diff --git a/src/shared/NSClient.h b/src/shared/NSClient.h index 4dac11ba..54b9197b 100644 --- a/src/shared/NSClient.h +++ b/src/shared/NSClient.h @@ -56,5 +56,8 @@ NSClient:NSSurfacePropEntity /* run every frame before renderscene() */ virtual float(void) predraw; +#else + virtual void(float) Save; + virtual void(string,string) Restore; #endif }; diff --git a/src/shared/NSClient.qc b/src/shared/NSClient.qc index 5ba2a0f3..a67f6204 100644 --- a/src/shared/NSClient.qc +++ b/src/shared/NSClient.qc @@ -14,6 +14,23 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef SERVER +void +NSClient::Save(float handle) +{ + super::Save(handle); +} + +void +NSClient::Restore(string strKey, string strValue) +{ + switch (strKey) { + default: + super::Restore(strKey, strValue); + } +} +#endif + void NSClient::OnRemoveEntity(void) { diff --git a/src/shared/NSClientSpectator.h b/src/shared/NSClientSpectator.h index 20c75212..85f28d14 100644 --- a/src/shared/NSClientSpectator.h +++ b/src/shared/NSClientSpectator.h @@ -66,6 +66,8 @@ class NSClientSpectator:NSClient virtual bool(void) IsPlayer; #ifdef SERVER + virtual void(float) Save; + virtual void(string,string) Restore; virtual void(void) EvaluateEntity; virtual float(entity, float) SendEntity; virtual void(void) RunClientCommand; diff --git a/src/shared/NSClientSpectator.qc b/src/shared/NSClientSpectator.qc index 28f1e1da..e674bb22 100644 --- a/src/shared/NSClientSpectator.qc +++ b/src/shared/NSClientSpectator.qc @@ -14,6 +14,23 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef SERVER +void +NSClientSpectator::Save(float handle) +{ + super::Save(handle); +} + +void +NSClientSpectator::Restore(string strKey, string strValue) +{ + switch (strKey) { + default: + super::Restore(strKey, strValue); + } +} +#endif + bool NSClientSpectator::IsRealSpectator(void) { diff --git a/src/shared/NSNavAI.h b/src/shared/NSNavAI.h index 75a2ea68..e1cab08c 100644 --- a/src/shared/NSNavAI.h +++ b/src/shared/NSNavAI.h @@ -32,6 +32,9 @@ NSNavAI:NSSurfacePropEntity void(void) NSNavAI; #ifdef SERVER + virtual void(float) Save; + virtual void(string,string) Restore; + /* methods we'd like others to override */ virtual bool(void) CanCrouch; diff --git a/src/shared/NSNavAI.qc b/src/shared/NSNavAI.qc index f1b6017f..dccd2bfd 100644 --- a/src/shared/NSNavAI.qc +++ b/src/shared/NSNavAI.qc @@ -14,6 +14,25 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifdef SERVER +void +NSNavAI::Save(float handle) +{ + super::Save(handle); +} + +void +NSNavAI::Restore(string strKey, string strValue) +{ + switch (strKey) { + default: + super::Restore(strKey, strValue); + } +} +#endif + + #ifdef SERVER bool NSNavAI::CanCrouch(void) diff --git a/src/shared/NSPhysicsEntity.h b/src/shared/NSPhysicsEntity.h index 07b33808..43abb0e6 100644 --- a/src/shared/NSPhysicsEntity.h +++ b/src/shared/NSPhysicsEntity.h @@ -74,6 +74,8 @@ class NSPhysicsEntity:NSSurfacePropEntity virtual void(void) Death; virtual void(void) EvaluateEntity; virtual float(entity, float) SendEntity; + virtual void(float) Save; + virtual void(string,string) Restore; #else virtual void(float, float) ReceiveEntity; #endif diff --git a/src/shared/NSPhysicsEntity.qc b/src/shared/NSPhysicsEntity.qc index 7506b90d..95c1d048 100644 --- a/src/shared/NSPhysicsEntity.qc +++ b/src/shared/NSPhysicsEntity.qc @@ -14,6 +14,44 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +#ifdef SERVER +void +NSPhysicsEntity::Save(float handle) +{ + SaveInt(handle, "m_iEnabled", m_iEnabled); + SaveInt(handle, "m_iShape", m_iShape); + SaveInt(handle, "m_iMaterial", m_iMaterial); + SaveInt(handle, "m_iFlags", m_iFlags); + SaveFloat(handle, "m_flInertiaScale", m_flInertiaScale); + super::Save(handle); +} + +void +NSPhysicsEntity::Restore(string strKey, string strValue) +{ + switch (strKey) { + case "m_iEnabled": + m_iEnabled = ReadInt(strValue); + break; + case "m_iShape": + m_iShape = ReadInt(strValue); + break; + case "m_iMaterial": + m_iMaterial = ReadInt(strValue); + break; + case "m_iFlags": + m_iFlags = ReadInt(strValue); + break; + case "m_flInertiaScale": + m_flInertiaScale = ReadFloat(strValue); + break; + default: + super::Restore(strKey, strValue); + } +} +#endif + #define ODE_MODE 1 #ifdef CLIENT diff --git a/src/shared/NSTrigger.qc b/src/shared/NSTrigger.qc index 228e9b27..2dd419ca 100644 --- a/src/shared/NSTrigger.qc +++ b/src/shared/NSTrigger.qc @@ -156,6 +156,7 @@ NSTrigger::Restore(string strKey, string strValue) super::Restore(strKey, strValue); } } + void NSTrigger::Input(entity eAct, string strInput, string strData) { diff --git a/src/shared/NSVehicle.h b/src/shared/NSVehicle.h index 0d7a4ace..38599f41 100644 --- a/src/shared/NSVehicle.h +++ b/src/shared/NSVehicle.h @@ -50,6 +50,8 @@ class NSVehicle:NSSurfacePropEntity virtual vector(void) GetExitPos; virtual void(void) EvaluateEntity; virtual float(entity, float) SendEntity; + virtual void(float) Save; + virtual void(string,string) Restore; #endif virtual entity(void) GetDriver; diff --git a/src/shared/NSVehicle.qc b/src/shared/NSVehicle.qc index f9114fd8..9c6a14c4 100644 --- a/src/shared/NSVehicle.qc +++ b/src/shared/NSVehicle.qc @@ -14,6 +14,51 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#ifdef SERVER +void +NSVehicle::Save(float handle) +{ + SaveInt(handle, "m_iVehicleFlags", m_iVehicleFlags); + SaveInt(handle, "m_iMoveButtons", m_iMoveButtons); + SaveVector(handle, "m_vecMoveValues", m_vecMoveValues); + SaveFloat(handle, "m_eDriver", num_for_edict(m_eDriver)); + SaveFloat(handle, "m_eDriverLast", num_for_edict(m_eDriverLast)); + SaveVector(handle, "m_vecPlayerPos", m_vecPlayerPos); + SaveVector(handle, "m_vecExitPos", m_vecExitPos); + + super::Save(handle); +} +void +NSVehicle::Restore(string strKey, string strValue) +{ + switch (strKey) { + case "m_iVehicleFlags": + m_iVehicleFlags = ReadInt(strValue); + break; + case "m_iMoveButtons": + m_iMoveButtons = ReadInt(strValue); + break; + case "m_vecMoveValues": + m_vecMoveValues = ReadVector(strValue); + break; + case "m_eDriver": + m_eDriver = edict_num(stof(strValue)); + break; + case "m_eDriverLast": + m_eDriverLast = edict_num(stof(strValue)); + break; + case "m_vecPlayerPos": + m_vecPlayerPos = ReadVector(strValue); + break; + case "m_vecExitPos": + m_vecExitPos = ReadVector(strValue); + break; + default: + super::Restore(strKey, strValue); + } +} +#endif + bool NSVehicle::CanDriverCrouch(void) {