- Exhumed: Move nQuake[] array into Player struct.

This commit is contained in:
Mitchell Richters 2023-03-23 17:32:26 +11:00
parent 05fd2911a4
commit bd30e31b8d
7 changed files with 16 additions and 25 deletions

View file

@ -827,7 +827,7 @@ loc_flag:
case kWeaponM60: case kWeaponM60:
{ {
if (nWeapon == kWeaponM60) { // hack(?) to do fallthrough from kWeapon3 into kWeaponPistol without doing the nQuake[] change if (nWeapon == kWeaponM60) { // hack(?) to do fallthrough from kWeapon3 into kWeaponPistol without doing the nQuake[] change
nQuake[nPlayer] = 0.5; PlayerList[nPlayer].nQuake = 0.5;
} }
// fall through // fall through
[[fallthrough]]; [[fallthrough]];
@ -864,7 +864,7 @@ loc_flag:
case kWeaponStaff: case kWeaponStaff:
{ {
BuildSnake(nPlayer, nHeight); BuildSnake(nPlayer, nHeight);
nQuake[nPlayer] = 2.; PlayerList[nPlayer].nQuake = 2.;
PlayerList[nPlayer].nThrust -= pPlayerActor->spr.Angles.Yaw.ToVector() * 2; PlayerList[nPlayer].nThrust -= pPlayerActor->spr.Angles.Yaw.ToVector() * 2;
break; break;

View file

@ -955,9 +955,9 @@ void SetQuake(DExhumedActor* pActor, int nVal)
nVal = clamp(int(nVal / nSqrt), 0, 15); nVal = clamp(int(nVal / nSqrt), 0, 15);
} }
if (nVal > nQuake[i]) if (nVal > PlayerList[i].nQuake)
{ {
nQuake[i] = nVal; PlayerList[i].nQuake = nVal;
} }
} }
} }

View file

@ -1556,7 +1556,7 @@ void DoFinale()
PlayFX2(StaticSound[kSound78] | 0x2000, pFinaleSpr); PlayFX2(StaticSound[kSound78] | 0x2000, pFinaleSpr);
for (int i = 0; i < nTotalPlayers; i++) { for (int i = 0; i < nTotalPlayers; i++) {
nQuake[i] = 5.; PlayerList[i].nQuake = 5.;
} }
} }
} }

View file

@ -435,7 +435,7 @@ void RestartPlayer(int nPlayer)
PlayerList[nPlayer].nCurrentItem = -1; PlayerList[nPlayer].nCurrentItem = -1;
plr->nDeathType = 0; plr->nDeathType = 0;
nQuake[nPlayer] = 0; plr->nQuake = 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -956,14 +956,14 @@ void AIPlayer::Tick(RunListEvent* ev)
} }
} }
if (nQuake[nPlayer] != 0) if (PlayerList[nPlayer].nQuake != 0)
{ {
nQuake[nPlayer] = -nQuake[nPlayer]; PlayerList[nPlayer].nQuake = -PlayerList[nPlayer].nQuake;
if (nQuake[nPlayer] > 0) if (PlayerList[nPlayer].nQuake > 0)
{ {
nQuake[nPlayer] -= 2.; PlayerList[nPlayer].nQuake -= 2.;
if (nQuake[nPlayer] < 0) if (PlayerList[nPlayer].nQuake < 0)
nQuake[nPlayer] = 0; PlayerList[nPlayer].nQuake = 0;
} }
} }
@ -1154,7 +1154,7 @@ sectdone:
auto pViewSect = pPlayerActor->sector(); auto pViewSect = pPlayerActor->sector();
double EyeZ = pPlayerActor->getOffsetZ() + nQuake[nPlayer]; double EyeZ = pPlayerActor->getOffsetZ() + PlayerList[nPlayer].nQuake;
while (1) while (1)
{ {

View file

@ -99,6 +99,7 @@ struct Player
int16_t nTauntTimer; int16_t nTauntTimer;
uint16_t nPlayerWeapons; // each set bit represents a weapon the player has uint16_t nPlayerWeapons; // each set bit represents a weapon the player has
int16_t dVertPan; int16_t dVertPan;
double nQuake;
PlayerSave sPlayerSave; PlayerSave sPlayerSave;
int ototalvel; int ototalvel;
int totalvel; int totalvel;

View file

@ -35,19 +35,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_PS_NS BEGIN_PS_NS
bool bSubTitles = true; bool bSubTitles = true;
DVector3 nCamerapos; DVector3 nCamerapos;
bool bTouchFloor; bool bTouchFloor;
double nQuake[kMaxPlayers] = { 0 };
int nChunkTotal = 0; int nChunkTotal = 0;
int nViewTop; int nViewTop;
bool bCamera = false; bool bCamera = false;
// We cannot drag these through the entire event system... :( // We cannot drag these through the entire event system... :(
tspriteArray* mytspriteArray; tspriteArray* mytspriteArray;
@ -141,8 +134,8 @@ void DrawView(double interpfrac, bool sceneonly)
} }
else else
{ {
nCamerapos.Z = min(nCamerapos.Z + nQuake[nLocalPlayer], pPlayerActor->sector()->floorz); nCamerapos.Z = min(nCamerapos.Z + pPlayer->nQuake, pPlayerActor->sector()->floorz);
nCameraangles.Yaw += DAngle::fromDeg(fmod(nQuake[nLocalPlayer], 16.) * (45. / 128.)); nCameraangles.Yaw += DAngle::fromDeg(fmod(pPlayer->nQuake, 16.) * (45. / 128.));
if (bCamera) if (bCamera)
{ {
@ -345,7 +338,6 @@ void SerializeView(FSerializer& arc)
("touchfloor", bTouchFloor) ("touchfloor", bTouchFloor)
("chunktotal", nChunkTotal) ("chunktotal", nChunkTotal)
("camera", bCamera) ("camera", bCamera)
.Array("quake", nQuake, countof(nQuake))
.EndObject(); .EndObject();
} }
} }

View file

@ -28,11 +28,9 @@ void DrawStatusBar();
void DrawView(double interpfrac, bool sceneonly = false); void DrawView(double interpfrac, bool sceneonly = false);
void ResetView(); void ResetView();
extern double nQuake[];
extern DVector3 nCamerapos; extern DVector3 nCamerapos;
extern bool bTouchFloor; extern bool bTouchFloor;
extern int nChunkTotal; extern int nChunkTotal;
extern int gFov;
extern tspriteArray* mytspriteArray; extern tspriteArray* mytspriteArray;