mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-26 05:51:30 +00:00
use global stat manager in SW
This commit is contained in:
parent
da3df98484
commit
19dfd84320
13 changed files with 18 additions and 49 deletions
|
@ -295,6 +295,11 @@ struct MapLocals
|
|||
superSecrets.add(playerno, amount);
|
||||
}
|
||||
|
||||
void addFrags(int playerno, int amount)
|
||||
{
|
||||
// todo
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -564,7 +564,7 @@ int NewCoolg(DSWActor* actor)
|
|||
actorNew->user.__legacyState.Attrib = &CoolgAttrib;
|
||||
|
||||
// special case
|
||||
TotalKillable++;
|
||||
Level.addKillCount();
|
||||
CoolgCommon(actorNew);
|
||||
|
||||
return 0;
|
||||
|
@ -589,7 +589,7 @@ int DoCoolgBirth(DSWActor* actor)
|
|||
|
||||
EnemyDefaults(actor, &CoolgActionSet, &CoolgPersonality);
|
||||
// special case
|
||||
TotalKillable--;
|
||||
Level.addKillCount(-1);
|
||||
|
||||
actor->user.Flags |= (SPR_NO_SCAREDZ|SPR_XFLIP_TOGGLE);
|
||||
CoolgCommon(actor);
|
||||
|
|
|
@ -381,7 +381,7 @@ void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SET* action, PERSONALITY* perso
|
|||
break;
|
||||
default:
|
||||
{
|
||||
TotalKillable++;
|
||||
Level.addKillCount();
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
@ -162,7 +162,6 @@ short screenpeek = 0;
|
|||
|
||||
int GodMode = false;
|
||||
short Skill = 2;
|
||||
int TotalKillable;
|
||||
|
||||
const GAME_SET gs_defaults =
|
||||
{
|
||||
|
@ -356,7 +355,7 @@ void InitLevelGlobals(void)
|
|||
void InitLevelGlobals2(void)
|
||||
{
|
||||
InitTimingVars();
|
||||
TotalKillable = 0;
|
||||
Level.clearStats();
|
||||
Bunny_Count = 0;
|
||||
FinishAnim = false;
|
||||
}
|
||||
|
@ -642,11 +641,8 @@ void GameInterface::LevelCompleted(MapRecord* map, int skill)
|
|||
STAT_Update(map == nullptr);
|
||||
|
||||
SummaryInfo info{};
|
||||
Level.fillSummary(info);
|
||||
|
||||
info.kills = Player[screenpeek].Kills;
|
||||
info.maxkills = TotalKillable;
|
||||
info.secrets = Player[screenpeek].SecretsFound;
|
||||
info.maxsecrets = LevelSecrets;
|
||||
info.time = PlayClock / 120;
|
||||
|
||||
|
||||
|
@ -825,7 +821,7 @@ int StdRandomRange(int range)
|
|||
GameStats GameInterface::getStats()
|
||||
{
|
||||
PLAYER* pp = Player + myconnectindex;
|
||||
return { pp->Kills, TotalKillable, pp->SecretsFound, LevelSecrets, PlayClock / 120, 0 };
|
||||
return { Level.kills.got, Level.kills.max, Level.secrets.got, Level.secrets.max, PlayClock / 120, 0 };
|
||||
}
|
||||
|
||||
void GameInterface::FreeLevelData()
|
||||
|
|
|
@ -1656,8 +1656,6 @@ void LoadSaveMsg(const char *msg);
|
|||
void UpdateStatusBar();
|
||||
int32_t registerosdcommands(void);
|
||||
|
||||
extern short LevelSecrets;
|
||||
extern int TotalKillable;
|
||||
extern int OrigCommPlayers;
|
||||
|
||||
extern uint8_t PlayerGravity;
|
||||
|
@ -1809,9 +1807,7 @@ struct PLAYER
|
|||
|
||||
// Death stuff
|
||||
uint16_t DeathType;
|
||||
int16_t Kills;
|
||||
int16_t KilledPlayer[MAX_SW_PLAYERS_REG];
|
||||
int16_t SecretsFound;
|
||||
|
||||
// Health
|
||||
int16_t Armor;
|
||||
|
|
|
@ -2135,12 +2135,10 @@ void PlayerLevelReset(PLAYER* pp)
|
|||
|
||||
COVER_SetReverb(0); // Turn off any echoing that may have been going before
|
||||
pp->Reverb = 0;
|
||||
pp->SecretsFound = 0;
|
||||
pp->WpnFirstType = WPN_SWORD;
|
||||
//PlayerUpdateHealth(pp, 500);
|
||||
//pp->Armor = 0;
|
||||
//PlayerUpdateArmor(pp, 0);
|
||||
pp->Kills = 0;
|
||||
pp->KillerActor = nullptr;;
|
||||
pp->NightVision = false;
|
||||
pp->StartColor = 0;
|
||||
|
@ -2277,7 +2275,6 @@ void PlayerGameReset(PLAYER* pp)
|
|||
pp->TestNukeInit = false;
|
||||
pp->InitingNuke = false;
|
||||
pp->NukeInitialized = false;
|
||||
pp->SecretsFound = 0;
|
||||
pp->WpnReloadState = 2;
|
||||
|
||||
pp->WpnAmmo[WPN_STAR] = 30;
|
||||
|
|
|
@ -449,20 +449,12 @@ void PlayerUpdateKills(PLAYER* pp, short value)
|
|||
// for everyone on the same team
|
||||
if (opp != pp && opp->actor->user.spal == pp->actor->user.spal)
|
||||
{
|
||||
opp->Kills += value;
|
||||
if (opp->Kills > 999)
|
||||
opp->Kills = 0;
|
||||
if (opp->Kills < -99)
|
||||
opp->Kills = -99;
|
||||
Level.addFrags(pnum, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pp->Kills += value;
|
||||
if (pp->Kills > 999)
|
||||
pp->Kills = 0;
|
||||
if (pp->Kills < -99)
|
||||
pp->Kills = -99;
|
||||
Level.addFrags(pp->pnum, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -6695,8 +6695,7 @@ void MultiPlayLimits(void)
|
|||
{
|
||||
TRAVERSE_CONNECT(pnum)
|
||||
{
|
||||
pp = Player + pnum;
|
||||
if (pp->Kills >= gNet.KillLimit)
|
||||
if (Level.kills.player[pnum] >= gNet.KillLimit)
|
||||
{
|
||||
Done = true;
|
||||
}
|
||||
|
@ -6884,7 +6883,6 @@ void InitAllPlayers(void)
|
|||
|
||||
pp->climb_ndx = 10;
|
||||
pp->KillerActor = nullptr;
|
||||
pp->Kills = 0;
|
||||
pp->bcnt = 0;
|
||||
pp->UziShellLeftAlt = 0;
|
||||
pp->UziShellRightAlt = 0;
|
||||
|
@ -7313,8 +7311,6 @@ DEFINE_FIELD_X(SWPlayer, PLAYER, InventoryActive)
|
|||
DEFINE_FIELD_X(SWPlayer, PLAYER, DiveTics)
|
||||
DEFINE_FIELD_X(SWPlayer, PLAYER, DiveDamageTics)
|
||||
DEFINE_FIELD_X(SWPlayer, PLAYER, DeathType)
|
||||
DEFINE_FIELD_X(SWPlayer, PLAYER, Kills)
|
||||
DEFINE_FIELD_X(SWPlayer, PLAYER, SecretsFound)
|
||||
DEFINE_FIELD_X(SWPlayer, PLAYER, Armor)
|
||||
DEFINE_FIELD_X(SWPlayer, PLAYER, MaxHealth)
|
||||
DEFINE_FIELD_X(SWPlayer, PLAYER, UziShellLeftAlt)
|
||||
|
|
|
@ -526,10 +526,8 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PLAYER& w, PLAYER*
|
|||
("DiveTics", w.DiveTics)
|
||||
("DiveDamageTics", w.DiveDamageTics)
|
||||
("DeathType", w.DeathType)
|
||||
("Kills", w.Kills)
|
||||
("Killer", w.KillerActor)
|
||||
.Array("KilledPlayer", w.KilledPlayer, countof(w.KilledPlayer))
|
||||
("SecretsFound", w.SecretsFound)
|
||||
("Armor", w.Armor)
|
||||
("MaxHealth", w.MaxHealth)
|
||||
("UziShellLeftAlt", w.UziShellLeftAlt)
|
||||
|
@ -1129,10 +1127,8 @@ void GameInterface::SerializeGameState(FSerializer& arc)
|
|||
("LoWangsQueueHead", LoWangsQueueHead)
|
||||
.Array("LoWangsQueue", LoWangsQueue, countof(LoWangsQueue))
|
||||
("PlayClock", PlayClock)
|
||||
("TotalKillable", TotalKillable)
|
||||
("net", gNet)
|
||||
("gs", gs)
|
||||
("LevelSecrets", LevelSecrets)
|
||||
("Bunny_Count", Bunny_Count)
|
||||
("GodMode", GodMode)
|
||||
("FinishTimer", FinishTimer)
|
||||
|
|
|
@ -84,10 +84,7 @@ void UpdateStatusBar()
|
|||
}
|
||||
|
||||
SummaryInfo info{};
|
||||
info.kills = Player[screenpeek].Kills;
|
||||
info.maxkills = TotalKillable;
|
||||
info.secrets = Player[screenpeek].SecretsFound;
|
||||
info.maxsecrets = LevelSecrets;
|
||||
Level.fillSummary(info);
|
||||
info.time = Scale(PlayClock, 1000, 120);
|
||||
info.totaltime = STAT_GetTotalTime();
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ enum
|
|||
void DoPlayerBeginForceJump(PLAYER*);
|
||||
|
||||
sectortype* FindNextSectorByTag(sectortype* sect, int tag);
|
||||
short LevelSecrets;
|
||||
bool TestVatorMatchActive(short match);
|
||||
bool TestSpikeMatchActive(short match);
|
||||
bool TestRotatorMatchActive(short match);
|
||||
|
@ -413,8 +412,6 @@ void SectorSetup(void)
|
|||
memset(SineWaveFloor, 0, sizeof(SineWaveFloor));
|
||||
memset(SpringBoard, 0, sizeof(SpringBoard));
|
||||
|
||||
LevelSecrets = 0;
|
||||
|
||||
for(auto§: sector)
|
||||
{
|
||||
auto const sectp = §
|
||||
|
@ -475,7 +472,7 @@ void SectorSetup(void)
|
|||
switch (tag)
|
||||
{
|
||||
case TAG_SECRET_AREA_TRIGGER:
|
||||
LevelSecrets++;
|
||||
Level.addSecretCount();
|
||||
break;
|
||||
|
||||
case TAG_DOOR_SLIDING:
|
||||
|
@ -1915,7 +1912,7 @@ void TriggerSecret(sectortype* sectp, PLAYER* pp)
|
|||
|
||||
PutStringInfo(pp, GStrings("TXTS_SECRET"));
|
||||
// always give to the first player
|
||||
Player->SecretsFound++;
|
||||
Level.addSecret(myconnectindex);
|
||||
sectp->lotag = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -4548,8 +4548,7 @@ void UpdateSinglePlayKills(DSWActor* actor)
|
|||
case GIRLNINJA_RUN_R0:
|
||||
case SKULL_R0:
|
||||
case BETTY_R0:
|
||||
// always give kills to the first player
|
||||
Player->Kills++;
|
||||
Level.addKill(-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,10 +263,8 @@ struct SWPlayer native
|
|||
|
||||
// Death stuff
|
||||
native uint16 DeathType;
|
||||
native int16 Kills;
|
||||
//native int16 Killer; //who killed me
|
||||
//native int16 KilledPlayer[MAX_SW_PLAYERS_REG];
|
||||
native int16 SecretsFound;
|
||||
|
||||
// Health
|
||||
native int16 Armor;
|
||||
|
|
Loading…
Reference in a new issue