diff --git a/src/client/include.src b/src/client/include.src index c54d25c5..0512a1d0 100644 --- a/src/client/include.src +++ b/src/client/include.src @@ -26,5 +26,5 @@ shake.qc cmd.qc event.qc entry.qc -util.cpp +util.qc #endlist diff --git a/src/client/util.cpp b/src/client/util.cpp deleted file mode 100644 index 866f7f28..00000000 --- a/src/client/util.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -float -Client_IsSpectator(base_client cl) -{ - return (getplayerkeyfloat(cl.entnum - 1, "*spec") > 0) ? TRUE : FALSE; -} - -float -Client_IsRealSpectator(base_client cl) -{ - return (cl.classname == "spectator") ? TRUE : FALSE; -} - -float -Client_IsFakeSpectator(base_client cl) -{ - return (getplayerkeyvalue(cl.entnum - 1, "*spec") == "2") ? TRUE : FALSE; -} - -float -Client_IsDead(base_client cl) -{ - if (Client_IsSpectator(cl) == TRUE) - return FALSE; - else - return (getplayerkeyvalue(cl.entnum - 1, "*dead") == "1") ? TRUE : FALSE; -} - -float -Client_IsPlayer(base_client cl) -{ - return (cl.classname == "player") ? TRUE : FALSE; -} \ No newline at end of file diff --git a/src/client/util.qc b/src/client/util.qc new file mode 100644 index 00000000..4e0cf96e --- /dev/null +++ b/src/client/util.qc @@ -0,0 +1,33 @@ + +float +Client_IsSpectator(base_client cl) +{ + if (cl.IsRealSpectator() || cl.IsFakeSpectator()) + return true; + + return false; +} + +float +Client_IsRealSpectator(base_client cl) +{ + return cl.IsRealSpectator(); +} + +float +Client_IsFakeSpectator(base_client cl) +{ + return cl.IsFakeSpectator(); +} + +float +Client_IsDead(base_client cl) +{ + return cl.IsDead(); +} + +float +Client_IsPlayer(base_client cl) +{ + return cl.IsPlayer(); +} \ No newline at end of file diff --git a/src/gs-entbase/client/env_cubemap.qc b/src/gs-entbase/client/env_cubemap.qc index 36adc22f..73f1dc45 100644 --- a/src/gs-entbase/client/env_cubemap.qc +++ b/src/gs-entbase/client/env_cubemap.qc @@ -93,7 +93,7 @@ CMap_Shoot(void) setproperty(VF_ANGLES, [0,0,0]); strReflectcube = sprintf( - "env/%s_%d_%d_%d.ktx", + "env/%s_%d_%d_%d", mapname, g_vecCubePos[0], g_vecCubePos[1], diff --git a/src/gs-entbase/server/func_door.qc b/src/gs-entbase/server/func_door.qc index 7f74a16c..da4afef0 100644 --- a/src/gs-entbase/server/func_door.qc +++ b/src/gs-entbase/server/func_door.qc @@ -424,7 +424,7 @@ func_door::Respawn(void) m_vecPos1 = GetSpawnOrigin(); m_vecPos2 = (m_vecPos1 + m_vecMoveDir * (fabs(m_vecMoveDir * size) - m_flLip)); - if (spawnflags & SF_MOV_TOGGLE || spawnflags & SF_MOV_USE) + if (spawnflags & SF_MOV_USE) m_iCanTouch = false; else m_iCanTouch = true; diff --git a/src/server/traceattack.qc b/src/server/traceattack.qc index bd2e4dba..bf4cf411 100644 --- a/src/server/traceattack.qc +++ b/src/server/traceattack.qc @@ -17,8 +17,11 @@ entity g_multiDamage_Target; int g_multiDamage_Value; int g_multiDamage_HitBod; + +#ifdef BULLETPENETRATION float g_pen_flMaxThickness; var float g_pen_flRangeMod = 1.0f; +#endif static void TraceAttack_Apply(entity eAttacker, int iWeapon) diff --git a/src/shared/client.h b/src/shared/client.h index 4aca2d33..3d48dfc4 100644 --- a/src/shared/client.h +++ b/src/shared/client.h @@ -1,4 +1,3 @@ - /* both base_player and base_spectator are based off this class */ class base_client:NSSurfacePropEntity @@ -15,7 +14,9 @@ base_client:NSSurfacePropEntity virtual void(void) PostFrame; virtual int(void) IsFakeSpectator; - + virtual int(void) IsRealSpectator; + virtual int(void) IsDead; + virtual int(void) IsPlayer; #ifdef CLIENT /* gives the chance to override input variables before networking */ @@ -27,4 +28,4 @@ base_client:NSSurfacePropEntity /* run every frame before renderscene() */ virtual float(void) predraw; #endif -}; +}; \ No newline at end of file diff --git a/src/shared/client.qc b/src/shared/client.qc index bcc2e9fe..8231402e 100644 --- a/src/shared/client.qc +++ b/src/shared/client.qc @@ -19,6 +19,24 @@ base_client::IsFakeSpectator(void) return (FALSE); } +int +base_client::IsRealSpectator(void) +{ + return (FALSE); +} + +int +base_client::IsDead(void) +{ + return (FALSE); +} + +int +base_client::IsPlayer(void) +{ + return (FALSE); +} + #ifdef CLIENT void base_client::ClientInputFrame(void) diff --git a/src/shared/player.h b/src/shared/player.h index f08b40f6..58418bc2 100644 --- a/src/shared/player.h +++ b/src/shared/player.h @@ -76,6 +76,9 @@ base_player:spectator virtual void(void) Physics_Run; virtual int(void) IsFakeSpectator; + virtual int(void) IsRealSpectator; + virtual int(void) IsDead; + virtual int(void) IsPlayer; #ifdef CLIENT int sequence; @@ -93,7 +96,6 @@ base_player:spectator virtual void(void) PredictPostFrame; virtual void(void) ClientInputFrame; #else - int voted; int step; float step_time; diff --git a/src/shared/player.qc b/src/shared/player.qc index ebebc1ab..7678db84 100644 --- a/src/shared/player.qc +++ b/src/shared/player.qc @@ -14,14 +14,31 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +int +base_player::IsRealSpectator(void) +{ + return (FALSE); +} + +int +base_player::IsDead(void) +{ + if (health > 0) + return (FALSE); + else + return (TRUE); +} + +int +base_player::IsPlayer(void) +{ + return (FALSE); +} + int base_player::IsFakeSpectator(void) { -#ifdef SERVER - if (infokey(this, "*spec") == "2") -#else - if (getplayerkeyfloat(entnum - 1, "*spec") == 2) -#endif + if (movetype == MOVETYPE_NOCLIP) return (TRUE); return (FALSE); @@ -503,19 +520,17 @@ base_player::MakeTempSpectator(void) { classname = "player"; flags = FL_CLIENT; - modelindex = 0; + SetModelindex(0); + SetSolid(SOLID_NOT); + SetMovetype(MOVETYPE_NOCLIP); + SetTakedamage(DAMAGE_NO); + maxspeed = 250; max_health = health = 0; armor = 0; g_items = 0; activeweapon = 0; effects = 0; alpha = 0.0f; - solid = SOLID_NOT; - movetype = MOVETYPE_NOCLIP; - maxspeed = 250; - takedamage = DAMAGE_NO; - forceinfokey(this, "*spec", "2"); - forceinfokey(this, "*dead", "0"); } /* @@ -538,9 +553,7 @@ base_player::Death(void) SetModelindex(0); SetMovetype(MOVETYPE_NONE); SetSolid(SOLID_NOT); - takedamage = DAMAGE_NO; - forceinfokey(this, "*spec", "0"); - forceinfokey(this, "*dead", "1"); + SetTakedamage(DAMAGE_NO); viewzoom = 1.0; view_ofs = [0,0,0]; vehicle = __NULL__; @@ -574,8 +587,6 @@ base_player::MakePlayer(void) solid = SOLID_SLIDEBOX; movetype = MOVETYPE_WALK; takedamage = DAMAGE_YES; - forceinfokey(this, "*spec", "0"); - forceinfokey(this, "*dead", "0"); viewzoom = 1.0; vehicle = __NULL__; velocity = [0,0,0]; @@ -829,7 +840,8 @@ _base_player_unuseworkaround(entity eTarget) ================= base_player:: InputUse_Down -Called when we hold down the +use button for the first time +Called when we hold down the +use button for the first time, +looks for an entity that has the .PlayerUse field set to a function and calls it. ================= */ void @@ -843,22 +855,28 @@ base_player::InputUse_Down(void) vector vecSource; entity eRad; + bool found_use = false; makevectors(v_angle); vecSource = origin + view_ofs; traceline(vecSource, vecSource + (v_forward * 64), MOVE_EVERYTHING, this); - /* find anything in a 8 unit radius, including certain non-solids (func_door, func_rot_button etc. */ - eRad = findradius(trace_endpos, 8); - bool found_use = false; + /* first see if we traced something head-on, else we'll findradius something */ + if (trace_ent.PlayerUse) { + found_use = true; + eRad = trace_ent; + } else { + /* find anything in a 8 unit radius, including certain non-solids (func_door, func_rot_button etc. */ + eRad = findradius(trace_endpos, 8); - /* loop through our chain and just pick the first valid one */ - while (eRad) { - if (eRad.PlayerUse) { - found_use = true; - break; + /* loop through our chain and just pick the first valid one */ + while (eRad) { + if (eRad.PlayerUse) { + found_use = true; + break; + } + eRad = eRad.chain; } - eRad = eRad.chain; } /* TODO: maybe eRad will return something in the future that'll suppress a successfull use? */ diff --git a/src/shared/spectator.h b/src/shared/spectator.h index bac0433a..0dc2549b 100644 --- a/src/shared/spectator.h +++ b/src/shared/spectator.h @@ -44,6 +44,11 @@ class spectator:base_client virtual void(void) PostFrame; virtual void(void) SpectatorTrackPlayer; + virtual int(void) IsFakeSpectator; + virtual int(void) IsRealSpectator; + virtual int(void) IsDead; + virtual int(void) IsPlayer; + #ifdef SERVER virtual void(void) EvaluateEntity; virtual float(entity, float) SendEntity; diff --git a/src/shared/spectator.qc b/src/shared/spectator.qc index d8471ace..58e84b14 100644 --- a/src/shared/spectator.qc +++ b/src/shared/spectator.qc @@ -14,6 +14,31 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ + +int +spectator::IsRealSpectator(void) +{ + return (TRUE); +} + +int +spectator::IsDead(void) +{ + return (FALSE); +} + +int +spectator::IsPlayer(void) +{ + return (FALSE); +} + +int +spectator::IsFakeSpectator(void) +{ + return (FALSE); +} + void spectator::ClientInput(void) { @@ -434,10 +459,6 @@ spectator::spectator(void) maxspeed = 250; spec_ent = 0; spec_mode = 0; - -#ifdef SERVER - forceinfokey(this, "*spec", "1"); -#endif } #ifdef CLIENT