: a * pow(fabs(b / a), lerp);
}
-noref float pmove_waterjumptime;
-
#define unstick_offsets(X) \
/* 1 no nudge (just return the original if this test passes) */ \
X(' 0.000 0.000 0.000') \
void PM_ClientMovement_UpdateStatus(entity this, bool ground)
{
+#ifdef CSQC
// make sure player is not stuck
PM_ClientMovement_Unstick(this);
vector origin1 = this.origin + '0 0 1';
vector origin2 = this.origin - '0 0 1';
- if (ground)
+ if (ground && autocvar_cl_movement != 3)
{
tracebox(origin1, this.mins, this.maxs, origin2, MOVE_NORMAL, this);
if (trace_fraction < 1.0 && trace_plane_normal.z > 0.7)
}
}
- if (IS_ONGROUND(this) || this.velocity.z <= 0 || pmove_waterjumptime <= 0)
- pmove_waterjumptime = 0;
+ if (IS_ONGROUND(this) || this.velocity.z <= 0 || PHYS_TELEPORT_TIME(this) <= 0)
+ PHYS_TELEPORT_TIME(this) = 0;
+#endif
}
void PM_ClientMovement_Move(entity this)
f = (this.velocity * trace1_plane_normal);
this.velocity = this.velocity + -f * trace1_plane_normal;
}
- if(pmove_waterjumptime > 0)
+ if(PHYS_TELEPORT_TIME(this) > 0)
this.velocity = primalvelocity;
#endif
}
this.velocity_z = 225;
this.flags |= FL_WATERJUMP;
SET_JUMP_HELD(this);
-#ifdef SVQC
- this.teleport_time = time + 2; // safety net
-#elif defined(CSQC)
- pmove_waterjumptime = time + 2;
-#endif
+ PHYS_TELEPORT_TIME(this) = time + 2; // safety net
}
}
}
// acceleration
vector wishdir = normalize(wishvel);
float wishspeed = min(vlen(wishvel), PHYS_MAXSPEED(this) * maxspd_mod);
-#ifdef SVQC
- if (time >= this.teleport_time)
-#endif
+ if(time >= PHYS_TELEPORT_TIME(this))
PM_Accelerate(this, wishdir, wishspeed, wishspeed, PHYS_ACCELERATE(this) * maxspd_mod, 1, 0, 0, 0);
PM_ClientMovement_Move(this);
}
{
this.velocity = forward * 50;
this.velocity_z = 310;
- pmove_waterjumptime = 2;
+ PHYS_TELEPORT_TIME(this) = 2;
UNSET_ONGROUND(this);
SET_JUMP_HELD(this);
}
// acceleration
vector wishdir = normalize(wishvel);
float wishspeed = min(vlen(wishvel), PHYS_MAXSPEED(this) * maxspd_mod);
-#ifdef SVQC
- if (time >= this.teleport_time)
-#endif
+ if(time >= PHYS_TELEPORT_TIME(this))
// water acceleration
PM_Accelerate(this, wishdir, wishspeed, wishspeed, PHYS_ACCELERATE(this)*maxspd_mod, 1, 0, 0, 0);
PM_ClientMovement_Move(this);
vector wishdir = normalize(wishvel);
float wishspeed = vlen(wishvel);
-#ifdef SVQC
- if (time >= this.teleport_time)
-#else
- if (pmove_waterjumptime <= 0)
-#endif
+ if(PHYS_TELEPORT_TIME(this) < time)
{
float maxairspd = PHYS_MAXAIRSPEED(this) * min(maxspd_mod, 1);
this.team = myteam + 1; // is this correct?
if (!(PHYS_INPUT_BUTTON_JUMP(this))) // !jump
UNSET_JUMP_HELD(this); // canjump = true
- pmove_waterjumptime -= PHYS_INPUT_TIMELENGTH;
+ PHYS_TELEPORT_TIME(this) -= PHYS_INPUT_TIMELENGTH;
PM_ClientMovement_UpdateStatus(this, true);
#endif
{
this.velocity_x = this.movedir.x;
this.velocity_y = this.movedir.y;
- if (time > this.teleport_time || this.waterlevel == WATERLEVEL_NONE)
+ if (time > PHYS_TELEPORT_TIME(this) || this.waterlevel == WATERLEVEL_NONE)
{
this.flags &= ~FL_WATERJUMP;
- this.teleport_time = 0;
+ PHYS_TELEPORT_TIME(this) = 0;
}
}
SELFPARAM();
#endif
PM_Main(this);
-#ifdef CSQC
- this.pmove_flags =
- ((this.flags & FL_DUCKED) ? PMF_DUCKED : 0) |
- (!(this.flags & FL_JUMPRELEASED) ? PMF_JUMP_HELD : 0) |
- ((this.flags & FL_ONGROUND) ? PMF_ONGROUND : 0);
-#endif
}
#ifdef CSQC
+ noref float pmove_waterjumptime;
+
const int FL_WATERJUMP = 2048; // player jumping out of water
const int FL_JUMPRELEASED = 4096; // for jump debouncing
//float player_multijump;
//float player_jumpheight;
+ #define PHYS_TELEPORT_TIME(s) pmove_waterjumptime
+
#define TICRATE ticrate
#define PHYS_INPUT_ANGLES(s) input_angles
/** Not real stats */
.string stat_jumpspeedcap_min, stat_jumpspeedcap_max;
+ #define PHYS_TELEPORT_TIME(s) s.teleport_time
+
#define TICRATE sys_frametime
#define PHYS_INPUT_ANGLES(s) s.v_angle
return;
}
+#ifdef SVQC
str = min(self.radius, vlen(self.origin - other.origin));
+#elif defined(CSQC)
+ str = min(self.radius, vlen(self.move_origin - other.move_origin));
+#endif
if(self.falloff == 1)
str = (str / self.radius) * self.strength;
if(self.spawnflags & 64)
{
+#ifdef SVQC
float addspeed = str - other.velocity * normalize(targ.origin - self.origin);
if (addspeed > 0)
{
float accelspeed = min(8 * pushdeltatime * str, addspeed);
other.velocity += accelspeed * normalize(targ.origin - self.origin);
}
+#elif defined(CSQC)
+ float addspeed = str - other.move_velocity * normalize(targ.move_origin - self.move_origin);
+ if (addspeed > 0)
+ {
+ float accelspeed = min(8 * pushdeltatime * str, addspeed);
+ other.move_velocity += accelspeed * normalize(targ.move_origin - self.move_origin);
+ }
+#endif
}
else
+#ifdef SVQC
other.velocity = other.velocity + normalize(targ.origin - self.origin) * str * pushdeltatime;
- other.flags &= ~FL_ONGROUND;
+#elif defined(CSQC)
+ other.move_velocity = other.move_velocity + normalize(targ.move_origin - self.move_origin) * str * pushdeltatime;
+#endif
+
#ifdef SVQC
+ other.flags &= ~FL_ONGROUND;
+
UpdateCSQCProjectile(other);
+#elif defined(CSQC)
+ other.move_flags &= ~FL_ONGROUND;
#endif
}
if(!pushdeltatime) return;
// div0: ticrate independent, 1 = identity (not 20)
- other.velocity = other.velocity * pow(self.strength, pushdeltatime);
#ifdef SVQC
+ other.velocity = other.velocity * pow(self.strength, pushdeltatime);
+
UpdateCSQCProjectile(other);
+#elif defined(CSQC)
+ other.move_velocity = other.move_velocity * pow(self.strength, pushdeltatime);
#endif
}
setsize(self, '-1 -1 -1' * self.radius,'1 1 1' * self.radius);
+#ifdef SVQC
str = min(self.radius, vlen(self.origin - other.origin));
+#elif defined(CSQC)
+ str = min(self.radius, vlen(self.move_origin - other.move_origin));
+#endif
if(self.falloff == 1)
str = (1 - str / self.radius) * self.strength; // 1 in the inside
else
str = self.strength;
- other.velocity = other.velocity + normalize(other.origin - self.origin) * str * pushdeltatime;
#ifdef SVQC
+ other.velocity = other.velocity + normalize(other.origin - self.origin) * str * pushdeltatime;
+
UpdateCSQCProjectile(other);
+#elif defined(CSQC)
+ other.move_velocity = other.move_velocity + normalize(other.move_origin - self.move_origin) * str * pushdeltatime;
#endif
}
in directional and sperical mode. For damper/accelerator mode this is not nessesary (and has no effect).
*/
#ifdef SVQC
-bool trigger_impulse_send(entity to, int sf)
-{SELFPARAM();
+bool trigger_impulse_send(entity this, entity to, int sf)
+{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_IMPULSE);
+ WriteInt24_t(MSG_ENTITY, self.spawnflags);
WriteCoord(MSG_ENTITY, self.radius);
WriteCoord(MSG_ENTITY, self.strength);
WriteByte(MSG_ENTITY, self.falloff);
void trigger_impulse_link()
{
- //Net_LinkEntity(self, 0, false, trigger_impulse_send);
+ Net_LinkEntity(self, 0, false, trigger_impulse_send);
}
spawnfunc(trigger_impulse)
#elif defined(CSQC)
NET_HANDLE(ENT_CLIENT_TRIGGER_IMPULSE, bool isnew)
{
+ self.spawnflags = ReadInt24_t();
self.radius = ReadCoord();
self.strength = ReadCoord();
self.falloff = ReadByte();
self.classname = "trigger_impulse";
self.solid = SOLID_TRIGGER;
self.entremove = trigger_remove_generic;
- self.draw = trigger_draw_generic;
+ //self.draw = trigger_draw_generic;
self.drawmask = MASK_NORMAL;
self.move_time = time;
- if(self.radius) { self.trigger_touch = trigger_impulse_touch3; }
- else if(self.target) { self.trigger_touch = trigger_impulse_touch1; }
- else { self.trigger_touch = trigger_impulse_touch2; }
+ if(self.radius) { self.move_touch = trigger_impulse_touch3; }
+ else if(self.target) { self.move_touch = trigger_impulse_touch1; }
+ else { self.move_touch = trigger_impulse_touch2; }
}
#endif
this.velocity = this.move_velocity;
this.angles = this.move_angles;
this.flags = BITSET(this.flags, FL_ONGROUND, boolean(this.move_flags & FL_ONGROUND));
+ this.flags = BITSET(this.flags, FL_WATERJUMP, boolean(this.move_flags & FL_WATERJUMP));
+ this.waterlevel = this.move_waterlevel;
+ this.watertype = this.move_watertype;
setorigin(this, this.move_origin);
}
this.move_velocity = this.velocity;
this.move_avelocity = this.avelocity;
this.move_flags = BITSET(this.move_flags, FL_ONGROUND, boolean(this.flags & FL_ONGROUND));
+ this.move_flags = BITSET(this.move_flags, FL_WATERJUMP, boolean(this.flags & FL_WATERJUMP));
+ this.move_waterlevel = this.waterlevel;
+ this.move_watertype = this.watertype;
Movetype_Physics_Spam(this);
}
+
+ this.pmove_flags =
+ ((this.flags & FL_DUCKED) ? PMF_DUCKED : 0) |
+ (!(this.flags & FL_JUMPRELEASED) ? PMF_JUMP_HELD : 0) |
+ ((this.flags & FL_ONGROUND) ? PMF_ONGROUND : 0);
}
}