.float stat_sv_maxspeed;
MUTATOR_HOOKFUNCTION(nb, PlayerPhysics)
-{SELFPARAM();
- if(self.ballcarried)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.ballcarried)
{
- self.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed;
- self.stat_sv_maxspeed *= autocvar_g_nexball_basketball_carrier_highspeed;
+ player.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed;
+ player.stat_sv_maxspeed *= autocvar_g_nexball_basketball_carrier_highspeed;
}
- return false;
}
MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics)
{
- SELFPARAM();
- if (time >= this.spider_slowness)
+ entity player = M_ARGV(0, entity);
+
+ if (time >= player.spider_slowness)
return false;
- PHYS_MAXSPEED(this) *= 0.5; // half speed while slow from spider
- PHYS_MAXAIRSPEED(this) *= 0.5;
- PHYS_AIRSPEEDLIMIT_NONQW(this) *= 0.5;
- PHYS_AIRSTRAFEACCELERATE(this) *= 0.5;
- return false;
+ PHYS_MAXSPEED(player) *= 0.5; // half speed while slow from spider
+ PHYS_MAXAIRSPEED(player) *= 0.5;
+ PHYS_AIRSPEEDLIMIT_NONQW(player) *= 0.5;
+ PHYS_AIRSTRAFEACCELERATE(player) *= 0.5;
}
MUTATOR_HOOKFUNCTION(spiderweb, MonsterMove)
* is run AFTER bot code and idle checking on the server
*/
#define EV_PlayerPhysics(i, o) \
- /**/ i(entity, __self) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
/**/
MUTATOR_HOOKABLE(PlayerPhysics, EV_PlayerPhysics);
/** called when a player presses the jump key */
#define EV_PlayerJump(i, o) \
- /**/ i(entity, __self) \
- /**/ i(float, player_multijump) \
- /**/ i(float, player_jumpheight) \
- /**/ o(float, player_multijump) \
- /**/ o(float, player_jumpheight) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** jump height */ i(float, MUTATOR_ARGV_1_float) \
+ /**/ o(float, MUTATOR_ARGV_1_float) \
+ /** multijump */ i(bool, MUTATOR_ARGV_2_bool) \
+ /**/ o(bool, MUTATOR_ARGV_2_bool) \
/**/
-float player_multijump;
-float player_jumpheight;
MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump);
/** called during player physics, allows adjusting the movement type used */
#define EV_PM_Physics(i, o) \
- /**/ i(entity, __self) \
- /**/ i(float, pm_maxspeed_mod) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** maxspeed_mod */ i(float, MUTATOR_ARGV_1_float) \
/**/
-float pm_maxspeed_mod;
MUTATOR_HOOKABLE(PM_Physics, EV_PM_Physics);
/** called when a weapon model is about to be set, allows custom paths etc. */
#define EV_WeaponModel(i, o) \
- /**/ i(string, weapon_model) \
- /**/ i(string, weapon_model_output) \
- /**/ o(string, weapon_model_output) \
+ /** model */ i(string, MUTATOR_ARGV_0_string) \
+ /** output */ i(string, MUTATOR_ARGV_1_string) \
+ /**/ o(string, MUTATOR_ARGV_1_string) \
/**/
-string weapon_model;
-string weapon_model_output;
MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel);
#endif
}
MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
-{SELFPARAM();
- if(self.health <= autocvar_g_bloodloss)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.health <= autocvar_g_bloodloss)
return true;
return false;
.float stat_sv_jumpvelocity;
MUTATOR_HOOKFUNCTION(buffs, PlayerPhysics)
-{SELFPARAM();
- if(self.buffs & BUFF_SPEED.m_itemid)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.buffs & BUFF_SPEED.m_itemid)
{
- self.stat_sv_maxspeed *= autocvar_g_buffs_speed_speed;
- self.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_speed_speed;
+ player.stat_sv_maxspeed *= autocvar_g_buffs_speed_speed;
+ player.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_speed_speed;
}
- if(time < self.buff_disability_time)
+ if(time < player.buff_disability_time)
{
- self.stat_sv_maxspeed *= autocvar_g_buffs_disability_speed;
- self.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_disability_speed;
+ player.stat_sv_maxspeed *= autocvar_g_buffs_disability_speed;
+ player.stat_sv_airspeedlimit_nonqw *= autocvar_g_buffs_disability_speed;
}
- if(self.buffs & BUFF_JUMP.m_itemid)
+ if(player.buffs & BUFF_JUMP.m_itemid)
{
// automatically reset, no need to worry
- self.stat_sv_jumpvelocity = autocvar_g_buffs_jump_height;
+ player.stat_sv_jumpvelocity = autocvar_g_buffs_jump_height;
}
-
- return false;
}
MUTATOR_HOOKFUNCTION(buffs, PlayerJump)
-{SELFPARAM();
- if(self.buffs & BUFF_JUMP.m_itemid)
- player_jumpheight = autocvar_g_buffs_jump_height;
+{
+ entity player = M_ARGV(0, entity);
- return false;
+ if(player.buffs & BUFF_JUMP.m_itemid)
+ M_ARGV(1, float) = autocvar_g_buffs_jump_height;
}
MUTATOR_HOOKFUNCTION(buffs, MonsterMove)
#endif
MUTATOR_HOOKFUNCTION(bugrigs, PM_Physics)
{
- SELFPARAM();
- if(!PHYS_BUGRIGS(self) || !IS_PLAYER(self)) { return false; }
+ entity player = M_ARGV(0, entity);
+
+ if(!PHYS_BUGRIGS(player) || !IS_PLAYER(player)) { return false; }
#ifdef SVQC
- self.angles = self.bugrigs_prevangles;
+ player.angles = player.bugrigs_prevangles;
#endif
- RaceCarPhysics(self);
+ RaceCarPhysics(player);
return true;
}
MUTATOR_HOOKFUNCTION(bugrigs, PlayerPhysics)
{
+ if(!PHYS_BUGRIGS(M_ARGV(0, entity))) { return false; }
#ifdef SVQC
- SELFPARAM();
+ entity player = M_ARGV(0, entity);
+ player.bugrigs_prevangles = player.angles;
#endif
- if(!PHYS_BUGRIGS(self)) { return false; }
-#ifdef SVQC
- self.bugrigs_prevangles = self.angles;
-#endif
- return false;
}
#ifdef SVQC
MUTATOR_HOOKFUNCTION(dodging, PlayerPhysics)
{
- SELFPARAM();
+ entity player = M_ARGV(0, entity);
+
// print("dodging_PlayerPhysics\n");
- PM_dodging_GetPressedKeys(self);
- PM_dodging(self);
- return false;
+ PM_dodging_GetPressedKeys(player);
+ PM_dodging(player);
}
#ifdef SVQC
MUTATOR_HOOKFUNCTION(doublejump, PlayerJump)
{
- SELFPARAM();
- if (PHYS_DOUBLEJUMP(self))
+ entity player = M_ARGV(0, entity);
+
+ if (PHYS_DOUBLEJUMP(player))
{
- tracebox(self.origin + '0 0 0.01', self.mins, self.maxs, self.origin - '0 0 0.01', MOVE_NORMAL, self);
+ tracebox(player.origin + '0 0 0.01', player.mins, player.maxs, player.origin - '0 0 0.01', MOVE_NORMAL, player);
if (trace_fraction < 1 && trace_plane_normal_z > 0.7)
{
- player_multijump = true;
+ M_ARGV(2, bool) = true;
// we MUST clip velocity here!
- float f = self.velocity * trace_plane_normal;
+ float f = player.velocity * trace_plane_normal;
if (f < 0)
- self.velocity -= f * trace_plane_normal;
+ player.velocity -= f * trace_plane_normal;
}
}
- return false;
}
#endif
.float stat_sv_maxspeed;
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerPhysics)
-{SELFPARAM();
- if(self.items & ITEM_Speed.m_itemid)
- self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed;
+{
+ entity player = M_ARGV(0, entity);
- return false;
+ if(player.items & ITEM_Speed.m_itemid)
+ player.stat_sv_maxspeed = player.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed;
}
MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_SplitHealthArmor)
REGISTER_MUTATOR(multijump, true);
#endif
-#define PHYS_MULTIJUMP STAT(MULTIJUMP, self)
-#define PHYS_MULTIJUMP_SPEED STAT(MULTIJUMP_SPEED, self)
-#define PHYS_MULTIJUMP_ADD STAT(MULTIJUMP_ADD, self)
-#define PHYS_MULTIJUMP_MAXSPEED STAT(MULTIJUMP_MAXSPEED, self)
-#define PHYS_MULTIJUMP_DODGING STAT(MULTIJUMP_DODGING, self)
-#define PHYS_MULTIJUMP_COUNT(s) STAT(MULTIJUMP_COUNT, s)
+#define PHYS_MULTIJUMP(s) STAT(MULTIJUMP, s)
+#define PHYS_MULTIJUMP_SPEED(s) STAT(MULTIJUMP_SPEED, s)
+#define PHYS_MULTIJUMP_ADD(s) STAT(MULTIJUMP_ADD, s)
+#define PHYS_MULTIJUMP_MAXSPEED(s) STAT(MULTIJUMP_MAXSPEED, s)
+#define PHYS_MULTIJUMP_DODGING(s) STAT(MULTIJUMP_DODGING, s)
+#define PHYS_MULTIJUMP_COUNT(s) STAT(MULTIJUMP_COUNT, s)
.bool multijump_ready;
#define PHYS_MULTIJUMP_CLIENT(s) (s).cvar_cl_multijump
#endif
-bool PM_multijump_checkjump(entity this)
+MUTATOR_HOOKFUNCTION(multijump, PlayerPhysics)
{
- if(!PHYS_MULTIJUMP) { return false; }
+ entity player = M_ARGV(0, entity);
+
+#ifdef CSQC
+ player.multijump_count = PHYS_MULTIJUMP_COUNT(player);
+#endif
+ if(!PHYS_MULTIJUMP(player)) { return; }
+
+ if(IS_ONGROUND(player))
+ player.multijump_count = 0;
+}
- int client_multijump = PHYS_MULTIJUMP_CLIENT(this);
+MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(!PHYS_MULTIJUMP(player)) { return false; }
+
+ int client_multijump = PHYS_MULTIJUMP_CLIENT(player);
if(client_multijump > 1)
return false; // nope
- if (!IS_JUMP_HELD(this) && !IS_ONGROUND(this) && client_multijump) // jump button pressed this frame and we are in midair
- this.multijump_ready = true; // this is necessary to check that we released the jump button and pressed it again
+ if (!IS_JUMP_HELD(player) && !IS_ONGROUND(player) && client_multijump) // jump button pressed this frame and we are in midair
+ player.multijump_ready = true; // this is necessary to check that we released the jump button and pressed it again
else
- this.multijump_ready = false;
+ player.multijump_ready = false;
- int phys_multijump = PHYS_MULTIJUMP;
+ int phys_multijump = PHYS_MULTIJUMP(player);
- if(!player_multijump && this.multijump_ready && (PHYS_MULTIJUMP_COUNT(this) < phys_multijump || phys_multijump == -1) && this.velocity_z > PHYS_MULTIJUMP_SPEED && (!PHYS_MULTIJUMP_MAXSPEED || vlen(this.velocity) <= PHYS_MULTIJUMP_MAXSPEED))
+ if(!M_ARGV(2, bool) && player.multijump_ready && (PHYS_MULTIJUMP_COUNT(player) < phys_multijump || phys_multijump == -1) && player.velocity_z > PHYS_MULTIJUMP_SPEED(player) &&
+ (!PHYS_MULTIJUMP_MAXSPEED(player) || vdist(player.velocity, <=, PHYS_MULTIJUMP_MAXSPEED(player))))
{
- if (PHYS_MULTIJUMP)
+ if (PHYS_MULTIJUMP(player))
{
- if (!PHYS_MULTIJUMP_ADD) // in this case we make the z velocity == jumpvelocity
+ if (!PHYS_MULTIJUMP_ADD(player)) // in this case we make the z velocity == jumpvelocity
{
- if (this.velocity_z < PHYS_JUMPVELOCITY(this))
+ if (player.velocity_z < PHYS_JUMPVELOCITY(player))
{
- player_multijump = true;
- this.velocity_z = 0;
+ M_ARGV(2, bool) = true;
+ player.velocity_z = 0;
}
}
else
- player_multijump = true;
+ M_ARGV(2, bool) = true;
- if(player_multijump)
+ if(M_ARGV(2, bool))
{
- if(PHYS_MULTIJUMP_DODGING)
- if(this.movement_x != 0 || this.movement_y != 0) // don't remove all speed if player isnt pressing any movement keys
+ 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
{
float curspeed;
vector wishvel, wishdir;
/*#ifdef SVQC
curspeed = max(
- vlen(vec2(this.velocity)), // current xy speed
- vlen(vec2(antilag_takebackavgvelocity(this, max(this.lastteleporttime + sys_frametime, time - 0.25), time))) // average xy topspeed over the last 0.25 secs
+ vlen(vec2(player.velocity)), // current xy speed
+ vlen(vec2(antilag_takebackavgvelocity(player, max(player.lastteleporttime + sys_frametime, time - 0.25), time))) // average xy topspeed over the last 0.25 secs
);
#elif defined(CSQC)*/
- curspeed = vlen(vec2(this.velocity));
+ curspeed = vlen(vec2(player.velocity));
//#endif
- makevectors(this.v_angle_y * '0 1 0');
- wishvel = v_forward * this.movement_x + v_right * this.movement_y;
+ makevectors(player.v_angle_y * '0 1 0');
+ wishvel = v_forward * player.movement_x + v_right * player.movement_y;
wishdir = normalize(wishvel);
- this.velocity_x = wishdir_x * curspeed; // allow "dodging" at a multijump
- this.velocity_y = wishdir_y * curspeed;
+ player.velocity_x = wishdir_x * curspeed; // allow "dodging" at a multijump
+ player.velocity_y = wishdir_y * curspeed;
// keep velocity_z unchanged!
}
- if (PHYS_MULTIJUMP > 0)
+ if (PHYS_MULTIJUMP(player) > 0)
{
- this.multijump_count += 1;
+ player.multijump_count += 1;
}
}
}
- this.multijump_ready = false; // require releasing and pressing the jump button again for the next jump
+ player.multijump_ready = false; // require releasing and pressing the jump button again for the next jump
}
-
- return false;
-}
-
-MUTATOR_HOOKFUNCTION(multijump, PlayerPhysics)
-{
- SELFPARAM();
-#ifdef CSQC
- this.multijump_count = PHYS_MULTIJUMP_COUNT(this);
-#endif
- if(!PHYS_MULTIJUMP) { return; }
-
- if(IS_ONGROUND(this))
- this.multijump_count = 0;
- return false;
-}
-
-MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
-{
- SELFPARAM();
- return PM_multijump_checkjump(this);
}
#ifdef SVQC
bool doublejump = false;
float mjumpheight = PHYS_JUMPVELOCITY(this);
- if (MUTATOR_CALLHOOK(PlayerJump, this, doublejump, mjumpheight))
+ if (MUTATOR_CALLHOOK(PlayerJump, this, mjumpheight, doublejump))
return true;
- doublejump = player_multijump;
- mjumpheight = player_jumpheight;
+ mjumpheight = M_ARGV(1, float);
+ doublejump = M_ARGV(2, bool);
if (this.waterlevel >= WATERLEVEL_SWIMMING)
{
void CheckPlayerJump(entity this)
{
#ifdef SVQC
- float was_flying = ITEMS_STAT(this) & IT_USING_JETPACK;
+ bool was_flying = boolean(ITEMS_STAT(this) & IT_USING_JETPACK);
#endif
if (JETPACK_JUMP(this) < 2)
ITEMS_STAT(this) &= ~IT_USING_JETPACK;
if(PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_JETPACK(this))
{
- float air_jump = !PlayerJump(this) || player_multijump; // PlayerJump() has important side effects
- float activate = JETPACK_JUMP(this) && air_jump && PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_JETPACK(this);
- float has_fuel = !PHYS_JETPACK_FUEL(this) || PHYS_AMMO_FUEL(this) || (ITEMS_STAT(this) & IT_UNLIMITED_WEAPON_AMMO);
+ bool playerjump = PlayerJump(this); // required
+
+ bool air_jump = !playerjump || M_ARGV(2, bool);
+ bool activate = JETPACK_JUMP(this) && air_jump && PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_JETPACK(this);
+ bool has_fuel = !PHYS_JETPACK_FUEL(this) || PHYS_AMMO_FUEL(this) || (ITEMS_STAT(this) & IT_UNLIMITED_WEAPON_AMMO);
if (!(ITEMS_STAT(this) & ITEM_Jetpack.m_itemid)) { }
else if (this.jetpack_stopped) { }
{
string output = strcat("models/weapons/", w_mdl);
MUTATOR_CALLHOOK(WeaponModel, w_mdl, output);
- return weapon_model_output;
+ return M_ARGV(1, string);
}
#ifndef MENUQC
}
MUTATOR_HOOKFUNCTION(cts, PlayerPhysics)
-{SELFPARAM();
- self.race_movetime_frac += PHYS_INPUT_TIMELENGTH;
- float f = floor(self.race_movetime_frac);
- self.race_movetime_frac -= f;
- self.race_movetime_count += f;
- self.race_movetime = self.race_movetime_frac + self.race_movetime_count;
+{
+ entity player = M_ARGV(0, entity);
+
+ player.race_movetime_frac += PHYS_INPUT_TIMELENGTH;
+ float f = floor(player.race_movetime_frac);
+ player.race_movetime_frac -= f;
+ player.race_movetime_count += f;
+ player.race_movetime = player.race_movetime_frac + player.race_movetime_count;
#ifdef SVQC
- if(IS_PLAYER(self))
+ if(IS_PLAYER(player))
{
- if (self.race_penalty)
- if (time > self.race_penalty)
- self.race_penalty = 0;
- if(self.race_penalty)
+ if (player.race_penalty)
+ if (time > player.race_penalty)
+ player.race_penalty = 0;
+ if(player.race_penalty)
{
- self.velocity = '0 0 0';
- self.movetype = MOVETYPE_NONE;
- self.disableclientprediction = 2;
+ player.velocity = '0 0 0';
+ player.movetype = MOVETYPE_NONE;
+ player.disableclientprediction = 2;
}
}
#endif
// 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(self.movement.x);
- wishvel.y = fabs(self.movement.y);
+ wishvel.x = fabs(player.movement.x);
+ wishvel.y = fabs(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(self.movement.x > 0)
- self.movement_x = wishspeed;
+ if(player.movement.x > 0)
+ player.movement_x = wishspeed;
else
- self.movement_x = -wishspeed;
- self.movement_y = 0;
+ player.movement_x = -wishspeed;
+ player.movement_y = 0;
}
else if(wishvel.y >= 2 * wishvel.x)
{
// pure Y motion
- self.movement_x = 0;
- if(self.movement.y > 0)
- self.movement_y = wishspeed;
+ player.movement_x = 0;
+ if(player.movement.y > 0)
+ player.movement_y = wishspeed;
else
- self.movement_y = -wishspeed;
+ player.movement_y = -wishspeed;
}
else
{
// diagonal
- if(self.movement.x > 0)
- self.movement_x = M_SQRT1_2 * wishspeed;
+ if(player.movement.x > 0)
+ player.movement_x = M_SQRT1_2 * wishspeed;
else
- self.movement_x = -M_SQRT1_2 * wishspeed;
- if(self.movement.y > 0)
- self.movement_y = M_SQRT1_2 * wishspeed;
+ player.movement_x = -M_SQRT1_2 * wishspeed;
+ if(player.movement.y > 0)
+ player.movement_y = M_SQRT1_2 * wishspeed;
else
- self.movement_y = -M_SQRT1_2 * wishspeed;
+ player.movement_y = -M_SQRT1_2 * wishspeed;
}
}
-
- return false;
}
MUTATOR_HOOKFUNCTION(cts, reset_map_global)
.float stat_sv_maxspeed;
MUTATOR_HOOKFUNCTION(ka, PlayerPhysics)
-{SELFPARAM();
- if(self.ballcarried)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.ballcarried)
{
- self.stat_sv_airspeedlimit_nonqw *= autocvar_g_keepaway_ballcarrier_highspeed;
- self.stat_sv_maxspeed *= autocvar_g_keepaway_ballcarrier_highspeed;
+ player.stat_sv_airspeedlimit_nonqw *= autocvar_g_keepaway_ballcarrier_highspeed;
+ player.stat_sv_maxspeed *= autocvar_g_keepaway_ballcarrier_highspeed;
}
- return false;
}
MUTATOR_HOOKFUNCTION(ka, BotShouldAttack)
}
MUTATOR_HOOKFUNCTION(rc, PlayerPhysics)
-{SELFPARAM();
- self.race_movetime_frac += PHYS_INPUT_TIMELENGTH;
- float f = floor(self.race_movetime_frac);
- self.race_movetime_frac -= f;
- self.race_movetime_count += f;
- self.race_movetime = self.race_movetime_frac + self.race_movetime_count;
+{
+ entity player = M_ARGV(0, entity);
+
+ player.race_movetime_frac += PHYS_INPUT_TIMELENGTH;
+ float f = floor(player.race_movetime_frac);
+ player.race_movetime_frac -= f;
+ player.race_movetime_count += f;
+ player.race_movetime = player.race_movetime_frac + player.race_movetime_count;
#ifdef SVQC
- if(IS_PLAYER(self))
+ if(IS_PLAYER(player))
{
- if (self.race_penalty)
- if (time > self.race_penalty)
- self.race_penalty = 0;
- if(self.race_penalty)
+ if (player.race_penalty)
+ if (time > player.race_penalty)
+ player.race_penalty = 0;
+ if(player.race_penalty)
{
- self.velocity = '0 0 0';
- self.movetype = MOVETYPE_NONE;
- self.disableclientprediction = 2;
+ player.velocity = '0 0 0';
+ player.movetype = MOVETYPE_NONE;
+ player.disableclientprediction = 2;
}
}
#endif
// 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(self.movement.x);
- wishvel.y = fabs(self.movement.y);
+ wishvel.x = fabs(player.movement.x);
+ wishvel.y = fabs(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(self.movement.x > 0)
- self.movement_x = wishspeed;
+ if(player.movement.x > 0)
+ player.movement_x = wishspeed;
else
- self.movement_x = -wishspeed;
- self.movement_y = 0;
+ player.movement_x = -wishspeed;
+ player.movement_y = 0;
}
else if(wishvel.y >= 2 * wishvel.x)
{
// pure Y motion
- self.movement_x = 0;
- if(self.movement.y > 0)
- self.movement_y = wishspeed;
+ player.movement_x = 0;
+ if(player.movement.y > 0)
+ player.movement_y = wishspeed;
else
- self.movement_y = -wishspeed;
+ player.movement_y = -wishspeed;
}
else
{
// diagonal
- if(self.movement.x > 0)
- self.movement_x = M_SQRT1_2 * wishspeed;
+ if(player.movement.x > 0)
+ player.movement_x = M_SQRT1_2 * wishspeed;
else
- self.movement_x = -M_SQRT1_2 * wishspeed;
- if(self.movement.y > 0)
- self.movement_y = M_SQRT1_2 * wishspeed;
+ player.movement_x = -M_SQRT1_2 * wishspeed;
+ if(player.movement.y > 0)
+ player.movement_y = M_SQRT1_2 * wishspeed;
else
- self.movement_y = -M_SQRT1_2 * wishspeed;
+ player.movement_y = -M_SQRT1_2 * wishspeed;
}
}
-
- return false;
}
MUTATOR_HOOKFUNCTION(rc, reset_map_global)