float vh_notice_time;
void WaypointSprite_Load();
void CSQC_UpdateView(float w, float h)
-{SELFPARAM();
+{
+ SELFPARAM();
TC(int, w); TC(int, h);
entity e;
float fov;
//self.think = func_null;
//self.enemy = world;
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal)
if((ball = other.ballcarried) && !STAT(FROZEN, other) && !IS_DEAD(other) && (IS_PLAYER(attacker)))
{
void M_Mage_Attack_Spike_Touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
M_Mage_Attack_Spike_Explode(self);
}
void M_Shambler_Attack_Lightning_Touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
self.use(this, NULL, NULL);
}
void M_Spider_Attack_Web_Touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
M_Spider_Attack_Web_Explode();
}
void M_Wyvern_Attack_Fireball_Touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
M_Wyvern_Attack_Fireball_Explode(this);
}
return;
}
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
//setsize(self, '-2 -2 -2', '2 2 2');
//UpdateCSQCProjectile(self);
void W_RocketPropelledChainsaw_Touch (entity this)
{
- if(WarpZone_Projectile_Touch())
- if(wasfreed(self))
+ if(WarpZone_Projectile_Touch(this))
+ if(wasfreed(this))
return;
W_RocketPropelledChainsaw_Explode(this);
void Item_ItemsTime_SetTime(entity e, float t);
void Item_ItemsTime_SetTimesForAllPlayers();
-void Item_Respawn ()
-{SELFPARAM();
+void Item_Respawn (entity this)
+{
Item_Show(self, 1);
// this is ugly...
if(self.items == ITEM_Strength.m_itemid)
{
if(self.waypointsprite_attached)
WaypointSprite_Kill(self.waypointsprite_attached);
- Item_Respawn();
+ Item_Respawn(self);
}
else
{
ItemUpdate(self);
if(time >= self.wait)
- Item_Respawn();
+ Item_Respawn(self);
}
void Item_ScheduleRespawnIn(entity e, float t)
Item_ScheduleInitialRespawn(this);
}
}
-void Item_Reset_self() { SELFPARAM(); Item_Reset(this); }
void Item_FindTeam(entity this)
{
e.(regenfield) = max(e.(regenfield), time + regentime);
}
float GiveItems(entity e, float beginarg, float endarg)
-{SELFPARAM();
+{
float got, i, val, op;
float _switchweapon;
string cmd;
POSTGIVE_VALUE_ROT(e, health, 1, pauserothealth_finished, autocvar_g_balance_pause_health_rot, pauseregen_finished, autocvar_g_balance_pause_health_regen, SND_MEGAHEALTH, SND_Null);
if(e.superweapons_finished <= 0)
- if(self.weapons & WEPSET_SUPERWEAPONS)
+ if(e.weapons & WEPSET_SUPERWEAPONS)
e.superweapons_finished = autocvar_g_balance_superweapons_time;
if(e.strength_finished <= 0)
void Item_Show (entity e, float mode);
-void Item_Respawn ();
+void Item_Respawn (entity this);
void Item_RespawnCountdown(entity this);
void Item_ScheduleRespawnIn(entity e, float t);
void turret_projectile_touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
turret_projectile_explode(this);
}
if (self.pathgoal.enemy)
{
- self.pathcurrent = pathlib_astar(self.pathgoal.origin,self.pathgoal.enemy.origin);
+ self.pathcurrent = pathlib_astar(self, self.pathgoal.origin,self.pathgoal.enemy.origin);
self.pathgoal = self.pathgoal.enemy;
}
}
{
#ifdef EWHEEL_FANCYPATH
- it.pathcurrent = WALKER_PATH(it.origin,e.origin);
+ it.pathcurrent = WALKER_PATH(it, it.origin, e.origin);
it.pathgoal = e;
#else
it.pathcurrent = e;
.float animflag;
.float idletime;
-#define WALKER_PATH(s,e) pathlib_astar(s,e)
+#define WALKER_PATH(this, s, e) pathlib_astar(this, s, e)
float walker_firecheck()
{SELFPARAM();
if (self.pathgoal.enemy)
{
- self.pathcurrent = WALKER_PATH(self.pathgoal.origin,self.pathgoal.enemy.origin);
+ self.pathcurrent = WALKER_PATH(self, self.pathgoal.origin, self.pathgoal.enemy.origin);
self.pathgoal = self.pathgoal.enemy;
}
}
else
{
#ifdef WALKER_FANCYPATHING
- it.pathcurrent = WALKER_PATH(it.origin, e.origin);
+ it.pathcurrent = WALKER_PATH(it, it.origin, e.origin);
it.pathgoal = e;
#else
it.pathcurrent = e;
#ifndef MENUQC
#ifndef CSQC
+entity _wordwrap_buffer_sprint_ent;
void wordwrap_buffer_sprint(string s)
-{SELFPARAM();
+{
wordwrap_buffer = strcat(wordwrap_buffer, s);
if(s == "\n")
{
- sprint(self, wordwrap_buffer);
+ sprint(_wordwrap_buffer_sprint_ent, wordwrap_buffer);
wordwrap_buffer = "";
}
}
-void wordwrap_sprint(string s, float l)
-{SELFPARAM();
+void wordwrap_sprint(entity to, string s, float l)
+{
wordwrap_buffer = "";
+ _wordwrap_buffer_sprint_ent = to;
wordwrap_cb(s, l, wordwrap_buffer_sprint);
+ _wordwrap_buffer_sprint_ent = NULL;
if(wordwrap_buffer != "")
- sprint(self, strcat(wordwrap_buffer, "\n"));
+ sprint(to, strcat(wordwrap_buffer, "\n"));
wordwrap_buffer = "";
return;
}
string wordwrap(string s, float l);
#ifndef MENUQC
#ifndef CSQC
-void wordwrap_sprint(string s, float l);
+void wordwrap_sprint(entity to, string s, float l);
#endif
#endif
void wordwrap_cb(string s, float l, void(string) callback);
return;
}
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
self.event_damage = func_null;
RadiusDamage (self, self.realowner, self.shot_dmg, 0, self.shot_radius, self, world, self.shot_force, self.totalfrags, other);
if(other == self.owner)
return;
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
setthink(self, raptor_bomblet_boom);
self.nextthink = time + random() * autocvar_g_vehicle_raptor_bomblet_explode_delay;
}
void W_Arc_Bolt_Touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
self.use(this, NULL, NULL);
}
void W_Blaster_Touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
self.event_damage = func_null;
float finalhit;
float f;
float isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY);
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
float a;
a = bound(0, 1 - (time - self.fade_time) * self.fade_rate, 1);
void W_Devastator_Touch(entity this)
{
- if(WarpZone_Projectile_Touch())
+ if(WarpZone_Projectile_Touch(this))
{
- if(wasfreed(self))
- W_Devastator_Unregister(self);
+ if(wasfreed(this))
+ W_Devastator_Unregister(this);
return;
}
- W_Devastator_Unregister(self);
+ W_Devastator_Unregister(this);
W_Devastator_Explode(this);
}
void W_Electro_TouchExplode(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
W_Electro_Explode(this);
}
void W_Electro_Orb_Touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
if(other.takedamage == DAMAGE_AIM)
{ if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(self); } }
else
void W_Fireball_TouchExplode(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
W_Fireball_Explode(this);
}
void W_Fireball_Firemine_Touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
if(other.takedamage == DAMAGE_AIM)
if(Fire_AddDamage(other, self.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), self.projectiledeathtype) >= 0)
{
void W_Hagar_Touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
this.use(this, NULL, NULL);
}
void W_Hagar_Touch2(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
this.use(this, NULL, NULL);
{
float isprimary;
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
self.event_damage = func_null;
void W_Hook_Touch2(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
this.use(this, NULL, NULL);
}
if(self.movetype == MOVETYPE_NONE || self.movetype == MOVETYPE_FOLLOW)
return; // we're already a stuck mine, why do we get called? TODO does this even happen?
- if(WarpZone_Projectile_Touch())
+ if(WarpZone_Projectile_Touch(self))
{
if(wasfreed(self))
self.realowner.minelayer_mines -= 1;
void W_Mortar_Grenade_Touch1(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
if(other.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
{
this.use(this, NULL, NULL);
void W_Mortar_Grenade_Touch2(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
if(other.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
{
this.use(this, NULL, NULL);
void W_Seeker_Missile_Touch(entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
W_Seeker_Missile_Explode(this);
}
vector org2;
entity e;
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
dir = normalize(self.realowner.origin - self.origin);
org2 = findbetterlocation(self.origin, 8);
void W_RocketMinsta_Laser_Touch (entity this)
{
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
//W_RocketMinsta_Laser_Explode ();
RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
remove(self);
// generic CSQC model code
-bool CSQCModel_Send(entity to, int sf)
+bool CSQCModel_Send(entity this, entity to, int sf)
{
- SELFPARAM();
// some nice flags for CSQCMODEL_IF
noref bool isplayer = IS_CLIENT(this);
noref bool islocalplayer = (this == to);
void CSQCModel_LinkEntity(entity e)
{
- e.SendEntity = CSQCModel_Send;
+ e.SendEntity = SendEntity_self;
+ e.SendEntity3 = CSQCModel_Send;
e.SendFlags = 0xFFFFFF;
CSQCModel_CheckUpdate(e);
}
void CSQCModel_UnlinkEntity(entity e)
{
e.SendEntity = func_null;
+ e.SendEntity3 = func_null;
}
#ifdef WARPZONELIB_KEEPDEBUG
float WarpZone_CheckProjectileImpact(entity player)
-{SELFPARAM();
+{
vector o0, v0;
.vector orgvec, velvec;
#endif
#endif
-float WarpZone_Projectile_Touch()
-{SELFPARAM();
+float WarpZone_Projectile_Touch(entity this)
+{
if(other.classname == "trigger_warpzone")
return true;
save_ent = trace_ent;
save_inopen = trace_inopen;
save_inwater = trace_inwater;
- float f;
- if((f = WarpZone_CheckProjectileImpact(this)) != 0)
- return (f > 0);
+ float f = WarpZone_CheckProjectileImpact(this);
+ if (f) return (f > 0);
trace_dpstartcontents = save_dpstartcontents;
trace_dphitcontents = save_dphitcontents;
trace_dphitq3surfaceflags = save_dphitq3surfaceflags;
#ifdef SVQC
void WarpZone_StartFrame();
-float WarpZone_Projectile_Touch();
+float WarpZone_Projectile_Touch(entity this);
// THESE must be defined by calling QC code:
void WarpZone_PostTeleportPlayer_Callback(entity pl);
this.aistatus |= AI_STATUS_DANGER_AHEAD;
}
- dodge = havocbot_dodge();
+ dodge = havocbot_dodge(this);
dodge = dodge * bound(0,0.5+(skill+this.bot_dodgeskill)*0.1,1);
evadelava = evadelava * bound(1,3-(skill+this.bot_dodgeskill),3); //Noobs fear lava a lot and take more distance from it
traceline(this.origin, ( ( this.enemy.absmin + this.enemy.absmax ) * 0.5 ), true, world);
havocbot_chooserole(this);
}
-vector havocbot_dodge()
+vector havocbot_dodge(entity this)
{
// LordHavoc: disabled because this is too expensive
return '0 0 0';
#if 0
-SELFPARAM();
entity head;
vector dodge, v, n;
float danger, bestdanger, vl, d;
float havocbot_moveto(entity this, vector pos);
float havocbot_moveto_refresh_route(entity this);
-vector havocbot_dodge();
+vector havocbot_dodge(entity this);
.void(entity this) havocbot_role;
.void(entity this) havocbot_previous_role;
// ==========================================
// used by CommonCommand_timeout() and CommonCommand_timein() to handle game pausing and messaging and such.
-void timeout_handler_reset()
+void timeout_handler_reset(entity this)
{
- SELFPARAM();
- timeout_caller = world;
+ timeout_caller = NULL;
timeout_time = 0;
timeout_leadtime = 0;
- remove(self);
+ remove(this);
}
void timeout_handler_think(entity this)
it.fixangle = false;
));
- timeout_handler_reset();
+ timeout_handler_reset(this);
}
return;
case TIMEOUT_INACTIVE:
default:
{
- timeout_handler_reset();
+ timeout_handler_reset(this);
return;
}
}
{
string command = builtin_cvar_string(strcat("sv_info_", argv(1)));
- if (command) wordwrap_sprint(command, 1000);
+ if (command) wordwrap_sprint(caller, command, 1000);
else print_to(caller, "ERROR: unsupported info command");
return; // never fall through to usage
// ==========================================
// used by CommonCommand_timeout() and CommonCommand_timein() to handle game pausing and messaging and such.
-void timeout_handler_reset();
+void timeout_handler_reset(entity this);
void timeout_handler_think(entity this);
{
if(other.movetype == MOVETYPE_FOLLOW)
return;
- PROJECTILE_TOUCH;
+ PROJECTILE_TOUCH(this);
GrapplingHook_Stop();
#define ITEM_TOUCH_NEEDKILL() (((trace_dpstartcontents | trace_dphitcontents) & DPCONTENTS_NODROP) || (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
#define ITEM_DAMAGE_NEEDKILL(dt) (((dt) == DEATH_HURTTRIGGER.m_id) || ((dt) == DEATH_SLIME.m_id) || ((dt) == DEATH_LAVA.m_id) || ((dt) == DEATH_SWAMP.m_id))
-#define PROJECTILE_TOUCH if(WarpZone_Projectile_Touch()) return
+#define PROJECTILE_TOUCH(this) MACRO_BEGIN if (WarpZone_Projectile_Touch(this)) return; MACRO_END
#define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))
}
}
-void path_dbg_think()
-{SELFPARAM();
- pathlib_showpath(self);
- self.nextthink = time + 1;
+void path_dbg_think(entity this)
+{
+ pathlib_showpath(this);
+ this.nextthink = time + 1;
}
void __showpath2_think(entity this)
return path;
}
-entity pathlib_astar(vector from,vector to)
-{SELFPARAM();
+entity pathlib_astar(entity this, vector from,vector to)
+{
entity path, start, end, open, n, ln;
float ptime, ftime, ctime;
pathlib_movecost_waterfactor = 25000000;
pathlib_foundgoal = 0;
- movenode_boxmax = self.maxs * 1.1;
- movenode_boxmin = self.mins * 1.1;
+ movenode_boxmax = this.maxs * 1.1;
+ movenode_boxmin = this.mins * 1.1;
movenode_stepsize = pathlib_gridsize * 0.25;