Merge remote-tracking branch 'origin/TimePath/experiments/csqc_prediction' into TimeP...
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 2 Feb 2015 09:02:30 +0000 (20:02 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 2 Feb 2015 09:02:30 +0000 (20:02 +1100)
1  2 
qcsrc/common/physics.qc

diff --combined qcsrc/common/physics.qc
@@@ -1,6 -1,46 +1,6 @@@
 -.float race_penalty;
 +#include "physics.qh"
  
 -.float gravity;
 -.float swamp_slowdown;
 -.float lastflags;
 -.float lastground;
 -.float wasFlying;
 -.float spectatorspeed;
 -
 -.vector movement_old;
 -.float buttons_old;
 -.vector v_angle_old;
 -.string lastclassname;
 -
 -.float() PlayerPhysplug;
 -float AdjustAirAccelQW(float accelqw, float factor);
 -
 -#ifdef CSQC
 -
 -.float watertype;
 -
 -#elif defined(SVQC)
 -.float stat_sv_airaccel_qw;
 -.float stat_sv_airstrafeaccel_qw;
 -.float stat_sv_airspeedlimit_nonqw;
 -.float stat_sv_maxspeed;
 -.float stat_movement_highspeed;
 -
 -.float stat_sv_friction_on_land;
 -.float stat_sv_friction_slick;
 -
 -.float stat_doublejump;
 -
 -.float stat_jumpspeedcap_min;
 -.float stat_jumpspeedcap_max;
 -.float stat_jumpspeedcap_disable_onramps;
 -
 -.float stat_jetpack_accel_side;
 -.float stat_jetpack_accel_up;
 -.float stat_jetpack_antigravity;
 -.float stat_jetpack_fuel;
 -.float stat_jetpack_maxspeed_up;
 -.float stat_jetpack_maxspeed_side;
 +#ifdef SVQC
  
  void Physics_AddStats()
  {
@@@ -400,20 -440,20 +400,20 @@@ void PM_AirAccelerate(vector wishdir, f
  PlayerJump
  
  When you press the jump key
 -returns TRUE if handled
 +returns true if handled
  =============
  */
  float PlayerJump (void)
  {
        if (PHYS_FROZEN(self))
 -              return TRUE; // no jumping in freezetag when frozen
 +              return true; // no jumping in freezetag when frozen
  
  #ifdef SVQC
        if (self.player_blocked)
 -              return TRUE; // no jumping while blocked
 +              return true; // no jumping while blocked
  #endif
  
 -      float doublejump = FALSE;
 +      float doublejump = false;
        float mjumpheight = PHYS_JUMPVELOCITY;
  
        player_multijump = doublejump;
  #elif defined(CSQC)
        if(PM_multijump_checkjump())
  #endif
 -              return TRUE;
 +              return true;
  
        doublejump = player_multijump;
        mjumpheight = player_jumpheight;
                tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
                if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
                {
 -                      doublejump = TRUE;
 +                      doublejump = true;
  
                        // we MUST clip velocity here!
                        float f;
        if (self.waterlevel >= WATERLEVEL_SWIMMING)
        {
                self.velocity_z = PHYS_MAXSPEED(self) * 0.7;
 -              return TRUE;
 +              return true;
        }
  
        if (!doublejump)
  
        if (PHYS_TRACK_CANJUMP(self))
                if (IS_JUMP_HELD(self))
 -                      return TRUE;
 +                      return true;
  
        // sv_jumpspeedcap_min/sv_jumpspeedcap_max act as baseline
        // velocity bounds.  Final velocity is bound between (jumpheight *
  
        self.oldvelocity_z = self.velocity_z;
  
 -      animdecide_setaction(self, ANIMACTION_JUMP, TRUE);
 +      animdecide_setaction(self, ANIMACTION_JUMP, true);
  
        if (autocvar_g_jump_grunt)
                PlayerSound(playersound_jump, CH_PLAYER, VOICETYPE_PLAYERSOUND);
  #endif
 -      return TRUE;
 +      return true;
  }
  
  void CheckWaterJump()
        v_forward_z = 0;
        normalize(v_forward);
        vector end = start + v_forward*24;
 -      traceline (start, end, TRUE, self);
 +      traceline (start, end, true, self);
        if (trace_fraction < 1)
        {       // solid at waist
                start_z = start_z + self.maxs_z - 8;
                end = start + v_forward*24;
                self.movedir = trace_plane_normal * -50;
 -              traceline(start, end, TRUE, self);
 +              traceline(start, end, true, self);
                if (trace_fraction == 1)
                {       // open at eye level
                        self.velocity_z = 225;
@@@ -570,7 -610,7 +570,7 @@@ void CheckPlayerJump(
                float has_fuel = !autocvar_g_jetpack_fuel || self.ammo_fuel || ITEMS(self) & IT_UNLIMITED_WEAPON_AMMO;
  #else
                PlayerJump(); // Client only
 -              float has_fuel = TRUE; // TODO
 +              float has_fuel = true; // TODO
  #endif
                if (!(ITEMS(self) & IT_JETPACK)) { }
                else if (self.jetpack_stopped) { }
                        else if (activate)
                                Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
  #endif
 -                      self.jetpack_stopped = TRUE;
 +                      self.jetpack_stopped = true;
  #ifdef SVQC
                        ITEMS(self) &= ~IT_USING_JETPACK;
  #endif
        }
        else
        {
 -              self.jetpack_stopped = FALSE;
 +              self.jetpack_stopped = false;
  #ifdef SVQC
                ITEMS(self) &= ~IT_USING_JETPACK;
  #endif
@@@ -844,6 -884,40 +844,6 @@@ void SpecialCommand(
  #endif
  }
  
 -#ifdef SVQC
 -float speedaward_speed;
 -string speedaward_holder;
 -string speedaward_uid;
 -#endif
 -void race_send_speedaward(float msg)
 -{
 -#ifdef SVQC
 -      // send the best speed of the round
 -      WriteByte(msg, SVC_TEMPENTITY);
 -      WriteByte(msg, TE_CSQC_RACE);
 -      WriteByte(msg, RACE_NET_SPEED_AWARD);
 -      WriteInt24_t(msg, floor(speedaward_speed+0.5));
 -      WriteString(msg, speedaward_holder);
 -#endif
 -}
 -
 -#ifdef SVQC
 -float speedaward_alltimebest;
 -string speedaward_alltimebest_holder;
 -string speedaward_alltimebest_uid;
 -#endif
 -void race_send_speedaward_alltimebest(float msg)
 -{
 -#ifdef SVQC
 -      // send the best speed
 -      WriteByte(msg, SVC_TEMPENTITY);
 -      WriteByte(msg, TE_CSQC_RACE);
 -      WriteByte(msg, RACE_NET_SPEED_AWARD_BEST);
 -      WriteInt24_t(msg, floor(speedaward_alltimebest+0.5));
 -      WriteString(msg, speedaward_alltimebest_holder);
 -#endif
 -}
 -
  float PM_check_keepaway(void)
  {
  #ifdef SVQC
@@@ -892,13 -966,13 +892,13 @@@ float PM_check_specialcommand(float but
                {
                        self.specialcommand_pos = 0;
                        SpecialCommand();
 -                      return TRUE;
 +                      return true;
                }
        }
        else if (self.specialcommand_pos && (c != substring(specialcommand, self.specialcommand_pos - 1, 1)))
                self.specialcommand_pos = 0;
  #endif
 -      return FALSE;
 +      return false;
  }
  
  void PM_check_nickspam(void)
                        PHYS_INPUT_ANGLES(self)_x = random() * 360;
                        PHYS_INPUT_ANGLES(self)_y = random() * 360;
                        // at least I'm not forcing retardedview by also assigning to angles_z
 -                      self.fixangle = TRUE;
 +                      self.fixangle = true;
                }
        }
  #endif
@@@ -1739,9 -1813,8 +1739,8 @@@ void PM_Main(
                        not_allowed_to_move = 1;
  #endif
  #ifdef SVQC
-               if (!autocvar_sv_ready_restart_after_countdown)
-                       if (time < game_starttime)
-                               not_allowed_to_move = 1;
+               if (time < game_starttime)
+                       not_allowed_to_move = 1;
  #endif
  
                if (not_allowed_to_move)
  #elif defined(CSQC)
        self.lastflags = self.pmove_flags;
  #endif
 -      
 +
        self.lastclassname = self.classname;
  }
  
@@@ -1942,4 -2015,4 +1941,4 @@@ void CSQC_ClientMovement_PlayerMove_Fra
  #endif
  {
        PM_Main();
 -}
 +}