Add missing Save/Restore methods for ambient_generic, env_beverage, and

a dozen more.
This commit is contained in:
Marco Cawthorne 2022-01-10 13:20:00 -08:00
parent a95354c09a
commit e98f751071
Signed by: eukara
GPG Key ID: C196CD8BA993248A
13 changed files with 277 additions and 16 deletions

View File

@ -82,13 +82,13 @@ class ambient_generic:NSPointTrigger
void
ambient_generic::Save(float handle)
{
SaveInt(handle, "loop", m_iLoop);
SaveInt(handle, "toggleswitch", m_iToggleSwitch);
SaveFloat(handle, "pitch", m_flPitch);
SaveFloat(handle, "radius", m_flRadius);
SaveFloat(handle, "volume", m_flVolume);
SaveString(handle, "soundpath", m_strSoundPath);
SaveString(handle, "activepath", m_strActivePath);
SaveString(handle, "soundpath", m_strSoundPath);
SaveFloat(handle, "volume", m_flVolume);
SaveFloat(handle, "radius", m_flRadius);
SaveFloat(handle, "pitch", m_flPitch);
SaveInt(handle, "toggleswitch", m_iToggleSwitch);
SaveInt(handle, "loop", m_iLoop);
super::Save(handle);
}

View File

@ -49,11 +49,42 @@ class env_beverage:NSRenderableEntity
int m_iUses;
int m_iReady;
int m_iSkin;
void(void) env_beverage;
virtual void(float) Save;
virtual void(string, string) Restore;
virtual void(entity, int) Trigger;
virtual void(string, string) SpawnKey;
};
void
env_beverage::Save(float handle)
{
SaveInt(handle, "uses", m_iUses);
SaveInt(handle, "ready", m_iReady);
SaveInt(handle, "skin_value", m_iSkin);
super::Save(handle);
}
void
env_beverage::Restore(string strKey, string strValue)
{
switch (strKey) {
case "uses":
m_iUses = ReadInt(strValue);
break;
case "ready":
m_iReady = ReadInt(strValue);
break;
case "skin_value":
m_iSkin = ReadInt(strValue);
break;
default:
super::Restore(strKey, strValue);
}
}
void
env_beverage::Trigger(entity act, int unused)
{

View File

@ -71,17 +71,14 @@ class func_door_rotating:NSRenderableEntity
{
string targetClose;
string m_strSndStop;
string m_strSndOpen;
string m_strSndClose;
string m_strLockedSfx;
float m_flSoundWait;
int m_iDamage;
int m_iLocked;
float m_flDistance;
float m_flSpeed;
/*float m_flLip;*/
float m_iState;
float m_flNextAction;
float m_flWait;

View File

@ -52,15 +52,54 @@ class func_mortar_field:NSBrushTrigger
void(void) func_mortar_field;
/* overrides */
virtual void(float) Save;
virtual void(string, string) Restore;
virtual void(entity,int) Trigger;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
virtual void(vector) Fire;
virtual void(void) FireRandom;
virtual void(entity) FireTarget;
virtual void(void) FireControlled;
virtual void(entity,int) Trigger;
virtual void(void) Respawn;
virtual void(string, string) SpawnKey;
};
void
func_mortar_field::Save(float handle)
{
SaveInt(handle, "type", m_iType);
SaveInt(handle, "count", m_iCount);
SaveFloat(handle, "spread", m_flSpread);
SaveString(handle, "x_controller", m_strXController);
SaveString(handle, "y_controller", m_strYController);
super::Save(handle);
}
void
func_mortar_field::Restore(string strKey, string strValue)
{
switch (strKey) {
case "type":
m_iType = ReadInt(strValue);
break;
case "count":
m_iCount = ReadInt(strValue);
break;
case "spread":
m_flSpread = ReadFloat(strValue);
break;
case "x_controller":
m_strXController = ReadString(strValue);
break;
case "y_controller":
m_strYController = ReadString(strValue);
break;
default:
super::Restore(strKey, strValue);
}
}
void
func_mortar_field::Fire(vector vecOrg)
{

View File

@ -58,12 +58,45 @@ class func_pendulum:NSRenderableEntity
void(void) func_pendulum;
virtual void(float) Save;
virtual void(string, string) Restore;
virtual void(void) customphysics;
virtual void(void) Respawn;
virtual void(entity, int) Trigger;
virtual void(string, string) SpawnKey;
};
void
func_pendulum::Save(float handle)
{
SaveInt(handle, "active", m_iActive);
SaveFloat(handle, "progress", m_flProgress);
SaveFloat(handle, "dampening", m_flDampening);
SaveFloat(handle, "distance", m_flDistance);
super::Save(handle);
}
void
func_pendulum::Restore(string strKey, string strValue)
{
switch (strKey) {
case "active":
m_iActive = ReadInt(strValue);
break;
case "progress":
m_flProgress = ReadFloat(strValue);
break;
case "dampening":
m_flDampening = ReadFloat(strValue);
break;
case "distance":
m_flDistance = ReadFloat(strValue);
break;
default:
super::Restore(strKey, strValue);
}
}
void
func_pendulum::customphysics(void)
{

View File

@ -42,11 +42,13 @@ enum
class func_plat:NSRenderableEntity
{
int m_iState;
float m_flSpeed;
float m_flHeight;
void(void) func_plat;
virtual void(float) Save;
virtual void(string, string) Restore;
virtual void(entity, int) Trigger;
virtual void(void) ArrivedUp;
virtual void(void) ArrivedDown;
@ -57,6 +59,33 @@ class func_plat:NSRenderableEntity
virtual void(string, string) SpawnKey;
};
void
func_plat::Save(float handle)
{
SaveInt(handle, "state", m_iState);
SaveFloat(handle, "speed", m_flSpeed);
SaveFloat(handle, "height", m_flHeight);
super::Save(handle);
}
void
func_plat::Restore(string strKey, string strValue)
{
switch (strKey) {
case "state":
m_iState = ReadInt(strValue);
break;
case "spped":
m_flSpeed = ReadFloat(strValue);
break;
case "height":
m_flHeight = ReadFloat(strValue);
break;
default:
super::Restore(strKey, strValue);
}
}
void
func_plat::ArrivedUp(void)
{

View File

@ -38,12 +38,37 @@ class func_pushable:func_breakable
void(void) func_pushable;
virtual void(float) Save;
virtual void(string, string) Restore;
virtual void(void) customphysics;
virtual void(void) Respawn;
virtual void(void) PlayerTouch;
virtual void(void) OnPlayerUse;
};
void
func_pushable::Save(float handle)
{
SaveFloat(handle, "puller", num_for_edict(m_pPuller));
SaveFloat(handle, "collbox", num_for_edict(m_eCollBox));
super::Save(handle);
}
void
func_pushable::Restore(string strKey, string strValue)
{
switch (strKey) {
case "puller":
m_pPuller = edict_num(ReadFloat(strValue));
break;
case "collbox":
m_eCollBox = edict_num(ReadFloat(strValue));
break;
default:
super::Restore(strKey, strValue);
}
}
void
func_pushable::customphysics(void)
{

View File

@ -89,6 +89,8 @@ class func_tank:NSVehicle
void(void) func_tank;
virtual void(float) Save;
virtual void(string, string) Restore;
virtual void(void) customphysics;
virtual void(void) PlayerInput;
virtual void(void) Respawn;
@ -97,6 +99,82 @@ class func_tank:NSVehicle
virtual void(string, string) SpawnKey;
};
void
func_tank::Save(float handle)
{
SaveInt(handle, "damage", m_iDamage);
SaveFloat(handle, "yawrate", m_flYawRate);
SaveFloat(handle, "yawrange", m_flYawRange);
SaveFloat(handle, "pitchrate", m_flPitchRate);
SaveFloat(handle, "pitchrange", m_flPitchRange);
SaveFloat(handle, "firerate", m_flFireRate);
SaveFloat(handle, "spritescale", m_flSpriteScale);
SaveFloat(handle, "persistence", m_flPersistance);
SaveFloat(handle, "minrange", m_flMinRange);
SaveFloat(handle, "maxrange", m_flMaxRange);
SaveString(handle, "spritesmoke", m_strSpriteSmoke);
SaveString(handle, "spriteflash", m_strSpriteFlash);
SaveString(handle, "sndrotate", m_strSndRotate);
SaveVector(handle, "tippos", m_vecTipPos);
SaveVector(handle, "spread", m_vecSpread);
super::Save(handle);
}
void
func_tank::Restore(string strKey, string strValue)
{
switch (strKey) {
case "damage":
m_iDamage = ReadInt(strValue);
break;
case "yawrate":
m_flYawRate = ReadFloat(strValue);
break;
case "yawrange":
m_flYawRange = ReadFloat(strValue);
break;
case "pitchrate":
m_flPitchRate = ReadFloat(strValue);
break;
case "pitchrange":
m_flPitchRange = ReadFloat(strValue);
break;
case "firerate":
m_flFireRate = ReadFloat(strValue);
break;
case "spritescale":
m_flSpriteScale = ReadFloat(strValue);
break;
case "persistence":
m_flPersistance = ReadFloat(strValue);
break;
case "minrange":
m_flMinRange = ReadFloat(strValue);
break;
case "maxrange":
m_flMaxRange = ReadFloat(strValue);
break;
case "spritesmoke":
m_strSpriteSmoke = ReadString(strValue);
break;
case "spriteflash":
m_strSpriteFlash = ReadString(strValue);
break;
case "sndrotate":
m_strSndRotate = ReadString(strValue);
break;
case "tippos":
m_vecTipPos = ReadVector(strValue);
break;
case "spread":
m_vecSpread = ReadVector(strValue);
break;
default:
super::Restore(strKey, strValue);
}
}
void
func_tank::SpriteSmoke(vector org)
{

View File

@ -65,7 +65,7 @@ func_tankcontrols::Respawn(void)
{
InitBrushTrigger();
solid = SOLID_BBOX;
setorigin(this, origin);
SetOrigin(GetSpawnOrigin());
PlayerUse = OnPlayerUse;
}

View File

@ -53,6 +53,9 @@ class momentary_rot_button:CBaseMomentary
void(void) momentary_rot_button;
/* overrides */
virtual void(float) Save;
virtual void(string, string) Restore;
virtual void(void) OnPlayerUse;
virtual void(void) Respawn;
virtual void(void) SetMovementDirection;
@ -63,6 +66,25 @@ class momentary_rot_button:CBaseMomentary
virtual float(void) GetProgress;
};
void
momentary_rot_button::Save(float handle)
{
SaveInt(handle, "turndir", m_iTurnDir);
super::Save(handle);
}
void
momentary_rot_button::Restore(string strKey, string strValue)
{
switch (strKey) {
case "turndir":
m_iTurnDir = ReadInt(strValue);
break;
default:
super::Restore(strKey, strValue);
}
}
float
momentary_rot_button::GetProgress(void)
{

View File

@ -79,6 +79,7 @@ CBaseMomentary::Save(float handle)
SaveFloat(handle, "distance", m_flDistance);
SaveFloat(handle, "speed", m_flSpeed);
SaveFloat(handle, "returnspeed", m_flReturnspeed);
SaveInt(handle, "movestate", m_iMoveState);
super::Save(handle);
}
@ -108,6 +109,9 @@ CBaseMomentary::Restore(string strKey, string strValue)
case "returnspeed":
m_flReturnspeed = ReadFloat(strValue);
break;
case "movestate":
m_iMoveState = ReadInt(strValue);
break;
default:
super::Restore(strKey, strValue);
}

View File

@ -76,6 +76,7 @@ trigger_changelevel::Save(float handle)
SaveString(handle, "map", m_strMap);
SaveString(handle, "landmark", m_strLandmark);
SaveString(handle, "OnLevelChange", m_strOnLevelChange);
SaveFloat(handle, "activator", num_for_edict(m_activator));
super::Save(handle);
}
@ -95,6 +96,9 @@ trigger_changelevel::Restore(string strKey, string strValue)
case "OnLevelChange":
m_strOnLevelChange = ReadString(strValue);
break;
case "activator":
m_activator = edict_num(ReadFloat(strValue));
break;
default:
super::Restore(strKey, strValue);
}

View File

@ -68,11 +68,10 @@ This entity was introduced in Quake (1996).
class trigger_hurt:NSBrushTrigger
{
int m_iDamage;
int m_iDamageType;
float m_flNextTrigger;
float m_flNextDmg;
float m_flDelay;
int m_iDamageType;
string m_strOnHurt;
string m_strOnHurtPlayer;