From: TimePath Date: Mon, 31 Aug 2015 05:03:56 +0000 (+1000) Subject: Remove oldself variables X-Git-Tag: xonotic-v0.8.2~1931^2~6 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=f7f97e1cda9e8f5c5e0d044d7768245afc565aa1 Remove oldself variables --- diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index 5d5de15660..ec03281163 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -130,9 +130,6 @@ void Ent_DamageInfo(float isNew) bool hitplayer = false; int species, forcemul; vector force, thisforce; - entity oldself; - - oldself = self; w_deathtype = ReadShort(); w_issilent = (w_deathtype & 0x8000); @@ -212,7 +209,7 @@ void Ent_DamageInfo(float isNew) if(self.isplayermodel) hitplayer = true; // this impact damaged a player } - setself(oldself); + setself(this); if(DEATH_ISVEHICLE(w_deathtype)) { diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 124fb7e858..d4e1691f0c 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -38,7 +38,7 @@ void monster_dropitem() return; vector org = self.origin + ((self.mins + self.maxs) * 0.5); - entity e = spawn(), oldself = self; + entity e = spawn(); e.monster_loot = self.monster_loot; @@ -58,7 +58,7 @@ void monster_dropitem() e.item_spawnshieldtime = time + 0.7; e.classname = "droppedweapon"; // use weapon handling to remove it on touch SUB_SetFade(e, time + autocvar_g_monsters_drop_time, 1); - setself(oldself); + setself(this); } } diff --git a/qcsrc/common/movetypes/movetypes.qc b/qcsrc/common/movetypes/movetypes.qc index b3158b5f95..defa3718f0 100644 --- a/qcsrc/common/movetypes/movetypes.qc +++ b/qcsrc/common/movetypes/movetypes.qc @@ -346,15 +346,14 @@ void _Movetype_Impact(entity oth) // SV_Impact void _Movetype_LinkEdict_TouchAreaGrid() // SV_LinkEdict_TouchAreaGrid {SELFPARAM(); - entity oldself = self; entity oldother = other; for (entity e = findradius(0.5 * (self.absmin + self.absmax), 0.5 * vlen(self.absmax - self.absmin)); e; e = e.chain) { - if(e.move_touch && boxesoverlap(e.absmin, e.absmax, oldself.absmin, oldself.absmax)) + if(e.move_touch && boxesoverlap(e.absmin, e.absmax, this.absmin, this.absmax)) { setself(e); - other = oldself; + other = this; trace_allsolid = false; trace_startsolid = false; @@ -364,14 +363,14 @@ void _Movetype_LinkEdict_TouchAreaGrid() // SV_LinkEdict_TouchAreaGrid trace_endpos = e.origin; trace_plane_normal = '0 0 1'; trace_plane_dist = 0; - trace_ent = oldself; + trace_ent = this; e.move_touch(); } } other = oldother; - setself(oldself); + setself(this); } void _Movetype_LinkEdict(bool touch_triggers) // SV_LinkEdict diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index 12e3c4dd1a..0ea2f6dfe2 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -213,14 +213,11 @@ float door_check_keys(void) void door_fire() {SELFPARAM(); - entity oself; entity starte; if (self.owner != self) objerror ("door_fire: self.owner != self"); - oself = self; - if (self.spawnflags & DOOR_TOGGLE) { if (self.state == STATE_UP || self.state == STATE_TOP) @@ -238,7 +235,7 @@ void door_fire() } setself(self.enemy); } while ( (self != starte) && (self != world) ); - setself(oself); + setself(this); return; } } @@ -267,7 +264,7 @@ void door_fire() } setself(self.enemy); } while ( (self != starte) && (self != world) ); - setself(oself); + setself(this); } void door_use() diff --git a/qcsrc/common/triggers/trigger/keylock.qc b/qcsrc/common/triggers/trigger/keylock.qc index 1c2bd70b5d..17313f0aa8 100644 --- a/qcsrc/common/triggers/trigger/keylock.qc +++ b/qcsrc/common/triggers/trigger/keylock.qc @@ -3,7 +3,6 @@ */ void trigger_keylock_trigger(string s) {SELFPARAM(); - entity stemp = self; entity otemp = other; entity atemp = activator; @@ -12,12 +11,12 @@ void trigger_keylock_trigger(string s) if(t.use) { setself(t); - other = stemp; + other = this; activator = atemp; self.use(); } - setself(stemp); + setself(this); other = otemp; activator = atemp; } diff --git a/qcsrc/common/triggers/triggers.qc b/qcsrc/common/triggers/triggers.qc index bd67c1479a..a44c688ed9 100644 --- a/qcsrc/common/triggers/triggers.qc +++ b/qcsrc/common/triggers/triggers.qc @@ -138,7 +138,7 @@ match (string)self.target and call their .use function */ void SUB_UseTargets() {SELFPARAM(); - entity t, stemp, otemp, act; + entity t, otemp, act; string s; float i; @@ -191,10 +191,9 @@ void SUB_UseTargets() // fire targets // act = activator; - stemp = self; otemp = other; - if(stemp.target_random) + if(this.target_random) RandomSelection_Init(); for(i = 0; i < 4; ++i) @@ -202,10 +201,10 @@ void SUB_UseTargets() switch(i) { default: - case 0: s = stemp.target; break; - case 1: s = stemp.target2; break; - case 2: s = stemp.target3; break; - case 3: s = stemp.target4; break; + case 0: s = this.target; break; + case 1: s = this.target2; break; + case 2: s = this.target3; break; + case 3: s = this.target4; break; } if (s != "") { @@ -215,7 +214,7 @@ void SUB_UseTargets() for(t = world; (t = find(t, targetname, s)); ) if(t.use) { - if(stemp.target_random) + if(this.target_random) { RandomSelection_Add(t, 0, string_null, 1, 0); } @@ -224,7 +223,7 @@ void SUB_UseTargets() if (t.classname == "func_clientwall" || t.classname == "func_clientillusionary") t.antiwall_flag = aw_flag; setself(t); - other = stemp; + other = this; activator = act; self.use(); } @@ -232,16 +231,16 @@ void SUB_UseTargets() } } - if(stemp.target_random && RandomSelection_chosen_ent) + if(this.target_random && RandomSelection_chosen_ent) { setself(RandomSelection_chosen_ent); - other = stemp; + other = this; activator = act; self.use(); } activator = act; - setself(stemp); + setself(this); other = otemp; } diff --git a/qcsrc/common/turrets/sv_turrets.qc b/qcsrc/common/turrets/sv_turrets.qc index d03ee2a3d3..9297187837 100644 --- a/qcsrc/common/turrets/sv_turrets.qc +++ b/qcsrc/common/turrets/sv_turrets.qc @@ -495,9 +495,7 @@ entity turret_projectile(string _snd, float _size, float _health, float _death, void turret_do_updates(entity t_turret) {SELFPARAM(); vector enemy_pos; - entity oldself; - oldself = self; setself(t_turret); enemy_pos = real_origin(self.enemy); @@ -527,7 +525,7 @@ void turret_do_updates(entity t_turret) self.tur_impactent = trace_ent; self.tur_impacttime = vlen(self.tur_shotorg - trace_endpos) / self.shot_speed; - setself(oldself); + setself(this); } /** diff --git a/qcsrc/common/turrets/unit/phaser.qc b/qcsrc/common/turrets/unit/phaser.qc index d188e99cd4..c83b34056d 100644 --- a/qcsrc/common/turrets/unit/phaser.qc +++ b/qcsrc/common/turrets/unit/phaser.qc @@ -43,18 +43,16 @@ void beam_think() self.nextthink = time + self.ticrate; self.owner.attack_finished_single = time + frametime; - entity oldself; - oldself = self; setself(self.owner); FireImoBeam ( self.tur_shotorg, self.tur_shotorg + self.tur_shotdir_updated * self.target_range, '-1 -1 -1' * self.shot_radius, '1 1 1' * self.shot_radius, self.shot_force, - oldself.shot_dmg, + this.shot_dmg, 0.75, DEATH_TURRET_PHASER); - setself(oldself); + setself(this); self.scale = vlen(self.owner.tur_shotorg - trace_endpos) / 256; } diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 0ed648f043..bc8399b09f 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -534,13 +534,13 @@ void vehicles_showwp() if(self.waypointsprite_attached) { WaypointSprite_UpdateRule(self.waypointsprite_attached, self.wp00.team, SPRITERULE_DEFAULT); - if(oldself == world) + if(this == NULL) WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, self.nextthink); WaypointSprite_Ping(self.waypointsprite_attached); } - if(oldself != world) - setself(oldself); + if(this) + setself(this); } void vehicles_setreturn(entity veh) @@ -828,7 +828,6 @@ void vehicles_exit(bool eject) {SELFPARAM(); entity _vehicle; entity _player; - entity _oldself = self; if(vehicles_exit_running) { @@ -844,7 +843,7 @@ void vehicles_exit(bool eject) if (_vehicle.vehicle_flags & VHF_PLAYERSLOT) { _vehicle.vehicle_exit(eject); - setself(_oldself); + setself(this); vehicles_exit_running = false; return; } @@ -920,7 +919,7 @@ void vehicles_exit(bool eject) CSQCMODEL_AUTOINIT(self); - setself(_oldself); + setself(this); vehicles_exit_running = false; } @@ -987,7 +986,6 @@ void vehicles_enter(entity pl, entity veh) if(veh.vehicle_flags & VHF_MULTISLOT) if(veh.owner) { - entity oldself = self; setself(veh); other = pl; // TODO: fix @@ -996,7 +994,7 @@ void vehicles_enter(entity pl, entity veh) if(veh.gun1.vehicle_enter) if(veh.gun1.vehicle_enter()) { - setself(oldself); + setself(this); return; } @@ -1005,11 +1003,11 @@ void vehicles_enter(entity pl, entity veh) if(veh.gun2.vehicle_enter) if(veh.gun2.vehicle_enter()) { - setself(oldself); + setself(this); return; } - setself(oldself); + setself(this); } if(teamplay) @@ -1113,11 +1111,10 @@ void vehicles_enter(entity pl, entity veh) MUTATOR_CALLHOOK(VehicleEnter, pl, veh); - entity oldself = self; setself(veh); CSQCModel_UnlinkEntity(); VEH_ACTION(veh.vehicleid, VR_ENTER); - setself(oldself); + setself(this); antilag_clear(pl); } diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 52020901a1..a9829f6129 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -272,7 +272,6 @@ void W_Arc_Beam_Think(void) } if(self == self.owner.arc_beam) { self.owner.arc_beam = world; } - entity oldself = self; setself(self.owner); if(!WEP_ACTION(WEP_ARC.m_id, WR_CHECKAMMO1) && !WEP_ACTION(WEP_ARC.m_id, WR_CHECKAMMO2)) if(!(self.items & IT_UNLIMITED_WEAPON_AMMO)) @@ -280,7 +279,7 @@ void W_Arc_Beam_Think(void) // note: this doesn't force the switch W_SwitchToOtherWeapon(self); } - setself(oldself); + setself(this); remove(self); return; } diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index eaba831cc9..7350cb1bc0 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -414,7 +414,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; + entity oldenemy; self.cnt = self.cnt - 1; if((!(self.realowner.items & IT_UNLIMITED_AMMO) && self.realowner.WEP_AMMO(SEEKER) < WEP_CVAR(seeker, missile_ammo)) || (self.cnt <= -1) || (self.realowner.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER.m_id)) @@ -425,11 +425,10 @@ void W_Seeker_Vollycontroller_Think(void) // TODO: Merge this with W_Seeker_Atta self.nextthink = time + WEP_CVAR(seeker, missile_delay) * W_WeaponRateFactor(); - oldself = self; setself(self.realowner); oldenemy = self.enemy; - self.enemy = oldself.enemy; + self.enemy = this.enemy; c = self.cnt % 4; switch(c) @@ -450,7 +449,7 @@ void W_Seeker_Vollycontroller_Think(void) // TODO: Merge this with W_Seeker_Atta } self.enemy = oldenemy; - setself(oldself); + setself(this); } void W_Seeker_Tracker_Think(void) diff --git a/qcsrc/csqcmodellib/cl_player.qc b/qcsrc/csqcmodellib/cl_player.qc index da10d10ad3..a5afdac8f7 100644 --- a/qcsrc/csqcmodellib/cl_player.qc +++ b/qcsrc/csqcmodellib/cl_player.qc @@ -220,7 +220,6 @@ void CSQCPlayer_SetCamera() if(csqcplayer) { - entity oldself = self; setself(csqcplayer); if(servercommandframe == 0 || clientcommandframe == 0) @@ -298,7 +297,7 @@ void CSQCPlayer_SetCamera() // relink setorigin(self, self.origin); - setself(oldself); + setself(this); } entity view; diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 9981749f00..5e2586cd60 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -307,7 +307,6 @@ float CheatCommand(float argc) cmd = argv(0); switch(cmd) { - entity e; float effectnum, f; vector start, end; entity oldself; @@ -362,7 +361,7 @@ float CheatCommand(float argc) } else { - e = spawn(); + entity e = spawn(); e.model = strzone(argv(1)); e.mdl = "rocket_explode"; e.health = 1000; @@ -404,9 +403,9 @@ float CheatCommand(float argc) } sprint(self, "Usage: sv_cheats 1; restart; cmd penalty 5.0 AHAHAHAHAHAHAH))\n"); break; - case "dragbox_spawn": + case "dragbox_spawn": { IS_CHEAT(0, argc, 0); - e = spawn(); + entity e = spawn(); e.classname = "dragbox_box"; e.think = DragBox_Think; e.nextthink = time; @@ -458,9 +457,10 @@ float CheatCommand(float argc) setorigin(e.killindicator.killindicator, '0 0 8'); DID_CHEAT(); break; - case "dragpoint_spawn": + } + case "dragpoint_spawn": { IS_CHEAT(0, argc, 0); - e = spawn(); + entity e = spawn(); e.classname = "dragpoint"; e.think = DragBox_Think; e.nextthink = time; @@ -493,13 +493,14 @@ float CheatCommand(float argc) setorigin(e.killindicator.killindicator, '0 0 56'); DID_CHEAT(); break; + } case "drag_remove": IS_CHEAT(0, argc, 0); RandomSelection_Init(); crosshair_trace(self); - for(e = world; (e = find(e, classname, "dragbox_box")); ) + for(entity e = world; (e = find(e, classname, "dragbox_box")); ) RandomSelection_Add(e, 0, string_null, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos)); - for(e = world; (e = find(e, classname, "dragpoint")); ) + for(entity e = world; (e = find(e, classname, "dragpoint")); ) RandomSelection_Add(e, 0, string_null, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos)); if(RandomSelection_chosen_ent) { @@ -519,9 +520,9 @@ float CheatCommand(float argc) { RandomSelection_Init(); crosshair_trace(self); - for(e = world; (e = find(e, classname, "dragbox_box")); ) + for(entity e = world; (e = find(e, classname, "dragbox_box")); ) RandomSelection_Add(e, 0, string_null, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos)); - for(e = world; (e = find(e, classname, "dragpoint")); ) + for(entity e = world; (e = find(e, classname, "dragpoint")); ) RandomSelection_Add(e, 0, string_null, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos)); if(RandomSelection_chosen_ent) { @@ -541,11 +542,11 @@ float CheatCommand(float argc) { f = fopen(argv(1), FILE_WRITE); fputs(f, "cmd drag_clear\n"); - for(e = world; (e = find(e, classname, "dragbox_box")); ) + for(entity e = world; (e = find(e, classname, "dragbox_box")); ) { fputs(f, strcat("cmd dragbox_spawn ", ftos(e.cnt), " \"", vtos(e.aiment.origin), "\" \"", vtos(e.enemy.origin), "\"\n")); } - for(e = world; (e = find(e, classname, "dragpoint")); ) + for(entity e = world; (e = find(e, classname, "dragpoint")); ) { fputs(f, strcat("cmd dragpoint_spawn ", ftos(e.cnt), " \"", vtos(e.origin), "\"\n")); } @@ -560,7 +561,7 @@ float CheatCommand(float argc) if(argc == 2) { f = fopen(argv(1), FILE_WRITE); - for(e = world; (e = find(e, classname, "dragbox_box")); ) + for(entity e = world; (e = find(e, classname, "dragbox_box")); ) { fputs(f, "{\n"); fputs(f, "\"classname\" \"trigger_race_checkpoint\"\n"); @@ -570,7 +571,7 @@ float CheatCommand(float argc) fputs(f, strcat("\"targetname\" \"checkpoint", ftos(e.cnt), "\"\n")); fputs(f, "}\n"); } - for(e = world; (e = find(e, classname, "dragpoint")); ) + for(entity e = world; (e = find(e, classname, "dragpoint")); ) { start = '0 0 0'; effectnum = 0; @@ -626,15 +627,15 @@ float CheatCommand(float argc) break; case "drag_clear": IS_CHEAT(0, argc, 0); - for(e = world; (e = find(e, classname, "dragbox_box")); ) + for(entity e = world; (e = find(e, classname, "dragbox_box")); ) remove(e); - for(e = world; (e = find(e, classname, "dragbox_corner_1")); ) + for(entity e = world; (e = find(e, classname, "dragbox_corner_1")); ) remove(e); - for(e = world; (e = find(e, classname, "dragbox_corner_2")); ) + for(entity e = world; (e = find(e, classname, "dragbox_corner_2")); ) remove(e); - for(e = world; (e = find(e, classname, "dragpoint")); ) + for(entity e = world; (e = find(e, classname, "dragpoint")); ) remove(e); - for(e = world; (e = find(e, classname, "drag_digit")); ) + for(entity e = world; (e = find(e, classname, "drag_digit")); ) remove(e); DID_CHEAT(); break; @@ -695,29 +696,26 @@ float CheatCommand(float argc) break; case "usetarget": IS_CHEAT(0, argc, 0); - e = self; setself(spawn()); self.target = argv(1); - activator = e; + activator = this; SUB_UseTargets(); remove(self); - setself(e); + setself(this); DID_CHEAT(); break; case "killtarget": IS_CHEAT(0, argc, 0); - e = self; setself(spawn()); self.killtarget = argv(1); - activator = e; + activator = this; SUB_UseTargets(); remove(self); - setself(e); + setself(this); DID_CHEAT(); break; case "teleporttotarget": IS_CHEAT(0, argc, 0); - e = self; setself(spawn()); setorigin(self, self.origin); self.classname = "cheattriggerteleport"; @@ -725,13 +723,11 @@ float CheatCommand(float argc) teleport_findtarget(); if(!wasfreed(self)) { - Simple_TeleportPlayer(self, e); + Simple_TeleportPlayer(self, this); remove(self); - setself(e); DID_CHEAT(); } - else - setself(e); + setself(this); break; } diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 80d7aadcef..5ba3d86672 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -847,8 +847,8 @@ void KillIndicator_Think() if(self.cnt <= 0) { - setself(self.owner); - ClientKill_Now(); // no oldself needed + SELFCALL(self.owner, ClientKill_Now()); + SELFCALL_DONE(); return; } else if(g_cts && self.health == 1) // health == 1 means that it's silent @@ -2617,15 +2617,14 @@ void PlayerPreThink (void) { self.teamkill_soundtime = 0; - entity oldself = self; setself(self.teamkill_soundsource); entity oldpusher = self.pusher; - self.pusher = oldself; + self.pusher = this; PlayerSound(playersound_teamshoot, CH_VOICE, VOICETYPE_LASTATTACKER_ONLY); self.pusher = oldpusher; - setself(oldself); + setself(this); } if(self.taunt_soundtime) diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 4c35cbbe04..e221dba41e 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -40,81 +40,79 @@ void CopyBody_Think(void) } void CopyBody(float keepvelocity) {SELFPARAM(); - entity oldself; if (self.effects & EF_NODRAW) return; - oldself = self; setself(spawn()); - self.enemy = oldself; - self.lip = oldself.lip; - self.colormap = oldself.colormap; - self.iscreature = oldself.iscreature; - self.teleportable = oldself.teleportable; - self.damagedbycontents = oldself.damagedbycontents; - self.angles = oldself.angles; - self.v_angle = oldself.v_angle; - self.avelocity = oldself.avelocity; + self.enemy = this; + self.lip = this.lip; + self.colormap = this.colormap; + self.iscreature = this.iscreature; + self.teleportable = this.teleportable; + self.damagedbycontents = this.damagedbycontents; + self.angles = this.angles; + self.v_angle = this.v_angle; + self.avelocity = this.avelocity; self.classname = "body"; - self.damageforcescale = oldself.damageforcescale; - self.effects = oldself.effects; - self.glowmod = oldself.glowmod; - self.event_damage = oldself.event_damage; - self.anim_state = oldself.anim_state; - self.anim_time = oldself.anim_time; - self.anim_lower_action = oldself.anim_lower_action; - self.anim_lower_time = oldself.anim_lower_time; - self.anim_upper_action = oldself.anim_upper_action; - self.anim_upper_time = oldself.anim_upper_time; - self.anim_implicit_state = oldself.anim_implicit_state; - self.anim_implicit_time = oldself.anim_implicit_time; - self.anim_lower_implicit_action = oldself.anim_lower_implicit_action; - self.anim_lower_implicit_time = oldself.anim_lower_implicit_time; - self.anim_upper_implicit_action = oldself.anim_upper_implicit_action; - self.anim_upper_implicit_time = oldself.anim_upper_implicit_time; - self.dphitcontentsmask = oldself.dphitcontentsmask; - self.death_time = oldself.death_time; - self.pain_finished = oldself.pain_finished; - self.health = oldself.health; - self.armorvalue = oldself.armorvalue; - self.armortype = oldself.armortype; - self.model = oldself.model; - self.modelindex = oldself.modelindex; - self.skin = oldself.skin; - self.species = oldself.species; - self.movetype = oldself.movetype; - self.solid = oldself.solid; - self.ballistics_density = oldself.ballistics_density; - self.takedamage = oldself.takedamage; - self.customizeentityforclient = oldself.customizeentityforclient; - self.uncustomizeentityforclient = oldself.uncustomizeentityforclient; - self.uncustomizeentityforclient_set = oldself.uncustomizeentityforclient_set; + self.damageforcescale = this.damageforcescale; + self.effects = this.effects; + self.glowmod = this.glowmod; + self.event_damage = this.event_damage; + self.anim_state = this.anim_state; + self.anim_time = this.anim_time; + self.anim_lower_action = this.anim_lower_action; + self.anim_lower_time = this.anim_lower_time; + self.anim_upper_action = this.anim_upper_action; + self.anim_upper_time = this.anim_upper_time; + self.anim_implicit_state = this.anim_implicit_state; + self.anim_implicit_time = this.anim_implicit_time; + self.anim_lower_implicit_action = this.anim_lower_implicit_action; + self.anim_lower_implicit_time = this.anim_lower_implicit_time; + self.anim_upper_implicit_action = this.anim_upper_implicit_action; + self.anim_upper_implicit_time = this.anim_upper_implicit_time; + self.dphitcontentsmask = this.dphitcontentsmask; + self.death_time = this.death_time; + self.pain_finished = this.pain_finished; + self.health = this.health; + self.armorvalue = this.armorvalue; + self.armortype = this.armortype; + self.model = this.model; + self.modelindex = this.modelindex; + self.skin = this.skin; + self.species = this.species; + self.movetype = this.movetype; + self.solid = this.solid; + self.ballistics_density = this.ballistics_density; + self.takedamage = this.takedamage; + self.customizeentityforclient = this.customizeentityforclient; + self.uncustomizeentityforclient = this.uncustomizeentityforclient; + self.uncustomizeentityforclient_set = this.uncustomizeentityforclient_set; if (keepvelocity == 1) - self.velocity = oldself.velocity; + self.velocity = this.velocity; self.oldvelocity = self.velocity; - self.alpha = oldself.alpha; - self.fade_time = oldself.fade_time; - self.fade_rate = oldself.fade_rate; - //self.weapon = oldself.weapon; - setorigin(self, oldself.origin); - setsize(self, oldself.mins, oldself.maxs); - self.prevorigin = oldself.origin; + self.alpha = this.alpha; + self.fade_time = this.fade_time; + self.fade_rate = this.fade_rate; + //self.weapon = this.weapon; + setorigin(self, this.origin); + setsize(self, this.mins, this.maxs); + self.prevorigin = this.origin; self.reset = SUB_Remove; - Drag_MoveDrag(oldself, self); + Drag_MoveDrag(this, self); if(self.colormap <= maxclients && self.colormap > 0) - self.colormap = 1024 + oldself.clientcolors; + self.colormap = 1024 + this.clientcolors; CSQCMODEL_AUTOINIT(self); - self.CopyBody_nextthink = oldself.nextthink; - self.CopyBody_think = oldself.think; + self.CopyBody_nextthink = this.nextthink; + self.CopyBody_think = this.think; self.nextthink = time; self.think = CopyBody_Think; // "bake" the current animation frame for clones (they don't get clientside animation) animdecide_load_if_needed(self); animdecide_setframes(self, false, frame, frame1time, frame2, frame2time); - setself(oldself); + setself(this); } float player_getspecies() diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 93005391f5..70100db991 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -624,7 +624,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d if (gameover || targ.killcount == -666) return; - entity oldself = self; setself(targ); damage_targ = targ; damage_inflictor = inflictor; @@ -643,7 +642,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d if(IS_PLAYER(targ)) if(SAME_TEAM(targ, attacker)) { - setself(oldself); + setself(this); return; } } @@ -763,7 +762,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d { Send_Effect(EFFECT_TELEPORT, targ.origin, '0 0 0', 1); - entity oldself = self; setself(targ); entity spot = SelectSpawnPoint (false); @@ -794,7 +792,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d Send_Effect(EFFECT_TELEPORT, self.origin, '0 0 0', 1); } - setself(oldself); + setself(this); } if(!g_instagib) @@ -911,7 +909,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d if (damage != 0 || (self.damageforcescale && vlen(force))) if (self.event_damage) self.event_damage (inflictor, attacker, damage, deathtype, hitloc, force); - setself(oldself); + setself(this); // apply mirror damage if any if(mirrordamage > 0 || mirrorforce > 0) diff --git a/qcsrc/server/mutators/gamemode_assault.qc b/qcsrc/server/mutators/gamemode_assault.qc index 163e423602..2cab4918dd 100644 --- a/qcsrc/server/mutators/gamemode_assault.qc +++ b/qcsrc/server/mutators/gamemode_assault.qc @@ -70,19 +70,18 @@ void assault_objective_decrease_use() PlayerTeamScore_Add(activator, SP_ASSAULT_OBJECTIVES, ST_ASSAULT_OBJECTIVES, 1); self.enemy.health = -1; - entity oldself, oldactivator, head; + entity oldactivator, head; - oldself = self; - setself(oldself.enemy); + setself(this.enemy); if(self.message) FOR_EACH_PLAYER(head) centerprint(head, self.message); oldactivator = activator; - activator = oldself; + activator = this; SUB_UseTargets(); activator = oldactivator; - setself(oldself); + setself(this); } } } diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 28775ea017..6cf7c1a654 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -846,11 +846,10 @@ void ctf_FlagThink() self.health = 0; ctf_CheckFlagReturn(self, RETURN_SPEEDRUN); - tmp_entity = self; setself(self.owner); self.impulse = CHIMPULSE_SPEEDRUN; // move the player back to the waypoint they set ImpulseCommands(); - setself(tmp_entity); + setself(this); } if(autocvar_g_ctf_stalemate) { @@ -2382,7 +2381,6 @@ 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 = self; setself(spawn()); self.classname = "ctf_team"; self.netname = teamname; @@ -2390,7 +2388,7 @@ void ctf_SpawnTeam (string teamname, int teamcolor) spawnfunc_ctf_team(); - setself(oldself); + setself(this); } void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to be set up. diff --git a/qcsrc/server/mutators/gamemode_domination.qc b/qcsrc/server/mutators/gamemode_domination.qc index 21179e912c..322c7e0dd6 100644 --- a/qcsrc/server/mutators/gamemode_domination.qc +++ b/qcsrc/server/mutators/gamemode_domination.qc @@ -544,7 +544,6 @@ 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 = self; setself(spawn()); self.classname = "dom_team"; self.netname = teamname; @@ -565,19 +564,18 @@ void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float p self.team = self.cnt + 1; //eprint(self); - setself(oldself); + setself(this); } void dom_spawnpoint(vector org) {SELFPARAM(); - entity oldself = self; setself(spawn()); self.classname = "dom_controlpoint"; self.think = spawnfunc_dom_controlpoint; self.nextthink = time; setorigin(self, org); spawnfunc_dom_controlpoint(); - setself(oldself); + setself(this); } // spawn some default teams if the map is not set up for domination diff --git a/qcsrc/server/mutators/gamemode_nexball.qc b/qcsrc/server/mutators/gamemode_nexball.qc index 5b11699131..fad911386c 100644 --- a/qcsrc/server/mutators/gamemode_nexball.qc +++ b/qcsrc/server/mutators/gamemode_nexball.qc @@ -59,18 +59,16 @@ void ball_restart(void) void nexball_setstatus(void) {SELFPARAM(); - entity oldself; self.items &= ~IT_KEY1; if(self.ballcarried) { if(self.ballcarried.teamtime && (self.ballcarried.teamtime < time)) { bprint("The ", Team_ColoredFullName(self.team), " held the ball for too long.\n"); - oldself = self; setself(self.ballcarried); DropBall(self, self.owner.origin, '0 0 0'); ResetBall(); - setself(oldself); + setself(this); } else self.items |= IT_KEY1; @@ -153,15 +151,14 @@ void GiveBall(entity plyr, entity ball) ball.nextthink = time + autocvar_g_nexball_basketball_delay_hold; } - ownr = self; + plyr.weaponentity.weapons = plyr.weapons; + plyr.weaponentity.switchweapon = plyr.weapon; + plyr.weapons = WEPSET_PORTO; setself(plyr); - self.weaponentity.weapons = self.weapons; - self.weaponentity.switchweapon = self.weapon; - self.weapons = WEPSET_PORTO; WEP_ACTION(WEP_PORTO.m_id, WR_RESETPLAYER); - self.switchweapon = WEP_PORTO.m_id; + plyr.switchweapon = WEP_PORTO.m_id; W_SwitchWeapon(WEP_PORTO.m_id); - setself(ownr); + setself(this); } void DropBall(entity ball, vector org, vector vel) diff --git a/qcsrc/server/mutators/gamemode_onslaught.qc b/qcsrc/server/mutators/gamemode_onslaught.qc index c069dc1538..1372bd09d9 100644 --- a/qcsrc/server/mutators/gamemode_onslaught.qc +++ b/qcsrc/server/mutators/gamemode_onslaught.qc @@ -345,8 +345,6 @@ 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; } if (self.owner.isshielded) @@ -404,11 +402,10 @@ void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damag onslaught_updatelinks(); // Use targets now (somebody make sure this is in the right place..) - oself = self; setself(self.owner); activator = self; SUB_UseTargets (); - setself(oself); + setself(this); self.owner.waslinked = self.owner.islinked; if(self.owner.model != "models/onslaught/controlpoint_pad.md3") @@ -423,7 +420,6 @@ 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; if(autocvar_g_onslaught_cp_proxydecap) @@ -478,11 +474,10 @@ void ons_ControlPoint_Icon_Think() if(!self.owner.islinked) self.owner.team = 0; - oself = self; setself(self.owner); activator = self; SUB_UseTargets (); - setself(oself); + setself(this); self.owner.team = t; @@ -503,7 +498,6 @@ void ons_ControlPoint_Icon_Think() void ons_ControlPoint_Icon_BuildThink() {SELFPARAM(); - entity oself; int a; self.nextthink = time + ONS_CP_THINKRATE; @@ -545,11 +539,10 @@ void ons_ControlPoint_Icon_BuildThink() onslaught_updatelinks(); // Use targets now (somebody make sure this is in the right place..) - oself = self; setself(self.owner); activator = self; SUB_UseTargets (); - setself(oself); + setself(this); self.SendFlags |= CPSF_SETUP; } diff --git a/qcsrc/server/mutators/mutator_overkill.qc b/qcsrc/server/mutators/mutator_overkill.qc index 364fa01c4a..d7739d8eec 100644 --- a/qcsrc/server/mutators/mutator_overkill.qc +++ b/qcsrc/server/mutators/mutator_overkill.qc @@ -72,7 +72,6 @@ MUTATOR_HOOKFUNCTION(ok_PlayerDamage_SplitHealthArmor) MUTATOR_HOOKFUNCTION(ok_PlayerDies) {SELFPARAM(); - entity oldself = self; entity targ = ((frag_attacker) ? frag_attacker : frag_target); if(IS_MONSTER(self)) @@ -93,7 +92,7 @@ MUTATOR_HOOKFUNCTION(ok_PlayerDies) self.velocity = '0 0 200' + normalize(targ.origin - self.origin) * 500; self.classname = "droppedweapon"; // hax SUB_SetFade(self, time + 5, 1); - setself(oldself); + setself(this); self.ok_lastwep = self.switchweapon; diff --git a/qcsrc/server/mutators/mutator_superspec.qc b/qcsrc/server/mutators/mutator_superspec.qc index 1bb5872a0f..e7bb9d0182 100644 --- a/qcsrc/server/mutators/mutator_superspec.qc +++ b/qcsrc/server/mutators/mutator_superspec.qc @@ -100,7 +100,6 @@ float superspec_filteritem(entity _for, entity _item) MUTATOR_HOOKFUNCTION(superspec_ItemTouch) {SELFPARAM(); - entity _oldself = self; entity _item = self; entity e; @@ -118,7 +117,7 @@ MUTATOR_HOOKFUNCTION(superspec_ItemTouch) { _spectate(other); - setself(_oldself); + setself(this); return MUT_ITEMTOUCH_CONTINUE; } } @@ -148,7 +147,7 @@ MUTATOR_HOOKFUNCTION(superspec_ItemTouch) } } - setself(_oldself); + setself(this); return MUT_ITEMTOUCH_CONTINUE; } diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 111303e8ba..c83f5252fe 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -736,7 +736,7 @@ float race_waypointsprite_visible_for_player(entity e) float have_verified; void trigger_race_checkpoint_verify() {SELFPARAM(); - entity oldself, cp; + entity cp; float i, p; float qual; @@ -746,7 +746,6 @@ void trigger_race_checkpoint_verify() qual = g_race_qualifying; - oldself = self; setself(spawn()); self.classname = "player"; @@ -895,7 +894,7 @@ void trigger_race_checkpoint_verify() } } remove(self); - setself(oldself); + setself(this); } vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector current) diff --git a/qcsrc/server/t_items.qc b/qcsrc/server/t_items.qc index fc131e5b24..47165c7732 100644 --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@ -477,16 +477,15 @@ void Item_RespawnCountdown (void) if(self.waypointsprite_attached) { - entity e; - entity it = self; setself(self.waypointsprite_attached); + entity e; FOR_EACH_REALCLIENT(e) if(self.waypointsprite_visible_for_player(e)) { msg_entity = e; - soundto(MSG_ONE, it, CH_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTEN_NORM); // play respawn sound + soundto(MSG_ONE, this, CH_TRIGGER, "misc/itemrespawncountdown.wav", VOL_BASE, ATTEN_NORM); // play respawn sound } - setself(it); + setself(this); WaypointSprite_Ping(self.waypointsprite_attached); //WaypointSprite_UpdateHealth(self.waypointsprite_attached, self.count); diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 83323f4bf8..de240ce2ef 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -20,7 +20,6 @@ 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; if(time < self.hasweapon_complain_spam) complain = 0; @@ -47,7 +46,6 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) } else { - oldself = self; setself(cl); f = WEP_ACTION(wpn, WR_CHECKAMMO1); f = f + WEP_ACTION(wpn, WR_CHECKAMMO2); @@ -58,7 +56,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain) for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self) f = 1; - setself(oldself); + setself(this); } if (!f) { diff --git a/qcsrc/server/weapons/spawning.qc b/qcsrc/server/weapons/spawning.qc index 57302ee7fe..202b29fda7 100644 --- a/qcsrc/server/weapons/spawning.qc +++ b/qcsrc/server/weapons/spawning.qc @@ -39,7 +39,6 @@ void weapon_defaultspawnfunc(float wpn) entity e; float t; string s; - entity oldself; float i, j; int f; @@ -67,7 +66,6 @@ void weapon_defaultspawnfunc(float wpn) if(t >= 2) { self.team = --internalteam; - oldself = self; for(i = 1; i < t; ++i) { s = argv(i); @@ -77,7 +75,7 @@ void weapon_defaultspawnfunc(float wpn) if(e.netname == s) { setself(spawn()); - copyentity(oldself, self); + copyentity(this, self); self.classname = "replacedweapon"; weapon_defaultspawnfunc(j); break; @@ -85,10 +83,10 @@ void weapon_defaultspawnfunc(float wpn) } if(j > WEP_LAST) { - LOG_INFO("The weapon replace list for ", oldself.classname, " contains an unknown weapon ", s, ". Skipped.\n"); + LOG_INFO("The weapon replace list for ", this.classname, " contains an unknown weapon ", s, ". Skipped.\n"); } } - setself(oldself); + setself(this); } if(t >= 1) // always the case! { diff --git a/qcsrc/warpzonelib/server.qc b/qcsrc/warpzonelib/server.qc index ba17091ac6..bda756bba4 100644 --- a/qcsrc/warpzonelib/server.qc +++ b/qcsrc/warpzonelib/server.qc @@ -159,8 +159,6 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1) void WarpZone_Touch (void) {SELFPARAM(); - entity oldself; - if(other.classname == "trigger_warpzone") return; @@ -205,14 +203,13 @@ void WarpZone_Touch (void) if (!self.target) self.target = save1; if (!self.target3) self.target3 = save2; - oldself = self; setself(self.enemy); save1 = self.target; self.target = string_null; save2 = self.target2; self.target2 = string_null; SUB_UseTargets(); if (!self.target) self.target = save1; if (!self.target2) self.target2 = save2; - setself(oldself); + setself(this); } else { @@ -776,16 +773,14 @@ void WarpZone_Think() || self.warpzone_save_eorigin != self.enemy.origin || self.warpzone_save_eangles != self.enemy.angles) { - entity oldself; - oldself = self; WarpZone_InitStep_UpdateTransform(); setself(self.enemy); WarpZone_InitStep_UpdateTransform(); - setself(oldself); + setself(this); WarpZone_InitStep_FinalizeTransform(); setself(self.enemy); WarpZone_InitStep_FinalizeTransform(); - setself(oldself); + setself(this); self.warpzone_save_origin = self.origin; self.warpzone_save_angles = self.angles; self.warpzone_save_eorigin = self.enemy.origin; @@ -811,8 +806,7 @@ void WarpZone_StartFrame() WarpZone_PostInitialize_Callback(); } - entity oldself, oldother; - oldself = self; + entity oldother; oldother = other; for(e = world; (e = nextent(e)); ) { @@ -849,7 +843,7 @@ void WarpZone_StartFrame() break; } } - setself(oldself); + setself(this); other = oldother; }