From 53998c9cb79f0799599a95e4455119c947df3546 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 16 Nov 2021 18:26:14 +0100 Subject: [PATCH] - Blood: remove unneeded replacement functions. changespritesect is the only one called from the engine. --- source/build/include/build.h | 3 --- source/build/src/engine.cpp | 9 --------- source/games/blood/src/db.cpp | 15 --------------- source/games/blood/src/db.h | 3 --- source/games/blood/src/replace.cpp | 6 ------ 5 files changed, 36 deletions(-) diff --git a/source/build/include/build.h b/source/build/include/build.h index 120ecfebd..9d57bec97 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -687,10 +687,7 @@ extern int32_t rintersect(int32_t x1, int32_t y1, int32_t z1, extern int32_t(*animateoffs_replace)(int const tilenum, int fakevar); extern void(*initspritelists_replace)(void); -extern int32_t(*insertsprite_replace)(int16_t sectnum, int16_t statnum); -extern int32_t(*deletesprite_replace)(int16_t spritenum); extern int32_t(*changespritesect_replace)(int16_t spritenum, int16_t newsectnum); -extern int32_t(*changespritestat_replace)(int16_t spritenum, int16_t newstatnum); // Masking these into the object index to keep it in 16 bit was probably the single most dumbest and pointless thing Build ever did. // Gonna be fun to globally replace these to finally lift the limit this imposes on map size. diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index bcb0cc719..7e10c0eac 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -314,11 +314,8 @@ static void do_deletespritestat(int16_t deleteme) // // insertsprite // -int32_t(*insertsprite_replace)(int16_t sectnum, int16_t statnum) = NULL; int32_t insertsprite(int16_t sectnum, int16_t statnum) { - if (insertsprite_replace) - return insertsprite_replace(sectnum, statnum); // TODO: guard against bad sectnum? int32_t const newspritenum = insertspritestat(statnum); @@ -338,12 +335,9 @@ int32_t insertsprite(int16_t sectnum, int16_t statnum) // // deletesprite // -int32_t (*deletesprite_replace)(int16_t spritenum) = NULL; int32_t deletesprite(int16_t spritenum) { Polymost::polymost_deletesprite(spritenum); - if (deletesprite_replace) - return deletesprite_replace(spritenum); assert((sprite[spritenum].statnum == MAXSTATUS) == (sprite[spritenum].sectnum == MAXSECTORS)); @@ -401,11 +395,8 @@ int32_t changespritesect(int16_t spritenum, int16_t newsectnum) // // changespritestat // -int32_t (*changespritestat_replace)(int16_t spritenum, int16_t newstatnum) = NULL; int32_t changespritestat(int16_t spritenum, int16_t newstatnum) { - if (changespritestat_replace) - return changespritestat_replace(spritenum, newstatnum); // XXX: NOTE: MAXSTATUS is allowed if ((newstatnum < 0 || newstatnum > MAXSTATUS) || (sprite[spritenum].statnum == MAXSTATUS)) return -1; // can't set the statnum of a sprite not in the world diff --git a/source/games/blood/src/db.cpp b/source/games/blood/src/db.cpp index 1e882d9cc..f72381f2d 100644 --- a/source/games/blood/src/db.cpp +++ b/source/games/blood/src/db.cpp @@ -203,11 +203,6 @@ int InsertSprite(int nSector, int nStat) return nSprite; } -int qinsertsprite(short nSector, short nStat) // Replace -{ - return InsertSprite(nSector, nStat); -} - int DeleteSprite(int nSprite) { FVector3 pos = GetSoundPos(&sprite[nSprite].pos); @@ -230,11 +225,6 @@ int DeleteSprite(int nSprite) return nSprite; } -int qdeletesprite(short nSprite) // Replace -{ - return DeleteSprite(nSprite); -} - int ChangeSpriteSect(int nSprite, int nSector) { assert(nSprite >= 0 && nSprite < kMaxSprites); @@ -261,11 +251,6 @@ int ChangeSpriteStat(int nSprite, int nStatus) return 0; } -int qchangespritestat(short nSprite, short nStatus) -{ - return ChangeSpriteStat(nSprite, nStatus); -} - void InitFreeList(unsigned short *pList, int nCount) { for (int i = 1; i < nCount; i++) diff --git a/source/games/blood/src/db.h b/source/games/blood/src/db.h index c06ec4cbf..df05e9646 100644 --- a/source/games/blood/src/db.h +++ b/source/games/blood/src/db.h @@ -354,13 +354,10 @@ void InsertSpriteStat(int nSprite, int nStat); void RemoveSpriteStat(int nSprite); void qinitspritelists(void); int InsertSprite(int nSector, int nStat); -int qinsertsprite(short nSector, short nStat); int DeleteSprite(int nSprite); -int qdeletesprite(short nSprite); int ChangeSpriteSect(int nSprite, int nSector); int qchangespritesect(short nSprite, short nSector); int ChangeSpriteStat(int nSprite, int nStatus); -int qchangespritestat(short nSprite, short nStatus); void InitFreeList(unsigned short *pList, int nCount); void InitFreeList(unsigned short* pList, int nCount, FixedBitArray& activeXSprites); void InsertFree(unsigned short *pList, int nIndex); diff --git a/source/games/blood/src/replace.cpp b/source/games/blood/src/replace.cpp index 9ef9e82e5..710a14282 100644 --- a/source/games/blood/src/replace.cpp +++ b/source/games/blood/src/replace.cpp @@ -63,19 +63,13 @@ int qanimateoffs(int a1, int a2) } void qinitspritelists(); -int32_t qinsertsprite(int16_t nSector, int16_t nStat); -int32_t qdeletesprite(int16_t nSprite); int32_t qchangespritesect(int16_t nSprite, int16_t nSector); -int32_t qchangespritestat(int16_t nSprite, int16_t nStatus); void HookReplaceFunctions(void) { animateoffs_replace = qanimateoffs; initspritelists_replace = qinitspritelists; - insertsprite_replace = qinsertsprite; - deletesprite_replace = qdeletesprite; changespritesect_replace = qchangespritesect; - changespritestat_replace = qchangespritestat; } END_BLD_NS