X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fmutator%2Fgamemode_ctf.qc;h=cbd527289014cfb629e65cf6b12a9fdc29305a17;hb=9c0758425f32e8b07e1d44d59a7264d535b78844;hp=83618a2f80a7be965982fcafdf85e582ee232e93;hpb=f52ddede69621c7c9d31983591902f47fd40d7d0;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/mutator/gamemode_ctf.qc b/qcsrc/server/mutators/mutator/gamemode_ctf.qc index 83618a2f8..cbd527289 100644 --- a/qcsrc/server/mutators/mutator/gamemode_ctf.qc +++ b/qcsrc/server/mutators/mutator/gamemode_ctf.qc @@ -278,16 +278,16 @@ void ctf_CaptureShield_Update(entity player, bool wanted_status) } } -bool ctf_CaptureShield_Customize() -{SELFPARAM(); +bool ctf_CaptureShield_Customize(entity this) +{ if(!other.ctf_captureshielded) { return false; } if(CTF_SAMETEAM(self, other)) { return false; } return true; } -void ctf_CaptureShield_Touch() -{SELFPARAM(); +void ctf_CaptureShield_Touch(entity this) +{ if(!other.ctf_captureshielded) { return; } if(CTF_SAMETEAM(self, other)) { return; } @@ -304,8 +304,8 @@ void ctf_CaptureShield_Spawn(entity flag) shield.enemy = self; shield.team = self.team; - shield.touch = ctf_CaptureShield_Touch; - shield.customizeentityforclient = ctf_CaptureShield_Customize; + settouch(shield, ctf_CaptureShield_Touch); + setcefc(shield, ctf_CaptureShield_Customize); shield.effects = EF_ADDITIVE; shield.movetype = MOVETYPE_NOCLIP; shield.solid = SOLID_TRIGGER; @@ -747,8 +747,8 @@ void ctf_CheckFlagReturn(entity flag, int returntype) } } -bool ctf_Stalemate_Customize() -{SELFPARAM(); +bool ctf_Stalemate_Customize(entity this) +{ // make spectators see what the player would see entity e, wp_owner; e = WaypointSprite_getviewentity(other); @@ -814,7 +814,7 @@ void ctf_CheckStalemate() { entity wp = WaypointSprite_Spawn(((ctf_oneflag) ? WP_FlagCarrier : WP_FlagCarrierEnemy), 0, 0, tmp_entity.owner, FLAG_WAYPOINT_OFFSET, world, 0, tmp_entity.owner, wps_enemyflagcarrier, true, RADARICON_FLAG); wp.colormod = WPCOLOR_ENEMYFC(tmp_entity.owner.team); - tmp_entity.owner.wps_enemyflagcarrier.customizeentityforclient = ctf_Stalemate_Customize; + setcefc(tmp_entity.owner.wps_enemyflagcarrier, ctf_Stalemate_Customize); } } @@ -851,8 +851,8 @@ void ctf_FlagDamage(entity this, entity inflictor, entity attacker, float damage } } -void ctf_FlagThink() -{SELFPARAM(); +void ctf_FlagThink(entity this) +{ // declarations entity tmp_entity; @@ -943,10 +943,8 @@ void ctf_FlagThink() self.health = 0; ctf_CheckFlagReturn(self, RETURN_SPEEDRUN); - setself(self.owner); - self.impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set - ImpulseCommands(self); - setself(this); + self.owner.impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set + ImpulseCommands(self.owner); } if(autocvar_g_ctf_stalemate) { @@ -1188,9 +1186,6 @@ void ctf_DelayedFlagSetup(entity this) // called after a flag is placed on a map void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc { - // declarations - setself(flag); // for later usage with droptofloor() - // main setup flag.ctf_worldflagnext = ctf_worldflaglist; // link flag into ctf_worldflaglist ctf_worldflaglist = flag; @@ -1216,8 +1211,8 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e flag.velocity = '0 0 0'; flag.mangle = flag.angles; flag.reset = ctf_Reset; - flag.touch = ctf_FlagTouch; - flag.think = ctf_FlagThink; + settouch(flag, ctf_FlagTouch); + setthink(flag, ctf_FlagThink); flag.nextthink = time + FLAG_THINKRATE; flag.ctf_status = FLAG_BASE; @@ -1231,16 +1226,18 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e if (flag.capeffect == "") { flag.capeffect = EFFECT_CAP(teamnumber).eent_eff_name; } // sounds - flag.snd_flag_taken = strzone(SND(CTF_TAKEN(teamnumber))); - flag.snd_flag_returned = strzone(SND(CTF_RETURNED(teamnumber))); - flag.snd_flag_capture = strzone(SND(CTF_CAPTURE(teamnumber))); - flag.snd_flag_dropped = strzone(SND(CTF_DROPPED(teamnumber))); - if (flag.snd_flag_respawn == "") flag.snd_flag_respawn = strzone(SND(CTF_RESPAWN)); // if there is ever a team-based sound for this, update the code to match. - precache_sound(flag.snd_flag_respawn); - if (flag.snd_flag_touch == "") flag.snd_flag_touch = strzone(SND(CTF_TOUCH)); // again has no team-based sound - precache_sound(flag.snd_flag_touch); - if (flag.snd_flag_pass == "") flag.snd_flag_pass = strzone(SND(CTF_PASS)); // same story here - precache_sound(flag.snd_flag_pass); +#define X(s,b) \ + if(flag.s == "") flag.s = b; \ + precache_sound(flag.s); + + X(snd_flag_taken, strzone(SND(CTF_TAKEN(teamnumber)))) + X(snd_flag_returned, strzone(SND(CTF_RETURNED(teamnumber)))) + X(snd_flag_capture, strzone(SND(CTF_CAPTURE(teamnumber)))) + X(snd_flag_dropped, strzone(SND(CTF_DROPPED(teamnumber)))) + X(snd_flag_respawn, strzone(SND(CTF_RESPAWN))) + X(snd_flag_touch, strzone(SND(CTF_TOUCH))) + X(snd_flag_pass, strzone(SND(CTF_PASS))) +#undef X // precache precache_model(flag.model); @@ -1288,8 +1285,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e else // drop to floor, automatically find a platform and set that as spawn origin { flag.noalign = false; - setself(flag); - droptofloor(); + WITHSELF(flag, droptofloor()); flag.movetype = MOVETYPE_TOSS; } @@ -2419,9 +2415,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) @@ -2437,9 +2433,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) @@ -2455,9 +2451,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) @@ -2473,9 +2469,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) @@ -2491,10 +2487,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) @@ -2505,10 +2501,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