NSVehicle, NSPhysicsEntity get Save/Restore methods

This commit is contained in:
Marco Cawthorne 2022-07-19 15:49:35 -07:00
parent 2a220fb331
commit 356319a7b7
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
11 changed files with 149 additions and 0 deletions

View File

@ -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
};

View File

@ -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)
{

View File

@ -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;

View File

@ -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)
{

View File

@ -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;

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -156,6 +156,7 @@ NSTrigger::Restore(string strKey, string strValue)
super::Restore(strKey, strValue);
}
}
void
NSTrigger::Input(entity eAct, string strInput, string strData)
{

View File

@ -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;

View File

@ -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)
{