- short review and disasm variable renaming

(down to 200 shorts)
This commit is contained in:
Christoph Oelckers 2021-11-21 20:34:15 +01:00
parent 033a73bce0
commit d73c7aa543
24 changed files with 194 additions and 210 deletions

View file

@ -57,8 +57,6 @@ void BlackOut();
void DoGameOverScene(bool finallevel);
int Query(short n, short l, ...);
extern unsigned char curpal[];
void TintPalette(int a, int b, int c);
@ -84,7 +82,6 @@ void GameTicker();
void InitLevel(MapRecord*);
void InitNewGame();
int showmap(short nLevel, short nLevelNew, short nLevelBest);
void menu_DoPlasma();
void DoEnergyTile();
void InitEnergyTile();
@ -174,7 +171,7 @@ class TextOverlay
{
FFont* font;
double nCrawlY;
short nLeft[50];
int16_t nLeft[50];
int nHeight;
double lastclock;
TArray<FString> screentext;

View file

@ -40,7 +40,7 @@ static actionSeq FishSeq[] = {
void BuildFishLimb(DExhumedActor* pActor, short anim)
void BuildFishLimb(DExhumedActor* pActor, int anim)
{
auto pSprite = &pActor->s();
@ -198,7 +198,7 @@ void BuildFish(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAng
nCreaturesTotal++;
}
void IdleFish(DExhumedActor* pActor, short edx)
void IdleFish(DExhumedActor* pActor, int edx)
{
auto pSprite = &pActor->s();
@ -241,7 +241,7 @@ void AIFish::Draw(RunListEvent* ev)
{
auto pActor = ev->pObjActor;
if (pActor == nullptr) return;
short nAction = pActor->nAction;
int nAction = pActor->nAction;
seq_PlotSequence(ev->nParam, SeqOffsets[kSeqFish] + FishSeq[nAction].a, pActor->nFrame, FishSeq[nAction].b);
ev->pTSprite->owner = -1;
@ -324,14 +324,14 @@ void AIFish::Tick(RunListEvent* ev)
if (pActor == nullptr) return;
auto pSprite = &pActor->s();
short nAction = pActor->nAction;
int nAction = pActor->nAction;
if (!(pSprite->sector()->Flag & kSectUnderwater))
{
Gravity(pActor);
}
short nSeq = SeqOffsets[kSeqFish] + FishSeq[nAction].a;
int nSeq = SeqOffsets[kSeqFish] + FishSeq[nAction].a;
pSprite->picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame);

View file

@ -40,7 +40,7 @@
template<class Type, int size> class FreeListArray
{
int freecount;
short FreeList[size];
int16_t FreeList[size];
Type DataList[size];
public:
enum { count = size };

View file

@ -52,7 +52,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS
short nBestLevel;
int nBestLevel;
void RunCinemaScene(int num);
void GameMove(void);

View file

@ -193,7 +193,7 @@ void ExplodeGrenade(DExhumedActor* pActor)
}
}
short nDamage = BulletInfo[kWeaponGrenade].nDamage;
int nDamage = BulletInfo[kWeaponGrenade].nDamage;
if (PlayerList[nPlayer].nDouble > 0) {
nDamage *= 2;
@ -212,7 +212,7 @@ void AIGrenade::Draw(RunListEvent* ev)
auto pActor = ev->pObjActor;
if (!pActor) return;
short nSeq = pActor->nFrame ? SeqOffsets[kSeqGrenBoom] : SeqOffsets[kSeqGrenRoll] + pActor->nIndex;
int nSeq = pActor->nFrame ? SeqOffsets[kSeqGrenBoom] : SeqOffsets[kSeqGrenRoll] + pActor->nIndex;
seq_PlotSequence(ev->nParam, nSeq, pActor->nHealth >> 8, 1);
}
@ -223,7 +223,7 @@ void AIGrenade::Tick(RunListEvent* ev)
if (!pActor) return;
auto pGrenadeSprite = &pActor->s();
short nSeq = pActor->nFrame ? SeqOffsets[kSeqGrenBoom] : SeqOffsets[kSeqGrenRoll] + pActor->nIndex;
int nSeq = pActor->nFrame ? SeqOffsets[kSeqGrenBoom] : SeqOffsets[kSeqGrenRoll] + pActor->nIndex;
seq_MoveSequence(pActor, nSeq, pActor->nHealth >> 8);
pGrenadeSprite->picnum = seq_GetSeqPicnum2(nSeq, pActor->nHealth >> 8);

View file

@ -48,7 +48,7 @@ Weapon WeaponInfo[] = {
int16_t nTemperature[kMaxPlayers];
static const uint8_t nMinAmmo[] = { 0, 24, 51, 50, 1, 0, 0 };
short isRed = 0;
int isRed = 0;
void SerializeGun(FSerializer& arc)
@ -134,7 +134,7 @@ void SetNewWeapon(int nPlayer, int nWeapon)
}
else if (nWeapon != kWeaponGrenade || PlayerList[nPlayer].nAmmo[kWeaponGrenade] > 0)
{
short nCurrentWeapon = PlayerList[nPlayer].nCurrentWeapon;
int nCurrentWeapon = PlayerList[nPlayer].nCurrentWeapon;
if (nCurrentWeapon != kWeaponMummified)
{
@ -243,7 +243,7 @@ void ResetSwordSeqs()
Collision CheckCloseRange(int nPlayer, int *x, int *y, int *z, int *nSector)
{
short hitSect, hitWall, hitSprite;
int hitSect, hitWall, hitSprite;
int hitX, hitY, hitZ;
auto pActor = PlayerList[nPlayer].Actor();
@ -329,7 +329,7 @@ void MoveWeapons(int nPlayer)
auto pPlayerActor = PlayerList[nPlayer].Actor();
auto pPlayerSprite = &pPlayerActor->s();
short nWeapon = PlayerList[nPlayer].nCurrentWeapon;
int nWeapon = PlayerList[nPlayer].nCurrentWeapon;
if (nWeapon < -1)
{
@ -345,10 +345,10 @@ void MoveWeapons(int nPlayer)
}
// loc_26ACC
short eax = PlayerList[nPlayer].nState;
short nSeq = WeaponInfo[nWeapon].nSeq;
int eax = PlayerList[nPlayer].nState;
int nSeq = WeaponInfo[nWeapon].nSeq;
short var_3C = WeaponInfo[nWeapon].b[eax] + SeqOffsets[nSeq];
int var_3C = WeaponInfo[nWeapon].b[eax] + SeqOffsets[nSeq];
int var_1C = (PlayerList[nPlayer].nDouble > 0) + 1;
@ -721,7 +721,7 @@ loc_flag:
if (cRange.type != kHitNone)
{
short nDamage = BulletInfo[kWeaponSword].nDamage;
int nDamage = BulletInfo[kWeaponSword].nDamage;
if (PlayerList[nPlayer].nDouble) {
nDamage *= 2;
@ -851,7 +851,7 @@ loc_flag:
case kWeaponMummified:
{
short nDamage = BulletInfo[kWeaponMummified].nDamage;
int nDamage = BulletInfo[kWeaponMummified].nDamage;
if (PlayerList[nPlayer].nDouble) {
nDamage *= 2;
}
@ -903,15 +903,15 @@ void DrawWeapons(double smooth)
return;
}
short nWeapon = PlayerList[nLocalPlayer].nCurrentWeapon;
int nWeapon = PlayerList[nLocalPlayer].nCurrentWeapon;
if (nWeapon < -1) {
return;
}
short var_34 = PlayerList[nLocalPlayer].nState;
int var_34 = PlayerList[nLocalPlayer].nState;
short var_30 = SeqOffsets[WeaponInfo[nWeapon].nSeq];
int var_30 = SeqOffsets[WeaponInfo[nWeapon].nSeq];
short var_28 = var_30 + WeaponInfo[nWeapon].b[var_34];
int var_28 = var_30 + WeaponInfo[nWeapon].b[var_34];
int8_t nShade = sector[initsect].ceilingshade;
@ -1015,7 +1015,7 @@ void DrawWeapons(double smooth)
{
int nClip = PlayerList[nLocalPlayer].nPlayerClip;
short edx = (nClip % 3) * 4;
int edx = (nClip % 3) * 4;
if (nClip <= 0) {
return;
@ -1046,7 +1046,7 @@ void DrawWeapons(double smooth)
{
int nClip = PlayerList[nLocalPlayer].nPlayerClip;
short dx = PlayerList[nLocalPlayer].nSeqSize2;
int dx = PlayerList[nLocalPlayer].nSeqSize2;
if (nClip <= 0) {
return;
@ -1082,7 +1082,7 @@ void DrawWeapons(double smooth)
{
int nClip = PlayerList[nLocalPlayer].nPlayerClip;
short ax = PlayerList[nLocalPlayer].nSeqSize2;
int ax = PlayerList[nLocalPlayer].nSeqSize2;
if (nClip <= 0) {
return;

View file

@ -194,12 +194,12 @@ void InitNewGame()
}
}
void SetBelow(short nCurSector, short nBelowSector)
void SetBelow(int nCurSector, int nBelowSector)
{
sector[nCurSector].Below = nBelowSector;
}
void SetAbove(short nCurSector, short nAboveSector)
void SetAbove(int nCurSector, int nAboveSector)
{
sector[nCurSector].Above = nAboveSector;
}
@ -276,7 +276,7 @@ void InitSectFlag()
}
}
void ProcessSpriteTag(DExhumedActor* pActor, short nLotag, short nHitag)
void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag)
{
auto pSprite = &pActor->s();
int nChannel = runlist_AllocChannel(nHitag % 1000);

View file

@ -29,8 +29,8 @@ BEGIN_PS_NS
struct AnimInfo
{
short a;
short repeat;
int16_t a;
int16_t repeat;
};
AnimInfo nItemAnimInfo[] = {
@ -98,15 +98,8 @@ AnimInfo nItemAnimInfo[] = {
const int16_t nItemMagic[] = { 500, 1000, 100, 500, 400, 200, 700, 0 };
/*
short something
short x/y repeat
*/
TArray<DExhumedActor*> Regenerates;
short nMagicCount;
int nMagicCount;
void SerializeItems(FSerializer& arc)
{

View file

@ -164,8 +164,8 @@ void AILavaDude::Draw(RunListEvent* ev)
auto pActor = ev->pObjActor;
if (!pActor) return;
short nAction = pActor->nAction;
short nSeq = LavadudeSeq[nAction].a + SeqOffsets[kSeqLavag];
int nAction = pActor->nAction;
int nSeq = LavadudeSeq[nAction].a + SeqOffsets[kSeqLavag];
seq_PlotSequence(ev->nParam, nSeq, pActor->nFrame, LavadudeSeq[nAction].b);
ev->pTSprite->owner = -1;
@ -177,7 +177,7 @@ void AILavaDude::Damage(RunListEvent* ev)
auto pActor = ev->pObjActor;
if (!pActor) return;
short nAction = pActor->nAction;
int nAction = pActor->nAction;
auto pSprite = &pActor->s();
if (!ev->nDamage)
@ -228,15 +228,15 @@ void AILavaDude::Tick(RunListEvent* ev)
auto pActor = ev->pObjActor;
if (!pActor) return;
short nAction = pActor->nAction;
short nSeq = LavadudeSeq[nAction].a + SeqOffsets[kSeqLavag];
int nAction = pActor->nAction;
int nSeq = LavadudeSeq[nAction].a + SeqOffsets[kSeqLavag];
auto pSprite = &pActor->s();
pSprite->picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame);
int var_38 = pActor->nFrame;
short nFlag = FrameFlag[SeqBase[nSeq] + var_38];
int nFlag = FrameFlag[SeqBase[nSeq] + var_38];
int var_1C = 0;

View file

@ -47,17 +47,17 @@ struct Flash
struct Glow
{
short field_0;
short field_2;
int16_t nShade;
int16_t nCounter;
int nSector;
short field_6;
int16_t nThreshold;
};
struct Flicker
{
short field_0;
int16_t nShade;
int nSector;
unsigned int field_4;
unsigned int nMask;
};
struct Flow
@ -109,10 +109,10 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Glow& w, Glow* def
{
if (arc.BeginObject(keyname))
{
arc("at0", w.field_0)
("at2", w.field_2)
arc("at0", w.nShade)
("at2", w.nCounter)
("sector", w.nSector)
("at6", w.field_6)
("at6", w.nThreshold)
.EndObject();
}
return arc;
@ -122,9 +122,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Flicker& w, Flicke
{
if (arc.BeginObject(keyname))
{
arc("at0", w.field_0)
arc("at0", w.nShade)
("sector", w.nSector)
("at4", w.field_4)
("at4", w.nMask)
.EndObject();
}
return arc;
@ -267,7 +267,7 @@ void AddFlash(int nSector, int x, int y, int z, int val)
{
if (!pNextSector || pNextSector->floorz < sectp->floorz)
{
short nFlash = GrabFlash();
int nFlash = GrabFlash();
if (nFlash < 0) {
return;
}
@ -298,7 +298,7 @@ void AddFlash(int nSector, int x, int y, int z, int val)
if (var_14 && sectp->floorpal < 4)
{
short nFlash = GrabFlash();
int nFlash = GrabFlash();
if (nFlash < 0) {
return;
}
@ -322,7 +322,7 @@ void AddFlash(int nSector, int x, int y, int z, int val)
{
if (sectp->ceilingpal < 4)
{
short nFlash2 = GrabFlash();
int nFlash2 = GrabFlash();
if (nFlash2 >= 0)
{
sFlash[nFlash2].nType = var_20 | 3;
@ -349,7 +349,7 @@ void AddFlash(int nSector, int x, int y, int z, int val)
auto pSprite = &pActor->s();
if (pSprite->pal < 4)
{
short nFlash3 = GrabFlash();
int nFlash3 = GrabFlash();
if (nFlash3 >= 0)
{
sFlash[nFlash3].nType = var_20 | 4;
@ -378,7 +378,7 @@ void AddFlash(int nSector, int x, int y, int z, int val)
if (eax < 0)
{
short shade = pSprite->shade + eax;
int shade = pSprite->shade + eax;
if (shade < -127) {
shade = -127;
}
@ -540,10 +540,10 @@ void AddGlow(int nSector, int nVal)
return;
}
sGlow[nGlowCount].field_6 = nVal;
sGlow[nGlowCount].nThreshold = nVal;
sGlow[nGlowCount].nSector = nSector;
sGlow[nGlowCount].field_0 = -1;
sGlow[nGlowCount].field_2 = 0;
sGlow[nGlowCount].nShade = -1;
sGlow[nGlowCount].nCounter = 0;
nGlowCount++;
}
@ -555,14 +555,14 @@ void AddFlicker(int nSector, int nVal)
return;
}
sFlicker[nFlickerCount].field_0 = nVal;
sFlicker[nFlickerCount].nShade = nVal;
sFlicker[nFlickerCount].nSector = nSector;
if (nVal >= 25) {
nVal = 24;
}
sFlicker[nFlickerCount].field_4 = flickermask[nVal];
sFlicker[nFlickerCount].nMask = flickermask[nVal];
nFlickerCount++;
}
@ -579,16 +579,16 @@ void DoGlows()
for (int i = 0; i < nGlowCount; i++)
{
sGlow[i].field_2++;
sGlow[i].nCounter++;
int nSector =sGlow[i].nSector;
auto sectp = &sector[nSector];
short nShade = sGlow[i].field_0;
int nShade = sGlow[i].nShade;
if (sGlow[i].field_2 >= sGlow[i].field_6)
if (sGlow[i].nCounter >= sGlow[i].nThreshold)
{
sGlow[i].field_2 = 0;
sGlow[i].field_0 = -sGlow[i].field_0;
sGlow[i].nCounter = 0;
sGlow[i].nShade = -sGlow[i].nShade;
}
sectp->ceilingshade += nShade;
@ -618,26 +618,26 @@ void DoFlickers()
int nSector =sFlicker[i].nSector;
auto sectp = &sector[nSector];
unsigned int eax = (sFlicker[i].field_4 & 1);
unsigned int edx = (sFlicker[i].field_4 & 1) << 31;
unsigned int ebp = sFlicker[i].field_4 >> 1;
unsigned int eax = (sFlicker[i].nMask & 1);
unsigned int edx = (sFlicker[i].nMask & 1) << 31;
unsigned int ebp = sFlicker[i].nMask >> 1;
ebp |= edx;
edx = ebp & 1;
sFlicker[i].field_4 = ebp;
sFlicker[i].nMask = ebp;
if (edx ^ eax)
{
short shade;
int shade;
if (eax)
{
shade = sFlicker[i].field_0;
shade = sFlicker[i].nShade;
}
else
{
shade = -sFlicker[i].field_0;
shade = -sFlicker[i].nShade;
}
sectp->ceilingshade += shade;
@ -662,13 +662,13 @@ void AddFlow(int nIndex, int nSpeed, int b, int nAngle)
if (nFlowCount >= kMaxFlows)
return;
short nFlow = nFlowCount;
int nFlow = nFlowCount;
nFlowCount++;
if (b < 2)
{
short nPic = sector[nIndex].floorpicnum;
int nPic = sector[nIndex].floorpicnum;
sFlowInfo[nFlow].xacc = (tileWidth(nPic) << 14) - 1;
sFlowInfo[nFlow].yacc = (tileHeight(nPic) << 14) - 1;
@ -693,7 +693,7 @@ void AddFlow(int nIndex, int nSpeed, int b, int nAngle)
nAngle = 1536;
}
short nPic = wall[nIndex].picnum;
int nPic = wall[nIndex].picnum;
sFlowInfo[nFlow].xacc = (tileWidth(nPic) * wall[nIndex].xrepeat) << 8;
sFlowInfo[nFlow].yacc = (tileHeight(nPic) * wall[nIndex].yrepeat) << 8;

View file

@ -99,7 +99,7 @@ void AILion::Draw(RunListEvent* ev)
{
auto pActor = ev->pObjActor;
if (!pActor) return;
short nAction = pActor->nAction;
int nAction = pActor->nAction;
seq_PlotSequence(ev->nParam, SeqOffsets[kSeqLion] + LionSeq[nAction].a, pActor->nFrame, LionSeq[nAction].b);
}
@ -119,7 +119,7 @@ void AILion::Damage(RunListEvent* ev)
if (!pActor) return;
auto pSprite = &pActor->s();
short nAction = pActor->nAction;
int nAction = pActor->nAction;
if (ev->nDamage && pActor->nHealth > 0)
{
@ -199,7 +199,7 @@ void AILion::Tick(RunListEvent* ev)
if (!pActor) return;
auto pSprite = &pActor->s();
short nAction = pActor->nAction;
int nAction = pActor->nAction;
bool bVal = false;
@ -208,7 +208,7 @@ void AILion::Tick(RunListEvent* ev)
Gravity(pActor);
}
short nSeq = SeqOffsets[kSeqLion] + LionSeq[nAction].a;
int nSeq = SeqOffsets[kSeqLion] + LionSeq[nAction].a;
pSprite->picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame);
@ -221,7 +221,7 @@ void AILion::Tick(RunListEvent* ev)
bVal = true;
}
short nFlag = FrameFlag[SeqBase[nSeq] + pActor->nFrame];
int nFlag = FrameFlag[SeqBase[nSeq] + pActor->nFrame];
auto pTarget = pActor->pTarget;
auto nMov = MoveCreatureWithCaution(pActor);
@ -396,11 +396,11 @@ void AILion::Tick(RunListEvent* ev)
int nCheckDist = 0x7FFFFFFF;
int nAngle = pSprite->ang;
short nScanAngle = (pSprite->ang - 512) & kAngleMask;
int nScanAngle = (pSprite->ang - 512) & kAngleMask;
for (int i = 0; i < 5; i++)
{
short hitwall;
int hitwall;
int hitx, hity;
vec3_t startPos = { x, y, z };
hitdata_t hitData;

View file

@ -50,7 +50,7 @@ uint8_t *dest;
unsigned int nRandom = 0x41C6167E;
int dword_9AB57 = 0x1F;
short word_9AB5B = 0;
int word_9AB5B = 0;
int keytimer = 0;
@ -86,7 +86,7 @@ void DoEnergyTile()
uint8_t* ptr1 = energy1 + 1984;
uint8_t* ptr2 = energy1 + 2048;
short nColor = nButtonColor + 161;
int nColor = nButtonColor + 161;
int i, j;

View file

@ -30,10 +30,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS
short nPushBlocks;
int nPushBlocks;
// TODO - moveme?
short overridesect;
int overridesect;
DExhumedActor* nBodySprite[50];
@ -303,7 +303,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
assert(validSectorIndex(nSector));
overridesect = nSector;
short edi = nSector;
int edi = nSector;
// backup cstat
uint16_t cstat = pSprite->cstat;
@ -312,7 +312,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
Collision nRet(0);
short nSectFlags = sector[nSector].Flag;
int nSectFlags = sector[nSector].Flag;
if (nSectFlags & kSectUnderwater) {
z >>= 1;
@ -388,7 +388,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
if (pSprite->statnum == 100 && pFloorSprite->statnum != 0 && pFloorSprite->statnum < 100)
{
short nDamage = (z >> 9);
int nDamage = (z >> 9);
if (nDamage)
{
runlist_DamageEnemy(loHit.actor, pActor, nDamage << 1);
@ -755,8 +755,8 @@ void CheckSectorFloor(int nSector, int z, int *x, int *y)
return;
}
short nFlag = pSector->Flag;
short nAng = nFlag & kAngleMask;
int nFlag = pSector->Flag;
int nAng = nFlag & kAngleMask;
if (z >= sector[nSector].floorz)
{
@ -889,15 +889,15 @@ void MoveSector(int nSector, int nAngle, int *nXVel, int *nYVel)
sectortype *pSector = &sector[nSector];
short nBlock = pSector->extra;
short nSectFlag = sector[nSector].Flag;
int nBlock = pSector->extra;
int nSectFlag = sector[nSector].Flag;
int nFloorZ = pSector->floorz;
int startwall = pSector->wallptr;
int nWalls = pSector->wallnum;
walltype *pStartWall = &wall[startwall];
short nNextSector = wall[startwall].nextsector;
int nNextSector = wall[startwall].nextsector;
BlockInfo *pBlockInfo = &sBlockInfo[nBlock];

View file

@ -131,7 +131,7 @@ void AIMummy::Tick(RunListEvent* ev)
auto pTarget = UpdateEnemy(&pActor->pTarget);
auto pSprite = &pActor->s();
short nAction = pActor->nAction;
int nAction = pActor->nAction;
Gravity(pActor);
@ -139,8 +139,8 @@ void AIMummy::Tick(RunListEvent* ev)
pSprite->picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame);
short nFrame = SeqBase[nSeq] + pActor->nFrame;
short nFrameFlag = FrameFlag[nFrame];
int nFrame = SeqBase[nSeq] + pActor->nFrame;
int nFrameFlag = FrameFlag[nFrame];
seq_MoveSequence(pActor, nSeq, pActor->nFrame);
@ -410,7 +410,7 @@ void AIMummy::Draw(RunListEvent* ev)
{
auto pActor = ev->pObjActor;
if (!pActor) return;
short nAction = pActor->nAction;
int nAction = pActor->nAction;
seq_PlotSequence(ev->nParam, SeqOffsets[kSeqMummy] + MummySeq[nAction].a, pActor->nFrame, MummySeq[nAction].b);
return;

View file

@ -31,11 +31,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS
static short ObjectSeq[] = {
static const int8_t ObjectSeq[] = {
46, -1, 72, -1
};
static short ObjectStatnum[] = {
static const short ObjectStatnum[] = {
kStatExplodeTrigger, kStatExplodeTarget, 98, kStatDestructibleSprite
};
@ -51,8 +51,8 @@ struct TrailPoint
int x;
int y;
uint8_t nTrailPointVal;
short nTrailPointPrev;
short nTrailPointNext;
int16_t nTrailPointPrev;
int16_t nTrailPointNext;
};
@ -62,7 +62,7 @@ struct Bob
uint8_t field_2;
uint8_t field_3;
int z;
short sBobID;
uint16_t sBobID;
};
@ -76,16 +76,15 @@ struct Drip
struct Elev
{
DExhumedActor* pActor;
short field_0;
short nChannel;
int16_t nFlags;
int16_t nChannel;
int nSector;
int field_6;
int field_A;
short nCountZOffsets; // count of items in zOffsets
short nCurZOffset;
int nParam1;
int nParam2;
int16_t nCountZOffsets; // count of items in zOffsets
int16_t nCurZOffset;
int zOffsets[8]; // different Z offsets
short field_32;
short field_36;
int16_t nRunRec;
};
// 16 bytes
@ -236,17 +235,16 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Elev& w, Elev* def
{
if (arc.BeginObject(keyname))
{
arc("at0", w.field_0)
arc("at0", w.nFlags)
("channel", w.nChannel)
("sector", w.nSector)
("at6", w.field_6)
("ata", w.field_A)
("at6", w.nParam1)
("ata", w.nParam2)
("countz", w.nCountZOffsets)
("curz", w.nCurZOffset)
.Array("zofs", w.zOffsets, 8)
("at32", w.field_32)
("at32", w.nRunRec)
("sprite", w.pActor)
("at36", w.field_36)
.EndObject();
}
return arc;
@ -483,15 +481,14 @@ int BuildElevF(int nChannel, int nSector, DExhumedActor* nWallSprite, int arg_4,
{
auto ElevCount = Elevator.Reserve(1);
Elevator[ElevCount].field_0 = 2;
Elevator[ElevCount].field_6 = arg_4;
Elevator[ElevCount].field_32 = -1;
Elevator[ElevCount].field_A = arg_5;
Elevator[ElevCount].nFlags = 2;
Elevator[ElevCount].nParam1 = arg_4;
Elevator[ElevCount].nRunRec = -1;
Elevator[ElevCount].nParam2 = arg_5;
Elevator[ElevCount].nChannel = nChannel;
Elevator[ElevCount].nSector = nSector;
Elevator[ElevCount].nCountZOffsets = 0;
Elevator[ElevCount].nCurZOffset = 0;
Elevator[ElevCount].field_36 = 0;
if (nWallSprite == nullptr) {
nWallSprite = BuildWallSprite(nSector);
@ -525,19 +522,18 @@ int BuildElevC(int arg1, int nChannel, int nSector, DExhumedActor* nWallSprite,
auto ElevCount = Elevator.Reserve(1);
Elevator[ElevCount].field_0 = arg1;
Elevator[ElevCount].nFlags = arg1;
if (arg1 & 4)
{
edi = arg5 / 2;
}
Elevator[ElevCount].field_6 = edi;
Elevator[ElevCount].nParam1 = edi;
Elevator[ElevCount].nCountZOffsets = 0;
Elevator[ElevCount].field_36 = 0;
Elevator[ElevCount].nCurZOffset = 0;
Elevator[ElevCount].field_A = arg6;
Elevator[ElevCount].field_32 = -1;
Elevator[ElevCount].nParam2 = arg6;
Elevator[ElevCount].nRunRec = -1;
Elevator[ElevCount].nChannel = nChannel;
Elevator[ElevCount].nSector = nSector;
@ -683,8 +679,8 @@ void AIElev::ProcessChannel(RunListEvent* ev)
short nElev = RunData[nRun].nObjIndex;
assert(nElev >= 0 && nElev < (int)Elevator.Size());
short nChannel = Elevator[nElev].nChannel;
short var_18 = Elevator[nElev].field_0;
int nChannel = Elevator[nElev].nChannel;
int nFlags = Elevator[nElev].nFlags;
assert(nChannel >= 0 && nChannel < kMaxChannels);
@ -693,7 +689,7 @@ void AIElev::ProcessChannel(RunListEvent* ev)
int edi = 999; // FIXME CHECKME - this isn't default set to anything in the ASM that I can see - if ax is 0 and var_24 is 0, this will never be set to a known value otherwise!
if (var_18 & 0x8)
if (nFlags & 0x8)
{
if (dx) {
edi = 1;
@ -705,12 +701,12 @@ void AIElev::ProcessChannel(RunListEvent* ev)
else
{
// loc_20D48:
if (var_18 & 0x10) // was var_24
if (nFlags & 0x10) // was var_24
{
if (Elevator[nElev].field_32 < 0)
if (Elevator[nElev].nRunRec < 0)
{
Elevator[nElev].field_32 = runlist_AddRunRec(NewRun, &RunData[nRun]);
StartElevSound(Elevator[nElev].pActor, var_18);
Elevator[nElev].nRunRec = runlist_AddRunRec(NewRun, &RunData[nRun]);
StartElevSound(Elevator[nElev].pActor, nFlags);
edi = 1;
}
@ -724,7 +720,6 @@ void AIElev::ProcessChannel(RunListEvent* ev)
{
if (dx == Elevator[nElev].nCurZOffset || dx >= Elevator[nElev].nCountZOffsets)
{
Elevator[nElev].field_36 = dx;
edi = 1;
}
else
@ -741,20 +736,20 @@ void AIElev::ProcessChannel(RunListEvent* ev)
// loc_20DF9:
if (edi)
{
if (Elevator[nElev].field_32 < 0)
if (Elevator[nElev].nRunRec < 0)
{
Elevator[nElev].field_32 = runlist_AddRunRec(NewRun, &RunData[nRun]);
Elevator[nElev].nRunRec = runlist_AddRunRec(NewRun, &RunData[nRun]);
StartElevSound(Elevator[nElev].pActor, var_18);
StartElevSound(Elevator[nElev].pActor, nFlags);
}
}
else
{
//loc_20E4E:
if (Elevator[nElev].field_32 >= 0)
if (Elevator[nElev].nRunRec >= 0)
{
runlist_SubRunRec(Elevator[nElev].field_32);
Elevator[nElev].field_32 = -1;
runlist_SubRunRec(Elevator[nElev].nRunRec);
Elevator[nElev].nRunRec = -1;
}
}
}
@ -766,7 +761,7 @@ void AIElev::Tick(RunListEvent* ev)
assert(nElev >= 0 && nElev < (int)Elevator.Size());
short nChannel = Elevator[nElev].nChannel;
short var_18 = Elevator[nElev].field_0;
short var_18 = Elevator[nElev].nFlags;
assert(nChannel >= 0 && nChannel < kMaxChannels);
@ -783,7 +778,7 @@ void AIElev::Tick(RunListEvent* ev)
short nSectorB = nSector;
StartInterpolation(nSector, Interp_Sect_Floorz);
int nVal = LongSeek((int*)&sector[nSector].floorz, nZVal, Elevator[nElev].field_6, Elevator[nElev].field_A);
int nVal = LongSeek((int*)&sector[nSector].floorz, nZVal, Elevator[nElev].nParam1, Elevator[nElev].nParam2);
ebp = nVal;
if (!nVal)
@ -797,7 +792,7 @@ void AIElev::Tick(RunListEvent* ev)
{
StopActorSound(pElevSpr);
runlist_SubRunRec(nRun);
Elevator[nElev].field_32 = -1;
Elevator[nElev].nRunRec = -1;
runlist_ReadyChannel(nChannel);
D3PlayFX(StaticSound[nStopSound], Elevator[nElev].pActor);
@ -825,7 +820,7 @@ void AIElev::Tick(RunListEvent* ev)
int zVal = Elevator[nElev].zOffsets[nZOffset];
StartInterpolation(nSector, Interp_Sect_Ceilingz);
int nVal = LongSeek(&ceilZ, zVal, Elevator[nElev].field_6, Elevator[nElev].field_A);
int nVal = LongSeek(&ceilZ, zVal, Elevator[nElev].nParam1, Elevator[nElev].nParam2);
ebp = nVal;
if (!nVal)
@ -839,7 +834,7 @@ void AIElev::Tick(RunListEvent* ev)
else
{
runlist_SubRunRec(nRun);
Elevator[nElev].field_32 = -1;
Elevator[nElev].nRunRec = -1;
StopActorSound(Elevator[nElev].pActor);
D3PlayFX(StaticSound[nStopSound], Elevator[nElev].pActor);
runlist_ReadyChannel(nChannel);

View file

@ -1779,7 +1779,7 @@ sectdone:
// loc_1B75D
int var_18 = 1 << var_40;
short weapons = PlayerList[nPlayer].nPlayerWeapons;
int weapons = PlayerList[nPlayer].nPlayerWeapons;
if (weapons & var_18)
{
@ -1841,7 +1841,7 @@ sectdone:
// loc_1B75D
int var_18 = 1 << var_40;
short weapons = PlayerList[nPlayer].nPlayerWeapons;
int weapons = PlayerList[nPlayer].nPlayerWeapons;
if (weapons & var_18)
{
@ -1903,7 +1903,7 @@ sectdone:
// loc_1B75D
int var_18 = 1 << var_40;
short weapons = PlayerList[nPlayer].nPlayerWeapons;
int weapons = PlayerList[nPlayer].nPlayerWeapons;
if (weapons & var_18)
{
@ -1965,7 +1965,7 @@ sectdone:
// loc_1B75D
int var_18 = 1 << var_40;
short weapons = PlayerList[nPlayer].nPlayerWeapons;
int weapons = PlayerList[nPlayer].nPlayerWeapons;
if (weapons & var_18)
{
@ -2027,7 +2027,7 @@ sectdone:
// loc_1B75D
int var_18 = 1 << var_40;
short weapons = PlayerList[nPlayer].nPlayerWeapons;
int weapons = PlayerList[nPlayer].nPlayerWeapons;
if (weapons & var_18)
{
@ -2089,7 +2089,7 @@ sectdone:
// loc_1B75D
int var_18 = 1 << var_40;
short weapons = PlayerList[nPlayer].nPlayerWeapons;
int weapons = PlayerList[nPlayer].nPlayerWeapons;
if (weapons & var_18)
{

View file

@ -227,7 +227,7 @@ void BlowChunks(DExhumedActor* pActor)
}
}
void DestroyEgg(short nEgg)
void DestroyEgg(int nEgg)
{
auto pActor = QueenEgg[nEgg].pActor;
auto pSprite = &pActor->s();

View file

@ -114,7 +114,7 @@ void MoveRaToEnemy(int nPlayer)
{
auto pTarget = Ra[nPlayer].pTarget;
auto pActor = Ra[nPlayer].pActor;
short nAction = Ra[nPlayer].nAction;
int nAction = Ra[nPlayer].nAction;
auto pSprite = &pActor->s();
if (pTarget)
@ -168,9 +168,9 @@ void MoveRaToEnemy(int nPlayer)
void AIRa::Tick(RunListEvent* ev)
{
int nPlayer = RunData[ev->nRun].nObjIndex;
short nCurrentWeapon = PlayerList[nPlayer].nCurrentWeapon;
int nCurrentWeapon = PlayerList[nPlayer].nCurrentWeapon;
short nSeq = SeqOffsets[kSeqEyeHit] + RaSeq[Ra[nPlayer].nAction].a;
int nSeq = SeqOffsets[kSeqEyeHit] + RaSeq[Ra[nPlayer].nAction].a;
auto pActor = Ra[nPlayer].pActor;
auto pSprite = &pActor->s();
@ -291,7 +291,7 @@ void AIRa::Tick(RunListEvent* ev)
void AIRa::Draw(RunListEvent* ev)
{
int nPlayer = RunData[ev->nRun].nObjIndex;
short nSeq = SeqOffsets[kSeqEyeHit] + RaSeq[Ra[nPlayer].nAction].a;
int nSeq = SeqOffsets[kSeqEyeHit] + RaSeq[Ra[nPlayer].nAction].a;
seq_PlotSequence(ev->nParam, nSeq, Ra[nPlayer].nFrame, 1);
ev->pTSprite->owner = -1;

View file

@ -51,15 +51,15 @@ int16_t nMouthTile;
int nPupData = 0;
short word_964E8 = 0;
short word_964EA = 0;
short word_964EC = 10;
int word_964E8 = 0;
int word_964EA = 0;
int word_964EC = 10;
short nSpiritRepeatX;
short nSpiritRepeatY;
int nSpiritRepeatX;
int nSpiritRepeatY;
DExhumedActor* pSpiritSprite;
short nPixelsToShow;
short nTalkTime = 0;
int nPixelsToShow;
int nTalkTime = 0;
void InitSpiritHead()
@ -180,7 +180,7 @@ void DimSector(int nSector)
}
}
void CopyHeadToWorkTile(short nTile)
void CopyHeadToWorkTile(int nTile)
{
const uint8_t* pSrc = tilePtr(nTile);
uint8_t *pDest = &Worktile[212 * 49 + 53];
@ -197,7 +197,7 @@ void CopyHeadToWorkTile(short nTile)
// This is based on BuildGDX's version of this function which was a lot less cryptic than PCExhumed's.
void DoSpiritHead()
{
static short dimSectCount = 0;
static int dimSectCount = 0;
auto pSpiritSpr = &pSpiritSprite->s();
sPlayerInput[0].actions |= SB_CENTERVIEW;
@ -214,7 +214,7 @@ void DoSpiritHead()
{
if (nPupData != 0)
{
short clock = *pPupData++;
int clock = *pPupData++;
nPupData -= 2;
if (nPupData > 0)
{

View file

@ -112,16 +112,16 @@ const char *SoundFiles[kMaxSoundFiles] =
"jon_air2" // 79
};
short nStopSound;
short nStoneSound;
short nSwitchSound;
short nLocalEyeSect;
short nElevSound;
short nCreepyTimer;
int nStopSound;
int nStoneSound;
int nSwitchSound;
int nLocalEyeSect;
int nElevSound;
int nCreepyTimer;
bool looped[kMaxSounds];
short StaticSound[kMaxSounds];
int16_t StaticSound[kMaxSounds];
int fakesources[] = { 0, 1, 2, 3 };
int swirlysources[4]= { 0, 1, 2, 3 };
FVector3 amb, creepy;
@ -281,7 +281,7 @@ void BendAmbientSound(void)
//
//==========================================================================
void PlayLocalSound(short nSound, short nRate, bool unattached, EChanFlags cflags)
void PlayLocalSound(int nSound, int nRate, bool unattached, EChanFlags cflags)
{
if (!SoundEnabled()) return;
if (nSound < 0 || nSound >= kMaxSounds || !soundEngine->isValidSoundId(nSound + 1))
@ -347,7 +347,7 @@ void StartSwirly(int nActiveSound)
if (!SoundEnabled()) return;
auto &swirly = swirlysources[nActiveSound];
short nPitch = nNextFreq - RandomSize(9);
int nPitch = nNextFreq - RandomSize(9);
nNextFreq = 25000 - RandomSize(10) * 6;
if (nNextFreq > 32000)
nNextFreq = 32000;
@ -405,7 +405,7 @@ void SoundBigEntrance(void)
StopAllSounds();
for (int i = 0; i < 4; i++)
{
short nPitch = 11025 + (i * 512 - 1200);
int nPitch = 11025 + (i * 512 - 1200);
//pASound->snd_pitch = nPitch;
soundEngine->StopSound(SOURCE_EXBoss, &fakesources[i], -1);
soundEngine->StartSound(SOURCE_EXBoss, &fakesources[i], nullptr, CHAN_BODY, CHANF_TRANSIENT, StaticSound[kSoundTorchOn]+1, 200 / 255.f, ATTN_NONE, nullptr, nPitch / 11025.f);
@ -500,7 +500,7 @@ void GameInterface::UpdateSounds()
return;
vec3_t pos;
short ang;
int ang;
if (nSnakeCam > -1)
{
Snake *pSnake = &SnakeList[nSnakeCam];
@ -552,9 +552,9 @@ void GameInterface::UpdateSounds()
//==========================================================================
int soundx, soundy, soundz;
short soundsect;
int soundsect;
void PlayFX2(unsigned short nSound, DExhumedActor* pActor, int sectf, EChanFlags chanflags, int sprflags)
void PlayFX2(unsigned int nSound, DExhumedActor* pActor, int sectf, EChanFlags chanflags, int sprflags)
{
if (!SoundEnabled()) return;
if ((nSound&0x1ff) >= kMaxSounds || !soundEngine->isValidSoundId((nSound & 0x1ff)+1))
@ -583,7 +583,7 @@ void PlayFX2(unsigned short nSound, DExhumedActor* pActor, int sectf, EChanFlags
if (forcePlay || midprio) prio = 1000;
else if (pActor != nullptr && hiprio) prio = 2000;
short v10 = (nSound&0xe00)>>9;
int v10 = (nSound&0xe00)>>9;
nSound &= 0x1ff;
int nPitch = 0;
@ -655,7 +655,7 @@ void PlayFX2(unsigned short nSound, DExhumedActor* pActor, int sectf, EChanFlags
//
//==========================================================================
void PlayFXAtXYZ(unsigned short ax, int x, int y, int z, int nSector, EChanFlags chanflags, int sectf)
void PlayFXAtXYZ(unsigned int ax, int x, int y, int z, int nSector, EChanFlags chanflags, int sectf)
{
soundx = x;
soundy = y;
@ -747,7 +747,7 @@ void UpdateCreepySounds()
}
int nVolume = 255;
short v10 = (vsi & 0xe00) >> 9;
int v10 = (vsi & 0xe00) >> 9;
vsi &= 0x1ff;
int nPitch = 0;

View file

@ -103,17 +103,16 @@ enum {
kSound79,
};
extern short gMusicVolume;
extern short gFXVolume;
extern int gMusicVolume;
extern int gFXVolume;
extern int nStopSound;
extern int nStoneSound;
extern int nSwitchSound;
extern int nLocalEyeSect;
extern int nElevSound;
extern int nCreepyTimer;
extern short nStopSound;
extern short nStoneSound;
extern short nSwitchSound;
extern short nLocalEyeSect;
extern short nElevSound;
extern short nCreepyTimer;
extern short StaticSound[];
extern int16_t StaticSound[];
void UpdateCreepySounds();
@ -125,16 +124,16 @@ int LocalSoundPlaying();
void LoadFX();
void StopAllSounds();
void StopLocalSound();
void PlayLocalSound(short nSound, short val, bool unattached = false, EChanFlags cflags = CHANF_NONE);
void PlayLocalSound(int nSound, int val, bool unattached = false, EChanFlags cflags = CHANF_NONE);
int LoadSound(const char* sound);
void BendAmbientSound();
void CheckAmbience(int nSector);
void PlayFX2(unsigned short nSound, DExhumedActor* nSprite, int sectf = 0, EChanFlags chanflags = CHANF_NONE, int sprflags = 0);
void PlayFX2(unsigned int nSound, DExhumedActor* nSprite, int sectf = 0, EChanFlags chanflags = CHANF_NONE, int sprflags = 0);
void PlayFXAtXYZ(unsigned short nSound, int x, int y, int z, int nSector, EChanFlags chanflags = CHANF_NONE, int sectf = 0);
inline void D3PlayFX(unsigned short nSound, DExhumedActor* actor, short flags = 0)
void PlayFXAtXYZ(unsigned int nSound, int x, int y, int z, int nSector, EChanFlags chanflags = CHANF_NONE, int sectf = 0);
inline void D3PlayFX(unsigned int nSound, DExhumedActor* actor, int flags = 0)
{
PlayFX2(nSound, actor, 0, CHANF_NONE, flags);
}

View file

@ -36,7 +36,7 @@ EXTERN_CVAR(Bool, testnewrenderer)
BEGIN_PS_NS
short bSubTitles = true;
bool bSubTitles = true;
int zbob;

View file

@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS
extern short bSubTitles;
extern bool bSubTitles;
extern DExhumedActor* bestTarget;
extern bool bCamera;

View file

@ -121,7 +121,7 @@ void AIWasp::Draw(RunListEvent* ev)
{
auto pActor = ev->pObjActor;
if (!pActor) return;
short nAction = pActor->nAction;
int nAction = pActor->nAction;
seq_PlotSequence(ev->nParam, SeqOffsets[kSeqWasp] + WaspSeq[nAction].a, pActor->nFrame, WaspSeq[nAction].b);
return;
@ -194,13 +194,13 @@ void AIWasp::Tick(RunListEvent* ev)
auto pActor = ev->pObjActor;
if (!pActor) return;
auto pSprite = &pActor->s();
short nAction = pActor->nAction;
int nAction = pActor->nAction;
DExhumedActor* pTarget = nullptr;
bool bVal = false;
short nSeq = SeqOffsets[kSeqWasp] + WaspSeq[nAction].a;
int nSeq = SeqOffsets[kSeqWasp] + WaspSeq[nAction].a;
pSprite->picnum = seq_GetSeqPicnum2(nSeq, pActor->nFrame);