mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 20:00:49 +00:00
- turning some of the player arrays into Player members.
For script code we do not want the arrays accessible so all that get accessed need to be moved into the struct first.
This commit is contained in:
parent
4e182ea5ee
commit
12b7c73393
9 changed files with 11 additions and 57 deletions
|
@ -209,7 +209,6 @@ static void cmd_Give(int player, uint8_t** stream, bool skip)
|
||||||
{
|
{
|
||||||
PlayerList[player].keys = 0xFFFF;
|
PlayerList[player].keys = 0xFFFF;
|
||||||
if (player == myconnectindex) StatusMessage(150, GStrings("TXT_EX_KEYS"));
|
if (player == myconnectindex) StatusMessage(150, GStrings("TXT_EX_KEYS"));
|
||||||
RefreshStatus();
|
|
||||||
}
|
}
|
||||||
if (buttons & kButtonCheatItems) // LOBOSWAG cheat
|
if (buttons & kButtonCheatItems) // LOBOSWAG cheat
|
||||||
{
|
{
|
||||||
|
|
|
@ -482,10 +482,6 @@ static void SetTileNames()
|
||||||
|
|
||||||
void GameInterface::app_init()
|
void GameInterface::app_init()
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
//int esi = 1;
|
|
||||||
//int edi = esi;
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
help_disabled = true;
|
help_disabled = true;
|
||||||
#endif
|
#endif
|
||||||
|
@ -510,9 +506,6 @@ void GameInterface::app_init()
|
||||||
seq_LoadSequences();
|
seq_LoadSequences();
|
||||||
InitStatus();
|
InitStatus();
|
||||||
|
|
||||||
for (i = 0; i < kMaxPlayers; i++) {
|
|
||||||
nPlayerLives[i] = kDefaultLives;
|
|
||||||
}
|
|
||||||
resettiming();
|
resettiming();
|
||||||
GrabPalette();
|
GrabPalette();
|
||||||
|
|
||||||
|
|
|
@ -168,7 +168,7 @@ void GameInterface::LevelCompleted(MapRecord *to_map, int skill)
|
||||||
{
|
{
|
||||||
if (to_map->levelNumber > nBestLevel) nBestLevel = to_map->levelNumber - 1;
|
if (to_map->levelNumber > nBestLevel) nBestLevel = to_map->levelNumber - 1;
|
||||||
|
|
||||||
if (to_map->gameflags & LEVEL_EX_COUNTDOWN) nPlayerLives[0] = 0;
|
if (to_map->gameflags & LEVEL_EX_COUNTDOWN) PlayerList[0].nLives = 0;
|
||||||
if (to_map->gameflags & LEVEL_EX_TRAINING)
|
if (to_map->gameflags & LEVEL_EX_TRAINING)
|
||||||
{
|
{
|
||||||
gameaction = ga_nextlevel;
|
gameaction = ga_nextlevel;
|
||||||
|
|
|
@ -227,21 +227,6 @@ void FireWeapon(short nPlayer)
|
||||||
|
|
||||||
void SetWeaponStatus(short nPlayer)
|
void SetWeaponStatus(short nPlayer)
|
||||||
{
|
{
|
||||||
if (nPlayer != nLocalPlayer)
|
|
||||||
return;
|
|
||||||
|
|
||||||
short nWeapon = PlayerList[nPlayer].nCurrentWeapon;
|
|
||||||
|
|
||||||
if (nWeapon < 0)
|
|
||||||
{
|
|
||||||
nCounterBullet = -1;
|
|
||||||
SetCounterImmediate(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nCounterBullet = WeaponInfo[nWeapon].nAmmoType;
|
|
||||||
SetCounterImmediate(PlayerList[nPlayer].nAmmo[nCounterBullet]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t WeaponCanFire(short nPlayer)
|
uint8_t WeaponCanFire(short nPlayer)
|
||||||
|
|
|
@ -185,7 +185,6 @@ void InitLevel(MapRecord* map)
|
||||||
}
|
}
|
||||||
EndLevel = 0;
|
EndLevel = 0;
|
||||||
lastfps = 0;
|
lastfps = 0;
|
||||||
InitStatus();
|
|
||||||
ResetView();
|
ResetView();
|
||||||
ResetEngine();
|
ResetEngine();
|
||||||
totalmoves = 0;
|
totalmoves = 0;
|
||||||
|
@ -195,8 +194,6 @@ void InitLevel(MapRecord* map)
|
||||||
lPlayerYVel = 0;
|
lPlayerYVel = 0;
|
||||||
movefifopos = movefifoend;
|
movefifopos = movefifoend;
|
||||||
|
|
||||||
RefreshStatus();
|
|
||||||
|
|
||||||
if (!mus_redbook && map->music.IsNotEmpty()) Mus_Play(map->music, true); // Allow non-CD music if defined for the current level
|
if (!mus_redbook && map->music.IsNotEmpty()) Mus_Play(map->music, true); // Allow non-CD music if defined for the current level
|
||||||
playCDtrack(map->cdSongId, true);
|
playCDtrack(map->cdSongId, true);
|
||||||
setLevelStarted(currentLevel);
|
setLevelStarted(currentLevel);
|
||||||
|
|
|
@ -103,7 +103,6 @@ short nPlayerPushSound[kMaxPlayers];
|
||||||
short nTauntTimer[kMaxPlayers];
|
short nTauntTimer[kMaxPlayers];
|
||||||
short nPlayerTorch[kMaxPlayers];
|
short nPlayerTorch[kMaxPlayers];
|
||||||
uint16_t nPlayerWeapons[kMaxPlayers]; // each set bit represents a weapon the player has
|
uint16_t nPlayerWeapons[kMaxPlayers]; // each set bit represents a weapon the player has
|
||||||
short nPlayerLives[kMaxPlayers];
|
|
||||||
Player PlayerList[kMaxPlayers];
|
Player PlayerList[kMaxPlayers];
|
||||||
short nPlayerInvisible[kMaxPlayers];
|
short nPlayerInvisible[kMaxPlayers];
|
||||||
short nPlayerDouble[kMaxPlayers];
|
short nPlayerDouble[kMaxPlayers];
|
||||||
|
@ -225,7 +224,7 @@ void InitPlayerInventory(short nPlayer)
|
||||||
|
|
||||||
ResetPlayerWeapons(nPlayer);
|
ResetPlayerWeapons(nPlayer);
|
||||||
|
|
||||||
nPlayerLives[nPlayer] = kDefaultLives;
|
PlayerList[nPlayer].nLives = kDefaultLives;
|
||||||
|
|
||||||
PlayerList[nPlayer].nSprite = -1;
|
PlayerList[nPlayer].nSprite = -1;
|
||||||
PlayerList[nPlayer].nRun = -1;
|
PlayerList[nPlayer].nRun = -1;
|
||||||
|
@ -560,19 +559,15 @@ void StartDeathSeq(int nPlayer, int nVal)
|
||||||
if (nTotalPlayers == 1)
|
if (nTotalPlayers == 1)
|
||||||
{
|
{
|
||||||
if (!(currentLevel->gameflags & LEVEL_EX_TRAINING)) { // if not on the training level
|
if (!(currentLevel->gameflags & LEVEL_EX_TRAINING)) { // if not on the training level
|
||||||
nPlayerLives[nPlayer]--;
|
PlayerList[nPlayer].nLives--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nPlayerLives[nPlayer] < 0) {
|
if (PlayerList[nPlayer].nLives < 0) {
|
||||||
nPlayerLives[nPlayer] = 0;
|
PlayerList[nPlayer].nLives = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ototalvel[nPlayer] = totalvel[nPlayer] = 0;
|
ototalvel[nPlayer] = totalvel[nPlayer] = 0;
|
||||||
|
|
||||||
if (nPlayer == nLocalPlayer) {
|
|
||||||
RefreshStatus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount)
|
int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount)
|
||||||
|
@ -594,13 +589,6 @@ int AddAmmo(int nPlayer, int nWeapon, int nAmmoAmount)
|
||||||
|
|
||||||
PlayerList[nPlayer].nAmmo[nWeapon] = nAmmoAmount;
|
PlayerList[nPlayer].nAmmo[nWeapon] = nAmmoAmount;
|
||||||
|
|
||||||
if (nPlayer == nLocalPlayer)
|
|
||||||
{
|
|
||||||
if (nWeapon == nCounterBullet) {
|
|
||||||
SetCounter(nAmmoAmount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nWeapon == 1)
|
if (nWeapon == 1)
|
||||||
{
|
{
|
||||||
if (!nPistolClip[nPlayer]) {
|
if (!nPistolClip[nPlayer]) {
|
||||||
|
@ -1812,11 +1800,11 @@ do_default_b:
|
||||||
{
|
{
|
||||||
var_88 = -1;
|
var_88 = -1;
|
||||||
|
|
||||||
if (nPlayerLives[nPlayer] >= kMaxPlayerLives) {
|
if (PlayerList[nPlayer].nLives >= kMaxPlayerLives) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
nPlayerLives[nPlayer]++;
|
PlayerList[nPlayer].nLives++;
|
||||||
|
|
||||||
var_8C = 32;
|
var_8C = 32;
|
||||||
var_44 = 32;
|
var_44 = 32;
|
||||||
|
@ -2533,7 +2521,7 @@ loc_1BD2E:
|
||||||
|
|
||||||
PlayerList[nPlayer].nCurrentWeapon = nPlayerOldWeapon[nPlayer];
|
PlayerList[nPlayer].nCurrentWeapon = nPlayerOldWeapon[nPlayer];
|
||||||
|
|
||||||
if (nPlayerLives[nPlayer] && nNetTime)
|
if (PlayerList[nPlayer].nLives && nNetTime)
|
||||||
{
|
{
|
||||||
if (nAction != 20)
|
if (nAction != 20)
|
||||||
{
|
{
|
||||||
|
@ -2709,6 +2697,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, Player& w, Player*
|
||||||
("seq", w.nSeq)
|
("seq", w.nSeq)
|
||||||
("horizon", w.horizon)
|
("horizon", w.horizon)
|
||||||
("angle", w.angle)
|
("angle", w.angle)
|
||||||
|
("lives", w.nLives)
|
||||||
.EndObject();
|
.EndObject();
|
||||||
}
|
}
|
||||||
return arc;
|
return arc;
|
||||||
|
@ -2759,7 +2748,6 @@ void SerializePlayer(FSerializer& arc)
|
||||||
.Array("taunttimer", nTauntTimer, PlayerCount)
|
.Array("taunttimer", nTauntTimer, PlayerCount)
|
||||||
.Array("torch", nPlayerTorch, PlayerCount)
|
.Array("torch", nPlayerTorch, PlayerCount)
|
||||||
.Array("weapons", nPlayerWeapons, PlayerCount)
|
.Array("weapons", nPlayerWeapons, PlayerCount)
|
||||||
.Array("lives", nPlayerLives, PlayerCount)
|
|
||||||
.Array("list", PlayerList, PlayerCount)
|
.Array("list", PlayerList, PlayerCount)
|
||||||
.Array("invisible", nPlayerInvisible, PlayerCount)
|
.Array("invisible", nPlayerInvisible, PlayerCount)
|
||||||
.Array("double", nPlayerDouble, PlayerCount)
|
.Array("double", nPlayerDouble, PlayerCount)
|
||||||
|
@ -2771,14 +2759,6 @@ void SerializePlayer(FSerializer& arc)
|
||||||
.Array("netstartsprite", nNetStartSprite, PlayerCount)
|
.Array("netstartsprite", nNetStartSprite, PlayerCount)
|
||||||
.Array("grenade", nPlayerGrenade, PlayerCount)
|
.Array("grenade", nPlayerGrenade, PlayerCount)
|
||||||
.Array("d282a", word_D282A, PlayerCount);
|
.Array("d282a", word_D282A, PlayerCount);
|
||||||
|
|
||||||
if (SaveVersion < 13) // Item was an external array in older versions.
|
|
||||||
{
|
|
||||||
int nPlayerItem[8]{};
|
|
||||||
arc.Array("item", nPlayerItem, PlayerCount);
|
|
||||||
for (int i = 0; i < PlayerCount; i++) PlayerList[i].nItem = nPlayerItem[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
arc.EndObject();
|
arc.EndObject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ extern int lPlayerYVel;
|
||||||
struct Player
|
struct Player
|
||||||
{
|
{
|
||||||
short nHealth;
|
short nHealth;
|
||||||
|
short nLives;
|
||||||
short field_2;
|
short field_2;
|
||||||
short nAction;
|
short nAction;
|
||||||
short nSprite;
|
short nSprite;
|
||||||
|
|
|
@ -133,7 +133,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
||||||
}
|
}
|
||||||
|
|
||||||
Mus_ResumeSaved();
|
Mus_ResumeSaved();
|
||||||
RefreshStatus();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -488,7 +488,7 @@ private:
|
||||||
DrawStatusSequence(nStatusSeqOffset + 156 + 2* count, 0, 0);
|
DrawStatusSequence(nStatusSeqOffset + 156 + 2* count, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
short nLives = nPlayerLives[nLocalPlayer];
|
short nLives = PlayerList[nLocalPlayer].nLives;
|
||||||
DrawStatusSequence(nStatusSeqOffset + 145 + (2 * nLives), 0, 0);
|
DrawStatusSequence(nStatusSeqOffset + 145 + (2 * nLives), 0, 0);
|
||||||
|
|
||||||
if (nHurt > 0) DrawStatusSequence(nStatusSeqOffset + 4, nHurt - 1, 0);
|
if (nHurt > 0) DrawStatusSequence(nStatusSeqOffset + 4, nHurt - 1, 0);
|
||||||
|
|
Loading…
Reference in a new issue