From b9b4f1e03740d8f1fee7654ea03a1e29405ec1b4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 16 Nov 2021 18:45:07 +0100 Subject: [PATCH] - shorts replaced in Exhumed only a small part, the easy stuff --- source/games/exhumed/src/aistuff.h | 20 ++++---- source/games/exhumed/src/init.cpp | 12 ++--- source/games/exhumed/src/items.cpp | 4 +- source/games/exhumed/src/object.cpp | 6 +-- source/games/exhumed/src/player.h | 52 +++++++++---------- source/games/exhumed/src/switch.cpp | 80 ++++++++++++++--------------- 6 files changed, 87 insertions(+), 87 deletions(-) diff --git a/source/games/exhumed/src/aistuff.h b/source/games/exhumed/src/aistuff.h index afed797a7..34102b7d1 100644 --- a/source/games/exhumed/src/aistuff.h +++ b/source/games/exhumed/src/aistuff.h @@ -57,12 +57,12 @@ struct bulletInfo int16_t nDamage; // 0 int16_t field_2; // 2 int field_4; // 4 - short field_8; // 8 - short nSeq; // 10 - short field_C; // 12 - short nFlags; - short nRadius; // damage radius - short xyRepeat; + int16_t field_8; // 8 + int16_t nSeq; // 10 + int16_t field_C; // 12 + int16_t nFlags; + int16_t nRadius; // damage radius + int16_t xyRepeat; }; extern bulletInfo BulletInfo[]; @@ -161,9 +161,9 @@ extern short nItemMagic[]; void BuildItemAnim(DExhumedActor* nSprite); void ItemFlash(); void FillItems(short nPlayer); -void UseItem(short nPlayer, short nItem); +void UseItem(short nPlayer, int nItem); void UseCurItem(short nPlayer); -int GrabItem(short nPlayer, short nItem); +int GrabItem(short nPlayer, int nItem); void DropMagic(DExhumedActor* actor); void InitItems(); void StartRegenerate(DExhumedActor* nSprite); @@ -766,9 +766,9 @@ std::pair BuildSwNotOnPause(int nChannel, int nLink, int nSector, int int BuildLink(int nCount, ...); std::pair BuildSwPressSector(int nChannel, int nLink, int nSector, int ecx); std::pair BuildSwStepOn(int nChannel, int nLink, int nSector); -std::pair BuildSwReady(int nChannel, short nLink); +std::pair BuildSwReady(int nChannel, int nLink); -std::pair BuildSwPressWall(short nChannel, short nLink, int nWall); +std::pair BuildSwPressWall(int nChannel, int nLink, int nWall); // wasp diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index ba9d9bdb1..f0950250b 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -803,8 +803,8 @@ void ExamineSprites() int nStatus = pSprite->statnum; if (!nStatus) { - short lotag = pSprite->lotag; - short hitag = pSprite->hitag; + int lotag = pSprite->lotag; + int hitag = pSprite->hitag; if ((nStatus < kMaxStatus) && lotag) { @@ -849,8 +849,8 @@ void LoadObjects() for (int nSector = 0; nSector < numsectors; nSector++) { auto sectp = §or[nSector]; - short hitag = sectp->hitag; - short lotag = sectp->lotag; + int hitag = sectp->hitag; + int lotag = sectp->lotag; sectp->hitag = 0; sectp->lotag = 0; @@ -869,8 +869,8 @@ void LoadObjects() { wall[nWall].extra = -1; - short lotag = wall[nWall].lotag; - short hitag = wall[nWall].hitag; + int lotag = wall[nWall].lotag; + int hitag = wall[nWall].hitag; wall[nWall].lotag = 0; diff --git a/source/games/exhumed/src/items.cpp b/source/games/exhumed/src/items.cpp index ce07520fb..cb658a014 100644 --- a/source/games/exhumed/src/items.cpp +++ b/source/games/exhumed/src/items.cpp @@ -261,7 +261,7 @@ static bool UseHand(short nPlayer) return true; } -void UseItem(short nPlayer, short nItem) +void UseItem(short nPlayer, int nItem) { bool didit = false; switch (nItem) @@ -313,7 +313,7 @@ void UseItem(short nPlayer, short nItem) } // TODO - bool return type? -int GrabItem(short nPlayer, short nItem) +int GrabItem(short nPlayer, int nItem) { if (PlayerList[nPlayer].items[nItem] >= 5) { return 0; diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 0f44f0109..1e58e160a 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -1972,7 +1972,7 @@ void AIObject::Tick(RunListEvent* ev) if (!pActor) return; auto pSprite = &pActor->s(); short nStat = pSprite->statnum; - short bx = pActor->nIndex; + int bx = pActor->nIndex; if (nStat == 97 || (!(pSprite->cstat & 0x101))) { return; @@ -2088,7 +2088,7 @@ void AIObject::Damage(RunListEvent* ev) auto pActor = ev->pObjActor; if (!pActor) return; auto pSprite = &pActor->s(); - short nStat = pSprite->statnum; + int nStat = pSprite->statnum; if (nStat >= 150 || pActor->nHealth <= 0) { return; @@ -2119,7 +2119,7 @@ void AIObject::Draw(RunListEvent* ev) { auto pActor = ev->pObjActor; if (!pActor) return; - short bx = pActor->nIndex; + int bx = pActor->nIndex; if (bx > -1) { diff --git a/source/games/exhumed/src/player.h b/source/games/exhumed/src/player.h index 1b3702bca..53d35ae2c 100644 --- a/source/games/exhumed/src/player.h +++ b/source/games/exhumed/src/player.h @@ -60,23 +60,23 @@ struct Player { DExhumedActor* Actor() { return pActor; } DExhumedActor* pActor; - short nHealth; - short nLives; - short nDouble; - short nInvisible; - short nTorch; - short field_2; - short nAction; - short bIsMummified; - short invincibility; - short nAir; - short nSeq; - short nMaskAmount; + int16_t nHealth; + int16_t nLives; + int16_t nDouble; + int16_t nInvisible; + int16_t nTorch; + int16_t field_2; + int16_t nAction; + int16_t bIsMummified; + int16_t invincibility; + int16_t nAir; + int16_t nSeq; + int16_t nMaskAmount; uint16_t keys; - short nMagic; - short nItem; + int16_t nMagic; + int16_t nItem; uint8_t items[8]; - short nAmmo[7]; // TODO - kMaxWeapons? + int16_t nAmmo[7]; // TODO - kMaxWeapons? short nCurrentWeapon; short field_3FOUR; @@ -91,21 +91,21 @@ struct Player PlayerHorizon horizon; PlayerAngle angle; - short nBreathTimer; - short nPlayerSwear; - short nPlayerPushSect; - short nDeathType; - short nPlayerScore; - short nPlayerColor; + int16_t nBreathTimer; + int16_t nPlayerSwear; + int nPlayerPushSect; + int16_t nDeathType; + int16_t nPlayerScore; + int16_t nPlayerColor; + int16_t nPistolClip; int nPlayerDY; int nPlayerDX; - short nPistolClip; int nXDamage; int nYDamage; - short nPlayerOldWeapon; - short nPlayerClip; - short nPlayerPushSound; - short nTauntTimer; + int16_t nPlayerOldWeapon; + int16_t nPlayerClip; + int16_t nPlayerPushSound; + int16_t nTauntTimer; uint16_t nPlayerWeapons; // each set bit represents a weapon the player has short nPlayerViewSect; PlayerSave sPlayerSave; diff --git a/source/games/exhumed/src/switch.cpp b/source/games/exhumed/src/switch.cpp index f76e6830b..fdf550278 100644 --- a/source/games/exhumed/src/switch.cpp +++ b/source/games/exhumed/src/switch.cpp @@ -39,8 +39,8 @@ struct Switch { short nWaitTimer; short nWait; - short nChannel; - short nLink; + int nChannel; + int nLink; short nRunPtr; int nSector; short nRun2; @@ -122,7 +122,7 @@ void InitSwitch() memset(SwitchData, 0, sizeof(SwitchData)); } -std::pair BuildSwReady(int nChannel, short nLink) +std::pair BuildSwReady(int nChannel, int nLink) { if (SwitchCount <= 0 || nLink < 0) { I_Error("Too many switch readys!\n"); @@ -137,11 +137,11 @@ std::pair BuildSwReady(int nChannel, short nLink) void AISWReady::Process(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; + int nSwitch = RunData[ev->nRun].nObjIndex; assert(nSwitch >= 0 && nSwitch < kMaxSwitches); - short nChannel = SwitchData[nSwitch].nChannel; - short nLink = SwitchData[nSwitch].nLink; + int nChannel = SwitchData[nSwitch].nChannel; + int nLink = SwitchData[nSwitch].nLink; assert(sRunChannels[nChannel].c < 8); int8_t nVal = LinkMap[nLink].v[sRunChannels[nChannel].c]; @@ -175,7 +175,7 @@ std::pair BuildSwPause(int nChannel, int nLink, int ebx) void AISWPause::ProcessChannel(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; + int nSwitch = RunData[ev->nRun].nObjIndex; if (SwitchData[nSwitch].nRunPtr >= 0) { runlist_SubRunRec(SwitchData[nSwitch].nRunPtr); @@ -185,9 +185,9 @@ void AISWPause::ProcessChannel(RunListEvent* ev) void AISWPause::Tick(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; - short nChannel = SwitchData[nSwitch].nChannel; - short nLink = SwitchData[nSwitch].nLink; + int nSwitch = RunData[ev->nRun].nObjIndex; + int nChannel = SwitchData[nSwitch].nChannel; + int nLink = SwitchData[nSwitch].nLink; SwitchData[nSwitch].nWaitTimer--; if (SwitchData[nSwitch].nWaitTimer <= 0) @@ -204,9 +204,9 @@ void AISWPause::Tick(RunListEvent* ev) void AISWPause::Process(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; - short nChannel = SwitchData[nSwitch].nChannel; - short nLink = SwitchData[nSwitch].nLink; + int nSwitch = RunData[ev->nRun].nObjIndex; + int nChannel = SwitchData[nSwitch].nChannel; + int nLink = SwitchData[nSwitch].nLink; assert(sRunChannels[nChannel].c < 8); if (LinkMap[nLink].v[sRunChannels[nChannel].c] < 0) { @@ -250,11 +250,11 @@ std::pair BuildSwStepOn(int nChannel, int nLink, int nSector) void AISWStepOn::ProcessChannel(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; + int nSwitch = RunData[ev->nRun].nObjIndex; assert(nSwitch >= 0 && nSwitch < kMaxSwitches); - short nLink = SwitchData[nSwitch].nLink; - short nChannel = SwitchData[nSwitch].nChannel; + int nLink = SwitchData[nSwitch].nLink; + int nChannel = SwitchData[nSwitch].nChannel; int nSector =SwitchData[nSwitch].nSector; assert(sRunChannels[nChannel].c < 8); @@ -275,11 +275,11 @@ void AISWStepOn::ProcessChannel(RunListEvent* ev) void AISWStepOn::TouchFloor(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; + int nSwitch = RunData[ev->nRun].nObjIndex; assert(nSwitch >= 0 && nSwitch < kMaxSwitches); - short nLink = SwitchData[nSwitch].nLink; - short nChannel = SwitchData[nSwitch].nChannel; + int nLink = SwitchData[nSwitch].nLink; + int nChannel = SwitchData[nSwitch].nChannel; int nSector =SwitchData[nSwitch].nSector; assert(sRunChannels[nChannel].c < 8); @@ -316,7 +316,7 @@ std::pair BuildSwNotOnPause(int nChannel, int nLink, int nSector, int void AISWNotOnPause::ProcessChannel(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; + int nSwitch = RunData[ev->nRun].nObjIndex; assert(nSwitch >= 0 && nSwitch < kMaxSwitches); if (SwitchData[nSwitch].nRun2 >= 0) @@ -336,11 +336,11 @@ void AISWNotOnPause::ProcessChannel(RunListEvent* ev) void AISWNotOnPause::Tick(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; + int nSwitch = RunData[ev->nRun].nObjIndex; assert(nSwitch >= 0 && nSwitch < kMaxSwitches); - short nChannel = SwitchData[nSwitch].nChannel; - short nLink = SwitchData[nSwitch].nLink; + int nChannel = SwitchData[nSwitch].nChannel; + int nLink = SwitchData[nSwitch].nLink; SwitchData[nSwitch].nWaitTimer -= 4; if (SwitchData[nSwitch].nWaitTimer <= 0) @@ -353,11 +353,11 @@ void AISWNotOnPause::Tick(RunListEvent* ev) void AISWNotOnPause::Process(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; + int nSwitch = RunData[ev->nRun].nObjIndex; assert(nSwitch >= 0 && nSwitch < kMaxSwitches); - short nChannel = SwitchData[nSwitch].nChannel; - short nLink = SwitchData[nSwitch].nLink; + int nChannel = SwitchData[nSwitch].nChannel; + int nLink = SwitchData[nSwitch].nLink; assert(sRunChannels[nChannel].c < 8); @@ -377,7 +377,7 @@ void AISWNotOnPause::Process(RunListEvent* ev) void AISWNotOnPause::TouchFloor(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; + int nSwitch = RunData[ev->nRun].nObjIndex; SwitchData[nSwitch].nWaitTimer = SwitchData[nSwitch].nWait; return; @@ -401,11 +401,11 @@ std::pair BuildSwPressSector(int nChannel, int nLink, int nSector, int void AISWPressSector::ProcessChannel(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; + int nSwitch = RunData[ev->nRun].nObjIndex; assert(nSwitch >= 0 && nSwitch < kMaxSwitches); - short nChannel = SwitchData[nSwitch].nChannel; - short nLink = SwitchData[nSwitch].nLink; + int nChannel = SwitchData[nSwitch].nChannel; + int nLink = SwitchData[nSwitch].nLink; if (SwitchData[nSwitch].nRun2 >= 0) { @@ -426,11 +426,11 @@ void AISWPressSector::ProcessChannel(RunListEvent* ev) void AISWPressSector::Use(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; + int nSwitch = RunData[ev->nRun].nObjIndex; assert(nSwitch >= 0 && nSwitch < kMaxSwitches); - short nChannel = SwitchData[nSwitch].nChannel; - short nLink = SwitchData[nSwitch].nLink; + int nChannel = SwitchData[nSwitch].nChannel; + int nLink = SwitchData[nSwitch].nLink; int nPlayer = ev->nParam; if ((PlayerList[nPlayer].keys & SwitchData[nSwitch].nKeyMask) == SwitchData[nSwitch].nKeyMask) @@ -450,7 +450,7 @@ void AISWPressSector::Use(RunListEvent* ev) } -std::pair BuildSwPressWall(short nChannel, short nLink, int nWall) +std::pair BuildSwPressWall(int nChannel, int nLink, int nWall) { if (SwitchCount <= 0 || nLink < 0 || nWall < 0) { I_Error("Too many switches!\n"); @@ -468,11 +468,11 @@ std::pair BuildSwPressWall(short nChannel, short nLink, int nWall) void AISWPressWall::Process(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; + int nSwitch = RunData[ev->nRun].nObjIndex; assert(nSwitch >= 0 && nSwitch < kMaxSwitches); - short nChannel = SwitchData[nSwitch].nChannel; - short nLink = SwitchData[nSwitch].nLink; + int nChannel = SwitchData[nSwitch].nChannel; + int nLink = SwitchData[nSwitch].nLink; if (SwitchData[nSwitch].nRun3 >= 0) { @@ -489,11 +489,11 @@ void AISWPressWall::Process(RunListEvent* ev) void AISWPressWall::Use(RunListEvent* ev) { - short nSwitch = RunData[ev->nRun].nObjIndex; + int nSwitch = RunData[ev->nRun].nObjIndex; assert(nSwitch >= 0 && nSwitch < kMaxSwitches); - short nChannel = SwitchData[nSwitch].nChannel; - short nLink = SwitchData[nSwitch].nLink; + int nChannel = SwitchData[nSwitch].nChannel; + int nLink = SwitchData[nSwitch].nLink; int8_t cx = LinkMap[nLink].v[sRunChannels[nChannel].c];