Skip to content

Commit

Permalink
Move the weapon freeze logic into Physics_InputPostMove() to work bet…
Browse files Browse the repository at this point in the history
…ter with bots.
  • Loading branch information
eukara committed Mar 7, 2024
1 parent 7994088 commit 8e3f5f2
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions src/shared/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ class player:NSClientPlayer

virtual void(void) Physics_InputPostMove;
virtual void UpdatePlayerAnimation(float);
virtual void SharedInputFrame(void);

#ifdef CLIENT
int playertype;
Expand Down Expand Up @@ -227,18 +226,22 @@ player::Physics_InputPostMove(void)
UpdatePlayerAnimation(input_timelength);

RemoveFlags(FL_FROZEN);
ProcessInput();

#ifdef SERVER
if (g_cs_gamestate == GAME_FREEZE) {
#else
if (getstati(STAT_GAMESTATE) == GAME_FREEZE) {
#endif
flags |= FL_FROZEN;

if (input_buttons & INPUT_BUTTON0) {
w_attack_next = (w_attack_next > 0.1) ? w_attack_next : 0.1f;
}

}
ProcessInput();
}


void Animation_PlayerUpdate(player);
void Animation_TimerUpdate(player, float);

Expand All @@ -251,22 +254,6 @@ player::UpdatePlayerAnimation(float timelength)
Animation_TimerUpdate(this, timelength);
}

void
player::SharedInputFrame(void)
{
/* don't allow attacks when in freeze. */
#ifdef CLIENT
if (getstatf(STAT_GAMESTATE) == GAME_FREEZE) {
#else
if (g_cs_gamestate == GAME_FREEZE) {
#endif
/* secondary fire is still allowed, however. */
if (input_buttons & INPUT_BUTTON0) {
w_attack_next = (w_attack_next > 0.1) ? w_attack_next : 0.1f;
}
}
}

#ifdef CLIENT
void Camera_RunPosBob(vector angles, __inout vector camera_pos);
void Camera_StrafeRoll(__inout vector camera_angle);
Expand Down

0 comments on commit 8e3f5f2

Please sign in to comment.