From 908560f9aaefed9e9ad55ed09ab69c38826568b9 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Tue, 19 May 2015 22:01:44 +0000 Subject: [PATCH] SW: picanm_t git-svn-id: https://svn.eduke32.com/eduke32@5203 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/sw/src/cache.c | 16 ++++++++-------- polymer/eduke32/source/sw/src/game.c | 6 +++--- polymer/eduke32/source/sw/src/game.h | 16 +++++----------- polymer/eduke32/source/sw/src/sprite.c | 26 +++++++++++++------------- 4 files changed, 29 insertions(+), 35 deletions(-) diff --git a/polymer/eduke32/source/sw/src/cache.c b/polymer/eduke32/source/sw/src/cache.c index c8c1908ef..26f496b76 100644 --- a/polymer/eduke32/source/sw/src/cache.c +++ b/polymer/eduke32/source/sw/src/cache.c @@ -662,9 +662,9 @@ precache(void) SET(gotpic[j>>3], 1<<(j&7)); - if (TEST(picanm[j],TILE_ANIM_TYPE)) + if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT) { - for (i = 1; i <= TEST(picanm[j],TILE_ANIM_NUM); i++) + for (i = 1; i <= picanm[j].num; i++) { SET(gotpic[(j+i)>>3], 1<<((j+i)&7)); } @@ -674,9 +674,9 @@ precache(void) SET(gotpic[j>>3], 1<<(j&7)); - if (TEST(picanm[j],TILE_ANIM_TYPE)) + if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT) { - for (i = 1; i <= TEST(picanm[j],TILE_ANIM_NUM); i++) + for (i = 1; i <= picanm[j].num; i++) { SET(gotpic[(j+i)>>3], 1<<((j+i)&7)); } @@ -690,9 +690,9 @@ precache(void) SET(gotpic[j>>3], 1<<(j&7)); - if (TEST(picanm[j],TILE_ANIM_TYPE)) + if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT) { - for (i = 1; i <= TEST(picanm[j],TILE_ANIM_NUM); i++) + for (i = 1; i <= picanm[j].num; i++) { SET(gotpic[(j+i)>>3], 1<<((j+i)&7)); } @@ -703,9 +703,9 @@ precache(void) j = wp->overpicnum; SET(gotpic[j>>3], 1<<(j&7)); - if (TEST(picanm[j],TILE_ANIM_TYPE)) + if (TEST(picanm[j].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT) { - for (i = 1; i <= TEST(picanm[j],TILE_ANIM_NUM); i++) + for (i = 1; i <= picanm[j].num; i++) { SET(gotpic[(j+i)>>3], 1<<((j+i)&7)); } diff --git a/polymer/eduke32/source/sw/src/game.c b/polymer/eduke32/source/sw/src/game.c index 1607ae5b2..68d0dbc9c 100644 --- a/polymer/eduke32/source/sw/src/game.c +++ b/polymer/eduke32/source/sw/src/game.c @@ -5719,7 +5719,7 @@ SHOWSPRITE: x1 = sprx; y1 = spry; tilenum = spr->picnum; - xoff = (int)((signed char)((picanm[tilenum] >> 8) & 255)) + ((int) spr->xoffset); + xoff = (int)picanm[tilenum].xofs + (int)spr->xoffset; if ((spr->cstat & 4) > 0) xoff = -xoff; k = spr->ang; @@ -5751,8 +5751,8 @@ SHOWSPRITE: if (dimensionmode == 5) { tilenum = spr->picnum; - xoff = (int)((signed char)((picanm[tilenum] >> 8) & 255)) + ((int) spr->xoffset); - yoff = (int)((signed char)((picanm[tilenum] >> 16) & 255)) + ((int) spr->yoffset); + xoff = (int)picanm[tilenum].xofs + (int)spr->xoffset; + yoff = (int)picanm[tilenum].yofs + (int)spr->yoffset; if ((spr->cstat & 4) > 0) xoff = -xoff; if ((spr->cstat & 8) > 0) diff --git a/polymer/eduke32/source/sw/src/game.h b/polymer/eduke32/source/sw/src/game.h index 829369857..5e9a478af 100644 --- a/polymer/eduke32/source/sw/src/game.h +++ b/polymer/eduke32/source/sw/src/game.h @@ -125,7 +125,7 @@ int krand1(void); // Map directions/degrees // -#if FALSE +#if 0 y-- ^ 1536 | @@ -453,12 +453,12 @@ int StdRandomRange(int range); // x & y offset of tile -#define TILE_XOFF(picnum) ((int8_t)TEST(picanm[(picnum)] >> 8, 0xFF)) -#define TILE_YOFF(picnum) ((int8_t)TEST(picanm[(picnum)] >> 16, 0xFF)) +#define TILE_XOFF(picnum) (picanm[(picnum)].xofs) +#define TILE_YOFF(picnum) (picanm[(picnum)].yofs) // x & y offset of current sprite tile -#define SPRITEp_XOFF(sp) ((int8_t)TEST(picanm[(sp)->picnum] >> 8, 0xFF)) -#define SPRITEp_YOFF(sp) ((int8_t)TEST(picanm[(sp)->picnum] >> 16, 0xFF)) +#define SPRITEp_XOFF(sp) (picanm[(sp)->picnum].xofs) +#define SPRITEp_YOFF(sp) (picanm[(sp)->picnum].yofs) // Z size of top (TOS) and bottom (BOS) part of sprite #define SPRITEp_SIZE_TOS(sp) (DIV2(SPRITEp_SIZE_Z(sp)) + Z(SPRITEp_YOFF(sp))) @@ -681,12 +681,6 @@ int StdRandomRange(int range); ) - -// break up of picanm[] -#define TILE_ANIM_NUM (0xF|BIT(4)|BIT(5)) -#define TILE_ANIM_TYPE (BIT(6)|BIT(7)) -#define TILE_SPEED (0xF << 20) - #define SIZ(array) (sizeof(array)/sizeof(array[0])) diff --git a/polymer/eduke32/source/sw/src/sprite.c b/polymer/eduke32/source/sw/src/sprite.c index 96964a717..bafe68bf3 100644 --- a/polymer/eduke32/source/sw/src/sprite.c +++ b/polymer/eduke32/source/sw/src/sprite.c @@ -963,7 +963,7 @@ void PicAnimOff(short picnum) { int i; - short anim_type = TEST(picanm[picnum], TILE_ANIM_TYPE); + short anim_type = TEST(picanm[picnum].sf, PICANM_ANIMTYPE_MASK) >> PICANM_ANIMTYPE_SHIFT; short num; ASSERT(picnum >= 0 && picnum < MAXTILES); @@ -972,16 +972,16 @@ PicAnimOff(short picnum) return; /* - num = TEST(picanm[picnum], TILE_ANIM_NUM); + num = picanm[picnum].num; ASSERT(num < 20); for (i = 0; i < num; i++) { - RESET(picanm[picnum + i], TILE_ANIM_TYPE); + RESET(picanm[picnum + i].sf, PICANM_ANIMTYPE_MASK); } */ - RESET(picanm[picnum], TILE_ANIM_TYPE); + RESET(picanm[picnum].sf, PICANM_ANIMTYPE_MASK); } SWBOOL @@ -3126,8 +3126,8 @@ KeyMain: ChangeState(SpriteNum, s_Key[num]); - RESET(picanm[sp->picnum], TILE_ANIM_TYPE); - RESET(picanm[sp->picnum + 1], TILE_ANIM_TYPE); + RESET(picanm[sp->picnum].sf, PICANM_ANIMTYPE_MASK); + RESET(picanm[sp->picnum + 1].sf, PICANM_ANIMTYPE_MASK); change_sprite_stat(SpriteNum, STAT_ITEM); RESET(sp->cstat, CSTAT_SPRITE_BLOCK | CSTAT_SPRITE_BLOCK_HITSCAN); u->Radius = 500; @@ -3161,8 +3161,8 @@ KeyStatueMain: u->spal = sp->pal; ChangeState(SpriteNum, s_KeyStatue[num]); - RESET(picanm[sp->picnum], TILE_ANIM_TYPE); - RESET(picanm[sp->picnum + 1], TILE_ANIM_TYPE); + RESET(picanm[sp->picnum].sf, PICANM_ANIMTYPE_MASK); + RESET(picanm[sp->picnum + 1].sf, PICANM_ANIMTYPE_MASK); change_sprite_stat(SpriteNum, STAT_ITEM); @@ -4595,8 +4595,8 @@ int SpawnItemsMatch(short match) ChangeState(SpriteNum, s_Key[num]); - RESET(picanm[sp->picnum], TILE_ANIM_TYPE); - RESET(picanm[sp->picnum + 1], TILE_ANIM_TYPE); + RESET(picanm[sp->picnum].sf, PICANM_ANIMTYPE_MASK); + RESET(picanm[sp->picnum + 1].sf, PICANM_ANIMTYPE_MASK); SetupItemForJump(sip, SpriteNum); @@ -4640,7 +4640,7 @@ NewStateGroup(short SpriteNum, STATEp StateGroup[]) // turn anims off because people keep setting them in the // art file - RESET(picanm[sprite[SpriteNum].picnum], TILE_ANIM_TYPE); + RESET(picanm[sprite[SpriteNum].picnum].sf, PICANM_ANIMTYPE_MASK); return 0; } @@ -4759,8 +4759,8 @@ getzrangepoint(int x, int y, int z, short sectnum, // Calculate and store centering offset information into xoff&yoff tilenum = spr->picnum; - xoff = (int)((signed char)((picanm[tilenum] >> 8) & 255)) + ((int) spr->xoffset); - yoff = (int)((signed char)((picanm[tilenum] >> 16) & 255)) + ((int) spr->yoffset); + xoff = (int)picanm[tilenum].xofs + (int)spr->xoffset; + yoff = (int)picanm[tilenum].yofs + (int)spr->yoffset; if (cstat & 4) xoff = -xoff; if (cstat & 8)