mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 14:41:55 +00:00
- handle USERSAVE.
This commit is contained in:
parent
afe93f89af
commit
a72732a7b1
3 changed files with 27 additions and 25 deletions
|
@ -527,7 +527,7 @@ void TerminateLevel(void)
|
|||
SWStatIterator it(stat);
|
||||
if (auto actor = it.Next())
|
||||
{
|
||||
if (actor->hasU()) puser[pnum].CopyFromUser(actor->u());
|
||||
if (actor->hasU()) puser[pnum].CopyFromUser(actor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1100,27 +1100,6 @@ struct USER
|
|||
|
||||
using USERp = USER*;
|
||||
|
||||
struct USERSAVE
|
||||
{
|
||||
int16_t 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;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -1819,8 +1798,6 @@ extern short connecthead, connectpoint2[MAXPLAYERS];
|
|||
*/
|
||||
extern int *lastpacket2clock;
|
||||
|
||||
// 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];
|
||||
|
||||
///////////////////////////
|
||||
//
|
||||
|
@ -2222,6 +2199,31 @@ struct ANIMstruct
|
|||
extern ANIM Anim[MAXANIM];
|
||||
extern short AnimCnt;
|
||||
|
||||
struct USERSAVE
|
||||
{
|
||||
int16_t Health;
|
||||
int8_t WeaponNum;
|
||||
int8_t LastWeaponNum;
|
||||
|
||||
void CopyFromUser(DSWActor* u)
|
||||
{
|
||||
Health = u->user.Health;
|
||||
WeaponNum = u->user.WeaponNum;
|
||||
LastWeaponNum = u->user.LastWeaponNum;
|
||||
}
|
||||
|
||||
void CopyToUser(DSWActor* u)
|
||||
{
|
||||
u->user.Health = Health;
|
||||
u->user.WeaponNum = WeaponNum;
|
||||
u->user.LastWeaponNum = LastWeaponNum;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// 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];
|
||||
|
||||
|
||||
END_SW_NS
|
||||
|
||||
|
|
|
@ -2400,7 +2400,7 @@ void InitPlayerSprite(PLAYERp pp)
|
|||
else
|
||||
{
|
||||
// restore stuff from last level
|
||||
puser[pnum].CopyToUser(u);
|
||||
puser[pnum].CopyToUser(actor);
|
||||
PlayerLevelReset(pp);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue