if ( !IS_OBSERVER(player) && autocvar_sv_minigames_observer )
{
- WITHSELF(player, PutObserverInServer());
+ PutObserverInServer(player);
}
if ( autocvar_sv_minigames_observer == 2 )
player.team_forced = -1;
bool superspec_Spectate(entity this, entity targ)
{
- if(Spectate(targ) == 1)
+ if(Spectate(this, targ) == 1)
TRANSMUTE(Spectator, this);
return true;
WITHSELF(this, PutClientInServer());
}
-void PutObserverInServer();
+void PutObserverInServer(entity this);
void ClientDisconnect();
STATIC_METHOD(Client, Remove, void(Client this))
void FixPlayermodel(entity player);
/** putting a client as observer in the server */
-void PutObserverInServer()
+void PutObserverInServer(entity this)
{
- SELFPARAM();
bool mutator_returnvalue = MUTATOR_CALLHOOK(MakePlayerObserver, this);
PlayerState_detach(this);
MUTATOR_CALLHOOK(PutClientInServer, this);
if (IS_OBSERVER(this)) {
- PutObserverInServer();
+ PutObserverInServer(this);
} else if (IS_PLAYER(this)) {
PlayerState_attach(this);
accuracy_resend(this);
{
if(blockSpectators)
Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
- WITHSELF(this, PutObserverInServer());
+ PutObserverInServer(this);
}
else
WITHSELF(this, SV_ChangeTeam(this.killindicator_teamchange - 1));
}
}
-bool SpectateUpdate()
-{SELFPARAM();
+bool SpectateUpdate(entity this)
+{
if(!this.enemy)
return false;
return true;
}
-bool SpectateSet()
-{SELFPARAM();
+bool SpectateSet(entity this)
+{
if(!IS_PLAYER(this.enemy))
return false;
this.movetype = MOVETYPE_NONE;
accuracy_resend(this);
- if(!SpectateUpdate())
- PutObserverInServer();
+ if(!SpectateUpdate(this))
+ PutObserverInServer(this);
return true;
}
-void SetSpectatee(entity player, entity spectatee)
+void SetSpectatee(entity this, entity spectatee)
{
- entity old_spectatee = player.enemy;
+ entity old_spectatee = this.enemy;
- player.enemy = spectatee;
+ this.enemy = spectatee;
// WEAPONTODO
// these are required to fix the spectator bug with arc
if(old_spectatee && old_spectatee.arc_beam) { old_spectatee.arc_beam.SendFlags |= ARC_SF_SETTINGS; }
- if(player.enemy && player.enemy.arc_beam) { player.enemy.arc_beam.SendFlags |= ARC_SF_SETTINGS; }
+ if(this.enemy && this.enemy.arc_beam) { this.enemy.arc_beam.SendFlags |= ARC_SF_SETTINGS; }
}
-bool Spectate(entity pl)
-{SELFPARAM();
+bool Spectate(entity this, entity pl)
+{
if(MUTATOR_CALLHOOK(SpectateSet, this, pl))
return false;
pl = M_ARGV(1, entity);
SetSpectatee(this, pl);
- return SpectateSet();
+ return SpectateSet(this);
}
-bool SpectateNext()
-{SELFPARAM();
+bool SpectateNext(entity this)
+{
other = find(this.enemy, classname, STR_PLAYER);
if (MUTATOR_CALLHOOK(SpectateNext, this, other))
if(other) { SetSpectatee(this, other); }
- return SpectateSet();
+ return SpectateSet(this);
}
-bool SpectatePrev()
-{SELFPARAM();
+bool SpectatePrev(entity this)
+{
// NOTE: chain order is from the highest to the lower entnum (unlike find)
other = findchain(classname, STR_PLAYER);
if (!other) // no player
}
SetSpectatee(this, other);
- return SpectateSet();
+ return SpectateSet(this);
}
/*
}
}
-void LeaveSpectatorMode()
-{SELFPARAM();
+void LeaveSpectatorMode(entity this)
+{
if(this.caplayer)
return;
if(nJoinAllowed(this, this))
Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN);
- PutClientInServer();
+ WITHSELF(this, PutClientInServer());
if(IS_PLAYER(this)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), this.netname); }
}
}
}
-void ObserverThink()
-{SELFPARAM();
+void ObserverThink(entity this)
+{
if ( this.impulse )
{
MinigameImpulse(this, this.impulse);
this.flags |= FL_SPAWNING;
} else if(PHYS_INPUT_BUTTON_ATCK(this) && !this.version_mismatch) {
this.flags &= ~FL_JUMPRELEASED;
- if(SpectateNext()) {
+ if(SpectateNext(this)) {
TRANSMUTE(Spectator, this);
}
} else {
if(this.flags & FL_SPAWNING)
{
this.flags &= ~FL_SPAWNING;
- LeaveSpectatorMode();
+ LeaveSpectatorMode(this);
return;
}
}
}
}
-void SpectatorThink()
-{SELFPARAM();
+void SpectatorThink(entity this)
+{
if ( this.impulse )
{
if(MinigameImpulse(this, this.impulse))
this.flags |= FL_SPAWNING;
} else if(PHYS_INPUT_BUTTON_ATCK(this) || this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209)) {
this.flags &= ~FL_JUMPRELEASED;
- if(SpectateNext()) {
+ if(SpectateNext(this)) {
TRANSMUTE(Spectator, this);
} else {
TRANSMUTE(Observer, this);
- PutClientInServer();
+ WITHSELF(this, PutClientInServer());
}
this.impulse = 0;
} else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19 || (this.impulse >= 220 && this.impulse <= 229)) {
this.flags &= ~FL_JUMPRELEASED;
- if(SpectatePrev()) {
+ if(SpectatePrev(this)) {
TRANSMUTE(Spectator, this);
} else {
TRANSMUTE(Observer, this);
- PutClientInServer();
+ WITHSELF(this, PutClientInServer());
}
this.impulse = 0;
} else if (PHYS_INPUT_BUTTON_ATCK2(this)) {
this.flags &= ~FL_JUMPRELEASED;
TRANSMUTE(Observer, this);
- PutClientInServer();
+ WITHSELF(this, PutClientInServer());
} else {
- if(!SpectateUpdate())
- PutObserverInServer();
+ if(!SpectateUpdate(this))
+ PutObserverInServer(this);
}
} else {
if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this))) {
if(this.flags & FL_SPAWNING)
{
this.flags &= ~FL_SPAWNING;
- LeaveSpectatorMode();
+ LeaveSpectatorMode(this);
return;
}
}
- if(!SpectateUpdate())
- PutObserverInServer();
+ if(!SpectateUpdate(this))
+ PutObserverInServer(this);
}
this.flags |= FL_CLIENT | FL_NOTARGET;
PrintWelcomeMessage(this);
if (IS_PLAYER(this)) {
- CheckRules_Player();
+ CheckRules_Player(this);
if (intermission_running) {
- IntermissionThink();
+ IntermissionThink(this);
return;
}
this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
}
else if (gameover) {
- if (intermission_running) IntermissionThink();
+ if (intermission_running) IntermissionThink(this);
return;
}
else if (IS_OBSERVER(this)) {
- ObserverThink();
+ ObserverThink(this);
}
else if (IS_SPEC(this)) {
- SpectatorThink();
+ SpectatorThink(this);
}
// WEAPONTODO: Add weapon request for this
if (IS_PLAYER(this)) {
DrownPlayer(this);
- CheckRules_Player();
+ CheckRules_Player(this);
UpdateChatBubble();
if (this.impulse) ImpulseCommands(this);
if (intermission_running) return; // intermission or finale
float CalcRotRegen(float current, float regenstable, float regenfactor, float regenlinear, float regenframetime, float rotstable, float rotfactor, float rotlinear, float rotframetime, float limit);
-float Spectate(entity pl);
+bool Spectate(entity this, entity pl);
#define SPECTATE_COPY() [[accumulate]] void SpectateCopy(entity this, entity spectatee)
#define SPECTATE_COPYFIELD(fld) SPECTATE_COPY() { this.(fld) = spectatee.(fld); }
#include <common/monsters/sv_monsters.qh>
-void PutObserverInServer();
+void PutObserverInServer(entity this);
// =====================================================
// Server side game commands code, reworked by Samual
int n = 0;
FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
if (it.caplayer) it.caplayer = 0;
- WITHSELF(it, PutObserverInServer());
+ PutObserverInServer(it);
++n;
));
if (n) bprint(strcat("Successfully forced all (", ftos(n), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n"));
if (!IS_SPEC(client) && !IS_OBSERVER(client))
{
if (client.caplayer) client.caplayer = 0;
- WITHSELF(client, PutObserverInServer());
+ PutObserverInServer(client);
successful = strcat(successful, (successful ? ", " : ""), client.netname);
}
============
*/
.float autoscreenshot;
-void IntermissionThink()
-{SELFPARAM();
- FixIntermissionClient(self);
+void IntermissionThink(entity this)
+{
+ FixIntermissionClient(this);
- float server_screenshot = (autocvar_sv_autoscreenshot && self.cvar_cl_autoscreenshot);
- float client_screenshot = (self.cvar_cl_autoscreenshot == 2);
+ float server_screenshot = (autocvar_sv_autoscreenshot && this.cvar_cl_autoscreenshot);
+ float client_screenshot = (this.cvar_cl_autoscreenshot == 2);
if( (server_screenshot || client_screenshot)
- && ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) )
+ && ((this.autoscreenshot > 0) && (time > this.autoscreenshot)) )
{
- self.autoscreenshot = -1;
- if(IS_REAL_CLIENT(self)) { stuffcmd(self, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"\n", GetMapname(), strftime(false, "%s"))); }
+ this.autoscreenshot = -1;
+ if(IS_REAL_CLIENT(this)) { stuffcmd(this, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"\n", GetMapname(), strftime(false, "%s"))); }
return;
}
return;
if(!mapvote_initialized)
- if (time < intermission_exittime + 10 && !(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_ATCK2(self) || PHYS_INPUT_BUTTON_HOOK(self) || PHYS_INPUT_BUTTON_USE(self)))
+ if (time < intermission_exittime + 10 && !(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this)))
return;
MapVote_Start();
Exit deathmatch games upon conditions
============
*/
-void CheckRules_Player()
-{SELFPARAM();
+void CheckRules_Player(entity this)
+{
if (gameover) // someone else quit the game already
return;
float WinningCondition_Scores(float limit, float leadlimit);
void SetWinners(.float field, float value);
-void CheckRules_Player();
-void IntermissionThink();
+void CheckRules_Player(entity this);
+void IntermissionThink(entity this);
void GotoNextMap(float reinit);
void ReadyRestart();
}
void objerror(string s)
-{SELFPARAM();
+{SELFPARAM(); // needed for engine functions
make_safe_for_remove(self);
builtin_objerror(s);
}
spawnfunc(team_CTF_blueplayer) { spawnfunc_info_player_team2(this); }
spawnfunc(team_CTF_bluespawn) { spawnfunc_info_player_team2(this); }
-void team_CTF_neutralflag() { SELFPARAM(); spawnfunc_item_flag_neutral(self); }
-void team_neutralobelisk() { SELFPARAM(); spawnfunc_item_flag_neutral(self); }
+spawnfunc(team_CTF_neutralflag) { spawnfunc_item_flag_neutral(this); }
+spawnfunc(team_neutralobelisk) { spawnfunc_item_flag_neutral(this); }
// ==============
e.dom_pps_pink = pps_pink;
}
-void dompoint_captured ()
-{SELFPARAM();
- entity head;
+void dompoint_captured(entity this)
+{
float old_delay, old_team, real_team;
// now that the delay has expired, switch to the latest team to lay claim to this point
- head = self.owner;
+ entity head = this.owner;
- real_team = self.cnt;
- self.cnt = -1;
+ real_team = this.cnt;
+ this.cnt = -1;
- dom_EventLog("taken", self.team, self.dmg_inflictor);
- self.dmg_inflictor = world;
+ dom_EventLog("taken", this.team, this.dmg_inflictor);
+ this.dmg_inflictor = world;
- self.goalentity = head;
- self.model = head.mdl;
- self.modelindex = head.dmg;
- self.skin = head.skin;
+ this.goalentity = head;
+ this.model = head.mdl;
+ this.modelindex = head.dmg;
+ this.skin = head.skin;
float points, wait_time;
if (autocvar_g_domination_point_amt)
points = autocvar_g_domination_point_amt;
else
- points = self.frags;
+ points = this.frags;
if (autocvar_g_domination_point_rate)
wait_time = autocvar_g_domination_point_rate;
else
- wait_time = self.wait;
+ wait_time = this.wait;
if(domination_roundbased)
- bprint(sprintf("^3%s^3%s\n", head.netname, self.message));
+ bprint(sprintf("^3%s^3%s\n", head.netname, this.message));
else
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_DOMINATION_CAPTURE_TIME, head.netname, self.message, points, wait_time);
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_DOMINATION_CAPTURE_TIME, head.netname, this.message, points, wait_time);
- if(self.enemy.playerid == self.enemy_playerid)
- PlayerScore_Add(self.enemy, SP_DOM_TAKES, 1);
+ if(this.enemy.playerid == this.enemy_playerid)
+ PlayerScore_Add(this.enemy, SP_DOM_TAKES, 1);
else
- self.enemy = world;
+ this.enemy = world;
if (head.noise != "")
- if(self.enemy)
- _sound(self.enemy, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM);
+ if(this.enemy)
+ _sound(this.enemy, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM);
else
- _sound(self, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM);
+ _sound(this, CH_TRIGGER, head.noise, VOL_BASE, ATTEN_NORM);
if (head.noise1 != "")
play2all(head.noise1);
- self.delay = time + wait_time;
+ this.delay = time + wait_time;
// do trigger work
- old_delay = self.delay;
- old_team = self.team;
- self.team = real_team;
- self.delay = 0;
- SUB_UseTargets (self, self, NULL);
- self.delay = old_delay;
- self.team = old_team;
+ old_delay = this.delay;
+ old_team = this.team;
+ this.team = real_team;
+ this.delay = 0;
+ SUB_UseTargets (this, this, NULL);
+ this.delay = old_delay;
+ this.team = old_team;
entity msg = WP_DomNeut;
- switch(self.team)
+ switch(this.team)
{
case NUM_TEAM_1: msg = WP_DomRed; break;
case NUM_TEAM_2: msg = WP_DomBlue; break;
case NUM_TEAM_4: msg = WP_DomPink; break;
}
- WaypointSprite_UpdateSprites(self.sprite, msg, WP_Null, WP_Null);
+ WaypointSprite_UpdateSprites(this.sprite, msg, WP_Null, WP_Null);
total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
for(head = world; (head = find(head, classname, "dom_controlpoint")) != world; )
total_pps += points/wait_time;
));
- WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_DOMPOINT, colormapPaletteColor(self.goalentity.team - 1, 0));
- WaypointSprite_Ping(self.sprite);
+ WaypointSprite_UpdateTeamRadar(this.sprite, RADARICON_DOMPOINT, colormapPaletteColor(this.goalentity.team - 1, 0));
+ WaypointSprite_Ping(this.sprite);
- self.captime = time;
+ this.captime = time;
FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(set_dom_state(it)));
}
-void AnimateDomPoint()
-{SELFPARAM();
- if(self.pain_finished > time)
+void AnimateDomPoint(entity this)
+{
+ if(this.pain_finished > time)
return;
- self.pain_finished = time + self.t_width;
- if(self.nextthink > self.pain_finished)
- self.nextthink = self.pain_finished;
+ this.pain_finished = time + this.t_width;
+ if(this.nextthink > this.pain_finished)
+ this.nextthink = this.pain_finished;
- self.frame = self.frame + 1;
- if(self.frame > self.t_length)
- self.frame = 0;
+ this.frame = this.frame + 1;
+ if(this.frame > this.t_length)
+ this.frame = 0;
}
void dompointthink(entity this)
{
float fragamt;
- self.nextthink = time + 0.1;
+ this.nextthink = time + 0.1;
- //self.frame = self.frame + 1;
- //if(self.frame > 119)
- // self.frame = 0;
- AnimateDomPoint();
+ //this.frame = this.frame + 1;
+ //if(this.frame > 119)
+ // this.frame = 0;
+ AnimateDomPoint(this);
// give points
- if (gameover || self.delay > time || time < game_starttime) // game has ended, don't keep giving points
+ if (gameover || this.delay > time || time < game_starttime) // game has ended, don't keep giving points
return;
if(autocvar_g_domination_point_rate)
- self.delay = time + autocvar_g_domination_point_rate;
+ this.delay = time + autocvar_g_domination_point_rate;
else
- self.delay = time + self.wait;
+ this.delay = time + this.wait;
// give credit to the team
// NOTE: this defaults to 0
if (!domination_roundbased)
- if (self.goalentity.netname != "")
+ if (this.goalentity.netname != "")
{
if(autocvar_g_domination_point_amt)
fragamt = autocvar_g_domination_point_amt;
else
- fragamt = self.frags;
- TeamScore_AddToTeam(self.goalentity.team, ST_SCORE, fragamt);
- TeamScore_AddToTeam(self.goalentity.team, ST_DOM_TICKS, fragamt);
+ fragamt = this.frags;
+ TeamScore_AddToTeam(this.goalentity.team, ST_SCORE, fragamt);
+ TeamScore_AddToTeam(this.goalentity.team, ST_DOM_TICKS, fragamt);
// give credit to the individual player, if he is still there
- if (self.enemy.playerid == self.enemy_playerid)
+ if (this.enemy.playerid == this.enemy_playerid)
{
- PlayerScore_Add(self.enemy, SP_SCORE, fragamt);
- PlayerScore_Add(self.enemy, SP_DOM_TICKS, fragamt);
+ PlayerScore_Add(this.enemy, SP_SCORE, fragamt);
+ PlayerScore_Add(this.enemy, SP_DOM_TICKS, fragamt);
}
else
- self.enemy = world;
+ this.enemy = world;
}
}
void dompointtouch(entity this)
{
- entity head;
if (!IS_PLAYER(other))
return;
if (other.health < 1)
if(round_handler_IsActive() && !round_handler_IsRoundStarted())
return;
- if(time < self.captime + 0.3)
+ if(time < this.captime + 0.3)
return;
// only valid teams can claim it
- head = find(world, classname, "dom_team");
+ entity head = find(world, classname, "dom_team");
while (head && head.team != other.team)
head = find(head, classname, "dom_team");
- if (!head || head.netname == "" || head == self.goalentity)
+ if (!head || head.netname == "" || head == this.goalentity)
return;
// delay capture
- self.team = self.goalentity.team; // this stores the PREVIOUS team!
+ this.team = this.goalentity.team; // this stores the PREVIOUS team!
- self.cnt = other.team;
- self.owner = head; // team to switch to after the delay
- self.dmg_inflictor = other;
+ this.cnt = other.team;
+ this.owner = head; // team to switch to after the delay
+ this.dmg_inflictor = other;
- // self.state = 1;
- // self.delay = time + cvar("g_domination_point_capturetime");
- //self.nextthink = time + cvar("g_domination_point_capturetime");
- //self.think = dompoint_captured;
+ // this.state = 1;
+ // this.delay = time + cvar("g_domination_point_capturetime");
+ //this.nextthink = time + cvar("g_domination_point_capturetime");
+ //this.think = dompoint_captured;
// go to neutral team in the mean time
head = find(world, classname, "dom_team");
if(head == world)
return;
- WaypointSprite_UpdateSprites(self.sprite, WP_DomNeut, WP_Null, WP_Null);
- WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_DOMPOINT, '0 1 1');
- WaypointSprite_Ping(self.sprite);
+ WaypointSprite_UpdateSprites(this.sprite, WP_DomNeut, WP_Null, WP_Null);
+ WaypointSprite_UpdateTeamRadar(this.sprite, RADARICON_DOMPOINT, '0 1 1');
+ WaypointSprite_Ping(this.sprite);
- self.goalentity = head;
- self.model = head.mdl;
- self.modelindex = head.dmg;
- self.skin = head.skin;
+ this.goalentity = head;
+ this.model = head.mdl;
+ this.modelindex = head.dmg;
+ this.skin = head.skin;
- self.enemy = other; // individual player scoring
- self.enemy_playerid = other.playerid;
- dompoint_captured();
+ this.enemy = other; // individual player scoring
+ this.enemy_playerid = other.playerid;
+ dompoint_captured(this);
}
void dom_controlpoint_setup(entity this)
objerror("no spawnfunc_dom_team with netname \"\" found\n");
// copy important properties from spawnfunc_dom_team entity
- self.goalentity = head;
- _setmodel(self, head.mdl); // precision already set
- self.skin = head.skin;
+ this.goalentity = head;
+ _setmodel(this, head.mdl); // precision already set
+ this.skin = head.skin;
- self.cnt = -1;
+ this.cnt = -1;
- if(self.message == "")
- self.message = " has captured a control point";
+ if(this.message == "")
+ this.message = " has captured a control point";
- if(self.frags <= 0)
- self.frags = 1;
- if(self.wait <= 0)
- self.wait = 5;
+ if(this.frags <= 0)
+ this.frags = 1;
+ if(this.wait <= 0)
+ this.wait = 5;
float points, waittime;
if (autocvar_g_domination_point_amt)
points = autocvar_g_domination_point_amt;
else
- points = self.frags;
+ points = this.frags;
if (autocvar_g_domination_point_rate)
waittime = autocvar_g_domination_point_rate;
else
- waittime = self.wait;
+ waittime = this.wait;
total_pps += points/waittime;
- if(!self.t_width)
- self.t_width = 0.02; // frame animation rate
- if(!self.t_length)
- self.t_length = 239; // maximum frame
-
- setthink(self, dompointthink);
- self.nextthink = time;
- settouch(self, dompointtouch);
- self.solid = SOLID_TRIGGER;
- self.flags = FL_ITEM;
- setsize(self, '-32 -32 -32', '32 32 32');
- setorigin(self, self.origin + '0 0 20');
- droptofloor(self);
-
- waypoint_spawnforitem(self);
- WaypointSprite_SpawnFixed(WP_DomNeut, self.origin + '0 0 32', self, sprite, RADARICON_DOMPOINT);
+ if(!this.t_width)
+ this.t_width = 0.02; // frame animation rate
+ if(!this.t_length)
+ this.t_length = 239; // maximum frame
+
+ setthink(this, dompointthink);
+ this.nextthink = time;
+ settouch(this, dompointtouch);
+ this.solid = SOLID_TRIGGER;
+ this.flags = FL_ITEM;
+ setsize(this, '-32 -32 -32', '32 32 32');
+ setorigin(this, this.origin + '0 0 20');
+ droptofloor(this);
+
+ waypoint_spawnforitem(this);
+ WaypointSprite_SpawnFixed(WP_DomNeut, this.origin + '0 0 32', this, sprite, RADARICON_DOMPOINT);
}
float total_controlpoints;
return 1;
}
-entity freezetag_LastPlayerForTeam()
-{SELFPARAM();
+entity freezetag_LastPlayerForTeam(entity this)
+{
entity last_pl = world;
- FOREACH_CLIENT(IS_PLAYER(it) && it != self, LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, LAMBDA(
if(it.health >= 1)
if(!STAT(FROZEN, it))
- if(SAME_TEAM(it, self))
+ if(SAME_TEAM(it, this))
if(!last_pl)
last_pl = it;
else
return last_pl;
}
-void freezetag_LastPlayerForTeam_Notify()
+void freezetag_LastPlayerForTeam_Notify(entity this)
{
if(round_handler_IsActive())
if(round_handler_IsRoundStarted())
{
- entity pl = freezetag_LastPlayerForTeam();
+ entity pl = freezetag_LastPlayerForTeam(this);
if(pl)
Send_Notification(NOTIF_ONE, pl, MSG_CENTER, CENTER_ALONE);
}
}
-void freezetag_Add_Score(entity attacker)
-{SELFPARAM();
- if(attacker == self)
+void freezetag_Add_Score(entity targ, entity attacker)
+{
+ if(attacker == targ)
{
- // you froze your own dumb self
+ // you froze your own dumb targ
// counted as "suicide" already
- PlayerScore_Add(self, SP_SCORE, -1);
+ PlayerScore_Add(targ, SP_SCORE, -1);
}
else if(IS_PLAYER(attacker))
{
// got frozen by an enemy
// counted as "kill" and "death" already
- PlayerScore_Add(self, SP_SCORE, -1);
+ PlayerScore_Add(targ, SP_SCORE, -1);
PlayerScore_Add(attacker, SP_SCORE, +1);
}
// else nothing - got frozen by the game type rules themselves
}
-void freezetag_Freeze(entity attacker)
-{SELFPARAM();
- if(STAT(FROZEN, self))
+void freezetag_Freeze(entity targ, entity attacker)
+{
+ if(STAT(FROZEN, targ))
return;
if(autocvar_g_freezetag_frozen_maxtime > 0)
- self.freezetag_frozen_timeout = time + autocvar_g_freezetag_frozen_maxtime;
+ targ.freezetag_frozen_timeout = time + autocvar_g_freezetag_frozen_maxtime;
- Freeze(self, 0, 1, true);
+ Freeze(targ, 0, 1, true);
freezetag_count_alive_players();
- freezetag_Add_Score(attacker);
+ freezetag_Add_Score(targ, attacker);
}
-void freezetag_Unfreeze(entity attacker)
-{SELFPARAM();
- self.freezetag_frozen_time = 0;
- self.freezetag_frozen_timeout = 0;
+void freezetag_Unfreeze(entity this)
+{
+ this.freezetag_frozen_time = 0;
+ this.freezetag_frozen_timeout = 0;
- Unfreeze(self);
+ Unfreeze(this);
}
float freezetag_isEliminated(entity e)
{
this.health = 0; // neccessary to update correctly alive stats
if(!STAT(FROZEN, this))
- freezetag_LastPlayerForTeam_Notify();
- WITHSELF(this, freezetag_Unfreeze(world));
+ freezetag_LastPlayerForTeam_Notify(this);
+ freezetag_Unfreeze(this);
freezetag_count_alive_players();
}
if(round_handler_CountdownRunning())
{
if(STAT(FROZEN, frag_target))
- WITHSELF(frag_target, freezetag_Unfreeze(world));
+ freezetag_Unfreeze(frag_target);
freezetag_count_alive_players();
return 1; // let the player die so that he can respawn whenever he wants
}
// let the player die, he will be automatically frozen when he respawns
if(STAT(FROZEN, frag_target) != 1)
{
- freezetag_Add_Score(frag_attacker);
+ freezetag_Add_Score(frag_target, frag_attacker);
freezetag_count_alive_players();
- freezetag_LastPlayerForTeam_Notify();
+ freezetag_LastPlayerForTeam_Notify(frag_target);
}
else
- WITHSELF(frag_target, freezetag_Unfreeze(world)); // remove ice
+ freezetag_Unfreeze(frag_target); // remove ice
frag_target.health = 0; // Unfreeze resets health
frag_target.freezetag_frozen_timeout = -2; // freeze on respawn
return 1;
if(STAT(FROZEN, frag_target))
return 1;
- WITHSELF(frag_target, freezetag_Freeze(frag_attacker));
- freezetag_LastPlayerForTeam_Notify();
+ freezetag_Freeze(frag_target, frag_attacker);
+ freezetag_LastPlayerForTeam_Notify(frag_target);
if(frag_attacker == frag_target || frag_attacker == world)
{
if(player.freezetag_frozen_timeout == -2) // player was dead
{
- WITHSELF(player, freezetag_Freeze(world));
+ freezetag_Freeze(player, world);
return 1;
}
if(round_handler_IsRoundStarted())
{
Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_SPAWN_LATE);
- WITHSELF(player, freezetag_Freeze(world));
+ freezetag_Freeze(player, world);
}
return 1;
.string cvarfilter;
bool DoesQ3ARemoveThisEntity(entity this);
void SV_OnEntityPreSpawnFunction()
-{SELFPARAM();
+{SELFPARAM(); // needed for engine functions
__spawnfunc_expect = this;
if (this)
if (this.gametypefilter != "")
//void() ctf_playerchanged;
void SV_ChangeTeam(float _color)
-{SELFPARAM();
+{SELFPARAM(); // needed for engine functions
float scolor, dcolor, steam, dteam; //, dbotcount, scount, dcount;
// in normal deathmatch we can just apply the color and we're done