- moved 'frags' into player_struct.

Again for reducing the work with the script interface.
This commit is contained in:
Christoph Oelckers 2020-11-29 14:10:03 +01:00
parent 346921211e
commit 553bb2af19
8 changed files with 9 additions and 9 deletions

View file

@ -739,7 +739,7 @@ public:
for (int y = 0; y < playerswhenstarted; y++)
{
int frag = frags[i][y];
int frag = ps[i].frags[y];
if (i == y)
{
mysnprintf(tempbuf, 32, "%-4d", ps[y].fraggedself);
@ -774,7 +774,7 @@ public:
{
if (i == y)
yfragtotal += ps[i].fraggedself;
int frag = frags[i][y];
int frag = ps[i].frags[y];
yfragtotal += frag;
}
mysnprintf(tempbuf, 32, "%-4d", yfragtotal);

View file

@ -300,7 +300,7 @@ public:
for (int y = 0; y < playerswhenstarted; y++)
{
int frag = frags[i][y];
int frag = ps[i].frags[y];
if (i == y)
{
mysnprintf(tempbuf, 32, "%-4d", ps[y].fraggedself);
@ -335,7 +335,7 @@ public:
{
if (i == y)
yfragtotal += ps[i].fraggedself;
int frag = frags[i][y];
int frag = ps[i].frags[y];
yfragtotal += frag;
}
mysnprintf(tempbuf, 32, "%-4d", yfragtotal);

View file

@ -53,7 +53,6 @@ int rtsplaying;
int tempwallptr;
weaponhit hittype[MAXSPRITES+1]; // +1 to have a blank entry for serialization.
bool sound445done; // this was local state inside a function, but this must be maintained globally and serialized
uint16_t frags[MAXPLAYERS][MAXPLAYERS];
player_struct ps[MAXPLAYERS];
int spriteqamount = 64;
uint8_t shadedsector[MAXSECTORS];

View file

@ -60,7 +60,6 @@ extern int rtsplaying;
extern int tempwallptr;
extern bool sound445done;
extern uint16_t frags[MAXPLAYERS][MAXPLAYERS];
extern player_struct ps[MAXPLAYERS];
extern int spriteqamount;
extern uint8_t shadedsector[MAXSECTORS];

View file

@ -612,7 +612,7 @@ void playerisdead(int snum, int psectlotag, int fz, int cz)
if (p->frag_ps != snum)
{
ps[p->frag_ps].frag++;
frags[p->frag_ps][snum]++;
ps[p->frag_ps].frags[snum]++;
auto pname = PlayerName(p->frag_ps);
if (snum == screenpeek)

View file

@ -898,8 +898,8 @@ static void clearfrags(void)
for (int i = 0; i < ud.multimode; i++)
{
ps[i].frag = ps[i].fraggedself = 0;
memset(ps[i].frags, 0, sizeof(ps[i].frags));
}
memset(frags, 0, sizeof(frags));
}
//---------------------------------------------------------------------------

View file

@ -248,6 +248,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
("moto_on_mud", w.moto_on_mud)
// new stuff
("actions", w.sync.actions)
.Array("frags", w.frags, MAXPLAYERS)
.EndObject();
w.invdisptime = 0;
@ -315,7 +316,6 @@ void GameInterface::SerializeGameState(FSerializer& arc)
if (arc.BeginObject("duke.gamestate"))
{
arc("multimode", ud.multimode);
if (ud.multimode > 1) arc.Array("frags", &frags[0][0], MAXPLAYERS * MAXPLAYERS);
arc.SparseArray("actors", hittype, MAXSPRITES, activeSprites)
("skill", ud.player_skill)

View file

@ -171,6 +171,8 @@ struct player_struct
PlayerHorizon horizon;
PlayerAngle angle;
uint16_t frags[MAXPLAYERS];
// using a bit field for this to save a bit of space.
FixedBitArray<MAX_WEAPONS> gotweapon;