GS-Entbase: Make sure we use Set*() functions for networked fields all the

time to notify clients of any changes
This commit is contained in:
Marco Cawthorne 2021-07-19 08:34:46 +02:00
parent 362895b19c
commit 37c5c6efdd
17 changed files with 60 additions and 48 deletions

View File

@ -200,8 +200,8 @@ CBaseTrigger::GetMaster(void)
void
CBaseTrigger::InitPointTrigger(void)
{
setsize(this, VEC_HULL_MIN, VEC_HULL_MAX);
solid = SOLID_TRIGGER;
SetSize(VEC_HULL_MIN, VEC_HULL_MAX);
SetSolid(SOLID_TRIGGER);
}
void

View File

@ -55,7 +55,7 @@ void
cycler::Respawn(void)
{
CBaseEntity::Respawn();
solid = SOLID_BBOX;
SetSolid(SOLID_BBOX);
takedamage = DAMAGE_YES;
health = 9999;
}

View File

@ -463,11 +463,13 @@ func_door::func_door(void)
void
func_water(void)
{
func_door door;
spawnfunc_func_door();
self.classname = "func_water";
self.solid = SOLID_BSP;
self.skin = CONTENT_WATER;
self.effects |= EF_FULLBRIGHT;
self.spawnflags |= SF_MOV_TOGGLE;
setorigin(self, self.origin); // relink. have to do this.
door = (func_door)self;
door.classname = "func_water";
door.SetSolid(SOLID_BSP);
door.SetSkin(CONTENT_WATER);
door.effects |= EF_FULLBRIGHT;
door.spawnflags |= SF_MOV_TOGGLE;
setorigin(door, door.origin); // relink. have to do this.
}

View File

@ -33,7 +33,7 @@ func_lod::SpawnKey(string strKey, string strValue)
switch (strKey) {
case "Solid":
case "solid":
solid = stoi(strValue) == 1 ? SOLID_NOT : SOLID_BSP;
SetSolid(stoi(strValue) == 1 ? SOLID_NOT : SOLID_BSP);
break;
default:
CBaseEntity::SpawnKey(strKey, strValue);

View File

@ -493,8 +493,8 @@ func_vehicle::Realign(void)
void
func_vehicle::Respawn(void)
{
movetype = MOVETYPE_PUSH;
solid = SOLID_BSP;
SetMovetype(MOVETYPE_PUSH);
SetSolid(SOLID_BSP);
SetModel(m_oldModel);
SetOrigin(m_oldOrigin);
SetAngles(m_oldAngle);

View File

@ -58,19 +58,19 @@ func_wall_toggle::Trigger(entity act, int state)
}
if (m_iVisible) {
SetSolid(SOLID_BSP);
SetModelindex(m_oldmodelindex);
solid = SOLID_BSP;
} else {
SetSolid(SOLID_NOT);
SetModelindex(0);
solid = SOLID_NOT;
}
}
void
func_wall_toggle::Respawn(void)
{
movetype = MOVETYPE_PUSH;
solid = SOLID_BSP;
SetMovetype(MOVETYPE_PUSH);
SetSolid(SOLID_BSP);
SetModel(m_oldModel);
SetOrigin(origin);
m_iVisible = 1;

View File

@ -26,7 +26,7 @@ This is a food item that will give the user 1 health when touched.
This entity was introduced in Half-Life (1998).
*/
class item_food
class item_food:CBaseEntity
{
int m_iIsCan;
void(void) item_food;
@ -46,14 +46,14 @@ void item_food::Touch(void)
}
Damage_Apply(other, this, -1, 0, DMG_GENERIC);
solid = SOLID_NOT;
SetSolid(SOLID_NOT);
remove(this);
}
void item_food::Setup(void)
{
solid = SOLID_TRIGGER;
setsize(this, [-16,-16,-16], [16,16,16]);
SetSolid(SOLID_TRIGGER);
SetSize([-16,-16,-16], [16,16,16]);
touch = Touch;
if (m_iIsCan) {
@ -66,14 +66,14 @@ void item_food::item_food(void)
// TODO: differentiate between item_sodacan and item_food
m_iIsCan = 1;
solid = SOLID_NOT;
movetype = MOVETYPE_TOSS;
SetSolid(SOLID_NOT);
SetMovetype(MOVETYPE_TOSS);
if (m_iIsCan) {
setmodel(this,"models/can.mdl");
SetModel("models/can.mdl");
}
setsize(this, [0,0,0], [0,0,0]);
SetSize([0,0,0], [0,0,0]);
think = Setup;
nextthink = time + 1.0f;
}

View File

@ -41,17 +41,24 @@ enumflags
class monster_furniture:CBaseMonster
{
void(void) monster_furniture;
//virtual void(void) Respawn;
virtual void(void) Respawn;
};
void monster_furniture::monster_furniture(void)
void
monster_furniture::Respawn(void)
{
SetMovetype(MOVETYPE_NOCLIP);
SetSolid(SOLID_NOT);
SetModel(m_oldModel);
SetOrigin(m_oldOrigin);
SetAngles(m_oldAngle);
}
void
monster_furniture::monster_furniture(void)
{
precache_model(model);
SetModel(model);
CBaseEntity::CBaseEntity();
movetype = MOVETYPE_NOCLIP;
solid = SOLID_NOT;
spawnflags |= MSF_MULTIPLAYER;
}

View File

@ -45,8 +45,8 @@ monster_generic::Respawn(void)
if (spawnflags & MGF_NONSOLID) {
takedamage = DAMAGE_NO;
SetSolid(SOLID_NOT);
iBleeds = FALSE;
solid = SOLID_NOT;
}
}

View File

@ -57,17 +57,17 @@ target_cdaudio::touch(void)
WriteByte(MSG_MULTICAST, m_iCDTrack);
msg_entity = world;
multicast([0,0,0], MULTICAST_ALL_R);
solid = SOLID_NOT;
SetSolid(SOLID_NOT);
}
void
target_cdaudio::Respawn(void)
{
/* nobody cares that this is non-spherical... right? */
solid = SOLID_TRIGGER;
mins = [-m_flRadius, -m_flRadius, -m_flRadius];
maxs = [m_flRadius, m_flRadius, m_flRadius];
setsize(this, mins, maxs);
SetSolid(SOLID_TRIGGER);
SetSize(mins, maxs);
}
void

View File

@ -85,7 +85,7 @@ trigger_counter::Respawn(void)
{
m_iValue = 0;
m_iCounted = 0;
solid = SOLID_TRIGGER;
SetSolid(SOLID_TRIGGER);
#ifdef GS_RENDERFX
SetRenderMode(RM_TRIGGER);

View File

@ -67,10 +67,10 @@ trigger_hurt::Trigger(entity act, int state)
{
switch (state) {
case TRIG_OFF:
solid = SOLID_NOT;
SetSolid(SOLID_NOT);
break;
case TRIG_ON:
solid = SOLID_TRIGGER;
SetSolid(SOLID_TRIGGER);
InitBrushTrigger();
break;
default:

View File

@ -83,7 +83,7 @@ trigger_multiple::touch(void)
think = Respawn;
nextthink = time + m_flWait;
}
solid = SOLID_NOT;
SetSolid(SOLID_NOT);
}
void

View File

@ -64,7 +64,7 @@ trigger_once::touch(void)
if (!(spawnflags & TO_PUSHABLES) && other.classname == "func_pushable")
return;
solid = SOLID_NOT; /* make inactive */
SetSolid(SOLID_NOT); /* make inactive */
m_iValue = 1;
if (!target) {
@ -79,7 +79,7 @@ void
trigger_once::Respawn(void)
{
m_iValue = 0;
solid = SOLID_TRIGGER;
SetSolid(SOLID_TRIGGER);
#ifdef GS_RENDERFX
SetRenderMode(RM_TRIGGER);

View File

@ -70,13 +70,13 @@ trigger_push::Trigger(entity act, int state)
{
switch (state) {
case TRIG_OFF:
solid = SOLID_NOT;
SetSolid(SOLID_NOT);
break;
case TRIG_ON:
solid = SOLID_TRIGGER;
SetSolid(SOLID_TRIGGER);
break;
default:
solid = (solid == SOLID_NOT) ? SOLID_TRIGGER : SOLID_NOT;
SetSolid(solid == SOLID_NOT ? SOLID_TRIGGER : SOLID_NOT);
}
}
@ -116,7 +116,7 @@ trigger_push::Respawn(void)
SetMovementDirection();
if (spawnflags & TP_STARTOFF) {
solid = SOLID_NOT;
SetSolid(SOLID_NOT);
}
}

View File

@ -33,11 +33,10 @@ class trigger_transition:CBaseEntity
void
trigger_transition::trigger_transition(void)
{
solid = SOLID_NOT;
movetype = MOVETYPE_NONE;
SetSolid(SOLID_NOT);
SetMovetype(MOVETYPE_NONE);
SetModel(model);
model = __NULL__;
modelindex = 0;
SetModelindex(0);
#ifdef GS_RENDERFX
SetRenderMode(RM_TRIGGER);

View File

@ -67,6 +67,7 @@ class CBaseEntity
virtual void(void) SpawnInit;
#endif
/* we only provide these for networked keys, so we can send updates */
virtual void(float) SetEffects;
virtual void(float) SetFrame;
virtual void(string) SetModel;
@ -76,9 +77,12 @@ class CBaseEntity
virtual void(float) SetSolid;
virtual void(int) SetBody;
virtual void(float) SetScale;
/* these are monitored at all times */
virtual void(vector) SetAngles;
virtual void(vector) SetOrigin;
virtual void(vector, vector) SetSize;
virtual void(string, string) SpawnKey;
#ifdef GS_RENDERFX