Fixed incorrect SEQ index, causing the Cobra staff to appear briefly when changing from grenade to M-60. Fixes issue #6 .Also renamed a player field from field_34 to field_3FOUR to better visually differentiate it from field_3A

This commit is contained in:
sirlemonhead 2019-10-29 22:10:50 +00:00 committed by Christoph Oelckers
parent 0dbb073b0a
commit 223d83e7be
4 changed files with 28 additions and 29 deletions

View file

@ -293,7 +293,7 @@ void FuncGrenade(int a, int nDamage, int nRun)
if (GrenadeList[nGrenade].field_10 < 0) if (GrenadeList[nGrenade].field_10 < 0)
{ {
PlayerList[nPlayer].field_3A = 0; PlayerList[nPlayer].field_3A = 0;
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
if (PlayerList[nPlayer].nAmmo[kWeaponGrenade]) if (PlayerList[nPlayer].nAmmo[kWeaponGrenade])
{ {

View file

@ -34,7 +34,6 @@ struct Weapon
short c; short c;
short d; short d;
short bFireUnderwater; short bFireUnderwater;
short pad[15];
}; };
*/ */
@ -107,7 +106,7 @@ void ResetPlayerWeapons(short nPlayer)
PlayerList[nPlayer].nCurrentWeapon = 0; PlayerList[nPlayer].nCurrentWeapon = 0;
PlayerList[nPlayer].field_3A = 0; PlayerList[nPlayer].field_3A = 0;
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
nPlayerGrenade[nPlayer] = -1; nPlayerGrenade[nPlayer] = -1;
nPlayerWeapons[nPlayer] = 0x1; // turn on bit 1 only nPlayerWeapons[nPlayer] = 0x1; // turn on bit 1 only
@ -128,7 +127,7 @@ void SetNewWeapon(short nPlayer, short nWeapon)
PlayerList[nPlayer].field_3A = 5; PlayerList[nPlayer].field_3A = 5;
SetPlayerMummified(nPlayer, kTrue); SetPlayerMummified(nPlayer, kTrue);
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
} }
else else
{ {
@ -149,7 +148,7 @@ void SetNewWeapon(short nPlayer, short nWeapon)
else else
{ {
PlayerList[nPlayer].nCurrentWeapon = nWeapon; PlayerList[nPlayer].nCurrentWeapon = nWeapon;
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
} }
} }
else { else {
@ -180,7 +179,7 @@ void SetNewWeaponImmediate(short nPlayer, short nWeapon)
PlayerList[nPlayer].nCurrentWeapon = nWeapon; PlayerList[nPlayer].nCurrentWeapon = nWeapon;
PlayerList[nPlayer].field_38 = -1; PlayerList[nPlayer].field_38 = -1;
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
PlayerList[nPlayer].field_3A = 0; PlayerList[nPlayer].field_3A = 0;
} }
@ -193,9 +192,9 @@ void SetNewWeaponIfBetter(short nPlayer, short nWeapon)
void SelectNewWeapon(short nPlayer) void SelectNewWeapon(short nPlayer)
{ {
int nWeapon = 6; int nWeapon = kWeaponRing; // start at the highest weapon number
uint16_t di = nPlayerWeapons[nPlayer];
uint16_t di = nPlayerWeapons[nPlayer];
uint16_t dx = 0x40; // bit 7 turned on uint16_t dx = 0x40; // bit 7 turned on
while (dx) while (dx)
@ -212,7 +211,7 @@ void SelectNewWeapon(short nPlayer)
} }
if (nWeapon < 0) if (nWeapon < 0)
nWeapon = 0; nWeapon = kWeaponSword;
PlayerList[nPlayer].bIsFiring = kFalse; PlayerList[nPlayer].bIsFiring = kFalse;
@ -359,7 +358,7 @@ void MoveWeapons(short nPlayer)
{ {
PlayerList[nPlayer].nCurrentWeapon = PlayerList[nPlayer].field_38; PlayerList[nPlayer].nCurrentWeapon = PlayerList[nPlayer].field_38;
PlayerList[nPlayer].field_3A = 0; PlayerList[nPlayer].field_3A = 0;
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
PlayerList[nPlayer].field_38 = -1; PlayerList[nPlayer].field_38 = -1;
} }
@ -378,16 +377,16 @@ void MoveWeapons(short nPlayer)
for (frames = var_1C; frames > 0; frames--) for (frames = var_1C; frames > 0; frames--)
{ {
seq_MoveSequence(nPlayerSprite, var_3C, PlayerList[nPlayer].field_34); seq_MoveSequence(nPlayerSprite, var_3C, PlayerList[nPlayer].field_3FOUR);
PlayerList[nPlayer].field_34++; PlayerList[nPlayer].field_3FOUR++;
dword_96E22++; dword_96E22++;
if (dword_96E22 >= 15) { if (dword_96E22 >= 15) {
dword_96E22 = 0; dword_96E22 = 0;
} }
if (PlayerList[nPlayer].field_34 >= SeqSize[var_3C]) if (PlayerList[nPlayer].field_3FOUR >= SeqSize[var_3C])
{ {
if (PlayerList[nPlayer].field_38 == -1) if (PlayerList[nPlayer].field_38 == -1)
{ {
@ -451,7 +450,7 @@ void MoveWeapons(short nPlayer)
if (nWeapon == kWeaponPistol && nPistolClip[nPlayer] <= 0) if (nWeapon == kWeaponPistol && nPistolClip[nPlayer] <= 0)
{ {
PlayerList[nPlayer].field_3A = 3; PlayerList[nPlayer].field_3A = 3;
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
nPistolClip[nPlayer] = Min(6, PlayerList[nPlayer].nAmmo[kWeaponPistol]); nPistolClip[nPlayer] = Min(6, PlayerList[nPlayer].nAmmo[kWeaponPistol]);
break; break;
@ -465,7 +464,7 @@ void MoveWeapons(short nPlayer)
} }
else else
{ {
PlayerList[nPlayer].field_34 = SeqSize[var_3C] - 1; PlayerList[nPlayer].field_3FOUR = SeqSize[var_3C] - 1;
continue; continue;
} }
} }
@ -562,7 +561,7 @@ void MoveWeapons(short nPlayer)
SelectNewWeapon(nPlayer); SelectNewWeapon(nPlayer);
PlayerList[nPlayer].field_3A = 5; PlayerList[nPlayer].field_3A = 5;
PlayerList[nPlayer].field_34 = SeqSize[WeaponInfo[kWeaponGrenade].b[SeqOffsets[nSeq]]] - 1; // CHECKME PlayerList[nPlayer].field_3FOUR = SeqSize[WeaponInfo[kWeaponGrenade].b[0] + SeqOffsets[nSeq]] - 1; // CHECKME
goto loc_flag; // FIXME goto loc_flag; // FIXME
} }
} }
@ -613,7 +612,7 @@ void MoveWeapons(short nPlayer)
// loc_26FC5 // loc_26FC5
var_3C = SeqOffsets[WeaponInfo[nWeapon].nSeq] + WeaponInfo[nWeapon].b[PlayerList[nPlayer].field_3A]; var_3C = SeqOffsets[WeaponInfo[nWeapon].nSeq] + WeaponInfo[nWeapon].b[PlayerList[nPlayer].field_3A];
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
} }
else else
{ {
@ -631,7 +630,7 @@ void MoveWeapons(short nPlayer)
PlayerList[nPlayer].field_3A = 5; PlayerList[nPlayer].field_3A = 5;
} }
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
continue; continue;
} }
} // end of if (PlayerList[nPlayer].field_34 >= SeqSize[var_3C]) } // end of if (PlayerList[nPlayer].field_34 >= SeqSize[var_3C])
@ -639,7 +638,7 @@ void MoveWeapons(short nPlayer)
loc_flag: loc_flag:
// loc_27001 // loc_27001
short nFrameFlag = seq_GetFrameFlag(var_3C, PlayerList[nPlayer].field_34); short nFrameFlag = seq_GetFrameFlag(var_3C, PlayerList[nPlayer].field_3FOUR);
if (((!(nSectFlag & kSectUnderwater)) || nWeapon == kWeaponRing) && (nFrameFlag & 4)) if (((!(nSectFlag & kSectUnderwater)) || nWeapon == kWeaponRing) && (nFrameFlag & 4))
{ {
@ -674,7 +673,7 @@ loc_flag:
{ {
nTemperature[nPlayer] = 0; nTemperature[nPlayer] = 0;
PlayerList[nPlayer].field_3A = 4; PlayerList[nPlayer].field_3A = 4;
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
} }
} }
@ -794,7 +793,7 @@ loc_flag:
// loc_27399: // loc_27399:
PlayerList[nPlayer].field_3A = var_28; PlayerList[nPlayer].field_3A = var_28;
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
break; break;
} }
case kWeaponFlamer: case kWeaponFlamer:
@ -803,7 +802,7 @@ loc_flag:
{ {
DoBubbles(nPlayer); DoBubbles(nPlayer);
PlayerList[nPlayer].field_3A = 1; PlayerList[nPlayer].field_3A = 1;
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
StopSpriteSound(nPlayerSprite); StopSpriteSound(nPlayerSprite);
break; break;
} }
@ -898,7 +897,7 @@ loc_flag:
if (nWeapon == kWeaponM60 && nPlayerClip[nPlayer] <= 0) if (nWeapon == kWeaponM60 && nPlayerClip[nPlayer] <= 0)
{ {
PlayerList[nPlayer].field_3A = 3; PlayerList[nPlayer].field_3A = 3;
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
// goto loc_27609: // goto loc_27609:
} }
} }
@ -970,7 +969,7 @@ void DrawWeapons()
nShade = sprite[PlayerList[nLocalPlayer].nSprite].shade; nShade = sprite[PlayerList[nLocalPlayer].nSprite].shade;
} }
seq_DrawGunSequence(var_28, PlayerList[nLocalPlayer].field_34, xOffset, yOffset, nShade, nPal); seq_DrawGunSequence(var_28, PlayerList[nLocalPlayer].field_3FOUR, xOffset, yOffset, nShade, nPal);
if (nWeapon != kWeaponM60) if (nWeapon != kWeaponM60)
return; return;
@ -1006,7 +1005,7 @@ void DrawWeapons()
nSeqOffset = var_30 + 4; nSeqOffset = var_30 + 4;
} }
seq_DrawGunSequence(nSeqOffset, PlayerList[nLocalPlayer].field_34, xOffset, yOffset, nShade, nPal); seq_DrawGunSequence(nSeqOffset, PlayerList[nLocalPlayer].field_3FOUR, xOffset, yOffset, nShade, nPal);
return; return;
} }
case 1: case 1:
@ -1044,7 +1043,7 @@ void DrawWeapons()
{ {
int nClip = nPlayerClip[nLocalPlayer]; int nClip = nPlayerClip[nLocalPlayer];
short dx = PlayerList[nLocalPlayer].field_34; short dx = PlayerList[nLocalPlayer].field_3FOUR;
if (nClip <= 0) { if (nClip <= 0) {
return; return;
@ -1080,7 +1079,7 @@ void DrawWeapons()
{ {
int nClip = nPlayerClip[nLocalPlayer]; int nClip = nPlayerClip[nLocalPlayer];
short ax = PlayerList[nLocalPlayer].field_34; short ax = PlayerList[nLocalPlayer].field_3FOUR;
if (nClip <= 0) { if (nClip <= 0) {
return; return;

View file

@ -629,7 +629,7 @@ void RestartPlayer(short nPlayer)
nPlayerInvisible[nPlayer] = 0; nPlayerInvisible[nPlayer] = 0;
PlayerList[nPlayer].bIsFiring = 0; PlayerList[nPlayer].bIsFiring = 0;
PlayerList[nPlayer].field_34 = 0; PlayerList[nPlayer].field_3FOUR = 0;
nPlayerViewSect[nPlayer] = sPlayerSave[nPlayer].nSector; nPlayerViewSect[nPlayer] = sPlayerSave[nPlayer].nSector;
PlayerList[nPlayer].field_3A = 0; PlayerList[nPlayer].field_3A = 0;

View file

@ -46,7 +46,7 @@ struct Player
short pad[2]; short pad[2];
short nCurrentWeapon; short nCurrentWeapon;
short field_34; short field_3FOUR;
short bIsFiring; short bIsFiring;
short field_38; short field_38;
short field_3A; short field_3A;