From 9b52b3b45105d8f710ca0dd08b16ec18e0ea55e5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 9 Nov 2021 17:27:54 +0100 Subject: [PATCH] - made all nSector variables full ints. This already takes care of most sector[] accesses in Exhumed --- source/games/exhumed/src/aistuff.h | 36 +++++++++++++-------------- source/games/exhumed/src/anims.cpp | 4 +-- source/games/exhumed/src/anubis.cpp | 2 +- source/games/exhumed/src/bubbles.cpp | 6 ++--- source/games/exhumed/src/bullet.cpp | 4 +-- source/games/exhumed/src/engine.h | 2 +- source/games/exhumed/src/fish.cpp | 4 +-- source/games/exhumed/src/grenade.cpp | 4 +-- source/games/exhumed/src/gun.cpp | 4 +-- source/games/exhumed/src/init.cpp | 24 +++++++++--------- source/games/exhumed/src/lavadude.cpp | 6 ++--- source/games/exhumed/src/lighting.cpp | 20 +++++++-------- source/games/exhumed/src/lion.cpp | 2 +- source/games/exhumed/src/move.cpp | 16 ++++++------ source/games/exhumed/src/object.cpp | 32 ++++++++++++------------ source/games/exhumed/src/player.cpp | 6 ++--- source/games/exhumed/src/player.h | 4 +-- source/games/exhumed/src/queen.cpp | 8 +++--- source/games/exhumed/src/ramses.cpp | 2 +- source/games/exhumed/src/rat.cpp | 2 +- source/games/exhumed/src/rex.cpp | 2 +- source/games/exhumed/src/roach.cpp | 2 +- source/games/exhumed/src/scorp.cpp | 2 +- source/games/exhumed/src/sequence.cpp | 2 +- source/games/exhumed/src/set.cpp | 4 +-- source/games/exhumed/src/snake.cpp | 4 +-- source/games/exhumed/src/sound.cpp | 2 +- source/games/exhumed/src/sound.h | 2 +- source/games/exhumed/src/spider.cpp | 4 +-- source/games/exhumed/src/switch.cpp | 12 ++++----- source/games/exhumed/src/view.cpp | 2 +- source/games/exhumed/src/wasp.cpp | 4 +-- 32 files changed, 115 insertions(+), 115 deletions(-) diff --git a/source/games/exhumed/src/aistuff.h b/source/games/exhumed/src/aistuff.h index 9483183f8..788ba68ad 100644 --- a/source/games/exhumed/src/aistuff.h +++ b/source/games/exhumed/src/aistuff.h @@ -171,7 +171,7 @@ void DoRegenerates(); // lavadude -void BuildLava(DExhumedActor* nSprite, int x, int y, int z, short nSector, short nAngle, int nChannel); +void BuildLava(DExhumedActor* nSprite, int x, int y, int z, int nSector, short nAngle, int nChannel); DExhumedActor* BuildLavaLimb(DExhumedActor* nSprite, int edx, int ebx); void FuncLavaLimb(int, int, int, int); void FuncLava(int, int, int, int); @@ -181,20 +181,20 @@ void FuncLava(int, int, int, int); extern short nFlashDepth; void InitLights(); -void AddFlash(short nSector, int x, int y, int z, int val); +void AddFlash(int nSector, int x, int y, int z, int val); void SetTorch(int nPlayer, int bTorchOnOff); void UndoFlashes(); void DoLights(); void AddFlow(int nSprite, int nSpeed, int b, int ang = -1); -void BuildFlash(short nPlayer, short nSector, int nVal); -void AddGlow(short nSector, int nVal); -void AddFlicker(short nSector, int nVal); +void BuildFlash(int nPlayer, int nVal); +void AddGlow(int nSector, int nVal); +void AddFlicker(int nSector, int nVal); extern short bTorch; // lion -void BuildLion(DExhumedActor* nSprite, int x, int y, int z, short nSector, short nAngle); +void BuildLion(DExhumedActor* nSprite, int x, int y, int z, int nSector, short nAngle); void FuncLion(int, int, int, int); // move @@ -234,11 +234,11 @@ DExhumedActor* FindPlayer(DExhumedActor* nSprite, int nDistance, bool dontengage DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial = false); void BuildNear(int x, int y, int walldist, int nSector); int PlotCourseToSprite(DExhumedActor* nSprite1, DExhumedActor* nSprite2); -void CheckSectorFloor(short nSector, int z, int *x, int *y); +void CheckSectorFloor(int nSector, int z, int *x, int *y); int GetAngleToSprite(DExhumedActor* nSprite1, DExhumedActor* nSprite2); int GetWallNormal(short nWall); int GetUpAngle(DExhumedActor* nSprite1, int nVal, DExhumedActor* nSprite2, int ecx); -void MoveSector(short nSector, int nAngle, int *nXVel, int *nYVel); +void MoveSector(int nSector, int nAngle, int *nXVel, int *nYVel); Collision AngleChase(DExhumedActor* nSprite, DExhumedActor* nSprite2, int ebx, int ecx, int push1); void SetQuake(DExhumedActor* nSprite, int nVal); @@ -283,8 +283,8 @@ void FuncObject(int, int, int, int); void FuncTrap(int, int, int, int); void FuncEnergyBlock(int, int, int, int); void FuncSpark(int, int, int, int); -void SnapBobs(short nSectorA, short nSectorB); -DExhumedActor* FindWallSprites(short nSector); +void SnapBobs(int nSectorA, int nSectorB); +DExhumedActor* FindWallSprites(int nSector); void AddMovingSector(int nSector, int edx, int ebx, int ecx); void ProcessTrailSprite(DExhumedActor* nSprite, int nLotag, int nHitag); void AddSectorBob(int nSector, int nHitag, int bx); @@ -292,7 +292,7 @@ DExhumedActor* BuildObject(DExhumedActor* nSprite, int nOjectType, int nHitag); int BuildArrow(DExhumedActor* nSprite, int nVal); int BuildFireBall(DExhumedActor*, int a, int b); void BuildDrip(DExhumedActor* nSprite); -DExhumedActor* BuildEnergyBlock(short nSector); +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, short nWall, int nCount, ...); @@ -334,18 +334,18 @@ void FuncRa(int, int, int, int); void InitRats(); void SetRatVel(short nSprite); -void BuildRat(DExhumedActor* nSprite, int x, int y, int z, short nSector, int nAngle); +void BuildRat(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle); int FindFood(short nSprite); void FuncRat(int a, int, int b, int nRun); // rex -void BuildRex(DExhumedActor* nSprite, int x, int y, int z, short nSector, short nAngle, int nChannel); +void BuildRex(DExhumedActor* nSprite, int x, int y, int z, int nSector, short nAngle, int nChannel); void FuncRex(int, int, int, int); // roach -void BuildRoach(int nType, DExhumedActor* nSprite, int x, int y, int z, short nSector, int angle); +void BuildRoach(int nType, DExhumedActor* nSprite, int x, int y, int z, int nSector, int angle); void FuncRoach(int a, int, int nDamage, int nRun); // runlist @@ -707,12 +707,12 @@ void runlist_ExecObjects(); // scorp -void BuildScorp(DExhumedActor* nSprite, int x, int y, int z, short nSector, short nAngle, int nChannel); +void BuildScorp(DExhumedActor* nSprite, int x, int y, int z, int nSector, short nAngle, int nChannel); void FuncScorp(int, int, int, int); // set -void BuildSet(DExhumedActor* nSprite, int x, int y, int z, short nSector, short nAngle, int nChannel); +void BuildSet(DExhumedActor* nSprite, int x, int y, int z, int nSector, short nAngle, int nChannel); void FuncSoul(int, int, int, int); void FuncSet(int, int, int, int); @@ -746,7 +746,7 @@ void FuncSnake(int, int, int, int); // spider -DExhumedActor* BuildSpider(DExhumedActor* nSprite, int x, int y, int z, short nSector, int nAngle); +DExhumedActor* BuildSpider(DExhumedActor* nSprite, int x, int y, int z, int nSector, int nAngle); void FuncSpider(int a, int, int b, int nRun); // switch @@ -772,7 +772,7 @@ std::pair BuildSwPressWall(short nChannel, short nLink, short nWall); // wasp -DExhumedActor* BuildWasp(DExhumedActor* nSprite, int x, int y, int z, short nSector, short nAngle, bool bEggWasp); +DExhumedActor* BuildWasp(DExhumedActor* nSprite, int x, int y, int z, int nSector, short nAngle, bool bEggWasp); void FuncWasp(int eax, int, int edx, int nRun); diff --git a/source/games/exhumed/src/anims.cpp b/source/games/exhumed/src/anims.cpp index 79fa3fafe..2dd30a570 100644 --- a/source/games/exhumed/src/anims.cpp +++ b/source/games/exhumed/src/anims.cpp @@ -240,7 +240,7 @@ void BuildExplosion(DExhumedActor* pActor) { auto pSprite = &pActor->s(); - short nSector = pSprite->sectnum; + int nSector = pSprite->sectnum; int edx = 36; @@ -248,7 +248,7 @@ void BuildExplosion(DExhumedActor* pActor) { edx = 75; } - else if (pSprite->z == sector[nSector].floorz) + else if (pSprite->z == pSprite->sector()->floorz) { edx = 34; } diff --git a/source/games/exhumed/src/anubis.cpp b/source/games/exhumed/src/anubis.cpp index eb7c08f5f..ac6e354f0 100644 --- a/source/games/exhumed/src/anubis.cpp +++ b/source/games/exhumed/src/anubis.cpp @@ -406,7 +406,7 @@ void AIAnubis::Damage(RunListEvent* ev) pDrumSprite->x = sp->x; pDrumSprite->y = sp->y; - pDrumSprite->z = sector[pDrumSprite->sectnum].floorz; + pDrumSprite->z = pDrumSprite->sector()->floorz; pDrumSprite->xrepeat = 40; pDrumSprite->yrepeat = 40; pDrumSprite->shade = -64; diff --git a/source/games/exhumed/src/bubbles.cpp b/source/games/exhumed/src/bubbles.cpp index 86dafd852..eb4859863 100644 --- a/source/games/exhumed/src/bubbles.cpp +++ b/source/games/exhumed/src/bubbles.cpp @@ -35,7 +35,7 @@ void DestroyBubble(DExhumedActor* pActor) DeleteActor(pActor); } -DExhumedActor* BuildBubble(vec3_t pos, short nSector) +DExhumedActor* BuildBubble(vec3_t pos, int nSector) { int nSize = RandomSize(3); if (nSize > 4) { @@ -93,11 +93,11 @@ void AIBubble::Tick(RunListEvent* ev) pSprite->z += pSprite->zvel; - short nSector = pSprite->sectnum; + int nSector = pSprite->sectnum; if (pSprite->z <= sector[nSector].ceilingz) { - short nSectAbove = SectAbove[nSector]; + int nSectAbove = SectAbove[nSector]; if (pSprite->hitag > -1 && nSectAbove != -1) { BuildAnim(nullptr, 70, 0, pSprite->x, pSprite->y, sector[nSectAbove].floorz, nSectAbove, 64, 0); diff --git a/source/games/exhumed/src/bullet.cpp b/source/games/exhumed/src/bullet.cpp index 21fcd1554..13cf53524 100644 --- a/source/games/exhumed/src/bullet.cpp +++ b/source/games/exhumed/src/bullet.cpp @@ -487,7 +487,7 @@ HITSPRITE: HITWALL: if (wall[hitwall].picnum == kEnergy1) { - short nSector = wall[hitwall].nextsector; + int nSector =wall[hitwall].nextsector; if (nSector > -1) { short nDamage = BulletInfo[pBullet->nType].nDamage; @@ -612,7 +612,7 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, int n return nullptr; } - short nSector; + int nSector; if (pSprite->statnum == 100) { diff --git a/source/games/exhumed/src/engine.h b/source/games/exhumed/src/engine.h index 0e0c8f3a6..3cdb4119c 100644 --- a/source/games/exhumed/src/engine.h +++ b/source/games/exhumed/src/engine.h @@ -88,7 +88,7 @@ enum ECounter }; extern int Counters[kNumCounters]; -void SnapSectors(short nSectorA, short nSectorB, short b); +void SnapSectors(int nSectorA, int nSectorB, int b); extern short SectSound[]; extern short SectDamage[]; diff --git a/source/games/exhumed/src/fish.cpp b/source/games/exhumed/src/fish.cpp index ddc76f295..dd43498cf 100644 --- a/source/games/exhumed/src/fish.cpp +++ b/source/games/exhumed/src/fish.cpp @@ -77,7 +77,7 @@ void BuildFishLimb(DExhumedActor* pActor, short anim) pSprite2->hitag = runlist_AddRunRec(NewRun, pChunkActor, 0x200000); } -void BuildBlood(int x, int y, int z, short nSector) +void BuildBlood(int x, int y, int z, int nSector) { BuildAnim(nullptr, kSeqFish, 36, x, y, z, nSector, 75, 128); } @@ -438,7 +438,7 @@ void AIFish::Tick(RunListEvent* ev) int x = pSprite->x; int y = pSprite->y; int z = pSprite->z; - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; // loc_2EF54 Collision coll = movesprite(pActor, pSprite->xvel << 13, pSprite->yvel << 13, pSprite->zvel << 2, 0, 0, CLIPMASK0); diff --git a/source/games/exhumed/src/grenade.cpp b/source/games/exhumed/src/grenade.cpp index e7be545e7..42119c6c4 100644 --- a/source/games/exhumed/src/grenade.cpp +++ b/source/games/exhumed/src/grenade.cpp @@ -148,8 +148,8 @@ void ExplodeGrenade(DExhumedActor* pActor) int var_28, var_20; auto pGrenadeSprite = &pActor->s(); - short nPlayer = pGrenadeSprite->owner; - short nGrenadeSect = pGrenadeSprite->sectnum; + int nPlayer = pGrenadeSprite->owner; + int nGrenadeSect = pGrenadeSprite->sectnum; pActor->nFrame = 1; diff --git a/source/games/exhumed/src/gun.cpp b/source/games/exhumed/src/gun.cpp index 2414f3735..44ce82271 100644 --- a/source/games/exhumed/src/gun.cpp +++ b/source/games/exhumed/src/gun.cpp @@ -231,7 +231,7 @@ void SetWeaponStatus(short nPlayer) uint8_t WeaponCanFire(short nPlayer) { short nWeapon = PlayerList[nPlayer].nCurrentWeapon; - short nSector = PlayerList[nPlayer].nPlayerViewSect; + int nSector =PlayerList[nPlayer].nPlayerViewSect; if (!(SectFlag[nSector] & kSectUnderwater) || WeaponInfo[nWeapon].bFireUnderwater) { @@ -632,7 +632,7 @@ loc_flag: if (((!(nSectFlag & kSectUnderwater)) || nWeapon == kWeaponRing) && (nFrameFlag & 4)) { - BuildFlash(nPlayer, pPlayerSprite->sectnum, 512); + BuildFlash(nPlayer, 512); AddFlash( pPlayerSprite->sectnum, pPlayerSprite->x, diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index 5fdeed08d..276a29f65 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -215,16 +215,16 @@ void SetAbove(short nCurSector, short nAboveSector) SectAbove[nCurSector] = nAboveSector; } -void SnapSectors(short nSectorA, short nSectorB, short b) +void SnapSectors(int nSectorA, int nSectorB, int b) { // edx - nSectorA // eax - nSectorB - short nWallA = sector[nSectorA].wallptr; - short nWallB = sector[nSectorB].wallptr; + int nWallA = sector[nSectorA].wallptr; + int nWallB = sector[nSectorB].wallptr; - short num1 = sector[nSectorA].wallnum; - short num2 = sector[nSectorB].wallnum; + int num1 = sector[nSectorA].wallnum; + int num2 = sector[nSectorB].wallnum; int nCount = 0; @@ -631,7 +631,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag) } case 99: // underwater type 2 { - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; SetAbove(nSector, nHitag); SectFlag[nSector] |= kSectUnderwater; @@ -640,7 +640,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag) } case 98: { - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; SetBelow(nSector, nHitag); SnapSectors(nSector, nHitag, 1); @@ -661,7 +661,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag) nDamage = 1; } - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; SectDamage[nSector] = nDamage; SectFlag[nSector] |= kSectLava; @@ -678,7 +678,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag) } case 94: // water { - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; SectDepth[nSector] = nHitag << 8; DeleteActor(pActor); @@ -697,7 +697,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag) case 79: case 89: { - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; SectSpeed[nSector] = nSpeed; SectFlag[nSector] |= pSprite->ang; @@ -714,7 +714,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag) } case 80: // underwater { - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; SectFlag[nSector] |= kSectUnderwater; DeleteActor(pActor); @@ -724,7 +724,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag) { AddFlow(pSprite->sectnum, nSpeed, 1, pSprite->ang); - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; SectFlag[nSector] |= 0x8000; DeleteActor(pActor); diff --git a/source/games/exhumed/src/lavadude.cpp b/source/games/exhumed/src/lavadude.cpp index 032caeea1..3b7d24ab6 100644 --- a/source/games/exhumed/src/lavadude.cpp +++ b/source/games/exhumed/src/lavadude.cpp @@ -40,7 +40,7 @@ static actionSeq LavadudeSeq[] = { DExhumedActor* BuildLavaLimb(DExhumedActor* pActor, int move, int ebx) { auto pSprite = &pActor->s(); - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; auto pLimbActor = insertActor(nSector, 118); auto pLimbSprite = &pLimbActor->s(); @@ -104,7 +104,7 @@ void AILavaDudeLimb::Draw(RunListEvent* ev) } -void BuildLava(DExhumedActor* pActor, int x, int y, int, short nSector, short nAngle, int nChannel) +void BuildLava(DExhumedActor* pActor, int x, int y, int, int nSector, short nAngle, int nChannel) { spritetype* pSprite; if (pActor == nullptr) @@ -296,7 +296,7 @@ void AILavaDude::Tick(RunListEvent* ev) int x = pSprite->x; int y = pSprite->y; int z = pSprite->z; - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; auto coll = movesprite(pActor, pSprite->xvel << 8, pSprite->yvel << 8, 0, 0, 0, CLIPMASK0); diff --git a/source/games/exhumed/src/lighting.cpp b/source/games/exhumed/src/lighting.cpp index b03f28eb2..95de9f625 100644 --- a/source/games/exhumed/src/lighting.cpp +++ b/source/games/exhumed/src/lighting.cpp @@ -49,14 +49,14 @@ struct Glow { short field_0; short field_2; - short nSector; + int nSector; short field_6; }; struct Flicker { short field_0; - short nSector; + int nSector; unsigned int field_4; }; @@ -212,7 +212,7 @@ void InitLights() nLastFlash = -1; } -void AddFlash(short nSector, int x, int y, int z, int val) +void AddFlash(int nSector, int x, int y, int z, int val) { assert(nSector >= 0 && nSector < kMaxSectors); auto sectp = §or[nSector]; @@ -541,7 +541,7 @@ loc_1868A: } } -void AddGlow(short nSector, int nVal) +void AddGlow(int nSector, int nVal) { if (nGlowCount >= kMaxGlows) { return; @@ -556,7 +556,7 @@ void AddGlow(short nSector, int nVal) } // ok -void AddFlicker(short nSector, int nVal) +void AddFlicker(int nSector, int nVal) { if (nFlickerCount >= kMaxFlickers) { return; @@ -588,7 +588,7 @@ void DoGlows() { sGlow[i].field_2++; - short nSector = sGlow[i].nSector; + int nSector =sGlow[i].nSector; auto sectp = §or[nSector]; short nShade = sGlow[i].field_0; @@ -622,7 +622,7 @@ void DoFlickers() for (int i = 0; i < nFlickerCount; i++) { - short nSector = sFlicker[i].nSector; + int nSector =sFlicker[i].nSector; auto sectp = §or[nSector]; unsigned int eax = (sFlicker[i].field_4 & 1); @@ -728,7 +728,7 @@ void DoFlows() sFlowInfo[i].xdelta &= sFlowInfo[i].xacc; sFlowInfo[i].ydelta &= sFlowInfo[i].yacc; - short nSector = sFlowInfo[i].objindex; + int nSector =sFlowInfo[i].objindex; sector[nSector].setfloorxpan(sFlowInfo[i].xdelta / 16384.f); sector[nSector].setfloorypan(sFlowInfo[i].ydelta / 16384.f); break; @@ -736,7 +736,7 @@ void DoFlows() case 1: { - short nSector = sFlowInfo[i].objindex; + int nSector =sFlowInfo[i].objindex; sector[nSector].setceilingxpan(sFlowInfo[i].xdelta / 16384.f); sector[nSector].setceilingypan(sFlowInfo[i].ydelta / 16384.f); @@ -821,7 +821,7 @@ void SetTorch(int nPlayer, int bTorchOnOff) StatusMessage(150, GStrings(buf)); } -void BuildFlash(short nPlayer, short, int nVal) +void BuildFlash(int nPlayer, int nVal) { if (nPlayer == nLocalPlayer) { diff --git a/source/games/exhumed/src/lion.cpp b/source/games/exhumed/src/lion.cpp index 48a65d484..91f33820d 100644 --- a/source/games/exhumed/src/lion.cpp +++ b/source/games/exhumed/src/lion.cpp @@ -41,7 +41,7 @@ static actionSeq LionSeq[] = { }; -void BuildLion(DExhumedActor* pActor, int x, int y, int z, short nSector, short nAngle) +void BuildLion(DExhumedActor* pActor, int x, int y, int z, int nSector, short nAngle) { spritetype* pSprite; if (pActor == nullptr) diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 90a0d2273..48befbf03 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -237,7 +237,7 @@ void BuildNear(int x, int y, int walldist, int nSector) while (i < NearCount) { - short nSector = NearSector[i]; + int nSector =NearSector[i]; short nWall = sector[nSector].wallptr; short nWallCount = sector[nSector].wallnum; @@ -282,7 +282,7 @@ void BuildNear(int x, int y, int walldist, int nSector) int BelowNear(DExhumedActor* pActor) { auto pSprite = &pActor->s(); - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; int z = pSprite->z; int z2; @@ -340,7 +340,7 @@ int BelowNear(DExhumedActor* pActor) Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdist) { spritetype* pSprite = &pActor->s(); - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; assert(nSector >= 0 && nSector < kMaxSectors); overridesect = nSector; @@ -614,7 +614,7 @@ Collision movesprite(DExhumedActor* pActor, int dx, int dy, int dz, int ceildist void Gravity(DExhumedActor* actor) { auto pSprite = &actor->s(); - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; if (SectFlag[nSector] & kSectUnderwater) { @@ -674,7 +674,7 @@ Collision MoveCreatureWithCaution(DExhumedActor* pActor) auto ecx = MoveCreature(pActor); - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; if (nSector != nSectorPre) { @@ -748,7 +748,7 @@ DExhumedActor* FindPlayer(DExhumedActor* pActor, int nDistance, bool dontengage) int x = pSprite->x; int y = pSprite->y; - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; int z = pSprite->z - GetActorHeight(pActor); @@ -790,7 +790,7 @@ DExhumedActor* FindPlayer(DExhumedActor* pActor, int nDistance, bool dontengage) return pPlayerActor; } -void CheckSectorFloor(short nSector, int z, int *x, int *y) +void CheckSectorFloor(int nSector, int z, int *x, int *y) { short nSpeed = SectSpeed[nSector]; @@ -910,7 +910,7 @@ void CreatePushBlock(int nSector) sectp->extra = nBlock; } -void MoveSector(short nSector, int nAngle, int *nXVel, int *nYVel) +void MoveSector(int nSector, int nAngle, int *nXVel, int *nYVel) { if (nSector == -1) { return; diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index 39f69acd5..43cf95dab 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -58,7 +58,7 @@ struct TrailPoint struct Bob { - short nSector; + int nSector; char field_2; char field_3; int z; @@ -78,7 +78,7 @@ struct Elev DExhumedActor* pActor; short field_0; short nChannel; - short nSector; + int nSector; int field_6; int field_A; short nCountZOffsets; // count of items in zOffsets @@ -91,7 +91,7 @@ struct Elev // 16 bytes struct MoveSect { - short nSector; + int nSector; short nTrail; short nTrailPoint; short field_6; @@ -138,7 +138,7 @@ struct slideData struct Point { - short nSector; + int nSector; short field_2; short field_4; short field_6; @@ -415,7 +415,7 @@ DExhumedActor* BuildWallSprite(int nSector) } // done -DExhumedActor* FindWallSprites(short nSector) +DExhumedActor* FindWallSprites(int nSector) { int var_24 = 0x7FFFFFFF; int ecx = 0x7FFFFFFF; @@ -610,7 +610,7 @@ int LongSeek(int* pZVal, int a2, int a3, int a4) } // done -int CheckSectorSprites(short nSector, int nVal) +int CheckSectorSprites(int nSector, int nVal) { int b = 0; @@ -784,7 +784,7 @@ void AIElev::Tick(RunListEvent* ev) assert(nChannel >= 0 && nChannel < kMaxChannels); - short nSector = Elevator[nElev].nSector; + int nSector =Elevator[nElev].nSector; auto pElevSpr = Elevator[nElev].pActor; int ebp = 0; // initialise to *something* @@ -993,7 +993,7 @@ int BuildSlide(int nChannel, int nStartWall, int nWall1, int ecx, int nWall2, in { auto nSlide = SlideData.Reserve(1); - short nSector = IdentifySector(nStartWall); + int nSector =IdentifySector(nStartWall); SlideData[nSlide].field_4a = -1; SlideData[nSlide].nChannel = nChannel; @@ -1295,7 +1295,7 @@ int BuildTrap(DExhumedActor* pActor, int edx, int ebx, int ecx) sTrap[nTrap].field_6 = -1; sTrap[nTrap].field_8 = -1; - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; short nWall = sector[nSector].wallptr; int i = 0; @@ -1636,7 +1636,7 @@ void DoFinale() } } -DExhumedActor* BuildEnergyBlock(short nSector) +DExhumedActor* BuildEnergyBlock(int nSector) { short startwall = sector[nSector].wallptr; short nWalls = sector[nSector].wallnum; @@ -1724,7 +1724,7 @@ void ExplodeEnergyBlock(DExhumedActor* pActor) { auto pSprite = &pActor->s(); - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; short startwall = sector[nSector].wallptr; short nWalls = sector[nSector].wallnum; @@ -1861,7 +1861,7 @@ void AIEnergyBlock::RadialDamage(RunListEvent* ev) if (!pActor) return; auto spr = &pActor->s(); - short nSector = spr->sectnum; + int nSector =spr->sectnum; if (sector[nSector].extra == -1) { return; @@ -2229,7 +2229,7 @@ void DoDrips() sBob[i].field_2 += 4; int edx = bsin(sBob[i].field_2 << 3, -4); - short nSector = sBob[i].nSector; + int nSector =sBob[i].nSector; if (sBob[i].field_3) { @@ -2246,7 +2246,7 @@ void DoDrips() } } -void SnapBobs(short nSectorA, short nSectorB) +void SnapBobs(int nSectorA, int nSectorB) { int ecx = -1; int ebx = ecx; @@ -2430,7 +2430,7 @@ void DoMovingSects() continue; } - short nSector = sMoveSect[i].nSector; + int nSector =sMoveSect[i].nSector; short nBlock = sector[nSector].extra; BlockInfo* pBlockInfo = &sBlockInfo[nBlock]; @@ -2568,7 +2568,7 @@ void PostProcess() runlist_ChangeChannel(sMoveSect[i].field_14, 1); } - short nSector = sMoveSect[i].nSector; + int nSector =sMoveSect[i].nSector; if (SectFlag[nSector] & kSectUnderwater) { diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index c3ab6f8a8..bcde8b458 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -98,7 +98,7 @@ void RestoreSavePoint(int nPlayer, int *x, int *y, int *z, short *nSector, short *nAngle = PlayerList[nPlayer].sPlayerSave.nAngle; } -void SetSavePoint(int nPlayer, int x, int y, int z, short nSector, short nAngle) +void SetSavePoint(int nPlayer, int x, int y, int z, int nSector, short nAngle) { PlayerList[nPlayer].sPlayerSave.x = x; PlayerList[nPlayer].sPlayerSave.y = y; @@ -458,7 +458,7 @@ void StartDeathSeq(int nPlayer, int nVal) if (nWeapon > kWeaponSword && nWeapon <= kWeaponRing) { - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; if (SectBelow[nSector] > -1) { nSector = SectBelow[nSector]; } @@ -864,7 +864,7 @@ void AIPlayer::Tick(RunListEvent* ev) } // loc_1A4E6 - short nSector = pPlayerSprite->sectnum; + int nSector =pPlayerSprite->sectnum; short nSectFlag = SectFlag[PlayerList[nPlayer].nPlayerViewSect]; int playerX = pPlayerSprite->x; diff --git a/source/games/exhumed/src/player.h b/source/games/exhumed/src/player.h index 1b214d043..81f9cb1c7 100644 --- a/source/games/exhumed/src/player.h +++ b/source/games/exhumed/src/player.h @@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_PS_NS void RestoreSavePoint(int nPlayer, int *x, int *y, int *z, short *nSector, short *nAngle); -void SetSavePoint(int nPlayer, int x, int y, int z, short nSector, short nAngle); +void SetSavePoint(int nPlayer, int x, int y, int z, int nSector, short nAngle); void InitPlayer(); void InitPlayerKeys(short nPlayer); int GrabPlayer(); @@ -52,7 +52,7 @@ struct PlayerSave int x; int y; int z; - short nSector; + int nSector; short nAngle; }; diff --git a/source/games/exhumed/src/queen.cpp b/source/games/exhumed/src/queen.cpp index 0ba13570d..131aa91d1 100644 --- a/source/games/exhumed/src/queen.cpp +++ b/source/games/exhumed/src/queen.cpp @@ -384,7 +384,7 @@ void BuildTail() int x = pSprite->x; int y = pSprite->x; int z = pSprite->x; - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; int i; @@ -437,7 +437,7 @@ void BuildQueenEgg(short nQueen, int nVal) int x = pSprite->x; int y = pSprite->y; - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; int nFloorZ = sector[nSector].floorz; short nAngle = pSprite->ang; @@ -698,7 +698,7 @@ void BuildQueenHead(short nQueen) int x = pSprite->x; int y = pSprite->y; short nAngle = pSprite->ang; - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; int z = sector[nSector].floorz; auto pActor2 = insertActor(nSector, 121); @@ -973,7 +973,7 @@ void AIQueenHead::Tick(RunListEvent* ev) int x = pSprite->x; int y = pSprite->y; int z = pSprite->z; - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; int nAngle = RandomSize(11) & kAngleMask; pSprite->xrepeat = 127 - QueenHead.nIndex2; diff --git a/source/games/exhumed/src/ramses.cpp b/source/games/exhumed/src/ramses.cpp index 95d9dc79e..15ccab033 100644 --- a/source/games/exhumed/src/ramses.cpp +++ b/source/games/exhumed/src/ramses.cpp @@ -159,7 +159,7 @@ void InitSpiritHead() nTalkTime = 1; } -void DimSector(short nSector) +void DimSector(int nSector) { short startwall = sector[nSector].wallptr; short nWalls = sector[nSector].wallnum; diff --git a/source/games/exhumed/src/rat.cpp b/source/games/exhumed/src/rat.cpp index e13f5c980..e49c1944d 100644 --- a/source/games/exhumed/src/rat.cpp +++ b/source/games/exhumed/src/rat.cpp @@ -73,7 +73,7 @@ void SetRatVel(spritetype* pSprite) pSprite->yvel = bsin(pSprite->ang, -2); } -void BuildRat(DExhumedActor* pActor, int x, int y, int z, short nSector, int nAngle) +void BuildRat(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAngle) { spritetype* pSprite; if (pActor == nullptr) diff --git a/source/games/exhumed/src/rex.cpp b/source/games/exhumed/src/rex.cpp index d918a3994..89bf800c1 100644 --- a/source/games/exhumed/src/rex.cpp +++ b/source/games/exhumed/src/rex.cpp @@ -37,7 +37,7 @@ static actionSeq RexSeq[] = { {28, 1} }; -void BuildRex(DExhumedActor* pActor, int x, int y, int z, short nSector, short nAngle, int nChannel) +void BuildRex(DExhumedActor* pActor, int x, int y, int z, int nSector, short nAngle, int nChannel) { spritetype* pSprite; if (pActor == nullptr) diff --git a/source/games/exhumed/src/roach.cpp b/source/games/exhumed/src/roach.cpp index d797b0dcd..0c4834d12 100644 --- a/source/games/exhumed/src/roach.cpp +++ b/source/games/exhumed/src/roach.cpp @@ -47,7 +47,7 @@ struct Roach }; // TODO - make nType a bool? -void BuildRoach(int nType, DExhumedActor* pActor, int x, int y, int z, short nSector, int angle) +void BuildRoach(int nType, DExhumedActor* pActor, int x, int y, int z, int nSector, int angle) { spritetype* pSprite; if (pActor == nullptr) diff --git a/source/games/exhumed/src/scorp.cpp b/source/games/exhumed/src/scorp.cpp index 12d7615d2..939fcc0bf 100644 --- a/source/games/exhumed/src/scorp.cpp +++ b/source/games/exhumed/src/scorp.cpp @@ -38,7 +38,7 @@ static actionSeq ScorpSeq[] = { {53, 1} }; -void BuildScorp(DExhumedActor* pActor, int x, int y, int z, short nSector, short nAngle, int nChannel) +void BuildScorp(DExhumedActor* pActor, int x, int y, int z, int nSector, short nAngle, int nChannel) { spritetype* pSprite; diff --git a/source/games/exhumed/src/sequence.cpp b/source/games/exhumed/src/sequence.cpp index e227434f1..9d504aa0c 100644 --- a/source/games/exhumed/src/sequence.cpp +++ b/source/games/exhumed/src/sequence.cpp @@ -608,7 +608,7 @@ int seq_PlotSequence(short nSprite, short edx, short nFrame, short ecx) } else { - short nSector = pTSprite->sectnum; + int nSector =pTSprite->sectnum; int nFloorZ = sector[nSector].floorz; if (nFloorZ <= PlayerList[nLocalPlayer].eyelevel + initz) { diff --git a/source/games/exhumed/src/set.cpp b/source/games/exhumed/src/set.cpp index 96d894023..e0a4109d4 100644 --- a/source/games/exhumed/src/set.cpp +++ b/source/games/exhumed/src/set.cpp @@ -39,7 +39,7 @@ static actionSeq SetSeq[] = { {74, 1} }; -void BuildSet(DExhumedActor* pActor, int x, int y, int z, short nSector, short nAngle, int nChannel) +void BuildSet(DExhumedActor* pActor, int x, int y, int z, int nSector, short nAngle, int nChannel) { spritetype* pSprite; if (pActor == nullptr) @@ -120,7 +120,7 @@ void BuildSoul(DExhumedActor* pSet) pSprite->x = pSetSprite->x; pSprite->y = pSetSprite->y; - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; pSprite->z = (RandomSize(8) << 8) + 8192 + sector[nSector].ceilingz - GetActorHeight(pActor); //pSprite->hitag = nSet; diff --git a/source/games/exhumed/src/snake.cpp b/source/games/exhumed/src/snake.cpp index 9f44abb13..b89a7ca2a 100644 --- a/source/games/exhumed/src/snake.cpp +++ b/source/games/exhumed/src/snake.cpp @@ -274,7 +274,7 @@ DExhumedActor* FindSnakeEnemy(short nSnake) auto pSprite = &pActor->s(); short nAngle = pSprite->ang; - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; int esi = 2048; @@ -380,7 +380,7 @@ void AISnake::Tick(RunListEvent* ev) SnakeList[nSnake].sE = (SnakeList[nSnake].sE + 64) & 0x7FF; int var_28 = (nAngle + 512) & kAngleMask; - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; int x = pSprite->x; int y = pSprite->y; diff --git a/source/games/exhumed/src/sound.cpp b/source/games/exhumed/src/sound.cpp index 68dd4d550..7bd9b81a7 100644 --- a/source/games/exhumed/src/sound.cpp +++ b/source/games/exhumed/src/sound.cpp @@ -673,7 +673,7 @@ void PlayFXAtXYZ(unsigned short ax, int x, int y, int z, int nSector, EChanFlags // //========================================================================== -void CheckAmbience(short nSector) +void CheckAmbience(int nSector) { if (!SoundEnabled()) return; if (SectSound[nSector] != -1) diff --git a/source/games/exhumed/src/sound.h b/source/games/exhumed/src/sound.h index fdd6310f2..757852aa6 100644 --- a/source/games/exhumed/src/sound.h +++ b/source/games/exhumed/src/sound.h @@ -129,7 +129,7 @@ void PlayLocalSound(short nSound, short val, bool unattached = false, EChanFlags int LoadSound(const char* sound); void BendAmbientSound(); -void CheckAmbience(short nSector); +void CheckAmbience(int nSector); void PlayFX2(unsigned short nSound, DExhumedActor* nSprite, int sectf = 0, EChanFlags chanflags = CHANF_NONE, int sprflags = 0); diff --git a/source/games/exhumed/src/spider.cpp b/source/games/exhumed/src/spider.cpp index 449a4c967..26e4b4921 100644 --- a/source/games/exhumed/src/spider.cpp +++ b/source/games/exhumed/src/spider.cpp @@ -36,7 +36,7 @@ static actionSeq SpiderSeq[] = { }; -DExhumedActor* BuildSpider(DExhumedActor* spp, int x, int y, int z, short nSector, int nAngle) +DExhumedActor* BuildSpider(DExhumedActor* spp, int x, int y, int z, int nSector, int nAngle) { spritetype* sp; if (spp == nullptr) @@ -178,7 +178,7 @@ void AISpider::Tick(RunListEvent* ev) case 3: { case_3: - short nSector = sp->sectnum; + int nSector =sp->sectnum; if (sp->cstat & 8) { diff --git a/source/games/exhumed/src/switch.cpp b/source/games/exhumed/src/switch.cpp index 34f235bcc..3bc2ff6b3 100644 --- a/source/games/exhumed/src/switch.cpp +++ b/source/games/exhumed/src/switch.cpp @@ -42,7 +42,7 @@ struct Switch short nChannel; short nLink; short nRunPtr; - short nSector; + int nSector; short nRun2; short nWall; short nRun3; @@ -255,7 +255,7 @@ void AISWStepOn::ProcessChannel(RunListEvent* ev) short nLink = SwitchData[nSwitch].nLink; short nChannel = SwitchData[nSwitch].nChannel; - short nSector = SwitchData[nSwitch].nSector; + int nSector =SwitchData[nSwitch].nSector; assert(sRunChannels[nChannel].c < 8); @@ -280,7 +280,7 @@ void AISWStepOn::TouchFloor(RunListEvent* ev) short nLink = SwitchData[nSwitch].nLink; short nChannel = SwitchData[nSwitch].nChannel; - short nSector = SwitchData[nSwitch].nSector; + int nSector =SwitchData[nSwitch].nSector; assert(sRunChannels[nChannel].c < 8); @@ -367,7 +367,7 @@ void AISWNotOnPause::Process(RunListEvent* ev) { SwitchData[nSwitch].nRunPtr = runlist_AddRunRec(NewRun, &RunData[ev->nRun]); - short nSector = SwitchData[nSwitch].nSector; + int nSector =SwitchData[nSwitch].nSector; SwitchData[nSwitch].nWaitTimer = SwitchData[nSwitch].nWait; SwitchData[nSwitch].nRun2 = runlist_AddRunRec(sector[nSector].lotag - 1, &RunData[ev->nRun]); @@ -419,7 +419,7 @@ void AISWPressSector::ProcessChannel(RunListEvent* ev) return; } - short nSector = SwitchData[nSwitch].nSector; + int nSector =SwitchData[nSwitch].nSector; SwitchData[nSwitch].nRun2 = runlist_AddRunRec(sector[nSector].lotag - 1, &RunData[ev->nRun]); } @@ -506,7 +506,7 @@ void AISWPressWall::Use(RunListEvent* ev) } short nWall = SwitchData[nSwitch].nWall; - short nSector = SwitchData[nSwitch].nSector; // CHECKME - where is this set?? + int nSector =SwitchData[nSwitch].nSector; // CHECKME - where is this set?? PlayFXAtXYZ(StaticSound[nSwitchSound], wall[nWall].x, wall[nWall].y, 0, nSector, CHANF_LISTENERZ); } diff --git a/source/games/exhumed/src/view.cpp b/source/games/exhumed/src/view.cpp index 5f2e506fd..b992dad82 100644 --- a/source/games/exhumed/src/view.cpp +++ b/source/games/exhumed/src/view.cpp @@ -96,7 +96,7 @@ static void analyzesprites(spritetype* tsprite, int& spritesortcnt, int x, int y bestTarget = nullptr; - short nSector = pPlayerSprite->sectnum; + int nSector =pPlayerSprite->sectnum; int nAngle = (2048 - pPlayerSprite->ang) & kAngleMask; diff --git a/source/games/exhumed/src/wasp.cpp b/source/games/exhumed/src/wasp.cpp index bebcbb5dd..fd4ac5164 100644 --- a/source/games/exhumed/src/wasp.cpp +++ b/source/games/exhumed/src/wasp.cpp @@ -40,7 +40,7 @@ void SetWaspVel(spritetype* pSprite) pSprite->yvel = bsin(pSprite->ang); } -DExhumedActor* BuildWasp(DExhumedActor* pActor, int x, int y, int z, short nSector, short nAngle, bool bEggWasp) +DExhumedActor* BuildWasp(DExhumedActor* pActor, int x, int y, int z, int nSector, short nAngle, bool bEggWasp) { spritetype* pSprite; if (pActor == nullptr) @@ -339,7 +339,7 @@ void AIWasp::Tick(RunListEvent* ev) } case 5: { - short nSector = pSprite->sectnum; + int nSector =pSprite->sectnum; pSprite->z += pSprite->zvel;