From 4aa06ff70221e145ca326a4713e4e29eddca7eab Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 21 Nov 2020 16:34:32 +0100 Subject: [PATCH] - use a static table for SEQ callbacks. This ensures that callback indices are consistent. Runtime registration as performed by NBlood has undefined order and will make savegames non-transferrable. --- source/blood/src/actor.cpp | 15 ---- source/blood/src/aibat.cpp | 4 +- source/blood/src/aibeast.cpp | 9 +-- source/blood/src/aiboneel.cpp | 4 +- source/blood/src/aiburn.cpp | 5 +- source/blood/src/aicaleb.cpp | 5 +- source/blood/src/aicerber.cpp | 12 +-- source/blood/src/aicult.cpp | 25 ++---- source/blood/src/aigarg.cpp | 17 +--- source/blood/src/aighost.cpp | 12 +-- source/blood/src/aigilbst.cpp | 4 +- source/blood/src/aihand.cpp | 5 +- source/blood/src/aihound.cpp | 9 +-- source/blood/src/aipod.cpp | 17 +--- source/blood/src/airat.cpp | 5 +- source/blood/src/aispid.cpp | 12 +-- source/blood/src/aitchern.cpp | 12 +-- source/blood/src/aiunicult.cpp | 19 ++--- source/blood/src/aizomba.cpp | 8 +- source/blood/src/aizombf.cpp | 12 +-- source/blood/src/common_game.h | 1 + source/blood/src/player.cpp | 4 - source/blood/src/seq.cpp | 71 ++++++++++++++--- source/blood/src/seqcb.h | 127 ++++++++++++++++++++++++++++++ source/blood/src/triggers.cpp | 9 --- source/core/textures/buildtiles.h | 1 + 26 files changed, 238 insertions(+), 186 deletions(-) create mode 100644 source/blood/src/seqcb.h diff --git a/source/blood/src/actor.cpp b/source/blood/src/actor.cpp index 000fcbfc9..aa9540c66 100644 --- a/source/blood/src/actor.cpp +++ b/source/blood/src/actor.cpp @@ -2343,21 +2343,6 @@ static const short gPlayerGibThingComments[] = { 734, 735, 736, 737, 738, 739, 740, 741, 3038, 3049 }; -void FireballSeqCallback(int, int); -void sub_38938(int, int); -void NapalmSeqCallback(int, int); -void sub_3888C(int, int); -void TreeToGibCallback(int, int); -void DudeToGibCallback1(int, int); -void DudeToGibCallback2(int, int); - -const int nFireballClient = seqRegisterClient(FireballSeqCallback); -const int dword_2192D8 = seqRegisterClient(sub_38938); // fireball smoke -const int nNapalmClient = seqRegisterClient(NapalmSeqCallback); -const int dword_2192E0 = seqRegisterClient(sub_3888C); // flame lick -const int nTreeToGibClient = seqRegisterClient(TreeToGibCallback); -const int nDudeToGibClient1 = seqRegisterClient(DudeToGibCallback1); -const int nDudeToGibClient2 = seqRegisterClient(DudeToGibCallback2); int gPostCount = 0; diff --git a/source/blood/src/aibat.cpp b/source/blood/src/aibat.cpp index 5d23d2b9f..9a652c64a 100644 --- a/source/blood/src/aibat.cpp +++ b/source/blood/src/aibat.cpp @@ -39,7 +39,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void batBiteSeqCallback(int, int); static void batThinkTarget(spritetype *, XSPRITE *); static void batThinkSearch(spritetype *, XSPRITE *); static void batThinkGoto(spritetype *, XSPRITE *); @@ -52,7 +51,6 @@ static void batMoveSwoop(spritetype *, XSPRITE *); static void batMoveFly(spritetype *, XSPRITE *); static void batMoveToCeil(spritetype *, XSPRITE *); -static int nBatBiteClient = seqRegisterClient(batBiteSeqCallback); AISTATE batIdle = {kAiStateIdle, 0, -1, 0, NULL, NULL, batThinkTarget, NULL }; AISTATE batFlyIdle = {kAiStateIdle, 6, -1, 0, NULL, NULL, batThinkTarget, NULL }; @@ -73,7 +71,7 @@ AISTATE batDodgeDown = {kAiStateMove, 6, -1, 120, NULL, batMoveDodgeDown, 0, &ba AISTATE batDodgeDownRight = {kAiStateMove, 6, -1, 90, NULL, batMoveDodgeDown, 0, &batChase }; AISTATE batDodgeDownLeft = {kAiStateMove, 6, -1, 90, NULL, batMoveDodgeDown, 0, &batChase }; -static void batBiteSeqCallback(int, int nXSprite) +void batBiteSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; spritetype *pSprite = &sprite[pXSprite->reference]; diff --git a/source/blood/src/aibeast.cpp b/source/blood/src/aibeast.cpp index 180148be6..6e78f56fe 100644 --- a/source/blood/src/aibeast.cpp +++ b/source/blood/src/aibeast.cpp @@ -41,8 +41,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void SlashSeqCallback(int, int); -static void StompSeqCallback(int, int); static void MorphToBeast(spritetype *, XSPRITE *); static void beastThinkSearch(spritetype *, XSPRITE *); static void beastThinkGoto(spritetype *, XSPRITE *); @@ -54,9 +52,6 @@ static void sub_628A0(spritetype *, XSPRITE *); static void sub_62AE0(spritetype *, XSPRITE *); static void sub_62D7C(spritetype *, XSPRITE *); -static int nSlashClient = seqRegisterClient(SlashSeqCallback); -static int nStompClient = seqRegisterClient(StompSeqCallback); - AISTATE beastIdle = {kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE beastChase = {kAiStateChase, 8, -1, 0, NULL, beastMoveForward, beastThinkChase, NULL }; AISTATE beastDodge = { kAiStateMove, 8, -1, 60, NULL, aiMoveDodge, NULL, &beastChase }; @@ -79,7 +74,7 @@ AISTATE beast138FB4 = { kAiStateOther, 9, -1, 120, NULL, sub_62AE0, beastThinkSw AISTATE beast138FD0 = { kAiStateOther, 9, -1, 0, NULL, sub_62D7C, beastThinkSwimChase, &beastSwimChase }; AISTATE beast138FEC = { kAiStateOther, 9, -1, 120, NULL, aiMoveTurn, NULL, &beastSwimChase }; -static void SlashSeqCallback(int, int nXSprite) +void SlashSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -97,7 +92,7 @@ static void SlashSeqCallback(int, int nXSprite) sfxPlay3DSound(pSprite, 9012+Random(2), -1, 0); } -static void StompSeqCallback(int, int nXSprite) +void StompSeqCallback(int, int nXSprite) { uint8_t vb8[(kMaxSectors+7)>>3]; XSPRITE *pXSprite = &xsprite[nXSprite]; diff --git a/source/blood/src/aiboneel.cpp b/source/blood/src/aiboneel.cpp index be404748e..e4b1a246b 100644 --- a/source/blood/src/aiboneel.cpp +++ b/source/blood/src/aiboneel.cpp @@ -40,7 +40,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void eelBiteSeqCallback(int, int); static void eelThinkTarget(spritetype *, XSPRITE *); static void eelThinkSearch(spritetype *, XSPRITE *); static void eelThinkGoto(spritetype *, XSPRITE *); @@ -53,7 +52,6 @@ static void eelMoveSwoop(spritetype *, XSPRITE *); static void eelMoveAscend(spritetype *pSprite, XSPRITE *pXSprite); static void eelMoveToCeil(spritetype *, XSPRITE *); -static int nEelBiteClient = seqRegisterClient(eelBiteSeqCallback); AISTATE eelIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, eelThinkTarget, NULL }; AISTATE eelFlyIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, eelThinkTarget, NULL }; @@ -74,7 +72,7 @@ AISTATE eelDodgeDown = { kAiStateMove, 0, -1, 120, NULL, eelMoveDodgeDown, NULL, AISTATE eelDodgeDownRight = { kAiStateMove, 0, -1, 90, NULL, eelMoveDodgeDown, NULL, &eelChase }; AISTATE eelDodgeDownLeft = { kAiStateMove, 0, -1, 90, NULL, eelMoveDodgeDown, NULL, &eelChase }; -static void eelBiteSeqCallback(int, int nXSprite) +void eelBiteSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; spritetype *pSprite = &sprite[pXSprite->reference]; diff --git a/source/blood/src/aiburn.cpp b/source/blood/src/aiburn.cpp index a87c034fc..d1269dc3d 100644 --- a/source/blood/src/aiburn.cpp +++ b/source/blood/src/aiburn.cpp @@ -43,13 +43,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void BurnSeqCallback(int, int); static void burnThinkSearch(spritetype*, XSPRITE*); static void burnThinkGoto(spritetype*, XSPRITE*); static void burnThinkChase(spritetype*, XSPRITE*); -static int nBurnClient = seqRegisterClient(BurnSeqCallback); - AISTATE cultistBurnIdle = { kAiStateIdle, 3, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE cultistBurnChase = { kAiStateChase, 3, -1, 0, NULL, aiMoveForward, burnThinkChase, NULL }; AISTATE cultistBurnGoto = { kAiStateMove, 3, -1, 3600, NULL, aiMoveForward, burnThinkGoto, &cultistBurnSearch }; @@ -87,7 +84,7 @@ AISTATE genDudeBurnGoto = { kAiStateMove, 3, -1, 3600, NULL, aiMoveForward, burn AISTATE genDudeBurnSearch = { kAiStateSearch, 3, -1, 3600, NULL, aiMoveForward, burnThinkSearch, &genDudeBurnSearch }; AISTATE genDudeBurnAttack = { kAiStateChase, 3, nBurnClient, 120, NULL, NULL, NULL, &genDudeBurnChase }; -static void BurnSeqCallback(int, int) +void BurnSeqCallback(int, int) { } diff --git a/source/blood/src/aicaleb.cpp b/source/blood/src/aicaleb.cpp index d9b0059f8..33b2d98b6 100644 --- a/source/blood/src/aicaleb.cpp +++ b/source/blood/src/aicaleb.cpp @@ -41,7 +41,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void SeqAttackCallback(int, int); static void calebThinkSearch(spritetype *, XSPRITE *); static void calebThinkGoto(spritetype *, XSPRITE *); static void calebThinkChase(spritetype *, XSPRITE *); @@ -51,8 +50,6 @@ static void sub_65D04(spritetype *, XSPRITE *); static void sub_65F44(spritetype *, XSPRITE *); static void sub_661E0(spritetype *, XSPRITE *); -static int nAttackClient = seqRegisterClient(SeqAttackCallback); - AISTATE tinycalebIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE tinycalebChase = { kAiStateChase, 6, -1, 0, NULL, aiMoveForward, calebThinkChase, NULL }; AISTATE tinycalebDodge = { kAiStateMove, 6, -1, 90, NULL, aiMoveDodge, NULL, &tinycalebChase }; @@ -72,7 +69,7 @@ AISTATE tinycaleb139660 = { kAiStateOther, 8, -1, 120, NULL, sub_65F44, calebThi AISTATE tinycaleb13967C = { kAiStateOther, 8, -1, 0, NULL, sub_661E0, calebThinkSwimChase, &tinycalebSwimChase }; AISTATE tinycaleb139698 = { kAiStateOther, 8, -1, 120, NULL, aiMoveTurn, NULL, &tinycalebSwimChase }; -static void SeqAttackCallback(int, int nXSprite) +void SeqAttackCallback(int, int nXSprite) { int nSprite = xsprite[nXSprite].reference; spritetype *pSprite = &sprite[nSprite]; diff --git a/source/blood/src/aicerber.cpp b/source/blood/src/aicerber.cpp index 99394d1f3..f4658e638 100644 --- a/source/blood/src/aicerber.cpp +++ b/source/blood/src/aicerber.cpp @@ -41,17 +41,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void cerberusBiteSeqCallback(int, int); -static void cerberusBurnSeqCallback(int, int); -static void cerberusBurnSeqCallback2(int, int); static void cerberusThinkSearch(spritetype *pSprite, XSPRITE *pXSprite); static void cerberusThinkTarget(spritetype *pSprite, XSPRITE *pXSprite); static void cerberusThinkGoto(spritetype *pSprite, XSPRITE *pXSprite); static void cerberusThinkChase(spritetype *pSprite, XSPRITE *pXSprite); -static int nCerberusBiteClient = seqRegisterClient(cerberusBiteSeqCallback); -static int nCerberusBurnClient = seqRegisterClient(cerberusBurnSeqCallback); -static int nCerberusBurnClient2 = seqRegisterClient(cerberusBurnSeqCallback2); AISTATE cerberusIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, cerberusThinkTarget, NULL }; AISTATE cerberusSearch = { kAiStateSearch, 7, -1, 1800, NULL, aiMoveForward, cerberusThinkSearch, &cerberusIdle }; @@ -73,7 +67,7 @@ AISTATE cerberus4Burn = { kAiStateChase, 6, nCerberusBurnClient2, 60, NULL, NULL AISTATE cerberus139890 = { kAiStateOther, 7, -1, 120, NULL, aiMoveTurn, NULL, &cerberusChase }; AISTATE cerberus1398AC = { kAiStateOther, 7, -1, 120, NULL, aiMoveTurn, NULL, &cerberusChase }; -static void cerberusBiteSeqCallback(int, int nXSprite) +void cerberusBiteSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -97,7 +91,7 @@ static void cerberusBiteSeqCallback(int, int nXSprite) actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_14); } -static void cerberusBurnSeqCallback(int, int nXSprite) +void cerberusBurnSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -180,7 +174,7 @@ static void cerberusBurnSeqCallback(int, int nXSprite) } } -static void cerberusBurnSeqCallback2(int, int nXSprite) +void cerberusBurnSeqCallback2(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/aicult.cpp b/source/blood/src/aicult.cpp index 4dfc70f80..41fc43e7d 100644 --- a/source/blood/src/aicult.cpp +++ b/source/blood/src/aicult.cpp @@ -43,23 +43,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void TommySeqCallback(int, int); -static void TeslaSeqCallback(int, int); -static void ShotSeqCallback(int, int); -static void cultThrowSeqCallback(int, int); -static void sub_68170(int, int); -static void sub_68230(int, int); static void cultThinkSearch(spritetype *, XSPRITE *); static void cultThinkGoto(spritetype *, XSPRITE *); static void cultThinkChase(spritetype *, XSPRITE *); -static int nTommyClient = seqRegisterClient(TommySeqCallback); -static int nTeslaClient = seqRegisterClient(TeslaSeqCallback); -static int nShotClient = seqRegisterClient(ShotSeqCallback); -static int nThrowClient = seqRegisterClient(cultThrowSeqCallback); -static int n68170Client = seqRegisterClient(sub_68170); -static int n68230Client = seqRegisterClient(sub_68230); - AISTATE cultistIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE cultistProneIdle = { kAiStateIdle, 17, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE fanaticProneIdle = { kAiStateIdle, 17, -1, 0, NULL, NULL, aiThinkTarget, NULL }; @@ -99,7 +86,7 @@ AISTATE cultistTSwimFire = { kAiStateChase, 8, nTommyClient, 0, NULL, aiMoveTurn AISTATE cultistTsSwimFire = { kAiStateChase, 8, nTeslaClient, 0, NULL, aiMoveTurn, cultThinkChase, &cultistTsSwimFire }; AISTATE cultistSwimRecoil = { kAiStateRecoil, 5, -1, 0, NULL, NULL, NULL, &cultistSwimDodge }; -static void TommySeqCallback(int, int nXSprite) +void TommySeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -114,7 +101,7 @@ static void TommySeqCallback(int, int nXSprite) sfxPlay3DSound(pSprite, 4001, -1, 0); } -static void TeslaSeqCallback(int, int nXSprite) +void TeslaSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -132,7 +119,7 @@ static void TeslaSeqCallback(int, int nXSprite) } } -static void ShotSeqCallback(int, int nXSprite) +void ShotSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -156,7 +143,7 @@ static void ShotSeqCallback(int, int nXSprite) sfxPlay3DSound(pSprite, 1002, -1, 0); } -static void cultThrowSeqCallback(int, int nXSprite) +void cultThrowSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -183,7 +170,7 @@ static void cultThrowSeqCallback(int, int nXSprite) evPost(pMissile->index, 3, 120*(1+Random(2)), kCmdOn); } -static void sub_68170(int, int nXSprite) +void sub_68170(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -196,7 +183,7 @@ static void sub_68170(int, int nXSprite) evPost(pMissile->index, 3, 120*(2+Random(2)), kCmdOn); } -static void sub_68230(int, int nXSprite) +void sub_68230(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/aigarg.cpp b/source/blood/src/aigarg.cpp index e30693a33..de31531a3 100644 --- a/source/blood/src/aigarg.cpp +++ b/source/blood/src/aigarg.cpp @@ -44,10 +44,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void SlashFSeqCallback(int, int); -static void ThrowFSeqCallback(int, int); -static void BlastSSeqCallback(int, int); -static void ThrowSSeqCallback(int, int); static void gargThinkTarget(spritetype *, XSPRITE *); static void gargThinkSearch(spritetype *, XSPRITE *); static void gargThinkGoto(spritetype *, XSPRITE *); @@ -62,11 +58,6 @@ static void gargMoveSwoop(spritetype *, XSPRITE *); static void gargMoveFly(spritetype *, XSPRITE *); static void playStatueBreakSnd(spritetype*,XSPRITE*); -static int nSlashFClient = seqRegisterClient(SlashFSeqCallback); -static int nThrowFClient = seqRegisterClient(ThrowFSeqCallback); -static int nThrowSClient = seqRegisterClient(ThrowSSeqCallback); -static int nBlastSClient = seqRegisterClient(BlastSSeqCallback); - AISTATE gargoyleFIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, gargThinkTarget, NULL }; AISTATE gargoyleStatueIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, NULL, NULL }; AISTATE gargoyleFChase = { kAiStateChase, 0, -1, 0, NULL, gargMoveForward, gargThinkChase, &gargoyleFIdle }; @@ -99,7 +90,7 @@ static void playStatueBreakSnd(spritetype* pSprite, XSPRITE* pXSprite) { aiPlay3DSound(pSprite, 313, AI_SFX_PRIORITY_1, -1); } -static void SlashFSeqCallback(int, int nXSprite) +void SlashFSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -121,14 +112,14 @@ static void SlashFSeqCallback(int, int nXSprite) actFireVector(pSprite, 0, 0, dx-r2, dy+r1, dz, VECTOR_TYPE_13); } -static void ThrowFSeqCallback(int, int nXSprite) +void ThrowFSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; actFireThing(&sprite[nSprite], 0, 0, gDudeSlope[nXSprite]-7500, kThingBone, 0xeeeee); } -static void BlastSSeqCallback(int, int nXSprite) +void BlastSSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -223,7 +214,7 @@ static void BlastSSeqCallback(int, int nXSprite) } -static void ThrowSSeqCallback(int, int nXSprite) +void ThrowSSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/aighost.cpp b/source/blood/src/aighost.cpp index 7b1d4f96c..1bdf4cc05 100644 --- a/source/blood/src/aighost.cpp +++ b/source/blood/src/aighost.cpp @@ -44,9 +44,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void ghostSlashSeqCallback(int, int); -static void ghostThrowSeqCallback(int, int); -static void ghostBlastSeqCallback(int, int); static void ghostThinkTarget(spritetype *, XSPRITE *); static void ghostThinkSearch(spritetype *, XSPRITE *); static void ghostThinkGoto(spritetype *, XSPRITE *); @@ -58,9 +55,6 @@ static void ghostMoveSlow(spritetype *, XSPRITE *); static void ghostMoveSwoop(spritetype *, XSPRITE *); static void ghostMoveFly(spritetype *, XSPRITE *); -static int nGhostSlashClient = seqRegisterClient(ghostSlashSeqCallback); -static int nGhostThrowClient = seqRegisterClient(ghostThrowSeqCallback); -static int nGhostBlastClient = seqRegisterClient(ghostBlastSeqCallback); AISTATE ghostIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, ghostThinkTarget, NULL }; AISTATE ghostChase = { kAiStateChase, 0, -1, 0, NULL, ghostMoveForward, ghostThinkChase, &ghostIdle }; @@ -81,7 +75,7 @@ AISTATE ghostDodgeDown = { kAiStateMove, 0, -1, 120, NULL, ghostMoveDodgeDown, N AISTATE ghostDodgeDownRight = { kAiStateMove, 0, -1, 90, NULL, ghostMoveDodgeDown, NULL, &ghostChase }; AISTATE ghostDodgeDownLeft = { kAiStateMove, 0, -1, 90, NULL, ghostMoveDodgeDown, NULL, &ghostChase }; -static void ghostSlashSeqCallback(int, int nXSprite) +void ghostSlashSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -104,14 +98,14 @@ static void ghostSlashSeqCallback(int, int nXSprite) actFireVector(pSprite, 0, 0, dx-r2, dy+r1, dz, VECTOR_TYPE_12); } -static void ghostThrowSeqCallback(int, int nXSprite) +void ghostThrowSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; actFireThing(&sprite[nSprite], 0, 0, gDudeSlope[nXSprite]-7500, kThingBone, 0xeeeee); } -static void ghostBlastSeqCallback(int, int nXSprite) +void ghostBlastSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/aigilbst.cpp b/source/blood/src/aigilbst.cpp index c843dff1c..2f8ac6d7d 100644 --- a/source/blood/src/aigilbst.cpp +++ b/source/blood/src/aigilbst.cpp @@ -42,7 +42,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void GillBiteSeqCallback(int, int); static void gillThinkSearch(spritetype *, XSPRITE *); static void gillThinkGoto(spritetype *, XSPRITE *); static void gillThinkChase(spritetype *, XSPRITE *); @@ -52,7 +51,6 @@ static void sub_6CB00(spritetype *, XSPRITE *); static void sub_6CD74(spritetype *, XSPRITE *); static void sub_6D03C(spritetype *, XSPRITE *); -static int nGillBiteClient = seqRegisterClient(GillBiteSeqCallback); AISTATE gillBeastIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE gillBeastChase = { kAiStateChase, 9, -1, 0, NULL, aiMoveForward, gillThinkChase, NULL }; @@ -72,7 +70,7 @@ AISTATE gillBeast13A138 = { kAiStateOther, 10, -1, 120, NULL, sub_6CD74, gillThi AISTATE gillBeast13A154 = { kAiStateOther, 10, -1, 0, NULL, sub_6D03C, gillThinkSwimChase, &gillBeastSwimChase }; AISTATE gillBeast13A170 = { kAiStateOther, 10, -1, 120, NULL, NULL, aiMoveTurn, &gillBeastSwimChase }; -static void GillBiteSeqCallback(int, int nXSprite) +void GillBiteSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/aihand.cpp b/source/blood/src/aihand.cpp index 758f61f9a..8729b848e 100644 --- a/source/blood/src/aihand.cpp +++ b/source/blood/src/aihand.cpp @@ -42,13 +42,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void HandJumpSeqCallback(int, int); static void handThinkSearch(spritetype *, XSPRITE *); static void handThinkGoto(spritetype *, XSPRITE *); static void handThinkChase(spritetype *, XSPRITE *); -static int nJumpClient = seqRegisterClient(HandJumpSeqCallback); - AISTATE handIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE hand13A3B4 = { kAiStateOther, 0, -1, 0, NULL, NULL, NULL, NULL }; AISTATE handSearch = { kAiStateMove, 6, -1, 600, NULL, aiMoveForward, handThinkSearch, &handIdle }; @@ -57,7 +54,7 @@ AISTATE handRecoil = { kAiStateRecoil, 5, -1, 0, NULL, NULL, NULL, &handSearch } AISTATE handGoto = { kAiStateMove, 6, -1, 1800, NULL, aiMoveForward, handThinkGoto, &handIdle }; AISTATE handJump = { kAiStateChase, 7, nJumpClient, 120, NULL, NULL, NULL, &handChase }; -static void HandJumpSeqCallback(int, int nXSprite) +void HandJumpSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/aihound.cpp b/source/blood/src/aihound.cpp index 419288307..46848ee50 100644 --- a/source/blood/src/aihound.cpp +++ b/source/blood/src/aihound.cpp @@ -44,15 +44,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void houndBiteSeqCallback(int, int); -static void houndBurnSeqCallback(int, int); static void houndThinkSearch(spritetype *, XSPRITE *); static void houndThinkGoto(spritetype *, XSPRITE *); static void houndThinkChase(spritetype *, XSPRITE *); -static int nHoundBiteClient = seqRegisterClient(houndBiteSeqCallback); -static int nHoundBurnClient = seqRegisterClient(houndBurnSeqCallback); - AISTATE houndIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE houndSearch = { kAiStateMove, 8, -1, 1800, NULL, aiMoveForward, houndThinkSearch, &houndIdle }; AISTATE houndChase = { kAiStateChase, 8, -1, 0, NULL, aiMoveForward, houndThinkChase, NULL }; @@ -62,7 +57,7 @@ AISTATE houndGoto = { kAiStateMove, 8, -1, 600, NULL, aiMoveForward, houndThinkG AISTATE houndBite = { kAiStateChase, 6, nHoundBiteClient, 60, NULL, NULL, NULL, &houndChase }; AISTATE houndBurn = { kAiStateChase, 7, nHoundBurnClient, 60, NULL, NULL, NULL, &houndChase }; -static void houndBiteSeqCallback(int, int nXSprite) +void houndBiteSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -90,7 +85,7 @@ static void houndBiteSeqCallback(int, int nXSprite) #endif } -static void houndBurnSeqCallback(int, int nXSprite) +void houndBurnSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/aipod.cpp b/source/blood/src/aipod.cpp index 1ca118547..27f0479a4 100644 --- a/source/blood/src/aipod.cpp +++ b/source/blood/src/aipod.cpp @@ -44,19 +44,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void sub_6FF08(int, int); -static void sub_6FF54(int, int); -static void sub_6FFA0(int, int); -static void sub_70284(int, int); static void sub_7034C(spritetype *, XSPRITE *); static void sub_70380(spritetype *, XSPRITE *); static void sub_704D8(spritetype *, XSPRITE *); -static int dword_279B34 = seqRegisterClient(sub_6FFA0); -static int dword_279B38 = seqRegisterClient(sub_70284); -static int dword_279B3C = seqRegisterClient(sub_6FF08); -static int dword_279B40 = seqRegisterClient(sub_6FF54); - AISTATE podIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE pod13A600 = { kAiStateMove, 7, -1, 3600, NULL, aiMoveTurn, sub_70380, &podSearch }; AISTATE podSearch = { kAiStateSearch, 0, -1, 3600, NULL, aiMoveTurn, sub_7034C, &podSearch }; @@ -74,21 +65,21 @@ AISTATE tentacle13A750 = { kAiStateOther, 6, dword_279B38, 120, NULL, NULL, NULL AISTATE tentacleRecoil = { kAiStateRecoil, 5, -1, 0, NULL, NULL, NULL, &tentacleChase }; AISTATE tentacleChase = { kAiStateChase, 6, -1, 0, NULL, aiMoveTurn, sub_704D8, NULL }; -static void sub_6FF08(int, int nXSprite) +void sub_6FF08(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; sfxPlay3DSound(&sprite[nSprite], 2503, -1, 0); } -static void sub_6FF54(int, int nXSprite) +void sub_6FF54(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; sfxPlay3DSound(&sprite[nSprite], 2500, -1, 0); } -static void sub_6FFA0(int, int nXSprite) +void sub_6FFA0(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -145,7 +136,7 @@ static void sub_6FFA0(int, int nXSprite) sub_746D4(pSprite, 240); } -static void sub_70284(int, int nXSprite) +void sub_70284(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/airat.cpp b/source/blood/src/airat.cpp index 766ed81df..4c232b053 100644 --- a/source/blood/src/airat.cpp +++ b/source/blood/src/airat.cpp @@ -42,13 +42,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void ratBiteSeqCallback(int, int); static void ratThinkSearch(spritetype *, XSPRITE *); static void ratThinkGoto(spritetype *, XSPRITE *); static void ratThinkChase(spritetype *, XSPRITE *); -static int nRatBiteClient = seqRegisterClient(ratBiteSeqCallback); - AISTATE ratIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE ratSearch = { kAiStateSearch, 7, -1, 1800, NULL, aiMoveForward, ratThinkSearch, &ratIdle }; AISTATE ratChase = { kAiStateChase, 7, -1, 0, NULL, aiMoveForward, ratThinkChase, NULL }; @@ -57,7 +54,7 @@ AISTATE ratRecoil = { kAiStateRecoil, 7, -1, 0, NULL, NULL, NULL, &ratDodge }; AISTATE ratGoto = { kAiStateMove, 7, -1, 600, NULL, aiMoveForward, ratThinkGoto, &ratIdle }; AISTATE ratBite = { kAiStateChase, 6, nRatBiteClient, 120, NULL, NULL, NULL, &ratChase }; -static void ratBiteSeqCallback(int, int nXSprite) +void ratBiteSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/aispid.cpp b/source/blood/src/aispid.cpp index f8f29318c..5e1814728 100644 --- a/source/blood/src/aispid.cpp +++ b/source/blood/src/aispid.cpp @@ -43,16 +43,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void SpidBiteSeqCallback(int, int); -static void SpidJumpSeqCallback(int, int); -static void sub_71370(int, int); static void spidThinkSearch(spritetype *, XSPRITE *); static void spidThinkGoto(spritetype *, XSPRITE *); static void spidThinkChase(spritetype *, XSPRITE *); -static int nSpidBiteClient = seqRegisterClient(SpidBiteSeqCallback); -static int nSpidJumpClient = seqRegisterClient(SpidJumpSeqCallback); -static int dword_279B50 = seqRegisterClient(sub_71370); AISTATE spidIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE spidChase = { kAiStateChase, 7, -1, 0, NULL, aiMoveForward, spidThinkChase, NULL }; @@ -85,7 +79,7 @@ static char sub_70D30(XSPRITE *pXDude, int a2, int a3) return 0; } -static void SpidBiteSeqCallback(int, int nXSprite) +void SpidBiteSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -135,7 +129,7 @@ static void SpidBiteSeqCallback(int, int nXSprite) } } -static void SpidJumpSeqCallback(int, int nXSprite) +void SpidJumpSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -162,7 +156,7 @@ static void SpidJumpSeqCallback(int, int nXSprite) } } -static void sub_71370(int, int nXSprite) +void sub_71370(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/aitchern.cpp b/source/blood/src/aitchern.cpp index f9a8d7359..5b6a71850 100644 --- a/source/blood/src/aitchern.cpp +++ b/source/blood/src/aitchern.cpp @@ -43,17 +43,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void sub_71A90(int, int); -static void sub_71BD4(int, int); -static void sub_720AC(int, int); static void sub_72580(spritetype *, XSPRITE *); static void sub_725A4(spritetype *, XSPRITE *); static void sub_72850(spritetype *, XSPRITE *); static void sub_72934(spritetype *, XSPRITE *); -static int dword_279B54 = seqRegisterClient(sub_71BD4); -static int dword_279B58 = seqRegisterClient(sub_720AC); -static int dword_279B5C = seqRegisterClient(sub_71A90); AISTATE tchernobogIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, sub_725A4, NULL }; AISTATE tchernobogSearch = { kAiStateSearch, 8, -1, 1800, NULL, aiMoveForward, sub_72580, &tchernobogIdle }; @@ -65,7 +59,7 @@ AISTATE tcherno13A9F0 = { kAiStateChase, 6, dword_279B58, 60, NULL, NULL, NULL, AISTATE tcherno13AA0C = { kAiStateChase, 7, dword_279B5C, 60, NULL, NULL, NULL, &tchernobogChase }; AISTATE tcherno13AA28 = { kAiStateChase, 8, -1, 60, NULL, aiMoveTurn, NULL, &tchernobogChase }; -static void sub_71A90(int, int nXSprite) +void sub_71A90(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -81,7 +75,7 @@ static void sub_71A90(int, int nXSprite) aiNewState(pSprite, pXSprite, &tcherno13A9D4); } -static void sub_71BD4(int, int nXSprite) +void sub_71BD4(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -157,7 +151,7 @@ static void sub_71BD4(int, int nXSprite) actFireMissile(pSprite, 350, 0, aim.dx, aim.dy, aim.dz, kMissileFireballTchernobog); } -static void sub_720AC(int, int nXSprite) +void sub_720AC(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/aiunicult.cpp b/source/blood/src/aiunicult.cpp index 735649d73..60abee088 100644 --- a/source/blood/src/aiunicult.cpp +++ b/source/blood/src/aiunicult.cpp @@ -54,21 +54,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "gib.h" BEGIN_BLD_NS -static void genDudeAttack1(int, int); -static void punchCallback(int, int); -static void ThrowCallback1(int, int); -static void ThrowCallback2(int, int); static void ThrowThing(int, bool); static void unicultThinkSearch(spritetype*, XSPRITE*); static void unicultThinkGoto(spritetype*, XSPRITE*); static void unicultThinkChase(spritetype*, XSPRITE*); static void forcePunch(spritetype*, XSPRITE*); -static int nGenDudeAttack1 = seqRegisterClient(genDudeAttack1); -static int nGenDudePunch = seqRegisterClient(punchCallback); -static int nGenDudeThrow1 = seqRegisterClient(ThrowCallback1); -static int nGenDudeThrow2 = seqRegisterClient(ThrowCallback2); - AISTATE genDudeIdleL = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE genDudeIdleW = { kAiStateIdle, 13, -1, 0, NULL, NULL, aiThinkTarget, NULL }; // --------------------- @@ -135,7 +126,7 @@ const GENDUDESND gCustomDudeSnd[] = { GENDUDEEXTRA gGenDudeExtra[kMaxSprites]; // savegame handling in ai.cpp -static void forcePunch(spritetype* pSprite, XSPRITE*) { +void forcePunch(spritetype* pSprite, XSPRITE*) { if (gGenDudeExtra[pSprite->index].forcePunch && seqGetStatus(3, pSprite->extra) == -1) punchCallback(0,pSprite->extra); } @@ -184,7 +175,7 @@ void genDudeUpdate(spritetype* pSprite) { } } -static void punchCallback(int, int nXIndex) { +void punchCallback(int, int nXIndex) { XSPRITE* pXSprite = &xsprite[nXIndex]; if (pXSprite->target != -1) { int nSprite = pXSprite->reference; @@ -208,7 +199,7 @@ static void punchCallback(int, int nXIndex) { } } -static void genDudeAttack1(int, int nXIndex) { +void genDudeAttack1(int, int nXIndex) { if (!(nXIndex >= 0 && nXIndex < kMaxXSprites)) { Printf(PRINT_HIGH, "nXIndex >= 0 && nXIndex < kMaxXSprites"); return; @@ -274,11 +265,11 @@ static void genDudeAttack1(int, int nXIndex) { } } -static void ThrowCallback1(int, int nXIndex) { +void ThrowCallback1(int, int nXIndex) { ThrowThing(nXIndex, true); } -static void ThrowCallback2(int, int nXIndex) { +void ThrowCallback2(int, int nXIndex) { ThrowThing(nXIndex, false); } diff --git a/source/blood/src/aizomba.cpp b/source/blood/src/aizomba.cpp index 11e51f696..3c6fb52a0 100644 --- a/source/blood/src/aizomba.cpp +++ b/source/blood/src/aizomba.cpp @@ -43,8 +43,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void HackSeqCallback(int, int); -static void StandSeqCallback(int, int); static void zombaThinkSearch(spritetype *, XSPRITE *); static void zombaThinkGoto(spritetype *, XSPRITE *); static void zombaThinkChase(spritetype *, XSPRITE *); @@ -55,8 +53,6 @@ static void entryEZombie(spritetype *, XSPRITE *); static void entryAIdle(spritetype *, XSPRITE *); static void entryEStand(spritetype *, XSPRITE *); -static int nHackClient = seqRegisterClient(HackSeqCallback); -static int nStandClient = seqRegisterClient(StandSeqCallback); AISTATE zombieAIdle = { kAiStateIdle, 0, -1, 0, entryAIdle, NULL, aiThinkTarget, NULL }; AISTATE zombieAChase = { kAiStateChase, 8, -1, 0, NULL, aiMoveForward, zombaThinkChase, NULL }; @@ -76,7 +72,7 @@ AISTATE zombie2Search = { kAiStateSearch, 8, -1, 1800, NULL, NULL, myThinkSearch AISTATE zombieSIdle = { kAiStateIdle, 10, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE zombie13AC2C = { kAiStateOther, 11, nStandClient, 0, entryEZombie, NULL, NULL, &zombieAPonder }; -static void HackSeqCallback(int, int nXSprite) +void HackSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -96,7 +92,7 @@ static void HackSeqCallback(int, int nXSprite) actFireVector(pSprite, 0, 0, dx, dy, dz, VECTOR_TYPE_10); } -static void StandSeqCallback(int, int nXSprite) +void StandSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/aizombf.cpp b/source/blood/src/aizombf.cpp index 380660619..b84b66452 100644 --- a/source/blood/src/aizombf.cpp +++ b/source/blood/src/aizombf.cpp @@ -42,16 +42,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS -static void zombfHackSeqCallback(int, int); -static void PukeSeqCallback(int, int); -static void ThrowSeqCallback(int, int); static void zombfThinkSearch(spritetype *pSprite, XSPRITE *pXSprite); static void zombfThinkGoto(spritetype *pSprite, XSPRITE *pXSprite); static void zombfThinkChase(spritetype *pSprite, XSPRITE *pXSprite); -static int nZombfHackClient = seqRegisterClient(zombfHackSeqCallback); -static int nZombfPukeClient = seqRegisterClient(PukeSeqCallback); -static int nZombfThrowClient = seqRegisterClient(ThrowSeqCallback); AISTATE zombieFIdle = { kAiStateIdle, 0, -1, 0, NULL, NULL, aiThinkTarget, NULL }; AISTATE zombieFChase = { kAiStateChase, 8, -1, 0, NULL, aiMoveForward, zombfThinkChase, NULL }; @@ -64,7 +58,7 @@ AISTATE zombieFSearch = { kAiStateSearch, 8, -1, 1800, NULL, aiMoveForward, zomb AISTATE zombieFRecoil = { kAiStateRecoil, 5, -1, 0, NULL, NULL, NULL, &zombieFChase }; AISTATE zombieFTeslaRecoil = { kAiStateRecoil, 4, -1, 0, NULL, NULL, NULL, &zombieFChase }; -static void zombfHackSeqCallback(int, int nXSprite) +void zombfHackSeqCallback(int, int nXSprite) { if (nXSprite <= 0 || nXSprite >= kMaxXSprites) return; @@ -83,7 +77,7 @@ static void zombfHackSeqCallback(int, int nXSprite) actFireVector(pSprite, 0, 0, CosScale16(pSprite->ang), SinScale16(pSprite->ang), height-height2, VECTOR_TYPE_11); } -static void PukeSeqCallback(int, int nXSprite) +void PukeSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; @@ -102,7 +96,7 @@ static void PukeSeqCallback(int, int nXSprite) actFireMissile(pSprite, 0, -(height-height2), dx, dy, 0, kMissilePukeGreen); } -static void ThrowSeqCallback(int, int nXSprite) +void ThrowSeqCallback(int, int nXSprite) { XSPRITE *pXSprite = &xsprite[nXSprite]; int nSprite = pXSprite->reference; diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index 5a52a73b1..bb0750123 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "printf.h" #include "v_text.h" #include "binaryangle.h" +#include "seqcb.h" BEGIN_BLD_NS diff --git a/source/blood/src/player.cpp b/source/blood/src/player.cpp index d024b2a0f..b5e1d3fd1 100644 --- a/source/blood/src/player.cpp +++ b/source/blood/src/player.cpp @@ -180,11 +180,7 @@ ARMORDATA armorData[5] = { { 0xc80, 0xc80, 0xc80, 0xc80, 0xc80, 0xc80 } }; -void PlayerSurvive(int, int); -void PlayerKneelsOver(int, int); -int nPlayerSurviveClient = seqRegisterClient(PlayerSurvive); -int nPlayerKneelClient = seqRegisterClient(PlayerKneelsOver); struct VICTORY { const char *TotalKills; diff --git a/source/blood/src/seq.cpp b/source/blood/src/seq.cpp index 00dc6c037..523e581a5 100644 --- a/source/blood/src/seq.cpp +++ b/source/blood/src/seq.cpp @@ -38,9 +38,71 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "actor.h" #include "view.h" #include "raze_sound.h" +#include "seqcb.h" BEGIN_BLD_NS +static void (*seqClientCallback[])(int, int) = { + FireballSeqCallback, + sub_38938, + NapalmSeqCallback, + sub_3888C, + TreeToGibCallback, + DudeToGibCallback1, + DudeToGibCallback2, + batBiteSeqCallback, + SlashSeqCallback, + StompSeqCallback, + eelBiteSeqCallback, + BurnSeqCallback, + SeqAttackCallback, + cerberusBiteSeqCallback, + cerberusBurnSeqCallback, + cerberusBurnSeqCallback2, + TommySeqCallback, + TeslaSeqCallback, + ShotSeqCallback, + cultThrowSeqCallback, + sub_68170, + sub_68230, + SlashFSeqCallback, + ThrowFSeqCallback, + ThrowSSeqCallback, + BlastSSeqCallback, + ghostSlashSeqCallback, + ghostThrowSeqCallback, + ghostBlastSeqCallback, + GillBiteSeqCallback, + HandJumpSeqCallback, + houndBiteSeqCallback, + houndBurnSeqCallback, + sub_6FFA0, + sub_70284, + sub_6FF08, + sub_6FF54, + ratBiteSeqCallback, + SpidBiteSeqCallback, + SpidJumpSeqCallback, + sub_71370, + sub_71BD4, + sub_720AC, + sub_71A90, + genDudeAttack1, + punchCallback, + ThrowCallback1, + ThrowCallback2, + HackSeqCallback, + StandSeqCallback, + zombfHackSeqCallback, + PukeSeqCallback, + ThrowSeqCallback, + PlayerSurvive, + PlayerKneelsOver, + FireballTrapSeqCallback, + MGunFireSeqCallback, + MGunOpenSeqCallback, +}; + enum { kMaxSeqClients = 256, @@ -49,15 +111,6 @@ enum static ACTIVE activeList[kMaxSequences]; static int seqActiveCount = 0; -static int nSeqClients = 0; -static void(*seqClientCallback[kMaxSeqClients])(int, int); - -int seqRegisterClient(void(*pClient)(int, int)) -{ - assert(nSeqClients < kMaxSeqClients); - seqClientCallback[nSeqClients] = pClient; - return nSeqClients++; -} void Seq::Preload(void) { diff --git a/source/blood/src/seqcb.h b/source/blood/src/seqcb.h new file mode 100644 index 000000000..3bf9d962a --- /dev/null +++ b/source/blood/src/seqcb.h @@ -0,0 +1,127 @@ +#pragma once + +BEGIN_BLD_NS + +void FireballSeqCallback(int, int); +void sub_38938(int, int); +void NapalmSeqCallback(int, int); +void sub_3888C(int, int); +void TreeToGibCallback(int, int); +void DudeToGibCallback1(int, int); +void DudeToGibCallback2(int, int); +void batBiteSeqCallback(int, int); +void SlashSeqCallback(int, int); +void StompSeqCallback(int, int); +void eelBiteSeqCallback(int, int); +void BurnSeqCallback(int, int); +void SeqAttackCallback(int, int); +void cerberusBiteSeqCallback(int, int); +void cerberusBurnSeqCallback(int, int); +void cerberusBurnSeqCallback2(int, int); +void TommySeqCallback(int, int); +void TeslaSeqCallback(int, int); +void ShotSeqCallback(int, int); +void cultThrowSeqCallback(int, int); +void sub_68170(int, int); +void sub_68230(int, int); +void SlashFSeqCallback(int, int); +void ThrowFSeqCallback(int, int); +void BlastSSeqCallback(int, int); +void ThrowSSeqCallback(int, int); +void ghostSlashSeqCallback(int, int); +void ghostThrowSeqCallback(int, int); +void ghostBlastSeqCallback(int, int); +void GillBiteSeqCallback(int, int); +void HandJumpSeqCallback(int, int); +void houndBiteSeqCallback(int, int); +void houndBurnSeqCallback(int, int); +void sub_6FF08(int, int); +void sub_6FF54(int, int); +void sub_6FFA0(int, int); +void sub_70284(int, int); +void ratBiteSeqCallback(int, int); +void SpidBiteSeqCallback(int, int); +void SpidJumpSeqCallback(int, int); +void sub_71370(int, int); +void sub_71A90(int, int); +void sub_71BD4(int, int); +void sub_720AC(int, int); +void genDudeAttack1(int, int); +void punchCallback(int, int); +void ThrowCallback1(int, int); +void ThrowCallback2(int, int); +void HackSeqCallback(int, int); +void StandSeqCallback(int, int); +void zombfHackSeqCallback(int, int); +void PukeSeqCallback(int, int); +void ThrowSeqCallback(int, int); +void PlayerSurvive(int, int); +void PlayerKneelsOver(int, int); +void FireballTrapSeqCallback(int, int); +void MGunFireSeqCallback(int, int); +void MGunOpenSeqCallback(int, int); + +enum +{ + nFireballClient, + dword_2192D8, + nNapalmClient, + dword_2192E0, + nTreeToGibClient, + nDudeToGibClient1, + nDudeToGibClient2, + nBatBiteClient, + nSlashClient, + nStompClient, + nEelBiteClient, + nBurnClient, + nAttackClient, + nCerberusBiteClient, + nCerberusBurnClient, + nCerberusBurnClient2, + nTommyClient, + nTeslaClient, + nShotClient, + nThrowClient, + n68170Client, + n68230Client, + nSlashFClient, + nThrowFClient, + nThrowSClient, + nBlastSClient, + nGhostSlashClient, + nGhostThrowClient, + nGhostBlastClient, + nGillBiteClient, + nJumpClient, + nHoundBiteClient, + nHoundBurnClient, + dword_279B34, + dword_279B38, + dword_279B3C, + dword_279B40, + nRatBiteClient, + nSpidBiteClient, + nSpidJumpClient, + dword_279B50, + dword_279B54, + dword_279B58, + dword_279B5C, + nGenDudeAttack1, + nGenDudePunch, + nGenDudeThrow1, + nGenDudeThrow2, + nHackClient, + nStandClient, + nZombfHackClient, + nZombfPukeClient, + nZombfThrowClient, + nPlayerSurviveClient, + nPlayerKneelClient, + nFireballTrapClient, + nMGunFireClient, + nMGunOpenClient, +}; + + +END_BLD_NS diff --git a/source/blood/src/triggers.cpp b/source/blood/src/triggers.cpp index 1f6b29108..8138aacbe 100644 --- a/source/blood/src/triggers.cpp +++ b/source/blood/src/triggers.cpp @@ -56,15 +56,6 @@ BEGIN_BLD_NS int basePath[kMaxSectors]; -void FireballTrapSeqCallback(int, int); -void MGunFireSeqCallback(int, int); -void MGunOpenSeqCallback(int, int); - -int nFireballTrapClient = seqRegisterClient(FireballTrapSeqCallback); -int nMGunFireClient = seqRegisterClient(MGunFireSeqCallback); -int nMGunOpenClient = seqRegisterClient(MGunOpenSeqCallback); - - unsigned int GetWaveValue(unsigned int nPhase, int nType) { diff --git a/source/core/textures/buildtiles.h b/source/core/textures/buildtiles.h index 72d89ff12..0e9941ae6 100644 --- a/source/core/textures/buildtiles.h +++ b/source/core/textures/buildtiles.h @@ -453,6 +453,7 @@ int32_t animateoffs(int const tilenum, int fakevar); inline FGameTexture* tileGetTexture(int tile, bool animate = false) { assert(tile < MAXTILES); + if (tile < 0 || tile >= MAXTILES) return nullptr; if (animate) { if (picanm[tile].sf & PICANM_ANIMTYPE_MASK)