Skip to content

Commit

Permalink
Dynamically find number of blood splat lumps
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Jan 9, 2025
1 parent 422bfc5 commit 3a537da
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/p_mobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,7 @@ void P_SpawnBloodSplat(const fixed_t x, const fixed_t y, const int color, const

if (splat)
{
const int patch = firstbloodsplatlump + (M_BigRandom() & (BLOODSPLATLUMPS - 1));
const int patch = firstbloodsplatlump + (M_BigRandom() & (numbloodsplatlumps - 1));

splat->patch = firstspritelump + patch;
splat->color = color;
Expand Down
1 change: 0 additions & 1 deletion src/p_mobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#define REDBLOODSPLATCOLOR 184
#define GREENBLOODSPLATCOLOR 122

#define BLOODSPLATLUMPS 12
#define CORPSEBLOODSPLATS 512

// killough 11/98:
Expand Down
4 changes: 2 additions & 2 deletions src/p_saveg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1401,8 +1401,8 @@ void P_UnarchiveThinkers(void)

if (r_bloodsplats_total < r_bloodsplats_max)
{
if (splat->patch < firstbloodsplatlump || splat->patch >= firstbloodsplatlump + BLOODSPLATLUMPS)
splat->patch = firstbloodsplatlump + (M_BigRandom() & (BLOODSPLATLUMPS - 1));
if (splat->patch < firstbloodsplatlump || splat->patch >= firstbloodsplatlump + numbloodsplatlumps)
splat->patch = firstbloodsplatlump + (M_BigRandom() & (numbloodsplatlumps - 1));

splat->width = spritewidth[splat->patch];
splat->patch += firstspritelump;
Expand Down
2 changes: 2 additions & 0 deletions src/r_things.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ static int clipbot[MAXWIDTH];
spritedef_t *sprites;

short firstbloodsplatlump;
int numbloodsplatlumps;

bool allowwolfensteinss = true;

Expand Down Expand Up @@ -322,6 +323,7 @@ static void R_InitSpriteDefs(void)
free(hash); // free hash table

firstbloodsplatlump = sprites[SPR_BLD2].spriteframes[0].lump[0];
numbloodsplatlumps = sprites[SPR_BLD2].numframes;

// check if Wolfenstein SS sprites have been changed to zombiemen sprites
if (bfgedition && gamemode == commercial)
Expand Down
1 change: 1 addition & 0 deletions src/r_things.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ extern fixed_t pspritescale;
extern fixed_t pspriteiscale;

extern short firstbloodsplatlump;
extern int numbloodsplatlumps;

extern bool allowwolfensteinss;

Expand Down

0 comments on commit 3a537da

Please sign in to comment.