mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-14 08:30:40 +00:00
use global stat manager in Duke
This commit is contained in:
parent
4af7a649b6
commit
3e821c5849
12 changed files with 16 additions and 40 deletions
|
@ -275,6 +275,11 @@ struct MapLocals
|
|||
kills.addTotal(amount);
|
||||
}
|
||||
|
||||
void addSecretCount(int amount = 1)
|
||||
{
|
||||
secrets.addTotal(amount);
|
||||
}
|
||||
|
||||
void addKill(int playerno, int amount = 1)
|
||||
{
|
||||
kills.add(playerno, amount);
|
||||
|
|
|
@ -58,7 +58,7 @@ BEGIN_DUKE_NS
|
|||
GameStats GameInterface::getStats()
|
||||
{
|
||||
player_struct* p = &ps[myconnectindex];
|
||||
return { p->actors_killed, p->max_actors_killed, p->secret_rooms, p->max_secret_rooms, p->player_par / REALGAMETICSPERSEC, p->frag };
|
||||
return { Level.kills.got, Level.kills.max, Level.secrets.got, Level.secrets.max, p->player_par / REALGAMETICSPERSEC, p->frag };
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -879,16 +879,6 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
|
|||
else SetGameVarID(lVar2, ps[iPlayer].hard_landing, sActor, sPlayer);
|
||||
break;
|
||||
|
||||
case PLAYER_MAX_SECRET_ROOMS:
|
||||
if (bSet) ps[iPlayer].max_secret_rooms = lValue;
|
||||
else SetGameVarID(lVar2, ps[iPlayer].max_secret_rooms, sActor, sPlayer);
|
||||
break;
|
||||
|
||||
case PLAYER_SECRET_ROOMS:
|
||||
if (bSet) ps[iPlayer].secret_rooms = lValue;
|
||||
else SetGameVarID(lVar2, ps[iPlayer].secret_rooms, sActor, sPlayer);
|
||||
break;
|
||||
|
||||
case PLAYER_RETURN_TO_CENTER:
|
||||
if (bSet) ps[iPlayer].sync.actions |= SB_CENTERVIEW;
|
||||
else SetGameVarID(lVar2, ps[iPlayer].sync.actions & SB_CENTERVIEW ? int(abs((ps[iPlayer].GetActor()->spr.Angles.Pitch * (DAngle::fromDeg(9.) / GetMaxPitch())).Degrees())) : 0, sActor, sPlayer);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "models/modeldata.h"
|
||||
#include "texinfo.h"
|
||||
#include "funct.h"
|
||||
#include "mapinfo.h"
|
||||
|
||||
// all inline functions.
|
||||
BEGIN_DUKE_NS
|
||||
|
@ -314,7 +315,7 @@ inline void addtokills(DDukeActor* actor)
|
|||
{
|
||||
if (actor->flags1 & SFLAG_KILLCOUNT)
|
||||
{
|
||||
ps[myconnectindex].max_actors_killed++;
|
||||
Level.addKillCount(1);
|
||||
actor->spr.cstat2 |= CSTAT2_SPRITE_COUNTKILL;
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +324,7 @@ inline void addkill(DDukeActor* actor)
|
|||
{
|
||||
if ((actor->flags1 & SFLAG_KILLCOUNT) && (actor->spr.cstat2 & CSTAT2_SPRITE_COUNTKILL))
|
||||
{
|
||||
ps[myconnectindex].actors_killed++;
|
||||
Level.addKill(myconnectindex);
|
||||
actor->spr.cstat2 &= ~CSTAT2_SPRITE_COUNTKILL;
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +333,7 @@ inline void subkill(DDukeActor* actor)
|
|||
{
|
||||
if ((actor->flags1 & SFLAG_KILLCOUNT) && !(actor->spr.cstat2 & CSTAT2_SPRITE_COUNTKILL))
|
||||
{
|
||||
ps[myconnectindex].actors_killed--;
|
||||
Level.addKill(-1, -1); // only deduct from global, not from player kills
|
||||
actor->spr.cstat2 |= CSTAT2_SPRITE_COUNTKILL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -384,10 +384,6 @@ void resetprestat(int snum,int g)
|
|||
p->hbomb_on = 0;
|
||||
p->pals.a = 0;
|
||||
p->toggle_key_flag = 0;
|
||||
p->secret_rooms = 0;
|
||||
p->max_secret_rooms = 0;
|
||||
p->actors_killed = 0;
|
||||
p->max_actors_killed = 0;
|
||||
p->lastrandomspot = 0;
|
||||
p->oweapon_pos = p->weapon_pos = 6;
|
||||
p->okickback_pic = p->kickback_pic = 5;
|
||||
|
@ -627,6 +623,7 @@ void lava_cleararrays();
|
|||
|
||||
void prelevel_common(int g)
|
||||
{
|
||||
Level.clearStats();
|
||||
if (isRRRA()) ud.mapflags = MFLAG_ALLSECTORTYPES;
|
||||
else if (isRR()) ud.mapflags = MFLAG_SECTORTYPE800;
|
||||
auto p = &ps[screenpeek];
|
||||
|
@ -684,7 +681,7 @@ void prelevel_common(int g)
|
|||
|
||||
if (sectp->lotag == 32767) //Found a secret room
|
||||
{
|
||||
ps[0].max_secret_rooms++;
|
||||
Level.addSecretCount();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1298,10 +1295,7 @@ void exitlevel(MapRecord* nextlevel)
|
|||
|
||||
SummaryInfo info{};
|
||||
|
||||
info.kills = ps[0].actors_killed;
|
||||
info.maxkills = ps[0].max_actors_killed;
|
||||
info.secrets = ps[0].secret_rooms;
|
||||
info.maxsecrets = ps[0].max_secret_rooms;
|
||||
Level.fillSummary(info);
|
||||
info.time = ps[0].player_par / GameTicRate;
|
||||
info.endofgame = endofgame;
|
||||
Mus_Stop();
|
||||
|
|
|
@ -215,10 +215,6 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
|
|||
("walking_snd_toggle", w.walking_snd_toggle)
|
||||
("palookup", w.palookup)
|
||||
("hard_landing", w.hard_landing)
|
||||
("max_secret_rooms", w.max_secret_rooms)
|
||||
("secret_rooms", w.secret_rooms)
|
||||
("max_actors_killed", w.max_actors_killed)
|
||||
("actors_killed", w.actors_killed)
|
||||
// RR from here on
|
||||
("stairs", w.stairs)
|
||||
("detonate_count", w.detonate_count)
|
||||
|
|
|
@ -101,10 +101,7 @@ void DrawStatusBar()
|
|||
|
||||
SummaryInfo info{};
|
||||
|
||||
info.kills = ps[0].actors_killed;
|
||||
info.maxkills = ps[0].max_actors_killed;
|
||||
info.secrets = ps[0].secret_rooms;
|
||||
info.maxsecrets = ps[0].max_secret_rooms;
|
||||
Level.fillSummary(info);
|
||||
info.time = Scale(PlayClock, 1000, 120);
|
||||
info.totaltime = STAT_GetTotalTime();
|
||||
UpdateStatusBar(&info);
|
||||
|
|
|
@ -196,7 +196,7 @@ void checksectors_d(int snum)
|
|||
case 32767:
|
||||
p->cursector->lotag = 0;
|
||||
FTA(9, p);
|
||||
p->secret_rooms++;
|
||||
Level.addSecret(snum);
|
||||
SECRET_Trigger(sectindex(p->cursector));
|
||||
return;
|
||||
case -1:
|
||||
|
|
|
@ -175,8 +175,7 @@ void checksectors_r(int snum)
|
|||
case 32767:
|
||||
p->cursector->lotag = 0;
|
||||
FTA(9, p);
|
||||
p->secret_rooms++;
|
||||
SECRET_Trigger(sectindex(p->cursector));
|
||||
Level.addSecret(snum);
|
||||
return;
|
||||
case -1:
|
||||
p->cursector->lotag = 0;
|
||||
|
|
|
@ -312,8 +312,6 @@ struct player_struct
|
|||
uint8_t walking_snd_toggle, palookup;
|
||||
bool quick_kick_msg;
|
||||
|
||||
int max_secret_rooms, secret_rooms, max_actors_killed, actors_killed;
|
||||
|
||||
// Redneck Rampage additions. Those which did not have names in the reconstructed source got one from either RedneckGDX or RedNukem.
|
||||
// Items were reordered by size.
|
||||
int stairs;
|
||||
|
|
|
@ -1054,8 +1054,6 @@ DEFINE_FIELD_X(DukePlayer, player_struct, knuckle_incs)
|
|||
DEFINE_FIELD_X(DukePlayer, player_struct, walking_snd_toggle)
|
||||
DEFINE_FIELD_X(DukePlayer, player_struct, palookup)
|
||||
DEFINE_FIELD_X(DukePlayer, player_struct, quick_kick_msg)
|
||||
DEFINE_FIELD_X(DukePlayer, player_struct, max_secret_rooms)
|
||||
DEFINE_FIELD_X(DukePlayer, player_struct, secret_rooms)
|
||||
DEFINE_FIELD_X(DukePlayer, player_struct, stairs)
|
||||
DEFINE_FIELD_X(DukePlayer, player_struct, detonate_count)
|
||||
//DEFINE_FIELD_X(DukePlayer, player_struct, noise.X)
|
||||
|
|
|
@ -308,8 +308,6 @@ struct DukePlayer native
|
|||
native uint8 walking_snd_toggle, palookup;
|
||||
native bool quick_kick_msg;
|
||||
|
||||
native int max_secret_rooms, secret_rooms;
|
||||
|
||||
// Redneck Rampage additions. Those which did not have names in the reconstructed source got one from either RedneckGDX or RedNukem.
|
||||
// Items were reordered by size.
|
||||
native int stairs;
|
||||
|
|
Loading…
Reference in a new issue