From 033a73bce0f77414648bd1e95b99269c6b302ab3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 21 Nov 2021 20:13:19 +0100 Subject: [PATCH] - Exhumed short review, part 2. Down to 350. --- source/games/exhumed/src/aistuff.h | 76 ++++++++++++------------- source/games/exhumed/src/anims.cpp | 14 ++--- source/games/exhumed/src/anubis.cpp | 6 +- source/games/exhumed/src/bubbles.cpp | 2 +- source/games/exhumed/src/bullet.cpp | 18 +++--- source/games/exhumed/src/engine.h | 14 ++--- source/games/exhumed/src/exhumed.cpp | 47 +++++++-------- source/games/exhumed/src/exhumed.h | 34 +++++------ source/games/exhumed/src/exhumedactor.h | 20 +++---- source/games/exhumed/src/gun.cpp | 19 ++----- source/games/exhumed/src/init.cpp | 6 +- source/games/exhumed/src/items.cpp | 2 +- source/games/exhumed/src/light.cpp | 5 +- source/games/exhumed/src/lighting.cpp | 14 ++--- source/games/exhumed/src/map.cpp | 2 +- source/games/exhumed/src/object.cpp | 8 +-- source/games/exhumed/src/ra.cpp | 11 ++-- source/games/exhumed/src/runlist.cpp | 18 +++--- source/games/exhumed/src/sequence.cpp | 22 +++---- source/games/exhumed/src/sequence.h | 21 ++++--- source/games/exhumed/src/snake.cpp | 36 ++++++------ source/games/exhumed/src/trigdat.cpp | 2 +- source/games/exhumed/src/view.cpp | 2 +- 23 files changed, 187 insertions(+), 212 deletions(-) diff --git a/source/games/exhumed/src/aistuff.h b/source/games/exhumed/src/aistuff.h index 2cc17afe9..f11a176e9 100644 --- a/source/games/exhumed/src/aistuff.h +++ b/source/games/exhumed/src/aistuff.h @@ -66,7 +66,7 @@ struct bulletInfo extern bulletInfo BulletInfo[]; -extern short nRadialBullet; +extern int nRadialBullet; extern int lasthitsect; extern int lasthitz; extern int lasthitx; @@ -95,7 +95,6 @@ void FuncFishLimb(int a, int b, int c); enum { kMaxGrenades = 50 }; void BuildGrenade(int nPlayer); -void DestroyGrenade(short nGrenade); void ThrowGrenade(int nPlayer, int edx, int ebx, int ecx, int push1); void FuncGrenade(int, int, int, int); @@ -117,17 +116,16 @@ enum struct Weapon { - short nSeq; - short b[12]; // seq offsets? - short nAmmoType; - short c; - short d; // default or min ammo? or ammo used per 'shot' ? - short bFireUnderwater; -// short pad[15]; + int16_t nSeq; + int16_t b[12]; // seq offsets? + int16_t nAmmoType; + int16_t c; + int16_t d; // default or min ammo? or ammo used per 'shot' ? + int16_t bFireUnderwater; }; extern Weapon WeaponInfo[]; -extern short nTemperature[]; +extern int16_t nTemperature[]; void RestoreMinAmmo(int nPlayer); void FillWeapons(int nPlayer); @@ -155,7 +153,7 @@ enum kItemMask, }; -extern short nItemMagic[]; +extern const int16_t nItemMagic[]; void BuildItemAnim(DExhumedActor* nSprite); void ItemFlash(); @@ -177,7 +175,6 @@ void FuncLava(int, int, int, int); // lighting -extern short nFlashDepth; void InitLights(); void AddFlash(int nSector, int x, int y, int z, int val); @@ -189,7 +186,6 @@ void BuildFlash(int nPlayer, int nVal); void AddGlow(int nSector, int nVal); void AddFlicker(int nSector, int nVal); -extern short bTorch; // lion @@ -260,8 +256,10 @@ enum kStatus }; -extern short nSmokeSparks; -extern short nDronePitch; +extern int nFlashDepth; +extern int bTorch; +extern int nSmokeSparks; +extern int nDronePitch; extern int lFinaleStart; extern DExhumedActor* pFinaleSpr; @@ -294,7 +292,7 @@ void BuildDrip(DExhumedActor* nSprite); DExhumedActor* BuildEnergyBlock(int nSector); int BuildElevC(int arg1, int nChannel, int nSector, DExhumedActor* nWallSprite, int arg5, int arg6, int nCount, ...); int BuildElevF(int nChannel, int nSector, DExhumedActor* nWallSprite, int arg_4, int arg_5, int nCount, ...); -int BuildWallFace(short nChannel, int nWall, int nCount, ...); +int BuildWallFace(int nChannel, int nWall, int nCount, ...); int BuildSlide(int nChannel, int edx, int ebx, int ecx, int arg1, int arg2, int arg3); // queen @@ -312,11 +310,10 @@ struct RA DExhumedActor* pActor; DExhumedActor* pTarget; - short nAction; - short nFrame; - short nRun; - short field_A; - short field_C; + int16_t nAction; + int16_t nFrame; + int16_t nRun; + int16_t nState; int nPlayer; }; @@ -358,16 +355,16 @@ struct RunStruct int nAIType; // todo later: replace this with an AI pointer int nObjIndex; // If object is a non-actor / not refactored yet. DExhumedActor* pObjActor; // If object is an actor - short next; - short prev; + int next; + int prev; }; struct RunChannel { - short a; - short b; - short c; - short d; + int16_t a; + int16_t b; + int16_t c; + int16_t d; }; @@ -676,7 +673,7 @@ typedef void(*AiFunc)(int, int, int, int nRun); extern FreeListArray RunData; extern RunChannel sRunChannels[kMaxChannels]; -extern short NewRun; +extern int NewRun; void runlist_InitRun(); @@ -687,16 +684,16 @@ int runlist_AddRunRec(int index, DExhumedActor* object, int aitype); int runlist_AddRunRec(int index, RunStruct* other); int runlist_HeadRun(); void runlist_InitChan(); -void runlist_ChangeChannel(int eax, short dx); -void runlist_ReadyChannel(short eax); +void runlist_ChangeChannel(int eax, int dx); +void runlist_ReadyChannel(int eax); void runlist_ProcessSectorTag(int nSector, int nLotag, int nHitag); int runlist_AllocChannel(int a); void runlist_DoSubRunRec(int RunPtr); void runlist_SubRunRec(int RunPtr); -void runlist_ProcessWallTag(int nWall, short nLotag, short nHitag); +void runlist_ProcessWallTag(int nWall, int nLotag, int nHitag); int runlist_CheckRadialDamage(DExhumedActor* actor); -void runlist_RadialDamageEnemy(DExhumedActor* pActor, short nDamage, short nRadius); -void runlist_DamageEnemy(DExhumedActor* nSprite, DExhumedActor* nSprite2, short nDamage); +void runlist_RadialDamageEnemy(DExhumedActor* pActor, int nDamage, int nRadius); +void runlist_DamageEnemy(DExhumedActor* nSprite, DExhumedActor* nSprite2, int nDamage); void runlist_SignalRun(int NxtPtr, int edx, void(ExhumedAI::* func)(RunListEvent*), RunListEvent* ev = nullptr); void runlist_CleanRunRecs(); @@ -723,13 +720,12 @@ struct Snake DExhumedActor* pEnemy; // nRun DExhumedActor* pSprites[kSnakeSprites]; - short nCountdown; - short sC; - short nRun; + int16_t nCountdown; + int16_t nRun; uint8_t c[8]; - short sE; - short nSnakePlayer; + int16_t nAngle; + int16_t nSnakePlayer; }; enum { kMaxSnakes = 50 }; @@ -737,8 +733,8 @@ enum { kMaxSnakes = 50 }; extern FreeListArray SnakeList; void InitSnakes(); -short GrabSnake(); -void BuildSnake(int nPlayer, short zVal); +int GrabSnake(); +void BuildSnake(int nPlayer, int zVal); void FuncSnake(int, int, int, int); // spider diff --git a/source/games/exhumed/src/anims.cpp b/source/games/exhumed/src/anims.cpp index e037d3c77..f3dd61aff 100644 --- a/source/games/exhumed/src/anims.cpp +++ b/source/games/exhumed/src/anims.cpp @@ -25,9 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS -short nMagicSeq = -1; -short nPreMagicSeq = -1; -short nSavePointSeq = -1; +int nMagicSeq = -1; +int nPreMagicSeq = -1; +int nSavePointSeq = -1; //FreeListArray AnimList; @@ -126,10 +126,10 @@ void AIAnim::Tick(RunListEvent* ev) auto pActor = ev->pObjActor; if (!pActor) return; - short nIndex2 = pActor->nIndex2; + int nIndex2 = pActor->nIndex2; auto pSprite = &pActor->s(); - short nIndex = pActor->nIndex; + int nIndex = pActor->nIndex; if (!(pSprite->cstat & 0x8000)) { @@ -164,7 +164,7 @@ void AIAnim::Tick(RunListEvent* ev) { if (pSpriteB->cstat != 0x8000) { - short hitag2 = pSpriteB->hitag; + int hitag2 = pSpriteB->hitag; pSpriteB->hitag--; if (hitag2 >= 15) @@ -229,7 +229,7 @@ void AIAnim::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; if (!pActor) return; - short nIndex2 = pActor->nIndex2; + int nIndex2 = pActor->nIndex2; seq_PlotSequence(ev->nParam, nIndex2, pActor->nIndex, 0x101); ev->pTSprite->owner = -1; diff --git a/source/games/exhumed/src/anubis.cpp b/source/games/exhumed/src/anubis.cpp index ac6e354f0..a3179a8ab 100644 --- a/source/games/exhumed/src/anubis.cpp +++ b/source/games/exhumed/src/anubis.cpp @@ -123,7 +123,7 @@ void AIAnubis::Tick(RunListEvent* ev) Gravity(ap); } - short nSeq = SeqOffsets[kSeqAnubis] + AnubisSeq[nAction].a; + int nSeq = SeqOffsets[kSeqAnubis] + AnubisSeq[nAction].a; seq_MoveSequence(ap, nSeq, ap->nFrame); @@ -138,8 +138,8 @@ void AIAnubis::Tick(RunListEvent* ev) auto pTarget = ap->pTarget; - short nFrame = SeqBase[nSeq] + ap->nFrame; - short nFlag = FrameFlag[nFrame]; + int nFrame = SeqBase[nSeq] + ap->nFrame; + int nFlag = FrameFlag[nFrame]; Collision move(0); diff --git a/source/games/exhumed/src/bubbles.cpp b/source/games/exhumed/src/bubbles.cpp index 200015876..34f087926 100644 --- a/source/games/exhumed/src/bubbles.cpp +++ b/source/games/exhumed/src/bubbles.cpp @@ -80,7 +80,7 @@ void AIBubble::Tick(RunListEvent* ev) auto pActor = ev->pObjActor; if (!pActor) return; - short nSeq = pActor->nIndex; + int nSeq = pActor->nIndex; auto pSprite = &pActor->s(); seq_MoveSequence(pActor, nSeq, pActor->nFrame); diff --git a/source/games/exhumed/src/bullet.cpp b/source/games/exhumed/src/bullet.cpp index fcb00b968..23d603dc4 100644 --- a/source/games/exhumed/src/bullet.cpp +++ b/source/games/exhumed/src/bullet.cpp @@ -43,7 +43,7 @@ struct Bullet int16_t nRunRec2; int16_t nType; int16_t nPitch; - short field_E; + int16_t field_E; uint16_t field_10; uint8_t field_12; uint8_t nDoubleDamage; @@ -56,7 +56,7 @@ FreeListArray BulletList; int lasthitz, lasthitx, lasthity; int lasthitsect; -short nRadialBullet = 0; +int nRadialBullet = 0; FSerializer& Serialize(FSerializer& arc, const char* keyname, Bullet& w, Bullet* def) { @@ -164,7 +164,7 @@ void IgniteSprite(DExhumedActor* pActor) pAnimActor->pTarget = pActor; ChangeActorStat(pAnimActor, kStatIgnited); - short yRepeat = (tileHeight(pAnimActor->s().picnum) * 32) / nFlameHeight; + int yRepeat = (tileHeight(pAnimActor->s().picnum) * 32) / nFlameHeight; if (yRepeat < 1) yRepeat = 1; @@ -179,7 +179,7 @@ void BulletHitsSprite(Bullet *pBullet, DExhumedActor* pBulletActor, DExhumedActo bulletInfo *pBulletInfo = &BulletInfo[pBullet->nType]; auto pHitSprite = &pHitActor->s(); - short nStat = pHitSprite->statnum; + int nStat = pHitSprite->statnum; switch (pBullet->nType) { @@ -256,7 +256,7 @@ void BulletHitsSprite(Bullet *pBullet, DExhumedActor* pBulletActor, DExhumedActo } // BHS_switchBreak: - short nDamage = pBulletInfo->nDamage; + int nDamage = pBulletInfo->nDamage; if (pBullet->nDoubleDamage > 1) { nDamage *= 2; @@ -304,7 +304,7 @@ int MoveBullet(int nBullet) DExhumedActor* hitactor = nullptr; Bullet *pBullet = &BulletList[nBullet]; - short nType = pBullet->nType; + int nType = pBullet->nType; bulletInfo *pBulletInfo = &BulletInfo[nType]; auto pActor = BulletList[nBullet].pActor; @@ -313,7 +313,7 @@ int MoveBullet(int nBullet) int x = pSprite->x; int y = pSprite->y; int z = pSprite->z; // ebx - short nSectFlag = pSprite->sector()->Flag; + int nSectFlag = pSprite->sector()->Flag; int x2, y2, z2; @@ -412,7 +412,7 @@ MOVEEND: nVal = coll.type || coll.exbits? 1:0; // pSprite->sectnum may have changed since we set nSectFlag ? - short nFlagVal = nSectFlag ^ pSprite->sector()->Flag; + int nFlagVal = nSectFlag ^ pSprite->sector()->Flag; if (nFlagVal & kSectUnderwater) { DestroyBullet(nBullet); @@ -490,7 +490,7 @@ HITWALL: int nSector =wall[hitwall].nextsector; if (nSector > -1) { - short nDamage = BulletInfo[pBullet->nType].nDamage; + int nDamage = BulletInfo[pBullet->nType].nDamage; if (pBullet->nDoubleDamage > 1) { nDamage *= 2; } diff --git a/source/games/exhumed/src/engine.h b/source/games/exhumed/src/engine.h index 0549a4172..4fc1004a0 100644 --- a/source/games/exhumed/src/engine.h +++ b/source/games/exhumed/src/engine.h @@ -56,14 +56,14 @@ enum { extern int initx; extern int inity; extern int initz; -extern short inita; +extern int16_t inita; extern int initsect; -extern short nCurChunkNum; +extern int nCurChunkNum; extern DExhumedActor* nBodyGunSprite[50]; extern int movefifoend; extern int movefifopos; -extern short nCurBodyGunNum; +extern int nCurBodyGunNum; // all static counters combined in an array for easier maintenance. enum ECounter @@ -98,15 +98,13 @@ void FixPalette(); int HavePLURemap(); uint8_t RemapPLU(uint8_t pal); -extern short overscanindex; - extern char *origpalookup[]; -extern short nPalDiff; +extern int nPalDiff; // map -extern short bShowTowers; +extern bool bShowTowers; void GrabMap(); void UpdateMap(); @@ -130,7 +128,7 @@ int RandomSize(int nSize); int GetMyAngle(int x, int y); -int AngleDiff(short a, short b); +int AngleDiff(int a, int b); int AngleDelta(int a, int b, int c); END_PS_NS diff --git a/source/games/exhumed/src/exhumed.cpp b/source/games/exhumed/src/exhumed.cpp index 42a0ed50c..1482c6ca3 100644 --- a/source/games/exhumed/src/exhumed.cpp +++ b/source/games/exhumed/src/exhumed.cpp @@ -80,10 +80,9 @@ void GameInterface::loadPalette() LoadPaletteLookups(); } -void CopyTileToBitmap(short nSrcTile, short nDestTile, int xPos, int yPos); +void CopyTileToBitmap(int nSrcTile, int nDestTile, int xPos, int yPos); // void TestSaveLoad(); -void EraseScreen(int nVal); void LoadStatus(); void MySetView(int x1, int y1, int x2, int y2); @@ -93,53 +92,51 @@ int nFontFirstChar; int nBackgroundPic; int nShadowPic; -short nCreaturesKilled = 0, nCreaturesTotal = 0; +int nCreaturesKilled = 0, nCreaturesTotal = 0; -short nFreeze; +int nFreeze; -short nSnakeCam = -1; +int nSnakeCam = -1; int nNetPlayerCount = 0; -short nClockVal; -short nRedTicks; -short nAlarmTicks; -short nButtonColor; -short nEnergyChan; +int nClockVal; +int nRedTicks; +int nAlarmTicks; +int nButtonColor; +int nEnergyChan; int lCountDown = 0; -short nEnergyTowers = 0; +int nEnergyTowers = 0; -short nCfgNetPlayers = 0; +int nCfgNetPlayers = 0; int lLocalCodes = 0; -short bCoordinates = false; +bool bCoordinates = false; int nNetTime = -1; int flash; int totalmoves; -short nCurBodyNum = 0; +int nCurBodyNum = 0; -short nBodyTotal = 0; +int nBodyTotal = 0; -short nTotalPlayers = 1; +int nTotalPlayers = 1; // TODO: Rename this (or make it static) so it doesn't conflict with library function -short bSnakeCam = false; -short bRecord = false; -short bPlayback = false; -short bInDemo = false; -short bSlipMode = false; -short bDoFlashes = true; +bool bSnakeCam = false; +bool bRecord = false; +bool bPlayback = false; +bool bInDemo = false; +bool bSlipMode = false; +bool bDoFlashes = true; DExhumedActor* bestTarget; -short scan_char = 0; - int nStartLevel; int nTimeLimit; @@ -511,7 +508,7 @@ void DeleteActor(DExhumedActor* actor) -void CopyTileToBitmap(short nSrcTile, short nDestTile, int xPos, int yPos) +void CopyTileToBitmap(int nSrcTile, int nDestTile, int xPos, int yPos) { int nOffs = tileHeight(nDestTile) * xPos; diff --git a/source/games/exhumed/src/exhumed.h b/source/games/exhumed/src/exhumed.h index 4dede92a9..6e78c7c94 100644 --- a/source/games/exhumed/src/exhumed.h +++ b/source/games/exhumed/src/exhumed.h @@ -100,50 +100,50 @@ extern int nNetPlayerCount; extern int nNetTime; -extern short nTotalPlayers; +extern int nTotalPlayers; extern int nFontFirstChar; extern int nBackgroundPic; extern int nShadowPic; -extern short nCreaturesTotal, nCreaturesKilled; +extern int nCreaturesTotal, nCreaturesKilled; extern int lLocalButtons; -extern short nEnergyTowers; +extern int nEnergyTowers; -extern short nEnergyChan; +extern int nEnergyChan; extern DExhumedActor* pSpiritSprite; -extern short bInDemo; +extern bool bInDemo; -extern short nFreeze; +extern int nFreeze; -extern short nCurBodyNum; -extern short nBodyTotal; +extern int nCurBodyNum; +extern int nBodyTotal; -extern short bSnakeCam; +extern bool bSnakeCam; -extern short nButtonColor; +extern int nButtonColor; extern int nHeadStage; extern int flash; -extern short nSnakeCam; +extern int nSnakeCam; -extern short bCoordinates; +extern bool bCoordinates; extern int totalmoves; extern int lCountDown; -extern short nAlarmTicks; -extern short nRedTicks; -extern short nClockVal; +extern int nAlarmTicks; +extern int nRedTicks; +extern int nClockVal; -extern short bSlipMode; -extern short bDoFlashes; +extern bool bSlipMode; +extern bool bDoFlashes; extern int bVanilla; diff --git a/source/games/exhumed/src/exhumedactor.h b/source/games/exhumed/src/exhumedactor.h index 5407f2626..2f3d03cfa 100644 --- a/source/games/exhumed/src/exhumedactor.h +++ b/source/games/exhumed/src/exhumedactor.h @@ -85,17 +85,17 @@ class DExhumedActor public: DExhumedActor* pTarget; - short nPhase; + int16_t nPhase; - short nHealth; - short nFrame; - short nAction; - short nCount; - short nRun; - union { short nIndex; short nAngle; }; // angle is for wasp. - union { short nIndex2; short nAngle2; }; // index2 is for scorpion, angle2 is for wasp. - union { short nChannel; short nVel; }; // channel is for scorpion, vel is for wasp. - union { short nDamage; short nAction2; }; // nAction2 is for the queen. + int16_t nHealth; + int16_t nFrame; + int16_t nAction; + int16_t nCount; + int16_t nRun; + union { int16_t nIndex; int16_t nAngle; }; // angle is for wasp. + union { int16_t nIndex2; int16_t nAngle2; }; // index2 is for scorpion, angle2 is for wasp. + union { int16_t nChannel; int16_t nVel; }; // channel is for scorpion, vel is for wasp. + union { int16_t nDamage; int16_t nAction2; }; // nAction2 is for the queen. // for the grenade. int nTurn; diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index bc1c175c3..61e9ac465 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -31,17 +31,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS -/* -struct Weapon -{ - short nSeq; - short b[12]; // seq offsets? - short nAmmoType; - short c; - short d; - short bFireUnderwater; -}; -*/ Weapon WeaponInfo[] = { { kSeqSword, { 0, 1, 3, 7, -1, 2, 4, 5, 6, 8, 9, 10 }, 0, 0, 0, true }, @@ -57,8 +46,8 @@ Weapon WeaponInfo[] = { { kSeqDeadBrn, { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0, 1, 0, false } }; -short nTemperature[kMaxPlayers]; -short nMinAmmo[] = { 0, 24, 51, 50, 1, 0, 0 }; +int16_t nTemperature[kMaxPlayers]; +static const uint8_t nMinAmmo[] = { 0, 24, 51, 50, 1, 0, 0 }; short isRed = 0; @@ -410,7 +399,7 @@ void MoveWeapons(int nPlayer) Ra[nPlayer].nAction = 0; Ra[nPlayer].nFrame = 0; - Ra[nPlayer].field_C = 1; + Ra[nPlayer].nState = 1; } PlayerList[nPlayer].nState = 2; @@ -530,7 +519,7 @@ void MoveWeapons(int nPlayer) SelectNewWeapon(nPlayer); } - Ra[nPlayer].field_C = 0; + Ra[nPlayer].nState = 0; break; } else if (nWeapon == kWeaponM60) diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index bca53fddf..b59d1e84f 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -40,16 +40,16 @@ enum }; int initx, inity, initz; -short inita; +int16_t inita; int initsect; -short nCurChunkNum = 0; +int nCurChunkNum = 0; DExhumedActor* nBodyGunSprite[50]; int movefifoend; int movefifopos; -short nCurBodyGunNum; +int nCurBodyGunNum; int Counters[kNumCounters]; diff --git a/source/games/exhumed/src/items.cpp b/source/games/exhumed/src/items.cpp index 13cf76beb..0ff53ad88 100644 --- a/source/games/exhumed/src/items.cpp +++ b/source/games/exhumed/src/items.cpp @@ -96,7 +96,7 @@ AnimInfo nItemAnimInfo[] = { { -1, 32 } }; -short nItemMagic[] = { 500, 1000, 100, 500, 400, 200, 700, 0 }; +const int16_t nItemMagic[] = { 500, 1000, 100, 500, 400, 200, 700, 0 }; /* diff --git a/source/games/exhumed/src/light.cpp b/source/games/exhumed/src/light.cpp index 2456e0f1c..936e99a97 100644 --- a/source/games/exhumed/src/light.cpp +++ b/source/games/exhumed/src/light.cpp @@ -49,9 +49,8 @@ int btint = 0; palette_t *fadedestpal; palette_t *fadecurpal; -short nPalDelay; -short nPalDiff; -short overscanindex; +int nPalDelay; +int nPalDiff; int bGreenPal = 0; // keep a local copy of the palette that would have been sent to the VGA display adapter diff --git a/source/games/exhumed/src/lighting.cpp b/source/games/exhumed/src/lighting.cpp index 5f6f69b53..b3acbf77f 100644 --- a/source/games/exhumed/src/lighting.cpp +++ b/source/games/exhumed/src/lighting.cpp @@ -80,13 +80,13 @@ Flicker sFlicker[kMaxFlickers]; Flow sFlowInfo[kMaxFlows]; int flickermask[kMaxFlickerMask]; -short bTorch = 0; -short nFirstFlash = -1; -short nLastFlash = -1; -short nFlashDepth = 2; -short nFlowCount; -short nFlickerCount; -short nGlowCount; +int bTorch = 0; +int nFirstFlash = -1; +int nLastFlash = -1; +int nFlashDepth = 2; +int nFlowCount; +int nFlickerCount; +int nGlowCount; int bDoFlicks = 0; int bDoGlows = 0; diff --git a/source/games/exhumed/src/map.cpp b/source/games/exhumed/src/map.cpp index baf007196..7dd2f9b5b 100644 --- a/source/games/exhumed/src/map.cpp +++ b/source/games/exhumed/src/map.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS -short bShowTowers = false; +bool bShowTowers = false; void GrabMap() { diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 168c350f6..963a47bde 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -179,11 +179,11 @@ TArray EnergyBlocks; int lFinaleStart; -short nFinaleStage; +int nFinaleStage; DExhumedActor* pFinaleSpr; -short nDronePitch = 0; -short nSmokeSparks = 0; +int nDronePitch = 0; +int nSmokeSparks = 0; FSerializer& Serialize(FSerializer& arc, const char* keyname, Trail& w, Trail* def) { @@ -894,7 +894,7 @@ void InitWallFace() WallFace.Clear(); } -int BuildWallFace(short nChannel, int nWall, int nCount, ...) +int BuildWallFace(int nChannel, int nWall, int nCount, ...) { auto WallFaceCount = WallFace.Reserve(1); diff --git a/source/games/exhumed/src/ra.cpp b/source/games/exhumed/src/ra.cpp index 5ebde541b..3c0aed4d7 100644 --- a/source/games/exhumed/src/ra.cpp +++ b/source/games/exhumed/src/ra.cpp @@ -46,8 +46,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, RA& w, RA* def) ("sprite", w.pActor) ("target", w.pTarget) ("run", w.nRun) - ("ata", w.field_A) - ("atc", w.field_C) + ("atc", w.nState) ("player", w.nPlayer) .EndObject(); } @@ -102,7 +101,7 @@ void BuildRa(int nPlayer) Ra[nPlayer].pTarget = nullptr; Ra[nPlayer].nFrame = 0; Ra[nPlayer].nAction = 0; - Ra[nPlayer].field_C = 0; + Ra[nPlayer].nState = 0; Ra[nPlayer].nPlayer = nPlayer; } @@ -198,7 +197,7 @@ void AIRa::Tick(RunListEvent* ev) { MoveRaToEnemy(nPlayer); - if (!Ra[nPlayer].field_C || Ra[nPlayer].pTarget == nullptr) + if (!Ra[nPlayer].nState || Ra[nPlayer].pTarget == nullptr) { pSprite->cstat = 0x8000; } @@ -214,7 +213,7 @@ void AIRa::Tick(RunListEvent* ev) case 1: { - if (!Ra[nPlayer].field_C) + if (!Ra[nPlayer].nState) { Ra[nPlayer].nAction = 3; Ra[nPlayer].nFrame = 0; @@ -278,7 +277,7 @@ void AIRa::Tick(RunListEvent* ev) pSprite->cstat |= 0x8000; Ra[nPlayer].nAction = 0; Ra[nPlayer].nFrame = 0; - Ra[nPlayer].field_C = 0; + Ra[nPlayer].nState = 0; } return; diff --git a/source/games/exhumed/src/runlist.cpp b/source/games/exhumed/src/runlist.cpp index 52063b066..66967538b 100644 --- a/source/games/exhumed/src/runlist.cpp +++ b/source/games/exhumed/src/runlist.cpp @@ -41,7 +41,7 @@ short ChannelLast = -1; int nDamageRadius; int nRadialDamage; short RunChain; -short NewRun; +int NewRun; int sRunStack[kMaxRunStack]; RunChannel sRunChannels[kMaxChannels]; @@ -463,11 +463,11 @@ void runlist_InitChan() } } -void runlist_ChangeChannel(int eax, short nVal) +void runlist_ChangeChannel(int eax, int nVal) { if (sRunChannels[eax].b < 0) { - short nChannel = ChannelList; + int nChannel = ChannelList; ChannelList = eax; sRunChannels[eax].b = nChannel; } @@ -476,11 +476,11 @@ void runlist_ChangeChannel(int eax, short nVal) sRunChannels[eax].d |= 2; } -void runlist_ReadyChannel(short eax) +void runlist_ReadyChannel(int eax) { if (sRunChannels[eax].b < 0) { - short nChannel = ChannelList; + int nChannel = ChannelList; ChannelList = eax; sRunChannels[eax].b = nChannel; } @@ -601,7 +601,7 @@ void runlist_ProcessChannels() #endif } -int runlist_FindChannel(short ax) +int runlist_FindChannel(int ax) { for (int i = 0; i < kMaxChannels; i++) { @@ -1515,7 +1515,7 @@ void runlist_ProcessSectorTag(int nSector, int nLotag, int nHitag) } } -void runlist_ProcessWallTag(int nWall, short nLotag, short nHitag) +void runlist_ProcessWallTag(int nWall, int nLotag, int nHitag) { int nChannel = runlist_AllocChannel(nHitag % 1000); assert(nChannel >= 0 && nChannel < kMaxChannels); @@ -1730,7 +1730,7 @@ int runlist_CheckRadialDamage(DExhumedActor* pActor) return edi; } -void runlist_RadialDamageEnemy(DExhumedActor* pActor, short nDamage, short nRadius) +void runlist_RadialDamageEnemy(DExhumedActor* pActor, int nDamage, int nRadius) { if (!nRadius) { return; @@ -1748,7 +1748,7 @@ void runlist_RadialDamageEnemy(DExhumedActor* pActor, short nDamage, short nRadi } } -void runlist_DamageEnemy(DExhumedActor* pActor, DExhumedActor* pActor2, short nDamage) +void runlist_DamageEnemy(DExhumedActor* pActor, DExhumedActor* pActor2, int nDamage) { auto pSprite = &pActor->s(); diff --git a/source/games/exhumed/src/sequence.cpp b/source/games/exhumed/src/sequence.cpp index d02ae1948..7af174ce8 100644 --- a/source/games/exhumed/src/sequence.cpp +++ b/source/games/exhumed/src/sequence.cpp @@ -51,19 +51,19 @@ short nPilotLightBase; short nShadowWidth = 1; short nFlameHeight = 1; -short SeqBase[kMaxSequences]; -short SeqSize[kMaxSequences]; -short SeqFlag[kMaxSequences]; +int16_t SeqBase[kMaxSequences]; +int16_t SeqSize[kMaxSequences]; +int16_t SeqFlag[kMaxSequences]; -short FrameSound[kMaxSEQFrames]; -short FrameSize[kMaxSEQFrames]; -short FrameBase[kMaxSEQFrames]; -short FrameFlag[kMaxSEQFrames]; +int16_t FrameSound[kMaxSEQFrames]; +int16_t FrameSize[kMaxSEQFrames]; +int16_t FrameBase[kMaxSEQFrames]; +int16_t FrameFlag[kMaxSEQFrames]; -short ChunkYpos[kMaxSEQChunks]; -short ChunkXpos[kMaxSEQChunks]; -short ChunkPict[kMaxSEQChunks]; -short ChunkFlag[kMaxSEQChunks]; +int16_t ChunkYpos[kMaxSEQChunks]; +int16_t ChunkXpos[kMaxSEQChunks]; +int16_t ChunkPict[kMaxSEQChunks]; +int16_t ChunkFlag[kMaxSEQChunks]; const char *SeqNames[kMaxSEQFiles] = diff --git a/source/games/exhumed/src/sequence.h b/source/games/exhumed/src/sequence.h index b8d4f8a71..05f7d58b2 100644 --- a/source/games/exhumed/src/sequence.h +++ b/source/games/exhumed/src/sequence.h @@ -110,11 +110,10 @@ struct actionSeq extern short frames; -extern short SeqBase[]; -extern short SeqSize[]; -extern short SeqOffsets[]; - -extern short FrameFlag[]; +extern int16_t SeqBase[]; +extern int16_t SeqSize[]; +extern int16_t SeqOffsets[]; +extern int16_t FrameFlag[]; extern short nShadowWidth; extern short nFlameHeight; @@ -122,12 +121,12 @@ extern short nFlameHeight; extern short nPilotLightFrame; extern short nPilotLightCount; -extern short ChunkYpos[]; -extern short ChunkXpos[]; -extern short ChunkPict[]; -extern short ChunkFlag[]; -extern short FrameSize[]; -extern short FrameBase[]; +extern int16_t ChunkYpos[]; +extern int16_t ChunkXpos[]; +extern int16_t ChunkPict[]; +extern int16_t ChunkFlag[]; +extern int16_t FrameSize[]; +extern int16_t FrameBase[]; void seq_LoadSequences(); diff --git a/source/games/exhumed/src/snake.cpp b/source/games/exhumed/src/snake.cpp index f4897c8e8..6cd33b80a 100644 --- a/source/games/exhumed/src/snake.cpp +++ b/source/games/exhumed/src/snake.cpp @@ -31,7 +31,7 @@ BEGIN_PS_NS FreeListArray SnakeList; -short nPlayerSnake[kMaxPlayers]; +int16_t nPlayerSnake[kMaxPlayers]; FSerializer& Serialize(FSerializer& arc, const char* keyname, Snake& w, Snake* def) { @@ -40,10 +40,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Snake& w, Snake* d arc("enemy", w.pEnemy) ("countdown", w.nCountdown) .Array("sprites", w.pSprites, kSnakeSprites) - ("sc", w.sC) ("run", w.nRun) .Array("c", w.c, countof(w.c)) - ("se", w.sE) + ("se", w.nAngle) ("player", w.nSnakePlayer) .EndObject(); } @@ -63,14 +62,14 @@ void InitSnakes() memset(nPlayerSnake, 0, sizeof(nPlayerSnake)); } -short GrabSnake() +int GrabSnake() { return SnakeList.Get(); } void DestroySnake(int nSnake) { - short nRun = SnakeList[nSnake].nRun; + int nRun = SnakeList[nSnake].nRun; runlist_SubRunRec(nRun); for (int i = 0; i < kSnakeSprites; i++) @@ -95,7 +94,7 @@ void DestroySnake(int nSnake) void ExplodeSnakeSprite(DExhumedActor* pActor, int nPlayer) { auto pSprite = &pActor->s(); - short nDamage = BulletInfo[kWeaponStaff].nDamage; + int nDamage = BulletInfo[kWeaponStaff].nDamage; if (PlayerList[nPlayer].nDouble > 0) { nDamage *= 2; @@ -116,22 +115,22 @@ void ExplodeSnakeSprite(DExhumedActor* pActor, int nPlayer) StopActorSound(pActor); } -void BuildSnake(int nPlayer, short zVal) +void BuildSnake(int nPlayer, int zVal) { zVal -= 1280; auto pPlayerActor = PlayerList[nPlayer].Actor(); auto pPlayerSprite = &pPlayerActor->s(); - short nViewSect = PlayerList[nPlayer].nPlayerViewSect; - short nPic = seq_GetSeqPicnum(kSeqSnakBody, 0, 0); + int nViewSect = PlayerList[nPlayer].nPlayerViewSect; + int nPic = seq_GetSeqPicnum(kSeqSnakBody, 0, 0); int x = pPlayerSprite->x; int y = pPlayerSprite->y; int z = (pPlayerSprite->z + zVal) - 2560; int nAngle = pPlayerSprite->ang; - short hitsect; + int hitsect; int hitx, hity, hitz; DExhumedActor* hitactor; @@ -183,7 +182,7 @@ void BuildSnake(int nPlayer, short zVal) pTarget = sPlayerInput[nPlayer].pTarget; } - short nSnake = GrabSnake(); + int nSnake = GrabSnake(); if (nSnake == -1) return; // GrabTimeSlot(3); @@ -248,8 +247,7 @@ void BuildSnake(int nPlayer, short zVal) SnakeList[nSnake].c[7] = 7; SnakeList[nSnake].pEnemy = pTarget; SnakeList[nSnake].nCountdown = 0; - SnakeList[nSnake].sC = 1200; - SnakeList[nSnake].sE = 0; + SnakeList[nSnake].nAngle = 0; SnakeList[nSnake].nSnakePlayer = nPlayer; nPlayerSnake[nPlayer] = nSnake; @@ -264,7 +262,7 @@ void BuildSnake(int nPlayer, short zVal) } } -DExhumedActor* FindSnakeEnemy(short nSnake) +DExhumedActor* FindSnakeEnemy(int nSnake) { int nPlayer = SnakeList[nSnake].nSnakePlayer; auto pPlayerActor = PlayerList[nPlayer].Actor(); @@ -317,7 +315,7 @@ DExhumedActor* FindSnakeEnemy(short nSnake) void AISnake::Tick(RunListEvent* ev) { - short nSnake = RunData[ev->nRun].nObjIndex; + int nSnake = RunData[ev->nRun].nObjIndex; assert(nSnake >= 0 && nSnake < kMaxSnakes); auto pActor = SnakeList[nSnake].pSprites[0]; @@ -336,7 +334,7 @@ void AISnake::Tick(RunListEvent* ev) nMov = movesprite(pActor, 600 * bcos(pSprite->ang), 600 * bsin(pSprite->ang), - bsin(SnakeList[nSnake].sE, -5), + bsin(SnakeList[nSnake].nAngle, -5), 0, 0, CLIPMASK1); FindSnakeEnemy(nSnake); @@ -353,7 +351,7 @@ void AISnake::Tick(RunListEvent* ev) zVal = pSprite->z; - nMov = AngleChase(pActor, pEnemySprite, 1200, SnakeList[nSnake].sE, 32); + nMov = AngleChase(pActor, pEnemySprite, 1200, SnakeList[nSnake].nAngle, 32); zVal = pSprite->z - zVal; } @@ -374,9 +372,9 @@ void AISnake::Tick(RunListEvent* ev) int var_30 = -bcos(nAngle, 6); int var_34 = -bsin(nAngle, 6); - int var_20 = SnakeList[nSnake].sE; + int var_20 = SnakeList[nSnake].nAngle; - SnakeList[nSnake].sE = (SnakeList[nSnake].sE + 64) & 0x7FF; + SnakeList[nSnake].nAngle = (SnakeList[nSnake].nAngle + 64) & 0x7FF; int var_28 = (nAngle + 512) & kAngleMask; int nSector =pSprite->sectnum; diff --git a/source/games/exhumed/src/trigdat.cpp b/source/games/exhumed/src/trigdat.cpp index f5f31d951..e6b0addfc 100644 --- a/source/games/exhumed/src/trigdat.cpp +++ b/source/games/exhumed/src/trigdat.cpp @@ -120,7 +120,7 @@ int GetMyAngle(int x, int y) } // 100% done -int AngleDiff(short a, short b) +int AngleDiff(int a, int b) { int diff = (b - a) & kAngleMask; diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 18dcf9d2b..b838fc3ad 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -189,7 +189,7 @@ static void analyzesprites(spritetype* tsprite, int& spritesortcnt, int x, int y void ResetView() { - EraseScreen(overscanindex); + EraseScreen(0); #ifdef USE_OPENGL videoTintBlood(0, 0, 0); #endif