2018-07-06 14:11:38 +00:00
|
|
|
#ifndef GAME_SERVER_SAVE_H
|
|
|
|
#define GAME_SERVER_SAVE_H
|
2014-07-26 12:46:31 +00:00
|
|
|
|
2022-06-17 17:54:10 +00:00
|
|
|
#include <base/vmath.h>
|
|
|
|
|
2020-06-01 09:40:11 +00:00
|
|
|
#include <engine/shared/protocol.h>
|
|
|
|
#include <game/generated/protocol.h>
|
|
|
|
|
2020-05-28 11:29:42 +00:00
|
|
|
class IGameController;
|
|
|
|
class CGameContext;
|
2020-06-01 09:40:11 +00:00
|
|
|
class CCharacter;
|
2020-06-29 20:28:26 +00:00
|
|
|
class CSaveTeam;
|
2014-07-26 12:46:31 +00:00
|
|
|
|
|
|
|
class CSaveTee
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CSaveTee();
|
2022-02-14 23:19:41 +00:00
|
|
|
~CSaveTee() = default;
|
2021-02-16 17:15:50 +00:00
|
|
|
void Save(CCharacter *pchr);
|
2021-08-21 08:02:45 +00:00
|
|
|
void Load(CCharacter *pchr, int Team, bool IsSwap = false);
|
2020-09-26 19:41:58 +00:00
|
|
|
char *GetString(const CSaveTeam *pTeam);
|
2022-06-30 22:36:32 +00:00
|
|
|
int FromString(const char *pString);
|
2020-06-29 20:28:26 +00:00
|
|
|
void LoadHookedPlayer(const CSaveTeam *pTeam);
|
2021-01-23 15:49:50 +00:00
|
|
|
bool IsHooking() const;
|
2020-06-02 14:27:31 +00:00
|
|
|
vec2 GetPos() const { return m_Pos; }
|
2020-09-26 19:41:58 +00:00
|
|
|
const char *GetName() const { return m_aName; }
|
2020-06-03 20:08:21 +00:00
|
|
|
int GetClientID() const { return m_ClientID; }
|
2022-03-08 19:01:26 +00:00
|
|
|
void SetClientID(int ClientID) { m_ClientID = ClientID; }
|
2014-07-26 12:46:31 +00:00
|
|
|
|
|
|
|
private:
|
2020-06-03 20:08:21 +00:00
|
|
|
int m_ClientID;
|
2014-07-26 12:46:31 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
char m_aString[2048];
|
|
|
|
char m_aName[16];
|
2014-07-26 12:46:31 +00:00
|
|
|
|
|
|
|
int m_Alive;
|
|
|
|
int m_Paused;
|
|
|
|
int m_NeededFaketuning;
|
|
|
|
|
|
|
|
// Teamstuff
|
2021-07-20 20:16:40 +00:00
|
|
|
int m_TeeStarted;
|
2014-07-26 12:46:31 +00:00
|
|
|
int m_TeeFinished;
|
|
|
|
int m_IsSolo;
|
|
|
|
|
|
|
|
struct WeaponStat
|
|
|
|
{
|
|
|
|
int m_AmmoRegenStart;
|
|
|
|
int m_Ammo;
|
|
|
|
int m_Ammocost;
|
|
|
|
int m_Got;
|
|
|
|
} m_aWeapons[NUM_WEAPONS];
|
|
|
|
|
|
|
|
int m_LastWeapon;
|
|
|
|
int m_QueuedWeapon;
|
|
|
|
|
|
|
|
int m_SuperJump;
|
|
|
|
int m_Jetpack;
|
|
|
|
int m_NinjaJetpack;
|
|
|
|
int m_FreezeTime;
|
2022-05-24 15:26:49 +00:00
|
|
|
int m_FreezeStart;
|
2014-07-26 12:46:31 +00:00
|
|
|
int m_DeepFreeze;
|
2022-01-07 15:53:40 +00:00
|
|
|
int m_LiveFreeze;
|
2014-07-26 12:46:31 +00:00
|
|
|
int m_EndlessHook;
|
|
|
|
int m_DDRaceState;
|
|
|
|
|
|
|
|
int m_Hit;
|
|
|
|
int m_Collision;
|
|
|
|
int m_TuneZone;
|
|
|
|
int m_TuneZoneOld;
|
|
|
|
int m_Hook;
|
|
|
|
int m_Time;
|
|
|
|
vec2 m_Pos;
|
|
|
|
vec2 m_PrevPos;
|
|
|
|
int m_TeleCheckpoint;
|
|
|
|
int m_LastPenalty;
|
|
|
|
|
2022-07-05 14:13:48 +00:00
|
|
|
int m_TimeCpBroadcastEndTime;
|
|
|
|
int m_LastTimeCp;
|
|
|
|
int m_LastTimeCpBroadcasted;
|
2022-07-02 00:13:59 +00:00
|
|
|
float m_aCurrentTimeCp[MAX_CHECKPOINTS];
|
2014-07-26 12:46:31 +00:00
|
|
|
|
2018-12-17 13:55:58 +00:00
|
|
|
int m_NotEligibleForFinish;
|
|
|
|
|
2019-08-19 08:09:53 +00:00
|
|
|
int m_HasTelegunGun;
|
|
|
|
int m_HasTelegunGrenade;
|
|
|
|
int m_HasTelegunLaser;
|
2019-04-06 16:13:11 +00:00
|
|
|
|
2014-07-26 12:46:31 +00:00
|
|
|
// Core
|
|
|
|
vec2 m_CorePos;
|
|
|
|
vec2 m_Vel;
|
|
|
|
int m_ActiveWeapon;
|
|
|
|
int m_Jumped;
|
|
|
|
int m_JumpedTotal;
|
|
|
|
int m_Jumps;
|
|
|
|
vec2 m_HookPos;
|
|
|
|
vec2 m_HookDir;
|
|
|
|
vec2 m_HookTeleBase;
|
|
|
|
int m_HookTick;
|
|
|
|
int m_HookState;
|
2020-06-29 20:28:26 +00:00
|
|
|
int m_HookedPlayer;
|
|
|
|
int m_NewHook;
|
|
|
|
|
|
|
|
// player input
|
|
|
|
int m_InputDirection;
|
|
|
|
int m_InputJump;
|
|
|
|
int m_InputFire;
|
|
|
|
int m_InputHook;
|
2019-04-06 16:37:25 +00:00
|
|
|
|
2020-06-30 21:49:40 +00:00
|
|
|
int m_ReloadTimer;
|
|
|
|
|
2020-05-20 20:01:47 +00:00
|
|
|
char m_aGameUuid[UUID_MAXSTRSIZE];
|
2014-07-26 12:46:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CSaveTeam
|
|
|
|
{
|
|
|
|
public:
|
2022-06-30 22:36:32 +00:00
|
|
|
CSaveTeam(IGameController *pController);
|
2014-07-26 12:46:31 +00:00
|
|
|
~CSaveTeam();
|
2020-09-26 19:41:58 +00:00
|
|
|
char *GetString();
|
2020-06-02 14:27:31 +00:00
|
|
|
int GetMembersCount() const { return m_MembersCount; }
|
2020-06-03 20:08:21 +00:00
|
|
|
// MatchPlayers has to be called afterwards
|
2022-06-30 22:36:32 +00:00
|
|
|
int FromString(const char *pString);
|
2020-06-03 20:08:21 +00:00
|
|
|
// returns true if a team can load, otherwise writes a nice error Message in pMessage
|
|
|
|
bool MatchPlayers(const char (*paNames)[MAX_NAME_LENGTH], const int *pClientID, int NumPlayer, char *pMessage, int MessageLen);
|
2021-02-16 17:15:50 +00:00
|
|
|
int Save(int Team);
|
|
|
|
void Load(int Team, bool KeepCurrentWeakStrong);
|
2020-09-26 19:41:58 +00:00
|
|
|
CSaveTee *m_pSavedTees;
|
2014-07-26 12:46:31 +00:00
|
|
|
|
2020-05-27 18:09:12 +00:00
|
|
|
// returns true if an error occured
|
2020-02-13 16:04:58 +00:00
|
|
|
static bool HandleSaveError(int Result, int ClientID, CGameContext *pGameContext);
|
2020-09-26 19:41:58 +00:00
|
|
|
|
2014-07-26 12:46:31 +00:00
|
|
|
private:
|
2022-01-22 13:12:59 +00:00
|
|
|
CCharacter *MatchCharacter(int ClientID, int SaveID, bool KeepCurrentCharacter);
|
2014-07-26 12:46:31 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
IGameController *m_pController;
|
2014-07-26 12:46:31 +00:00
|
|
|
|
2020-05-22 11:58:37 +00:00
|
|
|
char m_aString[65536];
|
2014-07-26 12:46:31 +00:00
|
|
|
|
|
|
|
struct SSimpleSwitchers
|
|
|
|
{
|
|
|
|
int m_Status;
|
|
|
|
int m_EndTime;
|
|
|
|
int m_Type;
|
|
|
|
};
|
2020-09-26 19:41:58 +00:00
|
|
|
SSimpleSwitchers *m_pSwitchers;
|
2014-07-26 12:46:31 +00:00
|
|
|
|
|
|
|
int m_TeamState;
|
|
|
|
int m_MembersCount;
|
2022-05-01 23:54:29 +00:00
|
|
|
int m_HighestSwitchNumber;
|
2014-07-26 12:46:31 +00:00
|
|
|
int m_TeamLocked;
|
2020-05-22 21:59:47 +00:00
|
|
|
int m_Practice;
|
2014-07-26 12:46:31 +00:00
|
|
|
};
|
|
|
|
|
2018-07-06 14:11:38 +00:00
|
|
|
#endif // GAME_SERVER_SAVE_H
|