#include <server/anticheat.qh>
#endif
+#ifdef SVQC
float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax)
{
if (IS_PLAYER(player) && !IS_DEAD(player))
return 0;
}
-#ifdef SVQC
-
void trigger_teleport_link(entity this);
void tdeath(entity player, entity teleporter, entity telefragger, vector telefragmin, vector telefragmax)
{
tdeath(e, e, e, '0 0 0', '0 0 0');
}
-
#endif
void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags)
entity Simple_TeleportPlayer(entity teleporter, entity player)
{
vector locout;
- entity e;
- float p;
+ entity e = NULL;
// Find the output teleporter
if(teleporter.enemy)
}
else
{
+ // sorry CSQC, random stuff ain't gonna happen
+#ifdef SVQC
RandomSelection_Init();
FOREACH_ENTITY_STRING(targetname, teleporter.target,
{
- p = 1;
+ bool p = true;
if(STAT(TELEPORT_TELEFRAG_AVOID, player))
{
#ifdef SVQC
locout = it.origin + '0 0 1' * (1 - player.mins.z - 24);
#endif
if(check_tdeath(player, locout, '0 0 0', '0 0 0'))
- p = 0;
+ p = false;
}
RandomSelection_AddEnt(it, (it.cnt ? it.cnt : 1), p);
});
e = RandomSelection_chosen_ent;
+#endif
}
#ifdef SVQC
#ifdef CSQC
.entity realowner;
.float lastteleporttime;
-
-#define TDEATHLOOP(o) \
- entity head; \
- vector deathmin; \
- vector deathmax; \
- float deathradius; \
- deathmin = (o) + player.mins; \
- deathmax = (o) + player.maxs; \
- if(telefragmin != telefragmax) \
- { \
- if(deathmin.x > telefragmin.x) deathmin.x = telefragmin.x; \
- if(deathmin.y > telefragmin.y) deathmin.y = telefragmin.y; \
- if(deathmin.z > telefragmin.z) deathmin.z = telefragmin.z; \
- if(deathmax.x < telefragmax.x) deathmax.x = telefragmax.x; \
- if(deathmax.y < telefragmax.y) deathmax.y = telefragmax.y; \
- if(deathmax.z < telefragmax.z) deathmax.z = telefragmax.z; \
- } \
- deathradius = max(vlen(deathmin), vlen(deathmax)); \
- for(head = findradius(o, deathradius); head; head = head.chain) \
- if(head != player) \
- if(head.isplayermodel) \
- if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
#endif
Turret tur = get_turretinfo(this.m_id);
if(this.damage_flags & TFL_DMG_DEATH_NORESPAWN)
{
+ // do a simple explosion effect here, since CSQC can't do it on a to-be-removed entity
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ Send_Effect(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
+
tur.tr_death(tur, this);
delete(this.tur_head);
vector vec_bias(vector v, float f)
{
vector c;
- c_x = v_x + f;
- c_y = v_y + f;
- c_z = v_z + f;
+ c.x = v.x + f;
+ c.y = v.y + f;
+ c.z = v.z + f;
return c;
}
vector vec_to_min(vector a, vector b)
{
vector c;
- c_x = min(a_x, b_x);
- c_y = min(a_y, b_y);
- c_z = min(a_z, b_z);
+ c.x = min(a.x, b.x);
+ c.y = min(a.y, b.y);
+ c.z = min(a.z, b.z);
return c;
}
vector vec_to_max(vector a, vector b)
{
vector c;
- c_x = max(a_x, b_x);
- c_y = max(a_y, b_y);
- c_z = max(a_z, b_z);
+ c.x = max(a.x, b.x);
+ c.y = max(a.y, b.y);
+ c.z = max(a.z, b.z);
return c;
}
// there may already be a function for bounding a vector in this manner, however my very quick search did not reveal one -- Player_2
vector vec_bounds_in(vector point, vector a, vector b)
{
- vector c, d, e;
+ vector d = vec_to_min(a, b);
+ vector e = vec_to_max(a, b);
- d = vec_to_min(a, b);
- e = vec_to_max(a, b);
-
- c = vec_to_max(point, d);
- c = vec_to_min(c, e);
+ vector c = vec_to_min(vec_to_max(point, d), e);
return c;
}
vector vec_bounds_out(vector point, vector a, vector b)
{
- vector c, d, e;
-
- d = vec_to_max(a, b);
- e = vec_to_min(a, b);
+ vector d = vec_to_max(a, b);
+ vector e = vec_to_min(a, b);
- c = vec_to_max(point, d);
- c = vec_to_min(c, e);
+ vector c = vec_to_min(vec_to_max(point, d), e);
return c;
}
float angle_snap_f(float f, float increment)
{
- float i;
- for (i = 0; i <= 360; )
+ for (int j = 0; j <= 360; )
{
- if (f <= i - increment) return i - increment;
- i = i + increment;
+ if (f <= j - increment) return j - increment;
+ j = j + increment;
}
return 0;
}
-vector angle_snap_vec(vector v, float increment)
+vector angle_snap_vec(vector v, float increment)
{
vector c;
- c_x = angle_snap_f(v_x, increment);
- c_y = angle_snap_f(v_y, increment);
- c_z = angle_snap_f(v_z, increment);
+ c.x = angle_snap_f(v.x, increment);
+ c.y = angle_snap_f(v.y, increment);
+ c.z = angle_snap_f(v.z, increment);
return c;
}
-vector aim_vec(vector origin, vector target)
+vector aim_vec(vector org, vector targ)
{
vector v;
// we float around x and y, but rotate around z
- v_x = target_x - origin_x;
- v_y = target_y - origin_y;
- v_z = origin_z - target_z;
+ v.x = targ.x - org.x;
+ v.y = targ.y - org.y;
+ v.z = org.z - targ.z;
// get the angles actual
return vectoangles(normalize(v));
}
float angle_snap_f(float f, float increment);
vector angle_snap_vec(vector v, float increment);
-vector aim_vec(vector origin, vector target);
+vector aim_vec(vector org, vector targ);