OSDN Git Service

animation fixed and sprite rendering is more flexible with overdraww and overdrawh
authorsparky4 <sparky4@cock.li>
Tue, 24 Jan 2017 21:21:06 +0000 (15:21 -0600)
committersparky4 <sparky4@cock.li>
Tue, 24 Jan 2017 21:21:06 +0000 (15:21 -0600)
18 files changed:
data/spri/PRSBACW0.VRL [new file with mode: 0755]
data/spri/PRSBACW1.VRL [new file with mode: 0755]
data/spri/PRSBACW2.VRL [new file with mode: 0755]
data/spri/PRSBFCW0.VRL [new file with mode: 0755]
data/spri/PRSBFCW1.VRL [new file with mode: 0755]
data/spri/PRSBFCW2.VRL [new file with mode: 0755]
data/spri/PRSBLCW0.VRL [new file with mode: 0755]
data/spri/PRSBLCW1.VRL [new file with mode: 0755]
data/spri/PRSBLCW2.VRL [new file with mode: 0755]
data/spri/PRSBRCW0.VRL [new file with mode: 0755]
data/spri/PRSBRCW1.VRL [new file with mode: 0755]
data/spri/PRSBRCW2.VRL [new file with mode: 0755]
data/spri/ptmp.sht
data/spri/ptmp.vrs
src/lib/16_enti.c
src/lib/16_sprit.c
src/lib/16_tdef.h
src/zcroll.c

diff --git a/data/spri/PRSBACW0.VRL b/data/spri/PRSBACW0.VRL
new file mode 100755 (executable)
index 0000000..2c93df9
Binary files /dev/null and b/data/spri/PRSBACW0.VRL differ
diff --git a/data/spri/PRSBACW1.VRL b/data/spri/PRSBACW1.VRL
new file mode 100755 (executable)
index 0000000..fb3c7cf
Binary files /dev/null and b/data/spri/PRSBACW1.VRL differ
diff --git a/data/spri/PRSBACW2.VRL b/data/spri/PRSBACW2.VRL
new file mode 100755 (executable)
index 0000000..65fc4bf
Binary files /dev/null and b/data/spri/PRSBACW2.VRL differ
diff --git a/data/spri/PRSBFCW0.VRL b/data/spri/PRSBFCW0.VRL
new file mode 100755 (executable)
index 0000000..e2d1e1f
Binary files /dev/null and b/data/spri/PRSBFCW0.VRL differ
diff --git a/data/spri/PRSBFCW1.VRL b/data/spri/PRSBFCW1.VRL
new file mode 100755 (executable)
index 0000000..6473a16
Binary files /dev/null and b/data/spri/PRSBFCW1.VRL differ
diff --git a/data/spri/PRSBFCW2.VRL b/data/spri/PRSBFCW2.VRL
new file mode 100755 (executable)
index 0000000..30f48d1
Binary files /dev/null and b/data/spri/PRSBFCW2.VRL differ
diff --git a/data/spri/PRSBLCW0.VRL b/data/spri/PRSBLCW0.VRL
new file mode 100755 (executable)
index 0000000..161753b
Binary files /dev/null and b/data/spri/PRSBLCW0.VRL differ
diff --git a/data/spri/PRSBLCW1.VRL b/data/spri/PRSBLCW1.VRL
new file mode 100755 (executable)
index 0000000..fba1dc9
Binary files /dev/null and b/data/spri/PRSBLCW1.VRL differ
diff --git a/data/spri/PRSBLCW2.VRL b/data/spri/PRSBLCW2.VRL
new file mode 100755 (executable)
index 0000000..7872c41
Binary files /dev/null and b/data/spri/PRSBLCW2.VRL differ
diff --git a/data/spri/PRSBRCW0.VRL b/data/spri/PRSBRCW0.VRL
new file mode 100755 (executable)
index 0000000..b0a21ae
Binary files /dev/null and b/data/spri/PRSBRCW0.VRL differ
diff --git a/data/spri/PRSBRCW1.VRL b/data/spri/PRSBRCW1.VRL
new file mode 100755 (executable)
index 0000000..8c7267c
Binary files /dev/null and b/data/spri/PRSBRCW1.VRL differ
diff --git a/data/spri/PRSBRCW2.VRL b/data/spri/PRSBRCW2.VRL
new file mode 100755 (executable)
index 0000000..354fd6e
Binary files /dev/null and b/data/spri/PRSBRCW2.VRL differ
index 8d9e576..0b2d3f9 100755 (executable)
@@ -71,3 +71,83 @@ wh=24,32
 +PRSBACW2@42
 xy=48,96
 wh=24,32
+
+# begin animation list section. must come after sprite sheet
+*animation
+
+# Chikyuu, forward, standing and walking animation cycles
++PRSBFCW_STANDING@10
+sprite=PRSBFCW1
+
++PRSBFCW_WALKING@11
+sprite=PRSBFCW0
+delay=3
+-newframe
+sprite=PRSBFCW1
+delay=3
+event=@100         # in this example, signal the game engine the frame is one that can immediately transition to "standing"
+-newframe
+sprite=PRSBFCW2
+delay=3
+-newframe
+sprite=PRSBFCW1
+delay=3
+event=@100         # in this example, signal the game engine the frame is one that can immediately transition to "standing"
+
+# Chikyuu, left, standing and walking animation cycles
++PRSBLCW_STANDING@20
+sprite=PRSBLCW1
+
++PRSBLCW_WALKING@21
+sprite=PRSBLCW0
+delay=3
+-newframe
+sprite=PRSBLCW1
+delay=3
+event=@100         # in this example, signal the game engine the frame is one that can immediately transition to "standing"
+-newframe
+sprite=PRSBLCW2
+delay=3
+-newframe
+sprite=PRSBLCW1
+delay=3
+event=@100         # in this example, signal the game engine the frame is one that can immediately transition to "standing"
+
+# Chikyuu, right, standing and walking animation cycles
++PRSBRCW_STANDING@30
+sprite=PRSBRCW1
+
++PRSBRCW_WALKING@31
+sprite=PRSBRCW0
+delay=3
+-newframe
+sprite=PRSBRCW1
+delay=3
+event=@100         # in this example, signal the game engine the frame is one that can immediately transition to "standing"
+-newframe
+sprite=PRSBRCW2
+delay=3
+-newframe
+sprite=PRSBRCW1
+delay=3
+event=@100         # in this example, signal the game engine the frame is one that can immediately transition to "standing"
+
+# Chikyuu, away, standing and walking animation cycles
++PRSBACW_STANDING@40
+sprite=PRSBACW1
+
++PRSBACW_WALKING@41
+sprite=PRSBACW0
+delay=3
+-newframe
+sprite=PRSBACW1
+delay=3
+event=@100         # in this example, signal the game engine the frame is one that can immediately transition to "standing"
+-newframe
+sprite=PRSBACW2
+delay=3
+-newframe
+sprite=PRSBACW1
+delay=3
+event=@100         # in this example, signal the game engine the frame is one that can immediately transition to "standing"
+
index 3bff7ff..996844b 100755 (executable)
Binary files a/data/spri/ptmp.vrs and b/data/spri/ptmp.vrs differ
index a6b42b6..d0a3de5 100755 (executable)
@@ -37,6 +37,8 @@ void EN_initentity(entity_t *enti)
        enti->spt=(TILEWH/(enti->speed));       //speed per tile wwww\r
        enti->invq=1;\r
        enti->pred = enti->d;\r
+       enti->overdraww=0;\r
+       enti->overdrawh=4;\r
 }\r
 \r
 //init player!\r
index f797f23..189c3cf 100755 (executable)
@@ -103,8 +103,7 @@ void animate_spri(entity_t *enti, video_t *video)
 #define VMEMPAGEDATA2  GVARVIDEO->page[2].data\r
        unsigned int i,o,o2; int j;\r
        int x,y,rx,ry,w,h;\r
-       int overdraww = 0, overdrawh = 4;       // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks.\r
-                                               // if the sprite's edge pixels are clear anyway, you can set this to 0.\r
+\r
        VGA_RAM_PTR omemptr;\r
 \r
        // Depending on delay, update indices\r
@@ -159,12 +158,12 @@ void animate_spri(entity_t *enti, video_t *video)
 \r
        // render box bounds. y does not need modification, but x and width must be multiple of 4\r
        if(!GVARVIDEO->rss){\r
-       if (x >= overdraww) rx = (x - overdraww) & (~3);\r
+       if (x >= enti->overdraww) rx = (x - enti->overdraww) & (~3);\r
                else rx = -(GVARVIDEO->page[0].dx);\r
-       if (y >= overdrawh) ry = (y - overdrawh);\r
+       if (y >= enti->overdrawh) ry = (y - enti->overdrawh);\r
                else ry = -(GVARVIDEO->page[0].dy);\r
-       h = enti->spri->sprite_vrl_cont->vrl_header->height + overdrawh + y - ry;\r
-       w = (x + enti->spri->sprite_vrl_cont->vrl_header->width + (overdraww*2) + 3 - rx) & (~3) - overdraww;//round up\r
+       h = enti->spri->sprite_vrl_cont->vrl_header->height + enti->overdrawh + y - ry;\r
+       w = (x + enti->spri->sprite_vrl_cont->vrl_header->width + (enti->overdraww*2) + 3 - rx) & (~3) - enti->overdraww;//round up\r
        if ((rx+w) > GVARVIDEO->page[0].width) w = GVARVIDEO->page[0].width-rx;\r
        if ((ry+h) > GVARVIDEO->page[0].height) h = GVARVIDEO->page[0].height-ry;\r
 \r
index d45433a..9ddb458 100755 (executable)
@@ -146,6 +146,8 @@ typedef     struct
        word spt;               //speed per tile\r
        struct sprite *spri; // sprite used by entity\r
        sword hp; //hitpoints of the entity\r
+       nibble overdraww, overdrawh;    // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks.\r
+                                               // if the sprite's edge pixels are clear anyway, you can set this to 0.\r
        int persist_aniframe;    // gonna be increased to 1 before being used, so 0 is ok for default\r
 } entity_t;\r
 \r
index 1f5200d..147555b 100755 (executable)
@@ -43,6 +43,8 @@ byte *gpal;
 byte *ptr;\r
 memptr pal;\r
 \r
+bitmap_t       *ptmpdata;\r
+\r
 void main(int argc, char *argv[])\r
 {\r
        static global_game_variables_t gvar;\r
@@ -202,6 +204,8 @@ void main(int argc, char *argv[])
                }\r
                FUNCTIONKEYFUNCTIONS;\r
                if(IN_KeyDown(sc_L)){ modexClearRegion(&gvar.video.page[0], player[0].enti.x, player[0].enti.y, 16, 16, 1); }\r
+               if(IN_KeyDown(sc_J)){ read_vrs(&gvar, "data/spri/ptmp.vrs", player[0].enti.spri->spritesheet);  *ptmpdata = bitmapLoadPcx("data/ptmp.pcx", &gvar);      modexPalUpdate1(ptmpdata->palette); }\r
+               if(IN_KeyDown(sc_K)){ read_vrs(&gvar, "data/spri/chikyuu.vrs", player[0].enti.spri->spritesheet);       PCXBMP = bitmapLoadPcx("data/chikyuu.pcx", &gvar);      modexPalUpdate1(&PCXBMP->palette); }\r
 \r
                //9\r
 #ifdef FADE\r