From: TimePath Date: Sun, 30 Aug 2015 11:04:06 +0000 (+1000) Subject: Use SELFPARAM() in every function that uses self X-Git-Tag: xonotic-v0.8.2~1931^2~9 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=5b22584122d4354ab7819853d0fa5219d14d832e Use SELFPARAM() in every function that uses self --- diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index 19e51cedc6..8f477171ce 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -8,7 +8,7 @@ bool announcer_1min; bool announcer_5min; void Announcer_Countdown() -{ +{SELFPARAM(); float starttime = getstatf(STAT_GAMESTARTTIME); float roundstarttime = getstatf(STAT_ROUNDSTARTTIME); if(roundstarttime == -1) diff --git a/qcsrc/client/command/cl_cmd.qc b/qcsrc/client/command/cl_cmd.qc index 2d6093868c..8b0a33e6c2 100644 --- a/qcsrc/client/command/cl_cmd.qc +++ b/qcsrc/client/command/cl_cmd.qc @@ -21,7 +21,7 @@ #include "../../common/command/generic.qh" void DrawDebugModel() -{ +{SELFPARAM(); if(time - floor(time) > 0.5) { PolyDrawModel(self); diff --git a/qcsrc/client/controlpoint.qc b/qcsrc/client/controlpoint.qc index 3b8901cf37..83ee0316bd 100644 --- a/qcsrc/client/controlpoint.qc +++ b/qcsrc/client/controlpoint.qc @@ -35,7 +35,7 @@ void cpicon_precache() } void cpicon_draw() -{ +{SELFPARAM(); if(time < self.move_time) { return; } if(self.cp_bob_dmg_z > 0) @@ -99,7 +99,7 @@ void cpicon_draw() } void cpicon_damage(float hp) -{ +{SELFPARAM(); if(!self.iscaptured) { return; } if(hp < self.max_health * 0.25) @@ -121,7 +121,7 @@ void cpicon_damage(float hp) } void cpicon_construct() -{ +{SELFPARAM(); self.netname = "Control Point Icon"; setmodel(self, "models/onslaught/controlpoint_icon.md3"); @@ -155,7 +155,7 @@ void cpicon_construct() .vector glowmod; void cpicon_changeteam() -{ +{SELFPARAM(); if(self.team) { self.glowmod = Team_ColorRGB(self.team - 1); @@ -171,7 +171,7 @@ void cpicon_changeteam() } void ent_cpicon() -{ +{SELFPARAM(); int sf = ReadByte(); if(sf & CPSF_SETUP) diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index d8c44d660c..4379f52c27 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -31,7 +31,7 @@ void CSQCModel_Hook_PreDraw(bool isplayer); .int lodmodelindex1; .int lodmodelindex2; void CSQCPlayer_LOD_Apply(void) -{ +{SELFPARAM(); // LOD model loading if(self.lodmodelindex0 != self.modelindex) { @@ -120,14 +120,14 @@ int forceplayermodels_goodmodelindex; .vector old_glowmod; void CSQCPlayer_ModelAppearance_PreUpdate(void) -{ +{SELFPARAM(); self.model = self.forceplayermodels_savemodel; self.modelindex = self.forceplayermodels_savemodelindex; self.skin = self.forceplayermodels_saveskin; self.colormap = self.forceplayermodels_savecolormap; } void CSQCPlayer_ModelAppearance_PostUpdate(void) -{ +{SELFPARAM(); self.forceplayermodels_savemodel = self.model; self.forceplayermodels_savemodelindex = self.modelindex; self.forceplayermodels_saveskin = self.skin; @@ -142,7 +142,7 @@ void CSQCPlayer_ModelAppearance_PostUpdate(void) } } void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer) -{ +{SELFPARAM(); // FORCEMODEL // which one is ALWAYS good? if (!forceplayermodels_goodmodel) @@ -325,7 +325,7 @@ void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer) #define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1) void CSQCPlayer_FallbackFrame_PreUpdate(void) -{ +{SELFPARAM(); self.frame = self.csqcmodel_saveframe; self.frame2 = self.csqcmodel_saveframe2; #ifdef CSQCMODEL_HAVE_TWO_FRAMES @@ -334,7 +334,7 @@ void CSQCPlayer_FallbackFrame_PreUpdate(void) #endif } void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew) -{ +{SELFPARAM(); self.csqcmodel_saveframe = self.frame; self.csqcmodel_saveframe2 = self.frame2; #ifdef CSQCMODEL_HAVE_TWO_FRAMES @@ -360,11 +360,11 @@ void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew) self.csqcmodel_isdead = IS_DEAD_FRAME(self.frame); } void CSQCPlayer_AnimDecide_PostUpdate(bool isnew) -{ +{SELFPARAM(); self.csqcmodel_isdead = !!(self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2)); } int CSQCPlayer_FallbackFrame(int f) -{ +{SELFPARAM(); if(frameduration(self.modelindex, f) > 0) return f; // goooooood if(frameduration(self.modelindex, 1) <= 0) @@ -384,7 +384,7 @@ int CSQCPlayer_FallbackFrame(int f) return f; } void CSQCPlayer_FallbackFrame_Apply(void) -{ +{SELFPARAM(); self.frame = CSQCPlayer_FallbackFrame(self.frame); self.frame2 = CSQCPlayer_FallbackFrame(self.frame2); #ifdef CSQCMODEL_HAVE_TWO_FRAMES @@ -398,7 +398,7 @@ void CSQCPlayer_FallbackFrame_Apply(void) .int tag_entity_lastmodelindex; .int tag_index; void CSQCModel_AutoTagIndex_Apply(void) -{ +{SELFPARAM(); if(self.tag_entity && wasfreed(self.tag_entity)) self.tag_entity = world; @@ -423,10 +423,8 @@ void CSQCModel_AutoTagIndex_Apply(void) // recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch if(self.tag_entity.classname == "csqcmodel") { - entity oldself = self; - self = self.tag_entity; - CSQCModel_Hook_PreDraw((self.entnum >= 1 && self.entnum <= maxclients)); - self = oldself; + SELFCALL(self.tag_entity, CSQCModel_Hook_PreDraw((self.entnum >= 1 && self.entnum <= maxclients))); + SELFCALL_DONE(); } if(self.tag_entity.modelindex != self.tag_entity_lastmodelindex) @@ -499,13 +497,13 @@ const int MF_TRACER3 = 128; // purple trail .int csqcmodel_effects; .int csqcmodel_modelflags; void CSQCModel_Effects_PreUpdate(void) -{ +{SELFPARAM(); self.effects = self.csqcmodel_effects; self.modelflags = self.csqcmodel_modelflags; } void Reset_ArcBeam(void); void CSQCModel_Effects_PostUpdate(void) -{ +{SELFPARAM(); if (self == csqcplayer) { if (self.csqcmodel_teleported) { Reset_ArcBeam(); @@ -520,7 +518,7 @@ void CSQCModel_Effects_PostUpdate(void) } .int snd_looping; void CSQCModel_Effects_Apply(void) -{ +{SELFPARAM(); int eff = self.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST; self.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS); @@ -625,7 +623,7 @@ void CSQCPlayer_Precache() .int anim_saveframe2time; .int anim_prev_pmove_flags; void CSQCModel_Hook_PreDraw(bool isplayer) -{ +{SELFPARAM(); if(self.csqcmodel_predraw_run == framecount) return; self.csqcmodel_predraw_run = framecount; @@ -724,7 +722,7 @@ void CSQCModel_Hook_PreDraw(bool isplayer) } void CSQCModel_Hook_PreUpdate(bool isnew, bool isplayer, bool islocalplayer) -{ +{SELFPARAM(); // interpolate v_angle self.iflags |= IFLAG_V_ANGLE_X; // revert to values from server @@ -738,7 +736,7 @@ void CSQCModel_Hook_PreUpdate(bool isnew, bool isplayer, bool islocalplayer) } void CSQCModel_Hook_PostUpdate(bool isnew, bool isplayer, bool islocalplayer) -{ +{SELFPARAM(); // is it a player model? (shared state) self.isplayermodel = (substring(self.model, 0, 14) == "models/player/" || substring(self.model, 0, 17) == "models/ok_player/" || (substring(self.model, 0, 16) == "models/monsters/" && (self.entnum >= 1 && self.entnum <= maxclients))); diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index 32d236fba4..8cb410d668 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -20,7 +20,7 @@ .bool isplayermodel; void DamageEffect_Think() -{ +{SELFPARAM(); // if particle distribution is enabled, slow ticrate by total number of damages if(autocvar_cl_damageeffect_distribute) self.nextthink = time + autocvar_cl_damageeffect_ticrate * self.owner.total_damages; @@ -53,7 +53,7 @@ void DamageEffect_Think() } void DamageEffect(vector hitorg, float thedamage, int type, int specnum) -{ +{SELFPARAM(); // particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets) int nearestbone = 0; @@ -125,7 +125,7 @@ void DamageEffect(vector hitorg, float thedamage, int type, int specnum) } void Ent_DamageInfo(float isNew) -{ +{SELFPARAM(); float thedamage, rad, edge, thisdmg; bool hitplayer = false; int species, forcemul; diff --git a/qcsrc/client/generator.qc b/qcsrc/client/generator.qc index 80ccc441bc..710ed01f5b 100644 --- a/qcsrc/client/generator.qc +++ b/qcsrc/client/generator.qc @@ -32,7 +32,7 @@ void generator_precache() } void ons_generator_ray_draw() -{ +{SELFPARAM(); if(time < self.move_time) return; @@ -71,7 +71,7 @@ void ons_generator_ray_spawn(vector org) } void generator_draw() -{ +{SELFPARAM(); if(time < self.move_time) return; @@ -144,7 +144,7 @@ void generator_draw() } void generator_damage(float hp) -{ +{SELFPARAM(); if(hp <= 0) setmodel(self, "models/onslaught/generator_dead.md3"); else if(hp < self.max_health * 0.10) @@ -172,7 +172,7 @@ void generator_damage(float hp) } void generator_construct() -{ +{SELFPARAM(); self.netname = "Generator"; self.classname = "onslaught_generator"; @@ -192,7 +192,7 @@ void generator_construct() .vector glowmod; void generator_changeteam() -{ +{SELFPARAM(); if(self.team) { self.glowmod = Team_ColorRGB(self.team - 1); @@ -208,7 +208,7 @@ void generator_changeteam() } void ent_generator() -{ +{SELFPARAM(); int sf = ReadByte(); if(sf & GSF_SETUP) diff --git a/qcsrc/client/gibs.qc b/qcsrc/client/gibs.qc index b59cd4ff3d..3c46ea9288 100644 --- a/qcsrc/client/gibs.qc +++ b/qcsrc/client/gibs.qc @@ -13,7 +13,7 @@ .float gravity; void Gib_Delete() -{ +{SELFPARAM(); remove(self); } @@ -75,7 +75,7 @@ void SUB_RemoveOnNoImpact() } void Gib_Touch() -{ +{SELFPARAM(); // TODO maybe bounce of walls, make more gibs, etc. if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) @@ -92,7 +92,7 @@ void Gib_Touch() } void Gib_Draw() -{ +{SELFPARAM(); vector oldorg; oldorg = self.origin; @@ -164,7 +164,7 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector } void Ent_GibSplash(bool isNew) -{ +{SELFPARAM(); int amount, type, specnum; vector org, vel; string specstr; diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc index a30ab73c16..781681cf73 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -32,7 +32,7 @@ void Draw_GrapplingHook_trace_callback(vector start, vector hit, vector end) class(Hook) .float teleport_time; void Draw_GrapplingHook() -{ +{SELFPARAM(); vector a, b, atrans; string tex; vector rgb; @@ -167,12 +167,12 @@ void Draw_GrapplingHook() } void Remove_GrapplingHook() -{ +{SELFPARAM(); sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM); } void Ent_ReadHook(float bIsNew, float type) -{ +{SELFPARAM(); self.HookType = type; int sf = ReadByte(); diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index eb50ebc094..cbef45330a 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -352,7 +352,7 @@ int weaponorder_cmp(int i, int j, entity pass) } void HUD_Weapons(void) -{ +{SELFPARAM(); // declarations WepSet weapons_stat = WepSet_GetFromStat(); int i; diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index a5085e893d..6fbef76ef6 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -300,7 +300,7 @@ float SetTeam(entity o, int Team) } void Playerchecker_Think() -{ +{SELFPARAM(); int i; entity e; for(i = 0; i < maxclients; ++i) @@ -394,11 +394,11 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary) // BEGIN OPTIONAL CSQC FUNCTIONS void Ent_RemoveEntCS() -{ +{SELFPARAM(); entcs_receiver[self.sv_entnum] = world; } void Ent_ReadEntCS() -{ +{SELFPARAM(); int sf; InterpolateOrigin_Undo(); @@ -434,7 +434,7 @@ void Ent_ReadEntCS() void Ent_Remove(); void Ent_RemovePlayerScore() -{ +{SELFPARAM(); if(self.owner) { SetTeam(self.owner, -1); self.owner.gotscores = 0; @@ -445,7 +445,7 @@ void Ent_RemovePlayerScore() } void Ent_ReadPlayerScore() -{ +{SELFPARAM(); int i, n; bool isNew; entity o; @@ -503,7 +503,7 @@ void Ent_ReadPlayerScore() } void Ent_ReadTeamScore() -{ +{SELFPARAM(); int i; entity o; @@ -695,12 +695,12 @@ void Ent_ReadAccuracy(void) } void Spawn_Draw(void) -{ +{SELFPARAM(); pointparticles(self.cnt, self.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1)); } void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint -{ +{SELFPARAM(); float teamnum = (ReadByte() - 1); vector spn_origin; spn_origin.x = ReadShort(); @@ -746,7 +746,7 @@ void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint } void Ent_ReadSpawnEvent(float is_new) -{ +{SELFPARAM(); // If entnum is 0, ONLY do the local spawn actions // this way the server can disable the sending of // spawn origin or such to clients if wanted. @@ -802,7 +802,7 @@ void Ent_RadarLink(); void Ent_Init(); void Ent_ScoresInfo(); void CSQC_Ent_Update(float bIsNewEntity) -{ +{SELFPARAM(); float t; float savetime; t = ReadByte(); @@ -920,7 +920,7 @@ void CSQC_Ent_Update(float bIsNewEntity) // used when an entity changes its type. For an entity that someone interacts // with others, make sure it can no longer do so. void Ent_Remove() -{ +{SELFPARAM(); if(self.entremove) self.entremove(); @@ -944,7 +944,7 @@ void Ent_Remove() } // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(self) as well. void CSQC_Ent_Remove() -{ +{SELFPARAM(); if(autocvar_developer_csqcentities) LOG_INFOF("CSQC_Ent_Remove() with self=%i self.entnum=%d self.enttype=%d\n", self, self.entnum, self.enttype); @@ -1007,7 +1007,7 @@ void Fog_Force() void Gamemode_Init(); void Ent_ScoresInfo() -{ +{SELFPARAM(); int i; self.classname = "ent_client_scores_info"; gametype = ReadInt24_t(); @@ -1031,7 +1031,7 @@ void Ent_ScoresInfo() } void Ent_Init() -{ +{SELFPARAM(); self.classname = "ent_client_init"; nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th diff --git a/qcsrc/client/modeleffects.qc b/qcsrc/client/modeleffects.qc index c44fbe4dca..fa7044fc29 100644 --- a/qcsrc/client/modeleffects.qc +++ b/qcsrc/client/modeleffects.qc @@ -6,7 +6,7 @@ .float alpha; void ModelEffect_Draw() -{ +{SELFPARAM(); self.angles = self.angles + frametime * self.avelocity; setorigin(self, self.origin + frametime * self.velocity); self.scale = self.scale1 + (self.scale2 - self.scale1) * (time - self.teleport_time) / (self.lifetime + self.fadetime - self.teleport_time); @@ -25,7 +25,7 @@ void ModelEffect_Draw() } void Ent_ModelEffect(bool isNew) -{ +{SELFPARAM(); self.classname = "modeleffect_spawner"; int f = ReadByte(); diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index fe2e3fd33f..a79e0b4712 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -64,13 +64,13 @@ MUTATOR_HOOKABLE(CSQC_Ent_Update, EV_CSQC_Ent_Update); /** Called when a projectile is linked with CSQC */ #define EV_Ent_Projectile(i, o) \ - /** entity id */ i(entity, self) \ + /** entity id */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(Ent_Projectile, EV_Ent_Projectile); /** Called when a projectile's properties are being modified */ #define EV_EditProjectile(i, o) \ - /** entity id */ i(entity, self) \ + /** entity id */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile); @@ -79,25 +79,25 @@ MUTATOR_HOOKABLE(PrecacheProjectiles, EV_NO_ARGS); /** Called when updating the attached tags index */ #define EV_TagIndex_Update(i, o) \ - /** entity id */ i(entity, self) \ + /** entity id */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(TagIndex_Update, EV_TagIndex_Update); /** Called when setting the attached tags */ #define EV_TagIndex_Apply(i, o) \ - /** entity id */ i(entity, self) \ + /** entity id */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(TagIndex_Apply, EV_TagIndex_Apply); /** Called when setting up skeleton bones */ #define EV_Skeleton_CheckBones(i, o) \ - /** entity id */ i(entity, self) \ + /** entity id */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(Skeleton_CheckBones, EV_Skeleton_CheckBones); /** Called when setting up bones from the loaded model */ #define EV_Skeleton_CheckModel(i, o) \ - /** entity id */ i(entity, self) \ + /** entity id */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(Skeleton_CheckModel, EV_Skeleton_CheckModel); @@ -125,7 +125,7 @@ MUTATOR_HOOKABLE(PlayerJump, EV_PlayerJump); /** Called checking if 3rd person mode should be forced on */ #define EV_WantEventchase(i, o) \ - /** entity id */ i(entity, self) \ + /** entity id */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase); diff --git a/qcsrc/client/player_skeleton.qc b/qcsrc/client/player_skeleton.qc index 00f9543717..584a197801 100644 --- a/qcsrc/client/player_skeleton.qc +++ b/qcsrc/client/player_skeleton.qc @@ -107,7 +107,7 @@ void free_skeleton_from_frames(entity e) } void skeleton_from_frames(entity e, float is_dead) -{ +{SELFPARAM(); float m = e.modelindex; if(!e.skeletonindex) { diff --git a/qcsrc/client/rubble.qc b/qcsrc/client/rubble.qc index 4e32c0c454..11f547625c 100644 --- a/qcsrc/client/rubble.qc +++ b/qcsrc/client/rubble.qc @@ -3,7 +3,7 @@ // LordHavoc: rewrote this file, it was really bad code void RubbleLimit(string cname, float limit, void() deleteproc) -{ +{SELFPARAM(); entity e; entity oldest; entity oldself; diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index da5a7b2a77..7d2a425f19 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -975,7 +975,7 @@ float HUD_WouldDrawScoreboard() { float average_accuracy; vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size) -{ +{SELFPARAM(); WepSet weapons_stat = WepSet_GetFromStat(); WepSet weapons_inmap = WepSet_GetFromStat_InMap(); float initial_posx = pos.x; diff --git a/qcsrc/client/teamradar.qc b/qcsrc/client/teamradar.qc index ab6129e782..8eaf7e4c22 100644 --- a/qcsrc/client/teamradar.qc +++ b/qcsrc/client/teamradar.qc @@ -202,7 +202,7 @@ void teamradar_loadcvars() // radar links void Ent_RadarLink() -{ +{SELFPARAM(); int sendflags = ReadByte(); InterpolateOrigin_Undo(); diff --git a/qcsrc/client/tuba.qc b/qcsrc/client/tuba.qc index b95dd99e32..1acfbd7eb7 100644 --- a/qcsrc/client/tuba.qc +++ b/qcsrc/client/tuba.qc @@ -70,7 +70,7 @@ void tubasound(entity e, bool restart) } void Ent_TubaNote_Think() -{ +{SELFPARAM(); float f = autocvar_g_balance_tuba_fadetime; if (f > 0) { self.tuba_volume -= frametime * self.tuba_volume_initial / f; @@ -91,7 +91,7 @@ void Ent_TubaNote_Think() } void Ent_TubaNote_UpdateSound() -{ +{SELFPARAM(); self.enemy.tuba_volume = bound(0, VOL_BASE * autocvar_g_balance_tuba_volume, 1); self.enemy.tuba_volume_initial = self.enemy.tuba_volume; self.enemy.note = self.note; @@ -100,13 +100,13 @@ void Ent_TubaNote_UpdateSound() } void Ent_TubaNote_StopSound() -{ +{SELFPARAM(); self.enemy.nextthink = time; self.enemy = world; } void Ent_TubaNote(bool isNew) -{ +{SELFPARAM(); bool upd = false; int f = ReadByte(); if (f & 1) { diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 701eb9f1e7..3039c04a51 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -427,7 +427,7 @@ vector liquidcolor_prev; float eventchase_current_distance; float eventchase_running; bool WantEventchase() -{ +{SELFPARAM(); if(autocvar_cl_orthoview) return false; if(intermission) @@ -533,7 +533,7 @@ void UpdateHitsound() } void UpdateCrosshair() -{ +{SELFPARAM(); static float rainbow_last_flicker; static vector rainbow_prev_color; entity e = self; @@ -1022,7 +1022,7 @@ int lasthud; float vh_notice_time; void WaypointSprite_Load(); void CSQC_UpdateView(float w, float h) -{ +{SELFPARAM(); entity e; float fov; float f; diff --git a/qcsrc/client/wall.qc b/qcsrc/client/wall.qc index 92c1424356..7d79f77565 100644 --- a/qcsrc/client/wall.qc +++ b/qcsrc/client/wall.qc @@ -12,7 +12,7 @@ .vector movedir; void Ent_Wall_PreDraw() -{ +{SELFPARAM(); if (self.inactive) { self.alpha = 0; @@ -52,7 +52,7 @@ void Ent_Wall_PreDraw() } void Ent_Wall_Draw() -{ +{SELFPARAM(); float f; var .vector fld; @@ -110,14 +110,14 @@ void Ent_Wall_Draw() } void Ent_Wall_Remove() -{ +{SELFPARAM(); if(self.bgmscript) strunzone(self.bgmscript); self.bgmscript = string_null; } void Ent_Wall() -{ +{SELFPARAM(); int f; var .vector fld; diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 668228b649..7f13ab5dfe 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -18,19 +18,19 @@ .vector colormod; void SUB_Stop() -{ +{SELFPARAM(); self.move_velocity = self.move_avelocity = '0 0 0'; self.move_movetype = MOVETYPE_NONE; } void Projectile_ResetTrail(vector to) -{ +{SELFPARAM(); self.trail_oldorigin = to; self.trail_oldtime = time; } void Projectile_DrawTrail(vector to) -{ +{SELFPARAM(); vector from; float t0; @@ -52,7 +52,7 @@ void Projectile_DrawTrail(vector to) } void Projectile_Draw() -{ +{SELFPARAM(); vector rot; vector trailorigin; int f; @@ -166,7 +166,7 @@ void Projectile_Draw() } void loopsound(entity e, int ch, string samp, float vol, float attn) -{ +{SELFPARAM(); if(self.silent) return; @@ -175,7 +175,7 @@ void loopsound(entity e, int ch, string samp, float vol, float attn) } void Ent_RemoveProjectile() -{ +{SELFPARAM(); if(self.count & 0x80) { tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.05, MOVE_NORMAL, self); @@ -184,7 +184,7 @@ void Ent_RemoveProjectile() } void Ent_Projectile() -{ +{SELFPARAM(); int f; // projectile properties: diff --git a/qcsrc/common/buffs.qh b/qcsrc/common/buffs.qh index f1ef589eed..eeaba7371d 100644 --- a/qcsrc/common/buffs.qh +++ b/qcsrc/common/buffs.qh @@ -146,6 +146,7 @@ void buff_Init(entity ent); void buff_Init_Compat(entity ent, entity replacement); #define BUFF_SPAWNFUNC(e, b, t) void spawnfunc_item_buff_##e() { \ + SELFPARAM(); \ self.buffs = b.m_itemid; \ self.team = t; \ buff_Init(self); \ @@ -156,7 +157,7 @@ void buff_Init_Compat(entity ent, entity replacement); BUFF_SPAWNFUNC(e##_team2, b, NUM_TEAM_2) \ BUFF_SPAWNFUNC(e##_team3, b, NUM_TEAM_3) \ BUFF_SPAWNFUNC(e##_team4, b, NUM_TEAM_4) -#define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) void spawnfunc_item_##o() { buff_Init_Compat(self, r); } +#define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) void spawnfunc_item_##o() { SELFPARAM(); buff_Init_Compat(self, r); } BUFF_SPAWNFUNCS(resistance, BUFF_RESISTANCE) BUFF_SPAWNFUNCS(ammo, BUFF_AMMO) diff --git a/qcsrc/common/csqcmodel_settings.qh b/qcsrc/common/csqcmodel_settings.qh index e11604aae3..d356ff76d0 100644 --- a/qcsrc/common/csqcmodel_settings.qh +++ b/qcsrc/common/csqcmodel_settings.qh @@ -86,8 +86,8 @@ //vector PL_CROUCH_VIEW_OFS = ...; #ifdef SVQC -# define CSQCMODEL_AUTOINIT() CSQCModel_LinkEntity() -# define CSQCMODEL_AUTOUPDATE() CSQCModel_CheckUpdate() +# define CSQCMODEL_AUTOINIT(e) CSQCModel_LinkEntity(e) +# define CSQCMODEL_AUTOUPDATE(e) CSQCModel_CheckUpdate(e) #endif #define CSQCMODEL_EF_RESPAWNGHOST EF_SELECTABLE diff --git a/qcsrc/common/effects.qc b/qcsrc/common/effects.qc index e1707021ea..242145f0ba 100644 --- a/qcsrc/common/effects.qc +++ b/qcsrc/common/effects.qc @@ -39,7 +39,7 @@ void Read_Effect(bool is_new) #ifdef SVQC bool Net_Write_Effect(entity client, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_EFFECT); #if EFFECTS_COUNT >= 255 WriteShort(MSG_ENTITY, self.m_id); diff --git a/qcsrc/common/items/inventory.qh b/qcsrc/common/items/inventory.qh index 9b4013405d..2ec8837d48 100644 --- a/qcsrc/common/items/inventory.qh +++ b/qcsrc/common/items/inventory.qh @@ -41,7 +41,7 @@ void Inventory_Write(Inventory data) #ifdef SVQC bool Inventory_Send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_INVENTORY); entity e = self.owner; if (IS_SPEC(e)) e = e.enemy; diff --git a/qcsrc/common/minigames/cl_minigames.qc b/qcsrc/common/minigames/cl_minigames.qc index 3a1cc86744..83150d7d26 100644 --- a/qcsrc/common/minigames/cl_minigames.qc +++ b/qcsrc/common/minigames/cl_minigames.qc @@ -88,7 +88,7 @@ string minigame_texture(string name) #define MSLE_CLEAN_Vector2D(x) #define MSLE(Name,Fields) \ - void msle_entremove_##Name() { strunzone(self.netname); Fields } + void msle_entremove_##Name() { SELFPARAM(); strunzone(self.netname); Fields } MINIGAME_SIMPLELINKED_ENTITIES #undef MSLE #undef FIELD @@ -127,7 +127,7 @@ void deactivate_minigame() } void minigame_entremove() -{ +{SELFPARAM(); if ( self == active_minigame ) deactivate_minigame(); } @@ -169,7 +169,7 @@ void activate_minigame(entity minigame) } void minigame_player_entremove() -{ +{SELFPARAM(); if ( self.owner == active_minigame && self.minigame_playerslot == player_localentnum ) deactivate_minigame(); } @@ -190,7 +190,7 @@ string ReadString_Zoned() { return strzone(ReadString_Raw()); } Fields \ } void minigame_read_owner() -{ +{SELFPARAM(); string owner_name = ReadString_Raw(); self.owner = world; do @@ -200,7 +200,7 @@ void minigame_read_owner() LOG_TRACE("Got a minigame entity without a minigame!\n"); } void ent_read_minigame() -{ +{SELFPARAM(); float sf = ReadByte(); if ( sf & MINIG_SF_CREATE ) { diff --git a/qcsrc/common/minigames/cl_minigames_hud.qc b/qcsrc/common/minigames/cl_minigames_hud.qc index b7b7df128a..9ad706d1e9 100644 --- a/qcsrc/common/minigames/cl_minigames_hud.qc +++ b/qcsrc/common/minigames/cl_minigames_hud.qc @@ -104,7 +104,7 @@ entity HUD_MinigameMenu_activeitem; // Click the given item void HUD_MinigameMenu_Click(entity menuitem) -{ +{SELFPARAM(); if ( menuitem ) { entity e = self; @@ -167,14 +167,14 @@ entity HUD_MinigameMenu_SpawnSubEntry(string s, void() click, entity parent) // Click action for Create sub-entries void HUD_MinigameMenu_ClickCreate_Entry() -{ +{SELFPARAM(); minigame_cmd("create ",self.netname); } // Helper click action for collapsible entries // returns true when you have to create the sub-entries bool HUD_MinigameMenu_Click_ExpandCollapse() -{ +{SELFPARAM(); entity e; if ( self.flags & 2 ) { @@ -211,7 +211,7 @@ bool HUD_MinigameMenu_Click_ExpandCollapse() // Click action for the Create menu void HUD_MinigameMenu_ClickCreate() -{ +{SELFPARAM(); if ( HUD_MinigameMenu_Click_ExpandCollapse() ) { entity e; @@ -231,14 +231,14 @@ void HUD_MinigameMenu_ClickCreate() // Click action for Join sub-entries void HUD_MinigameMenu_ClickJoin_Entry() -{ +{SELFPARAM(); minigame_cmd("join ",self.netname); HUD_MinigameMenu_EraseEntry(self); } // Click action for the Join menu void HUD_MinigameMenu_ClickJoin() -{ +{SELFPARAM(); if ( HUD_MinigameMenu_Click_ExpandCollapse() ) { entity e = world; @@ -274,13 +274,13 @@ void HUD_MinigameMenu_ClickQuit() // Click action for Invite sub-entries void HUD_MinigameMenu_ClickInvite_Entry() -{ +{SELFPARAM(); minigame_cmd("invite #",self.netname); } // Click action for the Invite menu void HUD_MinigameMenu_ClickInvite() -{ +{SELFPARAM(); if ( HUD_MinigameMenu_Click_ExpandCollapse() ) { entity e; @@ -304,7 +304,7 @@ void HUD_MinigameMenu_ClickInvite() } void HUD_MinigameMenu_ClickCustomEntry() -{ +{SELFPARAM(); if ( active_minigame ) active_minigame.minigame_event(active_minigame,"menu_click",self.netname); } @@ -321,7 +321,7 @@ void HUD_MinigameMenu_CustomEntry(entity parent, string menumessage, string even // Click action for the Current Game menu void HUD_MinigameMenu_ClickCurrentGame() -{ +{SELFPARAM(); if ( HUD_MinigameMenu_Click_ExpandCollapse() ) { HUD_MinigameMenu_InsertEntry( HUD_MinigameMenu_SpawnSubEntry( diff --git a/qcsrc/common/minigames/minigame/nmm.qc b/qcsrc/common/minigames/minigame/nmm.qc index b7ad467b8c..5b9dd1ffe6 100644 --- a/qcsrc/common/minigames/minigame/nmm.qc +++ b/qcsrc/common/minigames/minigame/nmm.qc @@ -617,7 +617,7 @@ string nmm_turn_to_string(int turnflags) // Required function, handle client events int nmm_client_event(entity minigame, string event, ...) -{ +{SELFPARAM(); if ( event == "activate" ) { nmm_fromtile = world; diff --git a/qcsrc/common/minigames/minigame/pong.qc b/qcsrc/common/minigames/minigame/pong.qc index 6aca04cf95..0049fc93f9 100644 --- a/qcsrc/common/minigames/minigame/pong.qc +++ b/qcsrc/common/minigames/minigame/pong.qc @@ -53,7 +53,7 @@ void pong_ball_throw(entity ball) // Think equivalent of pong_ball_throw, used to delay throws void pong_ball_throwthink() -{ +{SELFPARAM(); pong_ball_throw(self); } @@ -144,7 +144,7 @@ bool pong_goal(entity ball, int pteam) // Moves the ball around void pong_ball_think() -{ +{SELFPARAM(); float think_speed = autocvar_sys_ticrate; self.nextthink = time + think_speed; @@ -200,7 +200,7 @@ void pong_ball_think() // AI action void pong_ai_think() -{ +{SELFPARAM(); float think_speed = autocvar_sv_minigames_pong_ai_thinkspeed; self.nextthink = time + think_speed; @@ -265,7 +265,7 @@ entity pong_ai_spawn(entity paddle) // Moves the paddle void pong_paddle_think() -{ +{SELFPARAM(); float think_speed = autocvar_sys_ticrate; self.nextthink = time + think_speed; diff --git a/qcsrc/common/minigames/sv_minigames.qc b/qcsrc/common/minigames/sv_minigames.qc index feb4b02944..db4209d927 100644 --- a/qcsrc/common/minigames/sv_minigames.qc +++ b/qcsrc/common/minigames/sv_minigames.qc @@ -61,7 +61,7 @@ void minigame_rmplayer(entity minigame_session, entity player) // Send an entity to a client // only use on minigame entities or entities with a minigame owner bool minigame_SendEntity(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_MINIGAME); WriteByte(MSG_ENTITY, sf); @@ -115,7 +115,7 @@ void minigame_resend(entity minigame) } bool minigame_CheckSend() -{ +{SELFPARAM(); entity e; for ( e = self.owner.minigame_players; e != world; e = e.list_next ) if ( e.minigame_players == other ) @@ -124,7 +124,7 @@ bool minigame_CheckSend() } int minigame_addplayer(entity minigame_session, entity player) -{ +{SELFPARAM(); if ( player.active_minigame ) { if ( player.active_minigame == minigame_session ) @@ -317,7 +317,7 @@ entity minigame_find_player(entity client) } bool MinigameImpulse(int imp) -{ +{SELFPARAM(); entity e = minigame_find_player(self); if ( imp && self.active_minigame && e ) { @@ -329,7 +329,7 @@ bool MinigameImpulse(int imp) void ClientCommand_minigame(int request, int argc, string command) -{ +{SELFPARAM(); if ( !autocvar_sv_minigames ) { sprint(self,"Minigames are not enabled!\n"); diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index 8f92d693a6..8e26b9c1f3 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -62,7 +62,7 @@ void() M_Mage_Defend_Shield; .float mage_shield_time; float M_Mage_Defend_Heal_Check(entity e) -{ +{SELFPARAM(); if(e == world) return false; if(e.health <= 0) @@ -88,7 +88,7 @@ float M_Mage_Defend_Heal_Check(entity e) } void M_Mage_Attack_Spike_Explode() -{ +{SELFPARAM(); self.event_damage = func_null; sound(self, CH_SHOTS, W_Sound("grenade_impact"), VOL_BASE, ATTEN_NORM); @@ -110,7 +110,7 @@ void M_Mage_Attack_Spike_Touch() // copied from W_Seeker_Think void M_Mage_Attack_Spike_Think() -{ +{SELFPARAM(); entity e; vector desireddir, olddir, newdir, eorg; float turnrate; @@ -173,7 +173,7 @@ void M_Mage_Attack_Spike_Think() } void M_Mage_Attack_Spike() -{ +{SELFPARAM(); entity missile; vector dir = normalize((self.enemy.origin + '0 0 10') - self.origin); @@ -200,7 +200,7 @@ void M_Mage_Attack_Spike() } void M_Mage_Defend_Heal() -{ +{SELFPARAM(); entity head; float washealed = false; @@ -257,7 +257,7 @@ void M_Mage_Defend_Heal() } void M_Mage_Attack_Push() -{ +{SELFPARAM(); sound(self, CH_SHOTS, W_Sound("tagexp1"), 1, ATTEN_NORM); RadiusDamage (self, self, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), world, world, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE, self.enemy); Send_Effect(EFFECT_TE_EXPLOSION, self.origin, '0 0 0', 1); @@ -267,7 +267,7 @@ void M_Mage_Attack_Push() } void M_Mage_Attack_Teleport() -{ +{SELFPARAM(); if(vlen(self.enemy.origin - self.origin) >= 500) return; @@ -284,13 +284,13 @@ void M_Mage_Attack_Teleport() } void M_Mage_Defend_Shield_Remove() -{ +{SELFPARAM(); self.effects &= ~(EF_ADDITIVE | EF_BLUE); self.armorvalue = autocvar_g_monsters_armor_blockpercent; } void M_Mage_Defend_Shield() -{ +{SELFPARAM(); self.effects |= (EF_ADDITIVE | EF_BLUE); self.mage_shield_delay = time + (autocvar_g_monster_mage_shield_delay); self.armorvalue = (autocvar_g_monster_mage_shield_blockpercent); @@ -301,7 +301,7 @@ void M_Mage_Defend_Shield() } float M_Mage_Attack(float attack_type) -{ +{SELFPARAM(); switch(attack_type) { case MONSTER_ATTACK_MELEE: @@ -348,7 +348,7 @@ void spawnfunc_monster_mage() { Monster_Spawn(MON_MAGE.monsterid); } #endif // SVQC bool M_Mage(int req) -{ +{SELFPARAM(); switch(req) { #ifdef SVQC diff --git a/qcsrc/common/monsters/monster/shambler.qc b/qcsrc/common/monsters/monster/shambler.qc index 4640fe945b..0a77342f62 100644 --- a/qcsrc/common/monsters/monster/shambler.qc +++ b/qcsrc/common/monsters/monster/shambler.qc @@ -47,7 +47,7 @@ const float shambler_anim_death = 8; .float shambler_lastattack; // delay attacks separately void M_Shambler_Attack_Smash() -{ +{SELFPARAM(); makevectors(self.angles); Send_Effect(EFFECT_EXPLOSION_MEDIUM, (self.origin + (v_forward * 150)) - ('0 0 1' * self.maxs.z), '0 0 0', 1); sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); @@ -61,7 +61,7 @@ void M_Shambler_Attack_Smash() } void M_Shambler_Attack_Swing() -{ +{SELFPARAM(); float r = (random() < 0.5); if(r && Monster_Attack_Melee(self.enemy, (autocvar_g_monster_shambler_attack_claw_damage), ((r) ? self.anim_melee2 : self.anim_melee3), self.attack_range, 0.8, DEATH_MONSTER_SHAMBLER_CLAW, true)) { @@ -72,7 +72,7 @@ void M_Shambler_Attack_Swing() } void M_Shambler_Attack_Lightning_Explode() -{ +{SELFPARAM(); entity head; sound(self, CH_SHOTS, W_Sound("electro_impact"), VOL_BASE, ATTEN_NORM); @@ -99,7 +99,7 @@ void M_Shambler_Attack_Lightning_Explode() } void M_Shambler_Attack_Lightning_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if (self.health <= 0) return; @@ -113,14 +113,14 @@ void M_Shambler_Attack_Lightning_Damage(entity inflictor, entity attacker, float } void M_Shambler_Attack_Lightning_Touch() -{ +{SELFPARAM(); PROJECTILE_TOUCH; self.use (); } void M_Shambler_Attack_Lightning_Think() -{ +{SELFPARAM(); self.nextthink = time; if (time > self.cnt) { @@ -131,7 +131,7 @@ void M_Shambler_Attack_Lightning_Think() } void M_Shambler_Attack_Lightning() -{ +{SELFPARAM(); entity gren; monster_makevectors(self.enemy); @@ -169,7 +169,7 @@ void M_Shambler_Attack_Lightning() } float M_Shambler_Attack(float attack_type) -{ +{SELFPARAM(); switch(attack_type) { case MONSTER_ATTACK_MELEE: @@ -215,7 +215,7 @@ void spawnfunc_monster_shambler() { Monster_Spawn(MON_SHAMBLER.monsterid); } #endif // SVQC bool M_Shambler(int req) -{ +{SELFPARAM(); switch(req) { #ifdef SVQC diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 0179c66b9a..7c9d31b2f7 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -38,7 +38,7 @@ const float spider_anim_attack2 = 3; .float spider_web_delay; void M_Spider_Attack_Web_Explode() -{ +{SELFPARAM(); entity e; if(self) { @@ -60,7 +60,7 @@ void M_Spider_Attack_Web_Touch() } void M_Spider_Attack_Web() -{ +{SELFPARAM(); monster_makevectors(self.enemy); sound(self, CH_SHOTS, W_Sound("electro_fire2"), VOL_BASE, ATTEN_NORM); @@ -98,7 +98,7 @@ void M_Spider_Attack_Web() } bool M_Spider_Attack(int attack_type) -{ +{SELFPARAM(); switch(attack_type) { case MONSTER_ATTACK_MELEE: @@ -128,7 +128,7 @@ void spawnfunc_monster_spider() { Monster_Spawn(MON_SPIDER.monsterid); } #endif // SVQC bool M_Spider(int req) -{ +{SELFPARAM(); switch(req) { #ifdef SVQC diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index 9bdc4c63af..f1160fb52e 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -37,7 +37,7 @@ const float wyvern_anim_death = 4; */ void M_Wyvern_Attack_Fireball_Explode() -{ +{SELFPARAM(); entity e; if(self) { @@ -60,7 +60,7 @@ void M_Wyvern_Attack_Fireball_Touch() } void M_Wyvern_Attack_Fireball() -{ +{SELFPARAM(); entity missile = spawn(); vector dir = normalize((self.enemy.origin + '0 0 10') - self.origin); @@ -83,7 +83,7 @@ void M_Wyvern_Attack_Fireball() } float M_Wyvern_Attack(float attack_type) -{ +{SELFPARAM(); switch(attack_type) { case MONSTER_ATTACK_MELEE: @@ -105,7 +105,7 @@ void spawnfunc_monster_wyvern() { Monster_Spawn(MON_WYVERN.monsterid); } #endif // SVQC bool M_Wyvern(int req) -{ +{SELFPARAM(); switch(req) { #ifdef SVQC diff --git a/qcsrc/common/monsters/monster/zombie.qc b/qcsrc/common/monsters/monster/zombie.qc index 780cf74b38..fe7c384ca9 100644 --- a/qcsrc/common/monsters/monster/zombie.qc +++ b/qcsrc/common/monsters/monster/zombie.qc @@ -63,7 +63,7 @@ const float zombie_anim_spawn = 30; */ void M_Zombie_Attack_Leap_Touch() -{ +{SELFPARAM(); if (self.health <= 0) return; @@ -86,7 +86,7 @@ void M_Zombie_Attack_Leap_Touch() } void M_Zombie_Defend_Block_End() -{ +{SELFPARAM(); if(self.health <= 0) return; @@ -95,7 +95,7 @@ void M_Zombie_Defend_Block_End() } float M_Zombie_Defend_Block() -{ +{SELFPARAM(); self.armorvalue = 0.9; self.state = MONSTER_ATTACK_MELEE; // freeze monster self.attack_finished_single = time + 2.1; @@ -108,7 +108,7 @@ float M_Zombie_Defend_Block() } float M_Zombie_Attack(float attack_type) -{ +{SELFPARAM(); switch(attack_type) { case MONSTER_ATTACK_MELEE: @@ -142,7 +142,7 @@ void spawnfunc_monster_zombie() { Monster_Spawn(MON_ZOMBIE.monsterid); } #endif // SVQC bool M_Zombie(int req) -{ +{SELFPARAM(); switch(req) { #ifdef SVQC diff --git a/qcsrc/common/monsters/spawn.qc b/qcsrc/common/monsters/spawn.qc index 4a84f94358..2ed974b28e 100644 --- a/qcsrc/common/monsters/spawn.qc +++ b/qcsrc/common/monsters/spawn.qc @@ -10,7 +10,7 @@ #include "../../server/defs.qh" #endif entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag) -{ +{SELFPARAM(); float i; entity e = spawn(); diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index d0b39828d1..17bb1baf48 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -27,13 +27,13 @@ #endif void monsters_setstatus() -{ +{SELFPARAM(); self.stat_monsters_total = monsters_total; self.stat_monsters_killed = monsters_killed; } void monster_dropitem() -{ +{SELFPARAM(); if(!self.candrop || !self.monster_loot) return; @@ -63,7 +63,7 @@ void monster_dropitem() } void monster_makevectors(entity e) -{ +{SELFPARAM(); if(IS_MONSTER(self)) { vector v; @@ -81,7 +81,7 @@ void monster_makevectors(entity e) // =============== bool Monster_ValidTarget(entity mon, entity player) -{ +{SELFPARAM(); // ensure we're not checking nonexistent monster/target if(!mon || !player) { return false; } @@ -196,7 +196,7 @@ void monster_changeteam(entity ent, float newteam) } void Monster_Delay_Action() -{ +{SELFPARAM(); entity oldself = self; self = self.owner; if(Monster_ValidTarget(self, self.enemy)) { oldself.use(); } @@ -215,7 +215,7 @@ void Monster_Delay_Action() } void Monster_Delay(float repeat_count, float repeat_defer, float defer_amnt, void() func) -{ +{SELFPARAM(); // deferred attacking, checks if monster is still alive and target is still valid before attacking entity e = spawn(); @@ -266,7 +266,7 @@ void Monster_Sound_Precache(string f) } void Monster_Sounds_Precache() -{ +{SELFPARAM(); string m = (get_monsterinfo(self.monsterid)).model; float globhandle, n, i; string f; @@ -285,7 +285,7 @@ void Monster_Sounds_Precache() } void Monster_Sounds_Clear() -{ +{SELFPARAM(); #define _MSOUND(m) if(self.monstersound_##m) { strunzone(self.monstersound_##m); self.monstersound_##m = string_null; } ALLMONSTERSOUNDS #undef _MSOUND @@ -305,7 +305,7 @@ void Monster_Sounds_Clear() } bool Monster_Sounds_Load(string f, int first) -{ +{SELFPARAM(); float fh; string s; var .string field; @@ -332,7 +332,7 @@ bool Monster_Sounds_Load(string f, int first) .int skin_for_monstersound; void Monster_Sounds_Update() -{ +{SELFPARAM(); if(self.skin == self.skin_for_monstersound) { return; } self.skin_for_monstersound = self.skin; @@ -342,7 +342,7 @@ void Monster_Sounds_Update() } void Monster_Sound(.string samplefield, float sound_delay, float delaytoo, float chan) -{ +{SELFPARAM(); if(!autocvar_g_monsters_sounds) { return; } if(delaytoo) @@ -359,7 +359,7 @@ void Monster_Sound(.string samplefield, float sound_delay, float delaytoo, float // ======================= float Monster_Attack_Melee(entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop) -{ +{SELFPARAM(); if(dostop && (self.flags & FL_MONSTER)) { self.state = MONSTER_ATTACK_MELEE; } setanim(self, anim, false, true, false); @@ -380,7 +380,7 @@ float Monster_Attack_Melee(entity targ, float damg, vector anim, float er, float } float Monster_Attack_Leap_Check(vector vel) -{ +{SELFPARAM(); if(self.state && (self.flags & FL_MONSTER)) return false; // already attacking if(!(self.flags & FL_ONGROUND)) @@ -402,7 +402,7 @@ float Monster_Attack_Leap_Check(vector vel) } bool Monster_Attack_Leap(vector anm, void() touchfunc, vector vel, float animtime) -{ +{SELFPARAM(); if(!Monster_Attack_Leap_Check(vel)) return false; @@ -457,7 +457,7 @@ void Monster_Attack_Check(entity e, entity targ) // ====================== void Monster_UpdateModel() -{ +{SELFPARAM(); // assume some defaults /*self.anim_idle = animfixfps(self, '0 1 0.01', '0 0 0'); self.anim_walk = animfixfps(self, '1 1 0.01', '0 0 0'); @@ -475,7 +475,7 @@ void Monster_UpdateModel() } void Monster_Touch() -{ +{SELFPARAM(); if(other == world) { return; } if(other.monster_attack) @@ -486,7 +486,7 @@ void Monster_Touch() } void Monster_Miniboss_Check() -{ +{SELFPARAM(); if(MUTATOR_CALLHOOK(MonsterCheckBossFlag)) return; @@ -503,7 +503,7 @@ void Monster_Miniboss_Check() } bool Monster_Respawn_Check() -{ +{SELFPARAM(); if(self.deadflag == DEAD_DEAD) // don't call when monster isn't dead if(MUTATOR_CALLHOOK(MonsterRespawn, self)) return true; // enabled by a mutator @@ -517,10 +517,10 @@ bool Monster_Respawn_Check() return true; } -void Monster_Respawn() { Monster_Spawn(self.monsterid); } +void Monster_Respawn() { SELFPARAM(); Monster_Spawn(self.monsterid); } void Monster_Dead_Fade() -{ +{SELFPARAM(); if(Monster_Respawn_Check()) { self.spawnflags |= MONSTERFLAG_RESPAWNED; @@ -550,12 +550,12 @@ void Monster_Dead_Fade() } void Monster_Use() -{ +{SELFPARAM(); if(Monster_ValidTarget(self, activator)) { self.enemy = activator; } } vector Monster_Move_Target(entity targ) -{ +{SELFPARAM(); // enemy is always preferred target if(self.enemy) { @@ -664,7 +664,7 @@ vector Monster_Move_Target(entity targ) } void Monster_CalculateVelocity(entity mon, vector to, vector from, float turnrate, float movespeed) -{ +{SELFPARAM(); float current_distance = vlen((('1 0 0' * to.x) + ('0 1 0' * to.y)) - (('1 0 0' * from.x) + ('0 1 0' * from.y))); // for the sake of this check, exclude Z axis float initial_height = 0; //min(50, (targ_distance * tanh(20))); float current_height = (initial_height * min(1, (self.pass_distance) ? (current_distance / self.pass_distance) : current_distance)); @@ -698,7 +698,7 @@ void Monster_CalculateVelocity(entity mon, vector to, vector from, float turnrat } void Monster_Move(float runspeed, float walkspeed, float stpspeed) -{ +{SELFPARAM(); if(self.target2) { self.goalentity = find(world, targetname, self.target2); } entity targ; @@ -924,7 +924,7 @@ void Monster_Remove(entity mon) } void Monster_Dead_Think() -{ +{SELFPARAM(); self.nextthink = time + self.ticrate; if(self.monster_lifetime != 0) @@ -936,7 +936,7 @@ void Monster_Dead_Think() } void Monster_Appear() -{ +{SELFPARAM(); self.enemy = activator; self.spawnflags &= ~MONSTERFLAG_APPEAR; // otherwise, we get an endless loop Monster_Spawn(self.monsterid); @@ -957,7 +957,7 @@ float Monster_Appear_Check(entity ent, float monster_id) } void Monster_Reset() -{ +{SELFPARAM(); setorigin(self, self.pos1); self.angles = self.pos2; @@ -972,7 +972,7 @@ void Monster_Reset() } void Monster_Dead_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); self.health -= damage; Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker); @@ -991,7 +991,7 @@ void Monster_Dead_Damage(entity inflictor, entity attacker, float damage, int de } void Monster_Dead(entity attacker, float gibbed) -{ +{SELFPARAM(); self.think = Monster_Dead_Think; self.nextthink = time; self.monster_lifetime = time + 5; @@ -1044,7 +1044,7 @@ void Monster_Dead(entity attacker, float gibbed) } void Monster_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if((self.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL) return; @@ -1128,7 +1128,7 @@ void Monster_Damage(entity inflictor, entity attacker, float damage, int deathty // don't check for enemies, just keep walking in a straight line void Monster_Move_2D(float mspeed, float allow_jumpoff) -{ +{SELFPARAM(); if(gameover || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || self.draggedby != world || time < game_starttime || (autocvar_g_campaign && !campaign_bots_may_start) || time < self.spawn_time) { mspeed = 0; @@ -1183,7 +1183,7 @@ void Monster_Move_2D(float mspeed, float allow_jumpoff) } void Monster_Anim() -{ +{SELFPARAM(); int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2)); if(self.deadflag) { @@ -1220,7 +1220,7 @@ void Monster_Anim() } void Monster_Think() -{ +{SELFPARAM(); self.think = Monster_Think; self.nextthink = self.ticrate; @@ -1236,11 +1236,11 @@ void Monster_Think() Monster_Anim(); - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } float Monster_Spawn_Setup() -{ +{SELFPARAM(); MON_ACTION(self.monsterid, MR_SETUP); // ensure some basic needs are met @@ -1300,7 +1300,7 @@ float Monster_Spawn_Setup() } bool Monster_Spawn(int mon_id) -{ +{SELFPARAM(); // setup the basic required properties for a monster entity mon = get_monsterinfo(mon_id); if(!mon.monsterid) { return false; } // invalid monster @@ -1400,7 +1400,7 @@ bool Monster_Spawn(int mon_id) if(!(self.spawnflags & MONSTERFLAG_RESPAWNED)) monster_setupcolors(self); - CSQCMODEL_AUTOINIT(); + CSQCMODEL_AUTOINIT(self); return true; } diff --git a/qcsrc/common/movetypes/follow.qc b/qcsrc/common/movetypes/follow.qc index 6cf28d6f17..b636772687 100644 --- a/qcsrc/common/movetypes/follow.qc +++ b/qcsrc/common/movetypes/follow.qc @@ -1,5 +1,5 @@ void _Movetype_Physics_Follow() // SV_Physics_Follow -{ +{SELFPARAM(); entity e = self.move_aiment; // TODO: networking? // LordHavoc: implemented rotation on MOVETYPE_FOLLOW objects diff --git a/qcsrc/common/movetypes/movetypes.qc b/qcsrc/common/movetypes/movetypes.qc index e92e81a0da..74716dd9a0 100644 --- a/qcsrc/common/movetypes/movetypes.qc +++ b/qcsrc/common/movetypes/movetypes.qc @@ -33,7 +33,7 @@ void _Movetype_WallFriction(vector stepnormal) // SV_WallFriction vector planes[MAX_CLIP_PLANES]; int _Movetype_FlyMove(float dt, bool applygravity, vector stepnormal, float stepheight) // SV_FlyMove -{ +{SELFPARAM(); int blocked = 0, bumpcount; int i, j, numplanes = 0; float time_left = dt, grav = 0; @@ -321,7 +321,7 @@ void _Movetype_CheckWaterTransition(entity ent) // SV_CheckWaterTransition } void _Movetype_Impact(entity oth) // SV_Impact -{ +{SELFPARAM(); entity oldself = self; entity oldother = other; @@ -347,7 +347,7 @@ void _Movetype_Impact(entity oth) // SV_Impact } void _Movetype_LinkEdict_TouchAreaGrid() // SV_LinkEdict_TouchAreaGrid -{ +{SELFPARAM(); entity oldself = self; entity oldother = other; @@ -377,7 +377,7 @@ void _Movetype_LinkEdict_TouchAreaGrid() // SV_LinkEdict_TouchAreaGrid } void _Movetype_LinkEdict(bool touch_triggers) // SV_LinkEdict -{ +{SELFPARAM(); vector mi, ma; if(self.solid == SOLID_BSP) { @@ -420,7 +420,7 @@ void _Movetype_LinkEdict(bool touch_triggers) // SV_LinkEdict } bool _Movetype_TestEntityPosition(vector ofs) // SV_TestEntityPosition -{ +{SELFPARAM(); // vector org = self.move_origin + ofs; int cont = self.dphitcontentsmask; @@ -437,7 +437,7 @@ bool _Movetype_TestEntityPosition(vector ofs) // SV_TestEntityPosition } bool _Movetype_UnstickEntity() // SV_UnstickEntity -{ +{SELFPARAM(); if(!_Movetype_TestEntityPosition('0 0 0')) return true; if(!_Movetype_TestEntityPosition('-1 0 0')) goto success; if(!_Movetype_TestEntityPosition('1 0 0')) goto success; @@ -474,7 +474,7 @@ vector _Movetype_ClipVelocity(vector vel, vector norm, float f) // SV_ClipVeloc } void _Movetype_PushEntityTrace(vector push) -{ +{SELFPARAM(); vector end = self.move_origin + push; int type; if(self.move_nomonsters) @@ -490,7 +490,7 @@ void _Movetype_PushEntityTrace(vector push) } float _Movetype_PushEntity(vector push, bool failonstartsolid) // SV_PushEntity -{ +{SELFPARAM(); _Movetype_PushEntityTrace(push); if(trace_startsolid && failonstartsolid) @@ -564,7 +564,7 @@ void makevectors_matrix(vector myangles) // AngleVectorsFLU } void _Movetype_Physics_Frame(float movedt) -{ +{SELFPARAM(); self.move_didgravity = -1; switch (self.move_movetype) { @@ -600,7 +600,7 @@ void _Movetype_Physics_Frame(float movedt) } void Movetype_Physics_NoMatchServer() // optimized -{ +{SELFPARAM(); float movedt = time - self.move_time; self.move_time = time; @@ -620,7 +620,7 @@ void Movetype_Physics_MatchServer(bool sloppy) } void Movetype_Physics_MatchTicrate(float tr, bool sloppy) // SV_Physics_Entity -{ +{SELFPARAM(); if(tr <= 0) { Movetype_Physics_NoMatchServer(); diff --git a/qcsrc/common/movetypes/push.qc b/qcsrc/common/movetypes/push.qc index 954033edbe..506edb5b64 100644 --- a/qcsrc/common/movetypes/push.qc +++ b/qcsrc/common/movetypes/push.qc @@ -1,5 +1,5 @@ void _Movetype_PushMove(float dt) // SV_PushMove -{ +{SELFPARAM(); if (self.move_velocity == '0 0 0' && self.move_avelocity == '0 0 0') { self.move_ltime += dt; @@ -131,7 +131,7 @@ void _Movetype_PushMove(float dt) // SV_PushMove } void _Movetype_Physics_Pusher(float dt) // SV_Physics_Pusher -{ +{SELFPARAM(); float oldltime = self.move_ltime; float thinktime = self.move_nextthink; float movetime; diff --git a/qcsrc/common/movetypes/step.qc b/qcsrc/common/movetypes/step.qc index 822bf09351..f4884ba27a 100644 --- a/qcsrc/common/movetypes/step.qc +++ b/qcsrc/common/movetypes/step.qc @@ -1,5 +1,5 @@ void _Movetype_Physics_Step(float dt) // SV_Physics_Step -{ +{SELFPARAM(); if(self.move_flags & FL_ONGROUND) { if(self.velocity_z >= (1.0 / 32.0) && UPWARD_VELOCITY_CLEARS_ONGROUND) diff --git a/qcsrc/common/movetypes/toss.qc b/qcsrc/common/movetypes/toss.qc index 6ed0407eb3..32ce9ca312 100644 --- a/qcsrc/common/movetypes/toss.qc +++ b/qcsrc/common/movetypes/toss.qc @@ -1,7 +1,7 @@ #include "../physics.qh" void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss -{ +{SELFPARAM(); if (self.move_flags & FL_ONGROUND) { if (self.move_velocity.z >= 1 / 32) diff --git a/qcsrc/common/movetypes/walk.qc b/qcsrc/common/movetypes/walk.qc index 180dfcc7fb..fa376277c8 100644 --- a/qcsrc/common/movetypes/walk.qc +++ b/qcsrc/common/movetypes/walk.qc @@ -1,5 +1,5 @@ void _Movetype_Physics_Walk(float dt) // SV_WalkMove -{ +{SELFPARAM(); vector stepnormal = '0 0 0'; // if frametime is 0 (due to client sending the same timestamp twice), don't move diff --git a/qcsrc/common/mutators/mutator/casings.qc b/qcsrc/common/mutators/mutator/casings.qc index a9a86f81f1..e93ed49a4b 100644 --- a/qcsrc/common/mutators/mutator/casings.qc +++ b/qcsrc/common/mutators/mutator/casings.qc @@ -9,7 +9,7 @@ REGISTER_MUTATOR(casings, true); #ifdef SVQC void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner) -{ +{SELFPARAM(); vector org = self.origin + self.view_ofs + self.weaponentity.spawnorigin.x * v_forward - self.weaponentity.spawnorigin.y * v_right + self.weaponentity.spawnorigin.z * v_up; if (!sound_allowed(MSG_BROADCAST, casingowner)) @@ -36,12 +36,12 @@ class(Casing) .int state; class(Casing) .float cnt; void Casing_Delete() -{ +{SELFPARAM(); remove(self); } void Casing_Draw() -{ +{SELFPARAM(); if (self.move_flags & FL_ONGROUND) { self.move_angles_x = 0; @@ -64,7 +64,7 @@ void Casing_Draw() } void Casing_Touch() -{ +{SELFPARAM(); if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) { Casing_Delete(); @@ -100,7 +100,7 @@ void Casing_Touch() } void Casing_Damage(float thisdmg, int hittype, vector org, vector thisforce) -{ +{SELFPARAM(); if (thisforce.z < 0) thisforce.z = 0; self.move_velocity = self.move_velocity + thisforce + '0 0 100'; diff --git a/qcsrc/common/mutators/mutator/damagetext.qc b/qcsrc/common/mutators/mutator/damagetext.qc index eec2d356b0..8d21f17057 100644 --- a/qcsrc/common/mutators/mutator/damagetext.qc +++ b/qcsrc/common/mutators/mutator/damagetext.qc @@ -25,7 +25,7 @@ CLASS(DamageText, Object) ATTRIB(DamageText, time_prev, float, time) void DamageText_draw() { - entity this = self; + SELFPARAM(); float dt = time - this.time_prev; this.time_prev = time; setorigin(this, this.origin + dt * this.velocity); diff --git a/qcsrc/common/mutators/mutator/itemstime.qc b/qcsrc/common/mutators/mutator/itemstime.qc index c3a025080d..ad6228d77c 100644 --- a/qcsrc/common/mutators/mutator/itemstime.qc +++ b/qcsrc/common/mutators/mutator/itemstime.qc @@ -149,7 +149,8 @@ float Item_ItemsTime_UpdateTime(entity e, float t) return t; } -MUTATOR_HOOKFUNCTION(itemstime, reset_map_global) { +MUTATOR_HOOKFUNCTION(itemstime, reset_map_global) +{SELFPARAM(); Item_ItemsTime_ResetTimes(); // ALL the times need to be reset before .reset()ing each item // since Item_Reset schedules respawn of superweapons and powerups @@ -162,11 +163,13 @@ MUTATOR_HOOKFUNCTION(itemstime, reset_map_global) { Item_ItemsTime_SetTimesForAllPlayers(); } -MUTATOR_HOOKFUNCTION(itemstime, MakePlayerObserver) { +MUTATOR_HOOKFUNCTION(itemstime, MakePlayerObserver) +{SELFPARAM(); Item_ItemsTime_SetTimesForPlayer(self); } -MUTATOR_HOOKFUNCTION(itemstime, PlayerSpawn) { +MUTATOR_HOOKFUNCTION(itemstime, PlayerSpawn) +{SELFPARAM(); if (warmup_stage) return; Item_ItemsTime_ResetTimesForPlayer(self); } diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 8673b96b35..c1bb62da15 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -5,7 +5,7 @@ REGISTER_MUTATOR(waypointsprites, true); #ifdef SVQC /** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */ float WaypointSprite_SendEntity(entity to, float sendflags) -{ +{SELFPARAM(); WriteMutator(MSG_ENTITY, waypointsprites); sendflags = sendflags & 0x7F; @@ -118,7 +118,7 @@ MUTATOR_HOOKFUNCTION(waypointsprites, CSQC_Ent_Update) { } void Ent_RemoveWaypointSprite() -{ +{SELFPARAM(); if (self.netname) strunzone(self.netname); if (self.netname2) strunzone(self.netname2); if (self.netname3) strunzone(self.netname3); @@ -126,7 +126,7 @@ void Ent_RemoveWaypointSprite() /** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */ void Ent_WaypointSprite() -{ +{SELFPARAM(); int sendflags = ReadByte(); self.wp_extra = ReadByte(); @@ -232,7 +232,7 @@ void Ent_WaypointSprite() #ifdef CSQC float spritelookupblinkvalue(string s) -{ +{SELFPARAM(); if (s == WP_Weapon.netname) { if (get_weaponinfo(self.wp_extra).spawnflags & WEP_FLAG_SUPERWEAPON) return 2; @@ -249,7 +249,7 @@ float spritelookupblinkvalue(string s) } vector spritelookupcolor(string s, vector def) -{ +{SELFPARAM(); if (s == WP_Weapon.netname) return get_weaponinfo(self.wp_extra).wpcolor; if (s == WP_Item.netname) return ITEMS[self.wp_extra].m_color; if (s == WP_Buff.netname) return BUFFS[self.wp_extra].m_color; @@ -257,7 +257,7 @@ vector spritelookupcolor(string s, vector def) } string spritelookuptext(string s) -{ +{SELFPARAM(); if (s == WP_RaceStartFinish.netname) return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start"); if (s == WP_Weapon.netname) return get_weaponinfo(self.wp_extra).message; if (s == WP_Item.netname) return ITEMS[self.wp_extra].m_waypoint; @@ -468,7 +468,7 @@ vector fixrgbexcess(vector rgb) } void Draw_WaypointSprite() -{ +{SELFPARAM(); if (self.lifetime) self.alpha = pow(bound(0, (self.fadetime - time) / self.lifetime, 1), waypointsprite_timealphaexponent); else @@ -924,7 +924,7 @@ void WaypointSprite_Disown(entity wp, float fadetime) } void WaypointSprite_Think() -{ +{SELFPARAM(); bool doremove = false; if (self.fade_time && time >= self.teleport_time) @@ -942,7 +942,7 @@ void WaypointSprite_Think() } float WaypointSprite_visible_for_player(entity e) -{ +{SELFPARAM(); // personal waypoints if (self.enemy && self.enemy != e) return false; @@ -984,7 +984,7 @@ float WaypointSprite_isteammate(entity e, entity e2) } float WaypointSprite_Customize() -{ +{SELFPARAM(); // this is not in SendEntity because it shall run every frame, not just every update // make spectators see what the player would see @@ -999,7 +999,7 @@ float WaypointSprite_Customize() float WaypointSprite_SendEntity(entity to, float sendflags); void WaypointSprite_Reset() -{ +{SELFPARAM(); // if a WP wants to time out, let it time out immediately; other WPs ought to be reset/killed by their owners if (self.fade_time) // there was there before: || g_keyhunt, do we really need this? @@ -1068,7 +1068,7 @@ entity WaypointSprite_DeployFixed( vector ofs, float icon // initial icon ) -{ +{SELFPARAM(); float t; if (teamplay) t = self.team; @@ -1087,7 +1087,7 @@ entity WaypointSprite_DeployPersonal( vector ofs, float icon // initial icon ) -{ +{SELFPARAM(); return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, self, waypointsprite_deployed_personal, false, icon); } @@ -1096,7 +1096,7 @@ entity WaypointSprite_Attach( float limited_range, float icon // initial icon ) -{ +{SELFPARAM(); float t; if (self.waypointsprite_attachedforcarrier) return world; // can't attach to FC @@ -1134,25 +1134,25 @@ void WaypointSprite_DetachCarrier(entity carrier) } void WaypointSprite_ClearPersonal() -{ +{SELFPARAM(); WaypointSprite_Kill(self.waypointsprite_deployed_personal); } void WaypointSprite_ClearOwned() -{ +{SELFPARAM(); WaypointSprite_Kill(self.waypointsprite_deployed_fixed); WaypointSprite_Kill(self.waypointsprite_deployed_personal); WaypointSprite_Kill(self.waypointsprite_attached); } void WaypointSprite_PlayerDead() -{ +{SELFPARAM(); WaypointSprite_Disown(self.waypointsprite_attached, waypointsprite_deadlifetime); WaypointSprite_DetachCarrier(self); } void WaypointSprite_PlayerGone() -{ +{SELFPARAM(); WaypointSprite_Disown(self.waypointsprite_deployed_fixed, waypointsprite_deadlifetime); WaypointSprite_Kill(self.waypointsprite_deployed_personal); WaypointSprite_Disown(self.waypointsprite_attached, waypointsprite_deadlifetime); diff --git a/qcsrc/common/nades.qc b/qcsrc/common/nades.qc index f9ddb8e991..08f579b275 100644 --- a/qcsrc/common/nades.qc +++ b/qcsrc/common/nades.qc @@ -17,7 +17,7 @@ #ifdef SVQC float healer_send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_HEALING_ORB); WriteByte(MSG_ENTITY, sf); @@ -41,7 +41,7 @@ float healer_send(entity to, int sf) #ifdef CSQC .float ltime; void healer_draw() -{ +{SELFPARAM(); float dt = time - self.move_time; self.move_time = time; if(dt <= 0) @@ -53,7 +53,7 @@ void healer_draw() } void healer_setup() -{ +{SELFPARAM(); setmodel(self, "models/ctf/shield.md3"); setorigin(self, self.origin); @@ -75,7 +75,7 @@ void healer_setup() } void ent_healer() -{ +{SELFPARAM(); int sf = ReadByte(); if(sf & TNSF_SETUP) diff --git a/qcsrc/common/net_notice.qc b/qcsrc/common/net_notice.qc index fb9958b08f..f748f99038 100644 --- a/qcsrc/common/net_notice.qc +++ b/qcsrc/common/net_notice.qc @@ -2,7 +2,7 @@ #ifdef SVQC void sv_notice_join_think() -{ +{SELFPARAM(); //NextLevel(); float argc = tokenizebyseparator(autocvar_sv_join_notices, "|"); if(argc > 0) @@ -15,7 +15,7 @@ void sv_notice_join_think() } void sv_notice_join() -{ +{SELFPARAM(); // to-do: make sv_join_notices support per-entry times if(autocvar_sv_join_notices == "") return; diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index 5145e5340c..b040a53689 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -1756,7 +1756,7 @@ void Read_Notification(float is_new) #ifdef SVQC void Net_Notification_Remove() -{ +{SELFPARAM(); if (!self) { backtrace(sprintf("Net_Notification_Remove() at %f: Missing self!?\n", time)); return; } #ifdef NOTIFICATIONS_DEBUG @@ -1774,7 +1774,7 @@ void Net_Notification_Remove() } float Net_Write_Notification(entity client, int sf) -{ +{SELFPARAM(); if(Notification_ShouldSend(self.nent_broadcast, client, self.nent_client)) { WriteByte(MSG_ENTITY, ENT_CLIENT_NOTIFICATION); diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index b53696b987..b3db77143b 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -116,7 +116,7 @@ void Physics_AddStats() } void Physics_UpdateStats(float maxspd_mod) -{ +{SELFPARAM(); // blah self.stat_pl_view_ofs = PL_VIEW_OFS; self.stat_pl_crouch_view_ofs = PL_CROUCH_VIEW_OFS; @@ -222,7 +222,7 @@ vector unstick_offsets[unstick_count] = }; void PM_ClientMovement_Unstick() -{ +{SELFPARAM(); float i; for (i = 0; i < unstick_count; i++) { @@ -237,7 +237,7 @@ void PM_ClientMovement_Unstick() } void PM_ClientMovement_UpdateStatus(bool ground) -{ +{SELFPARAM(); // make sure player is not stuck PM_ClientMovement_Unstick(); @@ -308,7 +308,7 @@ void PM_ClientMovement_UpdateStatus(bool ground) } void PM_ClientMovement_Move() -{ +{SELFPARAM(); #ifdef CSQC int bump; float t; @@ -397,7 +397,7 @@ void PM_ClientMovement_Move() } void CPM_PM_Aircontrol(vector wishdir, float wishspeed) -{ +{SELFPARAM(); float k = 32 * (2 * IsMoveInDirection(self.movement, 0) - 1); if (k <= 0) return; @@ -434,7 +434,7 @@ float AdjustAirAccelQW(float accelqw, float factor) // prvm_globalset server speedclamp_mode 1 // (or 2) void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float accel, float accelqw, float stretchfactor, float sidefric, float speedlimit) -{ +{SELFPARAM(); float speedclamp = stretchfactor > 0 ? stretchfactor : accelqw < 0 ? 1 // full clamping, no stretch : -1; // no clamping @@ -498,7 +498,7 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce } void PM_AirAccelerate(vector wishdir, float wishspeed) -{ +{SELFPARAM(); if (wishspeed == 0) return; @@ -541,7 +541,7 @@ returns true if handled ============= */ bool PlayerJump (void) -{ +{SELFPARAM(); if (PHYS_FROZEN(self)) return true; // no jumping in freezetag when frozen @@ -657,7 +657,7 @@ bool PlayerJump (void) } void CheckWaterJump() -{ +{SELFPARAM(); // check for a jump-out-of-water makevectors(self.v_angle); vector start = self.origin; @@ -697,7 +697,7 @@ void CheckWaterJump() // Hack: shouldn't need to know about this .float multijump_count; void CheckPlayerJump() -{ +{SELFPARAM(); #ifdef SVQC float was_flying = ITEMS_STAT(self) & IT_USING_JETPACK; #endif @@ -757,7 +757,7 @@ float racecar_angle(float forward, float down) } void RaceCarPhysics() -{ +{SELFPARAM(); #ifdef SVQC // using this move type for "big rigs" // the engine does not push the entity! @@ -977,7 +977,7 @@ void SpecialCommand() } void PM_check_race_movetime(void) -{ +{SELFPARAM(); #ifdef SVQC self.race_movetime_frac += PHYS_INPUT_TIMELENGTH; float f = floor(self.race_movetime_frac); @@ -988,7 +988,7 @@ void PM_check_race_movetime(void) } float PM_check_specialcommand(float buttons) -{ +{SELFPARAM(); #ifdef SVQC string c; if (!buttons) @@ -1025,7 +1025,7 @@ float PM_check_specialcommand(float buttons) } void PM_check_nickspam(void) -{ +{SELFPARAM(); #ifdef SVQC if (time >= self.nickspamtime) return; @@ -1047,7 +1047,7 @@ void PM_check_nickspam(void) } void PM_check_punch() -{ +{SELFPARAM(); #ifdef SVQC if (self.punchangle != '0 0 0') { @@ -1070,7 +1070,7 @@ void PM_check_punch() } void PM_check_spider(void) -{ +{SELFPARAM(); #ifdef SVQC if (time >= self.spider_slowness) return; @@ -1083,7 +1083,7 @@ void PM_check_spider(void) // predict frozen movement, as frozen players CAN move in some cases void PM_check_frozen(void) -{ +{SELFPARAM(); if (!PHYS_FROZEN(self)) return; if (PHYS_DODGING_FROZEN @@ -1110,7 +1110,7 @@ void PM_check_frozen(void) } void PM_check_hitground() -{ +{SELFPARAM(); #ifdef SVQC if (IS_ONGROUND(self)) if (IS_PLAYER(self)) // no fall sounds for observers thank you very much @@ -1137,7 +1137,7 @@ void PM_check_hitground() } void PM_check_blocked(void) -{ +{SELFPARAM(); #ifdef SVQC if (!self.player_blocked) return; @@ -1151,7 +1151,7 @@ float speedaward_lastsent; float speedaward_lastupdate; #endif void PM_check_race(void) -{ +{SELFPARAM(); #ifdef SVQC if(!(g_cts || g_race)) return; @@ -1181,7 +1181,7 @@ void PM_check_race(void) } void PM_check_vortex(void) -{ +{SELFPARAM(); #ifdef SVQC // WEAPONTODO float xyspeed = vlen(vec2(self.velocity)); @@ -1197,7 +1197,7 @@ void PM_check_vortex(void) } void PM_fly(float maxspd_mod) -{ +{SELFPARAM(); // noclipping or flying UNSET_ONGROUND(self); @@ -1218,7 +1218,7 @@ void PM_fly(float maxspd_mod) } void PM_swim(float maxspd_mod) -{ +{SELFPARAM(); // swimming UNSET_ONGROUND(self); @@ -1301,7 +1301,7 @@ void PM_swim(float maxspd_mod) } void PM_ladder(float maxspd_mod) -{ +{SELFPARAM(); // on a spawnfunc_func_ladder or swimming in spawnfunc_func_water UNSET_ONGROUND(self); @@ -1354,7 +1354,7 @@ void PM_ladder(float maxspd_mod) } void PM_jetpack(float maxspd_mod) -{ +{SELFPARAM(); //makevectors(self.v_angle.y * '0 1 0'); makevectors(self.v_angle); vector wishvel = v_forward * self.movement_x @@ -1470,7 +1470,7 @@ void PM_jetpack(float maxspd_mod) } void PM_walk(float buttons_prev, float maxspd_mod) -{ +{SELFPARAM(); if (!WAS_ONGROUND(self)) { #ifdef SVQC @@ -1555,7 +1555,7 @@ void PM_walk(float buttons_prev, float maxspd_mod) } void PM_air(float buttons_prev, float maxspd_mod) -{ +{SELFPARAM(); makevectors(self.v_angle.y * '0 1 0'); vector wishvel = v_forward * self.movement.x + v_right * self.movement.y; @@ -1641,7 +1641,7 @@ bool IsFlying(entity a) } void PM_Main() -{ +{SELFPARAM(); int buttons = PHYS_INPUT_BUTTON_MASK(self); #ifdef CSQC self.items = getstati(STAT_ITEMS, 0, 24); @@ -1923,7 +1923,7 @@ void SV_PlayerPhysics(void) #elif defined(CSQC) void CSQC_ClientMovement_PlayerMove_Frame(void) #endif -{ +{SELFPARAM(); PM_Main(); #ifdef CSQC diff --git a/qcsrc/common/triggers/func/bobbing.qc b/qcsrc/common/triggers/func/bobbing.qc index 9fb2f56c9d..298043bb57 100644 --- a/qcsrc/common/triggers/func/bobbing.qc +++ b/qcsrc/common/triggers/func/bobbing.qc @@ -1,7 +1,7 @@ #ifdef SVQC .float height; void func_bobbing_controller_think() -{ +{SELFPARAM(); vector v; self.nextthink = time + 0.1; @@ -29,7 +29,7 @@ dmg : Do this mutch dmg every .dmgtime intervall when blocked dmgtime : See above. */ void spawnfunc_func_bobbing() -{ +{SELFPARAM(); entity controller; if (self.noise != "") { diff --git a/qcsrc/common/triggers/func/breakable.qc b/qcsrc/common/triggers/func/breakable.qc index b70d8b6009..d705f842fb 100644 --- a/qcsrc/common/triggers/func/breakable.qc +++ b/qcsrc/common/triggers/func/breakable.qc @@ -50,7 +50,7 @@ void func_breakable_damage(entity inflictor, entity attacker, float damage, int // - basically func_assault_destructible for general gameplay use // void LaunchDebris (string debrisname, vector force) -{ +{SELFPARAM(); entity dbr = spawn(); setorigin(dbr, self.absmin + '1 0 0' * random() * (self.absmax.x - self.absmin.x) @@ -78,7 +78,7 @@ void LaunchDebris (string debrisname, vector force) } void func_breakable_colormod() -{ +{SELFPARAM(); float h; if (!(self.spawnflags & 2)) return; @@ -90,11 +90,11 @@ void func_breakable_colormod() else self.colormod = '1 1 1'; - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } void func_breakable_look_destroyed() -{ +{SELFPARAM(); float floorZ; if(self.solid == SOLID_BSP) // in case a misc_follow moved me, save the current origin first @@ -112,26 +112,26 @@ void func_breakable_look_destroyed() self.effects &= ~EF_NODRAW; } - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); self.solid = SOLID_NOT; } void func_breakable_look_restore() -{ +{SELFPARAM(); setmodel(self, self.mdl); self.effects &= ~EF_NODRAW; if(self.mdl_dead != "") // only do this if we use mdl_dead, to behave better with misc_follow setorigin(self, self.dropped_origin); - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); self.solid = SOLID_BSP; } void func_breakable_behave_destroyed() -{ +{SELFPARAM(); self.health = self.max_health; self.takedamage = DAMAGE_NO; self.bot_attack = false; @@ -145,7 +145,7 @@ void func_breakable_behave_destroyed() } void func_breakable_behave_restore() -{ +{SELFPARAM(); self.health = self.max_health; if(self.sprite) { @@ -166,7 +166,7 @@ void func_breakable_behave_restore() } void func_breakable_init_for_player(entity player) -{ +{SELFPARAM(); if (self.noise1 && self.state == 0 && clienttype(player) == CLIENTTYPE_REAL) { msg_entity = player; @@ -175,23 +175,24 @@ void func_breakable_init_for_player(entity player) } void func_breakable_destroyed() -{ +{SELFPARAM(); func_breakable_look_destroyed(); func_breakable_behave_destroyed(); - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } void func_breakable_restore() -{ +{SELFPARAM(); func_breakable_look_restore(); func_breakable_behave_restore(); - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } vector debrisforce; // global, set before calling this -void func_breakable_destroy() { +void func_breakable_destroy() +{SELFPARAM(); float n, i; string oldmsg; @@ -227,7 +228,7 @@ void func_breakable_destroy() { } void func_breakable_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.state == 1) return; if(self.spawnflags & DOOR_NOSPLASH) @@ -253,7 +254,7 @@ void func_breakable_damage(entity inflictor, entity attacker, float damage, int } void func_breakable_reset() -{ +{SELFPARAM(); self.team = self.team_saved; func_breakable_look_restore(); if(self.spawnflags & 1) @@ -261,12 +262,12 @@ void func_breakable_reset() else func_breakable_behave_restore(); - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } // destructible walls that can be used to trigger target_objective_decrease void spawnfunc_func_breakable() -{ +{SELFPARAM(); float n, i; if(!self.health) self.health = 100; @@ -330,7 +331,7 @@ void spawnfunc_func_breakable() self.init_for_player_needed = 1; self.init_for_player = func_breakable_init_for_player; - CSQCMODEL_AUTOINIT(); + CSQCMODEL_AUTOINIT(self); } // for use in maps with a "model" key set diff --git a/qcsrc/common/triggers/func/button.qc b/qcsrc/common/triggers/func/button.qc index bb8875b422..228b3f810a 100644 --- a/qcsrc/common/triggers/func/button.qc +++ b/qcsrc/common/triggers/func/button.qc @@ -5,7 +5,7 @@ void() button_wait; void() button_return; void button_wait() -{ +{SELFPARAM(); self.state = STATE_TOP; self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait; self.SUB_THINK = button_return; @@ -15,12 +15,12 @@ void button_wait() } void button_done() -{ +{SELFPARAM(); self.state = STATE_BOTTOM; } void button_return() -{ +{SELFPARAM(); self.state = STATE_DOWN; SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, button_done); self.frame = 0; // use normal textures @@ -36,7 +36,7 @@ void button_blocked() void button_fire() -{ +{SELFPARAM(); self.health = self.max_health; self.takedamage = DAMAGE_NO; // will be reset upon return @@ -51,7 +51,7 @@ void button_fire() } void button_reset() -{ +{SELFPARAM(); self.health = self.max_health; setorigin(self, self.pos1); self.frame = 0; // use normal textures @@ -61,7 +61,7 @@ void button_reset() } void button_use() -{ +{SELFPARAM(); if(self.active != ACTIVE_ACTIVE) return; @@ -70,7 +70,7 @@ void button_use() } void button_touch() -{ +{SELFPARAM(); if (!other) return; if (!other.iscreature) @@ -84,7 +84,7 @@ void button_touch() } void button_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.spawnflags & DOOR_NOSPLASH) if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH)) return; @@ -113,7 +113,7 @@ When a button is touched, it moves some distance in the direction of it's angle, 3) in-out */ void spawnfunc_func_button() -{ +{SELFPARAM(); SetMovedir (); if (!InitMovingBrushTrigger()) diff --git a/qcsrc/common/triggers/func/conveyor.qc b/qcsrc/common/triggers/func/conveyor.qc index 6ed01b0c59..4f5a7d6ea5 100644 --- a/qcsrc/common/triggers/func/conveyor.qc +++ b/qcsrc/common/triggers/func/conveyor.qc @@ -1,5 +1,5 @@ void conveyor_think() -{ +{SELFPARAM(); #ifdef CSQC // TODO: check if this is what is causing the glitchiness when switching between them float dt = time - self.move_time; @@ -57,21 +57,21 @@ void conveyor_think() #ifdef SVQC void conveyor_use() -{ +{SELFPARAM(); self.state = !self.state; self.SendFlags |= 2; } void conveyor_reset() -{ +{SELFPARAM(); self.state = (self.spawnflags & 1); self.SendFlags |= 2; } bool conveyor_send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_CONVEYOR); WriteByte(MSG_ENTITY, sf); @@ -107,7 +107,7 @@ bool conveyor_send(entity to, int sf) } void conveyor_init() -{ +{SELFPARAM(); if (!self.speed) self.speed = 200; self.movedir = self.movedir * self.speed; @@ -137,7 +137,7 @@ void spawnfunc_trigger_conveyor() } void spawnfunc_func_conveyor() -{ +{SELFPARAM(); SetMovedir(); InitMovingBrushTrigger(); self.movetype = MOVETYPE_NONE; @@ -147,7 +147,7 @@ void spawnfunc_func_conveyor() #elif defined(CSQC) void conveyor_init() -{ +{SELFPARAM(); self.draw = conveyor_think; self.drawmask = MASK_NORMAL; @@ -159,7 +159,7 @@ void conveyor_init() } void ent_conveyor() -{ +{SELFPARAM(); float sf = ReadByte(); if(sf & 1) diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index 4c56815d2f..9688214e3b 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -26,7 +26,7 @@ void() door_rotating_go_down; void() door_rotating_go_up; void door_blocked() -{ +{SELFPARAM(); if((self.spawnflags & 8) #ifdef SVQC && (other.takedamage != DAMAGE_NO) @@ -85,7 +85,7 @@ void door_blocked() } void door_hit_top() -{ +{SELFPARAM(); if (self.noise1 != "") sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.state = STATE_TOP; @@ -102,14 +102,14 @@ void door_hit_top() } void door_hit_bottom() -{ +{SELFPARAM(); if (self.noise1 != "") sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.state = STATE_BOTTOM; } void door_go_down() -{ +{SELFPARAM(); if (self.noise2 != "") sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); if (self.max_health) @@ -123,7 +123,7 @@ void door_go_down() } void door_go_up() -{ +{SELFPARAM(); if (self.state == STATE_UP) return; // already going up @@ -155,7 +155,7 @@ ACTIVATION FUNCTIONS */ float door_check_keys(void) -{ +{SELFPARAM(); local entity door; @@ -212,7 +212,7 @@ float door_check_keys(void) } void door_fire() -{ +{SELFPARAM(); entity oself; entity starte; @@ -271,7 +271,7 @@ void door_fire() } void door_use() -{ +{SELFPARAM(); entity oself; //dprint("door_use (model: ");dprint(self.model);dprint(")\n"); @@ -286,7 +286,7 @@ void door_use() } void door_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); entity oself; if(self.spawnflags & DOOR_NOSPLASH) if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH)) @@ -320,7 +320,7 @@ Prints messages */ void door_touch() -{ +{SELFPARAM(); if (!IS_PLAYER(other)) return; if (self.owner.attack_finished_single > time) @@ -339,7 +339,7 @@ void door_touch() } void door_generic_plat_blocked() -{ +{SELFPARAM(); if((self.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!! #ifdef SVQC @@ -377,7 +377,7 @@ void door_generic_plat_blocked() } void door_rotating_hit_top() -{ +{SELFPARAM(); if (self.noise1 != "") sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.state = STATE_TOP; @@ -388,7 +388,7 @@ void door_rotating_hit_top() } void door_rotating_hit_bottom() -{ +{SELFPARAM(); if (self.noise1 != "") sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); if (self.lip==666) // self.lip is used to remember reverse opening direction for door_rotating @@ -400,7 +400,7 @@ void door_rotating_hit_bottom() } void door_rotating_go_down() -{ +{SELFPARAM(); if (self.noise2 != "") sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); if (self.max_health) @@ -414,7 +414,7 @@ void door_rotating_go_down() } void door_rotating_go_up() -{ +{SELFPARAM(); if (self.state == STATE_UP) return; // already going up @@ -445,7 +445,7 @@ Spawned if a door lacks a real activator */ void door_trigger_touch() -{ +{SELFPARAM(); if (other.health < 1) #ifdef SVQC if (!((other.iscreature || (other.flags & FL_PROJECTILE)) && !PHYS_DEAD(other))) @@ -470,7 +470,7 @@ void door_trigger_touch() } void spawn_field(vector fmins, vector fmaxs) -{ +{SELFPARAM(); entity trigger; vector t1 = fmins, t2 = fmaxs; @@ -500,7 +500,7 @@ LinkDoors */ entity LinkDoors_nextent(entity cur, entity near, entity pass) -{ +{SELFPARAM(); while((cur = find(cur, classname, self.classname)) && ((cur.spawnflags & 4) || cur.enemy)) { } @@ -524,7 +524,7 @@ bool LinkDoors_isconnected(entity e1, entity e2, entity pass) void door_link(); #endif void LinkDoors() -{ +{SELFPARAM(); entity t; vector cmins, cmaxs; @@ -647,7 +647,7 @@ FIXME: only one sound set available at the time being */ float door_send(entity to, float sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_DOOR); WriteByte(MSG_ENTITY, sf); @@ -709,7 +709,7 @@ void door_link() #endif void door_init_startopen() -{ +{SELFPARAM(); SUB_SETORIGIN(self, self.pos2); self.pos2 = self.pos1; self.pos1 = self.origin; @@ -720,7 +720,7 @@ void door_init_startopen() } void door_reset() -{ +{SELFPARAM(); SUB_SETORIGIN(self, self.pos1); self.SUB_VELOCITY = '0 0 0'; self.state = STATE_BOTTOM; @@ -736,7 +736,7 @@ void door_reset() // spawnflags require key (for now only func_door) void spawnfunc_func_door() -{ +{SELFPARAM(); // Quake 1 keys compatibility if (self.spawnflags & SPAWNFLAGS_GOLD_KEY) self.itemkeys |= ITEM_KEY_BIT(0); @@ -815,7 +815,7 @@ void door_draw() } void ent_door() -{ +{SELFPARAM(); float sf = ReadByte(); if(sf & SF_TRIGGER_INIT) diff --git a/qcsrc/common/triggers/func/door_rotating.qc b/qcsrc/common/triggers/func/door_rotating.qc index bdf05a0093..fbe579c136 100644 --- a/qcsrc/common/triggers/func/door_rotating.qc +++ b/qcsrc/common/triggers/func/door_rotating.qc @@ -28,7 +28,7 @@ FIXME: only one sound set available at the time being */ void door_rotating_reset() -{ +{SELFPARAM(); self.angles = self.pos1; self.avelocity = '0 0 0'; self.state = STATE_BOTTOM; @@ -37,7 +37,7 @@ void door_rotating_reset() } void door_rotating_init_startopen() -{ +{SELFPARAM(); self.angles = self.movedir; self.pos2 = '0 0 0'; self.pos1 = self.movedir; @@ -45,7 +45,7 @@ void door_rotating_init_startopen() void spawnfunc_func_door_rotating() -{ +{SELFPARAM(); //if (!self.deathtype) // map makers can override this // self.deathtype = " got in the way"; diff --git a/qcsrc/common/triggers/func/door_secret.qc b/qcsrc/common/triggers/func/door_secret.qc index a0a44bbb92..b793228784 100644 --- a/qcsrc/common/triggers/func/door_secret.qc +++ b/qcsrc/common/triggers/func/door_secret.qc @@ -14,7 +14,7 @@ const float SECRET_NO_SHOOT = 8; // only opened by trigger const float SECRET_YES_SHOOT = 16; // shootable even if targeted void fd_secret_use() -{ +{SELFPARAM(); float temp; string message_save; @@ -70,7 +70,7 @@ void fd_secret_damage(entity inflictor, entity attacker, float damage, int death // Wait after first movement... void fd_secret_move1() -{ +{SELFPARAM(); self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0; self.think = fd_secret_move2; if (self.noise3 != "") @@ -79,7 +79,7 @@ void fd_secret_move1() // Start moving sideways w/sound... void fd_secret_move2() -{ +{SELFPARAM(); if (self.noise2 != "") sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); SUB_CalcMove(self.dest2, TSPEED_LINEAR, self.speed, fd_secret_move3); @@ -87,7 +87,7 @@ void fd_secret_move2() // Wait here until time to go back... void fd_secret_move3() -{ +{SELFPARAM(); if (self.noise3 != "") sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM); if (!(self.spawnflags & SECRET_OPEN_ONCE)) @@ -99,7 +99,7 @@ void fd_secret_move3() // Move backward... void fd_secret_move4() -{ +{SELFPARAM(); if (self.noise2 != "") sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); SUB_CalcMove(self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move5); @@ -107,7 +107,7 @@ void fd_secret_move4() // Wait 1 second... void fd_secret_move5() -{ +{SELFPARAM(); self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0; self.think = fd_secret_move6; if (self.noise3 != "") @@ -115,14 +115,14 @@ void fd_secret_move5() } void fd_secret_move6() -{ +{SELFPARAM(); if (self.noise2 != "") sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM); SUB_CalcMove(self.oldorigin, TSPEED_LINEAR, self.speed, fd_secret_done); } void fd_secret_done() -{ +{SELFPARAM(); if (self.spawnflags&SECRET_YES_SHOOT) { self.health = 10000; @@ -134,7 +134,7 @@ void fd_secret_done() } void secret_blocked() -{ +{SELFPARAM(); if (time < self.attack_finished_single) return; self.attack_finished_single = time + 0.5; @@ -149,7 +149,7 @@ Prints messages ================ */ void secret_touch() -{ +{SELFPARAM(); if (!other.iscreature) return; if (self.attack_finished_single > time) @@ -166,7 +166,7 @@ void secret_touch() } void secret_reset() -{ +{SELFPARAM(); if (self.spawnflags&SECRET_YES_SHOOT) { self.health = 10000; @@ -195,7 +195,7 @@ If a secret door has a targetname, it will only be opened by it's botton or trig */ void spawnfunc_func_door_secret() -{ +{SELFPARAM(); /*if (!self.deathtype) // map makers can override this self.deathtype = " got in the way";*/ diff --git a/qcsrc/common/triggers/func/fourier.qc b/qcsrc/common/triggers/func/fourier.qc index 19dceef253..552fffe5a1 100644 --- a/qcsrc/common/triggers/func/fourier.qc +++ b/qcsrc/common/triggers/func/fourier.qc @@ -11,7 +11,7 @@ dmgtime: See above. */ void func_fourier_controller_think() -{ +{SELFPARAM(); vector v; float n, i, t; @@ -40,7 +40,7 @@ void func_fourier_controller_think() } void spawnfunc_func_fourier() -{ +{SELFPARAM(); entity controller; if (self.noise != "") { diff --git a/qcsrc/common/triggers/func/ladder.qc b/qcsrc/common/triggers/func/ladder.qc index 5a96b9bb6e..fc3d47210e 100644 --- a/qcsrc/common/triggers/func/ladder.qc +++ b/qcsrc/common/triggers/func/ladder.qc @@ -1,5 +1,5 @@ void func_ladder_touch() -{ +{SELFPARAM(); #ifdef SVQC if (!other.iscreature) return; @@ -19,7 +19,7 @@ void func_ladder_touch() #ifdef SVQC float func_ladder_send(entity to, float sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER); WriteString(MSG_ENTITY, self.classname); @@ -40,7 +40,7 @@ void func_ladder_link() } void spawnfunc_func_ladder() -{ +{SELFPARAM(); self.mdl = self.model; EXACTTRIGGER_INIT; self.touch = func_ladder_touch; @@ -49,7 +49,7 @@ void spawnfunc_func_ladder() } void spawnfunc_func_water() -{ +{SELFPARAM(); self.mdl = self.model; EXACTTRIGGER_INIT; self.touch = func_ladder_touch; @@ -61,7 +61,7 @@ void spawnfunc_func_water() .float speed; void ent_func_ladder() -{ +{SELFPARAM(); self.classname = strzone(ReadString()); self.skin = ReadByte(); self.speed = ReadByte(); diff --git a/qcsrc/common/triggers/func/pendulum.qc b/qcsrc/common/triggers/func/pendulum.qc index 7d3eff7c9f..b23541e03a 100644 --- a/qcsrc/common/triggers/func/pendulum.qc +++ b/qcsrc/common/triggers/func/pendulum.qc @@ -1,7 +1,7 @@ #ifdef SVQC .float freq; void func_pendulum_controller_think() -{ +{SELFPARAM(); float v; self.nextthink = time + 0.1; @@ -22,7 +22,7 @@ void func_pendulum_controller_think() } void spawnfunc_func_pendulum() -{ +{SELFPARAM(); entity controller; if (self.noise != "") { diff --git a/qcsrc/common/triggers/func/plat.qc b/qcsrc/common/triggers/func/plat.qc index d36b1c6a37..8fc95bf48b 100644 --- a/qcsrc/common/triggers/func/plat.qc +++ b/qcsrc/common/triggers/func/plat.qc @@ -8,7 +8,7 @@ void plat_delayedinit() } float plat_send(entity to, float sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_PLAT); WriteByte(MSG_ENTITY, sf); @@ -60,7 +60,7 @@ void plat_link() } void spawnfunc_func_plat() -{ +{SELFPARAM(); if (self.sounds == 0) self.sounds = 2; @@ -134,7 +134,7 @@ void plat_draw() } void ent_plat() -{ +{SELFPARAM(); float sf = ReadByte(); if(sf & SF_TRIGGER_INIT) diff --git a/qcsrc/common/triggers/func/pointparticles.qc b/qcsrc/common/triggers/func/pointparticles.qc index 654db0f72a..f303ca9f2b 100644 --- a/qcsrc/common/triggers/func/pointparticles.qc +++ b/qcsrc/common/triggers/func/pointparticles.qc @@ -6,7 +6,7 @@ // NOTE: also contains func_sparks float pointparticles_SendEntity(entity to, float fl) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_POINTPARTICLES); // optional features to save space @@ -89,13 +89,13 @@ float pointparticles_SendEntity(entity to, float fl) } void pointparticles_use() -{ +{SELFPARAM(); self.state = !self.state; self.SendFlags |= 2; } void pointparticles_think() -{ +{SELFPARAM(); if(self.origin != self.oldorigin) { self.SendFlags |= 4; @@ -105,7 +105,7 @@ void pointparticles_think() } void pointparticles_reset() -{ +{SELFPARAM(); if(self.spawnflags & 1) self.state = 1; else @@ -113,7 +113,7 @@ void pointparticles_reset() } void spawnfunc_func_pointparticles() -{ +{SELFPARAM(); if(self.model != "") setmodel(self, self.model); if(self.noise != "") @@ -158,7 +158,7 @@ void spawnfunc_func_pointparticles() } void spawnfunc_func_sparks() -{ +{SELFPARAM(); // self.cnt is the amount of sparks that one burst will spawn if(self.cnt < 1) { self.cnt = 25.0; // nice default value @@ -184,7 +184,7 @@ void spawnfunc_func_sparks() #elif defined(CSQC) void Draw_PointParticles() -{ +{SELFPARAM(); float n, i, fail; vector p; vector sz; @@ -244,7 +244,7 @@ void Draw_PointParticles() } void Ent_PointParticles_Remove() -{ +{SELFPARAM(); if(self.noise) strunzone(self.noise); self.noise = string_null; @@ -254,7 +254,7 @@ void Ent_PointParticles_Remove() } void Ent_PointParticles() -{ +{SELFPARAM(); float i; vector v; int f = ReadByte(); diff --git a/qcsrc/common/triggers/func/rainsnow.qc b/qcsrc/common/triggers/func/rainsnow.qc index deb5ee58bf..8c00f9ce21 100644 --- a/qcsrc/common/triggers/func/rainsnow.qc +++ b/qcsrc/common/triggers/func/rainsnow.qc @@ -1,6 +1,6 @@ #ifdef SVQC float rainsnow_SendEntity(entity to, float sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_RAINSNOW); WriteByte(MSG_ENTITY, self.state); WriteCoord(MSG_ENTITY, self.origin_x + self.mins_x); @@ -27,7 +27,7 @@ Keys: adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000 */ void spawnfunc_func_rain() -{ +{SELFPARAM(); self.dest = self.velocity; self.velocity = '0 0 0'; if (!self.dest) @@ -65,7 +65,7 @@ Keys: adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000 */ void spawnfunc_func_snow() -{ +{SELFPARAM(); self.dest = self.velocity; self.velocity = '0 0 0'; if (!self.dest) @@ -91,17 +91,17 @@ void spawnfunc_func_snow() } #elif defined(CSQC) void Draw_Rain() -{ +{SELFPARAM(); te_particlerain(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color); } void Draw_Snow() -{ +{SELFPARAM(); te_particlesnow(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color); } void Ent_RainOrSnow() -{ +{SELFPARAM(); self.impulse = ReadByte(); // Rain, Snow, or Whatever self.origin_x = ReadCoord(); self.origin_y = ReadCoord(); diff --git a/qcsrc/common/triggers/func/rotating.qc b/qcsrc/common/triggers/func/rotating.qc index 93d4a30ced..2e3c7851a8 100644 --- a/qcsrc/common/triggers/func/rotating.qc +++ b/qcsrc/common/triggers/func/rotating.qc @@ -1,6 +1,6 @@ #ifdef SVQC void func_rotating_setactive(float astate) -{ +{SELFPARAM(); if (astate == ACTIVE_TOGGLE) { @@ -27,7 +27,7 @@ dmgtime : See above. */ void spawnfunc_func_rotating() -{ +{SELFPARAM(); if (self.noise != "") { precache_sound(self.noise); diff --git a/qcsrc/common/triggers/func/stardust.qc b/qcsrc/common/triggers/func/stardust.qc index 30c406f61e..0c329cdb27 100644 --- a/qcsrc/common/triggers/func/stardust.qc +++ b/qcsrc/common/triggers/func/stardust.qc @@ -1,8 +1,8 @@ #ifdef SVQC void spawnfunc_func_stardust() -{ +{SELFPARAM(); self.effects = EF_STARDUST; - CSQCMODEL_AUTOINIT(); + CSQCMODEL_AUTOINIT(self); } #endif diff --git a/qcsrc/common/triggers/func/train.qc b/qcsrc/common/triggers/func/train.qc index 0de3489381..f6059f74c8 100644 --- a/qcsrc/common/triggers/func/train.qc +++ b/qcsrc/common/triggers/func/train.qc @@ -1,7 +1,7 @@ .float train_wait_turning; void() train_next; void train_wait() -{ +{SELFPARAM(); entity oldself; oldself = self; self = self.enemy; @@ -53,7 +53,7 @@ void train_wait() } void train_next() -{ +{SELFPARAM(); entity targ, cp = world; vector cp_org = '0 0 0'; @@ -107,7 +107,7 @@ void train_next() #ifdef SVQC float train_send(entity to, float sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_TRAIN); WriteByte(MSG_ENTITY, sf); @@ -166,7 +166,7 @@ void train_link() } void func_train_find() -{ +{SELFPARAM(); entity targ; targ = find(world, targetname, self.target); self.target = targ.target; @@ -188,7 +188,7 @@ target : targetname of first spawnfunc_path_corner (starts here) */ #ifdef SVQC void spawnfunc_func_train() -{ +{SELFPARAM(); if (self.noise != "") precache_sound(self.noise); @@ -236,7 +236,7 @@ void train_draw() } void ent_train() -{ +{SELFPARAM(); float sf = ReadByte(); if(sf & SF_TRIGGER_INIT) diff --git a/qcsrc/common/triggers/func/vectormamamam.qc b/qcsrc/common/triggers/func/vectormamamam.qc index 521ac8780e..32355004be 100644 --- a/qcsrc/common/triggers/func/vectormamamam.qc +++ b/qcsrc/common/triggers/func/vectormamamam.qc @@ -58,7 +58,7 @@ vector func_vectormamamam_origin(entity o, float t) } void func_vectormamamam_controller_think() -{ +{SELFPARAM(); self.nextthink = time + 0.1; if(self.owner.active != ACTIVE_ACTIVE) @@ -72,7 +72,7 @@ void func_vectormamamam_controller_think() } void func_vectormamamam_findtarget() -{ +{SELFPARAM(); if(self.target != "") self.wp00 = find(world, targetname, self.target); @@ -99,7 +99,7 @@ void func_vectormamamam_findtarget() } void spawnfunc_func_vectormamamam() -{ +{SELFPARAM(); if (self.noise != "") { precache_sound(self.noise); diff --git a/qcsrc/common/triggers/misc/corner.qc b/qcsrc/common/triggers/misc/corner.qc index 4294eac2aa..390fd2c79c 100644 --- a/qcsrc/common/triggers/misc/corner.qc +++ b/qcsrc/common/triggers/misc/corner.qc @@ -1,6 +1,6 @@ #ifdef SVQC bool corner_send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_CORNER); WriteString(MSG_ENTITY, self.platmovetype); @@ -27,7 +27,7 @@ void corner_link() } void spawnfunc_path_corner() -{ +{SELFPARAM(); // setup values for overriding train movement // if a second value does not exist, both start and end speeds are the single value specified set_platmovetype(self, self.platmovetype); @@ -37,7 +37,7 @@ void spawnfunc_path_corner() #elif defined(CSQC) void corner_remove() -{ +{SELFPARAM(); if(self.target) { strunzone(self.target); } self.target = string_null; @@ -58,7 +58,7 @@ void corner_remove() } void ent_corner() -{ +{SELFPARAM(); self.platmovetype = strzone(ReadString()); self.origin_x = ReadCoord(); diff --git a/qcsrc/common/triggers/misc/follow.qc b/qcsrc/common/triggers/misc/follow.qc index bfeb865c1d..02c9dcc277 100644 --- a/qcsrc/common/triggers/misc/follow.qc +++ b/qcsrc/common/triggers/misc/follow.qc @@ -2,7 +2,7 @@ #ifdef SVQC void follow_init() -{ +{SELFPARAM(); entity src, dst; src = world; dst = world; @@ -63,7 +63,7 @@ void follow_init() } void spawnfunc_misc_follow() -{ +{SELFPARAM(); InitializeEntity(self, follow_init, INITPRIO_FINDTARGET); } #endif diff --git a/qcsrc/common/triggers/misc/laser.qc b/qcsrc/common/triggers/misc/laser.qc index a7fb078153..5dde1b4fac 100644 --- a/qcsrc/common/triggers/misc/laser.qc +++ b/qcsrc/common/triggers/misc/laser.qc @@ -11,7 +11,7 @@ #ifdef SVQC .float modelscale; void misc_laser_aim() -{ +{SELFPARAM(); vector a; if(self.enemy) { @@ -50,14 +50,14 @@ void misc_laser_aim() } void misc_laser_init() -{ +{SELFPARAM(); if(self.target != "") self.enemy = find(world, targetname, self.target); } .entity pusher; void misc_laser_think() -{ +{SELFPARAM(); vector o; entity oldself; entity hitent; @@ -131,7 +131,7 @@ void misc_laser_think() } float laser_SendEntity(entity to, float fl) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_LASER); fl = fl - (fl & 0xF0); // use that bit to indicate finite length laser if(self.spawnflags & 2) @@ -196,14 +196,14 @@ Keys: damage per second (-1 for a laser that kills immediately) */ void laser_use() -{ +{SELFPARAM(); self.state = !self.state; self.SendFlags |= 4; misc_laser_aim(); } void laser_reset() -{ +{SELFPARAM(); if(self.spawnflags & 1) self.state = 1; else @@ -211,7 +211,7 @@ void laser_reset() } void spawnfunc_misc_laser() -{ +{SELFPARAM(); if(self.mdl) { if(self.mdl == "none") @@ -280,7 +280,7 @@ class(Laser) .float scale; // scaling factor of the thickness class(Laser) .float modelscale; // scaling factor of the dlight void Draw_Laser() -{ +{SELFPARAM(); if(!self.state) return; InterpolateOrigin_Do(); @@ -331,7 +331,7 @@ void Draw_Laser() } void Ent_Laser() -{ +{SELFPARAM(); InterpolateOrigin_Undo(); // 30 bytes, or 13 bytes for just moving diff --git a/qcsrc/common/triggers/misc/teleport_dest.qc b/qcsrc/common/triggers/misc/teleport_dest.qc index b80ce827d7..a3c9783537 100644 --- a/qcsrc/common/triggers/misc/teleport_dest.qc +++ b/qcsrc/common/triggers/misc/teleport_dest.qc @@ -1,7 +1,7 @@ #ifdef SVQC void spawnfunc_info_teleport_destination (void) -{ +{SELFPARAM(); self.classname = "info_teleport_destination"; self.mangle = self.angles; diff --git a/qcsrc/common/triggers/platforms.qc b/qcsrc/common/triggers/platforms.qc index b837d7c5a8..bf184193e1 100644 --- a/qcsrc/common/triggers/platforms.qc +++ b/qcsrc/common/triggers/platforms.qc @@ -1,5 +1,5 @@ void generic_plat_blocked() -{ +{SELFPARAM(); #ifdef SVQC if(self.dmg && other.takedamage != DAMAGE_NO) { @@ -17,7 +17,7 @@ void generic_plat_blocked() } void plat_spawn_inside_trigger() -{ +{SELFPARAM(); entity trigger; vector tmin, tmax; @@ -64,7 +64,7 @@ void plat_spawn_inside_trigger() } void plat_hit_top() -{ +{SELFPARAM(); sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.state = 1; @@ -73,27 +73,27 @@ void plat_hit_top() } void plat_hit_bottom() -{ +{SELFPARAM(); sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM); self.state = 2; } void plat_go_down() -{ +{SELFPARAM(); sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM); self.state = 3; SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom); } void plat_go_up() -{ +{SELFPARAM(); sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM); self.state = 4; SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top); } void plat_center_touch() -{ +{SELFPARAM(); #ifdef SVQC if (!other.iscreature) return; @@ -115,7 +115,7 @@ void plat_center_touch() } void plat_outside_touch() -{ +{SELFPARAM(); #ifdef SVQC if (!other.iscreature) return; @@ -133,7 +133,7 @@ void plat_outside_touch() } void plat_trigger_use() -{ +{SELFPARAM(); #ifdef SVQC if (self.think) return; // already activated @@ -146,7 +146,7 @@ void plat_trigger_use() void plat_crush() -{ +{SELFPARAM(); if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!! #ifdef SVQC @@ -176,7 +176,7 @@ void plat_crush() } void plat_use() -{ +{SELFPARAM(); self.use = func_null; if (self.state != 4) objerror ("plat_use: not in up state"); @@ -186,7 +186,7 @@ void plat_use() .string sound1, sound2; void plat_reset() -{ +{SELFPARAM(); IFTARGETED { setorigin (self, self.pos1); diff --git a/qcsrc/common/triggers/subs.qc b/qcsrc/common/triggers/subs.qc index fa7c1c5e45..0fa48b83eb 100644 --- a/qcsrc/common/triggers/subs.qc +++ b/qcsrc/common/triggers/subs.qc @@ -13,7 +13,7 @@ Applies some friction to self */ .float friction; void SUB_Friction (void) -{ +{SELFPARAM(); self.SUB_NEXTTHINK = time; if(self.SUB_FLAGS & FL_ONGROUND) self.SUB_VELOCITY = self.SUB_VELOCITY * (1 - frametime * self.friction); @@ -46,7 +46,7 @@ void SUB_VanishOrRemove (entity ent) } void SUB_SetFade_Think (void) -{ +{SELFPARAM(); if(self.alpha == 0) self.alpha = 1; self.SUB_THINK = SUB_SetFade_Think; @@ -81,7 +81,7 @@ self.SUB_ORIGIN traveling at speed =============== */ void SUB_CalcMoveDone (void) -{ +{SELFPARAM(); // After moving, set origin to exact final destination SUB_SETORIGIN (self, self.finaldest); @@ -93,7 +93,7 @@ void SUB_CalcMoveDone (void) .float platmovetype_turn; void SUB_CalcMove_controller_think (void) -{ +{SELFPARAM(); entity oldself; float traveltime; float phasepos; @@ -185,7 +185,7 @@ float TSPEED_END = 2; // TODO average too? void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void() func) -{ +{SELFPARAM(); float traveltime; entity controller; @@ -244,7 +244,7 @@ void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float } void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func) -{ +{SELFPARAM(); vector delta; float traveltime; @@ -293,7 +293,7 @@ void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func) } void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func) -{ +{SELFPARAM(); entity oldself; oldself = self; @@ -315,7 +315,7 @@ The calling function should make sure self.SUB_THINK is valid =============== */ void SUB_CalcAngleMoveDone (void) -{ +{SELFPARAM(); // After rotating, set angle to exact final angle self.angles = self.finalangle; self.SUB_AVELOCITY = '0 0 0'; @@ -326,7 +326,7 @@ void SUB_CalcAngleMoveDone (void) // FIXME: I fixed this function only for rotation around the main axes void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void() func) -{ +{SELFPARAM(); vector delta; float traveltime; @@ -368,7 +368,7 @@ void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void() } void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func) -{ +{SELFPARAM(); entity oldself; oldself = self; diff --git a/qcsrc/common/triggers/subs.qh b/qcsrc/common/triggers/subs.qh index ea8ef30574..b9ae06f4eb 100644 --- a/qcsrc/common/triggers/subs.qh +++ b/qcsrc/common/triggers/subs.qh @@ -27,7 +27,7 @@ #define SUB_FLAGS move_flags void SUB_SETORIGIN(entity s, vector v) - { + {SELFPARAM(); s.move_origin = v; entity oldself = self; self = s; diff --git a/qcsrc/common/triggers/target/changelevel.qc b/qcsrc/common/triggers/target/changelevel.qc index 8e5c31bfea..8dc694e621 100644 --- a/qcsrc/common/triggers/target/changelevel.qc +++ b/qcsrc/common/triggers/target/changelevel.qc @@ -4,7 +4,7 @@ void spawnfunc_target_changelevel_use() -{ +{SELFPARAM(); if(self.spawnflags & 2) { // simply don't react if a non-player triggers it @@ -36,7 +36,7 @@ void spawnfunc_target_changelevel_use() } void spawnfunc_target_changelevel() -{ +{SELFPARAM(); self.use = spawnfunc_target_changelevel_use; if(!self.count) { self.count = 0.7; } diff --git a/qcsrc/common/triggers/target/location.qc b/qcsrc/common/triggers/target/location.qc index 1430cabd81..554032ee60 100644 --- a/qcsrc/common/triggers/target/location.qc +++ b/qcsrc/common/triggers/target/location.qc @@ -1,13 +1,13 @@ #ifdef SVQC void spawnfunc_target_location() -{ +{SELFPARAM(); self.classname = "target_location"; // location name in netname // eventually support: count, teamgame selectors, line of sight? } void spawnfunc_info_location() -{ +{SELFPARAM(); self.classname = "target_location"; self.message = self.netname; } diff --git a/qcsrc/common/triggers/target/music.qc b/qcsrc/common/triggers/target/music.qc index b3a5a24330..091603d864 100644 --- a/qcsrc/common/triggers/target/music.qc +++ b/qcsrc/common/triggers/target/music.qc @@ -19,7 +19,7 @@ // when triggered, the music is overridden for activator until lifetime (or forever, if lifetime is 0) // when targetname is not set, THIS ONE is default void target_music_sendto(float to, float is) -{ +{SELFPARAM(); WriteByte(to, SVC_TEMPENTITY); WriteByte(to, TE_CSQC_TARGET_MUSIC); WriteShort(to, num_for_edict(self)); @@ -30,7 +30,7 @@ void target_music_sendto(float to, float is) WriteString(to, self.noise); } void target_music_reset() -{ +{SELFPARAM(); if(self.targetname == "") target_music_sendto(MSG_ALL, 1); } @@ -47,7 +47,7 @@ void target_music_use() FOR_EACH_SPEC(head) if(head.enemy == activator) { msg_entity = head; target_music_sendto(MSG_ONE, 1); } } void spawnfunc_target_music() -{ +{SELFPARAM(); self.use = target_music_use; self.reset = target_music_reset; if(!self.volume) @@ -58,7 +58,7 @@ void spawnfunc_target_music() target_music_sendto(MSG_INIT, 0); } void TargetMusic_RestoreGame() -{ +{SELFPARAM(); for(self = world; (self = find(self, classname, "target_music")); ) { if(self.targetname == "") @@ -76,7 +76,7 @@ void TargetMusic_RestoreGame() // 1 = START_OFF // when triggered, it is disabled/enabled for everyone float trigger_music_SendEntity(entity to, float sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_MUSIC); sf &= ~0x80; if(self.cnt) @@ -115,17 +115,17 @@ float trigger_music_SendEntity(entity to, float sf) return 1; } void trigger_music_reset() -{ +{SELFPARAM(); self.cnt = !(self.spawnflags & 1); self.SendFlags |= 0x80; } void trigger_music_use() -{ +{SELFPARAM(); self.cnt = !self.cnt; self.SendFlags |= 0x80; } void spawnfunc_trigger_music() -{ +{SELFPARAM(); if(self.model != "") setmodel(self, self.model); if(!self.volume) @@ -255,7 +255,7 @@ void Net_TargetMusic() } void Ent_TriggerMusic_Think() -{ +{SELFPARAM(); if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, self, world)) { music_trigger = self; @@ -264,14 +264,14 @@ void Ent_TriggerMusic_Think() } void Ent_TriggerMusic_Remove() -{ +{SELFPARAM(); if(self.noise) strunzone(self.noise); self.noise = string_null; } void Ent_ReadTriggerMusic() -{ +{SELFPARAM(); int f = ReadByte(); if(f & 4) { diff --git a/qcsrc/common/triggers/target/spawn.qc b/qcsrc/common/triggers/target/spawn.qc index da7aeda71e..020e404d30 100644 --- a/qcsrc/common/triggers/target/spawn.qc +++ b/qcsrc/common/triggers/target/spawn.qc @@ -23,17 +23,17 @@ float target_spawn_spawnfunc_field; float target_spawn_count; void target_spawn_helper_setmodel() -{ +{SELFPARAM(); setmodel(self, self.model); } void target_spawn_helper_setsize() -{ +{SELFPARAM(); setsize(self, self.mins, self.maxs); } void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity t3, entity t4, entity act) -{ +{SELFPARAM(); float i, n, valuefieldpos; string key, value, valuefield, valueoffset, valueoffsetrandom; entity valueent; @@ -244,7 +244,7 @@ void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity } void target_spawn_useon(entity e) -{ +{SELFPARAM(); self.target_spawn_activator = activator; target_spawn_edit_entity( e, @@ -258,7 +258,7 @@ void target_spawn_useon(entity e) } float target_spawn_cancreate() -{ +{SELFPARAM(); float c; entity e; @@ -277,7 +277,7 @@ float target_spawn_cancreate() } void target_spawn_use() -{ +{SELFPARAM(); entity e; if(self.target == "") @@ -304,7 +304,7 @@ void target_spawn_use() } void target_spawn_spawnfirst() -{ +{SELFPARAM(); activator = self.target_spawn_activator; if(self.spawnflags & 2) target_spawn_use(); @@ -339,7 +339,7 @@ void initialize_field_db() } void spawnfunc_target_spawn() -{ +{SELFPARAM(); initialize_field_db(); self.use = target_spawn_use; self.message = strzone(strreplace("'", "\"", self.message)); diff --git a/qcsrc/common/triggers/target/speaker.qc b/qcsrc/common/triggers/target/speaker.qc index 7be8b91b4c..058ffd5263 100644 --- a/qcsrc/common/triggers/target/speaker.qc +++ b/qcsrc/common/triggers/target/speaker.qc @@ -2,7 +2,7 @@ // TODO add a way to do looped sounds with sound(); then complete this entity void target_speaker_use_off(); void target_speaker_use_activator() -{ +{SELFPARAM(); if (!IS_REAL_CLIENT(activator)) return; string snd; @@ -31,7 +31,7 @@ void target_speaker_use_activator() soundto(MSG_ONE, self, CH_TRIGGER, snd, VOL_BASE * self.volume, self.atten); } void target_speaker_use_on() -{ +{SELFPARAM(); string snd; if(substring(self.noise, 0, 1) == "*") { @@ -59,12 +59,12 @@ void target_speaker_use_on() self.use = target_speaker_use_off; } void target_speaker_use_off() -{ +{SELFPARAM(); sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASE * self.volume, self.atten); self.use = target_speaker_use_on; } void target_speaker_reset() -{ +{SELFPARAM(); if(self.spawnflags & 1) // LOOPED_ON { if(self.use == target_speaker_use_on) @@ -78,7 +78,7 @@ void target_speaker_reset() } void spawnfunc_target_speaker() -{ +{SELFPARAM(); // TODO: "*" prefix to sound file name // TODO: wait and random (just, HOW? random is not a field) if(self.noise) diff --git a/qcsrc/common/triggers/target/voicescript.qc b/qcsrc/common/triggers/target/voicescript.qc index c173d80eef..35d84da8df 100644 --- a/qcsrc/common/triggers/target/voicescript.qc +++ b/qcsrc/common/triggers/target/voicescript.qc @@ -10,7 +10,7 @@ void target_voicescript_clear(entity pl) } void target_voicescript_use() -{ +{SELFPARAM(); if(activator.voicescript != self) { activator.voicescript = self; @@ -74,7 +74,7 @@ void target_voicescript_next(entity pl) } void spawnfunc_target_voicescript() -{ +{SELFPARAM(); // netname: directory of the sound files // message: list of "sound file" duration "sound file" duration, a *, and again a list // foo1 4.1 foo2 4.0 foo3 -3.1 * fool1 1.1 fool2 7.1 fool3 9.1 fool4 3.7 diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index 3421311691..7d76b3f280 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -63,7 +63,7 @@ void spawn_tdeath(vector v0, entity e, vector v) } void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags) -{ +{SELFPARAM(); entity telefragger; vector from; @@ -179,7 +179,7 @@ entity Simple_TeleportPlayer(entity teleporter, entity player) } void teleport_findtarget (void) -{ +{SELFPARAM(); entity e; float n; @@ -224,7 +224,7 @@ entity Teleport_Find(vector mi, vector ma) } void WarpZone_PostTeleportPlayer_Callback(entity pl) -{ +{SELFPARAM(); makevectors(pl.angles); Reset_ArcBeam(pl, v_forward); UpdateCSQCProjectileAfterTeleport(pl); diff --git a/qcsrc/common/triggers/trigger/counter.qc b/qcsrc/common/triggers/trigger/counter.qc index bf1d9b2da7..9eb7eb072b 100644 --- a/qcsrc/common/triggers/trigger/counter.qc +++ b/qcsrc/common/triggers/trigger/counter.qc @@ -1,6 +1,6 @@ #ifdef SVQC void counter_use() -{ +{SELFPARAM(); self.count -= 1; if (self.count < 0) return; @@ -24,7 +24,7 @@ void counter_use() } void counter_reset() -{ +{SELFPARAM(); self.count = self.cnt; multi_reset(); } @@ -37,7 +37,7 @@ If nomessage is not set, t will print "1 more.. " etc when triggered and "sequen After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself. */ void spawnfunc_trigger_counter() -{ +{SELFPARAM(); self.wait = -1; if (!self.count) self.count = 2; diff --git a/qcsrc/common/triggers/trigger/delay.qc b/qcsrc/common/triggers/trigger/delay.qc index b01efe3bba..a3e08e4d81 100644 --- a/qcsrc/common/triggers/trigger/delay.qc +++ b/qcsrc/common/triggers/trigger/delay.qc @@ -1,18 +1,18 @@ #ifdef SVQC void delay_use() -{ +{SELFPARAM(); self.think = SUB_UseTargets; self.nextthink = self.wait; } void delay_reset() -{ +{SELFPARAM(); self.think = func_null; self.nextthink = 0; } void spawnfunc_trigger_delay() -{ +{SELFPARAM(); if(!self.wait) self.wait = 1; diff --git a/qcsrc/common/triggers/trigger/disablerelay.qc b/qcsrc/common/triggers/trigger/disablerelay.qc index 2a0432c978..4545df1957 100644 --- a/qcsrc/common/triggers/trigger/disablerelay.qc +++ b/qcsrc/common/triggers/trigger/disablerelay.qc @@ -1,6 +1,6 @@ #ifdef SVQC void trigger_disablerelay_use() -{ +{SELFPARAM(); entity e; float a, b; @@ -25,7 +25,7 @@ void trigger_disablerelay_use() } void spawnfunc_trigger_disablerelay() -{ +{SELFPARAM(); self.use = trigger_disablerelay_use; } #endif diff --git a/qcsrc/common/triggers/trigger/flipflop.qc b/qcsrc/common/triggers/trigger/flipflop.qc index 12d8a5940a..b5a2eb8b29 100644 --- a/qcsrc/common/triggers/trigger/flipflop.qc +++ b/qcsrc/common/triggers/trigger/flipflop.qc @@ -3,14 +3,14 @@ "Flip-flop" trigger gate... lets only every second trigger event through */ void flipflop_use() -{ +{SELFPARAM(); self.state = !self.state; if(self.state) SUB_UseTargets(); } void spawnfunc_trigger_flipflop() -{ +{SELFPARAM(); if(self.spawnflags & 1) self.state = 1; self.use = flipflop_use; diff --git a/qcsrc/common/triggers/trigger/gamestart.qc b/qcsrc/common/triggers/trigger/gamestart.qc index 3ad419d22f..1b72780e51 100644 --- a/qcsrc/common/triggers/trigger/gamestart.qc +++ b/qcsrc/common/triggers/trigger/gamestart.qc @@ -1,13 +1,13 @@ #ifdef SVQC void gamestart_use() -{ +{SELFPARAM(); activator = self; SUB_UseTargets(); remove(self); } void spawnfunc_trigger_gamestart() -{ +{SELFPARAM(); self.use = gamestart_use; self.reset2 = spawnfunc_trigger_gamestart; diff --git a/qcsrc/common/triggers/trigger/gravity.qc b/qcsrc/common/triggers/trigger/gravity.qc index a709a1f2a7..659a336901 100644 --- a/qcsrc/common/triggers/trigger/gravity.qc +++ b/qcsrc/common/triggers/trigger/gravity.qc @@ -13,7 +13,7 @@ void trigger_gravity_remove(entity own) own.trigger_gravity_check = world; } void trigger_gravity_check_think() -{ +{SELFPARAM(); // This spawns when a player enters the gravity zone and checks if he left. // Each frame, self.count is set to 2 by trigger_gravity_touch() and decreased by 1 here. // It the player has left the gravity trigger, this will be allowed to reach 0 and indicate that. @@ -33,12 +33,12 @@ void trigger_gravity_check_think() } void trigger_gravity_use() -{ +{SELFPARAM(); self.state = !self.state; } void trigger_gravity_touch() -{ +{SELFPARAM(); float g; if(self.state != true) @@ -86,7 +86,7 @@ void trigger_gravity_touch() } void spawnfunc_trigger_gravity() -{ +{SELFPARAM(); if(self.gravity == 1) return; diff --git a/qcsrc/common/triggers/trigger/heal.qc b/qcsrc/common/triggers/trigger/heal.qc index 6d68610b5c..323a4a160d 100644 --- a/qcsrc/common/triggers/trigger/heal.qc +++ b/qcsrc/common/triggers/trigger/heal.qc @@ -1,7 +1,7 @@ #ifdef SVQC .float triggerhealtime; void trigger_heal_touch() -{ +{SELFPARAM(); if (self.active != ACTIVE_ACTIVE) return; @@ -26,7 +26,7 @@ void trigger_heal_touch() } void spawnfunc_trigger_heal() -{ +{SELFPARAM(); self.active = ACTIVE_ACTIVE; EXACTTRIGGER_INIT; diff --git a/qcsrc/common/triggers/trigger/hurt.qc b/qcsrc/common/triggers/trigger/hurt.qc index 3a15a77ff4..7a12011931 100644 --- a/qcsrc/common/triggers/trigger/hurt.qc +++ b/qcsrc/common/triggers/trigger/hurt.qc @@ -1,6 +1,6 @@ #ifdef SVQC void trigger_hurt_use() -{ +{SELFPARAM(); if(IS_PLAYER(activator)) self.enemy = activator; else @@ -9,7 +9,7 @@ void trigger_hurt_use() .float triggerhurttime; void trigger_hurt_touch() -{ +{SELFPARAM(); if (self.active != ACTIVE_ACTIVE) return; @@ -58,7 +58,7 @@ defalt dmg = 5 entity trigger_hurt_last; entity trigger_hurt_first; void spawnfunc_trigger_hurt() -{ +{SELFPARAM(); EXACTTRIGGER_INIT; self.active = ACTIVE_ACTIVE; self.touch = trigger_hurt_touch; diff --git a/qcsrc/common/triggers/trigger/impulse.qc b/qcsrc/common/triggers/trigger/impulse.qc index 7b8ebcfde9..2b3bb5729a 100644 --- a/qcsrc/common/triggers/trigger/impulse.qc +++ b/qcsrc/common/triggers/trigger/impulse.qc @@ -1,6 +1,6 @@ // targeted (directional) mode void trigger_impulse_touch1() -{ +{SELFPARAM(); entity targ; float pushdeltatime; float str; @@ -54,7 +54,7 @@ void trigger_impulse_touch1() // Directionless (accelerator/decelerator) mode void trigger_impulse_touch2() -{ +{SELFPARAM(); float pushdeltatime; if (self.active != ACTIVE_ACTIVE) @@ -79,7 +79,7 @@ void trigger_impulse_touch2() // Spherical (gravity/repulsor) mode void trigger_impulse_touch3() -{ +{SELFPARAM(); float pushdeltatime; float str; @@ -132,7 +132,7 @@ in directional and sperical mode. For damper/accelerator mode this is not nesses */ #ifdef SVQC bool trigger_impulse_send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_IMPULSE); WriteCoord(MSG_ENTITY, self.radius); @@ -151,7 +151,7 @@ void trigger_impulse_link() } void spawnfunc_trigger_impulse() -{ +{SELFPARAM(); self.active = ACTIVE_ACTIVE; EXACTTRIGGER_INIT; @@ -181,7 +181,7 @@ void spawnfunc_trigger_impulse() } #elif defined(CSQC) void ent_trigger_impulse() -{ +{SELFPARAM(); self.radius = ReadCoord(); self.strength = ReadCoord(); self.falloff = ReadByte(); diff --git a/qcsrc/common/triggers/trigger/jumppads.qc b/qcsrc/common/triggers/trigger/jumppads.qc index 47f08d3acb..31bd98e5dc 100644 --- a/qcsrc/common/triggers/trigger/jumppads.qc +++ b/qcsrc/common/triggers/trigger/jumppads.qc @@ -5,7 +5,7 @@ #include "../../movetypes/movetypes.qh" void trigger_push_use() -{ +{SELFPARAM(); if(teamplay) { self.team = activator.team; @@ -128,7 +128,7 @@ vector trigger_push_calculatevelocity(vector org, entity tgt, float ht) } void trigger_push_touch() -{ +{SELFPARAM(); if (self.active == ACTIVE_NOT) return; @@ -257,7 +257,7 @@ void trigger_push_link(); void trigger_push_updatelink(); #endif void trigger_push_findtarget() -{ +{SELFPARAM(); entity t; vector org; @@ -321,7 +321,7 @@ void trigger_push_findtarget() #ifdef SVQC float trigger_push_send(entity to, float sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH); WriteByte(MSG_ENTITY, sf); @@ -345,7 +345,7 @@ float trigger_push_send(entity to, float sf) } void trigger_push_updatelink() -{ +{SELFPARAM(); self.SendFlags |= 1; } @@ -368,7 +368,7 @@ void trigger_push_link() * movedir: if target is not set, this * speed * 10 is the velocity to be reached. */ void spawnfunc_trigger_push() -{ +{SELFPARAM(); SetMovedir (); EXACTTRIGGER_INIT; @@ -392,7 +392,7 @@ void spawnfunc_trigger_push() float target_push_send(entity to, float sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_TARGET_PUSH); WriteByte(MSG_ENTITY, self.cnt); @@ -405,7 +405,7 @@ float target_push_send(entity to, float sf) } void target_push_link() -{ +{SELFPARAM(); Net_LinkEntity(self, false, 0, target_push_send); self.SendFlags |= 1; // update } @@ -419,7 +419,7 @@ void spawnfunc_target_position() { target_push_link(); } #ifdef CSQC void ent_trigger_push() -{ +{SELFPARAM(); float sf = ReadByte(); if(sf & 1) @@ -449,7 +449,7 @@ void ent_trigger_push() } void target_push_remove() -{ +{SELFPARAM(); if(self.classname) strunzone(self.classname); self.classname = string_null; @@ -460,7 +460,7 @@ void target_push_remove() } void ent_target_push() -{ +{SELFPARAM(); self.classname = "push_target"; self.cnt = ReadByte(); self.targetname = strzone(ReadString()); diff --git a/qcsrc/common/triggers/trigger/keylock.qc b/qcsrc/common/triggers/trigger/keylock.qc index ec27d4b77f..8d6d174cba 100644 --- a/qcsrc/common/triggers/trigger/keylock.qc +++ b/qcsrc/common/triggers/trigger/keylock.qc @@ -2,7 +2,7 @@ * trigger given targets */ void trigger_keylock_trigger(string s) -{ +{SELFPARAM(); entity stemp = self; entity otemp = other; entity atemp = activator; @@ -33,7 +33,7 @@ void trigger_keylock_kill(string s) } void trigger_keylock_touch() -{ +{SELFPARAM(); bool key_used = false; bool started_delay = false; @@ -97,7 +97,7 @@ void trigger_keylock_touch() #ifdef SVQC bool trigger_keylock_send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_KEYLOCK); WriteInt24_t(MSG_ENTITY, self.itemkeys); @@ -134,7 +134,7 @@ If spawned without any key specified in itemkeys, this trigger will display an e message2 and noise2 will be resent to the player every 2 seconds while he is in the trigger zone. */ void spawnfunc_trigger_keylock(void) -{ +{SELFPARAM(); if(!self.itemkeys) { remove(self); return; } // set unlocked message @@ -176,7 +176,7 @@ void spawnfunc_trigger_keylock(void) } #elif defined(CSQC) void keylock_remove() -{ +{SELFPARAM(); if(self.target) { strunzone(self.target); } self.target = string_null; @@ -197,7 +197,7 @@ void keylock_remove() } void ent_keylock() -{ +{SELFPARAM(); self.itemkeys = ReadInt24_t(); self.height = ReadByte(); diff --git a/qcsrc/common/triggers/trigger/magicear.qc b/qcsrc/common/triggers/trigger/magicear.qc index f14b75c312..7ca85876c0 100644 --- a/qcsrc/common/triggers/trigger/magicear.qc +++ b/qcsrc/common/triggers/trigger/magicear.qc @@ -2,7 +2,7 @@ float magicear_matched; float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorepitch, float mintempo, float maxtempo); string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin) -{ +{SELFPARAM(); float domatch, dotrigger, matchstart, l; string s, msg; entity oldself; @@ -166,7 +166,7 @@ string trigger_magicear_processmessage_forallears(entity source, float teamsay, } void spawnfunc_trigger_magicear() -{ +{SELFPARAM(); self.enemy = magicears; magicears = self; diff --git a/qcsrc/common/triggers/trigger/monoflop.qc b/qcsrc/common/triggers/trigger/monoflop.qc index 45ce761e03..5129ce35cd 100644 --- a/qcsrc/common/triggers/trigger/monoflop.qc +++ b/qcsrc/common/triggers/trigger/monoflop.qc @@ -3,7 +3,7 @@ "Mono-flop" trigger gate... turns one trigger event into one "on" and one "off" event, separated by a delay of "wait" */ void monoflop_use() -{ +{SELFPARAM(); self.nextthink = time + self.wait; self.enemy = activator; if(self.state) @@ -12,7 +12,7 @@ void monoflop_use() SUB_UseTargets(); } void monoflop_fixed_use() -{ +{SELFPARAM(); if(self.state) return; self.nextthink = time + self.wait; @@ -22,20 +22,20 @@ void monoflop_fixed_use() } void monoflop_think() -{ +{SELFPARAM(); self.state = 0; activator = self.enemy; SUB_UseTargets(); } void monoflop_reset() -{ +{SELFPARAM(); self.state = 0; self.nextthink = 0; } void spawnfunc_trigger_monoflop() -{ +{SELFPARAM(); if(!self.wait) self.wait = 1; if(self.spawnflags & 1) diff --git a/qcsrc/common/triggers/trigger/multi.qc b/qcsrc/common/triggers/trigger/multi.qc index 0e9a02016c..007e6da2f5 100644 --- a/qcsrc/common/triggers/trigger/multi.qc +++ b/qcsrc/common/triggers/trigger/multi.qc @@ -3,7 +3,7 @@ #ifdef SVQC // the wait time has passed, so set back up for another activation void multi_wait() -{ +{SELFPARAM(); if (self.max_health) { self.health = self.max_health; @@ -17,7 +17,7 @@ void multi_wait() // self.enemy should be set to the activator so it can be held through a delay // so wait for the delay time before firing void multi_trigger() -{ +{SELFPARAM(); if (self.nextthink > time) { return; // allready been triggered @@ -58,14 +58,14 @@ void multi_trigger() } void multi_use() -{ +{SELFPARAM(); self.goalentity = other; self.enemy = activator; multi_trigger(); } void multi_touch() -{ +{SELFPARAM(); if(!(self.spawnflags & 2)) if(!other.iscreature) return; @@ -96,7 +96,7 @@ void multi_touch() } void multi_eventdamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if (!self.takedamage) return; if(self.spawnflags & DOOR_NOSPLASH) @@ -112,7 +112,7 @@ void multi_eventdamage (entity inflictor, entity attacker, float damage, int dea } void multi_reset() -{ +{SELFPARAM(); if ( !(self.spawnflags & SPAWNFLAG_NOTOUCH) ) self.touch = multi_touch; if (self.max_health) @@ -140,7 +140,7 @@ sounds set "message" to text string */ void spawnfunc_trigger_multiple() -{ +{SELFPARAM(); self.reset = multi_reset; if (self.sounds == 1) { @@ -203,7 +203,7 @@ sounds set "message" to text string */ void spawnfunc_trigger_once() -{ +{SELFPARAM(); self.wait = -1; spawnfunc_trigger_multiple(); } diff --git a/qcsrc/common/triggers/trigger/multivibrator.qc b/qcsrc/common/triggers/trigger/multivibrator.qc index 02a258e87f..d9c6c2e60c 100644 --- a/qcsrc/common/triggers/trigger/multivibrator.qc +++ b/qcsrc/common/triggers/trigger/multivibrator.qc @@ -1,6 +1,6 @@ #ifdef SVQC void multivibrator_send() -{ +{SELFPARAM(); float newstate; float cyclestart; @@ -20,7 +20,7 @@ void multivibrator_send() } void multivibrator_toggle() -{ +{SELFPARAM(); if(self.nextthink == 0) { multivibrator_send(); @@ -37,7 +37,7 @@ void multivibrator_toggle() } void multivibrator_reset() -{ +{SELFPARAM(); if(!(self.spawnflags & 1)) self.nextthink = 0; // wait for a trigger event else @@ -56,7 +56,7 @@ respawntime: "off" cycle time (default: same as wait) START_ON: assume it is already turned on (when targeted) */ void spawnfunc_trigger_multivibrator() -{ +{SELFPARAM(); if(!self.wait) self.wait = 1; if(!self.respawntime) diff --git a/qcsrc/common/triggers/trigger/relay.qc b/qcsrc/common/triggers/trigger/relay.qc index e037028aee..20962cd495 100644 --- a/qcsrc/common/triggers/trigger/relay.qc +++ b/qcsrc/common/triggers/trigger/relay.qc @@ -3,7 +3,7 @@ This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages. */ void spawnfunc_trigger_relay() -{ +{SELFPARAM(); self.use = SUB_UseTargets; self.reset = spawnfunc_trigger_relay; // this spawnfunc resets fully } diff --git a/qcsrc/common/triggers/trigger/relay_activators.qc b/qcsrc/common/triggers/trigger/relay_activators.qc index 83c0103d09..e25253b84d 100644 --- a/qcsrc/common/triggers/trigger/relay_activators.qc +++ b/qcsrc/common/triggers/trigger/relay_activators.qc @@ -1,6 +1,6 @@ #ifdef SVQC void relay_activators_use() -{ +{SELFPARAM(); entity trg, os; os = self; @@ -26,19 +26,19 @@ void relay_activators_use() } void spawnfunc_relay_activate() -{ +{SELFPARAM(); self.cnt = ACTIVE_ACTIVE; self.use = relay_activators_use; } void spawnfunc_relay_deactivate() -{ +{SELFPARAM(); self.cnt = ACTIVE_NOT; self.use = relay_activators_use; } void spawnfunc_relay_activatetoggle() -{ +{SELFPARAM(); self.cnt = ACTIVE_TOGGLE; self.use = relay_activators_use; } diff --git a/qcsrc/common/triggers/trigger/relay_if.qc b/qcsrc/common/triggers/trigger/relay_if.qc index ade56c1e8b..cadd95e584 100644 --- a/qcsrc/common/triggers/trigger/relay_if.qc +++ b/qcsrc/common/triggers/trigger/relay_if.qc @@ -1,6 +1,6 @@ #ifdef SVQC void trigger_relay_if_use() -{ +{SELFPARAM(); float n; n = self.count; @@ -14,7 +14,7 @@ void trigger_relay_if_use() } void spawnfunc_trigger_relay_if() -{ +{SELFPARAM(); self.use = trigger_relay_if_use; } #endif diff --git a/qcsrc/common/triggers/trigger/relay_teamcheck.qc b/qcsrc/common/triggers/trigger/relay_teamcheck.qc index 8a77cef051..f93287a920 100644 --- a/qcsrc/common/triggers/trigger/relay_teamcheck.qc +++ b/qcsrc/common/triggers/trigger/relay_teamcheck.qc @@ -1,6 +1,6 @@ #ifdef SVQC void trigger_relay_teamcheck_use() -{ +{SELFPARAM(); if(activator.team) { if(self.spawnflags & 2) @@ -22,12 +22,12 @@ void trigger_relay_teamcheck_use() } void trigger_relay_teamcheck_reset() -{ +{SELFPARAM(); self.team = self.team_saved; } void spawnfunc_trigger_relay_teamcheck() -{ +{SELFPARAM(); self.team_saved = self.team; self.use = trigger_relay_teamcheck_use; self.reset = trigger_relay_teamcheck_reset; diff --git a/qcsrc/common/triggers/trigger/secret.qc b/qcsrc/common/triggers/trigger/secret.qc index b93ab03d0a..27347d9e83 100644 --- a/qcsrc/common/triggers/trigger/secret.qc +++ b/qcsrc/common/triggers/trigger/secret.qc @@ -9,7 +9,8 @@ #ifdef SVQC -void secrets_setstatus() { +void secrets_setstatus() +{SELFPARAM(); self.stat_secrets_total = secrets_total; self.stat_secrets_found = secrets_found; } @@ -17,7 +18,8 @@ void secrets_setstatus() { /** * A secret has been found (maybe :P) */ -void trigger_secret_touch() { +void trigger_secret_touch() +{SELFPARAM(); // only a player can trigger this if (!IS_PLAYER(other)) return; @@ -49,7 +51,8 @@ killtarget: remove all entities with this targetname when triggered You should create a common/trigger textured brush covering the entrance to a secret room/area. Trigger secret can only be trigger by a player's touch and can not be a target itself. */ -void spawnfunc_trigger_secret() { +void spawnfunc_trigger_secret() +{SELFPARAM(); // FIXME: should it be disabled in most modes? // update secrets count diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc index b99332b984..b9a4acd1a4 100644 --- a/qcsrc/common/triggers/trigger/swamp.qc +++ b/qcsrc/common/triggers/trigger/swamp.qc @@ -38,7 +38,7 @@ void swampslug_think(); * I do it this way becuz there is no "untouch" event. */ void swampslug_think(void) -{ +{SELFPARAM(); //Slowly kill the slug self.health = self.health - 1; @@ -62,7 +62,7 @@ void swampslug_think(void) } void swamp_touch(void) -{ +{SELFPARAM(); // If whatever thats touching the swamp is not a player // or if its a dead player, just dont care abt it. if(!IS_PLAYER(other) || PHYS_DEAD(other)) @@ -95,7 +95,7 @@ void swamp_touch(void) #ifdef SVQC float swamp_send(entity to, float sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER); WriteByte(MSG_ENTITY, self.dmg); // can probably get away with using a single byte here @@ -108,7 +108,7 @@ float swamp_send(entity to, float sf) } void swamp_link() -{ +{SELFPARAM(); Net_LinkEntity(self, false, 0, func_ladder_send); } @@ -117,7 +117,7 @@ Players gettin into the swamp will get slowd down and damaged */ void spawnfunc_trigger_swamp(void) -{ +{SELFPARAM(); // Init stuff EXACTTRIGGER_INIT; self.touch = swamp_touch; @@ -136,7 +136,7 @@ void spawnfunc_trigger_swamp(void) #elif defined(CSQC) void ent_swamp() -{ +{SELFPARAM(); self.dmg = ReadByte(); self.swamp_slowdown = ReadByte(); self.swamp_interval = ReadByte(); diff --git a/qcsrc/common/triggers/trigger/teleport.qc b/qcsrc/common/triggers/trigger/teleport.qc index d983cf3aec..5adc1505c5 100644 --- a/qcsrc/common/triggers/trigger/teleport.qc +++ b/qcsrc/common/triggers/trigger/teleport.qc @@ -1,6 +1,6 @@ #ifdef SVQC void trigger_teleport_use() -{ +{SELFPARAM(); if(teamplay) self.team = activator.team; #ifdef SVQC @@ -9,7 +9,7 @@ void trigger_teleport_use() } void Teleport_Touch (void) -{ +{SELFPARAM(); entity oldself; string s; @@ -53,7 +53,7 @@ void Teleport_Touch (void) } void spawnfunc_trigger_teleport() -{ +{SELFPARAM(); self.angles = '0 0 0'; EXACTTRIGGER_INIT; diff --git a/qcsrc/common/triggers/trigger/viewloc.qc b/qcsrc/common/triggers/trigger/viewloc.qc index 62c37a0f49..de2d3aac28 100644 --- a/qcsrc/common/triggers/trigger/viewloc.qc +++ b/qcsrc/common/triggers/trigger/viewloc.qc @@ -9,7 +9,7 @@ #ifdef SVQC void viewloc_think() -{ +{SELFPARAM(); entity e; // we abuse this method, rather than using normal .touch, because touch isn't reliable with multiple clients inside the same trigger, and can't "untouch" entities @@ -39,7 +39,7 @@ void viewloc_think() } bool trigger_viewloc_send(entity to, int sf) -{ +{SELFPARAM(); // CSQC doesn't need to know our origin (yet), as we're only available for referencing WriteByte(MSG_ENTITY, ENT_CLIENT_VIEWLOC_TRIGGER); @@ -54,7 +54,7 @@ bool trigger_viewloc_send(entity to, int sf) } void viewloc_init() -{ +{SELFPARAM(); entity e; for(e = world; (e = find(e, targetname, self.target)); ) if(e.classname == "target_viewlocation_start") @@ -81,7 +81,7 @@ void viewloc_init() } void spawnfunc_trigger_viewlocation() -{ +{SELFPARAM(); // we won't check target2 here yet, as it may not even need to exist if(self.target == "") { LOG_INFO("^1FAIL!\n"); remove(self); return; } @@ -90,7 +90,7 @@ void spawnfunc_trigger_viewlocation() } bool viewloc_send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_VIEWLOC); WriteByte(MSG_ENTITY, self.cnt); @@ -108,20 +108,20 @@ bool viewloc_send(entity to, int sf) .float angle; void viewloc_link() -{ +{SELFPARAM(); if(self.angle) self.angles_y = self.angle; Net_LinkEntity(self, false, 0, viewloc_send); } void spawnfunc_target_viewlocation_start() -{ +{SELFPARAM(); self.classname = "target_viewlocation_start"; self.cnt = 1; viewloc_link(); } void spawnfunc_target_viewlocation_end() -{ +{SELFPARAM(); self.classname = "target_viewlocation_end"; self.cnt = 2; viewloc_link(); @@ -133,13 +133,13 @@ void spawnfunc_target_viewlocation() { spawnfunc_target_viewlocation_start(); } #elif defined(CSQC) void trigger_viewloc_updatelink() -{ +{SELFPARAM(); self.enemy = findfloat(world, entnum, self.cnt); self.goalentity = findfloat(world, entnum, self.count); } void ent_viewloc_trigger() -{ +{SELFPARAM(); float point1 = ReadShort(); float point2 = ReadShort(); @@ -162,7 +162,7 @@ void ent_viewloc_trigger() } void ent_viewloc() -{ +{SELFPARAM(); self.cnt = ReadByte(); self.origin_x = ReadCoord(); diff --git a/qcsrc/common/triggers/triggers.qc b/qcsrc/common/triggers/triggers.qc index 1e7715a91b..09c9fcd108 100644 --- a/qcsrc/common/triggers/triggers.qc +++ b/qcsrc/common/triggers/triggers.qc @@ -3,7 +3,7 @@ void SUB_DontUseTargets() { } void() SUB_UseTargets; void DelayThink() -{ +{SELFPARAM(); activator = self.enemy; SUB_UseTargets (); remove(self); @@ -22,7 +22,7 @@ void FixSize(entity e) #ifdef SVQC void trigger_common_write(bool withtarget) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, self.warpzone_isboxy); WriteByte(MSG_ENTITY, self.scale); @@ -59,7 +59,7 @@ void trigger_common_write(bool withtarget) #elif defined(CSQC) void trigger_common_read(bool withtarget) -{ +{SELFPARAM(); self.warpzone_isboxy = ReadByte(); self.scale = ReadByte(); @@ -96,7 +96,7 @@ void trigger_common_read(bool withtarget) } void trigger_remove_generic() -{ +{SELFPARAM(); if(self.target) { strunzone(self.target); } self.target = string_null; @@ -137,7 +137,7 @@ match (string)self.target and call their .use function ============================== */ void SUB_UseTargets() -{ +{SELFPARAM(); entity t, stemp, otemp, act; string s; float i; @@ -247,7 +247,7 @@ void SUB_UseTargets() #ifdef CSQC void trigger_touch_generic(void() touchfunc) -{ +{SELFPARAM(); entity e; for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain) if(e.isplayermodel || e.classname == "csqcprojectile") @@ -267,7 +267,7 @@ void trigger_touch_generic(void() touchfunc) } } void trigger_draw_generic() -{ +{SELFPARAM(); float dt = time - self.move_time; self.move_time = time; if(dt <= 0) { return; } diff --git a/qcsrc/common/turrets/checkpoint.qc b/qcsrc/common/turrets/checkpoint.qc index 924ba7ecf0..2b0bd6f676 100644 --- a/qcsrc/common/turrets/checkpoint.qc +++ b/qcsrc/common/turrets/checkpoint.qc @@ -34,7 +34,7 @@ void turret_checkpoint_use() #if 0 void turret_checkpoint_think() -{ +{SELFPARAM(); if(self.enemy) te_lightning1(self,self.origin, self.enemy.origin); @@ -52,7 +52,7 @@ If the checkpoint chain in not looped, the unit will go "Roaming" when the last */ //float tc_acum; void turret_checkpoint_init() -{ +{SELFPARAM(); traceline(self.origin + '0 0 16', self.origin - '0 0 1024', MOVE_WORLDONLY, self); setorigin(self, trace_endpos + '0 0 32'); @@ -68,7 +68,7 @@ void turret_checkpoint_init() } void spawnfunc_turret_checkpoint() -{ +{SELFPARAM(); setorigin(self,self.origin); self.think = turret_checkpoint_init; self.nextthink = time + 0.2; @@ -76,7 +76,7 @@ void spawnfunc_turret_checkpoint() // Compat. void spawnfunc_walker_checkpoint() -{ +{SELFPARAM(); self.classname = "turret_checkpoint"; spawnfunc_turret_checkpoint(); } diff --git a/qcsrc/common/turrets/cl_turrets.qc b/qcsrc/common/turrets/cl_turrets.qc index f083e80d61..174e0ea7d4 100644 --- a/qcsrc/common/turrets/cl_turrets.qc +++ b/qcsrc/common/turrets/cl_turrets.qc @@ -1,5 +1,5 @@ void turret_remove() -{ +{SELFPARAM(); remove(self.tur_head); //remove(self.enemy); self.tur_head = world; @@ -7,7 +7,7 @@ void turret_remove() .vector glowmod; void turret_changeteam() -{ +{SELFPARAM(); self.glowmod = Team_ColorRGB(self.team - 1) * 2; self.teamradar_color = Team_ColorRGB(self.team - 1); @@ -20,12 +20,12 @@ void turret_changeteam() } void turret_head_draw() -{ +{SELFPARAM(); self.drawmask = MASK_NORMAL; } void turret_draw() -{ +{SELFPARAM(); float dt; dt = time - self.move_time; @@ -54,7 +54,7 @@ void turret_draw() } void turret_draw2d() -{ +{SELFPARAM(); if(self.netname == "") return; @@ -202,7 +202,7 @@ void turret_draw2d() } void turret_construct() -{ +{SELFPARAM(); entity tur = get_turretinfo(self.turretid); if(self.tur_head == world) @@ -247,7 +247,7 @@ void turret_construct() entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode); void turret_gibboom(); void turret_gib_draw() -{ +{SELFPARAM(); Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy); self.drawmask = MASK_NORMAL; @@ -269,7 +269,7 @@ void turret_gib_draw() } void turret_gibboom() -{ +{SELFPARAM(); float i; sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); @@ -317,7 +317,7 @@ entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, flo } void turret_die() -{ +{SELFPARAM(); sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); pointparticles(particleeffectnum(EFFECT_ROCKET_EXPLODE), self.origin, '0 0 0', 1); if (!autocvar_cl_nogibs) @@ -356,7 +356,7 @@ void turret_die() } void ent_turret() -{ +{SELFPARAM(); float sf; sf = ReadByte(); diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index 5b8ffede87..a551ddde07 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -3,7 +3,7 @@ // Generic aiming vector turret_aim_generic() -{ +{SELFPARAM(); vector pre_pos, prep; float distance, impact_time = 0, i, mintime; @@ -165,14 +165,14 @@ float turret_targetscore_generic(entity _turret, entity _target) // Generic damage handling void turret_hide() -{ +{SELFPARAM(); self.effects |= EF_NODRAW; self.nextthink = time + self.respawntime - 0.2; self.think = turret_respawn; } void turret_die() -{ +{SELFPARAM(); self.deadflag = DEAD_DEAD; self.tur_head.deadflag = self.deadflag; @@ -207,7 +207,7 @@ void turret_die() } void turret_damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce) -{ +{SELFPARAM(); // Enough already! if(self.deadflag == DEAD_DEAD) return; @@ -252,7 +252,7 @@ void turret_damage (entity inflictor, entity attacker, float damage, int deathty void() turret_think; void turret_respawn() -{ +{SELFPARAM(); // Make sure all parts belong to the same team since // this function doubles as "teamchange" function. self.tur_head.team = self.team; @@ -283,7 +283,7 @@ void turret_respawn() #define cvar_base "g_turrets_unit_" .float clientframe; void turrets_setframe(float _frame, float client_only) -{ +{SELFPARAM(); if((client_only ? self.clientframe : self.frame ) != _frame) { self.SendFlags |= TNSF_ANIM; @@ -298,7 +298,7 @@ void turrets_setframe(float _frame, float client_only) } float turret_send(entity to, float sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_TURRET); WriteByte(MSG_ENTITY, sf); @@ -359,7 +359,7 @@ float turret_send(entity to, float sf) } void load_unit_settings(entity ent, string unitname, float is_reload) -{ +{SELFPARAM(); string sbase; if (ent == world) @@ -423,7 +423,7 @@ void load_unit_settings(entity ent, string unitname, float is_reload) } void turret_projectile_explode() -{ +{SELFPARAM(); self.takedamage = DAMAGE_NO; self.event_damage = func_null; @@ -445,7 +445,7 @@ void turret_projectile_touch() } void turret_projectile_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce) -{ +{SELFPARAM(); self.velocity += vforce; self.health -= damage; //self.realowner = attacker; // Dont change realowner, it does not make much sense for turrets @@ -454,7 +454,7 @@ void turret_projectile_damage(entity inflictor, entity attacker, float damage, i } entity turret_projectile(string _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim) -{ +{SELFPARAM(); entity proj; sound (self, CH_WEAPON_A, _snd, VOL_BASE, ATTEN_NORM); @@ -493,7 +493,7 @@ entity turret_projectile(string _snd, float _size, float _health, float _death, ** and updated aim<->predict impact distance. **/ void turret_do_updates(entity t_turret) -{ +{SELFPARAM(); vector enemy_pos; entity oldself; @@ -536,7 +536,7 @@ void turret_do_updates(entity t_turret) **/ .float turret_framecounter; void turret_track() -{ +{SELFPARAM(); vector target_angle; // This is where we want to aim vector move_angle; // This is where we can aim float f_tmp; @@ -834,7 +834,7 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl } entity turret_select_target() -{ +{SELFPARAM(); entity e; // target looper entity float score; // target looper entity score entity e_enemy; // currently best scoreing target @@ -901,7 +901,7 @@ entity turret_select_target() ** Preforms pre-fire checks based on the uints firecheck_flags **/ float turret_firecheck() -{ +{SELFPARAM(); // This one just dont care =) if (self.firecheck_flags & TFL_FIRECHECK_NO) return 1; @@ -975,7 +975,7 @@ float turret_firecheck() } bool turret_checkfire() -{ +{SELFPARAM(); bool ret = false; // dummy if(MUTATOR_CALLHOOK(Turret_CheckFire, ret)) return ret_bool; @@ -984,7 +984,7 @@ bool turret_checkfire() } void turret_fire() -{ +{SELFPARAM(); if (autocvar_g_turrets_nofire != 0) return; @@ -1014,7 +1014,7 @@ void turret_fire() } void turret_think() -{ +{SELFPARAM(); entity e; self.nextthink = time + self.ticrate; @@ -1188,7 +1188,7 @@ void turret_think() If activator is world, the turret go inactive. */ void turret_use() -{ +{SELFPARAM(); LOG_TRACE("Turret ",self.netname, " used by ", activator.classname, "\n"); self.team = activator.team; @@ -1201,7 +1201,7 @@ void turret_use() } void turret_link() -{ +{SELFPARAM(); Net_LinkEntity(self, true, 0, turret_send); self.think = turret_think; self.nextthink = time; @@ -1209,7 +1209,7 @@ void turret_link() } void turrets_manager_think() -{ +{SELFPARAM(); self.nextthink = time + 1; entity e; @@ -1231,7 +1231,7 @@ void turrets_manager_think() } float turret_initialize(float tur_id) -{ +{SELFPARAM(); if(!autocvar_g_turrets) return false; diff --git a/qcsrc/common/turrets/targettrigger.qc b/qcsrc/common/turrets/targettrigger.qc index 65510645b1..21e45a5533 100644 --- a/qcsrc/common/turrets/targettrigger.qc +++ b/qcsrc/common/turrets/targettrigger.qc @@ -2,7 +2,7 @@ void spawnfunc_turret_targettrigger(); void turret_targettrigger_touch(); void turret_targettrigger_touch() -{ +{SELFPARAM(); entity e; if (self.cnt > time) return; entity oldself; @@ -29,7 +29,7 @@ void turret_targettrigger_touch() /*QUAKED turret_targettrigger (.5 .5 .5) ? */ void spawnfunc_turret_targettrigger() -{ +{SELFPARAM(); if(!autocvar_g_turrets) { remove(self); return; } InitTrigger (); diff --git a/qcsrc/common/turrets/unit/ewheel.qc b/qcsrc/common/turrets/unit/ewheel.qc index 1a09611da0..716a70ceff 100644 --- a/qcsrc/common/turrets/unit/ewheel.qc +++ b/qcsrc/common/turrets/unit/ewheel.qc @@ -25,7 +25,7 @@ const float ewheel_anim_bck_fast = 4; //#define EWHEEL_FANCYPATH void ewheel_move_path() -{ +{SELFPARAM(); #ifdef EWHEEL_FANCYPATH // Are we close enougth to a path node to switch to the next? if (vlen(self.origin - self.pathcurrent.origin) < 64) @@ -68,7 +68,7 @@ void ewheel_move_path() } void ewheel_move_enemy() -{ +{SELFPARAM(); float newframe; self.steerto = steerlib_arrive(self.enemy.origin,self.target_range_optimal); @@ -109,7 +109,7 @@ void ewheel_move_enemy() } void ewheel_move_idle() -{ +{SELFPARAM(); if(self.frame != 0) { self.SendFlags |= TNSF_ANIM; @@ -121,10 +121,10 @@ void ewheel_move_idle() movelib_beak_simple((autocvar_g_turrets_unit_ewheel_speed_stop)); } -void spawnfunc_turret_ewheel() { if(!turret_initialize(TUR_EWHEEL)) remove(self); } +void spawnfunc_turret_ewheel() { SELFPARAM(); if(!turret_initialize(TUR_EWHEEL)) remove(self); } float t_ewheel(float req) -{ +{SELFPARAM(); switch(req) { case TR_ATTACK: @@ -265,7 +265,7 @@ float t_ewheel(float req) #ifdef CSQC void ewheel_draw() -{ +{SELFPARAM(); float dt; dt = time - self.move_time; @@ -284,7 +284,7 @@ void ewheel_draw() } float t_ewheel(float req) -{ +{SELFPARAM(); switch(req) { case TR_SETUP: diff --git a/qcsrc/common/turrets/unit/flac.qc b/qcsrc/common/turrets/unit/flac.qc index 3b834e4775..eff6a5801e 100644 --- a/qcsrc/common/turrets/unit/flac.qc +++ b/qcsrc/common/turrets/unit/flac.qc @@ -12,7 +12,7 @@ REGISTER_TURRET( #else #ifdef SVQC void turret_flac_projectile_think_explode() -{ +{SELFPARAM(); if(self.enemy != world) if(vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 3) setorigin(self,self.enemy.origin + randomvec() * self.owner.shot_radius); @@ -28,10 +28,10 @@ void turret_flac_projectile_think_explode() remove(self); } -void spawnfunc_turret_flac() { if(!turret_initialize(TUR_FLAC)) remove(self); } +void spawnfunc_turret_flac() { SELFPARAM(); if(!turret_initialize(TUR_FLAC)) remove(self); } float t_flac(float req) -{ +{SELFPARAM(); switch(req) { case TR_ATTACK: diff --git a/qcsrc/common/turrets/unit/fusionreactor.qc b/qcsrc/common/turrets/unit/fusionreactor.qc index ca4c3e2de0..25cddf006e 100644 --- a/qcsrc/common/turrets/unit/fusionreactor.qc +++ b/qcsrc/common/turrets/unit/fusionreactor.qc @@ -12,7 +12,7 @@ REGISTER_TURRET( #else #ifdef SVQC bool turret_fusionreactor_firecheck() -{ +{SELFPARAM(); if (self.attack_finished_single > time) return false; @@ -40,10 +40,10 @@ bool turret_fusionreactor_firecheck() return true; } -void spawnfunc_turret_fusionreactor() { if(!turret_initialize(TUR_FUSIONREACTOR)) remove(self); } +void spawnfunc_turret_fusionreactor() { SELFPARAM(); if(!turret_initialize(TUR_FUSIONREACTOR)) remove(self); } float t_fusionreactor(float req) -{ +{SELFPARAM(); switch(req) { case TR_ATTACK: diff --git a/qcsrc/common/turrets/unit/hellion.qc b/qcsrc/common/turrets/unit/hellion.qc index 882f852bc2..66b9907998 100644 --- a/qcsrc/common/turrets/unit/hellion.qc +++ b/qcsrc/common/turrets/unit/hellion.qc @@ -15,7 +15,7 @@ float autocvar_g_turrets_unit_hellion_shot_speed_gain; float autocvar_g_turrets_unit_hellion_shot_speed_max; void turret_hellion_missile_think() -{ +{SELFPARAM(); vector olddir,newdir; vector pre_pos; float itime; @@ -76,10 +76,10 @@ void turret_hellion_missile_think() UpdateCSQCProjectile(self); } -void spawnfunc_turret_hellion() { if(!turret_initialize(TUR_HELLION)) remove(self); } +void spawnfunc_turret_hellion() { SELFPARAM(); if(!turret_initialize(TUR_HELLION)) remove(self); } float t_hellion(float req) -{ +{SELFPARAM(); switch(req) { case TR_ATTACK: diff --git a/qcsrc/common/turrets/unit/hk.qc b/qcsrc/common/turrets/unit/hk.qc index fec2a69366..8a78e976ad 100644 --- a/qcsrc/common/turrets/unit/hk.qc +++ b/qcsrc/common/turrets/unit/hk.qc @@ -25,7 +25,7 @@ float autocvar_g_turrets_unit_hk_shot_speed_turnrate; #endif float hk_is_valid_target(entity e_target) -{ +{SELFPARAM(); if (e_target == world) return 0; @@ -59,7 +59,7 @@ float hk_is_valid_target(entity e_target) } void turret_hk_missile_think() -{ +{SELFPARAM(); vector vu, vd, vf, vl, vr, ve; // Vector (direction) float fu, fd, ff, fl, fr, fe; // Fraction to solid vector olddir,wishdir,newdir; // Final direction @@ -260,7 +260,7 @@ void turret_hk_missile_think() } float turret_hk_addtarget(entity e_target,entity e_sender) -{ +{SELFPARAM(); if (e_target) { if (turret_validate_target(self,e_target,self.target_validate_flags) > 0) @@ -273,10 +273,10 @@ float turret_hk_addtarget(entity e_target,entity e_sender) return 0; } -void spawnfunc_turret_hk() { if(!turret_initialize(TUR_HK)) remove(self); } +void spawnfunc_turret_hk() { SELFPARAM(); if(!turret_initialize(TUR_HK)) remove(self); } float t_hk(float req) -{ +{SELFPARAM(); switch(req) { case TR_ATTACK: diff --git a/qcsrc/common/turrets/unit/machinegun.qc b/qcsrc/common/turrets/unit/machinegun.qc index 5d5d62c832..8b580af0a9 100644 --- a/qcsrc/common/turrets/unit/machinegun.qc +++ b/qcsrc/common/turrets/unit/machinegun.qc @@ -11,12 +11,12 @@ REGISTER_TURRET( ); #else #ifdef SVQC -void spawnfunc_turret_machinegun() { if(!turret_initialize(TUR_MACHINEGUN)) remove(self); } +void spawnfunc_turret_machinegun() { SELFPARAM(); if(!turret_initialize(TUR_MACHINEGUN)) remove(self); } void W_MachineGun_MuzzleFlash(void); float t_machinegun(float req) -{ +{SELFPARAM(); switch(req) { case TR_ATTACK: diff --git a/qcsrc/common/turrets/unit/mlrs.qc b/qcsrc/common/turrets/unit/mlrs.qc index fca6a5b718..548ca8fc80 100644 --- a/qcsrc/common/turrets/unit/mlrs.qc +++ b/qcsrc/common/turrets/unit/mlrs.qc @@ -11,10 +11,10 @@ REGISTER_TURRET( ); #else #ifdef SVQC -void spawnfunc_turret_mlrs() { if(!turret_initialize(TUR_MLRS)) remove(self); } +void spawnfunc_turret_mlrs() { SELFPARAM(); if(!turret_initialize(TUR_MLRS)) remove(self); } float t_mlrs(float req) -{ +{SELFPARAM(); switch(req) { case TR_ATTACK: diff --git a/qcsrc/common/turrets/unit/phaser.qc b/qcsrc/common/turrets/unit/phaser.qc index 7d377174f7..cbb07070a6 100644 --- a/qcsrc/common/turrets/unit/phaser.qc +++ b/qcsrc/common/turrets/unit/phaser.qc @@ -14,13 +14,13 @@ REGISTER_TURRET( .float fireflag; float turret_phaser_firecheck() -{ +{SELFPARAM(); if (self.fireflag != 0) return 0; return turret_firecheck(); } void beam_think() -{ +{SELFPARAM(); if ((time > self.cnt) || (self.owner.deadflag != DEAD_NO)) { self.owner.attack_finished_single = time + self.owner.shot_refire; @@ -59,10 +59,10 @@ void beam_think() } -void spawnfunc_turret_phaser() { if(!turret_initialize(TUR_PHASER)) remove(self); } +void spawnfunc_turret_phaser() { SELFPARAM(); if(!turret_initialize(TUR_PHASER)) remove(self); } float t_phaser(float req) -{ +{SELFPARAM(); switch(req) { case TR_ATTACK: diff --git a/qcsrc/common/turrets/unit/plasma.qc b/qcsrc/common/turrets/unit/plasma.qc index dda66f72c5..ff882d18c9 100644 --- a/qcsrc/common/turrets/unit/plasma.qc +++ b/qcsrc/common/turrets/unit/plasma.qc @@ -11,10 +11,10 @@ REGISTER_TURRET( ); #else #ifdef SVQC -void spawnfunc_turret_plasma() { if(!turret_initialize(TUR_PLASMA)) remove(self); } +void spawnfunc_turret_plasma() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA)) remove(self); } float t_plasma(float req) -{ +{SELFPARAM(); switch(req) { case TR_ATTACK: diff --git a/qcsrc/common/turrets/unit/plasma_dual.qc b/qcsrc/common/turrets/unit/plasma_dual.qc index ef762387b8..47dd34ae89 100644 --- a/qcsrc/common/turrets/unit/plasma_dual.qc +++ b/qcsrc/common/turrets/unit/plasma_dual.qc @@ -11,10 +11,10 @@ REGISTER_TURRET( ); #else #ifdef SVQC -void spawnfunc_turret_plasma_dual() { if(!turret_initialize(TUR_PLASMA_DUAL)) remove(self); } +void spawnfunc_turret_plasma_dual() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA_DUAL)) remove(self); } float t_plasma_dual(float req) -{ +{SELFPARAM(); switch(req) { case TR_ATTACK: diff --git a/qcsrc/common/turrets/unit/tesla.qc b/qcsrc/common/turrets/unit/tesla.qc index 05dbffbcbb..8f80abea75 100644 --- a/qcsrc/common/turrets/unit/tesla.qc +++ b/qcsrc/common/turrets/unit/tesla.qc @@ -12,7 +12,7 @@ REGISTER_TURRET( #else #ifdef SVQC entity toast(entity from, float range, float damage) -{ +{SELFPARAM(); entity e; entity etarget = world; float d,dd; @@ -54,7 +54,7 @@ entity toast(entity from, float range, float damage) } float turret_tesla_firecheck() -{ +{SELFPARAM(); // g_turrets_targetscan_maxdelay forces a target re-scan at least this often float do_target_scan = 0; @@ -89,10 +89,10 @@ float turret_tesla_firecheck() return 0; } -void spawnfunc_turret_tesla() { if(!turret_initialize(TUR_TESLA)) remove(self); } +void spawnfunc_turret_tesla() { SELFPARAM(); if(!turret_initialize(TUR_TESLA)) remove(self); } float t_tesla(float req) -{ +{SELFPARAM(); switch(req) { case TR_ATTACK: diff --git a/qcsrc/common/turrets/unit/walker.qc b/qcsrc/common/turrets/unit/walker.qc index 4a9ca77afe..58c1be198d 100644 --- a/qcsrc/common/turrets/unit/walker.qc +++ b/qcsrc/common/turrets/unit/walker.qc @@ -53,7 +53,7 @@ float autocvar_g_turrets_unit_walker_turn_run; #define WALKER_PATH(s,e) pathlib_astar(s,e) float walker_firecheck() -{ +{SELFPARAM(); if (self.animflag == ANIM_MELEE) return 0; @@ -61,7 +61,7 @@ float walker_firecheck() } void walker_melee_do_dmg() -{ +{SELFPARAM(); vector where; entity e; @@ -80,18 +80,18 @@ void walker_melee_do_dmg() } void walker_setnoanim() -{ +{SELFPARAM(); turrets_setframe(ANIM_NO, false); self.animflag = self.frame; } void walker_rocket_explode() -{ +{SELFPARAM(); RadiusDamage (self, self.owner, (autocvar_g_turrets_unit_walker_rocket_damage), 0, (autocvar_g_turrets_unit_walker_rocket_radius), self, world, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET, world); remove (self); } void walker_rocket_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce) -{ +{SELFPARAM(); self.health = self.health - damage; self.velocity = self.velocity + vforce; @@ -102,7 +102,7 @@ void walker_rocket_damage (entity inflictor, entity attacker, float damage, floa #define WALKER_ROCKET_MOVE movelib_move_simple(newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self) void walker_rocket_loop(); void walker_rocket_think() -{ +{SELFPARAM(); vector newdir; float edist; float itime; @@ -157,7 +157,7 @@ void walker_rocket_think() } void walker_rocket_loop3() -{ +{SELFPARAM(); vector newdir; self.nextthink = time; @@ -180,7 +180,7 @@ void walker_rocket_loop3() } void walker_rocket_loop2() -{ +{SELFPARAM(); vector newdir; self.nextthink = time; @@ -203,7 +203,7 @@ void walker_rocket_loop2() } void walker_rocket_loop() -{ +{SELFPARAM(); self.nextthink = time; self.tur_shotorg = self.origin + '0 0 300'; self.think = walker_rocket_loop2; @@ -211,7 +211,7 @@ void walker_rocket_loop() } void walker_fire_rocket(vector org) -{ +{SELFPARAM(); entity rocket; fixedmakevectors(self.angles); @@ -258,7 +258,7 @@ void walker_fire_rocket(vector org) .vector enemy_last_loc; .float enemy_last_time; void walker_move_to(vector _target, float _dist) -{ +{SELFPARAM(); switch (self.waterlevel) { case WATERLEVEL_NONE: @@ -290,7 +290,7 @@ void walker_move_to(vector _target, float _dist) //#define WALKER_FANCYPATHING void walker_move_path() -{ +{SELFPARAM(); #ifdef WALKER_FANCYPATHING // Are we close enougth to a path node to switch to the next? if (vlen(self.origin - self.pathcurrent.origin) < 64) @@ -334,10 +334,10 @@ void walker_move_path() #endif } -void spawnfunc_turret_walker() { if(!turret_initialize(TUR_WALKER)) remove(self); } +void spawnfunc_turret_walker() { SELFPARAM(); if(!turret_initialize(TUR_WALKER)) remove(self); } float t_walker(float req) -{ +{SELFPARAM(); switch(req) { case TR_ATTACK: @@ -651,7 +651,7 @@ float t_walker(float req) #include "../../../server/movelib.qh" void walker_draw() -{ +{SELFPARAM(); float dt; dt = time - self.move_time; @@ -671,7 +671,7 @@ void walker_draw() } float t_walker(float req) -{ +{SELFPARAM(); switch(req) { case TR_SETUP: diff --git a/qcsrc/common/turrets/util.qc b/qcsrc/common/turrets/util.qc index 477df7b680..8fa223aef1 100644 --- a/qcsrc/common/turrets/util.qc +++ b/qcsrc/common/turrets/util.qc @@ -114,7 +114,7 @@ vector angleofs3(vector from, vector from_a, entity to) * NOTICE this func overwrites the global v_forward, v_right and v_up vectors. */ float turret_tag_fire_update() -{ +{SELFPARAM(); if(!self.tur_head) { error("Call to turret_tag_fire_update with self.tur_head missing!\n"); @@ -134,7 +134,7 @@ float turret_tag_fire_update() void FireImoBeam (vector start, vector end, vector smin, vector smax, float bforce, float f_dmg, float f_velfactor, int deathtype) -{ +{SELFPARAM(); vector hitloc, force, endpoint, dir; entity ent; @@ -206,7 +206,7 @@ void FireImoBeam (vector start, vector end, vector smin, vector smax, #ifdef TURRET_DEBUG void SUB_Remove(); void marker_think() -{ +{SELFPARAM(); if(self.cnt) if(self.cnt < time) { diff --git a/qcsrc/common/util-post.qh b/qcsrc/common/util-post.qh index 6b43f34bf2..afec8ed207 100644 --- a/qcsrc/common/util-post.qh +++ b/qcsrc/common/util-post.qh @@ -1,6 +1,42 @@ #ifndef UTIL_POST_H #define UTIL_POST_H +[[alias("self")]] entity __self; + +// Step 1: auto oldself +#if 1 +#define SELFPARAM() noref entity this = __self +#define self __self +#define SELFCALL(s, f) (__self = s, f) +#define SELFCALL_DONE() (__self = this) +#endif + +// Step 2: check SELFPARAM() is present for functions that use self +#if 0 +#define SELFPARAM() [[alias("__self")]] noref entity this = __self +#define self this +#define SELFCALL(s, f) (this = s, f) +#define SELFCALL_DONE() (this = this) +#endif + +// Step 3: const self +#if 0 +#define SELFPARAM() noref const entity this = __self +entity setself(entity e) { return self = e; } +entity getself() { return self; } +#define self getself() +#define SELFCALL(s, f) (__self = s, f) +#define SELFCALL_DONE() (__self = this) +#endif + +// Step 4: enable when possible +#if 0 +#define SELFPARAM() noref const entity this = __self +#define self this +#define SELFCALL(s, f) (__self = s, f) +#define SELFCALL_DONE() (__self = this) +#endif + #define spawn() new(entity) #endif diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 439f0bffa0..a054edde8a 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -41,7 +41,7 @@ string wordwrap(string s, float l) #ifndef MENUQC #ifndef CSQC void wordwrap_buffer_sprint(string s) -{ +{SELFPARAM(); wordwrap_buffer = strcat(wordwrap_buffer, s); if(s == "\n") { @@ -51,7 +51,7 @@ void wordwrap_buffer_sprint(string s) } void wordwrap_sprint(string s, float l) -{ +{SELFPARAM(); wordwrap_buffer = ""; wordwrap_cb(s, l, wordwrap_buffer_sprint); if(wordwrap_buffer != "") diff --git a/qcsrc/common/vehicles/cl_vehicles.qc b/qcsrc/common/vehicles/cl_vehicles.qc index 141f8fc42d..b6c8844abd 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qc +++ b/qcsrc/common/vehicles/cl_vehicles.qc @@ -27,7 +27,7 @@ void vehicle_alarm(entity e, int ch, string s0und) } void AuxiliaryXhair_Draw2D() -{ +{SELFPARAM(); if (scoreboard_showscores) return; @@ -73,7 +73,7 @@ void Net_AuXair2(bool bIsNew) } void Net_VehicleSetup() -{ +{SELFPARAM(); int hud_id = ReadByte(); // hud_id == 0 means we exited a vehicle, so stop alarm sound/s @@ -119,7 +119,7 @@ void Vehicles_drawHUD( string iconAmmo2, vector colorAmmo2, string crosshair) -{ +{SELFPARAM(); if(autocvar_r_letterbox) return; diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 523156006d..894e0638a1 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -39,7 +39,7 @@ bool vehicle_send(entity to, int sf) #endif bool SendAuxiliaryXhair(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_AUXILIARYXHAIR); @@ -94,7 +94,7 @@ void CSQCVehicleSetup(entity own, int vehicle_id) } vector targetdrone_getnewspot() -{ +{SELFPARAM(); vector spot; int i; for(i = 0; i < 100; ++i) @@ -108,7 +108,7 @@ vector targetdrone_getnewspot() } void vehicles_locktarget(float incr, float decr, float _lock_time) -{ +{SELFPARAM(); if(self.lock_target && self.lock_target.deadflag != DEAD_NO) { self.lock_target = world; @@ -181,7 +181,7 @@ void vehicles_locktarget(float incr, float decr, float _lock_time) } vector vehicles_force_fromtag_hover(string tag_name, float spring_length, float max_power) -{ +{SELFPARAM(); force_fromtag_origin = gettaginfo(self, gettagindex(self, tag_name)); v_forward = normalize(v_forward) * -1; traceline(force_fromtag_origin, force_fromtag_origin - (v_forward * spring_length), MOVE_NORMAL, self); @@ -193,7 +193,7 @@ vector vehicles_force_fromtag_hover(string tag_name, float spring_length, float } vector vehicles_force_fromtag_maglev(string tag_name, float spring_length, float max_power) -{ +{SELFPARAM(); force_fromtag_origin = gettaginfo(self, gettagindex(self, tag_name)); v_forward = normalize(v_forward) * -1; @@ -214,7 +214,7 @@ vector vehicles_force_fromtag_maglev(string tag_name, float spring_length, float // projectile handling void vehicles_projectile_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); // Ignore damage from oterh projectiles from my owner (dont mess up volly's) if(inflictor.owner == self.owner) return; @@ -231,7 +231,7 @@ void vehicles_projectile_damage(entity inflictor, entity attacker, float damage, } void vehicles_projectile_explode() -{ +{SELFPARAM(); if(self.owner && other != world) { if(other == self.owner.vehicle) @@ -254,7 +254,7 @@ entity vehicles_projectile(string _mzlfx, string _mzlsound, float _dmg, float _radi, float _force, float _size, int _deahtype, float _projtype, float _health, bool _cull, bool _clianim, entity _owner) -{ +{SELFPARAM(); entity proj; proj = spawn(); @@ -302,7 +302,7 @@ entity vehicles_projectile(string _mzlfx, string _mzlsound, } void vehicles_gib_explode() -{ +{SELFPARAM(); sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM); Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); Send_Effect(EFFECT_EXPLOSION_SMALL, self.wp00.origin + '0 0 64', '0 0 0', 1); @@ -310,7 +310,7 @@ void vehicles_gib_explode() } void vehicles_gib_think() -{ +{SELFPARAM(); self.alpha -= 0.1; if(self.cnt >= time) remove(self); @@ -319,7 +319,7 @@ void vehicles_gib_think() } entity vehicle_tossgib(entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot) -{ +{SELFPARAM(); entity _gib = spawn(); setmodel(_gib, _template.model); setorigin(_gib, gettaginfo(self, gettagindex(self, _tag))); @@ -397,7 +397,7 @@ vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string } void vehicles_reset_colors() -{ +{SELFPARAM(); entity e; float _effects = 0, _colormap; vector _glowmod, _colormod; @@ -478,7 +478,7 @@ void vehicles_clearreturn(entity veh) void vehicles_spawn(); void vehicles_return() -{ +{SELFPARAM(); Send_Effect(EFFECT_TELEPORT, self.wp00.origin + '0 0 64', '0 0 0', 1); self.wp00.think = vehicles_spawn; @@ -491,7 +491,7 @@ void vehicles_return() } void vehicles_showwp_goaway() -{ +{SELFPARAM(); if(self.waypointsprite_attached) WaypointSprite_Kill(self.waypointsprite_attached); @@ -500,7 +500,7 @@ void vehicles_showwp_goaway() } void vehicles_showwp() -{ +{SELFPARAM(); entity oldself = world; vector rgb; @@ -571,7 +571,7 @@ void vehicles_setreturn(entity veh) } void vehicle_use() -{ +{SELFPARAM(); LOG_TRACE("vehicle ",self.netname, " used by ", activator.classname, "\n"); self.tur_head.team = activator.team; @@ -598,7 +598,7 @@ void vehicle_use() } void vehicles_regen(float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale) -{ +{SELFPARAM(); if(self.regen_field < field_max) if(timer + rpause < time) { @@ -613,7 +613,7 @@ void vehicles_regen(float timer, .float regen_field, float field_max, float rpau } void shieldhit_think() -{ +{SELFPARAM(); self.alpha -= 0.1; if (self.alpha <= 0) { @@ -628,7 +628,7 @@ void shieldhit_think() } void vehicles_painframe() -{ +{SELFPARAM(); if(self.owner.vehicle_health <= 50) if(self.pain_frame < time) { @@ -650,7 +650,7 @@ void vehicles_painframe() } void vehicles_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); self.dmg_time = time; // WEAPONTODO @@ -754,7 +754,7 @@ float vehicles_crushable(entity e) } void vehicles_impact(float _minspeed, float _speedfac, float _maxpain) -{ +{SELFPARAM(); if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) return; @@ -777,7 +777,7 @@ void vehicles_impact(float _minspeed, float _speedfac, float _maxpain) // vehicle enter/exit handling vector vehicles_findgoodexit(vector prefer_spot) -{ +{SELFPARAM(); //vector exitspot; float mysize; @@ -825,7 +825,7 @@ vector vehicles_findgoodexit(vector prefer_spot) } void vehicles_exit(bool eject) -{ +{SELFPARAM(); entity _vehicle; entity _player; entity _oldself = self; @@ -918,7 +918,7 @@ void vehicles_exit(bool eject) vehicles_reset_colors(); _vehicle.owner = world; - CSQCMODEL_AUTOINIT(); + CSQCMODEL_AUTOINIT(self); self = _oldself; @@ -926,7 +926,7 @@ void vehicles_exit(bool eject) } void vehicles_touch() -{ +{SELFPARAM(); if(MUTATOR_CALLHOOK(VehicleTouch, self, other)) return; @@ -957,7 +957,7 @@ void vehicles_touch() } bool vehicle_impulse(int imp) -{ +{SELFPARAM(); switch(imp) { case 17: @@ -971,7 +971,7 @@ bool vehicle_impulse(int imp) } void vehicles_enter(entity pl, entity veh) -{ +{SELFPARAM(); // Remove this when bots know how to use vehicles if((IS_BOT_CLIENT(pl) && !autocvar_g_vehicles_allow_bots)) return; @@ -1124,7 +1124,7 @@ void vehicles_enter(entity pl, entity veh) } void vehicles_think() -{ +{SELFPARAM(); self.nextthink = time; if(self.owner) @@ -1132,12 +1132,12 @@ void vehicles_think() VEH_ACTION(self.vehicleid, VR_THINK); - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } // initialization void vehicles_spawn() -{ +{SELFPARAM(); LOG_TRACE("Spawning vehicle: ", self.classname, "\n"); // disown & reset @@ -1183,11 +1183,11 @@ void vehicles_spawn() VEH_ACTION(self.vehicleid, VR_SPAWN); - CSQCMODEL_AUTOINIT(); + CSQCMODEL_AUTOINIT(self); } bool vehicle_initialize(entity veh, bool nodrop) -{ +{SELFPARAM(); if(!autocvar_g_vehicles) return false; diff --git a/qcsrc/common/vehicles/unit/bumblebee.qc b/qcsrc/common/vehicles/unit/bumblebee.qc index 7ace8225bb..0bb776b859 100644 --- a/qcsrc/common/vehicles/unit/bumblebee.qc +++ b/qcsrc/common/vehicles/unit/bumblebee.qc @@ -111,7 +111,7 @@ void bumblebee_fire_cannon(entity _gun, string _tagname, entity _owner) } float bumblebee_gunner_frame() -{ +{SELFPARAM(); entity vehic = self.vehicle.owner; entity gun = self.vehicle; entity gunner = self; @@ -247,7 +247,7 @@ vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity p } void bumblebee_gunner_exit(int _exitflag) -{ +{SELFPARAM(); entity player = self; entity gunner = player.vehicle; entity vehic = gunner.owner; @@ -303,7 +303,7 @@ void bumblebee_gunner_exit(int _exitflag) } bool bumblebee_gunner_enter() -{ +{SELFPARAM(); entity vehic = self; entity player = other; entity gunner = world; @@ -370,7 +370,7 @@ bool bumblebee_gunner_enter() } bool vehicles_valid_pilot() -{ +{SELFPARAM(); if(IS_BOT_CLIENT(other) && !autocvar_g_vehicles_allow_bots) return false; @@ -384,7 +384,7 @@ bool vehicles_valid_pilot() } void bumblebee_touch() -{ +{SELFPARAM(); if(autocvar_g_vehicles_enter) { return; } if(self.gunner1 != world && self.gunner2 != world) @@ -406,7 +406,7 @@ void bumblebee_touch() } void bumblebee_regen() -{ +{SELFPARAM(); if(self.gun1.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time) self.gun1.vehicle_energy = min(autocvar_g_vehicle_bumblebee_cannon_ammo, self.gun1.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime); @@ -427,7 +427,7 @@ void bumblebee_regen() } float bumblebee_pilot_frame() -{ +{SELFPARAM(); entity pilot, vehic; vector newvel; @@ -649,7 +649,7 @@ float bumblebee_pilot_frame() } void bumblebee_land() -{ +{SELFPARAM(); float hgt; hgt = raptor_altitude(512); @@ -662,11 +662,11 @@ void bumblebee_land() self.nextthink = time; - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } void bumblebee_exit(float eject) -{ +{SELFPARAM(); if(self.owner.vehicleid == VEH_BUMBLEBEE.vehicleid) { bumblebee_gunner_exit(eject); @@ -709,7 +709,7 @@ void bumblebee_exit(float eject) } void bumblebee_blowup() -{ +{SELFPARAM(); RadiusDamage(self, self.enemy, autocvar_g_vehicle_bumblebee_blowup_coredamage, autocvar_g_vehicle_bumblebee_blowup_edgedamage, autocvar_g_vehicle_bumblebee_blowup_radius, self, world, @@ -726,7 +726,7 @@ void bumblebee_blowup() } void bumblebee_diethink() -{ +{SELFPARAM(); if(time >= self.wait) self.think = bumblebee_blowup; @@ -740,7 +740,7 @@ void bumblebee_diethink() } float bumble_raygun_send(entity to, float sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_BUMBLE_RAYGUN); WriteByte(MSG_ENTITY, sf); @@ -769,13 +769,13 @@ float bumble_raygun_send(entity to, float sf) } void spawnfunc_vehicle_bumblebee() -{ +{SELFPARAM(); if(!autocvar_g_vehicle_bumblebee) { remove(self); return; } if(!vehicle_initialize(VEH_BUMBLEBEE, false)) { remove(self); return; } } float v_bumblebee(float req) -{ +{SELFPARAM(); switch(req) { case VR_IMPACT: @@ -1026,7 +1026,7 @@ void CSQC_BUMBLE_GUN_HUD() } void bumble_raygun_draw() -{ +{SELFPARAM(); float _len; vector _dir; vector _vtmp1, _vtmp2; @@ -1064,7 +1064,7 @@ void bumble_raygun_draw() } void bumble_raygun_read(bool bIsNew) -{ +{SELFPARAM(); int sf = ReadByte(); if(sf & BRG_SETUP) diff --git a/qcsrc/common/vehicles/unit/racer.qc b/qcsrc/common/vehicles/unit/racer.qc index 38b06c3b3a..1320d95b1e 100644 --- a/qcsrc/common/vehicles/unit/racer.qc +++ b/qcsrc/common/vehicles/unit/racer.qc @@ -111,7 +111,7 @@ vector autocvar_g_vehicle_racer_bouncepain; var vector racer_force_from_tag(string tag_name, float spring_length, float max_power); void racer_align4point(float _delta) -{ +{SELFPARAM(); vector push_vector; float fl_push, fr_push, bl_push, br_push; @@ -169,7 +169,7 @@ void racer_align4point(float _delta) } void racer_fire_cannon(string tagname) -{ +{SELFPARAM(); vector v; entity bolt; @@ -186,7 +186,7 @@ void racer_fire_cannon(string tagname) } void racer_rocket_groundhugger() -{ +{SELFPARAM(); vector olddir, newdir; float oldvel, newvel; @@ -238,7 +238,7 @@ void racer_rocket_groundhugger() } void racer_rocket_tracker() -{ +{SELFPARAM(); vector olddir, newdir; float oldvel, newvel; @@ -290,7 +290,7 @@ void racer_rocket_tracker() } void racer_fire_rocket(string tagname, entity trg) -{ +{SELFPARAM(); vector v = gettaginfo(self, gettagindex(self, tagname)); entity rocket = vehicles_projectile(EFFECT_RACER_ROCKETLAUNCH.eent_eff_name, W_Sound("rocket_fire"), v, v_forward * autocvar_g_vehicle_racer_rocket_speed, @@ -310,7 +310,7 @@ void racer_fire_rocket(string tagname, entity trg) } float racer_frame() -{ +{SELFPARAM(); entity player, racer; vector df; float ftmp; @@ -550,7 +550,7 @@ float racer_frame() } void racer_think() -{ +{SELFPARAM(); self.nextthink = time; float pushdeltatime = time - self.lastpushtime; @@ -579,11 +579,11 @@ void racer_think() self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime); self.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime); - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } void racer_exit(float eject) -{ +{SELFPARAM(); vector spot; self.think = racer_think; @@ -627,7 +627,7 @@ void racer_exit(float eject) } void racer_blowup() -{ +{SELFPARAM(); self.deadflag = DEAD_DEAD; self.vehicle_exit(VHEF_NORMAL); @@ -650,17 +650,17 @@ void racer_blowup() } void racer_blowup_think() -{ +{SELFPARAM(); self.nextthink = time; if(time >= self.delay) racer_blowup(); - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } void racer_deadtouch() -{ +{SELFPARAM(); self.avelocity_x *= 0.7; self.cnt -= 1; if(self.cnt <= 0) @@ -668,7 +668,7 @@ void racer_deadtouch() } void spawnfunc_vehicle_racer() -{ +{SELFPARAM(); if(!autocvar_g_vehicle_racer) { remove(self); return; } if(!vehicle_initialize(VEH_RACER, false)) { remove(self); return; } } @@ -678,7 +678,7 @@ void spawnfunc_vehicle_racer() #ifdef CSQC #if 0 void racer_draw() -{ +{SELFPARAM(); float pushdeltatime = time - self.lastpushtime; if (pushdeltatime > 0.15) pushdeltatime = 0; self.lastpushtime = time; @@ -711,7 +711,7 @@ void racer_draw() #endif bool v_racer(int req) -{ +{SELFPARAM(); switch(req) { case VR_IMPACT: diff --git a/qcsrc/common/vehicles/unit/raptor.qc b/qcsrc/common/vehicles/unit/raptor.qc index d2ddea7731..14da2b3207 100644 --- a/qcsrc/common/vehicles/unit/raptor.qc +++ b/qcsrc/common/vehicles/unit/raptor.qc @@ -96,13 +96,13 @@ vector autocvar_g_vehicle_raptor_bouncepain; .entity bomb2; float raptor_altitude(float amax) -{ +{SELFPARAM(); tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * amax), MOVE_WORLDONLY, self); return vlen(self.origin - trace_endpos); } void raptor_bomblet_boom() -{ +{SELFPARAM(); RadiusDamage (self, self.realowner, autocvar_g_vehicle_raptor_bomblet_damage, autocvar_g_vehicle_raptor_bomblet_edgedamage, autocvar_g_vehicle_raptor_bomblet_radius, world, world, @@ -111,7 +111,7 @@ void raptor_bomblet_boom() } void raptor_bomblet_touch() -{ +{SELFPARAM(); if(other == self.owner) return; @@ -121,7 +121,7 @@ void raptor_bomblet_touch() } void raptor_bomb_burst() -{ +{SELFPARAM(); if(self.cnt > time) if(autocvar_g_vehicle_raptor_bomblet_alt) { @@ -160,7 +160,7 @@ void raptor_bomb_burst() } void raptor_bombdrop() -{ +{SELFPARAM(); entity bomb_1, bomb_2; bomb_1 = spawn(); @@ -194,7 +194,7 @@ void raptor_bombdrop() void raptor_fire_cannon(entity gun, string tagname) -{ +{SELFPARAM(); vehicles_projectile(EFFECT_RAPTOR_MUZZLEFLASH.eent_eff_name, W_Sound("lasergun_fire"), gettaginfo(gun, gettagindex(gun, tagname)), normalize(v_forward + randomvec() * autocvar_g_vehicle_raptor_cannon_spread) * autocvar_g_vehicle_raptor_cannon_speed, autocvar_g_vehicle_raptor_cannon_damage, autocvar_g_vehicle_raptor_cannon_radius, autocvar_g_vehicle_raptor_cannon_force, 0, @@ -202,7 +202,7 @@ void raptor_fire_cannon(entity gun, string tagname) } void raptor_land() -{ +{SELFPARAM(); float hgt; hgt = raptor_altitude(512); @@ -226,11 +226,11 @@ void raptor_land() self.nextthink = time; - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } void raptor_exit(float eject) -{ +{SELFPARAM(); vector spot; self.tur_head.exteriormodeltoclient = world; @@ -277,19 +277,19 @@ void raptor_exit(float eject) } void raptor_flare_touch() -{ +{SELFPARAM(); remove(self); } void raptor_flare_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); self.health -= damage; if(self.health <= 0) remove(self); } void raptor_flare_think() -{ +{SELFPARAM(); self.nextthink = time + 0.1; entity _missile = findchainentity(enemy, self.owner); while(_missile) @@ -306,7 +306,7 @@ void raptor_flare_think() } float raptor_frame() -{ +{SELFPARAM(); entity player, raptor; float ftmp = 0; vector df; @@ -647,7 +647,7 @@ float raptor_frame() } float raptor_takeoff() -{ +{SELFPARAM(); entity player, raptor; player = self; @@ -655,7 +655,7 @@ float raptor_takeoff() self = raptor; self.nextthink = time; - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); self.nextthink = 0; // will this work? if(self.sound_nexttime < time) @@ -703,7 +703,7 @@ float raptor_takeoff() } void raptor_blowup() -{ +{SELFPARAM(); self.deadflag = DEAD_DEAD; self.vehicle_exit(VHEF_NORMAL); RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_RAPT_DEATH, world); @@ -721,7 +721,7 @@ void raptor_blowup() } void raptor_diethink() -{ +{SELFPARAM(); if(time >= self.wait) self.think = raptor_blowup; @@ -732,20 +732,20 @@ void raptor_diethink() } self.nextthink = time; - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } // If we dont do this ever now and then, the raptors rotors // stop working, presumably due to angle overflow. cute. void raptor_rotor_anglefix() -{ +{SELFPARAM(); self.gun1.angles_y = anglemods(self.gun1.angles_y); self.gun2.angles_y = anglemods(self.gun2.angles_y); self.nextthink = time + 15; } float raptor_impulse(float _imp) -{ +{SELFPARAM(); switch(_imp) { case 1: @@ -790,13 +790,13 @@ float raptor_impulse(float _imp) } void spawnfunc_vehicle_raptor() -{ +{SELFPARAM(); if(!autocvar_g_vehicle_raptor) { remove(self); return; } if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; } } float v_raptor(float req) -{ +{SELFPARAM(); switch(req) { case VR_IMPACT: @@ -991,7 +991,7 @@ float v_raptor(float req) #ifdef CSQC void RaptorCBShellfragDraw() -{ +{SELFPARAM(); if(wasfreed(self)) return; @@ -1007,7 +1007,7 @@ void RaptorCBShellfragDraw() } void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang) -{ +{SELFPARAM(); entity sfrag; sfrag = spawn(); diff --git a/qcsrc/common/vehicles/unit/spiderbot.qc b/qcsrc/common/vehicles/unit/spiderbot.qc index 973e1e5944..b08d1deac1 100644 --- a/qcsrc/common/vehicles/unit/spiderbot.qc +++ b/qcsrc/common/vehicles/unit/spiderbot.qc @@ -86,13 +86,13 @@ float autocvar_g_vehicle_spiderbot_rocket_lifetime; vector autocvar_g_vehicle_spiderbot_bouncepain; void spiderbot_rocket_artillery() -{ +{SELFPARAM(); self.nextthink = time; UpdateCSQCProjectile(self); } void spiderbot_rocket_unguided() -{ +{SELFPARAM(); vector newdir, olddir; self.nextthink = time; @@ -108,7 +108,7 @@ void spiderbot_rocket_unguided() } void spiderbot_rocket_guided() -{ +{SELFPARAM(); vector newdir, olddir; self.nextthink = time; @@ -128,7 +128,7 @@ void spiderbot_rocket_guided() } void spiderbot_guide_release() -{ +{SELFPARAM(); entity rkt; rkt = findchainentity(realowner, self.owner); if(!rkt) @@ -221,7 +221,7 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht) } void spiderbot_rocket_do() -{ +{SELFPARAM(); vector v; entity rocket = world; @@ -333,7 +333,7 @@ void spiderbot_rocket_do() .float jump_delay; float spiderbot_frame() -{ +{SELFPARAM(); vector ad, vf; entity player, spider; float ftmp; @@ -612,7 +612,7 @@ float spiderbot_frame() } void spiderbot_exit(float eject) -{ +{SELFPARAM(); entity e; vector spot; @@ -669,7 +669,7 @@ void spiderbot_exit(float eject) } void spiderbot_headfade() -{ +{SELFPARAM(); self.think = spiderbot_headfade; self.nextthink = self.fade_time; self.alpha = 1 - (time - self.fade_time) * self.fade_rate; @@ -686,7 +686,7 @@ void spiderbot_headfade() } void spiderbot_blowup() -{ +{SELFPARAM(); if(self.cnt > time) { if(random() < 0.1) @@ -759,7 +759,7 @@ void spiderbot_blowup() } bool spiderbot_impulse(int _imp) -{ +{SELFPARAM(); switch(_imp) { case 1: @@ -812,13 +812,13 @@ bool spiderbot_impulse(int _imp) } void spawnfunc_vehicle_spiderbot() -{ +{SELFPARAM(); if(!autocvar_g_vehicle_spiderbot) { remove(self); return; } if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; } } float v_spiderbot(float req) -{ +{SELFPARAM(); switch(req) { case VR_IMPACT: diff --git a/qcsrc/common/viewloc.qc b/qcsrc/common/viewloc.qc index 125e6f8e12..ce89bde34e 100644 --- a/qcsrc/common/viewloc.qc +++ b/qcsrc/common/viewloc.qc @@ -11,7 +11,7 @@ // client movement void viewloc_PlayerPhysics() -{ +{SELFPARAM(); if(self.viewloc) { vector oldmovement = self.movement; @@ -58,7 +58,7 @@ void viewloc_PlayerPhysics() #ifdef CSQC void viewloc_SetTags() -{ +{SELFPARAM(); if(self.viewloc && wasfreed(self.viewloc)) self.viewloc = world; diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index c101a8c8ab..6548f0879e 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -129,7 +129,7 @@ vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as void spawnfunc_weapon_arc(void) { weapon_defaultspawnfunc(WEP_ARC.m_id); } float W_Arc_Beam_Send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_ARC_BEAM); // Truncate information when this beam is displayed to the owner client @@ -213,7 +213,7 @@ void Arc_Player_SetHeat(entity player) } void W_Arc_Beam_Think(void) -{ +{SELFPARAM(); if(self != self.owner.arc_beam) { remove(self); @@ -576,7 +576,7 @@ void W_Arc_Beam_Think(void) } void W_Arc_Beam(float burst) -{ +{SELFPARAM(); // only play fire sound if 1 sec has passed since player let go the fire button if(time - self.beam_prev > 1) @@ -600,7 +600,7 @@ void W_Arc_Beam(float burst) } void Arc_Smoke() -{ +{SELFPARAM(); makevectors(self.v_angle); W_SetupShot_Range(self,true,0,"",0,0,0); @@ -636,7 +636,7 @@ void Arc_Smoke() } bool W_Arc(int req) -{ +{SELFPARAM(); switch(req) { case WR_AIM: @@ -870,7 +870,7 @@ void Reset_ArcBeam(void) } void Draw_ArcBeam(void) -{ +{SELFPARAM(); float dt = time - self.move_time; self.move_time = time; if(dt <= 0) { return; } @@ -1163,13 +1163,13 @@ void Draw_ArcBeam(void) } void Remove_ArcBeam(void) -{ +{SELFPARAM(); remove(self.beam_muzzleentity); sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM); } void Ent_ReadArcBeam(float isnew) -{ +{SELFPARAM(); int sf = ReadByte(); entity flash; @@ -1521,7 +1521,7 @@ void Ent_ReadArcBeam(float isnew) } bool W_Arc(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index 6234f4a3e1..9debcacc13 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -52,7 +52,7 @@ void spawnfunc_weapon_blaster(void) { weapon_defaultspawnfunc(WEP_BLASTER.m_id); void spawnfunc_weapon_laser(void) { spawnfunc_weapon_blaster(); } void W_Blaster_Touch(void) -{ +{SELFPARAM(); PROJECTILE_TOUCH; self.event_damage = func_null; @@ -74,7 +74,7 @@ void W_Blaster_Touch(void) } void W_Blaster_Think(void) -{ +{SELFPARAM(); self.movetype = MOVETYPE_FLY; self.think = SUB_Remove; self.nextthink = time + self.blaster_lifetime; @@ -92,7 +92,7 @@ void W_Blaster_Attack( float atk_spread, float atk_delay, float atk_lifetime) -{ +{SELFPARAM(); vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD); W_SetupShot_Dir(self, s_forward, false, 3, W_Sound("lasergun_fire"), CH_WEAPON_B, atk_damage); @@ -149,7 +149,7 @@ void W_Blaster_Attack( } } bool W_Blaster(int request) -{ +{SELFPARAM(); switch(request) { case WR_AIM: @@ -268,7 +268,7 @@ bool W_Blaster(int request) #endif #ifdef CSQC bool W_Blaster(int request) -{ +{SELFPARAM(); switch(request) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 08deaf78c4..ba63afbcea 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -107,7 +107,7 @@ void W_Crylink_Dequeue(entity e) } void W_Crylink_Reset(void) -{ +{SELFPARAM(); W_Crylink_Dequeue(self); remove(self); } @@ -224,7 +224,7 @@ vector W_Crylink_LinkJoin(entity e, float jspeed) } void W_Crylink_LinkJoinEffect_Think(void) -{ +{SELFPARAM(); // is there at least 2 projectiles very close? entity e, p; float n; @@ -289,7 +289,7 @@ float W_Crylink_Touch_WouldHitFriendly(entity projectile, float rad) // NO bounce protection, as bounces are limited! void W_Crylink_Touch(void) -{ +{SELFPARAM(); float finalhit; float f; float isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY); @@ -334,13 +334,13 @@ void W_Crylink_Touch(void) } void W_Crylink_Fadethink(void) -{ +{SELFPARAM(); W_Crylink_Dequeue(self); remove(self); } void W_Crylink_Attack(void) -{ +{SELFPARAM(); float counter, shots; entity proj, prevproj, firstproj; vector s; @@ -449,7 +449,7 @@ void W_Crylink_Attack(void) } void W_Crylink_Attack2(void) -{ +{SELFPARAM(); float counter, shots; entity proj, prevproj, firstproj; vector s; @@ -565,7 +565,7 @@ void W_Crylink_Attack2(void) } bool W_Crylink(int req) -{ +{SELFPARAM(); float ammo_amount; switch(req) { @@ -691,7 +691,7 @@ bool W_Crylink(int req) #endif #ifdef CSQC bool W_Crylink(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 9a235bf35d..bbce1a8ca4 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -66,7 +66,7 @@ void spawnfunc_weapon_devastator(void) { weapon_defaultspawnfunc(WEP_DEVASTATOR. void spawnfunc_weapon_rocketlauncher(void) { spawnfunc_weapon_devastator(); } void W_Devastator_Unregister(void) -{ +{SELFPARAM(); if(self.realowner && self.realowner.lastrocket == self) { self.realowner.lastrocket = world; @@ -75,7 +75,7 @@ void W_Devastator_Unregister(void) } void W_Devastator_Explode(void) -{ +{SELFPARAM(); W_Devastator_Unregister(); if(other.takedamage == DAMAGE_AIM) @@ -115,7 +115,7 @@ void W_Devastator_Explode(void) } void W_Devastator_DoRemoteExplode(void) -{ +{SELFPARAM(); W_Devastator_Unregister(); self.event_damage = func_null; @@ -194,7 +194,7 @@ void W_Devastator_DoRemoteExplode(void) } void W_Devastator_RemoteExplode(void) -{ +{SELFPARAM(); if(self.realowner.deadflag == DEAD_NO) if(self.realowner.lastrocket) { @@ -242,7 +242,7 @@ vector W_Devastator_SteerTo(vector thisdir, vector goaldir, float maxturn_cos) // normalize(0) void W_Devastator_Think(void) -{ +{SELFPARAM(); vector desireddir, olddir, newdir, desiredorigin, goal; float velspeed, f; self.nextthink = time; @@ -309,7 +309,7 @@ void W_Devastator_Think(void) } void W_Devastator_Touch(void) -{ +{SELFPARAM(); if(WarpZone_Projectile_Touch()) { if(wasfreed(self)) @@ -321,7 +321,7 @@ void W_Devastator_Touch(void) } void W_Devastator_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.health <= 0) return; @@ -336,7 +336,7 @@ void W_Devastator_Damage(entity inflictor, entity attacker, float damage, int de } void W_Devastator_Attack(void) -{ +{SELFPARAM(); entity missile; entity flash; @@ -393,7 +393,7 @@ void W_Devastator_Attack(void) } bool W_Devastator(int req) -{ +{SELFPARAM(); entity rock; float rockfound; float ammo_amount; @@ -657,7 +657,7 @@ bool W_Devastator(int req) #endif #ifdef CSQC bool W_Devastator(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index 0f60fd29d3..b308d2e0fc 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -117,7 +117,7 @@ void W_Electro_TriggerCombo(vector org, float rad, entity own) } void W_Electro_ExplodeCombo(void) -{ +{SELFPARAM(); W_Electro_TriggerCombo(self.origin, WEP_CVAR(electro, combo_comboradius), self.realowner); self.event_damage = func_null; @@ -139,7 +139,7 @@ void W_Electro_ExplodeCombo(void) } void W_Electro_Explode(void) -{ +{SELFPARAM(); if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) if(DIFF_TEAM(self.realowner, other)) @@ -192,7 +192,7 @@ void W_Electro_TouchExplode(void) } void W_Electro_Bolt_Think(void) -{ +{SELFPARAM(); if(time >= self.ltime) { self.use(); @@ -244,7 +244,7 @@ void W_Electro_Bolt_Think(void) } void W_Electro_Attack_Bolt(void) -{ +{SELFPARAM(); entity proj; W_DecreaseAmmo(WEP_CVAR_PRI(electro, ammo)); @@ -289,7 +289,7 @@ void W_Electro_Attack_Bolt(void) } void W_Electro_Orb_Touch(void) -{ +{SELFPARAM(); PROJECTILE_TOUCH; if(other.takedamage == DAMAGE_AIM) { if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(); } } @@ -302,7 +302,7 @@ void W_Electro_Orb_Touch(void) } void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.health <= 0) return; @@ -344,7 +344,7 @@ void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, int d } void W_Electro_Attack_Orb(void) -{ +{SELFPARAM(); W_DecreaseAmmo(WEP_CVAR_SEC(electro, ammo)); W_SetupShot_ProjectileSize( @@ -405,7 +405,7 @@ void W_Electro_Attack_Orb(void) } void W_Electro_CheckAttack(void) -{ +{SELFPARAM(); if(self.electro_count > 1) if(self.BUTTON_ATCK2) if(weapon_prepareattack(1, -1)) @@ -421,7 +421,7 @@ void W_Electro_CheckAttack(void) .float bot_secondary_electromooth; bool W_Electro(int req) -{ +{SELFPARAM(); float ammo_amount; switch(req) { @@ -571,7 +571,7 @@ bool W_Electro(int req) #endif #ifdef CSQC bool W_Electro(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index 4f8f3787c3..cb33a244c4 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -58,7 +58,7 @@ FIREBALL_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) void spawnfunc_weapon_fireball(void) { weapon_defaultspawnfunc(WEP_FIREBALL.m_id); } void W_Fireball_Explode(void) -{ +{SELFPARAM(); entity e; float dist; float points; @@ -114,7 +114,7 @@ void W_Fireball_TouchExplode(void) } void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage, float burntime) -{ +{SELFPARAM(); entity e; float d; vector p; @@ -148,7 +148,7 @@ void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage, } void W_Fireball_Think(void) -{ +{SELFPARAM(); if(time > self.pushltime) { self.cnt = 1; @@ -163,7 +163,7 @@ void W_Fireball_Think(void) } void W_Fireball_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.health <= 0) return; @@ -179,7 +179,7 @@ void W_Fireball_Damage(entity inflictor, entity attacker, float damage, int deat } void W_Fireball_Attack1(void) -{ +{SELFPARAM(); entity proj; W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, W_Sound("fireball_fire2"), CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage)); @@ -218,7 +218,7 @@ void W_Fireball_Attack1(void) } void W_Fireball_AttackEffect(float i, vector f_diff) -{ +{SELFPARAM(); W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 0, "", 0, 0); w_shotorg += f_diff.x * v_up + f_diff.y * v_right; Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); @@ -249,14 +249,14 @@ void W_Fireball_Attack1_Frame1(void) } void W_Fireball_Attack1_Frame0(void) -{ +{SELFPARAM(); W_Fireball_AttackEffect(0, '-1.25 -3.75 0'); sound(self, CH_WEAPON_SINGLE, W_Sound("fireball_prefire2"), VOL_BASE, ATTEN_NORM); weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame1); } void W_Fireball_Firemine_Think(void) -{ +{SELFPARAM(); if(time > self.pushltime) { remove(self); @@ -282,7 +282,7 @@ void W_Fireball_Firemine_Think(void) } void W_Fireball_Firemine_Touch(void) -{ +{SELFPARAM(); PROJECTILE_TOUCH; if(other.takedamage == DAMAGE_AIM) if(Fire_AddDamage(other, self.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), self.projectiledeathtype) >= 0) @@ -294,7 +294,7 @@ void W_Fireball_Firemine_Touch(void) } void W_Fireball_Attack2(void) -{ +{SELFPARAM(); entity proj; vector f_diff; float c; @@ -349,7 +349,7 @@ void W_Fireball_Attack2(void) } bool W_Fireball(int req) -{ +{SELFPARAM(); switch(req) { case WR_AIM: @@ -449,7 +449,7 @@ bool W_Fireball(int req) #endif #ifdef CSQC bool W_Fireball(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index 4f1b905847..cc01af7db1 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -61,7 +61,7 @@ void spawnfunc_weapon_hagar(void) { weapon_defaultspawnfunc(WEP_HAGAR.m_id); } // NO bounce protection, as bounces are limited! void W_Hagar_Explode(void) -{ +{SELFPARAM(); self.event_damage = func_null; RadiusDamage(self, self.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), world, world, WEP_CVAR_PRI(hagar, force), self.projectiledeathtype, other); @@ -69,7 +69,7 @@ void W_Hagar_Explode(void) } void W_Hagar_Explode2(void) -{ +{SELFPARAM(); self.event_damage = func_null; RadiusDamage(self, self.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), world, world, WEP_CVAR_SEC(hagar, force), self.projectiledeathtype, other); @@ -77,7 +77,7 @@ void W_Hagar_Explode2(void) } void W_Hagar_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.health <= 0) return; @@ -101,13 +101,13 @@ void W_Hagar_Damage(entity inflictor, entity attacker, float damage, int deathty } void W_Hagar_Touch(void) -{ +{SELFPARAM(); PROJECTILE_TOUCH; self.use(); } void W_Hagar_Touch2(void) -{ +{SELFPARAM(); PROJECTILE_TOUCH; if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) { @@ -122,7 +122,7 @@ void W_Hagar_Touch2(void) } void W_Hagar_Attack(void) -{ +{SELFPARAM(); entity missile; W_DecreaseAmmo(WEP_CVAR_PRI(hagar, ammo)); @@ -165,7 +165,7 @@ void W_Hagar_Attack(void) } void W_Hagar_Attack2(void) -{ +{SELFPARAM(); entity missile; W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo)); @@ -210,7 +210,7 @@ void W_Hagar_Attack2(void) .float hagar_loadstep, hagar_loadblock, hagar_loadbeep, hagar_warning; void W_Hagar_Attack2_Load_Release(void) -{ +{SELFPARAM(); // time to release the rockets we've loaded entity missile; @@ -290,7 +290,7 @@ void W_Hagar_Attack2_Load_Release(void) } void W_Hagar_Attack2_Load(void) -{ +{SELFPARAM(); // loadable hagar secondary attack, must always run each frame if(time < game_starttime) @@ -398,7 +398,7 @@ void W_Hagar_Attack2_Load(void) } bool W_Hagar(int req) -{ +{SELFPARAM(); float ammo_amount; switch(req) { @@ -526,7 +526,7 @@ bool W_Hagar(int req) #endif #ifdef CSQC bool W_Hagar(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index 49685296a8..8e0ce6f118 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -51,7 +51,7 @@ HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) void spawnfunc_weapon_hlac(void) { weapon_defaultspawnfunc(WEP_HLAC.m_id); } void W_HLAC_Touch(void) -{ +{SELFPARAM(); float isprimary; PROJECTILE_TOUCH; @@ -66,7 +66,7 @@ void W_HLAC_Touch(void) } void W_HLAC_Attack(void) -{ +{SELFPARAM(); entity missile; float spread; @@ -115,7 +115,7 @@ void W_HLAC_Attack(void) } void W_HLAC_Attack2(void) -{ +{SELFPARAM(); entity missile; float spread; @@ -160,7 +160,7 @@ void W_HLAC_Attack2(void) // weapon frames void W_HLAC_Attack_Frame(void) -{ +{SELFPARAM(); if(self.weapon != self.switchweapon) // abort immediately if switching { w_ready(); @@ -189,7 +189,7 @@ void W_HLAC_Attack_Frame(void) } void W_HLAC_Attack2_Frame(void) -{ +{SELFPARAM(); float i; W_DecreaseAmmo(WEP_CVAR_SEC(hlac, ammo)); @@ -205,7 +205,7 @@ void W_HLAC_Attack2_Frame(void) } bool W_HLAC(int req) -{ +{SELFPARAM(); float ammo_amount; switch(req) { @@ -284,7 +284,7 @@ bool W_HLAC(int req) #endif #ifdef CSQC bool W_HLAC(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/hmg.qc b/qcsrc/common/weapons/weapon/hmg.qc index 52b60e83bb..c9afd42ecd 100644 --- a/qcsrc/common/weapons/weapon/hmg.qc +++ b/qcsrc/common/weapons/weapon/hmg.qc @@ -44,7 +44,7 @@ HMG_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) void spawnfunc_weapon_hmg() { weapon_defaultspawnfunc(WEP_HMG.m_id); } void W_HeavyMachineGun_Attack_Auto() -{ +{SELFPARAM(); if (!self.BUTTON_ATCK) { w_ready(); @@ -87,7 +87,7 @@ void W_HeavyMachineGun_Attack_Auto() } bool W_HeavyMachineGun(int req) -{ +{SELFPARAM(); float ammo_amount; switch(req) { @@ -171,7 +171,7 @@ bool W_HeavyMachineGun(int req) #endif #ifdef CSQC bool W_HeavyMachineGun(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/hook.qc b/qcsrc/common/weapons/weapon/hook.qc index 6c5519e60b..c6b352212e 100644 --- a/qcsrc/common/weapons/weapon/hook.qc +++ b/qcsrc/common/weapons/weapon/hook.qc @@ -60,7 +60,7 @@ HOOK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #ifdef SVQC void spawnfunc_weapon_hook(void) -{ +{SELFPARAM(); if(g_grappling_hook) // offhand hook { startitem_failed = true; @@ -71,7 +71,7 @@ void spawnfunc_weapon_hook(void) } void W_Hook_ExplodeThink(void) -{ +{SELFPARAM(); float dt, dmg_remaining_next, f; dt = time - self.teleport_time; @@ -91,7 +91,7 @@ void W_Hook_ExplodeThink(void) } void W_Hook_Explode2(void) -{ +{SELFPARAM(); self.event_damage = func_null; self.touch = func_null; self.effects |= EF_NODRAW; @@ -110,7 +110,7 @@ void W_Hook_Explode2(void) } void W_Hook_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.health <= 0) return; @@ -124,13 +124,13 @@ void W_Hook_Damage(entity inflictor, entity attacker, float damage, int deathtyp } void W_Hook_Touch2(void) -{ +{SELFPARAM(); PROJECTILE_TOUCH; self.use(); } void W_Hook_Attack2(void) -{ +{SELFPARAM(); entity gren; //W_DecreaseAmmo(WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb) @@ -175,7 +175,7 @@ void W_Hook_Attack2(void) } bool W_Hook(int req) -{ +{SELFPARAM(); float hooked_time_max, hooked_fuel; switch(req) @@ -338,7 +338,7 @@ bool W_Hook(int req) #endif #ifdef CSQC bool W_Hook(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index da1eb33a60..a0bad57faa 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -56,7 +56,7 @@ MACHINEGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) #ifdef SVQC void spawnfunc_weapon_machinegun(void) -{ +{SELFPARAM(); if(autocvar_sv_q3acompat_machineshotgunswap) if(self.classname != "droppedweapon") { @@ -68,7 +68,7 @@ void spawnfunc_weapon_machinegun(void) void spawnfunc_weapon_uzi(void) { spawnfunc_weapon_machinegun(); } void W_MachineGun_MuzzleFlash_Think(void) -{ +{SELFPARAM(); self.frame = self.frame + 2; self.scale = self.scale * 0.5; self.alpha = self.alpha - 0.25; @@ -85,7 +85,7 @@ void W_MachineGun_MuzzleFlash_Think(void) } void W_MachineGun_MuzzleFlash(void) -{ +{SELFPARAM(); if(self.muzzle_flash == world) self.muzzle_flash = spawn(); @@ -103,7 +103,7 @@ void W_MachineGun_MuzzleFlash(void) } void W_MachineGun_Attack(int deathtype) -{ +{SELFPARAM(); W_SetupShot(self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage))); if(!autocvar_g_norecoil) { @@ -136,7 +136,7 @@ void W_MachineGun_Attack(int deathtype) // weapon frames void W_MachineGun_Attack_Frame(void) -{ +{SELFPARAM(); if(self.weapon != self.switchweapon) // abort immediately if switching { w_ready(); @@ -161,7 +161,7 @@ void W_MachineGun_Attack_Frame(void) void W_MachineGun_Attack_Auto(void) -{ +{SELFPARAM(); float machinegun_spread; if(!self.BUTTON_ATCK) @@ -205,7 +205,7 @@ void W_MachineGun_Attack_Auto(void) } void W_MachineGun_Attack_Burst(void) -{ +{SELFPARAM(); W_SetupShot(self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage)); if(!autocvar_g_norecoil) { @@ -237,7 +237,7 @@ void W_MachineGun_Attack_Burst(void) } bool W_MachineGun(int req) -{ +{SELFPARAM(); float ammo_amount; switch(req) { @@ -371,7 +371,7 @@ bool W_MachineGun(int req) #endif #ifdef CSQC bool W_MachineGun(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 8048957bce..0524a13b4b 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -60,7 +60,7 @@ void W_MineLayer_Think(void); void spawnfunc_weapon_minelayer(void) { weapon_defaultspawnfunc(WEP_MINE_LAYER.m_id); } void W_MineLayer_Stick(entity to) -{ +{SELFPARAM(); spamsound(self, CH_SHOTS, W_Sound("mine_stick"), VOL_BASE, ATTN_NORM); // in order for mines to face properly when sticking to the ground, they must be a server side entity rather than a csqc projectile @@ -107,7 +107,7 @@ void W_MineLayer_Stick(entity to) } void W_MineLayer_Explode(void) -{ +{SELFPARAM(); if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) if(DIFF_TEAM(self.realowner, other)) @@ -138,7 +138,7 @@ void W_MineLayer_Explode(void) } void W_MineLayer_DoRemoteExplode(void) -{ +{SELFPARAM(); self.event_damage = func_null; self.takedamage = DAMAGE_NO; @@ -165,7 +165,7 @@ void W_MineLayer_DoRemoteExplode(void) } void W_MineLayer_RemoteExplode(void) -{ +{SELFPARAM(); if(self.realowner.deadflag == DEAD_NO) if((self.spawnshieldtime >= 0) ? (time >= self.spawnshieldtime) // timer @@ -177,7 +177,7 @@ void W_MineLayer_RemoteExplode(void) } void W_MineLayer_ProximityExplode(void) -{ +{SELFPARAM(); // make sure no friend is in the mine's radius. If there is any, explosion is delayed until he's at a safe distance if(WEP_CVAR(minelayer, protection) && self.mine_explodeanyway == 0) { @@ -206,7 +206,7 @@ int W_MineLayer_Count(entity e) } void W_MineLayer_Think(void) -{ +{SELFPARAM(); entity head; self.nextthink = time; @@ -269,7 +269,7 @@ void W_MineLayer_Think(void) } void W_MineLayer_Touch(void) -{ +{SELFPARAM(); 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? @@ -292,7 +292,7 @@ void W_MineLayer_Touch(void) } void W_MineLayer_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.health <= 0) return; @@ -309,7 +309,7 @@ void W_MineLayer_Damage(entity inflictor, entity attacker, float damage, int dea } void W_MineLayer_Attack(void) -{ +{SELFPARAM(); entity mine; entity flash; @@ -381,7 +381,7 @@ void W_MineLayer_Attack(void) } float W_MineLayer_PlacedMines(float detonate) -{ +{SELFPARAM(); entity mine; float minfound = 0; @@ -402,7 +402,7 @@ float W_MineLayer_PlacedMines(float detonate) } bool W_MineLayer(int req) -{ +{SELFPARAM(); entity mine; float ammo_amount; switch(req) @@ -593,7 +593,7 @@ bool W_MineLayer(int req) #endif #ifdef CSQC bool W_MineLayer(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 850a6c342f..1e8f4f91a1 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -60,7 +60,7 @@ void spawnfunc_weapon_mortar(void) { weapon_defaultspawnfunc(WEP_MORTAR.m_id); } void spawnfunc_weapon_grenadelauncher(void) { spawnfunc_weapon_mortar(); } void W_Mortar_Grenade_Explode(void) -{ +{SELFPARAM(); if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) if(DIFF_TEAM(self.realowner, other)) @@ -80,7 +80,7 @@ void W_Mortar_Grenade_Explode(void) } void W_Mortar_Grenade_Explode2(void) -{ +{SELFPARAM(); if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) if(DIFF_TEAM(self.realowner, other)) @@ -101,7 +101,7 @@ void W_Mortar_Grenade_Explode2(void) void W_Mortar_Grenade_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.health <= 0) return; @@ -115,7 +115,7 @@ void W_Mortar_Grenade_Damage(entity inflictor, entity attacker, float damage, in } void W_Mortar_Grenade_Think1(void) -{ +{SELFPARAM(); self.nextthink = time; if(time > self.cnt) { @@ -129,7 +129,7 @@ void W_Mortar_Grenade_Think1(void) } void W_Mortar_Grenade_Touch1(void) -{ +{SELFPARAM(); PROJECTILE_TOUCH; if(other.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile { @@ -174,7 +174,7 @@ void W_Mortar_Grenade_Touch1(void) } void W_Mortar_Grenade_Touch2(void) -{ +{SELFPARAM(); PROJECTILE_TOUCH; if(other.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile { @@ -223,7 +223,7 @@ void W_Mortar_Grenade_Touch2(void) } void W_Mortar_Attack(void) -{ +{SELFPARAM(); entity gren; W_DecreaseAmmo(WEP_CVAR_PRI(mortar, ammo)); @@ -272,7 +272,7 @@ void W_Mortar_Attack(void) } void W_Mortar_Attack2(void) -{ +{SELFPARAM(); entity gren; W_DecreaseAmmo(WEP_CVAR_SEC(mortar, ammo)); @@ -321,7 +321,7 @@ void W_Mortar_Attack2(void) .float bot_secondary_grenademooth; bool W_Mortar(int req) -{ +{SELFPARAM(); entity nade; float nadefound; float ammo_amount; @@ -461,7 +461,7 @@ bool W_Mortar(int req) #endif #ifdef CSQC bool W_Mortar(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index 2d08c0fcfd..3903e087f9 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -44,7 +44,7 @@ PORTO_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) void spawnfunc_weapon_porto(void) { weapon_defaultspawnfunc(WEP_PORTO.m_id); } void W_Porto_Success(void) -{ +{SELFPARAM(); if(self.realowner == world) { objerror("Cannot succeed successfully: no owner\n"); @@ -57,7 +57,7 @@ void W_Porto_Success(void) string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo); void W_Porto_Fail(float failhard) -{ +{SELFPARAM(); if(self.realowner == world) { objerror("Cannot fail successfully: no owner\n"); @@ -92,7 +92,7 @@ void W_Porto_Fail(float failhard) } void W_Porto_Remove(entity p) -{ +{SELFPARAM(); if(p.porto_current.realowner == p && p.porto_current.classname == "porto") { entity oldself; @@ -104,7 +104,7 @@ void W_Porto_Remove(entity p) } void W_Porto_Think(void) -{ +{SELFPARAM(); trace_plane_normal = '0 0 0'; if(self.realowner.playerid != self.playerid) remove(self); @@ -113,7 +113,7 @@ void W_Porto_Think(void) } void W_Porto_Touch(void) -{ +{SELFPARAM(); vector norm; // do not use PROJECTILE_TOUCH here @@ -235,7 +235,7 @@ void W_Porto_Touch(void) } void W_Porto_Attack(float type) -{ +{SELFPARAM(); entity gren; W_SetupShot(self, false, 4, "porto/fire.wav", CH_WEAPON_A, 0); @@ -289,7 +289,7 @@ void W_Porto_Attack(float type) bool w_nexball_weapon(int req); // WEAPONTODO bool W_Porto(int req) -{ +{SELFPARAM(); //vector v_angle_save; if(g_nexball) { return w_nexball_weapon(req); } @@ -406,7 +406,7 @@ bool W_Porto(int req) #endif #ifdef CSQC bool W_Porto(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index ef3babd872..37923e16c8 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -52,7 +52,7 @@ void spawnfunc_weapon_campingrifle(void) { spawnfunc_weapon_rifle(); } void spawnfunc_weapon_sniperrifle(void) { spawnfunc_weapon_rifle(); } void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, string pSound) -{ +{SELFPARAM(); float i; W_DecreaseAmmo(pAmmo); @@ -89,7 +89,7 @@ void W_Rifle_Attack2(void) .float rifle_bullethail_animtime; .float rifle_bullethail_refire; void W_Rifle_BulletHail_Continue(void) -{ +{SELFPARAM(); float r, sw, af; sw = self.switchweapon; // make it not detect weapon changes as reason to abort firing @@ -114,7 +114,7 @@ void W_Rifle_BulletHail_Continue(void) } void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animtime, float refire) -{ +{SELFPARAM(); // if we get here, we have at least one bullet to fire AttackFunc(); if(mode) @@ -135,7 +135,7 @@ void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animt .float bot_secondary_riflemooth; bool W_Rifle(int req) -{ +{SELFPARAM(); float ammo_amount; switch(req) @@ -266,7 +266,7 @@ bool W_Rifle(int req) #endif #ifdef CSQC bool W_Rifle(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/rpc.qc b/qcsrc/common/weapons/weapon/rpc.qc index 8a34490e28..1b336f4edf 100644 --- a/qcsrc/common/weapons/weapon/rpc.qc +++ b/qcsrc/common/weapons/weapon/rpc.qc @@ -48,7 +48,7 @@ RPC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) void spawnfunc_weapon_rpc() { weapon_defaultspawnfunc(WEP_RPC.m_id); } void W_RocketPropelledChainsaw_Explode() -{ +{SELFPARAM(); self.event_damage = func_null; self.takedamage = DAMAGE_NO; @@ -58,7 +58,7 @@ void W_RocketPropelledChainsaw_Explode() } void W_RocketPropelledChainsaw_Touch (void) -{ +{SELFPARAM(); if(WarpZone_Projectile_Touch()) if(wasfreed(self)) return; @@ -67,7 +67,7 @@ void W_RocketPropelledChainsaw_Touch (void) } void W_RocketPropelledChainsaw_Damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if (self.health <= 0) return; @@ -81,7 +81,7 @@ void W_RocketPropelledChainsaw_Damage (entity inflictor, entity attacker, float } void W_RocketPropelledChainsaw_Think() -{ +{SELFPARAM(); if(self.cnt <= time) { remove(self); @@ -103,7 +103,7 @@ void W_RocketPropelledChainsaw_Think() } void W_RocketPropelledChainsaw_Attack (void) -{ +{SELFPARAM(); entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(self); entity flash = spawn (); @@ -148,7 +148,7 @@ void W_RocketPropelledChainsaw_Attack (void) } bool W_RocketPropelledChainsaw(int req) -{ +{SELFPARAM(); float ammo_amount = false; switch(req) { @@ -234,7 +234,7 @@ bool W_RocketPropelledChainsaw(int req) #ifdef CSQC bool W_RocketPropelledChainsaw(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index 69c4974de6..9708af05b4 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -90,7 +90,7 @@ void spawnfunc_weapon_seeker(void) { weapon_defaultspawnfunc(WEP_SEEKER.m_id); } // Begin: Missile functions, these are general functions to be manipulated by other code // ============================ void W_Seeker_Missile_Explode(void) -{ +{SELFPARAM(); self.event_damage = func_null; RadiusDamage(self, self.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), world, world, WEP_CVAR(seeker, missile_force), self.projectiledeathtype, other); @@ -105,7 +105,7 @@ void W_Seeker_Missile_Touch(void) } void W_Seeker_Missile_Think(void) -{ +{SELFPARAM(); entity e; vector desireddir, olddir, newdir, eorg; float turnrate; @@ -202,7 +202,7 @@ void W_Seeker_Missile_Think(void) void W_Seeker_Missile_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.health <= 0) return; @@ -244,7 +244,7 @@ void W_Seeker_Missile_Animate(void) */ void W_Seeker_Fire_Missile(vector f_diff, entity m_target) -{ +{SELFPARAM(); entity missile; W_DecreaseAmmo(WEP_CVAR(seeker, missile_ammo)); @@ -301,7 +301,7 @@ void W_Seeker_Fire_Missile(vector f_diff, entity m_target) // Begin: FLAC, close range attack meant for defeating rockets which are coming at you. // ============================ void W_Seeker_Flac_Explode(void) -{ +{SELFPARAM(); self.event_damage = func_null; RadiusDamage(self, self.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), world, world, WEP_CVAR(seeker, flac_force), self.projectiledeathtype, other); @@ -317,7 +317,7 @@ void W_Seeker_Flac_Touch(void) } void W_Seeker_Fire_Flac(void) -{ +{SELFPARAM(); entity missile; vector f_diff; float c; @@ -389,7 +389,7 @@ entity W_Seeker_Tagged_Info(entity isowner, entity istarget) } void W_Seeker_Attack(void) -{ +{SELFPARAM(); entity tracker, closest_target; closest_target = world; @@ -412,7 +412,7 @@ void W_Seeker_Attack(void) } void W_Seeker_Vollycontroller_Think(void) // TODO: Merge this with W_Seeker_Attack -{ +{SELFPARAM(); float c; entity oldself,oldenemy; self.cnt = self.cnt - 1; @@ -454,7 +454,7 @@ void W_Seeker_Vollycontroller_Think(void) // TODO: Merge this with W_Seeker_Atta } void W_Seeker_Tracker_Think(void) -{ +{SELFPARAM(); // commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up if((self.realowner.deadflag != DEAD_NO) || (self.tag_target.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER.m_id) || (time > self.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime))) @@ -475,7 +475,7 @@ void W_Seeker_Tracker_Think(void) // Begin: Tag projectile // ============================ void W_Seeker_Tag_Explode(void) -{ +{SELFPARAM(); //if(other==self.realowner) // return; Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, other.species, self); @@ -484,7 +484,7 @@ void W_Seeker_Tag_Explode(void) } void W_Seeker_Tag_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.health <= 0) return; self.health = self.health - damage; @@ -493,7 +493,7 @@ void W_Seeker_Tag_Damage(entity inflictor, entity attacker, float damage, int de } void W_Seeker_Tag_Touch(void) -{ +{SELFPARAM(); vector dir; vector org2; entity e; @@ -556,7 +556,7 @@ void W_Seeker_Tag_Touch(void) } void W_Seeker_Fire_Tag(void) -{ +{SELFPARAM(); entity missile; W_DecreaseAmmo(WEP_CVAR(seeker, tag_ammo)); @@ -598,7 +598,7 @@ void W_Seeker_Fire_Tag(void) // ============================ bool W_Seeker(int req) -{ +{SELFPARAM(); float ammo_amount; switch(req) @@ -727,7 +727,7 @@ bool W_Seeker(int req) #endif #ifdef CSQC bool W_Seeker(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index 3287ea3cb3..4103370801 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -83,7 +83,7 @@ void Net_ReadShockwaveParticle(void); #ifdef IMPLEMENTATION #ifdef SVQC void spawnfunc_weapon_shockwave(void) -{ +{SELFPARAM(); //if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO if(autocvar_sv_q3acompat_machineshotgunswap) if(self.classname != "droppedweapon") @@ -106,7 +106,7 @@ vector shockwave_hit_force[MAX_SHOCKWAVE_HITS]; // MELEE ATTACK MODE void W_Shockwave_Melee_Think(void) -{ +{SELFPARAM(); // declarations float i, f, swing, swing_factor, swing_damage, meleetime, is_player; entity target_victim; @@ -228,7 +228,7 @@ void W_Shockwave_Melee_Think(void) } void W_Shockwave_Melee(void) -{ +{SELFPARAM(); sound(self, CH_WEAPON_A, W_Sound("shotgun_melee"), VOL_BASE, ATTN_NORM); weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready); @@ -274,7 +274,7 @@ float W_Shockwave_Attack_IsVisible( vector nearest_on_line, vector sw_shotorg, vector attack_endpos) -{ +{SELFPARAM(); vector nearest_to_attacker = head.WarpZone_findradius_nearest; vector center = (head.origin + (head.mins + head.maxs) * 0.5); vector corner; @@ -334,7 +334,7 @@ float W_Shockwave_Attack_CheckHit( } void W_Shockwave_Send(void) -{ +{SELFPARAM(); WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); WriteByte(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE); WriteCoord(MSG_BROADCAST, w_shotorg.x); @@ -350,7 +350,7 @@ void W_Shockwave_Send(void) } void W_Shockwave_Attack(void) -{ +{SELFPARAM(); // declarations float multiplier, multiplier_from_accuracy, multiplier_from_distance; float final_damage; @@ -667,7 +667,7 @@ void W_Shockwave_Attack(void) } bool W_Shockwave(int req) -{ +{SELFPARAM(); switch(req) { case WR_AIM: @@ -750,7 +750,7 @@ const float SW_MAXALPHA = 0.5; const float SW_FADETIME = 0.4; const float SW_DISTTOMIN = 200; void Draw_Shockwave() -{ +{SELFPARAM(); // fading/removal control float a = bound(0, (SW_MAXALPHA - ((time - self.sw_time) / SW_FADETIME)), SW_MAXALPHA); if(a < ALPHA_MIN_VISIBLE) { remove(self); } @@ -866,7 +866,7 @@ void Net_ReadShockwaveParticle(void) } bool W_Shockwave(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 9024bbfa1f..d61a2521dd 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -55,7 +55,7 @@ SHOTGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP) void spawnfunc_weapon_shotgun(void) { weapon_defaultspawnfunc(WEP_SHOTGUN.m_id); } void W_Shotgun_Attack(float isprimary) -{ +{SELFPARAM(); float sc; entity flash; @@ -84,7 +84,7 @@ void W_Shotgun_Attack(float isprimary) .float swing_prev; .entity swing_alreadyhit; void W_Shotgun_Melee_Think(void) -{ +{SELFPARAM(); // declarations float i, f, swing, swing_factor, swing_damage, meleetime, is_player; entity target_victim; @@ -180,7 +180,7 @@ void W_Shotgun_Melee_Think(void) } void W_Shotgun_Attack2(void) -{ +{SELFPARAM(); sound(self, CH_WEAPON_A, W_Sound("shotgun_melee"), VOL_BASE, ATTEN_NORM); weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(shotgun, animtime), w_ready); @@ -194,7 +194,7 @@ void W_Shotgun_Attack2(void) // alternate secondary weapon frames void W_Shotgun_Attack3_Frame2() -{ +{SELFPARAM(); if (!WEP_ACTION(self.weapon, WR_CHECKAMMO2)) if (!(self.items & IT_UNLIMITED_WEAPON_AMMO)) { @@ -208,7 +208,7 @@ void W_Shotgun_Attack3_Frame2() weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready); } void W_Shotgun_Attack3_Frame1() -{ +{SELFPARAM(); if (!WEP_ACTION(self.weapon, WR_CHECKAMMO2)) if (!(self.items & IT_UNLIMITED_WEAPON_AMMO)) { @@ -224,7 +224,7 @@ void W_Shotgun_Attack3_Frame1() .float shotgun_primarytime; float W_Shotgun(float req) -{ +{SELFPARAM(); float ammo_amount; switch(req) { @@ -352,7 +352,7 @@ float W_Shotgun(float req) #ifdef CSQC .float prevric; float W_Shotgun(float req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/tuba.qc b/qcsrc/common/weapons/weapon/tuba.qc index 686c89ec3a..9baa0c6155 100644 --- a/qcsrc/common/weapons/weapon/tuba.qc +++ b/qcsrc/common/weapons/weapon/tuba.qc @@ -148,7 +148,7 @@ bool W_Tuba_HasPlayed(entity pl, string melody, int instrument, bool ignorepitch } void W_Tuba_NoteOff(void) -{ +{SELFPARAM(); // we have a note: // on: self.spawnshieldtime // off: time @@ -252,7 +252,7 @@ int W_Tuba_GetNote(entity pl, int hittype) } bool W_Tuba_NoteSendEntity(entity to, int sf) -{ +{SELFPARAM(); int f; msg_entity = to; @@ -280,7 +280,7 @@ bool W_Tuba_NoteSendEntity(entity to, int sf) } void W_Tuba_NoteThink(void) -{ +{SELFPARAM(); float dist_mult; float vol0, vol1; vector dir0, dir1; @@ -318,7 +318,7 @@ void W_Tuba_NoteThink(void) } void W_Tuba_NoteOn(float hittype) -{ +{SELFPARAM(); vector o; float n; @@ -369,7 +369,7 @@ void W_Tuba_NoteOn(float hittype) } bool W_Tuba(int req) -{ +{SELFPARAM(); switch(req) { case WR_AIM: @@ -495,7 +495,7 @@ bool W_Tuba(int req) #endif #ifdef CSQC bool W_Tuba(int req) -{ +{SELFPARAM(); // nothing to do here; particles of tuba are handled differently // WEAPONTODO diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 4ed2dc2d36..aa1fb54c10 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -58,7 +58,7 @@ void spawnfunc_weapon_vaporizer(void) { weapon_defaultspawnfunc(WEP_VAPORIZER.m_ void spawnfunc_weapon_minstanex(void) { spawnfunc_weapon_vaporizer(); } void W_RocketMinsta_Explosion(vector loc) -{ +{SELFPARAM(); if(accuracy_canbegooddamage(self)) accuracy_add(self, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0); entity dmgent = spawn(); @@ -69,7 +69,7 @@ void W_RocketMinsta_Explosion(vector loc) } void W_Vaporizer_Attack(void) -{ +{SELFPARAM(); float flying; flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last @@ -139,7 +139,7 @@ void W_Vaporizer_Attack(void) } void W_RocketMinsta_Laser_Explode (void) -{ +{SELFPARAM(); if(other.takedamage == DAMAGE_AIM) if(IS_PLAYER(other)) if(DIFF_TEAM(self.realowner, other)) @@ -154,7 +154,7 @@ void W_RocketMinsta_Laser_Explode (void) } void W_RocketMinsta_Laser_Touch (void) -{ +{SELFPARAM(); PROJECTILE_TOUCH; //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); @@ -162,7 +162,7 @@ void W_RocketMinsta_Laser_Touch (void) } void W_RocketMinsta_Attack2(void) -{ +{SELFPARAM(); makevectors(self.v_angle); entity proj; @@ -217,7 +217,7 @@ void W_RocketMinsta_Attack2(void) } void W_RocketMinsta_Attack3 (void) -{ +{SELFPARAM(); makevectors(self.v_angle); entity proj; @@ -268,7 +268,7 @@ void W_RocketMinsta_Attack3 (void) } float W_Vaporizer(float req) -{ +{SELFPARAM(); float ammo_amount; float vaporizer_ammo; float rapid = autocvar_g_rm_laser_rapid; @@ -428,7 +428,7 @@ float W_Vaporizer(float req) #endif #ifdef CSQC float W_Vaporizer(float req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index 3aa17e526d..03cd25066b 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -77,7 +77,7 @@ void SendCSQCVortexBeamParticle(float charge) { } void W_Vortex_Attack(float issecondary) -{ +{SELFPARAM(); float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge; mydmg = WEP_CVAR_BOTH(vortex, !issecondary, damage); @@ -133,7 +133,7 @@ void spawnfunc_weapon_vortex(void); // defined in t_items.qc .float vortex_chargepool_pauseregen_finished; bool W_Vortex(int req) -{ +{SELFPARAM(); float dt; float ammo_amount; switch(req) @@ -320,7 +320,7 @@ bool W_Vortex(int req) #ifdef CSQC float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO bool W_Vortex(int req) -{ +{SELFPARAM(); switch(req) { case WR_IMPACTEFFECT: diff --git a/qcsrc/csqcmodellib/cl_model.qc b/qcsrc/csqcmodellib/cl_model.qc index 95489ad432..ab93b01723 100644 --- a/qcsrc/csqcmodellib/cl_model.qc +++ b/qcsrc/csqcmodellib/cl_model.qc @@ -42,7 +42,7 @@ float autocvar_cl_nolerp = 0; .float csqcmodel_lerpfrac2time; void CSQCModel_InterpolateAnimation_2To4_PreNote(int sf) -{ +{SELFPARAM(); if(sf & CSQCMODEL_PROPERTY_FRAME) { self.frame3 = self.frame; @@ -61,7 +61,7 @@ void CSQCModel_InterpolateAnimation_2To4_PreNote(int sf) } } void CSQCModel_InterpolateAnimation_1To2_PreNote(int sf) -{ +{SELFPARAM(); if(sf & CSQCMODEL_PROPERTY_FRAME) { self.frame2 = self.frame; @@ -78,7 +78,7 @@ void CSQCModel_InterpolateAnimation_PreNote(int sf) } void CSQCModel_InterpolateAnimation_2To4_Note(int sf, float set_times) -{ +{SELFPARAM(); if(sf & CSQCMODEL_PROPERTY_FRAME) { if(set_times) @@ -97,7 +97,7 @@ void CSQCModel_InterpolateAnimation_2To4_Note(int sf, float set_times) } } void CSQCModel_InterpolateAnimation_1To2_Note(int sf, float set_times) -{ +{SELFPARAM(); if(sf & CSQCMODEL_PROPERTY_FRAME) { if(set_times) @@ -114,7 +114,7 @@ void CSQCModel_InterpolateAnimation_Note(int sf) } void CSQCModel_InterpolateAnimation_2To4_Do() -{ +{SELFPARAM(); if(autocvar_cl_nolerp || (autocvar_cl_lerpanim_maxdelta_framegroups == 0)) { self.lerpfrac = self.csqcmodel_lerpfrac; @@ -161,7 +161,7 @@ void CSQCModel_InterpolateAnimation_2To4_Do() } } void CSQCModel_InterpolateAnimation_1To2_Do() -{ +{SELFPARAM(); if(autocvar_cl_nolerp || (autocvar_cl_lerpanim_maxdelta_framegroups == 0)) { self.lerpfrac = 0; @@ -184,7 +184,7 @@ void CSQCModel_InterpolateAnimation_Do() } void CSQCModel_Draw() -{ +{SELFPARAM(); // some nice flags for CSQCMODEL_IF and the hooks bool isplayer = (self.entnum >= 1 && self.entnum <= maxclients); noref bool islocalplayer = (self.entnum == player_localnum + 1); @@ -214,7 +214,7 @@ void CSQCModel_Draw() } void CSQCModel_Read(bool isnew) -{ +{SELFPARAM(); int sf = ReadInt24_t(); // some nice flags for CSQCMODEL_IF and the hooks diff --git a/qcsrc/csqcmodellib/cl_player.qc b/qcsrc/csqcmodellib/cl_player.qc index 3d5f9a00cb..945a27bff6 100644 --- a/qcsrc/csqcmodellib/cl_player.qc +++ b/qcsrc/csqcmodellib/cl_player.qc @@ -100,7 +100,7 @@ void CSQCPlayer_SetPredictionError(vector o, vector v, float onground_diff) } void CSQCPlayer_Unpredict() -{ +{SELFPARAM(); if(csqcplayer_status == CSQCPLAYERSTATUS_UNPREDICTED) return; if(csqcplayer_status != CSQCPLAYERSTATUS_PREDICTED) @@ -112,7 +112,7 @@ void CSQCPlayer_Unpredict() } void CSQCPlayer_SetMinsMaxs() -{ +{SELFPARAM(); if(self.flags & FL_DUCKED) { self.mins = PL_CROUCH_MIN; @@ -128,7 +128,7 @@ void CSQCPlayer_SetMinsMaxs() } void CSQCPlayer_SavePrediction() -{ +{SELFPARAM(); player_pmflags = self.flags; csqcplayer_origin = self.origin; csqcplayer_velocity = self.velocity; @@ -139,7 +139,7 @@ void CSQCPlayer_SavePrediction() void CSQC_ClientMovement_PlayerMove_Frame(); void PM_Movement_Move() -{ +{SELFPARAM(); runstandardplayerphysics(self); #ifdef CSQC self.flags = @@ -159,7 +159,7 @@ void CSQCPlayer_Physics(void) } void CSQCPlayer_PredictTo(float endframe, float apply_error) -{ +{SELFPARAM(); CSQCPlayer_Unpredict(); if(apply_error) { @@ -204,7 +204,7 @@ void CSQCPlayer_PredictTo(float endframe, float apply_error) } bool CSQCPlayer_IsLocalPlayer() -{ +{SELFPARAM(); return (self == csqcplayer); } @@ -214,7 +214,7 @@ void CSQCPlayer_SetViewLocation() } void CSQCPlayer_SetCamera() -{ +{SELFPARAM(); vector v0; v0 = pmove_vel; // TRICK: pmove_vel is set by the engine when we get here. No need to network velocity @@ -353,7 +353,7 @@ void CSQCPlayer_Remove() } float CSQCPlayer_PreUpdate() -{ +{SELFPARAM(); if(self != csqcplayer) return 0; if(csqcplayer_status != CSQCPLAYERSTATUS_FROMSERVER) @@ -362,7 +362,7 @@ float CSQCPlayer_PreUpdate() } float CSQCPlayer_PostUpdate() -{ +{SELFPARAM(); if(self.entnum != player_localnum + 1) return 0; csqcplayer = self; diff --git a/qcsrc/csqcmodellib/interpolate.qc b/qcsrc/csqcmodellib/interpolate.qc index 5c8e1e31e6..78fb051f79 100644 --- a/qcsrc/csqcmodellib/interpolate.qc +++ b/qcsrc/csqcmodellib/interpolate.qc @@ -38,12 +38,12 @@ .vector ivup1, ivup2; .float itime1, itime2; void InterpolateOrigin_Reset() -{ +{SELFPARAM(); self.iflags &= ~IFLAG_INTERNALMASK; self.itime1 = self.itime2 = 0; } void InterpolateOrigin_Note() -{ +{SELFPARAM(); float dt; int f0; @@ -138,7 +138,7 @@ void InterpolateOrigin_Note() } } void InterpolateOrigin_Do() -{ +{SELFPARAM(); vector forward, up; if(self.itime1 && self.itime2 && self.itime1 != self.itime2) { @@ -165,7 +165,7 @@ void InterpolateOrigin_Do() } } void InterpolateOrigin_Undo() -{ +{SELFPARAM(); if(self.iflags & IFLAG_ORIGIN) setorigin(self, self.iorigin2); if(self.iflags & IFLAG_ANGLES) diff --git a/qcsrc/csqcmodellib/sv_model.qc b/qcsrc/csqcmodellib/sv_model.qc index 32c8b87075..bbd9071f9a 100644 --- a/qcsrc/csqcmodellib/sv_model.qc +++ b/qcsrc/csqcmodellib/sv_model.qc @@ -37,7 +37,7 @@ // generic CSQC model code bool CSQCModel_Send(entity to, int sf) -{ +{SELFPARAM(); // some nice flags for CSQCMODEL_IF float isplayer = (IS_CLIENT(self)); float islocalplayer = (self == to); @@ -70,10 +70,10 @@ bool CSQCModel_Send(entity to, int sf) #ifdef CSQCPLAYER_FORCE_UPDATES .float csqcmodel_nextforcedupdate; #endif -void CSQCModel_CheckUpdate() +void CSQCModel_CheckUpdate(entity e) { // some nice flags for CSQCMODEL_IF - float isplayer = (IS_CLIENT(self)); + float isplayer = (IS_CLIENT(e)); float islocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags float isnolocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags @@ -82,43 +82,43 @@ void CSQCModel_CheckUpdate() unused_float = isnolocalplayer; #ifdef CSQCPLAYER_FORCE_UPDATES - if(isplayer && time > self.csqcmodel_nextforcedupdate) + if(isplayer && time > e.csqcmodel_nextforcedupdate) { - self.SendFlags |= CSQCMODEL_PROPERTY_ORIGIN; - self.csqcmodel_nextforcedupdate = time + CSQCPLAYER_FORCE_UPDATES * (0.5 + random()); // ensure about 4 origin sends per sec + e.SendFlags |= CSQCMODEL_PROPERTY_ORIGIN; + e.csqcmodel_nextforcedupdate = time + CSQCPLAYER_FORCE_UPDATES * (0.5 + random()); // ensure about 4 origin sends per sec } #endif - if(self.effects & EF_RESTARTANIM_BIT) + if(e.effects & EF_RESTARTANIM_BIT) { - self.SendFlags |= CSQCMODEL_PROPERTY_FRAME | CSQCMODEL_PROPERTY_FRAME2; // full anim resend please - self.effects &= ~EF_RESTARTANIM_BIT; + e.SendFlags |= CSQCMODEL_PROPERTY_FRAME | CSQCMODEL_PROPERTY_FRAME2; // full anim resend please + e.effects &= ~EF_RESTARTANIM_BIT; } - if(self.effects & EF_TELEPORT_BIT) + if(e.effects & EF_TELEPORT_BIT) { - self.SendFlags |= CSQCMODEL_PROPERTY_TELEPORTED; // no interpolation please - self.effects &= ~EF_TELEPORT_BIT; + e.SendFlags |= CSQCMODEL_PROPERTY_TELEPORTED; // no interpolation please + e.effects &= ~EF_TELEPORT_BIT; } #define CSQCMODEL_IF(cond) if(cond) { #define CSQCMODEL_ENDIF } #define CSQCMODEL_PROPERTY(flag,t,r,w,f) \ { \ - t tmp = self.f; \ - if(tmp != self.csqcmodel_##f) \ + t tmp = e.f; \ + if(tmp != e.csqcmodel_##f) \ { \ - self.csqcmodel_##f = tmp; \ - self.SendFlags |= flag; \ + e.csqcmodel_##f = tmp; \ + e.SendFlags |= flag; \ } \ } #define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) \ { \ - t tmp = rint(bound(mi, s * self.f, ma) - mi); \ - if(tmp != self.csqcmodel_##f) \ + t tmp = rint(bound(mi, s * e.f, ma) - mi); \ + if(tmp != e.csqcmodel_##f) \ { \ - self.csqcmodel_##f = tmp; \ - self.SendFlags |= flag; \ + e.csqcmodel_##f = tmp; \ + e.SendFlags |= flag; \ } \ } ALLPROPERTIES @@ -128,14 +128,14 @@ void CSQCModel_CheckUpdate() #undef CSQCMODEL_IF } -void CSQCModel_LinkEntity() +void CSQCModel_LinkEntity(entity e) { - self.SendEntity = CSQCModel_Send; - self.SendFlags = 0xFFFFFF; - CSQCModel_CheckUpdate(); + e.SendEntity = CSQCModel_Send; + e.SendFlags = 0xFFFFFF; + CSQCModel_CheckUpdate(e); } void CSQCModel_UnlinkEntity() -{ +{SELFPARAM(); self.SendEntity = func_null; } diff --git a/qcsrc/csqcmodellib/sv_model.qh b/qcsrc/csqcmodellib/sv_model.qh index 73e03e8620..6694ded1a6 100644 --- a/qcsrc/csqcmodellib/sv_model.qh +++ b/qcsrc/csqcmodellib/sv_model.qh @@ -26,8 +26,8 @@ // generic CSQC model code -void CSQCModel_CheckUpdate(); -void CSQCModel_LinkEntity(); +void CSQCModel_CheckUpdate(entity e); +void CSQCModel_LinkEntity(entity e); void CSQCModel_UnlinkEntity(); #define CSQCMODEL_IF(cond) diff --git a/qcsrc/lib/Defer.qh b/qcsrc/lib/Defer.qh index fd2619d6fb..ce12478b57 100644 --- a/qcsrc/lib/Defer.qh +++ b/qcsrc/lib/Defer.qh @@ -16,20 +16,16 @@ Remove self ================== */ void SUB_Remove() -{ +{SELFPARAM(); remove (self); } void defer_think() -{ - entity oself; - - oself = self; - self = self.owner; - oself.think = SUB_Remove; - oself.nextthink = time; - - oself.use(); +{SELFPARAM(); + self.think = SUB_Remove; + self.nextthink = time; + SELFCALL(self.owner, self.use()); + SELFCALL_DONE(); } /* @@ -37,7 +33,7 @@ void defer_think() self when func is executed = self when defer is called */ void defer(float fdelay, void() func) -{ +{SELFPARAM(); entity e; e = spawn(); diff --git a/qcsrc/server/anticheat.qc b/qcsrc/server/anticheat.qc index 6647633ff9..f795a1acb2 100644 --- a/qcsrc/server/anticheat.qc +++ b/qcsrc/server/anticheat.qc @@ -63,7 +63,7 @@ float movement_oddity(vector m0, vector m1) } void anticheat_physics() -{ +{SELFPARAM(); float f; // div0_evade -> SPECTATORS @@ -150,13 +150,13 @@ void anticheat_physics() } void anticheat_spectatecopy(entity spectatee) -{ +{SELFPARAM(); // div0_evade -> SPECTATORS self.angles = spectatee.anticheat_div0_evade_v_angle; } void anticheat_prethink() -{ +{SELFPARAM(); // div0_evade -> SPECTATORS self.anticheat_div0_evade_offset = 0; } @@ -173,7 +173,7 @@ string anticheat_display(float f, float tmin, float mi, float ma) } void anticheat_report() -{ +{SELFPARAM(); if(!autocvar_sv_eventlog) return; // TODO(divVerent): Use xonstat to acquire good thresholds. @@ -198,7 +198,7 @@ void anticheat_report() } float anticheat_getvalue(string id) -{ +{SELFPARAM(); switch(id) { case "_time": return servertime - self.anticheat_jointime; case "speedhack": return MEAN_EVALUATE(anticheat_speedhack); @@ -228,12 +228,12 @@ void anticheat_startframe() } void anticheat_fixangle() -{ +{SELFPARAM(); self.anticheat_fixangle_endtime = servertime + ANTILAG_LATENCY(self) + 0.2; } void anticheat_endframe() -{ +{SELFPARAM(); entity oldself = self; FOR_EACH_CLIENT(self) if (self.fixangle) @@ -243,7 +243,7 @@ void anticheat_endframe() } void anticheat_init() -{ +{SELFPARAM(); self.anticheat_speedhack_offset = 0; self.anticheat_jointime = servertime; } diff --git a/qcsrc/server/bot/aim.qc b/qcsrc/server/bot/aim.qc index 58ddfc0364..a30f399383 100644 --- a/qcsrc/server/bot/aim.qc +++ b/qcsrc/server/bot/aim.qc @@ -86,7 +86,7 @@ float findtrajectorywithleading(vector org, vector m1, vector m2, entity targ, f } void lag_update() -{ +{SELFPARAM(); if (self.lag1_time) if (time > self.lag1_time) {self.lag_func(self.lag1_time, self.lag1_float1, self.lag1_float2, self.lag1_entity1, self.lag1_vec1, self.lag1_vec2, self.lag1_vec3, self.lag1_vec4);self.lag1_time = 0;} if (self.lag2_time) if (time > self.lag2_time) {self.lag_func(self.lag2_time, self.lag2_float1, self.lag2_float2, self.lag2_entity1, self.lag2_vec1, self.lag2_vec2, self.lag2_vec3, self.lag2_vec4);self.lag2_time = 0;} if (self.lag3_time) if (time > self.lag3_time) {self.lag_func(self.lag3_time, self.lag3_float1, self.lag3_float2, self.lag3_entity1, self.lag3_vec1, self.lag3_vec2, self.lag3_vec3, self.lag3_vec4);self.lag3_time = 0;} @@ -95,7 +95,7 @@ void lag_update() } float lag_additem(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4) -{ +{SELFPARAM(); if (self.lag1_time == 0) {self.lag1_time = t;self.lag1_float1 = f1;self.lag1_float2 = f2;self.lag1_entity1 = e1;self.lag1_vec1 = v1;self.lag1_vec2 = v2;self.lag1_vec3 = v3;self.lag1_vec4 = v4;return true;} if (self.lag2_time == 0) {self.lag2_time = t;self.lag2_float1 = f1;self.lag2_float2 = f2;self.lag2_entity1 = e1;self.lag2_vec1 = v1;self.lag2_vec2 = v2;self.lag2_vec3 = v3;self.lag2_vec4 = v4;return true;} if (self.lag3_time == 0) {self.lag3_time = t;self.lag3_float1 = f1;self.lag3_float2 = f2;self.lag3_entity1 = e1;self.lag3_vec1 = v1;self.lag3_vec2 = v2;self.lag3_vec3 = v3;self.lag3_vec4 = v4;return true;} @@ -106,7 +106,7 @@ float lag_additem(float t, float f1, float f2, entity e1, vector v1, vector v2, } float bot_shouldattack(entity e) -{ +{SELFPARAM(); if (e.team == self.team) { if (e == self) @@ -144,7 +144,7 @@ float bot_shouldattack(entity e) } void bot_lagfunc(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4) -{ +{SELFPARAM(); if(self.flags & FL_INWATER) { self.bot_aimtarg = world; @@ -167,7 +167,7 @@ void bot_lagfunc(float t, float f1, float f2, entity e1, vector v1, vector v2, v } float bot_aimdir(vector v, float maxfiredeviation) -{ +{SELFPARAM(); float dist, delta_t, blend; vector desiredang, diffang; @@ -318,7 +318,7 @@ vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, flo } float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity) -{ +{SELFPARAM(); float f, r, hf, distanceratio; vector v; /* diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc index 64f5eb7d4c..2a7081cdbc 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/bot.qc @@ -38,7 +38,7 @@ #include "../../warpzonelib/util_server.qh" entity bot_spawn() -{ +{SELFPARAM(); entity oldself, bot; bot = spawnclient(); if (bot) @@ -55,7 +55,7 @@ entity bot_spawn() } void bot_think() -{ +{SELFPARAM(); if (self.bot_nextthink > time) return; @@ -133,7 +133,7 @@ void bot_think() } void bot_setnameandstuff() -{ +{SELFPARAM(); string readfile, s; float file, tokens, prio; entity p; @@ -389,7 +389,7 @@ void bot_relinkplayerlist() } void bot_clientdisconnect() -{ +{SELFPARAM(); if (!IS_BOT_CLIENT(self)) return; bot_clearqueue(self); @@ -412,7 +412,7 @@ void bot_clientdisconnect() } void bot_clientconnect() -{ +{SELFPARAM(); if (!IS_BOT_CLIENT(self)) return; self.bot_preferredcolors = self.clientcolors; diff --git a/qcsrc/server/bot/havocbot/havocbot.qc b/qcsrc/server/bot/havocbot/havocbot.qc index 5796fe6016..7a3ac0561a 100644 --- a/qcsrc/server/bot/havocbot/havocbot.qc +++ b/qcsrc/server/bot/havocbot/havocbot.qc @@ -14,7 +14,7 @@ #include "../../../warpzonelib/common.qh" void havocbot_ai() -{ +{SELFPARAM(); if(self.draggedby) return; @@ -179,7 +179,7 @@ void havocbot_ai() } void havocbot_keyboard_movement(vector destorg) -{ +{SELFPARAM(); vector keyboard; float blend, maxspeed; float sk; @@ -254,7 +254,7 @@ void havocbot_keyboard_movement(vector destorg) } void havocbot_bunnyhop(vector dir) -{ +{SELFPARAM(); float bunnyhopdistance; vector deviation; float maxspeed; @@ -397,7 +397,7 @@ void havocbot_bunnyhop(vector dir) } void havocbot_movetogoal() -{ +{SELFPARAM(); vector destorg; vector diff; vector dir; @@ -854,7 +854,7 @@ void havocbot_movetogoal() } void havocbot_chooseenemy() -{ +{SELFPARAM(); entity head, best, head2; float rating, bestrating, i, hf; vector eye, v; @@ -949,7 +949,7 @@ void havocbot_chooseenemy() } float havocbot_chooseweapon_checkreload(int new_weapon) -{ +{SELFPARAM(); // bots under this skill cannot find unloaded weapons to reload idly when not in combat, // so skip this for them, or they'll never get to reload their weapons at all. // this also allows bots under this skill to be more stupid, and reload more often during combat :) @@ -974,7 +974,7 @@ float havocbot_chooseweapon_checkreload(int new_weapon) } void havocbot_chooseweapon() -{ +{SELFPARAM(); int i; // ;) @@ -1076,7 +1076,7 @@ void havocbot_chooseweapon() } void havocbot_aim() -{ +{SELFPARAM(); vector selfvel, enemyvel; // if(self.flags & FL_INWATER) // return; @@ -1098,7 +1098,7 @@ void havocbot_aim() } float havocbot_moveto_refresh_route() -{ +{SELFPARAM(); // Refresh path to goal if necessary entity wp; wp = self.havocbot_personal_waypoint; @@ -1109,7 +1109,7 @@ float havocbot_moveto_refresh_route() } float havocbot_moveto(vector pos) -{ +{SELFPARAM(); entity wp; if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING) @@ -1231,7 +1231,7 @@ float havocbot_resetgoal() } void havocbot_setupbot() -{ +{SELFPARAM(); self.bot_ai = havocbot_ai; self.cmd_moveto = havocbot_moveto; self.cmd_resetgoal = havocbot_resetgoal; @@ -1240,7 +1240,7 @@ void havocbot_setupbot() } vector havocbot_dodge() -{ +{SELFPARAM(); // LordHavoc: disabled because this is too expensive return '0 0 0'; #if 0 diff --git a/qcsrc/server/bot/havocbot/role_keyhunt.qc b/qcsrc/server/bot/havocbot/role_keyhunt.qc index 63888e45fc..b1603c792a 100644 --- a/qcsrc/server/bot/havocbot/role_keyhunt.qc +++ b/qcsrc/server/bot/havocbot/role_keyhunt.qc @@ -15,7 +15,7 @@ void() havocbot_role_kh_freelancer; void havocbot_goalrating_kh(float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy) -{ +{SELFPARAM(); entity head; for (head = kh_worldkeylist; head; head = head.kh_worldkeynext) { @@ -44,7 +44,7 @@ void havocbot_goalrating_kh(float ratingscale_team, float ratingscale_dropped, f } void havocbot_role_kh_carrier() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) return; @@ -71,7 +71,7 @@ void havocbot_role_kh_carrier() } void havocbot_role_kh_defense() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) return; @@ -112,7 +112,7 @@ void havocbot_role_kh_defense() } void havocbot_role_kh_offense() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) return; @@ -154,7 +154,7 @@ void havocbot_role_kh_offense() } void havocbot_role_kh_freelancer() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) return; @@ -204,7 +204,7 @@ void havocbot_role_kh_freelancer() } void havocbot_chooserole_kh() -{ +{SELFPARAM(); float r; if(self.deadflag != DEAD_NO) diff --git a/qcsrc/server/bot/havocbot/roles.qc b/qcsrc/server/bot/havocbot/roles.qc index c56f70598e..037968f136 100644 --- a/qcsrc/server/bot/havocbot/roles.qc +++ b/qcsrc/server/bot/havocbot/roles.qc @@ -13,7 +13,7 @@ .void() havocbot_role; void havocbot_goalrating_items(float ratingscale, vector org, float sradius) -{ +{SELFPARAM(); entity head; entity player; float rating, d, discard, distance, friend_distance, enemy_distance; @@ -138,7 +138,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius) } void havocbot_goalrating_controlpoints(float ratingscale, vector org, float sradius) -{ +{SELFPARAM(); entity head; head = findchain(classname, "dom_controlpoint"); while (head) @@ -157,7 +157,7 @@ void havocbot_goalrating_controlpoints(float ratingscale, vector org, float srad } void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius) -{ +{SELFPARAM(); entity head; int t; float distance; @@ -214,7 +214,7 @@ void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradi // legacy bot role for standard gamemodes // go to best items void havocbot_role_generic() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) return; @@ -230,12 +230,12 @@ void havocbot_role_generic() } void havocbot_chooserole_generic() -{ +{SELFPARAM(); self.havocbot_role = havocbot_role_generic; } void havocbot_chooserole() -{ +{SELFPARAM(); LOG_TRACE("choosing a role...\n"); self.bot_strategytime = 0; if (MUTATOR_CALLHOOK(HavocBot_ChooseRole, self)) diff --git a/qcsrc/server/bot/navigation.qc b/qcsrc/server/bot/navigation.qc index 72729ec867..99e3901b2b 100644 --- a/qcsrc/server/bot/navigation.qc +++ b/qcsrc/server/bot/navigation.qc @@ -22,7 +22,7 @@ void bot_debug(string input) // can be traveled, used for waypoint linking and havocbot float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float movemode) -{ +{SELFPARAM(); vector org; vector move; vector dir; @@ -232,7 +232,7 @@ float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float // completely empty the goal stack, used when deciding where to go void navigation_clearroute() -{ +{SELFPARAM(); //print("bot ", etos(self), " clear\n"); self.navigation_hasgoals = false; self.goalcurrent = world; @@ -276,7 +276,7 @@ void navigation_clearroute() // That means, if the stack overflows, the bot will know how to do the FIRST 32 // steps to the goal, and then recalculate the path. void navigation_pushroute(entity e) -{ +{SELFPARAM(); //print("bot ", etos(self), " push ", etos(e), "\n"); self.goalstack31 = self.goalstack30; self.goalstack30 = self.goalstack29; @@ -316,7 +316,7 @@ void navigation_pushroute(entity e) // (in other words: remove a prerequisite for reaching the later goals) // (used when a spawnfunc_waypoint is reached) void navigation_poproute() -{ +{SELFPARAM(); //print("bot ", etos(self), " pop\n"); self.goalcurrent = self.goalstack01; self.goalstack01 = self.goalstack02; @@ -449,7 +449,7 @@ entity navigation_findnearestwaypoint(entity ent, float walkfromwp) // finds the waypoints near the bot initiating a navigation query float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist) -{ +{SELFPARAM(); entity head; vector v, m1, m2, diff; float c; @@ -520,7 +520,7 @@ void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vecto // queries the entire spawnfunc_waypoint network for pathes leading away from the bot void navigation_markroutes(entity fixed_source_waypoint) -{ +{SELFPARAM(); entity w, wp, waylist; float searching, cost, cost2; vector p; @@ -679,7 +679,7 @@ void navigation_markroutes_inverted(entity fixed_source_waypoint) // updates the best goal according to a weighted calculation of travel cost and item value of a new proposed item void navigation_routerating(entity e, float f, float rangebias) -{ +{SELFPARAM(); entity nwp; vector o; if (!e) @@ -861,7 +861,7 @@ void navigation_routerating(entity e, float f, float rangebias) // adds an item to the the goal stack with the path to a given item float navigation_routetogoal(entity e, vector startposition) -{ +{SELFPARAM(); self.goalentity = e; // if there is no goal, just exit @@ -907,7 +907,7 @@ float navigation_routetogoal(entity e, vector startposition) // removes any currently touching waypoints from the goal stack // (this is how bots detect if they reached a goal) void navigation_poptouchedgoals() -{ +{SELFPARAM(); vector org, m1, m2; org = self.origin; m1 = org + self.mins; @@ -993,7 +993,7 @@ void navigation_poptouchedgoals() // begin a goal selection session (queries spawnfunc_waypoint network) void navigation_goalrating_start() -{ +{SELFPARAM(); if(self.aistatus & AI_STATUS_STUCK) return; @@ -1007,7 +1007,7 @@ void navigation_goalrating_start() // ends a goal selection session (updates goal stack to the best goal) void navigation_goalrating_end() -{ +{SELFPARAM(); if(self.aistatus & AI_STATUS_STUCK) return; @@ -1067,7 +1067,7 @@ void botframe_updatedangerousobjects(float maxupdate) } void navigation_unstuck() -{ +{SELFPARAM(); float search_radius = 1000; if (!autocvar_bot_wander_enable) @@ -1164,7 +1164,7 @@ void debugresetnodes() } void debugnode(vector node) -{ +{SELFPARAM(); if (!IS_PLAYER(self)) return; @@ -1207,7 +1207,7 @@ void debugnodestatus(vector position, float status) // Debug the goal stack visually void debuggoalstack() -{ +{SELFPARAM(); entity goal; vector org, go; diff --git a/qcsrc/server/bot/scripting.qc b/qcsrc/server/bot/scripting.qc index a8dc921717..46193160da 100644 --- a/qcsrc/server/bot/scripting.qc +++ b/qcsrc/server/bot/scripting.qc @@ -101,7 +101,7 @@ const int MAX_BOT_PLACES = 4; .entity bot_places[MAX_BOT_PLACES]; .string bot_placenames[MAX_BOT_PLACES]; entity bot_getplace(string placename) -{ +{SELFPARAM(); entity e; if(substring(placename, 0, 1) == "@") { @@ -480,20 +480,20 @@ float bot_cmd_cc() } float bot_cmd_impulse() -{ +{SELFPARAM(); self.impulse = bot_cmd.bot_cmd_parm_float; return CMD_STATUS_FINISHED; } float bot_cmd_continue() -{ +{SELFPARAM(); self.bot_exec_status &= ~BOT_EXEC_STATUS_PAUSED; return CMD_STATUS_FINISHED; } .float bot_cmd_wait_time; float bot_cmd_wait() -{ +{SELFPARAM(); if(self.bot_exec_status & BOT_EXEC_STATUS_WAITING) { if(time>=self.bot_cmd_wait_time) @@ -511,7 +511,7 @@ float bot_cmd_wait() } float bot_cmd_wait_until() -{ +{SELFPARAM(); if(time < bot_cmd.bot_cmd_parm_float + bot_barriertime) { self.bot_exec_status |= BOT_EXEC_STATUS_WAITING; @@ -522,7 +522,7 @@ float bot_cmd_wait_until() } float bot_cmd_barrier() -{ +{SELFPARAM(); entity cl; // 0 = no barrier, 1 = waiting, 2 = waiting finished @@ -561,14 +561,14 @@ float bot_cmd_barrier() } float bot_cmd_turn() -{ +{SELFPARAM(); self.v_angle_y = self.v_angle.y + bot_cmd.bot_cmd_parm_float; self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360; return CMD_STATUS_FINISHED; } float bot_cmd_select_weapon() -{ +{SELFPARAM(); float id; id = bot_cmd.bot_cmd_parm_float; @@ -593,7 +593,7 @@ const int CMD_CONDITION_true_BLOCK = 4; const int CMD_CONDITION_false_BLOCK = 8; float bot_cmd_eval(string expr) -{ +{SELFPARAM(); // Search for numbers if(strstrofs("0123456789", substring(expr, 0, 1), 0) >= 0) { @@ -622,7 +622,7 @@ float bot_cmd_eval(string expr) } float bot_cmd_if() -{ +{SELFPARAM(); string expr, val_a, val_b; float cmpofs; @@ -693,20 +693,20 @@ float bot_cmd_if() } float bot_cmd_else() -{ +{SELFPARAM(); self.bot_cmd_condition_status &= ~CMD_CONDITION_true_BLOCK; self.bot_cmd_condition_status |= CMD_CONDITION_false_BLOCK; return CMD_STATUS_FINISHED; } float bot_cmd_fi() -{ +{SELFPARAM(); self.bot_cmd_condition_status = CMD_CONDITION_NONE; return CMD_STATUS_FINISHED; } float bot_cmd_resetaim() -{ +{SELFPARAM(); self.v_angle = '0 0 0'; return CMD_STATUS_FINISHED; } @@ -717,7 +717,7 @@ float bot_cmd_resetaim() .vector bot_cmd_aim_end; float bot_cmd_aim() -{ +{SELFPARAM(); // Current direction if(self.bot_cmd_aim_endtime) { @@ -768,7 +768,7 @@ float bot_cmd_aim() } float bot_cmd_aimtarget() -{ +{SELFPARAM(); if(self.bot_cmd_aim_endtime) { return bot_cmd_aim(); @@ -827,7 +827,7 @@ const int BOT_CMD_KEY_CROUCH = 512; const int BOT_CMD_KEY_CHAT = 1024; float bot_presskeys() -{ +{SELFPARAM(); self.movement = '0 0 0'; self.BUTTON_JUMP = false; self.BUTTON_CROUCH = false; @@ -876,7 +876,7 @@ float bot_presskeys() float bot_cmd_keypress_handler(string key, float enabled) -{ +{SELFPARAM(); switch(key) { case "all": @@ -990,7 +990,7 @@ float bot_cmd_releasekey() } float bot_cmd_pause() -{ +{SELFPARAM(); self.button1 = 0; self.button8 = 0; self.BUTTON_USE = 0; @@ -1009,12 +1009,12 @@ float bot_cmd_pause() } float bot_cmd_moveto() -{ +{SELFPARAM(); return self.cmd_moveto(bot_cmd.bot_cmd_parm_vector); } float bot_cmd_movetotarget() -{ +{SELFPARAM(); entity e; e = bot_getplace(bot_cmd.bot_cmd_parm_string); if(!e) @@ -1023,13 +1023,13 @@ float bot_cmd_movetotarget() } float bot_cmd_resetgoal() -{ +{SELFPARAM(); return self.cmd_resetgoal(); } float bot_cmd_sound() -{ +{SELFPARAM(); string f; f = bot_cmd.bot_cmd_parm_string; @@ -1057,7 +1057,7 @@ float bot_cmd_sound() .entity tuba_note; float bot_cmd_debug_assert_canfire() -{ +{SELFPARAM(); float f; f = bot_cmd.bot_cmd_parm_float; @@ -1100,7 +1100,7 @@ float bot_cmd_debug_assert_canfire() // void bot_command_executed(float rm) -{ +{SELFPARAM(); entity cmd; cmd = bot_cmd; @@ -1112,7 +1112,7 @@ void bot_command_executed(float rm) } void bot_setcurrentcommand() -{ +{SELFPARAM(); bot_cmd = world; if(!self.bot_cmd_current) @@ -1171,7 +1171,7 @@ void bot_resetqueues() // Here we map commands to functions and deal with complex interactions between commands and execution states // NOTE: Of course you need to include your commands here too :) float bot_execute_commands_once() -{ +{SELFPARAM(); float status, ispressingkey; // Find command diff --git a/qcsrc/server/bot/waypoints.qc b/qcsrc/server/bot/waypoints.qc index ca209f9ca7..957f2478d2 100644 --- a/qcsrc/server/bot/waypoints.qc +++ b/qcsrc/server/bot/waypoints.qc @@ -162,7 +162,7 @@ void waypoint_addlink(entity from, entity to) // (precompile a list of all reachable waypoints from this spawnfunc_waypoint) // (SLOW!) void waypoint_think() -{ +{SELFPARAM(); entity e; vector sv, sm1, sm2, ev, em1, em2, dv; @@ -294,7 +294,7 @@ void waypoint_schedulerelink(entity wp) // spawnfunc_waypoint map entity void spawnfunc_waypoint() -{ +{SELFPARAM(); setorigin(self, self.origin); // schedule a relink after other waypoints have had a chance to spawn waypoint_clearlinks(self); @@ -808,7 +808,7 @@ void waypoint_spawnforteleporter(entity e, vector destination, float timetaken) } entity waypoint_spawnpersonal(vector position) -{ +{SELFPARAM(); entity w; // drop the waypoint to a proper location: diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 82bc903615..62e968e896 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -65,7 +65,7 @@ void CheatShutdownClient() } float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as argument for possible future ACL checking -{ +{SELFPARAM(); // dead people cannot cheat if(self.deadflag != DEAD_NO) return 0; @@ -115,7 +115,7 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a float num_autoscreenshot; void info_autoscreenshot_findtarget() -{ +{SELFPARAM(); entity e; e = find(world, targetname, self.target); if(!e) @@ -130,7 +130,7 @@ void info_autoscreenshot_findtarget() // we leave Rick Roll alone } void spawnfunc_info_autoscreenshot() -{ +{SELFPARAM(); if(++num_autoscreenshot > autocvar_g_max_info_autoscreenshot) { objerror("Too many info_autoscreenshot entitites. FAIL!"); @@ -142,7 +142,7 @@ void spawnfunc_info_autoscreenshot() } float CheatImpulse(float i) -{ +{SELFPARAM(); BEGIN_CHEAT_FUNCTION(); switch(i) { @@ -301,7 +301,7 @@ float CheatImpulse(float i) void DragBox_Think(); float drag_lastcnt; float CheatCommand(float argc) -{ +{SELFPARAM(); BEGIN_CHEAT_FUNCTION(); string cmd; cmd = argv(0); @@ -755,7 +755,7 @@ void Drag_MoveDrag(entity from, entity to); .entity dragentity; float CheatFrame() -{ +{SELFPARAM(); BEGIN_CHEAT_FUNCTION(); // Dragging can be used as either a cheat, or a function for some objects. If sv_cheats is active, @@ -799,7 +799,7 @@ float CheatFrame() .float dragmovetype; float Drag(float force_allow_pick, float ischeat) -{ +{SELFPARAM(); BEGIN_CHEAT_FUNCTION(); // returns true when an entity has been picked up @@ -1075,7 +1075,7 @@ void Drag_MoveDrag(entity from, entity to) } void DragBox_Think() -{ +{SELFPARAM(); if(self.aiment && self.enemy) { self.origin_x = (self.aiment.origin.x + self.enemy.origin.x) * 0.5; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 3674755f2c..0cb1e49133 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -54,7 +54,7 @@ void send_CSQC_teamnagger() { } float ClientData_Send(entity to, int sf) -{ +{SELFPARAM(); if(to != self.owner) { error("wtf"); @@ -94,14 +94,14 @@ float ClientData_Send(entity to, int sf) } void ClientData_Attach() -{ +{SELFPARAM(); Net_LinkEntity(self.clientdata = spawn(), false, 0, ClientData_Send); self.clientdata.drawonlytoclient = self; self.clientdata.owner = self; } void ClientData_Detach() -{ +{SELFPARAM(); remove(self.clientdata); self.clientdata = world; } @@ -186,7 +186,7 @@ putting a client as observer in the server */ void FixPlayermodel(); void PutObserverInServer (void) -{ +{SELFPARAM(); entity spot; self.hud = HUD_NORMAL; @@ -316,7 +316,7 @@ void PutObserverInServer (void) .float model_randomizer; void FixPlayermodel() -{ +{SELFPARAM(); string defaultmodel; float defaultskin, chmdl, oldskin, n, i; vector m1, m2; @@ -406,15 +406,11 @@ void FixPlayermodel() setcolor(self, stof(autocvar_sv_defaultplayercolors)); } -/* -============= -PutClientInServer -Called when a client spawns in the server -============= -*/ -void PutClientInServer (void) +/** Called when a client spawns in the server */ +void PutClientInServer() { + SELFPARAM(); if(IS_BOT_CLIENT(self)) self.classname = "player"; else if(IS_REAL_CLIENT(self)) @@ -609,7 +605,7 @@ void PutClientInServer (void) self.killcount = 0; } - CL_SpawnWeaponentity(); + CL_SpawnWeaponentity(self); self.alpha = default_player_alpha; self.colormod = '1 1 1' * autocvar_g_player_brightness; self.exteriorweaponentity.alpha = default_weapon_alpha; @@ -675,7 +671,7 @@ void PutClientInServer (void) // TODO do we need all these fields, or should we stop autodetecting runtime // changes and just have a console command to update this? float ClientInit_SendEntity(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_INIT); WriteByte(MSG_ENTITY, g_nexball_meter_period * 32); WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[0])); @@ -707,7 +703,7 @@ float ClientInit_SendEntity(entity to, int sf) } void ClientInit_CheckUpdate() -{ +{SELFPARAM(); self.nextthink = time; if(self.count != autocvar_g_balance_armor_blockpercent) { @@ -737,7 +733,7 @@ void ClientInit_CheckUpdate() } void ClientInit_Spawn() -{ +{SELFPARAM(); entity o; entity e; e = spawn(); @@ -768,7 +764,7 @@ SetChangeParms ============= */ void SetChangeParms (void) -{ +{SELFPARAM(); // save parms for level change parm1 = self.parm_idlesince - time; } @@ -779,7 +775,7 @@ DecodeLevelParms ============= */ void DecodeLevelParms (void) -{ +{SELFPARAM(); // load parms self.parm_idlesince = parm1; if(self.parm_idlesince == -(86400 * 366)) @@ -799,7 +795,7 @@ Called when a client types 'kill' in the console .float clientkill_nexttime; void ClientKill_Now_TeamChange() -{ +{SELFPARAM(); if(self.killindicator_teamchange == -1) { JoinBestTeam( self, false, true ); @@ -816,7 +812,7 @@ void ClientKill_Now_TeamChange() } void ClientKill_Now() -{ +{SELFPARAM(); if(self.vehicle) { vehicles_exit(VHEF_RELEASE); @@ -841,7 +837,7 @@ void ClientKill_Now() // now I am sure the player IS dead } void KillIndicator_Think() -{ +{SELFPARAM(); if (gameover) { self.owner.killindicator = world; @@ -883,7 +879,7 @@ void KillIndicator_Think() float clientkilltime; void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2 = spec -{ +{SELFPARAM(); float killtime; float starttime; entity e; @@ -987,7 +983,7 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2 } void ClientKill (void) -{ +{SELFPARAM(); if(gameover) return; if(self.player_blocked) return; if(self.frozen) return; @@ -1048,7 +1044,7 @@ Called once (not at each match start) when a client begins a connection to the s ============= */ void ClientPreConnect (void) -{ +{SELFPARAM(); if(autocvar_sv_eventlog) { GameLogEcho(sprintf(":connect:%d:%d:%s", @@ -1069,7 +1065,7 @@ Called when a client connects to the server */ void DecodeLevelParms (void); void ClientConnect (void) -{ +{SELFPARAM(); float t; if(IS_CLIENT(self)) @@ -1264,7 +1260,7 @@ void ClientConnect (void) CheatInitClient(); - CSQCMODEL_AUTOINIT(); + CSQCMODEL_AUTOINIT(self); self.model_randomizer = random(); @@ -1290,7 +1286,7 @@ Called when a client disconnects from the server .entity chatbubbleentity; void ReadyCount(); void ClientDisconnect (void) -{ +{SELFPARAM(); if(self.vehicle) vehicles_exit(VHEF_RELEASE); @@ -1374,7 +1370,7 @@ void ClientDisconnect (void) .float BUTTON_CHAT; void ChatBubbleThink() -{ +{SELFPARAM(); self.nextthink = time; if ((self.owner.alpha < 0) || self.owner.chatbubbleentity != self) { @@ -1400,7 +1396,7 @@ void ChatBubbleThink() } void UpdateChatBubble() -{ +{SELFPARAM(); if (self.alpha < 0) return; // spawn a chatbubble entity if needed @@ -1439,7 +1435,7 @@ void UpdateChatBubble() }*/ void respawn(void) -{ +{SELFPARAM(); if(self.alpha >= 0 && autocvar_g_respawn_ghosts) { self.solid = SOLID_NOT; @@ -1460,7 +1456,7 @@ void respawn(void) } void play_countdown(float finished, string samp) -{ +{SELFPARAM(); if(IS_REAL_CLIENT(self)) if(floor(finished - time - frametime) != floor(finished - time)) if(finished - time < 6) @@ -1468,7 +1464,7 @@ void play_countdown(float finished, string samp) } void player_powerups (void) -{ +{SELFPARAM(); // add a way to see what the items were BEFORE all of these checks for the mutator hook int items_prev = self.items; @@ -1631,7 +1627,7 @@ float CalcRotRegen(float current, float regenstable, float regenfactor, float re } void player_regen (void) -{ +{SELFPARAM(); float max_mod, regen_mod, rot_mod, limit_mod; max_mod = regen_mod = rot_mod = limit_mod = 1; regen_mod_max = max_mod; @@ -1691,7 +1687,7 @@ void player_regen (void) float zoomstate_set; void SetZoomState(float z) -{ +{SELFPARAM(); if(z != self.zoomstate) { self.zoomstate = z; @@ -1700,7 +1696,8 @@ void SetZoomState(float z) zoomstate_set = 1; } -void GetPressedKeys(void) { +void GetPressedKeys() +{SELFPARAM(); MUTATOR_CALLHOOK(GetPressedKeys); #define X(var,bit,flag) (flag ? var |= bit : var &= ~bit) X(self.pressedkeys, KEY_FORWARD, self.movement_x > 0); @@ -1721,7 +1718,8 @@ spectate mode routines ====================== */ -void SpectateCopy(entity spectatee) { +void SpectateCopy(entity spectatee) +{SELFPARAM(); MUTATOR_CALLHOOK(SpectateCopy, spectatee, self); self.armortype = spectatee.armortype; self.armorvalue = spectatee.armorvalue; @@ -1797,7 +1795,7 @@ void SpectateCopy(entity spectatee) { } bool SpectateUpdate() -{ +{SELFPARAM(); if(!self.enemy) return false; @@ -1813,7 +1811,7 @@ bool SpectateUpdate() } bool SpectateSet() -{ +{SELFPARAM(); if(!IS_PLAYER(self.enemy)) return false; @@ -1842,7 +1840,7 @@ void SetSpectator(entity player, entity spectatee) } bool Spectate(entity pl) -{ +{SELFPARAM(); if(g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer) if(DIFF_TEAM(pl, self)) return false; @@ -1853,7 +1851,7 @@ bool Spectate(entity pl) // Returns next available player to spectate if g_ca_spectate_enemies == 0 entity CA_SpectateNext(entity start) -{ +{SELFPARAM(); if(SAME_TEAM(start, self)) return start; @@ -1874,7 +1872,7 @@ entity CA_SpectateNext(entity start) } bool SpectateNext() -{ +{SELFPARAM(); other = find(self.enemy, classname, "player"); if (g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer) @@ -1893,7 +1891,7 @@ bool SpectateNext() } bool SpectatePrev() -{ +{SELFPARAM(); // NOTE: chain order is from the highest to the lower entnum (unlike find) other = findchain(classname, "player"); if (!other) // no player @@ -1938,7 +1936,7 @@ Update a respawn countdown display. ============= */ void ShowRespawnCountdown() -{ +{SELFPARAM(); float number; if(self.deadflag == DEAD_NO) // just respawned? return; @@ -1957,7 +1955,7 @@ void ShowRespawnCountdown() } void LeaveSpectatorMode() -{ +{SELFPARAM(); if(self.caplayer) return; if(nJoinAllowed(self)) @@ -1995,7 +1993,8 @@ void LeaveSpectatorMode() * it checks whether the number of currently playing players exceeds g_maxplayers. * @return int number of free slots for players, 0 if none */ -float nJoinAllowed(entity ignore) { +float nJoinAllowed(entity ignore) +{SELFPARAM(); if(!ignore) // this is called that way when checking if anyone may be able to join (to build qcstatus) // so report 0 free slots if restricted @@ -2034,7 +2033,8 @@ float nJoinAllowed(entity ignore) { * Checks whether the client is an observer or spectator, if so, he will get kicked after * g_maxplayers_spectator_blocktime seconds */ -void checkSpectatorBlock() { +void checkSpectatorBlock() +{SELFPARAM(); if(IS_SPEC(self) || IS_OBSERVER(self)) if(!self.caplayer) if(IS_REAL_CLIENT(self)) @@ -2047,7 +2047,7 @@ void checkSpectatorBlock() { } void PrintWelcomeMessage() -{ +{SELFPARAM(); if(self.motd_actived_time == 0) { if (autocvar_g_campaign) { @@ -2094,7 +2094,7 @@ void PrintWelcomeMessage() } void ObserverThink() -{ +{SELFPARAM(); if ( self.impulse ) { MinigameImpulse(self.impulse); @@ -2129,7 +2129,7 @@ void ObserverThink() } void SpectatorThink() -{ +{SELFPARAM(); if ( self.impulse ) { if(MinigameImpulse(self.impulse)) @@ -2184,7 +2184,7 @@ void SpectatorThink() void vehicles_enter (entity pl, entity veh); void PlayerUseKey() -{ +{SELFPARAM(); if (!IS_PLAYER(self)) return; @@ -2270,7 +2270,7 @@ void() nexball_setstatus; .float last_vehiclecheck; .int items_added; void PlayerPreThink (void) -{ +{SELFPARAM(); WarpZone_PlayerPhysics_FixVAngle(); self.stat_game_starttime = game_starttime; @@ -2661,7 +2661,7 @@ Called every frame for each client after the physics are run */ .float idlekick_lasttimeleft; void PlayerPostThink (void) -{ +{SELFPARAM(); if(sv_maxidle > 0 && frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero). if(IS_PLAYER(self) || sv_maxidle_spectatorsareidle) { @@ -2732,5 +2732,5 @@ void PlayerPostThink (void) playerdemo_write(); - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index dd010214e5..0271f085bd 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -51,7 +51,7 @@ */ void ImpulseCommands (void) -{ +{SELFPARAM(); int imp; vector org; float i; diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 76253977c1..6f7c8c2ba1 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -25,7 +25,7 @@ #include "../common/animdecide.qh" void CopyBody_Think(void) -{ +{SELFPARAM(); if(self.CopyBody_nextthink && time > self.CopyBody_nextthink) { self.CopyBody_think(); @@ -35,11 +35,11 @@ void CopyBody_Think(void) self.CopyBody_think = self.think; self.think = CopyBody_Think; } - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); self.nextthink = time; } void CopyBody(float keepvelocity) -{ +{SELFPARAM(); entity oldself; if (self.effects & EF_NODRAW) return; @@ -105,7 +105,7 @@ void CopyBody(float keepvelocity) if(self.colormap <= maxclients && self.colormap > 0) self.colormap = 1024 + oldself.clientcolors; - CSQCMODEL_AUTOINIT(); + CSQCMODEL_AUTOINIT(self); self.CopyBody_nextthink = oldself.nextthink; self.CopyBody_think = oldself.think; self.nextthink = time; @@ -118,7 +118,7 @@ void CopyBody(float keepvelocity) } float player_getspecies() -{ +{SELFPARAM(); float s; get_model_parameters(self.model, self.skin); s = get_model_parameters_species; @@ -129,14 +129,14 @@ float player_getspecies() } void player_setupanimsformodel() -{ +{SELFPARAM(); // load animation info animdecide_load_if_needed(self); animdecide_setstate(self, 0, false); } void player_anim (void) -{ +{SELFPARAM(); int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2)); if(self.deadflag) { if (!deadbits) { @@ -169,7 +169,7 @@ void player_anim (void) } void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); float take, save; vector v; Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker); @@ -221,7 +221,7 @@ void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, int de } void calculate_player_respawn_time() -{ +{SELFPARAM(); if(g_ca) return; @@ -308,7 +308,7 @@ void calculate_player_respawn_time() } void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); float take, save, dh, da; int j; vector v; @@ -1013,7 +1013,7 @@ void PrecachePlayerSounds(string f) } void ClearPlayerSounds() -{ +{SELFPARAM(); #define _VOICEMSG(m) if(self.playersound_##m) { strunzone(self.playersound_##m); self.playersound_##m = string_null; } ALLPLAYERSOUNDS ALLVOICEMSGS @@ -1021,7 +1021,7 @@ void ClearPlayerSounds() } float LoadPlayerSounds(string f, float first) -{ +{SELFPARAM(); float fh; string s; var .string field; @@ -1049,7 +1049,7 @@ float LoadPlayerSounds(string f, float first) } void UpdatePlayerSounds() -{ +{SELFPARAM(); if(self.modelindex == self.modelindex_for_playersound) if(self.skin == self.skin_for_playersound) return; @@ -1063,7 +1063,7 @@ void UpdatePlayerSounds() } void FakeGlobalSound(string sample, float chan, float voicetype) -{ +{SELFPARAM(); float n; float tauntrand; @@ -1138,7 +1138,7 @@ void FakeGlobalSound(string sample, float chan, float voicetype) } void GlobalSound(string sample, float chan, float voicetype) -{ +{SELFPARAM(); float n; float tauntrand; @@ -1236,12 +1236,12 @@ void GlobalSound(string sample, float chan, float voicetype) } void PlayerSound(.string samplefield, float chan, float voicetype) -{ +{SELFPARAM(); GlobalSound(self.(samplefield), chan, voicetype); } void VoiceMessage(string type, string msg) -{ +{SELFPARAM(); var .string sample; float voicetype, ownteam; float flood; diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index a34752c9c7..f849deb6a8 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -40,7 +40,7 @@ void ClientKill_TeamChange (float targetteam); // 0 = don't change, -1 = auto, - // ========================================================= float SV_ParseClientCommand_floodcheck() -{ +{SELFPARAM(); if (!timeout_status) // not while paused { if(time <= (self.cmd_floodtime + autocvar_sv_clientcommand_antispam_time)) @@ -63,7 +63,7 @@ float SV_ParseClientCommand_floodcheck() // ======================= void ClientCommand_autoswitch(float request, float argc) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -88,7 +88,7 @@ void ClientCommand_autoswitch(float request, float argc) } void ClientCommand_clientversion(float request, float argc) // internal command, used only by code -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -131,7 +131,7 @@ void ClientCommand_clientversion(float request, float argc) // internal command, } void ClientCommand_mv_getpicture(float request, float argc) // internal command, used only by code -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -157,7 +157,7 @@ void ClientCommand_mv_getpicture(float request, float argc) // internal command, } void ClientCommand_join(float request) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -199,7 +199,7 @@ void ClientCommand_join(float request) } void ClientCommand_physics(float request, float argc) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -239,7 +239,7 @@ void ClientCommand_physics(float request, float argc) } void ClientCommand_ready(float request) // todo: anti-spam for toggling readyness -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -285,7 +285,7 @@ void ClientCommand_ready(float request) // todo: anti-spam for toggling readynes } void ClientCommand_say(float request, float argc, string command) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -305,7 +305,7 @@ void ClientCommand_say(float request, float argc, string command) } void ClientCommand_say_team(float request, float argc, string command) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -325,7 +325,7 @@ void ClientCommand_say_team(float request, float argc, string command) } void ClientCommand_selectteam(float request, float argc) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -397,7 +397,7 @@ void ClientCommand_selectteam(float request, float argc) } void ClientCommand_selfstuff(float request, string command) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -421,7 +421,7 @@ void ClientCommand_selfstuff(float request, string command) } void ClientCommand_sentcvar(float request, float argc, string command) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -455,7 +455,7 @@ void ClientCommand_sentcvar(float request, float argc, string command) } void ClientCommand_spectate(float request) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -500,7 +500,7 @@ void ClientCommand_spectate(float request) } void ClientCommand_suggestmap(float request, float argc) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -524,7 +524,7 @@ void ClientCommand_suggestmap(float request, float argc) } void ClientCommand_tell(float request, float argc, string command) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -575,7 +575,7 @@ void ClientCommand_tell(float request, float argc, string command) } void ClientCommand_voice(float request, float argc, string command) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -652,7 +652,7 @@ void ClientCommand_(float request) /* nothing */ void ClientCommand_macro_help() -{ +{SELFPARAM(); #define CLIENT_COMMAND(name,function,description) \ { sprint(self, " ^2", name, "^7: ", description, "\n"); } @@ -701,7 +701,7 @@ void ClientCommand_macro_write_aliases(float fh) // If this function exists, server game code parses clientcommand before the engine code gets it. void SV_ParseClientCommand(string command) -{ +{SELFPARAM(); // If invalid UTF-8, don't even parse it string command2 = ""; float len = strlen(command); diff --git a/qcsrc/server/command/common.qc b/qcsrc/server/command/common.qc index ee832bcc85..5ddea150a9 100644 --- a/qcsrc/server/command/common.qc +++ b/qcsrc/server/command/common.qc @@ -178,7 +178,7 @@ void print_to(entity to, string input) // used by CommonCommand_timeout() and CommonCommand_timein() to handle game pausing and messaging and such. void timeout_handler_reset() -{ +{SELFPARAM(); timeout_caller = world; timeout_time = 0; timeout_leadtime = 0; @@ -187,7 +187,7 @@ void timeout_handler_reset() } void timeout_handler_think() -{ +{SELFPARAM(); entity tmp_player; switch(timeout_status) @@ -312,7 +312,7 @@ void CommonCommand_cvar_purechanges(float request, entity caller) } void CommonCommand_editmob(int request, entity caller, int argc) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: diff --git a/qcsrc/server/command/radarmap.qc b/qcsrc/server/command/radarmap.qc index 396337a187..8c15819e05 100644 --- a/qcsrc/server/command/radarmap.qc +++ b/qcsrc/server/command/radarmap.qc @@ -227,7 +227,7 @@ void RadarMap_Next() radarmapper = world; } void RadarMap_Think() -{ +{SELFPARAM(); // rough map entity // cnt: current line // size: pixel width/height diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index fdf82e368f..136977ddc4 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -41,7 +41,7 @@ void PutObserverInServer (void); // used by GameCommand_make_mapinfo() void make_mapinfo_Think() -{ +{SELFPARAM(); if(MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, 0, 1)) { LOG_INFO("Done rebuiling mapinfos.\n"); @@ -196,7 +196,7 @@ void GameCommand_allready(float request) } void GameCommand_allspec(float request, float argc) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -230,7 +230,7 @@ void GameCommand_allspec(float request, float argc) } void GameCommand_anticheat(float request, float argc) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -1002,7 +1002,7 @@ void GameCommand_make_mapinfo(float request) } void GameCommand_moveplayer(float request, float argc) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -1171,7 +1171,7 @@ void GameCommand_nospectators(float request) } void GameCommand_playerdemo(float request, float argc) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: @@ -1344,7 +1344,7 @@ void GameCommand_setbots(float request, float argc) } void GameCommand_shuffleteams(float request) -{ +{SELFPARAM(); switch(request) { case CMD_REQUEST_COMMAND: diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 4be48e124e..4d6c6ae8e5 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -348,7 +348,7 @@ void VoteThink() // Resets the state of all clients, items, weapons, waypoints, ... of the map. void reset_map(float dorespawn) -{ +{SELFPARAM(); entity oldself; oldself = self; @@ -423,7 +423,7 @@ void reset_map(float dorespawn) // Restarts the map after the countdown is over (and cvar sv_ready_restart_after_countdown is set) void ReadyRestart_think() -{ +{SELFPARAM(); restart_mapalreadyrestarted = 1; reset_map(true); Score_ClearAll(); diff --git a/qcsrc/server/controlpoint.qc b/qcsrc/server/controlpoint.qc index 7cf81d762e..fac8bca4dd 100644 --- a/qcsrc/server/controlpoint.qc +++ b/qcsrc/server/controlpoint.qc @@ -1,7 +1,7 @@ #include "controlpoint.qh" bool cpicon_send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_CONTROLPOINT_ICON); WriteByte(MSG_ENTITY, sf); if(sf & CPSF_SETUP) diff --git a/qcsrc/server/ent_cs.qc b/qcsrc/server/ent_cs.qc index 40dbf1aefa..a3be17bf2b 100644 --- a/qcsrc/server/ent_cs.qc +++ b/qcsrc/server/ent_cs.qc @@ -26,7 +26,7 @@ void entcs_init() } float entcs_customize() -{ +{SELFPARAM(); entity o; o = self.owner; if(o.deadflag != DEAD_NO) @@ -43,7 +43,7 @@ float entcs_customize() } float entcs_send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS); WriteByte(MSG_ENTITY, sf); if(sf & 1) @@ -64,7 +64,7 @@ float entcs_send(entity to, int sf) } void entcs_think() -{ +{SELFPARAM(); self.nextthink = time + 0.033333333333; // increase this to like 0.15 once the client can do smoothing entity o; @@ -93,7 +93,7 @@ void entcs_think() } entity attach_entcs() -{ +{SELFPARAM(); entity ent; ent = spawn(); @@ -111,7 +111,7 @@ entity attach_entcs() } void detach_entcs() -{ +{SELFPARAM(); remove(self.entcs); self.entcs = world; } diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 0807c924c2..4331676808 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -23,7 +23,7 @@ #include "../warpzonelib/common.qh" float Damage_DamageInfo_SendEntity(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_DAMAGEINFO); WriteShort(MSG_ENTITY, self.projectiledeathtype); WriteCoord(MSG_ENTITY, floor(self.origin.x)); @@ -67,7 +67,7 @@ void UpdateFrags(entity player, float f) } void GiveFrags (entity attacker, entity targ, float f, int deathtype) -{ +{SELFPARAM(); // TODO route through PlayerScores instead if(gameover) return; @@ -544,7 +544,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype) } void Ice_Think() -{ +{SELFPARAM(); if(!self.owner.frozen || self.owner.iceblock != self) { remove(self); @@ -555,7 +555,7 @@ void Ice_Think() } void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypoint) -{ +{SELFPARAM(); if(!IS_PLAYER(targ) && !IS_MONSTER(targ)) // only specified entities can be freezed return; @@ -624,7 +624,7 @@ void Unfreeze (entity targ) } void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); float mirrordamage; float mirrorforce; float complainteamdamage = 0; @@ -1313,7 +1313,7 @@ void Fire_ApplyEffect(entity e) } void fireburner_think() -{ +{SELFPARAM(); // for players, this is done in the regular loop if(wasfreed(self.owner)) { diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index d63a2ade0d..543432e405 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -80,7 +80,7 @@ void RemoveGrapplingHook(entity pl) } void GrapplingHookReset(void) -{ +{SELFPARAM(); if(self.realowner.hook == self) RemoveGrapplingHook(self.owner); else // in any case: @@ -89,7 +89,7 @@ void GrapplingHookReset(void) void GrapplingHookThink(); void GrapplingHook_Stop() -{ +{SELFPARAM(); Send_Effect(EFFECT_HOOK_IMPACT, self.origin, '0 0 0', 1); sound (self, CH_SHOTS, W_Sound("hook_impact"), VOL_BASE, ATTEN_NORM); @@ -104,7 +104,7 @@ void GrapplingHook_Stop() .vector hook_start, hook_end; float GrapplingHookSend(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_HOOK); sf = sf & 0x7F; if(sound_allowed(MSG_BROADCAST, self.realowner)) @@ -130,7 +130,7 @@ float GrapplingHookSend(entity to, int sf) } void GrapplingHookThink() -{ +{SELFPARAM(); float spd, dist, minlength, pullspeed, ropestretch, ropeairfriction, rubberforce, newlength, rubberforce_overstretch; vector dir, org, end, v0, dv, v, myorg, vs; if(self.realowner.hook != self) // how did that happen? @@ -300,7 +300,7 @@ void GrapplingHookThink() } void GrapplingHookTouch (void) -{ +{SELFPARAM(); if(other.movetype == MOVETYPE_FOLLOW) return; PROJECTILE_TOUCH; @@ -318,7 +318,7 @@ void GrapplingHookTouch (void) } void GrapplingHook_Damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.health <= 0) return; @@ -340,7 +340,7 @@ void GrapplingHook_Damage (entity inflictor, entity attacker, float damage, int } void FireGrapplingHook (void) -{ +{SELFPARAM(); entity missile; vector org; vector vs; @@ -423,7 +423,7 @@ void FireGrapplingHook (void) // if((self.hook == world || !self.hook.state) && self.movetype == MOVETYPE_FLY) void GrapplingHookFrame() -{ +{SELFPARAM(); if(g_grappling_hook && timeout_status != TIMEOUT_ACTIVE && self.weapon != WEP_HOOK.m_id && !self.vehicle) { // offhand hook controls @@ -531,7 +531,7 @@ void GrappleHookInit() } void SetGrappleHookBindings() -{ +{SELFPARAM(); // this function has been modified for Xonotic // don't remove these lines! old server or demos coud overwrite the new aliases stuffcmd(self, "alias +hook +button6\n"); diff --git a/qcsrc/server/g_models.qc b/qcsrc/server/g_models.qc index 62b2cfb51d..8bb2b1b6af 100644 --- a/qcsrc/server/g_models.qc +++ b/qcsrc/server/g_models.qc @@ -10,7 +10,7 @@ .float modelscale; void g_model_setcolormaptoactivator (void) -{ +{SELFPARAM(); if(teamplay) { if(activator.team) @@ -24,13 +24,13 @@ void g_model_setcolormaptoactivator (void) } void g_clientmodel_setcolormaptoactivator (void) -{ +{SELFPARAM(); g_model_setcolormaptoactivator(); self.SendFlags |= (8 | 1); } void g_clientmodel_use(void) -{ +{SELFPARAM(); if (self.antiwall_flag == 1) { self.inactive = 1; @@ -45,7 +45,7 @@ void g_clientmodel_use(void) } void g_model_dropbyspawnflags() -{ +{SELFPARAM(); if((self.spawnflags & 3) == 1) // ALIGN_ORIGIN { traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self); @@ -64,7 +64,7 @@ void g_model_dropbyspawnflags() } void g_clientmodel_dropbyspawnflags() -{ +{SELFPARAM(); vector o0; o0 = self.origin; g_model_dropbyspawnflags(); @@ -73,7 +73,7 @@ void g_clientmodel_dropbyspawnflags() } float g_clientmodel_genericsendentity (entity to, int sf) -{ +{SELFPARAM(); sf = sf & 0x0F; if(self.angles != '0 0 0') sf |= 0x10; @@ -177,15 +177,15 @@ float g_clientmodel_genericsendentity (entity to, int sf) self.default_solid = sol; // non-solid model entities: -void spawnfunc_misc_gamemodel() { self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // model entity -void spawnfunc_misc_clientmodel() { self.angles_x = -self.angles.x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity -void spawnfunc_misc_models() { self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use +void spawnfunc_misc_gamemodel() { SELFPARAM(); self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // model entity +void spawnfunc_misc_clientmodel() { SELFPARAM(); self.angles_x = -self.angles.x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity +void spawnfunc_misc_models() { SELFPARAM(); self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use // non-solid brush entities: -void spawnfunc_func_illusionary() { G_MODEL_INIT (SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED) -void spawnfunc_func_clientillusionary() { G_CLIENTMODEL_INIT(SOLID_NOT) } // brush entity -void spawnfunc_func_static() { G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old alias name from some other game +void spawnfunc_func_illusionary() { SELFPARAM(); G_MODEL_INIT (SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED) +void spawnfunc_func_clientillusionary() { SELFPARAM(); G_CLIENTMODEL_INIT(SOLID_NOT) } // brush entity +void spawnfunc_func_static() { SELFPARAM(); G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old alias name from some other game // solid brush entities -void spawnfunc_func_wall() { G_MODEL_INIT (SOLID_BSP) } // Q1 name -void spawnfunc_func_clientwall() { G_CLIENTMODEL_INIT(SOLID_BSP) } // brush entity (WARNING: MISPREDICTED) +void spawnfunc_func_wall() { SELFPARAM(); G_MODEL_INIT (SOLID_BSP) } // Q1 name +void spawnfunc_func_clientwall() { SELFPARAM(); G_CLIENTMODEL_INIT(SOLID_BSP) } // brush entity (WARNING: MISPREDICTED) diff --git a/qcsrc/server/g_subs.qc b/qcsrc/server/g_subs.qc index 3a242dcf32..fc70c758a4 100644 --- a/qcsrc/server/g_subs.qc +++ b/qcsrc/server/g_subs.qc @@ -6,7 +6,7 @@ #include "../warpzonelib/common.qh" void spawnfunc_info_null (void) -{ +{SELFPARAM(); remove(self); // if anything breaks, tell the mapper to fix his map! info_null is meant to remove itself immediately. } @@ -281,7 +281,7 @@ vector findbetterlocation (vector org, float mindist) } float LOD_customize() -{ +{SELFPARAM(); float d; if(autocvar_loddebug) @@ -309,12 +309,12 @@ float LOD_customize() } void LOD_uncustomize() -{ +{SELFPARAM(); self.modelindex = self.lodmodelindex0; } void LODmodel_attach() -{ +{SELFPARAM(); entity e; if(!self.loddistance1) @@ -374,7 +374,7 @@ void LODmodel_attach() } void ApplyMinMaxScaleAngles(entity e) -{ +{SELFPARAM(); if(e.angles.x != 0 || e.angles.z != 0 || self.avelocity.x != 0 || self.avelocity.z != 0) // "weird" rotation { e.maxs = '1 1 1' * vlen( @@ -401,7 +401,7 @@ void ApplyMinMaxScaleAngles(entity e) } void SetBrushEntityModel() -{ +{SELFPARAM(); if(self.model != "") { precache_model(self.model); @@ -421,7 +421,7 @@ void SetBrushEntityModel() } void SetBrushEntityModelNoLOD() -{ +{SELFPARAM(); if(self.model != "") { precache_model(self.model); @@ -446,7 +446,7 @@ InitTrigger */ void SetMovedir() -{ +{SELFPARAM(); if (self.movedir != '0 0 0') self.movedir = normalize(self.movedir); else @@ -459,7 +459,7 @@ void SetMovedir() } void InitTrigger() -{ +{SELFPARAM(); // trigger angles are used for one-way touches. An angle of 0 is assumed // to mean no restrictions, so use a yaw of 360 instead. SetMovedir (); @@ -471,7 +471,7 @@ void InitTrigger() } void InitSolidBSPTrigger() -{ +{SELFPARAM(); // trigger angles are used for one-way touches. An angle of 0 is assumed // to mean no restrictions, so use a yaw of 360 instead. SetMovedir (); @@ -483,7 +483,7 @@ void InitSolidBSPTrigger() } float InitMovingBrushTrigger() -{ +{SELFPARAM(); // trigger angles are used for one-way touches. An angle of 0 is assumed // to mean no restrictions, so use a yaw of 360 instead. self.solid = SOLID_BSP; diff --git a/qcsrc/server/g_violence.qc b/qcsrc/server/g_violence.qc index 5bc8aafd37..a9111a03bc 100644 --- a/qcsrc/server/g_violence.qc +++ b/qcsrc/server/g_violence.qc @@ -2,7 +2,7 @@ #include "_all.qh" float Violence_GibSplash_SendEntity(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_GIBSPLASH); WriteByte(MSG_ENTITY, self.state); // actually type WriteByte(MSG_ENTITY, bound(1, self.cnt * 16, 255)); // gibbage amount multiplier @@ -15,7 +15,7 @@ float Violence_GibSplash_SendEntity(entity to, int sf) // TODO maybe convert this to a TE? void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker) -{ +{SELFPARAM(); if(g_cts) // no gibs in CTS return; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 15c1ae68de..3233f241a4 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -41,7 +41,7 @@ const float LATENCY_THINKRATE = 10; .float latency_time; entity pingplreport; void PingPLReport_Think() -{ +{SELFPARAM(); float delta; entity e; @@ -117,7 +117,7 @@ void SetDefaultAlpha() } void GotoFirstMap() -{ +{SELFPARAM(); float n; if(autocvar__sv_init) { @@ -513,20 +513,20 @@ void detect_maptype() entity randomseed; float RandomSeed_Send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_RANDOMSEED); WriteShort(MSG_ENTITY, self.cnt); return true; } void RandomSeed_Think() -{ +{SELFPARAM(); self.cnt = bound(0, floor(random() * 65536), 65535); self.nextthink = time + 5; self.SendFlags |= 1; } void RandomSeed_Spawn() -{ +{SELFPARAM(); randomseed = spawn(); randomseed.think = RandomSeed_Think; Net_LinkEntity(randomseed, false, 0, RandomSeed_Send); @@ -539,7 +539,7 @@ void RandomSeed_Spawn() } void spawnfunc___init_dedicated_server(void) -{ +{SELFPARAM(); // handler for _init/_init map (only for dedicated server initialization) world_initialized = -1; // don't complain @@ -577,7 +577,7 @@ void WeaponStats_Init(); void WeaponStats_Shutdown(); void Physics_AddStats(); void spawnfunc_worldspawn (void) -{ +{SELFPARAM(); float fd, l, j, n; string s; @@ -926,7 +926,7 @@ void spawnfunc_worldspawn (void) } void spawnfunc_light (void) -{ +{SELFPARAM(); //makestatic (self); // Who the f___ did that? remove(self); } @@ -1318,7 +1318,7 @@ When the player presses attack or jump, change to the next level */ .float autoscreenshot; void IntermissionThink() -{ +{SELFPARAM(); FixIntermissionClient(self); float server_screenshot = (autocvar_sv_autoscreenshot && self.cvar_cl_autoscreenshot); @@ -1595,7 +1595,7 @@ Exit deathmatch games upon conditions ============ */ void CheckRules_Player() -{ +{SELFPARAM(); if (gameover) // someone else quit the game already return; @@ -1694,7 +1694,7 @@ void ClearWinners(void) // they win. Otherwise the defending team wins once the timelimit passes. void assault_new_round(); float WinningCondition_Assault() -{ +{SELFPARAM(); float status; WinningConditionHelper(); // set worldstatus @@ -2202,7 +2202,7 @@ string GotoMap(string m) void EndFrame() -{ +{SELFPARAM(); anticheat_endframe(); float altime; @@ -2241,7 +2241,7 @@ void EndFrame() float redirection_timeout; float redirection_nextthink; float RedirectionThink() -{ +{SELFPARAM(); float clients_found; if(redirection_target == "") diff --git a/qcsrc/server/generator.qc b/qcsrc/server/generator.qc index 3e0b5171f2..ec38521c66 100644 --- a/qcsrc/server/generator.qc +++ b/qcsrc/server/generator.qc @@ -1,7 +1,7 @@ #include "generator.qh" bool generator_send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_GENERATOR); WriteByte(MSG_ENTITY, sf); if(sf & GSF_SETUP) @@ -30,7 +30,7 @@ bool generator_send(entity to, int sf) } void generator_link(void() spawnproc) -{ +{SELFPARAM(); Net_LinkEntity(self, true, 0, generator_send); self.think = spawnproc; self.nextthink = time; diff --git a/qcsrc/server/ipban.qc b/qcsrc/server/ipban.qc index 671137a645..5bf648a0b5 100644 --- a/qcsrc/server/ipban.qc +++ b/qcsrc/server/ipban.qc @@ -200,7 +200,7 @@ void OnlineBanList_URI_Get_Callback(float id, float status, string data) } void OnlineBanList_Think() -{ +{SELFPARAM(); float argc; string uri; float i, n; diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index 1518151f2c..eccfbd91c7 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -69,7 +69,8 @@ item_key /** * Key touch handler. */ -void item_key_touch(void) { +void item_key_touch() +{SELFPARAM(); if (!IS_PLAYER(other)) return; @@ -86,7 +87,8 @@ void item_key_touch(void) { /** * Spawn a key with given model, key code and color. */ -void spawn_item_key() { +void spawn_item_key() +{SELFPARAM(); precache_model(self.model); if (self.spawnflags & 1) // FLOATING @@ -146,7 +148,8 @@ This is the only correct way to put keys on the map! itemkeys MUST always have exactly one bit set. */ -void spawnfunc_item_key() { +void spawnfunc_item_key() +{SELFPARAM(); string _netname; vector _colormod; @@ -252,7 +255,8 @@ FLOATING: the item will float in air, instead of aligning to the floor by fallin ---------NOTES---------- Don't use this entity on new maps! Use item_key instead. */ -void spawnfunc_item_key1(void) { +void spawnfunc_item_key1(void) +{SELFPARAM(); self.classname = "item_key"; self.itemkeys = ITEM_KEY_BIT(1); spawnfunc_item_key(); @@ -270,7 +274,8 @@ FLOATING: the item will float in air, instead of aligning to the floor by fallin ---------NOTES---------- Don't use this entity on new maps! Use item_key instead. */ -void spawnfunc_item_key2(void) { +void spawnfunc_item_key2(void) +{SELFPARAM(); self.classname = "item_key"; self.itemkeys = ITEM_KEY_BIT(0); spawnfunc_item_key(); diff --git a/qcsrc/server/mapvoting.qc b/qcsrc/server/mapvoting.qc index d453606d39..8e7deae8fe 100644 --- a/qcsrc/server/mapvoting.qc +++ b/qcsrc/server/mapvoting.qc @@ -123,7 +123,7 @@ void MapVote_UnzoneStrings() } string MapVote_Suggest(string m) -{ +{SELFPARAM(); float i; if(m == "") return "That's not how to use this command."; @@ -263,7 +263,7 @@ void MapVote_Init() } void MapVote_SendPicture(float id) -{ +{SELFPARAM(); msg_entity = self; WriteByte(MSG_ONE, SVC_TEMPENTITY); WriteByte(MSG_ONE, TE_CSQC_PICTURE); diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 55b8c2ea27..1ed405b34d 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -241,7 +241,7 @@ string NearestLocation(vector p) } string formatmessage(string msg) -{ +{SELFPARAM(); float p, p1, p2; float n; vector cursor; @@ -323,7 +323,7 @@ Called with: >0: receives a cvar from name=argv(f) value=argv(f+1) */ void GetCvars_handleString(string thisname, float f, .string field, string name) -{ +{SELFPARAM(); if (f < 0) { if (self.(field)) @@ -343,7 +343,7 @@ void GetCvars_handleString(string thisname, float f, .string field, string name) stuffcmd(self, strcat("cl_cmd sendcvar ", name, "\n")); } void GetCvars_handleString_Fixup(string thisname, float f, .string field, string name, string(string) func) -{ +{SELFPARAM(); GetCvars_handleString(thisname, f, field, name); if (f >= 0) // also initialize to the fitting value for "" when sending cvars out if (thisname == name) @@ -357,7 +357,7 @@ void GetCvars_handleString_Fixup(string thisname, float f, .string field, string } } void GetCvars_handleFloat(string thisname, float f, .float field, string name) -{ +{SELFPARAM(); if (f < 0) { } @@ -370,7 +370,7 @@ void GetCvars_handleFloat(string thisname, float f, .float field, string name) stuffcmd(self, strcat("cl_cmd sendcvar ", name, "\n")); } void GetCvars_handleFloatOnce(string thisname, float f, .float field, string name) -{ +{SELFPARAM(); if (f < 0) { } @@ -393,7 +393,7 @@ void GetCvars_handleFloatOnce(string thisname, float f, .float field, string nam } } string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(string wo) -{ +{SELFPARAM(); string o; o = W_FixWeaponOrder_ForceComplete(wo); if(self.weaponorder_byimpulse) @@ -405,7 +405,7 @@ string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(string wo) return o; } void GetCvars(float f) -{ +{SELFPARAM(); string s = string_null; if (f > 0) @@ -970,7 +970,7 @@ void precache_all_playermodels(string pattern) } void precache() -{ +{SELFPARAM(); // gamemode related things precache_model ("models/misc/chatbubble.spr"); precache_model("models/ice/ice.md3"); @@ -1111,7 +1111,7 @@ void make_safe_for_remove(entity e) } void objerror(string s) -{ +{SELFPARAM(); make_safe_for_remove(self); builtin_objerror(s); } @@ -1173,7 +1173,7 @@ void InitializeEntity(entity e, void(void) func, float order) } } void InitializeEntitiesRun() -{ +{SELFPARAM(); entity startoflist; startoflist = initialize_entity_first; initialize_entity_first = world; @@ -1213,7 +1213,7 @@ void InitializeEntitiesRun() } void UncustomizeEntitiesRun() -{ +{SELFPARAM(); entity oldself; oldself = self; for (self = world; (self = findfloat(self, uncustomizeentityforclient_set, 1)); ) @@ -1228,7 +1228,7 @@ void SetCustomizer(entity e, float(void) customizer, void(void) uncustomizer) } void Net_LinkEntity(entity e, bool docull, float dt, bool(entity, int) sendfunc) -{ +{SELFPARAM(); vector mi, ma; if (e.classname == "") @@ -1293,7 +1293,7 @@ void EliminatedPlayers_Init(float(entity) isEliminated_func) void adaptor_think2touch() -{ +{SELFPARAM(); entity o; o = other; other = world; @@ -1302,7 +1302,7 @@ void adaptor_think2touch() } void adaptor_think2use() -{ +{SELFPARAM(); entity o, a; o = other; a = activator; @@ -1314,7 +1314,7 @@ void adaptor_think2use() } void adaptor_think2use_hittype_splash() // for timed projectile detonation -{ +{SELFPARAM(); if(!(self.flags & FL_ONGROUND)) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING self.projectiledeathtype |= HITTYPE_SPLASH; adaptor_think2use(); @@ -1322,13 +1322,13 @@ void adaptor_think2use_hittype_splash() // for timed projectile detonation // deferred dropping void DropToFloor_Handler() -{ +{SELFPARAM(); builtin_droptofloor(); self.dropped_origin = self.origin; } void droptofloor() -{ +{SELFPARAM(); InitializeEntity(self, DropToFloor_Handler, INITPRIO_DROPTOFLOOR); } @@ -1384,7 +1384,7 @@ float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector t } float SUB_NoImpactCheck() -{ +{SELFPARAM(); // zero hitcontents = this is not the real impact, but either the // mirror-impact of something hitting the projectile instead of the // projectile hitting the something, or a touchareagrid one. Neither of @@ -1421,7 +1421,7 @@ float SUB_NoImpactCheck() void W_Crylink_Dequeue(entity e); float WarpZone_Projectile_Touch_ImpactFilter_Callback() -{ +{SELFPARAM(); if(SUB_OwnerCheck()) return true; if(SUB_NoImpactCheck()) @@ -1697,7 +1697,7 @@ vector shotorg_adjust_values(vector vecs, float y_is_right, float visual, float } vector shotorg_adjust(vector vecs, float y_is_right, float visual) -{ +{SELFPARAM(); return shotorg_adjust_values(vecs, y_is_right, visual, self.owner.cvar_cl_gunalign); } @@ -1787,7 +1787,7 @@ vector gettaginfo_relative(entity e, float tag) .float scale2; float modeleffect_SendEntity(entity to, int sf) -{ +{SELFPARAM(); float f; WriteByte(MSG_ENTITY, ENT_CLIENT_MODELEFFECT); diff --git a/qcsrc/server/movelib.qc b/qcsrc/server/movelib.qc index 994849f557..acacba093a 100644 --- a/qcsrc/server/movelib.qc +++ b/qcsrc/server/movelib.qc @@ -8,7 +8,7 @@ self.velocity = movelib_dragvec(self.velocity,0.02,0.5); **/ vector movelib_dragvec(float drag, float exp_) -{ +{SELFPARAM(); float lspeed,ldrag; lspeed = vlen(self.velocity); @@ -40,7 +40,7 @@ float movelib_dragflt(float fspeed,float drag,float exp_) self.velocity = movelib_inertmove_byspeed(self.velocity,newvel,1000,0.1,0.9); **/ vector movelib_inertmove_byspeed(vector vel_new, float vel_max,float newmin,float oldmax) -{ +{SELFPARAM(); float influense; influense = vlen(self.velocity) * (1 / vel_max); @@ -51,12 +51,12 @@ vector movelib_inertmove_byspeed(vector vel_new, float vel_max,float newmin,floa } vector movelib_inertmove(vector new_vel,float new_bias) -{ +{SELFPARAM(); return new_vel * new_bias + self.velocity * (1-new_bias); } void movelib_move(vector force,float max_velocity,float drag,float theMass,float breakforce) -{ +{SELFPARAM(); float deltatime; float acceleration; float mspeed; @@ -164,7 +164,7 @@ void movelib_update(vector dir,float force) */ void movelib_beak_simple(float force) -{ +{SELFPARAM(); float mspeed; vector mdir; float vz; @@ -183,7 +183,7 @@ Yed need to set v_up and v_forward (generally by calling makevectors) before cal #endif void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max) -{ +{SELFPARAM(); vector a, b, c, d, e, r, push_angle, ahead, side; push_angle.y = 0; diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index e867e049a3..44f926fa5a 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -12,7 +12,7 @@ MUTATOR_HOOKABLE(MakePlayerObserver, EV_MakePlayerObserver) /** */ #define EV_PutClientInServer(i, o) \ - /** client wanting to spawn */ i(entity, self) \ + /** client wanting to spawn */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer); @@ -128,7 +128,7 @@ MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount); /** copies variables for spectating "other" to "self" */ #define EV_SpectateCopy(i, o) \ /**/ i(entity, other) \ - /**/ i(entity, self) \ + /**/ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy); @@ -167,7 +167,7 @@ MUTATOR_HOOKABLE(SetStartItems, EV_NO_ARGS); /** called every frame. customizes the waypoint for spectators */ #define EV_CustomizeWaypoint(i, o) \ - /** waypoint */ i(entity, self) \ + /** waypoint */ i(entity, __self) \ /** player; other.enemy = spectator */ i(entity, other) \ /**/ MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint); @@ -180,13 +180,13 @@ MUTATOR_HOOKABLE(FilterItem, EV_NO_ARGS); /** return error to request removal */ #define EV_TurretSpawn(i, o) \ - /** turret */ i(entity, self) \ + /** turret */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn); /** return error to not attack */ #define EV_TurretFire(i, o) \ - /** turret */ i(entity, self) \ + /** turret */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(TurretFire, EV_TurretFire); @@ -224,7 +224,7 @@ MUTATOR_HOOKABLE(GetCvars, EV_NO_ARGS); // NOTE: Can't use EV_GetCvars because o /** can edit any "just fired" projectile */ #define EV_EditProjectile(i, o) \ - /**/ i(entity, self) \ + /**/ i(entity, __self) \ /**/ i(entity, other) \ /**/ MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile); @@ -338,7 +338,7 @@ MUTATOR_HOOKABLE(PlayerDamaged, EV_PlayerDamaged); /** called at the end of player_powerups() in cl_client.qc, used for manipulating the values which are set by powerup items. */ #define EV_PlayerPowerups(i, o) \ - /**/ i(entity, self) \ + /**/ i(entity, __self) \ /**/ i(int, olditems) \ /**/ int olditems; @@ -416,7 +416,7 @@ MUTATOR_HOOKABLE(SV_ParseServerCommand, EV_SV_ParseServerCommand); * return 1 to make the spawnpoint unusable */ #define EV_Spawn_Score(i, o) \ - /** player wanting to spawn */ i(entity, self) \ + /** player wanting to spawn */ i(entity, __self) \ /** spot to be evaluated */ i(entity, spawn_spot) \ /** _x is priority, _y is "distance" */ i(vector, spawn_score) \ /**/ o(vector, spawn_score) \ @@ -438,12 +438,12 @@ MUTATOR_HOOKABLE(SetModname, EV_SetModname); * return 1 to remove an item */ #define EV_Item_Spawn(i, o) \ - /** the item */ i(entity, self) \ + /** the item */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn); #define EV_SetWeaponreplace(i, o) \ - /** map entity */ i(entity, self) \ + /** map entity */ i(entity, __self) \ /** weapon info */ i(entity, other) \ /**/ i(string, ret_string) \ /**/ o(string, ret_string) \ @@ -473,7 +473,7 @@ MUTATOR_HOOKABLE(BotShouldAttack, EV_BotShouldAttack); * allows you to strip a player of an item if they go through the teleporter to help prevent cheating */ #define EV_PortalTeleport(i, o) \ - /**/ i(entity, self) \ + /**/ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport); @@ -484,7 +484,7 @@ MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport); * in a special manner using this hook */ #define EV_HelpMePing(i, o) \ - /** the player who pressed impulse 33 */ i(entity, self) \ + /** the player who pressed impulse 33 */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing); @@ -511,7 +511,7 @@ MUTATOR_HOOKABLE(VehicleEnter, EV_VehicleEnter); * return true to stop player from entering the vehicle */ #define EV_VehicleTouch(i, o) \ - /** vehicle */ i(entity, self) \ + /** vehicle */ i(entity, __self) \ /** player */ i(entity, other) \ /**/ MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch); @@ -528,13 +528,13 @@ MUTATOR_HOOKABLE(VehicleExit, EV_VehicleExit); /** called when a speedrun is aborted and the player is teleported back to start position */ #define EV_AbortSpeedrun(i, o) \ - /** player */ i(entity, self) \ + /** player */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun); /** called at when a item is touched. Called early, can edit item properties. */ #define EV_ItemTouch(i, o) \ - /** item */ i(entity, self) \ + /** item */ i(entity, __self) \ /** player */ i(entity, other) \ /**/ MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch); @@ -547,12 +547,12 @@ enum { /** called at when a player connect */ #define EV_ClientConnect(i, o) \ - /** player */ i(entity, self) \ + /** player */ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect); #define EV_HavocBot_ChooseRole(i, o) \ - /**/ i(entity, self) \ + /**/ i(entity, __self) \ /**/ MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole); @@ -581,7 +581,7 @@ MUTATOR_HOOKABLE(GetModelParams, EV_GetModelParams); /** called when a bullet has hit a target */ #define EV_FireBullet_Hit(i, o) \ - /**/ i(entity, self) \ + /**/ i(entity, __self) \ /**/ i(entity, bullet_hit) \ /**/ i(vector, bullet_startpos) \ /**/ i(vector, bullet_endpos) \ @@ -608,7 +608,7 @@ MUTATOR_HOOKABLE(FixPlayermodel, EV_FixPlayermodel); MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS); #define EV_GrappleHookThink(i, o) \ - /**/ i(entity, self) \ + /**/ i(entity, __self) \ /**/ i(int, hook_tarzan) \ /**/ o(int, hook_tarzan) \ /**/ i(entity, hook_pullentity) \ @@ -622,7 +622,7 @@ float hook_velmultiplier; MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink); #define EV_BuffModel_Customize(i, o) \ - /**/ i(entity, self) \ + /**/ i(entity, __self) \ /**/ i(entity, buff_player) \ /**/ entity buff_player; @@ -630,7 +630,7 @@ MUTATOR_HOOKABLE(BuffModel_Customize, EV_BuffModel_Customize); /** called at when a buff is touched. Called early, can edit buff properties. */ #define EV_BuffTouch(i, o) \ - /** item */ i(entity, self) \ + /** item */ i(entity, __self) \ /** player */ i(entity, other) \ /**/ MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch); diff --git a/qcsrc/server/mutators/gamemode_assault.qc b/qcsrc/server/mutators/gamemode_assault.qc index 7e13b334d3..8915b89bc2 100644 --- a/qcsrc/server/mutators/gamemode_assault.qc +++ b/qcsrc/server/mutators/gamemode_assault.qc @@ -7,7 +7,7 @@ // random functions void assault_objective_use() -{ +{SELFPARAM(); // activate objective self.health = 100; //print("^2Activated objective ", self.targetname, "=", etos(self), "\n"); @@ -26,7 +26,7 @@ void assault_objective_use() } vector target_objective_spawn_evalfunc(entity player, entity spot, vector current) -{ +{SELFPARAM(); if(self.health < 0 || self.health >= ASSAULT_VALUE_INACTIVE) return '-1 0 0'; return current; @@ -35,13 +35,13 @@ vector target_objective_spawn_evalfunc(entity player, entity spot, vector curren // reset this objective. Used when spawning an objective // and when a new round starts void assault_objective_reset() -{ +{SELFPARAM(); self.health = ASSAULT_VALUE_INACTIVE; } // decrease the health of targeted objectives void assault_objective_decrease_use() -{ +{SELFPARAM(); if(activator.team != assault_attacker_team) { // wrong team triggered decrease @@ -88,7 +88,7 @@ void assault_objective_decrease_use() } void assault_setenemytoobjective() -{ +{SELFPARAM(); entity objective; for(objective = world; (objective = find(objective, targetname, self.target)); ) { @@ -107,7 +107,7 @@ void assault_setenemytoobjective() } float assault_decreaser_sprite_visible(entity e) -{ +{SELFPARAM(); entity decreaser; decreaser = self.assault_decreaser; @@ -119,7 +119,7 @@ float assault_decreaser_sprite_visible(entity e) } void target_objective_decrease_activate() -{ +{SELFPARAM(); entity ent, spr; self.owner = world; for(ent = world; (ent = find(ent, target, self.targetname)); ) @@ -154,19 +154,19 @@ void target_objective_decrease_findtarget() } void target_assault_roundend_reset() -{ +{SELFPARAM(); //print("round end reset\n"); self.cnt = self.cnt + 1; // up round counter self.winning = 0; // up round } void target_assault_roundend_use() -{ +{SELFPARAM(); self.winning = 1; // round has been won by attackers } void assault_roundstart_use() -{ +{SELFPARAM(); activator = self; SUB_UseTargets(); @@ -193,7 +193,7 @@ void assault_roundstart_use() } void assault_wall_think() -{ +{SELFPARAM(); if(self.enemy.health < 0) { self.model = ""; @@ -213,7 +213,7 @@ void assault_wall_think() void vehicles_clearreturn(entity veh); void vehicles_spawn(); void assault_new_round() -{ +{SELFPARAM(); entity oldself; //bprint("ASSAULT: new round\n"); @@ -263,7 +263,7 @@ void assault_new_round() // spawnfuncs void spawnfunc_info_player_attacker() -{ +{SELFPARAM(); if (!g_assault) { remove(self); return; } self.team = NUM_TEAM_1; // red, gets swapped every round @@ -271,7 +271,7 @@ void spawnfunc_info_player_attacker() } void spawnfunc_info_player_defender() -{ +{SELFPARAM(); if (!g_assault) { remove(self); return; } self.team = NUM_TEAM_2; // blue, gets swapped every round @@ -279,7 +279,7 @@ void spawnfunc_info_player_defender() } void spawnfunc_target_objective() -{ +{SELFPARAM(); if (!g_assault) { remove(self); return; } self.classname = "target_objective"; @@ -290,7 +290,7 @@ void spawnfunc_target_objective() } void spawnfunc_target_objective_decrease() -{ +{SELFPARAM(); if (!g_assault) { remove(self); return; } self.classname = "target_objective_decrease"; @@ -308,7 +308,7 @@ void spawnfunc_target_objective_decrease() // destructible walls that can be used to trigger target_objective_decrease void spawnfunc_func_assault_destructible() -{ +{SELFPARAM(); if (!g_assault) { remove(self); return; } self.spawnflags = 3; @@ -323,7 +323,7 @@ void spawnfunc_func_assault_destructible() } void spawnfunc_func_assault_wall() -{ +{SELFPARAM(); if (!g_assault) { remove(self); return; } self.classname = "func_assault_wall"; @@ -336,7 +336,7 @@ void spawnfunc_func_assault_wall() } void spawnfunc_target_assault_roundend() -{ +{SELFPARAM(); if (!g_assault) { remove(self); return; } self.winning = 0; // round not yet won by attackers @@ -347,7 +347,7 @@ void spawnfunc_target_assault_roundend() } void spawnfunc_target_assault_roundstart() -{ +{SELFPARAM(); if (!g_assault) { remove(self); return; } assault_attacker_team = NUM_TEAM_1; @@ -359,7 +359,7 @@ void spawnfunc_target_assault_roundstart() // legacy bot code void havocbot_goalrating_ast_targets(float ratingscale) -{ +{SELFPARAM(); entity ad, best, wp, tod; float radius, found, bestvalue; vector p; @@ -445,7 +445,7 @@ void havocbot_goalrating_ast_targets(float ratingscale) } void havocbot_role_ast_offense() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) { self.havocbot_attack_time = 0; @@ -479,7 +479,7 @@ void havocbot_role_ast_offense() } void havocbot_role_ast_defense() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) { self.havocbot_attack_time = 0; @@ -530,7 +530,7 @@ void havocbot_role_ast_setrole(entity bot, float role) } void havocbot_ast_reset_role(entity bot) -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) return; @@ -542,7 +542,7 @@ void havocbot_ast_reset_role(entity bot) // mutator hooks MUTATOR_HOOKFUNCTION(assault_PlayerSpawn) -{ +{SELFPARAM(); if(self.team == assault_attacker_team) Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_ATTACKING); else @@ -552,7 +552,7 @@ MUTATOR_HOOKFUNCTION(assault_PlayerSpawn) } MUTATOR_HOOKFUNCTION(assault_TurretSpawn) -{ +{SELFPARAM(); if(!self.team || self.team == MAX_SHOT_DISTANCE) self.team = 5; // this gets reversed when match starts? @@ -560,14 +560,14 @@ MUTATOR_HOOKFUNCTION(assault_TurretSpawn) } MUTATOR_HOOKFUNCTION(assault_VehicleSpawn) -{ +{SELFPARAM(); self.nextthink = time + 0.5; return false; } MUTATOR_HOOKFUNCTION(assault_BotRoles) -{ +{SELFPARAM(); havocbot_ast_reset_role(self); return true; } diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc index f4c4f6826d..204c4f8ca0 100644 --- a/qcsrc/server/mutators/gamemode_ca.qc +++ b/qcsrc/server/mutators/gamemode_ca.qc @@ -163,7 +163,7 @@ float ca_isEliminated(entity e) } MUTATOR_HOOKFUNCTION(ca_PlayerSpawn) -{ +{SELFPARAM(); self.caplayer = 1; if(!warmup_stage) eliminatedPlayers.SendFlags |= 1; @@ -171,7 +171,7 @@ MUTATOR_HOOKFUNCTION(ca_PlayerSpawn) } MUTATOR_HOOKFUNCTION(ca_PutClientInServer) -{ +{SELFPARAM(); if(!allowed_to_spawn) if(IS_PLAYER(self)) // this is true even when player is trying to join { @@ -188,7 +188,7 @@ MUTATOR_HOOKFUNCTION(ca_PutClientInServer) } MUTATOR_HOOKFUNCTION(ca_reset_map_players) -{ +{SELFPARAM(); FOR_EACH_CLIENT(self) { self.killcount = 0; @@ -208,7 +208,7 @@ MUTATOR_HOOKFUNCTION(ca_reset_map_players) } MUTATOR_HOOKFUNCTION(ca_ClientConnect) -{ +{SELFPARAM(); self.classname = "observer"; return 1; } @@ -226,7 +226,7 @@ MUTATOR_HOOKFUNCTION(ca_GetTeamCount) } entity ca_LastPlayerForTeam() -{ +{SELFPARAM(); entity pl, last_pl = world; FOR_EACH_PLAYER(pl) { @@ -253,7 +253,7 @@ void ca_LastPlayerForTeam_Notify() } MUTATOR_HOOKFUNCTION(ca_PlayerDies) -{ +{SELFPARAM(); ca_LastPlayerForTeam_Notify(); if(!allowed_to_spawn) self.respawn_flags = RESPAWN_SILENT; @@ -263,7 +263,7 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDies) } MUTATOR_HOOKFUNCTION(ca_ClientDisconnect) -{ +{SELFPARAM(); if(self.caplayer == 1) ca_LastPlayerForTeam_Notify(); return 1; @@ -275,7 +275,7 @@ MUTATOR_HOOKFUNCTION(ca_ForbidPlayerScore_Clear) } MUTATOR_HOOKFUNCTION(ca_MakePlayerObserver) -{ +{SELFPARAM(); if(self.caplayer == 1) ca_LastPlayerForTeam_Notify(); if(self.killindicator_teamchange == -2) @@ -326,7 +326,7 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDamage) } MUTATOR_HOOKFUNCTION(ca_FilterItem) -{ +{SELFPARAM(); if(autocvar_g_powerups <= 0) if(self.flags & FL_POWERUP) return true; diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 0df123e3a4..55262c7ef0 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -179,7 +179,7 @@ void ctf_CaptureShield_Update(entity player, bool wanted_status) } bool ctf_CaptureShield_Customize() -{ +{SELFPARAM(); if(!other.ctf_captureshielded) { return false; } if(CTF_SAMETEAM(self, other)) { return false; } @@ -187,7 +187,7 @@ bool ctf_CaptureShield_Customize() } void ctf_CaptureShield_Touch() -{ +{SELFPARAM(); if(!other.ctf_captureshielded) { return; } if(CTF_SAMETEAM(self, other)) { return; } @@ -199,7 +199,7 @@ void ctf_CaptureShield_Touch() } void ctf_CaptureShield_Spawn(entity flag) -{ +{SELFPARAM(); entity shield = spawn(); shield.enemy = self; @@ -649,7 +649,7 @@ void ctf_CheckFlagReturn(entity flag, int returntype) } bool ctf_Stalemate_Customize() -{ +{SELFPARAM(); // make spectators see what the player would see entity e, wp_owner; e = WaypointSprite_getviewentity(other); @@ -730,7 +730,7 @@ void ctf_CheckStalemate(void) } void ctf_FlagDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(ITEM_DAMAGE_NEEDKILL(deathtype)) { if(autocvar_g_ctf_flag_return_damage_delay) @@ -754,7 +754,7 @@ void ctf_FlagDamage(entity inflictor, entity attacker, float damage, int deathty } void ctf_FlagThink() -{ +{SELFPARAM(); // declarations entity tmp_entity; @@ -903,7 +903,7 @@ void ctf_FlagThink() } void ctf_FlagTouch() -{ +{SELFPARAM(); if(gameover) { return; } if(trace_dphitcontents & (DPCONTENTS_PLAYERCLIP | DPCONTENTS_MONSTERCLIP)) { return; } @@ -1049,7 +1049,7 @@ void ctf_RespawnFlag(entity flag) } void ctf_Reset() -{ +{SELFPARAM(); if(self.owner) if(IS_PLAYER(self.owner)) ctf_Handle_Throw(self.owner, world, DROP_RESET); @@ -1058,7 +1058,7 @@ void ctf_Reset() } void ctf_DelayedFlagSetup(void) // called after a flag is placed on a map by ctf_FlagSetup() -{ +{SELFPARAM(); // bot waypoints waypoint_spawnforitem_force(self, self.origin); self.nearestwaypointtimeout = 0; // activate waypointing again @@ -1090,7 +1090,7 @@ void set_flag_string(entity flag, .string field, string value, string teamname) } void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc -{ +{SELFPARAM(); // declarations string teamname = Static_Team_ColorName_Lower(teamnumber); self = flag; // for later usage with droptofloor() @@ -1293,7 +1293,7 @@ int havocbot_ctf_teamcount(entity bot, vector org, float tc_radius) } void havocbot_goalrating_ctf_ourflag(float ratingscale) -{ +{SELFPARAM(); entity head; head = ctf_worldflaglist; while (head) @@ -1307,7 +1307,7 @@ void havocbot_goalrating_ctf_ourflag(float ratingscale) } void havocbot_goalrating_ctf_ourbase(float ratingscale) -{ +{SELFPARAM(); entity head; head = ctf_worldflaglist; while (head) @@ -1323,7 +1323,7 @@ void havocbot_goalrating_ctf_ourbase(float ratingscale) } void havocbot_goalrating_ctf_enemyflag(float ratingscale) -{ +{SELFPARAM(); entity head; head = ctf_worldflaglist; while (head) @@ -1350,7 +1350,7 @@ void havocbot_goalrating_ctf_enemyflag(float ratingscale) } void havocbot_goalrating_ctf_enemybase(float ratingscale) -{ +{SELFPARAM(); if (!bot_waypoints_for_items) { havocbot_goalrating_ctf_enemyflag(ratingscale); @@ -1368,7 +1368,7 @@ void havocbot_goalrating_ctf_enemybase(float ratingscale) } void havocbot_goalrating_ctf_ourstolenflag(float ratingscale) -{ +{SELFPARAM(); entity mf; mf = havocbot_ctf_find_flag(self); @@ -1404,7 +1404,7 @@ void havocbot_goalrating_ctf_droppedflags(float ratingscale, vector org, float d } void havocbot_goalrating_ctf_carrieritems(float ratingscale, vector org, float sradius) -{ +{SELFPARAM(); entity head; float t; head = findchainfloat(bot_pickup, true); @@ -1491,7 +1491,7 @@ void havocbot_ctf_reset_role(entity bot) } void havocbot_role_ctf_carrier() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) { havocbot_ctf_reset_role(self); @@ -1532,7 +1532,7 @@ void havocbot_role_ctf_carrier() } void havocbot_role_ctf_escort() -{ +{SELFPARAM(); entity mf, ef; if(self.deadflag != DEAD_NO) @@ -1592,7 +1592,7 @@ void havocbot_role_ctf_escort() } void havocbot_role_ctf_offense() -{ +{SELFPARAM(); entity mf, ef; vector pos; @@ -1674,7 +1674,7 @@ void havocbot_role_ctf_offense() // Retriever (temporary role): void havocbot_role_ctf_retriever() -{ +{SELFPARAM(); entity mf; if(self.deadflag != DEAD_NO) @@ -1722,7 +1722,7 @@ void havocbot_role_ctf_retriever() } void havocbot_role_ctf_middle() -{ +{SELFPARAM(); entity mf; if(self.deadflag != DEAD_NO) @@ -1773,7 +1773,7 @@ void havocbot_role_ctf_middle() } void havocbot_role_ctf_defense() -{ +{SELFPARAM(); entity mf; if(self.deadflag != DEAD_NO) @@ -1897,7 +1897,7 @@ void havocbot_role_ctf_setrole(entity bot, int role) // ============== MUTATOR_HOOKFUNCTION(ctf_PlayerPreThink) -{ +{SELFPARAM(); entity flag; int t = 0, t2 = 0, t3 = 0; @@ -2001,7 +2001,7 @@ MUTATOR_HOOKFUNCTION(ctf_GiveFragsForKill) } MUTATOR_HOOKFUNCTION(ctf_RemovePlayer) -{ +{SELFPARAM(); entity flag; // temporary entity for the search method if(self.flagcarried) @@ -2018,7 +2018,7 @@ MUTATOR_HOOKFUNCTION(ctf_RemovePlayer) } MUTATOR_HOOKFUNCTION(ctf_PortalTeleport) -{ +{SELFPARAM(); if(self.flagcarried) if(!autocvar_g_ctf_portalteleport) { ctf_Handle_Throw(self, world, DROP_NORMAL); } @@ -2027,7 +2027,7 @@ MUTATOR_HOOKFUNCTION(ctf_PortalTeleport) } MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey) -{ +{SELFPARAM(); if(MUTATOR_RETURNVALUE || gameover) { return false; } entity player = self; @@ -2120,7 +2120,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey) } MUTATOR_HOOKFUNCTION(ctf_HelpMePing) -{ +{SELFPARAM(); if(self.wps_flagcarrier) // update the flagcarrier waypointsprite with "NEEDING HELP" notification { self.wps_helpme_time = time; @@ -2174,7 +2174,7 @@ MUTATOR_HOOKFUNCTION(ctf_VehicleExit) } MUTATOR_HOOKFUNCTION(ctf_AbortSpeedrun) -{ +{SELFPARAM(); if(self.flagcarried) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((self.flagcarried.team) ? APP_TEAM_ENT_4(self.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN_) : INFO_CTF_FLAGRETURN_ABORTRUN_NEUTRAL)); @@ -2220,7 +2220,7 @@ MUTATOR_HOOKFUNCTION(ctf_MatchEnd) } MUTATOR_HOOKFUNCTION(ctf_BotRoles) -{ +{SELFPARAM(); havocbot_ctf_reset_role(self); return true; } @@ -2233,7 +2233,7 @@ MUTATOR_HOOKFUNCTION(ctf_GetTeamCount) } MUTATOR_HOOKFUNCTION(ctf_SpectateCopy) -{ +{SELFPARAM(); self.ctf_flagstatus = other.ctf_flagstatus; return false; } @@ -2255,7 +2255,7 @@ Keys: "noise4" sound played when flag is dropped by a player... "noise5" sound played when flag touches the ground... */ void spawnfunc_item_flag_team1() -{ +{SELFPARAM(); if(!g_ctf) { remove(self); return; } ctf_FlagSetup(NUM_TEAM_1, self); @@ -2273,7 +2273,7 @@ Keys: "noise4" sound played when flag is dropped by a player... "noise5" sound played when flag touches the ground... */ void spawnfunc_item_flag_team2() -{ +{SELFPARAM(); if(!g_ctf) { remove(self); return; } ctf_FlagSetup(NUM_TEAM_2, self); @@ -2291,7 +2291,7 @@ Keys: "noise4" sound played when flag is dropped by a player... "noise5" sound played when flag touches the ground... */ void spawnfunc_item_flag_team3() -{ +{SELFPARAM(); if(!g_ctf) { remove(self); return; } ctf_FlagSetup(NUM_TEAM_3, self); @@ -2309,7 +2309,7 @@ Keys: "noise4" sound played when flag is dropped by a player... "noise5" sound played when flag touches the ground... */ void spawnfunc_item_flag_team4() -{ +{SELFPARAM(); if(!g_ctf) { remove(self); return; } ctf_FlagSetup(NUM_TEAM_4, self); @@ -2327,7 +2327,7 @@ Keys: "noise4" sound played when flag is dropped by a player... "noise5" sound played when flag touches the ground... */ void spawnfunc_item_flag_neutral() -{ +{SELFPARAM(); if(!g_ctf) { remove(self); return; } if(!cvar("g_ctf_oneflag")) { remove(self); return; } @@ -2341,7 +2341,7 @@ Keys: "netname" Name of the team (for example Red, Blue, Green, Yellow, Life, Death, Offense, Defense, etc)... "cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */ void spawnfunc_ctf_team() -{ +{SELFPARAM(); if(!g_ctf) { remove(self); return; } self.classname = "ctf_team"; @@ -2381,7 +2381,7 @@ void ctf_ScoreRules(int teams) // code from here on is just to support maps that don't have flag and team entities void ctf_SpawnTeam (string teamname, int teamcolor) -{ +{SELFPARAM(); entity oldself; oldself = self; self = spawn(); diff --git a/qcsrc/server/mutators/gamemode_cts.qc b/qcsrc/server/mutators/gamemode_cts.qc index 04c589ce18..f9b478232a 100644 --- a/qcsrc/server/mutators/gamemode_cts.qc +++ b/qcsrc/server/mutators/gamemode_cts.qc @@ -8,7 +8,7 @@ // legacy bot roles .float race_checkpoint; void havocbot_role_cts() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) return; @@ -57,7 +57,7 @@ void cts_EventLog(string mode, entity actor) // use an alias for easy changing a } MUTATOR_HOOKFUNCTION(cts_PlayerPhysics) -{ +{SELFPARAM(); // force kbd movement for fairness float wishspeed; vector wishvel; @@ -142,7 +142,7 @@ MUTATOR_HOOKFUNCTION(cts_ResetMap) } MUTATOR_HOOKFUNCTION(cts_PlayerPreThink) -{ +{SELFPARAM(); if(IS_SPEC(self) || IS_OBSERVER(self)) if(g_race_qualifying) if(msg_entity.enemy.race_laptime) @@ -152,7 +152,7 @@ MUTATOR_HOOKFUNCTION(cts_PlayerPreThink) } MUTATOR_HOOKFUNCTION(cts_ClientConnect) -{ +{SELFPARAM(); race_PreparePlayer(); self.race_checkpoint = -1; @@ -179,7 +179,7 @@ MUTATOR_HOOKFUNCTION(cts_ClientConnect) } MUTATOR_HOOKFUNCTION(cts_MakePlayerObserver) -{ +{SELFPARAM(); if(PlayerScore_Add(self, SP_RACE_FASTEST, 0)) self.frags = FRAGS_LMS_LOSER; else @@ -192,7 +192,7 @@ MUTATOR_HOOKFUNCTION(cts_MakePlayerObserver) } MUTATOR_HOOKFUNCTION(cts_PlayerSpawn) -{ +{SELFPARAM(); if(spawn_spot.target == "") // Emergency: this wasn't a real spawnpoint. Can this ever happen? race_PreparePlayer(); @@ -207,7 +207,7 @@ MUTATOR_HOOKFUNCTION(cts_PlayerSpawn) } MUTATOR_HOOKFUNCTION(cts_PutClientInServer) -{ +{SELFPARAM(); if(IS_PLAYER(self)) if(!gameover) { @@ -222,20 +222,20 @@ MUTATOR_HOOKFUNCTION(cts_PutClientInServer) } MUTATOR_HOOKFUNCTION(cts_PlayerDies) -{ +{SELFPARAM(); self.respawn_flags |= RESPAWN_FORCE; race_AbandonRaceCheck(self); return false; } MUTATOR_HOOKFUNCTION(cts_BotRoles) -{ +{SELFPARAM(); self.havocbot_role = havocbot_role_cts; return true; } MUTATOR_HOOKFUNCTION(cts_PlayerPostThink) -{ +{SELFPARAM(); if(self.cvar_cl_allow_uidtracking == 1 && self.cvar_cl_allow_uid2name == 1) { if (!self.stored_netname) @@ -258,7 +258,7 @@ MUTATOR_HOOKFUNCTION(cts_ForbidThrowing) } MUTATOR_HOOKFUNCTION(cts_FilterItem) -{ +{SELFPARAM(); if(self.classname == "droppedweapon") return true; diff --git a/qcsrc/server/mutators/gamemode_domination.qc b/qcsrc/server/mutators/gamemode_domination.qc index 7b392a0663..aa49e8388d 100644 --- a/qcsrc/server/mutators/gamemode_domination.qc +++ b/qcsrc/server/mutators/gamemode_domination.qc @@ -21,7 +21,7 @@ void set_dom_state(entity e) } void dompoint_captured () -{ +{SELFPARAM(); entity head; float old_delay, old_team, real_team; @@ -129,7 +129,7 @@ void dompoint_captured () } void AnimateDomPoint() -{ +{SELFPARAM(); if(self.pain_finished > time) return; self.pain_finished = time + self.t_width; @@ -142,7 +142,7 @@ void AnimateDomPoint() } void dompointthink() -{ +{SELFPARAM(); float fragamt; self.nextthink = time + 0.1; @@ -186,7 +186,7 @@ void dompointthink() } void dompointtouch() -{ +{SELFPARAM(); entity head; if (!IS_PLAYER(other)) return; @@ -241,7 +241,7 @@ void dompointtouch() } void dom_controlpoint_setup() -{ +{SELFPARAM(); entity head; // find the spawnfunc_dom_team representing unclaimed points head = find(world, classname, "dom_team"); @@ -385,7 +385,7 @@ void Domination_RoundStart() //go to best items, or control points you don't own void havocbot_role_dom() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) return; @@ -408,7 +408,7 @@ MUTATOR_HOOKFUNCTION(dom_GetTeamCount) } MUTATOR_HOOKFUNCTION(dom_ResetMap) -{ +{SELFPARAM(); total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0; FOR_EACH_PLAYER(self) { @@ -421,7 +421,7 @@ MUTATOR_HOOKFUNCTION(dom_ResetMap) } MUTATOR_HOOKFUNCTION(dom_PlayerSpawn) -{ +{SELFPARAM(); if(domination_roundbased) if(!round_handler_IsRoundStarted()) self.player_blocked = 1; @@ -431,13 +431,13 @@ MUTATOR_HOOKFUNCTION(dom_PlayerSpawn) } MUTATOR_HOOKFUNCTION(dom_ClientConnect) -{ +{SELFPARAM(); set_dom_state(self); return false; } MUTATOR_HOOKFUNCTION(dom_BotRoles) -{ +{SELFPARAM(); self.havocbot_role = havocbot_role_dom; return true; } @@ -446,7 +446,7 @@ MUTATOR_HOOKFUNCTION(dom_BotRoles) Control point for Domination gameplay. */ void spawnfunc_dom_controlpoint() -{ +{SELFPARAM(); if(!g_domination) { remove(self); @@ -491,7 +491,7 @@ Keys: */ void spawnfunc_dom_team() -{ +{SELFPARAM(); if(!g_domination || autocvar_g_domination_teams_override >= 2) { remove(self); @@ -541,7 +541,7 @@ void ScoreRules_dom(float teams) // code from here on is just to support maps that don't have control point and team entities void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float pointskin, string capsound, string capnarration, string capmessage) -{ +{SELFPARAM(); entity oldself; oldself = self; self = spawn(); @@ -568,7 +568,7 @@ void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float p } void dom_spawnpoint(vector org) -{ +{SELFPARAM(); entity oldself; oldself = self; self = spawn(); diff --git a/qcsrc/server/mutators/gamemode_freezetag.qc b/qcsrc/server/mutators/gamemode_freezetag.qc index 1fa168d63f..27c5e9cc0c 100644 --- a/qcsrc/server/mutators/gamemode_freezetag.qc +++ b/qcsrc/server/mutators/gamemode_freezetag.qc @@ -134,7 +134,7 @@ float freezetag_CheckWinner() } entity freezetag_LastPlayerForTeam() -{ +{SELFPARAM(); entity pl, last_pl = world; FOR_EACH_PLAYER(pl) { @@ -162,7 +162,7 @@ void freezetag_LastPlayerForTeam_Notify() } void freezetag_Add_Score(entity attacker) -{ +{SELFPARAM(); if(attacker == self) { // you froze your own dumb self @@ -180,7 +180,7 @@ void freezetag_Add_Score(entity attacker) } void freezetag_Freeze(entity attacker) -{ +{SELFPARAM(); if(self.frozen) return; @@ -195,7 +195,7 @@ void freezetag_Freeze(entity attacker) } void freezetag_Unfreeze(entity attacker) -{ +{SELFPARAM(); self.freezetag_frozen_time = 0; self.freezetag_frozen_timeout = 0; @@ -218,7 +218,7 @@ void() havocbot_role_ft_freeing; void() havocbot_role_ft_offense; void havocbot_goalrating_freeplayers(float ratingscale, vector org, float sradius) -{ +{SELFPARAM(); entity head; float distance; @@ -244,7 +244,7 @@ void havocbot_goalrating_freeplayers(float ratingscale, vector org, float sradiu } void havocbot_role_ft_offense() -{ +{SELFPARAM(); entity head; float unfrozen; @@ -285,7 +285,7 @@ void havocbot_role_ft_offense() } void havocbot_role_ft_freeing() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) return; @@ -319,7 +319,7 @@ void havocbot_role_ft_freeing() // ============== MUTATOR_HOOKFUNCTION(freezetag_RemovePlayer) -{ +{SELFPARAM(); self.health = 0; // neccessary to update correctly alive stats if(!self.frozen) freezetag_LastPlayerForTeam_Notify(); @@ -329,7 +329,7 @@ MUTATOR_HOOKFUNCTION(freezetag_RemovePlayer) } MUTATOR_HOOKFUNCTION(freezetag_PlayerDies) -{ +{SELFPARAM(); if(round_handler_IsActive()) if(round_handler_CountdownRunning()) { @@ -383,7 +383,7 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerDies) } MUTATOR_HOOKFUNCTION(freezetag_PlayerSpawn) -{ +{SELFPARAM(); if(self.freezetag_frozen_timeout == -1) // if PlayerSpawn is called by reset_map_players return 1; // do nothing, round is starting right now @@ -406,7 +406,7 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerSpawn) } MUTATOR_HOOKFUNCTION(freezetag_reset_map_players) -{ +{SELFPARAM(); FOR_EACH_PLAYER(self) { self.killcount = 0; @@ -425,7 +425,7 @@ MUTATOR_HOOKFUNCTION(freezetag_GiveFragsForKill) } MUTATOR_HOOKFUNCTION(freezetag_PlayerPreThink) -{ +{SELFPARAM(); float n; if(gameover) @@ -540,7 +540,7 @@ MUTATOR_HOOKFUNCTION(freezetag_SetStartItems) } MUTATOR_HOOKFUNCTION(freezetag_BotRoles) -{ +{SELFPARAM(); if (!self.deadflag) { if (random() < 0.5) diff --git a/qcsrc/server/mutators/gamemode_invasion.qc b/qcsrc/server/mutators/gamemode_invasion.qc index c4750d9822..412e7bd540 100644 --- a/qcsrc/server/mutators/gamemode_invasion.qc +++ b/qcsrc/server/mutators/gamemode_invasion.qc @@ -7,7 +7,7 @@ #include "../../common/monsters/sv_monsters.qh" void spawnfunc_invasion_spawnpoint() -{ +{SELFPARAM(); if(!g_invasion) { remove(self); return; } self.classname = "invasion_spawnpoint"; @@ -261,7 +261,7 @@ void Invasion_RoundStart() } MUTATOR_HOOKFUNCTION(invasion_MonsterDies) -{ +{SELFPARAM(); if(!(self.spawnflags & MONSTERFLAG_RESPAWNED)) { inv_numkilled += 1; @@ -283,7 +283,7 @@ MUTATOR_HOOKFUNCTION(invasion_MonsterDies) } MUTATOR_HOOKFUNCTION(invasion_MonsterSpawn) -{ +{SELFPARAM(); if(!(self.spawnflags & MONSTERFLAG_SPAWNED)) return true; @@ -304,7 +304,7 @@ MUTATOR_HOOKFUNCTION(invasion_MonsterSpawn) } MUTATOR_HOOKFUNCTION(invasion_OnEntityPreSpawn) -{ +{SELFPARAM(); if(startsWith(self.classname, "monster_")) if(!(self.spawnflags & MONSTERFLAG_SPAWNED)) return true; @@ -327,7 +327,7 @@ MUTATOR_HOOKFUNCTION(invasion_PlayerRegen) } MUTATOR_HOOKFUNCTION(invasion_PlayerSpawn) -{ +{SELFPARAM(); self.bot_attack = false; return false; } @@ -344,7 +344,7 @@ MUTATOR_HOOKFUNCTION(invasion_PlayerDamage) } MUTATOR_HOOKFUNCTION(invasion_PlayerCommand) -{ +{SELFPARAM(); if(MUTATOR_RETURNVALUE) // command was already handled? return false; diff --git a/qcsrc/server/mutators/gamemode_keepaway.qc b/qcsrc/server/mutators/gamemode_keepaway.qc index 96765796a1..3ab6342b3b 100644 --- a/qcsrc/server/mutators/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/gamemode_keepaway.qc @@ -27,7 +27,7 @@ void ka_EventLog(string mode, entity actor) // use an alias for easy changing an void ka_TouchEvent(); void ka_RespawnBall() // runs whenever the ball needs to be relocated -{ +{SELFPARAM(); if(gameover) { return; } vector oldballorigin = self.origin; @@ -57,7 +57,7 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated } void ka_TimeScoring() -{ +{SELFPARAM(); if(self.owner.ballcarried) { // add points for holding the ball after a certain amount of time if(autocvar_g_keepaway_score_timepoints) @@ -69,7 +69,7 @@ void ka_TimeScoring() } void ka_TouchEvent() // runs any time that the ball comes in contact with something -{ +{SELFPARAM(); if(gameover) { return; } if(!self) { return; } if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) @@ -167,7 +167,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los } void ka_Reset() // used to clear the ballcarrier whenever the match switches from warmup to normal -{ +{SELFPARAM(); if((self.owner) && (IS_PLAYER(self.owner))) ka_DropEvent(self.owner); @@ -187,7 +187,7 @@ void ka_Reset() // used to clear the ballcarrier whenever the match switches fro // ================ void havocbot_goalrating_ball(float ratingscale, vector org) -{ +{SELFPARAM(); float t; entity ball_owner; ball_owner = ka_ball.owner; @@ -206,7 +206,7 @@ void havocbot_goalrating_ball(float ratingscale, vector org) } void havocbot_role_ka_carrier() -{ +{SELFPARAM(); if (self.deadflag != DEAD_NO) return; @@ -229,7 +229,7 @@ void havocbot_role_ka_carrier() } void havocbot_role_ka_collector() -{ +{SELFPARAM(); if (self.deadflag != DEAD_NO) return; @@ -257,7 +257,7 @@ void havocbot_role_ka_collector() // ============== MUTATOR_HOOKFUNCTION(ka_Scoring) -{ +{SELFPARAM(); if((frag_attacker != frag_target) && (IS_PLAYER(frag_attacker))) { if(frag_target.ballcarried) { // add to amount of times killing carrier @@ -284,7 +284,7 @@ MUTATOR_HOOKFUNCTION(ka_GiveFragsForKill) } MUTATOR_HOOKFUNCTION(ka_PlayerPreThink) -{ +{SELFPARAM(); // clear the item used for the ball in keepaway self.items &= ~IT_KEY1; @@ -296,7 +296,7 @@ MUTATOR_HOOKFUNCTION(ka_PlayerPreThink) } MUTATOR_HOOKFUNCTION(ka_PlayerUseKey) -{ +{SELFPARAM(); if(MUTATOR_RETURNVALUE == 0) if(self.ballcarried) { @@ -338,13 +338,13 @@ MUTATOR_HOOKFUNCTION(ka_PlayerDamage) // for changing damage and force values th } MUTATOR_HOOKFUNCTION(ka_RemovePlayer) -{ +{SELFPARAM(); if(self.ballcarried) { ka_DropEvent(self); } // a player with the ball has left the match, drop it return 0; } MUTATOR_HOOKFUNCTION(ka_PlayerPowerups) -{ +{SELFPARAM(); // In the future this hook is supposed to allow me to do some extra stuff with waypointsprites and invisibility powerup // So bare with me until I can fix a certain bug with ka_ballcarrier_waypointsprite_visible_for_player() @@ -357,7 +357,7 @@ MUTATOR_HOOKFUNCTION(ka_PlayerPowerups) } MUTATOR_HOOKFUNCTION(ka_PlayerPhysics) -{ +{SELFPARAM(); if(self.ballcarried) { self.stat_sv_airspeedlimit_nonqw *= autocvar_g_keepaway_ballcarrier_highspeed; @@ -367,7 +367,7 @@ MUTATOR_HOOKFUNCTION(ka_PlayerPhysics) } MUTATOR_HOOKFUNCTION(ka_BotShouldAttack) -{ +{SELFPARAM(); // if neither player has ball then don't attack unless the ball is on the ground if(!checkentity.ballcarried && !self.ballcarried && ka_ball.owner) return true; @@ -375,7 +375,7 @@ MUTATOR_HOOKFUNCTION(ka_BotShouldAttack) } MUTATOR_HOOKFUNCTION(ka_BotRoles) -{ +{SELFPARAM(); if (self.ballcarried) self.havocbot_role = havocbot_role_ka_carrier; else diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index fe53c1fcc4..92125926f7 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -92,7 +92,7 @@ void kh_ScoreRules(float teams) } float kh_KeyCarrier_waypointsprite_visible_for_player(entity e) // runs all the time -{ +{SELFPARAM(); if(!IS_PLAYER(e) || self.team != e.team) if(!kh_tracking_enabled) return false; @@ -101,7 +101,7 @@ float kh_KeyCarrier_waypointsprite_visible_for_player(entity e) // runs all the } float kh_Key_waypointsprite_visible_for_player(entity e) // ?? -{ +{SELFPARAM(); if(!kh_tracking_enabled) return false; if(!self.owner) @@ -154,7 +154,7 @@ void kh_Controller_SetThink(float t, kh_Think_t func) // runs occasionaly } void kh_WaitForPlayers(); void kh_Controller_Think() // called a lot -{ +{SELFPARAM(); if(intermission_running) return; if(self.cnt > 0) @@ -411,7 +411,7 @@ void kh_Key_AssignTo(entity key, entity player) // runs every time a key is pic } void kh_Key_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(self.owner) return; if(ITEM_DAMAGE_NEEDKILL(deathtype)) @@ -444,7 +444,7 @@ void kh_Key_Collect(entity key, entity player) //a player picks up a dropped ke } void kh_Key_Touch() // runs many, many times when a key has been dropped and can be picked up -{ +{SELFPARAM(); if(intermission_running) return; @@ -671,7 +671,7 @@ void kh_LoserTeam(float teem, entity lostkey) // runs when a player pushes a fl } void kh_Key_Think() // runs all the time -{ +{SELFPARAM(); entity head; //entity player; // needed by FOR_EACH_PLAYER @@ -729,7 +729,7 @@ void kh_Key_Think() // runs all the time } void key_reset() -{ +{SELFPARAM(); kh_Key_AssignTo(self, world); kh_Key_Remove(self); } @@ -1058,13 +1058,13 @@ void kh_finalize() // register this as a mutator MUTATOR_HOOKFUNCTION(kh_Key_DropAll) -{ +{SELFPARAM(); kh_Key_DropAll(self, true); return 0; } MUTATOR_HOOKFUNCTION(kh_PlayerDies) -{ +{SELFPARAM(); if(self == other) kh_Key_DropAll(self, true); else if(IS_PLAYER(other)) @@ -1093,13 +1093,13 @@ MUTATOR_HOOKFUNCTION(kh_GetTeamCount) } MUTATOR_HOOKFUNCTION(kh_SpectateCopy) -{ +{SELFPARAM(); self.kh_state = other.kh_state; return 0; } MUTATOR_HOOKFUNCTION(kh_PlayerUseKey) -{ +{SELFPARAM(); if(MUTATOR_RETURNVALUE == 0) { entity k; diff --git a/qcsrc/server/mutators/gamemode_lms.qc b/qcsrc/server/mutators/gamemode_lms.qc index a5707182e4..0db687f801 100644 --- a/qcsrc/server/mutators/gamemode_lms.qc +++ b/qcsrc/server/mutators/gamemode_lms.qc @@ -35,7 +35,7 @@ MUTATOR_HOOKFUNCTION(lms_ResetMap) } MUTATOR_HOOKFUNCTION(lms_ResetPlayers) -{ +{SELFPARAM(); if(restart_mapalreadyrestarted || (time < game_starttime)) FOR_EACH_CLIENT(self) if(IS_PLAYER(self)) @@ -45,7 +45,7 @@ MUTATOR_HOOKFUNCTION(lms_ResetPlayers) } MUTATOR_HOOKFUNCTION(lms_PlayerPreSpawn) -{ +{SELFPARAM(); // player is dead and becomes observer // FIXME fix LMS scoring for new system if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0) @@ -55,14 +55,14 @@ MUTATOR_HOOKFUNCTION(lms_PlayerPreSpawn) } MUTATOR_HOOKFUNCTION(lms_PlayerDies) -{ +{SELFPARAM(); self.respawn_flags |= RESPAWN_FORCE; return false; } MUTATOR_HOOKFUNCTION(lms_RemovePlayer) -{ +{SELFPARAM(); // Only if the player cannot play at all if(PlayerScore_Add(self, SP_LMS_RANK, 0) == 666) self.frags = FRAGS_SPECTATOR; @@ -79,7 +79,7 @@ MUTATOR_HOOKFUNCTION(lms_RemovePlayer) } MUTATOR_HOOKFUNCTION(lms_ClientConnect) -{ +{SELFPARAM(); self.classname = "player"; campaign_bots_may_start = 1; @@ -93,7 +93,7 @@ MUTATOR_HOOKFUNCTION(lms_ClientConnect) } MUTATOR_HOOKFUNCTION(lms_PlayerThink) -{ +{SELFPARAM(); if(self.deadflag == DEAD_DYING) self.deadflag = DEAD_RESPAWNING; @@ -156,7 +156,7 @@ MUTATOR_HOOKFUNCTION(lms_KeepScore) } MUTATOR_HOOKFUNCTION(lms_FilterItem) -{ +{SELFPARAM(); if(autocvar_g_lms_extra_lives) if(self.itemdef == ITEM_HealthMega) { @@ -168,7 +168,7 @@ MUTATOR_HOOKFUNCTION(lms_FilterItem) } MUTATOR_HOOKFUNCTION(lms_ItemTouch) -{ +{SELFPARAM(); // give extra lives for mega health if (self.items & ITEM_HealthMega.m_itemid) { diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index 6b8d5a07d7..2194922abb 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -51,14 +51,14 @@ void LogNB(string mode, entity actor) } void ball_restart(void) -{ +{SELFPARAM(); if(self.owner) DropBall(self, self.owner.origin, '0 0 0'); ResetBall(); } void nexball_setstatus(void) -{ +{SELFPARAM(); entity oldself; self.items &= ~IT_KEY1; if(self.ballcarried) @@ -78,7 +78,7 @@ void nexball_setstatus(void) } void relocate_nexball(void) -{ +{SELFPARAM(); tracebox(self.origin, BALL_MINS, BALL_MAXS, self.origin, true, self); if(trace_startsolid) { @@ -95,7 +95,7 @@ void relocate_nexball(void) } void DropOwner(void) -{ +{SELFPARAM(); entity ownr; ownr = self.owner; DropBall(self, ownr.origin, ownr.velocity); @@ -105,7 +105,7 @@ void DropOwner(void) } void GiveBall(entity plyr, entity ball) -{ +{SELFPARAM(); entity ownr; if((ownr = ball.owner)) @@ -196,7 +196,7 @@ void DropBall(entity ball, vector org, vector vel) } void InitBall(void) -{ +{SELFPARAM(); if(gameover) return; self.flags &= ~FL_ONGROUND; self.movetype = MOVETYPE_BOUNCE; @@ -216,7 +216,7 @@ void InitBall(void) } void ResetBall(void) -{ +{SELFPARAM(); if(self.cnt < 2) // step 1 { if(time == self.teamtime) @@ -252,7 +252,7 @@ void ResetBall(void) } void football_touch(void) -{ +{SELFPARAM(); if(other.solid == SOLID_BSP) { if(time > self.lastground + 0.1) @@ -298,7 +298,7 @@ void football_touch(void) } void basketball_touch(void) -{ +{SELFPARAM(); if(other.ballcarried) { football_touch(); @@ -320,7 +320,7 @@ void basketball_touch(void) } void GoalTouch(void) -{ +{SELFPARAM(); entity ball; float isclient, pscore, otherteam; string pname; @@ -412,7 +412,7 @@ void GoalTouch(void) // team ents // //=======================// void spawnfunc_nexball_team(void) -{ +{SELFPARAM(); if(!g_nexball) { remove(self); @@ -486,7 +486,7 @@ void nb_delayedinit(void) //=======================// void SpawnBall(void) -{ +{SELFPARAM(); if(!g_nexball) { remove(self); return; } // balls += 4; // using the remaining bits to count balls will leave more than the max edict count, so it's fine @@ -538,7 +538,7 @@ void SpawnBall(void) } void spawnfunc_nexball_basketball(void) -{ +{SELFPARAM(); nexball_mode |= NBM_BASKETBALL; self.classname = "nexball_basketball"; if (!(balls & BALL_BASKET)) @@ -561,7 +561,7 @@ void spawnfunc_nexball_basketball(void) } void spawnfunc_nexball_football(void) -{ +{SELFPARAM(); nexball_mode |= NBM_FOOTBALL; self.classname = "nexball_football"; self.solid = SOLID_TRIGGER; @@ -572,7 +572,7 @@ void spawnfunc_nexball_football(void) } float nb_Goal_Customize() -{ +{SELFPARAM(); entity e, wp_owner; e = WaypointSprite_getviewentity(other); wp_owner = self.owner; @@ -582,7 +582,7 @@ float nb_Goal_Customize() } void SpawnGoal(void) -{ +{SELFPARAM(); if(!g_nexball) { remove(self); return; } EXACTTRIGGER_INIT; @@ -602,28 +602,28 @@ void SpawnGoal(void) } void spawnfunc_nexball_redgoal(void) -{ +{SELFPARAM(); self.team = NUM_TEAM_1; SpawnGoal(); } void spawnfunc_nexball_bluegoal(void) -{ +{SELFPARAM(); self.team = NUM_TEAM_2; SpawnGoal(); } void spawnfunc_nexball_yellowgoal(void) -{ +{SELFPARAM(); self.team = NUM_TEAM_3; SpawnGoal(); } void spawnfunc_nexball_pinkgoal(void) -{ +{SELFPARAM(); self.team = NUM_TEAM_4; SpawnGoal(); } void spawnfunc_nexball_fault(void) -{ +{SELFPARAM(); self.team = GOAL_FAULT; if(self.noise == "") self.noise = "misc/typehit.wav"; @@ -631,7 +631,7 @@ void spawnfunc_nexball_fault(void) } void spawnfunc_nexball_out(void) -{ +{SELFPARAM(); self.team = GOAL_OUT; if(self.noise == "") self.noise = "misc/typehit.wav"; @@ -678,7 +678,7 @@ void spawnfunc_ball_bound(void) void W_Nexball_Think() -{ +{SELFPARAM(); //dprint("W_Nexball_Think\n"); //vector new_dir = steerlib_arrive(self.enemy.origin, 2500); vector new_dir = normalize(self.enemy.origin + '0 0 50' - self.origin); @@ -693,7 +693,7 @@ void W_Nexball_Think() } void W_Nexball_Touch(void) -{ +{SELFPARAM(); entity ball, attacker; attacker = self.owner; //self.think = func_null; @@ -724,7 +724,7 @@ void W_Nexball_Touch(void) } void W_Nexball_Attack(float t) -{ +{SELFPARAM(); entity ball; float mul, mi, ma; if(!(ball = self.ballcarried)) @@ -760,7 +760,7 @@ void W_Nexball_Attack(float t) } void W_Nexball_Attack2(void) -{ +{SELFPARAM(); if(self.ballcarried.enemy) { entity _ball = self.ballcarried; @@ -803,7 +803,7 @@ void W_Nexball_Attack2(void) } float ball_customize() -{ +{SELFPARAM(); if(!self.owner) { self.effects &= ~EF_FLAME; @@ -830,7 +830,7 @@ float ball_customize() } float w_nexball_weapon(float req) -{ +{SELFPARAM(); if(req == WR_THINK) { if(self.BUTTON_ATCK) @@ -880,7 +880,7 @@ float w_nexball_weapon(float req) } MUTATOR_HOOKFUNCTION(nexball_BallDrop) -{ +{SELFPARAM(); if(self.ballcarried && g_nexball) DropBall(self.ballcarried, self.origin, self.velocity); @@ -888,7 +888,7 @@ MUTATOR_HOOKFUNCTION(nexball_BallDrop) } MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink) -{ +{SELFPARAM(); makevectors(self.v_angle); if(nexball_mode & NBM_BASKETBALL) { @@ -952,7 +952,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink) } MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn) -{ +{SELFPARAM(); self.weaponentity.weapons = '0 0 0'; if(nexball_mode & NBM_BASKETBALL) @@ -964,7 +964,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn) } MUTATOR_HOOKFUNCTION(nexball_PlayerPhysics) -{ +{SELFPARAM(); if(self.ballcarried) { self.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed; @@ -981,7 +981,7 @@ MUTATOR_HOOKFUNCTION(nexball_SetStartItems) } MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing) -{ +{SELFPARAM(); if(self.weapon == WEP_MORTAR.m_id) return true; @@ -989,7 +989,7 @@ MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing) } MUTATOR_HOOKFUNCTION(nexball_FilterItem) -{ +{SELFPARAM(); if(self.classname == "droppedweapon") if(self.weapon == WEP_MORTAR.m_id) return true; diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index 33bebd04cc..d96c143f77 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -9,7 +9,7 @@ // ======================= bool ons_CaptureShield_Customize() -{ +{SELFPARAM(); entity e = WaypointSprite_getviewentity(other); if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, e.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return false; } @@ -19,7 +19,7 @@ bool ons_CaptureShield_Customize() } void ons_CaptureShield_Touch() -{ +{SELFPARAM(); if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, other.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return; } if(!IS_PLAYER(other)) { return; } if(SAME_TEAM(other, self)) { return; } @@ -41,7 +41,7 @@ void ons_CaptureShield_Touch() } void ons_CaptureShield_Reset() -{ +{SELFPARAM(); self.colormap = self.enemy.colormap; self.team = self.enemy.team; } @@ -229,7 +229,7 @@ void onslaught_updatelinks() // =================== bool ons_Link_Send(entity to, int sendflags) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_RADARLINK); WriteByte(MSG_ENTITY, sendflags); if(sendflags & 1) @@ -252,7 +252,7 @@ bool ons_Link_Send(entity to, int sendflags) } void ons_Link_CheckUpdate() -{ +{SELFPARAM(); // TODO check if the two sides have moved (currently they won't move anyway) float cc = 0, cc1 = 0, cc2 = 0; @@ -271,7 +271,7 @@ void ons_Link_CheckUpdate() } void ons_DelayedLinkSetup() -{ +{SELFPARAM(); self.goalentity = find(world, targetname, self.target); self.enemy = find(world, targetname, self.target2); if(!self.goalentity) { objerror("can not find target\n"); } @@ -344,7 +344,7 @@ int ons_ControlPoint_Attackable(entity cp, int teamnumber) } void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); entity oself; if(damage <= 0) { return; } @@ -422,7 +422,7 @@ void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damag } void ons_ControlPoint_Icon_Think() -{ +{SELFPARAM(); entity oself; self.nextthink = time + ONS_CP_THINKRATE; @@ -502,7 +502,7 @@ void ons_ControlPoint_Icon_Think() } void ons_ControlPoint_Icon_BuildThink() -{ +{SELFPARAM(); entity oself; int a; @@ -655,7 +655,7 @@ void ons_ControlPoint_UpdateSprite(entity e) } void ons_ControlPoint_Touch() -{ +{SELFPARAM(); entity toucher = other; int attackable; @@ -692,13 +692,13 @@ void ons_ControlPoint_Touch() } void ons_ControlPoint_Think() -{ +{SELFPARAM(); self.nextthink = time + ONS_CP_THINKRATE; - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } void ons_ControlPoint_Reset() -{ +{SELFPARAM(); if(self.goalentity) remove(self.goalentity); @@ -721,21 +721,21 @@ void ons_ControlPoint_Reset() activator = self; SUB_UseTargets(); // to reset the structures, playerspawns etc. - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } void ons_DelayedControlPoint_Setup(void) -{ +{SELFPARAM(); onslaught_updatelinks(); // captureshield setup ons_CaptureShield_Spawn(self, false); - CSQCMODEL_AUTOINIT(); + CSQCMODEL_AUTOINIT(self); } void ons_ControlPoint_Setup(entity cp) -{ +{SELFPARAM(); // declarations self = cp; // for later usage with droptofloor() @@ -842,7 +842,7 @@ void ons_Generator_UpdateSprite(entity e) } void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(damage <= 0) { return; } if(warmup_stage || gameover) { return; } if(!round_handler_IsRoundStarted()) { return; } @@ -925,7 +925,7 @@ void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int de } void ons_GeneratorThink() -{ +{SELFPARAM(); entity e; self.nextthink = time + GEN_THINKRATE; if (!gameover) @@ -948,7 +948,7 @@ void ons_GeneratorThink() } void ons_GeneratorReset() -{ +{SELFPARAM(); self.team = self.team_saved; self.lasthealth = self.max_health = self.health = autocvar_g_onslaught_gen_health; self.takedamage = DAMAGE_AIM; @@ -973,7 +973,7 @@ void ons_GeneratorReset() } void ons_DelayedGeneratorSetup() -{ +{SELFPARAM(); // bot waypoints waypoint_spawnforitem_force(self, self.origin); self.nearestwaypointtimeout = 0; // activate waypointing again @@ -989,7 +989,7 @@ void ons_DelayedGeneratorSetup() void onslaught_generator_touch() -{ +{SELFPARAM(); if ( IS_PLAYER(other) ) if ( SAME_TEAM(self,other) ) if ( self.iscaptured ) @@ -999,7 +999,7 @@ void onslaught_generator_touch() } void ons_GeneratorSetup(entity gen) // called when spawning a generator entity on the map as a spawnfunc -{ +{SELFPARAM(); // declarations int teamnumber = gen.team; self = gen; // for later usage with droptofloor() @@ -1210,7 +1210,7 @@ void Onslaught_RoundStart() // NOTE: LEGACY CODE, needs to be re-written! void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float sradius) -{ +{SELFPARAM(); entity head; float t, c; int i; @@ -1284,7 +1284,7 @@ void havocbot_role_ons_setrole(entity bot, int role) } int havocbot_ons_teamcount(entity bot, int role) -{ +{SELFPARAM(); int c = 0; entity head; @@ -1297,7 +1297,7 @@ int havocbot_ons_teamcount(entity bot, int role) } void havocbot_goalrating_ons_controlpoints_attack(float ratingscale) -{ +{SELFPARAM(); entity cp, cp1, cp2, best, pl, wp; float radius, bestvalue; int c; @@ -1415,7 +1415,7 @@ void havocbot_goalrating_ons_controlpoints_attack(float ratingscale) } bool havocbot_goalrating_ons_generator_attack(float ratingscale) -{ +{SELFPARAM(); entity g, wp, bestwp; bool found; int best; @@ -1471,7 +1471,7 @@ bool havocbot_goalrating_ons_generator_attack(float ratingscale) } void havocbot_role_ons_offense() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) { self.havocbot_attack_time = 0; @@ -1506,17 +1506,17 @@ void havocbot_role_ons_offense() } void havocbot_role_ons_assistant() -{ +{SELFPARAM(); havocbot_ons_reset_role(self); } void havocbot_role_ons_defense() -{ +{SELFPARAM(); havocbot_ons_reset_role(self); } void havocbot_ons_reset_role(entity bot) -{ +{SELFPARAM(); entity head; int c = 0; @@ -1548,7 +1548,7 @@ void havocbot_ons_reset_role(entity bot) * if max_dist is positive, only control points within this range will be considered */ entity ons_Nearest_ControlPoint(vector pos, float max_dist) -{ +{SELFPARAM(); entity tmp_entity, closest_target = world; tmp_entity = findchain(classname, "onslaught_controlpoint"); while(tmp_entity) @@ -1579,7 +1579,7 @@ entity ons_Nearest_ControlPoint(vector pos, float max_dist) * This function only check distances on the XY plane, disregarding Z */ entity ons_Nearest_ControlPoint_2D(vector pos, float max_dist) -{ +{SELFPARAM(); entity tmp_entity, closest_target = world; vector delta; float smallest_distance = 0, distance; @@ -1626,7 +1626,7 @@ entity ons_Nearest_ControlPoint_2D(vector pos, float max_dist) * find the number of control points and generators in the same team as self */ int ons_Count_SelfControlPoints() -{ +{SELFPARAM(); entity tmp_entity; tmp_entity = findchain(classname, "onslaught_controlpoint"); int n = 0; @@ -1702,7 +1702,7 @@ bool ons_Teleport(entity player, entity tele_target, float range, bool tele_effe // ============== MUTATOR_HOOKFUNCTION(ons_ResetMap) -{ +{SELFPARAM(); FOR_EACH_PLAYER(self) { self.ons_roundlost = false; @@ -1713,13 +1713,13 @@ MUTATOR_HOOKFUNCTION(ons_ResetMap) } MUTATOR_HOOKFUNCTION(ons_RemovePlayer) -{ +{SELFPARAM(); self.ons_deathloc = '0 0 0'; return false; } MUTATOR_HOOKFUNCTION(ons_PlayerSpawn) -{ +{SELFPARAM(); if(!round_handler_IsRoundStarted()) { self.player_blocked = true; @@ -1845,7 +1845,7 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn) } MUTATOR_HOOKFUNCTION(ons_PlayerDies) -{ +{SELFPARAM(); frag_target.ons_deathloc = frag_target.origin; entity l; for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext) @@ -1865,7 +1865,7 @@ MUTATOR_HOOKFUNCTION(ons_PlayerDies) } MUTATOR_HOOKFUNCTION(ons_MonsterThink) -{ +{SELFPARAM(); entity e = find(world, targetname, self.target); if (e != world) self.team = e.team; @@ -1874,7 +1874,7 @@ MUTATOR_HOOKFUNCTION(ons_MonsterThink) } void ons_MonsterSpawn_Delayed() -{ +{SELFPARAM(); entity e, own = self.owner; if(!own) { remove(self); return; } @@ -1895,7 +1895,7 @@ void ons_MonsterSpawn_Delayed() } MUTATOR_HOOKFUNCTION(ons_MonsterSpawn) -{ +{SELFPARAM(); entity e = spawn(); e.owner = self; InitializeEntity(e, ons_MonsterSpawn_Delayed, INITPRIO_FINDTARGET); @@ -1904,7 +1904,7 @@ MUTATOR_HOOKFUNCTION(ons_MonsterSpawn) } void ons_TurretSpawn_Delayed() -{ +{SELFPARAM(); entity e, own = self.owner; if(!own) { remove(self); return; } @@ -1926,7 +1926,7 @@ void ons_TurretSpawn_Delayed() } MUTATOR_HOOKFUNCTION(ons_TurretSpawn) -{ +{SELFPARAM(); entity e = spawn(); e.owner = self; InitializeEntity(e, ons_TurretSpawn_Delayed, INITPRIO_FINDTARGET); @@ -1935,7 +1935,7 @@ MUTATOR_HOOKFUNCTION(ons_TurretSpawn) } MUTATOR_HOOKFUNCTION(ons_BotRoles) -{ +{SELFPARAM(); havocbot_ons_reset_role(self); return true; } @@ -1959,13 +1959,13 @@ MUTATOR_HOOKFUNCTION(ons_GetTeamCount) } MUTATOR_HOOKFUNCTION(ons_SpectateCopy) -{ +{SELFPARAM(); self.ons_roundlost = other.ons_roundlost; // make spectators see it too return false; } MUTATOR_HOOKFUNCTION(ons_SV_ParseClientCommand) -{ +{SELFPARAM(); if(MUTATOR_RETURNVALUE) // command was already handled? return false; @@ -2029,7 +2029,7 @@ MUTATOR_HOOKFUNCTION(ons_SV_ParseClientCommand) } MUTATOR_HOOKFUNCTION(ons_PlayerUseKey) -{ +{SELFPARAM(); if(MUTATOR_RETURNVALUE || gameover) { return false; } if((time > self.teleport_antispam) && (self.deadflag == DEAD_NO) && !self.vehicle) @@ -2065,7 +2065,7 @@ keys: "target2" - second control point. */ void spawnfunc_onslaught_link() -{ +{SELFPARAM(); if(!g_onslaught) { remove(self); return; } if (self.target == "" || self.target2 == "") @@ -2090,7 +2090,7 @@ keys: */ void spawnfunc_onslaught_controlpoint() -{ +{SELFPARAM(); if(!g_onslaught) { remove(self); return; } ons_ControlPoint_Setup(self); @@ -2106,7 +2106,7 @@ keys: "targetname" - name that spawnfunc_onslaught_link entities will use to target this. */ void spawnfunc_onslaught_generator() -{ +{SELFPARAM(); if(!g_onslaught) { remove(self); return; } if(!self.team) { objerror("team must be set"); } diff --git a/qcsrc/server/mutators/gamemode_race.qc b/qcsrc/server/mutators/gamemode_race.qc index a7a832281a..d51b33ec2f 100644 --- a/qcsrc/server/mutators/gamemode_race.qc +++ b/qcsrc/server/mutators/gamemode_race.qc @@ -8,7 +8,7 @@ // legacy bot roles .float race_checkpoint; void havocbot_role_race() -{ +{SELFPARAM(); if(self.deadflag != DEAD_NO) return; @@ -64,7 +64,7 @@ void race_EventLog(string mode, entity actor) // use an alias for easy changing } MUTATOR_HOOKFUNCTION(race_PlayerPhysics) -{ +{SELFPARAM(); // force kbd movement for fairness float wishspeed; vector wishvel; @@ -149,7 +149,7 @@ MUTATOR_HOOKFUNCTION(race_ResetMap) } MUTATOR_HOOKFUNCTION(race_PlayerPreThink) -{ +{SELFPARAM(); if(IS_SPEC(self) || IS_OBSERVER(self)) if(g_race_qualifying) if(msg_entity.enemy.race_laptime) @@ -159,7 +159,7 @@ MUTATOR_HOOKFUNCTION(race_PlayerPreThink) } MUTATOR_HOOKFUNCTION(race_ClientConnect) -{ +{SELFPARAM(); race_PreparePlayer(); self.race_checkpoint = -1; @@ -186,7 +186,7 @@ MUTATOR_HOOKFUNCTION(race_ClientConnect) } MUTATOR_HOOKFUNCTION(race_MakePlayerObserver) -{ +{SELFPARAM(); if(g_race_qualifying) if(PlayerScore_Add(self, SP_RACE_FASTEST, 0)) self.frags = FRAGS_LMS_LOSER; @@ -200,7 +200,7 @@ MUTATOR_HOOKFUNCTION(race_MakePlayerObserver) } MUTATOR_HOOKFUNCTION(race_PlayerSpawn) -{ +{SELFPARAM(); if(spawn_spot.target == "") // Emergency: this wasn't a real spawnpoint. Can this ever happen? race_PreparePlayer(); @@ -215,7 +215,7 @@ MUTATOR_HOOKFUNCTION(race_PlayerSpawn) } MUTATOR_HOOKFUNCTION(race_PutClientInServer) -{ +{SELFPARAM(); if(IS_PLAYER(self)) if(!gameover) { @@ -230,20 +230,20 @@ MUTATOR_HOOKFUNCTION(race_PutClientInServer) } MUTATOR_HOOKFUNCTION(race_PlayerDies) -{ +{SELFPARAM(); self.respawn_flags |= RESPAWN_FORCE; race_AbandonRaceCheck(self); return false; } MUTATOR_HOOKFUNCTION(race_BotRoles) -{ +{SELFPARAM(); self.havocbot_role = havocbot_role_race; return true; } MUTATOR_HOOKFUNCTION(race_PlayerPostThink) -{ +{SELFPARAM(); if(self.cvar_cl_allow_uidtracking == 1 && self.cvar_cl_allow_uid2name == 1) { if (!self.stored_netname) diff --git a/qcsrc/server/mutators/gamemode_tdm.qc b/qcsrc/server/mutators/gamemode_tdm.qc index ad3a15b5f2..e9a95c1f89 100644 --- a/qcsrc/server/mutators/gamemode_tdm.qc +++ b/qcsrc/server/mutators/gamemode_tdm.qc @@ -9,7 +9,7 @@ Keys: "netname" Name of the team (for example Red, Blue, Green, Yellow, Life, Death, Offense, Defense, etc)... "cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */ void spawnfunc_tdm_team() -{ +{SELFPARAM(); if(!g_tdm) { remove(self); return; } self.classname = "tdm_team"; @@ -18,7 +18,7 @@ void spawnfunc_tdm_team() // code from here on is just to support maps that don't have team entities void tdm_SpawnTeam (string teamname, float teamcolor) -{ +{SELFPARAM(); entity oldself; oldself = self; self = spawn(); diff --git a/qcsrc/server/mutators/mutator_bloodloss.qc b/qcsrc/server/mutators/mutator_bloodloss.qc index eb179a0c8c..03c9904081 100644 --- a/qcsrc/server/mutators/mutator_bloodloss.qc +++ b/qcsrc/server/mutators/mutator_bloodloss.qc @@ -5,7 +5,7 @@ .float bloodloss_timer; MUTATOR_HOOKFUNCTION(bloodloss_PlayerThink) -{ +{SELFPARAM(); if(IS_PLAYER(self)) if(self.health <= autocvar_g_bloodloss && self.deadflag == DEAD_NO) { @@ -22,7 +22,7 @@ MUTATOR_HOOKFUNCTION(bloodloss_PlayerThink) } MUTATOR_HOOKFUNCTION(bloodloss_PlayerJump) -{ +{SELFPARAM(); if(self.health <= autocvar_g_bloodloss) return true; diff --git a/qcsrc/server/mutators/mutator_buffs.qc b/qcsrc/server/mutators/mutator_buffs.qc index 4433055b61..365c43ab40 100644 --- a/qcsrc/server/mutators/mutator_buffs.qc +++ b/qcsrc/server/mutators/mutator_buffs.qc @@ -16,7 +16,7 @@ entity buff_FirstFromFlags(int _buffs) } bool buffs_BuffModel_Customize() -{ +{SELFPARAM(); entity player, myowner; bool same_team; @@ -65,7 +65,7 @@ vector buff_GlowColor(entity buff) } void buff_Effect(entity player, string eff) -{ +{SELFPARAM(); if(!autocvar_g_buffs_effects) { return; } if(time >= self.buff_effect_delay) @@ -77,7 +77,7 @@ void buff_Effect(entity player, string eff) // buff item float buff_Waypoint_visible_for_player(entity plr) -{ +{SELFPARAM(); if(!self.owner.buff_active && !self.owner.buff_activetime) return false; @@ -99,7 +99,7 @@ void buff_Waypoint_Spawn(entity e) } void buff_SetCooldown(float cd) -{ +{SELFPARAM(); cd = max(0, cd); if(!self.buff_waypoint) @@ -111,7 +111,7 @@ void buff_SetCooldown(float cd) } void buff_Respawn(entity ent) -{ +{SELFPARAM(); if(gameover) { return; } vector oldbufforigin = ent.origin; @@ -144,7 +144,7 @@ void buff_Respawn(entity ent) } void buff_Touch() -{ +{SELFPARAM(); if(gameover) { return; } if(ITEM_TOUCH_NEEDKILL()) @@ -220,7 +220,7 @@ void buff_NewType(entity ent, float cb) } void buff_Think() -{ +{SELFPARAM(); if(self.buffs != self.oldbuffs) { entity buff = buff_FirstFromFlags(self.buffs); @@ -291,14 +291,14 @@ void buff_Think() } void buff_Waypoint_Reset() -{ +{SELFPARAM(); WaypointSprite_Kill(self.buff_waypoint); if(self.buff_activetime) { buff_Waypoint_Spawn(self); } } void buff_Reset() -{ +{SELFPARAM(); if(autocvar_g_buffs_randomize) buff_NewType(self, self.buffs); self.owner = world; @@ -311,7 +311,7 @@ void buff_Reset() } float buff_Customize() -{ +{SELFPARAM(); entity player = WaypointSprite_getviewentity(other); if(!self.buff_active || (self.team && DIFF_TEAM(player, self))) { @@ -330,7 +330,7 @@ float buff_Customize() } void buff_Init(entity ent) -{ +{SELFPARAM(); if(!cvar("g_buffs")) { remove(ent); return; } if(!teamplay && ent.team) { ent.team = 0; } @@ -400,7 +400,7 @@ void buff_SpawnReplacement(entity ent, entity old) } void buff_Vengeance_DelayedDamage() -{ +{SELFPARAM(); if(self.enemy) Damage(self.enemy, self.owner, self.owner, self.dmg, DEATH_BUFF, self.enemy.origin, '0 0 0'); @@ -520,7 +520,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDamage_Calculate) } MUTATOR_HOOKFUNCTION(buffs_PlayerSpawn) -{ +{SELFPARAM(); self.buffs = 0; // reset timers here to prevent them continuing after re-spawn self.buff_disability_time = 0; @@ -529,7 +529,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerSpawn) } MUTATOR_HOOKFUNCTION(buffs_PlayerPhysics) -{ +{SELFPARAM(); if(self.buffs & BUFF_SPEED.m_itemid) { self.stat_sv_maxspeed *= autocvar_g_buffs_speed_speed; @@ -552,7 +552,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerPhysics) } MUTATOR_HOOKFUNCTION(buffs_PlayerJump) -{ +{SELFPARAM(); if(self.buffs & BUFF_JUMP.m_itemid) player_jumpheight = autocvar_g_buffs_jump_height; @@ -560,7 +560,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerJump) } MUTATOR_HOOKFUNCTION(buffs_MonsterMove) -{ +{SELFPARAM(); if(time < self.buff_disability_time) { monster_speed_walk *= autocvar_g_buffs_disability_speed; @@ -571,7 +571,7 @@ MUTATOR_HOOKFUNCTION(buffs_MonsterMove) } MUTATOR_HOOKFUNCTION(buffs_PlayerDies) -{ +{SELFPARAM(); if(self.buffs) { int buffid = buff_FirstFromFlags(self.buffs).m_id; @@ -588,7 +588,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerDies) } MUTATOR_HOOKFUNCTION(buffs_PlayerUseKey) -{ +{SELFPARAM(); if(MUTATOR_RETURNVALUE || gameover) { return false; } if(self.buffs) { @@ -604,7 +604,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerUseKey) } MUTATOR_HOOKFUNCTION(buffs_PlayerThrowKey) -{ +{SELFPARAM(); if(MUTATOR_RETURNVALUE || gameover) { return false; } if(self.buffs & BUFF_SWAPPER.m_itemid) @@ -674,7 +674,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThrowKey) } MUTATOR_HOOKFUNCTION(buffs_RemovePlayer) -{ +{SELFPARAM(); if(self.buff_model) { remove(self.buff_model); @@ -689,7 +689,7 @@ MUTATOR_HOOKFUNCTION(buffs_RemovePlayer) } MUTATOR_HOOKFUNCTION(buffs_CustomizeWaypoint) -{ +{SELFPARAM(); entity e = WaypointSprite_getviewentity(other); // if you have the invisibility powerup, sprites ALWAYS are restricted to your team @@ -702,7 +702,7 @@ MUTATOR_HOOKFUNCTION(buffs_CustomizeWaypoint) } MUTATOR_HOOKFUNCTION(buffs_OnEntityPreSpawn) -{ +{SELFPARAM(); if(autocvar_g_buffs_replace_powerups) switch(self.classname) { @@ -718,7 +718,7 @@ MUTATOR_HOOKFUNCTION(buffs_OnEntityPreSpawn) } MUTATOR_HOOKFUNCTION(buffs_WeaponRate) -{ +{SELFPARAM(); if(self.buffs & BUFF_SPEED.m_itemid) weapon_rate *= autocvar_g_buffs_speed_rate; @@ -729,7 +729,7 @@ MUTATOR_HOOKFUNCTION(buffs_WeaponRate) } MUTATOR_HOOKFUNCTION(buffs_WeaponSpeed) -{ +{SELFPARAM(); if(self.buffs & BUFF_SPEED.m_itemid) ret_float *= autocvar_g_buffs_speed_weaponspeed; @@ -742,7 +742,7 @@ MUTATOR_HOOKFUNCTION(buffs_WeaponSpeed) .float buff_time; MUTATOR_HOOKFUNCTION(buffs_PlayerThink) -{ +{SELFPARAM(); if(gameover || self.deadflag != DEAD_NO) { return false; } if(time < self.buff_disability_time) @@ -889,7 +889,7 @@ MUTATOR_HOOKFUNCTION(buffs_PlayerThink) } MUTATOR_HOOKFUNCTION(buffs_SpectateCopy) -{ +{SELFPARAM(); self.buffs = other.buffs; return false; } @@ -909,7 +909,7 @@ MUTATOR_HOOKFUNCTION(buffs_VehicleExit) } MUTATOR_HOOKFUNCTION(buffs_PlayerRegen) -{ +{SELFPARAM(); if(self.buffs & BUFF_MEDIC.m_itemid) { regen_mod_rot = autocvar_g_buffs_medic_rot; diff --git a/qcsrc/server/mutators/mutator_campcheck.qc b/qcsrc/server/mutators/mutator_campcheck.qc index bacc590b78..960565d425 100644 --- a/qcsrc/server/mutators/mutator_campcheck.qc +++ b/qcsrc/server/mutators/mutator_campcheck.qc @@ -8,7 +8,7 @@ .float campcheck_traveled_distance; MUTATOR_HOOKFUNCTION(campcheck_PlayerDies) -{ +{SELFPARAM(); Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_CAMPCHECK); return false; @@ -28,7 +28,7 @@ MUTATOR_HOOKFUNCTION(campcheck_PlayerDamage) } MUTATOR_HOOKFUNCTION(campcheck_PlayerThink) -{ +{SELFPARAM(); if(IS_PLAYER(self)) if(self.deadflag == DEAD_NO) if(!self.frozen) @@ -66,7 +66,7 @@ MUTATOR_HOOKFUNCTION(campcheck_PlayerThink) } MUTATOR_HOOKFUNCTION(campcheck_PlayerSpawn) -{ +{SELFPARAM(); self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2; self.campcheck_traveled_distance = 0; diff --git a/qcsrc/server/mutators/mutator_dodging.qc b/qcsrc/server/mutators/mutator_dodging.qc index ab70fb217d..b5dc32fdfe 100644 --- a/qcsrc/server/mutators/mutator_dodging.qc +++ b/qcsrc/server/mutators/mutator_dodging.qc @@ -83,7 +83,7 @@ #elif defined(SVQC) void dodging_UpdateStats() -{ +{SELFPARAM(); self.stat_dodging = PHYS_DODGING; self.stat_dodging_delay = PHYS_DODGING_DELAY; self.stat_dodging_horiz_speed_frozen = PHYS_DODGING_HORIZ_SPEED_FROZEN; @@ -116,7 +116,7 @@ void dodging_Initialize() // returns 1 if the player is close to a wall bool check_close_to_wall(float threshold) -{ +{SELFPARAM(); if (PHYS_DODGING_WALL == 0) { return false; } #define X(OFFSET) \ @@ -133,12 +133,12 @@ bool check_close_to_wall(float threshold) } bool check_close_to_ground(float threshold) -{ +{SELFPARAM(); return IS_ONGROUND(self) ? true : false; } float PM_dodging_checkpressedkeys() -{ +{SELFPARAM(); if(!PHYS_DODGING) return false; @@ -199,7 +199,7 @@ float PM_dodging_checkpressedkeys() } void PM_dodging() -{ +{SELFPARAM(); if (!PHYS_DODGING) return; diff --git a/qcsrc/server/mutators/mutator_instagib.qc b/qcsrc/server/mutators/mutator_instagib.qc index 9728ed623b..c4ddfa12bb 100644 --- a/qcsrc/server/mutators/mutator_instagib.qc +++ b/qcsrc/server/mutators/mutator_instagib.qc @@ -8,7 +8,7 @@ #include "../../common/items/all.qc" void spawnfunc_item_minst_cells (void) -{ +{SELFPARAM(); if (!g_instagib) { remove(self); return; } if (!self.ammo_cells) self.ammo_cells = autocvar_g_instagib_ammo_drop; @@ -17,7 +17,7 @@ void spawnfunc_item_minst_cells (void) } void instagib_health_mega() -{ +{SELFPARAM(); self.max_health = 1; StartItemA (ITEM_ExtraLife); } @@ -32,7 +32,7 @@ void instagib_stop_countdown(entity e) e.instagib_needammo = false; } void instagib_ammocheck() -{ +{SELFPARAM(); if(time < self.instagib_nextthink) return; if(!IS_PLAYER(self)) @@ -130,7 +130,7 @@ MUTATOR_HOOKFUNCTION(instagib_MonsterLoot) } MUTATOR_HOOKFUNCTION(instagib_MonsterSpawn) -{ +{SELFPARAM(); // always refill ammo if(self.monsterid == MON_MAGE.monsterid) self.skin = 1; @@ -147,13 +147,13 @@ MUTATOR_HOOKFUNCTION(instagib_BotShouldAttack) } MUTATOR_HOOKFUNCTION(instagib_MakePlayerObserver) -{ +{SELFPARAM(); instagib_stop_countdown(self); return false; } MUTATOR_HOOKFUNCTION(instagib_PlayerSpawn) -{ +{SELFPARAM(); self.effects |= EF_FULLBRIGHT; return false; } @@ -171,7 +171,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerRegen) } MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups) -{ +{SELFPARAM(); if (!(self.effects & EF_FULLBRIGHT)) self.effects |= EF_FULLBRIGHT; @@ -220,7 +220,7 @@ MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups) } MUTATOR_HOOKFUNCTION(instagib_PlayerPhysics) -{ +{SELFPARAM(); if(self.items & ITEM_Shield.m_itemid) self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed; @@ -323,7 +323,7 @@ MUTATOR_HOOKFUNCTION(instagib_SetStartItems) } MUTATOR_HOOKFUNCTION(instagib_FilterItem) -{ +{SELFPARAM(); if(self.classname == "item_cells") return true; // no normal cells? @@ -358,7 +358,7 @@ MUTATOR_HOOKFUNCTION(instagib_FilterItem) } MUTATOR_HOOKFUNCTION(instagib_CustomizeWaypoint) -{ +{SELFPARAM(); entity e = WaypointSprite_getviewentity(other); // if you have the invisibility powerup, sprites ALWAYS are restricted to your team @@ -371,7 +371,7 @@ MUTATOR_HOOKFUNCTION(instagib_CustomizeWaypoint) } MUTATOR_HOOKFUNCTION(instagib_ItemCountdown) -{ +{SELFPARAM(); switch (self.items) { case ITEM_Strength.m_itemid: item_name = "item-invis"; item_color = '0 0 1'; break; @@ -382,7 +382,7 @@ MUTATOR_HOOKFUNCTION(instagib_ItemCountdown) } MUTATOR_HOOKFUNCTION(instagib_ItemTouch) -{ +{SELFPARAM(); if(self.ammo_cells) { // play some cool sounds ;) @@ -411,7 +411,7 @@ MUTATOR_HOOKFUNCTION(instagib_ItemTouch) } MUTATOR_HOOKFUNCTION(instagib_OnEntityPreSpawn) -{ +{SELFPARAM(); if (!autocvar_g_powerups) { return false; } if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.itemdef == ITEM_HealthMega)) return false; diff --git a/qcsrc/server/mutators/mutator_melee_only.qc b/qcsrc/server/mutators/mutator_melee_only.qc index c77bba5163..dee8dd6bc9 100644 --- a/qcsrc/server/mutators/mutator_melee_only.qc +++ b/qcsrc/server/mutators/mutator_melee_only.qc @@ -16,7 +16,7 @@ MUTATOR_HOOKFUNCTION(melee_ForbidThrowing) } MUTATOR_HOOKFUNCTION(melee_FilterItem) -{ +{SELFPARAM(); switch (self.items) { case ITEM_HealthSmall.m_itemid: diff --git a/qcsrc/server/mutators/mutator_midair.qc b/qcsrc/server/mutators/mutator_midair.qc index 686df9a567..3ac7303171 100644 --- a/qcsrc/server/mutators/mutator_midair.qc +++ b/qcsrc/server/mutators/mutator_midair.qc @@ -5,7 +5,7 @@ .float midair_shieldtime; MUTATOR_HOOKFUNCTION(midair_PlayerDamage) -{ +{SELFPARAM(); if(IS_PLAYER(frag_attacker)) if(IS_PLAYER(frag_target)) if(time < self.midair_shieldtime) @@ -15,7 +15,7 @@ MUTATOR_HOOKFUNCTION(midair_PlayerDamage) } MUTATOR_HOOKFUNCTION(midair_PlayerPowerups) -{ +{SELFPARAM(); if(time >= game_starttime) if(self.flags & FL_ONGROUND) { @@ -27,7 +27,7 @@ MUTATOR_HOOKFUNCTION(midair_PlayerPowerups) } MUTATOR_HOOKFUNCTION(midair_PlayerSpawn) -{ +{SELFPARAM(); if(IS_BOT_CLIENT(self)) self.bot_moveskill = 0; // disable bunnyhopping diff --git a/qcsrc/server/mutators/mutator_multijump.qc b/qcsrc/server/mutators/mutator_multijump.qc index dd879e5de4..265ebea424 100644 --- a/qcsrc/server/mutators/mutator_multijump.qc +++ b/qcsrc/server/mutators/mutator_multijump.qc @@ -25,7 +25,7 @@ .float stat_multijump_add; void multijump_UpdateStats() -{ +{SELFPARAM(); self.stat_multijump = PHYS_MULTIJUMP; self.stat_multijump_speed = PHYS_MULTIJUMP_SPEED; self.stat_multijump_add = PHYS_MULTIJUMP_ADD; @@ -41,7 +41,7 @@ void multijump_AddStats() #endif void PM_multijump() -{ +{SELFPARAM(); if(!PHYS_MULTIJUMP) { return; } if(IS_ONGROUND(self)) @@ -51,7 +51,7 @@ void PM_multijump() } float PM_multijump_checkjump() -{ +{SELFPARAM(); if(!PHYS_MULTIJUMP) { return false; } if (!IS_JUMP_HELD(self) && !IS_ONGROUND(self)) // jump button pressed this frame and we are in midair diff --git a/qcsrc/server/mutators/mutator_nades.qc b/qcsrc/server/mutators/mutator_nades.qc index 9199fe1eaf..fcab3c7697 100644 --- a/qcsrc/server/mutators/mutator_nades.qc +++ b/qcsrc/server/mutators/mutator_nades.qc @@ -14,7 +14,7 @@ .entity nade_spawnloc; void nade_timer_think() -{ +{SELFPARAM(); self.skin = 8 - (self.owner.wait - time) / (autocvar_g_nades_nade_lifetime / 10); self.nextthink = time; if(!self.owner || wasfreed(self.owner)) @@ -46,7 +46,7 @@ void nade_spawn(entity _nade) } void napalm_damage(float dist, float damage, float edgedamage, float burntime) -{ +{SELFPARAM(); entity e; float d; vector p; @@ -84,7 +84,7 @@ void napalm_damage(float dist, float damage, float edgedamage, float burntime) void napalm_ball_think() -{ +{SELFPARAM(); if(round_handler_IsActive()) if(!round_handler_IsRoundStarted()) { @@ -117,7 +117,7 @@ void napalm_ball_think() void nade_napalm_ball() -{ +{SELFPARAM(); entity proj; vector kick; @@ -158,7 +158,7 @@ void nade_napalm_ball() void napalm_fountain_think() -{ +{SELFPARAM(); if(round_handler_IsActive()) if(!round_handler_IsRoundStarted()) @@ -196,7 +196,7 @@ void napalm_fountain_think() } void nade_napalm_boom() -{ +{SELFPARAM(); entity fountain; int c; for (c = 0; c < autocvar_g_nades_napalm_ball_count; c++) @@ -237,7 +237,7 @@ void nade_ice_freeze(entity freezefield, entity frost_target, float freeze_time) } void nade_ice_think() -{ +{SELFPARAM(); if(round_handler_IsActive()) if(!round_handler_IsRoundStarted()) @@ -310,7 +310,7 @@ void nade_ice_think() } void nade_ice_boom() -{ +{SELFPARAM(); entity fountain; fountain = spawn(); fountain.owner = self.owner; @@ -349,7 +349,7 @@ void nade_ice_boom() } void nade_translocate_boom() -{ +{SELFPARAM(); if(self.realowner.vehicle) return; @@ -365,7 +365,7 @@ void nade_translocate_boom() } void nade_spawn_boom() -{ +{SELFPARAM(); entity spawnloc = spawn(); setorigin(spawnloc, self.origin); setsize(spawnloc, self.realowner.mins, self.realowner.maxs); @@ -385,7 +385,7 @@ void nade_spawn_boom() } void nade_heal_think() -{ +{SELFPARAM(); if(time >= self.ltime) { remove(self); @@ -404,7 +404,7 @@ void nade_heal_think() } void nade_heal_touch() -{ +{SELFPARAM(); float maxhealth; float health_factor; if(IS_PLAYER(other) || IS_MONSTER(other)) @@ -446,7 +446,7 @@ void nade_heal_touch() } void nade_heal_boom() -{ +{SELFPARAM(); entity healer; healer = spawn(); healer.owner = self.owner; @@ -472,7 +472,7 @@ void nade_heal_boom() } void nade_monster_boom() -{ +{SELFPARAM(); entity e = spawnmonster(self.pokenade_type, 0, self.realowner, self.realowner, self.origin, false, false, 1); if(autocvar_g_nades_pokenade_monster_lifetime > 0) @@ -481,7 +481,7 @@ void nade_monster_boom() } void nade_boom() -{ +{SELFPARAM(); entity expef = NULL; bool nade_blast = true; @@ -562,7 +562,7 @@ void nade_boom() } void nade_touch() -{ +{SELFPARAM(); /*float is_weapclip = 0; if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW) if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID)) @@ -593,14 +593,14 @@ void nade_touch() } void nade_beep() -{ +{SELFPARAM(); sound(self, CH_SHOTS_SINGLE, "overkill/grenadebip.ogg", VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX)); self.think = nade_boom; self.nextthink = max(self.wait, time); } void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(ITEM_DAMAGE_NEEDKILL(deathtype)) { self.takedamage = DAMAGE_NO; @@ -666,7 +666,7 @@ void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, } void toss_nade(entity e, vector _velocity, float _time) -{ +{SELFPARAM(); if(e.nade == world) return; @@ -772,7 +772,7 @@ void nades_RemoveBonus(entity player) } float nade_customize() -{ +{SELFPARAM(); //if(IS_SPEC(other)) { return false; } if(other == self.realowner || (IS_SPEC(other) && other.enemy == self.realowner)) { @@ -794,7 +794,7 @@ float nade_customize() } void nade_prime() -{ +{SELFPARAM(); if(self.nade) remove(self.nade); @@ -851,7 +851,7 @@ void nade_prime() } float CanThrowNade() -{ +{SELFPARAM(); if(self.vehicle) return false; @@ -874,7 +874,7 @@ float CanThrowNade() } void nades_CheckThrow() -{ +{SELFPARAM(); if(!CanThrowNade()) return; @@ -926,7 +926,7 @@ MUTATOR_HOOKFUNCTION(nades_VehicleEnter) } MUTATOR_HOOKFUNCTION(nades_PlayerPreThink) -{ +{SELFPARAM(); if(!IS_PLAYER(self)) { return false; } float key_pressed = self.BUTTON_HOOK; @@ -1057,7 +1057,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink) } MUTATOR_HOOKFUNCTION(nades_PlayerSpawn) -{ +{SELFPARAM(); if(autocvar_g_nades_spawn) self.nade_refire = time + autocvar_g_spawnshieldtime; else @@ -1138,7 +1138,7 @@ MUTATOR_HOOKFUNCTION(nades_PlayerDamage) } MUTATOR_HOOKFUNCTION(nades_MonsterDies) -{ +{SELFPARAM(); if(IS_PLAYER(frag_attacker)) if(DIFF_TEAM(frag_attacker, self)) if(!(self.spawnflags & MONSTERFLAG_SPAWNED)) @@ -1148,14 +1148,14 @@ MUTATOR_HOOKFUNCTION(nades_MonsterDies) } MUTATOR_HOOKFUNCTION(nades_RemovePlayer) -{ +{SELFPARAM(); nades_Clear(self); nades_RemoveBonus(self); return false; } MUTATOR_HOOKFUNCTION(nades_SpectateCopy) -{ +{SELFPARAM(); self.nade_timer = other.nade_timer; self.nade_type = other.nade_type; self.pokenade_type = other.pokenade_type; diff --git a/qcsrc/server/mutators/mutator_new_toys.qc b/qcsrc/server/mutators/mutator_new_toys.qc index fa7638b515..c80f19f669 100644 --- a/qcsrc/server/mutators/mutator_new_toys.qc +++ b/qcsrc/server/mutators/mutator_new_toys.qc @@ -168,7 +168,7 @@ MUTATOR_HOOKFUNCTION(nt_SetStartItems) } MUTATOR_HOOKFUNCTION(nt_SetWeaponreplace) -{ +{SELFPARAM(); // otherwise, we do replace if(self.new_toys) { @@ -188,7 +188,7 @@ MUTATOR_HOOKFUNCTION(nt_SetWeaponreplace) } MUTATOR_HOOKFUNCTION(nt_FilterItem) -{ +{SELFPARAM(); if(nt_IsNewToy(self.weapon)) self.item_pickupsound = W_Sound("weaponpickup_new_toys"); return 0; diff --git a/qcsrc/server/mutators/mutator_nix.qc b/qcsrc/server/mutators/mutator_nix.qc index f239dbbf63..8cf0118d4e 100644 --- a/qcsrc/server/mutators/mutator_nix.qc +++ b/qcsrc/server/mutators/mutator_nix.qc @@ -44,7 +44,7 @@ void NIX_ChooseNextWeapon() } void NIX_GiveCurrentWeapon() -{ +{SELFPARAM(); float dt; if(!nix_nextweapon) @@ -177,7 +177,7 @@ MUTATOR_HOOKFUNCTION(nix_BuildMutatorsPrettyString) } MUTATOR_HOOKFUNCTION(nix_FilterItem) -{ +{SELFPARAM(); switch (self.items) { case ITEM_HealthSmall.m_itemid: @@ -202,14 +202,14 @@ MUTATOR_HOOKFUNCTION(nix_FilterItem) } MUTATOR_HOOKFUNCTION(nix_OnEntityPreSpawn) -{ +{SELFPARAM(); if(self.classname == "target_items") // items triggers cannot work in nix (as they change weapons/ammo) return 1; return 0; } MUTATOR_HOOKFUNCTION(nix_PlayerPreThink) -{ +{SELFPARAM(); if(!intermission_running) if(self.deadflag == DEAD_NO) if(IS_PLAYER(self)) @@ -218,7 +218,7 @@ MUTATOR_HOOKFUNCTION(nix_PlayerPreThink) } MUTATOR_HOOKFUNCTION(nix_PlayerSpawn) -{ +{SELFPARAM(); self.nix_lastchange_id = -1; NIX_GiveCurrentWeapon(); // overrides the weapons you got when spawning self.items |= IT_UNLIMITED_SUPERWEAPONS; @@ -232,7 +232,7 @@ MUTATOR_HOOKFUNCTION(nix_SetModname) } MUTATOR_DEFINITION(mutator_nix) -{ +{SELFPARAM(); entity e; MUTATOR_HOOK(ForbidThrowCurrentWeapon, nix_ForbidThrowCurrentWeapon, CBC_ORDER_ANY); diff --git a/qcsrc/server/mutators/mutator_overkill.qc b/qcsrc/server/mutators/mutator_overkill.qc index 9247dffaca..5410d6cd05 100644 --- a/qcsrc/server/mutators/mutator_overkill.qc +++ b/qcsrc/server/mutators/mutator_overkill.qc @@ -64,14 +64,14 @@ MUTATOR_HOOKFUNCTION(ok_PlayerDamage_Calculate) } MUTATOR_HOOKFUNCTION(ok_PlayerDamage_SplitHealthArmor) -{ +{SELFPARAM(); if(damage_take) self.ok_pauseregen_finished = max(self.ok_pauseregen_finished, time + 2); return false; } MUTATOR_HOOKFUNCTION(ok_PlayerDies) -{ +{SELFPARAM(); entity oldself = self; entity targ = ((frag_attacker) ? frag_attacker : frag_target); @@ -101,7 +101,7 @@ MUTATOR_HOOKFUNCTION(ok_PlayerDies) } MUTATOR_HOOKFUNCTION(ok_PlayerRegen) -{ +{SELFPARAM(); // overkill's values are different, so use custom regen if(!self.frozen) { @@ -125,7 +125,7 @@ MUTATOR_HOOKFUNCTION(ok_ForbidThrowCurrentWeapon) } MUTATOR_HOOKFUNCTION(ok_PlayerPreThink) -{ +{SELFPARAM(); if(intermission_running || gameover) return false; @@ -189,7 +189,7 @@ MUTATOR_HOOKFUNCTION(ok_PlayerPreThink) } MUTATOR_HOOKFUNCTION(ok_PlayerSpawn) -{ +{SELFPARAM(); if(autocvar_g_overkill_ammo_charge) { for(int i = WEP_FIRST; i <= WEP_LAST; ++i) @@ -207,7 +207,7 @@ MUTATOR_HOOKFUNCTION(ok_PlayerSpawn) } MUTATOR_HOOKFUNCTION(ok_OnEntityPreSpawn) -{ +{SELFPARAM(); if(autocvar_g_powerups) if(autocvar_g_overkill_powerups_replace) { @@ -250,7 +250,7 @@ MUTATOR_HOOKFUNCTION(ok_OnEntityPreSpawn) } MUTATOR_HOOKFUNCTION(ok_ItemRemove) -{ +{SELFPARAM(); if(self.ok_item) return false; @@ -264,7 +264,7 @@ MUTATOR_HOOKFUNCTION(ok_ItemRemove) } MUTATOR_HOOKFUNCTION(ok_SpectateCopy) -{ +{SELFPARAM(); self.ammo_charge[self.weapon] = other.ammo_charge[other.weapon]; self.ok_use_ammocharge = other.ok_use_ammocharge; diff --git a/qcsrc/server/mutators/mutator_physical_items.qc b/qcsrc/server/mutators/mutator_physical_items.qc index 08bb81a9f6..892211ce03 100644 --- a/qcsrc/server/mutators/mutator_physical_items.qc +++ b/qcsrc/server/mutators/mutator_physical_items.qc @@ -5,7 +5,7 @@ .vector spawn_origin, spawn_angles; void physical_item_think() -{ +{SELFPARAM(); self.nextthink = time; self.alpha = self.owner.alpha; // apply fading and ghosting @@ -40,7 +40,7 @@ void physical_item_think() } void physical_item_touch() -{ +{SELFPARAM(); if(!self.cnt) // not for dropped items if (ITEM_TOUCH_NEEDKILL()) { @@ -50,7 +50,7 @@ void physical_item_touch() } void physical_item_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(!self.cnt) // not for dropped items if(ITEM_DAMAGE_NEEDKILL(deathtype)) { @@ -60,7 +60,7 @@ void physical_item_damage(entity inflictor, entity attacker, float damage, int d } MUTATOR_HOOKFUNCTION(item_spawning) -{ +{SELFPARAM(); if(self.owner == world && autocvar_g_physical_items <= 1) return false; if (self.spawnflags & 1) // floating item diff --git a/qcsrc/server/mutators/mutator_pinata.qc b/qcsrc/server/mutators/mutator_pinata.qc index 5dd6aa92e4..71262b923d 100644 --- a/qcsrc/server/mutators/mutator_pinata.qc +++ b/qcsrc/server/mutators/mutator_pinata.qc @@ -3,7 +3,7 @@ #include "mutator.qh" MUTATOR_HOOKFUNCTION(pinata_PlayerDies) -{ +{SELFPARAM(); float j; for(j = WEP_FIRST; j <= WEP_LAST; ++j) if(self.weapons & WepSet_FromWeapon(j)) diff --git a/qcsrc/server/mutators/mutator_spawn_near_teammate.qc b/qcsrc/server/mutators/mutator_spawn_near_teammate.qc index c3ab07a726..899438d762 100644 --- a/qcsrc/server/mutators/mutator_spawn_near_teammate.qc +++ b/qcsrc/server/mutators/mutator_spawn_near_teammate.qc @@ -8,7 +8,7 @@ .vector msnt_deathloc; MUTATOR_HOOKFUNCTION(msnt_Spawn_Score) -{ +{SELFPARAM(); if(autocvar_g_spawn_near_teammate_ignore_spawnpoint) return 0; @@ -44,7 +44,7 @@ MUTATOR_HOOKFUNCTION(msnt_Spawn_Score) } MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn) -{ +{SELFPARAM(); // Note: when entering this, fixangle is already set. if(autocvar_g_spawn_near_teammate_ignore_spawnpoint) { @@ -153,7 +153,7 @@ MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn) } MUTATOR_HOOKFUNCTION(msnt_PlayerDies) -{ +{SELFPARAM(); self.msnt_deathloc = self.origin; return 0; } diff --git a/qcsrc/server/mutators/mutator_superspec.qc b/qcsrc/server/mutators/mutator_superspec.qc index bac05be86c..ea66e7da1c 100644 --- a/qcsrc/server/mutators/mutator_superspec.qc +++ b/qcsrc/server/mutators/mutator_superspec.qc @@ -25,7 +25,7 @@ const float SSF_ITEMMSG = 4; .string superspec_itemfilter; //"classname1 classname2 ..." float _spectate(entity _player) -{ +{SELFPARAM(); if(Spectate(_player) == 1) self.classname = "spectator"; @@ -33,7 +33,7 @@ float _spectate(entity _player) } void superspec_save_client_conf() -{ +{SELFPARAM(); string fn = "superspec-local.options"; float fh; @@ -99,7 +99,7 @@ float superspec_filteritem(entity _for, entity _item) } MUTATOR_HOOKFUNCTION(superspec_ItemTouch) -{ +{SELFPARAM(); entity _oldself = self; entity _item = self; @@ -152,7 +152,7 @@ MUTATOR_HOOKFUNCTION(superspec_ItemTouch) } MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand) -{ +{SELFPARAM(); #define OPTIONINFO(flag,var,test,text,long,short) \ var = strcat(var, ((flag & test) ? "^2[ON] ^7" : "^1[OFF] ^7")); \ var = strcat(var, text," ^7(^3 ", long, "^7 | ^3", short, " ^7)\n") @@ -431,7 +431,7 @@ MUTATOR_HOOKFUNCTION(superspec_BuildMutatorsPrettyString) } void superspec_hello() -{ +{SELFPARAM(); if(self.enemy.crypto_idfp == "") Send_Notification(NOTIF_ONE_ONLY, self.enemy, MSG_INFO, INFO_SUPERSPEC_MISSING_UID); @@ -439,7 +439,7 @@ void superspec_hello() } MUTATOR_HOOKFUNCTION(superspec_ClientConnect) -{ +{SELFPARAM(); if(!IS_REAL_CLIENT(self)) return false; @@ -487,7 +487,7 @@ MUTATOR_HOOKFUNCTION(superspec_ClientConnect) } MUTATOR_HOOKFUNCTION(superspec_PlayerDies) -{ +{SELFPARAM(); entity _old_self = self; FOR_EACH_SPEC(self) diff --git a/qcsrc/server/mutators/mutator_touchexplode.qc b/qcsrc/server/mutators/mutator_touchexplode.qc index 3c0e2706f8..4f49d550d9 100644 --- a/qcsrc/server/mutators/mutator_touchexplode.qc +++ b/qcsrc/server/mutators/mutator_touchexplode.qc @@ -5,7 +5,7 @@ .float touchexplode_time; void PlayerTouchExplode(entity p1, entity p2) -{ +{SELFPARAM(); vector org; org = (p1.origin + p2.origin) * 0.5; org.z += (p1.mins.z + p2.mins.z) * 0.5; @@ -21,7 +21,7 @@ void PlayerTouchExplode(entity p1, entity p2) } MUTATOR_HOOKFUNCTION(touchexplode_PlayerThink) -{ +{SELFPARAM(); if(time > self.touchexplode_time) if(!gameover) if(!self.frozen) diff --git a/qcsrc/server/mutators/mutator_vampirehook.qc b/qcsrc/server/mutators/mutator_vampirehook.qc index 85ff7b0586..3d88a90157 100644 --- a/qcsrc/server/mutators/mutator_vampirehook.qc +++ b/qcsrc/server/mutators/mutator_vampirehook.qc @@ -8,7 +8,7 @@ float autocvar_g_vampirehook_health_steal; .float last_dmg; MUTATOR_HOOKFUNCTION(vh, GrappleHookThink) -{ +{SELFPARAM(); entity dmgent = ((SAME_TEAM(self.owner, self.aiment) && autocvar_g_vampirehook_teamheal) ? self.owner : self.aiment); if(IS_PLAYER(self.aiment)) diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 273e25e3f9..a5d925d103 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -10,7 +10,7 @@ float object_count; .float touch_timer; void sandbox_ObjectFunction_Touch() -{ +{SELFPARAM(); // apply material impact effects if(!self.material) @@ -35,7 +35,7 @@ void sandbox_ObjectFunction_Touch() } void sandbox_ObjectFunction_Think() -{ +{SELFPARAM(); entity e; // decide if and how this object can be grabbed @@ -61,12 +61,12 @@ void sandbox_ObjectFunction_Think() self.nextthink = time; - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } .float old_solid, old_movetype; entity sandbox_ObjectEdit_Get(float permissions) -{ +{SELFPARAM(); // Returns the traced entity if the player can edit it, and world if not. // If permissions if false, the object is returned regardless of editing rights. // Attached objects are SOLID_NOT and do not get traced. @@ -140,7 +140,7 @@ void sandbox_ObjectAttach_Remove(entity e) } entity sandbox_ObjectSpawn(float database) -{ +{SELFPARAM(); // spawn a new object with default properties entity e, oldself; @@ -181,7 +181,7 @@ entity sandbox_ObjectSpawn(float database) oldself = self; self = e; - CSQCMODEL_AUTOINIT(); + CSQCMODEL_AUTOINIT(self); self = oldself; object_count += 1; @@ -424,7 +424,7 @@ void sandbox_Database_Load() } MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) -{ +{SELFPARAM(); if(MUTATOR_RETURNVALUE) // command was already handled? return false; if(cmd_name == "g_sandbox") diff --git a/qcsrc/server/pathlib/debug.qc b/qcsrc/server/pathlib/debug.qc index 5c97cf7ac4..1da4fc0493 100644 --- a/qcsrc/server/pathlib/debug.qc +++ b/qcsrc/server/pathlib/debug.qc @@ -18,13 +18,13 @@ void pathlib_showpath(entity start) } void path_dbg_think() -{ +{SELFPARAM(); pathlib_showpath(self); self.nextthink = time + 1; } void __showpath2_think() -{ +{SELFPARAM(); #ifdef TURRET_DEBUG mark_info(self.origin,1); #endif diff --git a/qcsrc/server/pathlib/main.qc b/qcsrc/server/pathlib/main.qc index 39847f635d..f097e8a0fe 100644 --- a/qcsrc/server/pathlib/main.qc +++ b/qcsrc/server/pathlib/main.qc @@ -370,7 +370,7 @@ entity path_build(entity next, vector where, entity prev, entity start) } entity pathlib_astar(vector from,vector to) -{ +{SELFPARAM(); entity path, start, end, open, n, ln; float ptime, ftime, ctime; diff --git a/qcsrc/server/pathlib/movenode.qc b/qcsrc/server/pathlib/movenode.qc index 8720eca8b7..6645d71266 100644 --- a/qcsrc/server/pathlib/movenode.qc +++ b/qcsrc/server/pathlib/movenode.qc @@ -4,7 +4,7 @@ #include "utility.qh" vector pathlib_wateroutnode(vector start,vector end, float doedge) -{ +{SELFPARAM(); vector surface; pathlib_movenode_goodnode = 0; @@ -38,7 +38,7 @@ vector pathlib_wateroutnode(vector start,vector end, float doedge) } vector pathlib_swimnode(vector start,vector end, float doedge) -{ +{SELFPARAM(); pathlib_movenode_goodnode = 0; if(pointcontents(start) != CONTENT_WATER) @@ -58,7 +58,7 @@ vector pathlib_swimnode(vector start,vector end, float doedge) } vector pathlib_flynode(vector start,vector end, float doedge) -{ +{SELFPARAM(); pathlib_movenode_goodnode = 0; end.x = fsnap(end.x, pathlib_gridsize); @@ -72,7 +72,7 @@ vector pathlib_flynode(vector start,vector end, float doedge) } void a_think() -{ +{SELFPARAM(); te_lightning1(self,self.origin, self.pos1); if(self.cnt < time) remove(self); @@ -81,7 +81,7 @@ void a_think() } vector pathlib_walknode(vector start,vector end,float doedge) -{ +{SELFPARAM(); vector direction,point,last_point,s,e; float steps, distance, i; diff --git a/qcsrc/server/pathlib/path_waypoint.qc b/qcsrc/server/pathlib/path_waypoint.qc index 7dee3e80f6..4c3a7a1aad 100644 --- a/qcsrc/server/pathlib/path_waypoint.qc +++ b/qcsrc/server/pathlib/path_waypoint.qc @@ -234,7 +234,7 @@ entity pathlib_waypointpath_step() return world; } void plas_think() -{ +{SELFPARAM(); pathlib_waypointpath_step(); if(pathlib_foundgoal) return; diff --git a/qcsrc/server/pathlib/utility.qc b/qcsrc/server/pathlib/utility.qc index ce12c1c631..9028f85e4f 100644 --- a/qcsrc/server/pathlib/utility.qc +++ b/qcsrc/server/pathlib/utility.qc @@ -72,7 +72,7 @@ entity pathlib_nodeatpoint(vector where) } float tile_check_cross(vector where) -{ +{SELFPARAM(); vector p,f,r; f = PLIB_FORWARD * tile_check_size; @@ -107,7 +107,7 @@ float tile_check_cross(vector where) } float tile_check_plus(vector where) -{ +{SELFPARAM(); vector p,f,r; f = PLIB_FORWARD * tile_check_size; @@ -142,7 +142,7 @@ float tile_check_plus(vector where) } float tile_check_plus2(vector where) -{ +{SELFPARAM(); vector p,f,r; float i = 0, e = 0; diff --git a/qcsrc/server/playerdemo.qc b/qcsrc/server/playerdemo.qc index 2450d58651..4a750be3e6 100644 --- a/qcsrc/server/playerdemo.qc +++ b/qcsrc/server/playerdemo.qc @@ -15,11 +15,11 @@ const float PLAYERDEMO_MODE_OFF = 0; const float PLAYERDEMO_MODE_READING = 1; const float PLAYERDEMO_MODE_WRITING = 2; void playerdemo_init() -{ +{SELFPARAM(); self.playerdemo_mode = PLAYERDEMO_MODE_OFF; } void playerdemo_shutdown() -{ +{SELFPARAM(); if(self.playerdemo_mode != PLAYERDEMO_MODE_OFF) { LOG_INFO("playerdemo: ", self.netname, " closed\n"); @@ -28,7 +28,7 @@ void playerdemo_shutdown() self.playerdemo_mode = 0; } void playerdemo_open_read(string f) -{ +{SELFPARAM(); playerdemo_shutdown(); self.playerdemo_mode = PLAYERDEMO_MODE_READING; self.playerdemo_fh = fopen(f, FILE_READ); @@ -39,7 +39,7 @@ void playerdemo_open_read(string f) LOG_INFO("playerdemo: ", self.netname, " reading from ", f, "\n"); } void playerdemo_open_write(string f) -{ +{SELFPARAM(); playerdemo_shutdown(); self.playerdemo_mode = PLAYERDEMO_MODE_WRITING; self.playerdemo_fh = fopen(f, FILE_WRITE); @@ -70,51 +70,51 @@ void playerdemo_open_write(string f) // end of list void playerdemo_write_originvector(.vector f, string name) -{ +{SELFPARAM(); fputs(self.playerdemo_fh, strcat(vtos(self.(f)), "\n")); } void playerdemo_write_sizevector(.vector f, string name) -{ +{SELFPARAM(); fputs(self.playerdemo_fh, strcat(vtos(self.(f)), "\n")); } void playerdemo_write_vector(.vector f, string name) -{ +{SELFPARAM(); fputs(self.playerdemo_fh, strcat(vtos(self.(f)), "\n")); } void playerdemo_write_string(.string f, string name) -{ +{SELFPARAM(); fputs(self.playerdemo_fh, strcat(self.(f), "\n")); } void playerdemo_write_modelstring(.string f, string name) -{ +{SELFPARAM(); fputs(self.playerdemo_fh, strcat(self.(f), "\n")); } void playerdemo_write_float(.float f, string name) -{ +{SELFPARAM(); fputs(self.playerdemo_fh, strcat(ftos(self.(f)), "\n")); } void playerdemo_write() -{ +{SELFPARAM(); if(self.playerdemo_mode != PLAYERDEMO_MODE_WRITING) return; fputs(self.playerdemo_fh, strcat(ftos(time - self.playerdemo_starttime), "\n")); PLAYERDEMO_FIELDS(playerdemo_write_) } void playerdemo_read_originvector(.vector f, string name) -{ +{SELFPARAM(); setorigin(self, stov(fgets(self.playerdemo_fh))); } void playerdemo_read_sizevector(.vector f, string name) -{ +{SELFPARAM(); self.(f) = stov(fgets(self.playerdemo_fh)); setsize(self, self.mins, self.maxs); } void playerdemo_read_vector(.vector f, string name) -{ +{SELFPARAM(); self.(f) = stov(fgets(self.playerdemo_fh)); } void playerdemo_read_string(.string f, string name) -{ +{SELFPARAM(); string s = fgets(self.playerdemo_fh); if (s != self.(f)) { @@ -126,17 +126,17 @@ void playerdemo_read_string(.string f, string name) } } void playerdemo_read_modelstring(.string f, string name) -{ +{SELFPARAM(); string s = fgets(self.playerdemo_fh); if (s != self.(f)) setmodel(self, s); } void playerdemo_read_float(.float f, string name) -{ +{SELFPARAM(); self.(f) = stof(fgets(self.playerdemo_fh)); } float playerdemo_read() -{ +{SELFPARAM(); if(self.playerdemo_mode != PLAYERDEMO_MODE_READING) return 0; if(self.playerdemo_time < 0) diff --git a/qcsrc/server/portals.qc b/qcsrc/server/portals.qc index 09cd6e9d20..e02c04d6b2 100644 --- a/qcsrc/server/portals.qc +++ b/qcsrc/server/portals.qc @@ -248,7 +248,7 @@ float Portal_WillHitPlane(vector eorg, vector emins, vector emaxs, vector evel, } void Portal_Touch() -{ +{SELFPARAM(); vector g; #ifdef PORTALS_ARE_NOT_SOLID @@ -427,7 +427,7 @@ void Portal_Remove(entity portal, float killed) } void Portal_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) -{ +{SELFPARAM(); if(deathtype == DEATH_TELEFRAG) return; if(attacker != self.aiment) @@ -439,7 +439,7 @@ void Portal_Damage(entity inflictor, entity attacker, float damage, int deathtyp } void Portal_Think_TryTeleportPlayer(entity e, vector g) -{ +{SELFPARAM(); if(!Portal_WillHitPlane(e.origin, e.mins, e.maxs, e.velocity + g, self.origin, v_forward, self.maxs.x)) return; @@ -451,7 +451,7 @@ void Portal_Think_TryTeleportPlayer(entity e, vector g) } void Portal_Think() -{ +{SELFPARAM(); entity e, o; vector g; @@ -494,7 +494,7 @@ void Portal_Think() } float Portal_Customize() -{ +{SELFPARAM(); if(IS_SPEC(other)) other = other.enemy; if(other == self.aiment) @@ -574,7 +574,7 @@ void Portal_ClearAll(entity own) W_Porto_Remove(own); } void Portal_RemoveLater_Think() -{ +{SELFPARAM(); Portal_Remove(self, self.cnt); } void Portal_RemoveLater(entity portal, float kill) diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index bffb221a24..e32f8b03fe 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -569,7 +569,7 @@ void dumpsurface(entity e) } void checkpoint_passed() -{ +{SELFPARAM(); string oldmsg; entity cp; @@ -724,7 +724,7 @@ void checkpoint_use() } float race_waypointsprite_visible_for_player(entity e) -{ +{SELFPARAM(); if(e.race_checkpoint == -1 || self.owner.race_checkpoint == -2) return true; else if(e.race_checkpoint == self.owner.race_checkpoint) @@ -735,7 +735,7 @@ float race_waypointsprite_visible_for_player(entity e) float have_verified; void trigger_race_checkpoint_verify() -{ +{SELFPARAM(); entity oldself, cp; float i, p; float qual; @@ -899,7 +899,7 @@ void trigger_race_checkpoint_verify() } vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector current) -{ +{SELFPARAM(); if(g_race_qualifying) { // spawn at first @@ -931,7 +931,7 @@ vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector } void spawnfunc_trigger_race_checkpoint() -{ +{SELFPARAM(); vector o; if(!g_race && !g_cts) { remove(self); return; } @@ -979,7 +979,7 @@ void spawnfunc_trigger_race_checkpoint() } void spawnfunc_target_checkpoint() // defrag entity -{ +{SELFPARAM(); vector o; if(!g_race && !g_cts) { remove(self); return; } defrag_ents = 1; @@ -1043,7 +1043,7 @@ void race_StartCompleting() } void race_PreparePlayer() -{ +{SELFPARAM(); race_ClearTime(self); self.race_place = 0; self.race_started = 0; @@ -1052,7 +1052,7 @@ void race_PreparePlayer() } void race_RetractPlayer() -{ +{SELFPARAM(); if(!g_race && !g_cts) return; if(self.race_respawn_checkpoint == 0 || self.race_respawn_checkpoint == race_timed_checkpoint) @@ -1061,7 +1061,7 @@ void race_RetractPlayer() } void spawnfunc_info_player_race (void) -{ +{SELFPARAM(); if(!g_race && !g_cts) { remove(self); return; } ++race_spawns; spawnfunc_info_player_deathmatch(); @@ -1073,7 +1073,7 @@ void spawnfunc_info_player_race (void) } void race_ClearRecords() -{ +{SELFPARAM(); float i; entity e; @@ -1131,7 +1131,7 @@ void race_ImposePenaltyTime(entity pl, float penalty, string reason) } void penalty_touch() -{ +{SELFPARAM(); EXACTTRIGGER_TOUCH; if(other.race_lastpenalty != self) { @@ -1141,12 +1141,12 @@ void penalty_touch() } void penalty_use() -{ +{SELFPARAM(); race_ImposePenaltyTime(activator, self.race_penalty, self.race_penalty_reason); } void spawnfunc_trigger_race_penalty() -{ +{SELFPARAM(); EXACTTRIGGER_INIT; self.use = penalty_use; diff --git a/qcsrc/server/round_handler.qc b/qcsrc/server/round_handler.qc index d5b0281338..0d608f9af7 100644 --- a/qcsrc/server/round_handler.qc +++ b/qcsrc/server/round_handler.qc @@ -5,7 +5,7 @@ #include "../common/util.qh" void round_handler_Think() -{ +{SELFPARAM(); float f; if(time < game_starttime) diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 57f5e95f8f..ad00c5437d 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -56,7 +56,7 @@ vector ScoreField_Compare(entity t1, entity t2, .float field, float fieldflags, */ float TeamScore_SendEntity(entity to, float sendflags) -{ +{SELFPARAM(); float i, p, longflags; WriteByte(MSG_ENTITY, ENT_CLIENT_TEAMSCORES); @@ -231,7 +231,7 @@ void ScoreInfo_Init(float teams) */ float PlayerScore_SendEntity(entity to, float sendflags) -{ +{SELFPARAM(); float i, p, longflags; WriteByte(MSG_ENTITY, ENT_CLIENT_SCORES); diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 6caba7c7db..928be465d1 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -10,7 +10,7 @@ #include "../warpzonelib/util_server.qh" float SpawnPoint_Send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT); WriteByte(MSG_ENTITY, self.team); @@ -22,7 +22,7 @@ float SpawnPoint_Send(entity to, int sf) } float SpawnEvent_Send(entity to, int sf) -{ +{SELFPARAM(); float send; WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNEVENT); @@ -46,7 +46,7 @@ float SpawnEvent_Send(entity to, int sf) } void spawnpoint_use() -{ +{SELFPARAM(); if(teamplay) if(have_team_spawns > 0) { @@ -57,7 +57,7 @@ void spawnpoint_use() } void relocate_spawnpoint() -{ +{SELFPARAM(); // nudge off the floor setorigin(self, self.origin + '0 0 1'); @@ -152,7 +152,7 @@ void spawnfunc_info_player_start (void) } void spawnfunc_info_player_deathmatch (void) -{ +{SELFPARAM(); self.classname = "info_player_deathmatch"; relocate_spawnpoint(); } @@ -161,7 +161,7 @@ void spawnfunc_info_player_deathmatch (void) Starting point for a player in team one (Red). Keys: "angle" viewing angle when spawning. */ void spawnfunc_info_player_team1() -{ +{SELFPARAM(); if(g_assault) { remove(self); return; } self.team = NUM_TEAM_1; // red @@ -173,7 +173,7 @@ void spawnfunc_info_player_team1() Starting point for a player in team two (Blue). Keys: "angle" viewing angle when spawning. */ void spawnfunc_info_player_team2() -{ +{SELFPARAM(); if(g_assault) { remove(self); return; } self.team = NUM_TEAM_2; // blue @@ -184,7 +184,7 @@ void spawnfunc_info_player_team2() Starting point for a player in team three (Yellow). Keys: "angle" viewing angle when spawning. */ void spawnfunc_info_player_team3() -{ +{SELFPARAM(); if(g_assault) { remove(self); return; } self.team = NUM_TEAM_3; // yellow @@ -196,7 +196,7 @@ void spawnfunc_info_player_team3() Starting point for a player in team four (Purple). Keys: "angle" viewing angle when spawning. */ void spawnfunc_info_player_team4() -{ +{SELFPARAM(); if(g_assault) { remove(self); return; } self.team = NUM_TEAM_4; // purple @@ -207,7 +207,7 @@ void spawnfunc_info_player_team4() // _x: prio (-1 if unusable) // _y: weight vector Spawn_Score(entity spot, float mindist, float teamcheck) -{ +{SELFPARAM(); float shortest, thisdist; float prio; entity player; @@ -332,7 +332,7 @@ Finds a point to respawn ============= */ entity SelectSpawnPoint (float anypoint) -{ +{SELFPARAM(); float teamcheck; entity spot, firstspot; diff --git a/qcsrc/server/steerlib.qc b/qcsrc/server/steerlib.qc index e57d56dd16..fcdbda9776 100644 --- a/qcsrc/server/steerlib.qc +++ b/qcsrc/server/steerlib.qc @@ -9,7 +9,7 @@ Uniform pull towards a point **/ vector steerlib_pull(vector point) -{ +{SELFPARAM(); return normalize(point - self.origin); } @@ -27,7 +27,7 @@ vector steerlib_push(vector point) Pull toward a point, The further away, the stronger the pull. **/ vector steerlib_arrive(vector point,float maximal_distance) -{ +{SELFPARAM(); float distance; vector direction; @@ -40,7 +40,7 @@ vector steerlib_arrive(vector point,float maximal_distance) Pull toward a point increasing the pull the closer we get **/ vector steerlib_attract(vector point, float maximal_distance) -{ +{SELFPARAM(); float distance; vector direction; @@ -51,7 +51,7 @@ vector steerlib_attract(vector point, float maximal_distance) } vector steerlib_attract2(vector point, float min_influense,float max_distance,float max_influense) -{ +{SELFPARAM(); float distance; vector direction; float influense; @@ -99,7 +99,7 @@ vector steerlib_attract2(vector point, float maximal_distance,float min_influens Move away from a point. **/ vector steerlib_repell(vector point,float maximal_distance) -{ +{SELFPARAM(); float distance; vector direction; @@ -113,7 +113,7 @@ vector steerlib_repell(vector point,float maximal_distance) Try to keep at ideal_distance away from point **/ vector steerlib_standoff(vector point,float ideal_distance) -{ +{SELFPARAM(); float distance; vector direction; @@ -140,7 +140,7 @@ vector steerlib_standoff(vector point,float ideal_distance) where range is the cicrle radius and tresh is how close we need to be to pick a new heading. **/ vector steerlib_wander(float range,float tresh,vector oldpoint) -{ +{SELFPARAM(); vector wander_point; wander_point = v_forward - oldpoint; @@ -159,7 +159,7 @@ vector steerlib_wander(float range,float tresh,vector oldpoint) Dodge a point. dont work to well. **/ vector steerlib_dodge(vector point,vector dodge_dir,float min_distance) -{ +{SELFPARAM(); float distance; distance = max(vlen(self.origin - point),min_distance); @@ -175,7 +175,7 @@ vector steerlib_dodge(vector point,vector dodge_dir,float min_distance) **/ .float flock_id; vector steerlib_flock(float _radius, float standoff,float separation_force,float flock_force) -{ +{SELFPARAM(); entity flock_member; vector push = '0 0 0', pull = '0 0 0'; float ccount = 0; @@ -201,7 +201,7 @@ vector steerlib_flock(float _radius, float standoff,float separation_force,float xy only version (for ground movers). **/ vector steerlib_flock2d(float _radius, float standoff,float separation_force,float flock_force) -{ +{SELFPARAM(); entity flock_member; vector push = '0 0 0', pull = '0 0 0'; float ccount = 0; @@ -232,7 +232,7 @@ vector steerlib_flock2d(float _radius, float standoff,float separation_force,flo This results in a aligned movement (?!) much like flocking. **/ vector steerlib_swarm(float _radius, float standoff,float separation_force,float swarm_force) -{ +{SELFPARAM(); entity swarm_member; vector force = '0 0 0', center = '0 0 0'; float ccount = 0; @@ -262,7 +262,7 @@ vector steerlib_swarm(float _radius, float standoff,float separation_force,float You need to call makevectors() (or equivalent) before this function to set v_forward and v_right **/ vector steerlib_traceavoid(float pitch,float length) -{ +{SELFPARAM(); vector vup_left,vup_right,vdown_left,vdown_right; float fup_left,fup_right,fdown_left,fdown_right; vector upwish,downwish,leftwish,rightwish; @@ -309,7 +309,7 @@ vector steerlib_traceavoid(float pitch,float length) Run tracelines in a forward trident, bias each direction negative if something is found there. **/ vector steerlib_traceavoid_flat(float pitch, float length, vector vofs) -{ +{SELFPARAM(); vector vt_left, vt_right,vt_front; float f_left, f_right,f_front; vector leftwish, rightwish,frontwish, v_left; @@ -381,7 +381,7 @@ float beamsweep_badpoint(vector point,float waterok) //#define BEAMSTEER_VISUAL float beamsweep(vector from, vector dir,float length, float step,float step_up, float step_down) -{ +{SELFPARAM(); float i; vector a,b,u,d; @@ -421,7 +421,7 @@ float beamsweep(vector from, vector dir,float length, float step,float step_up, } vector steerlib_beamsteer(vector dir, float length, float step, float step_up, float step_down) -{ +{SELFPARAM(); float bm_forward, bm_right, bm_left,p; vector vr,vl; @@ -497,7 +497,7 @@ vector steerlib_beamsteer(vector dir, float length, float step, float step_up, f //#define TLIBS_TETSLIBS #ifdef TLIBS_TETSLIBS void flocker_die() -{ +{SELFPARAM(); Send_Effect(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1); self.owner.cnt += 1; @@ -509,7 +509,7 @@ void flocker_die() void flocker_think() -{ +{SELFPARAM(); vector dodgemove,swarmmove; vector reprellmove,wandermove,newmove; @@ -547,7 +547,7 @@ void flocker_think() void spawn_flocker() -{ +{SELFPARAM(); entity flocker; flocker = spawn (); @@ -574,7 +574,7 @@ void spawn_flocker() } void flockerspawn_think() -{ +{SELFPARAM(); if(self.cnt > 0) @@ -585,7 +585,7 @@ void flockerspawn_think() } void flocker_hunter_think() -{ +{SELFPARAM(); vector dodgemove,attractmove,newmove; entity e,ee; float d,bd; @@ -640,7 +640,7 @@ void flocker_hunter_think() float globflockcnt; void spawnfunc_flockerspawn() -{ +{SELFPARAM(); precache_model ( "models/turrets/rocket.md3"); precache_model("models/turrets/c512.md3"); ++globflockcnt; diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 1f629af5cf..bfcf7ca3c7 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -28,7 +28,7 @@ .float lastground; void CreatureFrame (void) -{ +{SELFPARAM(); entity oldself; float dm; @@ -186,7 +186,7 @@ float game_delay_last; float RedirectionThink(); void StartFrame (void) -{ +{SELFPARAM(); execute_next_frame(); remove = remove_unsafely; // not during spawning! @@ -279,7 +279,7 @@ void StartFrame (void) .string cvarfilter; float DoesQ3ARemoveThisEntity(); void SV_OnEntityPreSpawnFunction() -{ +{SELFPARAM(); if (self) if (self.gametypefilter != "") if (!isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, self.gametypefilter)) diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index c78b2fda9c..49f0b10540 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -29,7 +29,7 @@ #ifdef CSQC void ItemDraw() -{ +{SELFPARAM(); if(self.gravity) { Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy); @@ -65,7 +65,7 @@ void ItemDraw() } void ItemDrawSimple() -{ +{SELFPARAM(); if(self.gravity) { Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy); @@ -76,7 +76,7 @@ void ItemDrawSimple() } void ItemRead(float _IsNew) -{ +{SELFPARAM(); int sf = ReadByte(); if(sf & ISF_LOCATION) @@ -229,7 +229,7 @@ void ItemRead(float _IsNew) #ifdef SVQC bool ItemSend(entity to, int sf) -{ +{SELFPARAM(); if(self.gravity) sf |= ISF_DROP; else @@ -295,7 +295,7 @@ void ItemUpdate(entity item) } float have_pickup_item(void) -{ +{SELFPARAM(); if(self.flags & FL_POWERUP) { if(autocvar_g_powerups > 0) @@ -401,7 +401,7 @@ void Item_Show (entity e, float mode) } void Item_Think() -{ +{SELFPARAM(); self.nextthink = time; if(self.origin != self.oldorigin) { @@ -417,7 +417,7 @@ void Item_ItemsTime_SetTime(entity e, float t); void Item_ItemsTime_SetTimesForAllPlayers(); void Item_Respawn (void) -{ +{SELFPARAM(); Item_Show(self, 1); // this is ugly... if(self.items == ITEM_Strength.m_itemid) @@ -443,7 +443,7 @@ void Item_Respawn (void) } void Item_RespawnCountdown (void) -{ +{SELFPARAM(); if(self.count >= ITEM_RESPAWN_TICKS) { if(self.waypointsprite_attached) @@ -497,7 +497,7 @@ void Item_RespawnCountdown (void) } void Item_RespawnThink() -{ +{SELFPARAM(); self.nextthink = time; if(self.origin != self.oldorigin) { @@ -677,7 +677,7 @@ float Item_GiveTo(entity item, entity player) } void Item_Touch (void) -{ +{SELFPARAM(); entity e, head; // remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky) @@ -756,7 +756,7 @@ void Item_Touch (void) } void Item_Reset() -{ +{SELFPARAM(); Item_Show(self, !self.state); setorigin (self, self.origin); @@ -774,7 +774,7 @@ void Item_Reset() } void Item_FindTeam() -{ +{SELFPARAM(); entity head, e; if(self.effects & EF_NODRAW) @@ -806,7 +806,7 @@ void Item_FindTeam() // Savage: used for item garbage-collection // TODO: perhaps nice special effect? void RemoveItem(void) -{ +{SELFPARAM(); Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1); remove(self); } @@ -939,7 +939,7 @@ void Item_Damage(entity inflictor, entity attacker, float damage, int deathtype, } void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue) -{ +{SELFPARAM(); startitem_failed = false; if(self.model == "") @@ -1170,12 +1170,13 @@ string Item_Model(string item_mdl) } void StartItemA (entity a) -{ +{SELFPARAM(); self.itemdef = a; StartItem(Item_Model(a.m_model), a.m_sound, a.m_respawntime(), a.m_respawntimejitter(), a.m_name, a.m_itemid, 0, a.m_itemflags, a.m_pickupevalfunc, a.m_botvalue); } -void spawnfunc_item_rockets (void) { +void spawnfunc_item_rockets() +{SELFPARAM(); if(!self.ammo_rockets) self.ammo_rockets = g_pickup_rockets; if(!self.pickup_anyway) @@ -1183,7 +1184,8 @@ void spawnfunc_item_rockets (void) { StartItemA (ITEM_Rockets); } -void spawnfunc_item_bullets (void) { +void spawnfunc_item_bullets() +{SELFPARAM(); if(!weaponswapping) if(autocvar_sv_q3acompat_machineshotgunswap) if(self.classname != "droppedweapon") @@ -1201,7 +1203,8 @@ void spawnfunc_item_bullets (void) { StartItemA (ITEM_Bullets); } -void spawnfunc_item_cells (void) { +void spawnfunc_item_cells() +{SELFPARAM(); if(!self.ammo_cells) self.ammo_cells = g_pickup_cells; if(!self.pickup_anyway) @@ -1210,7 +1213,7 @@ void spawnfunc_item_cells (void) { } void spawnfunc_item_plasma() -{ +{SELFPARAM(); if(!self.ammo_plasma) self.ammo_plasma = g_pickup_plasma; if(!self.pickup_anyway) @@ -1218,7 +1221,8 @@ void spawnfunc_item_plasma() StartItemA (ITEM_Plasma); } -void spawnfunc_item_shells (void) { +void spawnfunc_item_shells() +{SELFPARAM(); if(!weaponswapping) if(autocvar_sv_q3acompat_machineshotgunswap) if(self.classname != "droppedweapon") @@ -1236,7 +1240,8 @@ void spawnfunc_item_shells (void) { StartItemA (ITEM_Shells); } -void spawnfunc_item_armor_small (void) { +void spawnfunc_item_armor_small() +{SELFPARAM(); if(!self.armorvalue) self.armorvalue = g_pickup_armorsmall; if(!self.max_armorvalue) @@ -1246,7 +1251,8 @@ void spawnfunc_item_armor_small (void) { StartItemA (ITEM_ArmorSmall); } -void spawnfunc_item_armor_medium (void) { +void spawnfunc_item_armor_medium() +{SELFPARAM(); if(!self.armorvalue) self.armorvalue = g_pickup_armormedium; if(!self.max_armorvalue) @@ -1256,7 +1262,8 @@ void spawnfunc_item_armor_medium (void) { StartItemA (ITEM_ArmorMedium); } -void spawnfunc_item_armor_big (void) { +void spawnfunc_item_armor_big() +{SELFPARAM(); if(!self.armorvalue) self.armorvalue = g_pickup_armorbig; if(!self.max_armorvalue) @@ -1266,7 +1273,8 @@ void spawnfunc_item_armor_big (void) { StartItemA (ITEM_ArmorLarge); } -void spawnfunc_item_armor_large (void) { +void spawnfunc_item_armor_large() +{SELFPARAM(); if(!self.armorvalue) self.armorvalue = g_pickup_armorlarge; if(!self.max_armorvalue) @@ -1276,7 +1284,8 @@ void spawnfunc_item_armor_large (void) { StartItemA (ITEM_ArmorMega); } -void spawnfunc_item_health_small (void) { +void spawnfunc_item_health_small() +{SELFPARAM(); if(!self.max_health) self.max_health = g_pickup_healthsmall_max; if(!self.health) @@ -1286,7 +1295,8 @@ void spawnfunc_item_health_small (void) { StartItemA (ITEM_HealthSmall); } -void spawnfunc_item_health_medium (void) { +void spawnfunc_item_health_medium() +{SELFPARAM(); if(!self.max_health) self.max_health = g_pickup_healthmedium_max; if(!self.health) @@ -1296,7 +1306,8 @@ void spawnfunc_item_health_medium (void) { StartItemA (ITEM_HealthMedium); } -void spawnfunc_item_health_large (void) { +void spawnfunc_item_health_large() +{SELFPARAM(); if(!self.max_health) self.max_health = g_pickup_healthlarge_max; if(!self.health) @@ -1306,7 +1317,8 @@ void spawnfunc_item_health_large (void) { StartItemA (ITEM_HealthLarge); } -void spawnfunc_item_health_mega (void) { +void spawnfunc_item_health_mega() +{SELFPARAM(); if(!self.max_health) self.max_health = g_pickup_healthmega_max; if(!self.health) @@ -1323,24 +1335,26 @@ void spawnfunc_item_health1() { spawnfunc_item_health_small(); } void spawnfunc_item_health25() { spawnfunc_item_health_medium(); } void spawnfunc_item_health100() { spawnfunc_item_health_mega(); } -void spawnfunc_item_strength (void) { +void spawnfunc_item_strength() +{SELFPARAM(); precache_sound("weapons/strength_fire.wav"); if(!self.strength_finished) self.strength_finished = autocvar_g_balance_powerup_strength_time; StartItemA (ITEM_Strength); } -void spawnfunc_item_invincible (void) { +void spawnfunc_item_invincible() +{SELFPARAM(); if(!self.invincible_finished) self.invincible_finished = autocvar_g_balance_powerup_invincible_time; StartItemA (ITEM_Shield); } // compatibility: -void spawnfunc_item_quad (void) {self.classname = "item_strength";spawnfunc_item_strength();} +void spawnfunc_item_quad() {SELFPARAM(); self.classname = "item_strength";spawnfunc_item_strength();} -void target_items_use (void) -{ +void target_items_use() +{SELFPARAM(); if(activator.classname == "droppedweapon") { EXACTTRIGGER_TOUCH; @@ -1364,7 +1378,7 @@ void target_items_use (void) } void spawnfunc_target_items (void) -{ +{SELFPARAM(); float n, i, j; entity e; string s; @@ -1489,7 +1503,7 @@ void spawnfunc_target_items (void) } void spawnfunc_item_fuel(void) -{ +{SELFPARAM(); if(!self.ammo_fuel) self.ammo_fuel = g_pickup_fuel; if(!self.pickup_anyway) @@ -1508,7 +1522,7 @@ void spawnfunc_item_fuel_regen(void) } void spawnfunc_item_jetpack(void) -{ +{SELFPARAM(); if(!self.ammo_fuel) self.ammo_fuel = g_pickup_fuel_jetpack; if(start_items & ITEM_Jetpack.m_itemid) @@ -1629,7 +1643,7 @@ void GiveRot(entity e, float v0, float v1, .float rotfield, float rottime, .floa e.(regenfield) = max(e.(regenfield), time + regentime); } float GiveItems(entity e, float beginarg, float endarg) -{ +{SELFPARAM(); float got, i, j, val, op; float _switchweapon; entity wi; diff --git a/qcsrc/server/t_quake.qc b/qcsrc/server/t_quake.qc index 517b880822..74a324b981 100644 --- a/qcsrc/server/t_quake.qc +++ b/qcsrc/server/t_quake.qc @@ -14,15 +14,15 @@ void spawnfunc_item_health_medium(); //*********************** //QUAKE 1 ENTITIES - So people can play quake1 maps with the xonotic weapons //*********************** -void spawnfunc_weapon_nailgun (void) {spawnfunc_weapon_electro();} -void spawnfunc_weapon_supernailgun (void) {spawnfunc_weapon_hagar();} -void spawnfunc_weapon_supershotgun (void) {spawnfunc_weapon_machinegun();} - -void spawnfunc_item_spikes (void) {spawnfunc_item_bullets();} -//void spawnfunc_item_armor1 (void) {spawnfunc_item_armor_medium;} // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard -void spawnfunc_item_armor2 (void) {spawnfunc_item_armor_large();} -void item_armorInv (void) {spawnfunc_item_armor_large();} -void spawnfunc_item_health (void) {if (self.spawnflags & 2) spawnfunc_item_health_mega();else spawnfunc_item_health_medium();} +void spawnfunc_weapon_nailgun() {spawnfunc_weapon_electro();} +void spawnfunc_weapon_supernailgun() {spawnfunc_weapon_hagar();} +void spawnfunc_weapon_supershotgun() {spawnfunc_weapon_machinegun();} + +void spawnfunc_item_spikes() {spawnfunc_item_bullets();} +//void spawnfunc_item_armor1() {spawnfunc_item_armor_medium;} // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard +void spawnfunc_item_armor2() {spawnfunc_item_armor_large();} +void item_armorInv() {spawnfunc_item_armor_large();} +void spawnfunc_item_health() {SELFPARAM();if (self.spawnflags & 2) spawnfunc_item_health_mega();else spawnfunc_item_health_medium();} //spawnfunc_item_spikes //spawnfunc_item_health diff --git a/qcsrc/server/t_quake3.qc b/qcsrc/server/t_quake3.qc index 6908b6dbf1..d20c90055d 100644 --- a/qcsrc/server/t_quake3.qc +++ b/qcsrc/server/t_quake3.qc @@ -85,7 +85,7 @@ void target_init_verify() } void spawnfunc_target_init() -{ +{SELFPARAM(); self.spawnflags = 0; // remove all weapons except the ones listed below self.netname = "shotgun"; // keep these weapons through the remove trigger spawnfunc_target_items(); @@ -94,7 +94,7 @@ void spawnfunc_target_init() // weapon give ent from defrag void target_give_init() -{ +{SELFPARAM(); entity targ; for (targ = world; (targ = find(targ, targetname, self.target)); ) { if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") { @@ -136,7 +136,7 @@ void target_give_init() } void spawnfunc_target_give() -{ +{SELFPARAM(); InitializeEntity(self, target_give_init, INITPRIO_FINDTARGET); } @@ -152,7 +152,7 @@ void spawnfunc_target_give() // CTF spawnfuncs handled in mutators/gamemode_ctf.qc now void spawnfunc_item_flight() -{ +{SELFPARAM(); if(!cvar("g_buffs") || !cvar("g_buffs_flight")) spawnfunc_item_jetpack(); else @@ -166,7 +166,7 @@ void spawnfunc_item_flight() .float notta; .string gametype; float DoesQ3ARemoveThisEntity() -{ +{SELFPARAM(); // Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY) if(self.notq3a) diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index b14386bd49..25adab26d5 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -267,7 +267,8 @@ void InitGameplayMode() InitializeEntity(world, default_delayedinit, INITPRIO_GAMETYPE_FALLBACK); } -string GetClientVersionMessage() { +string GetClientVersionMessage() +{SELFPARAM(); string versionmsg; if (self.version_mismatch) { if(self.version < autocvar_gameversion) { @@ -396,7 +397,7 @@ void SetPlayerTeam(entity pl, float t, float s, float noprint) // set c1...c4 to show what teams are allowed void CheckAllowedTeams (entity for_whom) -{ +{SELFPARAM(); float dm; entity head; string teament_name; @@ -702,7 +703,7 @@ float FindSmallestTeam(entity pl, float ignore_pl) } float JoinBestTeam(entity pl, float only_return_best, float forcebestteam) -{ +{SELFPARAM(); float smallest, selectedteam; // don't join a team if we're not playing a team game @@ -779,7 +780,7 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam) //void() ctf_playerchanged; void SV_ChangeTeam(float _color) -{ +{SELFPARAM(); float scolor, dcolor, steam, dteam; //, dbotcount, scount, dcount; // in normal deathmatch we can just apply the color and we're done diff --git a/qcsrc/server/weapons/accuracy.qc b/qcsrc/server/weapons/accuracy.qc index d0dda35af1..d78d93c873 100644 --- a/qcsrc/server/weapons/accuracy.qc +++ b/qcsrc/server/weapons/accuracy.qc @@ -18,7 +18,7 @@ float accuracy_byte(float n, float d) } float accuracy_send(entity to, int sf) -{ +{SELFPARAM(); int w, f; entity a; WriteByte(MSG_ENTITY, ENT_CLIENT_ACCURACY); diff --git a/qcsrc/server/weapons/common.qc b/qcsrc/server/weapons/common.qc index 8c3c883815..f841fecf69 100644 --- a/qcsrc/server/weapons/common.qc +++ b/qcsrc/server/weapons/common.qc @@ -9,7 +9,7 @@ #include "../../common/weapons/all.qh" void W_GiveWeapon (entity e, float wep) -{ +{SELFPARAM(); entity oldself; if (!wep) @@ -81,7 +81,7 @@ float W_CheckProjectileDamage(entity inflictor, entity projowner, int deathtype, } void W_PrepareExplosionByDamage(entity attacker, void() explode) -{ +{SELFPARAM(); self.takedamage = DAMAGE_NO; self.event_damage = func_null; diff --git a/qcsrc/server/weapons/csqcprojectile.qc b/qcsrc/server/weapons/csqcprojectile.qc index 507fc4a413..36d037167b 100644 --- a/qcsrc/server/weapons/csqcprojectile.qc +++ b/qcsrc/server/weapons/csqcprojectile.qc @@ -11,7 +11,7 @@ .float csqcprojectile_type; bool CSQCProjectile_SendEntity(entity to, int sf) -{ +{SELFPARAM(); float ft, fr; // note: flag 0x08 = no trail please (teleport bit) diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index d563ac2d84..f7fc6f9dc7 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -18,7 +18,7 @@ void Send_WeaponComplain(entity e, float wpn, float type) } float client_hasweapon(entity cl, float wpn, float andammo, float complain) -{ +{SELFPARAM(); float f; entity oldself; @@ -115,7 +115,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) } float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain, float skipmissing) -{ +{SELFPARAM(); // We cannot tokenize in this function, as GiveItems calls this // function. Thus we must use car/cdr. float weaponwant, first_valid, prev_valid, switchtonext, switchtolast; @@ -254,7 +254,7 @@ void W_SwitchToOtherWeapon(entity pl) } void W_SwitchWeapon(float imp) -{ +{SELFPARAM(); if (self.switchweapon != imp) { if (client_hasweapon(self, imp, true, true)) @@ -266,7 +266,7 @@ void W_SwitchWeapon(float imp) } void W_CycleWeapon(string weaponorder, float dir) -{ +{SELFPARAM(); float w; w = W_GetCycleWeapon(self, weaponorder, dir, -1, 1, true); if(w > 0) @@ -274,7 +274,7 @@ void W_CycleWeapon(string weaponorder, float dir) } void W_NextWeaponOnImpulse(float imp) -{ +{SELFPARAM(); float w; w = W_GetCycleWeapon(self, self.cvar_cl_weaponpriority, +1, imp, 1, (self.cvar_cl_weaponimpulsemode == 0)); if(w > 0) @@ -283,7 +283,7 @@ void W_NextWeaponOnImpulse(float imp) // next weapon void W_NextWeapon(float list) -{ +{SELFPARAM(); if(list == 0) W_CycleWeapon(weaponorder_byid, -1); else if(list == 1) @@ -294,7 +294,7 @@ void W_NextWeapon(float list) // prev weapon void W_PreviousWeapon(float list) -{ +{SELFPARAM(); if(list == 0) W_CycleWeapon(weaponorder_byid, +1); else if(list == 1) @@ -305,7 +305,7 @@ void W_PreviousWeapon(float list) // previously used if exists and has ammo, (second) best otherwise void W_LastWeapon(void) -{ +{SELFPARAM(); if(client_hasweapon(self, self.cnt, true, false)) W_SwitchWeapon(self.cnt); else diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index 3c3c9d8069..73ce1de78a 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -35,7 +35,7 @@ string W_Apply_Weaponreplace(string in) } void weapon_defaultspawnfunc(float wpn) -{ +{SELFPARAM(); entity e; float t; string s; diff --git a/qcsrc/server/weapons/throwing.qc b/qcsrc/server/weapons/throwing.qc index 89ec52f217..5c3b11dd3b 100644 --- a/qcsrc/server/weapons/throwing.qc +++ b/qcsrc/server/weapons/throwing.qc @@ -11,7 +11,7 @@ #include "../../common/weapons/all.qh" void thrown_wep_think() -{ +{SELFPARAM(); self.nextthink = time; if(self.oldorigin != self.origin) { @@ -30,7 +30,7 @@ void thrown_wep_think() // returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo) -{ +{SELFPARAM(); entity oldself, wep; float thisammo, i; string s; @@ -166,7 +166,7 @@ float W_IsWeaponThrowable(float w) // toss current weapon void W_ThrowWeapon(vector velo, vector delta, float doreduce) -{ +{SELFPARAM(); float w; string a; @@ -194,7 +194,7 @@ void W_ThrowWeapon(vector velo, vector delta, float doreduce) } void SpawnThrownWeapon(vector org, float w) -{ +{SELFPARAM(); if(self.weapons & WepSet_FromWeapon(self.weapon)) if(W_IsWeaponThrowable(self.weapon)) W_ThrowNewWeapon(self, self.weapon, false, org, randomvec() * 125 + '0 0 200'); diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index eec32a3e51..7c033fa889 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -194,7 +194,7 @@ void W_SetupProjVelocity_Explicit(entity proj, vector dir, vector upDir, float p // ==================== void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, int deathtype) -{ +{SELFPARAM(); vector hitloc, force, endpoint, dir; entity ent, endent; float endq3surfaceflags; @@ -345,7 +345,7 @@ void fireBullet_trace_callback(vector start, vector hit, vector end) } void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects) -{ +{SELFPARAM(); vector end; dir = normalize(dir + randomvec() * spread); diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index f53e3c53d0..8be3a668f7 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -50,7 +50,7 @@ float W_WeaponSpeedFactor() void(float fr, float t, void() func) weapon_thinkf; float CL_Weaponentity_CustomizeEntityForClient() -{ +{SELFPARAM(); self.viewmodelforclient = self.owner; if(IS_SPEC(other)) if(other.enemy == self.owner) @@ -110,7 +110,7 @@ float CL_Weaponentity_CustomizeEntityForClient() // call again with "" // remove the ent void CL_WeaponEntity_SetModel(string name) -{ +{SELFPARAM(); float v_shot_idx; if (name != "") { @@ -269,7 +269,7 @@ void CL_WeaponEntity_SetModel(string name) } vector CL_Weapon_GetShotOrg(float wpn) -{ +{SELFPARAM(); entity wi, oldself; vector ret; wi = get_weaponinfo(wpn); @@ -284,7 +284,7 @@ vector CL_Weapon_GetShotOrg(float wpn) } void CL_Weaponentity_Think() -{ +{SELFPARAM(); int tb; self.nextthink = time; if (intermission_running) @@ -360,7 +360,7 @@ void CL_Weaponentity_Think() } void CL_ExteriorWeaponentity_Think() -{ +{SELFPARAM(); float tag_found; self.nextthink = time; if (self.owner.exteriorweaponentity != self) @@ -404,46 +404,41 @@ void CL_ExteriorWeaponentity_Think() self.glowmod = self.owner.weaponentity_glowmod; self.colormap = self.owner.colormap; - CSQCMODEL_AUTOUPDATE(); + CSQCMODEL_AUTOUPDATE(self); } // spawning weaponentity for client -void CL_SpawnWeaponentity() +void CL_SpawnWeaponentity(entity e) { - self.weaponentity = spawn(); - self.weaponentity.classname = "weaponentity"; - self.weaponentity.solid = SOLID_NOT; - self.weaponentity.owner = self; - setmodel(self.weaponentity, ""); // precision set when changed - setorigin(self.weaponentity, '0 0 0'); - self.weaponentity.angles = '0 0 0'; - self.weaponentity.viewmodelforclient = self; - self.weaponentity.flags = 0; - self.weaponentity.think = CL_Weaponentity_Think; - self.weaponentity.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient; - self.weaponentity.nextthink = time; - - self.exteriorweaponentity = spawn(); - self.exteriorweaponentity.classname = "exteriorweaponentity"; - self.exteriorweaponentity.solid = SOLID_NOT; - self.exteriorweaponentity.exteriorweaponentity = self.exteriorweaponentity; - self.exteriorweaponentity.owner = self; - setorigin(self.exteriorweaponentity, '0 0 0'); - self.exteriorweaponentity.angles = '0 0 0'; - self.exteriorweaponentity.think = CL_ExteriorWeaponentity_Think; - self.exteriorweaponentity.nextthink = time; - - { - entity oldself = self; - self = self.exteriorweaponentity; - CSQCMODEL_AUTOINIT(); - self = oldself; - } + entity view = e.weaponentity = spawn(); + view.classname = "weaponentity"; + view.solid = SOLID_NOT; + view.owner = e; + setmodel(view, ""); // precision set when changed + setorigin(view, '0 0 0'); + view.angles = '0 0 0'; + view.viewmodelforclient = e; + view.flags = 0; + view.think = CL_Weaponentity_Think; + view.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient; + view.nextthink = time; + + entity exterior = e.exteriorweaponentity = spawn(); + exterior.classname = "exteriorweaponentity"; + exterior.solid = SOLID_NOT; + exterior.exteriorweaponentity = exterior; + exterior.owner = e; + setorigin(exterior, '0 0 0'); + exterior.angles = '0 0 0'; + exterior.think = CL_ExteriorWeaponentity_Think; + exterior.nextthink = time; + + CSQCMODEL_AUTOINIT(exterior); } // Weapon subs void w_clear() -{ +{SELFPARAM(); if (self.weapon != -1) { self.weapon = 0; @@ -457,7 +452,7 @@ void w_clear() } void w_ready() -{ +{SELFPARAM(); if (self.weaponentity) self.weaponentity.state = WS_READY; weapon_thinkf(WFRAME_IDLE, 1000000, w_ready); @@ -466,7 +461,7 @@ void w_ready() .float prevdryfire; .float prevwarntime; float weapon_prepareattack_checkammo(float secondary) -{ +{SELFPARAM(); if (!(self.items & IT_UNLIMITED_WEAPON_AMMO)) if (!WEP_ACTION(self.weapon, WR_CHECKAMMO1 + secondary)) { @@ -513,7 +508,7 @@ float weapon_prepareattack_checkammo(float secondary) } .float race_penalty; float weapon_prepareattack_check(float secondary, float attacktime) -{ +{SELFPARAM(); if(!weapon_prepareattack_checkammo(secondary)) return false; @@ -543,7 +538,7 @@ float weapon_prepareattack_check(float secondary, float attacktime) return true; } float weapon_prepareattack_do(float secondary, float attacktime) -{ +{SELFPARAM(); self.weaponentity.state = WS_INUSE; self.spawnshieldtime = min(self.spawnshieldtime, time); // kill spawn shield when you fire @@ -574,7 +569,7 @@ float weapon_prepareattack(float secondary, float attacktime) } void weapon_thinkf(float fr, float t, void() func) -{ +{SELFPARAM(); vector a; vector of, or, ou; float restartanim; @@ -665,7 +660,7 @@ float forbidWeaponUse(entity player) } void W_WeaponFrame() -{ +{SELFPARAM(); vector fo, ri, up; if (frametime) @@ -796,7 +791,7 @@ void W_WeaponFrame() } void W_AttachToShotorg(entity flash, vector offset) -{ +{SELFPARAM(); entity xflash; flash.owner = self; flash.angles_z = random() * 360; @@ -828,7 +823,7 @@ void W_AttachToShotorg(entity flash, vector offset) } void W_DecreaseAmmo(float ammo_use) -{ +{SELFPARAM(); entity wep = get_weaponinfo(self.weapon); if(cvar("g_overkill")) @@ -872,7 +867,7 @@ void W_DecreaseAmmo(float ammo_use) .string reload_sound; void W_ReloadedAndReady() -{ +{SELFPARAM(); // finish the reloading process, and do the ammo transfer self.clip_load = self.old_clip_load; // restore the ammo counter, in case we still had ammo in the weapon before reloading @@ -899,7 +894,7 @@ void W_ReloadedAndReady() } void W_Reload(float sent_ammo_min, string sent_sound) -{ +{SELFPARAM(); // set global values to work with entity e; e = get_weaponinfo(self.weapon); @@ -976,7 +971,7 @@ void W_Reload(float sent_ammo_min, string sent_sound) } void W_DropEvent(float event, entity player, float weapon_type, entity weapon_item) -{ +{SELFPARAM(); entity oldself = self; self = player; weapon_dropevent_item = weapon_item; diff --git a/qcsrc/server/weapons/weaponsystem.qh b/qcsrc/server/weapons/weaponsystem.qh index e466449e6e..41b382d971 100644 --- a/qcsrc/server/weapons/weaponsystem.qh +++ b/qcsrc/server/weapons/weaponsystem.qh @@ -14,7 +14,7 @@ const float WFRAME_FIRE2 = 1; const float WFRAME_IDLE = 2; const float WFRAME_RELOAD = 3; -void CL_SpawnWeaponentity(); +void CL_SpawnWeaponentity(entity e); vector CL_Weapon_GetShotOrg(float wpn); diff --git a/qcsrc/warpzonelib/client.qc b/qcsrc/warpzonelib/client.qc index e0bb643458..85fbdd933e 100644 --- a/qcsrc/warpzonelib/client.qc +++ b/qcsrc/warpzonelib/client.qc @@ -10,7 +10,7 @@ #endif void WarpZone_Fade_PreDraw() -{ +{SELFPARAM(); vector org; org = getpropertyvec(VF_ORIGIN); if(!checkpvs(org, self)) // this makes sense as long as we don't support recursive warpzones @@ -27,7 +27,7 @@ void WarpZone_Fade_PreDraw() } void WarpZone_Read(float isnew) -{ +{SELFPARAM(); warpzone_warpzones_exist = 1; if (!self.enemy) { @@ -92,7 +92,7 @@ void WarpZone_Read(float isnew) } void WarpZone_Camera_Read(float isnew) -{ +{SELFPARAM(); warpzone_cameras_exist = 1; self.classname = "func_warpzone_camera"; @@ -149,7 +149,7 @@ void WarpZone_Camera_Read(float isnew) void CL_RotateMoves(vector ang) = #638; void WarpZone_Teleported_Read(float isnew) -{ +{SELFPARAM(); vector v; self.classname = "warpzone_teleported"; v.x = ReadCoord(); diff --git a/qcsrc/warpzonelib/common.qc b/qcsrc/warpzonelib/common.qc index d04b768f88..7b0b9e723f 100644 --- a/qcsrc/warpzonelib/common.qc +++ b/qcsrc/warpzonelib/common.qc @@ -43,7 +43,7 @@ void WarpZone_Accumulator_AddInverse(entity acc, entity wz) .vector(vector, vector) camera_transform; float autocvar_cl_warpzone_usetrace = 1; vector WarpZone_camera_transform(vector org, vector ang) -{ +{SELFPARAM(); vector vf, vr, vu; if(self.warpzone_fadestart) if(vlen(org - self.origin - 0.5 * (self.mins + self.maxs)) > self.warpzone_fadeend + 400) @@ -81,7 +81,7 @@ void WarpZone_SetUp(entity e, vector my_org, vector my_ang, vector other_org, ve } vector WarpZone_Camera_camera_transform(vector org, vector ang) -{ +{SELFPARAM(); // a fixed camera view if(self.warpzone_fadestart) if(vlen(org - self.origin - 0.5 * (self.mins + self.maxs)) > self.warpzone_fadeend + 400) @@ -698,7 +698,7 @@ entity WarpZone_FindRadius(vector org, float rad, float needlineofsight) .entity WarpZone_refsys; void WarpZone_RefSys_GC() -{ +{SELFPARAM(); // garbage collect unused reference systems self.nextthink = time + 1; if(self.owner.WarpZone_refsys != self) @@ -818,7 +818,7 @@ entity WarpZone_RefSys_SpawnSameRefSys(entity me) } float WarpZoneLib_ExactTrigger_Touch() -{ +{SELFPARAM(); return !WarpZoneLib_BoxTouchesBrush(other.absmin, other.absmax, self, other); } diff --git a/qcsrc/warpzonelib/server.qc b/qcsrc/warpzonelib/server.qc index b5c6f656a4..8d5a6b68a8 100644 --- a/qcsrc/warpzonelib/server.qc +++ b/qcsrc/warpzonelib/server.qc @@ -54,7 +54,7 @@ void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector } bool WarpZone_Teleported_Send(entity to, int sf) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED); WriteCoord(MSG_ENTITY, self.angles.x); WriteCoord(MSG_ENTITY, self.angles.y); @@ -158,7 +158,7 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1) } void WarpZone_Touch (void) -{ +{SELFPARAM(); entity oldself; if(other.classname == "trigger_warpzone") @@ -221,7 +221,7 @@ void WarpZone_Touch (void) } bool WarpZone_Send(entity to, int sendflags) -{ +{SELFPARAM(); WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE); // we must send this flag for clientside to match properly too @@ -275,7 +275,7 @@ bool WarpZone_Send(entity to, int sendflags) } bool WarpZone_Camera_Send(entity to, int sendflags) -{ +{SELFPARAM(); int f = 0; WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA); @@ -321,7 +321,7 @@ bool WarpZone_Camera_Send(entity to, int sendflags) #ifdef WARPZONELIB_KEEPDEBUG float WarpZone_CheckProjectileImpact(entity player) -{ +{SELFPARAM(); vector o0, v0; o0 = player.origin + player.view_ofs; @@ -388,7 +388,7 @@ float WarpZone_CheckProjectileImpact(entity player) #endif float WarpZone_Projectile_Touch() -{ +{SELFPARAM(); if(other.classname == "trigger_warpzone") return true; @@ -456,7 +456,7 @@ float WarpZone_Projectile_Touch() } void WarpZone_InitStep_FindOriginTarget() -{ +{SELFPARAM(); if(self.killtarget != "") { self.aiment = find(world, targetname, self.killtarget); @@ -470,7 +470,7 @@ void WarpZone_InitStep_FindOriginTarget() } void WarpZonePosition_InitStep_FindTarget() -{ +{SELFPARAM(); if(self.target == "") { error("Warp zone position with no target"); @@ -492,7 +492,7 @@ void WarpZonePosition_InitStep_FindTarget() } void WarpZoneCamera_Think(void) -{ +{SELFPARAM(); if(self.warpzone_save_origin != self.origin || self.warpzone_save_angles != self.angles || self.warpzone_save_eorigin != self.enemy.origin @@ -508,7 +508,7 @@ void WarpZoneCamera_Think(void) } void WarpZoneCamera_InitStep_FindTarget() -{ +{SELFPARAM(); entity e; float i; if(self.target == "") @@ -538,7 +538,7 @@ void WarpZoneCamera_InitStep_FindTarget() } void WarpZone_InitStep_UpdateTransform() -{ +{SELFPARAM(); vector org, ang, norm, point; float area; vector tri, a, b, c, n; @@ -619,7 +619,7 @@ void WarpZone_InitStep_UpdateTransform() } void WarpZone_InitStep_ClearTarget() -{ +{SELFPARAM(); if(self.enemy) self.enemy.enemy = world; self.enemy = world; @@ -627,7 +627,7 @@ void WarpZone_InitStep_ClearTarget() entity warpzone_first; .entity warpzone_next; void WarpZone_InitStep_FindTarget() -{ +{SELFPARAM(); float i; entity e, e2; @@ -658,7 +658,7 @@ void WarpZone_InitStep_FindTarget() void WarpZone_Think(); void WarpZone_InitStep_FinalizeTransform() -{ +{SELFPARAM(); if(!self.enemy || self.enemy.enemy != self) { error("Invalid warp zone detected. Killed."); @@ -684,7 +684,7 @@ entity warpzone_position_first; entity warpzone_camera_first; .entity warpzone_next; void spawnfunc_misc_warpzone_position(void) -{ +{SELFPARAM(); // "target", "angles", "origin" self.warpzone_next = warpzone_position_first; warpzone_position_first = self; @@ -694,7 +694,7 @@ void spawnfunc_trigger_warpzone_position(void) spawnfunc_misc_warpzone_position(); } void spawnfunc_trigger_warpzone(void) -{ +{SELFPARAM(); // warp zone entities must have: // "killtarget" pointing to a target_position with a direction arrow // that points AWAY from the warp zone, and that is inside @@ -732,7 +732,7 @@ void spawnfunc_trigger_warpzone(void) warpzone_first = self; } void spawnfunc_func_camera(void) -{ +{SELFPARAM(); if(!self.scale) self.scale = self.modelscale; if(!self.scale) @@ -757,7 +757,7 @@ void spawnfunc_func_camera(void) warpzone_camera_first = self; } void WarpZones_Reconnect() -{ +{SELFPARAM(); entity e; e = self; for(self = warpzone_first; self; self = self.warpzone_next) @@ -772,7 +772,7 @@ void WarpZones_Reconnect() } void WarpZone_Think() -{ +{SELFPARAM(); if(self.warpzone_save_origin != self.origin || self.warpzone_save_angles != self.angles || self.warpzone_save_eorigin != self.enemy.origin @@ -797,7 +797,7 @@ void WarpZone_Think() } void WarpZone_StartFrame() -{ +{SELFPARAM(); entity e; if(warpzone_initialized == 0) { @@ -867,7 +867,7 @@ float visible_to_some_client(entity ent) return 0; } void trigger_warpzone_reconnect_use() -{ +{SELFPARAM(); entity e; e = self; // NOTE: this matches for target, not targetname, but of course @@ -892,7 +892,7 @@ void trigger_warpzone_reconnect_use() } void spawnfunc_trigger_warpzone_reconnect() -{ +{SELFPARAM(); self.use = trigger_warpzone_reconnect_use; } @@ -902,7 +902,7 @@ void spawnfunc_target_warpzone_reconnect() } void WarpZone_PlayerPhysics_FixVAngle(void) -{ +{SELFPARAM(); #ifndef WARPZONE_DONT_FIX_VANGLE if(IS_REAL_CLIENT(self)) if(self.v_angle.z <= 360) // if not already adjusted diff --git a/qcsrc/warpzonelib/util_server.qc b/qcsrc/warpzonelib/util_server.qc index 0af6d3c0dc..29bbecce4e 100644 --- a/qcsrc/warpzonelib/util_server.qc +++ b/qcsrc/warpzonelib/util_server.qc @@ -12,7 +12,7 @@ #include "common.qh" void WarpZoneLib_ExactTrigger_Init() -{ +{SELFPARAM(); vector mi, ma; if (self.movedir == '0 0 0') if (self.angles != '0 0 0')