diff --git a/src/gs-entbase/client/env_sprite.qc b/src/gs-entbase/client/env_sprite.qc index ed1f6e25..7d5991ac 100644 --- a/src/gs-entbase/client/env_sprite.qc +++ b/src/gs-entbase/client/env_sprite.qc @@ -19,13 +19,50 @@ class env_sprite:NSRenderableEntity float framerate; int loops; int maxframe; + string m_strMaterial; + virtual float(void) predraw; virtual void(void) Init; virtual void(void) Initialized; virtual void(float,float) ReceiveEntity; virtual void(void) think; }; +float +env_sprite::predraw(void) +{ + if (!m_strMaterial) + return (PREDRAW_NEXT); + + int s = (float)getproperty(VF_ACTIVESEAT); + pSeat = &g_seats[s]; + vector vecPlayer = pSeat->m_vecPredictedOrigin; + makevectors(view_angles); + makevectors(vectoangles(origin - vecPlayer)); + vector forg = origin + (v_forward * -16); + vector fsize = [64,64]; + + traceline(origin, vecPlayer, MOVE_WORLDONLY, this); + + if (trace_fraction < 1.0) + return; + + R_BeginPolygon(m_strMaterial, 1, 0); + R_PolygonVertex(forg + v_right * fsize[0] - v_up * fsize[1], + [1,1], m_vecRenderColor, 1.0); + R_PolygonVertex(forg - v_right * fsize[0] - v_up * fsize[1], + [0,1], m_vecRenderColor, 1.0); + R_PolygonVertex(forg - v_right * fsize[0] + v_up * fsize[1], + [0,0], m_vecRenderColor, 1.0); + R_PolygonVertex(forg + v_right * fsize[0] + v_up * fsize[1], + [1,0], m_vecRenderColor, 1.0); + R_EndPolygon(); + + addentity(this); + + return (PREDRAW_NEXT); +} + void env_sprite::think(void) { @@ -51,6 +88,7 @@ env_sprite::ReceiveEntity(float flNew, float flChanged) modelindex = readfloat(); framerate = readfloat(); scale = readfloat(); + m_strMaterial = readstring(); #ifdef GS_RENDERFX m_iRenderFX = readbyte(); @@ -92,6 +130,7 @@ EnvSprite_ParseEvent(void) spr.modelindex = readfloat(); spr.framerate = readfloat(); spr.scale = readfloat(); + spr.m_strMaterial = readstring(); #ifdef GS_RENDERFX spr.m_iRenderFX = readbyte(); diff --git a/src/gs-entbase/server/env_sprite.qc b/src/gs-entbase/server/env_sprite.qc index b3fa3212..8a2bfb4f 100644 --- a/src/gs-entbase/server/env_sprite.qc +++ b/src/gs-entbase/server/env_sprite.qc @@ -48,17 +48,33 @@ enumflags class env_sprite:NSRenderableEntity { + bool m_iIsShader; int m_iToggled; float m_flFramerate; float m_flScale; float m_flEffects; + string m_strMaterial; void(void) env_sprite; virtual void(entity, int) Trigger; virtual float(entity, float) SendEntity; virtual void(string, string) SpawnKey; + virtual void(entity, string, string) Input; }; +void +env_sprite::Input(entity eAct, string strInput, string strData) +{ + switch (strInput) { + case "Color": + m_vecRenderColor = stov(strData) / 255; + SendFlags |= 1; + break; + default: + super::Input(eAct, strInput, strData); + } +} + float env_sprite::SendEntity(entity ePEnt, float flags) { @@ -80,6 +96,7 @@ env_sprite::SendEntity(entity ePEnt, float flags) WriteFloat(MSG_ENTITY, modelindex); WriteFloat(MSG_ENTITY, m_flFramerate); WriteFloat(MSG_ENTITY, m_flScale); + WriteString(MSG_ENTITY, m_strMaterial); #ifdef GS_RENDERFX WriteByte(MSG_ENTITY, m_iRenderFX); @@ -109,6 +126,7 @@ env_sprite::NetworkOnce(void) WriteFloat(MSG_MULTICAST, modelindex); WriteFloat(MSG_MULTICAST, m_flFramerate); WriteFloat(MSG_MULTICAST, m_flScale); + WriteString(MSG_MULTICAST, m_strMaterial); #ifdef GS_RENDERFX WriteByte(MSG_MULTICAST, m_iRenderFX); @@ -144,6 +162,10 @@ void env_sprite::SpawnKey(string strKey, string strValue) { switch (strKey) { + case "shader": + case "material": + m_strMaterial = strValue; + break; case "framerate": m_flFramerate = stof(strValue); break; @@ -158,6 +180,7 @@ env_sprite::SpawnKey(string strKey, string strValue) void env_sprite::env_sprite(void) { + m_iIsShader = false; m_flFramerate = 10; m_flScale = 1.0f; diff --git a/src/gs-entbase/server/func_breakable.qc b/src/gs-entbase/server/func_breakable.qc index 9e59e954..13c0d38e 100644 --- a/src/gs-entbase/server/func_breakable.qc +++ b/src/gs-entbase/server/func_breakable.qc @@ -218,7 +218,6 @@ func_breakable::Death(void) return; } - health = 0; eActivator = g_dmg_eAttacker; if (m_strBreakSpawn != "" && isfunction(m_strBreakSpawn)) { @@ -241,9 +240,8 @@ func_breakable::Death(void) nextthink = time + random(0.0,0.5); } else { FX_BreakModel(vlen(size) / 10, absmin, absmax, [0,0,0], GetSurfaceData(SURFDATA_MATERIAL)); - /* TODO: ability to have whoever destroyed the crate be the activator */ - UseTargets(this, TRIG_TOGGLE, 0.0f); Hide(); + UseTargets(eActivator, TRIG_TOGGLE, 0.0f); } } diff --git a/src/gs-entbase/server/func_physbox.qc b/src/gs-entbase/server/func_physbox.qc index a83e16ca..8322b7e0 100644 --- a/src/gs-entbase/server/func_physbox.qc +++ b/src/gs-entbase/server/func_physbox.qc @@ -24,6 +24,7 @@ Physics brush. This entity was introduced in Half-Life 2 (2004). */ +#ifndef PHYSICS_STATIC #define FNCPHYBX_ASLEEP 4096 class func_physbox:NSPhysicsEntity @@ -57,3 +58,33 @@ func_physbox::func_physbox(void) { super::NSPhysicsEntity(); } +#else +class func_physbox:NSSurfacePropEntity +{ + void(void) func_physbox; + virtual void(void) Respawn; + virtual void(void) Death; +}; + +void +func_physbox::Death(void) +{ + Hide(); +} + +void +func_physbox::Respawn(void) +{ + NSSurfacePropEntity::Respawn(); + health = GetSpawnHealth(); + SetTakedamage(DAMAGE_YES); + SetSolid(SOLID_BBOX); +} + +void +func_physbox::func_physbox(void) +{ + super::NSSurfacePropEntity(); +} + +#endif diff --git a/src/gs-entbase/server/prop_physics.qc b/src/gs-entbase/server/prop_physics.qc index 0c781018..81723c93 100644 --- a/src/gs-entbase/server/prop_physics.qc +++ b/src/gs-entbase/server/prop_physics.qc @@ -24,6 +24,7 @@ Physics model This entity was introduced in Half-Life 2 (2004). */ +#ifndef PHYSICS_STATIC #define PRPPHYS_ASLEEP 1 class prop_physics:NSPhysicsEntity @@ -56,4 +57,24 @@ void prop_physics::prop_physics(void) { super::NSPhysicsEntity(); -} \ No newline at end of file +} +#else +class prop_physics:NSRenderableEntity +{ + void(void) prop_physics; + virtual void(void) Respawn; +}; + +void +prop_physics::Respawn(void) +{ + super::Respawn(); + SetSolid(SOLID_BBOX); +} + +void +prop_physics::prop_physics(void) +{ + super::NSRenderableEntity(); +} +#endif diff --git a/src/gs-entbase/shared/NSSurfacePropEntity.qc b/src/gs-entbase/shared/NSSurfacePropEntity.qc index 1984b5f3..bdc562de 100644 --- a/src/gs-entbase/shared/NSSurfacePropEntity.qc +++ b/src/gs-entbase/shared/NSSurfacePropEntity.qc @@ -215,7 +215,7 @@ NSSurfacePropEntity::SpawnKey(string strKey, string strValue) { switch (strKey) { case "health": - health = stof(strValue); + max_health = health = stof(strValue); m_oldHealth = health; break; case "propdata":