vector rigvel;
vector angles_save = this.angles;
- float accel = bound(-1, this.movement.x / PHYS_MAXSPEED(this), 1);
- float steer = bound(-1, this.movement.y / PHYS_MAXSPEED(this), 1);
+ float accel = bound(-1, PHYS_CS(this).movement.x / PHYS_MAXSPEED(this), 1);
+ float steer = bound(-1, PHYS_CS(this).movement.y / PHYS_MAXSPEED(this), 1);
if (PHYS_BUGRIGS_REVERSE_SPEEDING(this))
{
float tap_direction_x = 0;
float tap_direction_y = 0;
bool dodge_detected = false;
+ vector mymovement = PHYS_CS(this).movement;
#define X(COND,BTN,RESULT) \
- if (this.movement_##COND) \
+ if (mymovement_##COND) \
/* is this a state change? */ \
if(!(PHYS_DODGING_PRESSED_KEYS(this) & KEY_##BTN) || frozen_no_doubletap) { \
tap_direction_##RESULT; \
if (this.dodging_action == 1)
{
//disable jump key during dodge accel phase
- if(this.movement_z > 0) { this.movement_z = 0; }
+ if(PHYS_CS(this).movement.z > 0) { PHYS_CS(this).movement_z = 0; }
this.velocity += ((this.dodging_direction_y * velocity_difference) * v_right)
+ ((this.dodging_direction_x * velocity_difference) * v_forward);
PM_dodging_checkpressedkeys(this);
int keys = this.pressedkeys;
- keys = BITSET(keys, KEY_FORWARD, this.movement.x > 0);
- keys = BITSET(keys, KEY_BACKWARD, this.movement.x < 0);
- keys = BITSET(keys, KEY_RIGHT, this.movement.y > 0);
- keys = BITSET(keys, KEY_LEFT, this.movement.y < 0);
+ keys = BITSET(keys, KEY_FORWARD, PHYS_CS(this).movement.x > 0);
+ keys = BITSET(keys, KEY_BACKWARD, PHYS_CS(this).movement.x < 0);
+ keys = BITSET(keys, KEY_RIGHT, PHYS_CS(this).movement.y > 0);
+ keys = BITSET(keys, KEY_LEFT, PHYS_CS(this).movement.y < 0);
keys = BITSET(keys, KEY_JUMP, PHYS_INPUT_BUTTON_JUMP(this));
keys = BITSET(keys, KEY_CROUCH, PHYS_INPUT_BUTTON_CROUCH(this));
if(M_ARGV(2, bool))
{
if(PHYS_MULTIJUMP_DODGING(player))
- if(player.movement_x != 0 || player.movement_y != 0) // don't remove all speed if player isnt pressing any movement keys
+ if(PHYS_CS(player).movement_x != 0 || PHYS_CS(player).movement_y != 0) // don't remove all speed if player isnt pressing any movement keys
{
float curspeed;
vector wishvel, wishdir;
//#endif
makevectors(player.v_angle_y * '0 1 0');
- wishvel = v_forward * player.movement_x + v_right * player.movement_y;
+ wishvel = v_forward * PHYS_CS(player).movement_x + v_right * PHYS_CS(player).movement_y;
wishdir = normalize(wishvel);
player.velocity_x = wishdir_x * curspeed; // allow "dodging" at a multijump
void CPM_PM_Aircontrol(entity this, float dt, vector wishdir, float wishspeed)
{
- float movity = IsMoveInDirection(this.movement, 0);
+ float movity = IsMoveInDirection(PHYS_CS(this).movement, 0);
if(PHYS_AIRCONTROL_BACKWARDS(this))
- movity += IsMoveInDirection(this.movement, 180);
+ movity += IsMoveInDirection(PHYS_CS(this).movement, 180);
if(PHYS_AIRCONTROL_SIDEWARDS(this))
{
- movity += IsMoveInDirection(this.movement, 90);
- movity += IsMoveInDirection(this.movement, -90);
+ movity += IsMoveInDirection(PHYS_CS(this).movement, 90);
+ movity += IsMoveInDirection(PHYS_CS(this).movement, -90);
}
float k = 32 * (2 * movity - 1);
if (this.nickspamcount >= autocvar_g_nick_flood_penalty_yellow)
{
// slight annoyance for nick change scripts
- this.movement = -1 * this.movement;
+ PHYS_CS(this).movement = -1 * PHYS_CS(this).movement;
PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_JUMP(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_ZOOM(this) = PHYS_INPUT_BUTTON_CROUCH(this) = PHYS_INPUT_BUTTON_HOOK(this) = PHYS_INPUT_BUTTON_USE(this) = false;
if (this.nickspamcount >= autocvar_g_nick_flood_penalty_red) // if you are persistent and the slight annoyance above does not stop you, I'll show you!
#endif
)
{
- this.movement_x = bound(-5, this.movement.x, 5);
- this.movement_y = bound(-5, this.movement.y, 5);
- this.movement_z = bound(-5, this.movement.z, 5);
+ PHYS_CS(this).movement_x = bound(-5, PHYS_CS(this).movement.x, 5);
+ PHYS_CS(this).movement_y = bound(-5, PHYS_CS(this).movement.y, 5);
+ PHYS_CS(this).movement_z = bound(-5, PHYS_CS(this).movement.z, 5);
}
else
- this.movement = '0 0 0';
+ PHYS_CS(this).movement = '0 0 0';
vector midpoint = ((this.absmin + this.absmax) * 0.5);
if (pointcontents(midpoint) == CONTENT_WATER)
#ifdef SVQC
if (!this.player_blocked)
return;
- this.movement = '0 0 0';
+ PHYS_CS(this).movement = '0 0 0';
this.disableclientprediction = 1;
#endif
}
{
//makevectors(this.v_angle.y * '0 1 0');
makevectors(this.v_angle);
- vector wishvel = v_forward * this.movement_x
- + v_right * this.movement_y;
+ vector wishvel = v_forward * PHYS_CS(this).movement_x
+ + v_right * PHYS_CS(this).movement_y;
// add remaining speed as Z component
float maxairspd = PHYS_MAXAIRSPEED(this) * max(1, maxspd_mod);
// fix speedhacks :P
#define PHYS_INPUT_FRAMETIME serverdeltatime
#define PHYS_INPUT_MOVEVALUES(s) input_movevalues
+ #define PHYS_CS(s) (s)
#define PHYS_INPUT_BUTTON_BUTTON1(s) boolean(input_buttons & BIT(0))
#define PHYS_INPUT_BUTTON_BUTTON2(s) boolean(input_buttons & BIT(1))
#define PHYS_INPUT_TIMELENGTH frametime
#define PHYS_INPUT_FRAMETIME sys_frametime
- #define PHYS_INPUT_MOVEVALUES(s) ((s).movement)
+ #define PHYS_INPUT_MOVEVALUES(s) CS(s).movement
+ #define PHYS_CS(s) CS(s)
#define PHYS_INPUT_BUTTON_BUTTON1(s) (CS(s).button0)
#define PHYS_INPUT_BUTTON_BUTTON2(s) (CS(s).button2)
// Pitch
ftmp = 0;
- if(this.movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit)
+ if(CS(this).movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit)
ftmp = 4;
- else if(this.movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit)
+ else if(CS(this).movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit)
ftmp = -8;
newvel.x = bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel.x , autocvar_g_vehicle_bumblebee_pitchlimit);
makevectors('0 1 0' * vehic.angles.y);
newvel = vehic.velocity * -autocvar_g_vehicle_bumblebee_friction;
- if(this.movement.x != 0)
+ if(CS(this).movement.x != 0)
{
- if(this.movement.x > 0)
+ if(CS(this).movement.x > 0)
newvel += v_forward * autocvar_g_vehicle_bumblebee_speed_forward;
- else if(this.movement.x < 0)
+ else if(CS(this).movement.x < 0)
newvel -= v_forward * autocvar_g_vehicle_bumblebee_speed_forward;
}
- if(this.movement.y != 0)
+ if(CS(this).movement.y != 0)
{
- if(this.movement.y < 0)
+ if(CS(this).movement.y < 0)
newvel -= v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
- else if(this.movement.y > 0)
+ else if(CS(this).movement.y > 0)
newvel += v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
ftmp = newvel * v_right;
ftmp *= dt * 0.1;
newvel += v_up * autocvar_g_vehicle_bumblebee_speed_up;
vehic.velocity += newvel * dt;
- this.velocity = this.movement = vehic.velocity;
+ this.velocity = CS(this).movement = vehic.velocity;
if(autocvar_g_vehicle_bumblebee_healgun_locktime)
vector df = vehic.velocity * -autocvar_g_vehicle_racer_friction;
//vehic.velocity_z = ftmp;
- if(this.movement)
+ if(CS(this).movement)
{
if(cont & DPCONTENTS_LIQUIDSMASK)
{
- if(this.movement_x) { df += v_forward * ((this.movement_x > 0) ? autocvar_g_vehicle_racer_water_speed_forward : -autocvar_g_vehicle_racer_water_speed_forward); }
- if(this.movement_y) { df += v_right * ((this.movement_y > 0) ? autocvar_g_vehicle_racer_water_speed_strafe : -autocvar_g_vehicle_racer_water_speed_strafe); }
+ if(CS(this).movement_x) { df += v_forward * ((CS(this).movement_x > 0) ? autocvar_g_vehicle_racer_water_speed_forward : -autocvar_g_vehicle_racer_water_speed_forward); }
+ if(CS(this).movement_y) { df += v_right * ((CS(this).movement_y > 0) ? autocvar_g_vehicle_racer_water_speed_strafe : -autocvar_g_vehicle_racer_water_speed_strafe); }
}
else
{
- if(this.movement_x) { df += v_forward * ((this.movement_x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward); }
- if(this.movement_y) { df += v_right * ((this.movement_y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe); }
+ if(CS(this).movement_x) { df += v_forward * ((CS(this).movement_x > 0) ? autocvar_g_vehicle_racer_speed_forward : -autocvar_g_vehicle_racer_speed_forward); }
+ if(CS(this).movement_y) { df += v_right * ((CS(this).movement_y > 0) ? autocvar_g_vehicle_racer_speed_strafe : -autocvar_g_vehicle_racer_speed_strafe); }
}
#ifdef SVQC
dforce = autocvar_g_vehicle_racer_water_downforce;
df -= v_up * (vlen(vehic.velocity) * dforce);
- this.movement = vehic.velocity += df * dt;
+ CS(this).movement = vehic.velocity += df * dt;
#ifdef SVQC
// Pitch
ftmp = 0;
- if(this.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
- else if(this.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
+ if(CS(this).movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5;
+ else if(CS(this).movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20;
df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit);
ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit);
df = vehic.velocity * -autocvar_g_vehicle_raptor_friction;
- if(this.movement_x != 0)
+ if(CS(this).movement_x != 0)
{
- if(this.movement_x > 0)
+ if(CS(this).movement_x > 0)
df += v_forward * autocvar_g_vehicle_raptor_speed_forward;
- else if(this.movement_x < 0)
+ else if(CS(this).movement_x < 0)
df -= v_forward * autocvar_g_vehicle_raptor_speed_forward;
}
- if(this.movement_y != 0)
+ if(CS(this).movement_y != 0)
{
- if(this.movement_y < 0)
+ if(CS(this).movement_y < 0)
df -= v_right * autocvar_g_vehicle_raptor_speed_strafe;
- else if(this.movement_y > 0)
+ else if(CS(this).movement_y > 0)
df += v_right * autocvar_g_vehicle_raptor_speed_strafe;
- vehic.angles_z = bound(-30,vehic.angles_z + (this.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
+ vehic.angles_z = bound(-30,vehic.angles_z + (CS(this).movement_y / autocvar_g_vehicle_raptor_speed_strafe),30);
}
else
{
df += v_up * autocvar_g_vehicle_raptor_speed_up;
vehic.velocity += df * dt;
- this.velocity = this.movement = vehic.velocity;
+ this.velocity = CS(this).movement = vehic.velocity;
setorigin(this, vehic.origin + '0 0 32');
this.oldorigin = this.origin; // negate fall damage
//PHYS_INPUT_BUTTON_JUMP(this) = false;
vector movefix = '0 0 0';
- if(this.movement_x > 0) movefix_x = 1;
- if(this.movement_x < 0) movefix_x = -1;
- if(this.movement_y > 0) movefix_y = 1;
- if(this.movement_y < 0) movefix_y = -1;
+ if(CS(this).movement_x > 0) movefix_x = 1;
+ if(CS(this).movement_x < 0) movefix_x = -1;
+ if(CS(this).movement_y > 0) movefix_y = 1;
+ if(CS(this).movement_y < 0) movefix_y = -1;
vector rt = movefix_y * v_right;
vector sd = movefix_x * v_forward;
}
else if(time >= vehic.jump_delay)
{
- if(!this.movement)
+ if(!CS(this).movement)
{
if(IS_ONGROUND(vehic))
{
else
{
// Turn Body
- if(this.movement_x == 0 && this.movement_y != 0)
+ if(CS(this).movement_x == 0 && CS(this).movement_y != 0)
ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * PHYS_INPUT_FRAMETIME;
else
ftmp = autocvar_g_vehicle_spiderbot_turnspeed * PHYS_INPUT_FRAMETIME;
vehic.angles_y = anglemods(vehic.angles_y + ftmp);
vehic.tur_head.angles_y -= ftmp;
- if(this.movement_x != 0)
+ if(CS(this).movement_x != 0)
{
- if(this.movement_x > 0)
+ if(CS(this).movement_x > 0)
{
- this.movement_x = 1;
+ CS(this).movement_x = 1;
if(IS_ONGROUND(vehic))
vehic.frame = 0;
}
- else if(this.movement_x < 0)
+ else if(CS(this).movement_x < 0)
{
- this.movement_x = -1;
+ CS(this).movement_x = -1;
if(IS_ONGROUND(vehic))
vehic.frame = 1;
}
- this.movement_y = 0;
+ CS(this).movement_y = 0;
float oldvelz = vehic.velocity_z;
- movelib_move_simple(vehic, normalize(v_forward * this.movement_x),((PHYS_INPUT_BUTTON_JUMP(this)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
+ movelib_move_simple(vehic, normalize(v_forward * CS(this).movement_x),((PHYS_INPUT_BUTTON_JUMP(this)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia);
vehic.velocity_z = oldvelz;
float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
if(vehic.velocity_z <= 20) // not while jumping
//dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n");
}
}
- else if(this.movement_y != 0)
+ else if(CS(this).movement_y != 0)
{
- if(this.movement_y < 0)
+ if(CS(this).movement_y < 0)
{
- this.movement_y = -1;
+ CS(this).movement_y = -1;
if(IS_ONGROUND(vehic))
vehic.frame = 2;
}
- else if(this.movement_y > 0)
+ else if(CS(this).movement_y > 0)
{
- this.movement_y = 1;
+ CS(this).movement_y = 1;
if(IS_ONGROUND(vehic))
vehic.frame = 3;
}
float oldvelz = vehic.velocity_z;
- movelib_move_simple(vehic, normalize(v_right * this.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
+ movelib_move_simple(vehic, normalize(v_right * CS(this).movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia);
vehic.velocity_z = oldvelz;
float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1);
if(vehic.velocity_z <= 20) // not while jumping
if(this.viewloc.goalentity == this.viewloc.enemy)
return; // we can't side-scroll in this case
- vector old_movement = this.movement;
- this.movement_x = old_movement_y;
- this.movement_y = 0;
+ vector old_movement = PHYS_CS(this).movement;
+ PHYS_CS(this).movement_x = old_movement_y;
+ PHYS_CS(this).movement_y = 0;
- if(this.movement_x < 0)
- this.movement_x = -this.movement_x;
+ if(PHYS_CS(this).movement_x < 0)
+ PHYS_CS(this).movement_x = -PHYS_CS(this).movement_x;
vector level_start, level_end;
level_start = this.viewloc.enemy.origin;
forward = vectoangles(normalize(level_end - level_start));
backward = vectoangles(normalize(level_start - level_end));
- if(this.movement_x < 0) // left
+ if(PHYS_CS(this).movement_x < 0) // left
this.angles_y = backward_y;
- if(this.movement_x > 0) // right
+ if(PHYS_CS(this).movement_x > 0) // right
this.angles_y = forward_y;
if(old_movement_x > 0)
int W_Tuba_GetNote(entity pl, int hittype)
{
float movestate = 5;
- if (pl.movement.x < 0) movestate -= 3;
- else if (pl.movement.x > 0) movestate += 3;
- if (pl.movement.y < 0) movestate -= 1;
- else if (pl.movement.y > 0) movestate += 1;
+ if (CS(pl).movement.x < 0) movestate -= 3;
+ else if (CS(pl).movement.x > 0) movestate += 3;
+ if (CS(pl).movement.y < 0) movestate -= 1;
+ else if (CS(pl).movement.y > 0) movestate += 1;
int note = 0;
switch (movestate)
if (sys_phys_override(this, dt)) { return; } sys_phys_monitor(this, dt);
this.buttons_old = PHYS_INPUT_BUTTON_MASK(this);
- this.movement_old = this.movement;
+ PHYS_CS(this).movement_old = PHYS_CS(this).movement;
this.v_angle_old = this.v_angle;
sys_phys_ai(this);
}
}
makevectors(vmul(this.v_angle, (this.com_phys_vel_2d ? '0 1 0' : '1 1 1')));
- // wishvel = v_forward * this.movement.x + v_right * this.movement.y + v_up * this.movement.z;
- vector wishvel = v_forward * this.movement.x
- + v_right * this.movement.y
- + '0 0 1' * this.movement.z * (this.com_phys_vel_2d ? 0 : 1);
+ // wishvel = v_forward * PHYS_CS(this).movement.x + v_right * PHYS_CS(this).movement.y + v_up * PHYS_CS(this).movement.z;
+ vector wishvel = v_forward * PHYS_CS(this).movement.x
+ + v_right * PHYS_CS(this).movement.y
+ + '0 0 1' * PHYS_CS(this).movement.z * (this.com_phys_vel_2d ? 0 : 1);
if (this.com_phys_water) {
if (PHYS_INPUT_BUTTON_CROUCH(this)) {
wishvel.z = -PHYS_MAXSPEED(this);
}
if (this.com_phys_ladder) {
if (this.viewloc) {
- wishvel.z = this.movement_old.x;
+ wishvel.z = PHYS_CS(this).movement_old.x;
}
if (this.ladder_entity.classname == "func_water") {
float f = vlen(wishvel);
// dv/dt = accel * maxspeed * (1 - accelqw) (when fast)
// log dv/dt = logaccel + logmaxspeed (when slow)
// log dv/dt = logaccel + logmaxspeed + log(1 - accelqw) (when fast)
- float strafity = IsMoveInDirection(this.movement, -90) + IsMoveInDirection(this.movement, +90); // if one is nonzero, other is always zero
+ float strafity = IsMoveInDirection(PHYS_CS(this).movement, -90) + IsMoveInDirection(PHYS_CS(this).movement, +90); // if one is nonzero, other is always zero
if (PHYS_MAXAIRSTRAFESPEED(this)) {
wishspeed =
min(wishspeed,
}
// !CPM
- if (PHYS_WARSOWBUNNY_TURNACCEL(this) && accelerating && this.movement.y == 0 && this.movement.x != 0) {
+ if (PHYS_WARSOWBUNNY_TURNACCEL(this) && accelerating && PHYS_CS(this).movement.y == 0 && PHYS_CS(this).movement.x != 0) {
PM_AirAccelerate(this, dt, wishdir, wishspeed2);
} else {
float sidefric = maxairspd ? (PHYS_AIRACCEL_SIDEWAYS_FRICTION(this) / maxairspd) : 0;
anticheat_physics(this);
if (sv_maxidle > 0) {
if (buttons != this.buttons_old
- || this.movement != this.movement_old
+ || CS(this).movement != CS(this).movement_old
|| this.v_angle != this.v_angle_old) { CS(this).parm_idlesince = time; }
}
PM_check_nickspam(this);
MEAN_ACCUMULATE(CS(this), anticheat_div0_evade, 0.5 - 0.5 * (CS(this).anticheat_div0_evade_forward_initial * v_forward), 1);
}
- MEAN_ACCUMULATE(CS(this), anticheat_div0_strafebot_old, movement_oddity(this.movement, CS(this).anticheat_div0_strafebot_movement_prev), 1);
- CS(this).anticheat_div0_strafebot_movement_prev = this.movement;
+ MEAN_ACCUMULATE(CS(this), anticheat_div0_strafebot_old, movement_oddity(CS(this).movement, CS(this).anticheat_div0_strafebot_movement_prev), 1);
+ CS(this).anticheat_div0_strafebot_movement_prev = CS(this).movement;
// Note: this actually tries to detect snap-aim.
if(CS(this).anticheat_div0_strafebot_forward_prev && time > CS(this).anticheat_fixangle_endtime) {
if (!IS_PLAYER(this) || (autocvar_g_campaign && !campaign_bots_may_start))
{
- this.movement = '0 0 0';
+ CS(this).movement = '0 0 0';
this.bot_nextthink = time + 0.5;
return;
}
if (time < game_starttime)
{
// block the bot during the countdown to game start
- this.movement = '0 0 0';
+ CS(this).movement = '0 0 0';
this.bot_nextthink = game_starttime;
return;
}
// if dead, just wait until we can respawn
if (IS_DEAD(this))
{
- this.movement = '0 0 0';
+ CS(this).movement = '0 0 0';
if (this.deadflag == DEAD_DEAD)
{
PHYS_INPUT_BUTTON_JUMP(this) = true; // press jump to respawn
+ 0.05 / max(1, sk + this.havocbot_keyboardskill)
+ random() * 0.025 / max(0.00025, skill + this.havocbot_keyboardskill)
, time);
- keyboard = this.movement / autocvar_sv_maxspeed;
+ keyboard = CS(this).movement / autocvar_sv_maxspeed;
float trigger = autocvar_bot_ai_keyboard_threshold;
float trigger1 = -trigger;
keyboard = this.havocbot_keyboard;
float blend = bound(0, vlen(destorg - this.origin) / autocvar_bot_ai_keyboard_distance, 1); // When getting close move with 360 degree
- //dprint("movement ", vtos(this.movement), " keyboard ", vtos(keyboard), " blend ", ftos(blend), "\n");
- this.movement = this.movement + (keyboard - this.movement) * blend;
+ //dprint("movement ", vtos(CS(this).movement), " keyboard ", vtos(keyboard), " blend ", ftos(blend), "\n");
+ CS(this).movement = CS(this).movement + (keyboard - CS(this).movement) * blend;
}
void havocbot_bunnyhop(entity this, vector dir)
while (deviation.y > 180) deviation.y = deviation.y - 360;
if(fabs(deviation.y)>10)
- this.movement_x = 0;
+ CS(this).movement_x = 0;
if(deviation.y>10)
- this.movement_y = maxspeed * -1;
+ CS(this).movement_y = maxspeed * -1;
else if(deviation.y<10)
- this.movement_y = maxspeed;
+ CS(this).movement_y = maxspeed;
}
}
vector dodge;
//if (this.goalentity)
// te_lightning2(this, this.origin, (this.goalentity.absmin + this.goalentity.absmax) * 0.5);
- this.movement = '0 0 0';
+ CS(this).movement = '0 0 0';
maxspeed = autocvar_sv_maxspeed;
// Jetpack navigation
// Brake
if(fabs(this.velocity.x)>maxspeed*0.3)
{
- this.movement_x = dir * v_forward * -maxspeed;
+ CS(this).movement_x = dir * v_forward * -maxspeed;
return;
}
// Switch to normal mode
PHYS_INPUT_BUTTON_HOOK(this) = true;
if(this.navigation_jetpack_point.z - STAT(PL_MAX, this).z + STAT(PL_MIN, this).z < this.origin.z)
{
- this.movement_x = dir * v_forward * maxspeed;
- this.movement_y = dir * v_right * maxspeed;
+ CS(this).movement_x = dir * v_forward * maxspeed;
+ CS(this).movement_y = dir * v_right * maxspeed;
}
return;
}
tracebox(this.origin, this.mins, this.maxs, this.origin + (dir * maxspeed * 3), MOVE_NOMONSTERS, this);
if(trace_fraction==1)
{
- this.movement_x = dir * v_forward * maxspeed;
- this.movement_y = dir * v_right * maxspeed;
+ CS(this).movement_x = dir * v_forward * maxspeed;
+ CS(this).movement_y = dir * v_right * maxspeed;
if (skill < 10)
havocbot_keyboard_movement(this, this.origin + dir * 100);
}
if(client_hasweapon(this, WEP_DEVASTATOR, weaponentity, true, false))
{
- this.movement_x = maxspeed;
+ CS(this).movement_x = maxspeed;
if(this.rocketjumptime)
{
{
// If there is no goal try to move forward
if(this.goalcurrent==NULL)
- this.movement_x = maxspeed;
+ CS(this).movement_x = maxspeed;
}
}
else
PHYS_INPUT_BUTTON_JUMP(this) = false;
makevectors(this.v_angle.y * '0 1 0');
- this.movement_x = dir * v_forward * maxspeed;
- this.movement_y = dir * v_right * maxspeed;
- this.movement_z = dir * v_up * maxspeed;
+ CS(this).movement_x = dir * v_forward * maxspeed;
+ CS(this).movement_y = dir * v_right * maxspeed;
+ CS(this).movement_z = dir * v_up * maxspeed;
}
// if there is nowhere to go, exit
//dir = this.bot_dodgevector;
//if (this.bot_dodgevector_jumpbutton)
// PHYS_INPUT_BUTTON_JUMP(this) = true;
- this.movement_x = dir * v_forward * maxspeed;
- this.movement_y = dir * v_right * maxspeed;
- this.movement_z = dir * v_up * maxspeed;
+ CS(this).movement_x = dir * v_forward * maxspeed;
+ CS(this).movement_y = dir * v_right * maxspeed;
+ CS(this).movement_z = dir * v_up * maxspeed;
// Emulate keyboard interface
if (skill < 10)
bool bot_presskeys(entity this)
{
- this.movement = '0 0 0';
+ CS(this).movement = '0 0 0';
PHYS_INPUT_BUTTON_JUMP(this) = false;
PHYS_INPUT_BUTTON_CROUCH(this) = false;
PHYS_INPUT_BUTTON_ATCK(this) = false;
return false;
if(this.bot_cmd_keys & BOT_CMD_KEY_FORWARD)
- this.movement_x = autocvar_sv_maxspeed;
+ CS(this).movement_x = autocvar_sv_maxspeed;
else if(this.bot_cmd_keys & BOT_CMD_KEY_BACKWARD)
- this.movement_x = -autocvar_sv_maxspeed;
+ CS(this).movement_x = -autocvar_sv_maxspeed;
if(this.bot_cmd_keys & BOT_CMD_KEY_RIGHT)
- this.movement_y = autocvar_sv_maxspeed;
+ CS(this).movement_y = autocvar_sv_maxspeed;
else if(this.bot_cmd_keys & BOT_CMD_KEY_LEFT)
- this.movement_y = -autocvar_sv_maxspeed;
+ CS(this).movement_y = -autocvar_sv_maxspeed;
if(this.bot_cmd_keys & BOT_CMD_KEY_JUMP)
PHYS_INPUT_BUTTON_JUMP(this) = true;
PHYS_INPUT_BUTTON_ATCK2(this) = false;
PHYS_INPUT_BUTTON_CROUCH(this) = false;
- this.movement = '0 0 0';
+ CS(this).movement = '0 0 0';
this.bot_cmd_keys = BOT_CMD_KEY_NONE;
bot_clear(this);
{
MUTATOR_CALLHOOK(GetPressedKeys, this);
int keys = STAT(PRESSED_KEYS, this);
- keys = BITSET(keys, KEY_FORWARD, this.movement.x > 0);
- keys = BITSET(keys, KEY_BACKWARD, this.movement.x < 0);
- keys = BITSET(keys, KEY_RIGHT, this.movement.y > 0);
- keys = BITSET(keys, KEY_LEFT, this.movement.y < 0);
+ keys = BITSET(keys, KEY_FORWARD, CS(this).movement.x > 0);
+ keys = BITSET(keys, KEY_BACKWARD, CS(this).movement.x < 0);
+ keys = BITSET(keys, KEY_RIGHT, CS(this).movement.y > 0);
+ keys = BITSET(keys, KEY_LEFT, CS(this).movement.y < 0);
keys = BITSET(keys, KEY_JUMP, PHYS_INPUT_BUTTON_JUMP(this));
keys = BITSET(keys, KEY_CROUCH, PHYS_INPUT_BUTTON_CROUCH(this));
ATTRIB(Client, idlekick_lasttimeleft, float, this.idlekick_lasttimeleft);
ATTRIB(Client, pm_frametime, float, this.pm_frametime);
ATTRIB(Client, pressedkeys, int, this.pressedkeys);
+ ATTRIB(Client, movement_old, vector, this.movement_old);
METHOD(Client, m_unwind, bool(Client this));
// stop the player from moving so that he stands still once he gets respawned
it.velocity = '0 0 0';
it.avelocity = '0 0 0';
- it.movement = '0 0 0';
+ CS(it).movement = '0 0 0';
PutClientInServer(it);
});
}
// ensure nothing EVIL is being done (i.e. div0_evade)
// this hinders joystick users though
// but it still gives SOME analog control
- wishvel.x = fabs(player.movement.x);
- wishvel.y = fabs(player.movement.y);
+ wishvel.x = fabs(CS(player).movement.x);
+ wishvel.y = fabs(CS(player).movement.y);
if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y)
{
wishvel.z = 0;
if(wishvel.x >= 2 * wishvel.y)
{
// pure X motion
- if(player.movement.x > 0)
- player.movement_x = wishspeed;
+ if(CS(player).movement.x > 0)
+ CS(player).movement_x = wishspeed;
else
- player.movement_x = -wishspeed;
- player.movement_y = 0;
+ CS(player).movement_x = -wishspeed;
+ CS(player).movement_y = 0;
}
else if(wishvel.y >= 2 * wishvel.x)
{
// pure Y motion
- player.movement_x = 0;
- if(player.movement.y > 0)
- player.movement_y = wishspeed;
+ CS(player).movement_x = 0;
+ if(CS(player).movement.y > 0)
+ CS(player).movement_y = wishspeed;
else
- player.movement_y = -wishspeed;
+ CS(player).movement_y = -wishspeed;
}
else
{
// diagonal
- if(player.movement.x > 0)
- player.movement_x = M_SQRT1_2 * wishspeed;
+ if(CS(player).movement.x > 0)
+ CS(player).movement_x = M_SQRT1_2 * wishspeed;
else
- player.movement_x = -M_SQRT1_2 * wishspeed;
- if(player.movement.y > 0)
- player.movement_y = M_SQRT1_2 * wishspeed;
+ CS(player).movement_x = -M_SQRT1_2 * wishspeed;
+ if(CS(player).movement.y > 0)
+ CS(player).movement_y = M_SQRT1_2 * wishspeed;
else
- player.movement_y = -M_SQRT1_2 * wishspeed;
+ CS(player).movement_y = -M_SQRT1_2 * wishspeed;
}
}
}
// ensure nothing EVIL is being done (i.e. div0_evade)
// this hinders joystick users though
// but it still gives SOME analog control
- wishvel.x = fabs(player.movement.x);
- wishvel.y = fabs(player.movement.y);
+ wishvel.x = fabs(CS(player).movement.x);
+ wishvel.y = fabs(CS(player).movement.y);
if(wishvel.x != 0 && wishvel.y != 0 && wishvel.x != wishvel.y)
{
wishvel.z = 0;
if(wishvel.x >= 2 * wishvel.y)
{
// pure X motion
- if(player.movement.x > 0)
- player.movement_x = wishspeed;
+ if(CS(player).movement.x > 0)
+ CS(player).movement_x = wishspeed;
else
- player.movement_x = -wishspeed;
- player.movement_y = 0;
+ CS(player).movement_x = -wishspeed;
+ CS(player).movement_y = 0;
}
else if(wishvel.y >= 2 * wishvel.x)
{
// pure Y motion
- player.movement_x = 0;
- if(player.movement.y > 0)
- player.movement_y = wishspeed;
+ CS(player).movement_x = 0;
+ if(CS(player).movement.y > 0)
+ CS(player).movement_y = wishspeed;
else
- player.movement_y = -wishspeed;
+ CS(player).movement_y = -wishspeed;
}
else
{
// diagonal
- if(player.movement.x > 0)
- player.movement_x = M_SQRT1_2 * wishspeed;
+ if(CS(player).movement.x > 0)
+ CS(player).movement_x = M_SQRT1_2 * wishspeed;
else
- player.movement_x = -M_SQRT1_2 * wishspeed;
- if(player.movement.y > 0)
- player.movement_y = M_SQRT1_2 * wishspeed;
+ CS(player).movement_x = -M_SQRT1_2 * wishspeed;
+ if(CS(player).movement.y > 0)
+ CS(player).movement_y = M_SQRT1_2 * wishspeed;
else
- player.movement_y = -M_SQRT1_2 * wishspeed;
+ CS(player).movement_y = -M_SQRT1_2 * wishspeed;
}
}
}
this.playerdemo_time += this.playerdemo_starttime;
}
this.velocity = '0 0 0';
- this.movement = '0 0 0';
+ CS(this).movement = '0 0 0';
this.dmg_take = 0; // so screen doesn't stay blurry
this.dmg_save = 0;
this.dmg_inflictor = NULL;