- handled the remaining arrays that got accessed by the status bar.

This commit is contained in:
Christoph Oelckers 2021-05-13 19:15:53 +02:00
parent 12b7c73393
commit c716900a3c
9 changed files with 53 additions and 58 deletions

View file

@ -259,7 +259,7 @@ void ExplodeGrenade(short nGrenade)
short nDamage = BulletInfo[kWeaponGrenade].nDamage;
if (nPlayerDouble[nPlayer] > 0) {
if (PlayerList[nPlayer].nDouble > 0) {
nDamage *= 2;
}

View file

@ -356,7 +356,7 @@ void MoveWeapons(short nPlayer)
short var_3C = WeaponInfo[nWeapon].b[eax] + SeqOffsets[nSeq];
int var_1C = (nPlayerDouble[nPlayer] > 0) + 1;
int var_1C = (PlayerList[nPlayer].nDouble > 0) + 1;
frames = var_1C - 1;
@ -729,7 +729,7 @@ loc_flag:
{
short nDamage = BulletInfo[kWeaponSword].nDamage;
if (nPlayerDouble[nPlayer]) {
if (PlayerList[nPlayer].nDouble) {
nDamage *= 2;
}
@ -848,7 +848,7 @@ loc_flag:
case kWeaponMummified:
{
short nDamage = BulletInfo[kWeaponMummified].nDamage;
if (nPlayerDouble[nPlayer]) {
if (PlayerList[nPlayer].nDouble) {
nDamage *= 2;
}
@ -911,7 +911,7 @@ void DrawWeapons(double smooth)
int8_t nShade = sector[initsect].ceilingshade;
int nDouble = nPlayerDouble[nLocalPlayer];
int nDouble = PlayerList[nLocalPlayer].nDouble;
int nPal = kPalNormal;
if (nDouble)

View file

@ -181,8 +181,8 @@ void FillItems(short nPlayer)
static bool UseEye(short nPlayer)
{
if (nPlayerInvisible[nPlayer] >= 0)
nPlayerInvisible[nPlayer] = 900;
if (PlayerList[nPlayer].nInvisible >= 0)
PlayerList[nPlayer].nInvisible = 900;
int nSprite = PlayerList[nPlayer].nSprite;
@ -214,12 +214,12 @@ static bool UseMask(short nPlayer)
bool UseTorch(short nPlayer)
{
if (!nPlayerTorch[nPlayer])
if (!PlayerList[nPlayer].nTorch)
{
SetTorch(nPlayer, 1);
}
nPlayerTorch[nPlayer] = 900;
PlayerList[nPlayer].nTorch = 900;
return true;
}
@ -255,7 +255,7 @@ bool UseScarab(short nPlayer)
// faster firing
static bool UseHand(short nPlayer)
{
nPlayerDouble[nPlayer] = 1350;
PlayerList[nPlayer].nDouble = 1350;
if (nPlayer == nLocalPlayer)
{

View file

@ -40,7 +40,7 @@ void GrabMap()
void UpdateMap()
{
if (sector[initsect].ceilingpal != 3 || (nPlayerTorch[nLocalPlayer] != 0)) {
if (sector[initsect].ceilingpal != 3 || (PlayerList[nLocalPlayer].nTorch != 0)) {
MarkSectorSeen(initsect);
}
}

View file

@ -101,11 +101,8 @@ short nPlayerOldWeapon[kMaxPlayers];
short nPlayerClip[kMaxPlayers];
short nPlayerPushSound[kMaxPlayers];
short nTauntTimer[kMaxPlayers];
short nPlayerTorch[kMaxPlayers];
uint16_t nPlayerWeapons[kMaxPlayers]; // each set bit represents a weapon the player has
Player PlayerList[kMaxPlayers];
short nPlayerInvisible[kMaxPlayers];
short nPlayerDouble[kMaxPlayers];
short nPlayerViewSect[kMaxPlayers];
short nPlayerFloorSprite[kMaxPlayers];
PlayerSave sPlayerSave[kMaxPlayers];
@ -389,19 +386,19 @@ void RestartPlayer(short nPlayer)
plr->invincibility = 0;
}
nPlayerTorch[nPlayer] = 0;
PlayerList[nPlayer].nTorch = 0;
plr->nMaskAmount = 0;
SetTorch(nPlayer, 0);
nPlayerInvisible[nPlayer] = 0;
PlayerList[nPlayer].nInvisible = 0;
plr->bIsFiring = 0;
plr->field_3FOUR = 0;
nPlayerViewSect[nPlayer] = sPlayerSave[nPlayer].nSector;
plr->field_3A = 0;
nPlayerDouble[nPlayer] = 0;
PlayerList[nPlayer].nDouble = 0;
plr->nSeq = kSeqJoe;
@ -526,7 +523,7 @@ void StartDeathSeq(int nPlayer, int nVal)
PlayerList[nPlayer].horizon.ohoriz = PlayerList[nPlayer].horizon.horiz = q16horiz(0);
oeyelevel[nPlayer] = eyelevel[nPlayer] = -14080;
nPlayerInvisible[nPlayer] = 0;
PlayerList[nPlayer].nInvisible = 0;
dVertPan[nPlayer] = 15;
sprite[nSprite].cstat &= 0x7FFF;
@ -822,10 +819,10 @@ void FuncPlayer(int a, int nDamage, int nRun)
sprite[nPlayerSprite].picnum = seq_GetSeqPicnum(PlayerList[nPlayer].nSeq, PlayerSeq[nHeightTemplate[nAction]].a, var_EC);
sprite[nDopple].picnum = sprite[nPlayerSprite].picnum;
if (nPlayerTorch[nPlayer] > 0)
if (PlayerList[nPlayer].nTorch > 0)
{
nPlayerTorch[nPlayer]--;
if (nPlayerTorch[nPlayer] == 0)
PlayerList[nPlayer].nTorch--;
if (PlayerList[nPlayer].nTorch == 0)
{
SetTorch(nPlayer, 0);
}
@ -842,18 +839,18 @@ void FuncPlayer(int a, int nDamage, int nRun)
}
}
if (nPlayerDouble[nPlayer] > 0)
if (PlayerList[nPlayer].nDouble > 0)
{
nPlayerDouble[nPlayer]--;
if (nPlayerDouble[nPlayer] == 150 && nPlayer == nLocalPlayer) {
PlayerList[nPlayer].nDouble--;
if (PlayerList[nPlayer].nDouble == 150 && nPlayer == nLocalPlayer) {
PlayAlert("WEAPON POWER IS ABOUT TO EXPIRE");
}
}
if (nPlayerInvisible[nPlayer] > 0)
if (PlayerList[nPlayer].nInvisible > 0)
{
nPlayerInvisible[nPlayer]--;
if (nPlayerInvisible[nPlayer] == 0)
PlayerList[nPlayer].nInvisible--;
if (PlayerList[nPlayer].nInvisible == 0)
{
sprite[nPlayerSprite].cstat &= 0x7FFF; // set visible
short nFloorSprite = nPlayerFloorSprite[nPlayerSprite];
@ -862,7 +859,7 @@ void FuncPlayer(int a, int nDamage, int nRun)
sprite[nFloorSprite].cstat &= 0x7FFF; // set visible
}
}
else if (nPlayerInvisible[nPlayer] == 150 && nPlayer == nLocalPlayer)
else if (PlayerList[nPlayer].nInvisible == 150 && nPlayer == nLocalPlayer)
{
PlayAlert("INVISIBILITY IS ABOUT TO EXPIRE");
}
@ -1285,9 +1282,9 @@ sectdone:
// loc_1B0B9
if (var_5C) // if underwater
{
if (nPlayerTorch[nPlayer] > 0)
if (PlayerList[nPlayer].nTorch > 0)
{
nPlayerTorch[nPlayer] = 0;
PlayerList[nPlayer].nTorch = 0;
SetTorch(nPlayer, 0);
}
}
@ -2698,6 +2695,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Player& w, Player*
("horizon", w.horizon)
("angle", w.angle)
("lives", w.nLives)
("double", w.nDouble)
("invisible", w.nInvisible)
("torch", w.nTorch)
.EndObject();
}
return arc;
@ -2746,11 +2746,8 @@ void SerializePlayer(FSerializer& arc)
.Array("clip", nPlayerClip, PlayerCount)
.Array("pushsound", nPlayerPushSound, PlayerCount)
.Array("taunttimer", nTauntTimer, PlayerCount)
.Array("torch", nPlayerTorch, PlayerCount)
.Array("weapons", nPlayerWeapons, PlayerCount)
.Array("list", PlayerList, PlayerCount)
.Array("invisible", nPlayerInvisible, PlayerCount)
.Array("double", nPlayerDouble, PlayerCount)
.Array("viewsect", nPlayerViewSect, PlayerCount)
.Array("floorspr", nPlayerFloorSprite, PlayerCount)
.Array("save", sPlayerSave, PlayerCount)

View file

@ -51,6 +51,9 @@ struct Player
{
short nHealth;
short nLives;
short nDouble;
short nInvisible;
short nTorch;
short field_2;
short nAction;
short nSprite;
@ -82,12 +85,8 @@ struct Player
extern short PlayerCount;
extern short nPlayerTorch[];
extern short nPlayerLives[];
extern Player PlayerList[];
extern short nPlayerInvisible[];
extern short nPlayerDouble[];
extern short nPlayerViewSect[];
extern short nPlayerFloorSprite[];

View file

@ -421,7 +421,7 @@ int seq_DrawGunSequence(int nSeqOffset, short dx, double xOffs, double yOffs, in
nShade = -100;
double alpha = 1;
if (nPlayerInvisible[nLocalPlayer]) {
if (PlayerList[nLocalPlayer].nInvisible) {
alpha = 0.3;
}

View file

@ -94,7 +94,7 @@ void ExplodeSnakeSprite(int nSprite, short nPlayer)
{
short nDamage = BulletInfo[kWeaponStaff].nDamage;
if (nPlayerDouble[nPlayer] > 0) {
if (PlayerList[nPlayer].nDouble > 0) {
nDamage *= 2;
}

View file

@ -47,25 +47,6 @@ void InitStatus()
nStatusSeqOffset = SeqOffsets[kSeqStatus];
}
int ItemTimer(int num, int plr)
{
switch (num) {
case 1: //Scarab item
return (PlayerList[plr].invincibility * 100) / 900;
case 3: //Hand item
return (nPlayerDouble[plr] * 100) / 1350;
case 5: //Mask
return (PlayerList[plr].nMaskAmount * 100) / 1350;
case 4: //Invisible
return (nPlayerInvisible[plr] * 100) / 900;
case 2: //Torch
return (nPlayerTorch[plr] * 100) / 900;
}
return -1;
}
class DExhumedStatusBar : public DBaseStatusBar
{
DECLARE_CLASS(DExhumedStatusBar, DBaseStatusBar)
@ -284,6 +265,24 @@ private:
//
//==========================================================================
int ItemTimer(int num, int plr)
{
switch (num) {
case 1: //Scarab item
return (PlayerList[plr].invincibility * 100) / 900;
case 3: //Hand item
return (PlayerList[plr].nDouble * 100) / 1350;
case 5: //Mask
return (PlayerList[plr].nMaskAmount * 100) / 1350;
case 4: //Invisible
return (PlayerList[plr].nInvisible * 100) / 900;
case 2: //Torch
return (PlayerList[plr].nTorch * 100) / 900;
}
return -1;
}
void DrawHUD2()
{
BeginHUD(320, 200, 1);