From: Mario Date: Thu, 19 May 2016 20:08:48 +0000 (+1000) Subject: spawnfunc and SendEntity3 have a 'this' parameter, use it X-Git-Tag: xonotic-v0.8.2~924 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=301702fff6cd39f10c89eef9880cd9a85fe5c53e;p=xonotic%2Fxonotic-data.pk3dir.git spawnfunc and SendEntity3 have a 'this' parameter, use it --- diff --git a/qcsrc/common/effects/qc/damageeffects.qc b/qcsrc/common/effects/qc/damageeffects.qc index c894ea154..9291a3599 100644 --- a/qcsrc/common/effects/qc/damageeffects.qc +++ b/qcsrc/common/effects/qc/damageeffects.qc @@ -20,15 +20,15 @@ REGISTER_NET_LINKED(ENT_CLIENT_DAMAGEINFO) bool Damage_DamageInfo_SendEntity(entity this, entity to, int sf) { WriteHeader(MSG_ENTITY, ENT_CLIENT_DAMAGEINFO); - WriteShort(MSG_ENTITY, self.projectiledeathtype); - WriteCoord(MSG_ENTITY, floor(self.origin.x)); - WriteCoord(MSG_ENTITY, floor(self.origin.y)); - WriteCoord(MSG_ENTITY, floor(self.origin.z)); - WriteByte(MSG_ENTITY, bound(1, self.dmg, 255)); - WriteByte(MSG_ENTITY, bound(0, self.dmg_radius, 255)); - WriteByte(MSG_ENTITY, bound(1, self.dmg_edge, 255)); - WriteShort(MSG_ENTITY, self.oldorigin.x); - WriteByte(MSG_ENTITY, self.species); + WriteShort(MSG_ENTITY, this.projectiledeathtype); + WriteCoord(MSG_ENTITY, floor(this.origin.x)); + WriteCoord(MSG_ENTITY, floor(this.origin.y)); + WriteCoord(MSG_ENTITY, floor(this.origin.z)); + WriteByte(MSG_ENTITY, bound(1, this.dmg, 255)); + WriteByte(MSG_ENTITY, bound(0, this.dmg_radius, 255)); + WriteByte(MSG_ENTITY, bound(1, this.dmg_edge, 255)); + WriteShort(MSG_ENTITY, this.oldorigin.x); + WriteByte(MSG_ENTITY, this.species); return true; } diff --git a/qcsrc/common/effects/qc/modeleffects.qc b/qcsrc/common/effects/qc/modeleffects.qc index 84b083b95..f57776290 100644 --- a/qcsrc/common/effects/qc/modeleffects.qc +++ b/qcsrc/common/effects/qc/modeleffects.qc @@ -14,43 +14,43 @@ bool modeleffect_SendEntity(entity this, entity to, int sf) WriteHeader(MSG_ENTITY, ENT_CLIENT_MODELEFFECT); f = 0; - if(self.velocity != '0 0 0') + if(this.velocity != '0 0 0') f |= 1; - if(self.angles != '0 0 0') + if(this.angles != '0 0 0') f |= 2; - if(self.avelocity != '0 0 0') + if(this.avelocity != '0 0 0') f |= 4; WriteByte(MSG_ENTITY, f); - WriteShort(MSG_ENTITY, self.modelindex); - WriteByte(MSG_ENTITY, self.skin); - WriteByte(MSG_ENTITY, self.frame); - WriteCoord(MSG_ENTITY, self.origin.x); - WriteCoord(MSG_ENTITY, self.origin.y); - WriteCoord(MSG_ENTITY, self.origin.z); + WriteShort(MSG_ENTITY, this.modelindex); + WriteByte(MSG_ENTITY, this.skin); + WriteByte(MSG_ENTITY, this.frame); + WriteCoord(MSG_ENTITY, this.origin.x); + WriteCoord(MSG_ENTITY, this.origin.y); + WriteCoord(MSG_ENTITY, this.origin.z); if(f & 1) { - WriteCoord(MSG_ENTITY, self.velocity.x); - WriteCoord(MSG_ENTITY, self.velocity.y); - WriteCoord(MSG_ENTITY, self.velocity.z); + WriteCoord(MSG_ENTITY, this.velocity.x); + WriteCoord(MSG_ENTITY, this.velocity.y); + WriteCoord(MSG_ENTITY, this.velocity.z); } if(f & 2) { - WriteCoord(MSG_ENTITY, self.angles.x); - WriteCoord(MSG_ENTITY, self.angles.y); - WriteCoord(MSG_ENTITY, self.angles.z); + WriteCoord(MSG_ENTITY, this.angles.x); + WriteCoord(MSG_ENTITY, this.angles.y); + WriteCoord(MSG_ENTITY, this.angles.z); } if(f & 4) { - WriteCoord(MSG_ENTITY, self.avelocity.x); - WriteCoord(MSG_ENTITY, self.avelocity.y); - WriteCoord(MSG_ENTITY, self.avelocity.z); + WriteCoord(MSG_ENTITY, this.avelocity.x); + WriteCoord(MSG_ENTITY, this.avelocity.y); + WriteCoord(MSG_ENTITY, this.avelocity.z); } - WriteShort(MSG_ENTITY, self.scale * 256.0); - WriteShort(MSG_ENTITY, self.scale2 * 256.0); - WriteByte(MSG_ENTITY, self.teleport_time * 100.0); - WriteByte(MSG_ENTITY, self.fade_time * 100.0); - WriteByte(MSG_ENTITY, self.alpha * 255.0); + WriteShort(MSG_ENTITY, this.scale * 256.0); + WriteShort(MSG_ENTITY, this.scale2 * 256.0); + WriteByte(MSG_ENTITY, this.teleport_time * 100.0); + WriteByte(MSG_ENTITY, this.fade_time * 100.0); + WriteByte(MSG_ENTITY, this.alpha * 255.0); return true; } diff --git a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc index d95df1f5e..d4cc871d9 100644 --- a/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc +++ b/qcsrc/common/gamemodes/gamemode/nexball/nexball.qc @@ -105,20 +105,20 @@ void nexball_setstatus() } } -void relocate_nexball() -{SELFPARAM(); - tracebox(self.origin, BALL_MINS, BALL_MAXS, self.origin, true, self); +void relocate_nexball(entity this) +{ + tracebox(this.origin, BALL_MINS, BALL_MAXS, this.origin, true, this); if(trace_startsolid) { vector o; - o = self.origin; - if(!move_out_of_solid(self)) + o = this.origin; + if(!move_out_of_solid(this)) objerror("could not get out of solid at all!"); - LOG_INFO("^1NOTE: this map needs FIXING. ", self.classname, " at ", vtos(o - '0 0 1')); - LOG_INFO(" needs to be moved out of solid, e.g. by '", ftos(self.origin.x - o.x)); - LOG_INFO(" ", ftos(self.origin.y - o.y)); - LOG_INFO(" ", ftos(self.origin.z - o.z), "'\n"); - self.origin = o; + LOG_INFO("^1NOTE: this map needs FIXING. ", this.classname, " at ", vtos(o - '0 0 1')); + LOG_INFO(" needs to be moved out of solid, e.g. by '", ftos(this.origin.x - o.x)); + LOG_INFO(" ", ftos(this.origin.y - o.y)); + LOG_INFO(" ", ftos(this.origin.z - o.z), "'\n"); + this.origin = o; } } @@ -444,10 +444,10 @@ spawnfunc(nexball_team) { if(!g_nexball) { - remove(self); + remove(this); return; } - self.team = self.cnt + 1; + this.team = this.cnt + 1; } void nb_spawnteam(string teamname, float teamcolor) @@ -512,62 +512,62 @@ void nb_delayedinit(entity this) // spawnfuncs // //=======================// -void SpawnBall() -{SELFPARAM(); - if(!g_nexball) { remove(self); return; } +void SpawnBall(entity this) +{ + if(!g_nexball) { remove(this); return; } // balls += 4; // using the remaining bits to count balls will leave more than the max edict count, so it's fine - if(self.model == "") + if(this.model == "") { - self.model = "models/nexball/ball.md3"; - self.scale = 1.3; + this.model = "models/nexball/ball.md3"; + this.scale = 1.3; } - precache_model(self.model); - _setmodel(self, self.model); - setsize(self, BALL_MINS, BALL_MAXS); - ball_scale = self.scale; + precache_model(this.model); + _setmodel(this, this.model); + setsize(this, BALL_MINS, BALL_MAXS); + ball_scale = this.scale; - relocate_nexball(); - self.spawnorigin = self.origin; + relocate_nexball(this); + this.spawnorigin = this.origin; - self.effects = self.effects | EF_LOWPRECISION; + this.effects = this.effects | EF_LOWPRECISION; - if(cvar(strcat("g_", self.classname, "_trail"))) //nexball_basketball :p + if(cvar(strcat("g_", this.classname, "_trail"))) //nexball_basketball :p { - self.glow_color = autocvar_g_nexball_trail_color; - self.glow_trail = true; + this.glow_color = autocvar_g_nexball_trail_color; + this.glow_trail = true; } - self.movetype = MOVETYPE_FLY; + this.movetype = MOVETYPE_FLY; if(!autocvar_g_nexball_sound_bounce) - self.noise = ""; - else if(self.noise == "") - self.noise = strzone(SND(NB_BOUNCE)); + this.noise = ""; + else if(this.noise == "") + this.noise = strzone(SND(NB_BOUNCE)); //bounce sound placeholder (FIXME) - if(self.noise1 == "") - self.noise1 = strzone(SND(NB_DROP)); + if(this.noise1 == "") + this.noise1 = strzone(SND(NB_DROP)); //ball drop sound placeholder (FIXME) - if(self.noise2 == "") - self.noise2 = strzone(SND(NB_STEAL)); + if(this.noise2 == "") + this.noise2 = strzone(SND(NB_STEAL)); //stealing sound placeholder (FIXME) - if(self.noise) precache_sound(self.noise); - precache_sound(self.noise1); - precache_sound(self.noise2); + if(this.noise) precache_sound(this.noise); + precache_sound(this.noise1); + precache_sound(this.noise2); - WaypointSprite_AttachCarrier(WP_NbBall, self, RADARICON_FLAGCARRIER); // the ball's team is not set yet, no rule update needed + WaypointSprite_AttachCarrier(WP_NbBall, this, RADARICON_FLAGCARRIER); // the ball's team is not set yet, no rule update needed - self.reset = ball_restart; - self.think = InitBall; - self.nextthink = game_starttime + autocvar_g_nexball_delay_start; + this.reset = ball_restart; + this.think = InitBall; + this.nextthink = game_starttime + autocvar_g_nexball_delay_start; } spawnfunc(nexball_basketball) { nexball_mode |= NBM_BASKETBALL; - self.classname = "nexball_basketball"; + this.classname = "nexball_basketball"; if (!(balls & BALL_BASKET)) { /* @@ -578,26 +578,26 @@ spawnfunc(nexball_basketball) */ autocvar_g_nexball_basketball_effects_default = autocvar_g_nexball_basketball_effects_default & BALL_EFFECTMASK; } - if(!self.effects) - self.effects = autocvar_g_nexball_basketball_effects_default; - self.solid = SOLID_TRIGGER; - self.pushable = autocvar_g_nexball_basketball_jumppad; + if(!this.effects) + this.effects = autocvar_g_nexball_basketball_effects_default; + this.solid = SOLID_TRIGGER; + this.pushable = autocvar_g_nexball_basketball_jumppad; balls |= BALL_BASKET; - self.bouncefactor = autocvar_g_nexball_basketball_bouncefactor; - self.bouncestop = autocvar_g_nexball_basketball_bouncestop; - SpawnBall(); + this.bouncefactor = autocvar_g_nexball_basketball_bouncefactor; + this.bouncestop = autocvar_g_nexball_basketball_bouncestop; + SpawnBall(this); } spawnfunc(nexball_football) { nexball_mode |= NBM_FOOTBALL; - self.classname = "nexball_football"; - self.solid = SOLID_TRIGGER; + this.classname = "nexball_football"; + this.solid = SOLID_TRIGGER; balls |= BALL_FOOT; - self.pushable = autocvar_g_nexball_football_jumppad; - self.bouncefactor = autocvar_g_nexball_football_bouncefactor; - self.bouncestop = autocvar_g_nexball_football_bouncestop; - SpawnBall(); + this.pushable = autocvar_g_nexball_football_jumppad; + this.bouncefactor = autocvar_g_nexball_football_bouncefactor; + this.bouncestop = autocvar_g_nexball_football_bouncestop; + SpawnBall(this); } float nb_Goal_Customize() @@ -610,61 +610,61 @@ float nb_Goal_Customize() return true; } -void SpawnGoal() -{SELFPARAM(); - if(!g_nexball) { remove(self); return; } +void SpawnGoal(entity this) +{ + if(!g_nexball) { remove(this); return; } - EXACTTRIGGER_INIT; + WITHSELF(this, WarpZoneLib_ExactTrigger_Init()); - if(self.team != GOAL_OUT && Team_TeamToNumber(self.team) != -1) + if(this.team != GOAL_OUT && Team_TeamToNumber(this.team) != -1) { - entity wp = WaypointSprite_SpawnFixed(WP_NbGoal, (self.absmin + self.absmax) * 0.5, self, sprite, RADARICON_NONE); - wp.colormod = ((self.team) ? Team_ColorRGB(self.team) : '1 0.5 0'); - self.sprite.customizeentityforclient = nb_Goal_Customize; + entity wp = WaypointSprite_SpawnFixed(WP_NbGoal, (this.absmin + this.absmax) * 0.5, this, sprite, RADARICON_NONE); + wp.colormod = ((this.team) ? Team_ColorRGB(this.team) : '1 0.5 0'); + this.sprite.customizeentityforclient = nb_Goal_Customize; } - self.classname = "nexball_goal"; - if(self.noise == "") - self.noise = "ctf/respawn.wav"; - precache_sound(self.noise); - self.touch = GoalTouch; + this.classname = "nexball_goal"; + if(this.noise == "") + this.noise = "ctf/respawn.wav"; + precache_sound(this.noise); + this.touch = GoalTouch; } spawnfunc(nexball_redgoal) { - self.team = NUM_TEAM_1; - SpawnGoal(); + this.team = NUM_TEAM_1; + SpawnGoal(this); } spawnfunc(nexball_bluegoal) { - self.team = NUM_TEAM_2; - SpawnGoal(); + this.team = NUM_TEAM_2; + SpawnGoal(this); } spawnfunc(nexball_yellowgoal) { - self.team = NUM_TEAM_3; - SpawnGoal(); + this.team = NUM_TEAM_3; + SpawnGoal(this); } spawnfunc(nexball_pinkgoal) { - self.team = NUM_TEAM_4; - SpawnGoal(); + this.team = NUM_TEAM_4; + SpawnGoal(this); } spawnfunc(nexball_fault) { - self.team = GOAL_FAULT; - if(self.noise == "") - self.noise = strzone(SND(TYPEHIT)); - SpawnGoal(); + this.team = GOAL_FAULT; + if(this.noise == "") + this.noise = strzone(SND(TYPEHIT)); + SpawnGoal(this); } spawnfunc(nexball_out) { - self.team = GOAL_OUT; - if(self.noise == "") - self.noise = strzone(SND(TYPEHIT)); - SpawnGoal(); + this.team = GOAL_OUT; + if(this.noise == "") + this.noise = strzone(SND(TYPEHIT)); + SpawnGoal(this); } // diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc index bb302998f..6653f28ad 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/onslaught.qc @@ -2183,16 +2183,16 @@ keys: */ spawnfunc(onslaught_link) { - if(!g_onslaught) { remove(self); return; } + if(!g_onslaught) { remove(this); return; } - if (self.target == "" || self.target2 == "") + if (this.target == "" || this.target2 == "") objerror("target and target2 must be set\n"); - self.ons_worldlinknext = ons_worldlinklist; // link into ons_worldlinklist - ons_worldlinklist = self; + this.ons_worldlinknext = ons_worldlinklist; // link into ons_worldlinklist + ons_worldlinklist = this; - InitializeEntity(self, ons_DelayedLinkSetup, INITPRIO_FINDTARGET); - Net_LinkEntity(self, false, 0, ons_Link_Send); + InitializeEntity(this, ons_DelayedLinkSetup, INITPRIO_FINDTARGET); + Net_LinkEntity(this, false, 0, ons_Link_Send); } /*QUAKED spawnfunc_onslaught_controlpoint (0 .5 .8) (-32 -32 0) (32 32 128) @@ -2208,9 +2208,9 @@ keys: spawnfunc(onslaught_controlpoint) { - if(!g_onslaught) { remove(self); return; } + if(!g_onslaught) { remove(this); return; } - ons_ControlPoint_Setup(self); + ons_ControlPoint_Setup(this); } /*QUAKED spawnfunc_onslaught_generator (0 .5 .8) (-32 -32 -24) (32 32 64) @@ -2224,10 +2224,10 @@ keys: */ spawnfunc(onslaught_generator) { - if(!g_onslaught) { remove(self); return; } - if(!self.team) { objerror("team must be set"); } + if(!g_onslaught) { remove(this); return; } + if(!this.team) { objerror("team must be set"); } - ons_GeneratorSetup(self); + ons_GeneratorSetup(this); } // scoreboard setup diff --git a/qcsrc/common/minigames/cl_minigames.qc b/qcsrc/common/minigames/cl_minigames.qc index f080e90d0..4e3bfc25d 100644 --- a/qcsrc/common/minigames/cl_minigames.qc +++ b/qcsrc/common/minigames/cl_minigames.qc @@ -156,24 +156,24 @@ void minigame_player_entremove(entity this) string() ReadString_Raw = #366; string ReadString_Zoned() { return strzone(ReadString_Raw()); } #define ReadString ReadString_Zoned -#define FIELD(Flags, Type,Name) if ( sf & (Flags) ) self.Name = Read##Type(); +#define FIELD(Flags, Type,Name) if ( sf & (Flags) ) this.Name = Read##Type(); #define MSLE(Name,Fields) \ - else if ( self.classname == #Name ) { \ + else if ( this.classname == #Name ) { \ if ( sf & MINIG_SF_CREATE ) { \ minigame_read_owner(); \ - self.entremove = msle_entremove_##Name; \ + this.entremove = msle_entremove_##Name; \ } \ - minigame_ent = self.owner; \ + minigame_ent = this.owner; \ Fields \ } void minigame_read_owner() {SELFPARAM(); string owner_name = ReadString_Raw(); - self.owner = world; + this.owner = world; do - self.owner = find(self.owner,netname,owner_name); - while ( self.owner && self.owner.classname != "minigame" ); - if ( !self.owner ) + this.owner = find(this.owner,netname,owner_name); + while ( this.owner && this.owner.classname != "minigame" ); + if ( !this.owner ) LOG_TRACE("Got a minigame entity without a minigame!\n"); } NET_HANDLE(ENT_CLIENT_MINIGAME, bool isnew) @@ -181,63 +181,63 @@ NET_HANDLE(ENT_CLIENT_MINIGAME, bool isnew) float sf = ReadByte(); if ( sf & MINIG_SF_CREATE ) { - self.classname = msle_classname(ReadShort()); - self.netname = ReadString_Zoned(); + this.classname = msle_classname(ReadShort()); + this.netname = ReadString_Zoned(); } entity minigame_ent = world; - if ( self.classname == "minigame" ) + if ( this.classname == "minigame" ) { - minigame_ent = self; + minigame_ent = this; if ( sf & MINIG_SF_CREATE ) { - self.entremove = minigame_entremove; - self.descriptor = minigame_get_descriptor(ReadString_Raw()); - if ( !self.descriptor ) + this.entremove = minigame_entremove; + this.descriptor = minigame_get_descriptor(ReadString_Raw()); + if ( !this.descriptor ) LOG_TRACE("Got a minigame without a client-side descriptor!\n"); else - self.minigame_event = self.descriptor.minigame_event; + this.minigame_event = this.descriptor.minigame_event; } if ( sf & MINIG_SF_UPDATE ) - self.minigame_flags = ReadLong(); + this.minigame_flags = ReadLong(); } - else if ( self.classname == "minigame_player" ) + else if ( this.classname == "minigame_player" ) { float activate = 0; if ( sf & MINIG_SF_CREATE ) { - self.entremove = minigame_player_entremove; + this.entremove = minigame_player_entremove; minigame_read_owner(); float ent = ReadLong(); - self.minigame_playerslot = ent; + this.minigame_playerslot = ent; LOG_DEBUG("Player: ",entcs_GetName(ent-1),"\n"); - activate = (ent == player_localnum+1 && self.owner && self.owner != active_minigame); + activate = (ent == player_localnum+1 && this.owner && this.owner != active_minigame); } - minigame_ent = self.owner; + minigame_ent = this.owner; if ( sf & MINIG_SF_UPDATE ) - self.team = ReadByte(); + this.team = ReadByte(); if ( activate ) { - minigame_self = self; - activate_minigame(self.owner); + minigame_self = this; + activate_minigame(this.owner); } } MINIGAME_SIMPLELINKED_ENTITIES if ( minigame_ent ) - minigame_ent.minigame_event(minigame_ent,"network_receive",self,sf); + minigame_ent.minigame_event(minigame_ent,"network_receive",this,sf); if ( sf & MINIG_SF_CREATE ) { - LOG_DEBUG("CL Reading entity: ",ftos(etof(self)), - " classname:",self.classname," enttype:",ftos(self.enttype) ); - LOG_DEBUG(" sf:",ftos(sf)," netname:",self.netname,"\n\n"); + LOG_DEBUG("CL Reading entity: ",ftos(etof(this)), + " classname:",this.classname," enttype:",ftos(this.enttype) ); + LOG_DEBUG(" sf:",ftos(sf)," netname:",this.netname,"\n\n"); } return true; } diff --git a/qcsrc/common/minigames/sv_minigames.qc b/qcsrc/common/minigames/sv_minigames.qc index 991544189..fe10459ff 100644 --- a/qcsrc/common/minigames/sv_minigames.qc +++ b/qcsrc/common/minigames/sv_minigames.qc @@ -65,35 +65,35 @@ bool minigame_SendEntity(entity this, entity to, int sf) if ( sf & MINIG_SF_CREATE ) { - WriteShort(MSG_ENTITY,msle_id(self.classname)); - WriteString(MSG_ENTITY,self.netname); + WriteShort(MSG_ENTITY,msle_id(this.classname)); + WriteString(MSG_ENTITY,this.netname); } - entity minigame_ent = self.owner; + entity minigame_ent = this.owner; - if ( self.classname == "minigame" ) + if ( this.classname == "minigame" ) { - minigame_ent = self; + minigame_ent = this; if ( sf & MINIG_SF_CREATE ) - WriteString(MSG_ENTITY,self.descriptor.netname); + WriteString(MSG_ENTITY,this.descriptor.netname); if ( sf & MINIG_SF_UPDATE ) - WriteLong(MSG_ENTITY,self.minigame_flags); + WriteLong(MSG_ENTITY,this.minigame_flags); } - else if ( self.classname == "minigame_player" ) + else if ( this.classname == "minigame_player" ) { if ( sf & MINIG_SF_CREATE ) { - WriteString(MSG_ENTITY,self.owner.netname); - WriteLong(MSG_ENTITY,etof(self.minigame_players)); + WriteString(MSG_ENTITY,this.owner.netname); + WriteLong(MSG_ENTITY,etof(this.minigame_players)); } if ( sf & MINIG_SF_UPDATE ) - WriteByte(MSG_ENTITY,self.team); + WriteByte(MSG_ENTITY,this.team); } MINIGAME_SIMPLELINKED_ENTITIES - minigame_ent.minigame_event(minigame_ent,"network_send",self,sf); + minigame_ent.minigame_event(minigame_ent,"network_send",this,sf); return true; diff --git a/qcsrc/common/mutators/mutator/buffs/all.qh b/qcsrc/common/mutators/mutator/buffs/all.qh index 8e1319b39..66f83d1c5 100644 --- a/qcsrc/common/mutators/mutator/buffs/all.qh +++ b/qcsrc/common/mutators/mutator/buffs/all.qh @@ -46,9 +46,9 @@ STATIC_INIT(REGISTER_BUFFS) { void buff_Init(entity ent); void buff_Init_Compat(entity ent, entity replacement); #define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \ - self.buffs = b.m_itemid; \ - self.team = t; \ - buff_Init(self); \ + this.buffs = b.m_itemid; \ + this.team = t; \ + buff_Init(this); \ } #define BUFF_SPAWNFUNCS(e, b) \ BUFF_SPAWNFUNC(e, b, 0) \ @@ -56,7 +56,7 @@ STATIC_INIT(REGISTER_BUFFS) { 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) spawnfunc(item_##o) { buff_Init_Compat(self, r); } + #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) spawnfunc(item_##o) { buff_Init_Compat(this, r); } #else #define BUFF_SPAWNFUNC(e, b, t) #define BUFF_SPAWNFUNCS(e, b) diff --git a/qcsrc/common/mutators/mutator/instagib/instagib.qc b/qcsrc/common/mutators/mutator/instagib/instagib.qc index ec11970fe..575e95210 100644 --- a/qcsrc/common/mutators/mutator/instagib/instagib.qc +++ b/qcsrc/common/mutators/mutator/instagib/instagib.qc @@ -24,8 +24,8 @@ REGISTER_MUTATOR(mutator_instagib, cvar("g_instagib") && !g_nexball); spawnfunc(item_minst_cells) { - if (!g_instagib) { remove(self); return; } - if (!self.ammo_cells) self.ammo_cells = autocvar_g_instagib_ammo_drop; + if (!g_instagib) { remove(this); return; } + if (!this.ammo_cells) this.ammo_cells = autocvar_g_instagib_ammo_drop; StartItem(this, ITEM_VaporizerCells); } diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index 086590985..5bbf8c644 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -14,29 +14,29 @@ bool WaypointSprite_SendEntity(entity this, entity to, float sendflags) sendflags = sendflags & 0x7F; - if (self.max_health || (self.pain_finished && (time < self.pain_finished + 0.25))) + if (this.max_health || (this.pain_finished && (time < this.pain_finished + 0.25))) sendflags |= 0x80; int f = 0; - if(self.currentammo) + if(this.currentammo) f |= 1; // hideable - if(self.exteriormodeltoclient == to) + if(this.exteriormodeltoclient == to) f |= 2; // my own MUTATOR_CALLHOOK(SendWaypoint, this, to, sendflags, f); WriteByte(MSG_ENTITY, sendflags); - WriteByte(MSG_ENTITY, self.wp_extra); + WriteByte(MSG_ENTITY, this.wp_extra); if (sendflags & 0x80) { - if (self.max_health) + if (this.max_health) { - WriteByte(MSG_ENTITY, (self.health / self.max_health) * 191.0); + WriteByte(MSG_ENTITY, (this.health / this.max_health) * 191.0); } else { - float dt = self.pain_finished - time; + float dt = this.pain_finished - time; dt = bound(0, dt * 32, 16383); WriteByte(MSG_ENTITY, (dt & 0xFF00) / 256 + 192); WriteByte(MSG_ENTITY, (dt & 0x00FF)); @@ -45,44 +45,44 @@ bool WaypointSprite_SendEntity(entity this, entity to, float sendflags) if (sendflags & 64) { - WriteCoord(MSG_ENTITY, self.origin.x); - WriteCoord(MSG_ENTITY, self.origin.y); - WriteCoord(MSG_ENTITY, self.origin.z); + WriteCoord(MSG_ENTITY, this.origin.x); + WriteCoord(MSG_ENTITY, this.origin.y); + WriteCoord(MSG_ENTITY, this.origin.z); } if (sendflags & 1) { - WriteByte(MSG_ENTITY, self.team); - WriteByte(MSG_ENTITY, self.rule); + WriteByte(MSG_ENTITY, this.team); + WriteByte(MSG_ENTITY, this.rule); } if (sendflags & 2) - WriteString(MSG_ENTITY, self.model1); + WriteString(MSG_ENTITY, this.model1); if (sendflags & 4) - WriteString(MSG_ENTITY, self.model2); + WriteString(MSG_ENTITY, this.model2); if (sendflags & 8) - WriteString(MSG_ENTITY, self.model3); + WriteString(MSG_ENTITY, this.model3); if (sendflags & 16) { - WriteCoord(MSG_ENTITY, self.fade_time); - WriteCoord(MSG_ENTITY, self.teleport_time); - WriteShort(MSG_ENTITY, self.fade_rate); // maxdist + WriteCoord(MSG_ENTITY, this.fade_time); + WriteCoord(MSG_ENTITY, this.teleport_time); + WriteShort(MSG_ENTITY, this.fade_rate); // maxdist WriteByte(MSG_ENTITY, f); } if (sendflags & 32) { - WriteByte(MSG_ENTITY, self.cnt); // icon on radar - WriteByte(MSG_ENTITY, self.colormod.x * 255.0); - WriteByte(MSG_ENTITY, self.colormod.y * 255.0); - WriteByte(MSG_ENTITY, self.colormod.z * 255.0); + WriteByte(MSG_ENTITY, this.cnt); // icon on radar + WriteByte(MSG_ENTITY, this.colormod.x * 255.0); + WriteByte(MSG_ENTITY, this.colormod.y * 255.0); + WriteByte(MSG_ENTITY, this.colormod.z * 255.0); - if (WaypointSprite_isteammate(self.owner, WaypointSprite_getviewentity(to))) + if (WaypointSprite_isteammate(this.owner, WaypointSprite_getviewentity(to))) { - float dt = (self.waypointsprite_helpmetime - time) / 0.1; + float dt = (this.waypointsprite_helpmetime - time) / 0.1; if (dt < 0) dt = 0; if (dt > 255) diff --git a/qcsrc/common/triggers/func/bobbing.qc b/qcsrc/common/triggers/func/bobbing.qc index 909f5cd97..0dcba018e 100644 --- a/qcsrc/common/triggers/func/bobbing.qc +++ b/qcsrc/common/triggers/func/bobbing.qc @@ -31,53 +31,53 @@ dmgtime : See above. spawnfunc(func_bobbing) { entity controller; - if (self.noise != "") + if (this.noise != "") { - precache_sound(self.noise); - soundto(MSG_INIT, self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE); + precache_sound(this.noise); + soundto(MSG_INIT, this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_IDLE); } - if (!self.speed) - self.speed = 4; - if (!self.height) - self.height = 32; + if (!this.speed) + this.speed = 4; + if (!this.height) + this.height = 32; // center of bobbing motion - self.destvec = self.origin; + this.destvec = this.origin; // time scale to get degrees - self.cnt = 360 / self.speed; + this.cnt = 360 / this.speed; - self.active = ACTIVE_ACTIVE; + this.active = ACTIVE_ACTIVE; // damage when blocked - self.blocked = generic_plat_blocked; - if(self.dmg && (self.message == "")) - self.message = " was squished"; - if(self.dmg && (self.message2 == "")) - self.message2 = "was squished by"; - if(self.dmg && (!self.dmgtime)) - self.dmgtime = 0.25; - self.dmgtime2 = time; + this.blocked = generic_plat_blocked; + if(this.dmg && (this.message == "")) + this.message = " was squished"; + if(this.dmg && (this.message2 == "")) + this.message2 = "was squished by"; + if(this.dmg && (!this.dmgtime)) + this.dmgtime = 0.25; + this.dmgtime2 = time; // how far to bob - if (self.spawnflags & 1) // X - self.movedir = '1 0 0' * self.height; - else if (self.spawnflags & 2) // Y - self.movedir = '0 1 0' * self.height; + if (this.spawnflags & 1) // X + this.movedir = '1 0 0' * this.height; + else if (this.spawnflags & 2) // Y + this.movedir = '0 1 0' * this.height; else // Z - self.movedir = '0 0 1' * self.height; + this.movedir = '0 0 1' * this.height; - if (!InitMovingBrushTrigger()) + if (!InitMovingBrushTrigger(this)) return; // wait for targets to spawn controller = new(func_bobbing_controller); - controller.owner = self; + controller.owner = this; controller.nextthink = time + 1; controller.think = func_bobbing_controller_think; - self.SUB_NEXTTHINK = self.SUB_LTIME + 999999999; - self.SUB_THINK = SUB_NullThink; + this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999; + this.SUB_THINK = SUB_NullThink; // Savage: Reduce bandwith, critical on e.g. nexdm02 - self.effects |= EF_LOWPRECISION; + this.effects |= EF_LOWPRECISION; // TODO make a reset function for this one } diff --git a/qcsrc/common/triggers/func/breakable.qc b/qcsrc/common/triggers/func/breakable.qc index 25857be3a..82e529160 100644 --- a/qcsrc/common/triggers/func/breakable.qc +++ b/qcsrc/common/triggers/func/breakable.qc @@ -319,7 +319,7 @@ spawnfunc(func_breakable) this.dmg_force = 200; this.mdl = this.model; - SetBrushEntityModel(); + WITHSELF(this, SetBrushEntityModel()); if(this.spawnflags & 4) this.use = func_breakable_destroy; diff --git a/qcsrc/common/triggers/func/button.qc b/qcsrc/common/triggers/func/button.qc index a1cabdc6c..ecc1fdf8e 100644 --- a/qcsrc/common/triggers/func/button.qc +++ b/qcsrc/common/triggers/func/button.qc @@ -49,14 +49,14 @@ void button_fire() SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, button_wait); } -void button_reset() -{SELFPARAM(); - self.health = self.max_health; - setorigin(self, self.pos1); - self.frame = 0; // use normal textures - self.state = STATE_BOTTOM; - if (self.health) - self.takedamage = DAMAGE_YES; // can be shot again +void button_reset(entity this) +{ + this.health = this.max_health; + setorigin(this, this.pos1); + this.frame = 0; // use normal textures + this.state = STATE_BOTTOM; + if (this.health) + this.takedamage = DAMAGE_YES; // can be shot again } void button_use(entity this, entity actor, entity trigger) @@ -113,42 +113,42 @@ When a button is touched, it moves some distance in the direction of it's angle, */ spawnfunc(func_button) { - SetMovedir(self); + SetMovedir(this); - if (!InitMovingBrushTrigger()) + if (!InitMovingBrushTrigger(this)) return; - self.effects |= EF_LOWPRECISION; + this.effects |= EF_LOWPRECISION; - self.blocked = button_blocked; - self.use = button_use; + this.blocked = button_blocked; + this.use = button_use; -// if (self.health == 0) // all buttons are now shootable -// self.health = 10; - if (self.health) +// if (this.health == 0) // all buttons are now shootable +// this.health = 10; + if (this.health) { - self.max_health = self.health; - self.event_damage = button_damage; - self.takedamage = DAMAGE_YES; + this.max_health = this.health; + this.event_damage = button_damage; + this.takedamage = DAMAGE_YES; } else - self.touch = button_touch; + this.touch = button_touch; - if (!self.speed) - self.speed = 40; - if (!self.wait) - self.wait = 1; - if (!self.lip) - self.lip = 4; + if (!this.speed) + this.speed = 40; + if (!this.wait) + this.wait = 1; + if (!this.lip) + this.lip = 4; - if(self.noise != "") - precache_sound(self.noise); + if(this.noise != "") + precache_sound(this.noise); - self.active = ACTIVE_ACTIVE; + this.active = ACTIVE_ACTIVE; - self.pos1 = self.origin; - self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip); - self.flags |= FL_NOTARGET; + this.pos1 = this.origin; + this.pos2 = this.pos1 + this.movedir*(fabs(this.movedir*this.size) - this.lip); + this.flags |= FL_NOTARGET; - button_reset(); + button_reset(this); } #endif diff --git a/qcsrc/common/triggers/func/conveyor.qc b/qcsrc/common/triggers/func/conveyor.qc index 5cd17e7bf..d3c1abf73 100644 --- a/qcsrc/common/triggers/func/conveyor.qc +++ b/qcsrc/common/triggers/func/conveyor.qc @@ -108,8 +108,8 @@ bool conveyor_send(entity this, entity to, int sf) return true; } -void conveyor_init() -{SELFPARAM(); +void conveyor_init(entity this) +{ if (!this.speed) this.speed = 200; this.movedir *= this.speed; this.think = conveyor_think; @@ -132,17 +132,17 @@ void conveyor_init() spawnfunc(trigger_conveyor) { - SetMovedir(self); + SetMovedir(this); EXACTTRIGGER_INIT; - conveyor_init(); + conveyor_init(this); } spawnfunc(func_conveyor) { - SetMovedir(self); - InitMovingBrushTrigger(); - self.movetype = MOVETYPE_NONE; - conveyor_init(); + SetMovedir(this); + InitMovingBrushTrigger(this); + this.movetype = MOVETYPE_NONE; + conveyor_init(this); } #elif defined(CSQC) diff --git a/qcsrc/common/triggers/func/door.qc b/qcsrc/common/triggers/func/door.qc index 30de40fa9..7fe9ba55c 100644 --- a/qcsrc/common/triggers/func/door.qc +++ b/qcsrc/common/triggers/func/door.qc @@ -717,78 +717,78 @@ void door_reset(entity this) spawnfunc(func_door) { // Quake 1 keys compatibility - if (self.spawnflags & SPAWNFLAGS_GOLD_KEY) - self.itemkeys |= ITEM_KEY_BIT(0); - if (self.spawnflags & SPAWNFLAGS_SILVER_KEY) - self.itemkeys |= ITEM_KEY_BIT(1); + if (this.spawnflags & SPAWNFLAGS_GOLD_KEY) + this.itemkeys |= ITEM_KEY_BIT(0); + if (this.spawnflags & SPAWNFLAGS_SILVER_KEY) + this.itemkeys |= ITEM_KEY_BIT(1); - SetMovedir(self); + SetMovedir(this); - self.max_health = self.health; - if (!InitMovingBrushTrigger()) + this.max_health = this.health; + if (!InitMovingBrushTrigger(this)) return; - self.effects |= EF_LOWPRECISION; - self.classname = "door"; + this.effects |= EF_LOWPRECISION; + this.classname = "door"; - if(self.noise == "") - self.noise = "misc/talk.wav"; - if(self.noise3 == "") - self.noise3 = "misc/talk.wav"; - precache_sound(self.noise); - precache_sound(self.noise3); + if(this.noise == "") + this.noise = "misc/talk.wav"; + if(this.noise3 == "") + this.noise3 = "misc/talk.wav"; + precache_sound(this.noise); + precache_sound(this.noise3); - self.blocked = door_blocked; - self.use = door_use; + this.blocked = door_blocked; + this.use = door_use; - if(self.dmg && (self.message == "")) - self.message = "was squished"; - if(self.dmg && (self.message2 == "")) - self.message2 = "was squished by"; + if(this.dmg && (this.message == "")) + this.message = "was squished"; + if(this.dmg && (this.message2 == "")) + this.message2 = "was squished by"; - if (self.sounds > 0) + if (this.sounds > 0) { precache_sound ("plats/medplat1.wav"); precache_sound ("plats/medplat2.wav"); - self.noise2 = "plats/medplat1.wav"; - self.noise1 = "plats/medplat2.wav"; + this.noise2 = "plats/medplat1.wav"; + this.noise1 = "plats/medplat2.wav"; } - if (!self.speed) - self.speed = 100; - if (!self.wait) - self.wait = 3; - if (!self.lip) - self.lip = 8; + if (!this.speed) + this.speed = 100; + if (!this.wait) + this.wait = 3; + if (!this.lip) + this.lip = 8; - self.pos1 = self.SUB_ORIGIN; - self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip); + this.pos1 = this.SUB_ORIGIN; + this.pos2 = this.pos1 + this.movedir*(fabs(this.movedir*this.size) - this.lip); - if(self.spawnflags & DOOR_NONSOLID) - self.solid = SOLID_NOT; + if(this.spawnflags & DOOR_NONSOLID) + this.solid = SOLID_NOT; // DOOR_START_OPEN is to allow an entity to be lighted in the closed position // but spawn in the open position - if (self.spawnflags & DOOR_START_OPEN) - InitializeEntity(self, door_init_startopen, INITPRIO_SETLOCATION); + if (this.spawnflags & DOOR_START_OPEN) + InitializeEntity(this, door_init_startopen, INITPRIO_SETLOCATION); - self.state = STATE_BOTTOM; + this.state = STATE_BOTTOM; - if (self.health) + if (this.health) { - self.takedamage = DAMAGE_YES; - self.event_damage = door_damage; + this.takedamage = DAMAGE_YES; + this.event_damage = door_damage; } - if (self.items) - self.wait = -1; + if (this.items) + this.wait = -1; - self.touch = door_touch; + this.touch = door_touch; // LinkDoors can't be done until all of the doors have been spawned, so // the sizes can be detected properly. - InitializeEntity(self, LinkDoors, INITPRIO_LINKDOORS); + InitializeEntity(this, LinkDoors, INITPRIO_LINKDOORS); - self.reset = door_reset; + this.reset = door_reset; } #elif defined(CSQC) diff --git a/qcsrc/common/triggers/func/door_rotating.qc b/qcsrc/common/triggers/func/door_rotating.qc index 4c97fe6a8..ae7918c82 100644 --- a/qcsrc/common/triggers/func/door_rotating.qc +++ b/qcsrc/common/triggers/func/door_rotating.qc @@ -47,80 +47,80 @@ void door_rotating_init_startopen(entity this) spawnfunc(func_door_rotating) { - //if (!self.deathtype) // map makers can override this - // self.deathtype = " got in the way"; + //if (!this.deathtype) // map makers can override this + // this.deathtype = " got in the way"; // I abuse "movedir" for denoting the axis for now - if (self.spawnflags & 64) // X (untested) - self.movedir = '0 0 1'; - else if (self.spawnflags & 128) // Y (untested) - self.movedir = '1 0 0'; + if (this.spawnflags & 64) // X (untested) + this.movedir = '0 0 1'; + else if (this.spawnflags & 128) // Y (untested) + this.movedir = '1 0 0'; else // Z - self.movedir = '0 1 0'; + this.movedir = '0 1 0'; - if (self.angles_y==0) self.angles_y = 90; + if (this.angles_y==0) this.angles_y = 90; - self.movedir = self.movedir * self.angles_y; - self.angles = '0 0 0'; + this.movedir = this.movedir * this.angles_y; + this.angles = '0 0 0'; - self.max_health = self.health; - self.avelocity = self.movedir; - if (!InitMovingBrushTrigger()) + this.max_health = this.health; + this.avelocity = this.movedir; + if (!InitMovingBrushTrigger(this)) return; - self.velocity = '0 0 0'; - //self.effects |= EF_LOWPRECISION; - self.classname = "door_rotating"; + this.velocity = '0 0 0'; + //this.effects |= EF_LOWPRECISION; + this.classname = "door_rotating"; - self.blocked = door_blocked; - self.use = door_use; + this.blocked = door_blocked; + this.use = door_use; - if(self.spawnflags & 8) - self.dmg = 10000; + if(this.spawnflags & 8) + this.dmg = 10000; - if(self.dmg && (self.message == "")) - self.message = "was squished"; - if(self.dmg && (self.message2 == "")) - self.message2 = "was squished by"; + if(this.dmg && (this.message == "")) + this.message = "was squished"; + if(this.dmg && (this.message2 == "")) + this.message2 = "was squished by"; - if (self.sounds > 0) + if (this.sounds > 0) { precache_sound ("plats/medplat1.wav"); precache_sound ("plats/medplat2.wav"); - self.noise2 = "plats/medplat1.wav"; - self.noise1 = "plats/medplat2.wav"; + this.noise2 = "plats/medplat1.wav"; + this.noise1 = "plats/medplat2.wav"; } - if (!self.speed) - self.speed = 50; - if (!self.wait) - self.wait = 1; - self.lip = 0; // self.lip is used to remember reverse opening direction for door_rotating + if (!this.speed) + this.speed = 50; + if (!this.wait) + this.wait = 1; + this.lip = 0; // this.lip is used to remember reverse opening direction for door_rotating - self.pos1 = '0 0 0'; - self.pos2 = self.movedir; + this.pos1 = '0 0 0'; + this.pos2 = this.movedir; // DOOR_START_OPEN is to allow an entity to be lighted in the closed position // but spawn in the open position - if (self.spawnflags & DOOR_START_OPEN) - InitializeEntity(self, door_rotating_init_startopen, INITPRIO_SETLOCATION); + if (this.spawnflags & DOOR_START_OPEN) + InitializeEntity(this, door_rotating_init_startopen, INITPRIO_SETLOCATION); - self.state = STATE_BOTTOM; + this.state = STATE_BOTTOM; - if (self.health) + if (this.health) { - self.takedamage = DAMAGE_YES; - self.event_damage = door_damage; + this.takedamage = DAMAGE_YES; + this.event_damage = door_damage; } - if (self.items) - self.wait = -1; + if (this.items) + this.wait = -1; - self.touch = door_touch; + this.touch = door_touch; // LinkDoors can't be done until all of the doors have been spawned, so // the sizes can be detected properly. - InitializeEntity(self, LinkDoors, INITPRIO_LINKDOORS); + InitializeEntity(this, LinkDoors, INITPRIO_LINKDOORS); - self.reset = door_rotating_reset; + this.reset = door_rotating_reset; } #endif diff --git a/qcsrc/common/triggers/func/door_secret.qc b/qcsrc/common/triggers/func/door_secret.qc index 3e4530204..aa00cd45d 100644 --- a/qcsrc/common/triggers/func/door_secret.qc +++ b/qcsrc/common/triggers/func/door_secret.qc @@ -207,7 +207,7 @@ spawnfunc(func_door_secret) this.mangle = this.angles; this.angles = '0 0 0'; this.classname = "door"; - if (!InitMovingBrushTrigger()) return; + if (!InitMovingBrushTrigger(this)) return; this.effects |= EF_LOWPRECISION; if (this.noise == "") this.noise = "misc/talk.wav"; diff --git a/qcsrc/common/triggers/func/fourier.qc b/qcsrc/common/triggers/func/fourier.qc index 31e383591..a793b3e7b 100644 --- a/qcsrc/common/triggers/func/fourier.qc +++ b/qcsrc/common/triggers/func/fourier.qc @@ -42,46 +42,46 @@ void func_fourier_controller_think() spawnfunc(func_fourier) { entity controller; - if (self.noise != "") + if (this.noise != "") { - precache_sound(self.noise); - soundto(MSG_INIT, self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE); + precache_sound(this.noise); + soundto(MSG_INIT, this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_IDLE); } - if (!self.speed) - self.speed = 4; - if (!self.height) - self.height = 32; - self.destvec = self.origin; - self.cnt = 360 / self.speed; - - self.blocked = generic_plat_blocked; - if(self.dmg && (self.message == "")) - self.message = " was squished"; - if(self.dmg && (self.message2 == "")) - self.message2 = "was squished by"; - if(self.dmg && (!self.dmgtime)) - self.dmgtime = 0.25; - self.dmgtime2 = time; - - if(self.netname == "") - self.netname = "1 0 0 0 1"; - - if (!InitMovingBrushTrigger()) + if (!this.speed) + this.speed = 4; + if (!this.height) + this.height = 32; + this.destvec = this.origin; + this.cnt = 360 / this.speed; + + this.blocked = generic_plat_blocked; + if(this.dmg && (this.message == "")) + this.message = " was squished"; + if(this.dmg && (this.message2 == "")) + this.message2 = "was squished by"; + if(this.dmg && (!this.dmgtime)) + this.dmgtime = 0.25; + this.dmgtime2 = time; + + if(this.netname == "") + this.netname = "1 0 0 0 1"; + + if (!InitMovingBrushTrigger(this)) return; - self.active = ACTIVE_ACTIVE; + this.active = ACTIVE_ACTIVE; // wait for targets to spawn controller = new(func_fourier_controller); - controller.owner = self; + controller.owner = this; controller.nextthink = time + 1; controller.think = func_fourier_controller_think; - self.SUB_NEXTTHINK = self.SUB_LTIME + 999999999; - self.SUB_THINK = SUB_NullThink; // for PushMove + this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999; + this.SUB_THINK = SUB_NullThink; // for PushMove // Savage: Reduce bandwith, critical on e.g. nexdm02 - self.effects |= EF_LOWPRECISION; + this.effects |= EF_LOWPRECISION; // TODO make a reset function for this one } diff --git a/qcsrc/common/triggers/func/ladder.qc b/qcsrc/common/triggers/func/ladder.qc index 04c5c2563..ea8af7198 100644 --- a/qcsrc/common/triggers/func/ladder.qc +++ b/qcsrc/common/triggers/func/ladder.qc @@ -32,31 +32,29 @@ bool func_ladder_send(entity to, int sf) return true; } -void func_ladder_link() +void func_ladder_link(entity this) { - SELFPARAM(); - self.SendEntity = func_ladder_send; - self.SendFlags = 0xFFFFFF; - //self.model = "null"; + this.SendEntity = func_ladder_send; + this.SendFlags = 0xFFFFFF; + //this.model = "null"; } -void func_ladder_init() +void func_ladder_init(entity this) { - SELFPARAM(); - self.touch = func_ladder_touch; + this.touch = func_ladder_touch; - trigger_init(self); - func_ladder_link(); + trigger_init(this); + func_ladder_link(this); } spawnfunc(func_ladder) { - func_ladder_init(); + func_ladder_init(this); } spawnfunc(func_water) { - func_ladder_init(); + func_ladder_init(this); } #elif defined(CSQC) @@ -70,17 +68,17 @@ void func_ladder_remove(entity this) NET_HANDLE(ENT_CLIENT_LADDER, bool isnew) { - self.classname = strzone(ReadString()); - self.skin = ReadByte(); - self.speed = ReadCoord(); + this.classname = strzone(ReadString()); + this.skin = ReadByte(); + this.speed = ReadCoord(); trigger_common_read(false); - self.solid = SOLID_TRIGGER; - self.move_touch = func_ladder_touch; - self.drawmask = MASK_NORMAL; - self.move_time = time; - self.entremove = func_ladder_remove; + this.solid = SOLID_TRIGGER; + this.move_touch = func_ladder_touch; + this.drawmask = MASK_NORMAL; + this.move_time = time; + this.entremove = func_ladder_remove; return true; } diff --git a/qcsrc/common/triggers/func/pendulum.qc b/qcsrc/common/triggers/func/pendulum.qc index 2d8aea35c..e59881ddc 100644 --- a/qcsrc/common/triggers/func/pendulum.qc +++ b/qcsrc/common/triggers/func/pendulum.qc @@ -24,52 +24,52 @@ void func_pendulum_controller_think() spawnfunc(func_pendulum) { entity controller; - if (self.noise != "") + if (this.noise != "") { - precache_sound(self.noise); - soundto(MSG_INIT, self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE); + precache_sound(this.noise); + soundto(MSG_INIT, this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_IDLE); } - self.active = ACTIVE_ACTIVE; + this.active = ACTIVE_ACTIVE; // keys: angle, speed, phase, noise, freq - if(!self.speed) - self.speed = 30; - // not initializing self.dmg to 2, to allow damageless pendulum + if(!this.speed) + this.speed = 30; + // not initializing this.dmg to 2, to allow damageless pendulum - if(self.dmg && (self.message == "")) - self.message = " was squished"; - if(self.dmg && (self.message2 == "")) - self.message2 = "was squished by"; - if(self.dmg && (!self.dmgtime)) - self.dmgtime = 0.25; - self.dmgtime2 = time; + if(this.dmg && (this.message == "")) + this.message = " was squished"; + if(this.dmg && (this.message2 == "")) + this.message2 = "was squished by"; + if(this.dmg && (!this.dmgtime)) + this.dmgtime = 0.25; + this.dmgtime2 = time; - self.blocked = generic_plat_blocked; + this.blocked = generic_plat_blocked; - self.avelocity_z = 0.0000001; - if (!InitMovingBrushTrigger()) + this.avelocity_z = 0.0000001; + if (!InitMovingBrushTrigger(this)) return; - if(!self.freq) + if(!this.freq) { // find pendulum length (same formula as Q3A) - self.freq = 1 / (M_PI * 2) * sqrt(autocvar_sv_gravity / (3 * max(8, fabs(self.mins_z)))); + this.freq = 1 / (M_PI * 2) * sqrt(autocvar_sv_gravity / (3 * max(8, fabs(this.mins_z)))); } // copy initial angle - self.cnt = self.angles_z; + this.cnt = this.angles_z; // wait for targets to spawn controller = new(func_pendulum_controller); - controller.owner = self; + controller.owner = this; controller.nextthink = time + 1; controller.think = func_pendulum_controller_think; - self.nextthink = self.SUB_LTIME + 999999999; - self.SUB_THINK = SUB_NullThink; // for PushMove + this.nextthink = this.SUB_LTIME + 999999999; + this.SUB_THINK = SUB_NullThink; // for PushMove - //self.effects |= EF_LOWPRECISION; + //this.effects |= EF_LOWPRECISION; // TODO make a reset function for this one } diff --git a/qcsrc/common/triggers/func/plat.qc b/qcsrc/common/triggers/func/plat.qc index 14cfa5641..02822e7d2 100644 --- a/qcsrc/common/triggers/func/plat.qc +++ b/qcsrc/common/triggers/func/plat.qc @@ -101,7 +101,7 @@ spawnfunc(func_plat) this.angles = '0 0 0'; this.classname = "plat"; - if (!InitMovingBrushTrigger()) + if (!InitMovingBrushTrigger(this)) return; this.effects |= EF_LOWPRECISION; setsize (this, this.mins , this.maxs); diff --git a/qcsrc/common/triggers/func/rainsnow.qc b/qcsrc/common/triggers/func/rainsnow.qc index fc4630318..1bb1bd47b 100644 --- a/qcsrc/common/triggers/func/rainsnow.qc +++ b/qcsrc/common/triggers/func/rainsnow.qc @@ -4,16 +4,16 @@ REGISTER_NET_LINKED(ENT_CLIENT_RAINSNOW) bool rainsnow_SendEntity(entity this, entity to, float sf) { WriteHeader(MSG_ENTITY, ENT_CLIENT_RAINSNOW); - WriteByte(MSG_ENTITY, self.state); - WriteCoord(MSG_ENTITY, self.origin_x + self.mins_x); - WriteCoord(MSG_ENTITY, self.origin_y + self.mins_y); - WriteCoord(MSG_ENTITY, self.origin_z + self.mins_z); - WriteCoord(MSG_ENTITY, self.maxs_x - self.mins_x); - WriteCoord(MSG_ENTITY, self.maxs_y - self.mins_y); - WriteCoord(MSG_ENTITY, self.maxs_z - self.mins_z); - WriteShort(MSG_ENTITY, compressShortVector(self.dest)); - WriteShort(MSG_ENTITY, self.count); - WriteByte(MSG_ENTITY, self.cnt); + WriteByte(MSG_ENTITY, this.state); + WriteCoord(MSG_ENTITY, this.origin_x + this.mins_x); + WriteCoord(MSG_ENTITY, this.origin_y + this.mins_y); + WriteCoord(MSG_ENTITY, this.origin_z + this.mins_z); + WriteCoord(MSG_ENTITY, this.maxs_x - this.mins_x); + WriteCoord(MSG_ENTITY, this.maxs_y - this.mins_y); + WriteCoord(MSG_ENTITY, this.maxs_z - this.mins_z); + WriteShort(MSG_ENTITY, compressShortVector(this.dest)); + WriteShort(MSG_ENTITY, this.count); + WriteByte(MSG_ENTITY, this.cnt); return true; } @@ -30,28 +30,28 @@ Keys: */ spawnfunc(func_rain) { - self.dest = self.velocity; - self.velocity = '0 0 0'; - if (!self.dest) - self.dest = '0 0 -700'; - self.angles = '0 0 0'; - self.movetype = MOVETYPE_NONE; - self.solid = SOLID_NOT; + this.dest = this.velocity; + this.velocity = '0 0 0'; + if (!this.dest) + this.dest = '0 0 -700'; + this.angles = '0 0 0'; + this.movetype = MOVETYPE_NONE; + this.solid = SOLID_NOT; SetBrushEntityModel(); - if (!self.cnt) - self.cnt = 12; - if (!self.count) - self.count = 2000; - self.count = 0.01 * self.count * (self.size_x / 1024) * (self.size_y / 1024); - if (self.count < 1) - self.count = 1; - if(self.count > 65535) - self.count = 65535; + if (!this.cnt) + this.cnt = 12; + if (!this.count) + this.count = 2000; + this.count = 0.01 * this.count * (this.size_x / 1024) * (this.size_y / 1024); + if (this.count < 1) + this.count = 1; + if(this.count > 65535) + this.count = 65535; - self.state = 1; // 1 is rain, 0 is snow - self.Version = 1; + this.state = 1; // 1 is rain, 0 is snow + this.Version = 1; - Net_LinkEntity(self, false, 0, rainsnow_SendEntity); + Net_LinkEntity(this, false, 0, rainsnow_SendEntity); } @@ -68,28 +68,28 @@ Keys: */ spawnfunc(func_snow) { - self.dest = self.velocity; - self.velocity = '0 0 0'; - if (!self.dest) - self.dest = '0 0 -300'; - self.angles = '0 0 0'; - self.movetype = MOVETYPE_NONE; - self.solid = SOLID_NOT; + this.dest = this.velocity; + this.velocity = '0 0 0'; + if (!this.dest) + this.dest = '0 0 -300'; + this.angles = '0 0 0'; + this.movetype = MOVETYPE_NONE; + this.solid = SOLID_NOT; SetBrushEntityModel(); - if (!self.cnt) - self.cnt = 12; - if (!self.count) - self.count = 2000; - self.count = 0.01 * self.count * (self.size_x / 1024) * (self.size_y / 1024); - if (self.count < 1) - self.count = 1; - if(self.count > 65535) - self.count = 65535; + if (!this.cnt) + this.cnt = 12; + if (!this.count) + this.count = 2000; + this.count = 0.01 * this.count * (this.size_x / 1024) * (this.size_y / 1024); + if (this.count < 1) + this.count = 1; + if(this.count > 65535) + this.count = 65535; - self.state = 0; // 1 is rain, 0 is snow - self.Version = 1; + this.state = 0; // 1 is rain, 0 is snow + this.Version = 1; - Net_LinkEntity(self, false, 0, rainsnow_SendEntity); + Net_LinkEntity(this, false, 0, rainsnow_SendEntity); } #elif defined(CSQC) void Draw_Rain(entity this) @@ -104,29 +104,29 @@ void Draw_Snow(entity this) NET_HANDLE(ENT_CLIENT_RAINSNOW, bool isnew) { - self.impulse = ReadByte(); // Rain, Snow, or Whatever - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); - self.maxs_x = ReadCoord(); - self.maxs_y = ReadCoord(); - self.maxs_z = ReadCoord(); - self.velocity = decompressShortVector(ReadShort()); - self.count = ReadShort() * 10; - self.glow_color = ReadByte(); // color + this.impulse = ReadByte(); // Rain, Snow, or Whatever + this.origin_x = ReadCoord(); + this.origin_y = ReadCoord(); + this.origin_z = ReadCoord(); + this.maxs_x = ReadCoord(); + this.maxs_y = ReadCoord(); + this.maxs_z = ReadCoord(); + this.velocity = decompressShortVector(ReadShort()); + this.count = ReadShort() * 10; + this.glow_color = ReadByte(); // color return = true; - self.mins = -0.5 * self.maxs; - self.maxs = 0.5 * self.maxs; - self.origin = self.origin - self.mins; + this.mins = -0.5 * this.maxs; + this.maxs = 0.5 * this.maxs; + this.origin = this.origin - this.mins; - setorigin(self, self.origin); - setsize(self, self.mins, self.maxs); - self.solid = SOLID_NOT; - if(self.impulse) - self.draw = Draw_Rain; + setorigin(this, this.origin); + setsize(this, this.mins, this.maxs); + this.solid = SOLID_NOT; + if(this.impulse) + this.draw = Draw_Rain; else - self.draw = Draw_Snow; + this.draw = Draw_Snow; } #endif diff --git a/qcsrc/common/triggers/func/rotating.qc b/qcsrc/common/triggers/func/rotating.qc index 3f481ae78..3f9a88f28 100644 --- a/qcsrc/common/triggers/func/rotating.qc +++ b/qcsrc/common/triggers/func/rotating.qc @@ -27,49 +27,49 @@ dmgtime : See above. spawnfunc(func_rotating) { - if (self.noise != "") + if (this.noise != "") { - precache_sound(self.noise); - ambientsound(self.origin, self.noise, VOL_BASE, ATTEN_IDLE); + precache_sound(this.noise); + ambientsound(this.origin, this.noise, VOL_BASE, ATTEN_IDLE); } - self.active = ACTIVE_ACTIVE; - self.setactive = func_rotating_setactive; + this.active = ACTIVE_ACTIVE; + this.setactive = func_rotating_setactive; - if (!self.speed) - self.speed = 100; + if (!this.speed) + this.speed = 100; // FIXME: test if this turns the right way, then remove this comment (negate as needed) - if (self.spawnflags & 4) // X (untested) - self.avelocity = '0 0 1' * self.speed; + if (this.spawnflags & 4) // X (untested) + this.avelocity = '0 0 1' * this.speed; // FIXME: test if this turns the right way, then remove this comment (negate as needed) - else if (self.spawnflags & 8) // Y (untested) - self.avelocity = '1 0 0' * self.speed; + else if (this.spawnflags & 8) // Y (untested) + this.avelocity = '1 0 0' * this.speed; // FIXME: test if this turns the right way, then remove this comment (negate as needed) else // Z - self.avelocity = '0 1 0' * self.speed; + this.avelocity = '0 1 0' * this.speed; - self.pos1 = self.avelocity; + this.pos1 = this.avelocity; - if(self.dmg && (self.message == "")) - self.message = " was squished"; - if(self.dmg && (self.message2 == "")) - self.message2 = "was squished by"; + if(this.dmg && (this.message == "")) + this.message = " was squished"; + if(this.dmg && (this.message2 == "")) + this.message2 = "was squished by"; - if(self.dmg && (!self.dmgtime)) - self.dmgtime = 0.25; + if(this.dmg && (!this.dmgtime)) + this.dmgtime = 0.25; - self.dmgtime2 = time; + this.dmgtime2 = time; - if (!InitMovingBrushTrigger()) + if (!InitMovingBrushTrigger(this)) return; // no EF_LOWPRECISION here, as rounding angles is bad - self.blocked = generic_plat_blocked; + this.blocked = generic_plat_blocked; // wait for targets to spawn - self.SUB_NEXTTHINK = self.SUB_LTIME + 999999999; - self.SUB_THINK = SUB_NullThink; // for PushMove + this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999; + this.SUB_THINK = SUB_NullThink; // for PushMove // TODO make a reset function for this one } diff --git a/qcsrc/common/triggers/func/stardust.qc b/qcsrc/common/triggers/func/stardust.qc index 859cdf53d..db5081b61 100644 --- a/qcsrc/common/triggers/func/stardust.qc +++ b/qcsrc/common/triggers/func/stardust.qc @@ -1,8 +1,8 @@ #ifdef SVQC spawnfunc(func_stardust) { - self.effects = EF_STARDUST; + this.effects = EF_STARDUST; - CSQCMODEL_AUTOINIT(self); + CSQCMODEL_AUTOINIT(this); } #endif diff --git a/qcsrc/common/triggers/func/train.qc b/qcsrc/common/triggers/func/train.qc index 013d4597f..033748812 100644 --- a/qcsrc/common/triggers/func/train.qc +++ b/qcsrc/common/triggers/func/train.qc @@ -211,45 +211,45 @@ target : targetname of first spawnfunc_path_corner (starts here) #ifdef SVQC spawnfunc(func_train) { - if (self.noise != "") - precache_sound(self.noise); + if (this.noise != "") + precache_sound(this.noise); - if (self.target == "") + if (this.target == "") objerror("func_train without a target"); - if (!self.speed) - self.speed = 100; + if (!this.speed) + this.speed = 100; - if (!InitMovingBrushTrigger()) + if (!InitMovingBrushTrigger(this)) return; - self.effects |= EF_LOWPRECISION; + this.effects |= EF_LOWPRECISION; - if(self.spawnflags & 4) - self.use = train_use; + if(this.spawnflags & 4) + this.use = train_use; - if (self.spawnflags & 2) + if (this.spawnflags & 2) { - self.platmovetype_turn = true; - self.view_ofs = '0 0 0'; // don't offset a rotating train, origin works differently now + this.platmovetype_turn = true; + this.view_ofs = '0 0 0'; // don't offset a rotating train, origin works differently now } else - self.view_ofs = self.mins; + this.view_ofs = this.mins; // wait for targets to spawn - InitializeEntity(self, func_train_find, INITPRIO_FINDTARGET); - - self.blocked = generic_plat_blocked; - if(self.dmg && (self.message == "")) - self.message = " was squished"; - if(self.dmg && (self.message2 == "")) - self.message2 = "was squished by"; - if(self.dmg && (!self.dmgtime)) - self.dmgtime = 0.25; - self.dmgtime2 = time; - - if(!set_platmovetype(self, self.platmovetype)) + InitializeEntity(this, func_train_find, INITPRIO_FINDTARGET); + + this.blocked = generic_plat_blocked; + if(this.dmg && (this.message == "")) + this.message = " was squished"; + if(this.dmg && (this.message2 == "")) + this.message2 = "was squished by"; + if(this.dmg && (!this.dmgtime)) + this.dmgtime = 0.25; + this.dmgtime2 = time; + + if(!set_platmovetype(this, this.platmovetype)) return; - self.platmovetype_start_default = self.platmovetype_start; - self.platmovetype_end_default = self.platmovetype_end; + this.platmovetype_start_default = this.platmovetype_start; + this.platmovetype_end_default = this.platmovetype_end; // TODO make a reset function for this one } diff --git a/qcsrc/common/triggers/func/vectormamamam.qc b/qcsrc/common/triggers/func/vectormamamam.qc index 2dfa1ac98..139145e5b 100644 --- a/qcsrc/common/triggers/func/vectormamamam.qc +++ b/qcsrc/common/triggers/func/vectormamamam.qc @@ -73,86 +73,86 @@ void func_vectormamamam_controller_think() void func_vectormamamam_findtarget(entity this) { - if(self.target != "") - self.wp00 = find(world, targetname, self.target); + if(this.target != "") + this.wp00 = find(world, targetname, this.target); - if(self.target2 != "") - self.wp01 = find(world, targetname, self.target2); + if(this.target2 != "") + this.wp01 = find(world, targetname, this.target2); - if(self.target3 != "") - self.wp02 = find(world, targetname, self.target3); + if(this.target3 != "") + this.wp02 = find(world, targetname, this.target3); - if(self.target4 != "") - self.wp03 = find(world, targetname, self.target4); + if(this.target4 != "") + this.wp03 = find(world, targetname, this.target4); - if(!self.wp00 && !self.wp01 && !self.wp02 && !self.wp03) + if(!this.wp00 && !this.wp01 && !this.wp02 && !this.wp03) objerror("No reference entity found, so there is nothing to move. Aborting."); - self.destvec = self.origin - func_vectormamamam_origin(self, 0); + this.destvec = this.origin - func_vectormamamam_origin(this, 0); entity controller; controller = new(func_vectormamamam_controller); - controller.owner = self; + controller.owner = this; controller.nextthink = time + 1; controller.think = func_vectormamamam_controller_think; } spawnfunc(func_vectormamamam) { - if (self.noise != "") + if (this.noise != "") { - precache_sound(self.noise); - soundto(MSG_INIT, self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE); + precache_sound(this.noise); + soundto(MSG_INIT, this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_IDLE); } - if(!self.targetfactor) - self.targetfactor = 1; + if(!this.targetfactor) + this.targetfactor = 1; - if(!self.target2factor) - self.target2factor = 1; + if(!this.target2factor) + this.target2factor = 1; - if(!self.target3factor) - self.target3factor = 1; + if(!this.target3factor) + this.target3factor = 1; - if(!self.target4factor) - self.target4factor = 1; + if(!this.target4factor) + this.target4factor = 1; - if(vlen(self.targetnormal)) - self.targetnormal = normalize(self.targetnormal); + if(vlen(this.targetnormal)) + this.targetnormal = normalize(this.targetnormal); - if(vlen(self.target2normal)) - self.target2normal = normalize(self.target2normal); + if(vlen(this.target2normal)) + this.target2normal = normalize(this.target2normal); - if(vlen(self.target3normal)) - self.target3normal = normalize(self.target3normal); + if(vlen(this.target3normal)) + this.target3normal = normalize(this.target3normal); - if(vlen(self.target4normal)) - self.target4normal = normalize(self.target4normal); + if(vlen(this.target4normal)) + this.target4normal = normalize(this.target4normal); - self.blocked = generic_plat_blocked; - if(self.dmg && (self.message == "")) - self.message = " was squished"; - if(self.dmg && (self.message == "")) - self.message2 = "was squished by"; - if(self.dmg && (!self.dmgtime)) - self.dmgtime = 0.25; - self.dmgtime2 = time; + this.blocked = generic_plat_blocked; + if(this.dmg && (this.message == "")) + this.message = " was squished"; + if(this.dmg && (this.message == "")) + this.message2 = "was squished by"; + if(this.dmg && (!this.dmgtime)) + this.dmgtime = 0.25; + this.dmgtime2 = time; - if(self.netname == "") - self.netname = "1 0 0 0 1"; + if(this.netname == "") + this.netname = "1 0 0 0 1"; - if (!InitMovingBrushTrigger()) + if (!InitMovingBrushTrigger(this)) return; // wait for targets to spawn - self.SUB_NEXTTHINK = self.SUB_LTIME + 999999999; - self.SUB_THINK = SUB_NullThink; // for PushMove + this.SUB_NEXTTHINK = this.SUB_LTIME + 999999999; + this.SUB_THINK = SUB_NullThink; // for PushMove // Savage: Reduce bandwith, critical on e.g. nexdm02 - self.effects |= EF_LOWPRECISION; + this.effects |= EF_LOWPRECISION; - self.active = ACTIVE_ACTIVE; + this.active = ACTIVE_ACTIVE; - InitializeEntity(self, func_vectormamamam_findtarget, INITPRIO_FINDTARGET); + InitializeEntity(this, func_vectormamamam_findtarget, INITPRIO_FINDTARGET); } #endif diff --git a/qcsrc/common/triggers/misc/corner.qc b/qcsrc/common/triggers/misc/corner.qc index d081807bc..77f430640 100644 --- a/qcsrc/common/triggers/misc/corner.qc +++ b/qcsrc/common/triggers/misc/corner.qc @@ -1,40 +1,40 @@ REGISTER_NET_LINKED(ENT_CLIENT_CORNER) #ifdef SVQC -bool corner_send(entity to, int sf) -{SELFPARAM(); +bool corner_send(entity this, entity to, int sf) +{ WriteHeader(MSG_ENTITY, ENT_CLIENT_CORNER); - WriteString(MSG_ENTITY, self.platmovetype); + WriteString(MSG_ENTITY, this.platmovetype); - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, this.origin_x); + WriteCoord(MSG_ENTITY, this.origin_y); + WriteCoord(MSG_ENTITY, this.origin_z); - WriteString(MSG_ENTITY, self.target); - WriteString(MSG_ENTITY, self.target2); - WriteString(MSG_ENTITY, self.target3); - WriteString(MSG_ENTITY, self.target4); - WriteString(MSG_ENTITY, self.targetname); - WriteByte(MSG_ENTITY, self.target_random); + WriteString(MSG_ENTITY, this.target); + WriteString(MSG_ENTITY, this.target2); + WriteString(MSG_ENTITY, this.target3); + WriteString(MSG_ENTITY, this.target4); + WriteString(MSG_ENTITY, this.targetname); + WriteByte(MSG_ENTITY, this.target_random); - WriteByte(MSG_ENTITY, self.wait); + WriteByte(MSG_ENTITY, this.wait); return true; } -void corner_link() +void corner_link(entity this) { - //Net_LinkEntity(self, false, 0, corner_send); + //Net_LinkEntity(this, false, 0, corner_send); } spawnfunc(path_corner) { // 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); + set_platmovetype(this, this.platmovetype); - corner_link(); + corner_link(this); } #elif defined(CSQC) diff --git a/qcsrc/common/triggers/misc/follow.qc b/qcsrc/common/triggers/misc/follow.qc index 2ac304a21..dbe1cb7d8 100644 --- a/qcsrc/common/triggers/misc/follow.qc +++ b/qcsrc/common/triggers/misc/follow.qc @@ -6,10 +6,10 @@ void follow_init(entity this) entity src, dst; src = world; dst = world; - if(self.killtarget != "") - src = find(world, targetname, self.killtarget); - if(self.target != "") - dst = find(world, targetname, self.target); + if(this.killtarget != "") + src = find(world, targetname, this.killtarget); + if(this.target != "") + dst = find(world, targetname, this.target); if(!src && !dst) { @@ -17,35 +17,35 @@ void follow_init(entity this) return; } - if(self.jointtype) + if(this.jointtype) { // already done :P entity must stay - self.aiment = src; - self.enemy = dst; + this.aiment = src; + this.enemy = dst; } else if(!src || !dst) { objerror("follow: could not find target/killtarget"); return; } - else if(self.spawnflags & 1) + else if(this.spawnflags & 1) { // attach - if(self.spawnflags & 2) + if(this.spawnflags & 2) { - setattachment(dst, src, self.message); + setattachment(dst, src, this.message); } else { - attach_sameorigin(dst, src, self.message); + attach_sameorigin(dst, src, this.message); } dst.solid = SOLID_NOT; // solid doesn't work with attachment - remove(self); + remove(this); } else { - if(self.spawnflags & 2) + if(this.spawnflags & 2) { dst.movetype = MOVETYPE_FOLLOW; dst.aiment = src; @@ -58,12 +58,12 @@ void follow_init(entity this) follow_sameorigin(dst, src); } - remove(self); + remove(this); } } spawnfunc(misc_follow) { - InitializeEntity(self, follow_init, INITPRIO_FINDTARGET); + InitializeEntity(this, follow_init, INITPRIO_FINDTARGET); } #endif diff --git a/qcsrc/common/triggers/misc/teleport_dest.qc b/qcsrc/common/triggers/misc/teleport_dest.qc index 33401930d..b3a242076 100644 --- a/qcsrc/common/triggers/misc/teleport_dest.qc +++ b/qcsrc/common/triggers/misc/teleport_dest.qc @@ -24,21 +24,21 @@ bool teleport_dest_send(entity this, entity to, int sf) return true; } -void teleport_dest_link() -{SELFPARAM(); - Net_LinkEntity(self, false, 0, teleport_dest_send); - self.SendFlags |= 1; // update +void teleport_dest_link(entity this) +{ + Net_LinkEntity(this, false, 0, teleport_dest_send); + this.SendFlags |= 1; // update } spawnfunc(info_teleport_destination) { - self.classname = "info_teleport_destination"; + this.classname = "info_teleport_destination"; - self.mangle = self.angles; - self.angles = '0 0 0'; + this.mangle = this.angles; + this.angles = '0 0 0'; - //setorigin (self, self.origin + '0 0 27'); // To fix a mappers' habit as old as Quake - setorigin (self, self.origin); + //setorigin (this, this.origin + '0 0 27'); // To fix a mappers' habit as old as Quake + setorigin (this, this.origin); IFTARGETED { @@ -46,7 +46,7 @@ spawnfunc(info_teleport_destination) else objerror ("^3Teleport destination without a targetname"); - teleport_dest_link(); + teleport_dest_link(this); } spawnfunc(misc_teleporter_dest) @@ -63,9 +63,9 @@ spawnfunc(target_teleporter) void teleport_dest_remove(entity this) { - //if(self.classname) - //strunzone(self.classname); - //self.classname = string_null; + //if(this.classname) + //strunzone(this.classname); + //this.classname = string_null; if(this.targetname) strunzone(this.targetname); @@ -78,22 +78,22 @@ NET_HANDLE(ENT_CLIENT_TELEPORT_DEST, bool isnew) if(sf & 1) { - self.classname = "info_teleport_destination"; - self.cnt = ReadByte(); - self.speed = ReadCoord(); - self.targetname = strzone(ReadString()); - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); - - self.mangle_x = ReadAngle(); - self.mangle_y = ReadAngle(); - self.mangle_z = ReadAngle(); - - setorigin(self, self.origin); - - self.drawmask = MASK_NORMAL; - self.entremove = teleport_dest_remove; + this.classname = "info_teleport_destination"; + this.cnt = ReadByte(); + this.speed = ReadCoord(); + this.targetname = strzone(ReadString()); + this.origin_x = ReadCoord(); + this.origin_y = ReadCoord(); + this.origin_z = ReadCoord(); + + this.mangle_x = ReadAngle(); + this.mangle_y = ReadAngle(); + this.mangle_z = ReadAngle(); + + setorigin(this, this.origin); + + this.drawmask = MASK_NORMAL; + this.entremove = teleport_dest_remove; } return = true; diff --git a/qcsrc/common/triggers/target/location.qc b/qcsrc/common/triggers/target/location.qc index 642c72cdb..5a24d2c5e 100644 --- a/qcsrc/common/triggers/target/location.qc +++ b/qcsrc/common/triggers/target/location.qc @@ -3,7 +3,7 @@ void target_push_init(entity this); spawnfunc(target_location) { - self.classname = "target_location"; + this.classname = "target_location"; // location name in netname // eventually support: count, teamgame selectors, line of sight? diff --git a/qcsrc/common/triggers/target/music.qc b/qcsrc/common/triggers/target/music.qc index c48a0ba26..b57d483f2 100644 --- a/qcsrc/common/triggers/target/music.qc +++ b/qcsrc/common/triggers/target/music.qc @@ -20,28 +20,28 @@ REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_MUSIC) // fade_rate // 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(); +void target_music_sendto(entity this, int to, bool is) +{ WriteHeader(to, TE_CSQC_TARGET_MUSIC); - WriteShort(to, etof(self)); - WriteByte(to, self.volume * 255.0 * is); - WriteByte(to, self.fade_time * 16.0); - WriteByte(to, self.fade_rate * 16.0); - WriteByte(to, self.lifetime); - WriteString(to, self.noise); + WriteShort(to, etof(this)); + WriteByte(to, this.volume * 255.0 * is); + WriteByte(to, this.fade_time * 16.0); + WriteByte(to, this.fade_rate * 16.0); + WriteByte(to, this.lifetime); + WriteString(to, this.noise); } void target_music_reset(entity this) { - if (this.targetname == "") target_music_sendto(MSG_ALL, 1); + if (this.targetname == "") target_music_sendto(this, MSG_ALL, 1); } void target_music_kill() { FOREACH_ENTITY_CLASS("target_music", true, { it.volume = 0; if (it.targetname == "") - WITHSELF(it, target_music_sendto(MSG_ALL, 1)); + WITHSELF(it, target_music_sendto(it, MSG_ALL, 1)); else - WITHSELF(it, target_music_sendto(MSG_ALL, 0)); + WITHSELF(it, target_music_sendto(it, MSG_ALL, 0)); }); } void target_music_use(entity this, entity actor, entity trigger) @@ -51,33 +51,32 @@ void target_music_use(entity this, entity actor, entity trigger) if(IS_REAL_CLIENT(actor)) { msg_entity = actor; - target_music_sendto(MSG_ONE, 1); + target_music_sendto(this, MSG_ONE, 1); } FOREACH_CLIENT(IS_SPEC(it) && it.enemy == actor, { msg_entity = it; - target_music_sendto(MSG_ONE, 1); + target_music_sendto(this, MSG_ONE, 1); }); } spawnfunc(target_music) { - self.use = target_music_use; - self.reset = target_music_reset; - if(!self.volume) - self.volume = 1; - if(self.targetname == "") - target_music_sendto(MSG_INIT, 1); + this.use = target_music_use; + this.reset = target_music_reset; + if(!this.volume) + this.volume = 1; + if(this.targetname == "") + target_music_sendto(this, MSG_INIT, 1); else - target_music_sendto(MSG_INIT, 0); + target_music_sendto(this, MSG_INIT, 0); } void TargetMusic_RestoreGame() {SELFPARAM(); for(entity e = world; (e = find(e, classname, "target_music")); ) { - setself(e); - if(self.targetname == "") - target_music_sendto(MSG_INIT, 1); + if(e.targetname == "") + target_music_sendto(e, MSG_INIT, 1); else - target_music_sendto(MSG_INIT, 0); + target_music_sendto(e, MSG_INIT, 0); } } // values: @@ -92,38 +91,38 @@ bool trigger_music_SendEntity(entity this, entity to, float sf) { WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_MUSIC); sf &= ~0x80; - if(self.cnt) + if(this.cnt) sf |= 0x80; WriteByte(MSG_ENTITY, sf); if(sf & 4) { - WriteCoord(MSG_ENTITY, self.origin.x); - WriteCoord(MSG_ENTITY, self.origin.y); - WriteCoord(MSG_ENTITY, self.origin.z); + WriteCoord(MSG_ENTITY, this.origin.x); + WriteCoord(MSG_ENTITY, this.origin.y); + WriteCoord(MSG_ENTITY, this.origin.z); } if(sf & 1) { - if(self.model != "null") + if(this.model != "null") { - WriteShort(MSG_ENTITY, self.modelindex); - WriteCoord(MSG_ENTITY, self.mins.x); - WriteCoord(MSG_ENTITY, self.mins.y); - WriteCoord(MSG_ENTITY, self.mins.z); - WriteCoord(MSG_ENTITY, self.maxs.x); - WriteCoord(MSG_ENTITY, self.maxs.y); - WriteCoord(MSG_ENTITY, self.maxs.z); + WriteShort(MSG_ENTITY, this.modelindex); + WriteCoord(MSG_ENTITY, this.mins.x); + WriteCoord(MSG_ENTITY, this.mins.y); + WriteCoord(MSG_ENTITY, this.mins.z); + WriteCoord(MSG_ENTITY, this.maxs.x); + WriteCoord(MSG_ENTITY, this.maxs.y); + WriteCoord(MSG_ENTITY, this.maxs.z); } else { WriteShort(MSG_ENTITY, 0); - WriteCoord(MSG_ENTITY, self.maxs.x); - WriteCoord(MSG_ENTITY, self.maxs.y); - WriteCoord(MSG_ENTITY, self.maxs.z); + WriteCoord(MSG_ENTITY, this.maxs.x); + WriteCoord(MSG_ENTITY, this.maxs.y); + WriteCoord(MSG_ENTITY, this.maxs.z); } - WriteByte(MSG_ENTITY, self.volume * 255.0); - WriteByte(MSG_ENTITY, self.fade_time * 16.0); - WriteByte(MSG_ENTITY, self.fade_rate * 16.0); - WriteString(MSG_ENTITY, self.noise); + WriteByte(MSG_ENTITY, this.volume * 255.0); + WriteByte(MSG_ENTITY, this.fade_time * 16.0); + WriteByte(MSG_ENTITY, this.fade_rate * 16.0); + WriteString(MSG_ENTITY, this.noise); } return 1; } diff --git a/qcsrc/common/triggers/target/spawn.qc b/qcsrc/common/triggers/target/spawn.qc index 74ac8fd99..5b6824283 100644 --- a/qcsrc/common/triggers/target/spawn.qc +++ b/qcsrc/common/triggers/target/spawn.qc @@ -330,9 +330,9 @@ void initialize_field_db() spawnfunc(target_spawn) { initialize_field_db(); - self.use = target_spawn_use; - self.message = strzone(strreplace("'", "\"", self.message)); - self.target_spawn_id = ++target_spawn_count; - InitializeEntity(self, target_spawn_spawnfirst, INITPRIO_LAST); + this.use = target_spawn_use; + this.message = strzone(strreplace("'", "\"", this.message)); + this.target_spawn_id = ++target_spawn_count; + InitializeEntity(this, target_spawn_spawnfirst, INITPRIO_LAST); } #endif diff --git a/qcsrc/common/triggers/target/speaker.qc b/qcsrc/common/triggers/target/speaker.qc index 046128f79..dc9b34b4a 100644 --- a/qcsrc/common/triggers/target/speaker.qc +++ b/qcsrc/common/triggers/target/speaker.qc @@ -79,53 +79,53 @@ spawnfunc(target_speaker) { // TODO: "*" prefix to sound file name // TODO: wait and random (just, HOW? random is not a field) - if(self.noise) - precache_sound (self.noise); + if(this.noise) + precache_sound (this.noise); - if(!self.atten && !(self.spawnflags & 4)) + if(!this.atten && !(this.spawnflags & 4)) { IFTARGETED - self.atten = ATTEN_NORM; + this.atten = ATTEN_NORM; else - self.atten = ATTEN_STATIC; + this.atten = ATTEN_STATIC; } - else if(self.atten < 0) - self.atten = 0; + else if(this.atten < 0) + this.atten = 0; - if(!self.volume) - self.volume = 1; + if(!this.volume) + this.volume = 1; IFTARGETED { - if(self.spawnflags & 8) // ACTIVATOR - self.use = target_speaker_use_activator; - else if(self.spawnflags & 1) // LOOPED_ON + if(this.spawnflags & 8) // ACTIVATOR + this.use = target_speaker_use_activator; + else if(this.spawnflags & 1) // LOOPED_ON { - target_speaker_use_on(self, NULL, NULL); - self.reset = target_speaker_reset; + target_speaker_use_on(this, NULL, NULL); + this.reset = target_speaker_reset; } - else if(self.spawnflags & 2) // LOOPED_OFF + else if(this.spawnflags & 2) // LOOPED_OFF { - self.use = target_speaker_use_on; - self.reset = target_speaker_reset; + this.use = target_speaker_use_on; + this.reset = target_speaker_reset; } else - self.use = target_speaker_use_on; + this.use = target_speaker_use_on; } - else if(self.spawnflags & 1) // LOOPED_ON + else if(this.spawnflags & 1) // LOOPED_ON { - ambientsound (self.origin, self.noise, VOL_BASE * self.volume, self.atten); - remove(self); + ambientsound (this.origin, this.noise, VOL_BASE * this.volume, this.atten); + remove(this); } - else if(self.spawnflags & 2) // LOOPED_OFF + else if(this.spawnflags & 2) // LOOPED_OFF { objerror("This sound entity can never be activated"); } else { // Quake/Nexuiz fallback - ambientsound (self.origin, self.noise, VOL_BASE * self.volume, self.atten); - remove(self); + ambientsound (this.origin, this.noise, VOL_BASE * this.volume, this.atten); + remove(this); } } #endif diff --git a/qcsrc/common/triggers/target/voicescript.qc b/qcsrc/common/triggers/target/voicescript.qc index e84331770..bfce684c4 100644 --- a/qcsrc/common/triggers/target/voicescript.qc +++ b/qcsrc/common/triggers/target/voicescript.qc @@ -84,18 +84,18 @@ spawnfunc(target_voicescript) // delay: initial delay before the first message float i, n; - self.use = target_voicescript_use; + this.use = target_voicescript_use; - n = tokenize_console(self.message); - self.cnt = n / 2; + n = tokenize_console(this.message); + this.cnt = n / 2; for(i = 0; i+1 < n; i += 2) { if(argv(i) == "*") { - self.cnt = i / 2; + this.cnt = i / 2; ++i; } - precache_sound(strcat(self.netname, "/", argv(i), ".wav")); + precache_sound(strcat(this.netname, "/", argv(i), ".wav")); } } #endif diff --git a/qcsrc/common/triggers/trigger/counter.qc b/qcsrc/common/triggers/trigger/counter.qc index 5ada6805f..cffffc968 100644 --- a/qcsrc/common/triggers/trigger/counter.qc +++ b/qcsrc/common/triggers/trigger/counter.qc @@ -38,12 +38,12 @@ After the counter has been triggered "count" times (default 2), it will fire all */ spawnfunc(trigger_counter) { - self.wait = -1; - if (!self.count) - self.count = 2; - self.cnt = self.count; + this.wait = -1; + if (!this.count) + this.count = 2; + this.cnt = this.count; - self.use = counter_use; - self.reset = counter_reset; + this.use = counter_use; + this.reset = counter_reset; } #endif diff --git a/qcsrc/common/triggers/trigger/delay.qc b/qcsrc/common/triggers/trigger/delay.qc index 02c1aa968..3dec82ace 100644 --- a/qcsrc/common/triggers/trigger/delay.qc +++ b/qcsrc/common/triggers/trigger/delay.qc @@ -13,10 +13,10 @@ void delay_reset(entity this) spawnfunc(trigger_delay) { - if(!self.wait) - self.wait = 1; + if(!this.wait) + this.wait = 1; - self.use = delay_use; - self.reset = delay_reset; + this.use = delay_use; + this.reset = delay_reset; } #endif diff --git a/qcsrc/common/triggers/trigger/gravity.qc b/qcsrc/common/triggers/trigger/gravity.qc index c7dd586cb..86039d20b 100644 --- a/qcsrc/common/triggers/trigger/gravity.qc +++ b/qcsrc/common/triggers/trigger/gravity.qc @@ -87,20 +87,20 @@ void trigger_gravity_touch() spawnfunc(trigger_gravity) { - if(self.gravity == 1) + if(this.gravity == 1) return; EXACTTRIGGER_INIT; - self.touch = trigger_gravity_touch; - if(self.noise != "") - precache_sound(self.noise); + this.touch = trigger_gravity_touch; + if(this.noise != "") + precache_sound(this.noise); - self.state = true; + this.state = true; IFTARGETED { - self.use = trigger_gravity_use; - if(self.spawnflags & 2) - self.state = false; + this.use = trigger_gravity_use; + if(this.spawnflags & 2) + this.state = false; } } #endif diff --git a/qcsrc/common/triggers/trigger/heal.qc b/qcsrc/common/triggers/trigger/heal.qc index cbabe8dfd..b58574452 100644 --- a/qcsrc/common/triggers/trigger/heal.qc +++ b/qcsrc/common/triggers/trigger/heal.qc @@ -27,16 +27,16 @@ void trigger_heal_touch() spawnfunc(trigger_heal) { - self.active = ACTIVE_ACTIVE; + this.active = ACTIVE_ACTIVE; EXACTTRIGGER_INIT; - self.touch = trigger_heal_touch; - if (!self.health) - self.health = 10; - if (!self.max_health) - self.max_health = 200; //Max health topoff for field - if(self.noise == "") - self.noise = "misc/mediumhealth.wav"; - precache_sound(self.noise); + this.touch = trigger_heal_touch; + if (!this.health) + this.health = 10; + if (!this.max_health) + this.max_health = 200; //Max health topoff for field + if(this.noise == "") + this.noise = "misc/mediumhealth.wav"; + precache_sound(this.noise); } #endif diff --git a/qcsrc/common/triggers/trigger/hurt.qc b/qcsrc/common/triggers/trigger/hurt.qc index a7ee567eb..efd23a5de 100644 --- a/qcsrc/common/triggers/trigger/hurt.qc +++ b/qcsrc/common/triggers/trigger/hurt.qc @@ -60,23 +60,23 @@ entity trigger_hurt_first; spawnfunc(trigger_hurt) { EXACTTRIGGER_INIT; - self.active = ACTIVE_ACTIVE; - self.touch = trigger_hurt_touch; - self.use = trigger_hurt_use; - self.enemy = world; // I hate you all - if (!self.dmg) - self.dmg = 1000; - if (self.message == "") - self.message = "was in the wrong place"; - if (self.message2 == "") - self.message2 = "was thrown into a world of hurt by"; - // self.message = "someone like %s always gets wrongplaced"; + this.active = ACTIVE_ACTIVE; + this.touch = trigger_hurt_touch; + this.use = trigger_hurt_use; + this.enemy = world; // I hate you all + if (!this.dmg) + this.dmg = 1000; + if (this.message == "") + this.message = "was in the wrong place"; + if (this.message2 == "") + this.message2 = "was thrown into a world of hurt by"; + // this.message = "someone like %s always gets wrongplaced"; if(!trigger_hurt_first) - trigger_hurt_first = self; + trigger_hurt_first = this; if(trigger_hurt_last) - trigger_hurt_last.trigger_hurt_next = self; - trigger_hurt_last = self; + trigger_hurt_last.trigger_hurt_next = this; + trigger_hurt_last = this; } float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end) diff --git a/qcsrc/common/triggers/trigger/impulse.qc b/qcsrc/common/triggers/trigger/impulse.qc index b7cd57272..a1ac1255f 100644 --- a/qcsrc/common/triggers/trigger/impulse.qc +++ b/qcsrc/common/triggers/trigger/impulse.qc @@ -179,41 +179,40 @@ bool trigger_impulse_send(entity this, entity to, int sf) return true; } -void trigger_impulse_link() +void trigger_impulse_link(entity this) { - SELFPARAM(); - trigger_link(self, trigger_impulse_send); + trigger_link(this, trigger_impulse_send); } spawnfunc(trigger_impulse) { - self.active = ACTIVE_ACTIVE; + this.active = ACTIVE_ACTIVE; - trigger_init(self); + trigger_init(this); - if(self.radius) + if(this.radius) { - if(!self.strength) self.strength = 2000 * autocvar_g_triggerimpulse_radial_multiplier; - setorigin(self, self.origin); - setsize(self, '-1 -1 -1' * self.radius,'1 1 1' * self.radius); - self.touch = trigger_impulse_touch3; + if(!this.strength) this.strength = 2000 * autocvar_g_triggerimpulse_radial_multiplier; + setorigin(this, this.origin); + setsize(this, '-1 -1 -1' * this.radius,'1 1 1' * this.radius); + this.touch = trigger_impulse_touch3; } else { - if(self.target) + if(this.target) { - if(!self.strength) self.strength = 950 * autocvar_g_triggerimpulse_directional_multiplier; - self.touch = trigger_impulse_touch1; + if(!this.strength) this.strength = 950 * autocvar_g_triggerimpulse_directional_multiplier; + this.touch = trigger_impulse_touch1; } else { - if(!self.strength) self.strength = 0.9; - self.strength = pow(self.strength, autocvar_g_triggerimpulse_accel_power) * autocvar_g_triggerimpulse_accel_multiplier; - self.touch = trigger_impulse_touch2; + if(!this.strength) this.strength = 0.9; + this.strength = pow(this.strength, autocvar_g_triggerimpulse_accel_power) * autocvar_g_triggerimpulse_accel_multiplier; + this.touch = trigger_impulse_touch2; } } - trigger_impulse_link(); + trigger_impulse_link(this); } #elif defined(CSQC) NET_HANDLE(ENT_CLIENT_TRIGGER_IMPULSE, bool isnew) diff --git a/qcsrc/common/triggers/trigger/keylock.qc b/qcsrc/common/triggers/trigger/keylock.qc index 311075aa0..3a38a9ef8 100644 --- a/qcsrc/common/triggers/trigger/keylock.qc +++ b/qcsrc/common/triggers/trigger/keylock.qc @@ -82,22 +82,22 @@ void trigger_keylock_touch() REGISTER_NET_LINKED(ENT_CLIENT_KEYLOCK) #ifdef SVQC -bool trigger_keylock_send(entity to, int sf) -{SELFPARAM(); +bool trigger_keylock_send(entity this, entity to, int sf) +{ WriteHeader(MSG_ENTITY, ENT_CLIENT_KEYLOCK); - WriteInt24_t(MSG_ENTITY, self.itemkeys); - WriteByte(MSG_ENTITY, self.height); + WriteInt24_t(MSG_ENTITY, this.itemkeys); + WriteByte(MSG_ENTITY, this.height); - trigger_common_write(self, true); + trigger_common_write(this, true); return true; } -void trigger_keylock_link() +void trigger_keylock_link(entity this) { // uncomment to network keylocks - //Net_LinkEntity(self, false, 0, trigger_keylock_send); + //Net_LinkEntity(this, false, 0, trigger_keylock_send); } /*QUAKED trigger_keylock (.0 .5 .8) ? @@ -121,44 +121,44 @@ message2 and noise2 will be resent to the player every 2 seconds while he is in */ spawnfunc(trigger_keylock) { - if(!self.itemkeys) { remove(self); return; } + if(!this.itemkeys) { remove(this); return; } // set unlocked message - if(self.message == "") - self.message = "Unlocked!"; + if(this.message == "") + this.message = "Unlocked!"; // set default unlock noise - if(self.noise == "") + if(this.noise == "") { - if(self.sounds == 1) - self.noise = "misc/secret.wav"; - else if(self.sounds == 2) - self.noise = strzone(SND(TALK)); - else //if (self.sounds == 3) { - self.noise = "misc/trigger1.wav"; + if(this.sounds == 1) + this.noise = "misc/secret.wav"; + else if(this.sounds == 2) + this.noise = strzone(SND(TALK)); + else //if (this.sounds == 3) { + this.noise = "misc/trigger1.wav"; } // set default use key sound - if(self.noise1 == "") - self.noise1 = "misc/decreasevalue.wav"; + if(this.noise1 == "") + this.noise1 = "misc/decreasevalue.wav"; // set closed sourd - if(self.noise2 == "") - self.noise2 = SND(TALK); + if(this.noise2 == "") + this.noise2 = SND(TALK); // delay between triggering message2 and trigger2 - if(!self.wait) { self.wait = 5; } + if(!this.wait) { this.wait = 5; } // precache sounds - precache_sound(self.noise); - precache_sound(self.noise1); - precache_sound(self.noise2); + precache_sound(this.noise); + precache_sound(this.noise1); + precache_sound(this.noise2); EXACTTRIGGER_INIT; - self.touch = trigger_keylock_touch; + this.touch = trigger_keylock_touch; - trigger_keylock_link(); + trigger_keylock_link(this); } #elif defined(CSQC) void keylock_remove(entity this) diff --git a/qcsrc/common/triggers/trigger/magicear.qc b/qcsrc/common/triggers/trigger/magicear.qc index 2c94fa395..328721040 100644 --- a/qcsrc/common/triggers/trigger/magicear.qc +++ b/qcsrc/common/triggers/trigger/magicear.qc @@ -158,8 +158,8 @@ string trigger_magicear_processmessage_forallears(entity source, float teamsay, spawnfunc(trigger_magicear) { - self.enemy = magicears; - magicears = self; + this.enemy = magicears; + magicears = this; // actually handled in "say" processing // spawnflags: @@ -190,6 +190,6 @@ spawnfunc(trigger_magicear) // movedir: // for spawnflags 256, defines 'instrument+1 mintempo maxtempo' (zero component doesn't matter) - self.movedir_x -= 1; // map to tuba instrument numbers + this.movedir_x -= 1; // map to tuba instrument numbers } #endif diff --git a/qcsrc/common/triggers/trigger/multivibrator.qc b/qcsrc/common/triggers/trigger/multivibrator.qc index a50f62b7a..8d3b6b5d5 100644 --- a/qcsrc/common/triggers/trigger/multivibrator.qc +++ b/qcsrc/common/triggers/trigger/multivibrator.qc @@ -1,28 +1,33 @@ #ifdef SVQC -void multivibrator_send() -{SELFPARAM(); +void multivibrator_send(entity this) +{ float newstate; float cyclestart; - cyclestart = floor((time + self.phase) / (self.wait + self.respawntime)) * (self.wait + self.respawntime) - self.phase; + cyclestart = floor((time + this.phase) / (this.wait + this.respawntime)) * (this.wait + this.respawntime) - this.phase; - newstate = (time < cyclestart + self.wait); + newstate = (time < cyclestart + this.wait); - if(self.state != newstate) - SUB_UseTargets(self, self, NULL); - self.state = newstate; + if(this.state != newstate) + SUB_UseTargets(this, this, NULL); + this.state = newstate; - if(self.state) - self.nextthink = cyclestart + self.wait + 0.01; + if(this.state) + this.nextthink = cyclestart + this.wait + 0.01; else - self.nextthink = cyclestart + self.wait + self.respawntime + 0.01; + this.nextthink = cyclestart + this.wait + this.respawntime + 0.01; +} + +void multivibrator_send_think() +{SELFPARAM(); + multivibrator_send(this); } void multivibrator_toggle(entity this, entity actor, entity trigger) { if(this.nextthink == 0) { - WITHSELF(this, multivibrator_send()); + multivibrator_send(this); } else { @@ -35,12 +40,12 @@ void multivibrator_toggle(entity this, entity actor, entity trigger) } } -void multivibrator_reset() -{SELFPARAM(); - if(!(self.spawnflags & 1)) - self.nextthink = 0; // wait for a trigger event +void multivibrator_reset(entity this) +{ + if(!(this.spawnflags & 1)) + this.nextthink = 0; // wait for a trigger event else - self.nextthink = max(1, time); + this.nextthink = max(1, time); } /*QUAKED trigger_multivibrator (.5 .5 .5) (-8 -8 -8) (8 8 8) START_ON @@ -56,17 +61,17 @@ START_ON: assume it is already turned on (when targeted) */ spawnfunc(trigger_multivibrator) { - if(!self.wait) - self.wait = 1; - if(!self.respawntime) - self.respawntime = self.wait; + if(!this.wait) + this.wait = 1; + if(!this.respawntime) + this.respawntime = this.wait; - self.state = 0; - self.use = multivibrator_toggle; - self.think = multivibrator_send; - self.nextthink = max(1, time); + this.state = 0; + this.use = multivibrator_toggle; + this.think = multivibrator_send_think; + this.nextthink = max(1, time); IFTARGETED - multivibrator_reset(); + multivibrator_reset(this); } #endif diff --git a/qcsrc/common/triggers/trigger/secret.qc b/qcsrc/common/triggers/trigger/secret.qc index f94cd00ad..5cae4ed4e 100644 --- a/qcsrc/common/triggers/trigger/secret.qc +++ b/qcsrc/common/triggers/trigger/secret.qc @@ -58,30 +58,30 @@ spawnfunc(trigger_secret) secrets_total += 1; // add default message - if (self.message == "") - self.message = "You found a secret!"; + if (this.message == "") + this.message = "You found a secret!"; // set default sound - if (self.noise == "") - if (!self.sounds) - self.sounds = 1; // misc/secret.wav + if (this.noise == "") + if (!this.sounds) + this.sounds = 1; // misc/secret.wav // this entity can't be a target itself!!!! - self.targetname = ""; + this.targetname = ""; // you can't just shoot a room to find it, can you? - self.health = 0; + this.health = 0; // a secret can not be delayed - self.delay = 0; + this.delay = 0; // convert this trigger to trigger_once - self.classname = "trigger_once"; + this.classname = "trigger_once"; spawnfunc_trigger_once(this); // take over the touch() function, so we can mark secret as found - self.touch = trigger_secret_touch; + this.touch = trigger_secret_touch; // ignore triggering; - self.use = func_null; + this.use = func_null; } #endif diff --git a/qcsrc/common/triggers/trigger/swamp.qc b/qcsrc/common/triggers/trigger/swamp.qc index ad9c872da..a65cdb0e2 100644 --- a/qcsrc/common/triggers/trigger/swamp.qc +++ b/qcsrc/common/triggers/trigger/swamp.qc @@ -108,9 +108,9 @@ float swamp_send(entity this, entity to, float sf) return true; } -void swamp_link() -{SELFPARAM(); - trigger_link(self, swamp_send); +void swamp_link(entity this) +{ + trigger_link(this, swamp_send); } /*QUAKED spawnfunc_trigger_swamp (.5 .5 .5) ? @@ -120,37 +120,37 @@ get slowd down and damaged spawnfunc(trigger_swamp) { // Init stuff - trigger_init(self); - self.touch = swamp_touch; + trigger_init(this); + this.touch = swamp_touch; // Setup default keys, if missing - if(self.dmg <= 0) - self.dmg = 5; - if(self.swamp_interval <= 0) - self.swamp_interval = 1; - if(self.swamp_slowdown <= 0) - self.swamp_slowdown = 0.5; - - swamp_link(); + if(this.dmg <= 0) + this.dmg = 5; + if(this.swamp_interval <= 0) + this.swamp_interval = 1; + if(this.swamp_slowdown <= 0) + this.swamp_slowdown = 0.5; + + swamp_link(this); } #elif defined(CSQC) NET_HANDLE(ENT_CLIENT_SWAMP, bool isnew) { - self.dmg = ReadByte(); - self.swamp_slowdown = ReadByte(); - self.swamp_interval = ReadByte(); + this.dmg = ReadByte(); + this.swamp_slowdown = ReadByte(); + this.swamp_interval = ReadByte(); trigger_common_read(false); return = true; - self.classname = "trigger_swamp"; - self.solid = SOLID_TRIGGER; - self.move_touch = swamp_touch; - self.drawmask = MASK_NORMAL; - self.move_time = time; - self.entremove = trigger_remove_generic; + this.classname = "trigger_swamp"; + this.solid = SOLID_TRIGGER; + this.move_touch = swamp_touch; + this.drawmask = MASK_NORMAL; + this.move_time = time; + this.entremove = trigger_remove_generic; } #endif diff --git a/qcsrc/common/triggers/trigger/teleport.qc b/qcsrc/common/triggers/trigger/teleport.qc index c9b814713..dcae83f0f 100644 --- a/qcsrc/common/triggers/trigger/teleport.qc +++ b/qcsrc/common/triggers/trigger/teleport.qc @@ -79,27 +79,27 @@ void trigger_teleport_link(entity this) spawnfunc(trigger_teleport) { - self.angles = '0 0 0'; + this.angles = '0 0 0'; - self.active = ACTIVE_ACTIVE; - //trigger_init(self); // only for predicted triggers? + this.active = ACTIVE_ACTIVE; + //trigger_init(this); // only for predicted triggers? EXACTTRIGGER_INIT; - self.use = trigger_teleport_use; + this.use = trigger_teleport_use; - if(self.noise != "") - FOREACH_WORD(self.noise, true, precache_sound(it)); + if(this.noise != "") + FOREACH_WORD(this.noise, true, precache_sound(it)); // this must be called to spawn the teleport waypoints for bots - InitializeEntity(self, teleport_findtarget, INITPRIO_FINDTARGET); + InitializeEntity(this, teleport_findtarget, INITPRIO_FINDTARGET); - if (self.target == "") + if (this.target == "") { objerror ("Teleporter with no target"); return; } - self.teleport_next = teleport_first; - teleport_first = self; + this.teleport_next = teleport_first; + teleport_first = this; } #elif defined(CSQC) NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew) diff --git a/qcsrc/common/triggers/trigger/viewloc.qc b/qcsrc/common/triggers/trigger/viewloc.qc index db75434bf..7003f3889 100644 --- a/qcsrc/common/triggers/trigger/viewloc.qc +++ b/qcsrc/common/triggers/trigger/viewloc.qc @@ -45,12 +45,12 @@ bool trigger_viewloc_send(entity this, entity to, int sf) // CSQC doesn't need to know our origin (yet), as we're only available for referencing WriteHeader(MSG_ENTITY, ENT_CLIENT_VIEWLOC_TRIGGER); - WriteEntity(MSG_ENTITY, self.enemy); - WriteEntity(MSG_ENTITY, self.goalentity); + WriteEntity(MSG_ENTITY, this.enemy); + WriteEntity(MSG_ENTITY, this.goalentity); - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, this.origin_x); + WriteCoord(MSG_ENTITY, this.origin_y); + WriteCoord(MSG_ENTITY, this.origin_z); return true; } @@ -58,75 +58,75 @@ bool trigger_viewloc_send(entity this, entity to, int sf) void viewloc_init(entity this) { entity e; - for(e = world; (e = find(e, targetname, self.target)); ) + for(e = world; (e = find(e, targetname, this.target)); ) if(e.classname == "target_viewlocation_start") { - self.enemy = e; + this.enemy = e; break; } - for(e = world; (e = find(e, targetname, self.target2)); ) + for(e = world; (e = find(e, targetname, this.target2)); ) if(e.classname == "target_viewlocation_end") { - self.goalentity = e; + this.goalentity = e; break; } - if(!self.enemy) { LOG_INFO("^1FAIL!\n"); remove(self); return; } + if(!this.enemy) { LOG_INFO("^1FAIL!\n"); remove(this); return; } - if(!self.goalentity) - self.goalentity = self.enemy; // make them match so CSQC knows what to do + if(!this.goalentity) + this.goalentity = this.enemy; // make them match so CSQC knows what to do - Net_LinkEntity(self, false, 0, trigger_viewloc_send); + Net_LinkEntity(this, false, 0, trigger_viewloc_send); - self.think = viewloc_think; - self.nextthink = time; + this.think = viewloc_think; + this.nextthink = time; } spawnfunc(trigger_viewlocation) { // 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; } + if(this.target == "") { LOG_INFO("^1FAIL!\n"); remove(this); return; } EXACTTRIGGER_INIT; - InitializeEntity(self, viewloc_init, INITPRIO_FINDTARGET); + InitializeEntity(this, viewloc_init, INITPRIO_FINDTARGET); } bool viewloc_send(entity this, entity to, int sf) { WriteHeader(MSG_ENTITY, ENT_CLIENT_VIEWLOC); - WriteByte(MSG_ENTITY, self.cnt); + WriteByte(MSG_ENTITY, this.cnt); - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + WriteCoord(MSG_ENTITY, this.origin_x); + WriteCoord(MSG_ENTITY, this.origin_y); + WriteCoord(MSG_ENTITY, this.origin_z); - WriteCoord(MSG_ENTITY, self.angles_x); - WriteCoord(MSG_ENTITY, self.angles_y); - WriteCoord(MSG_ENTITY, self.angles_z); + WriteCoord(MSG_ENTITY, this.angles_x); + WriteCoord(MSG_ENTITY, this.angles_y); + WriteCoord(MSG_ENTITY, this.angles_z); return true; } .float angle; -void viewloc_link() -{SELFPARAM(); - if(self.angle) - self.angles_y = self.angle; - Net_LinkEntity(self, false, 0, viewloc_send); +void viewloc_link(entity this) +{ + if(this.angle) + this.angles_y = this.angle; + Net_LinkEntity(this, false, 0, viewloc_send); } spawnfunc(target_viewlocation_start) { - self.classname = "target_viewlocation_start"; - self.cnt = 1; - viewloc_link(); + this.classname = "target_viewlocation_start"; + this.cnt = 1; + viewloc_link(this); } spawnfunc(target_viewlocation_end) { - self.classname = "target_viewlocation_end"; - self.cnt = 2; - viewloc_link(); + this.classname = "target_viewlocation_end"; + this.cnt = 2; + viewloc_link(this); } // compatibility @@ -145,44 +145,44 @@ NET_HANDLE(ENT_CLIENT_VIEWLOC_TRIGGER, bool isnew) float point1 = ReadShort(); float point2 = ReadShort(); - self.enemy = findfloat(world, entnum, point1); - self.goalentity = findfloat(world, entnum, point2); + this.enemy = findfloat(world, entnum, point1); + this.goalentity = findfloat(world, entnum, point2); - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); + this.origin_x = ReadCoord(); + this.origin_y = ReadCoord(); + this.origin_z = ReadCoord(); return = true; - setorigin(self, self.origin); + setorigin(this, this.origin); - self.cnt = point1; - self.count = point2; + this.cnt = point1; + this.count = point2; - self.think = trigger_viewloc_updatelink; - self.nextthink = time + 1; // we need to delay this or else + this.think = trigger_viewloc_updatelink; + this.nextthink = time + 1; // we need to delay this or else - self.classname = "trigger_viewlocation"; - self.drawmask = MASK_NORMAL; // not so concerned, but better keep it alive + this.classname = "trigger_viewlocation"; + this.drawmask = MASK_NORMAL; // not so concerned, but better keep it alive } NET_HANDLE(ENT_CLIENT_VIEWLOC, bool isnew) { - self.cnt = ReadByte(); + this.cnt = ReadByte(); - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); - setorigin(self, self.origin); + this.origin_x = ReadCoord(); + this.origin_y = ReadCoord(); + this.origin_z = ReadCoord(); + setorigin(this, this.origin); - self.movedir_x = ReadCoord(); - self.movedir_y = ReadCoord(); - self.movedir_z = ReadCoord(); + this.movedir_x = ReadCoord(); + this.movedir_y = ReadCoord(); + this.movedir_z = ReadCoord(); return = true; - self.classname = ((self.cnt == 2) ? "target_viewlocation_end" : "target_viewlocation_start"); - self.drawmask = MASK_NORMAL; // don't cull it + this.classname = ((this.cnt == 2) ? "target_viewlocation_end" : "target_viewlocation_start"); + this.drawmask = MASK_NORMAL; // don't cull it } #endif diff --git a/qcsrc/common/turrets/checkpoint.qc b/qcsrc/common/turrets/checkpoint.qc index bb2bff22c..669414c57 100644 --- a/qcsrc/common/turrets/checkpoint.qc +++ b/qcsrc/common/turrets/checkpoint.qc @@ -69,14 +69,14 @@ void turret_checkpoint_init() spawnfunc(turret_checkpoint) { - setorigin(self,self.origin); - self.think = turret_checkpoint_init; - self.nextthink = time + 0.2; + setorigin(this,this.origin); + this.think = turret_checkpoint_init; + this.nextthink = time + 0.2; } // Compat. spawnfunc(walker_checkpoint) { - self.classname = "turret_checkpoint"; + this.classname = "turret_checkpoint"; spawnfunc_turret_checkpoint(this); } diff --git a/qcsrc/common/turrets/targettrigger.qc b/qcsrc/common/turrets/targettrigger.qc index 625746341..d3deda070 100644 --- a/qcsrc/common/turrets/targettrigger.qc +++ b/qcsrc/common/turrets/targettrigger.qc @@ -29,9 +29,9 @@ void turret_targettrigger_touch() */ spawnfunc(turret_targettrigger) { - if(!autocvar_g_turrets) { remove(self); return; } + if(!autocvar_g_turrets) { remove(this); return; } - InitTrigger (); + WITHSELF(this, InitTrigger()); - self.touch = turret_targettrigger_touch; + this.touch = turret_targettrigger_touch; } diff --git a/qcsrc/common/turrets/turret/ewheel.qc b/qcsrc/common/turrets/turret/ewheel.qc index 0bdfca46e..d11c0867b 100644 --- a/qcsrc/common/turrets/turret/ewheel.qc +++ b/qcsrc/common/turrets/turret/ewheel.qc @@ -133,7 +133,7 @@ void ewheel_move_idle() movelib_brake_simple(self, (autocvar_g_turrets_unit_ewheel_speed_stop)); } -spawnfunc(turret_ewheel) { if(!turret_initialize(TUR_EWHEEL)) remove(self); } +spawnfunc(turret_ewheel) { if(!turret_initialize(TUR_EWHEEL)) remove(this); } METHOD(EWheel, tr_think, void(EWheel thistur, entity it)) { diff --git a/qcsrc/common/turrets/turret/flac.qc b/qcsrc/common/turrets/turret/flac.qc index 6bd6a3ff1..0969018d6 100644 --- a/qcsrc/common/turrets/turret/flac.qc +++ b/qcsrc/common/turrets/turret/flac.qc @@ -22,7 +22,7 @@ REGISTER_TURRET(FLAC, NEW(Flac)); #ifdef SVQC -spawnfunc(turret_flac) { if (!turret_initialize(TUR_FLAC)) remove(self); } +spawnfunc(turret_flac) { if (!turret_initialize(TUR_FLAC)) remove(this); } METHOD(Flac, tr_setup, void(Flac this, entity it)) { diff --git a/qcsrc/common/turrets/turret/fusionreactor.qc b/qcsrc/common/turrets/turret/fusionreactor.qc index 5c253d4c5..9b67e1db2 100644 --- a/qcsrc/common/turrets/turret/fusionreactor.qc +++ b/qcsrc/common/turrets/turret/fusionreactor.qc @@ -46,7 +46,7 @@ bool turret_fusionreactor_firecheck() return true; } -spawnfunc(turret_fusionreactor) { if (!turret_initialize(TUR_FUSIONREACTOR)) remove(self); } +spawnfunc(turret_fusionreactor) { if (!turret_initialize(TUR_FUSIONREACTOR)) remove(this); } METHOD(FusionReactor, tr_attack, void(FusionReactor this, entity it)) { diff --git a/qcsrc/common/turrets/turret/hellion.qc b/qcsrc/common/turrets/turret/hellion.qc index ef279f761..b3100bcb5 100644 --- a/qcsrc/common/turrets/turret/hellion.qc +++ b/qcsrc/common/turrets/turret/hellion.qc @@ -22,7 +22,7 @@ REGISTER_TURRET(HELLION, NEW(Hellion)); #ifdef SVQC -spawnfunc(turret_hellion) { if (!turret_initialize(TUR_HELLION)) remove(self); } +spawnfunc(turret_hellion) { if (!turret_initialize(TUR_HELLION)) remove(this); } METHOD(Hellion, tr_think, void(Hellion thistur, entity it)) { diff --git a/qcsrc/common/turrets/turret/hk.qc b/qcsrc/common/turrets/turret/hk.qc index 4e7b45138..2c9f68cf7 100644 --- a/qcsrc/common/turrets/turret/hk.qc +++ b/qcsrc/common/turrets/turret/hk.qc @@ -28,7 +28,7 @@ REGISTER_TURRET(HK, NEW(HunterKiller)); .float atime; #endif -spawnfunc(turret_hk) { if(!turret_initialize(TUR_HK)) remove(self); } +spawnfunc(turret_hk) { if(!turret_initialize(TUR_HK)) remove(this); } METHOD(HunterKiller, tr_think, void(HunterKiller thistur, entity it)) { diff --git a/qcsrc/common/turrets/turret/machinegun.qc b/qcsrc/common/turrets/turret/machinegun.qc index e91902657..5202ea371 100644 --- a/qcsrc/common/turrets/turret/machinegun.qc +++ b/qcsrc/common/turrets/turret/machinegun.qc @@ -22,7 +22,7 @@ REGISTER_TURRET(MACHINEGUN, NEW(MachineGunTurret)); #ifdef SVQC -spawnfunc(turret_machinegun) { if (!turret_initialize(TUR_MACHINEGUN)) remove(self); } +spawnfunc(turret_machinegun) { if (!turret_initialize(TUR_MACHINEGUN)) remove(this); } METHOD(MachineGunTurret, tr_setup, void(MachineGunTurret this, entity it)) { diff --git a/qcsrc/common/turrets/turret/mlrs.qc b/qcsrc/common/turrets/turret/mlrs.qc index 43710b6c0..bff258605 100644 --- a/qcsrc/common/turrets/turret/mlrs.qc +++ b/qcsrc/common/turrets/turret/mlrs.qc @@ -22,7 +22,7 @@ REGISTER_TURRET(MLRS, NEW(MLRSTurret)); #ifdef SVQC -spawnfunc(turret_mlrs) { if (!turret_initialize(TUR_MLRS)) remove(self); } +spawnfunc(turret_mlrs) { if (!turret_initialize(TUR_MLRS)) remove(this); } METHOD(MLRSTurret, tr_think, void(MLRSTurret thistur, entity it)) { diff --git a/qcsrc/common/turrets/turret/phaser.qc b/qcsrc/common/turrets/turret/phaser.qc index e4c0c119a..7675bc41e 100644 --- a/qcsrc/common/turrets/turret/phaser.qc +++ b/qcsrc/common/turrets/turret/phaser.qc @@ -22,7 +22,7 @@ REGISTER_TURRET(PHASER, NEW(PhaserTurret)); #ifdef SVQC -spawnfunc(turret_phaser) { if (!turret_initialize(TUR_PHASER)) remove(self); } +spawnfunc(turret_phaser) { if (!turret_initialize(TUR_PHASER)) remove(this); } .int fireflag; diff --git a/qcsrc/common/turrets/turret/plasma.qc b/qcsrc/common/turrets/turret/plasma.qc index a70e13756..97f5c5659 100644 --- a/qcsrc/common/turrets/turret/plasma.qc +++ b/qcsrc/common/turrets/turret/plasma.qc @@ -22,7 +22,7 @@ REGISTER_TURRET(PLASMA, NEW(PlasmaTurret)); #ifdef SVQC -spawnfunc(turret_plasma) { if (!turret_initialize(TUR_PLASMA)) remove(self); } +spawnfunc(turret_plasma) { if (!turret_initialize(TUR_PLASMA)) remove(this); } METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this, entity it)) { diff --git a/qcsrc/common/turrets/turret/plasma_dual.qc b/qcsrc/common/turrets/turret/plasma_dual.qc index 6f712b370..9874fb3cb 100644 --- a/qcsrc/common/turrets/turret/plasma_dual.qc +++ b/qcsrc/common/turrets/turret/plasma_dual.qc @@ -28,7 +28,7 @@ REGISTER_TURRET(PLASMA_DUAL, NEW(DualPlasmaTurret)); #ifdef SVQC -spawnfunc(turret_plasma_dual) { if (!turret_initialize(TUR_PLASMA_DUAL)) remove(self); } +spawnfunc(turret_plasma_dual) { if (!turret_initialize(TUR_PLASMA_DUAL)) remove(this); } METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret thistur, entity it)) { diff --git a/qcsrc/common/turrets/turret/tesla.qc b/qcsrc/common/turrets/turret/tesla.qc index 510331c63..35929ccc5 100644 --- a/qcsrc/common/turrets/turret/tesla.qc +++ b/qcsrc/common/turrets/turret/tesla.qc @@ -22,7 +22,7 @@ REGISTER_TURRET(TESLA, NEW(TeslaCoil)); #ifdef SVQC -spawnfunc(turret_tesla) { if (!turret_initialize(TUR_TESLA)) remove(self); } +spawnfunc(turret_tesla) { if (!turret_initialize(TUR_TESLA)) remove(this); } METHOD(TeslaCoil, tr_think, void(TeslaCoil thistur, entity it)) { diff --git a/qcsrc/common/turrets/turret/walker.qc b/qcsrc/common/turrets/turret/walker.qc index 51ace9a7d..ebca240d0 100644 --- a/qcsrc/common/turrets/turret/walker.qc +++ b/qcsrc/common/turrets/turret/walker.qc @@ -344,7 +344,7 @@ void walker_move_path() #endif } -spawnfunc(turret_walker) { if(!turret_initialize(TUR_WALKER)) remove(self); } +spawnfunc(turret_walker) { if(!turret_initialize(TUR_WALKER)) remove(this); } METHOD(WalkerTurret, tr_think, void(WalkerTurret thistur, entity it)) { diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index 355eada3c..4a49933b1 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -62,7 +62,7 @@ REGISTER_WEAPON(MACHINEGUN, machinegun, NEW(MachineGun)); spawnfunc(weapon_machinegun) { if(autocvar_sv_q3acompat_machineshotgunswap) - if(self.classname != "droppedweapon") + if(this.classname != "droppedweapon") { weapon_defaultspawnfunc(this, WEP_SHOCKWAVE); return; diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index add6d5355..9788e5e28 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -126,8 +126,8 @@ spawnfunc(info_autoscreenshot) objerror("Too many info_autoscreenshot entitites. FAIL!"); return; } - if(self.target != "") - InitializeEntity(self, info_autoscreenshot_findtarget, INITPRIO_FINDTARGET); + if(this.target != "") + InitializeEntity(this, info_autoscreenshot_findtarget, INITPRIO_FINDTARGET); // this one just has to exist } diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 3ffc73820..f6918c606 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -656,7 +656,7 @@ void PutClientInServer() } } -void ClientInit_misc(); +void ClientInit_misc(entity this); .float ebouncefactor, ebouncestop; // electro's values // TODO do we need all these fields, or should we stop autodetecting runtime @@ -670,12 +670,11 @@ bool ClientInit_SendEntity(entity this, entity to, int sf) // TODO: make easier to use Registry_send_all(); W_PROP_reload(MSG_ONE, to); - ClientInit_misc(); + ClientInit_misc(this); MUTATOR_CALLHOOK(Ent_Init); } -void ClientInit_misc() +void ClientInit_misc(entity this) { - SELFPARAM(); int channel = MSG_ONE; WriteHeader(channel, ENT_CLIENT_INIT); WriteByte(channel, g_nexball_meter_period * 32); diff --git a/qcsrc/server/g_lights.qc b/qcsrc/server/g_lights.qc index 352f0be43..2b1d12b94 100644 --- a/qcsrc/server/g_lights.qc +++ b/qcsrc/server/g_lights.qc @@ -91,43 +91,43 @@ void dynlight_use(entity this, entity actor, entity trigger) } spawnfunc(dynlight) { - if (!self.light_lev) - self.light_lev = 200; - if (!self.color) - self.color = '1 1 1'; - self.lefty = self.light_lev; - self.use = dynlight_use; - setsize (self, '0 0 0', '0 0 0'); - setorigin (self, self.origin); - //self.pflags = PFLAGS_FULLDYNAMIC; - self.solid = SOLID_NOT; - //self.blocked = func_null; - //if (self.spawnflags & DNOSHADOW) - // self.pflags = self.pflags + PFLAGS_NOSHADOW; - //if (self.spawnflags & START_OFF) - // self.light_lev = 0; + if (!this.light_lev) + this.light_lev = 200; + if (!this.color) + this.color = '1 1 1'; + this.lefty = this.light_lev; + this.use = dynlight_use; + setsize (this, '0 0 0', '0 0 0'); + setorigin (this, this.origin); + //this.pflags = PFLAGS_FULLDYNAMIC; + this.solid = SOLID_NOT; + //this.blocked = func_null; + //if (this.spawnflags & DNOSHADOW) + // this.pflags = this.pflags + PFLAGS_NOSHADOW; + //if (this.spawnflags & START_OFF) + // this.light_lev = 0; //tag attaching - if (self.dtagname) + if (this.dtagname) { - InitializeEntity(self, dynlight_find_target, INITPRIO_FINDTARGET); + InitializeEntity(this, dynlight_find_target, INITPRIO_FINDTARGET); return; } // entity following - if (self.spawnflags & DFOLLOW) + if (this.spawnflags & DFOLLOW) { - InitializeEntity(self, dynlight_find_aiment, INITPRIO_FINDTARGET); + InitializeEntity(this, dynlight_find_aiment, INITPRIO_FINDTARGET); return; } // path following - if (self.target) -// if (!(self.spawnflags & DFOLLOW)) + if (this.target) +// if (!(this.spawnflags & DFOLLOW)) { - self.movetype = MOVETYPE_NOCLIP; - if (!self.speed) - self.speed = 100; - InitializeEntity(self, dynlight_find_path, INITPRIO_FINDTARGET); + this.movetype = MOVETYPE_NOCLIP; + if (!this.speed) + this.speed = 100; + InitializeEntity(this, dynlight_find_path, INITPRIO_FINDTARGET); return; } } diff --git a/qcsrc/server/g_models.qc b/qcsrc/server/g_models.qc index 6623a0778..363650ce8 100644 --- a/qcsrc/server/g_models.qc +++ b/qcsrc/server/g_models.qc @@ -53,42 +53,42 @@ void g_clientmodel_use(entity this, entity actor, entity trigger) void g_model_dropbyspawnflags(entity this) { - if((self.spawnflags & 3) == 1) // ALIGN_ORIGIN + if((this.spawnflags & 3) == 1) // ALIGN_ORIGIN { - traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self); - setorigin(self, trace_endpos); + traceline(this.origin, this.origin - '0 0 4096', MOVE_NOMONSTERS, this); + setorigin(this, trace_endpos); } - else if((self.spawnflags & 3) == 2) // ALIGN_BOTTOM + else if((this.spawnflags & 3) == 2) // ALIGN_BOTTOM { - tracebox(self.origin, self.mins, self.maxs, self.origin - '0 0 4096', MOVE_NOMONSTERS, self); - setorigin(self, trace_endpos); + tracebox(this.origin, this.mins, this.maxs, this.origin - '0 0 4096', MOVE_NOMONSTERS, this); + setorigin(this, trace_endpos); } - else if((self.spawnflags & 3) == 3) // ALIGN_ORIGIN | ALIGN_BOTTOM + else if((this.spawnflags & 3) == 3) // ALIGN_ORIGIN | ALIGN_BOTTOM { - traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self); - setorigin(self, trace_endpos - '0 0 1' * self.mins.z); + traceline(this.origin, this.origin - '0 0 4096', MOVE_NOMONSTERS, this); + setorigin(this, trace_endpos - '0 0 1' * this.mins.z); } } void g_clientmodel_dropbyspawnflags(entity this) { vector o0; - o0 = self.origin; - g_model_dropbyspawnflags(self); - if(self.origin != o0) - self.SendFlags |= 2; + o0 = this.origin; + g_model_dropbyspawnflags(this); + if(this.origin != o0) + this.SendFlags |= 2; } bool g_clientmodel_genericsendentity(entity this, entity to, int sf) { sf = sf & 0x0F; - if(self.angles != '0 0 0') + if(this.angles != '0 0 0') sf |= 0x10; - if(self.mins != '0 0 0' || self.maxs != '0 0 0') + if(this.mins != '0 0 0' || this.maxs != '0 0 0') sf |= 0x20; - if(self.colormap != 0) + if(this.colormap != 0) sf |= 0x40; - if(self.lodmodelindex1) + if(this.lodmodelindex1) sf |= 0x80; WriteHeader(MSG_ENTITY, ENT_CLIENT_WALL); @@ -97,23 +97,23 @@ bool g_clientmodel_genericsendentity(entity this, entity to, int sf) if(sf & BIT(0)) { if(sf & 0x40) - WriteShort(MSG_ENTITY, self.colormap); + WriteShort(MSG_ENTITY, this.colormap); } if(sf & BIT(1)) { - WriteCoord(MSG_ENTITY, self.origin.x); - WriteCoord(MSG_ENTITY, self.origin.y); - WriteCoord(MSG_ENTITY, self.origin.z); + WriteCoord(MSG_ENTITY, this.origin.x); + WriteCoord(MSG_ENTITY, this.origin.y); + WriteCoord(MSG_ENTITY, this.origin.z); } if(sf & BIT(2)) { if(sf & 0x10) { - WriteAngle(MSG_ENTITY, self.angles.x); - WriteAngle(MSG_ENTITY, self.angles.y); - WriteAngle(MSG_ENTITY, self.angles.z); + WriteAngle(MSG_ENTITY, this.angles.x); + WriteAngle(MSG_ENTITY, this.angles.y); + WriteAngle(MSG_ENTITY, this.angles.z); } } @@ -121,78 +121,78 @@ bool g_clientmodel_genericsendentity(entity this, entity to, int sf) { if(sf & 0x80) { - WriteShort(MSG_ENTITY, self.lodmodelindex0); - WriteShort(MSG_ENTITY, bound(0, self.loddistance1, 65535)); - WriteShort(MSG_ENTITY, self.lodmodelindex1); - WriteShort(MSG_ENTITY, bound(0, self.loddistance2, 65535)); - WriteShort(MSG_ENTITY, self.lodmodelindex2); + WriteShort(MSG_ENTITY, this.lodmodelindex0); + WriteShort(MSG_ENTITY, bound(0, this.loddistance1, 65535)); + WriteShort(MSG_ENTITY, this.lodmodelindex1); + WriteShort(MSG_ENTITY, bound(0, this.loddistance2, 65535)); + WriteShort(MSG_ENTITY, this.lodmodelindex2); } else - WriteShort(MSG_ENTITY, self.modelindex); - WriteByte(MSG_ENTITY, self.solid); - WriteShort(MSG_ENTITY, floor(self.scale * 256)); + WriteShort(MSG_ENTITY, this.modelindex); + WriteByte(MSG_ENTITY, this.solid); + WriteShort(MSG_ENTITY, floor(this.scale * 256)); if(sf & 0x20) { - WriteCoord(MSG_ENTITY, self.mins.x); - WriteCoord(MSG_ENTITY, self.mins.y); - WriteCoord(MSG_ENTITY, self.mins.z); - WriteCoord(MSG_ENTITY, self.maxs.x); - WriteCoord(MSG_ENTITY, self.maxs.y); - WriteCoord(MSG_ENTITY, self.maxs.z); + WriteCoord(MSG_ENTITY, this.mins.x); + WriteCoord(MSG_ENTITY, this.mins.y); + WriteCoord(MSG_ENTITY, this.mins.z); + WriteCoord(MSG_ENTITY, this.maxs.x); + WriteCoord(MSG_ENTITY, this.maxs.y); + WriteCoord(MSG_ENTITY, this.maxs.z); } - WriteString(MSG_ENTITY, self.bgmscript); - if(self.bgmscript != "") + WriteString(MSG_ENTITY, this.bgmscript); + if(this.bgmscript != "") { - WriteByte(MSG_ENTITY, floor(self.bgmscriptattack * 64)); - WriteByte(MSG_ENTITY, floor(self.bgmscriptdecay * 64)); - WriteByte(MSG_ENTITY, floor(self.bgmscriptsustain * 255)); - WriteByte(MSG_ENTITY, floor(self.bgmscriptrelease * 64)); - WriteCoord(MSG_ENTITY, self.movedir.x); - WriteCoord(MSG_ENTITY, self.movedir.y); - WriteCoord(MSG_ENTITY, self.movedir.z); - WriteByte(MSG_ENTITY, floor(self.lip * 255)); + WriteByte(MSG_ENTITY, floor(this.bgmscriptattack * 64)); + WriteByte(MSG_ENTITY, floor(this.bgmscriptdecay * 64)); + WriteByte(MSG_ENTITY, floor(this.bgmscriptsustain * 255)); + WriteByte(MSG_ENTITY, floor(this.bgmscriptrelease * 64)); + WriteCoord(MSG_ENTITY, this.movedir.x); + WriteCoord(MSG_ENTITY, this.movedir.y); + WriteCoord(MSG_ENTITY, this.movedir.z); + WriteByte(MSG_ENTITY, floor(this.lip * 255)); } - WriteShort(MSG_ENTITY, self.fade_start); - WriteShort(MSG_ENTITY, self.fade_end); - WriteShort(MSG_ENTITY, self.alpha_max); - WriteShort(MSG_ENTITY, self.alpha_min); - WriteShort(MSG_ENTITY, self.inactive); - WriteShort(MSG_ENTITY, self.fade_vertical_offset); + WriteShort(MSG_ENTITY, this.fade_start); + WriteShort(MSG_ENTITY, this.fade_end); + WriteShort(MSG_ENTITY, this.alpha_max); + WriteShort(MSG_ENTITY, this.alpha_min); + WriteShort(MSG_ENTITY, this.inactive); + WriteShort(MSG_ENTITY, this.fade_vertical_offset); } return true; } -#define G_MODEL_INIT(sol) \ - if(self.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) self.movetype = MOVETYPE_PHYSICS; \ - if(!self.scale) self.scale = self.modelscale; \ +#define G_MODEL_INIT(ent,sol) \ + if(ent.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) ent.movetype = MOVETYPE_PHYSICS; \ + if(!ent.scale) ent.scale = ent.modelscale; \ SetBrushEntityModel(); \ - self.use = g_model_setcolormaptoactivator; \ - InitializeEntity(self, g_model_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \ - if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT; + ent.use = g_model_setcolormaptoactivator; \ + InitializeEntity(ent, g_model_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \ + if(!ent.solid) ent.solid = (sol); else if(ent.solid < 0) ent.solid = SOLID_NOT; -#define G_CLIENTMODEL_INIT(sol) \ - if(self.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) self.movetype = MOVETYPE_PHYSICS; \ - if(!self.scale) self.scale = self.modelscale; \ +#define G_CLIENTMODEL_INIT(ent,sol) \ + if(ent.geomtype) if(autocvar_physics_ode && checkextension("DP_PHYSICS_ODE")) ent.movetype = MOVETYPE_PHYSICS; \ + if(!ent.scale) ent.scale = ent.modelscale; \ SetBrushEntityModel(); \ - self.use = g_clientmodel_use; \ - InitializeEntity(self, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \ - if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT; \ - if(!self.bgmscriptsustain) self.bgmscriptsustain = 1; else if(self.bgmscriptsustain < 0) self.bgmscriptsustain = 0; \ - Net_LinkEntity(self, true, 0, g_clientmodel_genericsendentity); \ - self.default_solid = sol; + ent.use = g_clientmodel_use; \ + InitializeEntity(ent, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \ + if(!ent.solid) ent.solid = (sol); else if(ent.solid < 0) ent.solid = SOLID_NOT; \ + if(!ent.bgmscriptsustain) ent.bgmscriptsustain = 1; else if(ent.bgmscriptsustain < 0) ent.bgmscriptsustain = 0; \ + Net_LinkEntity(ent, true, 0, g_clientmodel_genericsendentity); \ + ent.default_solid = sol; // non-solid model entities: -spawnfunc(misc_gamemodel) { self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // model entity -spawnfunc(misc_clientmodel) { self.angles_x = -self.angles.x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity -spawnfunc(misc_models) { self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use +spawnfunc(misc_gamemodel) { this.angles_x = -this.angles.x; G_MODEL_INIT (this, SOLID_NOT) } // model entity +spawnfunc(misc_clientmodel) { this.angles_x = -this.angles.x; G_CLIENTMODEL_INIT(this, SOLID_NOT) } // model entity +spawnfunc(misc_models) { this.angles_x = -this.angles.x; G_MODEL_INIT (this, SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use // non-solid brush entities: -spawnfunc(func_illusionary) { G_MODEL_INIT (SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED) -spawnfunc(func_clientillusionary) { G_CLIENTMODEL_INIT(SOLID_NOT) } // brush entity -spawnfunc(func_static) { G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old alias name from some other game +spawnfunc(func_illusionary) { G_MODEL_INIT (this, SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED) +spawnfunc(func_clientillusionary) { G_CLIENTMODEL_INIT(this, SOLID_NOT) } // brush entity +spawnfunc(func_static) { G_MODEL_INIT (this, SOLID_NOT) } // DEPRECATED old alias name from some other game // solid brush entities -spawnfunc(func_wall) { G_MODEL_INIT (SOLID_BSP) } // Q1 name -spawnfunc(func_clientwall) { G_CLIENTMODEL_INIT(SOLID_BSP) } // brush entity (WARNING: MISPREDICTED) +spawnfunc(func_wall) { G_MODEL_INIT (this, SOLID_BSP) } // Q1 name +spawnfunc(func_clientwall) { G_CLIENTMODEL_INIT(this, SOLID_BSP) } // brush entity (WARNING: MISPREDICTED) diff --git a/qcsrc/server/g_subs.qc b/qcsrc/server/g_subs.qc index a2cbc5a43..cc4d2c60d 100644 --- a/qcsrc/server/g_subs.qc +++ b/qcsrc/server/g_subs.qc @@ -8,7 +8,7 @@ spawnfunc(info_null) { - remove(self); + remove(this); // if anything breaks, tell the mapper to fix his map! info_null is meant to remove itself immediately. } @@ -434,17 +434,17 @@ void InitSolidBSPTrigger() self.model = ""; } -float InitMovingBrushTrigger() -{SELFPARAM(); +bool InitMovingBrushTrigger(entity this) +{ // 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; - SetBrushEntityModel(); - self.movetype = MOVETYPE_PUSH; - if(self.modelindex == 0) + this.solid = SOLID_BSP; + WITHSELF(this, SetBrushEntityModel()); + this.movetype = MOVETYPE_PUSH; + if(this.modelindex == 0) { objerror("InitMovingBrushTrigger: no brushes found!"); - return 0; + return false; } - return 1; + return true; } diff --git a/qcsrc/server/g_subs.qh b/qcsrc/server/g_subs.qh index dc8ffe8c0..b46907433 100644 --- a/qcsrc/server/g_subs.qh +++ b/qcsrc/server/g_subs.qh @@ -162,4 +162,4 @@ void InitTrigger(); void InitSolidBSPTrigger(); -float InitMovingBrushTrigger(); +bool InitMovingBrushTrigger(entity this); diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 054e19d74..b9d8035d5 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -923,7 +923,7 @@ spawnfunc(worldspawn) spawnfunc(light) { //makestatic (self); // Who the f___ did that? - remove(self); + remove(this); } string GetGametype() diff --git a/qcsrc/server/item_key.qc b/qcsrc/server/item_key.qc index 9688d51db..c129127c3 100644 --- a/qcsrc/server/item_key.qc +++ b/qcsrc/server/item_key.qc @@ -91,38 +91,38 @@ void item_key_touch() /** * Spawn a key with given model, key code and color. */ -void spawn_item_key() -{SELFPARAM(); - precache_model(self.model); +void spawn_item_key(entity this) +{ + precache_model(this.model); - if (self.spawnflags & 1) // FLOATING - self.noalign = 1; + if (this.spawnflags & 1) // FLOATING + this.noalign = 1; - if (self.noalign) - self.movetype = MOVETYPE_NONE; + if (this.noalign) + this.movetype = MOVETYPE_NONE; else - self.movetype = MOVETYPE_TOSS; + this.movetype = MOVETYPE_TOSS; - precache_sound(self.noise); + precache_sound(this.noise); - self.mdl = self.model; - self.effects = EF_LOWPRECISION; - _setmodel(self, self.model); - //setsize(self, '-16 -16 -24', '16 16 32'); - setorigin(self, self.origin + '0 0 32'); - setsize(self, '-16 -16 -56', '16 16 0'); - self.modelflags |= MF_ROTATE; - self.solid = SOLID_TRIGGER; + this.mdl = this.model; + this.effects = EF_LOWPRECISION; + _setmodel(this, this.model); + //setsize(this, '-16 -16 -24', '16 16 32'); + setorigin(this, this.origin + '0 0 32'); + setsize(this, '-16 -16 -56', '16 16 0'); + this.modelflags |= MF_ROTATE; + this.solid = SOLID_TRIGGER; - if (!self.noalign) + if (!this.noalign) { // first nudge it off the floor a little bit to avoid math errors - setorigin(self, self.origin + '0 0 1'); + setorigin(this, this.origin + '0 0 1'); // note droptofloor returns false if stuck/or would fall too far - droptofloor(); + WITHSELF(this, droptofloor()); } - self.touch = item_key_touch; + this.touch = item_key_touch; }; @@ -158,14 +158,14 @@ spawnfunc(item_key) vector _colormod; // reject this entity if more than one key was set! - if (self.itemkeys>0 && (self.itemkeys & (self.itemkeys-1)) != 0) { + if (this.itemkeys>0 && (this.itemkeys & (this.itemkeys-1)) != 0) { objerror("item_key.itemkeys must contain only 1 bit set specifying the key it represents!"); - remove(self); + remove(this); return; } // find default netname and colormod - switch(self.itemkeys) { + switch(this.itemkeys) { case BIT(0): _netname = "GOLD key"; _colormod = '1 .9 0'; @@ -200,9 +200,9 @@ spawnfunc(item_key) _netname = "FLUFFY PINK keycard"; _colormod = '1 1 1'; - if (self.netname == "") { + if (this.netname == "") { objerror("item_key doesn't have a default name for this key and a custom one was not specified!"); - remove(self); + remove(this); return; } break; @@ -211,40 +211,40 @@ spawnfunc(item_key) // find default model string _model = string_null; - if (self.itemkeys <= ITEM_KEY_BIT(2)) { + if (this.itemkeys <= ITEM_KEY_BIT(2)) { _model = "models/keys/key.md3"; - } else if (self.itemkeys >= ITEM_KEY_BIT(3) && self.itemkeys <= ITEM_KEY_BIT(5)) { + } else if (this.itemkeys >= ITEM_KEY_BIT(3) && this.itemkeys <= ITEM_KEY_BIT(5)) { _model = "models/keys/key.md3"; // FIXME: replace it by a keycard model! - } else if (self.model == "") { + } else if (this.model == "") { objerror("item_key doesn't have a default model for this key and a custom one was not specified!"); - remove(self); + remove(this); return; } // set defailt netname - if (self.netname == "") - self.netname = _netname; + if (this.netname == "") + this.netname = _netname; // set default colormod - if (!self.colormod) - self.colormod = _colormod; + if (!this.colormod) + this.colormod = _colormod; // set default model - if (self.model == "") - self.model = _model; + if (this.model == "") + this.model = _model; // set default pickup message - if (self.message == "") - self.message = strzone(strcat("You've picked up the ", self.netname, "!")); + if (this.message == "") + this.message = strzone(strcat("You've picked up the ", this.netname, "!")); - if (self.noise == "") - self.noise = strzone(SND(ITEMPICKUP)); + if (this.noise == "") + this.noise = strzone(SND(ITEMPICKUP)); // save the name for later - item_keys_names[lowestbit(self.itemkeys)] = self.netname; + item_keys_names[lowestbit(this.itemkeys)] = this.netname; // put the key on the map - spawn_item_key(); + spawn_item_key(this); } /*QUAKED item_key1 (0 .5 .8) (-16 -16 -24) (16 16 32) FLOATING diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 702ff4574..33fb745a5 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -2421,9 +2421,9 @@ Keys: "noise5" sound played when flag touches the ground... */ spawnfunc(item_flag_team1) { - if(!g_ctf) { remove(self); return; } + if(!g_ctf) { remove(this); return; } - ctf_FlagSetup(NUM_TEAM_1, self); + ctf_FlagSetup(NUM_TEAM_1, this); } /*QUAKED spawnfunc_item_flag_team2 (0 0.5 0.8) (-48 -48 -37) (48 48 37) @@ -2439,9 +2439,9 @@ Keys: "noise5" sound played when flag touches the ground... */ spawnfunc(item_flag_team2) { - if(!g_ctf) { remove(self); return; } + if(!g_ctf) { remove(this); return; } - ctf_FlagSetup(NUM_TEAM_2, self); + ctf_FlagSetup(NUM_TEAM_2, this); } /*QUAKED spawnfunc_item_flag_team3 (0 0.5 0.8) (-48 -48 -37) (48 48 37) @@ -2457,9 +2457,9 @@ Keys: "noise5" sound played when flag touches the ground... */ spawnfunc(item_flag_team3) { - if(!g_ctf) { remove(self); return; } + if(!g_ctf) { remove(this); return; } - ctf_FlagSetup(NUM_TEAM_3, self); + ctf_FlagSetup(NUM_TEAM_3, this); } /*QUAKED spawnfunc_item_flag_team4 (0 0.5 0.8) (-48 -48 -37) (48 48 37) @@ -2475,9 +2475,9 @@ Keys: "noise5" sound played when flag touches the ground... */ spawnfunc(item_flag_team4) { - if(!g_ctf) { remove(self); return; } + if(!g_ctf) { remove(this); return; } - ctf_FlagSetup(NUM_TEAM_4, self); + ctf_FlagSetup(NUM_TEAM_4, this); } /*QUAKED spawnfunc_item_flag_neutral (0 0.5 0.8) (-48 -48 -37) (48 48 37) @@ -2493,10 +2493,10 @@ Keys: "noise5" sound played when flag touches the ground... */ spawnfunc(item_flag_neutral) { - if(!g_ctf) { remove(self); return; } - if(!cvar("g_ctf_oneflag")) { remove(self); return; } + if(!g_ctf) { remove(this); return; } + if(!cvar("g_ctf_oneflag")) { remove(this); return; } - ctf_FlagSetup(0, self); + ctf_FlagSetup(0, this); } /*QUAKED spawnfunc_ctf_team (0 .5 .8) (-16 -16 -24) (16 16 32) @@ -2507,10 +2507,10 @@ Keys: "cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */ spawnfunc(ctf_team) { - if(!g_ctf) { remove(self); return; } + if(!g_ctf) { remove(this); return; } - self.classname = "ctf_team"; - self.team = self.cnt + 1; + this.classname = "ctf_team"; + this.team = this.cnt + 1; } // compatibility for quake maps diff --git a/qcsrc/server/mutators/mutator/gamemode_domination.qc b/qcsrc/server/mutators/mutator/gamemode_domination.qc index 141837c26..08b00716b 100644 --- a/qcsrc/server/mutators/mutator/gamemode_domination.qc +++ b/qcsrc/server/mutators/mutator/gamemode_domination.qc @@ -538,19 +538,19 @@ spawnfunc(dom_controlpoint) { if(!g_domination) { - remove(self); + remove(this); return; } - self.think = dom_controlpoint_setup_self; - self.nextthink = time + 0.1; - self.reset = dom_controlpoint_setup; + this.think = dom_controlpoint_setup_self; + this.nextthink = time + 0.1; + this.reset = dom_controlpoint_setup; - if(!self.scale) - self.scale = 0.6; + if(!this.scale) + this.scale = 0.6; - self.effects = self.effects | EF_LOWPRECISION; + this.effects = this.effects | EF_LOWPRECISION; if (autocvar_g_domination_point_fullbright) - self.effects |= EF_FULLBRIGHT; + this.effects |= EF_FULLBRIGHT; } /*QUAKED spawnfunc_dom_team (0 .5 .8) (-32 -32 -24) (32 32 32) @@ -583,23 +583,23 @@ spawnfunc(dom_team) { if(!g_domination || autocvar_g_domination_teams_override >= 2) { - remove(self); + remove(this); return; } - precache_model(self.model); - if (self.noise != "") - precache_sound(self.noise); - if (self.noise1 != "") - precache_sound(self.noise1); - self.classname = "dom_team"; - _setmodel(self, self.model); // precision not needed - self.mdl = self.model; - self.dmg = self.modelindex; - self.model = ""; - self.modelindex = 0; + precache_model(this.model); + if (this.noise != "") + precache_sound(this.noise); + if (this.noise1 != "") + precache_sound(this.noise1); + this.classname = "dom_team"; + _setmodel(this, this.model); // precision not needed + this.mdl = this.model; + this.dmg = this.modelindex; + this.model = ""; + this.modelindex = 0; // this would have to be changed if used in quakeworld - if(self.cnt) - self.team = self.cnt + 1; // WHY are these different anyway? + if(this.cnt) + this.team = this.cnt + 1; // WHY are these different anyway? } // scoreboard setup diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index e49bf3d54..42592dda7 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -77,13 +77,13 @@ float autocvar_g_invasion_spawn_delay; spawnfunc(invasion_spawnpoint) { - if(!g_invasion) { remove(self); return; } + if(!g_invasion) { remove(this); return; } - self.classname = "invasion_spawnpoint"; + this.classname = "invasion_spawnpoint"; if(autocvar_g_invasion_zombies_only) // precache only if it hasn't been already - if(self.monsterid) { - Monster mon = get_monsterinfo(self.monsterid); + if(this.monsterid) { + Monster mon = get_monsterinfo(this.monsterid); mon.mr_precache(mon); } } diff --git a/qcsrc/server/mutators/mutator/gamemode_tdm.qc b/qcsrc/server/mutators/mutator/gamemode_tdm.qc index 6c22a8e19..d391f11b2 100644 --- a/qcsrc/server/mutators/mutator/gamemode_tdm.qc +++ b/qcsrc/server/mutators/mutator/gamemode_tdm.qc @@ -51,10 +51,10 @@ Keys: "cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */ spawnfunc(tdm_team) { - if(!g_tdm || !self.cnt) { remove(self); return; } + if(!g_tdm || !this.cnt) { remove(this); return; } - self.classname = "tdm_team"; - self.team = self.cnt + 1; + this.classname = "tdm_team"; + this.team = this.cnt + 1; } // code from here on is just to support maps that don't have team entities diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index b09657e6a..df6a611d8 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -233,11 +233,11 @@ bool PlayerScore_SendEntity(entity this, entity to, float sendflags) float i, p, longflags; WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES); - WriteByte(MSG_ENTITY, etof(self.owner)); + WriteByte(MSG_ENTITY, etof(this.owner)); longflags = 0; for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2) - if(self.(scores[i]) > 127 || self.(scores[i]) <= -128) + if(this.(scores[i]) > 127 || this.(scores[i]) <= -128) longflags |= p; #if MAX_SCORE <= 8 @@ -251,9 +251,9 @@ bool PlayerScore_SendEntity(entity this, entity to, float sendflags) if(sendflags & p) { if(longflags & p) - WriteInt24_t(MSG_ENTITY, self.(scores[i])); + WriteInt24_t(MSG_ENTITY, this.(scores[i])); else - WriteChar(MSG_ENTITY, self.(scores[i])); + WriteChar(MSG_ENTITY, this.(scores[i])); } return true; diff --git a/qcsrc/server/steerlib.qc b/qcsrc/server/steerlib.qc index 248001656..849100091 100644 --- a/qcsrc/server/steerlib.qc +++ b/qcsrc/server/steerlib.qc @@ -640,26 +640,26 @@ spawnfunc(flockerspawn) {SELFPARAM(); ++globflockcnt; - if(!self.cnt) self.cnt = 20; - if(!self.delay) self.delay = 0.25; - if(!self.flock_id) self.flock_id = globflockcnt; - - self.think = flockerspawn_think; - self.nextthink = time + 0.25; - - self.enemy = new(FLock Hunter); - - setmodel(self.enemy, MDL_FLOCKER); - setorigin(self.enemy,self.origin + '0 0 768' + (randomvec() * 128)); - - self.enemy.scale = 3; - self.enemy.effects = EF_LOWPRECISION; - self.enemy.movetype = MOVETYPE_BOUNCEMISSILE; - PROJECTILE_MAKETRIGGER(self.enemy); - self.enemy.think = flocker_hunter_think; - self.enemy.nextthink = time + 10; - self.enemy.flock_id = self.flock_id; - self.enemy.owner = self; + if(!this.cnt) this.cnt = 20; + if(!this.delay) this.delay = 0.25; + if(!this.flock_id) this.flock_id = globflockcnt; + + this.think = flockerspawn_think; + this.nextthink = time + 0.25; + + this.enemy = new(FLock Hunter); + + setmodel(this.enemy, MDL_FLOCKER); + setorigin(this.enemy,this.origin + '0 0 768' + (randomvec() * 128)); + + this.enemy.scale = 3; + this.enemy.effects = EF_LOWPRECISION; + this.enemy.movetype = MOVETYPE_BOUNCEMISSILE; + PROJECTILE_MAKETRIGGER(this.enemy); + this.enemy.think = flocker_hunter_think; + this.enemy.nextthink = time + 10; + this.enemy.flock_id = this.flock_id; + this.enemy.owner = this; } #endif diff --git a/qcsrc/server/weapons/csqcprojectile.qc b/qcsrc/server/weapons/csqcprojectile.qc index f3e9f22ef..0edf22664 100644 --- a/qcsrc/server/weapons/csqcprojectile.qc +++ b/qcsrc/server/weapons/csqcprojectile.qc @@ -16,22 +16,22 @@ bool CSQCProjectile_SendEntity(entity this, entity to, int sf) // note: flag 0x08 = no trail please (teleport bit) sf = sf & 0x0F; - if(self.csqcprojectile_clientanimate) + if(this.csqcprojectile_clientanimate) sf |= 0x80; // client animated, not interpolated - if(IS_ONGROUND(self)) + if(IS_ONGROUND(this)) sf |= 0x40; ft = fr = 0; - if(self.fade_time != 0 || self.fade_rate != 0) + if(this.fade_time != 0 || this.fade_rate != 0) { - ft = (self.fade_time - time) / sys_frametime; - fr = (1 / self.fade_rate) / sys_frametime; + ft = (this.fade_time - time) / sys_frametime; + fr = (1 / this.fade_rate) / sys_frametime; if(ft <= 255 && fr <= 255 && fr >= 1) sf |= 0x20; } - if(self.gravity != 0) + if(this.gravity != 0) sf |= 0x10; WriteHeader(MSG_ENTITY, ENT_CLIENT_PROJECTILE); @@ -39,17 +39,17 @@ bool CSQCProjectile_SendEntity(entity this, entity to, int sf) if(sf & 1) { - WriteCoord(MSG_ENTITY, self.origin.x); - WriteCoord(MSG_ENTITY, self.origin.y); - WriteCoord(MSG_ENTITY, self.origin.z); + WriteCoord(MSG_ENTITY, this.origin.x); + WriteCoord(MSG_ENTITY, this.origin.y); + WriteCoord(MSG_ENTITY, this.origin.z); if(sf & 0x80) { - WriteCoord(MSG_ENTITY, self.velocity.x); - WriteCoord(MSG_ENTITY, self.velocity.y); - WriteCoord(MSG_ENTITY, self.velocity.z); + WriteCoord(MSG_ENTITY, this.velocity.x); + WriteCoord(MSG_ENTITY, this.velocity.y); + WriteCoord(MSG_ENTITY, this.velocity.z); if(sf & 0x10) - WriteCoord(MSG_ENTITY, self.gravity); + WriteCoord(MSG_ENTITY, this.gravity); } if(sf & 0x20) @@ -58,11 +58,11 @@ bool CSQCProjectile_SendEntity(entity this, entity to, int sf) WriteByte(MSG_ENTITY, fr); } - WriteByte(MSG_ENTITY, self.realowner.team); + WriteByte(MSG_ENTITY, this.realowner.team); } if(sf & 2) - WriteByte(MSG_ENTITY, self.csqcprojectile_type); // TODO maybe put this into sf? + WriteByte(MSG_ENTITY, this.csqcprojectile_type); // TODO maybe put this into sf? return true; }