mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- shorten the struct for puser to what actually gets used from it.
This is preparation for making USER more serialization friendly as it was copied to puser.
This commit is contained in:
parent
dd75c8dbe4
commit
6dfe869614
4 changed files with 29 additions and 10 deletions
|
@ -514,10 +514,9 @@ void TerminateLevel(void)
|
|||
pnum = stat - STAT_PLAYER0;
|
||||
|
||||
StatIterator it(stat);
|
||||
while ((i = it.NextIndex()) >= 0)
|
||||
if ((i = it.NextIndex()) >= 0)
|
||||
{
|
||||
if (User[i])
|
||||
memcpy(&puser[pnum], User[i], sizeof(USER));
|
||||
if (User[i]) puser[pnum].CopyFromUser(User[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1272,6 +1272,28 @@ typedef struct
|
|||
uint8_t filler;
|
||||
} USER,*USERp;
|
||||
|
||||
struct USERSAVE
|
||||
{
|
||||
short Health;
|
||||
int8_t WeaponNum;
|
||||
int8_t LastWeaponNum;
|
||||
|
||||
void CopyFromUser(USER* u)
|
||||
{
|
||||
Health = u->Health;
|
||||
WeaponNum = u->WeaponNum;
|
||||
LastWeaponNum = u->LastWeaponNum;
|
||||
}
|
||||
|
||||
void CopyToUser(USER* u)
|
||||
{
|
||||
u->Health = Health;
|
||||
u->WeaponNum = WeaponNum;
|
||||
u->LastWeaponNum = LastWeaponNum;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// sprite->extra flags
|
||||
// BUILD AND GAME - DO NOT MOVE THESE
|
||||
#define SPRX_SKILL (BIT(0) | BIT(1) | BIT(2))
|
||||
|
@ -1991,8 +2013,8 @@ extern short connecthead, connectpoint2[MAXPLAYERS];
|
|||
*/
|
||||
extern int *lastpacket2clock;
|
||||
|
||||
// save player info when moving to a new level
|
||||
extern USER puser[MAX_SW_PLAYERS_REG];
|
||||
// save player info when moving to a new level (shortened to only cover the fields that actually are copied back.(
|
||||
extern USERSAVE puser[MAX_SW_PLAYERS_REG];
|
||||
|
||||
///////////////////////////
|
||||
//
|
||||
|
|
|
@ -2444,10 +2444,8 @@ InitPlayerSprite(PLAYERp pp)
|
|||
}
|
||||
else
|
||||
{
|
||||
// save stuff from last level
|
||||
u->WeaponNum = puser[pnum].WeaponNum;
|
||||
u->LastWeaponNum = puser[pnum].LastWeaponNum;
|
||||
u->Health = puser[pnum].Health;
|
||||
// restore stuff from last level
|
||||
puser[pnum].CopyToUser(u);
|
||||
PlayerLevelReset(pp);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ extern bool NoMeters;
|
|||
#define PLAYER_MIN_HEIGHT (Z(20))
|
||||
#define PLAYER_CRAWL_WADE_DEPTH (30)
|
||||
|
||||
USER puser[MAX_SW_PLAYERS_REG];
|
||||
USERSAVE puser[MAX_SW_PLAYERS_REG];
|
||||
|
||||
//int16_t gNet.MultiGameType = MULTI_GAME_NONE;
|
||||
bool NightVision = false;
|
||||
|
|
Loading…
Reference in a new issue