From: sparky4 Date: Tue, 24 Jan 2017 21:21:06 +0000 (-0600) Subject: animation fixed and sprite rendering is more flexible with overdraww and overdrawh X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=d03215b6373268416dd879c8bb5b0b1f0c8e9309 animation fixed and sprite rendering is more flexible with overdraww and overdrawh --- diff --git a/data/spri/PRSBACW0.VRL b/data/spri/PRSBACW0.VRL new file mode 100755 index 00000000..2c93df94 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 index 00000000..fb3c7cf2 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 index 00000000..65fc4bf6 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 index 00000000..e2d1e1ff 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 index 00000000..6473a169 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 index 00000000..30f48d11 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 index 00000000..161753b4 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 index 00000000..fba1dc95 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 index 00000000..7872c41a 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 index 00000000..b0a21ae5 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 index 00000000..8c7267c5 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 index 00000000..354fd6eb Binary files /dev/null and b/data/spri/PRSBRCW2.VRL differ diff --git a/data/spri/ptmp.sht b/data/spri/ptmp.sht index 8d9e5761..0b2d3f96 100755 --- a/data/spri/ptmp.sht +++ b/data/spri/ptmp.sht @@ -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" + diff --git a/data/spri/ptmp.vrs b/data/spri/ptmp.vrs index 3bff7ff6..996844b8 100755 Binary files a/data/spri/ptmp.vrs and b/data/spri/ptmp.vrs differ diff --git a/src/lib/16_enti.c b/src/lib/16_enti.c index a6b42b67..d0a3de51 100755 --- a/src/lib/16_enti.c +++ b/src/lib/16_enti.c @@ -37,6 +37,8 @@ void EN_initentity(entity_t *enti) enti->spt=(TILEWH/(enti->speed)); //speed per tile wwww enti->invq=1; enti->pred = enti->d; + enti->overdraww=0; + enti->overdrawh=4; } //init player! diff --git a/src/lib/16_sprit.c b/src/lib/16_sprit.c index f797f23b..189c3cf4 100755 --- a/src/lib/16_sprit.c +++ b/src/lib/16_sprit.c @@ -103,8 +103,7 @@ void animate_spri(entity_t *enti, video_t *video) #define VMEMPAGEDATA2 GVARVIDEO->page[2].data unsigned int i,o,o2; int j; int x,y,rx,ry,w,h; - int overdraww = 0, overdrawh = 4; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks. - // if the sprite's edge pixels are clear anyway, you can set this to 0. + VGA_RAM_PTR omemptr; // Depending on delay, update indices @@ -159,12 +158,12 @@ void animate_spri(entity_t *enti, video_t *video) // render box bounds. y does not need modification, but x and width must be multiple of 4 if(!GVARVIDEO->rss){ - if (x >= overdraww) rx = (x - overdraww) & (~3); + if (x >= enti->overdraww) rx = (x - enti->overdraww) & (~3); else rx = -(GVARVIDEO->page[0].dx); - if (y >= overdrawh) ry = (y - overdrawh); + if (y >= enti->overdrawh) ry = (y - enti->overdrawh); else ry = -(GVARVIDEO->page[0].dy); - h = enti->spri->sprite_vrl_cont->vrl_header->height + overdrawh + y - ry; - w = (x + enti->spri->sprite_vrl_cont->vrl_header->width + (overdraww*2) + 3 - rx) & (~3) - overdraww;//round up + h = enti->spri->sprite_vrl_cont->vrl_header->height + enti->overdrawh + y - ry; + w = (x + enti->spri->sprite_vrl_cont->vrl_header->width + (enti->overdraww*2) + 3 - rx) & (~3) - enti->overdraww;//round up if ((rx+w) > GVARVIDEO->page[0].width) w = GVARVIDEO->page[0].width-rx; if ((ry+h) > GVARVIDEO->page[0].height) h = GVARVIDEO->page[0].height-ry; diff --git a/src/lib/16_tdef.h b/src/lib/16_tdef.h index d45433ac..9ddb4581 100755 --- a/src/lib/16_tdef.h +++ b/src/lib/16_tdef.h @@ -146,6 +146,8 @@ typedef struct word spt; //speed per tile struct sprite *spri; // sprite used by entity sword hp; //hitpoints of the entity + nibble overdraww, overdrawh; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks. + // if the sprite's edge pixels are clear anyway, you can set this to 0. int persist_aniframe; // gonna be increased to 1 before being used, so 0 is ok for default } entity_t; diff --git a/src/zcroll.c b/src/zcroll.c index 1f5200da..147555b8 100755 --- a/src/zcroll.c +++ b/src/zcroll.c @@ -43,6 +43,8 @@ byte *gpal; byte *ptr; memptr pal; +bitmap_t *ptmpdata; + void main(int argc, char *argv[]) { static global_game_variables_t gvar; @@ -202,6 +204,8 @@ void main(int argc, char *argv[]) } FUNCTIONKEYFUNCTIONS; if(IN_KeyDown(sc_L)){ modexClearRegion(&gvar.video.page[0], player[0].enti.x, player[0].enti.y, 16, 16, 1); } + 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); } + 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); } //9 #ifdef FADE