diff --git a/src/client/entry.qc b/src/client/entry.qc index 8870966b..d09f82bf 100644 --- a/src/client/entry.qc +++ b/src/client/entry.qc @@ -526,6 +526,9 @@ CSQC_Input_Frame(void) { entity me; + if (Util_IsPaused()) + return; + CSQC_UpdateSeat(); me = pSeat->m_ePlayer; diff --git a/src/client/predict.qc b/src/client/predict.qc index b3b8d80c..5aa4e869 100644 --- a/src/client/predict.qc +++ b/src/client/predict.qc @@ -26,6 +26,9 @@ Propagate our pmove state to whatever the current frame before its stomped on void Predict_EntityUpdate(player pl, float new) { + if (Util_IsPaused()) + return; + /* this is a new client entity, let's set it up right */ if (new || self.classname != "player") { spawnfunc_player(); diff --git a/src/gs-entbase/shared/NSMonster.h b/src/gs-entbase/shared/NSMonster.h index 9a637eec..0c7e3a83 100644 --- a/src/gs-entbase/shared/NSMonster.h +++ b/src/gs-entbase/shared/NSMonster.h @@ -253,7 +253,7 @@ class NSMonster:NSNavAI virtual int(void) AttackRanged; virtual float(void) MeleeMaxDistance; - virtual int(void) MeleeCondition; + virtual bool(void) MeleeCondition; virtual bool(entity enemy) IsValidEnemy; diff --git a/src/gs-entbase/shared/NSMonster.qc b/src/gs-entbase/shared/NSMonster.qc index 8a308ebe..c822aa91 100644 --- a/src/gs-entbase/shared/NSMonster.qc +++ b/src/gs-entbase/shared/NSMonster.qc @@ -140,10 +140,10 @@ NSMonster::MeleeMaxDistance(void) } /* Whether or not we should attempt a melee attack */ -int +bool NSMonster::MeleeCondition(void) { - return (vlen(origin - m_eEnemy.origin) < MeleeMaxDistance()) ? TRUE : FALSE; + return (vlen(origin - m_eEnemy.origin) < MeleeMaxDistance()) ? true : false; } float diff --git a/src/gs-entbase/shared/NSTalkMonster.qc b/src/gs-entbase/shared/NSTalkMonster.qc index 8697f708..33a2f6b1 100644 --- a/src/gs-entbase/shared/NSTalkMonster.qc +++ b/src/gs-entbase/shared/NSTalkMonster.qc @@ -369,16 +369,29 @@ NSTalkMonster::TalkStopFollow(void) void NSTalkMonster::FollowPlayer(void) { + float flPlayerDist; input_angles = vectoangles(m_eFollowingChain.origin - origin); input_angles[0] = 0; input_angles[1] = Math_FixDelta(input_angles[1]); input_angles[2] = 0; + /* for best results, we want to ignore the Z plane + this avoids the problem of a follower spinning + around when above/below you on a platform */ + vector vecParent = m_eFollowingChain.origin; + vecParent[2] = origin[2]; + + flPlayerDist = vlen(vecParent - origin); + /* Give up after 1024 units */ - if (vlen(m_eFollowingChain.origin - origin) > 1024) { + if (flPlayerDist > 1024) { m_eFollowing = world; - } else if (vlen(m_eFollowingChain.origin - origin) > 64) { - input_movevalues[0] = GetChaseSpeed(); + } else if (flPlayerDist > 64) { + /* if we're close enough, we ought to walk */ + if (flPlayerDist > 256) + input_movevalues[0] = GetChaseSpeed(); + else + input_movevalues[0] = GetWalkSpeed(); other = world; traceline(origin, m_eFollowingChain.origin, MOVE_OTHERONLY, this); diff --git a/src/shared/NSClientPlayer.qc b/src/shared/NSClientPlayer.qc index 261ecb14..3a27f238 100644 --- a/src/shared/NSClientPlayer.qc +++ b/src/shared/NSClientPlayer.qc @@ -48,6 +48,9 @@ void NSClientPlayer::PreFrame(void) { #ifdef CLIENT + if (Util_IsPaused()) + return; + /* this is where a game/mod would decide to add more prediction rollback * information. */ PredictPreFrame(); @@ -86,6 +89,9 @@ void NSClientPlayer::PostFrame(void) { #ifdef CLIENT + if (Util_IsPaused()) + return; + /* give the game/mod a chance to roll back its values too */ PredictPostFrame(); setorigin(this, origin); /* update bounds */ @@ -101,7 +107,10 @@ NSClientPlayer::PostFrame(void) void NSClientPlayer::ClientInput(void) -{ +{ + if (Util_IsPaused()) + return; + XR_InputFrame(this); if (!Client_InIntermission() && IsFakeSpectator()) { @@ -174,7 +183,10 @@ This is basically CSQC_Input_Frame! So games can override this as they please. */ void NSClientPlayer::ClientInputFrame(void) -{ +{ + if (Util_IsPaused()) + return; + if (IsFakeSpectator()) { NSClientSpectator::ClientInputFrame(); return; diff --git a/src/shared/defs.h b/src/shared/defs.h index 1a19a666..05c11ac6 100644 --- a/src/shared/defs.h +++ b/src/shared/defs.h @@ -120,6 +120,7 @@ Empty(void) void Util_Destroy(void); string Util_TimeToString(float fTime); int Util_IsTeamplay(void); +bool Util_IsPaused(void); __wrap void dprint(string m) diff --git a/src/shared/util.qc b/src/shared/util.qc index e467759e..d7a6d0b8 100644 --- a/src/shared/util.qc +++ b/src/shared/util.qc @@ -14,6 +14,16 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +bool +Util_IsPaused(void) +{ +#ifdef CLIENT + return serverkeyfloat(SERVERKEY_PAUSESTATE) == 1 ? true : false; +#else + return false; +#endif +} + void Util_Destroy(void) {