]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Replace all player/bot/spectator classname checks with macros
authorMario <mario.mario@y7mail.com>
Mon, 25 Feb 2013 19:00:49 +0000 (06:00 +1100)
committerMario <mario.mario@y7mail.com>
Mon, 25 Feb 2013 19:00:49 +0000 (06:00 +1100)
64 files changed:
qcsrc/csqcmodellib/sv_model.qc
qcsrc/server/accuracy.qc
qcsrc/server/arena.qc
qcsrc/server/assault.qc
qcsrc/server/bot/aim.qc
qcsrc/server/bot/bot.qc
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/bot/havocbot/roles.qc
qcsrc/server/bot/navigation.qc
qcsrc/server/bot/scripting.qc
qcsrc/server/campaign.qc
qcsrc/server/cheats.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/cl_player.qc
qcsrc/server/cl_weaponsystem.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/common.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/ent_cs.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_subs.qc
qcsrc/server/g_triggers.qc
qcsrc/server/g_world.qc
qcsrc/server/item_key.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_domination.qc
qcsrc/server/mutators/gamemode_freezetag.qc
qcsrc/server/mutators/gamemode_keepaway.qc
qcsrc/server/mutators/gamemode_keyhunt.qc
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/mutators/gamemode_onslaught.qc
qcsrc/server/mutators/mutator_nix.qc
qcsrc/server/mutators/mutator_superspec.qc
qcsrc/server/playerstats.qc
qcsrc/server/portals.qc
qcsrc/server/race.qc
qcsrc/server/runematch.qc
qcsrc/server/scores.qc
qcsrc/server/secret.qc
qcsrc/server/sv_main.qc
qcsrc/server/t_items.qc
qcsrc/server/t_jumppads.qc
qcsrc/server/t_plats.qc
qcsrc/server/t_swamp.qc
qcsrc/server/t_teleporters.qc
qcsrc/server/teamplay.qc
qcsrc/server/tturrets/system/system_damage.qc
qcsrc/server/tturrets/system/system_main.qc
qcsrc/server/tturrets/system/system_scoreprocs.qc
qcsrc/server/tturrets/units/unit_hk.qc
qcsrc/server/vehicles/bumblebee.qc
qcsrc/server/vehicles/vehicles.qc
qcsrc/server/w_common.qc
qcsrc/server/w_electro.qc
qcsrc/server/w_fireball.qc
qcsrc/server/w_grenadelauncher.qc
qcsrc/server/w_minelayer.qc
qcsrc/server/w_rocketlauncher.qc
qcsrc/server/w_shotgun.qc
qcsrc/server/waypointsprites.qc
qcsrc/warpzonelib/server.qc

index e6e4cfe43a091e3f2fd1a5efa615a8e2d6132e66..60c135cb9e1cff14bb51c9d3d376c453b8e4c859 100644 (file)
@@ -25,7 +25,7 @@
 float CSQCModel_Send(entity to, float sf)
 {
        // some nice flags for CSQCMODEL_IF
-       float isplayer = (self.flags & FL_CLIENT);
+       float isplayer = (IS_CLIENT(self));
        float islocalplayer = (self == to);
        float isnolocalplayer = (isplayer && (self != to));
 
@@ -59,7 +59,7 @@ float CSQCModel_Send(entity to, float sf)
 void CSQCModel_CheckUpdate()
 {
        // some nice flags for CSQCMODEL_IF
-       float isplayer = (self.flags & FL_CLIENT);
+       float isplayer = (IS_CLIENT(self));
        float islocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
        float isnolocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
 
index 9271e03d0ad20ef4b7e8e9a6536d68b723b40348..3c737f6e6cec277f4e8d225f6ccefcc0004a271d 100644 (file)
@@ -20,7 +20,7 @@ float accuracy_send(entity to, float sf)
        WriteByte(MSG_ENTITY, ENT_CLIENT_ACCURACY);
 
        a = self.owner;
-       if(a.classname == "spectator")
+       if(IS_SPEC(a))
                a = a.enemy;
        a = a.accuracy;
 
@@ -102,7 +102,7 @@ void accuracy_add(entity e, float w, float fired, float hit)
        w = pow(2, mod(w, 24));
        a.SendFlags |= w;
        FOR_EACH_CLIENT(a)
-               if(a.classname == "spectator")
+               if(IS_SPEC(a))
                        if(a.enemy == e)
                                a.SendFlags |= w;
 }
@@ -110,7 +110,7 @@ void accuracy_add(entity e, float w, float fired, float hit)
 float accuracy_isgooddamage(entity attacker, entity targ)
 {
        if(!inWarmupStage)
-       if(targ.flags & FL_CLIENT)
+       if(IS_CLIENT(targ))
        if(targ.deadflag == DEAD_NO)
        if(IsDifferentTeam(attacker, targ))
                return TRUE;
index ef81fd92bad7db138edb2fa1e1067d252bae875b..b3f28843a977e105ddf648302b636990b1637110 100644 (file)
@@ -47,7 +47,7 @@ void reset_map(float dorespawn)
        race_ReadyRestart();
 
        for(self = world; (self = nextent(self)); )
-       if(clienttype(self) == CLIENTTYPE_NOTACLIENT)
+       if(IS_NOT_A_CLIENT(self))
        {
                if(self.reset)
                {
@@ -64,7 +64,7 @@ void reset_map(float dorespawn)
 
        // Waypoints and assault start come LAST
        for(self = world; (self = nextent(self)); )
-       if(clienttype(self) == CLIENTTYPE_NOTACLIENT)
+       if(IS_NOT_A_CLIENT(self))
        {
                if(self.reset2)
                {
@@ -77,7 +77,7 @@ void reset_map(float dorespawn)
        // on spawnpoint entities which have to be reset first --blub
        if(dorespawn)
        FOR_EACH_CLIENT(self) {
-               if(self.flags & FL_CLIENT)                              // reset all players
+               if(IS_CLIENT(self))                             // reset all players
                {
                        if(g_arena)
                        {
@@ -92,7 +92,7 @@ void reset_map(float dorespawn)
                        }
                        else if(g_freezetag)
                        {
-                               if(self.classname == "player")
+                               if(IS_PLAYER(self))
                                        PutClientInServer();
                        }
                        else
@@ -106,7 +106,7 @@ void reset_map(float dorespawn)
                                if (restart_mapalreadyrestarted || (time < game_starttime))
                                {
                                        //NEW: changed behaviour so that it prevents that previous spectators/observers suddenly spawn as players
-                                       if (self.classname == "player") {
+                                       if (IS_PLAYER(self)) {
                                                //PlayerScore_Clear(self);
                                                if(g_lms)
                                                        PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives());
@@ -126,7 +126,7 @@ void reset_map(float dorespawn)
                kh_Controller_SetThink_NoMsg(autocvar_g_balance_keyhunt_delay_round+(game_starttime - time), kh_StartRound);
 
        if(g_arena)
-       if(champion && champion.classname == "player" && player_count > 1)
+       if(champion && IS_PLAYER(champion) && player_count > 1)
                UpdateFrags(champion, +1);
 
        self = oldself;
@@ -255,7 +255,7 @@ void Arena_Warmup()
                if (g_arena) {
                        FOR_EACH_CLIENT(e)
                        {
-                               if(e.spawned && e.classname == "player")
+                               if(e.spawned && IS_PLAYER(e))
                                        e.player_blocked = 1;
                        }
                }
index 2562dca3df803fa93725204eb01f7059ef1cd189..fe5fb5ef04da10914e70498abc5d8027e792ba93 100644 (file)
@@ -361,7 +361,7 @@ void assault_new_round()
        entity ent;
        for(ent = world; (ent = nextent(ent)); )
        {
-               if(clienttype(ent) == CLIENTTYPE_NOTACLIENT)
+               if(IS_NOT_A_CLIENT(ent))
                {
                        if(ent.team_saved == COLOR_TEAM1)
                                ent.team_saved = COLOR_TEAM2;
index 3bff21ecf00a4801bd083ba12315087312f28931..c381893b7870b3a9ce2d39a45518c084c143f996 100644 (file)
@@ -127,7 +127,7 @@ float bot_shouldattack(entity e)
                        return FALSE;
        }
        else if(bot_ignore_bots)
-               if(clienttype(e) == CLIENTTYPE_BOT)
+               if(IS_BOT_CLIENT(e))
                        return FALSE;
 
        if (!e.takedamage)
index 45107b833a1b16221b8082da7c55c143d7b9244b..ee4933cc464ef8f2ddcaf4fbd62c291a92999584 100644 (file)
@@ -148,7 +148,7 @@ void bot_setnameandstuff()
                        prio = 1;
                        FOR_EACH_CLIENT(p)
                        {
-                               if(clienttype(p) == CLIENTTYPE_BOT)
+                               if(IS_BOT_CLIENT(p))
                                if(s == p.cleanname)
                                {
                                        prio = 0;
@@ -218,7 +218,7 @@ void bot_setnameandstuff()
        i = 0;
        FOR_EACH_CLIENT(p)
        {
-               if(clienttype(p) == CLIENTTYPE_BOT)
+               if(IS_BOT_CLIENT(p))
                        if(p.cleanname == name)
                                ++i;
        }
@@ -342,7 +342,7 @@ void bot_relinkplayerlist()
        {
                player_count = player_count + 1;
                e.nextplayer = e.chain;
-               if (clienttype(e) == CLIENTTYPE_BOT)
+               if (IS_BOT_CLIENT(e))
                {
                        if (prevbot)
                                prevbot.nextbot = e;
@@ -363,7 +363,7 @@ void bot_relinkplayerlist()
 
 void bot_clientdisconnect()
 {
-       if (clienttype(self) != CLIENTTYPE_BOT)
+       if not(IS_BOT_CLIENT(self))
                return;
        bot_clearqueue(self);
        if(self.cleanname)
@@ -386,7 +386,7 @@ void bot_clientdisconnect()
 
 void bot_clientconnect()
 {
-       if (clienttype(self) != CLIENTTYPE_BOT)
+       if not(IS_BOT_CLIENT(self))
                return;
        self.bot_preferredcolors = self.clientcolors;
        self.bot_nextthink = time - random();
@@ -491,7 +491,7 @@ void autoskill(float factor)
        bestplayer = -1;
        FOR_EACH_PLAYER(head)
        {
-               if(clienttype(head) == CLIENTTYPE_REAL)
+               if(IS_REAL_CLIENT(head))
                        bestplayer = max(bestplayer, head.totalfrags - head.totalfrags_lastcheck);
                else
                        bestbot = max(bestbot, head.totalfrags - head.totalfrags_lastcheck);
@@ -551,7 +551,7 @@ float bot_fixcount()
 
        FOR_EACH_REALCLIENT(head)
        {
-               if(head.classname == "player" || g_lms || g_arena || g_ca)
+               if(IS_PLAYER(head) || g_lms || g_arena || g_ca)
                        ++activerealplayers;
                ++realplayers;
        }
index 1b9178b1774b7632c2359463a9fd777833771326..e05d1aa1b312b79ac32100a4c696181888ca88ef 100644 (file)
@@ -107,7 +107,7 @@ void havocbot_ai()
                }
                else
                {
-                       if(self.bot_aimtarg.classname=="player")
+                       if(IS_PLAYER(self.bot_aimtarg))
                                bot_aimdir(self.bot_aimtarg.origin + self.bot_aimtarg.view_ofs - self.origin - self.view_ofs , -1);
                }
        }
@@ -261,7 +261,7 @@ void havocbot_bunnyhop(vector dir)
        if(self.aistatus & AI_STATUS_ATTACKING)
                return;
 
-       if(self.goalcurrent.classname == "player")
+       if(IS_PLAYER(self.goalcurrent))
                return;
 
        maxspeed = autocvar_sv_maxspeed;
@@ -541,7 +541,7 @@ void havocbot_movetogoal()
                        }
 
                        // Don't chase players while using a jump pad
-                       if(self.goalcurrent.classname=="player" || self.goalstack01.classname=="player")
+                       if(IS_PLAYER(self.goalcurrent) || IS_PLAYER(self.goalstack01))
                                return;
                }
        }
@@ -806,7 +806,7 @@ void havocbot_movetogoal()
                dodge = dodge * bound(0,0.5+(skill+self.bot_dodgeskill)*0.1,1);
                evadelava = evadelava * bound(1,3-(skill+self.bot_dodgeskill),3); //Noobs fear lava a lot and take more distance from it
                traceline(self.origin, ( ( self.enemy.absmin + self.enemy.absmax ) * 0.5 ), TRUE, world);
-               if(trace_ent.classname == "player")
+               if(IS_PLAYER(trace_ent))
                        dir = dir * bound(0,(skill+self.bot_dodgeskill)/7,1);
 
                dir = normalize(dir + dodge + evadeobstacle + evadelava);
index a3078c4e43588bc64bbbeef1c2a09e490a4af928..5deb8af9fdefb664d6428a0755e980754a3a7181 100644 (file)
@@ -69,7 +69,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
 
                                if ( player.team == self.team )
                                {
-                                       if ( clienttype(player) != CLIENTTYPE_REAL || discard )
+                                       if ( !IS_REAL_CLIENT(player) || discard )
                                                continue;
 
                                        if( d > friend_distance)
index a5c60e3935bca171b1e16e30971d2b34997141cd..4663d8d9c404c0e55ea191975500890c06860a46 100644 (file)
@@ -923,7 +923,7 @@ void navigation_poptouchedgoals()
 
        // HACK: remove players/bots as goals, they can lead a bot to unexpected places (cliffs, lava, etc)
        // TODO: rate waypoints near the targetted player at that moment, instead of the player itself
-       if(self.goalcurrent.classname=="player")
+       if(IS_PLAYER(self.goalcurrent))
                navigation_poproute();
 
        // aid for detecting jump pads better (distance based check fails sometimes)
@@ -1141,7 +1141,7 @@ void debugresetnodes()
 
 void debugnode(vector node)
 {
-       if not(self.classname=="player")
+       if not(IS_PLAYER(self))
                return;
 
        if(debuglastnode=='0 0 0')
index ace11c6d696a52a046fee386f4a44fca4563091f..21e1b728f6b0d553c9588fb93a104e7809f9356f 100644 (file)
@@ -286,7 +286,7 @@ entity find_bot_by_name(string name)
        bot = findchainflags(flags, FL_CLIENT);
        while (bot)
        {
-               if(clienttype(bot) == CLIENTTYPE_BOT)
+               if(IS_BOT_CLIENT(bot))
                if(bot.netname==name)
                        return bot;
 
@@ -308,7 +308,7 @@ entity find_bot_by_number(float number)
        bot = findchainflags(flags, FL_CLIENT);
        while (bot)
        {
-               if(clienttype(bot) == CLIENTTYPE_BOT)
+               if(IS_BOT_CLIENT(bot))
                {
                        if(++c==number)
                                return bot;
index b69e0fbe097479687200957a1f8bef54fda96c89..9beb6e1f04c04a7df695f849e276b67b1bde3c3f 100644 (file)
@@ -188,7 +188,7 @@ void CampaignPreIntermission()
        head = findchain(classname, "player");
        while(head)
        {
-               if(clienttype(head) == CLIENTTYPE_REAL)
+               if(IS_REAL_CLIENT(head))
                {
                        if(head.winning)
                                won = won + 1;
index 746a22d8940c622f1ffbb7e51060b082886d3c89..017999d761becfb892d56dc535ff8f2c43a9a148 100644 (file)
@@ -48,7 +48,7 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a
        // dead people cannot cheat
        if(self.deadflag != DEAD_NO)
                return 0;
-       if(gamestart_sv_cheats < 2 && self.classname != "player")
+       if(gamestart_sv_cheats < 2 && !IS_PLAYER(self))
                return 0;
        
        // sv_clones
@@ -943,9 +943,9 @@ float Drag_IsDraggable(entity draggee)
                return FALSE;
 //     if(draggee.model == "")
 //             return FALSE;
-       if(draggee.classname == "spectator")
+       if(IS_SPEC(draggee))
                return FALSE;
-       if(draggee.classname == "observer")
+       if(IS_OBSERVER(draggee))
                return FALSE;
        if(draggee.classname == "exteriorweaponentity")
                return FALSE;
@@ -1011,7 +1011,7 @@ void Drag_Update(entity dragger)
 
 float Drag_CanDrag(entity dragger)
 {
-       return (dragger.deadflag == DEAD_NO) || (dragger.classname == "player");
+       return (dragger.deadflag == DEAD_NO) || (IS_PLAYER(dragger));
 }
 
 float Drag_IsDragging(entity dragger)
index be5138c92d41af91bc93571431ac9f6df2757582..c8b64a175f95a88e136f1a6cc3a98a3a10180022 100644 (file)
@@ -13,7 +13,7 @@ void Announce(string snd) {
 }
 
 void AnnounceTo(entity e, string snd) {
-       if (clienttype(e) == CLIENTTYPE_REAL)
+       if (IS_REAL_CLIENT(e))
        {
                msg_entity = e;
                WriteByte(MSG_ONE, SVC_TEMPENTITY);
@@ -33,7 +33,7 @@ float ClientData_Send(entity to, float sf)
        entity e;
 
        e = to;
-       if(to.classname == "spectator")
+       if(IS_SPEC(to))
                e = to.enemy;
 
        sf = 0;
@@ -84,7 +84,7 @@ void ClientData_Touch(entity e)
        FOR_EACH_REALCLIENT(e2)
        {
                if(e2 != e)
-                       if(e2.classname == "spectator")
+                       if(IS_SPEC(e2))
                                if(e2.enemy == e)
                                        e2.clientdata.SendFlags = 1;
        }
@@ -140,7 +140,7 @@ vector Spawn_Score(entity spot, float mindist, float teamcheck)
                if(spot.target == "")
                        return '-1 0 0';
 
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
        {
                if(spot.restriction == 1)
                        return '-1 0 0';
@@ -394,7 +394,7 @@ void PutObserverInServer (void)
                error("No spawnpoints for observers?!?\n");
        RemoveGrapplingHook(self); // Wazat's Grappling Hook
 
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
        {
                msg_entity = self;
                WriteByte(MSG_ONE, SVC_SETVIEW);
@@ -655,13 +655,13 @@ Called when a client spawns in the server
 
 void PutClientInServer (void)
 {
-       if(clienttype(self) == CLIENTTYPE_BOT)
+       if(IS_BOT_CLIENT(self))
        {
                self.classname = "player";
                if(g_ca)
                        self.caplayer = 1;
        }
-       else if(clienttype(self) == CLIENTTYPE_REAL)
+       else if(IS_REAL_CLIENT(self))
        {
                msg_entity = self;
                WriteByte(MSG_ONE, SVC_SETVIEW);
@@ -685,7 +685,7 @@ void PutClientInServer (void)
        if(gameover)
                self.classname = "observer";
 
-       if(self.classname == "player" && (!g_ca || (g_ca && allowed_to_spawn))) {
+       if(IS_PLAYER(self) && (!g_ca || (g_ca && allowed_to_spawn))) {
                entity spot, oldself;
                float j;
 
@@ -715,7 +715,7 @@ void PutClientInServer (void)
                self.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
                if(autocvar_g_playerclip_collisions)
                        self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
-               if(clienttype(self) == CLIENTTYPE_BOT && autocvar_g_botclip_collisions)
+               if(IS_BOT_CLIENT(self) && autocvar_g_botclip_collisions)
                        self.dphitcontentsmask |= DPCONTENTS_BOTCLIP;
                self.frags = FRAGS_PLAYER;
                if(INDEPENDENT_PLAYERS)
@@ -934,7 +934,7 @@ void PutClientInServer (void)
 
                if (autocvar_g_spawnsound)
                        soundat(world, self.origin, CH_TRIGGER, "misc/spawn.wav", VOL_BASE, ATTN_NORM);
-       } else if(self.classname == "observer") {
+       } else if(IS_OBSERVER(self)) {
                PutObserverInServer ();
        }
 }
@@ -1149,7 +1149,7 @@ void KillIndicator_Think()
        {
                if(self.cnt <= 10)
                        setmodel(self, strcat("models/sprites/", ftos(self.cnt), ".spr32"));
-               if(clienttype(self.owner) == CLIENTTYPE_REAL)
+               if(IS_REAL_CLIENT(self.owner))
                {
                        if(self.cnt <= 10)
                                AnnounceTo(self.owner, strcat(ftos(self.cnt), ""));
@@ -1193,7 +1193,7 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
                        self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
                }
 
-               if(killtime <= 0 || self.classname != "player" || self.deadflag != DEAD_NO)
+               if(killtime <= 0 || !IS_PLAYER(self) || self.deadflag != DEAD_NO)
                {
                        ClientKill_Now();
                }
@@ -1235,28 +1235,28 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2
                if(targetteam == 0) // just die
                {
                        self.killindicator.colormod = '0 0 0';
-                       if(clienttype(self) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(self))
                        if(self.killindicator.cnt > 0)
                                Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, "^1Suicide in %d seconds", 1, self.killindicator.cnt);
                }
                else if(targetteam == -1) // auto
                {
                        self.killindicator.colormod = '0 1 0';
-                       if(clienttype(self) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(self))
                        if(self.killindicator.cnt > 0)
                                Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, "Changing team in %d seconds", 1, self.killindicator.cnt);
                }
                else if(targetteam == -2) // spectate
                {
                        self.killindicator.colormod = '0.5 0.5 0.5';
-                       if(clienttype(self) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(self))
                        if(self.killindicator.cnt > 0)
                                Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, "Spectating in %d seconds", 1, self.killindicator.cnt);
                }
                else
                {
                        self.killindicator.colormod = TeamColor(targetteam);
-                       if(clienttype(self) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(self))
                        if(self.killindicator.cnt > 0)
                                Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, strcat("Changing to ", ColoredTeamName(targetteam), " in %d seconds"), 1, self.killindicator.cnt);
                }
@@ -1269,7 +1269,7 @@ void ClientKill (void)
        if (gameover)
                return;
 
-       if((g_arena || g_ca) && ((champion && champion.classname == "player" && player_count > 1) || player_count == 1)) // don't allow a kill in this case either
+       if((g_arena || g_ca) && ((champion && IS_PLAYER(champion) && player_count > 1) || player_count == 1)) // don't allow a kill in this case either
        {
                // do nothing
        }
@@ -1357,7 +1357,7 @@ void ClientConnect (void)
 {
        float t;
 
-       if(self.flags & FL_CLIENT)
+       if(IS_CLIENT(self))
        {
                print("Warning: ClientConnect, but already connected!\n");
                return;
@@ -1398,7 +1398,7 @@ void ClientConnect (void)
        // identify the right forced team
        if(autocvar_g_campaign)
        {
-               if(clienttype(self) == CLIENTTYPE_REAL) // only players, not bots
+               if(IS_REAL_CLIENT(self)) // only players, not bots
                {
                        switch(autocvar_g_campaign_forceteam)
                        {
@@ -1465,11 +1465,11 @@ void ClientConnect (void)
 
        PlayerStats_AddEvent(sprintf("kills-%d", self.playerid));
 
-    if(clienttype(self) == CLIENTTYPE_BOT)
+    if(IS_BOT_CLIENT(self))
         PlayerStats_AddPlayer(self);
 
        if(autocvar_sv_eventlog)
-               GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((clienttype(self) == CLIENTTYPE_REAL) ? self.netaddress : "bot"), ":", self.netname));
+               GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot"), ":", self.netname));
 
        LogTeamchange(self.playerid, self.team, 1);
 
@@ -1479,7 +1479,7 @@ void ClientConnect (void)
 
        bprint("^4", self.netname, "^4 connected");
 
-       if(self.classname != "observer" && (g_domination || g_ctf))
+       if(!IS_OBSERVER(self) && (g_domination || g_ctf))
                bprint(" and joined the ", ColoredTeamName(self.team));
 
        bprint("\n");
@@ -1531,7 +1531,7 @@ void ClientConnect (void)
        self.jointime = time;
        self.allowed_timeouts = autocvar_sv_timeout_number;
 
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
        {
                if(autocvar_g_bugrigs || WEPSET_EQ_AW(g_weaponarena_weapons, WEP_TUBA))
                        stuffcmd(self, "cl_cmd settemp chase_active 1\n");
@@ -1589,7 +1589,7 @@ void ClientConnect (void)
 
        self.model_randomizer = random();
     
-    if(clienttype(self) != CLIENTTYPE_REAL)
+    if not(IS_REAL_CLIENT(self))
         return;
         
     sv_notice_join();
@@ -1610,7 +1610,7 @@ void ClientDisconnect (void)
        if(self.vehicle)
            vehicles_exit(VHEF_RELESE);
 
-       if not(self.flags & FL_CLIENT)
+       if not(IS_CLIENT(self))
        {
                print("Warning: ClientDisconnect without ClientConnect\n");
                return;
@@ -1774,7 +1774,7 @@ void respawn(void)
 
 void play_countdown(float finished, string samp)
 {
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
                if(floor(finished - time - frametime) != floor(finished - time))
                        if(finished - time < 6)
                                sound (self, CH_INFO, samp, VOL_BASE, ATTN_NORM);
@@ -2207,7 +2207,7 @@ float SpectateUpdate() {
        if (self == self.enemy)
                return 0;
 
-       if(self.enemy.classname != "player")
+       if not(IS_PLAYER(self.enemy))
                return 0;
 
        SpectateCopy(self.enemy);
@@ -2258,7 +2258,7 @@ float SpectateNext(entity _prefer) {
        if (other)
                self.enemy = other;
 
-       if(self.enemy.classname == "player") {
+       if(IS_PLAYER(self.enemy)) {
            /*if(self.enemy.vehicle)
            {      
             
@@ -2329,7 +2329,7 @@ void LeaveSpectatorMode()
 
                        PutClientInServer();
 
-                       if(self.classname == "player")
+                       if(IS_PLAYER(self))
                                bprint ("^4", self.netname, "^4 is playing now\n");
 
                        if(!autocvar_g_campaign)
@@ -2406,7 +2406,7 @@ float nJoinAllowed(entity ignore) {
  * g_maxplayers_spectator_blocktime seconds
  */
 void checkSpectatorBlock() {
-       if(self.classname == "spectator" || self.classname == "observer") {
+       if(IS_SPEC(self) || IS_OBSERVER(self)) {
                if( time > (self.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
                        sprint(self, "^7You were kicked from the server because you are spectator and spectators aren't allowed at the moment.\n");
                        dropclient(self);
@@ -2419,7 +2419,7 @@ void PrintWelcomeMessage()
 {
        if (self.motd_actived_time == 0) { // is there already a message showing?
                if (autocvar_g_campaign) {
-                       if ((self.classname == "player" && self.BUTTON_INFO) || (self.classname != "player")) {
+                       if ((IS_PLAYER(self) && self.BUTTON_INFO) || (!IS_PLAYER(self))) {
                                self.motd_actived_time = time;
                                Send_CSQC_Centerprint_Generic(self, CPID_MOTD, campaign_message, -1, 0);
                        }
@@ -2433,7 +2433,7 @@ void PrintWelcomeMessage()
                if (autocvar_g_campaign) {
                        if (self.BUTTON_INFO)
                                self.motd_actived_time = time;
-                       else if ((time - self.motd_actived_time > 2) && self.classname == "player") { // hide it some seconds after BUTTON_INFO has been released
+                       else if ((time - self.motd_actived_time > 2) && IS_PLAYER(self)) { // hide it some seconds after BUTTON_INFO has been released
                                self.motd_actived_time = 0;
                                Send_CSQC_Centerprint_Generic_Expire(self, CPID_MOTD);
                        }
@@ -2524,7 +2524,7 @@ void SpectatorThink()
 
 void PlayerUseKey()
 {
-       if(self.classname != "player")
+       if not(IS_PLAYER(self))
                return;
 
        if(self.vehicle)
@@ -2641,7 +2641,7 @@ void PlayerPreThink (void)
 
        PrintWelcomeMessage();
 
-       if(self.classname == "player") {
+       if(IS_PLAYER(self)) {
 //             if(self.netname == "Wazat")
 //                     bprint(self.classname, "\n");
 
@@ -2742,7 +2742,7 @@ void PlayerPreThink (void)
 
                if(g_touchexplode)
                if(time > self.touchexplode_time)
-               if(self.classname == "player")
+               if(IS_PLAYER(self))
                if(self.deadflag == DEAD_NO)
                if not(IS_INDEPENDENT_PLAYER(self))
                FOR_EACH_PLAYER(other) if(self != other)
@@ -2875,9 +2875,9 @@ void PlayerPreThink (void)
                if (intermission_running)
                        IntermissionThink ();   // otherwise a button could be missed between
                return;
-       } else if(self.classname == "observer") {
+       } else if(IS_OBSERVER(self)) {
                ObserverThink();
-       } else if(self.classname == "spectator") {
+       } else if(IS_SPEC(self)) {
                SpectatorThink();
        }
 
@@ -2886,9 +2886,9 @@ void PlayerPreThink (void)
 
        float oldspectatee_status;
        oldspectatee_status = self.spectatee_status;
-       if(self.classname == "spectator")
+       if(IS_SPEC(self))
                self.spectatee_status = num_for_edict(self.enemy);
-       else if(self.classname == "observer")
+       else if(IS_OBSERVER(self))
                self.spectatee_status = num_for_edict(self);
        else
                self.spectatee_status = 0;
@@ -3018,7 +3018,7 @@ void PlayerPostThink (void)
 
        //CheckPlayerJump();
 
-       if(self.classname == "player") {
+       if(IS_PLAYER(self)) {
                CheckRules_Player();
                UpdateChatBubble();
                if (self.impulse)
index 50401604ef905313d521380d6995b0cf202d6bec..b1497846b5128477623b4e0604927fde57c0c09e 100644 (file)
@@ -826,7 +826,7 @@ void SV_PlayerPhysics()
                        self.punchvector = '0 0 0';
        }
 
-       if (clienttype(self) == CLIENTTYPE_BOT)
+       if (IS_BOT_CLIENT(self))
        {
                if(playerdemo_read())
                        return;
@@ -835,7 +835,7 @@ void SV_PlayerPhysics()
        
        self.items &~= IT_USING_JETPACK;
 
-       if(self.classname == "player")
+       if(IS_PLAYER(self))
        {
                if(self.race_penalty)
                        if(time > self.race_penalty)
@@ -889,7 +889,7 @@ void SV_PlayerPhysics()
        if(self.conveyor.state)
                self.velocity -= self.conveyor.movedir;
 
-       if(self.classname != "player")
+       if not(IS_PLAYER(self))
        {
                maxspd_mod = autocvar_sv_spectator_speed_multiplier;
                if(!self.spectatorspeed)
@@ -938,7 +938,7 @@ void SV_PlayerPhysics()
        }
 
        if(self.flags & FL_ONGROUND)
-       if(self.classname == "player") // no fall sounds for observers thank you very much
+       if(IS_PLAYER(self)) // no fall sounds for observers thank you very much
        if(self.wasFlying)
        {
                self.wasFlying = 0;
@@ -963,7 +963,7 @@ void SV_PlayerPhysics()
        if(IsFlying(self))
                self.wasFlying = 1;
 
-       if(self.classname == "player")
+       if(IS_PLAYER(self))
                CheckPlayerJump();
 
        if (self.flags & FL_WATERJUMP )
@@ -976,7 +976,7 @@ void SV_PlayerPhysics()
                        self.teleport_time = 0;
                }
        }
-       else if (g_bugrigs && self.classname == "player")
+       else if (g_bugrigs && IS_PLAYER(self))
        {
                RaceCarPhysics();
        }
@@ -1328,7 +1328,7 @@ void SV_PlayerPhysics()
                }
        }
 
-       if((g_cts || g_race) && self.classname != "observer") {
+       if((g_cts || g_race) && !IS_OBSERVER(self)) {
                if(vlen(self.velocity - self.velocity_z * '0 0 1') > speedaward_speed) {
                        speedaward_speed = vlen(self.velocity - self.velocity_z * '0 0 1');
                        speedaward_holder = self.netname;
index e81b08e58e73094a76f7c8c3e0fc1d84b757140a..3014b03cb3d171e05eaa4d0952a1c4d7adb5ec9f 100644 (file)
@@ -410,7 +410,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                //self.pushltime = 0;
                self.istypefrag = 0;
        }
-       else if(attacker.classname == "player")
+       else if(IS_PLAYER(attacker))
        {
                self.pusher = attacker;
                self.pushltime = time + autocvar_g_maxpushtime;
@@ -511,18 +511,18 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
        self.dmg_take = self.dmg_take + take;//max(take - 10, 0);
        self.dmg_inflictor = inflictor;
 
-       if(g_ca && self != attacker && attacker.classname == "player")
+       if(g_ca && self != attacker && IS_PLAYER(attacker))
                PlayerScore_Add(attacker, SP_SCORE, (damage - excess) * autocvar_g_ca_damage2score_multiplier);
 
        float abot, vbot, awep;
-       abot = (clienttype(attacker) == CLIENTTYPE_BOT);
-       vbot = (clienttype(self) == CLIENTTYPE_BOT);
+       abot = (IS_BOT_CLIENT(attacker));
+       vbot = (IS_BOT_CLIENT(self));
 
        valid_damage_for_weaponstats = 0;
        awep = 0;
 
-       if(vbot || clienttype(self) == CLIENTTYPE_REAL)
-       if(abot || clienttype(attacker) == CLIENTTYPE_REAL)
+       if(vbot || IS_REAL_CLIENT(self))
+       if(abot || IS_REAL_CLIENT(attacker))
        if(attacker && self != attacker)
        if(IsDifferentTeam(self, attacker))
        {
@@ -617,7 +617,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
 
                Portal_ClearAllLater(self);
 
-               if(clienttype(self) == CLIENTTYPE_REAL)
+               if(IS_REAL_CLIENT(self))
                {
                        stuffcmd(self, "-zoom\n");
                        self.fixangle = TRUE;
@@ -731,7 +731,7 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f
 
        msgin = formatmessage(msgin);
 
-       if(source.classname != "player")
+       if not(IS_PLAYER(source))
                colorstr = "^0"; // black for spectators
        else if(teamplay)
                colorstr = Team_ColorCode(source.team);
@@ -891,7 +891,7 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f
        }
 
        if(!privatesay)
-       if(source.classname != "player")
+       if not(IS_PLAYER(source))
        {
                if not(intermission_running)
                        if(teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !(inWarmupStage || gameover)))
@@ -958,7 +958,7 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f
                {
                        sprint(source, sourcemsgstr);
                        //print(msgstr); // send to server console too
-                       FOR_EACH_REALCLIENT(head) if(head.classname != "player")
+                       FOR_EACH_REALCLIENT(head) if not(IS_PLAYER(head))
                                if(head != source)
                                        sprint(head, msgstr);
                }
@@ -1131,7 +1131,7 @@ void FakeGlobalSound(string sample, float chan, float voicetype)
                        if(self.pusher)
                        {
                                msg_entity = self;
-                               if(clienttype(msg_entity) == CLIENTTYPE_REAL)
+                               if(IS_REAL_CLIENT(msg_entity))
                                        soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE);
                        }
                        break;
@@ -1160,7 +1160,7 @@ void FakeGlobalSound(string sample, float chan, float voicetype)
                        }
                        break;
                case VOICETYPE_TAUNT:
-                       if(self.classname == "player")
+                       if(IS_PLAYER(self))
                                if(self.deadflag == DEAD_NO)
                                        animdecide_setaction(self, ANIMACTION_TAUNT, TRUE);
                        if(!sv_taunt)
@@ -1204,7 +1204,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                        if(self.pusher)
                        {
                                msg_entity = self.pusher;
-                               if(clienttype(msg_entity) == CLIENTTYPE_REAL)
+                               if(IS_REAL_CLIENT(msg_entity))
                                {
                                        if(msg_entity.cvar_cl_voice_directional == 1)
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);
@@ -1217,7 +1217,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                        if(self.pusher)
                        {
                                msg_entity = self.pusher;
-                               if(clienttype(msg_entity) == CLIENTTYPE_REAL)
+                               if(IS_REAL_CLIENT(msg_entity))
                                {
                                        if(msg_entity.cvar_cl_voice_directional == 1)
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);
@@ -1225,7 +1225,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                                soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_NONE);
                                }
                                msg_entity = self;
-                               if(clienttype(msg_entity) == CLIENTTYPE_REAL)
+                               if(IS_REAL_CLIENT(msg_entity))
                                        soundto(MSG_ONE, self, chan, sample, VOL_BASE, ATTN_NONE);
                        }
                        break;
@@ -1257,7 +1257,7 @@ void GlobalSound(string sample, float chan, float voicetype)
                                }
                        break;
                case VOICETYPE_TAUNT:
-                       if(self.classname == "player")
+                       if(IS_PLAYER(self))
                                if(self.deadflag == DEAD_NO)
                                        animdecide_setaction(self, ANIMACTION_TAUNT, TRUE);
                        if(!sv_taunt)
index f697d3689c6247ab40a060198244fb147ade1673..8d83c975e944009a90a250db74c6a8e8c03879ba 100644 (file)
@@ -108,12 +108,12 @@ void W_HitPlotAnalysis(entity player, vector screenforward, vector screenright,
                lag = ANTILAG_LATENCY(player);
                if(lag < 0.001)
                        lag = 0;
-               if(clienttype(player) != CLIENTTYPE_REAL)
+               if not(IS_REAL_CLIENT(player))
                        lag = 0; // only antilag for clients
 
                org = player.origin + player.view_ofs;
                traceline_antilag_force(player, org, org + screenforward * MAX_SHOT_DISTANCE, MOVE_NORMAL, player, lag);
-               if(trace_ent.flags & FL_CLIENT)
+               if(IS_CLIENT(trace_ent))
                {
                        antilag_takeback(trace_ent, time - lag);
                        hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);
@@ -213,7 +213,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
                        if (!trace_ent.takedamage)
                        {
                                traceline_antilag_force (ent, w_shotorg, w_shotorg + w_shotdir * range, MOVE_NORMAL, ent, ANTILAG_LATENCY(ent));
-                               if (trace_ent.takedamage && trace_ent.classname == "player")
+                               if (trace_ent.takedamage && IS_PLAYER(trace_ent))
                                {
                                        entity e;
                                        e = trace_ent;
@@ -229,7 +229,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
                        if (ent.cursor_trace_ent)                 // client was aiming at someone
                        if (ent.cursor_trace_ent != ent)         // just to make sure
                        if (ent.cursor_trace_ent.takedamage)      // and that person is killable
-                       if (ent.cursor_trace_ent.classname == "player") // and actually a player
+                       if (IS_PLAYER(ent.cursor_trace_ent)) // and actually a player
                        {
                                // verify that the shot would miss without antilag
                                // (avoids an issue where guns would always shoot at their origin)
@@ -271,7 +271,7 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
 float CL_Weaponentity_CustomizeEntityForClient()
 {
        self.viewmodelforclient = self.owner;
-       if(other.classname == "spectator")
+       if(IS_SPEC(other))
                if(other.enemy == self.owner)
                        self.viewmodelforclient = other;
        return TRUE;
@@ -711,7 +711,7 @@ float client_hasweapon(entity cl, float wpn, float andammo, float complain)
                        if (!f)
                        {
                                if (complain)
-                               if(clienttype(cl) == CLIENTTYPE_REAL)
+                               if(IS_REAL_CLIENT(cl))
                                {
                                        play2(cl, "weapons/unavailable.wav");
                                        sprint(cl, strcat("You don't have any ammo for the ^2", W_Name(wpn), "\n"));
@@ -1371,7 +1371,7 @@ void W_Reload(float sent_ammo_min, float sent_ammo_amount, float sent_time, stri
        if(!self.(self.current_ammo) && self.reload_ammo_min)
        if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
        {
-               if(clienttype(self) == CLIENTTYPE_REAL && self.reload_complain < time)
+               if(IS_REAL_CLIENT(self) && self.reload_complain < time)
                {
                        play2(self, "weapons/unavailable.wav");
                        sprint(self, strcat("You don't have enough ammo to reload the ^2", W_Name(self.weapon), "\n"));
index 530646afd2ec8fbb105dc8a080b41dadaaa25d0f..c7fcdeacb8bc1914c7d4094e624cb37c62de0fce 100644 (file)
@@ -81,7 +81,7 @@ void ClientCommand_clientversion(float request, float argc) // internal command,
                {
                        if(argv(1) != "")
                        {
-                               if(self.flags & FL_CLIENT)
+                               if(IS_CLIENT(self))
                                {
                                        self.version = ((argv(1) == "$gameversion") ? 1 : stof(argv(1)));
                                        
@@ -148,9 +148,9 @@ void ClientCommand_join(float request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if(self.flags & FL_CLIENT)
+                       if(IS_CLIENT(self))
                        {
-                               if(self.classname != "player" && !lockteams && !g_arena)
+                               if(!IS_PLAYER(self) && !lockteams && !g_arena)
                                {
                                        if(nJoinAllowed(self)) 
                                        {
@@ -188,7 +188,7 @@ void ClientCommand_ready(float request) // todo: anti-spam for toggling readynes
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if(self.flags & FL_CLIENT)
+                       if(IS_CLIENT(self))
                        {
                                if(inWarmupStage || autocvar_sv_ready_restart || g_race_qualifying == 2)
                                {
@@ -274,7 +274,7 @@ void ClientCommand_selectteam(float request, float argc)
                {
                        if(argv(1) != "")
                        {
-                               if(self.flags & FL_CLIENT)
+                               if(IS_CLIENT(self))
                                {
                                        if(teamplay)
                                                if not(self.team_forced > 0) 
@@ -390,7 +390,7 @@ void ClientCommand_spectate(float request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if(self.flags & FL_CLIENT)
+                       if(IS_CLIENT(self))
                        {
                                if(g_arena) { return; } 
                                if(g_lms)
@@ -408,12 +408,12 @@ void ClientCommand_spectate(float request)
                                        }
                                }
                                
-                               if(self.classname == "player" && autocvar_sv_spectate == 1) 
+                               if(IS_PLAYER(self) && autocvar_sv_spectate == 1) 
                                        ClientKill_TeamChange(-2); // observe
                                
                                // in CA, allow a dead player to move to spectators (without that, caplayer!=0 will be moved back to the player list)
                                // note: if arena game mode is ever done properly, this needs to be removed.
-                               if(g_ca && self.caplayer && (self.classname == "spectator" || self.classname == "observer"))
+                               if(g_ca && self.caplayer && (IS_SPEC(self) || IS_OBSERVER(self)))
                                {
                                        sprint(self, "WARNING: you will spectate in the next round.\n");
                                        self.caplayer = 0;
index 53ad41d3551d0d7de500622a31f224ec87b52ef1..42fba4f0e8c45e9ae24e6c239e10f292d3ffdc8d 100644 (file)
@@ -24,11 +24,11 @@ string GetCallerName(entity caller)
 // verify that the client provided is acceptable for use
 float VerifyClientEntity(entity client, float must_be_real, float must_be_bots)
 {
-       if not(client.flags & FL_CLIENT)
+       if not(IS_CLIENT(client))
                return CLIENT_DOESNT_EXIST;
-       else if(must_be_real && (clienttype(client) != CLIENTTYPE_REAL))
+       else if(must_be_real && !IS_REAL_CLIENT(client))
                return CLIENT_NOT_REAL;
-       else if(must_be_bots && (clienttype(client) != CLIENTTYPE_BOT))
+       else if(must_be_bots && !IS_BOT_CLIENT(client))
                return CLIENT_NOT_BOT;
                
        return CLIENT_ACCEPTABLE;
@@ -565,7 +565,7 @@ void CommonCommand_timeout(float request, entity caller) // DEAR GOD THIS COMMAN
                                else if(inWarmupStage && !g_warmup_allow_timeout) { print_to(caller, "^7Error: You can not call a timeout in warmup-stage."); }
                                else if(time < game_starttime) { print_to(caller, "^7Error: You can not call a timeout while the map is being restarted."); }
                                else if(caller && (caller.allowed_timeouts < 1)) { print_to(caller, "^7Error: You already used all your timeout calls for this map."); }
-                               else if(caller && (caller.classname != "player")) { print_to(caller, "^7Error: You must be a player to call a timeout."); }
+                               else if(caller && !IS_PLAYER(caller)) { print_to(caller, "^7Error: You must be a player to call a timeout."); }
                                else if((autocvar_timelimit) && (last_possible_timeout < time - game_starttime)) { print_to(caller, "^7Error: It is too late to call a timeout now!"); }
                                
                                else // everything should be okay, proceed with starting the timeout
@@ -621,7 +621,7 @@ void CommonCommand_who(float request, entity caller, float argc)
                        total_listed_players = 0;
                        FOR_EACH_CLIENT(tmp_player)
                        {
-                               is_bot = (clienttype(tmp_player) == CLIENTTYPE_BOT);
+                               is_bot = (IS_BOT_CLIENT(tmp_player));
                                
                                if(is_bot)
                                {
index 8f3ea869d49e24bcdf0febd74dc5564c1002f7b6..dbc09c0ee3dde52081538de63c6d3f65b321f3a2 100644 (file)
@@ -997,7 +997,7 @@ void GameCommand_moveplayer(float request, float argc)
                                        // Where are we putting this player?
                                        if(destination == "spec" || destination == "spectator") 
                                        {
-                                               if(client.classname != "spectator" && client.classname != "observer")
+                                               if(!IS_SPEC(client) && !IS_OBSERVER(client))
                                                {
                                                        self = client;
                                                        PutObserverInServer();
@@ -1012,7 +1012,7 @@ void GameCommand_moveplayer(float request, float argc)
                                        }
                                        else
                                        {
-                                               if(client.classname != "spectator" && client.classname != "observer")
+                                               if(!IS_SPEC(client) && !IS_OBSERVER(client))
                                                {
                                                        if(teamplay)
                                                        {
@@ -1109,7 +1109,7 @@ void GameCommand_nospectators(float request)
                        entity plr;
                        FOR_EACH_CLIENT(plr) //give every spectator <g_maxplayers_spectator_blocktime> seconds time to become a player
                        {
-                               if(plr.classname == "spectator" || plr.classname == "observer")
+                               if(IS_SPEC(plr) || IS_OBSERVER(plr))
                                {
                                        plr.spectatortime = time;
                                        sprint(plr, strcat("^7You have to become a player within the next ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n"));
index 329fb9d4ef98c1a4d8d4ee0c30b8b15e9625f701..cdb3a1290e0b2e5b0c1267daccd0ca4898b713d9 100644 (file)
@@ -63,7 +63,7 @@ float Nagger_SendEntity(entity to, float sendflags)
                for(i = 1; i <= maxclients; i += 8)
                {
                        for(f = 0, e = edict_num(i), b = 1; b < 256; b *= 2, e = nextent(e))
-                               if(clienttype(e) != CLIENTTYPE_REAL || e.ready)
+                               if(!IS_REAL_CLIENT(e) || e.ready)
                                        f |= b;
                        WriteByte(MSG_ENTITY, f);
                }
@@ -194,7 +194,7 @@ void VoteCount(float first_count)
                                || ((autocvar_sv_vote_nospectators == 1) && (inWarmupStage || gameover))
                                || (autocvar_sv_vote_nospectators == 0));
                                
-       float vote_player_count = 0, is_player, notvoters = 0;
+       float vote_player_count = 0, notvoters = 0;
        float vote_real_player_count = 0, vote_real_accept_count = 0;
        float vote_real_reject_count = 0, vote_real_abstain_count = 0;
        float vote_needed_of_voted, final_needed_votes;
@@ -207,16 +207,14 @@ void VoteCount(float first_count)
        // add up all the votes from each connected client
        FOR_EACH_REALCLIENT(tmp_player)
        {
-               is_player = (tmp_player.classname == "player");
-               
                ++vote_player_count;
-               if(is_player) { ++vote_real_player_count; }
+               if(IS_PLAYER(tmp_player)) { ++vote_real_player_count; }
                
                switch(tmp_player.vote_selection)
                {
-                       case VOTE_SELECT_REJECT: { ++vote_reject_count; { if(is_player) ++vote_real_reject_count; } break; }
-                       case VOTE_SELECT_ACCEPT: { ++vote_accept_count; { if(is_player) ++vote_real_reject_count; } break; }
-                       case VOTE_SELECT_ABSTAIN: { ++vote_abstain_count; { if(is_player) ++vote_real_abstain_count; } break; }
+                       case VOTE_SELECT_REJECT: { ++vote_reject_count; { if(IS_PLAYER(tmp_player)) ++vote_real_reject_count; } break; }
+                       case VOTE_SELECT_ACCEPT: { ++vote_accept_count; { if(IS_PLAYER(tmp_player)) ++vote_real_reject_count; } break; }
+                       case VOTE_SELECT_ABSTAIN: { ++vote_abstain_count; { if(IS_PLAYER(tmp_player)) ++vote_real_abstain_count; } break; }
                        default: break;
                }
        }
@@ -703,7 +701,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm
                        if not(autocvar_sv_vote_call || !caller) { print_to(caller, "^1Vote calling is not allowed."); }
                        else if(!autocvar_sv_vote_gamestart && time < game_starttime) { print_to(caller, "^1Vote calling is not allowed before the match has started."); }
                        else if(vote_called) { print_to(caller, "^1There is already a vote called."); }
-                       else if(!spectators_allowed && (caller && (caller.classname != "player"))) { print_to(caller, "^1Only players can call a vote."); }
+                       else if(!spectators_allowed && (caller && !IS_PLAYER(caller))) { print_to(caller, "^1Only players can call a vote."); }
                        else if(timeout_status) { print_to(caller, "^1You can not call a vote while a timeout is active."); }
                        else if(caller && (time < caller.vote_waittime)) { print_to(caller, strcat("^1You have to wait ^2", ftos(ceil(caller.vote_waittime - time)), "^1 seconds before you can again call a vote.")); }
                        else if not(VoteCommand_checknasty(vote_command)) { print_to(caller, "^1Syntax error in command, see 'vhelp' for more info."); }
@@ -802,7 +800,7 @@ void VoteCommand_master(float request, entity caller, float argc, string vote_co
                                                
                                                if not(autocvar_sv_vote_master_callable) { print_to(caller, "^1Vote to become vote master is not allowed."); }
                                                else if(vote_called) { print_to(caller, "^1There is already a vote called."); }
-                                               else if(!spectators_allowed && (caller && (caller.classname != "player"))) { print_to(caller, "^1Only players can call a vote."); }
+                                               else if(!spectators_allowed && (caller && !IS_PLAYER(caller))) { print_to(caller, "^1Only players can call a vote."); }
                                                else if(timeout_status) { print_to(caller, "^1You can not call a vote while a timeout is active."); }
                                                
                                                else // everything went okay, continue with creating vote
index af9a73ecaed21e347608e137aa2ec52b6ccd5d81..8fce148d1f2aadb097a4dbb953af1b7260d890d0 100644 (file)
@@ -26,11 +26,11 @@ float entcs_customize()
        o = self.owner;
        if(o.deadflag != DEAD_NO)
                return FALSE;
-       if(o.classname != "player")
+       if not(IS_PLAYER(o))
                return FALSE;
        if(other == o)
                return FALSE;
-       if((other.classname == "player") || other.caplayer)
+       if((IS_PLAYER(other)) || other.caplayer)
                if(!teamplay || o.team != other.team)
                        if not (radar_showennemies)
                                return FALSE;
index e779ff45357bce54c3907b5aced103c70b308738..f94f9ef2ce4d2b4ae3b6aaa5274556be62b2665d 100644 (file)
@@ -231,7 +231,7 @@ string Obituary_ExtraFragInfo(entity player) // Extra fragmessage information
                
                // ping display
                if(autocvar_sv_fraginfo_ping)
-                       ping_output = ((clienttype(player) == CLIENTTYPE_BOT) ? "^2Bot" : strcat("Ping ", ((player.ping >= 150) ? "^1" : "^2"), ftos(rint(player.ping)), "ms"));
+                       ping_output = ((IS_BOT_CLIENT(player)) ? "^2Bot" : strcat("Ping ", ((player.ping >= 150) ? "^1" : "^2"), ftos(rint(player.ping)), "ms"));
                        
                // handicap display 
                if(autocvar_sv_fraginfo_handicap) 
@@ -311,7 +311,7 @@ void Send_KillNotification (string s1, string s2, string s3, float msg, float ty
 // Function is used to send a generic centerprint whose content CSQC gets to decide (gentle version or not in the below cases)
 void Send_CSQC_KillCenterprint(entity e, string s1, string s2, float msg, float type)
 {
-       if (clienttype(e) == CLIENTTYPE_REAL)
+       if (IS_REAL_CLIENT(e))
        {
                msg_entity = e;
                WRITESPECTATABLE_MSG_ONE({
@@ -330,7 +330,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
        string  s, a, msg;
        float type;
 
-       if (targ.classname == "player")
+       if (IS_PLAYER(targ))
        {
                s = targ.netname;
                a = attacker.netname;
@@ -364,7 +364,7 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
 
                        Send_KillNotification(s, msg, "", deathtype, MSG_SUICIDE);
                }
-               else if (attacker.classname == "player")
+               else if (IS_PLAYER(attacker))
                {
                        if(!IsDifferentTeam(attacker, targ))
                        {
@@ -543,7 +543,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
         damage_attacker = attacker;
                attacker_save = attacker;
 
-       if(targ.classname == "player")
+       if(IS_PLAYER(targ))
                if(targ.hook)
                        if(targ.hook.aiment)
                                if(targ.hook.aiment == attacker)
@@ -552,7 +552,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        // special rule: gravity bomb does not hit team mates (other than for disconnecting the hook)
        if(DEATH_ISWEAPON(deathtype, WEP_HOOK) || DEATH_ISWEAPON(deathtype, WEP_TUBA))
        {
-               if(targ.classname == "player")
+               if(IS_PLAYER(targ))
                        if not(IsDifferentTeam(targ, attacker))
                        {
                                self = oldself;
@@ -577,20 +577,11 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        }
        else
        {
-               /*
-               skill based bot damage? gtfo. (tZork)
-               if (targ.classname == "player")
-               if (attacker.classname == "player")
-               if (!targ.isbot)
-               if (attacker.isbot)
-                       damage = damage * bound(0.1, (skill + 5) * 0.1, 1);
-        */
-        
                // nullify damage if teamplay is on
                if(deathtype != DEATH_TELEFRAG)
-               if(attacker.classname == "player")
+               if(IS_PLAYER(attacker))
                {
-                       if(targ.classname == "player" && targ != attacker && (IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(targ)))
+                       if(IS_PLAYER(targ) && targ != attacker && (IS_INDEPENDENT_PLAYER(attacker) || IS_INDEPENDENT_PLAYER(targ)))
                        {
                                damage = 0;
                                force = '0 0 0';
@@ -605,7 +596,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                                damage = 0;
                                        else if(autocvar_teamplay_mode == 4)
                                        {
-                                               if(targ.classname == "player" && targ.deadflag == DEAD_NO)
+                                               if(IS_PLAYER(targ) && targ.deadflag == DEAD_NO)
                                                {
                                                        attacker.dmg_team = attacker.dmg_team + damage;
                                                        complainteamdamage = attacker.dmg_team - autocvar_g_teamdamage_threshold;
@@ -651,15 +642,15 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        }
                }
 
-               if(targ.classname == "player")
-               if(attacker.classname == "player")
+               if(IS_PLAYER(targ))
+               if(IS_PLAYER(attacker))
                if(attacker != targ)
                {
                        targ.lms_traveled_distance = autocvar_g_lms_campcheck_distance;
                        attacker.lms_traveled_distance = autocvar_g_lms_campcheck_distance;
                }
 
-               if(targ.classname == "player")
+               if(IS_PLAYER(targ))
                if (g_minstagib)
                {
                        if ((deathtype == DEATH_FALL)  ||
@@ -688,7 +679,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                                complainteamdamage = 0;
                                if (targ != attacker)
                                {
-                                       if ((targ.health >= 1) && (targ.classname == "player"))
+                                       if ((targ.health >= 1) && (IS_PLAYER(targ)))
                                                centerprint(attacker, "Secondary fire inflicts no damage!");
                                        force = '0 0 0';
                                        // keep mirrorforce
@@ -789,7 +780,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        else
                                victim = targ;
 
-                       if(victim.classname == "player" || victim.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
+                       if(IS_PLAYER(victim) || victim.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
                        {
                                if(IsDifferentTeam(victim, attacker))
                                {
@@ -808,7 +799,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
 
                                                if not(DEATH_ISSPECIAL(deathtype))
                                                {
-                                                       if(targ.classname == "player") // don't do this for vehicles
+                                                       if(IS_PLAYER(targ)) // don't do this for vehicles
                                                        if(!g_minstagib)
                                                        if(IsFlying(victim))
                                                                yoda = 1;
@@ -840,7 +831,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        // apply push
        if (self.damageforcescale)
        if (vlen(force))
-       if (self.classname != "player" || time >= self.spawnshieldtime || g_midair)
+       if (!IS_PLAYER(self) || time >= self.spawnshieldtime || g_midair)
        {
                vector farce = damage_explosion_calcpush(self.damageforcescale * force, self.velocity, autocvar_g_balance_damagepush_speedfactor);
                if(self.movetype == MOVETYPE_PHYSICS)
@@ -868,7 +859,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                self.event_damage (inflictor, attacker, damage, deathtype, hitloc, force);
        self = oldself;
 
-       if(targ.classname == "player" && attacker.classname == "player" && attacker != targ && attacker.health > 2)
+       if(IS_PLAYER(targ) && IS_PLAYER(attacker) && attacker != targ && attacker.health > 2)
        {
                if(g_runematch)
                {
@@ -1041,7 +1032,7 @@ float RadiusDamage (entity inflictor, entity attacker, float coredamage, float e
                                                        if(autocvar_g_throughfloor_debug)
                                                                print(sprintf(" steps=%f", total));
 
-                                                       if (targ.classname == "player")
+                                                       if (IS_PLAYER(targ))
                                                                total = ceil(bound(autocvar_g_throughfloor_min_steps_player, total, autocvar_g_throughfloor_max_steps_player));
                                                        else
                                                                total = ceil(bound(autocvar_g_throughfloor_min_steps_other, total, autocvar_g_throughfloor_max_steps_other));
@@ -1177,7 +1168,7 @@ float Fire_AddDamage(entity e, entity o, float d, float t, float dt)
        float dps;
        float maxtime, mintime, maxdamage, mindamage, maxdps, mindps, totaldamage, totaltime;
 
-       if(e.classname == "player")
+       if(IS_PLAYER(e))
        {
                if(e.deadflag)
                        return -1;
@@ -1301,7 +1292,7 @@ void Fire_ApplyDamage(entity e)
                return;
 
        for(t = 0, o = e.owner; o.owner && t < 16; o = o.owner, ++t);
-       if(clienttype(o) == CLIENTTYPE_NOTACLIENT)
+       if(IS_NOT_A_CLIENT(o))
                o = e.fire_owner;
 
        // water and slime stop fire
@@ -1329,7 +1320,7 @@ void Fire_ApplyDamage(entity e)
        if not(IS_INDEPENDENT_PLAYER(e))
        FOR_EACH_PLAYER(other) if(e != other)
        {
-               if(other.classname == "player")
+               if(IS_PLAYER(other))
                if(other.deadflag == DEAD_NO)
                if not(IS_INDEPENDENT_PLAYER(other))
                if(boxesoverlap(e.absmin, e.absmax, other.absmin, other.absmax))
index 371f9da399ee9988cd7982b9f887239d95dbe1cc..6444ffdb3cec98fcf7f97114736f340c493964ef 100644 (file)
@@ -92,7 +92,7 @@ Makes client invisible or removes non-client
 */
 void SUB_VanishOrRemove (entity ent)
 {
-       if (ent.flags & FL_CLIENT)
+       if (IS_CLIENT(ent))
        {
                // vanish
                ent.alpha = -1;
@@ -129,9 +129,6 @@ Fade 'ent' out when time >= 'when'
 */
 void SUB_SetFade (entity ent, float when, float fadetime)
 {
-       //if (ent.flags & FL_CLIENT) // && ent.deadflag != DEAD_NO)
-       //      return;
-       //ent.alpha = 1;
        ent.fade_rate = 1/fadetime;
        ent.think = SUB_SetFade_Think;
        ent.nextthink = when;
@@ -416,7 +413,7 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma,
        // check whether antilagged traces are enabled
        if (lag < 0.001)
                lag = 0;
-       if (clienttype(forent) != CLIENTTYPE_REAL)
+       if not(IS_REAL_CLIENT(forent))
                lag = 0; // only antilag for clients
 
        // change shooter to SOLID_BBOX so the shot can hit corpses
index 293c78f001f0f3a2df0c050d91102db2b53a4289..7defd351cdffe61e50f39931779e5bc8393bc0a4 100644 (file)
@@ -61,9 +61,9 @@ void SUB_UseTargets()
 //
 // print the message
 //
-       if (activator.classname == "player" && self.message != "")
+       if (IS_PLAYER(activator) && self.message != "")
        {
-               if(clienttype(activator) == CLIENTTYPE_REAL)
+               if(IS_REAL_CLIENT(activator))
                {
                        centerprint (activator, self.message);
                        if (self.noise == "")
@@ -164,7 +164,7 @@ void multi_trigger()
 
        if (self.classname == "trigger_secret")
        {
-               if (self.enemy.classname != "player")
+               if not(IS_PLAYER(self.enemy))
                        return;
                found_secrets = found_secrets + 1;
                WriteByte (MSG_ALL, SVC_FOUNDSECRET);
@@ -384,7 +384,7 @@ void counter_use()
 
        if (self.count != 0)
        {
-               if (activator.classname == "player"
+               if (IS_PLAYER(activator)
                && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
                {
                        if (self.count >= 4)
@@ -399,7 +399,7 @@ void counter_use()
                return;
        }
 
-       if (activator.classname == "player"
+       if (IS_PLAYER(activator)
        && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
                centerprint(activator, "Sequence completed!");
        self.enemy = activator;
@@ -432,7 +432,7 @@ void spawnfunc_trigger_counter()
 
 void trigger_hurt_use()
 {
-       if(activator.classname == "player")
+       if(IS_PLAYER(activator))
                self.enemy = activator;
        else
                self.enemy = world; // let's just destroy it, if taking over is too much work
@@ -459,7 +459,7 @@ void trigger_hurt_touch()
 
                        entity own;
                        own = self.enemy;
-                       if(own.classname != "player")
+                       if not(IS_PLAYER(own))
                        {
                                own = self;
                                self.enemy = world; // I still hate you all
@@ -702,7 +702,7 @@ void spawnfunc_trigger_gravity()
 void target_speaker_use_off();
 void target_speaker_use_activator()
 {
-       if(clienttype(activator) != CLIENTTYPE_REAL)
+       if not(IS_REAL_CLIENT(activator))
                return;
        string snd;
        if(substring(self.noise, 0, 1) == "*")
@@ -1777,7 +1777,7 @@ void target_voicescript_next(entity pl)
                return;
        if(vs.message == "")
                return;
-       if(pl.classname != "player")
+       if not(IS_PLAYER(pl))
                return;
        if(gameover)
                return;
@@ -1926,7 +1926,7 @@ string trigger_magicear_processmessage(entity ear, entity source, float teamsay,
 
        magicear_matched = FALSE;
 
-       dotrigger = ((source.classname == "player") && (source.deadflag == DEAD_NO) && ((ear.radius == 0) || (vlen(source.origin - ear.origin) <= ear.radius)));
+       dotrigger = ((IS_PLAYER(source)) && (source.deadflag == DEAD_NO) && ((ear.radius == 0) || (vlen(source.origin - ear.origin) <= ear.radius)));
        domatch = ((ear.spawnflags & 32) || dotrigger);
 
        if not(domatch)
index d67ef26eba5ca4904655eab2fb73fd0e0c08f549..91f8caf39cad6056978c5333d4dcf7f081137a48 100644 (file)
@@ -14,7 +14,7 @@ void PingPLReport_Think()
        self.nextthink = time + delta;
 
        e = edict_num(self.cnt + 1);
-       if(clienttype(e) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(e))
        {
                WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
                WriteByte(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
@@ -1347,7 +1347,7 @@ void IntermissionThink()
                && ((self.autoscreenshot > 0) && (time > self.autoscreenshot)) )
        {
                self.autoscreenshot = -1;
-               if(clienttype(self) == CLIENTTYPE_REAL) { stuffcmd(self, sprintf("\nscreenshot screenshots/autoscreenshot/%s-%s.jpg; echo \"^5A screenshot has been taken at request of the server.\"", GetMapname(), strftime(FALSE, "%s"))); }
+               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.\"", GetMapname(), strftime(FALSE, "%s"))); }
                return;
        }
 
@@ -1471,11 +1471,11 @@ void DumpStats(float final)
 
        FOR_EACH_CLIENT(other)
        {
-               if ((clienttype(other) == CLIENTTYPE_REAL) || (clienttype(other) == CLIENTTYPE_BOT && autocvar_sv_logscores_bots))
+               if ((IS_REAL_CLIENT(other)) || (IS_BOT_CLIENT(other) && autocvar_sv_logscores_bots))
                {
                        s = strcat(":player:see-labels:", GetPlayerScoreString(other, 0), ":");
                        s = strcat(s, ftos(rint(time - other.jointime)), ":");
-                       if(other.classname == "player" || g_arena || g_ca || g_lms)
+                       if(IS_PLAYER(other) || g_arena || g_ca || g_lms)
                                s = strcat(s, ftos(other.team), ":");
                        else
                                s = strcat(s, "spectator:");
@@ -1540,7 +1540,7 @@ void FixIntermissionClient(entity e)
                        if (e.weaponentity.weaponentity)
                                e.weaponentity.weaponentity.effects = EF_NODRAW;
                }
-               if(clienttype(e) == CLIENTTYPE_REAL)
+               if(IS_REAL_CLIENT(e))
                {
                        stuffcmd(e, "\nscr_printspeed 1000000\n");
                        s = autocvar_sv_intermission_cdtrack;
@@ -2720,7 +2720,7 @@ void MapVote_Tick()
                {
                        other.health = 2342;
                        other.impulse = 0;
-                       if(clienttype(other) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(other))
                        {
                                msg_entity = other;
                                WriteByte(MSG_ONE, SVC_FINALE);
@@ -2832,7 +2832,7 @@ void EndFrame()
        float altime;
        FOR_EACH_REALCLIENT(self)
        {
-               if(self.classname == "spectator")
+               if(IS_SPEC(self))
                {
                        if(self.enemy.typehitsound)
                                self.typehit_time = time;
index 1b423f5020f5646312a3c0b8d7a14380bb073344..530c2815c88349c55e3ccedb7a60070de23d88b2 100644 (file)
@@ -63,7 +63,7 @@ item_key
  * Key touch handler.
  */
 void item_key_touch(void) {
-       if (other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
                
        // player already picked up this key
@@ -318,7 +318,7 @@ void trigger_keylock_touch(void) {
        started_delay = FALSE;
        
        // only player may trigger the lock
-       if (other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
        
        
index e3689cc3d3337d7ced4df19b02ab9c6053b50697..6f76df693021695ef88edb597e790ed7c06ca331 100644 (file)
@@ -85,21 +85,23 @@ string STR_PLAYER = "player";
 string STR_SPECTATOR = "spectator";
 string STR_OBSERVER = "observer";
 
-#if 0
-#define FOR_EACH_CLIENT(v) for(v = world; (v = findflags(v, flags, FL_CLIENT)) != world; )
-#define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if(clienttype(v) == CLIENTTYPE_REAL)
-#define FOR_EACH_PLAYER(v) for(v = world; (v = find(v, classname, STR_PLAYER)) != world; )
-#define FOR_EACH_REALPLAYER(v) FOR_EACH_PLAYER(v) if(clienttype(v) == CLIENTTYPE_REAL)
-#else
+#define IS_PLAYER(v)                   (v.classname == STR_PLAYER)
+#define IS_SPEC(v)                             (v.classname == STR_SPECTATOR)
+#define IS_OBSERVER(v)                         (v.classname == STR_OBSERVER)
+#define IS_CLIENT(v)                   (v.flags & FL_CLIENT)
+#define IS_BOT_CLIENT(v)               (clienttype(v) == CLIENTTYPE_BOT)
+#define IS_REAL_CLIENT(v)              (clienttype(v) == CLIENTTYPE_REAL)
+#define IS_NOT_A_CLIENT(v)             (clienttype(v) == CLIENTTYPE_NOTACLIENT)
+
 #define FOR_EACH_CLIENTSLOT(v) for(v = world; (v = nextent(v)) && (num_for_edict(v) <= maxclients); )
-#define FOR_EACH_CLIENT(v) FOR_EACH_CLIENTSLOT(v) if(v.flags & FL_CLIENT)
-#define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if(clienttype(v) == CLIENTTYPE_REAL)
-#define FOR_EACH_PLAYER(v) FOR_EACH_CLIENT(v) if(v.classname == STR_PLAYER)
-#define FOR_EACH_SPEC(v) FOR_EACH_CLIENT(v) if(v.classname != STR_PLAYER)
-#define FOR_EACH_REALPLAYER(v) FOR_EACH_REALCLIENT(v) if(v.classname == STR_PLAYER)
-#endif
+#define FOR_EACH_CLIENT(v) FOR_EACH_CLIENTSLOT(v) if(IS_CLIENT(v))
+#define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if(IS_REAL_CLIENT(v))
+
+#define FOR_EACH_PLAYER(v) FOR_EACH_CLIENT(v) if(IS_PLAYER(v))
+#define FOR_EACH_SPEC(v) FOR_EACH_CLIENT(v) if not(IS_PLAYER(v)) // Samual: shouldn't this be IS_SPEC(v)? and rather create a separate macro to include observers too
+#define FOR_EACH_REALPLAYER(v) FOR_EACH_REALCLIENT(v) if(IS_PLAYER(v))
 
-#define CENTER_OR_VIEWOFS(ent) (ent.origin + ((ent.classname == STR_PLAYER) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))
+#define CENTER_OR_VIEWOFS(ent) (ent.origin + (IS_PLAYER(ent) ? ent.view_ofs : ((ent.mins + ent.maxs) * 0.5)))
 
 // copies a string to a tempstring (so one can strunzone it)
 string strcat1(string s) = #115; // FRIK_FILE
@@ -112,7 +114,7 @@ void bcenterprint(string s)
     // TODO replace by MSG_ALL (would show it to spectators too, though)?
     entity head;
     FOR_EACH_PLAYER(head)
-    if (clienttype(head) == CLIENTTYPE_REAL)
+    if (IS_REAL_CLIENT(head))
         centerprint(head, s);
 }
 
@@ -690,7 +692,7 @@ float NumberToTeamNumber(float number)
 string playername(entity p)
 {
     string t;
-    if (teamplay && !intermission_running && p.classname == "player")
+    if (teamplay && !intermission_running && IS_PLAYER(p))
     {
         t = Team_ColorCode(p.team);
         return strcat(t, strdecolorize(p.netname));
@@ -1289,7 +1291,7 @@ float sound_allowed(float dest, entity e)
             return TRUE;
     // sounds by players can be removed
     if (autocvar_bot_sound_monopoly)
-        if (clienttype(e) == CLIENTTYPE_REAL)
+        if (IS_REAL_CLIENT(e))
             return FALSE;
     // anything else may pass
     return TRUE;
@@ -1641,14 +1643,14 @@ void precache()
 }
 
 // sorry, but using \ in macros breaks line numbers
-#define WRITESPECTATABLE_MSG_ONE_VARNAME(varname,statement) entity varname; varname = msg_entity; FOR_EACH_REALCLIENT(msg_entity) if(msg_entity == varname || (msg_entity.classname == STR_SPECTATOR && msg_entity.enemy == varname)) statement msg_entity = varname
+#define WRITESPECTATABLE_MSG_ONE_VARNAME(varname,statement) entity varname; varname = msg_entity; FOR_EACH_REALCLIENT(msg_entity) if(msg_entity == varname || (IS_SPEC(msg_entity) && msg_entity.enemy == varname)) statement msg_entity = varname
 #define WRITESPECTATABLE_MSG_ONE(statement) WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement)
 #define WRITESPECTATABLE(msg,statement) if(msg == MSG_ONE) { WRITESPECTATABLE_MSG_ONE(statement); } else statement float WRITESPECTATABLE_workaround = 0
 
 
 void Send_CSQC_Centerprint_Generic(entity e, float id, string s, float duration, float countdown_num)
 {
-       if ((clienttype(e) == CLIENTTYPE_REAL) && (e.flags & FL_CLIENT))
+       if (IS_REAL_CLIENT(e) && IS_CLIENT(e))
        {
                msg_entity = e;
                WRITESPECTATABLE_MSG_ONE({
index 134e979d1c17d0b09da3b1658b0fd724a791b55e..5ca20ec7b55a0177981f03a4cbcddaa2909ea675 100644 (file)
@@ -814,7 +814,7 @@ void ctf_FlagTouch()
                else
                        return; // do nothing
        }
-       else if(toucher.classname != "player") // The flag just touched an object, most likely the world
+       else if not(IS_PLAYER(toucher)) // The flag just touched an object, most likely the world
        {
                if(time > self.wait) // if we haven't in a while, play a sound/effect
                {
@@ -854,7 +854,7 @@ void ctf_FlagTouch()
                
                case FLAG_PASSING:
                {
-                       if((toucher.classname == "player") && (toucher.deadflag == DEAD_NO) && (toucher != self.pass_sender))
+                       if((IS_PLAYER(toucher)) && (toucher.deadflag == DEAD_NO) && (toucher != self.pass_sender))
                        {
                                if(IsDifferentTeam(toucher, self.pass_sender))
                                        ctf_Handle_Return(self, toucher);
@@ -917,7 +917,7 @@ void ctf_RespawnFlag(entity flag)
 void ctf_Reset()
 {
        if(self.owner)
-               if(self.owner.classname == "player")
+               if(IS_PLAYER(self.owner))
                        ctf_Handle_Throw(self.owner, world, DROP_RESET);
                        
        ctf_RespawnFlag(self);
@@ -1768,7 +1768,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerDamage) // for changing damage and force values t
 
 MUTATOR_HOOKFUNCTION(ctf_PlayerDies)
 {
-       if((frag_attacker != frag_target) && (frag_attacker.classname == "player") && (frag_target.flagcarried))
+       if((frag_attacker != frag_target) && (IS_PLAYER(frag_target)) && (frag_target.flagcarried))
        {
                PlayerTeamScore_AddScore(frag_attacker, autocvar_g_ctf_score_kill);
                PlayerScore_Add(frag_attacker, SP_CTF_FCKILLS, 1);
@@ -1828,7 +1828,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
                        
                        while(head) // find the closest acceptable target to pass to
                        {
-                               if(head.classname == "player" && head.deadflag == DEAD_NO)
+                               if(IS_PLAYER(head) && head.deadflag == DEAD_NO)
                                if(head != player && !IsDifferentTeam(head, player))
                                if(!head.speedrunning && !head.vehicle)
                                {
@@ -1840,7 +1840,7 @@ MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
                                        {
                                                if(autocvar_g_ctf_pass_request && !player.flagcarried && head.flagcarried) 
                                                { 
-                                                       if(clienttype(head) == CLIENTTYPE_BOT)
+                                                       if(IS_BOT_CLIENT(head))
                                                        {
                                                                centerprint(player, strcat("Requesting ", head.netname, " to pass you the ", head.flagcarried.netname)); 
                                                                ctf_Handle_Throw(head, player, DROP_PASS);
index 852fb90c05dc287c0fdfeedeb31b61f6f9f4aa23..2f86092b7960f6f34a3e7bdd9cf38c4d703fc5aa 100644 (file)
@@ -186,7 +186,7 @@ void dompointthink()
 void dompointtouch()
 {
        entity head;
-       if (other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
        if (other.health < 1)
                return;
index 116eecbbf6b773613f7b299568df3ee31a5817d6..4014b140395fdf4ca4915e49759b9dddea3c292c 100644 (file)
@@ -97,7 +97,7 @@ void freezetag_Freeze(entity attacker)
                // counted as "suicide" already
                PlayerScore_Add(self, SP_SCORE, -1);
        }
-       else if(attacker.classname == "player")
+       else if(IS_PLAYER(attacker))
        {
                // got frozen by an enemy
                // counted as "kill" and "death" already
@@ -280,15 +280,15 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerDies)
 
        if(frag_attacker == frag_target || frag_attacker == world)
        {
-               if(frag_target.classname == STR_PLAYER)
+               if(IS_PLAYER(frag_target))
                        centerprint(frag_target, "^1You froze yourself.\n");
                bprint("^7", frag_target.netname, "^1 froze himself.\n");
        }
        else
        {
-               if(frag_target.classname == STR_PLAYER)
+               if(IS_PLAYER(frag_target))
                        centerprint(frag_target, strcat("^1You were frozen by ^7", frag_attacker.netname, ".\n"));
-               if(frag_attacker.classname == STR_PLAYER)
+               if(IS_PLAYER(frag_attacker))
                        centerprint(frag_attacker, strcat("^2You froze ^7", frag_target.netname, ".\n"));
                bprint("^7", frag_target.netname, "^1 was frozen by ^7", frag_attacker.netname, ".\n");
        }
index 3be0b035272b013598402f91188aed6c003069b6..4611c60fe1ae768c404df2ff9f5446084a10eb67 100644 (file)
@@ -6,7 +6,7 @@
 float ka_ballcarrier_waypointsprite_visible_for_player(entity e) // runs on waypoints which are attached to ballcarriers, updates once per frame 
 {
        if(e.ballcarried)
-               if(other.classname == "spectator"
+               if(IS_SPEC(other)
                        return FALSE; // we don't want spectators of the ballcarrier to see the attached waypoint on the top of their screen
                
        // TODO: Make the ballcarrier lack a waypointsprite whenever they have the invisibility powerup
@@ -71,7 +71,7 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth
                return;
        }
        if(other.deadflag != DEAD_NO) { return; }
-       if(other.classname != "player"
+       if not(IS_PLAYER(other)
        {  // The ball just touched an object, most likely the world
                pointparticles(particleeffectnum("kaball_sparks"), self.origin, '0 0 0', 1);
                sound(self, CH_TRIGGER, "keepaway/touch.wav", VOL_BASE, ATTN_NORM);
@@ -161,7 +161,7 @@ void ka_DropEvent(entity plyr) // runs any time that a player is supposed to los
 
 void ka_Reset() // used to clear the ballcarrier whenever the match switches from warmup to normal
 {
-       if((self.owner) && (self.owner.classname == "player"))
+       if((self.owner) && (IS_PLAYER(self.owner)))
                ka_DropEvent(self.owner);
 
        ka_RespawnBall();
@@ -245,7 +245,7 @@ void havocbot_role_ka_collector()
 
 MUTATOR_HOOKFUNCTION(ka_Scoring)
 {
-       if((frag_attacker != frag_target) && (frag_attacker.classname == "player"))
+       if((frag_attacker != frag_target) && (IS_PLAYER(frag_attacker)))
        {
                if(frag_target.ballcarried) { // add to amount of times killing carrier
                        PlayerScore_Add(frag_attacker, SP_KEEPAWAY_CARRIERKILLS, 1);
index 592fa327cfb7af6ae6b413369dcc6759573523a2..6724cd8f16152d6bee55bd09fe23469a008b95e0 100644 (file)
@@ -70,7 +70,7 @@ float kh_key_dropped, kh_key_carried;
 
 float kh_KeyCarrier_waypointsprite_visible_for_player(entity e)  // runs all the time
 {
-       if(e.classname != "player" || self.team != e.team)
+       if(!IS_PLAYER(e) || self.team != e.team)
                if(!kh_tracking_enabled)
                        return FALSE;
 
@@ -161,7 +161,7 @@ void kh_Controller_Think()  // called a lot
                        //dprint(s, "\n");
 
                        FOR_EACH_PLAYER(e)
-                               if(clienttype(e) == CLIENTTYPE_REAL)
+                               if(IS_REAL_CLIENT(e))
                                        Send_CSQC_Centerprint_Generic(e, CPID_KH_MSG, s, self.kh_cp_duration, 0);
                }
                self.cnt -= 1;
@@ -422,7 +422,7 @@ void kh_Key_Damage(entity inflictor, entity attacker, float damage, float deatht
        if(vlen(force) <= 0)
                return;
        if(time > self.pushltime)
-               if(attacker.classname == "player")
+               if(IS_PLAYER(attacker))
                        self.team = attacker.team;
 }
 
@@ -457,7 +457,7 @@ void kh_Key_Touch()  // runs many, many times when a key has been dropped and ca
                // maybe start a shorter countdown?
        }
 
-       if(other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
        if(other.deadflag != DEAD_NO)
                return;
@@ -583,7 +583,7 @@ void kh_LoserTeam(float teem, entity lostkey)  // runs when a player pushes a fl
        attacker = world;
        if(lostkey.pusher)
                if(lostkey.pusher.team != teem)
-                       if(lostkey.pusher.classname == "player")
+                       if(IS_PLAYER(lostkey.pusher))
                                attacker = lostkey.pusher;
 
        players = keys = 0;
@@ -904,7 +904,7 @@ void kh_EnableTrackingDevice()  // runs after each round
        entity player;
 
        FOR_EACH_PLAYER(player)
-               if(clienttype(player) == CLIENTTYPE_REAL)
+               if(IS_REAL_CLIENT(player))
                        Send_CSQC_Centerprint_Generic_Expire(player, CPID_KH_MSG);
 
        kh_tracking_enabled = TRUE;
@@ -930,7 +930,7 @@ void kh_StartRound()  // runs at the start of each round
        }
 
        FOR_EACH_PLAYER(player)
-               if(clienttype(player) == CLIENTTYPE_REAL)
+               if(IS_REAL_CLIENT(player))
                        Send_CSQC_Centerprint_Generic_Expire(player, CPID_KH_MSG);
 
        for(i = 0; i < kh_teams; ++i)
@@ -1047,7 +1047,7 @@ MUTATOR_HOOKFUNCTION(kh_PlayerDies)
 {
        if(self == other)
                kh_Key_DropAll(self, TRUE);
-       else if(other.classname == "player")
+       else if(IS_PLAYER(other))
                kh_Key_DropAll(self, FALSE);
        else
                kh_Key_DropAll(self, TRUE);
index 62cfd01ad867250673f406bfc68ab7ea99841671..2dd1b3c2425a77684d0b8210bc7ca1b60997327d 100644 (file)
@@ -247,7 +247,7 @@ void football_touch(void)
                        self.nextthink = time + autocvar_g_nexball_delay_idle;
                return;
        }
-       if(other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
        if(other.health < 1)
                return;
@@ -287,7 +287,7 @@ void basketball_touch(void)
                football_touch();
                return;
        }
-       if(!self.cnt && other.classname == "player" && (other != self.nb_dropper || time > self.nb_droptime + autocvar_g_nexball_delay_collect))
+       if(!self.cnt && IS_PLAYER(other) && (other != self.nb_dropper || time > self.nb_droptime + autocvar_g_nexball_delay_collect))
        {
                if(other.health <= 0)
                        return;
@@ -326,7 +326,7 @@ void GoalTouch(void)
        else
                otherteam = 0;
 
-       if((isclient = ball.pusher.flags & FL_CLIENT))
+       if((isclient = IS_CLIENT(ball.pusher)))
                pname = ball.pusher.netname;
        else
                pname = "Someone (?)";
@@ -673,7 +673,7 @@ void W_Nexball_Touch(void)
        
        PROJECTILE_TOUCH;
        if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal)
-               if((ball = other.ballcarried) && (attacker.classname == "player"))
+               if((ball = other.ballcarried) && (IS_PLAYER(attacker)))
                {
                        other.velocity = other.velocity + normalize(self.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force;
                        other.flags &~= FL_ONGROUND;
@@ -905,7 +905,7 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
                                //tracebox(self.origin + self.view_ofs, '-2 -2 -2', '2 2 2', self.origin + self.view_ofs + v_forward * autocvar_g_nexball_safepass_maxdist);
                                crosshair_trace(self);
                                if( trace_ent && 
-                                       trace_ent.flags & FL_CLIENT &&
+                                       IS_CLIENT(trace_ent) &&
                                        trace_ent.deadflag == DEAD_NO &&
                                        trace_ent.team == self.team &&
                                        vlen(trace_ent.origin - self.origin) <= autocvar_g_nexball_safepass_maxdist )
index dd0152ed084311be37509b34e5471531386afdcc..21a95d0f7601bd310917e1122d876b94e4c00e51 100644 (file)
@@ -586,7 +586,7 @@ void onslaught_generator_damage(entity inflictor, entity attacker, float damage,
                {
                        // this is protected by a shield, so ignore the damage
                        if (time > self.pain_finished)
-                               if (attacker.classname == "player")
+                               if (IS_PLAYER(attacker))
                                {
                                        play2(attacker, "onslaught/damageblockedbyshield.wav");
                                        self.pain_finished = time + 1;
@@ -977,7 +977,7 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float
        {
                // this is protected by a shield, so ignore the damage
                if (time > self.pain_finished)
-                       if (attacker.classname == "player")
+                       if (IS_PLAYER(attacker))
                        {
                                play2(attacker, "onslaught/damageblockedbyshield.wav");
                                self.pain_finished = time + 1;
@@ -985,7 +985,7 @@ void onslaught_controlpoint_icon_damage(entity inflictor, entity attacker, float
                return;
        }
 
-       if (attacker.classname == "player")
+       if (IS_PLAYER(attacker))
        {
                nag = FALSE;
                if(self.team == COLOR_TEAM1)
@@ -1270,7 +1270,7 @@ void onslaught_controlpoint_touch()
 {
        entity e;
        float a;
-       if (other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
        a = onslaught_controlpoint_attackable(self, other.team);
        if(a != 2 && a != 4)
index b492ee60eb48add1046b6278fb171783bc85dea8..151428e8685b7a5730c61b3e7400d7eb95b88b5d 100644 (file)
@@ -205,7 +205,7 @@ MUTATOR_HOOKFUNCTION(nix_PlayerPreThink)
 {
        if(!intermission_running)
        if(self.deadflag == DEAD_NO)
-       if(self.classname == "player")
+       if(IS_PLAYER(self))
                NIX_GiveCurrentWeapon();
        return 0;
 }
index 0645b4805446b17cd1baafe035225d4b4793fceb..f66c9657e26540a26564d8cdc3f60468fa15932b 100644 (file)
@@ -129,9 +129,9 @@ MUTATOR_HOOKFUNCTION(superspec_ItemTouch)
                                (self.autospec_flags& ASF_FLAG_GRAB && _item.classname == "item_flag_team"))
                {
 
-                       if((self.enemy != other) || self.classname == "observer")
+                       if((self.enemy != other) || IS_OBSERVER(self))
                        {
-                               if(self.autospec_flags & ASF_OBSERVER_ONLY && self.classname != "observer")
+                               if(self.autospec_flags & ASF_OBSERVER_ONLY && !IS_OBSERVER(self))
                                {
                                        if(self.superspec_flags & SSF_VERBOSE)
                                                superspec_msg("", "", self, sprintf("^8Ignored that %s^8 grabbed %s^8 since the observer_only option is ON\n", other.netname, _item.netname), 2);
@@ -161,7 +161,7 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
        if(MUTATOR_RETURNVALUE) // command was already handled?
                return FALSE;
 
-       if(self.classname == "player")
+       if(IS_PLAYER(self))
                return FALSE;
 
        if(cmd_name == "superspec_itemfilter")
index c01a25bbdc8228807ab8602cbd83b8aeaa2dfbb8..a6e3d61e96824c813394cad6125eb98f8f3c95ce 100644 (file)
@@ -68,12 +68,12 @@ void PlayerStats_AddPlayer(entity e)
        s = string_null;
        if(e.crypto_idfp != "" && e.cvar_cl_allow_uidtracking == 1)
                s = e.crypto_idfp;
-       else if(clienttype(e) == CLIENTTYPE_BOT)
+       else if(IS_BOT_CLIENT(e))
                s = sprintf("bot#%g#%s", skill, e.cleanname);
 
        if((s == "") || find(world, playerstats_id, s)) // already have one of the ID - next one can't be tracked then!
        {
-               if(clienttype(e) == CLIENTTYPE_BOT)
+               if(IS_BOT_CLIENT(e))
                        s = sprintf("bot#%d", e.playerid);
                else
                        s = sprintf("player#%d", e.playerid);
@@ -353,7 +353,7 @@ void PlayerStats_AddGlobalInfo(entity p)
 
        db_put(playerstats_db, sprintf("%s:_playerid", p.playerstats_id), ftos(p.playerid));
 
-       if(p.cvar_cl_allow_uid2name == 1 || clienttype(p) == CLIENTTYPE_BOT)
+       if(p.cvar_cl_allow_uid2name == 1 || IS_BOT_CLIENT(p))
                db_put(playerstats_db, sprintf("%s:_netname", p.playerstats_id), p.netname);
 
        if(teamplay)
@@ -364,7 +364,7 @@ void PlayerStats_AddGlobalInfo(entity p)
 
        PlayerStats_Accuracy(p);
 
-       if(clienttype(p) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(p))
        {
                if(p.latency_cnt)
                {
index 3e83c972eece82f015fafae1804b1e6db6a0ddda..7fba081c4fca04b9a21d1fafc84349e253ac6bc5 100644 (file)
@@ -146,7 +146,7 @@ float Portal_TeleportPlayer(entity teleporter, entity player)
        //print(vtos(to), "\n");
 
        // ang_x stuff works around weird quake angles
-       if(player.classname == "player")
+       if(IS_PLAYER(player))
                ang = Portal_ApplyTransformToPlayerAngle(transform, player.v_angle);
        else
                ang = AnglesTransform_ApplyToAngles(transform, player.angles);
@@ -244,7 +244,7 @@ void Portal_Touch()
        if(self.solid != SOLID_TRIGGER)
                return; // possibly engine bug
 
-       if(other.classname == "player")
+       if(IS_PLAYER(other))
                return; // handled by think
 #endif
 
@@ -277,11 +277,11 @@ void Portal_Touch()
                        return;
                }
        if(other != self.aiment)
-               if(other.classname == "player")
+               if(IS_PLAYER(other))
                        if(IS_INDEPENDENT_PLAYER(other) || IS_INDEPENDENT_PLAYER(self.aiment))
                                return; // cannot go through someone else's portal
        if(other.aiment != self.aiment)
-               if(other.aiment.classname == "player")
+               if(IS_PLAYER(other.aiment))
                        if(IS_INDEPENDENT_PLAYER(other.aiment) || IS_INDEPENDENT_PLAYER(self.aiment))
                                return; // cannot go through someone else's portal
        fixedmakevectors(self.mangle);
@@ -479,7 +479,7 @@ void Portal_Think()
 
 float Portal_Customize()
 {
-       if(other.classname == "spectator")
+       if(IS_SPEC(other))
                other = other.enemy;
        if(other == self.aiment)
        {
index 2742888b6179bab1e088d5d4a222b778f01af3e2..53e91f00a85e053d70b42a4bfc4a0eca1296b5bc 100644 (file)
@@ -470,7 +470,7 @@ void checkpoint_passed()
        /*
         * Trigger targets
         */
-       if not((self.spawnflags & 2) && (other.classname == "player"))
+       if not((self.spawnflags & 2) && (IS_PLAYER(other)))
        {
                activator = other;
                oldmsg = self.message;
@@ -479,7 +479,7 @@ void checkpoint_passed()
                self.message = oldmsg;
        }
 
-       if(other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
 
        /*
index ba8f648c888b33e0e312cdf8774b3e1cd0169cad..1b6cc5dbb16266a3a585c0b0645edcb5c00a4afb 100644 (file)
@@ -168,7 +168,7 @@ void RuneCarriedThink()
        vector ang = '0 0 0';
        entity rune;
 
-       if(self.owner.classname != "player" || time < game_starttime)
+       if(!IS_PLAYER(self.owner) || time < game_starttime)
        {
                rune_respawn();
                return;
@@ -205,7 +205,7 @@ void rune_touch()
                return;
        }
 
-       if(other.classname != "player" || other.health < 1)
+       if(!IS_PLAYER(other) || other.health < 1)
                return;
        if(self.wait > time)
                return; // "notouch" time isn't finished
@@ -551,7 +551,7 @@ void RuneMatchGivePoints()
                if(!rune)
                        return;
 
-               if(rune.owner.classname == "player")
+               if(IS_PLAYER(rune.owner))
                {
                        UpdateFrags(rune.owner, autocvar_g_runematch_pointamt);
                }
index 0df5b69af06fbc09c3809ddca9604a3d51a0f412..5ccc212bdcee8da9cc4a2b0b5d52dc36249eb31e 100644 (file)
@@ -523,16 +523,16 @@ void WinningConditionHelper()
                if(fullstatus)
                {
                        s = GetPlayerScoreString(p, 1);
-                       if(clienttype(p) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(p))
                                s = strcat(s, ":human");
                        else
                                s = strcat(s, ":bot");
-                       if(p.classname != "player" && !g_arena && !g_ca && !g_lms)
+                       if(!IS_PLAYER(p) && !g_arena && !g_ca && !g_lms)
                                s = strcat(s, ":spectator");
                }
                else
                {
-                       if(p.classname == "player" || g_arena || g_ca || g_lms)
+                       if(IS_PLAYER(p) || g_arena || g_ca || g_lms)
                                s = GetPlayerScoreString(p, 2);
                        else
                                s = "-666";
@@ -894,7 +894,7 @@ void Score_NicePrint(entity to)
        
        t = 0;
        FOR_EACH_CLIENT(p)
-       if(p.classname != "player")
+       if not(IS_PLAYER(p))
        {
                if not(t)
                        Score_NicePrint_Spectators(to);
index 54d60a14b6ee5b20ad5b3ed5549896d6aae6029a..9af13eca28df58d6860bce3edda0c856efd20f66 100644 (file)
@@ -10,7 +10,7 @@ void secrets_setstatus() {
  */
 void trigger_secret_touch() {
        // only a player can trigger this
-       if (other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
        
        // update secrets found counter
index c91c1ac1895ecae9d49667175258f3b91b9f9486..c532f2ede0d8c391a9d5e9a350ce4b5a08bec70b 100644 (file)
@@ -176,9 +176,9 @@ void StartFrame (void)
                c_seen = 0;
                FOR_EACH_CLIENT(cl)
                {
-                       if(clienttype(cl) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(cl))
                                ++c_seeing;
-                       if(cl.classname == "player")
+                       if(IS_PLAYER(cl))
                                ++c_seen;
                }
                print("CEFC calls per second: ", ftos(c_seeing * (c_seen - 1) / t), "; ");
index bf70da0286a837b98fb68fb2adbff927f8d30254..407962ae6adbb61e0894e493dbcf6750feef779a 100644 (file)
@@ -627,7 +627,7 @@ float Item_GiveTo(entity item, entity player)
                        _switchweapon = TRUE;
 
                        // play some cool sounds ;)
-                       if (clienttype(player) == CLIENTTYPE_REAL)
+                       if (IS_REAL_CLIENT(player))
                        {
                                if(player.health <= 5)
                                        AnnounceTo(player, "lastsecond");
@@ -766,7 +766,7 @@ void Item_Touch (void)
                }
        }
 
-       if (other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
        if (other.deadflag)
                return;
@@ -1680,7 +1680,7 @@ void target_items_use (void)
                return;
        }
 
-       if(activator.classname != "player")
+       if not(IS_PLAYER(activator))
                return;
        if(activator.deadflag != DEAD_NO)
                return;
index 5a5042b3d48a63dc1a273feff50b33e767a7de8f..e3df3a759ef38752174cfbfd9c7b53b5ff50dc63 100644 (file)
@@ -164,7 +164,7 @@ void trigger_push_touch()
 
        other.flags &~= FL_ONGROUND;
 
-       if (other.classname == "player")
+       if (IS_PLAYER(other))
        {
                // reset tracking of oldvelocity for impact damage (sudden velocity changes)
                other.oldvelocity = other.velocity;
@@ -176,9 +176,7 @@ void trigger_push_touch()
                        sound (other, CH_TRIGGER, self.noise, VOL_BASE, ATTN_NORM);
                        self.pushltime = time + 0.2;
                }
-               float ct;
-               ct = clienttype(other);
-               if( ct == CLIENTTYPE_REAL || ct == CLIENTTYPE_BOT)
+               if(IS_REAL_CLIENT(other) || IS_BOT_CLIENT(other))
                {
                        float i;
                        float found;
@@ -192,7 +190,7 @@ void trigger_push_touch()
                                other.jumppadcount = other.jumppadcount + 1;
                        }
 
-                       if(ct == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(other))
                        {
                                if(self.message)
                                        centerprint(other, self.message);
index 0b9da88faf2b97fc524f472364bc2ae4f6dabc7f..300cbd940bb3f8b741b4c8450be4268759a6a21a 100644 (file)
@@ -642,12 +642,6 @@ void button_reset()
 
 void button_use()
 {
-//     if (activator.classname != "player")
-//     {
-//             dprint(activator.classname);
-//             dprint(" triggered a button\n");
-//     }
-
        if not (self.active == ACTIVE_ACTIVE)
                return;
 
@@ -657,11 +651,6 @@ void button_use()
 
 void button_touch()
 {
-//     if (activator.classname != "player")
-//     {
-//             dprint(activator.classname);
-//             dprint(" touched a button\n");
-//     }
        if (!other)
                return;
        if not(other.iscreature)
@@ -682,11 +671,6 @@ void button_damage(entity inflictor, entity attacker, float damage, float deatht
        self.health = self.health - damage;
        if (self.health <= 0)
        {
-       //      if (activator.classname != "player")
-       //      {
-       //              dprint(activator.classname);
-       //              dprint(" killed a button\n");
-       //      }
                self.enemy = damage_attacker;
                button_fire ();
        }
@@ -918,7 +902,7 @@ float door_check_keys(void) {
 
        // this door require a key
        // only a player can have a key
-       if (other.classname != "player")
+       if not(IS_PLAYER(other))
                return FALSE;
        
        if (item_keys_usekey(door, other)) {
@@ -1079,7 +1063,7 @@ Prints messages
 */
 void door_touch()
 {
-       if(other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
        if (self.owner.attack_finished_single > time)
                return;
@@ -1088,7 +1072,7 @@ void door_touch()
 
        if (!(self.owner.dmg) && (self.owner.message != ""))
        {
-               if (other.flags & FL_CLIENT)
+               if (IS_CLIENT(other))
                        centerprint (other, self.owner.message);
                play2(other, "misc/talk.wav");
        }
@@ -1761,7 +1745,7 @@ void secret_touch()
 
        if (self.message)
        {
-               if (other.flags & FL_CLIENT)
+               if (IS_CLIENT(other))
                        centerprint (other, self.message);
                play2(other, "misc/talk.wav");
        }
@@ -2110,7 +2094,7 @@ void conveyor_think()
 
                for(e = world; (e = findentity(e, conveyor, self)); )
                {
-                       if(e.flags & FL_CLIENT) // doing it via velocity has quite some advantages
+                       if(IS_CLIENT(e)) // doing it via velocity has quite some advantages
                                continue; // done in SV_PlayerPhysics
 
                        setorigin(e, e.origin + self.movedir * sys_frametime);
index 4f3e54420c227de13552c503f8de4bbbae9b3c6a..2a9d5427b639ed8fb8e0f0b14bfdc6782f18d670 100644 (file)
@@ -54,7 +54,7 @@ void swamp_touch(void)
 {
        // If whatever thats touching the swamp is not a player
        // or if its a dead player, just dont care abt it.
-       if((other.classname != "player")||(other.deadflag != DEAD_NO))
+       if(!IS_PLAYER(other) || other.deadflag != DEAD_NO)
                return;
 
        EXACTTRIGGER_TOUCH;
index 9a17d90c0c53bac0a71e9d2187f057f89add046a..2932ad68b143bed0b8d8cf342717592bc48eaa49 100644 (file)
@@ -29,12 +29,12 @@ void trigger_teleport_use()
 
 float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax)
 {
-       if (player.classname == "player" && player.health >= 1)
+       if (IS_PLAYER(player) && player.health >= 1)
        {
                TDEATHLOOP(org)
                {
                        if not(teamplay && autocvar_g_telefrags_teamplay && head.team == player.team)
-                               if(head.classname == "player")
+                               if(IS_PLAYER(head))
                                        if(head.health >= 1)
                                                return 1;
                }
@@ -46,11 +46,11 @@ void tdeath(entity player, entity teleporter, entity telefragger, vector telefra
 {
        TDEATHLOOP(player.origin)
        {
-               if (player.classname == "player" && player.health >= 1)
+               if (IS_PLAYER(player) && player.health >= 1)
                {
                        if not(teamplay && autocvar_g_telefrags_teamplay && head.team == player.team)
                        {
-                               if(head.classname == "player")
+                               if(IS_PLAYER(head))
                                        if(head.health >= 1)
                                                ++tdeath_hit;
                                Damage (head, teleporter, telefragger, 10000, DEATH_TELEFRAG, head.origin, '0 0 0');
@@ -119,7 +119,7 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
 
        UpdateCSQCProjectileAfterTeleport(player);
 
-       if(player.classname == "player")
+       if(IS_PLAYER(player))
        {
                if(tflags & TELEPORT_FLAG_TDEATH)
                        if(player.takedamage && player.deadflag == DEAD_NO && !g_race && !g_cts && (autocvar_g_telefrags || (tflags & TELEPORT_FLAG_FORCE_TDEATH)))
@@ -221,7 +221,7 @@ void Teleport_Touch (void)
 
        EXACTTRIGGER_TOUCH;
 
-       if(other.classname == "player")
+       if(IS_PLAYER(other))
                RemoveGrapplingHook(other);
                
        entity e;
@@ -346,7 +346,7 @@ void WarpZone_PostTeleportPlayer_Callback(entity pl)
                        print("A non-projectile got through a warpzone and its owner cleared. It's a ", pl.classname, ".\n");
                pl.owner = world;
        }
-       if(pl.classname == "player")
+       if(IS_PLAYER(pl))
        {
                // reset tracking of oldvelocity for impact damage (sudden velocity changes)
                pl.oldvelocity = pl.velocity;
index 1ed2f533b3a923c93981ef14ad5403eb847a0f25..163f71a099c7c0cba598d7d4ccc7282ced4f91e1 100644 (file)
@@ -517,7 +517,7 @@ void CheckAllowedTeams (entity for_whom)
                if(autocvar_bot_vs_human > 0)
                {
                        // bots are all blue
-                       if(clienttype(for_whom) == CLIENTTYPE_BOT)
+                       if(IS_BOT_CLIENT(for_whom))
                                c1 = c3 = c4 = -1;
                        else
                                c2 = -1;
@@ -525,7 +525,7 @@ void CheckAllowedTeams (entity for_whom)
                else
                {
                        // bots are all red
-                       if(clienttype(for_whom) == CLIENTTYPE_BOT)
+                       if(IS_BOT_CLIENT(for_whom))
                                c2 = c3 = c4 = -1;
                        else
                                c1 = -1;
@@ -563,7 +563,7 @@ void GetTeamCounts(entity ignore)
        FOR_EACH_CLIENT(head)
        {
                float t;
-               if(head.classname == "player")
+               if(IS_PLAYER(head))
                        t = head.team;
                else if(head.team_forced > 0)
                        t = head.team_forced; // reserve the spot
@@ -572,7 +572,7 @@ void GetTeamCounts(entity ignore)
                if(head != ignore)// && head.netname != "")
                {
                        value = PlayerValue(head);
-                       if(clienttype(head) == CLIENTTYPE_BOT)
+                       if(IS_BOT_CLIENT(head))
                                bvalue = value;
                        else
                                bvalue = 0;
@@ -653,7 +653,7 @@ float TeamSmallerEqThanTeam(float ta, float tb, entity e)
        if(ta == tb)
                return TRUE;
 
-       if(clienttype(e) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(e))
        {
                if(bots_would_leave)
                {
@@ -711,7 +711,7 @@ float FindSmallestTeam(entity pl, float ignore_pl)
 
        if(totalteams <= 1)
        {
-               if(autocvar_g_campaign && pl && clienttype(pl) == CLIENTTYPE_REAL)
+               if(autocvar_g_campaign && pl && IS_REAL_CLIENT(pl))
                        return 1; // special case for campaign and player joining
                else if(g_domination)
                        error("Too few teams available for domination\n");
@@ -894,7 +894,7 @@ void SV_ChangeTeam(float _color)
 
 //     bprint("allow change teams from ", ftos(steam), " to ", ftos(dteam), "\n");
 
-       if(self.classname == "player" && steam != dteam)
+       if(IS_PLAYER(self) && steam != dteam)
        {
                // reduce frags during a team change
                TeamchangeFrags(self);
@@ -902,7 +902,7 @@ void SV_ChangeTeam(float _color)
 
        SetPlayerTeam(self, dteam, steam, FALSE);
 
-       if(self.classname == "player" && steam != dteam)
+       if(IS_PLAYER(self) && steam != dteam)
        {
                // kill player when changing teams
                if(self.deadflag == DEAD_NO)
index 971d65cca3916eea9f99a17d28b5d41ee096211f..51fe9dfe7eb1b6df9594af2b8993c365b4c49eaa 100644 (file)
@@ -95,7 +95,7 @@ void turret_stdproc_damage (entity inflictor, entity attacker, float damage, flo
     if (self.team == attacker.team)
     {
         // This does not happen anymore. Re-enable if you fix that.
-        if(clienttype(attacker) == CLIENTTYPE_REAL)
+        if(IS_REAL_CLIENT(attacker))
             sprint(attacker, "\{1}Turret tells you: I'm on your team!\n");
 
         if(autocvar_g_friendlyfire)
index dd58b3cee2860e0c031dc131a47eab165c846967..7687f88626567051a0a3af2ea8c9388f02884321 100644 (file)
@@ -605,7 +605,7 @@ float turret_validate_target(entity e_turret, entity e_target, float validate_fl
         return -6;
 
     // player
-    if (e_target.flags & FL_CLIENT)
+    if (IS_CLIENT(e_target))
     {
         if not (validate_flags & TFL_TARGETSELECT_PLAYERS)
             return -7;
index c542dab401ba2ee88da3f88df7d7c57f48329478..539be2ad9e1b38257bcd66f247bf1e68c9803d45 100644 (file)
@@ -44,7 +44,7 @@ float turret_stdproc_targetscore_generic(entity _turret, entity _target)
     if ((_turret.target_select_missilebias > 0) && (_target.flags & FL_PROJECTILE))
         m_score = 1;
 
-    if ((_turret.target_select_playerbias > 0) && (_target.flags & FL_CLIENT))
+    if ((_turret.target_select_playerbias > 0) && IS_CLIENT(_target))
         p_score = 1;
 
     d_score = max(d_score, 0);
index 8676091f583aaaebf708b814ec7b415f7a9e8b17..c7d7396e8f7ce2d7641d8308baa9c7f914458716 100644 (file)
@@ -23,7 +23,7 @@ float hk_is_valid_target(entity e_target)
         return 0;
 
     // player
-    if (e_target.flags & FL_CLIENT)
+    if (IS_CLIENT(e_target))
     {
         if (self.owner.target_select_playerbias < 0)
             return 0;
index b9c7dbfb8339e406603dbbea763f63c28ea81c24..4c216e5a756fe038e807a04e355f9853b622714c 100644 (file)
@@ -214,9 +214,7 @@ float bumb_gunner_frame()
 
 void bumb_gunner_exit(float _exitflag)
 {
-
-
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
        {
                msg_entity = self;
                WriteByte(MSG_ONE, SVC_SETVIEWPORT);
@@ -341,7 +339,7 @@ float bumb_gunner_enter()
 
 float vehicles_valid_pilot()
 {
-       if(other.classname != "player")
+       if not(IS_PLAYER(other))
                return FALSE;
 
        if(other.deadflag != DEAD_NO)
@@ -350,7 +348,7 @@ float vehicles_valid_pilot()
        if(other.vehicle != world)
                return FALSE;
 
-       if(clienttype(other) != CLIENTTYPE_REAL)
+       if not(IS_REAL_CLIENT(other))
                if(!autocvar_g_vehicles_allow_bots)
                        return FALSE;
 
@@ -561,7 +559,7 @@ float bumb_pilot_frame()
                                                        if(autocvar_g_vehicle_bumblebee_healgun_hps)
                                                                trace_ent.vehicle_health = min(trace_ent.vehicle_health + autocvar_g_vehicle_bumblebee_healgun_hps * frametime, trace_ent.tur_health);
                                                }
-                                               else if(trace_ent.flags & FL_CLIENT)
+                                               else if(IS_CLIENT(trace_ent))
                                                {
                                                        if(trace_ent.health <= autocvar_g_vehicle_bumblebee_healgun_hmax && autocvar_g_vehicle_bumblebee_healgun_hps)
                                                                trace_ent.health = min(trace_ent.health + autocvar_g_vehicle_bumblebee_healgun_hps * frametime, autocvar_g_vehicle_bumblebee_healgun_hmax);
index 5e377079e01dd2fc0b1377fde2a884a17e50656a..76d4aec96a2692a151ec0fc56795a5765155f902 100644 (file)
@@ -46,7 +46,7 @@ float SendAuxiliaryXhair(entity to, float sf)
 
 void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, float axh_id)
 {
-    if (clienttype(own) != CLIENTTYPE_REAL)
+    if not(IS_REAL_CLIENT(own))
         return;
 
     entity axh;
@@ -101,7 +101,7 @@ void SendAuxiliaryXhair2(entity own, vector loc, vector clr, float axh_id)
 **/
 void CSQCVehicleSetup(entity own, float vehicle_id)
 {
-    if (clienttype(own) != CLIENTTYPE_REAL)
+    if not(IS_REAL_CLIENT(own))
         return;
        
        msg_entity = own;
@@ -503,11 +503,11 @@ void vehicles_spawn()
 // Better way of determening whats crushable needed! (fl_crushable?)
 float vehicles_crushable(entity e)
 {
-    if(e.classname == "player")
+    if(IS_PLAYER(e))
         return TRUE;
 
-    if(e.classname == "monster_zombie")
-        return TRUE;
+    if(e.flags & FL_MONSTER)
+        return TRUE; // more bitflags for everyone!
 
     return FALSE;
 }
@@ -556,7 +556,7 @@ void vehicles_touch()
         return;
     }
 
-    if(other.classname != "player")
+    if not(IS_PLAYER(other))
         return;
 
     if(other.deadflag != DEAD_NO)
@@ -572,7 +572,7 @@ void vehicles_enter()
 {
    // Remove this when bots know how to use vehicles
    
-    if (clienttype(other) == CLIENTTYPE_BOT)    
+    if (IS_BOT_CLIENT(other))    
         if (autocvar_g_vehicles_allow_bots)
             dprint("Bot enters vehicle\n"); // This is where we need to disconnect (some, all?) normal bot AI and hand over to vehicle's _aiframe()
         else
@@ -634,7 +634,7 @@ void vehicles_enter()
     self.team                 = self.owner.team;
     self.flags               -= FL_NOTARGET;
     
-    if (clienttype(other) == CLIENTTYPE_REAL)
+    if (IS_REAL_CLIENT(other))
     {
         msg_entity = other;
         WriteByte (MSG_ONE, SVC_SETVIEWPORT);
@@ -740,7 +740,7 @@ void vehicles_exit(float eject)
     }
     
     vehicles_exit_running = TRUE;
-    if(self.flags & FL_CLIENT)
+    if(IS_CLIENT(self))
     {
         _vehicle = self.vehicle;
             
@@ -761,7 +761,7 @@ void vehicles_exit(float eject)
 
     if (_player)
     {
-        if (clienttype(_player) == CLIENTTYPE_REAL)
+        if (IS_REAL_CLIENT(_player))
         {
             msg_entity = _player;
             WriteByte (MSG_ONE, SVC_SETVIEWPORT);
index 67f5b3356b056b0d63c071877068247b87376897..592fa7df35d86e9302bc6d15bae0e62a5fd6ff89 100644 (file)
@@ -12,7 +12,7 @@ void W_GiveWeapon (entity e, float wep, string name)
        self = e;
 
        if not(g_minstagib)
-       if (other.classname == "player")
+       if (IS_PLAYER(other))
        {
                sprint (other, "You got the ^2");
                sprint (other, name);
@@ -109,7 +109,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, f
        // Find all non-hit players the beam passed close by
        if(deathtype == WEP_MINSTANEX || deathtype == WEP_NEX)
        {
-               FOR_EACH_REALCLIENT(msg_entity) if(msg_entity != self) if(!msg_entity.railgunhit) if not(msg_entity.classname == "spectator" && msg_entity.enemy == self) // we use realclient, so spectators can hear the whoosh too
+               FOR_EACH_REALCLIENT(msg_entity) if(msg_entity != self) if(!msg_entity.railgunhit) if not(IS_SPEC(msg_entity) && msg_entity.enemy == self) // we use realclient, so spectators can hear the whoosh too
                {
                        // nearest point on the beam
                        beampos = start + dir * bound(0, (msg_entity.origin - start) * dir, length);
@@ -445,7 +445,7 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f
                lag = ANTILAG_LATENCY(self);
                if(lag < 0.001)
                        lag = 0;
-               if(clienttype(self) != CLIENTTYPE_REAL)
+               if not(IS_REAL_CLIENT(self))
                        lag = 0;
                if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
                        lag = 0; // only do hitscan, but no antilag
@@ -618,7 +618,7 @@ void W_PrepareExplosionByDamage(entity attacker, void() explode)
        self.takedamage = DAMAGE_NO;
        self.event_damage = func_null;
        
-       if((attacker.flags & FL_CLIENT) && !autocvar_g_projectiles_keep_owner)
+       if(IS_CLIENT(attacker) && !autocvar_g_projectiles_keep_owner)
        {
                self.owner = attacker;
                self.realowner = attacker;
index 082e454ace2de00516090a35270868346ba7a8c8..21f9d36639dcc6806cf6dd7330869aaab0e559d6 100644 (file)
@@ -29,7 +29,7 @@ void W_Plasma_TriggerCombo(vector org, float rad, entity own)
 void W_Plasma_Explode (void)
 {
        if(other.takedamage == DAMAGE_AIM)
-               if(other.classname == "player")
+               if(IS_PLAYER(other))
                        if(IsDifferentTeam(self.realowner, other))
                                if(other.deadflag == DEAD_NO)
                                        if(IsFlying(other))
index 508a8ba1a04123726fcc8b4ce490ed684f1404ef..ba0acc34408ad346fdd538ff0e4a7fd6fa7e2405 100644 (file)
@@ -28,7 +28,7 @@ void W_Fireball_Explode (void)
                // 2. bfg effect
                // NOTE: this cannot be made warpzone aware by design. So, better intentionally ignore warpzones here.
                for(e = findradius(self.origin, autocvar_g_balance_fireball_primary_bfgradius); e; e = e.chain)
-               if(e != self.realowner) if(e.takedamage == DAMAGE_AIM) if(e.classname != "player" || !self.realowner || IsDifferentTeam(e, self))
+               if(e != self.realowner) if(e.takedamage == DAMAGE_AIM) if(!IS_PLAYER(e) || !self.realowner || IsDifferentTeam(e, self))
                {
                        // can we see fireball?
                        traceline(e.origin + e.view_ofs, self.origin, MOVE_NORMAL, e);
@@ -73,7 +73,7 @@ void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage,
 
        RandomSelection_Init();
        for(e = WarpZone_FindRadius(self.origin, dist, TRUE); e; e = e.chain)
-       if(e != self.realowner) if(e.takedamage == DAMAGE_AIM) if(e.classname != "player" || !self.realowner || IsDifferentTeam(e, self))
+       if(e != self.realowner) if(e.takedamage == DAMAGE_AIM) if(!IS_PLAYER(e) || !self.realowner || IsDifferentTeam(e, self))
        {
                p = e.origin;
                p_x += e.mins_x + random() * (e.maxs_x - e.mins_x);
index 91b50fe7f76642cf336763a11243baa401a482d5..acde7d5c10f2d6c03bd117d2507db29bd47d3315 100644 (file)
@@ -8,7 +8,7 @@ REGISTER_WEAPON(GRENADE_LAUNCHER, w_glauncher, IT_ROCKETS, 4, WEP_FLAG_NORMAL |
 void W_Grenade_Explode (void)
 {
        if(other.takedamage == DAMAGE_AIM)
-               if(other.classname == "player")
+               if(IS_PLAYER(other))
                        if(IsDifferentTeam(self.realowner, other))
                                if(other.deadflag == DEAD_NO)
                                        if(IsFlying(other))
@@ -28,7 +28,7 @@ void W_Grenade_Explode (void)
 void W_Grenade_Explode2 (void)
 {
        if(other.takedamage == DAMAGE_AIM)
-               if(other.classname == "player")
+               if(IS_PLAYER(other))
                        if(IsDifferentTeam(self.realowner, other))
                                if(other.deadflag == DEAD_NO)
                                        if(IsFlying(other))
index 1b4f7c6cd06aa232811c06b67617006ba6f031d2..12d0a40f9c70626ba7a8dc5c33c0f576f0862d26 100644 (file)
@@ -61,7 +61,7 @@ void W_Mine_Stick (entity to)
 void W_Mine_Explode ()
 {
        if(other.takedamage == DAMAGE_AIM)
-               if(other.classname == "player")
+               if(IS_PLAYER(other))
                        if(IsDifferentTeam(self.realowner, other))
                                if(other.deadflag == DEAD_NO)
                                        if(IsFlying(other))
@@ -184,7 +184,7 @@ void W_Mine_Think (void)
 
        // a player's mines shall explode if he disconnects or dies
        // TODO: Do this on team change too -- Samual: But isn't a player killed when they switch teams?
-       if(self.realowner.classname != "player" || self.realowner.deadflag != DEAD_NO)
+       if(!IS_PLAYER(self.realowner) || self.realowner.deadflag != DEAD_NO)
        {
                other = world;
                self.projectiledeathtype |= HITTYPE_BOUNCE;
@@ -196,7 +196,7 @@ void W_Mine_Think (void)
        head = findradius(self.origin, autocvar_g_balance_minelayer_proximityradius);
        while(head)
        {
-               if(head.classname == "player" && head.deadflag == DEAD_NO)
+               if(IS_PLAYER(head) && head.deadflag == DEAD_NO)
                if(head != self.realowner && IsDifferentTeam(head, self.realowner)) // don't trigger for team mates
                if(!self.mine_time)
                {
@@ -227,7 +227,7 @@ void W_Mine_Touch (void)
 
        PROJECTILE_TOUCH;
 
-       if(other && other.classname == "player" && other.deadflag == DEAD_NO)
+       if(other && IS_PLAYER(other) && other.deadflag == DEAD_NO)
        {
                // hit a player
                // don't stick
@@ -427,7 +427,7 @@ float w_minelayer(float req)
                                        //As the distance gets larger, a correct detonation gets near imposible
                                        //Bots are assumed to use the mine spawnfunc_light to see if the mine gets near a player
                                        if(v_forward * normalize(mine.origin - self.enemy.origin)< 0.1)
-                                               if(self.enemy.classname == "player")
+                                               if(IS_PLAYER(self.enemy))
                                                        if(desirabledamage >= 0.1*coredamage)
                                                                if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
                                                                        self.BUTTON_ATCK2 = TRUE;
index add0207d12b57c8fd1ec90abd776143407bef84a..456d24907986c1cb442e53a8886e6565b707607d 100644 (file)
@@ -19,7 +19,7 @@ void W_Rocket_Explode ()
        W_Rocket_Unregister();
 
        if(other.takedamage == DAMAGE_AIM)
-               if(other.classname == "player")
+               if(IS_PLAYER(other))
                        if(IsDifferentTeam(self.realowner, other))
                                if(other.deadflag == DEAD_NO)
                                        if(IsFlying(other))
@@ -348,7 +348,7 @@ float w_rlauncher(float req)
                                        //As the distance gets larger, a correct detonation gets near imposible
                                        //Bots are assumed to use the rocket spawnfunc_light to see if the rocket gets near a player
                                        if(v_forward * normalize(missile.origin - self.enemy.origin)< 0.1)
-                                               if(self.enemy.classname == "player")
+                                               if(IS_PLAYER(self.enemy))
                                                        if(desirabledamage >= 0.1*coredamage)
                                                                if(random()/distance*300 > frametime*bound(0,(10-skill)*0.2,1))
                                                                        self.BUTTON_ATCK2 = TRUE;
index a4d4139700d8315d7d0afa53c88095590a0588a1..89e94198ca33c8520574ecc7be536411792453ba 100644 (file)
@@ -91,7 +91,7 @@ void shotgun_meleethink (void)
                //te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5); 
                //te_customflash(targpos, 40,  2, '1 1 1');
                
-               is_player = (trace_ent.classname == "player" || trace_ent.classname == "body");
+               is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body");
 
                if((trace_fraction < 1) // if trace is good, apply the damage and remove self
                        && (trace_ent.takedamage == DAMAGE_AIM)  
index 0e6f2168b863b50c94a7c49dd20659a9315ed879..c452684434b3c0e22fc4063e2d4ebd9bddf44039 100644 (file)
@@ -197,7 +197,7 @@ float WaypointSprite_visible_for_player(entity e)
        {
                if(self.team != e.team)
                        return FALSE;
-               if(e.classname != "player")
+               if not(IS_PLAYER(e))
                        return FALSE;
        }
 
@@ -206,7 +206,7 @@ float WaypointSprite_visible_for_player(entity e)
 
 entity WaypointSprite_getviewentity(entity e)
 {
-       if(e.classname == "spectator")
+       if(IS_SPEC(e))
                e = e.enemy;
        /* TODO idea (check this breaks nothing)
        else if(e.classname == "observer")
@@ -241,7 +241,7 @@ float WaypointSprite_Customize()
        // as a GENERAL rule:
        // if you have the invisibility powerup, sprites ALWAYS are restricted to your team
        // but only apply this to real players, not to spectators
-       if(g_minstagib && (self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other))
+       if(g_minstagib && IS_CLIENT(self.owner) && (self.owner.items & IT_STRENGTH) && (e == other))
        {
                if(!WaypointSprite_isteammate(self.owner, e))
                        return FALSE;
index 4b9c2bc474e76ba0d04675390648e6ea96666ddd..25bcd2901f9e449cffa4a1274a99b19c78936a7f 100644 (file)
@@ -31,7 +31,7 @@ void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector
 
        BITXOR_ASSIGN(player.effects, EF_TELEPORT_BIT);
 
-       if(player.classname == "player")
+       if(IS_PLAYER(player))
                BITCLR_ASSIGN(player.flags, FL_ONGROUND);
 
        WarpZone_PostTeleportPlayer_Callback(player);
@@ -56,7 +56,7 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
 
        o10 = o1 = WarpZone_TransformOrigin(wz, o0);
        v1 = WarpZone_TransformVelocity(wz, v0);
-       if(clienttype(player) != CLIENTTYPE_NOTACLIENT)
+       if not(IS_NOT_A_CLIENT(player))
                a1 = WarpZone_TransformVAngles(wz, player.v_angle);
        else
                a1 = WarpZone_TransformAngles(wz, a0);
@@ -116,7 +116,7 @@ float WarpZone_Teleport(entity wz, entity player, float f0, float f1)
                player.warpzone_teleport_finishtime += sys_frametime - dt;
 
 #ifndef WARPZONE_USE_FIXANGLE
-       if(player.classname == "player")
+       if(IS_PLAYER(player))
        {
                // instead of fixangle, send the transform to the client for smoother operation
                player.fixangle = FALSE;
@@ -172,7 +172,7 @@ void WarpZone_Touch (void)
        //       96*frametime
        float d;
        d = 24 + max(vlen(other.mins), vlen(other.maxs));
-       if(clienttype(other) == CLIENTTYPE_NOTACLIENT)
+       if(IS_NOT_A_CLIENT(other))
                f = -d / bound(frametime * d * 1, frametime * vlen(other.velocity), d);
        else
                f = -1;
@@ -810,8 +810,7 @@ void WarpZone_StartFrame()
        {
                if(warpzone_warpzones_exist) { WarpZone_StoreProjectileData(e); }
                
-               float f = clienttype(e);
-               if(f == CLIENTTYPE_REAL)
+               if(IS_REAL_CLIENT(e))
                {
                        if(e.solid == SOLID_NOT) // not spectating?
                        if(e.movetype == MOVETYPE_NOCLIP || e.movetype == MOVETYPE_FLY || e.movetype == MOVETYPE_FLY_WORLDONLY) // not spectating? (this is to catch observers)
@@ -834,7 +833,7 @@ void WarpZone_StartFrame()
                        }
                }
                
-               if(f == CLIENTTYPE_NOTACLIENT)
+               if(IS_NOT_A_CLIENT(e))
                {
                        if(warpzone_warpzones_exist)
                                for(; (e = nextent(e)); )
@@ -850,8 +849,8 @@ void WarpZone_StartFrame()
 float visible_to_some_client(entity ent)
 {
        entity e;
-       for(e = nextent(world); clienttype(e) != CLIENTTYPE_NOTACLIENT; e = nextent(e))
-               if(e.classname == "player" && clienttype(e) == CLIENTTYPE_REAL)
+       for(e = nextent(world); !IS_NOT_A_CLIENT(e); e = nextent(e))
+               if(IS_PLAYER(e) && IS_REAL_CLIENT(e))
                        if(checkpvs(e.origin + e.view_ofs, ent))
                                return 1;
        return 0;
@@ -894,7 +893,7 @@ void spawnfunc_target_warpzone_reconnect()
 void WarpZone_PlayerPhysics_FixVAngle(void)
 {
 #ifndef WARPZONE_DONT_FIX_VANGLE
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
        if(self.v_angle_z <= 360) // if not already adjusted
        if(time - self.ping * 0.001 < self.warpzone_teleport_time)
        {