From: Mario Date: Fri, 10 Jun 2016 09:57:48 +0000 (+1000) Subject: Clean up some SELFPARAMs X-Git-Tag: xonotic-v0.8.2~857 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9ce59f684368d14ce510aad9f89f1157be1f061c;p=xonotic%2Fxonotic-data.pk3dir.git Clean up some SELFPARAMs --- diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 41ab8839f..a22d164ef 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -782,7 +782,7 @@ NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new) // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS. void CSQC_Ent_Update(bool isnew) { - SELFPARAM(); + SELFPARAM(); // needed for engine functions this.sourceLoc = __FILE__ ":" STR(__LINE__); int t = ReadByte(); @@ -863,7 +863,7 @@ void Ent_Remove(entity this) // CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(this) as well. void CSQC_Ent_Remove() { - SELFPARAM(); + SELFPARAM(); // needed for engine functions if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Ent_Remove() with this=%i {.entnum=%d, .enttype=%d}\n", this, this.entnum, this.enttype); if (wasfreed(this)) { diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 125a25709..828853243 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -1371,7 +1371,7 @@ float vh_notice_time; void WaypointSprite_Load(); void CSQC_UpdateView(float w, float h) { - SELFPARAM(); + SELFPARAM(); // needed for engine functions TC(int, w); TC(int, h); entity e; float fov; diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 09badf84e..07bac08da 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -758,7 +758,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i if(this.nade_type == NADE_TYPE_TRANSLOCATE.m_id || this.nade_type == NADE_TYPE_SPAWN.m_id) return; - if (MUTATOR_CALLHOOK(Nade_Damage, DEATH_WEAPONOF(deathtype), force, damage)) {} + if (MUTATOR_CALLHOOK(Nade_Damage, this, DEATH_WEAPONOF(deathtype), force, damage)) {} else if(DEATH_ISWEAPON(deathtype, WEP_BLASTER)) { force *= 1.5; diff --git a/qcsrc/common/mutators/mutator/nades/nades.qh b/qcsrc/common/mutators/mutator/nades/nades.qh index d89cd462d..851b4a539 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qh +++ b/qcsrc/common/mutators/mutator/nades/nades.qh @@ -90,11 +90,12 @@ void(entity player, float score) nades_GiveBonus; * called to adjust nade damage and force on hit */ #define EV_Nade_Damage(i, o) \ - /** weapon */ i(entity, MUTATOR_ARGV_0_entity) \ - /** force */ i(vector, MUTATOR_ARGV_1_vector) \ - /**/ o(vector, MUTATOR_ARGV_1_vector) \ - /** damage */ i(float, MUTATOR_ARGV_2_float) \ - /**/ o(float, MUTATOR_ARGV_2_float) \ + /** nade */ i(entity, MUTATOR_ARGV_0_entity) \ + /** weapon */ i(entity, MUTATOR_ARGV_1_entity) \ + /** force */ i(vector, MUTATOR_ARGV_2_vector) \ + /**/ o(vector, MUTATOR_ARGV_2_vector) \ + /** damage */ i(float, MUTATOR_ARGV_3_float) \ + /**/ o(float, MUTATOR_ARGV_3_float) \ /**/ MUTATOR_HOOKABLE(Nade_Damage, EV_Nade_Damage); diff --git a/qcsrc/common/mutators/mutator/overkill/hmg.qc b/qcsrc/common/mutators/mutator/overkill/hmg.qc index 38aec81e7..e0ae53931 100644 --- a/qcsrc/common/mutators/mutator/overkill/hmg.qc +++ b/qcsrc/common/mutators/mutator/overkill/hmg.qc @@ -47,17 +47,15 @@ REGISTER_WEAPON(HMG, hmg, NEW(HeavyMachineGun)); REGISTER_MUTATOR(hmg_nadesupport, true); MUTATOR_HOOKFUNCTION(hmg_nadesupport, Nade_Damage) { - SELFPARAM(); - if (M_ARGV(0, entity) != WEP_HMG) return; + if (M_ARGV(1, entity) != WEP_HMG) return; return = true; - M_ARGV(2, float) /* damage */ = self.max_health * 0.1; + M_ARGV(3, float) /* damage */ = (M_ARGV(0, entity)).max_health * 0.1; } spawnfunc(weapon_hmg) { weapon_defaultspawnfunc(this, WEP_HMG); } void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int fire) { - SELFPARAM(); if (!PHYS_INPUT_BUTTON_ATCK(actor)) { w_ready(thiswep, actor, weaponentity, fire); @@ -72,7 +70,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone return; } - W_DecreaseAmmo(WEP_HMG, self, WEP_CVAR(hmg, ammo)); + W_DecreaseAmmo(WEP_HMG, actor, WEP_CVAR(hmg, ammo)); W_SetupShot (actor, true, 0, SND_UZI_FIRE, CH_WEAPON_A, WEP_CVAR(hmg, damage)); @@ -102,11 +100,10 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone METHOD(HeavyMachineGun, wr_aim, void(entity thiswep, entity actor)) { - entity this = actor; - if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200)) - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false); + if(vdist(actor.origin - actor.enemy.origin, <, 3000 - bound(0, skill, 10) * 200)) + PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, 1000000, 0, 0.001, false); else - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); + PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, 1000000, 0, 0.001, false); } METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) @@ -146,8 +143,7 @@ METHOD(HeavyMachineGun, wr_checkammo2, bool(entity thiswep, entity actor)) METHOD(HeavyMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, WEP_CVAR(hmg, ammo), SND_RELOAD); + W_Reload(actor, WEP_CVAR(hmg, ammo), SND_RELOAD); } METHOD(HeavyMachineGun, wr_suicidemessage, Notification(entity thiswep)) @@ -168,12 +164,11 @@ METHOD(HeavyMachineGun, wr_killmessage, Notification(entity thiswep)) METHOD(HeavyMachineGun, wr_impacteffect, void(entity thiswep, entity actor)) { - entity this = actor; vector org2; org2 = w_org + w_backoff * 2; pointparticles(EFFECT_MACHINEGUN_IMPACT, org2, w_backoff * 1000, 1); if(!w_issilent) - sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM); + sound(actor, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM); } #endif diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qc b/qcsrc/common/mutators/mutator/overkill/rpc.qc index b3b8f4248..e5831a1bd 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@ -105,17 +105,17 @@ void W_RocketPropelledChainsaw_Think(entity this) self.nextthink = time; } -void W_RocketPropelledChainsaw_Attack (Weapon thiswep) -{SELFPARAM(); +void W_RocketPropelledChainsaw_Attack (Weapon thiswep, entity actor) +{ entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(self); entity flash = spawn (); - W_DecreaseAmmo(thiswep, self, WEP_CVAR(rpc, ammo)); - W_SetupShot_ProjectileSize (self, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(rpc, damage)); + W_DecreaseAmmo(thiswep, actor, WEP_CVAR(rpc, ammo)); + W_SetupShot_ProjectileSize (actor, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(rpc, damage)); Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); PROJECTILE_MAKETRIGGER(missile); - missile.owner = missile.realowner = self; + missile.owner = missile.realowner = actor; missile.bot_dodge = true; missile.bot_dodgerating = WEP_CVAR(rpc, damage) * 2; @@ -144,10 +144,10 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep) setmodel(flash, MDL_RPC_MUZZLEFLASH); // precision set below SUB_SetFade (flash, time, 0.1); flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; - W_AttachToShotorg(self, flash, '5 0 0'); + W_AttachToShotorg(actor, flash, '5 0 0'); missile.pos1 = missile.velocity; - MUTATOR_CALLHOOK(EditProjectile, self, missile); + MUTATOR_CALLHOOK(EditProjectile, actor, missile); } METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep, entity actor)) @@ -166,7 +166,7 @@ METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .en { if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(rpc, refire))) { - W_RocketPropelledChainsaw_Attack(thiswep); + W_RocketPropelledChainsaw_Attack(thiswep, actor); weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(rpc, animtime), w_ready); } } @@ -192,8 +192,7 @@ METHOD(RocketPropelledChainsaw, wr_checkammo2, bool(entity thiswep, entity actor METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity)) { - SELFPARAM(); - W_Reload(self, WEP_CVAR(rpc, ammo), SND_RELOAD); + W_Reload(actor, WEP_CVAR(rpc, ammo), SND_RELOAD); } METHOD(RocketPropelledChainsaw, wr_suicidemessage, Notification(entity thiswep)) diff --git a/qcsrc/common/mutators/mutator/sandbox/sandbox.qc b/qcsrc/common/mutators/mutator/sandbox/sandbox.qc index 1ab693512..e6b857a10 100644 --- a/qcsrc/common/mutators/mutator/sandbox/sandbox.qc +++ b/qcsrc/common/mutators/mutator/sandbox/sandbox.qc @@ -75,11 +75,11 @@ void sandbox_ObjectFunction_Think(entity this) { // decide if and how this object can be grabbed if(autocvar_g_sandbox_readonly) - self.grab = 0; // no grabbing - else if(autocvar_g_sandbox_editor_free < 2 && self.crypto_idfp) - self.grab = 1; // owner only + this.grab = 0; // no grabbing + else if(autocvar_g_sandbox_editor_free < 2 && this.crypto_idfp) + this.grab = 1; // owner only else - self.grab = 3; // anyone + this.grab = 3; // anyone // Object owner is stored via player UID, but we also need the owner as an entity (if the player is available on the server). // Therefore, scan for all players, and update the owner as long as the player is present. We must always do this, @@ -87,28 +87,28 @@ void sandbox_ObjectFunction_Think(entity this) // bots can't have objects FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA( - if(self.crypto_idfp == it.crypto_idfp) + if(this.crypto_idfp == it.crypto_idfp) { - self.realowner = it; + this.realowner = it; break; } - self.realowner = world; + this.realowner = world; )); - self.nextthink = time; + this.nextthink = time; - CSQCMODEL_AUTOUPDATE(self); + CSQCMODEL_AUTOUPDATE(this); } .float old_solid, old_movetype; -entity sandbox_ObjectEdit_Get(float permissions) -{SELFPARAM(); +entity sandbox_ObjectEdit_Get(entity this, float permissions) +{ // 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. - crosshair_trace_plusvisibletriggers(self); - if(vdist(self.origin - trace_ent.origin, >, autocvar_g_sandbox_editor_distance_edit)) + crosshair_trace_plusvisibletriggers(this); + if(vdist(this.origin - trace_ent.origin, >, autocvar_g_sandbox_editor_distance_edit)) return world; // out of trace range if(trace_ent.classname != "object") return world; // entity is not an object @@ -116,7 +116,7 @@ entity sandbox_ObjectEdit_Get(float permissions) return trace_ent; // don't check permissions, anyone can edit this object if(trace_ent.crypto_idfp == "") return trace_ent; // the player who spawned this object did not have an UID, so anyone can edit it - if (!(trace_ent.realowner != self && autocvar_g_sandbox_editor_free < 2)) + if (!(trace_ent.realowner != this && autocvar_g_sandbox_editor_free < 2)) return trace_ent; // object does not belong to the player, and players can only edit their own objects on this server return world; } @@ -175,8 +175,8 @@ void sandbox_ObjectAttach_Remove(entity e) } } -entity sandbox_ObjectSpawn(float database) -{SELFPARAM(); +entity sandbox_ObjectSpawn(entity this, float database) +{ // spawn a new object with default properties entity e = new(object); @@ -196,21 +196,21 @@ entity sandbox_ObjectSpawn(float database) { // set the object's owner via player UID // if the player does not have an UID, the owner cannot be stored and his objects may be edited by anyone - if(self.crypto_idfp != "") - e.crypto_idfp = strzone(self.crypto_idfp); + if(this.crypto_idfp != "") + e.crypto_idfp = strzone(this.crypto_idfp); else - print_to(self, "^1SANDBOX - WARNING: ^7You spawned an object, but lack a player UID. ^1Your objects are not secured and can be edited by any player!"); + print_to(this, "^1SANDBOX - WARNING: ^7You spawned an object, but lack a player UID. ^1Your objects are not secured and can be edited by any player!"); // set public object information - e.netname = strzone(self.netname); // name of the owner + e.netname = strzone(this.netname); // name of the owner e.message = strzone(strftime(true, "%d-%m-%Y %H:%M:%S")); // creation time e.message2 = strzone(strftime(true, "%d-%m-%Y %H:%M:%S")); // last editing time // set origin and direction based on player position and view angle - makevectors(self.v_angle); - WarpZone_TraceLine(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * autocvar_g_sandbox_editor_distance_spawn, MOVE_NORMAL, self); + makevectors(this.v_angle); + WarpZone_TraceLine(this.origin + this.view_ofs, this.origin + this.view_ofs + v_forward * autocvar_g_sandbox_editor_distance_spawn, MOVE_NORMAL, this); setorigin(e, trace_endpos); - e.angles_y = self.v_angle.y; + e.angles_y = this.v_angle.y; } CSQCMODEL_AUTOINIT(e); @@ -316,7 +316,7 @@ string sandbox_ObjectPort_Save(entity e, float database) return s; } -entity sandbox_ObjectPort_Load(string s, float database) +entity sandbox_ObjectPort_Load(entity this, string s, float database) { // load object properties, and spawn a new object with them float n, i; @@ -334,7 +334,7 @@ entity sandbox_ObjectPort_Load(string s, float database) string tagname = string_null; argv_num = 0; tokenize_console(port_string[i]); - e = sandbox_ObjectSpawn(database); + e = sandbox_ObjectSpawn(this, database); // ---------------- OBJECT PROPERTY STORAGE: LOAD ---------------- if(i) @@ -434,7 +434,7 @@ void sandbox_Database_Load() continue; entity e; - e = sandbox_ObjectPort_Load(file_read, true); + e = sandbox_ObjectPort_Load(NULL, file_read, true); if(e.material) { @@ -532,7 +532,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand) return true; } - e = sandbox_ObjectSpawn(false); + e = sandbox_ObjectSpawn(player, false); _setmodel(e, argv(2)); if(autocvar_g_sandbox_info > 0) @@ -541,7 +541,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand) // ---------------- COMMAND: OBJECT, REMOVE ---------------- case "object_remove": - e = sandbox_ObjectEdit_Get(true); + e = sandbox_ObjectEdit_Get(player, true); if(e != world) { if(autocvar_g_sandbox_info > 0) @@ -559,7 +559,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand) { case "copy": // copies customizable properties of the selected object to the clipboard cvar - e = sandbox_ObjectEdit_Get(autocvar_g_sandbox_editor_free); // can we copy objects we can't edit? + e = sandbox_ObjectEdit_Get(player, autocvar_g_sandbox_editor_free); // can we copy objects we can't edit? if(e != world) { s = sandbox_ObjectPort_Save(e, false); @@ -590,7 +590,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand) print_to(player, strcat("^1SANDBOX - WARNING: ^7Cannot spawn any more objects. Up to ^3", ftos(autocvar_g_sandbox_editor_maxobjects), " ^7objects may exist at a time")); return true; } - e = sandbox_ObjectPort_Load(argv(3), false); + e = sandbox_ObjectPort_Load(player, argv(3), false); print_to(player, "^2SANDBOX - INFO: ^7Object pasted successfully"); if(autocvar_g_sandbox_info > 0) @@ -605,7 +605,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand) { case "get": // select e as the object as meant to be attached - e = sandbox_ObjectEdit_Get(true); + e = sandbox_ObjectEdit_Get(player, true); if(e != world) { player.object_attach = e; @@ -622,7 +622,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand) } // attaches the previously selected object to e - e = sandbox_ObjectEdit_Get(true); + e = sandbox_ObjectEdit_Get(player, true); if(e != world) { sandbox_ObjectAttach_Set(player.object_attach, e, argv(3)); @@ -636,7 +636,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand) return true; case "remove": // removes e if it was attached - e = sandbox_ObjectEdit_Get(true); + e = sandbox_ObjectEdit_Get(player, true); if(e != world) { sandbox_ObjectAttach_Remove(e); @@ -658,7 +658,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand) return true; } - e = sandbox_ObjectEdit_Get(true); + e = sandbox_ObjectEdit_Get(player, true); if(e != world) { switch(argv(2)) @@ -748,7 +748,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand) print_to(player, "^1SANDBOX - WARNING: ^7You do not have a player UID, and cannot claim objects"); return true; } - e = sandbox_ObjectEdit_Get(true); + e = sandbox_ObjectEdit_Get(player, true); if(e != world) { // update the owner's name @@ -778,7 +778,7 @@ MUTATOR_HOOKFUNCTION(sandbox, SV_ParseClientCommand) // ---------------- COMMAND: OBJECT, INFO ---------------- case "object_info": // prints public information about the object to the player - e = sandbox_ObjectEdit_Get(false); + e = sandbox_ObjectEdit_Get(player, false); if(e != world) { switch(argv(2)) diff --git a/qcsrc/common/mutators/mutator/superspec/superspec.qc b/qcsrc/common/mutators/mutator/superspec/superspec.qc index ca8f7b486..70898811c 100644 --- a/qcsrc/common/mutators/mutator/superspec/superspec.qc +++ b/qcsrc/common/mutators/mutator/superspec/superspec.qc @@ -23,25 +23,25 @@ const float SSF_ITEMMSG = 4; .string superspec_itemfilter; //"classname1 classname2 ..." -bool superspec_Spectate(entity _player) -{SELFPARAM(); - if(Spectate(_player) == 1) - TRANSMUTE(Spectator, self); +bool superspec_Spectate(entity this, entity targ) +{ + if(Spectate(targ) == 1) + TRANSMUTE(Spectator, this); return true; } -void superspec_save_client_conf() -{SELFPARAM(); +void superspec_save_client_conf(entity this) +{ string fn = "superspec-local.options"; float fh; - if (!_ISLOCAL(self)) + if (!_ISLOCAL(this)) { - if(self.crypto_idfp == "") + if(this.crypto_idfp == "") return; - fn = sprintf("superspec-%s.options", uri_escape(self.crypto_idfp)); + fn = sprintf("superspec-%s.options", uri_escape(this.crypto_idfp)); } fh = fopen(fn, FILE_WRITE); @@ -53,11 +53,11 @@ void superspec_save_client_conf() { fputs(fh, _SSMAGIX); fputs(fh, "\n"); - fputs(fh, ftos(self.autospec_flags)); + fputs(fh, ftos(this.autospec_flags)); fputs(fh, "\n"); - fputs(fh, ftos(self.superspec_flags)); + fputs(fh, ftos(this.superspec_flags)); fputs(fh, "\n"); - fputs(fh, self.superspec_itemfilter); + fputs(fh, this.superspec_itemfilter); fputs(fh, "\n"); fclose(fh); } @@ -114,7 +114,7 @@ MUTATOR_HOOKFUNCTION(superspec, ItemTouch) superspec_msg("", "", it, sprintf("Player %s^7 just picked up ^3%s\n^8(%s^8)\n", toucher.netname, item.netname, item.classname), 1); if((it.autospec_flags & ASF_SSIM) && it.enemy != toucher) { - WITHSELF(it, superspec_Spectate(toucher)); + superspec_Spectate(it, toucher); return MUT_ITEMTOUCH_CONTINUE; } } @@ -138,7 +138,7 @@ MUTATOR_HOOKFUNCTION(superspec, ItemTouch) if(it.autospec_flags & ASF_SHOWWHAT) superspec_msg("", "", it, sprintf("^7Following %s^7 due to picking up %s\n", toucher.netname, item.netname), 2); - WITHSELF(it, superspec_Spectate(toucher)); + superspec_Spectate(it, toucher); } } } @@ -344,7 +344,7 @@ MUTATOR_HOOKFUNCTION(superspec, SV_ParseClientCommand) if(cmd_name == "followpowerup") { - FOREACH_CLIENT(IS_PLAYER(it) && (it.strength_finished > time || it.invincible_finished > time), LAMBDA(return superspec_Spectate(it))); + FOREACH_CLIENT(IS_PLAYER(it) && (it.strength_finished > time || it.invincible_finished > time), LAMBDA(return superspec_Spectate(player, it))); superspec_msg("", "", player, "No active powerup\n", 1); return true; @@ -352,7 +352,7 @@ MUTATOR_HOOKFUNCTION(superspec, SV_ParseClientCommand) if(cmd_name == "followstrength") { - FOREACH_CLIENT(IS_PLAYER(it) && it.strength_finished > time, LAMBDA(return superspec_Spectate(it))); + FOREACH_CLIENT(IS_PLAYER(it) && it.strength_finished > time, LAMBDA(return superspec_Spectate(player, it))); superspec_msg("", "", player, "No active Strength\n", 1); return true; @@ -360,7 +360,7 @@ MUTATOR_HOOKFUNCTION(superspec, SV_ParseClientCommand) if(cmd_name == "followshield") { - FOREACH_CLIENT(IS_PLAYER(it) && it.invincible_finished > time, LAMBDA(return superspec_Spectate(it))); + FOREACH_CLIENT(IS_PLAYER(it) && it.invincible_finished > time, LAMBDA(return superspec_Spectate(player, it))); superspec_msg("", "", player, "No active Shield\n", 1); return true; @@ -382,10 +382,10 @@ MUTATOR_HOOKFUNCTION(superspec, BuildMutatorsPrettyString) void superspec_hello(entity this) { - if(self.enemy.crypto_idfp == "") - Send_Notification(NOTIF_ONE_ONLY, self.enemy, MSG_INFO, INFO_SUPERSPEC_MISSING_UID); + if(this.enemy.crypto_idfp == "") + Send_Notification(NOTIF_ONE_ONLY, this.enemy, MSG_INFO, INFO_SUPERSPEC_MISSING_UID); - remove(self); + remove(this); } MUTATOR_HOOKFUNCTION(superspec, ClientConnect) @@ -449,7 +449,7 @@ MUTATOR_HOOKFUNCTION(superspec, PlayerDies) if(it.autospec_flags & ASF_SHOWWHAT) superspec_msg("", "", it, sprintf("^7Following %s^7 due to followkiller\n", frag_attacker.netname), 2); - WITHSELF(it, superspec_Spectate(frag_attacker)); + superspec_Spectate(it, frag_attacker); } )); @@ -460,6 +460,6 @@ MUTATOR_HOOKFUNCTION(superspec, ClientDisconnect) { entity player = M_ARGV(0, entity); - WITHSELF(player, superspec_save_client_conf()); + superspec_save_client_conf(player); } #endif diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index e208811ef..c1a72ee69 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -978,12 +978,12 @@ float WaypointSprite_Customize(entity this) bool WaypointSprite_SendEntity(entity this, entity to, float sendflags); -void WaypointSprite_Reset() -{SELFPARAM(); +void WaypointSprite_Reset(entity this) +{ // 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) - WaypointSprite_Kill(self); + if (this.fade_time) + WaypointSprite_Kill(this); } entity WaypointSprite_Spawn( diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh index 84f028c6e..328d5b439 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh @@ -172,7 +172,7 @@ float WaypointSprite_Customize(entity this); bool WaypointSprite_SendEntity(entity this, entity to, float sendflags); -void WaypointSprite_Reset(); +void WaypointSprite_Reset(entity this); entity WaypointSprite_Spawn( entity spr, // sprite diff --git a/qcsrc/common/triggers/trigger/gamestart.qc b/qcsrc/common/triggers/trigger/gamestart.qc index b042d01e0..6fa27cf1a 100644 --- a/qcsrc/common/triggers/trigger/gamestart.qc +++ b/qcsrc/common/triggers/trigger/gamestart.qc @@ -10,7 +10,7 @@ void gamestart_use_this(entity this) gamestart_use(this, NULL, NULL); } -void self_spawnfunc_trigger_gamestart(); +void self_spawnfunc_trigger_gamestart(entity this); spawnfunc(trigger_gamestart) { this.use = gamestart_use; @@ -24,6 +24,6 @@ spawnfunc(trigger_gamestart) else InitializeEntity(this, gamestart_use_this, INITPRIO_FINDTARGET); } -void self_spawnfunc_trigger_gamestart() { SELFPARAM(); spawnfunc_trigger_gamestart(this); } +void self_spawnfunc_trigger_gamestart(entity this) { WITHSELF(this, spawnfunc_trigger_gamestart(this)); } #endif diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 982e55c96..a7d31b061 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -349,7 +349,7 @@ void reset_map(bool dorespawn) // Waypoints and assault start come LAST FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), { - if (it.reset2) WITHSELF(it, it.reset2()); + if (it.reset2) it.reset2(it); }); FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(WITHSELF(it, Unfreeze(it)))); diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 71583db6f..8e5e8b34c 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -302,7 +302,7 @@ void SUB_DontUseTargets(entity this, entity actor, entity trigger); void SUB_UseTargets(entity this, entity actor, entity trigger); .void(entity this) reset; // if set, an entity is reset using this -.void() reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities) +.void(entity this) reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities) void ClientData_Touch(entity e); diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qc b/qcsrc/server/mutators/mutator/gamemode_assault.qc index 5b71be772..d737330a5 100644 --- a/qcsrc/server/mutators/mutator/gamemode_assault.qc +++ b/qcsrc/server/mutators/mutator/gamemode_assault.qc @@ -232,11 +232,6 @@ void assault_roundstart_use_this(entity this) { assault_roundstart_use(this, NULL, NULL); } -void assault_roundstart_use_self() -{ - SELFPARAM(); - assault_roundstart_use(this, NULL, NULL); -} void assault_wall_think(entity this) { @@ -424,7 +419,7 @@ spawnfunc(target_assault_roundstart) assault_attacker_team = NUM_TEAM_1; this.classname = "target_assault_roundstart"; this.use = assault_roundstart_use; - this.reset2 = assault_roundstart_use_self; + this.reset2 = assault_roundstart_use_this; InitializeEntity(this, assault_roundstart_use_this, INITPRIO_FINDTARGET); } diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index cf6bd6b2c..366011b29 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -2372,7 +2372,7 @@ MUTATOR_HOOKFUNCTION(ctf, GetRecords) M_ARGV(1, string) = ret_string; } -bool superspec_Spectate(entity _player); // TODO +bool superspec_Spectate(entity this, entity targ); // TODO void superspec_msg(string _center_title, string _con_title, entity _to, string _msg, float _spamlevel); // TODO MUTATOR_HOOKFUNCTION(ctf, SV_ParseClientCommand) { @@ -2407,7 +2407,7 @@ MUTATOR_HOOKFUNCTION(ctf, SV_ParseClientCommand) found = true; if(_team == 0 && IS_SPEC(player) && player.enemy == it) continue; // already spectating this fc, try another - return superspec_Spectate(it); + return superspec_Spectate(player, it); } ));