Skip to content

Commit

Permalink
Use bitmap macros for voxreserve and voxrotate
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendricks266 committed Aug 28, 2023
1 parent 211bf56 commit 4e823c7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion source/blood/src/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int tileInit(char a1, const char *a2)
for (int i = 0; i < kMaxTiles; i++)
{
if (voxelIndex[i] >= 0 && voxelIndex[i] < kMaxVoxels)
SetBitString((char*)voxreserve, voxelIndex[i]);
bitmap_set(voxreserve, voxelIndex[i]);
}

artLoaded = 1;
Expand Down
2 changes: 1 addition & 1 deletion source/blood/src/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2677,7 +2677,7 @@ void viewProcessSprites(int32_t cX, int32_t cY, int32_t cZ, int32_t cA, int32_t

int const nVoxel = tiletovox[pTSprite->picnum];

if (nVoxel != -1 && ((voxrotate[nVoxel>>3]&pow2char[nVoxel&7]) != 0 || (picanm[nRootTile].extra&7) == 7))
if (nVoxel != -1 && (bitmap_test(voxrotate, nVoxel) || (picanm[nRootTile].extra&7) == 7))
pTSprite->ang = (pTSprite->ang+((int)totalclock<<3))&2047;
}

Expand Down
4 changes: 2 additions & 2 deletions source/build/include/build.h
Original file line number Diff line number Diff line change
Expand Up @@ -1628,8 +1628,8 @@ extern GrowArray<char *> g_clipMapFiles;

EXTERN int32_t nextvoxid;
EXTERN intptr_t voxoff[MAXVOXELS][MAXVOXMIPS]; // used in KenBuild
EXTERN int8_t voxreserve[(MAXVOXELS+7)>>3];
EXTERN int8_t voxrotate[(MAXVOXELS+7)>>3];
EXTERN int8_t voxreserve[bitmap_size(MAXVOXELS)];
EXTERN int8_t voxrotate[bitmap_size(MAXVOXELS)];

#ifdef USE_OPENGL
// TODO: dynamically allocate this
Expand Down
4 changes: 2 additions & 2 deletions source/build/src/defs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ static int32_t defsparser(scriptfile *script)
break; //voxel filename

// begin downstream
while (nextvoxid < MAXVOXELS && (voxreserve[nextvoxid>>3]&(1<<(nextvoxid&7))))
while (nextvoxid < MAXVOXELS && bitmap_test(voxreserve, nextvoxid))
nextvoxid++;
// end downstream

Expand Down Expand Up @@ -1961,7 +1961,7 @@ static int32_t defsparser(scriptfile *script)
if (scriptfile_getbraces(script,&voxelend)) break;

// begin downstream
while (nextvoxid < MAXVOXELS && (voxreserve[nextvoxid>>3]&(1<<(nextvoxid&7))))
while (nextvoxid < MAXVOXELS && bitmap_test(voxreserve, nextvoxid))
nextvoxid++;
// end downstream

Expand Down
2 changes: 1 addition & 1 deletion source/build/src/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12252,7 +12252,7 @@ void vox_undefine(int32_t const tile)
voxlock[voxindex][j] = CACHE1D_FREE;
voxoff[voxindex][j] = 0;
}
voxrotate[voxindex>>3] &= ~pow2char[voxindex&7];
bitmap_clear(voxrotate, voxindex);
voxscale[voxindex] = 65536;
voxflags[voxindex] = 0;
tiletovox[tile] = -1;
Expand Down
2 changes: 1 addition & 1 deletion source/exhumed/src/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static void analyzesprites()
int const nRootTile = pTSprite->picnum;
int const nVoxel = tiletovox[pTSprite->picnum];

if (nVoxel != -1 && ((voxrotate[nVoxel >> 3] & pow2char[nVoxel & 7]) != 0 || (picanm[nRootTile].extra & 7) == 7))
if (nVoxel != -1 && (bitmap_test(voxrotate, nVoxel) || (picanm[nRootTile].extra & 7) == 7))
pTSprite->ang = (pTSprite->ang + ((int)totalclock << 3)) & kAngleMask;

if (pTSprite->picnum == 736) // invincibility sprite needs to always face player
Expand Down

0 comments on commit 4e823c7

Please sign in to comment.