void CSQC_ClientMovement_PlayerMove_Frame(entity this)
#endif
{
+#ifdef SVQC
+ // needs to be called before physics are run!
+ PM_UpdateButtons(this);
+#endif
+
sys_phys_update(this, PHYS_INPUT_TIMELENGTH);
#ifdef SVQC
void Physics_UpdateStats(entity this, float maxspd_mod);
+ void PM_UpdateButtons(entity this);
+
.float stat_sv_airspeedlimit_nonqw = _STAT(MOVEVARS_AIRSPEEDLIMIT_NONQW);
.float stat_sv_maxspeed = _STAT(MOVEVARS_MAXSPEED);
{
float maxspeed_mod = autocvar_sv_spectator_speed_multiplier;
if (!this.spectatorspeed) { this.spectatorspeed = maxspeed_mod; }
- if ((this.impulse >= 1 && this.impulse <= 19)
- || (this.impulse >= 200 && this.impulse <= 209)
- || (this.impulse >= 220 && this.impulse <= 229)
+ if ((CS(this).impulse >= 1 && CS(this).impulse <= 19)
+ || (CS(this).impulse >= 200 && CS(this).impulse <= 209)
+ || (CS(this).impulse >= 220 && CS(this).impulse <= 229)
) {
if (this.lastclassname != STR_PLAYER) {
- if (this.impulse == 10
- || this.impulse == 15
- || this.impulse == 18
- || (this.impulse >= 200 && this.impulse <= 209)
- ) { this.spectatorspeed = bound(1, this.spectatorspeed + 0.5, 5); } else if (this.impulse == 11) {
+ if (CS(this).impulse == 10
+ || CS(this).impulse == 15
+ || CS(this).impulse == 18
+ || (CS(this).impulse >= 200 && CS(this).impulse <= 209)
+ ) { this.spectatorspeed = bound(1, this.spectatorspeed + 0.5, 5); } else if (CS(this).impulse == 11) {
this.spectatorspeed = maxspeed_mod;
- } else if (this.impulse == 12
- || this.impulse == 16
- || this.impulse == 19
- || (this.impulse >= 220 && this.impulse <= 229)
+ } else if (CS(this).impulse == 12
+ || CS(this).impulse == 16
+ || CS(this).impulse == 19
+ || (CS(this).impulse >= 220 && CS(this).impulse <= 229)
) {
this.spectatorspeed = bound(1, this.spectatorspeed - 0.5, 5);
- } else if (this.impulse >= 1 && this.impulse <= 9) {
- this.spectatorspeed = 1 + 0.5 * (this.impulse - 1);
+ } else if (CS(this).impulse >= 1 && CS(this).impulse <= 9) {
+ this.spectatorspeed = 1 + 0.5 * (CS(this).impulse - 1);
}
} // otherwise just clear
- this.impulse = 0;
+ CS(this).impulse = 0;
}
}
// we are currently holding a weapon that's not fully loaded, reload it
if(skill >= 2) // bots can only reload the held weapon on purpose past this skill
if(this.(weaponentity).clip_load < this.(weaponentity).clip_size)
- this.impulse = IMP_weapon_reload.impulse; // not sure if this is done right
+ CS(this).impulse = IMP_weapon_reload.impulse; // not sure if this is done right
// if we're not reloading a weapon, switch to any weapon in our invnetory that's not fully loaded to reload it next
// the code above executes next frame, starting the reloading then
float bot_cmd_impulse(entity this)
{
- this.impulse = bot_cmd.bot_cmd_parm_float;
+ CS(this).impulse = bot_cmd.bot_cmd_parm_float;
return CMD_STATUS_FINISHED;
}
{
if(PHYS_INPUT_BUTTON_DRAG(this))
{
- if(this.impulse == 10 || this.impulse == 15 || this.impulse == 18)
+ if(CS(this).impulse == 10 || CS(this).impulse == 15 || CS(this).impulse == 18)
{
Drag_MoveForward(this);
- this.impulse = 0;
+ CS(this).impulse = 0;
}
- else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19)
+ else if(CS(this).impulse == 12 || CS(this).impulse == 16 || CS(this).impulse == 19)
{
Drag_MoveBackward(this);
- this.impulse = 0;
+ CS(this).impulse = 0;
}
- else if(this.impulse >= 1 && this.impulse <= 9)
+ else if(CS(this).impulse >= 1 && CS(this).impulse <= 9)
{
- Drag_SetSpeed(this, this.impulse - 1);
+ Drag_SetSpeed(this, CS(this).impulse - 1);
}
- else if(this.impulse == 14)
+ else if(CS(this).impulse == 14)
{
Drag_SetSpeed(this, 9);
}
this.clip_size = spectatee.clip_size;
this.effects = spectatee.effects & EFMASK_CHEAP; // eat performance
this.health = spectatee.health;
- this.impulse = 0;
+ CS(this).impulse = 0;
this.items = spectatee.items;
this.last_pickup = spectatee.last_pickup;
this.hit_time = spectatee.hit_time;
void ObserverThink(entity this)
{
- if ( this.impulse )
+ if ( CS(this).impulse )
{
- MinigameImpulse(this, this.impulse);
- this.impulse = 0;
+ MinigameImpulse(this, CS(this).impulse);
+ CS(this).impulse = 0;
}
if (this.flags & FL_JUMPRELEASED) {
void SpectatorThink(entity this)
{
- if ( this.impulse )
+ if ( CS(this).impulse )
{
- if(MinigameImpulse(this, this.impulse))
- this.impulse = 0;
+ if(MinigameImpulse(this, CS(this).impulse))
+ CS(this).impulse = 0;
- if (this.impulse == IMP_weapon_drop.impulse)
+ if (CS(this).impulse == IMP_weapon_drop.impulse)
{
STAT(CAMERA_SPECTATOR, this) = (STAT(CAMERA_SPECTATOR, this) + 1) % 3;
- this.impulse = 0;
+ CS(this).impulse = 0;
return;
}
}
if (PHYS_INPUT_BUTTON_JUMP(this) && joinAllowed(this)) {
this.flags &= ~FL_JUMPRELEASED;
this.flags |= FL_SPAWNING;
- } else if(PHYS_INPUT_BUTTON_ATCK(this) || this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209)) {
+ } else if(PHYS_INPUT_BUTTON_ATCK(this) || CS(this).impulse == 10 || CS(this).impulse == 15 || CS(this).impulse == 18 || (CS(this).impulse >= 200 && CS(this).impulse <= 209)) {
this.flags &= ~FL_JUMPRELEASED;
if(SpectateNext(this)) {
TRANSMUTE(Spectator, this);
TRANSMUTE(Observer, this);
PutClientInServer(this);
}
- this.impulse = 0;
- } else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19 || (this.impulse >= 220 && this.impulse <= 229)) {
+ CS(this).impulse = 0;
+ } else if(CS(this).impulse == 12 || CS(this).impulse == 16 || CS(this).impulse == 19 || (CS(this).impulse >= 220 && CS(this).impulse <= 229)) {
this.flags &= ~FL_JUMPRELEASED;
if(SpectatePrev(this)) {
TRANSMUTE(Spectator, this);
TRANSMUTE(Observer, this);
PutClientInServer(this);
}
- this.impulse = 0;
+ CS(this).impulse = 0;
} else if (PHYS_INPUT_BUTTON_ATCK2(this)) {
this.flags &= ~FL_JUMPRELEASED;
TRANSMUTE(Observer, this);
if (time > this.respawn_time) {
STAT(RESPAWN_TIME, this) = this.respawn_time = time + 1; // only retry once a second
respawn(this);
- this.impulse = CHIMPULSE_SPEEDRUN.impulse;
+ CS(this).impulse = CHIMPULSE_SPEEDRUN.impulse;
}
} else {
if (frametime) player_anim(this);
DrownPlayer(this);
CheckRules_Player(this);
UpdateChatBubble(this);
- if (this.impulse) ImpulseCommands(this);
+ if (CS(this).impulse) ImpulseCommands(this);
if (game_stopped)
{
CSQCMODEL_AUTOUPDATE(this);
CSQCMODEL_AUTOUPDATE(this);
}
+
+// hack to copy the button fields from the client entity to the Client State
+void PM_UpdateButtons(entity this)
+{
+ if(this.impulse)
+ CS(this).impulse = this.impulse;
+ this.impulse = 0;
+
+ CS(this).button0 = this.button0;
+ CS(this).button2 = this.button2;
+ CS(this).button3 = this.button3;
+ CS(this).button4 = this.button4;
+ CS(this).button5 = this.button5;
+ CS(this).button6 = this.button6;
+ CS(this).button7 = this.button7;
+ CS(this).button8 = this.button8;
+ CS(this).button9 = this.button9;
+ CS(this).button10 = this.button10;
+ CS(this).button11 = this.button11;
+ CS(this).button12 = this.button12;
+ CS(this).button13 = this.button13;
+ CS(this).button14 = this.button14;
+ CS(this).button15 = this.button15;
+ CS(this).button16 = this.button16;
+ CS(this).buttonuse = this.buttonuse;
+ CS(this).buttonchat = this.buttonchat;
+
+ CS(this).cursor_active = this.cursor_active;
+ CS(this).cursor_screen = this.cursor_screen;
+ CS(this).cursor_trace_start = this.cursor_trace_start;
+ CS(this).cursor_trace_endpos = this.cursor_trace_endpos;
+ CS(this).cursor_trace_ent = this.cursor_trace_ent;
+
+ // TODO: ping?
+
+ CS(this).v_angle = this.v_angle;
+ CS(this).movement = this.movement;
+}
/** the string "HMAC-SHA256" if signing, and string_null if plaintext */
ATTRIB(Client, crypto_signmethod, string, this.crypto_signmethod);
+ // engine client fields
+ ATTRIB(Client, impulse, int, this.impulse);
+
+ ATTRIB(Client, button0, int, this.button0);
+ ATTRIB(Client, button2, int, this.button2);
+ ATTRIB(Client, button3, int, this.button3);
+ ATTRIB(Client, button4, int, this.button4);
+ ATTRIB(Client, button5, int, this.button5);
+ ATTRIB(Client, button6, int, this.button6);
+ ATTRIB(Client, button7, int, this.button7);
+ ATTRIB(Client, button8, int, this.button8);
+ ATTRIB(Client, button9, int, this.button9);
+ ATTRIB(Client, button10, int, this.button10);
+ ATTRIB(Client, button11, int, this.button11);
+ ATTRIB(Client, button12, int, this.button12);
+ ATTRIB(Client, button13, int, this.button13);
+ ATTRIB(Client, button14, int, this.button14);
+ ATTRIB(Client, button15, int, this.button15);
+ ATTRIB(Client, button16, int, this.button16);
+ ATTRIB(Client, buttonuse, int, this.buttonuse);
+ ATTRIB(Client, buttonchat, int, this.buttonchat);
+
+ ATTRIB(Client, cursor_active, int, this.cursor_active);
+ ATTRIB(Client, cursor_screen, vector, this.cursor_screen);
+ ATTRIB(Client, cursor_trace_start, vector, this.cursor_trace_start);
+ ATTRIB(Client, cursor_trace_endpos, vector, this.cursor_trace_endpos);
+ ATTRIB(Client, cursor_trace_ent, entity, this.cursor_trace_ent);
+
+ ATTRIB(Client, v_angle, vector, this.v_angle);
+ ATTRIB(Client, movement, vector, this.movement);
+
// custom
ATTRIB(Client, playerid, int, this.playerid);
{
if (game_stopped) return;
- int imp = this.impulse;
+ int imp = CS(this).impulse;
if (!imp) return;
- this.impulse = 0;
+ CS(this).impulse = 0;
if (MinigameImpulse(this, imp)) return;
if(it.health != 2342)
{
it.health = 2342;
- it.impulse = 0;
+ CS(it).impulse = 0;
msg_entity = it;
WriteByte(MSG_ONE, SVC_FINALE);
if ( !(mapvote_maps_flags[it.mapvote-1] & GTV_AVAILABLE) )
it.mapvote = 0;
// use impulses as new vote
- if(it.impulse >= 1 && it.impulse <= mapvote_count)
- if( mapvote_maps_flags[it.impulse - 1] & GTV_AVAILABLE )
+ if(CS(it).impulse >= 1 && CS(it).impulse <= mapvote_count)
+ if( mapvote_maps_flags[CS(it).impulse - 1] & GTV_AVAILABLE )
{
- it.mapvote = it.impulse;
+ it.mapvote = CS(it).impulse;
MapVote_TouchVotes(it);
}
- it.impulse = 0;
+ CS(it).impulse = 0;
if(it.mapvote)
++totalvotes;
this.health = 0;
ctf_CheckFlagReturn(this, RETURN_SPEEDRUN);
- this.owner.impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set
+ CS(this.owner).impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set
ImpulseCommands(this.owner);
}
if(autocvar_g_ctf_stalemate)