]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/master' into Mario/rainbow_crosshair
authorSamual Lenks <samual@xonotic.org>
Sat, 11 May 2013 23:56:42 +0000 (19:56 -0400)
committerSamual Lenks <samual@xonotic.org>
Sat, 11 May 2013 23:56:42 +0000 (19:56 -0400)
88 files changed:
defaultXonotic.cfg
gfx/hud/default/weaponlaser.tga
gfx/hud/default/weaponminstanex.tga
gfx/hud/luminos/weaponlaser.tga
gfx/hud/luminos/weaponminstanex.tga
qcsrc/client/scoreboard.qc
qcsrc/common/deathtypes.qh
qcsrc/common/notifications.qh
qcsrc/csqcmodellib/sv_model.qc
qcsrc/menu/item/label.c
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.c
qcsrc/menu/xonotic/dialog_settings_user.c
qcsrc/server/accuracy.qc
qcsrc/server/attic/assault.qc
qcsrc/server/attic/runematch.qc
qcsrc/server/autocvars.qh
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_impulse.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/defs.qh
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/base.qh
qcsrc/server/mutators/gamemode_ca.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_lms.qc
qcsrc/server/mutators/gamemode_lms.qh
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/mutators/gamemode_onslaught.qc
qcsrc/server/mutators/mutator_minstagib.qc [new file with mode: 0644]
qcsrc/server/mutators/mutator_nix.qc
qcsrc/server/mutators/mutator_superspec.qc
qcsrc/server/mutators/mutator_vampire.qc
qcsrc/server/mutators/mutators.qh
qcsrc/server/playerstats.qc
qcsrc/server/portals.qc
qcsrc/server/progs.src
qcsrc/server/race.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_laser.qc
qcsrc/server/w_minelayer.qc
qcsrc/server/w_minstanex.qc
qcsrc/server/w_rocketlauncher.qc
qcsrc/server/w_shotgun.qc
qcsrc/server/waypointsprites.qc
qcsrc/warpzonelib/server.qc
vehicles.cfg

index de83c9ae57901fc412fcbc804a1a5eae42de5be0..0a66a907846e277ca75aca6bccdbe8e2ef322375 100644 (file)
@@ -374,7 +374,7 @@ set g_powerups -1 "if set to 0 the strength and shield (invincibility) will not
 set g_use_ammunition 1 "if set to 0 all weapons have unlimited ammunition"
 set g_pickup_items -1 "if set to 0 all items (health, armor, ammo, weapons...) are removed from the map, if 1 they are forced to spawn"
 set g_minstagib 0      "enable minstagib"
-set g_minstagib_extralives 2   "how many extra lives you will get per powerup"
+set g_minstagib_extralives 1   "how many extra lives you will get per powerup"
 set g_minstagib_ammo_start 10  "starting ammo"
 set g_minstagib_ammo_drop 5    "how much ammo you'll get for weapons or cells"
 set g_minstagib_invis_alpha 0.15
@@ -959,7 +959,7 @@ seta scoreboard_border_thickness 1 "scoreboard border thickness"
 seta scoreboard_accuracy_border_thickness 1 "accuracy stats border thickness"
 seta scoreboard_accuracy_doublerows 0 "use two rows instead of one"
 seta scoreboard_accuracy_nocolors 0 "don't use colors displaying accuracy stats"
-seta scoreboard_accuracy 1 "show weapon accuracy stats panel on scoreboard; colors can be configured with accuracy_color* cvars"
+seta scoreboard_accuracy 0 "show weapon accuracy stats panel on scoreboard; colors can be configured with accuracy_color* cvars"
 seta scoreboard_color_bg_r 0 "red color component of the scoreboard background"
 seta scoreboard_color_bg_g 0.4 "green color component of the scoreboard background"
 seta scoreboard_color_bg_b 0.6 "blue color component of the scoreboard background"
index 0afbb37d48124bb6f9b9a4f82998c45a1dcb43d4..f384a2c3000c27fbea425f23165e662c0f301bb5 100644 (file)
Binary files a/gfx/hud/default/weaponlaser.tga and b/gfx/hud/default/weaponlaser.tga differ
index 3618778729fc6918db40260e421f6cbf86ab842e..3bd2ae2d7aabe4270483aa1ac0c5016df50d6ccc 100644 (file)
Binary files a/gfx/hud/default/weaponminstanex.tga and b/gfx/hud/default/weaponminstanex.tga differ
index 0afbb37d48124bb6f9b9a4f82998c45a1dcb43d4..f384a2c3000c27fbea425f23165e662c0f301bb5 100644 (file)
Binary files a/gfx/hud/luminos/weaponlaser.tga and b/gfx/hud/luminos/weaponlaser.tga differ
index 3618778729fc6918db40260e421f6cbf86ab842e..3bd2ae2d7aabe4270483aa1ac0c5016df50d6ccc 100644 (file)
Binary files a/gfx/hud/luminos/weaponminstanex.tga and b/gfx/hud/luminos/weaponminstanex.tga differ
index 2ec7db0623025d7bc813afae95a299956a0fd63c..69d9a3c948e5b1bd851d21fbb7570d39c8f2d7cd 100644 (file)
@@ -947,7 +947,6 @@ float HUD_WouldDrawScoreboard() {
        return 0;
 }
 
-float g_minstagib;
 float average_accuracy;
 vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
 {
@@ -962,6 +961,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        float fontsize = height * 1/3;
        float weapon_height = height * 2/3;
        float weapon_width = sbwidth / weapon_cnt;
+       float g_minstagib = 0;
 
        drawstring(pos, sprintf(_("Accuracy stats (average %d%%)"), average_accuracy), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
        pos_y += 1.25 * hud_fontsize_y + autocvar_scoreboard_border_thickness;
index ca13f15a063e2fc674465312ebe1b600a1e88bd3..f9a9ceba25b1e0df2da7e77db433f5982e644b99 100644 (file)
@@ -69,7 +69,7 @@ entity deathtypes[DT_MAX];
                CHECK_MAX_COUNT(name, DT_MAX, DT_COUNT, "deathtypes") \
                \
                entity deathent = spawn(); \
-               deathtypes[(name - DT_FIRST) - 1] = deathent; \
+               deathtypes[(name - DT_FIRST)] = deathent; \
                deathent.classname = "deathtype"; \
                deathent.nent_name = #name; \
                #if (msg_death != NO_MSG) \
@@ -96,7 +96,7 @@ string Deathtype_Name(float deathtype)
 {
        if(DEATH_ISSPECIAL(deathtype))
        {
-               entity deathent = deathtypes[(deathtype - DT_FIRST) - 1];
+               entity deathent = deathtypes[(deathtype - DT_FIRST)];
                if not(deathent) { backtrace("Deathtype_Name: Could not find deathtype entity!\n"); return ""; }
                return deathent.nent_name;
        }
index d1aeba001e5e2f6a4c36c5d03a8c1f2f8117febd..42f1b9b162fb2bc665ad6775ecbdbe767158573a 100644 (file)
@@ -529,6 +529,8 @@ void Send_Notification_WOVA(
        MSG_CENTER_NOTIF(1, CENTER_LMS_CAMPCHECK,               0, 0, "",              CPID_LMS_CAMP,         "0 0", _("^F2Don't camp!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_MINSTA_FINDAMMO,             0, 0, "",              CPID_MINSTA_FINDAMMO,  "1 9", _("^F4^COUNT^BG left to find some ammo!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_MINSTA_FINDAMMO_FIRST,       0, 0, "",              CPID_MINSTA_FINDAMMO,  "1 10", _("^BGGet some ammo or you'll be dead in ^F4^COUNT^BG!"), _("^BGGet some ammo! ^F4^COUNT^BG left!")) \
+       MSG_CENTER_NOTIF(1, CENTER_MINSTA_LIVES_REMAINING,      0, 1, "f1",            NO_CPID,                           "0 0", _("^F2Extra lives remaining: ^K1%s"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_MINSTA_SECONDARY,            0, 0, "",              NO_CPID,                           "0 0", _("^BGSecondary fire inflicts no damage!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_MOTD,                        1, 0, "s1",            CPID_MOTD,             "-1 0", _("^BG%s"), "") \
        MSG_CENTER_NOTIF(1, CENTER_NIX_COUNTDOWN,               0, 2, "item_wepname",  CPID_NIX,              "1 f2", _("^F2^COUNT^BG until weapon change...\nNext weapon: ^F1%s"), "") \
        MSG_CENTER_NOTIF(1, CENTER_NIX_NEWWEAPON,               0, 1, "item_wepname",  CPID_NIX,              "0 0", _("^F2Active weapon: ^F1%s"), "") \
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 378e74adbcb1268ddaa34d7c33af0bb9031bce2e..5d0e7437fa8de17e77b93e7514918077cc6019eb 100644 (file)
@@ -8,6 +8,7 @@ CLASS(Label) EXTENDS(Item)
        METHOD(Label, recalcPositionWithText, void(entity, string))
        ATTRIB(Label, isBold, float, 0)
        ATTRIB(Label, text, string, string_null)
+       ATTRIB(Label, currentText, string, string_null)
        ATTRIB(Label, fontSize, float, 8)
        ATTRIB(Label, align, float, 0.5)
        ATTRIB(Label, allowCut, float, 0)
@@ -39,7 +40,13 @@ string Label_toString(entity me)
 void Label_setText(entity me, string txt)
 {
        me.text = txt;
-       me.recalcPos = 1;
+       if(txt != me.currentText)
+       {
+               if(me.currentText)
+                       strunzone(me.currentText);
+               me.currentText = strzone(txt);
+               me.recalcPos = 1;
+       }
 }
 void Label_recalcPositionWithText(entity me, string t)
 {
@@ -146,7 +153,13 @@ void Label_draw(entity me)
        if(me.textEntity)
        {
                t = me.textEntity.toString(me.textEntity);
-               me.recalcPos = 1;
+               if(t != me.currentText)
+               {
+                       if(me.currentText)
+                               strunzone(me.currentText);
+                       me.currentText = strzone(t);
+                       me.recalcPos = 1;
+               }
        }
        else
                t = me.text;
index 40fb4cca5e8786ef45a64e6a3cbe6b80c723598c..d0a8f6bc76a199ca49e1091fd1a4351b0f38f2e2 100644 (file)
@@ -172,6 +172,7 @@ void XonoticMutatorsDialog_fill(entity me)
        me.TR(me);
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_vampire", _("Vampire")));
+                       setDependent(e, "g_minstagib", 0, 0);
        me.TR(me);
                me.TDempty(me, 0.2);
                s = makeXonoticSlider(10, 50, 1, "g_bloodloss");
@@ -201,6 +202,7 @@ void XonoticMutatorsDialog_fill(entity me)
        me.TR(me);
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_invincible_projectiles", _("Invincible Projectiles")));
+                       setDependent(e, "g_minstagib", 0, 0);
        me.TR(me);
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_new_toys", _("New Toys")));
@@ -208,6 +210,7 @@ void XonoticMutatorsDialog_fill(entity me)
        me.TR(me);
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_rocket_flying", _("Rocket Flying")));
+                       setDependent(e, "g_minstagib", 0, 0);
        me.TR(me);
                me.TDempty(me, 0.2);
                me.TD(me, 1, 1.8, e = makeXonoticCheckBox(0, "g_pinata", _("Piñata")));
index 9a1710a9f5bbe8635bcf665281dcd9cdafc621d8..a3b89744b9fbc30b6ef44cb3489c386e6ce9c460 100644 (file)
@@ -61,17 +61,17 @@ void XonoticUserSettingsTab_fill(entity me)
                        e.onClick = SetLanguage_Click;
                        e.onClickEntity = sk;*/
                        
-       me.gotoRC(me, 0, 3.1); me.setFirstColumn(me, me.currentColumn);
+       me.gotoRC(me, 0, 2.85); me.setFirstColumn(me, me.currentColumn);
                me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Text language:")));
        me.TR(me);
-               me.TD(me, 6, 1, sk = makeXonoticLanguageList());
+               me.TD(me, 6, 1.5, sk = makeXonoticLanguageList());
        me.TR(me);
        me.TR(me);
        me.TR(me);
        me.TR(me);
        me.TR(me);
        me.TR(me);
-               me.TD(me, 1, 1, e = makeXonoticButton(_("Set language"), '0 0 0'));
+               me.TD(me, 1, 1.5, e = makeXonoticButton(_("Set language"), '0 0 0'));
                        e.onClick = SetLanguage_Click;
                        e.onClickEntity = sk;
                
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 7a5662c9799fb51f738b7293a3e5ce04f9a99f44..71ac7239a675a75f93a2dc33334dd4b66ed5c6c3 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 == NUM_TEAM_1)
                                ent.team_saved = NUM_TEAM_2;
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 efb9f8c17a240cfdd5869f6a074a7cb15fd2383b..d1603c0af1c3014b57fdc64750cfef9e7d5aaa58 100644 (file)
@@ -57,6 +57,7 @@ float autocvar_bot_sound_monopoly;
 #define autocvar_bot_suffix cvar_string("bot_suffix")
 float autocvar_bot_usemodelnames;
 float autocvar_bot_vs_human;
+float autocvar_bot_debug;
 float autocvar_bot_debug_tracewalk;
 float autocvar_bot_debug_goalstack;
 float autocvar_bot_wander_enable;
@@ -898,6 +899,7 @@ float autocvar_g_midair_shieldtime;
 float autocvar_g_minstagib_ammo_drop;
 float autocvar_g_minstagib_extralives;
 float autocvar_g_minstagib_speed_highspeed;
+float autocvar_g_minstagib_invis_alpha;
 #define autocvar_g_mirrordamage cvar("g_mirrordamage")
 #define autocvar_g_mirrordamage_virtual cvar("g_mirrordamage_virtual")
 
index cb42aa5c2c4b0b158697b4122a51c27e88543d7d..578306c4eb89c49c6e69707f07c6750273965601 100644 (file)
@@ -126,7 +126,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)
@@ -135,11 +135,13 @@ float bot_shouldattack(entity e)
                return FALSE;
        if (e.BUTTON_CHAT)
                return FALSE;
-       if(g_minstagib)
-       if(e.items & IT_STRENGTH)
-               return FALSE;
        if(e.flags & FL_NOTARGET)
                return FALSE;
+               
+       checkentity = e;
+       if(MUTATOR_CALLHOOK(BotShouldAttack))
+               return FALSE;
+               
        return TRUE;
 }
 
index f6e7f6f1b6921f5745982030050f76e1f350cee4..b45f35aa8fffb0d80b2e1b700f6636f7153e25ef 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 || head.caplayer == 1)
+               if(IS_PLAYER(head) || g_lms || g_arena || head.caplayer == 1)
                        ++activerealplayers;
                ++realplayers;
        }
index 0b8bac7333ee49ce8807733056a810a888c6fdfd..a9a3ea9f62b29796504d03eb5167b7218c2d748c 100644 (file)
@@ -106,7 +106,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);
                }
        }
@@ -260,7 +260,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;
@@ -540,7 +540,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;
                }
        }
@@ -805,7 +805,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 a54874786cf6df38f2f87cbf267ba88970d5fc79..17b80224d5ed98f5f8b3c4c6245cc405418b0057 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..5c60050cf1c674fb4f6e8694b346e87d9122857a 100644 (file)
@@ -1,3 +1,11 @@
+void bot_debug(string input)
+{
+       switch(autocvar_bot_debug)
+       {
+               case 1: dprint(input); break;
+               case 2: print(input); break;
+       }
+}
 
 // rough simulation of walking from one point to another to test if a path
 // can be traveled, used for waypoint linking and havocbot
@@ -674,7 +682,7 @@ void navigation_routerating(entity e, float f, float rangebias)
        {
                vector pointa, pointb;
 
-       //      dprint("jetpack ai: evaluating path for ", e.classname,"\n");
+               bot_debug(strcat("jetpack ai: evaluating path for ", e.classname, "\n"));
 
                // Point A
                traceline(self.origin, self.origin + '0 0 65535', MOVE_NORMAL, self);
@@ -689,7 +697,7 @@ void navigation_routerating(entity e, float f, float rangebias)
 
                if(trace_fraction==1)
                {
-               //      dprint("jetpack ai: can bridge these two points\n");
+                       bot_debug("jetpack ai: can bridge these two points\n");
 
                        // Lower the altitude of these points as much as possible
                        float zdistance, xydistance, cost, t, fuel;
@@ -725,8 +733,8 @@ void navigation_routerating(entity e, float f, float rangebias)
                        t = zdistance / autocvar_g_jetpack_maxspeed_up;
                        t += xydistance / autocvar_g_jetpack_maxspeed_side;
                        fuel = t * autocvar_g_jetpack_fuel * 0.8;
-
-               //      dprint("jetpack ai: required fuel ", ftos(fuel), " self.ammo_fuel ", ftos(self.ammo_fuel),"\n");
+                       
+                       bot_debug(strcat("jetpack ai: required fuel ", ftos(fuel), " self.ammo_fuel ", ftos(self.ammo_fuel), "\n"));
 
                        // enough fuel ?
                        if(self.ammo_fuel>fuel)
@@ -744,7 +752,7 @@ void navigation_routerating(entity e, float f, float rangebias)
 
                                if (navigation_bestrating < f)
                                {
-                       //              dprint("jetpack path: added goal", e.classname, " (with rating ", ftos(f), ")\n");
+                                       bot_debug(strcat("jetpack path: added goal ", e.classname, " (with rating ", ftos(f), ")\n"));
                                        navigation_bestrating = f;
                                        navigation_bestgoal = e;
                                        self.navigation_jetpack_goal = e;
@@ -790,7 +798,7 @@ void navigation_routerating(entity e, float f, float rangebias)
                                e.nearestwaypoint = nwp;
                        else
                        {
-                               dprint("FAILED to find a nearest waypoint to '", e.classname, "' #", etos(e), "\n");
+                               bot_debug(strcat("FAILED to find a nearest waypoint to '", e.classname, "' #", etos(e), "\n"));
 
                                if(e.flags & FL_ITEM)
                                        e.blacklisted = TRUE;
@@ -802,7 +810,7 @@ void navigation_routerating(entity e, float f, float rangebias)
 
                                if(e.blacklisted)
                                {
-                                       dprint("The entity '", e.classname, "' is going to be excluded from path finding during this match\n");
+                                       bot_debug(strcat("The entity '", e.classname, "' is going to be excluded from path finding during this match\n"));
                                        return;
                                }
                        }
@@ -816,23 +824,21 @@ void navigation_routerating(entity e, float f, float rangebias)
                nwp = e.nearestwaypoint;
        }
 
-       //dprint("-- checking ", e.classname, " (with cost ", ftos(nwp.wpcost), ")\n");
+       bot_debug(strcat("-- checking ", e.classname, " (with cost ", ftos(nwp.wpcost), ")\n"));
        if (nwp)
        if (nwp.wpcost < 10000000)
        {
                //te_wizspike(nwp.wpnearestpoint);
-       //      dprint(e.classname, " ", ftos(f), "/(1+", ftos((nwp.wpcost + vlen(e.origin - nwp.wpnearestpoint))), "/", ftos(rangebias), ") = ");
+               bot_debug(strcat(e.classname, " ", ftos(f), "/(1+", ftos((nwp.wpcost + vlen(e.origin - nwp.wpnearestpoint))), "/", ftos(rangebias), ") = "));
                f = f * rangebias / (rangebias + (nwp.wpcost + vlen(o - nwp.wpnearestpoint)));
-               //dprint("considering ", e.classname, " (with rating ", ftos(f), ")\n");
-               //dprint(ftos(f));
+               bot_debug(strcat("considering ", e.classname, " (with rating ", ftos(f), ")\n"));
                if (navigation_bestrating < f)
                {
-               //      dprint("ground path: added goal ", e.classname, " (with rating ", ftos(f), ")\n");
+                       bot_debug(strcat("ground path: added goal ", e.classname, " (with rating ", ftos(f), ")\n"));
                        navigation_bestrating = f;
                        navigation_bestgoal = e;
                }
        }
-       //dprint("\n");
 }
 
 // adds an item to the the goal stack with the path to a given item
@@ -911,7 +917,7 @@ void navigation_poptouchedgoals()
        if(checkpvs(self.origin + self.view_ofs, self.goalstack01))
        if(tracewalk(self, self.origin, self.mins, self.maxs, (self.goalstack01.absmin + self.goalstack01.absmax) * 0.5, bot_navigation_movemode))
        {
-       ///     dprint("path optimized for ", self.netname, ", removed a goal from the queue\n");
+               bot_debug(strcat("path optimized for ", self.netname, ", removed a goal from the queue\n"));
                navigation_poproute();
                // TODO this may also be a nice idea to do "early" (e.g. by
                // manipulating the vlen() comparisons) to shorten paths in
@@ -923,7 +929,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)
@@ -988,7 +994,7 @@ void navigation_goalrating_end()
                return;
 
        navigation_routetogoal(navigation_bestgoal, self.origin);
-//     dprint("best goal ", self.goalcurrent.classname , "\n");
+       bot_debug(strcat("best goal ", self.goalcurrent.classname , "\n"));
 
        // If the bot got stuck then try to reach the farthest waypoint
        if not (self.navigation_hasgoals)
@@ -996,7 +1002,7 @@ void navigation_goalrating_end()
        {
                if not(self.aistatus & AI_STATUS_STUCK)
                {
-                       dprint(self.netname, " cannot walk to any goal\n");
+                       bot_debug(strcat(self.netname, " cannot walk to any goal\n"));
                        self.aistatus |= AI_STATUS_STUCK;
                }
 
@@ -1051,7 +1057,7 @@ void navigation_unstuck()
 
        if not(bot_waypoint_queue_owner)
        {
-       //      dprint(self.netname, " sutck, taking over the waypoints queue\n");
+               bot_debug(strcat(self.netname, " sutck, taking over the waypoints queue\n"));
                bot_waypoint_queue_owner = self;
                bot_waypoint_queue_bestgoal = world;
                bot_waypoint_queue_bestgoalrating = 0;
@@ -1064,7 +1070,7 @@ void navigation_unstuck()
        {
                // evaluate the next goal on the queue
                float d = vlen(self.origin - bot_waypoint_queue_goal.origin);
-               // dprint(self.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d), "\n");
+               bot_debug(strcat(self.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d), "\n"));
                if(tracewalk(bot_waypoint_queue_goal, self.origin, PL_MIN, PL_MAX, bot_waypoint_queue_goal.origin, bot_navigation_movemode))
                {
                        if( d > bot_waypoint_queue_bestgoalrating)
@@ -1079,14 +1085,14 @@ void navigation_unstuck()
                {
                        if (bot_waypoint_queue_bestgoal)
                        {
-                               dprint(self.netname, " stuck, reachable waypoint found, heading to it\n");
+                               bot_debug(strcat(self.netname, " stuck, reachable waypoint found, heading to it\n"));
                                navigation_routetogoal(bot_waypoint_queue_bestgoal, self.origin);
                                self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
                                self.aistatus &~= AI_STATUS_STUCK;
                        }
                        else
                        {
-                               dprint(self.netname, " stuck, cannot walk to any waypoint at all\n");
+                               bot_debug(strcat(self.netname, " stuck, cannot walk to any waypoint at all\n"));
                        }
 
                        bot_waypoint_queue_owner = world;
@@ -1098,7 +1104,7 @@ void navigation_unstuck()
                        return;
 
                // build a new queue
-               dprint(self.netname, " stuck, scanning reachable waypoints within ", ftos(search_radius)," qu\n");
+               bot_debug(strcat(self.netname, " stuck, scanning reachable waypoints within ", ftos(search_radius)," qu\n"));
 
                entity head, first;
 
@@ -1126,7 +1132,7 @@ void navigation_unstuck()
                        bot_waypoint_queue_goal = first;
                else
                {
-                       dprint(self.netname, " stuck, cannot walk to any waypoint at all\n");
+                       bot_debug(strcat(self.netname, " stuck, cannot walk to any waypoint at all\n"));
                        bot_waypoint_queue_owner = world;
                }
        }
@@ -1141,7 +1147,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 3d89301844c248c20f59dd3003e2f3dd434a337e..02839baa2d08461374ef2617e501efa41b7a14ee 100644 (file)
@@ -17,7 +17,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;
@@ -68,7 +68,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;
        }
@@ -124,7 +124,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';
@@ -378,22 +378,14 @@ 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);
                WriteEntity(MSG_ONE, self);
        }
 
-       if(g_lms)
-       {
-               // Only if the player cannot play at all
-               if(PlayerScore_Add(self, SP_LMS_RANK, 0) == 666)
-                       self.frags = FRAGS_SPECTATOR;
-               else
-                       self.frags = FRAGS_LMS_LOSER;
-       }
-       else if((g_race && g_race_qualifying) || g_cts)
+       if((g_race && g_race_qualifying) || g_cts)
        {
                if(PlayerScore_Add(self, SP_RACE_FASTEST, 0))
                        self.frags = FRAGS_LMS_LOSER;
@@ -405,8 +397,6 @@ void PutObserverInServer (void)
 
        MUTATOR_CALLHOOK(MakePlayerObserver);
 
-       minstagib_stop_countdown(self);
-
        Portal_ClearAll(self);
        
        if(self.alivetime)
@@ -598,9 +588,9 @@ Called when a client spawns in the server
 
 void PutClientInServer (void)
 {
-       if(clienttype(self) == CLIENTTYPE_BOT)
+       if(IS_BOT_CLIENT(self))
                self.classname = "player";
-       else if(clienttype(self) == CLIENTTYPE_REAL)
+       else if(IS_REAL_CLIENT(self))
        {
                msg_entity = self;
                WriteByte(MSG_ONE, SVC_SETVIEW);
@@ -610,20 +600,13 @@ void PutClientInServer (void)
        // reset player keys
        self.itemkeys = 0;
 
-       // player is dead and becomes observer
-       // FIXME fix LMS scoring for new system
-       if(g_lms)
-       {
-               if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
-                       self.classname = "observer";
-       }
-
        MUTATOR_CALLHOOK(PutClientInServer);
 
        if(gameover)
                self.classname = "observer";
 
-       if(self.classname == "player") {
+       if(IS_PLAYER(self))
+       {
                entity spot, oldself;
                float j;
 
@@ -653,7 +636,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)
@@ -662,10 +645,7 @@ void PutClientInServer (void)
                if(autocvar__notarget)
                        self.flags |= FL_NOTARGET;
                self.takedamage = DAMAGE_AIM;
-               if(g_minstagib)
-                       self.effects = EF_FULLBRIGHT;
-               else
-                       self.effects = 0;
+               self.effects = 0;
                self.effects |= EF_TELEPORT_BIT | EF_RESTARTANIM_BIT;
                self.air_finished = time + 12;
                self.dmg = 2;
@@ -800,8 +780,6 @@ void PutClientInServer (void)
                self.colormod = '1 1 1' * autocvar_g_player_brightness;
                self.exteriorweaponentity.alpha = default_weapon_alpha;
 
-               self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval*2;
-               self.lms_traveled_distance = 0;
                self.speedrunning = FALSE;
 
                race_PostSpawn(spot);
@@ -857,7 +835,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 ();
        }
 }
@@ -1071,7 +1049,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)
                                { Send_Notification(NOTIF_ONE, self.owner, MSG_ANNCE, Announcer_PickNumber(self.cnt)); }
@@ -1115,7 +1093,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();
                }
@@ -1157,28 +1135,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_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, 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_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, 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_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, self.killindicator.cnt);
                }
                else
                {
                        self.killindicator.colormod = Team_ColorRGB(targetteam);
-                       if(clienttype(self) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(self))
                        if(self.killindicator.cnt > 0)
                                Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, APP_TEAM_NUM_4(targetteam, CENTER_TEAMCHANGE_), self.killindicator.cnt);
                }
@@ -1191,7 +1169,7 @@ void ClientKill (void)
        if(gameover) return;
        if(self.player_blocked) return;
        if(self.freezetag_frozen) return;
-
+       
        ClientKill_TeamChange(0);
 }
 
@@ -1270,7 +1248,7 @@ void ClientConnect (void)
 {
        float t;
 
-       if(self.flags & FL_CLIENT)
+       if(IS_CLIENT(self))
        {
                print("Warning: ClientConnect, but already connected!\n");
                return;
@@ -1311,7 +1289,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)
                        {
@@ -1378,11 +1356,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);
 
@@ -1390,7 +1368,7 @@ void ClientConnect (void)
 
        self.netname_previous = strzone(self.netname);
 
-       if((self.classname == STR_PLAYER && teamplay))
+       if(IS_PLAYER(self) && teamplay)
                Send_Notification(NOTIF_ALL, world, MSG_INFO, APP_TEAM_ENT_4(self, INFO_JOIN_CONNECT_TEAM_), self.netname);
        else
                Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_JOIN_CONNECT, self.netname);
@@ -1435,7 +1413,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_campaign)
                {
@@ -1487,7 +1465,7 @@ void ClientConnect (void)
 
        self.model_randomizer = random();
 
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
                sv_notice_join();
 
        MUTATOR_CALLHOOK(ClientConnect);
@@ -1506,7 +1484,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;
@@ -1663,7 +1641,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);
@@ -1687,55 +1665,7 @@ void player_powerups (void)
        Fire_ApplyDamage(self);
        Fire_ApplyEffect(self);
 
-       if (g_minstagib)
-       {
-               self.effects |= EF_FULLBRIGHT;
-
-               if (self.items & IT_STRENGTH)
-               {
-                       play_countdown(self.strength_finished, "misc/poweroff.wav");
-                       if (time > self.strength_finished)
-                       {
-                               self.alpha = default_player_alpha;
-                               self.exteriorweaponentity.alpha = default_weapon_alpha;
-                               self.items &~= IT_STRENGTH;
-                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_INVISIBILITY, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
-                       }
-               }
-               else
-               {
-                       if (time < self.strength_finished)
-                       {
-                               self.alpha = g_minstagib_invis_alpha;
-                               self.exteriorweaponentity.alpha = g_minstagib_invis_alpha;
-                               self.items |= IT_STRENGTH;
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
-                       }
-               }
-
-               if (self.items & IT_INVINCIBLE)
-               {
-                       play_countdown(self.invincible_finished, "misc/poweroff.wav");
-                       if (time > self.invincible_finished)
-                       {
-                               self.items = self.items - (self.items & IT_INVINCIBLE);
-                               //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SPEED, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED);
-                       }
-               }
-               else
-               {
-                       if (time < self.invincible_finished)
-                       {
-                               self.items = self.items | IT_INVINCIBLE;
-                               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, self.netname);
-                               Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED);
-                       }
-               }
-       }
-       else // if we're not in minstagib, continue. I added this else to replace the "return" which was here that broke the callhook for this function -- This code is nasty.
+       if not(g_minstagib)
        {
                if (self.items & IT_STRENGTH)
                {
@@ -2080,7 +2010,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);
@@ -2299,7 +2229,7 @@ float nJoinAllowed(entity ignore) {
 
        float currentlyPlaying = 0;
        FOR_EACH_REALCLIENT(e)
-               if(e.classname == "player" || e.caplayer == 1)
+               if(IS_PLAYER(e) || e.caplayer == 1)
                        currentlyPlaying += 1;
 
        if(currentlyPlaying < autocvar_g_maxplayers)
@@ -2313,7 +2243,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) ) {
                        Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
                        dropclient(self);
@@ -2326,7 +2256,7 @@ void PrintWelcomeMessage()
        if(self.motd_actived_time == 0)
        {
                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_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, campaign_message);
                        }
@@ -2342,7 +2272,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;
                                Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_MOTD);
                        }
@@ -2449,7 +2379,7 @@ void SpectatorThink()
 
 void PlayerUseKey()
 {
-       if(self.classname != "player")
+       if not(IS_PLAYER(self))
                return;
 
        if(self.vehicle)
@@ -2558,10 +2488,11 @@ void PlayerPreThink (void)
                self.usekeypressed = self.BUTTON_USE;
        }
 
-       if(clienttype(self) == CLIENTTYPE_REAL)
+       if(IS_REAL_CLIENT(self))
                PrintWelcomeMessage();
 
-       if(self.classname == "player") {
+       if(IS_PLAYER(self))
+       {
 
                CheckRules_Player();
 
@@ -2600,9 +2531,6 @@ void PlayerPreThink (void)
                        player_powerups();
                }
 
-               if (g_minstagib)
-                       minstagib_ammocheck();
-
                if (self.deadflag != DEAD_NO)
                {
                        if(self.personal && g_race_qualifying)
@@ -2751,9 +2679,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();
        }
 
@@ -2762,9 +2690,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;
@@ -2889,7 +2817,7 @@ void PlayerPostThink (void)
 
        //CheckPlayerJump();
 
-       if(self.classname == "player") {
+       if(IS_PLAYER(self)) {
                CheckRules_Player();
                UpdateChatBubble();
                if (self.impulse)
index d09c0704fe56dbc2536a52a74df8a93381318560..3288bbc72a9af3b52cfcc56c64e44ddd8df4b4cd 100644 (file)
@@ -98,8 +98,7 @@ void ImpulseCommands (void)
                                        W_PreviousWeapon (2);
                                        break;
                                case 17:
-                                       if (!g_minstagib)
-                                               W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750, FALSE), '0 0 0', TRUE);
+                                       W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750, FALSE), '0 0 0', TRUE);
                                        break;
                                case 18:
                                        W_NextWeapon (1);
index a318b8e3a4ad10c950a1adacc807a5da8b15e241..b65e62a85ca7915bd52e2e70625d2673e7c8df25 100644 (file)
@@ -698,8 +698,6 @@ void SV_PlayerPhysics()
        WarpZone_PlayerPhysics_FixVAngle();
        
        maxspd_mod = 1;
-       if(g_minstagib && (self.items & IT_INVINCIBLE))
-               maxspd_mod *= autocvar_g_minstagib_speed_highspeed;
        if(self.ballcarried)
                if(g_nexball)
                        maxspd_mod *= autocvar_g_nexball_basketball_carrier_highspeed;
@@ -806,7 +804,7 @@ void SV_PlayerPhysics()
                        self.punchvector = '0 0 0';
        }
 
-       if (clienttype(self) == CLIENTTYPE_BOT)
+       if (IS_BOT_CLIENT(self))
        {
                if(playerdemo_read())
                        return;
@@ -815,7 +813,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)
@@ -869,7 +867,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)
@@ -918,7 +916,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;
@@ -943,7 +941,7 @@ void SV_PlayerPhysics()
        if(IsFlying(self))
                self.wasFlying = 1;
 
-       if(self.classname == "player")
+       if(IS_PLAYER(self))
                CheckPlayerJump();
 
        if (self.flags & FL_WATERJUMP )
@@ -956,7 +954,7 @@ void SV_PlayerPhysics()
                        self.teleport_time = 0;
                }
        }
-       else if (g_bugrigs && self.classname == "player")
+       else if (g_bugrigs && IS_PLAYER(self))
        {
                RaceCarPhysics();
        }
@@ -1308,7 +1306,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 95aeced31b308b5db10fa4ab9da332baab5151aa..53a9e7aadc3ddaf97d7480e98f075de0fe3ed0ae 100644 (file)
@@ -262,10 +262,6 @@ void player_anim (void)
 
 void SpawnThrownWeapon (vector org, float w)
 {
-       if(g_minstagib)
-       if(self.ammo_cells <= 0)
-               return;
-
        if(g_pinata)
        {
                float j;
@@ -278,8 +274,9 @@ void SpawnThrownWeapon (vector org, float w)
        }
        else
        {
-               if(W_IsWeaponThrowable(self.weapon))
-                       W_ThrowNewWeapon(self, self.weapon, FALSE, org, randomvec() * 125 + '0 0 200');
+               if(WEPSET_CONTAINS_EW(self, self.weapon))
+                       if(W_IsWeaponThrowable(self.weapon))
+                               W_ThrowNewWeapon(self, self.weapon, FALSE, org, randomvec() * 125 + '0 0 200');
        }
 }
 
@@ -387,17 +384,10 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
        else
                Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
 
-       if (!g_minstagib)
-       {
-               v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, damage);
-               take = v_x;
-               save = v_y;
-       }
-       else
-       {
-               save = 0;
-               take = damage;
-       }
+
+       v = healtharmor_applydamage(self.armorvalue, autocvar_g_balance_armor_blockpercent, damage);
+       take = v_x;
+       save = v_y;
 
        if(attacker == self)
        {
@@ -406,7 +396,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;
@@ -507,18 +497,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))
        {
@@ -598,7 +588,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
 
                Portal_ClearAllLater(self);
 
-               if(clienttype(self) == CLIENTTYPE_REAL)
+               if(IS_REAL_CLIENT(self))
                {
                        self.fixangle = TRUE;
                        //msg_entity = self;
@@ -613,7 +603,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
 
                // player could have been miraculously resuscitated ;)
                // e.g. players in freezetag get frozen, they don't really die
-               if(self.health >= 1 || self.classname != "player")
+               if(self.health >= 1 || !IS_PLAYER(self))
                        return;
 
                // when we get here, player actually dies
@@ -664,7 +654,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                else
                        self.respawn_countdown = -1; // do not count down
 
-               if(g_lms || g_cts || autocvar_g_forced_respawn)
+               if(g_cts || autocvar_g_forced_respawn)
                        self.respawn_flags = self.respawn_flags | RESPAWN_FORCE;
 
                self.death_time = time;
@@ -719,7 +709,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);
@@ -879,7 +869,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)))
@@ -947,7 +937,7 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f
                {
                        sprint(source, sourcemsgstr);
                        dedicated_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);
                }
@@ -1120,7 +1110,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;
@@ -1149,7 +1139,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)
@@ -1193,7 +1183,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);
@@ -1206,7 +1196,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);
@@ -1214,7 +1204,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;
@@ -1246,7 +1236,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 afabe1820284522acf4d4dc0211d610d277de559..7625e9b504ed36c80b7524852f722b7768aef1b6 100644 (file)
@@ -93,12 +93,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);
@@ -117,10 +117,9 @@ vector w_shotend;
 .float prevstrengthsoundattempt;
 void W_PlayStrengthSound(entity player) // void W_PlayStrengthSound
 {
-               if((!g_minstagib)
-                       && (player.items & IT_STRENGTH)
-                       && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
-                       || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
+       if((player.items & IT_STRENGTH)
+               && ((time > player.prevstrengthsound + autocvar_sv_strengthsound_antispam_time) // prevent insane sound spam
+               || (time > player.prevstrengthsoundattempt + autocvar_sv_strengthsound_antispam_refire_threshold)))
                {
                        sound(player, CH_TRIGGER, "weapons/strength_fire.wav", VOL_BASE, ATTN_NORM);
                        player.prevstrengthsound = time;
@@ -198,7 +197,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;
@@ -214,7 +213,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)
@@ -256,7 +255,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;
@@ -696,7 +695,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");
                                        Send_WeaponComplain (cl, wpn, W_Name(wpn), 0);
@@ -1353,7 +1352,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 e22399f4acd14ed8b42b8901d1dc2f9c056050e2..ec9c33b1987b093005f28c5df16c062d3d9e9c65 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)
                                {
@@ -276,7 +276,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) 
@@ -392,7 +392,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)
@@ -412,12 +412,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(self.caplayer && (self.classname == "spectator" || self.classname == "observer"))
+                               if(self.caplayer && (IS_SPEC(self) || IS_OBSERVER(self)))
                                {
                                        sprint(self, "WARNING: you will spectate in the next round.\n");
                                        self.caplayer = 0;
index 132a0af70e31be2fbc97bbc79006ae5b5c1f263c..73bf0df4f7d279bb92709f1203a711c290831edf 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;
@@ -557,7 +557,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
@@ -613,7 +613,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 0944f04fbbe06799f4f523d37eb243af42bddb92..4c0445f1d33a99c3313dc01eca27b44a7f25dd0f 100644 (file)
@@ -996,7 +996,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();
@@ -1011,7 +1011,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)
                                                        {
@@ -1105,7 +1105,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;
                                        Send_Notification(NOTIF_ONE_ONLY, plr, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
index 3e564e39ae93f055226d64ad8e3caf5b40e13fe0..dcbf4f32e2bc5d26bbb790ca32820b835030a2ae 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;
                }
        }
@@ -332,11 +330,8 @@ void reset_map(float dorespawn)
                race_ReadyRestart();
        else MUTATOR_CALLHOOK(reset_map_global);
 
-       lms_lowest_lives = 999;
-       lms_next_place = player_count;
-
        for(self = world; (self = nextent(self)); )
-       if(clienttype(self) == CLIENTTYPE_NOTACLIENT)
+       if(IS_NOT_A_CLIENT(self))
        {
                if(self.reset)
                {
@@ -353,7 +348,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)
                {
@@ -379,8 +374,6 @@ void reset_map(float dorespawn)
                        //NEW: changed behaviour so that it prevents that previous spectators/observers suddenly spawn as players
                        if (IS_PLAYER(self)) {
                                //PlayerScore_Clear(self);
-                               if(g_lms)
-                                       PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives());
                                self.killcount = 0;
                                //stop the player from moving so that he stands still once he gets respawned
                                self.velocity = '0 0 0';
@@ -784,7 +777,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."); }
@@ -883,7 +876,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 fb93b7c7876b3d133d4f5b30b2daa872b56e4aa8..7d3585725d2544ecd4dab000d907c51cbab6354e 100644 (file)
@@ -16,7 +16,7 @@ noref float require_spawnfunc_prefix; // if this float exists, only functions wi
 
 // Globals
 
-float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_midair, g_minstagib, g_pinata, g_norecoil, g_minstagib_invis_alpha, g_bloodloss;
+float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_midair, g_minstagib, g_pinata, g_norecoil, g_bloodloss;
 float g_warmup_limit;
 float g_warmup_allguns;
 float g_warmup_allow_timeout;
@@ -243,9 +243,6 @@ float nJoinAllowed(entity ignore);
 
 .float spawnshieldtime;
 
-.float lms_nextcheck;
-.float lms_traveled_distance;
-
 .entity flagcarried;
 
 .float playerid;
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 6687f18ebc24064cf023faaa1c9a6b766cdb9396..da013fc75d0eebe984ebc4a39717489d47d72f45 100644 (file)
@@ -240,7 +240,7 @@ void Obituary_SpecialDeath(
 {
        if(DEATH_ISSPECIAL(deathtype))
        {
-               entity deathent = deathtypes[(deathtype - DT_FIRST) - 1];
+               entity deathent = deathtypes[(deathtype - DT_FIRST)];
                if not(deathent) { backtrace("Obituary_SpecialDeath: Could not find deathtype entity!\n"); return; }
 
                if(murder)
@@ -569,7 +569,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)
@@ -578,7 +578,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;
@@ -603,20 +603,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';
@@ -631,19 +622,14 @@ 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;
                                                        if(complainteamdamage > 0 && !g_ca) // FIXME why is g_ca ruled out here? Why not just g_mirrordamage 0 on CA servers?
                                                                mirrordamage = autocvar_g_mirrordamage * complainteamdamage;
                                                        mirrorforce = autocvar_g_mirrordamage * vlen(force);
-                                                       if(g_minstagib)
-                                                       {
-                                                               if(autocvar_g_friendlyfire == 0)
-                                                                       damage = 0;
-                                                       }
-                                                       else if(g_ca)
+                                                       if(g_ca)
                                                                damage = 0;
                                                        else
                                                                damage = autocvar_g_friendlyfire * damage;
@@ -677,44 +663,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                        }
                }
 
-               if(targ.classname == "player")
-               if (g_minstagib)
-               {
-                       if ((deathtype == DEATH_FALL)  ||
-                               (deathtype == DEATH_DROWN) ||
-                               (deathtype == DEATH_SLIME) ||
-                               (deathtype == DEATH_LAVA)  ||
-                               (!DEATH_ISWEAPON(deathtype, WEP_LASER) && damage > 0 && damage < 100))
-                       {
-                               self = oldself;
-                               return;
-                       }
-                       if(damage > 0)
-                           damage = 10000;
-                       if (targ.armorvalue && (deathtype == WEP_MINSTANEX) && damage)
-                       {
-                               targ.armorvalue -= 1;
-                               centerprint(targ, strcat("^3Remaining extra lives: ",ftos(targ.armorvalue)));
-                               damage = 0;
-                               targ.hitsound += 1;
-                               attacker.hitsound += 1; // TODO change this to a future specific hitsound for armor hit
-                       }
-                       if (DEATH_ISWEAPON(deathtype, WEP_LASER))
-                       {
-                               damage = 0;
-                               mirrordamage = 0;
-                               complainteamdamage = 0;
-                               if (targ != attacker)
-                               {
-                                       if ((targ.health >= 1) && (targ.classname == "player"))
-                                               centerprint(attacker, "Secondary fire inflicts no damage!");
-                                       force = '0 0 0';
-                                       // keep mirrorforce
-                                       attacker = targ;
-                               }
-                       }
-               }
-
                if not(DEATH_ISSPECIAL(deathtype))
                {
                        damage *= g_weapondamagefactor;
@@ -730,28 +678,33 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
                frag_damage = damage;
                frag_force = force;
         frag_deathtype = deathtype;
+               frag_mirrordamage = mirrordamage;
                MUTATOR_CALLHOOK(PlayerDamage_Calculate);
                damage = frag_damage;
+               mirrordamage = frag_mirrordamage;
                force = frag_force;
                
-               // apply strength multiplier
-               if ((attacker.items & IT_STRENGTH) && !g_minstagib)
+               if not(g_minstagib)
                {
-                       if(targ == attacker)
+                       // apply strength multiplier
+                       if (attacker.items & IT_STRENGTH)
                        {
-                               damage = damage * autocvar_g_balance_powerup_strength_selfdamage;
-                               force = force * autocvar_g_balance_powerup_strength_selfforce;
-                       }
-                       else
-                       {
-                               damage = damage * autocvar_g_balance_powerup_strength_damage;
-                               force = force * autocvar_g_balance_powerup_strength_force;
+                               if(targ == attacker)
+                               {
+                                       damage = damage * autocvar_g_balance_powerup_strength_selfdamage;
+                                       force = force * autocvar_g_balance_powerup_strength_selfforce;
+                               }
+                               else
+                               {
+                                       damage = damage * autocvar_g_balance_powerup_strength_damage;
+                                       force = force * autocvar_g_balance_powerup_strength_force;
+                               }
                        }
-               }
 
-               // apply invincibility multiplier
-               if (targ.items & IT_INVINCIBLE && !g_minstagib)
-                       damage = damage * autocvar_g_balance_powerup_invincible_takedamage;
+                       // apply invincibility multiplier
+                       if (targ.items & IT_INVINCIBLE)
+                               damage = damage * autocvar_g_balance_powerup_invincible_takedamage;
+               }
 
                if (targ == attacker)
                {
@@ -773,7 +726,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))
                                {
@@ -792,14 +745,9 @@ 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(!g_minstagib)
+                                                       if(IS_PLAYER(targ)) // don't do this for vehicles
                                                        if(IsFlying(victim))
                                                                yoda = 1;
-
-                                                       if(g_minstagib)
-                                                       if(victim.items & IT_STRENGTH)
-                                                               yoda = 1;
                                                }
                                        }
                                }
@@ -824,7 +772,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)
@@ -856,18 +804,6 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, float
        if(mirrordamage > 0 || mirrorforce > 0)
        {
                attacker = attacker_save;
-               if(g_minstagib)
-               if(mirrordamage > 0)
-               {
-                       // just lose extra LIVES, don't kill the player for mirror damage
-                       if(attacker.armorvalue > 0)
-                       {
-                               attacker.armorvalue = attacker.armorvalue - 1;
-                               centerprint(attacker, strcat("^3Remaining extra lives: ",ftos(attacker.armorvalue)));
-                               attacker.hitsound += 1;
-                       }
-                       mirrordamage = 0;
-               }
 
                force = normalize(attacker.origin + attacker.view_ofs - hitloc) * mirrorforce;
                Damage(attacker, inflictor, attacker, mirrordamage, DEATH_MIRRORDAMAGE, attacker.origin, force);
@@ -989,7 +925,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));
@@ -1125,7 +1061,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;
@@ -1249,7 +1185,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
@@ -1277,7 +1213,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 12c75ae9e57199fb5499b0a910c5ecda94d3ed42..65846f5e38ba332e8f6e226c8f29831f18474260 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
@@ -691,7 +691,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) == "*")
@@ -1766,7 +1766,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;
@@ -1915,7 +1915,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 1af52b13209eea54f3d915f1a1992a1c0b12cc6f..3043a30003a590f713fc6561074605fbf31d236f 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);
@@ -428,12 +428,9 @@ void cvar_changes_init()
                BADCVAR("g_minstagib");
                BADCVAR("g_new_toys");
                BADCVAR("g_nix");
-
-               if(autocvar_g_minstagib)
-               {
-                       BADCVAR("g_grappling_hook");
-                       BADCVAR("g_jetpack");
-               }
+               BADCVAR("g_grappling_hook");
+               BADCVAR("g_jetpack");
+               
 #undef BADPREFIX
 #undef BADCVAR
 
@@ -713,10 +710,6 @@ void spawnfunc_worldspawn (void)
                if(autocvar_g_midair)
                        s = strcat(s, ":midair");
 
-               // TODO to mutator system
-               if(autocvar_g_minstagib)
-                       s = strcat(s, ":minstagib");
-
                // TODO to mutator system
                if(autocvar_g_powerups == 0)
                        s = strcat(s, ":no_powerups");
@@ -925,9 +918,6 @@ void spawnfunc_worldspawn (void)
                modname = cvar_string("g_mod_balance");
        if(cvar_string("g_mod_config") != cvar_defstring("g_mod_config"))
                modname = cvar_string("g_mod_config");
-       // weird mutators that deserve to count as mod
-       if(autocvar_g_minstagib)
-               modname = "MinstaGib";
        // extra mutators that deserve to count as mod
        MUTATOR_CALLHOOK(SetModname);
 
@@ -1339,7 +1329,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.\"\n", 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.\"\n", GetMapname(), strftime(FALSE, "%s"))); }
                return;
        }
 
@@ -1463,11 +1453,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 || other.caplayer == 1 || g_lms)
+                       if(IS_PLAYER(other) || g_arena || other.caplayer == 1 || g_lms)
                                s = strcat(s, ftos(other.team), ":");
                        else
                                s = strcat(s, "spectator:");
@@ -1532,7 +1522,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;
@@ -1544,7 +1534,6 @@ void FixIntermissionClient(entity e)
        }
 }
 
-void minstagib_stop_countdown(entity e);
 /*
 go to the next level for deathmatch
 only called if a time or frag limit has expired
@@ -1590,7 +1579,6 @@ void NextLevel()
        GameLogClose();
 
        FOR_EACH_PLAYER(other) {
-               minstagib_stop_countdown(other);
                FixIntermissionClient(other);
                if(other.winning)
                        bprint(other.netname, " ^7wins.\n");
@@ -2684,7 +2672,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);
@@ -2796,7 +2784,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 13eb647dbdeb36d83aeebb371d88a44e4bcef1f4..ee993d5ec09b39c864a9b4220b3d328f4c5910f7 100644 (file)
@@ -589,7 +589,7 @@ void GetCvars(float f)
 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));
@@ -824,26 +824,10 @@ void readplayerstartcvars()
 
        if (g_weaponarena)
        {
-               g_minstagib = 0; // incompatible
                g_pinata = 0; // incompatible
                g_weapon_stay = 0; // incompatible
                WEPSET_COPY_AA(start_weapons, g_weaponarena_weapons);
-               if(!g_ca)
-                       start_items |= IT_UNLIMITED_AMMO;
-       }
-       else if (g_minstagib)
-       {
-               g_pinata = 0; // incompatible
-               g_weapon_stay = 0; // incompatible
-               g_bloodloss = 0; // incompatible
-               start_health = 100;
-               start_armorvalue = 0;
-               WEPSET_COPY_AW(start_weapons, WEP_MINSTANEX);
-               g_minstagib_invis_alpha = cvar("g_minstagib_invis_alpha");
-               start_items |= IT_UNLIMITED_SUPERWEAPONS;
-
-               if (g_minstagib_invis_alpha <= 0)
-                       g_minstagib_invis_alpha = -1;
+               start_items |= IT_UNLIMITED_AMMO;
        }
        else
        {
@@ -866,12 +850,7 @@ void readplayerstartcvars()
        if(cvar("g_nexball"))
                start_items |= IT_UNLIMITED_SUPERWEAPONS; // FIXME BAD BAD BAD BAD HACK, NEXBALL SHOULDN'T ABUSE PORTO'S WEAPON SLOT
 
-       if(g_minstagib)
-       {
-               start_ammo_cells = cvar("g_minstagib_ammo_start");
-               start_ammo_fuel = cvar("g_start_ammo_fuel");
-       }
-       else if(start_items & IT_UNLIMITED_WEAPON_AMMO)
+       if(start_items & IT_UNLIMITED_WEAPON_AMMO)
        {
                start_ammo_rockets = 999;
                start_ammo_shells = 999;
@@ -881,28 +860,11 @@ void readplayerstartcvars()
        }
        else
        {
-               if(g_ca)
-               {
-                       start_ammo_shells = cvar("g_lms_start_ammo_shells");
-                       start_ammo_nails = cvar("g_lms_start_ammo_nails");
-                       start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
-                       start_ammo_cells = cvar("g_lms_start_ammo_cells");
-                       start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
-               }
-               else
-               {
-                       start_ammo_shells = cvar("g_start_ammo_shells");
-                       start_ammo_nails = cvar("g_start_ammo_nails");
-                       start_ammo_rockets = cvar("g_start_ammo_rockets");
-                       start_ammo_cells = cvar("g_start_ammo_cells");
-                       start_ammo_fuel = cvar("g_start_ammo_fuel");
-               }
-       }
-
-       if (g_ca)
-       {
-               start_health = cvar("g_lms_start_health");
-               start_armorvalue = cvar("g_lms_start_armor");
+               start_ammo_shells = cvar("g_start_ammo_shells");
+               start_ammo_nails = cvar("g_start_ammo_nails");
+               start_ammo_rockets = cvar("g_start_ammo_rockets");
+               start_ammo_cells = cvar("g_start_ammo_cells");
+               start_ammo_fuel = cvar("g_start_ammo_fuel");
        }
 
        if (inWarmupStage)
@@ -918,7 +880,7 @@ void readplayerstartcvars()
                WEPSET_COPY_AA(warmup_start_weapons_default, start_weapons_default);
                WEPSET_COPY_AA(warmup_start_weapons_defaultmask, start_weapons_defaultmask);
 
-               if (!g_weaponarena && !g_minstagib && !g_ca)
+               if (!g_weaponarena && !g_ca)
                {
                        warmup_start_ammo_shells = cvar("g_warmup_start_ammo_shells");
                        warmup_start_ammo_cells = cvar("g_warmup_start_ammo_cells");
@@ -999,37 +961,25 @@ float sv_taunt;
 string GetGametype(); // g_world.qc
 void readlevelcvars(void)
 {
-       g_minstagib = cvar("g_minstagib");
-
-       // load ALL the mutators
-       if(cvar("g_dodging"))
-               MUTATOR_ADD(mutator_dodging);
-       if(cvar("g_spawn_near_teammate"))
-               MUTATOR_ADD(mutator_spawn_near_teammate);
-       if(cvar("g_physical_items"))
-               MUTATOR_ADD(mutator_physical_items);
-       if(cvar("g_touchexplode"))
-               MUTATOR_ADD(mutator_touchexplode);
-       if(!g_minstagib)
-       {
-               if(cvar("g_invincible_projectiles"))
-                       MUTATOR_ADD(mutator_invincibleprojectiles);
-               if(cvar("g_new_toys"))
-                       MUTATOR_ADD(mutator_new_toys);
-               if(cvar("g_nix"))
-                       MUTATOR_ADD(mutator_nix);
-               if(cvar("g_rocket_flying"))
-                       MUTATOR_ADD(mutator_rocketflying);
-               if(cvar("g_vampire"))
-                       MUTATOR_ADD(mutator_vampire);           
-               if(cvar("g_superspectate"))
-                       MUTATOR_ADD(mutator_superspec);
-       }
-
-       // is this a mutator? is this a mode?
-       if(cvar("g_sandbox"))
-               MUTATOR_ADD(sandbox);
-
+       // load mutators
+       #define CHECK_MUTATOR_ADD(mut_cvar,mut_name,dependence) \
+               { if(cvar(mut_cvar) && dependence) { MUTATOR_ADD(mut_name); } }
+               
+       CHECK_MUTATOR_ADD("g_dodging", mutator_dodging, 1);
+       CHECK_MUTATOR_ADD("g_spawn_near_teammate", mutator_spawn_near_teammate, 1);
+       CHECK_MUTATOR_ADD("g_physical_items", mutator_physical_items, 1);
+       CHECK_MUTATOR_ADD("g_touchexplode", mutator_touchexplode, 1);
+       CHECK_MUTATOR_ADD("g_minstagib", mutator_minstagib, 1);
+       CHECK_MUTATOR_ADD("g_invincible_projectiles", mutator_invincibleprojectiles, !cvar("g_minstagib"));
+       CHECK_MUTATOR_ADD("g_new_toys", mutator_new_toys, !cvar("g_minstagib"));
+       CHECK_MUTATOR_ADD("g_nix", mutator_nix, !cvar("g_minstagib"));
+       CHECK_MUTATOR_ADD("g_rocket_flying", mutator_rocketflying, !cvar("g_minstagib"));
+       CHECK_MUTATOR_ADD("g_vampire", mutator_vampire, !cvar("g_minstagib"));
+       CHECK_MUTATOR_ADD("g_superspectate", mutator_superspec, 1);
+       CHECK_MUTATOR_ADD("g_sandbox", sandbox, 1);
+       
+       #undef CHECK_MUTATOR_ADD
+       
        if(cvar("sv_allow_fullbright"))
                serverflags |= SERVERFLAG_ALLOW_FULLBRIGHT;
 
@@ -1048,6 +998,8 @@ void readlevelcvars(void)
     g_bugrigs_speed_ref = cvar("g_bugrigs_speed_ref");
     g_bugrigs_speed_pow = cvar("g_bugrigs_speed_pow");
     g_bugrigs_steer = cvar("g_bugrigs_steer");
+       
+       g_minstagib = cvar("g_minstagib");
 
        sv_clones = cvar("sv_clones");
        sv_foginterval = cvar("sv_foginterval");
@@ -1071,7 +1023,7 @@ void readlevelcvars(void)
        g_warmup_allguns = cvar("g_warmup_allguns");
        g_warmup_allow_timeout = cvar("g_warmup_allow_timeout");
 
-       if ((g_race && g_race_qualifying == 2) || g_arena || g_assault || cvar("g_campaign"))
+       if ((g_race && g_race_qualifying == 2) || g_arena || g_minstagib || g_assault || cvar("g_campaign"))
                inWarmupStage = 0; // these modes cannot work together, sorry
 
        g_pickup_respawntime_weapon = cvar("g_pickup_respawntime_weapon");
@@ -1177,7 +1129,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;
index 311d156304c9dbd0c99835d8ab928515e8ddc6aa..b2f9b29fda64b36d1df56e15536b2b3ad45168d2 100644 (file)
@@ -109,6 +109,11 @@ MUTATOR_HOOKABLE(BuildMutatorsPrettyString);
        // appends ", Mutator name" to ret_string for display
        // INPUT, OUTPUT:
                string ret_string;
+               
+MUTATOR_HOOKABLE(CustomizeWaypoint);
+       // called every frame
+       // customizes the waypoint for spectators
+       // INPUT: self = waypoint, other = player, other.enemy = spectator
 
 MUTATOR_HOOKABLE(FilterItem);
        // checks if the current item may be spawned (self.items and self.weapons may be read and written to, as well as the ammo_ fields)
@@ -163,6 +168,7 @@ MUTATOR_HOOKABLE(PlayerDamage_Calculate);
                float frag_deathtype;
        // INPUT, OUTPUT:
                float frag_damage;
+               float frag_mirrordamage;
                vector frag_force;
 
 MUTATOR_HOOKABLE(PlayerPowerups);
@@ -233,6 +239,17 @@ MUTATOR_HOOKABLE(SetWeaponreplace);
                entity other; // weapon info
        // IN+OUT
                string ret_string;
+               
+MUTATOR_HOOKABLE(Item_RespawnCountdown);
+       // called when an item is about to respawn
+       // INPUT+OUTPUT:
+       string item_name;
+       vector item_color;
+               
+MUTATOR_HOOKABLE(BotShouldAttack);
+       // called when a bot checks a target to attack
+       // INPUT
+       entity checkentity;
 
 MUTATOR_HOOKABLE(PortalTeleport);
        // called whenever a player goes through a portal gun teleport
index 11330fbd7d6b370f851aa8425bd11d0dfab4322d..32e7e98b6d080ffe81f5622e735d1d4598d5fe12 100644 (file)
@@ -147,7 +147,7 @@ MUTATOR_HOOKFUNCTION(ca_PutClientInServer)
                if(!self.caplayer)
                {
                        self.caplayer = 0.5;
-                       if(clienttype(self) == CLIENTTYPE_REAL)
+                       if(IS_REAL_CLIENT(self))
                                sprint(self, "You will join the game in the next round.\n");
                }
        }
@@ -222,6 +222,22 @@ MUTATOR_HOOKFUNCTION(ca_GiveFragsForKill)
        return 1;
 }
 
+MUTATOR_HOOKFUNCTION(ca_SetStartItems)
+{
+       start_health = cvar("g_lms_start_health");
+       start_armorvalue = cvar("g_lms_start_armor");
+       
+       start_ammo_shells = cvar("g_lms_start_ammo_shells");
+       start_ammo_nails = cvar("g_lms_start_ammo_nails");
+       start_ammo_rockets = cvar("g_lms_start_ammo_rockets");
+       start_ammo_cells = cvar("g_lms_start_ammo_cells");
+       start_ammo_fuel = cvar("g_lms_start_ammo_fuel");
+       
+       start_items &~= IT_UNLIMITED_AMMO;
+
+       return 0;
+}
+
 void ca_Initialize()
 {
        allowed_to_spawn = TRUE;
@@ -248,6 +264,7 @@ MUTATOR_DEFINITION(gamemode_ca)
        MUTATOR_HOOK(ForbidPlayerScore_Clear, ca_ForbidPlayerScore_Clear, CBC_ORDER_ANY);
        MUTATOR_HOOK(ForbidThrowCurrentWeapon, ca_ForbidThrowCurrentWeapon, CBC_ORDER_ANY);
        MUTATOR_HOOK(GiveFragsForKill, ca_GiveFragsForKill, CBC_ORDER_FIRST);
+       MUTATOR_HOOK(SetStartItems, ca_SetStartItems, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
index 8f0bc931efd540c587ea0f1ea5f3371fb04bdd0d..bc19d88ebb7bc1899ce203c1f6c462e3bc96c46c 100644 (file)
@@ -825,7 +825,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
                {
@@ -865,7 +865,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);
@@ -928,7 +928,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);
@@ -1780,7 +1780,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);
@@ -1840,7 +1840,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)
                                {
@@ -1852,7 +1852,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))
                                                        {
                                                                Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_CTF_PASS_REQUESTING, head.netname);
                                                                ctf_Handle_Throw(head, player, DROP_PASS);
index 98b9b40dd857c5052395bd0d7b09e8d8bfb7a0df..4a3b3b818e597b20bbd29231af5760683888f02e 100644 (file)
@@ -182,7 +182,7 @@ void dompointthink()
 void dompointtouch()
 {
        entity head;
-       if (other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
        if (other.health < 1)
                return;
index 980a9b20d9aff6c37ac55d344404a4bf9c821b5e..79ce5e2e14f47dfa67283af4980df1da83837c55 100644 (file)
@@ -356,15 +356,15 @@ MUTATOR_HOOKFUNCTION(freezetag_PlayerDies)
 
        if(frag_attacker == frag_target || frag_attacker == world)
        {
-               if(frag_target.classname == STR_PLAYER)
+               if(IS_PLAYER(frag_target))
                        Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_SELF);
                Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_SELF, frag_target.netname);
        }
        else
        {
-               if(frag_target.classname == STR_PLAYER)
+               if(IS_PLAYER(frag_target))
                        Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_FREEZETAG_FROZEN, frag_attacker.netname);
-               if(frag_attacker.classname == STR_PLAYER)
+               if(IS_PLAYER(frag_attacker))
                        Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_FREEZETAG_FREEZE, frag_target.netname);
                Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_FREEZETAG_FREEZE, frag_target.netname, frag_attacker.netname);
        }
index 7a16cd62b2716f62d0115916ff4a3f09cee06350..f92afab658a81d0eee8d51ce55e2cfdf6bc64947 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);
@@ -159,7 +159,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();
@@ -243,7 +243,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 13a06c367c72ca7084bb4d5d7301fa8affe73f58..99e7a3eae1cfd5666505e32237180d6d08549bf0 100644 (file)
@@ -69,7 +69,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;
 
@@ -391,7 +391,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;
 }
 
@@ -426,7 +426,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;
@@ -555,7 +555,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;
@@ -1012,7 +1012,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 681a1d433a1f62dbc0cfe4b60b7d05b71850b704..82258ac77c115e33d144c7dc280526c0c3aa729c 100644 (file)
@@ -18,15 +18,49 @@ float LMS_NewPlayerLives()
 }
 
 // mutator hooks
-MUTATOR_HOOKFUNCTION(lms_PlayerSpawn)
+MUTATOR_HOOKFUNCTION(lms_ResetMap)
+{
+       lms_lowest_lives = 999;
+       lms_next_place = player_count;
+       
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(lms_ResetPlayers)
 {
-       if(IS_PLAYER(self))
        if(restart_mapalreadyrestarted || (time < game_starttime))
+       FOR_EACH_CLIENT(self)
+       if(IS_PLAYER(self))
                PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives());
+       
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(lms_PlayerPreSpawn)
+{
+       // player is dead and becomes observer
+       // FIXME fix LMS scoring for new system
+       if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
+               self.classname = "observer";
+
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(lms_PlayerSpawn)
+{
+       self.lms_nextcheck = time + autocvar_g_lms_campcheck_interval*2;
+       self.lms_traveled_distance = 0;
                
        return FALSE;
 }
 
+MUTATOR_HOOKFUNCTION(lms_PlayerDies)
+{
+       self.respawn_flags |= RESPAWN_FORCE;
+       
+       return FALSE;
+}
+
 MUTATOR_HOOKFUNCTION(lms_RemovePlayer)
 {
        // Only if the player cannot play at all
@@ -181,18 +215,6 @@ MUTATOR_HOOKFUNCTION(lms_ItemTouch)
        return FALSE;
 }
 
-MUTATOR_HOOKFUNCTION(lms_BotSpawn)
-{
-       // temporary hack to give bots lives
-       if(PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
-       {
-               PlayerScore_Add(self, SP_LMS_RANK, 666);
-               self.frags = FRAGS_SPECTATOR;
-       }
-       
-       return FALSE;
-}
-
 // scoreboard stuff
 void lms_ScoreRules()
 {
@@ -212,7 +234,11 @@ void lms_Initialize()
 
 MUTATOR_DEFINITION(gamemode_lms)
 {
+       MUTATOR_HOOK(reset_map_global, lms_ResetMap, CBC_ORDER_ANY);
+       MUTATOR_HOOK(reset_map_players, lms_ResetPlayers, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PutClientInServer, lms_PlayerPreSpawn, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerSpawn, lms_PlayerSpawn, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerDies, lms_PlayerDies, CBC_ORDER_ANY);
        MUTATOR_HOOK(MakePlayerObserver, lms_RemovePlayer, CBC_ORDER_ANY);
        MUTATOR_HOOK(ClientConnect, lms_ClientConnect, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerPreThink, lms_PlayerThink, CBC_ORDER_ANY);
@@ -223,7 +249,6 @@ MUTATOR_DEFINITION(gamemode_lms)
        MUTATOR_HOOK(ForbidPlayerScore_Clear, lms_KeepScore, CBC_ORDER_ANY);
        MUTATOR_HOOK(FilterItem, lms_FilterItem, CBC_ORDER_ANY);
        MUTATOR_HOOK(ItemTouch, lms_ItemTouch, CBC_ORDER_ANY);
-       MUTATOR_HOOK(HavocBot_ChooseRule, lms_BotSpawn, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
index 16fda61550823e6a098e27a2f47e1cfe2506550d..508bf8c6cd12b98af08be540322c31a346adea79 100644 (file)
@@ -5,4 +5,8 @@
 // lives related defs
 float lms_lowest_lives;
 float lms_next_place;
-float LMS_NewPlayerLives();
\ No newline at end of file
+float LMS_NewPlayerLives();
+
+// camp check
+.float lms_nextcheck;
+.float lms_traveled_distance;
\ No newline at end of file
index 8790162afa9804ed508c48bcecb4241930ad5319..ba70a6cda8a5e301242f978430cf2c82d31a5e95 100644 (file)
@@ -248,7 +248,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;
@@ -288,7 +288,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;
@@ -327,7 +327,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 (?)";
@@ -674,7 +674,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;
@@ -900,7 +900,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 3801de302d9c80fa2ab8cb0e7e3215d01dbf0ff4..e4be2d7ab4ce2ea2b9422456b2affc7fbec3f2fd 100644 (file)
@@ -584,7 +584,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;
@@ -978,7 +978,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;
@@ -986,7 +986,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 == NUM_TEAM_1)
@@ -1271,7 +1271,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)
diff --git a/qcsrc/server/mutators/mutator_minstagib.qc b/qcsrc/server/mutators/mutator_minstagib.qc
new file mode 100644 (file)
index 0000000..05354a2
--- /dev/null
@@ -0,0 +1,421 @@
+void spawnfunc_item_minst_cells (void) 
+{
+       if not(g_minstagib) { remove(self); return; }
+       if not(self.ammo_cells)
+               self.ammo_cells = autocvar_g_minstagib_ammo_drop;
+               
+       StartItem ("models/items/a_cells.md3",
+                          "misc/itempickup.wav", 45, 0,
+                          "MinstaNex Ammo", IT_CELLS, 0, 0, generic_pickupevalfunc, 100);
+}
+
+void minstagib_health_mega()
+{
+       self.max_health = 1;
+       StartItem ("models/items/g_h100.md3",
+                          "misc/megahealth.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
+                          "Extralife", IT_NAILS, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
+}
+
+.float minstagib_nextthink;
+.float minstagib_needammo;
+void minstagib_stop_countdown(entity e)
+{
+       if (!e.minstagib_needammo)
+               return;
+       Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_MINSTA_FINDAMMO);
+       e.minstagib_needammo = FALSE;
+}
+void minstagib_ammocheck(void)
+{
+       if not(IS_PLAYER(self))
+               return; // not a player
+       if (time < self.minstagib_nextthink)
+               return;
+
+       if (self.deadflag || gameover)
+               minstagib_stop_countdown(self);
+       else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO))
+               minstagib_stop_countdown(self);
+       else
+       {
+               self.minstagib_needammo = TRUE;
+               if (self.health == 5)
+               {
+                       Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
+                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_MINSTAGIB_TERMINATED);
+               }
+               else if (self.health == 10)
+               {
+                       Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
+                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_1);
+               }
+               else if (self.health == 20)
+               {
+                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
+                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_2);
+               }
+               else if (self.health == 30)
+               {
+                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
+                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_3);
+               }
+               else if (self.health == 40)
+               {
+                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
+                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_4);
+               }
+               else if (self.health == 50)
+               {
+                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
+                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_5);
+               }
+               else if (self.health == 60)
+               {
+                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
+                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_6);
+               }
+               else if (self.health == 70)
+               {
+                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
+                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_7);
+               }
+               else if (self.health == 80)
+               {
+                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
+                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_8);
+               }
+               else if (self.health == 90)
+               {
+                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MINSTA_FINDAMMO);
+                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
+                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_9);
+               }
+               else if (self.health == 100)
+               {
+                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_MULTI, MULTI_MINSTA_FINDAMMO);
+                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
+               }
+       }
+       self.minstagib_nextthink = time + 1;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_MatchEnd)
+{
+       entity head;
+       FOR_EACH_PLAYER(head)
+               minstagib_stop_countdown(head);
+               
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_BotShouldAttack)
+{
+       if(checkentity.items & IT_STRENGTH)
+               return TRUE;
+               
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_MakePlayerObserver)
+{
+       minstagib_stop_countdown(self);
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_PlayerSpawn)
+{
+       self.effects |= EF_FULLBRIGHT;
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_PlayerPreThink)
+{
+       minstagib_ammocheck();
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_PlayerPowerups)
+{
+       if not(self.effects & EF_FULLBRIGHT)
+               self.effects |= EF_FULLBRIGHT;
+
+       if (self.items & IT_STRENGTH)
+       {
+               play_countdown(self.strength_finished, "misc/poweroff.wav");
+               if (time > self.strength_finished)
+               {
+                       self.alpha = default_player_alpha;
+                       self.exteriorweaponentity.alpha = default_weapon_alpha;
+                       self.items &~= IT_STRENGTH;
+                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_INVISIBILITY);
+               }
+       }
+       else
+       {
+               if (time < self.strength_finished)
+               {
+                       self.alpha = autocvar_g_minstagib_invis_alpha;
+                       self.exteriorweaponentity.alpha = autocvar_g_minstagib_invis_alpha;
+                       self.items |= IT_STRENGTH;
+                       Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_INVISIBILITY, self.netname);
+                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_INVISIBILITY);
+               }
+       }
+
+       if (self.items & IT_INVINCIBLE)
+       {
+               play_countdown(self.invincible_finished, "misc/poweroff.wav");
+               if (time > self.invincible_finished)
+               {
+                       self.items &~= IT_INVINCIBLE;
+                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SPEED);
+               }
+       }
+       else
+       {
+               if (time < self.invincible_finished)
+               {
+                       self.items |= IT_INVINCIBLE;
+                       Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SPEED, self.netname);
+                       Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SPEED);
+               }
+       }
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_PlayerPhysics)
+{
+       if(self.items & IT_INVINCIBLE)
+               self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_minstagib_speed_highspeed;
+               
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_SplitHealthArmor)
+{
+       damage_save = 0;
+       //damage_take = frag_damage; // frag_damage isn't even set here?!
+       
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_ForbidThrowing)
+{
+       if (self.health < 1)
+               return FALSE;
+               
+       return TRUE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_PlayerDamage)
+{
+       if(autocvar_g_friendlyfire == 0 && !IsDifferentTeam(frag_target, frag_attacker) && IS_PLAYER(frag_target))
+               frag_damage = 0;
+               
+       if(IS_PLAYER(frag_target))
+       {
+               if ((frag_deathtype == DEATH_FALL)  ||
+                       (frag_deathtype == DEATH_DROWN) ||
+                       (frag_deathtype == DEATH_SLIME) ||
+                       (frag_deathtype == DEATH_LAVA))
+               {
+                       frag_damage = 0;
+               }
+               
+               if (frag_target.armorvalue && (frag_deathtype == WEP_MINSTANEX) && frag_damage)
+               {
+                       frag_target.armorvalue -= 1;
+                       Send_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CENTER_MINSTA_LIVES_REMAINING, frag_target.armorvalue);
+                       frag_damage = 0;
+                       frag_target.hitsound += 1;
+                       frag_attacker.hitsound += 1; // TODO change this to a future specific hitsound for armor hit
+               }
+               if (DEATH_ISWEAPON(frag_deathtype, WEP_LASER))
+               {
+                       frag_damage = 0;
+                       frag_mirrordamage = 0;
+                       if (frag_target != frag_attacker)
+                       {
+                               if ((frag_target.health >= 1) && IS_PLAYER(frag_target))
+                                       Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_MINSTA_SECONDARY);
+                               frag_force = '0 0 0';
+                               // keep mirrorfrag_force
+                               frag_attacker = frag_target;
+                       }
+               }
+       }
+       
+       if(frag_mirrordamage > 0)
+       {
+               // just lose extra LIVES, don't kill the player for mirror damage
+               if(frag_attacker.armorvalue > 0)
+               {
+                       frag_attacker.armorvalue = frag_attacker.armorvalue - 1;
+                       Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_MINSTA_LIVES_REMAINING, frag_attacker.armorvalue);
+                       frag_attacker.hitsound += 1;
+               }
+               frag_mirrordamage = 0;
+       }
+       
+       if(frag_target.items & IT_STRENGTH)
+               yoda = 1;
+               
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_SetStartItems)
+{
+       start_ammo_cells = cvar("g_minstagib_ammo_start");
+       
+       start_health = 100;
+       start_armorvalue = 0;
+       WEPSET_COPY_AW(start_weapons, WEP_MINSTANEX);
+       start_items |= IT_UNLIMITED_SUPERWEAPONS;
+               
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_FilterItem)
+{
+       if(self.classname == "item_cells")
+               return TRUE; // no normal cells?
+               
+       if(self.weapon == WEP_MINSTANEX && self.classname == "droppedweapon")
+       {
+               self.ammo_cells = autocvar_g_minstagib_ammo_drop;
+               return FALSE;
+       }
+       
+       if(self.weapon == WEP_ROCKET_LAUNCHER || self.weapon == WEP_NEX)
+       {
+               entity e = spawn();
+               setorigin(e, self.origin);
+               entity oldself;
+               oldself = self;
+               self = e;
+               spawnfunc_item_minst_cells();
+               self = oldself;
+               return TRUE;
+       }
+               
+       if(self.flags & FL_POWERUP)
+               return FALSE;
+               
+       if(self.ammo_cells > autocvar_g_minstagib_ammo_drop && self.classname != "item_minst_cells")
+               self.ammo_cells = autocvar_g_minstagib_ammo_drop;
+               
+       if(self.ammo_cells && !self.weapon)
+               return FALSE;
+               
+       return TRUE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_CustomizeWaypoint)
+{
+       entity e = WaypointSprite_getviewentity(other);
+       
+       // if you have the invisibility powerup, sprites ALWAYS are restricted to your team
+       // but only apply this to real players, not to spectators
+       if((self.owner.flags & FL_CLIENT) && (self.owner.items & IT_STRENGTH) && (e == other))
+       if(IsDifferentTeam(self.owner, e))
+               return TRUE;
+       
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_ItemCountdown)
+{
+       switch(self.items)
+       {
+               case IT_STRENGTH:   item_name = "item-invis"; item_color = '0 0 1'; break;
+               case IT_NAILS:      item_name = "item-extralife"; item_color = '1 0 0'; break;
+               case IT_INVINCIBLE: item_name = "item-speed"; item_color = '1 0 1'; break;
+       }
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_ItemTouch)
+{
+       if(self.ammo_cells)
+       {
+               // play some cool sounds ;)
+               if (IS_CLIENT(other))
+               {
+                       if(other.health <= 5)
+                               Send_Notification(NOTIF_ONE, other, MSG_ANNCE, ANNCE_MINSTAGIB_LASTSECOND);
+                       else if(other.health < 50)
+                               Send_Notification(NOTIF_ONE, other, MSG_ANNCE, ANNCE_MINSTAGIB_NARROWLY);
+               }
+
+               if(other.health < 100)
+                       other.health = 100;
+       }
+       
+       if(self.max_health)
+       {
+               other.armorvalue = bound(other.armorvalue, 999, other.armorvalue + autocvar_g_minstagib_extralives);
+               Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_EXTRALIVES);
+       }
+               
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_OnEntityPreSpawn)
+{
+       if not(autocvar_g_powerups) { return FALSE; }
+       if not(self.classname == "item_strength" || self.classname == "item_invincible" || self.classname == "item_health_mega")
+               return FALSE;
+       
+       entity e = spawn();
+       
+       if(random() < 0.3)
+               e.think = spawnfunc_item_strength;
+       else if(random() < 0.6)
+               e.think = minstagib_health_mega;
+       else
+               e.think = spawnfunc_item_invincible;
+               
+       e.nextthink = time + 0.1;
+       e.spawnflags = self.spawnflags;
+       e.noalign = self.noalign;
+       setorigin(e, self.origin);
+       
+       return TRUE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsString)
+{
+       ret_string = strcat(ret_string, ":MinstaGib");
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(minstagib_BuildMutatorsPrettyString)
+{
+       ret_string = strcat(ret_string, ", MinstaGib");
+       return FALSE;
+}
+
+MUTATOR_DEFINITION(mutator_minstagib)
+{
+       MUTATOR_HOOK(MatchEnd, minstagib_MatchEnd, CBC_ORDER_ANY);
+       MUTATOR_HOOK(BotShouldAttack, minstagib_BotShouldAttack, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerPhysics, minstagib_PlayerPhysics, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerSpawn, minstagib_PlayerSpawn, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerDamage_Calculate, minstagib_PlayerDamage, CBC_ORDER_ANY);
+       MUTATOR_HOOK(MakePlayerObserver, minstagib_MakePlayerObserver, CBC_ORDER_ANY);
+       MUTATOR_HOOK(SetStartItems, minstagib_SetStartItems, CBC_ORDER_ANY);
+       MUTATOR_HOOK(ItemTouch, minstagib_ItemTouch, CBC_ORDER_ANY);
+       MUTATOR_HOOK(FilterItem, minstagib_FilterItem, CBC_ORDER_ANY);
+       MUTATOR_HOOK(CustomizeWaypoint, minstagib_CustomizeWaypoint, CBC_ORDER_ANY);
+       MUTATOR_HOOK(Item_RespawnCountdown, minstagib_ItemCountdown, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, minstagib_SplitHealthArmor, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerPowerups, minstagib_PlayerPowerups, CBC_ORDER_ANY);
+       MUTATOR_HOOK(ForbidThrowCurrentWeapon, minstagib_ForbidThrowing, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerPreThink, minstagib_PlayerPreThink, CBC_ORDER_ANY);
+       MUTATOR_HOOK(OnEntityPreSpawn, minstagib_OnEntityPreSpawn, CBC_ORDER_ANY);
+       MUTATOR_HOOK(BuildMutatorsString, minstagib_BuildMutatorsString, CBC_ORDER_ANY);
+       MUTATOR_HOOK(BuildMutatorsPrettyString, minstagib_BuildMutatorsPrettyString, CBC_ORDER_ANY);
+
+       return FALSE;
+}
index d5f95bd3039465f4df277b7ec389f6909a37c549..21285b53a0b62c627065d2d6144ede7f5b2dae2f 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 8f289e5c3b5e0f5821b0df4bc5b99ecbb3c7da2e..b11ee77ebc3d82cc1dba250e149953f43930ab80 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")
@@ -443,7 +443,7 @@ void superspec_hello()
 
 MUTATOR_HOOKFUNCTION(superspec_ClientConnect)
 {
-       if(clienttype(self) != CLIENTTYPE_REAL)
+       if(!IS_REAL_CLIENT(self))
                return FALSE;
 
        string fn = "superspec-local.options";
index 40a925b3ce835fbc24c9b64f424d9022690dd0bc..1aa293b39ea260efd53f3c7a80cf1325ea749d32 100644 (file)
@@ -5,7 +5,8 @@ MUTATOR_HOOKFUNCTION(vampire_PlayerDamage)
        if(g_minstagib)
        {
                // minstagib: each hit means +1 ammo
-               frag_attacker.ammo_cells += 2; // note: 1 cell was deducted for the shot
+               if(frag_attacker != frag_target)
+                       frag_attacker.ammo_cells += 2; // note: 1 cell was deducted for the shot
        }
        else
        {
index dab42bd65d8c39287701a4c3cffb3daf808f9609..3f9f020affc086c1968fbe80a2bfc64bd9a3d5e3 100644 (file)
@@ -19,6 +19,7 @@ MUTATOR_DECLARATION(mutator_spawn_near_teammate);
 MUTATOR_DECLARATION(mutator_physical_items);
 MUTATOR_DECLARATION(mutator_vampire);
 MUTATOR_DECLARATION(mutator_superspec);
+MUTATOR_DECLARATION(mutator_minstagib);
 MUTATOR_DECLARATION(mutator_touchexplode);
 
 MUTATOR_DECLARATION(sandbox);
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 f0b9c5b21861a8095913ca6fc3066a53590c4411..d5b14bcdd87cc37603383746944c2f1b2daf6eae 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 b3cc22ddaa7a785c9a44472025a74e1b0cde3cb3..957710c3f86edcb4369691d478f0fa79785e6791 100644 (file)
@@ -242,6 +242,7 @@ mutators/mutator_spawn_near_teammate.qc
 mutators/mutator_physical_items.qc
 mutators/sandbox.qc
 mutators/mutator_superspec.qc
+mutators/mutator_minstagib.qc
 mutators/mutator_touchexplode.qc
 
 ../warpzonelib/anglestransform.qc
index 6ec8a68e4935cbd9ce7f6ee35e68b90f1f8eb401..63d846f1fd03ad861dc53de314b1c155356896ec 100644 (file)
@@ -457,7 +457,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;
@@ -466,7 +466,7 @@ void checkpoint_passed()
                self.message = oldmsg;
        }
 
-       if(other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
 
        /*
index ad10fa5d53accf9baa0e4791a96215acc0bf691c..28715147bd7138cd41e86e0e8d87eca051864ffa 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 && p.caplayer != 1 && !g_lms)
+                       if(!IS_PLAYER(p) && !g_arena && p.caplayer != 1 && !g_lms)
                                s = strcat(s, ":spectator");
                }
                else
                {
-                       if(p.classname == "player" || g_arena || p.caplayer == 1 || g_lms)
+                       if(IS_PLAYER(p) || g_arena || p.caplayer == 1 || 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 8d81e03806267b9c5b565aa495ade4744cffa619..538dcc62c624b173caa59b1ff53686a39dd50109 100644 (file)
@@ -175,9 +175,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 40abd18b135fe920265d197357927a458308f990..cb6700a2cfb60a3a5e2e289ff82761976dada93a 100644 (file)
@@ -271,11 +271,6 @@ float ItemSend(entity to, float sf)
 
 float have_pickup_item(void)
 {
-       // minstagib: only allow filtered items
-       if(g_minstagib)
-               if(self.classname != "minstagib")
-                       return FALSE;
-
        if(self.flags & FL_POWERUP)
        {
                if(autocvar_g_powerups > 0)
@@ -440,9 +435,10 @@ void Item_Show (entity e, float mode)
 void Item_Respawn (void)
 {
        Item_Show(self, 1);
-       if(!g_minstagib && self.items == IT_STRENGTH)
+       // this is ugly...
+       if(self.items == IT_STRENGTH)
                sound (self, CH_TRIGGER, "misc/strength_respawn.wav", VOL_BASE, ATTN_NORM);     // play respawn sound
-       else if(!g_minstagib && self.items == IT_INVINCIBLE)
+       else if(self.items == IT_INVINCIBLE)
                sound (self, CH_TRIGGER, "misc/shield_respawn.wav", VOL_BASE, ATTN_NORM);       // play respawn sound
        else
                sound (self, CH_TRIGGER, "misc/itemrespawn.wav", VOL_BASE, ATTN_NORM);  // play respawn sound
@@ -469,28 +465,18 @@ void Item_RespawnCountdown (void)
                        string name;
                        vector rgb = '1 0 1';
                        name = string_null;
-                       if(g_minstagib)
-                       {
-                               switch(self.items)
-                               {
-                                       case IT_STRENGTH:   name = "item-invis"; rgb = '0 0 1'; break;
-                                       case IT_NAILS:      name = "item-extralife"; rgb = '1 0 0'; break;
-                                       case IT_INVINCIBLE: name = "item-speed"; rgb = '1 0 1'; break;
-                               }
-                       }
-                       else
-                       {
-                               switch(self.items)
-                               {
-                                       case IT_STRENGTH:   name = "item-strength"; rgb = '0 0 1'; break;
-                                       case IT_INVINCIBLE: name = "item-shield"; rgb = '1 0 1'; break;
-                               }
-                       }
                        switch(self.items)
                        {
-                               case IT_FUEL_REGEN:     name = "item-fuelregen"; rgb = '1 0.5 0'; break;
-                               case IT_JETPACK:        name = "item-jetpack"; rgb = '0.5 0.5 0.5'; break;
+                               case IT_FUEL_REGEN: name = "item-fuelregen"; rgb = '1 0.5 0'; break;
+                               case IT_JETPACK:    name = "item-jetpack"; rgb = '0.5 0.5 0.5'; break;
+                               case IT_STRENGTH:   name = "item-strength"; rgb = '0 0 1'; break;
+                               case IT_INVINCIBLE: name = "item-shield"; rgb = '1 0 1'; break;
                        }
+                       item_name = name;
+                       item_color = rgb;
+                       MUTATOR_CALLHOOK(Item_RespawnCountdown);
+                       name = item_name;
+                       rgb = item_color;
                        if(self.flags & FL_WEAPON)
                        {
                                entity wi = get_weaponinfo(self.weapon);
@@ -610,130 +596,69 @@ float Item_GiveTo(entity item, entity player)
        // if nothing happens to player, just return without taking the item
        pickedup = FALSE;
        _switchweapon = FALSE;
+       // in case the player has autoswitch enabled do the following:
+       // if the player is using their best weapon before items are given, they
+       // probably want to switch to an even better weapon after items are given
+       if (player.autoswitch)
+       if (player.switchweapon == w_getbestweapon(player))
+               _switchweapon = TRUE;
 
-       if (g_minstagib)
-       {
-               float prevcells = player.ammo_cells;
-
-               pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL);
-               pickedup |= Item_GiveAmmoTo(item, player, ammo_cells, 999, ITEM_MODE_NONE);
-
-               if(player.ammo_cells > prevcells)
-               {
-                       _switchweapon = TRUE;
-
-                       // play some cool sounds ;)
-                       if (clienttype(player) == CLIENTTYPE_REAL)
-                       {
-                               if(player.health <= 5)
-                                       Send_Notification(NOTIF_ONE, player, MSG_ANNCE, ANNCE_MINSTAGIB_LASTSECOND);
-                               else if(player.health < 50)
-                                       Send_Notification(NOTIF_ONE, player, MSG_ANNCE, ANNCE_MINSTAGIB_NARROWLY);
-                       }
-                       // sound not available
-                       // else if(item.items == IT_CELLS)
-                       //      AnnounceTo(player, "ammo");
+       if not(WEPSET_CONTAINS_EW(player, player.switchweapon))
+               _switchweapon = TRUE;
 
-                       if (WEPSET_CONTAINS_EW(item, WEP_MINSTANEX))
-                               W_GiveWeapon (player, WEP_MINSTANEX);
-                       player.health = 100;
-               }
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_shells, g_pickup_shells_max, ITEM_MODE_NONE);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_nails, g_pickup_nails_max, ITEM_MODE_NONE);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_rockets, g_pickup_rockets_max, ITEM_MODE_NONE);
+       pickedup |= Item_GiveAmmoTo(item, player, ammo_cells, g_pickup_cells_max, ITEM_MODE_NONE);
+       pickedup |= Item_GiveAmmoTo(item, player, health, item.max_health, ITEM_MODE_HEALTH);
+       pickedup |= Item_GiveAmmoTo(item, player, armorvalue, item.max_armorvalue, ITEM_MODE_ARMOR);
 
-               if((it = (item.items - (item.items & player.items)) & IT_PICKUPMASK))
-               {
-                       pickedup = TRUE;
-                       player.items |= it;
-                       sprint (player, strcat("You got the ^2", item.netname, "\n"));
-               }
+       if (item.flags & FL_WEAPON)
+       {
+               WEPSET_DECLARE_A(it);
+               WEPSET_COPY_AE(it, item);
+               WEPSET_ANDNOT_AE(it, player);
 
-               // extralife powerup
-               if (item.max_health)
+               if (!WEPSET_EMPTY_A(it) || (item.spawnshieldtime && item.pickup_anyway))
                {
                        pickedup = TRUE;
-                       // sound not available
-                       // AnnounceTo(player, "_lives");
-                       player.armorvalue = bound(player.armorvalue, 999, player.armorvalue + autocvar_g_minstagib_extralives);
-                       Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_EXTRALIVES);
+                       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+                       if(WEPSET_CONTAINS_AW(it, i))
+                               W_GiveWeapon(player, i);
                }
+       }
 
-               // invis powerup
-               if (item.strength_finished)
-               {
-                       pickedup = TRUE;
-                       // sound not available
-                       // AnnounceTo(player, "invisible");
-                       player.strength_finished = max(player.strength_finished, time) + autocvar_g_balance_powerup_strength_time;
-               }
+       if((it = (item.items - (item.items & player.items)) & IT_PICKUPMASK))
+       {
+               pickedup = TRUE;
+               player.items |= it;
+               sprint (player, strcat("You got the ^2", item.netname, "\n"));
+       }
 
-               // speed powerup
-               if (item.invincible_finished)
-               {
-                       pickedup = TRUE;
-                       // sound not available
-                       // AnnounceTo(player, "speed");
-                       player.invincible_finished = max(player.invincible_finished, time) + autocvar_g_balance_powerup_invincible_time;
-               }
+       if (item.strength_finished)
+       {
+               pickedup = TRUE;
+               player.strength_finished = max(player.strength_finished, time) + item.strength_finished;
        }
-       else
+       if (item.invincible_finished)
        {
-               // in case the player has autoswitch enabled do the following:
-               // if the player is using their best weapon before items are given, they
-               // probably want to switch to an even better weapon after items are given
-               if (player.autoswitch)
-               if (player.switchweapon == w_getbestweapon(player))
-                       _switchweapon = TRUE;
-
-               if not(WEPSET_CONTAINS_EW(player, player.switchweapon))
-                       _switchweapon = TRUE;
-
-               pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL);
-               pickedup |= Item_GiveAmmoTo(item, player, ammo_shells, g_pickup_shells_max, ITEM_MODE_NONE);
-               pickedup |= Item_GiveAmmoTo(item, player, ammo_nails, g_pickup_nails_max, ITEM_MODE_NONE);
-               pickedup |= Item_GiveAmmoTo(item, player, ammo_rockets, g_pickup_rockets_max, ITEM_MODE_NONE);
-               pickedup |= Item_GiveAmmoTo(item, player, ammo_cells, g_pickup_cells_max, ITEM_MODE_NONE);
-               pickedup |= Item_GiveAmmoTo(item, player, health, item.max_health, ITEM_MODE_HEALTH);
-               pickedup |= Item_GiveAmmoTo(item, player, armorvalue, item.max_armorvalue, ITEM_MODE_ARMOR);
-
-               if (item.flags & FL_WEAPON)
-               {
-                       WEPSET_DECLARE_A(it);
-                       WEPSET_COPY_AE(it, item);
-                       WEPSET_ANDNOT_AE(it, player);
-
-                       if (!WEPSET_EMPTY_A(it) || (item.spawnshieldtime && self.pickup_anyway))
-                       {
-                               pickedup = TRUE;
-                               for(i = WEP_FIRST; i <= WEP_LAST; ++i)
-                                       if(WEPSET_CONTAINS_AW(it, i))
-                                               W_GiveWeapon(player, i);
-                       }
-               }
-
-               if((it = (item.items - (item.items & player.items)) & IT_PICKUPMASK))
-               {
-                       pickedup = TRUE;
-                       player.items |= it;
-                       sprint (player, strcat("You got the ^2", item.netname, "\n"));
-               }
-
-               if (item.strength_finished)
-               {
-                       pickedup = TRUE;
-                       player.strength_finished = max(player.strength_finished, time) + item.strength_finished;
-               }
-               if (item.invincible_finished)
-               {
-                       pickedup = TRUE;
-                       player.invincible_finished = max(player.invincible_finished, time) + item.invincible_finished;
-               }
-               if (item.superweapons_finished)
-               {
-                       pickedup = TRUE;
-                       player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished;
-               }
+               pickedup = TRUE;
+               player.invincible_finished = max(player.invincible_finished, time) + item.invincible_finished;
+       }
+       if (item.superweapons_finished)
+       {
+               pickedup = TRUE;
+               player.superweapons_finished = max(player.superweapons_finished, time) + item.superweapons_finished;
+       }
+       if (item.max_health)
+       {
+               pickedup = TRUE;
+               // extra life powerup handled by mutators
        }
 
 :skip
+       
        // always eat teamed entities
        if(item.team)
                pickedup = TRUE;
@@ -762,7 +687,7 @@ void Item_Touch (void)
                }
        }
 
-       if (other.classname != "player")
+       if not(IS_PLAYER(other))
                return;
        if (other.deadflag)
                return;
@@ -1148,9 +1073,9 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
                precache_sound (self.item_pickupsound);
 
                precache_sound ("misc/itemrespawncountdown.wav");
-               if(!g_minstagib && itemid == IT_STRENGTH)
+               if(itemid == IT_STRENGTH)
                        precache_sound ("misc/strength_respawn.wav");
-               else if(!g_minstagib && itemid == IT_INVINCIBLE)
+               else if(itemid == IT_INVINCIBLE)
                        precache_sound ("misc/shield_respawn.wav");
                else
                        precache_sound ("misc/itemrespawn.wav");
@@ -1220,69 +1145,6 @@ void StartItem (string itemmodel, string pickupsound, float defaultrespawntime,
        }
 }
 
-/* replace items in minstagib
- * IT_STRENGTH  = invisibility
- * IT_NAILS     = extra lives
- * IT_INVINCIBLE = speed
- */
-void minstagib_items (float itemid) // will be deleted soon.
-{
-       float rnd;
-       self.classname = "minstagib"; // ...?
-
-       // replace rocket launchers and nex guns with ammo cells
-       if (itemid == IT_CELLS)
-       {
-               self.ammo_cells = autocvar_g_minstagib_ammo_drop;
-               StartItem ("models/items/a_cells.md3",
-                       "misc/itempickup.wav", 45, 0,
-                       "MinstaNex Ammo", IT_CELLS, 0, 0, generic_pickupevalfunc, 100);
-               return;
-       }
-
-       // randomize
-       rnd = random() * 3;
-       if (rnd <= 1)
-               itemid = IT_STRENGTH;
-       else if (rnd <= 2)
-               itemid = IT_NAILS;
-       else
-               itemid = IT_INVINCIBLE;
-
-       // replace with invis
-       if (itemid == IT_STRENGTH)
-       {
-               if(!self.strength_finished)
-                       self.strength_finished = autocvar_g_balance_powerup_strength_time;
-               StartItem ("models/items/g_strength.md3",
-                       "misc/powerup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
-                       "Invisibility", IT_STRENGTH, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID);
-       }
-       // replace with extra lives
-       if (itemid == IT_NAILS)
-       {
-               self.max_health = 1;
-               StartItem ("models/items/g_h100.md3",
-                       "misc/megahealth.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
-                       "Extralife", IT_NAILS, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
-       }
-       // replace with speed
-       if (itemid == IT_INVINCIBLE)
-       {
-               if(!self.invincible_finished)
-                       self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
-               StartItem ("models/items/g_invincible.md3",
-                       "misc/powerup_shield.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup,
-                       "Speed", IT_INVINCIBLE, 0, FL_POWERUP, generic_pickupevalfunc, BOT_PICKUP_RATING_MID);
-       }
-}
-
-float minst_no_auto_cells;
-void minst_remove_item (void) {
-       if(minst_no_auto_cells)
-               remove(self);
-}
-
 float weaponswapping;
 float internalteam;
 
@@ -1421,11 +1283,6 @@ void weapon_defaultspawnfunc(float wpn)
        if(self.team)
                f |= FL_NO_WEAPON_STAY;
 
-       // stupid minstagib hack, don't ask
-       if(g_minstagib)
-               if(self.ammo_cells)
-                       self.ammo_cells = autocvar_g_minstagib_ammo_drop;
-
        StartItem(e.model, "weapons/weaponpickup.wav", self.respawntime, self.respawntimejitter, e.message, 0, e.weapon, f, weapon_pickupevalfunc, e.bot_pickupbasevalue);
        if (self.modelindex) // don't precache if self was removed
                weapon_action(e.weapon, WR_PRECACHE);
@@ -1454,37 +1311,16 @@ void spawnfunc_weapon_shotgun (void) {
 
 void spawnfunc_weapon_nex (void)
 {
-       if (g_minstagib)
-       {
-               minstagib_items(IT_CELLS);
-               self.think = minst_remove_item;
-               self.nextthink = time;
-               return;
-       }
        weapon_defaultspawnfunc(WEP_NEX);
 }
 
 void spawnfunc_weapon_minstanex (void)
 {
-       if (g_minstagib)
-       {
-               minstagib_items(IT_CELLS);
-               self.think = minst_remove_item;
-               self.nextthink = time;
-               return;
-       }
        weapon_defaultspawnfunc(WEP_MINSTANEX);
 }
 
 void spawnfunc_weapon_rocketlauncher (void)
 {
-       if (g_minstagib)
-       {
-               minstagib_items(IT_CELLS); // replace rocketlauncher with cells
-               self.think = minst_remove_item;
-               self.nextthink = time;
-               return;
-       }
        weapon_defaultspawnfunc(WEP_ROCKET_LAUNCHER);
 }
 
@@ -1612,9 +1448,6 @@ void spawnfunc_item_health_large (void) {
 }
 
 void spawnfunc_item_health_mega (void) {
-       if(g_minstagib) {
-               minstagib_items(IT_NAILS);
-       } else {
                if(!self.max_health)
                        self.max_health = g_pickup_healthmega_max;
                if(!self.health)
@@ -1622,7 +1455,6 @@ void spawnfunc_item_health_mega (void) {
                if(!self.pickup_anyway)
                        self.pickup_anyway = g_pickup_healthmega_anyway;
                StartItem ("models/items/g_h100.md3", "misc/megahealth.wav", g_pickup_respawntime_long, g_pickup_respawntimejitter_long, "100 Health", IT_HEALTH, 0, 0, commodity_pickupevalfunc, BOT_PICKUP_RATING_HIGH);
-       }
 }
 
 // support old misnamed entities
@@ -1633,34 +1465,16 @@ void spawnfunc_item_health25() { spawnfunc_item_health_medium(); }
 void spawnfunc_item_health100() { spawnfunc_item_health_mega(); }
 
 void spawnfunc_item_strength (void) {
-       if(g_minstagib) {
-               minstagib_items(IT_STRENGTH);
-       } else {
                precache_sound("weapons/strength_fire.wav");
                if(!self.strength_finished)
                        self.strength_finished = autocvar_g_balance_powerup_strength_time;
                StartItem ("models/items/g_strength.md3", "misc/powerup.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Strength Powerup", IT_STRENGTH, 0, FL_POWERUP, generic_pickupevalfunc, 100000);
-       }
 }
 
 void spawnfunc_item_invincible (void) {
-       if(g_minstagib) {
-               minstagib_items(IT_INVINCIBLE);
-       } else {
                if(!self.invincible_finished)
                        self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
                StartItem ("models/items/g_invincible.md3", "misc/powerup_shield.wav", g_pickup_respawntime_powerup, g_pickup_respawntimejitter_powerup, "Shield", IT_INVINCIBLE, 0, FL_POWERUP, generic_pickupevalfunc, 100000);
-       }
-}
-
-void spawnfunc_item_minst_cells (void) {
-       if (g_minstagib)
-       {
-               minst_no_auto_cells = TRUE;
-               minstagib_items(IT_CELLS);
-       }
-       else
-               remove(self);
 }
 
 // compatibility:
@@ -1676,7 +1490,7 @@ void target_items_use (void)
                return;
        }
 
-       if(activator.classname != "player")
+       if not(IS_PLAYER(activator))
                return;
        if(activator.deadflag != DEAD_NO)
                return;
@@ -2152,12 +1966,6 @@ float GiveItems(entity e, float beginarg, float endarg)
                if(WEPSET_CONTAINS_ANY_EA(self, WEPBIT_SUPERWEAPONS))
                        e.superweapons_finished = autocvar_g_balance_superweapons_time;
 
-       if (g_minstagib)
-       {
-               e.health = bound(0, e.health, 100);
-               e.armorvalue = bound(0, e.armorvalue, 999);
-       }
-
        if(e.strength_finished <= 0)
                e.strength_finished = 0;
        else
index 0b6f7fc4cd9488357ccb0b0110adf3adf87a18ec..fba705c28afd229aa5676ebc329bbff1fdba7ea1 100644 (file)
@@ -166,7 +166,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;
@@ -178,9 +178,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;
@@ -194,7 +192,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 16236dd16ba7d93fb52210553efe8d0ca89a5078..0ba1e7c8481db848019a0f856fdf70ee236e0b32 100644 (file)
@@ -270,9 +270,7 @@ string getwelcomemessage(void)
        ret_string = "";
        MUTATOR_CALLHOOK(BuildMutatorsPrettyString);
        modifications = ret_string;
-       
-       if(g_minstagib)
-               modifications = strcat(modifications, ", MinstaGib");
+
        if(g_weaponarena)
        {
                if(g_weaponarena_random)
@@ -464,7 +462,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;
@@ -472,7 +470,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;
@@ -510,7 +508,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
@@ -519,7 +517,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;
@@ -600,7 +598,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)
                {
@@ -658,7 +656,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");
@@ -841,7 +839,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);
@@ -849,7 +847,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 726aa7be44c9df5f6963e79a5af55ac820a038bc..48a457a573dd04e3048cd8e1c11e1c4691a535a7 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 429b8e5f9f8c55cdf709e2e405c5481dffb74527..a530680632592cb5158e8d430b938e57fe30beb8 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 1b1ae3f647628626c24440d0b020ac8654909be1..40c90943e7d4d0b65d128aee672b8f12f1b66d20 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 2e0c1e8f02bbcd466773894e43e3da4df52104f5..a2de5dab04be64621a6742d0c024ac05aa69e79f 100644 (file)
@@ -11,8 +11,7 @@ void W_GiveWeapon (entity e, float wep)
        oldself = self;
        self = e;
 
-       if not(g_minstagib)
-       if(other.classname == "player")
+       if(IS_PLAYER(other))
                { Send_Notification(NOTIF_ONE, other, MSG_MULTI, ITEM_WEAPON_GOT, wep); }
 
        self = oldself;
@@ -105,7 +104,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 +444,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 +617,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 972642343b38c068317eeb1ec5b1cae944e6fdfb..29af116bc4977dbd80f7be4311761bdaff1b8b87 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 4d243a513575bb04ab1703521d2c981801cb8c3c..7d9ef6c04e3a39b937899414abe51c0cee345a59 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 cdcf841e018956e11b48ddd61afe7903f76e1fca..dcf06ceaa7f168e7e76fc0a549b3ccad62724c65 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 69dcb17aa5c292d4328b539668c8dac674f76935..f2a4ba281509d6ff7df6a9f17a3d613e684a1b46 100644 (file)
@@ -34,19 +34,11 @@ void W_Laser_Attack (float issecondary)
        entity missile;
        vector s_forward;
        float a;
-       float nodamage;
-
-       if(issecondary == 2) // minstanex shot
-               nodamage = g_minstagib;
-       else
-               nodamage = FALSE;
 
        a = autocvar_g_balance_laser_primary_shotangle;
        s_forward = v_forward * cos(a * DEG2RAD) + v_up * sin(a * DEG2RAD);
 
-       if(nodamage)
-               W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, 0);
-       else if(issecondary == 1)
+       if(issecondary == 1)
                W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, autocvar_g_balance_laser_secondary_damage);
        else
                W_SetupShot_Dir (self, s_forward, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, autocvar_g_balance_laser_primary_damage);
@@ -56,11 +48,8 @@ void W_Laser_Attack (float issecondary)
        missile.owner = missile.realowner = self;
        missile.classname = "laserbolt";
        missile.dmg = 0;
-       if(!nodamage)
-       {
-               missile.bot_dodge = TRUE;
-               missile.bot_dodgerating = autocvar_g_balance_laser_primary_damage;
-       }
+       missile.bot_dodge = TRUE;
+       missile.bot_dodgerating = autocvar_g_balance_laser_primary_damage;
 
        PROJECTILE_MAKETRIGGER(missile);
        missile.projectiledeathtype = WEP_LASER;
index 40c60e827e3adc024457f462577d6a2b68b32ac0..813bcff75508c01b044c43cfef5a48ff92593863 100644 (file)
@@ -62,7 +62,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))
@@ -185,7 +185,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;
@@ -197,7 +197,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)
                {
@@ -233,7 +233,7 @@ void W_Mine_Touch (void)
                return;
        }
 
-       if(other && other.classname == "player" && other.deadflag == DEAD_NO)
+       if(other && IS_PLAYER(other) && other.deadflag == DEAD_NO)
        {
                // hit a player
                // don't stick
@@ -435,7 +435,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 611319a16cd94f4794e5606ed55fb35205f4a54b..2ad71ce798667a92a5fa6d63e0f0b6fc8adca963 100644 (file)
@@ -16,20 +16,12 @@ void W_MinstaNex_Attack (void)
        damage_goodhits = 0;
        FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_MINSTANEX);
 
-       if(g_minstagib)
+       if(yoda && flying)
+               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
+       if(damage_goodhits && self.minstanex_lasthit)
        {
-               if(yoda)
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
-       }
-       else
-       {
-               if(yoda && flying)
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
-               if(damage_goodhits && self.minstanex_lasthit)
-               {
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
-                       damage_goodhits = 0; // only every second time
-               }
+               Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
+               damage_goodhits = 0; // only every second time
        }
 
        self.minstanex_lasthit = damage_goodhits;
@@ -39,129 +31,41 @@ void W_MinstaNex_Attack (void)
        // teamcolor / hit beam effect
        vector v;
        v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
-       if(teamplay)
-       {
-           switch(self.team)
-           {
-            case NUM_TEAM_1:   // Red
-                if(damage_goodhits)
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
-                else
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
-                break;
-            case NUM_TEAM_2:   // Blue
-                if(damage_goodhits)
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
-                else
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
-                break;
-            case NUM_TEAM_3:   // Yellow
-                if(damage_goodhits)
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
-                else
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
-                break;
-            case NUM_TEAM_4:   // Pink
-                if(damage_goodhits)
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
-                else
-                    WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
-                break;
-           }
-       }
-       else
-        WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
-
-       if (g_minstagib)
-               W_DecreaseAmmo(ammo_cells, 1, autocvar_g_balance_minstanex_reload_ammo);
-       else
-               W_DecreaseAmmo(ammo_cells, autocvar_g_balance_minstanex_ammo, autocvar_g_balance_minstanex_reload_ammo);
-}
-
-
-.float minstagib_nextthink;
-.float minstagib_needammo;
-void minstagib_stop_countdown(entity e)
-{
-       if (!e.minstagib_needammo)
-               return;
-       Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER_CPID, CPID_MINSTA_FINDAMMO);
-       e.minstagib_needammo = FALSE;
-}
-void minstagib_ammocheck(void)
-{
-       if (time < self.minstagib_nextthink)
-               return;
-
-       if (self.deadflag || gameover || (self.flags & FL_GODMODE))
-               minstagib_stop_countdown(self);
-       else if (self.ammo_cells > 0 || (self.items & IT_UNLIMITED_WEAPON_AMMO))
-       {
-               if (self.minstagib_needammo)
-                       self.health = 100;
-               minstagib_stop_countdown(self);
-       }
-       else
-       {
-               self.minstagib_needammo = TRUE;
-               if (self.health == 5)
-               {
-                       Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_MINSTAGIB_TERMINATED);
-               }
-               else if (self.health == 10)
-               {
-                       Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_1);
-               }
-               else if (self.health == 20)
-               {
-                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_2);
-               }
-               else if (self.health == 30)
-               {
-                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_3);
-               }
-               else if (self.health == 40)
-               {
-                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_4);
-               }
-               else if (self.health == 50)
-               {
-                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_5);
-               }
-               else if (self.health == 60)
-               {
-                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_6);
-               }
-               else if (self.health == 70)
-               {
-                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_7);
-               }
-               else if (self.health == 80)
-               {
-                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_8);
-               }
-               else if (self.health == 90)
-               {
-                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MINSTA_FINDAMMO);
-                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-                       Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_NUM_9);
-               }
-               else if (self.health == 100)
-               {
-                       Send_Notification(NOTIF_ONE_ONLY, self, MSG_MULTI, MULTI_MINSTA_FINDAMMO);
-                       Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
-               }
-       }
-       self.minstagib_nextthink = time + 1;
+       switch(self.team)
+       {
+               case NUM_TEAM_1:   // Red
+                       if(damage_goodhits)
+                               WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, v);
+                       else
+                               WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, v);
+                       break;
+               case NUM_TEAM_2:   // Blue
+                       if(damage_goodhits)
+                               WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, v);
+                       else
+                               WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, v);
+                       break;
+               case NUM_TEAM_3:   // Yellow
+                       if(damage_goodhits)
+                               WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, v);
+                       else
+                               WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, v);
+                       break;
+               case NUM_TEAM_4:   // Pink
+                       if(damage_goodhits)
+                               WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, v);
+                       else
+                               WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, v);
+                       break;
+               default:
+                       if(damage_goodhits)
+                               WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3_HIT"), w_shotorg, v);
+                       else
+                               WarpZone_TrailParticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, v);
+                       break;
+       }
+       
+       W_DecreaseAmmo(ammo_cells, ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo), autocvar_g_balance_minstanex_reload_ammo);
 }
 
 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
@@ -172,10 +76,7 @@ float w_minstanex(float req)
        float minstanex_ammo;
 
        // now multiple WR_s use this
-       if(g_minstagib)
-               minstanex_ammo = 1;
-       else
-               minstanex_ammo = autocvar_g_balance_minstanex_ammo;
+       minstanex_ammo = ((g_minstagib) ? 1 : autocvar_g_balance_minstanex_ammo);
 
        if (req == WR_AIM)
        {
index 250fc0d3bea089ff22db74c3633f54244e38f8b4..7548de88d5cfb96ed70c727f6b264ced34c71fb7 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 75f6a087d14256ef0b32ee3525809e847b47cf41..b9a0dba0cf4b0eb2a76a15377c45c4301b90d628 100644 (file)
@@ -85,13 +85,13 @@ void shotgun_meleethink (void)
                        + (v_up * swing_factor * autocvar_g_balance_shotgun_secondary_melee_swing_up)
                        + (v_right * swing_factor * autocvar_g_balance_shotgun_secondary_melee_swing_side));
 
-               WarpZone_traceline_antilag(self.realowner, self.realowner.origin + self.realowner.view_ofs, targpos, FALSE, self.realowner, ANTILAG_LATENCY(self.realowner));
+               WarpZone_traceline_antilag(self, self.realowner.origin + self.realowner.view_ofs, targpos, FALSE, self, ANTILAG_LATENCY(self.realowner));
                
                // draw lightning beams for debugging
                //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)  
@@ -151,7 +151,7 @@ void W_Shotgun_Attack2 (void)
 
        entity meleetemp;
        meleetemp = spawn();
-       meleetemp.owner = meleetemp.realowner = self;
+       meleetemp.realowner = self;
        meleetemp.think = shotgun_meleethink;
        meleetemp.nextthink = time + autocvar_g_balance_shotgun_secondary_melee_delay * W_WeaponRateFactor();
        W_SetupShot_Range(self, TRUE, 0, "", 0, autocvar_g_balance_shotgun_secondary_damage, autocvar_g_balance_shotgun_secondary_melee_range);
index 0e6f2168b863b50c94a7c49dd20659a9315ed879..d58985312200f4754fefc2bf0d984cea063ed8dc 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")
@@ -238,14 +238,8 @@ float WaypointSprite_Customize()
        entity e;
        e = WaypointSprite_getviewentity(other);
 
-       // 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(!WaypointSprite_isteammate(self.owner, e))
-                       return FALSE;
-       }
+       if(MUTATOR_CALLHOOK(CustomizeWaypoint))
+               return FALSE;
 
        return self.waypointsprite_visible_for_player(e);
 }
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)
        {
index 4030c64885d7945d728e9608a309c2b742e8e063..d28aa4cad6f258d4b058aa7b468e5ebc7fc63e61 100644 (file)
@@ -13,7 +13,7 @@ set g_vehicle_bumblebee 1
 set g_vehicles_crush_dmg 70
 set g_vehicles_crush_force 50
 
-set cl_vehicles_hudscale 0.5way
+set cl_vehicles_hudscale 0.5
 
 set g_vehicles_delayspawn 1
 set g_vehicles_delayspawn_jitter 10
@@ -21,6 +21,6 @@ set g_vehicles_delayspawn_jitter 10
 set g_vehicles_nex_damagerate 0.5
 set g_vehicles_uzi_damagerate 0.65
 set g_vehicles_rifle_damagerate 1
-set g_vehicles_minstanex_damagerate 0.001
+set g_vehicles_minstanex_damagerate 0.007
 set g_vehicles_tag_damagerate 2