]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into TimePath/csqc_sounds
authorTimePath <andrew.hardaker1995@gmail.com>
Fri, 13 Nov 2015 03:15:19 +0000 (14:15 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Fri, 13 Nov 2015 03:17:50 +0000 (14:17 +1100)
# Conflicts:
# qcsrc/server/cl_player.qh

85 files changed:
check-translations.sh
languages.txt
qcsrc/client/commands/cl_cmd.qc
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud.qh
qcsrc/client/hud/panel/ammo.qc
qcsrc/client/hud/panel/powerups.qc
qcsrc/client/main.qc
qcsrc/client/mutators/events.qh
qcsrc/client/progs.inc
qcsrc/client/t_items.qc
qcsrc/client/view.qc
qcsrc/client/weapons/projectile.qc
qcsrc/common/buffs/all.inc [deleted file]
qcsrc/common/buffs/all.qc [deleted file]
qcsrc/common/buffs/all.qh [deleted file]
qcsrc/common/command/all.qh
qcsrc/common/deathtypes/all.qh
qcsrc/common/effects/all.inc
qcsrc/common/effects/all.qh
qcsrc/common/effects/effectinfo.qc
qcsrc/common/effects/qc/damageeffects.qc
qcsrc/common/effects/qc/globalsound.qh
qcsrc/common/items/all.qh
qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh
qcsrc/common/minigames/cl_minigames.qh
qcsrc/common/minigames/sv_minigames.qh
qcsrc/common/models/all.qh
qcsrc/common/monsters/all.qh
qcsrc/common/mutators/all.inc
qcsrc/common/mutators/base.qh
qcsrc/common/mutators/events.qh
qcsrc/common/mutators/mutator/buffs/all.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/buffs/all.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/buffs/all.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/buffs/module.inc
qcsrc/common/mutators/mutator/instagib/instagib.qc
qcsrc/common/mutators/mutator/nades/effects.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/nades/module.inc
qcsrc/common/mutators/mutator/nades/nades.inc [new file with mode: 0644]
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/nades/nades.qh [new file with mode: 0644]
qcsrc/common/mutators/mutator/nades/net.qc [new file with mode: 0644]
qcsrc/common/mutators/mutator/waypoints/all.inc
qcsrc/common/mutators/mutator/waypoints/all.qh
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/nades/all.inc [deleted file]
qcsrc/common/nades/all.qc [deleted file]
qcsrc/common/nades/all.qh [deleted file]
qcsrc/common/net_notice.qc
qcsrc/common/notifications.qh
qcsrc/common/physics.qc
qcsrc/common/sounds/all.qh
qcsrc/common/triggers/misc/laser.qc
qcsrc/common/turrets/all.qh
qcsrc/common/vehicles/all.qh
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/lib/net.qh
qcsrc/lib/registry.qh
qcsrc/lib/stats.qh
qcsrc/lib/vector.qh
qcsrc/lib/warpzone/mathlib.qc
qcsrc/lib/warpzone/mathlib.qh
qcsrc/menu/gamesettings.qh
qcsrc/menu/item.qc
qcsrc/menu/menu.qc
qcsrc/menu/menu.qh
qcsrc/menu/sys-post.qh [deleted file]
qcsrc/menu/sys-pre.qh [deleted file]
qcsrc/menu/xonotic/crosshairpicker.qc
qcsrc/menu/xonotic/dialog_settings_game.qc
qcsrc/menu/xonotic/languagelist.qc
qcsrc/server/command/vote.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_world.qc
qcsrc/server/mutators/all.qc
qcsrc/server/progs.inc
qcsrc/server/t_quake3.qc
qcsrc/server/teamplay.qc
quickmenu_example.txt [new file with mode: 0644]

index facee4a7bc8fc4d49fe5d2f2089ed56d4c227037..a7406532d8d61829e952a19d91ccc5ccb0e28494 100755 (executable)
@@ -36,7 +36,8 @@ fi
 
 if [ x"$mode" = x"txt" ]; then
        {
-               echo "en English \"English\""
+               item=`grep "^en " languages.txt`
+               echo "$item"
                for X in common.*.po; do
                        [ -f "$X" ] || continue
                        if [ -n "$language" ]; then
@@ -67,9 +68,9 @@ if [ x"$mode" = x"txt" ]; then
                                if [ "$p" -lt 50 ]; then
                                        continue
                                fi
-                               item="$l $l \"$l (0%)\""
+                               item="$l $l \"$l\" 0%"
                        fi
-                       printf "%s\n" "$item" | sed -e "s/([0-9][0-9]*%)/($p%)/"
+                       printf "%s\n" "$item" | sed -e "s/[0-9][0-9]*%/$p%/"
                done
        } | tr '"' '\t' | sort -k3 | tr '\t' '"'
 fi
index a43c6cff46fa58a65421361b1356a0ded506dc95..9f0d1743b14bdfc98382aee4fdf9d7c5bfbeced8 100644 (file)
@@ -1,19 +1,19 @@
-ast Asturian "Asturianu (60%)"
-de German "Deutsch (90%)"
-de_CH German "Deutsch (Schweiz) (90%)"
-en_AU en_AU "en_AU (77%)"
-en English "English"
-es Spanish "Español (68%)"
-fr French "Français (98%)"
-it Italian "Italiano (97%)"
-hu Hungarian "Magyar (50%)"
-nl Dutch "Nederlands (45%)"
-pl Polish "Polski (60%)"
-pt Portuguese "Português (42%)"
-ro Romanian "Romana (90%)"
-fi Finnish "Suomi (35%)"
-el Greek "Ελληνική (25%)"
-be Belarusian "Беларуская (65%)"
-bg Bulgarian "Български (65%)"
-ru Russian "Русский (93%)"
-uk Ukrainian "Українська (60%)"
+ast   Asturian "Asturianu" 60%
+de    German "Deutsch" 90%
+de_CH German "Deutsch (Schweiz)" 90%
+en    English "English"
+en_AU English "English (Australia)" 77%
+es    Spanish "Español" 68%
+fr    French "Français" 98%
+it    Italian "Italiano" 97%
+hu    Hungarian "Magyar" 50%
+nl    Dutch "Nederlands" 45%
+pl    Polish "Polski" 60%
+pt    Portuguese "Português" 42%
+ro    Romanian "Romana" 90%
+fi    Finnish "Suomi" 35%
+el    Greek "Ελληνική" 25%
+be    Belarusian "Беларуская" 65%
+bg    Bulgarian "Български" 65%
+ru    Russian "Русский" 93%
+uk    Ukrainian "Українська" 60%
\ No newline at end of file
index 1c83438e534b5f9cde60a93d2c40aa61502114be..63e0c56126f7394c8ffd8eacbab9a9d194a229c6 100644 (file)
@@ -267,6 +267,13 @@ void LocalCommand_hud(int request, int argc)
 
                                case "quickmenu":
                                {
+                                       if (argv(2) == "help")
+                                       {
+                                               LOG_INFO(" quickmenu [[default | file | \"\"] submenu]\n");
+                                               LOG_INFO("Called without options (or with \"\") loads either the default quickmenu or a quickmenu file if hud_panel_quickmenu_file is set to a valid filename.\n");
+                                               LOG_INFO("A submenu name can be given to open the quickmenu directly in a submenu; it requires to specify 'default', 'file' or '\"\"' option.\n");
+                                               return;
+                                       }
                                        if (QuickMenu_IsOpened())
                                                QuickMenu_Close();
                                        else
@@ -336,10 +343,7 @@ void LocalCommand_hud(int request, int argc)
                        LOG_INFO("  'configname' is the name to save to for \"save\" action,\n");
                        LOG_INFO("  'radartoggle' is to control hud_panel_radar_maximized for \"radar\" action,\n");
                        LOG_INFO("  and 'layout' is how to organize the scoreboard columns for the set action.\n");
-                       LOG_INFO("  quickmenu [[default | file | \"\"] submenu]\n");
-                       LOG_INFO("    Called without options (or with " ") loads either the default quickmenu or a quickmenu file if hud_panel_quickmenu_file is set to a valid filename.\n");
-                       LOG_INFO("    Submenu option allows to open quickmenu directly in a submenu, it requires to specify 'default', 'file' or '\"\"' option.\n");
-                       LOG_INFO("  Full list of commands here: \"configure, minigame, save, scoreboard_columns_help, scoreboard_columns_set, radar.\"\n");
+                       LOG_INFO("  Full list of commands here: \"configure, quickmenu, minigame, save, scoreboard_columns_help, scoreboard_columns_set, radar.\"\n");
                        return;
                }
        }
index 1054e9bcb1cc8e95048dbda72fc8654ed63ce457..75e678275d80b55a32b70b9e42eb413f233db46b 100644 (file)
@@ -5,12 +5,10 @@
 #include "scoreboard.qh"
 #include "teamradar.qh"
 #include "t_items.qh"
-#include "../common/buffs/all.qh"
 #include "../common/deathtypes/all.qh"
 #include "../common/items/all.qc"
 #include "../common/mapinfo.qh"
 #include "../common/mutators/mutator/waypoints/all.qh"
-#include "../common/nades/all.qh"
 #include "../common/stats.qh"
 #include "../lib/csqcmodel/cl_player.qh"
 // TODO: remove
index 5c5a0fe96091968c3d5c66f62af18019364b93b9..7762d16c03706cfb6791238a11867674fbe92214 100644 (file)
@@ -8,11 +8,11 @@ void HUD_Radar_Mouse();
 
 REGISTRY(hud_panels, BITS(6))
 #define hud_panels_from(i) _hud_panels_from(i, NULL)
-REGISTER_REGISTRY(Registerhud_panels)
+REGISTER_REGISTRY(hud_panels)
 
 #define REGISTER_HUD_PANEL(id, draw_func, name, configflags, showflags) \
        void draw_func(); \
-       REGISTER(Registerhud_panels, HUD_PANEL, hud_panels, id, m_id, new(hud_panel)) { \
+       REGISTER(hud_panels, HUD_PANEL, id, m_id, new(hud_panel)) { \
                make_pure(this); \
                this.panel_id = this.m_id; \
                this.panel_draw = draw_func; \
index ac8fee0f10333484529051e823aa88af64e3ecbe..236a585985e8c983696284464d02b62277feb090 100644 (file)
@@ -10,41 +10,7 @@ void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector col
                autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
 }
 
-void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expand_time)
-{
-       float bonusNades    = getstatf(STAT_NADE_BONUS);
-       float bonusProgress = getstatf(STAT_NADE_BONUS_SCORE);
-       float bonusType     = getstati(STAT_NADE_BONUS_TYPE);
-       Nade def = Nades_from(bonusType);
-       vector nadeColor    = def.m_color;
-       string nadeIcon     = def.m_icon;
-
-       vector iconPos, textPos;
-
-       if(autocvar_hud_panel_ammo_iconalign)
-       {
-               iconPos = myPos + eX * 2 * mySize.y;
-               textPos = myPos;
-       }
-       else
-       {
-               iconPos = myPos;
-               textPos = myPos + eX * mySize.y;
-       }
-
-       if(bonusNades > 0 || bonusProgress > 0)
-       {
-               DrawNadeProgressBar(myPos, mySize, bonusProgress, nadeColor);
-
-               if(autocvar_hud_panel_ammo_text)
-                       drawstring_aspect(textPos, ftos(bonusNades), eX * (2/3) * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-
-               if(draw_expanding)
-                       drawpic_aspect_skin_expanding(iconPos, nadeIcon, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, expand_time);
-
-               drawpic_aspect_skin(iconPos, nadeIcon, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-       }
-}
+void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expand_time); // TODO: mutator
 
 void DrawAmmoItem(vector myPos, vector mySize, .int ammoType, bool isCurrent, bool isInfinite)
 {
index 4e509e5c5fc7db3de6336c58cc8e6d0ccc71ce62..10446d643605477a839f61b8f6ab89ec5f78e72a 100644 (file)
@@ -97,9 +97,7 @@ void HUD_Powerups()
        if(superTime)
                addPowerupItem("Superweapons", "superweapons", autocvar_hud_progressbar_superweapons_color, superTime, 30);
 
-       FOREACH(Buffs, it.m_itemid & allBuffs, LAMBDA(
-               addPowerupItem(it.m_prettyName, strcat("buff_", it.m_name), it.m_color, bound(0, getstatf(STAT_BUFF_TIME) - time, 99), 60);
-       ));
+       MUTATOR_CALLHOOK(HUD_Powerups_add);
 
        if(!powerupItemsCount)
                return;
index badc78ce69fca9ca08a318455741b88fdedccc0e..985489b81e37118cd05c011c26788173529ea884 100644 (file)
@@ -39,7 +39,7 @@ void CSQC_Init()
        prvm_language = strzone(cvar_string("prvm_language"));
 
 #ifdef WATERMARK
-       LOG_TRACEF("^4CSQC Build information: ^1%s\n", WATERMARK);
+       LOG_INFOF("^4CSQC Build information: ^1%s\n", WATERMARK);
 #endif
 
        binddb = db_create();
index 92f4558163156d02df204aa3a87648e66f8b7db3..baaba14aef2a0f6d5607f688f1d79192486f4d0c 100644 (file)
@@ -112,4 +112,29 @@ MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase);
 MUTATOR_HOOKABLE(AnnouncerOption, EV_AnnouncerOption);
 
 MUTATOR_HOOKABLE(Ent_Init, EV_NO_ARGS);
+
+#define EV_HUD_Draw_overlay(i, o) \
+       /**/ o(vector, MUTATOR_ARGV_0_vector) \
+       /**/ o(float, MUTATOR_ARGV_0_float) \
+       /**/
+MUTATOR_HOOKABLE(HUD_Draw_overlay, EV_HUD_Draw_overlay);
+
+MUTATOR_HOOKABLE(HUD_Powerups_add, EV_NO_ARGS);
+
+/** Return true to not draw any vortex beam */
+#define EV_Particles_VortexBeam(i, o) \
+       /**/ i(vector, vbeam_shotorg) \
+       /**/ i(vector, vbeam_endpos) \
+       /**/
+vector vbeam_shotorg;
+vector vbeam_endpos;
+MUTATOR_HOOKABLE(Particles_VortexBeam, EV_Particles_VortexBeam);
+
+/** Return true to not draw any impact effect */
+#define EV_Weapon_ImpactEffect(i, o) \
+       /**/ i(entity, w_hitwep) \
+       /**/
+entity w_hitwep;
+MUTATOR_HOOKABLE(Weapon_ImpactEffect, EV_Weapon_ImpactEffect);
+
 #endif
index 4e127917aa48cb136eeb6b77b2f788f81238d670..1e939b77035169aa0fd727d954155c9a4ccb1d45 100644 (file)
 #include "../common/minigames/minigames.qc"
 #include "../common/minigames/cl_minigames.qc"
 
-#include "../common/buffs/all.qc"
 #include "../common/deathtypes/all.qc"
 #include "../common/effects/all.qc"
 #include "../common/gamemodes/all.qc"
 #include "../common/items/all.qc"
 #include "../common/monsters/all.qc"
 #include "../common/mutators/all.qc"
-#include "../common/nades/all.qc"
 #include "../common/turrets/all.qc"
 #include "../common/vehicles/all.qc"
 #include "../common/weapons/all.qc"
index f4096b87a6a8fabed875b52faf37a62ca3e2edfc..b0e1315f69bf3d9abc33c5b9be58f4556e6363db 100644 (file)
@@ -1,5 +1,4 @@
 
-#include "../common/buffs/all.qh"
 #include "../common/movetypes/movetypes.qh"
 #include "../common/weapons/all.qh"
 #include "../lib/csqcmodel/cl_model.qh"
index c319dfcf0bdbc339d011fe6edb13ad2958cf9d5d..699e2d8ade41b81b6da5922980f2aa4449849009 100644 (file)
@@ -13,7 +13,6 @@
 #include "../common/debug.qh"
 #include "../common/mapinfo.qh"
 #include "../common/gamemodes/all.qh"
-#include "../common/nades/all.qh"
 #include "../common/stats.qh"
 #include "../common/triggers/target/music.qh"
 #include "../common/teams.qh"
@@ -1005,10 +1004,18 @@ void HUD_Crosshair()
 
 void HUD_Draw()
 {
-       if(getstati(STAT_FROZEN))
-               drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, ((getstatf(STAT_REVIVE_PROGRESS)) ? ('0.25 0.90 1' + ('1 0 0' * getstatf(STAT_REVIVE_PROGRESS)) + ('0 1 1' * getstatf(STAT_REVIVE_PROGRESS) * -1)) : '0.25 0.90 1'), autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE);
-       else if (getstatf(STAT_HEALING_ORB)>time)
-               drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, NADE_TYPE_HEAL.m_color, autocvar_hud_colorflash_alpha*getstatf(STAT_HEALING_ORB_ALPHA), DRAWFLAG_ADDITIVE);
+       vector rgb = '0 0 0';
+       float a = 1;
+       if (MUTATOR_CALLHOOK(HUD_Draw_overlay))
+       {
+               rgb = MUTATOR_ARGV(0, vector);
+               a = MUTATOR_ARGV(0, float);
+       }
+       else if(getstati(STAT_FROZEN))
+       {
+               rgb = ((getstatf(STAT_REVIVE_PROGRESS)) ? ('0.25 0.90 1' + ('1 0 0' * getstatf(STAT_REVIVE_PROGRESS)) + ('0 1 1' * getstatf(STAT_REVIVE_PROGRESS) * -1)) : '0.25 0.90 1');
+       }
+       drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, rgb, autocvar_hud_colorflash_alpha * a, DRAWFLAG_ADDITIVE);
        if(!intermission)
        if(getstatf(STAT_NADE_TIMER) && autocvar_cl_nade_timer) // give nade top priority, as it's a matter of life and death
        {
index 04a600cb694ffcfeb1be630e459f56a9a2128ef0..9609760c4a43ab168f465395bca180ec7cc45478 100644 (file)
@@ -7,7 +7,6 @@
 
 #include "../../common/constants.qh"
 #include "../../common/movetypes/movetypes.qh"
-#include "../../common/nades/all.qh"
 
 #include "../../lib/csqcmodel/interpolate.qh"
 
@@ -49,6 +48,8 @@ void Projectile_DrawTrail(entity this, vector to)
        }
 }
 
+bool Projectile_isnade(int proj); // TODO: remove
+
 void Projectile_Draw(entity this)
 {
        vector rot;
@@ -112,7 +113,7 @@ void Projectile_Draw(entity this)
                                break;
                }
 
-               if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null)
+               if (Projectile_isnade(self.cnt))
                        rot = self.avelocity;
 
                self.angles = AnglesTransform_ToAngles(AnglesTransform_Multiply(AnglesTransform_FromAngles(self.angles), rot * (t - self.spawntime)));
@@ -140,7 +141,7 @@ void Projectile_Draw(entity this)
                        break;
        }
 
-       if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null)
+       if (Projectile_isnade(self.cnt))
                trailorigin += v_up * 4;
 
        if (drawn)
@@ -295,7 +296,6 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                        CASE(HOOKBOMB)           self.traileffect = EFFECT_TR_KNIGHTSPIKE.m_id; break;
                        CASE(HAGAR)              self.traileffect = EFFECT_HAGAR_ROCKET.m_id; self.scale = 0.75; break;
                        CASE(HAGAR_BOUNCING)     self.traileffect = EFFECT_HAGAR_ROCKET.m_id; self.scale = 0.75; break;
-                       CASE(NAPALM_FOUNTAIN)                                                                         // fallthrough // sself.modelindex = 0; self.traileffect = _particleeffectnum("torch_small"); break;
                        CASE(FIREBALL)           self.modelindex = 0; self.traileffect = EFFECT_FIREBALL.m_id; break; // particle effect is good enough
                        CASE(FIREMINE)           self.modelindex = 0; self.traileffect = EFFECT_FIREMINE.m_id; break; // particle effect is good enough
                        CASE(TAG)                self.traileffect = EFFECT_TR_ROCKET.m_id; break;
@@ -324,13 +324,6 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                                if (MUTATOR_CALLHOOK(Ent_Projectile, self))
                                        break;
 
-                               if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null)
-                               {
-                                       setmodel(self, MDL_PROJECTILE_NADE);
-                                       entity trail = Nade_TrailEffect(self.cnt, self.team);
-                                       if (trail.eent_eff_name) self.traileffect = trail.m_id;
-                                       break;
-                               }
                                error("Received invalid CSQC projectile, can't work with this!");
                                break;
                }
@@ -402,7 +395,6 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                                self.move_movetype = MOVETYPE_BOUNCE;
                                self.move_touch = func_null;
                                break;
-                       case PROJECTILE_NAPALM_FOUNTAIN:
                        case PROJECTILE_FIREBALL:
                                loopsound(self, CH_SHOTS_SINGLE, SND(FIREBALL_FLY2), VOL_BASE, ATTEN_NORM);
                                self.mins = '-16 -16 -16';
@@ -460,23 +452,6 @@ NET_HANDLE(ENT_CLIENT_PROJECTILE, bool isnew)
                                break;
                }
 
-               if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null)
-               {
-                       entity nade_type = Nade_FromProjectile(self.cnt);
-                       self.mins = '-16 -16 -16';
-                       self.maxs = '16 16 16';
-                       self.colormod = nade_type.m_color;
-                       self.move_movetype = MOVETYPE_BOUNCE;
-                       self.move_touch = func_null;
-                       self.scale = 1.5;
-                       self.avelocity = randomvec() * 720;
-
-                       if (nade_type == NADE_TYPE_TRANSLOCATE || nade_type == NADE_TYPE_SPAWN)
-                               self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
-                       else
-                               self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
-               }
-
                MUTATOR_CALLHOOK(EditProjectile, self);
 
                setsize(self, self.mins, self.maxs);
diff --git a/qcsrc/common/buffs/all.inc b/qcsrc/common/buffs/all.inc
deleted file mode 100644 (file)
index 25fa722..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-REGISTER_BUFF(AMMO) {
-    this.m_prettyName = _("Ammo");
-    this.m_name = "ammo";
-    this.m_skin = 3;
-    this.m_color = '0.76 1 0.1';
-}
-BUFF_SPAWNFUNCS(ammo, BUFF_AMMO)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(ammoregen, BUFF_AMMO)
-
-REGISTER_BUFF(RESISTANCE) {
-    this.m_prettyName = _("Resistance");
-    this.m_name = "resistance";
-    this.m_skin = 0;
-    this.m_color = '0.36 1 0.07';
-}
-BUFF_SPAWNFUNCS(resistance, BUFF_RESISTANCE)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(resistance, BUFF_RESISTANCE)
-
-REGISTER_BUFF(SPEED) {
-    this.m_prettyName = _("Speed");
-    this.m_name = "speed";
-    this.m_skin = 9;
-    this.m_color = '0.1 1 0.84';
-}
-BUFF_SPAWNFUNCS(speed, BUFF_SPEED)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(haste, BUFF_SPEED)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(scout, BUFF_SPEED)
-
-REGISTER_BUFF(MEDIC) {
-    this.m_prettyName = _("Medic");
-    this.m_name = "medic";
-    this.m_skin = 1;
-    this.m_color = '1 0.12 0';
-}
-BUFF_SPAWNFUNCS(medic, BUFF_MEDIC)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(doubler, BUFF_MEDIC)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(medic, BUFF_MEDIC)
-
-REGISTER_BUFF(BASH) {
-    this.m_prettyName = _("Bash");
-    this.m_name = "bash";
-    this.m_skin = 5;
-    this.m_color = '1 0.39 0';
-}
-BUFF_SPAWNFUNCS(bash, BUFF_BASH)
-
-REGISTER_BUFF(VAMPIRE) {
-    this.m_prettyName = _("Vampire");
-    this.m_name = "vampire";
-    this.m_skin = 2;
-    this.m_color = '1 0 0.24';
-}
-BUFF_SPAWNFUNCS(vampire, BUFF_VAMPIRE)
-
-REGISTER_BUFF(DISABILITY) {
-    this.m_prettyName = _("Disability");
-    this.m_name = "disability";
-    this.m_skin = 7;
-    this.m_color = '0.94 0.3 1';
-}
-BUFF_SPAWNFUNCS(disability, BUFF_DISABILITY)
-
-REGISTER_BUFF(VENGEANCE) {
-    this.m_prettyName = _("Vengeance");
-    this.m_name = "vengeance";
-    this.m_skin = 15;
-    this.m_color = '1 0.23 0.61';
-}
-BUFF_SPAWNFUNCS(vengeance, BUFF_VENGEANCE)
-
-REGISTER_BUFF(JUMP) {
-    this.m_prettyName = _("Jump");
-    this.m_name = "jump";
-    this.m_skin = 10;
-    this.m_color = '0.24 0.78 1';
-}
-BUFF_SPAWNFUNCS(jump, BUFF_JUMP)
-
-REGISTER_BUFF(FLIGHT) {
-    this.m_prettyName = _("Flight");
-    this.m_name = "flight";
-    this.m_skin = 11;
-    this.m_color = '0.33 0.56 1';
-}
-BUFF_SPAWNFUNCS(flight, BUFF_FLIGHT)
-
-REGISTER_BUFF(INVISIBLE) {
-    this.m_prettyName = _("Invisible");
-    this.m_name = "invisible";
-    this.m_skin = 12;
-    this.m_color = '0.5 0.5 1';
-}
-BUFF_SPAWNFUNCS(invisible, BUFF_INVISIBLE)
-BUFF_SPAWNFUNC_Q3TA_COMPAT(invis, BUFF_INVISIBLE)
-
-REGISTER_BUFF(INFERNO) {
-    this.m_prettyName = _("Inferno");
-    this.m_name = "inferno";
-    this.m_skin = 16;
-    this.m_color = '1 0.62 0';
-}
-BUFF_SPAWNFUNCS(inferno, BUFF_INFERNO)
-
-REGISTER_BUFF(SWAPPER) {
-    this.m_prettyName = _("Swapper");
-    this.m_name = "swapper";
-    this.m_skin = 17;
-    this.m_color = '0.63 0.36 1';
-}
-BUFF_SPAWNFUNCS(swapper, BUFF_SWAPPER)
-
-REGISTER_BUFF(MAGNET) {
-    this.m_prettyName = _("Magnet");
-    this.m_name = "magnet";
-    this.m_skin = 18;
-    this.m_color = '1 0.95 0.18';
-}
-BUFF_SPAWNFUNCS(magnet, BUFF_MAGNET)
diff --git a/qcsrc/common/buffs/all.qc b/qcsrc/common/buffs/all.qc
deleted file mode 100644 (file)
index c6a6f49..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#if defined(CSQC)
-       #include "../../client/defs.qh"
-#elif defined(MENUQC)
-#elif defined(SVQC)
-#endif
-#include "all.qh"
-
diff --git a/qcsrc/common/buffs/all.qh b/qcsrc/common/buffs/all.qh
deleted file mode 100644 (file)
index beabaa7..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef BUFFS_ALL_H
-#define BUFFS_ALL_H
-// Welcome to the stuff behind the scenes
-// Below, you will find the list of buffs
-// Add new buffs here!
-// Note: Buffs also need spawnfuncs, which are set below
-
-#include "../teams.qh"
-#include "../util.qh"
-
-REGISTRY(Buffs, BITS(4))
-#define Buffs_from(i) _Buffs_from(i, BUFF_Null)
-REGISTER_REGISTRY(RegisterBuffs)
-REGISTRY_CHECK(Buffs)
-
-#define REGISTER_BUFF(id) \
-    REGISTER(RegisterBuffs, BUFF, Buffs, id, m_id, NEW(Buff)); \
-    REGISTER_INIT_POST(BUFF, id) { \
-        this.netname = this.m_name; \
-        this.m_itemid = BIT(this.m_id - 1); \
-        this.m_sprite = strzone(strcat("buff-", this.m_name)); \
-    } \
-    REGISTER_INIT(BUFF, id)
-
-#include "../items/item/pickup.qh"
-CLASS(Buff, Pickup)
-       /** bit index */
-       ATTRIB(Buff, m_itemid, int, 0)
-       ATTRIB(Buff, m_name, string, "buff")
-       ATTRIB(Buff, m_color, vector, '1 1 1')
-       ATTRIB(Buff, m_prettyName, string, "Buff")
-       ATTRIB(Buff, m_skin, int, 0)
-       ATTRIB(Buff, m_sprite, string, "")
-       METHOD(Buff, display, void(entity this, void(string name, string icon) returns)) {
-               returns(this.m_prettyName, sprintf("/gfx/hud/%s/buff_%s", cvar_string("menu_skin"), this.m_name));
-       }
-#ifdef SVQC
-       METHOD(Buff, m_time, float(entity));
-       float Buff_m_time(entity this) { return cvar(strcat("g_buffs_", this.netname, "_time")); }
-#endif
-ENDCLASS(Buff)
-
-#ifdef SVQC
-       .int buffs;
-       void buff_Init(entity ent);
-       void buff_Init_Compat(entity ent, entity replacement);
-       #define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \
-               self.buffs = b.m_itemid; \
-               self.team = t; \
-               buff_Init(self); \
-       }
-       #define BUFF_SPAWNFUNCS(e, b)                       \
-                       BUFF_SPAWNFUNC(e,           b,  0)          \
-                       BUFF_SPAWNFUNC(e##_team1,   b,  NUM_TEAM_1) \
-                       BUFF_SPAWNFUNC(e##_team2,   b,  NUM_TEAM_2) \
-                       BUFF_SPAWNFUNC(e##_team3,   b,  NUM_TEAM_3) \
-                       BUFF_SPAWNFUNC(e##_team4,   b,  NUM_TEAM_4)
-       #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) spawnfunc(item_##o) { buff_Init_Compat(self, r); }
-#else
-       #define BUFF_SPAWNFUNC(e, b, t)
-       #define BUFF_SPAWNFUNCS(e, b)
-       #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r)
-#endif
-
-REGISTER_BUFF(Null);
-BUFF_SPAWNFUNCS(random, BUFF_Null)
-
-#include "all.inc"
-
-#endif
index 05ccb464193d6670943eaefd822e337e513867d4..d1eb3cf76e284bf3b1ddc547366bef69218ac1ef 100644 (file)
@@ -4,7 +4,7 @@
 #include "command.qh"
 REGISTRY(GENERIC_COMMANDS, BITS(7))
 #define GENERIC_COMMANDS_from(i) _GENERIC_COMMANDS_from(i, NULL)
-REGISTER_REGISTRY(RegisterGENERIC_COMMANDS)
+REGISTER_REGISTRY(GENERIC_COMMANDS)
 REGISTRY_SORT(GENERIC_COMMANDS, 0)
 
 #define GENERIC_COMMAND(id, description) \
@@ -12,7 +12,7 @@ REGISTRY_SORT(GENERIC_COMMANDS, 0)
                ATTRIB(genericcommand_##id, m_name, string, #id); \
        ATTRIB(genericcommand_##id, m_description, string, description); \
        ENDCLASS(genericcommand_##id) \
-    REGISTER(RegisterGENERIC_COMMANDS, CMD_G, GENERIC_COMMANDS, id, m_id, NEW(genericcommand_##id)); \
+    REGISTER(GENERIC_COMMANDS, CMD_G, id, m_id, NEW(genericcommand_##id)); \
        METHOD(genericcommand_##id, m_invokecmd, void(int request, int arguments, string command))
 
 STATIC_INIT(GENERIC_COMMANDS_aliases) {
index b3a671d260fde17cd95175394112a9e25f99afc7..dcf64b11f3d635b6dac5224de9d93977ac87585c 100644 (file)
@@ -5,7 +5,7 @@
 
 REGISTRY(Deathtypes, BITS(8))
 #define Deathtypes_from(i) _Deathtypes_from(i, NULL)
-REGISTER_REGISTRY(RegisterDeathtypes)
+REGISTER_REGISTRY(Deathtypes)
 REGISTRY_CHECK(Deathtypes)
 
 .entity death_msgself;
@@ -13,7 +13,7 @@ REGISTRY_CHECK(Deathtypes)
 .string death_msgextra;
 
 #define REGISTER_DEATHTYPE(id, msg_death, msg_death_by, extra) \
-    REGISTER(RegisterDeathtypes, DEATH, Deathtypes, id, m_id, new(deathtype)) { \
+    REGISTER(Deathtypes, DEATH, id, m_id, new(deathtype)) { \
         make_pure(this); \
         this.m_id += DT_FIRST; \
         this.nent_name = #id; \
index 72d4565e4f8c0f9f6f90e52902f96afb874a325b..b34180056a1a5302c8b0fe46f50c97fe345c8e0e 100644 (file)
@@ -147,54 +147,6 @@ EFFECT(0, SPAWN_PINK,               "spawn_event_pink")
 EFFECT(0, SPAWNPOINT_NEUTRAL,       "spawn_point_neutral")
 EFFECT(0, SPAWN_NEUTRAL,            "spawn_event_neutral")
 
-EFFECT(0, NADE_EXPLODE_RED,         "nade_red_explode")
-EFFECT(0, NADE_EXPLODE_BLUE,        "nade_blue_explode")
-EFFECT(0, NADE_EXPLODE_YELLOW,      "nade_yellow_explode")
-EFFECT(0, NADE_EXPLODE_PINK,        "nade_pink_explode")
-EFFECT(0, NADE_EXPLODE_NEUTRAL,     "nade_neutral_explode")
-entity EFFECT_NADE_EXPLODE(int teamid)
-{
-    switch (teamid) {
-        case NUM_TEAM_1:    return EFFECT_NADE_EXPLODE_RED;
-        case NUM_TEAM_2:    return EFFECT_NADE_EXPLODE_BLUE;
-        case NUM_TEAM_3:    return EFFECT_NADE_EXPLODE_YELLOW;
-        case NUM_TEAM_4:    return EFFECT_NADE_EXPLODE_PINK;
-        default:                   return EFFECT_NADE_EXPLODE_NEUTRAL;
-    }
-}
-
-EFFECT(1, NADE_TRAIL_RED,           "nade_red")
-EFFECT(1, NADE_TRAIL_BLUE,          "nade_blue")
-EFFECT(1, NADE_TRAIL_YELLOW,        "nade_yellow")
-EFFECT(1, NADE_TRAIL_PINK,          "nade_pink")
-EFFECT(1, NADE_TRAIL_NEUTRAL,       "nade_neutral")
-entity EFFECT_NADE_TRAIL(int teamid)
-{
-    switch (teamid) {
-        case NUM_TEAM_1:    return EFFECT_NADE_TRAIL_RED;
-        case NUM_TEAM_2:    return EFFECT_NADE_TRAIL_BLUE;
-        case NUM_TEAM_3:    return EFFECT_NADE_TRAIL_YELLOW;
-        case NUM_TEAM_4:    return EFFECT_NADE_TRAIL_PINK;
-        default:            return EFFECT_NADE_TRAIL_NEUTRAL;
-    }
-}
-
-EFFECT(1, NADE_TRAIL_BURN_RED,      "nade_red_burn")
-EFFECT(1, NADE_TRAIL_BURN_BLUE,     "nade_blue_burn")
-EFFECT(1, NADE_TRAIL_BURN_YELLOW,   "nade_yellow_burn")
-EFFECT(1, NADE_TRAIL_BURN_PINK,     "nade_pink_burn")
-EFFECT(1, NADE_TRAIL_BURN_NEUTRAL,  "nade_neutral_burn")
-entity EFFECT_NADE_TRAIL_BURN(int teamid)
-{
-    switch (teamid) {
-        case NUM_TEAM_1:    return EFFECT_NADE_TRAIL_BURN_RED;
-        case NUM_TEAM_2:    return EFFECT_NADE_TRAIL_BURN_BLUE;
-        case NUM_TEAM_3:    return EFFECT_NADE_TRAIL_BURN_YELLOW;
-        case NUM_TEAM_4:    return EFFECT_NADE_TRAIL_BURN_PINK;
-        default:            return EFFECT_NADE_TRAIL_BURN_NEUTRAL;
-    }
-}
-
 EFFECT(0, ICEORGLASS,               "iceorglass")
 EFFECT(0, ICEFIELD,                 "icefield")
 EFFECT(0, FIREFIELD,                "firefield")
index 58284fb0e39711516830b2b2e6b0dba2b81d07eb..e0e9a3ca869d16b85734356e49802dba3fc706b9 100644 (file)
@@ -10,10 +10,10 @@ void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt);
 
 REGISTRY(Effects, BITS(8))
 #define Effects_from(i) _Effects_from(i, EFFECT_Null)
-REGISTER_REGISTRY(RegisterEffects)
+REGISTER_REGISTRY(Effects)
 REGISTRY_CHECK(Effects)
 #define EFFECT(istrail, name, realname) \
-    REGISTER(RegisterEffects, EFFECT, Effects, name, m_id, Create_Effect_Entity(realname, istrail));
+    REGISTER(Effects, EFFECT, name, m_id, Create_Effect_Entity(realname, istrail));
 
 EFFECT(0, Null, string_null)
 #include "all.inc"
index d6e929b2017b358b393dfdfd9b9fb2c845222f96..f4df3237d4e5ef046bb5909e84652004d2da9f59 100644 (file)
@@ -321,10 +321,10 @@ GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt")
 
 REGISTRY(EffectInfos, BITS(9))
 #define EffectInfos_from(i) _EffectInfos_from(i, NULL)
-REGISTER_REGISTRY(RegisterEffectInfos)
+REGISTER_REGISTRY(EffectInfos)
 #define EFFECTINFO(name) \
     [[accumulate]] void effectinfo_##name(EffectInfoGroup parent, EffectInfo this) { } \
-    REGISTER(RegisterEffectInfos, EFFECTINFO, EffectInfos, name, m_id, NEW(EffectInfoGroup)) { \
+    REGISTER(EffectInfos, EFFECTINFO, name, m_id, NEW(EffectInfoGroup)) { \
         effectinfo_##name(this, NULL); \
     }
 
index 6cf7c1992d82d41f6f382e15f852d0d2bda43773..e77f63f69c8c19a8261f40075da5b2599d3e9d63 100644 (file)
@@ -4,6 +4,7 @@
 #ifdef CSQC
 #include "../../deathtypes/all.qh"
 #include "../../movetypes/movetypes.qh"
+#include "../../../client/mutators/events.qh"
 #include "../../vehicles/all.qh"
 #include "../../weapons/all.qh"
 #endif
@@ -423,8 +424,10 @@ NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
                        w_backoff = -1 * normalize(force);
                setorigin(self, w_org + w_backoff * 2); // for sound() calls
 
-               if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) {
-                       hitwep.wr_impacteffect(hitwep);
+               if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
+               {
+                       if(!MUTATOR_CALLHOOK(Weapon_ImpactEffect, hitwep))
+                               hitwep.wr_impacteffect(hitwep);
                }
        }
 }
index 7f8fb77b1462c76d37c0ddea478cc4775d83314e..e8baf1bc367d6721628dc1dd339df5153f6588d5 100644 (file)
@@ -10,13 +10,13 @@ REGISTRY(PlayerSounds, BITS(8) - 1)
 #define PlayerSounds_from(i) _PlayerSounds_from(i, NULL)
 #define REGISTER_PLAYERSOUND(id) \
        .string _playersound_##id; \
-       REGISTER(RegisterPlayerSounds, playersound, PlayerSounds, id, m_id, new(PlayerSound)) \
+       REGISTER(PlayerSounds, playersound, id, m_id, new(PlayerSound)) \
        { \
                make_pure(this); \
                this.m_playersoundstr = #id; \
                this.m_playersoundfld = _playersound_##id; \
        }
-REGISTER_REGISTRY(RegisterPlayerSounds)
+REGISTER_REGISTRY(PlayerSounds)
 REGISTRY_SORT(PlayerSounds, 0)
 STATIC_INIT(PlayerSounds_renumber)
 {
@@ -41,7 +41,7 @@ REGISTER_PLAYERSOUND(pain75)
 .int m_playersoundvt;
 #define REGISTER_VOICEMSG(id, vt) \
        .string _playersound_##id; \
-       REGISTER(RegisterPlayerSounds, playersound, PlayerSounds, id, m_id, new(VoiceMessage)) \
+       REGISTER(PlayerSounds, playersound, id, m_id, new(VoiceMessage)) \
        { \
                make_pure(this); \
                this.instanceOfVoiceMessage = true; \
@@ -86,12 +86,12 @@ REGISTER_VOICEMSG(teamshoot, VOICETYPE_LASTATTACKER)
 REGISTRY(GlobalSounds, BITS(8) - 1)
 #define GlobalSounds_from(i) _GlobalSounds_from(i, NULL)
 #define REGISTER_GLOBALSOUND(id, str) \
-       REGISTER(RegisterGlobalSounds, GS, GlobalSounds, id, m_id, new(GlobalSound)) \
+       REGISTER(GlobalSounds, GS, id, m_id, new(GlobalSound)) \
        { \
                make_pure(this); \
                this.m_globalsoundstr = str; \
        }
-REGISTER_REGISTRY(RegisterGlobalSounds)
+REGISTER_REGISTRY(GlobalSounds)
 REGISTRY_SORT(GlobalSounds, 0)
 STATIC_INIT(GlobalSounds_renumber)
 {
index 809398bb292fa907c1e4f0d1a074ff646236bfee..ab86ea6736eaca2b592cb6e212bdc1aa6b42392b 100644 (file)
@@ -7,9 +7,9 @@
 
 REGISTRY(Items, BITS(5))
 #define Items_from(i) _Items_from(i, NULL)
-REGISTER_REGISTRY(RegisterItems)
+REGISTER_REGISTRY(Items)
 /** If you register a new item, make sure to add it to all.inc */
-#define REGISTER_ITEM(id, class) REGISTER(RegisterItems, ITEM, Items, id, m_id, NEW(class))
+#define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class))
 
 REGISTRY_SORT(Items, 0)
 REGISTRY_CHECK(Items)
index 4f856670b8110ee26731dffc67b5305159439e6d..5ca1c3803da30ea19467f6daaa21074ec4ac2d74 100644 (file)
@@ -1,13 +1,11 @@
 #if defined(CSQC)
     #include "../client/defs.qh"
     #include "util.qh"
-    #include "buffs/all.qh"
     #include "weapons/all.qh"
     #include "mapinfo.qh"
 #elif defined(MENUQC)
 #elif defined(SVQC)
     #include "util.qh"
-    #include "buffs/all.qh"
     #include "monsters/all.qh"
     #include "mapinfo.qh"
 #endif
@@ -1019,6 +1017,11 @@ float MapInfo_Get_ByName_NoFallbacks(string pFilename, int pAllowGenerate, int p
                {
                        MapInfo_Map_flags |= MAPINFO_FLAG_NOAUTOMAPLIST;
                }
+               else if(t == "gameversion_min")
+               {
+                       if (cvar("gameversion") < stof(s))
+                               MapInfo_Map_flags |= MAPINFO_FLAG_NOAUTOMAPLIST;
+               }
                else if(t == "type")
                {
                        t = car(s); s = cdr(s);
index 055777bf8493b51e0e15eb79e966c69abcf220a0..702798bbf861d3bfcb912ceac3b67a6afcd5052b 100644 (file)
@@ -44,13 +44,13 @@ ENDCLASS(Gametype)
 
 REGISTRY(Gametypes, BITS(4))
 #define Gametypes_from(i) _Gametypes_from(i, NULL)
-REGISTER_REGISTRY(RegisterGametypes)
+REGISTER_REGISTRY(Gametypes)
 REGISTRY_CHECK(Gametypes)
 int MAPINFO_TYPE_ALL;
 #define REGISTER_GAMETYPE(hname, sname, g_name, NAME, gteamplay, mutators, defaults, gdescription)          \
     int MAPINFO_TYPE_##NAME;                                                                                \
     bool NAME##_mapinfo(string k, string v) { return = false; }                                             \
-    REGISTER(RegisterGametypes, MAPINFO_TYPE, Gametypes, g_name, m_id,                                      \
+    REGISTER(Gametypes, MAPINFO_TYPE, g_name, m_id,                                      \
         NEW(Gametype, hname, #sname, #g_name, gteamplay, #sname " " mutators, defaults, gdescription)       \
     ) {                                                                                                     \
         /* same as `1 << m_id` */                                                                           \
index 6fb461c6beed194767fcb93f9211b48e3adb72cc..f21c6e482d10c5b3310557ee6eba9178d6c28c0e 100644 (file)
@@ -113,10 +113,10 @@ void HUD_MinigameMenu_CustomEntry(entity parent, string message, string event_ar
 
 REGISTRY(Minigames, BITS(3))
 #define Minigames_from(i) _Minigames_from(i, NULL)
-REGISTER_REGISTRY(RegisterMinigames)
+REGISTER_REGISTRY(Minigames)
 REGISTRY_CHECK(Minigames)
 #define REGISTER_MINIGAME(name,nicename) \
-    REGISTER(RegisterMinigames, MINIGAME, Minigames, name, m_id, new(minigame_descriptor)); \
+    REGISTER(Minigames, MINIGAME, name, m_id, new(minigame_descriptor)); \
     void name##_hud_board(vector, vector); \
     void name##_hud_status(vector, vector); \
     int name##_client_event(entity, string, ...); \
index f60b2d6dbaedae53314da1356aa1ed5f6a0e741d..eb6825ed600e52ad46df1c47af15717d3a10229d 100644 (file)
@@ -48,10 +48,10 @@ bool minigame_SendEntity(entity this, entity to, int sf);
 
 REGISTRY(Minigames, BITS(3))
 #define Minigames_from(i) _Minigames_from(i, NULL)
-REGISTER_REGISTRY(RegisterMinigames)
+REGISTER_REGISTRY(Minigames)
 REGISTRY_CHECK(Minigames)
 #define REGISTER_MINIGAME(name,nicename) \
-    REGISTER(RegisterMinigames, MINIGAME, Minigames, name, m_id, new(minigame_descriptor)); \
+    REGISTER(Minigames, MINIGAME, name, m_id, new(minigame_descriptor)); \
     int name##_server_event(entity, string, ...); \
     REGISTER_INIT_POST(MINIGAME, name) { \
         make_pure(this); \
index b81567427767f030fb5742c87be7089f4c56afe6..ac95c2c840a697a2b9e14d0d22277956c71a6416 100644 (file)
@@ -5,11 +5,11 @@
 
 REGISTRY(Models, BITS(9))
 #define Models_from(i) _Models_from(i, MDL_Null)
-REGISTER_REGISTRY(RegisterModels)
+REGISTER_REGISTRY(Models)
 
 #define MODEL(name, path) \
     string MDL_##name##_get() { return path; } \
-    REGISTER(RegisterModels, MDL, Models, name, m_id, NEW(Model, MDL_##name##_get))
+    REGISTER(Models, MDL, name, m_id, NEW(Model, MDL_##name##_get))
 
 PRECACHE(Models) {
     FOREACH(Models, true, LAMBDA({
index fd5978c91d4291936c15d05698b9410540bb14af..b771984f212b1b4ef3a680099e19e7059600662e 100644 (file)
@@ -8,12 +8,12 @@ string M_Model(string m_mdl);
 REGISTRY(Monsters, BITS(5))
 #define Monsters_from(i) _Monsters_from(i, MON_Null)
 #define get_monsterinfo(i) Monsters_from(i)
-REGISTER_REGISTRY(RegisterMonsters)
+REGISTER_REGISTRY(Monsters)
 REGISTRY_CHECK(Monsters)
 const int MON_FIRST = 1;
 #define MON_LAST (Monsters_COUNT - 1)
 /** If you register a new monster, make sure to add it to all.inc */
-#define REGISTER_MONSTER(id, inst) REGISTER(RegisterMonsters, MON, Monsters, id, monsterid, inst)
+#define REGISTER_MONSTER(id, inst) REGISTER(Monsters, MON, id, monsterid, inst)
 
 REGISTER_MONSTER(Null, NEW(Monster));
 
index a262cb9bcd60d41cfbe75c5f05a7570ffc03a195..bef00c649e890c2b71cb34a392ae4c9d77542b1a 100644 (file)
@@ -1,14 +1,15 @@
-#include "mutator/buffs/module.inc"
+#include "mutator/waypoints/module.inc"
+
 #include "mutator/itemstime.qc"
 #include "mutator/multijump/module.inc"
 #include "mutator/nades/module.inc"
 #include "mutator/superspec/module.inc"
-#include "mutator/waypoints/module.inc"
 
 // completely self contained
 
 #include "mutator/bloodloss/module.inc"
 #include "mutator/breakablehook/module.inc"
+#include "mutator/buffs/module.inc"
 #include "mutator/campcheck/module.inc"
 #include "mutator/cloaked/module.inc"
 #include "mutator/damagetext/module.inc"
index 07a3c82375e7d3813d0f6fdcc6225fb0dae476bb..7cfc297896ab7fd9e6ca91789e5e481455a21afa 100644 (file)
@@ -210,7 +210,7 @@ void Mutator_Remove(Mutator mut)
         bool ret = MUTATORFUNCTION_##id##_hooks(mode); if (ret) return ret; \
     } \
     bool MUTATOR_##id##_check() { return dependence; } \
-    REGISTER(RegisterMutators, MUTATOR, Mutators, id, m_id, NEW(Mutator, #id, MUTATORFUNCTION_##id)) \
+    REGISTER(Mutators, MUTATOR, id, m_id, NEW(Mutator, #id, MUTATORFUNCTION_##id)) \
     { this.mutatorcheck = MUTATOR_##id##_check; } \
     [[accumulate]] bool MUTATORFUNCTION_##id(int mode)
 
index bb845b8015785cd4bf7c679c83f9a1ff8a969003..82898237c53f38e6a212b62ff4f7089ff348bc5b 100644 (file)
@@ -48,4 +48,17 @@ MUTATOR_HOOKABLE(BuildMutatorsPrettyString, EV_BuildMutatorsPrettyString);
     /**/
 MUTATOR_HOOKABLE(BuildGameplayTipsString, EV_BuildGameplayTipsString);
 
+#define EV_IsFlying(i, o) \
+       /**/ i(entity, MUTATOR_ARGV_0_entity) \
+       /**/
+MUTATOR_HOOKABLE(IsFlying, EV_IsFlying);
+
+#define EV_WP_Format(i, o) \
+    /**/ i(entity, MUTATOR_ARGV_0_entity) \
+    /**/ i(string, MUTATOR_ARGV_0_string) \
+    /**/ o(vector, MUTATOR_ARGV_0_vector) \
+    /**/ o(string, MUTATOR_ARGV_0_string) \
+    /**/
+MUTATOR_HOOKABLE(WP_Format, EV_WP_Format);
+
 #endif
diff --git a/qcsrc/common/mutators/mutator/buffs/all.inc b/qcsrc/common/mutators/mutator/buffs/all.inc
new file mode 100644 (file)
index 0000000..25fa722
--- /dev/null
@@ -0,0 +1,118 @@
+REGISTER_BUFF(AMMO) {
+    this.m_prettyName = _("Ammo");
+    this.m_name = "ammo";
+    this.m_skin = 3;
+    this.m_color = '0.76 1 0.1';
+}
+BUFF_SPAWNFUNCS(ammo, BUFF_AMMO)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(ammoregen, BUFF_AMMO)
+
+REGISTER_BUFF(RESISTANCE) {
+    this.m_prettyName = _("Resistance");
+    this.m_name = "resistance";
+    this.m_skin = 0;
+    this.m_color = '0.36 1 0.07';
+}
+BUFF_SPAWNFUNCS(resistance, BUFF_RESISTANCE)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(resistance, BUFF_RESISTANCE)
+
+REGISTER_BUFF(SPEED) {
+    this.m_prettyName = _("Speed");
+    this.m_name = "speed";
+    this.m_skin = 9;
+    this.m_color = '0.1 1 0.84';
+}
+BUFF_SPAWNFUNCS(speed, BUFF_SPEED)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(haste, BUFF_SPEED)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(scout, BUFF_SPEED)
+
+REGISTER_BUFF(MEDIC) {
+    this.m_prettyName = _("Medic");
+    this.m_name = "medic";
+    this.m_skin = 1;
+    this.m_color = '1 0.12 0';
+}
+BUFF_SPAWNFUNCS(medic, BUFF_MEDIC)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(doubler, BUFF_MEDIC)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(medic, BUFF_MEDIC)
+
+REGISTER_BUFF(BASH) {
+    this.m_prettyName = _("Bash");
+    this.m_name = "bash";
+    this.m_skin = 5;
+    this.m_color = '1 0.39 0';
+}
+BUFF_SPAWNFUNCS(bash, BUFF_BASH)
+
+REGISTER_BUFF(VAMPIRE) {
+    this.m_prettyName = _("Vampire");
+    this.m_name = "vampire";
+    this.m_skin = 2;
+    this.m_color = '1 0 0.24';
+}
+BUFF_SPAWNFUNCS(vampire, BUFF_VAMPIRE)
+
+REGISTER_BUFF(DISABILITY) {
+    this.m_prettyName = _("Disability");
+    this.m_name = "disability";
+    this.m_skin = 7;
+    this.m_color = '0.94 0.3 1';
+}
+BUFF_SPAWNFUNCS(disability, BUFF_DISABILITY)
+
+REGISTER_BUFF(VENGEANCE) {
+    this.m_prettyName = _("Vengeance");
+    this.m_name = "vengeance";
+    this.m_skin = 15;
+    this.m_color = '1 0.23 0.61';
+}
+BUFF_SPAWNFUNCS(vengeance, BUFF_VENGEANCE)
+
+REGISTER_BUFF(JUMP) {
+    this.m_prettyName = _("Jump");
+    this.m_name = "jump";
+    this.m_skin = 10;
+    this.m_color = '0.24 0.78 1';
+}
+BUFF_SPAWNFUNCS(jump, BUFF_JUMP)
+
+REGISTER_BUFF(FLIGHT) {
+    this.m_prettyName = _("Flight");
+    this.m_name = "flight";
+    this.m_skin = 11;
+    this.m_color = '0.33 0.56 1';
+}
+BUFF_SPAWNFUNCS(flight, BUFF_FLIGHT)
+
+REGISTER_BUFF(INVISIBLE) {
+    this.m_prettyName = _("Invisible");
+    this.m_name = "invisible";
+    this.m_skin = 12;
+    this.m_color = '0.5 0.5 1';
+}
+BUFF_SPAWNFUNCS(invisible, BUFF_INVISIBLE)
+BUFF_SPAWNFUNC_Q3TA_COMPAT(invis, BUFF_INVISIBLE)
+
+REGISTER_BUFF(INFERNO) {
+    this.m_prettyName = _("Inferno");
+    this.m_name = "inferno";
+    this.m_skin = 16;
+    this.m_color = '1 0.62 0';
+}
+BUFF_SPAWNFUNCS(inferno, BUFF_INFERNO)
+
+REGISTER_BUFF(SWAPPER) {
+    this.m_prettyName = _("Swapper");
+    this.m_name = "swapper";
+    this.m_skin = 17;
+    this.m_color = '0.63 0.36 1';
+}
+BUFF_SPAWNFUNCS(swapper, BUFF_SWAPPER)
+
+REGISTER_BUFF(MAGNET) {
+    this.m_prettyName = _("Magnet");
+    this.m_name = "magnet";
+    this.m_skin = 18;
+    this.m_color = '1 0.95 0.18';
+}
+BUFF_SPAWNFUNCS(magnet, BUFF_MAGNET)
diff --git a/qcsrc/common/mutators/mutator/buffs/all.qc b/qcsrc/common/mutators/mutator/buffs/all.qc
new file mode 100644 (file)
index 0000000..b056751
--- /dev/null
@@ -0,0 +1 @@
+#include "all.qh"
diff --git a/qcsrc/common/mutators/mutator/buffs/all.qh b/qcsrc/common/mutators/mutator/buffs/all.qh
new file mode 100644 (file)
index 0000000..94a00b9
--- /dev/null
@@ -0,0 +1,73 @@
+#ifndef BUFFS_ALL_H
+#define BUFFS_ALL_H
+// Welcome to the stuff behind the scenes
+// Below, you will find the list of buffs
+// Add new buffs here!
+// Note: Buffs also need spawnfuncs, which are set below
+
+#include "../../../teams.qh"
+#include "../../../util.qh"
+
+REGISTER_WAYPOINT(Buff, _("Buff"), '1 0.5 0', 1);
+REGISTER_RADARICON(Buff, 1);
+
+REGISTRY(Buffs, BITS(4))
+#define Buffs_from(i) _Buffs_from(i, BUFF_Null)
+REGISTER_REGISTRY(Buffs)
+REGISTRY_CHECK(Buffs)
+
+#define REGISTER_BUFF(id) \
+    REGISTER(Buffs, BUFF, id, m_id, NEW(Buff)); \
+    REGISTER_INIT_POST(BUFF, id) { \
+        this.netname = this.m_name; \
+        this.m_itemid = BIT(this.m_id - 1); \
+        this.m_sprite = strzone(strcat("buff-", this.m_name)); \
+    } \
+    REGISTER_INIT(BUFF, id)
+
+#include "../../../items/item/pickup.qh"
+CLASS(Buff, Pickup)
+       /** bit index */
+       ATTRIB(Buff, m_itemid, int, 0)
+       ATTRIB(Buff, m_name, string, "buff")
+       ATTRIB(Buff, m_color, vector, '1 1 1')
+       ATTRIB(Buff, m_prettyName, string, "Buff")
+       ATTRIB(Buff, m_skin, int, 0)
+       ATTRIB(Buff, m_sprite, string, "")
+       METHOD(Buff, display, void(entity this, void(string name, string icon) returns)) {
+               returns(this.m_prettyName, sprintf("/gfx/hud/%s/buff_%s", cvar_string("menu_skin"), this.m_name));
+       }
+#ifdef SVQC
+       METHOD(Buff, m_time, float(Buff this))
+       { return cvar(strcat("g_buffs_", this.netname, "_time")); }
+#endif
+ENDCLASS(Buff)
+
+#ifdef SVQC
+       .int buffs;
+       void buff_Init(entity ent);
+       void buff_Init_Compat(entity ent, entity replacement);
+       #define BUFF_SPAWNFUNC(e, b, t) spawnfunc(item_buff_##e) { \
+               self.buffs = b.m_itemid; \
+               self.team = t; \
+               buff_Init(self); \
+       }
+       #define BUFF_SPAWNFUNCS(e, b)                       \
+                       BUFF_SPAWNFUNC(e,           b,  0)          \
+                       BUFF_SPAWNFUNC(e##_team1,   b,  NUM_TEAM_1) \
+                       BUFF_SPAWNFUNC(e##_team2,   b,  NUM_TEAM_2) \
+                       BUFF_SPAWNFUNC(e##_team3,   b,  NUM_TEAM_3) \
+                       BUFF_SPAWNFUNC(e##_team4,   b,  NUM_TEAM_4)
+       #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) spawnfunc(item_##o) { buff_Init_Compat(self, r); }
+#else
+       #define BUFF_SPAWNFUNC(e, b, t)
+       #define BUFF_SPAWNFUNCS(e, b)
+       #define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r)
+#endif
+
+REGISTER_BUFF(Null);
+BUFF_SPAWNFUNCS(random, BUFF_Null)
+
+#include "all.inc"
+
+#endif
index eeda5db74314ecc94590196505e3b1a08d7c0b7a..08f1aa3b504f60b93beb10ff6a6c28a25cd1b29e 100644 (file)
@@ -75,7 +75,6 @@ const vector BUFF_MAX = ('16 16 20');
 
 #include "../../../triggers/target/music.qh"
 #include "../../../gamemodes/all.qh"
-#include "../../../buffs/all.qh"
 
 .float buff_time;
 void buffs_DelayedInit();
@@ -789,6 +788,11 @@ MUTATOR_HOOKFUNCTION(buffs, CustomizeWaypoint)
 
 MUTATOR_HOOKFUNCTION(buffs, OnEntityPreSpawn, CBC_ORDER_LAST)
 {SELFPARAM();
+       if (self.classname == "item_flight" && cvar("g_buffs") && cvar("g_buffs_flight"))
+       {
+               buff_Init_Compat(self, BUFF_FLIGHT);
+               return true;
+       }
        if(autocvar_g_buffs_replace_powerups)
        switch(self.classname)
        {
index 89d31a1b317fc9e86f3fe59509d5a68b0a10ca4c..5f24f627e7a5879b06dc1a98cecffec9d1b256ca 100644 (file)
@@ -1,3 +1,46 @@
+#include "all.qc"
 #ifdef SVQC
 #include "buffs.qc"
 #endif
+
+#ifdef IMPLEMENTATION
+
+string BUFF_NAME(int i)
+{
+    Buff b = Buffs_from(i);
+    return sprintf("%s%s", rgb_to_hexcolor(b.m_color), b.m_prettyName);
+}
+
+#ifndef MENUQC
+REGISTER_MUTATOR(buffs_flight, true);
+MUTATOR_HOOKFUNCTION(buffs_flight, IsFlying)
+{
+    noref entity e = MUTATOR_ARGV(0, entity);
+       return BUFFS_STAT(e) & BUFF_FLIGHT.m_itemid;
+}
+#endif
+
+#ifdef CSQC
+REGISTER_MUTATOR(cl_buffs, true);
+MUTATOR_HOOKFUNCTION(cl_buffs, HUD_Powerups_add)
+{
+    int allBuffs = getstati(STAT_BUFFS, 0, 24);
+    FOREACH(Buffs, it.m_itemid & allBuffs, LAMBDA(
+               addPowerupItem(it.m_prettyName, strcat("buff_", it.m_name), it.m_color, bound(0, getstatf(STAT_BUFF_TIME) - time, 99), 60);
+       ));
+}
+MUTATOR_HOOKFUNCTION(cl_buffs, WP_Format)
+{
+    entity this = MUTATOR_ARGV(0, entity);
+    string s = MUTATOR_ARGV(0, string);
+    if (s == WP_Buff.netname || s == RADARICON_Buff.netname)
+    {
+        Buff b = Buffs_from(this.wp_extra);
+        MUTATOR_ARGV(0, vector) = b.m_color;
+        MUTATOR_ARGV(0, string) = b.m_prettyName;
+        return true;
+    }
+}
+
+#endif
+#endif
index 2a46dd699e1b5426c9735b7a0b3a0ec58424556f..1810734c64b36d46e36a9f4b401e9eb7769c3244 100644 (file)
@@ -17,7 +17,6 @@ int autocvar_g_instagib_extralives;
 float autocvar_g_instagib_speed_highspeed;
 
 #include "../../../../server/cl_client.qh"
-#include "../../../buffs/all.qh"
 
 #include "../../../items/all.qc"
 
@@ -333,7 +332,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_Calculate)
                frag_mirrordamage = 0;
        }
 
-       if((frag_target.buffs & BUFF_INVISIBLE.m_itemid) || (frag_target.items & ITEM_Invisibility.m_itemid))
+       if(frag_target.alpha && frag_target.alpha < 1)
                yoda = 1;
 
        return false;
diff --git a/qcsrc/common/mutators/mutator/nades/effects.inc b/qcsrc/common/mutators/mutator/nades/effects.inc
new file mode 100644 (file)
index 0000000..cde0016
--- /dev/null
@@ -0,0 +1,47 @@
+EFFECT(0, NADE_EXPLODE_RED,         "nade_red_explode")
+EFFECT(0, NADE_EXPLODE_BLUE,        "nade_blue_explode")
+EFFECT(0, NADE_EXPLODE_YELLOW,      "nade_yellow_explode")
+EFFECT(0, NADE_EXPLODE_PINK,        "nade_pink_explode")
+EFFECT(0, NADE_EXPLODE_NEUTRAL,     "nade_neutral_explode")
+entity EFFECT_NADE_EXPLODE(int teamid)
+{
+    switch (teamid) {
+        case NUM_TEAM_1:    return EFFECT_NADE_EXPLODE_RED;
+        case NUM_TEAM_2:    return EFFECT_NADE_EXPLODE_BLUE;
+        case NUM_TEAM_3:    return EFFECT_NADE_EXPLODE_YELLOW;
+        case NUM_TEAM_4:    return EFFECT_NADE_EXPLODE_PINK;
+        default:                   return EFFECT_NADE_EXPLODE_NEUTRAL;
+    }
+}
+
+EFFECT(1, NADE_TRAIL_RED,           "nade_red")
+EFFECT(1, NADE_TRAIL_BLUE,          "nade_blue")
+EFFECT(1, NADE_TRAIL_YELLOW,        "nade_yellow")
+EFFECT(1, NADE_TRAIL_PINK,          "nade_pink")
+EFFECT(1, NADE_TRAIL_NEUTRAL,       "nade_neutral")
+entity EFFECT_NADE_TRAIL(int teamid)
+{
+    switch (teamid) {
+        case NUM_TEAM_1:    return EFFECT_NADE_TRAIL_RED;
+        case NUM_TEAM_2:    return EFFECT_NADE_TRAIL_BLUE;
+        case NUM_TEAM_3:    return EFFECT_NADE_TRAIL_YELLOW;
+        case NUM_TEAM_4:    return EFFECT_NADE_TRAIL_PINK;
+        default:            return EFFECT_NADE_TRAIL_NEUTRAL;
+    }
+}
+
+EFFECT(1, NADE_TRAIL_BURN_RED,      "nade_red_burn")
+EFFECT(1, NADE_TRAIL_BURN_BLUE,     "nade_blue_burn")
+EFFECT(1, NADE_TRAIL_BURN_YELLOW,   "nade_yellow_burn")
+EFFECT(1, NADE_TRAIL_BURN_PINK,     "nade_pink_burn")
+EFFECT(1, NADE_TRAIL_BURN_NEUTRAL,  "nade_neutral_burn")
+entity EFFECT_NADE_TRAIL_BURN(int teamid)
+{
+    switch (teamid) {
+        case NUM_TEAM_1:    return EFFECT_NADE_TRAIL_BURN_RED;
+        case NUM_TEAM_2:    return EFFECT_NADE_TRAIL_BURN_BLUE;
+        case NUM_TEAM_3:    return EFFECT_NADE_TRAIL_BURN_YELLOW;
+        case NUM_TEAM_4:    return EFFECT_NADE_TRAIL_BURN_PINK;
+        default:            return EFFECT_NADE_TRAIL_BURN_NEUTRAL;
+    }
+}
index b9c0eb308e64240293a4a94b6f743e305cc8f634..e03900d6a5e1c7db7df258caf23fac7b81195998 100644 (file)
@@ -1,3 +1,4 @@
-#ifdef SVQC
 #include "nades.qc"
+#ifndef MENUQC
+#include "net.qc"
 #endif
diff --git a/qcsrc/common/mutators/mutator/nades/nades.inc b/qcsrc/common/mutators/mutator/nades/nades.inc
new file mode 100644 (file)
index 0000000..6d16fd1
--- /dev/null
@@ -0,0 +1,62 @@
+#ifndef MENUQC
+#define NADE_PROJECTILE(i, projectile, trail) do { \
+    this.m_projectile[i] = projectile; \
+    this.m_trail[i] = trail; \
+} while (0)
+#else
+#define NADE_PROJECTILE(i, projectile, trail)
+#endif
+
+REGISTER_NADE(NORMAL) {
+    this.m_color = '1 1 1';
+    NADE_PROJECTILE(0, PROJECTILE_NADE, EFFECT_Null);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_BURN, EFFECT_Null);
+}
+
+REGISTER_NADE(NAPALM) {
+    this.m_color = '2 0.5 0';
+    this.m_name = _("Napalm grenade");
+    this.m_icon = "nade_napalm";
+    NADE_PROJECTILE(0, PROJECTILE_NADE_NAPALM, EFFECT_TR_ROCKET);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_NAPALM_BURN, EFFECT_SPIDERBOT_ROCKET_TRAIL);
+}
+
+REGISTER_NADE(ICE) {
+    this.m_color = '0 0.5 2';
+    this.m_name = _("Ice grenade");
+    this.m_icon = "nade_ice";
+    NADE_PROJECTILE(0, PROJECTILE_NADE_ICE, EFFECT_TR_NEXUIZPLASMA);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_ICE_BURN, EFFECT_RACER_ROCKET_TRAIL);
+}
+
+REGISTER_NADE(TRANSLOCATE) {
+    this.m_color = '1 0 1';
+    this.m_name = _("Translocate grenade");
+    this.m_icon = "nade_translocate";
+    NADE_PROJECTILE(0, PROJECTILE_NADE_TRANSLOCATE, EFFECT_TR_CRYLINKPLASMA);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_TRANSLOCATE, EFFECT_TR_CRYLINKPLASMA);
+}
+
+REGISTER_NADE(SPAWN) {
+    this.m_color = '1 0.9 0';
+    this.m_name = _("Spawn grenade");
+    this.m_icon = "nade_spawn";
+    NADE_PROJECTILE(0, PROJECTILE_NADE_SPAWN, EFFECT_NADE_TRAIL_YELLOW);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_SPAWN, EFFECT_NADE_TRAIL_YELLOW);
+}
+
+REGISTER_NADE(HEAL) {
+    this.m_color = '1 0 0';
+    this.m_name = _("Heal grenade");
+    this.m_icon = "nade_heal";
+    NADE_PROJECTILE(0, PROJECTILE_NADE_HEAL, EFFECT_NADE_TRAIL_RED);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_HEAL_BURN, EFFECT_NADE_TRAIL_BURN_RED);
+}
+
+REGISTER_NADE(MONSTER) {
+    this.m_color = '0.25 0.75 0';
+    this.m_name = _("Monster grenade");
+    this.m_icon = "nade_monster";
+    NADE_PROJECTILE(0, PROJECTILE_NADE_MONSTER, EFFECT_NADE_TRAIL_RED);
+    NADE_PROJECTILE(1, PROJECTILE_NADE_MONSTER_BURN, EFFECT_NADE_TRAIL_BURN_RED);
+}
index 556265f1f99699227b3d10fa85350ca234964ba7..ef021bbdcb23f4f2bff217b7e4c43500ea3eb6d2 100644 (file)
-#ifndef MUTATOR_NADES_H
-#define MUTATOR_NADES_H
+#include "nades.qh"
 
-#ifdef SVQC
-#include "../../../../server/mutators/mutator/gamemode_freezetag.qc"
+#ifdef IMPLEMENTATION
+
+#ifndef MENUQC
+entity Nade_TrailEffect(int proj, int nade_team)
+{
+    switch (proj)
+    {
+        case PROJECTILE_NADE:       return EFFECT_NADE_TRAIL(nade_team);
+        case PROJECTILE_NADE_BURN:  return EFFECT_NADE_TRAIL_BURN(nade_team);
+    }
+
+    FOREACH(Nades, true, LAMBDA(
+        for (int j = 0; j < 2; j++)
+        {
+            if (it.m_projectile[j] == proj)
+            {
+                string trail = it.m_trail[j].eent_eff_name;
+                if (trail) return it.m_trail[j];
+                break;
+            }
+        }
+    ));
+
+    return EFFECT_Null;
+}
 #endif
 
-.entity nade;
-.entity fake_nade;
-.float nade_timer;
-.float nade_refire;
-.float bonus_nades;
-.float nade_special_time;
-.float bonus_nade_score;
-.float nade_type;
-.string pokenade_type;
-.entity nade_damage_target;
-.float cvar_cl_nade_type;
-.string cvar_cl_pokenade_type;
-.float toss_time;
-.float stat_healing_orb;
-.float stat_healing_orb_alpha;
-.float nade_show_particles;
-
-// Remove nades that are being thrown
-void nades_Clear(entity player);
-
-// Give a bonus grenade to a player
-void(entity player, float score) nades_GiveBonus;
-
-/**
- * called to adjust nade damage and force on hit
- */
-#define EV_Nade_Damage(i, o) \
-       /** weapon */ i(entity, MUTATOR_ARGV_0_entity) \
-    /** force */  i(vector, MUTATOR_ARGV_0_vector) \
-    /**/          o(vector, MUTATOR_ARGV_0_vector) \
-       /** damage */ i(float,  MUTATOR_ARGV_0_float) \
-    /**/          o(float,  MUTATOR_ARGV_0_float) \
-    /**/
-MUTATOR_HOOKABLE(Nade_Damage, EV_Nade_Damage);
+#ifdef CSQC
+REGISTER_MUTATOR(cl_nades, true);
+MUTATOR_HOOKFUNCTION(cl_nades, HUD_Draw_overlay)
+{
+       if (getstatf(STAT_HEALING_ORB) <= time) return false;
+       MUTATOR_ARGV(0, vector) = NADE_TYPE_HEAL.m_color;
+       MUTATOR_ARGV(0, float) = getstatf(STAT_HEALING_ORB_ALPHA);
+       return true;
+}
+MUTATOR_HOOKFUNCTION(cl_nades, Ent_Projectile)
+{
+       if (self.cnt == PROJECTILE_NAPALM_FOUNTAIN)
+       {
+               self.modelindex = 0;
+               self.traileffect = EFFECT_FIREBALL.m_id;
+               return true;
+       }
+       if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null)
+       {
+               setmodel(self, MDL_PROJECTILE_NADE);
+               entity trail = Nade_TrailEffect(self.cnt, self.team);
+               if (trail.eent_eff_name) self.traileffect = trail.m_id;
+               return true;
+       }
+}
+MUTATOR_HOOKFUNCTION(cl_nades, EditProjectile)
+{
+       if (self.cnt == PROJECTILE_NAPALM_FOUNTAIN)
+       {
+               loopsound(self, CH_SHOTS_SINGLE, SND(FIREBALL_FLY2), VOL_BASE, ATTEN_NORM);
+               self.mins = '-16 -16 -16';
+               self.maxs = '16 16 16';
+       }
+
+       entity nade_type = Nade_FromProjectile(self.cnt);
+       if (nade_type == NADE_TYPE_Null) return;
+       self.mins = '-16 -16 -16';
+       self.maxs = '16 16 16';
+       self.colormod = nade_type.m_color;
+       self.move_movetype = MOVETYPE_BOUNCE;
+       self.move_touch = func_null;
+       self.scale = 1.5;
+       self.avelocity = randomvec() * 720;
+
+       if (nade_type == NADE_TYPE_TRANSLOCATE || nade_type == NADE_TYPE_SPAWN)
+               self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP;
+       else
+               self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY;
+}
+bool Projectile_isnade(int p)
+{
+       return Nade_FromProjectile(p) != NADE_TYPE_Null;
+}
+void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expand_time)
+{
+       float bonusNades    = getstatf(STAT_NADE_BONUS);
+       float bonusProgress = getstatf(STAT_NADE_BONUS_SCORE);
+       float bonusType     = getstati(STAT_NADE_BONUS_TYPE);
+       Nade def = Nades_from(bonusType);
+       vector nadeColor    = def.m_color;
+       string nadeIcon     = def.m_icon;
+
+       vector iconPos, textPos;
+
+       if(autocvar_hud_panel_ammo_iconalign)
+       {
+               iconPos = myPos + eX * 2 * mySize.y;
+               textPos = myPos;
+       }
+       else
+       {
+               iconPos = myPos;
+               textPos = myPos + eX * mySize.y;
+       }
+
+       if(bonusNades > 0 || bonusProgress > 0)
+       {
+               DrawNadeProgressBar(myPos, mySize, bonusProgress, nadeColor);
+
+               if(autocvar_hud_panel_ammo_text)
+                       drawstring_aspect(textPos, ftos(bonusNades), eX * (2/3) * mySize.x + eY * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+
+               if(draw_expanding)
+                       drawpic_aspect_skin_expanding(iconPos, nadeIcon, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, expand_time);
 
+               drawpic_aspect_skin(iconPos, nadeIcon, '1 1 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+       }
+}
 #endif
 
-#ifdef IMPLEMENTATION
+#ifdef SVQC
 
-#include "../../../nades/all.qh"
 #include "../../../gamemodes/all.qh"
 #include "../../../monsters/spawn.qh"
 #include "../../../monsters/sv_monsters.qh"
@@ -1246,3 +1320,4 @@ MUTATOR_HOOKFUNCTION(nades, BuildMutatorsPrettyString)
        return false;
 }
 #endif
+#endif
diff --git a/qcsrc/common/mutators/mutator/nades/nades.qh b/qcsrc/common/mutators/mutator/nades/nades.qh
new file mode 100644 (file)
index 0000000..2e48293
--- /dev/null
@@ -0,0 +1,103 @@
+#ifndef NADES_ALL_H
+#define NADES_ALL_H
+
+#include "../../../teams.qh"
+
+// use slots 70-100
+const int PROJECTILE_NADE = 71;
+const int PROJECTILE_NADE_BURN = 72;
+const int PROJECTILE_NADE_NAPALM = 73;
+const int PROJECTILE_NADE_NAPALM_BURN = 74;
+const int PROJECTILE_NAPALM_FOUNTAIN = 75;
+const int PROJECTILE_NADE_ICE = 76;
+const int PROJECTILE_NADE_ICE_BURN = 77;
+const int PROJECTILE_NADE_TRANSLOCATE = 78;
+const int PROJECTILE_NADE_SPAWN = 79;
+const int PROJECTILE_NADE_HEAL = 80;
+const int PROJECTILE_NADE_HEAL_BURN = 81;
+const int PROJECTILE_NADE_MONSTER = 82;
+const int PROJECTILE_NADE_MONSTER_BURN = 83;
+
+REGISTRY(Nades, BITS(4))
+#define Nades_from(i) _Nades_from(i, NADE_TYPE_Null)
+REGISTER_REGISTRY(Nades)
+REGISTRY_CHECK(Nades)
+
+#define REGISTER_NADE(id) REGISTER(Nades, NADE_TYPE, id, m_id, NEW(Nade))
+
+CLASS(Nade, Object)
+    ATTRIB(Nade, m_id, int, 0)
+    ATTRIB(Nade, m_color, vector, '0 0 0')
+    ATTRIB(Nade, m_name, string, _("Grenade"))
+    ATTRIB(Nade, m_icon, string, "nade_normal")
+    ATTRIBARRAY(Nade, m_projectile, int, 2)
+    ATTRIBARRAY(Nade, m_trail, entity, 2)
+    METHOD(Nade, display, void(entity this, void(string name, string icon) returns)) {
+        returns(this.m_name, sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon));
+    }
+ENDCLASS(Nade)
+
+REGISTER_NADE(Null);
+
+Nade Nade_FromProjectile(int proj)
+{
+    FOREACH(Nades, true, LAMBDA(
+        for (int j = 0; j < 2; j++)
+        {
+            if (it.m_projectile[j] == proj) return it;
+        }
+    ));
+    return NADE_TYPE_Null;
+}
+
+#ifndef MENUQC
+#include "effects.inc"
+#endif
+
+#include "nades.inc"
+
+.float healer_lifetime;
+.float healer_radius;
+
+#ifdef SVQC
+
+.entity nade;
+.entity fake_nade;
+.float nade_timer;
+.float nade_refire;
+.float bonus_nades;
+.float nade_special_time;
+.float bonus_nade_score;
+.float nade_type;
+.string pokenade_type;
+.entity nade_damage_target;
+.float cvar_cl_nade_type;
+.string cvar_cl_pokenade_type;
+.float toss_time;
+.float stat_healing_orb;
+.float stat_healing_orb_alpha;
+.float nade_show_particles;
+
+bool healer_send(entity this, entity to, int sf);
+
+// Remove nades that are being thrown
+void nades_Clear(entity player);
+
+// Give a bonus grenade to a player
+void(entity player, float score) nades_GiveBonus;
+
+/**
+ * called to adjust nade damage and force on hit
+ */
+#define EV_Nade_Damage(i, o) \
+       /** weapon */ i(entity, MUTATOR_ARGV_0_entity) \
+    /** force */  i(vector, MUTATOR_ARGV_0_vector) \
+    /**/          o(vector, MUTATOR_ARGV_0_vector) \
+       /** damage */ i(float,  MUTATOR_ARGV_0_float) \
+    /**/          o(float,  MUTATOR_ARGV_0_float) \
+    /**/
+MUTATOR_HOOKABLE(Nade_Damage, EV_Nade_Damage);
+
+#endif
+
+#endif
diff --git a/qcsrc/common/mutators/mutator/nades/net.qc b/qcsrc/common/mutators/mutator/nades/net.qc
new file mode 100644 (file)
index 0000000..072f507
--- /dev/null
@@ -0,0 +1,84 @@
+#include "nades.qh"
+
+#ifdef IMPLEMENTATION
+
+#ifdef CSQC
+.float ltime;
+void healer_draw(entity this)
+{
+       float dt = time - self.move_time;
+       self.move_time = time;
+       if(dt <= 0)
+               return;
+
+       self.alpha = (self.ltime - time) / self.healer_lifetime;
+       self.scale = min((1 - self.alpha)*self.healer_lifetime*4,1)*self.healer_radius;
+}
+
+void healer_setup(entity e)
+{
+       setmodel(e, MDL_NADE_HEAL);
+
+       setorigin(e, e.origin);
+
+       float model_radius = e.maxs.x;
+       vector size = '1 1 1' * e.healer_radius / 2;
+       setsize(e,-size,size);
+       e.healer_radius = e.healer_radius/model_radius*0.6;
+
+       e.draw = healer_draw;
+       e.health = 255;
+       e.movetype = MOVETYPE_NONE;
+       e.solid = SOLID_NOT;
+       e.drawmask = MASK_NORMAL;
+       e.scale = 0.01;
+       e.avelocity = e.move_avelocity = '7 0 11';
+       e.colormod = '1 0 0';
+       e.renderflags |= RF_ADDITIVE;
+}
+#endif
+
+REGISTER_NET_LINKED(Nade_Heal)
+
+#ifdef CSQC
+NET_HANDLE(Nade_Heal, bool isNew)
+{
+       Net_Accept(Nade_Heal);
+       int sf = ReadByte();
+       if (sf & 1) {
+               this.origin_x = ReadCoord();
+               this.origin_y = ReadCoord();
+               this.origin_z = ReadCoord();
+               setorigin(this, this.origin);
+               this.healer_lifetime = ReadByte();
+               this.healer_radius = ReadShort();
+               this.ltime = time + ReadByte()/10.0;
+               // this.ltime = time + this.healer_lifetime;
+               healer_setup(this);
+       }
+       return true;
+}
+#endif
+
+#ifdef SVQC
+bool healer_send(entity this, entity to, int sf)
+{
+       int channel = MSG_ENTITY;
+       WriteHeader(channel, Nade_Heal);
+       WriteByte(channel, sf);
+       if (sf & 1) {
+               WriteCoord(channel, this.origin.x);
+               WriteCoord(channel, this.origin.y);
+               WriteCoord(channel, this.origin.z);
+
+               WriteByte(channel, this.healer_lifetime);
+               //WriteByte(MSG_ENTITY, this.ltime - time + 1);
+               WriteShort(channel, this.healer_radius);
+               // round time delta to a 1/10th of a second
+               WriteByte(channel, (this.ltime - time)*10.0+0.5);
+       }
+       return true;
+}
+#endif
+
+#endif
index 47fafe7ed5490169352a47e918ec4ea7f781b0a6..c74715ea714f6c2b92652a369a9e59a6d8de0973 100644 (file)
@@ -54,8 +54,6 @@ REGISTER_WAYPOINT(OnsCPAttack, _("Control point"), '1 0.5 0', 2);
 REGISTER_WAYPOINT(OnsGen, _("Generator"), '1 0.5 0', 1);
 REGISTER_WAYPOINT(OnsGenShielded, _("Generator"), '1 0.5 0', 1);
 
-REGISTER_WAYPOINT(Buff, _("Buff"), '1 0.5 0', 1);
-
 REGISTER_WAYPOINT(Weapon, _("Weapon"), '0 0 0', 1);
 
 REGISTER_WAYPOINT(Monster, _("Monster"), '1 0 0', 1);
index 3769412ec6b16e54788b76420e1f5f50699adecb..9693d2809050cb5ff88b7d0072981795dfccb18c 100644 (file)
@@ -5,11 +5,11 @@
 
 REGISTRY(Waypoints, BITS(6))
 #define Waypoints_from(i) _Waypoints_from(i, WP_Null)
-REGISTER_REGISTRY(RegisterWaypoints)
+REGISTER_REGISTRY(Waypoints)
 REGISTRY_CHECK(Waypoints)
 
 /** If you register a new waypoint, make sure to add it to all.inc */
-#define REGISTER_WAYPOINT_(id, init) REGISTER(RegisterWaypoints, WP, Waypoints, id, m_id, init)
+#define REGISTER_WAYPOINT_(id, init) REGISTER(Waypoints, WP, id, m_id, init)
 
 CLASS(Waypoint, Object)
     ATTRIB(Waypoint, m_id, int, 0)
@@ -30,11 +30,11 @@ ENDCLASS(Waypoint)
 
 REGISTRY(RadarIcons, BITS(7))
 #define RadarIcons_from(i) _RadarIcons_from(i, RADARICON_NONE)
-REGISTER_REGISTRY(RegisterRadarIcons)
+REGISTER_REGISTRY(RadarIcons)
 REGISTRY_CHECK(RadarIcons)
 
 .int m_radaricon;
-#define REGISTER_RADARICON(id, num) REGISTER(RegisterRadarIcons, RADARICON, RadarIcons, id, m_id, new(RadarIcon)) { make_pure(this); this.m_radaricon = num; this.netname = #id; }
+#define REGISTER_RADARICON(id, num) REGISTER(RadarIcons, RADARICON, id, m_id, new(RadarIcon)) { make_pure(this); this.m_radaricon = num; this.netname = #id; }
 
 REGISTER_WAYPOINT(Null, "", '0 0 0', 1);
 
@@ -54,7 +54,6 @@ REGISTER_RADARICON(OBJECTIVE,       1);
 REGISTER_RADARICON(DOMPOINT,        1);
 REGISTER_RADARICON(TAGGED,          1);
 
-REGISTER_RADARICON(Buff,            1);
 REGISTER_RADARICON(Item,            1);
 REGISTER_RADARICON(Vehicle,         1);
 REGISTER_RADARICON(Weapon,          1);
index 7fa9181f2060f7b659e1e7e0b5bb00948706f5e3..a11feab9eceac5b1947e22290cd6177cc8df5c17 100644 (file)
@@ -233,7 +233,10 @@ vector spritelookupcolor(entity this, string s, vector def)
 {
     if (s == WP_Weapon.netname  || s == RADARICON_Weapon.netname) return get_weaponinfo(this.wp_extra).wpcolor;
     if (s == WP_Item.netname    || s == RADARICON_Item.netname) return Items_from(this.wp_extra).m_color;
-    if (s == WP_Buff.netname    || s == RADARICON_Buff.netname) return Buffs_from(this.wp_extra).m_color;
+    if (MUTATOR_CALLHOOK(WP_Format, this, s))
+    {
+        return MUTATOR_ARGV(0, vector);
+    }
     return def;
 }
 
@@ -242,8 +245,11 @@ string spritelookuptext(string s)
     if (s == WP_RaceStartFinish.netname) return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start");
     if (s == WP_Weapon.netname) return get_weaponinfo(self.wp_extra).m_name;
     if (s == WP_Item.netname) return Items_from(self.wp_extra).m_waypoint;
-    if (s == WP_Buff.netname) return Buffs_from(self.wp_extra).m_prettyName;
     if (s == WP_Monster.netname) return get_monsterinfo(self.wp_extra).monster_name;
+    if (MUTATOR_CALLHOOK(WP_Format, this, s))
+    {
+        return MUTATOR_ARGV(0, string);
+    }
 
     // need to loop, as our netname could be one of three
     FOREACH(Waypoints, it.netname == s, LAMBDA(
@@ -371,11 +377,13 @@ vector drawspritetext(vector o, float ang, float minwidth, vector rgb, float a,
     if (fabs(sa) > fabs(ca))
     {
         algnx = (sa < 0);
-        algny = 0.5 - 0.5 * ca / fabs(sa);
+        float f = fabs(sa);
+        algny = 0.5 - 0.5 * (f ? (ca / f) : 0);
     }
     else
     {
-        algnx = 0.5 - 0.5 * sa / fabs(ca);
+        float f = fabs(ca);
+        algnx = 0.5 - 0.5 * (f ? (sa / f) : 0);
         algny = (ca < 0);
     }
 
diff --git a/qcsrc/common/nades/all.inc b/qcsrc/common/nades/all.inc
deleted file mode 100644 (file)
index 90326ed..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#define NADE_PROJECTILE(i, projectile, trail) do { \
-    this.m_projectile[i] = projectile; \
-    this.m_trail[i] = trail; \
-} while (0)
-
-REGISTER_NADE(NORMAL) {
-    this.m_color = '1 1 1';
-    NADE_PROJECTILE(0, PROJECTILE_NADE, EFFECT_Null);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_BURN, EFFECT_Null);
-}
-
-REGISTER_NADE(NAPALM) {
-    this.m_color = '2 0.5 0';
-    this.m_name = _("Napalm grenade");
-    this.m_icon = "nade_napalm";
-    NADE_PROJECTILE(0, PROJECTILE_NADE_NAPALM, EFFECT_TR_ROCKET);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_NAPALM_BURN, EFFECT_SPIDERBOT_ROCKET_TRAIL);
-}
-
-REGISTER_NADE(ICE) {
-    this.m_color = '0 0.5 2';
-    this.m_name = _("Ice grenade");
-    this.m_icon = "nade_ice";
-    NADE_PROJECTILE(0, PROJECTILE_NADE_ICE, EFFECT_TR_NEXUIZPLASMA);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_ICE_BURN, EFFECT_RACER_ROCKET_TRAIL);
-}
-
-REGISTER_NADE(TRANSLOCATE) {
-    this.m_color = '1 0 1';
-    this.m_name = _("Translocate grenade");
-    this.m_icon = "nade_translocate";
-    NADE_PROJECTILE(0, PROJECTILE_NADE_TRANSLOCATE, EFFECT_TR_CRYLINKPLASMA);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_TRANSLOCATE, EFFECT_TR_CRYLINKPLASMA);
-}
-
-REGISTER_NADE(SPAWN) {
-    this.m_color = '1 0.9 0';
-    this.m_name = _("Spawn grenade");
-    this.m_icon = "nade_spawn";
-    NADE_PROJECTILE(0, PROJECTILE_NADE_SPAWN, EFFECT_NADE_TRAIL_YELLOW);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_SPAWN, EFFECT_NADE_TRAIL_YELLOW);
-}
-
-REGISTER_NADE(HEAL) {
-    this.m_color = '1 0 0';
-    this.m_name = _("Heal grenade");
-    this.m_icon = "nade_heal";
-    NADE_PROJECTILE(0, PROJECTILE_NADE_HEAL, EFFECT_NADE_TRAIL_RED);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_HEAL_BURN, EFFECT_NADE_TRAIL_BURN_RED);
-}
-
-REGISTER_NADE(MONSTER) {
-    this.m_color = '0.25 0.75 0';
-    this.m_name = _("Monster grenade");
-    this.m_icon = "nade_monster";
-    NADE_PROJECTILE(0, PROJECTILE_NADE_MONSTER, EFFECT_NADE_TRAIL_RED);
-    NADE_PROJECTILE(1, PROJECTILE_NADE_MONSTER_BURN, EFFECT_NADE_TRAIL_BURN_RED);
-}
diff --git a/qcsrc/common/nades/all.qc b/qcsrc/common/nades/all.qc
deleted file mode 100644 (file)
index 4ba1340..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-#include "all.qh"
-
-#if defined(CSQC)
-       #include "../../client/defs.qh"
-       #include "../buffs/all.qh"
-       #include "../movetypes/movetypes.qh"
-       #include "../../client/main.qh"
-       #include "../../lib/csqcmodel/cl_model.qh"
-#elif defined(MENUQC)
-#elif defined(SVQC)
-    #include "../constants.qh"
-    #include "../../server/constants.qh"
-       #include "../turrets/sv_turrets.qh"
-#endif
-
-
-#ifdef CSQC
-.float ltime;
-void healer_draw(entity this)
-{
-       float dt = time - self.move_time;
-       self.move_time = time;
-       if(dt <= 0)
-               return;
-
-       self.alpha = (self.ltime - time) / self.healer_lifetime;
-       self.scale = min((1 - self.alpha)*self.healer_lifetime*4,1)*self.healer_radius;
-}
-
-void healer_setup(entity e)
-{
-       setmodel(e, MDL_NADE_HEAL);
-
-       setorigin(e, e.origin);
-
-       float model_radius = e.maxs.x;
-       vector size = '1 1 1' * e.healer_radius / 2;
-       setsize(e,-size,size);
-       e.healer_radius = e.healer_radius/model_radius*0.6;
-
-       e.draw = healer_draw;
-       e.health = 255;
-       e.movetype = MOVETYPE_NONE;
-       e.solid = SOLID_NOT;
-       e.drawmask = MASK_NORMAL;
-       e.scale = 0.01;
-       e.avelocity = e.move_avelocity = '7 0 11';
-       e.colormod = '1 0 0';
-       e.renderflags |= RF_ADDITIVE;
-}
-#endif // CSQC
-
-REGISTER_NET_LINKED(Nade_Heal)
-#ifdef CSQC
-NET_HANDLE(Nade_Heal, bool isNew)
-{
-       Net_Accept(Nade_Heal);
-       int sf = ReadByte();
-       if (sf & 1) {
-               this.origin_x = ReadCoord();
-               this.origin_y = ReadCoord();
-               this.origin_z = ReadCoord();
-               setorigin(this, this.origin);
-               this.healer_lifetime = ReadByte();
-               this.healer_radius = ReadShort();
-               this.ltime = time + ReadByte()/10.0;
-               // this.ltime = time + this.healer_lifetime;
-               healer_setup(this);
-       }
-       return true;
-}
-#endif
-
-#ifdef SVQC
-bool healer_send(entity this, entity to, int sf)
-{
-       int channel = MSG_ENTITY;
-       WriteHeader(channel, Nade_Heal);
-       WriteByte(channel, sf);
-       if (sf & 1) {
-               WriteCoord(channel, this.origin.x);
-               WriteCoord(channel, this.origin.y);
-               WriteCoord(channel, this.origin.z);
-
-               WriteByte(channel, this.healer_lifetime);
-               //WriteByte(MSG_ENTITY, this.ltime - time + 1);
-               WriteShort(channel, this.healer_radius);
-               // round time delta to a 1/10th of a second
-               WriteByte(channel, (this.ltime - time)*10.0+0.5);
-       }
-       return true;
-}
-#endif // SVQC
diff --git a/qcsrc/common/nades/all.qh b/qcsrc/common/nades/all.qh
deleted file mode 100644 (file)
index 235dd97..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef NADES_ALL_H
-#define NADES_ALL_H
-
-#include "../teams.qh"
-
-.float healer_lifetime;
-.float healer_radius;
-
-// use slots 70-100
-const int PROJECTILE_NADE = 71;
-const int PROJECTILE_NADE_BURN = 72;
-const int PROJECTILE_NADE_NAPALM = 73;
-const int PROJECTILE_NADE_NAPALM_BURN = 74;
-const int PROJECTILE_NAPALM_FOUNTAIN = 75;
-const int PROJECTILE_NADE_ICE = 76;
-const int PROJECTILE_NADE_ICE_BURN = 77;
-const int PROJECTILE_NADE_TRANSLOCATE = 78;
-const int PROJECTILE_NADE_SPAWN = 79;
-const int PROJECTILE_NADE_HEAL = 80;
-const int PROJECTILE_NADE_HEAL_BURN = 81;
-const int PROJECTILE_NADE_MONSTER = 82;
-const int PROJECTILE_NADE_MONSTER_BURN = 83;
-
-REGISTRY(Nades, BITS(4))
-#define Nades_from(i) _Nades_from(i, NADE_TYPE_Null)
-REGISTER_REGISTRY(RegisterNades)
-REGISTRY_CHECK(Nades)
-
-#define REGISTER_NADE(id) REGISTER(RegisterNades, NADE_TYPE, Nades, id, m_id, NEW(Nade))
-
-CLASS(Nade, Object)
-    ATTRIB(Nade, m_id, int, 0)
-    ATTRIB(Nade, m_color, vector, '0 0 0')
-    ATTRIB(Nade, m_name, string, _("Grenade"))
-    ATTRIB(Nade, m_icon, string, "nade_normal")
-    ATTRIBARRAY(Nade, m_projectile, int, 2)
-    ATTRIBARRAY(Nade, m_trail, entity, 2)
-    METHOD(Nade, display, void(entity this, void(string name, string icon) returns)) {
-        returns(this.m_name, sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon));
-    }
-ENDCLASS(Nade)
-
-REGISTER_NADE(Null);
-
-#ifdef SVQC
-bool healer_send(entity this, entity to, int sf);
-#endif
-
-entity Nade_FromProjectile(float proj)
-{
-    FOREACH(Nades, true, LAMBDA(
-        for (int j = 0; j < 2; j++)
-        {
-            if (it.m_projectile[j] == proj) return it;
-        }
-    ));
-    return NADE_TYPE_Null;
-}
-
-entity Nade_TrailEffect(int proj, int nade_team)
-{
-    switch (proj)
-    {
-        case PROJECTILE_NADE:       return EFFECT_NADE_TRAIL(nade_team);
-        case PROJECTILE_NADE_BURN:  return EFFECT_NADE_TRAIL_BURN(nade_team);
-    }
-
-    FOREACH(Nades, true, LAMBDA(
-        for (int j = 0; j < 2; j++)
-        {
-            if (it.m_projectile[j] == proj)
-            {
-                string trail = it.m_trail[j].eent_eff_name;
-                if (trail) return it.m_trail[j];
-                break;
-            }
-        }
-    ));
-
-    return EFFECT_Null;
-}
-
-#include "all.inc"
-
-#endif
index b54e19e98312b5ef91fb7e98293cb458a7ce86c3..63e318d2f7c03d4d4b3e9f7b043615993b3126c0 100644 (file)
@@ -72,8 +72,8 @@ float cl_notice_run()
     _notes = findchain(classname, "sv_notice");
     if(!_notes)
         return false;
-    #define M1 30
-    #define M2 10
+    const int M1 = 30;
+    const int M2 = 10;
 
     vector v1, v2 = '0 0 0', v3;
     v1 = '1 1 0' * M1;
@@ -111,8 +111,6 @@ float cl_notice_run()
     }
 
     #undef OUT
-    #undef M1
-    #undef M2
 
     return m;
 }
index 18cb7ee7f02c65944904cd9969f382a98afa01fa..f3cd0ba494ea482f77b60441f0d7219cc365a815 100644 (file)
@@ -284,6 +284,8 @@ const float ARG_DC = 6; // unique result to durcnt/centerprint
 // todo possible idea.... declare how many floats/strings each arg needs, and then dynamically increment the input
 // this way, we don't need to have duplicates like i.e. s2loc and s3loc?
 
+string BUFF_NAME(int i);
+
 #define NOTIF_ARGUMENT_LIST \
     ARG_CASE(ARG_CS_SV_HA,  "s1",            s1) \
     ARG_CASE(ARG_CS_SV_HA,  "s2",            s2) \
@@ -317,8 +319,8 @@ const float ARG_DC = 6; // unique result to durcnt/centerprint
     ARG_CASE(ARG_CS_SV,     "spree_end",     (autocvar_notification_show_sprees ? notif_arg_spree_inf(-1, "", "", f1) : "")) \
     ARG_CASE(ARG_CS_SV,     "spree_lost",    (autocvar_notification_show_sprees ? notif_arg_spree_inf(-2, "", "", f1) : "")) \
     ARG_CASE(ARG_CS_SV,     "item_wepname",  WEP_NAME(f1)) \
-    ARG_CASE(ARG_CS_SV,     "item_buffname", sprintf("%s%s", rgb_to_hexcolor(Buffs_from(f1).m_color), Buffs_from(f1).m_prettyName)) \
-    ARG_CASE(ARG_CS_SV,     "f3buffname",    sprintf("%s%s", rgb_to_hexcolor(Buffs_from(f3).m_color), Buffs_from(f3).m_prettyName)) \
+    ARG_CASE(ARG_CS_SV,     "item_buffname", BUFF_NAME(f1)) \
+    ARG_CASE(ARG_CS_SV,     "f3buffname",    BUFF_NAME(f3)) \
     ARG_CASE(ARG_CS_SV,     "item_wepammo",  (s1 != "" ? sprintf(_(" with %s"), s1) : "")) \
     ARG_CASE(ARG_DC,        "item_centime",  ftos(autocvar_notification_item_centerprinttime)) \
     ARG_CASE(ARG_SV,        "death_team",    Team_ColoredFullName(f1)) \
index 9f8f2852dd1e6e1e3ae61813446e339d9b658b5c..ad5f13808637f592d46ecdea365092b7a5813c71 100644 (file)
@@ -1811,7 +1811,7 @@ void PM_Main()
                RaceCarPhysics();
 #endif
 
-       else if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY || self.movetype == MOVETYPE_FLY_WORLDONLY || (BUFFS_STAT(self) & BUFF_FLIGHT.m_itemid))
+       else if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY || self.movetype == MOVETYPE_FLY_WORLDONLY || MUTATOR_CALLHOOK(IsFlying, self))
                PM_fly(maxspeed_mod);
 
        else if (self.waterlevel >= WATERLEVEL_SWIMMING)
index e81206cd13f1f12d3f9c442bae8e0550c44c884b..8225db7368c30f5593c2c1e435897b0123cbb8d5 100644 (file)
@@ -5,11 +5,11 @@
 
 REGISTRY(Sounds, BITS(8))
 #define Sounds_from(i) _Sounds_from(i, SND_Null)
-REGISTER_REGISTRY(RegisterSounds)
+REGISTER_REGISTRY(Sounds)
 
 #define SOUND(name, path) \
     string SND_##name##_get() { return path; } \
-    REGISTER(RegisterSounds, SND, Sounds, name, m_id, NEW(Sound, SND_##name##_get))
+    REGISTER(Sounds, SND, name, m_id, NEW(Sound, SND_##name##_get))
 
 // Used in places where a string is required
 #define SND(id) Sound_fixpath(SND_##id)
index a7dcd7e902d6fe48032630cfcc93d32768c3fa58..8bfa35f40da77688d516a8e36688628e766781c6 100644 (file)
@@ -1,5 +1,4 @@
 #if defined(CSQC)
-       #include "../../buffs/all.qh"
        #include "../../../lib/csqcmodel/interpolate.qh"
        #include "../../../client/main.qh"
        #include "../../../lib/csqcmodel/cl_model.qh"
index fa6ef43d423c0aaeed39086f324d6f0be8d1b2b9..fc79400434e4fd58fd4fbfdf85b9a30bc7a990e2 100644 (file)
@@ -9,7 +9,7 @@
 REGISTRY(Turrets, BITS(5))
 #define Turrets_from(i) _Turrets_from(i, TUR_Null)
 #define get_turretinfo(i) Turrets_from(i)
-REGISTER_REGISTRY(RegisterTurrets)
+REGISTER_REGISTRY(Turrets)
 REGISTRY_CHECK(Turrets)
 
 
@@ -70,7 +70,7 @@ GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
 const int TUR_FIRST = 1;
 #define TUR_LAST (Turrets_COUNT - 1)
 
-#define REGISTER_TURRET(id, inst) REGISTER(RegisterTurrets, TUR, Turrets, id, m_id, inst)
+#define REGISTER_TURRET(id, inst) REGISTER(Turrets, TUR, id, m_id, inst)
 
 REGISTER_TURRET(Null, NEW(Turret));
 
index d2d943c4e4d2afe88fa72e3d3108adbaf72694ed..3867cf1edd5490b7403750de6f38a5c12c436606 100644 (file)
@@ -6,14 +6,14 @@
 REGISTRY(Vehicles, BITS(3))
 #define Vehicles_from(i) _Vehicles_from(i, VEH_Null)
 #define get_vehicleinfo(i) Vehicles_from(i)
-REGISTER_REGISTRY(RegisterVehicles)
+REGISTER_REGISTRY(Vehicles)
 REGISTRY_CHECK(Vehicles)
 
 const int VEH_FIRST = 1;
 #define VEH_LAST (Vehicles_COUNT - 1)
 
 /** If you register a new vehicle, make sure to add it to all.inc */
-#define REGISTER_VEHICLE(id, inst) REGISTER(RegisterVehicles, VEH, Vehicles, id, vehicleid, inst)
+#define REGISTER_VEHICLE(id, inst) REGISTER(Vehicles, VEH, id, vehicleid, inst)
 
 #if defined(SVQC)
        #include "sv_vehicles.qh"
index b338122139730e150fa773b28e27ded825aca60d..452438add97a3c87fa202cc55f9074728cc2717b 100644 (file)
@@ -11,7 +11,6 @@
        #include "../../lib/warpzone/common.qh"
        #include "../../lib/warpzone/client.qh"
        #include "../util.qh"
-       #include "../buffs/all.qh"
        #include "../../client/autocvars.qh"
        #include "../deathtypes/all.qh"
        #include "../../lib/csqcmodel/interpolate.qh"
@@ -28,7 +27,6 @@
     #include "../stats.qh"
     #include "../teams.qh"
     #include "../util.qh"
-    #include "../buffs/all.qh"
     #include "../monsters/all.qh"
     #include "config.qh"
     #include "../../server/weapons/csqcprojectile.qh"
index af279506448160bb2cf89b5c60fed8c60d8ac237..93df313c05f6e75bd38a4d777d6dbad8799fb7bb 100644 (file)
@@ -37,7 +37,7 @@ WepSet ReadWepSet();
 REGISTRY(Weapons, 72) // Increase as needed. Can be up to 72.
 #define Weapons_from(i) _Weapons_from(i, WEP_Null)
 #define get_weaponinfo(i) Weapons_from(i)
-REGISTER_REGISTRY(RegisterWeapons)
+REGISTER_REGISTRY(Weapons)
 STATIC_INIT(WeaponPickup) { FOREACH(Weapons, true, LAMBDA(it.m_pickup = NEW(WeaponPickup, it))); }
 
 
@@ -96,7 +96,7 @@ GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPON
 
 #define REGISTER_WEAPON(id, inst) \
     /* WepSet WEPSET_##id; */ \
-    REGISTER(RegisterWeapons, WEP, Weapons, id, m_id, inst)
+    REGISTER(Weapons, WEP, id, m_id, inst)
 
 // create cvars for weapon settings
 #define WEP_ADD_CVAR_NONE(wepname,name) [[last]] float autocvar_g_balance_##wepname##_##name;
index 5a6082134c58134d5df4b97889d029405f0b9772..dc449d35d0ae8d58a11f4f07d2d28e40eb2c0f70 100644 (file)
@@ -56,6 +56,99 @@ VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 #endif
 #endif
 #ifdef IMPLEMENTATION
+
+REGISTER_NET_TEMP(TE_CSQC_VAPORBEAMPARTICLE)
+
+#if defined(SVQC)
+void SendCSQCVaporizerBeamParticle(entity player, int hit) {
+       vector v;
+       v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
+       WriteHeader(MSG_BROADCAST, TE_CSQC_VAPORBEAMPARTICLE);
+       WriteCoord(MSG_BROADCAST, w_shotorg.x);
+       WriteCoord(MSG_BROADCAST, w_shotorg.y);
+       WriteCoord(MSG_BROADCAST, w_shotorg.z);
+       WriteCoord(MSG_BROADCAST, v.x);
+       WriteCoord(MSG_BROADCAST, v.y);
+       WriteCoord(MSG_BROADCAST, v.z);
+       WriteByte(MSG_BROADCAST, hit);
+       WriteShort(MSG_BROADCAST, num_for_edict(player));
+       WriteByte(MSG_BROADCAST, player.team);
+}
+#elif defined(CSQC)
+bool autocvar_cl_vaporizerbeam_particle = false;
+float autocvar_cl_vaporizerbeam_lifetime = 0.8;
+float autocvar_cl_vaporizerbeam_colorboost = 0.7;
+
+string Draw_VaporizerBeam_trace_callback_tex;
+float Draw_VaporizerBeam_trace_callback_rnd;
+vector Draw_VaporizerBeam_trace_callback_rgb;
+float Draw_VaporizerBeam_trace_callback_a;
+void Draw_VaporizerBeam_trace_callback(vector start, vector hit, vector end)
+{
+       float i;
+       vector vorg;
+       vorg = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
+       for(i = 0; i < Draw_VaporizerBeam_trace_callback_a; ++i)
+               Draw_CylindricLine(hit, start, 8, Draw_VaporizerBeam_trace_callback_tex, 0.25, Draw_VaporizerBeam_trace_callback_rnd, Draw_VaporizerBeam_trace_callback_rgb, min(1, Draw_VaporizerBeam_trace_callback_a - i), DRAWFLAG_NORMAL, vorg);
+       Draw_VaporizerBeam_trace_callback_rnd += 0.25 * vlen(hit - start) / 8;
+}
+
+.vector vorg1, vorg2;
+.float spawn_time;
+void VaporizerBeam_Draw(entity this)
+{
+       //draw either the old v2.3 beam or the new beam
+       particles_alphamin = particles_alphamax = particles_fade = 1;
+
+       string tex = "particles/lgbeam";
+       if(this.cnt)
+               tex = "particles/gauntletbeam";
+       vector rgb = getcsqcplayercolor(this.sv_entnum);
+       rgb *= (1 + autocvar_cl_vaporizerbeam_colorboost);
+
+       float fail = (self.nextthink - time);
+
+       Draw_VaporizerBeam_trace_callback_tex = tex;
+       Draw_VaporizerBeam_trace_callback_rnd = 0;
+       Draw_VaporizerBeam_trace_callback_rgb = rgb;
+       Draw_VaporizerBeam_trace_callback_a = bound(0, fail, 1);
+       WarpZone_TraceBox_ThroughZone(this.vorg1, '0 0 0', '0 0 0', this.vorg2, MOVE_NOTHING, world, world, Draw_VaporizerBeam_trace_callback);
+       Draw_VaporizerBeam_trace_callback_tex = string_null;
+
+       /*if(!MUTATOR_CALLHOOK(Particles_VaporizerBeam, this.vorg1, this.vorg2))
+       if(autocvar_cl_particles_oldvortexbeam && (getstati(STAT_ALLOW_OLDVORTEXBEAM) || isdemo()))
+               WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM_OLD), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
+       else
+               WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);*/
+}
+
+NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew)
+{
+       Net_Accept(vortex_beam);
+       this.think = SUB_Remove;
+       this.nextthink = time + bound(0, autocvar_cl_vaporizerbeam_lifetime, 10);
+       this.draw = VaporizerBeam_Draw;
+       this.drawmask = MASK_NORMAL;
+
+       this.vorg1_x = ReadCoord(); this.vorg1_y = ReadCoord(); this.vorg1_z = ReadCoord();
+       this.vorg2_x = ReadCoord(); this.vorg2_y = ReadCoord(); this.vorg2_z = ReadCoord();
+       this.cnt = ReadByte();
+       this.sv_entnum = ReadShort();
+       this.team = ReadByte() - 1;
+
+       if(autocvar_cl_vaporizerbeam_particle)
+       {
+               WarpZone_TrailParticles(world, particleeffectnum(((this.cnt) ? EFFECT_VAPORIZER_HIT(this.team) : EFFECT_VAPORIZER(this.team))), this.vorg1, this.vorg2);
+               this.draw = func_null;
+               this.drawmask = MASK_NORMAL;
+               remove(this);
+       }
+
+       pointparticles(EFFECT_VORTEX_MUZZLEFLASH, this.vorg1, normalize(this.vorg2 - this.vorg1) * 1000, 1);
+       return true;
+}
+#endif
+
 #ifdef SVQC
 spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(this, WEP_VAPORIZER); }
 spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); }
@@ -85,6 +178,9 @@ void W_Vaporizer_Attack(Weapon thiswep)
        damage_goodhits = 0;
        FireRailgunBullet(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
 
+       // do this now, as goodhits is disabled below
+       SendCSQCVaporizerBeamParticle(self, damage_goodhits);
+
        if(yoda && flying)
                Send_Notification(NOTIF_ONE, self, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
        if(damage_goodhits && self.vaporizer_lasthit)
@@ -95,12 +191,6 @@ void W_Vaporizer_Attack(Weapon thiswep)
 
        self.vaporizer_lasthit = damage_goodhits;
 
-       Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
-
-       // teamcolor / hit beam effect
-       vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
-       Send_Effect((damage_goodhits ? EFFECT_VAPORIZER_HIT(self.team) : EFFECT_VAPORIZER(self.team)), w_shotorg, v, 1);
-
        if(autocvar_g_rm)
        if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
                W_RocketMinsta_Explosion(trace_endpos);
index bae7cca3de0ccb6fbd30086152c9c0f3cb31bedc..8a90679b81a2690428328e79dd4598ccf40ce183 100644 (file)
@@ -91,7 +91,8 @@ NET_HANDLE(TE_CSQC_VORTEXBEAMPARTICLE, bool isNew)
        charge = sqrt(charge); // divide evenly among trail spacing and alpha
        particles_alphamin = particles_alphamax = particles_fade = charge;
 
-       if (autocvar_cl_particles_oldvortexbeam && (getstati(STAT_ALLOW_OLDVORTEXBEAM) || isdemo()))
+       if(!MUTATOR_CALLHOOK(Particles_VortexBeam, shotorg, endpos))
+       if(autocvar_cl_particles_oldvortexbeam && (getstati(STAT_ALLOW_OLDVORTEXBEAM) || isdemo()))
                WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM_OLD), shotorg, endpos, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
        else
                WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM), shotorg, endpos, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
index 84a65ea5cd3cb4984300aa6c894615833395c9fb..bbe8f327640a7259ba117ada1c7fd207a0f57d9c 100644 (file)
@@ -93,7 +93,7 @@
                        this.sourceLocLine = __LINE__; \
                        if (!this) isnew = true; \
                } \
-               REGISTER(RegisterLinkedEntities, NET, LinkedEntities, id, m_id, new(net_linked_packet)) \
+               REGISTER(LinkedEntities, NET, id, m_id, new(net_linked_packet)) \
                { \
                        make_pure(this); \
                        this.netname = #id; \
 #else
        #define REGISTER_NET_LINKED(id) \
                const bool NET_##id##_istemp = false; \
-               REGISTER(RegisterLinkedEntities, NET, LinkedEntities, id, m_id, new(net_linked_packet)) \
+               REGISTER(LinkedEntities, NET, id, m_id, new(net_linked_packet)) \
                { \
                        make_pure(this); \
                        this.netname = #id; \
 
 REGISTRY(LinkedEntities, BITS(8) - 1)
 #define LinkedEntities_from(i) _LinkedEntities_from(i, NULL)
-REGISTER_REGISTRY(RegisterLinkedEntities)
+REGISTER_REGISTRY(LinkedEntities)
 REGISTRY_SORT(LinkedEntities, 0)
 REGISTRY_CHECK(LinkedEntities)
 STATIC_INIT(RegisterLinkedEntities_renumber)
@@ -123,7 +123,7 @@ STATIC_INIT(RegisterLinkedEntities_renumber)
 #ifdef CSQC
        #define REGISTER_NET_TEMP(id) \
                NET_HANDLE(id, bool); \
-               REGISTER(RegisterTempEntities, NET, TempEntities, id, m_id, new(net_temp_packet)) \
+               REGISTER(TempEntities, NET, id, m_id, new(net_temp_packet)) \
                { \
                        make_pure(this); \
                        this.netname = #id; \
@@ -132,7 +132,7 @@ STATIC_INIT(RegisterLinkedEntities_renumber)
 #else
        #define REGISTER_NET_TEMP(id) \
                const bool NET_##id##_istemp = true; \
-               REGISTER(RegisterTempEntities, NET, TempEntities, id, m_id, new(net_temp_packet)) \
+               REGISTER(TempEntities, NET, id, m_id, new(net_temp_packet)) \
                { \
                        make_pure(this); \
                        this.netname = #id; \
@@ -141,7 +141,7 @@ STATIC_INIT(RegisterLinkedEntities_renumber)
 
 REGISTRY(TempEntities, BITS(8) - 80)
 #define TempEntities_from(i) _TempEntities_from(i, NULL)
-REGISTER_REGISTRY(RegisterTempEntities)
+REGISTER_REGISTRY(TempEntities)
 REGISTRY_SORT(TempEntities, 0)
 REGISTRY_CHECK(TempEntities)
 STATIC_INIT(RegisterTempEntities_renumber)
index 59ddf25ff87ee30c627f14fc4cfd25b4ec23b072..52ab23377454bb92dfe75708ace67d428eac92e5 100644 (file)
@@ -3,11 +3,12 @@
 
 #include "oo.qh"
 
-#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init, func)
-
-#define REGISTER_INIT(ns, id) [[accumulate]] void Register_##ns##_##id##_init(entity this)
-#define REGISTER_INIT_POST(ns, id) [[accumulate]] void Register_##ns##_##id##_init_post(entity this)
-
+/**
+ * Declare a new registry.
+ *
+ * Don't forget to call `REGISTER_REGISTRY`:
+ *     REGISTER_REGISTRY(Foos)
+ */
 #define REGISTRY(id, max) \
        void Register##id() {} \
        const int id##_MAX = max; \
        int id##_COUNT; \
        entity _##id##_from(int i, entity null) { if (i >= 0 && i < id##_COUNT) { entity e = _##id[i]; if (e) return e; } return null; }
 
+REGISTRY(Registries, BITS(8))
+
 /** registered item identifier */
 .string registered_id;
 
 /**
- * Register a new entity with a global constructor.
+ * Register a new entity with a registry.
  * Must be followed by a semicolon or a function body with a `this` parameter.
  * Wrapper macros may perform actions after user initialization like so:
  *     #define REGISTER_FOO(id) \
- *         REGISTER(RegisterFoos, FOO, FOOS, id, m_id, NEW(Foo)); \
+ *         REGISTER(Foos, FOO, id, m_id, NEW(Foo)); \
  *         REGISTER_INIT_POST(FOO, id) { \
  *             print("Registering foo #", this.m_id + 1, "\n"); \
  *         } \
  *         REGISTER_INIT(FOO, id)
  *
- * Don't forget to forward declare `initfunc` and call `REGISTER_REGISTRY`:
- *     void RegisterFoos();
- *     REGISTER_REGISTRY(RegisterFoos)
  *
- * @param initfunc  The global constructor to accumulate into
+ * @param registry  The registry to add each entity to.
  * @param ns        Short for namespace, prefix for each global (ns##_##id)
- * @param array     The array to add each entity to. Also requires `array##_first` and `array##_last` to be defined
  * @param id        The identifier of the current entity being registered
- * @param fld       The field to store the current count into
+ * @param fld       The field to store the locally unique unique entity id
  * @param inst      An expression to create a new instance, invoked for every registration
  */
-#define REGISTER(initfunc, ns, array, id, fld, inst) \
+#define REGISTER(registry, ns, id, fld, inst) \
        entity ns##_##id; \
        REGISTER_INIT(ns, id) {} \
        REGISTER_INIT_POST(ns, id) {} \
        void Register_##ns##_##id() \
        { \
-               if (array##_COUNT >= array##_MAX) LOG_FATALF("Registry capacity exceeded (%s)", ftos(array##_MAX)); \
-               entity this = inst; \
-               ns##_##id = this; \
+               if (registry##_COUNT >= registry##_MAX) LOG_FATALF("Registry capacity exceeded (%s)", ftos(registry##_MAX)); \
+               entity this = ns##_##id = inst; \
                this.registered_id = #id; \
-               this.fld = array##_COUNT; \
-               _##array[array##_COUNT++] = this; \
-               if (!array##_first) array##_first = this; \
-               if (array##_last)   array##_last.REGISTRY_NEXT = this; \
-               array##_last = this; \
+               this.fld = registry##_COUNT; \
+               _##registry[registry##_COUNT] = this; \
+               ++registry##_COUNT; \
+               if (!registry##_first) registry##_first = this; \
+               if (registry##_last)   registry##_last.REGISTRY_NEXT = this; \
+               registry##_last = this; \
                Register_##ns##_##id##_init(this); \
                Register_##ns##_##id##_init_post(this); \
        } \
-       ACCUMULATE_FUNCTION(initfunc, Register_##ns##_##id) \
+       ACCUMULATE_FUNCTION(Register##registry, Register_##ns##_##id) \
        REGISTER_INIT(ns, id)
 
+#define REGISTER_INIT(ns, id) [[accumulate]] void Register_##ns##_##id##_init(entity this)
+#define REGISTER_INIT_POST(ns, id) [[accumulate]] void Register_##ns##_##id##_init_post(entity this)
+
 /** internal next pointer */
 #define REGISTRY_NEXT enemy
 .entity REGISTRY_NEXT;
@@ -119,7 +121,7 @@ void Registry_send(string id, string hash);
                string h = REGISTRY_HASH(id) = strzone(digest_hex(algo, s)); \
                LOG_TRACEF(#id ": %s\n[%s]\n", h, s); \
        } \
-       [[accumulate]] void Registry_check(string r, string sv) \
+       void Registry_check(string r, string sv) \
        { \
                if (r == #id) \
                { \
@@ -130,6 +132,17 @@ void Registry_send(string id, string hash);
                        } \
                } \
        } \
-       [[accumulate]] void Registry_send_all() { Registry_send(#id, REGISTRY_HASH(id)); } \
+       void Registry_send_all() { Registry_send(#id, REGISTRY_HASH(id)); } \
+
+#define REGISTER_REGISTRY(...) EVAL(OVERLOAD(REGISTER_REGISTRY, __VA_ARGS__))
+#define REGISTER_REGISTRY_1(id) REGISTER_REGISTRY_2(id, #id)
+#define REGISTER_REGISTRY_2(id, str) \
+       ACCUMULATE_FUNCTION(__static_init, Register##id) \
+       CLASS(id##Registry, Object) \
+               ATTRIB(id##Registry, m_name, string, str) \
+               ATTRIB(id##Registry, REGISTRY_NEXT, entity, id##_first) \
+       ENDCLASS(id##Registry) \
+       REGISTER(Registries, REGISTRY, id, m_id, NEW(id##Registry));
+
 
 #endif
index f522023ef8aa662ebfb45d800ee9b5e736c9b66d..7dd2706fd240c798e8dff885bd916f122222335f 100644 (file)
@@ -20,7 +20,7 @@
        #define _STAT(id) g_stat_##id
        #define REGISTER_STAT(id, type) \
                type _STAT(id); \
-               REGISTER(RegisterStats, STAT, Stats, id, m_id, new(stat)) \
+               REGISTER(Stats, STAT, id, m_id, new(stat)) \
                { \
                        make_pure(this); \
                } \
@@ -43,7 +43,7 @@
        #define _STAT(id) stat_##id
        #define REGISTER_STAT(id, type) \
                .type _STAT(id); \
-               REGISTER(RegisterStats, STAT, Stats, id, m_id, new(stat)) \
+               REGISTER(Stats, STAT, id, m_id, new(stat)) \
                { \
                        make_pure(this); \
                } \
@@ -58,7 +58,7 @@
 const int STATS_ENGINE_RESERVE = 32 + (8 * 3); // Not sure how to handle vector stats yet, reserve them too
 
 REGISTRY(Stats, 220 - STATS_ENGINE_RESERVE)
-REGISTER_REGISTRY(RegisterStats)
+REGISTER_REGISTRY(Stats)
 REGISTRY_SORT(Stats, 0)
 REGISTRY_CHECK(Stats)
 STATIC_INIT(RegisterStats_renumber)
index 6cbaebdcdb124aa7e18626b084902c8834394749..0cda013c0e8238ba26e259c0a232befd690ee9de 100644 (file)
@@ -1,6 +1,17 @@
 #ifndef VECTOR_H
 #define VECTOR_H
 
+#define cross(a, b) ((a) >< (b))
+/*
+vector cross(vector a, vector b)
+{
+       return
+               '1 0 0' * (a.y * b.z - a.z * b.y)
+       +       '0 1 0' * (a.z * b.x - a.x * b.z)
+       +       '0 0 1' * (a.x * b.y - a.y * b.x);
+}
+*/
+
 const vector eX = '1 0 0';
 const vector eY = '0 1 0';
 const vector eZ = '0 0 1';
index 92b7ee14dd9080d2fac9d17527042f929cbe3433..ac3b65ff1a276a3dd35c36f1c12d206055fd9fb0 100644 (file)
@@ -290,11 +290,3 @@ int isunordered(float x, float y)
 {
        return !(x < y || x == y || x > y);
 }
-
-vector cross(vector a, vector b)
-{
-       return
-               '1 0 0' * (a.y * b.z - a.z * b.y)
-       +       '0 1 0' * (a.z * b.x - a.x * b.z)
-       +       '0 0 1' * (a.x * b.y - a.y * b.x);
-}
index 9acece2ab2befeacad137ddc049ac01b1b41f407..c3de3838dde28cb70ed0d9e915751554436ccd49 100644 (file)
@@ -115,7 +115,4 @@ const float M_2_SQRTPI = 1.12837916709551257390;  /* 2/sqrt(pi) */
 const float M_SQRT2    = 1.41421356237309504880;  /* sqrt(2) */
 const float M_SQRT1_2  = 0.70710678118654752440;  /* 1/sqrt(2) */
 
-// Non-<math.h> stuff follows here.
-vector cross(vector a, vector b);
-
 #endif
index 24a40edf04a267128957e6f15221b8cb382510e4..0db9f77f2e08faf4c98d61205561c7e5af704e6f 100644 (file)
@@ -6,10 +6,10 @@
 
 REGISTRY(Settings, BITS(3))
 #define Settings_from(i) _Settings_from(i, NULL)
-REGISTER_REGISTRY(RegisterSettings)
+REGISTER_REGISTRY(Settings)
 #define REGISTER_SETTINGS(id, impl) \
     LAZY_NEW(id, impl) \
-    REGISTER(RegisterSettings, MENU, Settings, id, m_id, NEW(Lazy, LAZY(id)))
+    REGISTER(Settings, MENU, id, m_id, NEW(Lazy, LAZY(id)))
 
 #endif
 #endif
index fa6161a9779337d7587799b4d99f54693a6f0944..12132affb4a267baf6124ee9cb7ff73b0321392a 100644 (file)
@@ -2,21 +2,21 @@
 #define ITEM_H
 #include "skin.qh"
 CLASS(Item, Object)
-       METHOD(Item, draw, void(entity));
-       METHOD(Item, keyDown, float(entity, float, float, float));
-       METHOD(Item, keyUp, float(entity, float, float, float));
-       METHOD(Item, mouseMove, float(entity, vector));
-       METHOD(Item, mousePress, float(entity, vector));
-       METHOD(Item, mouseDrag, float(entity, vector));
-       METHOD(Item, mouseRelease, float(entity, vector));
-       METHOD(Item, focusEnter, void(entity));
-       METHOD(Item, focusLeave, void(entity));
-       METHOD(Item, resizeNotify, void(entity, vector, vector, vector, vector));
-       METHOD(Item, relinquishFocus, void(entity));
-       METHOD(Item, showNotify, void(entity));
-       METHOD(Item, hideNotify, void(entity));
-       METHOD(Item, toString, string(entity));
-       METHOD(Item, destroy, void(entity));
+       METHOD(Item, draw, void(Item));
+       METHOD(Item, keyDown, float(Item, float, float, float));
+       METHOD(Item, keyUp, float(Item, float, float, float));
+       METHOD(Item, mouseMove, float(Item, vector));
+       METHOD(Item, mousePress, float(Item, vector));
+       METHOD(Item, mouseDrag, float(Item, vector));
+       METHOD(Item, mouseRelease, float(Item, vector));
+       METHOD(Item, focusEnter, void(Item));
+       METHOD(Item, focusLeave, void(Item));
+       METHOD(Item, resizeNotify, void(Item, vector, vector, vector, vector));
+       METHOD(Item, relinquishFocus, void(Item));
+       METHOD(Item, showNotify, void(Item));
+       METHOD(Item, hideNotify, void(Item));
+       METHOD(Item, toString, string(Item));
+       METHOD(Item, destroy, void(Item));
        ATTRIB(Item, focused, float, 0)
        ATTRIB(Item, focusable, float, 0)
        ATTRIB(Item, allowFocusSound, float, 0)
@@ -29,111 +29,102 @@ ENDCLASS(Item)
 #endif
 
 #ifdef IMPLEMENTATION
-void Item_destroy(entity me)
-{
-       // free memory associated with me
-}
-
-void Item_relinquishFocus(entity me)
-{
-       if(me.parent)
-               if(me.parent.instanceOfContainer)
-                       me.parent.setFocus(me.parent, NULL);
-}
-
-void Item_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
-{
-       me.origin = absOrigin;
-       me.size = absSize;
-}
-
-float autocvar_menu_showboxes;
-void Item_draw(entity me)
-{
-       if(autocvar_menu_showboxes)
+       METHOD(Item, destroy, void(Item this))
        {
+               // free memory associated with this
+       }
+
+       METHOD(Item, relinquishFocus, void(Item this))
+       {
+               entity par = this.parent;
+               if (!par) return;
+               if (par.instanceOfContainer) par.setFocus(par, NULL);
+       }
+
+       METHOD(Item, resizeNotify, void(Item this, vector relOrigin, vector relSize, vector absOrigin, vector absSize))
+       {
+               this.origin = absOrigin;
+               this.size = absSize;
+       }
+
+       int autocvar_menu_showboxes;
+       METHOD(Item, draw, void(Item this))
+       {
+               if (!autocvar_menu_showboxes) return;
                vector rgb = '1 0 1';
                float a = fabs(autocvar_menu_showboxes);
 
                // don't draw containers and border images
-               if(me.instanceOfContainer || me.instanceOfBorderImage)
+               if (this.instanceOfContainer || this.instanceOfBorderImage)
                {
                        rgb = '0 0 0';
                        a = 0;
                }
 
-#if 0
-               // hack to detect multi drawing
-               float r = random() * 3;
-               if(r >= 2)
-                       rgb = '1 0 0';
-               else if(r >= 1)
-                       rgb = '0 1 0';
-               else
-                       rgb = '0 0 1';
-#endif
-               if(autocvar_menu_showboxes < 0)
+               #if 0
+                       // hack to detect multi drawing
+                       float r = random() * 3;
+                       if (r >= 2) rgb = '1 0 0';
+                       else if (r >= 1) rgb = '0 1 0';
+                       else rgb = '0 0 1';
+               #endif
+               if (autocvar_menu_showboxes < 0)
                {
                        draw_Fill('0 0 0', '0.5 0.5 0', rgb, a);
                        draw_Fill('0.5 0.5 0', '0.5 0.5 0', rgb, a);
                }
-               if(autocvar_menu_showboxes > 0)
+               else if (autocvar_menu_showboxes > 0)
                {
                        draw_Fill('0 0 0', '1 1 0', rgb, a);
                }
        }
-}
-
-void Item_showNotify(entity me)
-{
-}
-
-void Item_hideNotify(entity me)
-{
-}
-
-float Item_keyDown(entity me, float scan, float ascii, float shift)
-{
-       return 0; // unhandled
-}
-
-float Item_keyUp(entity me, float scan, float ascii, float shift)
-{
-       return 0; // unhandled
-}
-
-float Item_mouseMove(entity me, vector pos)
-{
-       return 0; // unhandled
-}
-
-float Item_mousePress(entity me, vector pos)
-{
-       return 0; // unhandled
-}
-
-float Item_mouseDrag(entity me, vector pos)
-{
-       return 0; // unhandled
-}
-
-float Item_mouseRelease(entity me, vector pos)
-{
-       return 0; // unhandled
-}
-
-void Item_focusEnter(entity me)
-{
-       if(me.allowFocusSound)
-               m_play_focus_sound();
-}
-
-void Item_focusLeave(entity me)
-{
-}
-
-string Item_toString(entity me)
-{
-       return string_null;
-}
+
+       METHOD(Item, showNotify, void(Item this))
+       {}
+
+       METHOD(Item, hideNotify, void(Item this))
+       {}
+
+       METHOD(Item, keyDown, float(Item this, float scan, float ascii, float shift))
+       {
+               return 0;  // unhandled
+       }
+
+       METHOD(Item, keyUp, float(Item this, float scan, float ascii, float shift))
+       {
+               return 0;  // unhandled
+       }
+
+       METHOD(Item, mouseMove, float(Item this, vector pos))
+       {
+               return 0;  // unhandled
+       }
+
+       METHOD(Item, mousePress, float(Item this, vector pos))
+       {
+               return 0;  // unhandled
+       }
+
+       METHOD(Item, mouseDrag, float(Item this, vector pos))
+       {
+               return 0;  // unhandled
+       }
+
+       METHOD(Item, mouseRelease, float(Item this, vector pos))
+       {
+               return 0;  // unhandled
+       }
+
+       METHOD(Item, focusEnter, void(Item this))
+       {
+               if (this.allowFocusSound) m_play_focus_sound();
+       }
+
+       METHOD(Item, focusLeave, void(Item this))
+       {}
+
+       METHOD(Item, toString, string(Item this))
+       {
+               return string_null;
+       }
 #endif
index ad2b000f93bfbeddb9c100a00c44c8e77f0ac9ce..899de0ec97185b66bdf500a10e883dd87dc9cbd0 100644 (file)
@@ -7,31 +7,25 @@
 #include "../common/mapinfo.qh"
 #include "../common/mutators/base.qh"
 
-///////////////////////////////////////////////
-// Menu Source File
-///////////////////////
-// This file belongs to dpmod/darkplaces
-// AK contains all menu functions (especially the required ones)
-///////////////////////////////////////////////
-
-float mouseButtonsPressed;
+int mouseButtonsPressed;
 vector menuMousePos;
 int menuShiftState;
 float menuPrevTime;
 float menuAlpha;
 float menuLogoAlpha;
 float prevMenuAlpha;
-float menuInitialized;
-float menuNotTheFirstFrame;
-float menuMouseMode;
+bool menuInitialized;
+bool menuNotTheFirstFrame;
+int menuMouseMode;
 
-float conwidth_s, conheight_s, vidwidth_s, vidheight_s, vidpixelheight_s,
-      realconwidth, realconheight;
+float conwidth_s, conheight_s;
+float vidwidth_s, vidheight_s, vidpixelheight_s;
+float realconwidth, realconheight;
 
 void m_sync()
 {
        updateCompression();
-       vidwidth_s = vidheight_s = vidpixelheight_s = 0;  // Force updateConwidths on next draw.
+       vidwidth_s = vidheight_s = vidpixelheight_s = 0;  // Force updateConwidths on next draw
 
        loadAllCvars(main);
 }
@@ -39,43 +33,37 @@ void m_sync()
 void m_gamestatus()
 {
        gamestatus = 0;
-       if(isserver())
-               gamestatus = gamestatus | GAME_ISSERVER;
-       if(clientstate() == CS_CONNECTED || isdemo())
-               gamestatus = gamestatus | GAME_CONNECTED;
-       if(cvar("developer"))
-               gamestatus = gamestatus | GAME_DEVELOPER;
+       if (isserver()) gamestatus |= GAME_ISSERVER;
+       if (clientstate() == CS_CONNECTED || isdemo()) gamestatus |= GAME_CONNECTED;
+       if (cvar("developer")) gamestatus |= GAME_DEVELOPER;
 }
 
 void m_init()
 {
-       float restarting = 0;
+       bool restarting = false;
        cvar_set("_menu_alpha", "0");
        prvm_language = cvar_string("prvm_language");
-       if(prvm_language == "")
+       if (prvm_language == "")
        {
                prvm_language = "en";
                cvar_set("prvm_language", prvm_language);
                localcmd("\nmenu_restart\n");
-               restarting = 1;
+               restarting = true;
        }
        prvm_language = strzone(prvm_language);
        cvar_set("_menu_prvm_language", prvm_language);
 
 #ifdef WATERMARK
-       LOG_TRACEF("^4MQC Build information: ^1%s\n", WATERMARK);
+               LOG_INFOF("^4MQC Build information: ^1%s\n", WATERMARK);
 #endif
 
        // list all game dirs (TEST)
-       if(cvar("developer"))
+       if (cvar("developer"))
        {
-               float i;
-               string s;
-               for(i = 0; ; ++i)
+               for (int i = 0; ; ++i)
                {
-                       s = getgamedirinfo(i, GETGAMEDIRINFO_NAME);
-                       if (!s)
-                               break;
+                       string s = getgamedirinfo(i, GETGAMEDIRINFO_NAME);
+                       if (!s) break;
                        LOG_TRACE(s, ": ", getgamedirinfo(i, GETGAMEDIRINFO_DESCRIPTION));
                }
        }
@@ -90,21 +78,18 @@ void m_init()
        float ddsload = cvar("r_texture_dds_load");
        float texcomp = cvar("gl_texturecompression");
        updateCompression();
-       if(ddsload != cvar("r_texture_dds_load") || texcomp != cvar("gl_texturecompression"))
-               localcmd("\nr_restart\n");
+       if (ddsload != cvar("r_texture_dds_load") || texcomp != cvar("gl_texturecompression")) localcmd("\nr_restart\n");
 
-       if(!restarting)
+       if (!restarting)
        {
-               if(cvar("_menu_initialized")) // always show menu after menu_restart
+               if (cvar("_menu_initialized"))  // always show menu after menu_restart
                        m_display();
-               else
-                       m_hide();
+               else m_hide();
                cvar_set("_menu_initialized", "1");
        }
-
 }
 
-const float MENU_ASPECT = 1.25; // 1280x1024
+const float MENU_ASPECT = 1280 / 1024;
 
 void draw_reset_cropped()
 {
@@ -119,8 +104,7 @@ void UpdateConWidthHeight(float w, float h, float p)
 {
        if (w != vidwidth_s || h != vidheight_s || p != vidpixelheight_s)
        {
-               if (updateConwidths(w, h, p))
-                       localcmd(sprintf("\nexec %s\n", cvar_string("menu_font_cfg")));
+               if (updateConwidths(w, h, p)) localcmd(sprintf("\nexec %s\n", cvar_string("menu_font_cfg")));
                vidwidth_s = w;
                vidheight_s = h;
                vidpixelheight_s = p;
@@ -129,7 +113,7 @@ void UpdateConWidthHeight(float w, float h, float p)
        conheight_s = conheight;
        realconwidth = cvar("vid_conwidth");
        realconheight = cvar("vid_conheight");
-       if(realconwidth / realconheight > MENU_ASPECT)
+       if (realconwidth / realconheight > MENU_ASPECT)
        {
                // widescreen
                conwidth = realconheight * MENU_ASPECT;
@@ -141,9 +125,9 @@ void UpdateConWidthHeight(float w, float h, float p)
                conwidth = realconwidth;
                conheight = realconwidth / MENU_ASPECT;
        }
-       if(main)
+       if (main)
        {
-               if(conwidth_s != conwidth || conheight_s != conheight)
+               if (conwidth_s != conwidth || conheight_s != conheight)
                {
                        draw_reset_cropped();
                        main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
@@ -151,64 +135,53 @@ void UpdateConWidthHeight(float w, float h, float p)
        }
        else
        {
-               vidwidth_s = vidheight_s = vidpixelheight_s = 0; // retry next frame
+               vidwidth_s = vidheight_s = vidpixelheight_s = 0;  // retry next frame
        }
 }
 
 string m_goto_buffer;
 void m_init_delayed()
 {
-       float fh, glob, n, i;
-       string s;
-
        draw_reset_cropped();
 
-       menuInitialized = 0;
-       if(!preMenuInit())
-               return;
-       menuInitialized = 1;
+       menuInitialized = false;
+       if (!preMenuInit()) return;
+       menuInitialized = true;
 
-       fh = -1;
-       if(cvar_string("menu_skin") != "")
+       int fh = -1;
+       if (cvar_string("menu_skin") != "")
        {
                draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
                fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
        }
-       if(fh < 0)
-       if(cvar_defstring("menu_skin") != "")
+       if (fh < 0 && cvar_defstring("menu_skin") != "")
        {
                cvar_set("menu_skin", cvar_defstring("menu_skin"));
                draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
                fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
        }
-       if(fh < 0)
+       if (fh < 0)
        {
                draw_currentSkin = "gfx/menu/default";
                fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
        }
-       if(fh < 0)
-       {
-               error("cannot load any menu skin\n");
-       }
+       if (fh < 0) error("cannot load any menu skin\n");
        draw_currentSkin = strzone(draw_currentSkin);
-       while((s = fgets(fh)))
+       for (string s; (s = fgets(fh)); )
        {
                // these two are handled by skinlist.qc
-               if(substring(s, 0, 6) == "title ")
-                       continue;
-               if(substring(s, 0, 7) == "author ")
-                       continue;
-               n = tokenize_console(s);
-               if(n >= 2)
-                       Skin_ApplySetting(argv(0), substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
+               if (substring(s, 0, 6) == "title ") continue;
+               if (substring(s, 0, 7) == "author ") continue;
+               int n = tokenize_console(s);
+               if (n < 2) continue;
+               Skin_ApplySetting(argv(0), substring(s, argv_start_index(1), argv_end_index(-1) - argv_start_index(1)));
        }
        fclose(fh);
 
-       glob = search_begin(strcat(draw_currentSkin, "/*.tga"), true, true);
-       if(glob >= 0)
+       int glob = search_begin(strcat(draw_currentSkin, "/*.tga"), true, true);
+       if (glob >= 0)
        {
-               n = search_getsize(glob);
-               for(i = 0; i < n; ++i)
+               for (int i = 0, n = search_getsize(glob); i < n; ++i)
                        precache_pic(search_getfilename(glob, i));
                search_end(glob);
        }
@@ -216,117 +189,110 @@ void m_init_delayed()
        draw_setMousePointer(SKINGFX_CURSOR, SKINSIZE_CURSOR, SKINOFFSET_CURSOR);
 
        anim = NEW(AnimHost);
-       main = NEW(MainWindow); main.configureMainWindow(main);
+       main = NEW(MainWindow);
+       main.configureMainWindow(main);
 
        main.resizeNotify(main, '0 0 0', eX * conwidth + eY * conheight, '0 0 0', eX * conwidth + eY * conheight);
-       main.focused = 1;
+       main.focused = true;
        menuShiftState = 0;
        menuMousePos = '0.5 0.5 0';
 
        m_sync();
 
-       if(m_goto_buffer)
+       if (m_goto_buffer)
        {
                m_goto(m_goto_buffer);
                strunzone(m_goto_buffer);
                m_goto_buffer = string_null;
        }
 
-       if(Menu_Active)
-               m_display(); // delayed menu display
+       if (Menu_Active) m_display();  // delayed menu display
 }
 
-void m_keyup (float key, float ascii)
+void m_keyup(float key, float ascii)
 {
-       if(!menuInitialized)
-               return;
-       if(!Menu_Active)
-               return;
+       if (!menuInitialized) return;
+       if (!Menu_Active) return;
        draw_reset_cropped();
        main.keyUp(main, key, ascii, menuShiftState);
-       if(key >= K_MOUSE1 && key <= K_MOUSE3)
+       if (key >= K_MOUSE1 && key <= K_MOUSE3)
        {
                --mouseButtonsPressed;
-               if(!mouseButtonsPressed)
-                       main.mouseRelease(main, menuMousePos);
-               if(mouseButtonsPressed < 0)
+               if (!mouseButtonsPressed) main.mouseRelease(main, menuMousePos);
+               if (mouseButtonsPressed < 0)
                {
                        mouseButtonsPressed = 0;
                        LOG_TRACE("Warning: released an already released button\n");
                }
        }
-       if(key == K_ALT) menuShiftState -= (menuShiftState & S_ALT);
-       if(key == K_CTRL) menuShiftState -= (menuShiftState & S_CTRL);
-       if(key == K_SHIFT) menuShiftState -= (menuShiftState & S_SHIFT);
+       if (key == K_ALT) menuShiftState &= ~S_ALT;
+       if (key == K_CTRL) menuShiftState &= ~S_CTRL;
+       if (key == K_SHIFT) menuShiftState &= ~S_SHIFT;
 }
 
 void m_keydown(float key, float ascii)
 {
-       if(!menuInitialized)
-               return;
-       if(!Menu_Active)
-               return;
+       if (!menuInitialized) return;
+       if (!Menu_Active) return;
 
-       if(menuMouseMode)
-       if(key >= K_MOUSE1 && key <= K_MOUSE3)
+       if (menuMouseMode && key >= K_MOUSE1 && key <= K_MOUSE3)
        {
                // detect a click outside of the game window
                vector p = getmousepos();
-               if(p.x < 0 || p.x > realconwidth || p.y < 0 || p.y > realconheight)
+               if (p.x < 0 || p.x > realconwidth || p.y < 0 || p.y > realconheight)
                {
                        ++mouseButtonsPressed;
                        return;
                }
        }
 
-       if(keyGrabber)
+       if (keyGrabber)
        {
-               entity e;
-               e = keyGrabber;
+               entity e = keyGrabber;
                keyGrabber = NULL;
                e.keyGrabbed(e, key, ascii);
        }
        else
        {
                draw_reset_cropped();
-               if(key >= K_MOUSE1 && key <= K_MOUSE3)
-                       if(!mouseButtonsPressed)
-                               main.mousePress(main, menuMousePos);
-               if(!main.keyDown(main, key, ascii, menuShiftState))
-                       if(key == K_ESCAPE)
-                               if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED)) // don't back out to console only
-                                       m_hide(); // disable menu on unhandled ESC
+               if (!mouseButtonsPressed && key >= K_MOUSE1 && key <= K_MOUSE3) main.mousePress(main, menuMousePos);
+               if (!main.keyDown(main, key, ascii, menuShiftState))
+               {
+                       // disable menu on unhandled ESC
+                       if (key == K_ESCAPE)
+                               if (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))  // don't back out to console only
+                                       m_hide();
+               }
        }
-       if(key >= K_MOUSE1 && key <= K_MOUSE3)
+       if (key >= K_MOUSE1 && key <= K_MOUSE3)
        {
                ++mouseButtonsPressed;
-               if(mouseButtonsPressed > 10)
+               if (mouseButtonsPressed > 10)
                {
                        mouseButtonsPressed = 10;
                        LOG_TRACE("Warning: pressed an already pressed button\n");
                }
        }
-       if(key == K_ALT) menuShiftState |= S_ALT;
-       if(key == K_CTRL) menuShiftState |= S_CTRL;
-       if(key == K_SHIFT) menuShiftState |= S_SHIFT;
+       if (key == K_ALT) menuShiftState |= S_ALT;
+       if (key == K_CTRL) menuShiftState |= S_CTRL;
+       if (key == K_SHIFT) menuShiftState |= S_SHIFT;
 }
 
-const float SCALEMODE_CROP = 0;
-const float SCALEMODE_LETTERBOX = 1;
-const float SCALEMODE_WIDTH = 2;
-const float SCALEMODE_HEIGHT = 3;
-const float SCALEMODE_STRETCH = 4;
+enum {
+       SCALEMODE_CROP,
+       SCALEMODE_LETTERBOX,
+       SCALEMODE_WIDTH,
+       SCALEMODE_HEIGHT,
+       SCALEMODE_STRETCH,
+};
 void draw_Picture_Aligned(vector algn, float scalemode, string img, float a)
 {
-       vector sz, org, isz, isz_w, isz_h;
-       float width_is_larger;
-
-       sz = draw_PictureSize(img);
-       width_is_larger = (sz.x * draw_scale.y >= sz.y * draw_scale.x);
-       isz_w = '1 0 0' + '0 1 0' * ((sz.y / sz.x) * (draw_scale.x / draw_scale.y));
-       isz_h = '0 1 0' + '1 0 0' * ((sz.x / sz.y) * (draw_scale.y / draw_scale.x));
-
-       switch(scalemode)
+       vector sz = draw_PictureSize(img);
+       bool width_is_larger = (sz.x * draw_scale.y >= sz.y * draw_scale.x);
+       vector isz_w = '1 0 0' + '0 1 0' * ((sz.y / sz.x) * (draw_scale.x / draw_scale.y));
+       vector isz_h = '0 1 0' + '1 0 0' * ((sz.x / sz.y) * (draw_scale.y / draw_scale.x));
+       vector isz;
+       switch (scalemode)
        {
                default:
                case SCALEMODE_CROP:
@@ -345,170 +311,174 @@ void draw_Picture_Aligned(vector algn, float scalemode, string img, float a)
                        isz = '1 1 0';
                        break;
        }
-
-       org = eX * (algn.x * (1 - isz.x)) + eY * (algn.y * (1 - isz.y));
+       vector org = eX * (algn.x * (1 - isz.x)) + eY * (algn.y * (1 - isz.y));
        draw_Picture(org, img, isz, '1 1 1', a);
 }
 
 void drawBackground(string img, float a, string algn, float force1)
 {
-       if(main.mainNexposee.ModalController_state == 0)
-               return;
-
-       vector v;
-       float i, l;
-       string c;
-       float scalemode;
-
-       v.z = 0;
-
-       scalemode = SCALEMODE_CROP;
-
-       l = 0;
-       for(i = 0; i < strlen(algn); ++i)
+       if (main.mainNexposee.ModalController_state == 0) return;
+       vector v = '0 0 0';
+       int scalemode = SCALEMODE_CROP;
+       for (int i = 0, l = 0; i < strlen(algn); ++i)
        {
-               c = substring(algn, i, 1);
-               switch(c)
+               string c = substring(algn, i, 1);
+               switch (c)
                {
-                       case "c": scalemode = SCALEMODE_CROP; goto nopic;
-                       case "l": scalemode = SCALEMODE_LETTERBOX; goto nopic;
-                       case "h": scalemode = SCALEMODE_HEIGHT; goto nopic;
-                       case "w": scalemode = SCALEMODE_WIDTH; goto nopic;
-                       case "s": scalemode = SCALEMODE_STRETCH; goto nopic;
-                       case "1": case "4": case "7": v.x = 0.0; break;
-                       case "2": case "5": case "8": v.x = 0.5; break;
-                       case "3": case "6": case "9": v.x = 1.0; break;
-                       default: v.x = random(); break;
+                       case "c":
+                               scalemode = SCALEMODE_CROP;
+                               goto nopic;
+                       case "l":
+                               scalemode = SCALEMODE_LETTERBOX;
+                               goto nopic;
+                       case "h":
+                               scalemode = SCALEMODE_HEIGHT;
+                               goto nopic;
+                       case "w":
+                               scalemode = SCALEMODE_WIDTH;
+                               goto nopic;
+                       case "s":
+                               scalemode = SCALEMODE_STRETCH;
+                               goto nopic;
+                       case "1": case "4": case "7":
+                               v.x = 0.0;
+                               break;
+                       case "2": case "5": case "8":
+                               v.x = 0.5;
+                               break;
+                       case "3": case "6": case "9":
+                               v.x = 1.0;
+                               break;
+                       default:
+                               v.x = random();
+                               break;
                }
-               switch(c)
+               switch (c)
                {
-                       case "7": case "8": case "9": v.y = 0.0; break;
-                       case "4": case "5": case "6": v.y = 0.5; break;
-                       case "1": case "2": case "3": v.y = 1.0; break;
-                       default: v.y = random(); break;
+                       case "7": case "8": case "9":
+                               v.y = 0.0;
+                               break;
+                       case "4": case "5": case "6":
+                               v.y = 0.5;
+                               break;
+                       case "1": case "2": case "3":
+                               v.y = 1.0;
+                               break;
+                       default:
+                               v.y = random();
+                               break;
                }
-               if(l == 0)
+               if (l == 0)
+               {
                        draw_Picture_Aligned(v, scalemode, img, a);
-               else if(force1)
+               }
+               else if (force1)
+               {
                        // force all secondary layers to use alpha 1. Prevents ugly issues
                        // with overlap. It's a flag because it cannot be used for the
                        // ingame background
-                       draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l+1)), 1);
+                       draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l + 1)), 1);
+               }
                else
-                       draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l+1)), a);
+               {
+                       draw_Picture_Aligned(v, scalemode, strcat(img, "_l", ftos(l + 1)), a);
+               }
                ++l;
-:nopic
+               : nopic
        }
 }
 
-float menu_tooltips;
-float menu_tooltips_old;
+int menu_tooltips;
+int menu_tooltips_old;
 vector menuTooltipAveragedMousePos;
 entity menuTooltipItem;
 vector menuTooltipOrigin;
 vector menuTooltipSize;
 float menuTooltipAlpha;
 string menuTooltipText;
-float menuTooltipState; // 0: static, 1: fading in, 2: fading out, 3: forced fading out
-float m_testmousetooltipbox(vector pos)
+int menuTooltipState;  // 0: static, 1: fading in, 2: fading out, 3: forced fading out
+bool m_testmousetooltipbox(vector pos)
 {
-       if(pos.x >= menuTooltipOrigin.x && pos.x < menuTooltipOrigin.x + menuTooltipSize.x)
-       if(pos.y >= menuTooltipOrigin.y && pos.y < menuTooltipOrigin.y + menuTooltipSize.y)
-               return false;
-       return true;
+       return !(
+           (pos.x >= menuTooltipOrigin.x && pos.x < menuTooltipOrigin.x + menuTooltipSize.x)
+           && (pos.y >= menuTooltipOrigin.y && pos.y < menuTooltipOrigin.y + menuTooltipSize.y)
+               );
 }
-float m_testtooltipbox(vector tooltippos)
+bool m_testtooltipbox(vector tooltippos)
 {
-       if(tooltippos.x < 0)
-               return false;
-       if(tooltippos.y < 0)
-               return false;
-       if(tooltippos.x + menuTooltipSize.x > 1)
-               return false;
-       if(tooltippos.y + menuTooltipSize.y > 1)
-               return false;
+       if (tooltippos.x < 0) return false;
+       if (tooltippos.y < 0) return false;
+       if (tooltippos.x + menuTooltipSize.x > 1) return false;
+       if (tooltippos.y + menuTooltipSize.y > 1) return false;
        menuTooltipOrigin = tooltippos;
        return true;
 }
-float m_allocatetooltipbox(vector pos)
+bool m_allocatetooltipbox(vector pos)
 {
-       vector avoidplus, avoidminus;
-       vector v;
-
+       vector avoidplus;
        avoidplus.x = (SKINAVOID_TOOLTIP_x + SKINSIZE_CURSOR_x - SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth;
        avoidplus.y = (SKINAVOID_TOOLTIP_y + SKINSIZE_CURSOR_y - SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight;
        avoidplus.z = 0;
 
+       vector avoidminus;
        avoidminus.x = (SKINAVOID_TOOLTIP_x + SKINOFFSET_CURSOR_x * SKINSIZE_CURSOR_x) / conwidth + menuTooltipSize.x;
        avoidminus.y = (SKINAVOID_TOOLTIP_y + SKINOFFSET_CURSOR_y * SKINSIZE_CURSOR_y) / conheight + menuTooltipSize.y;
        avoidminus.z = 0;
 
        // bottom right
-       v = pos + avoidplus;
-       if(m_testtooltipbox(v))
-               return true;
+       vector v = pos + avoidplus;
+       if (m_testtooltipbox(v)) return true;
 
        // bottom center
        v.x = pos.x - menuTooltipSize.x * 0.5;
-       if(m_testtooltipbox(v))
-               return true;
+       if (m_testtooltipbox(v)) return true;
 
        // bottom left
        v.x = pos.x - avoidminus.x;
-       if(m_testtooltipbox(v))
-               return true;
+       if (m_testtooltipbox(v)) return true;
 
        // top left
        v.y = pos.y - avoidminus.y;
-       if(m_testtooltipbox(v))
-               return true;
+       if (m_testtooltipbox(v)) return true;
 
        // top center
        v.x = pos.x - menuTooltipSize.x * 0.5;
-       if(m_testtooltipbox(v))
-               return true;
+       if (m_testtooltipbox(v)) return true;
 
        // top right
        v.x = pos.x + avoidplus.x;
-       if(m_testtooltipbox(v))
-               return true;
+       if (m_testtooltipbox(v)) return true;
 
        return false;
 }
 entity m_findtooltipitem(entity root, vector pos)
 {
-       entity it;
-       entity best;
-
-       best = NULL;
-       it = root;
-
-       while(it.instanceOfContainer)
+       entity best = NULL;
+       for (entity it = root; it.instanceOfContainer; )
        {
-               while(it.instanceOfNexposee && it.focusedChild)
+               while (it.instanceOfNexposee && it.focusedChild)
                {
                        it = it.focusedChild;
                        pos = globalToBox(pos, it.Container_origin, it.Container_size);
                }
-               if(it.instanceOfNexposee)
+               if (it.instanceOfNexposee)
                {
                        it = it.itemFromPoint(it, pos);
-                       if(it.tooltip)
-                               best = it;
-                       else if(menu_tooltips == 2 && (it.cvarName || it.onClickCommand))
-                               best = it;
+                       if (it.tooltip) best = it;
+                       else if (menu_tooltips == 2 && (it.cvarName || it.onClickCommand)) best = it;
                        it = NULL;
                }
-               else if(it.instanceOfModalController)
+               else if (it.instanceOfModalController)
+               {
                        it = it.focusedChild;
+               }
                else
+               {
                        it = it.itemFromPoint(it, pos);
-               if(!it)
-                       break;
-               if(it.tooltip)
-                       best = it;
-               else if(menu_tooltips == 2 && (it.cvarName || it.onClickCommand))
-                       best = it;
+               }
+               if (!it) break;
+               if (it.tooltip) best = it;
+               else if (menu_tooltips == 2 && (it.cvarName || it.onClickCommand)) best = it;
                pos = globalToBox(pos, it.Container_origin, it.Container_size);
        }
 
@@ -521,74 +491,72 @@ string gettooltip()
                string s;
                if (menuTooltipItem.cvarName)
                {
-                       if (getCvarsMulti(menuTooltipItem))
-                               s = strcat("[", menuTooltipItem.cvarName, " ", getCvarsMulti(menuTooltipItem), "]");
-                       else
-                               s = strcat("[", menuTooltipItem.cvarName, "]");
+                       if (getCvarsMulti(menuTooltipItem)) s =
+                                   strcat("[", menuTooltipItem.cvarName, " ", getCvarsMulti(menuTooltipItem), "]");
+                       else s = strcat("[", menuTooltipItem.cvarName, "]");
                }
                else if (menuTooltipItem.onClickCommand)
+               {
                        s = strcat("<", menuTooltipItem.onClickCommand, ">");
+               }
                else
+               {
                        return menuTooltipItem.tooltip;
-               if (menuTooltipItem.tooltip)
-                       return strcat(menuTooltipItem.tooltip, " ", s);
+               }
+               if (menuTooltipItem.tooltip) return strcat(menuTooltipItem.tooltip, " ", s);
                return s;
        }
        return menuTooltipItem.tooltip;
 }
-string prev_tooltip;
 void m_tooltip(vector pos)
 {
-       float f, i, w;
+       static string prev_tooltip;
        entity it;
-       vector fontsize, p;
-       string s;
-
        menu_tooltips = cvar("menu_tooltips");
        if (!menu_tooltips)
        {
                // don't return immediately, fade out the active tooltip first
-               if (menuTooltipItem == NULL)
-                       return;
+               if (menuTooltipItem == NULL) return;
                it = NULL;
                menu_tooltips_old = menu_tooltips;
        }
        else
        {
-               f = bound(0, frametime * 2, 1);
+               float f = bound(0, frametime * 2, 1);
                menuTooltipAveragedMousePos = menuTooltipAveragedMousePos * (1 - f) + pos * f;
                f = vlen(pos - menuTooltipAveragedMousePos);
-               if(f < 0.01)
+               if (f < 0.01)
                {
                        it = m_findtooltipitem(main, pos);
 
-                       if(it.instanceOfListBox && it.isScrolling(it))
-                               it = world;
+                       if (it.instanceOfListBox && it.isScrolling(it)) it = world;
 
-                       if(it && prev_tooltip != it.tooltip)
+                       if (it && prev_tooltip != it.tooltip)
                        {
                                // fade out if tooltip of a certain item has changed
                                menuTooltipState = 3;
-                               if(prev_tooltip)
-                                       strunzone(prev_tooltip);
+                               if (prev_tooltip) strunzone(prev_tooltip);
                                prev_tooltip = strzone(it.tooltip);
                        }
-                       else if(menuTooltipItem && !m_testmousetooltipbox(pos))
-                               menuTooltipState = 3; // fade out if mouse touches it
-
+                       else if (menuTooltipItem && !m_testmousetooltipbox(pos))
+                       {
+                               menuTooltipState = 3;  // fade out if mouse touches it
+                       }
                }
                else
+               {
                        it = NULL;
+               }
        }
-       fontsize = '1 0 0' * (SKINFONTSIZE_TOOLTIP / conwidth) + '0 1 0' * (SKINFONTSIZE_TOOLTIP / conheight);
+       vector fontsize = '1 0 0' * (SKINFONTSIZE_TOOLTIP / conwidth) + '0 1 0' * (SKINFONTSIZE_TOOLTIP / conheight);
 
        // float menuTooltipState; // 0: static, 1: fading in, 2: fading out, 3: forced fading out
-       if(it != menuTooltipItem)
+       if (it != menuTooltipItem)
        {
-               switch(menuTooltipState)
+               switch (menuTooltipState)
                {
                        case 0:
-                               if(menuTooltipItem)
+                               if (menuTooltipItem)
                                {
                                        // another item: fade out first
                                        menuTooltipState = 2;
@@ -599,22 +567,18 @@ void m_tooltip(vector pos)
                                        menuTooltipState = 1;
                                        menuTooltipItem = it;
 
-                                       menuTooltipOrigin.x = -1; // unallocated
+                                       menuTooltipOrigin.x = -1;  // unallocated
 
-                                       if (menuTooltipText)
-                                               strunzone(menuTooltipText);
+                                       if (menuTooltipText) strunzone(menuTooltipText);
                                        menuTooltipText = strzone(gettooltip());
 
-                                       i = 0;
-                                       w = 0;
-                                       getWrappedLine_remaining = menuTooltipText;
-                                       while(getWrappedLine_remaining)
+                                       int i = 0;
+                                       float w = 0;
+                                       for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining; ++i)
                                        {
-                                               s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
-                                               ++i;
-                                               f = draw_TextWidth(s, false, fontsize);
-                                               if(f > w)
-                                                       w = f;
+                                               string s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
+                                               float f = draw_TextWidth(s, false, fontsize);
+                                               if (f > w) w = f;
                                        }
                                        menuTooltipSize.x = w + 2 * (SKINMARGIN_TOOLTIP_x / conwidth);
                                        menuTooltipSize.y = i * fontsize.y + 2 * (SKINMARGIN_TOOLTIP_y / conheight);
@@ -630,20 +594,21 @@ void m_tooltip(vector pos)
                                break;
                }
        }
-       else if(menuTooltipState == 2) // re-fade in?
+       else if (menuTooltipState == 2)  // re-fade in?
+       {
                menuTooltipState = 1;
+       }
 
-       switch(menuTooltipState)
+       switch (menuTooltipState)
        {
-               case 1: // fade in
+               case 1:  // fade in
                        menuTooltipAlpha = bound(0, menuTooltipAlpha + 5 * frametime, 1);
-                       if(menuTooltipAlpha == 1)
-                               menuTooltipState = 0;
+                       if (menuTooltipAlpha == 1) menuTooltipState = 0;
                        break;
-               case 2: // fade out
-               case 3: // forced fade out
+               case 2:  // fade out
+               case 3:  // forced fade out
                        menuTooltipAlpha = bound(0, menuTooltipAlpha - 2 * frametime, 1);
-                       if(menuTooltipAlpha == 0)
+                       if (menuTooltipAlpha == 0)
                        {
                                menuTooltipState = 0;
                                menuTooltipItem = NULL;
@@ -651,7 +616,7 @@ void m_tooltip(vector pos)
                        break;
        }
 
-       if(menuTooltipItem == NULL)
+       if (menuTooltipItem == NULL)
        {
                if (menuTooltipText)
                {
@@ -662,31 +627,29 @@ void m_tooltip(vector pos)
        }
        else
        {
-               if(menu_tooltips != menu_tooltips_old)
+               if (menu_tooltips != menu_tooltips_old)
                {
-                       if (menu_tooltips != 0 && menu_tooltips_old != 0)
-                               menuTooltipItem = NULL; // reload tooltip next frame
+                       if (menu_tooltips != 0 && menu_tooltips_old != 0) menuTooltipItem = NULL; // reload tooltip next frame
                        menu_tooltips_old = menu_tooltips;
                }
-               else if(menuTooltipOrigin.x < 0) // unallocated?
+               else if (menuTooltipOrigin.x < 0)                                             // unallocated?
+               {
                        m_allocatetooltipbox(pos);
-
-               if(menuTooltipOrigin.x >= 0)
+               }
+               if (menuTooltipOrigin.x >= 0)
                {
                        // draw the tooltip!
-                       p = SKINBORDER_TOOLTIP;
+                       vector p = SKINBORDER_TOOLTIP;
                        p.x *= 1 / conwidth;
                        p.y *= 1 / conheight;
                        draw_BorderPicture(menuTooltipOrigin, SKINGFX_TOOLTIP, menuTooltipSize, '1 1 1', menuTooltipAlpha, p);
                        p = menuTooltipOrigin;
                        p.x += SKINMARGIN_TOOLTIP_x / conwidth;
                        p.y += SKINMARGIN_TOOLTIP_y / conheight;
-                       getWrappedLine_remaining = menuTooltipText;
-                       while(getWrappedLine_remaining)
+                       for (getWrappedLine_remaining = menuTooltipText; getWrappedLine_remaining; p.y += fontsize.y)
                        {
-                               s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
+                               string s = getWrappedLine(SKINWIDTH_TOOLTIP, fontsize, draw_TextWidth_WithoutColors);
                                draw_Text(p, s, fontsize, SKINCOLOR_TOOLTIP, SKINALPHA_TOOLTIP * menuTooltipAlpha, false);
-                               p.y += fontsize.y;
                        }
                }
        }
@@ -694,94 +657,90 @@ void m_tooltip(vector pos)
 
 void m_draw(float width, float height)
 {
-       float t;
-       float realFrametime;
-
        m_gamestatus();
 
        execute_next_frame();
 
        menuMouseMode = cvar("menu_mouse_absolute");
 
-       if (anim)
-               anim.tickAll(anim);
+       if (anim) anim.tickAll(anim);
 
        UpdateConWidthHeight(width, height, cvar("vid_pixelheight"));
 
-       if(!menuInitialized)
+       if (!menuInitialized)
        {
                // TODO draw an info image about this situation
                m_init_delayed();
                return;
        }
-       if(!menuNotTheFirstFrame)
+       if (!menuNotTheFirstFrame)
        {
-               menuNotTheFirstFrame = 1;
-               if(Menu_Active)
-               if(!cvar("menu_video_played"))
-               {
-                       localcmd("cd loop $menu_cdtrack; play sound/announcer/default/welcome.wav\n");
-                       menuLogoAlpha = -0.8; // no idea why, but when I start this at zero, it jumps instead of fading FIXME
-               }
+               menuNotTheFirstFrame = true;
+               if (Menu_Active && !cvar("menu_video_played"))
+        {
+            localcmd("cd loop $menu_cdtrack; play sound/announcer/default/welcome.wav\n");
+            menuLogoAlpha = -0.8;  // no idea why, but when I start this at zero, it jumps instead of fading FIXME
+        }
                // ALWAYS set this cvar; if we start but menu is not active, this means we want no background music!
                localcmd("set menu_video_played 1\n");
        }
 
-       t = gettime();
-       realFrametime = frametime = min(0.2, t - menuPrevTime);
+       float t = gettime();
+       float realFrametime = frametime = min(0.2, t - menuPrevTime);
        menuPrevTime = t;
        time += frametime;
 
        t = cvar("menu_slowmo");
-       if(t)
+       if (t)
        {
                frametime *= t;
                realFrametime *= t;
        }
        else
+       {
                t = 1;
+       }
 
-       if(Menu_Active)
+       if (Menu_Active)
        {
-               if(getmousetarget() == (menuMouseMode ? MT_CLIENT : MT_MENU) && (getkeydest() == KEY_MENU || getkeydest() == KEY_MENU_GRABBED))
-                       setkeydest(keyGrabber ? KEY_MENU_GRABBED : KEY_MENU);
-               else
-                       m_hide();
+               if (getmousetarget() == (menuMouseMode ? MT_CLIENT : MT_MENU)
+                   && (getkeydest() == KEY_MENU || getkeydest() == KEY_MENU_GRABBED))
+                       setkeydest(keyGrabber ? KEY_MENU_GRABBED : KEY_MENU);
+               else m_hide();
        }
 
-       if(cvar("cl_capturevideo"))
-               frametime = t / cvar("cl_capturevideo_fps"); // make capturevideo work smoothly
+       if (cvar("cl_capturevideo")) frametime = t / cvar("cl_capturevideo_fps");  // make capturevideo work smoothly
 
        prevMenuAlpha = menuAlpha;
-       if(Menu_Active)
+       if (Menu_Active)
        {
-               if(menuAlpha == 0 && menuLogoAlpha < 2)
+               if (menuAlpha == 0 && menuLogoAlpha < 2)
                {
-                       menuLogoAlpha = menuLogoAlpha + frametime * 2;
+                       menuLogoAlpha += 2 * frametime;
                }
                else
                {
-                       menuAlpha = min(1, menuAlpha + frametime * 5);
+                       menuAlpha = min(1, menuAlpha + 5 * frametime);
                        menuLogoAlpha = 2;
                }
        }
        else
        {
-               menuAlpha = max(0, menuAlpha - frametime * 5);
+               menuAlpha = max(0, menuAlpha - 5 * frametime);
                menuLogoAlpha = 2;
        }
 
        draw_reset_cropped();
 
-       if(!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
+       if (!(gamestatus & (GAME_CONNECTED | GAME_ISSERVER)))
        {
-               if(menuLogoAlpha > 0)
+               if (menuLogoAlpha > 0)
                {
                        draw_reset_full();
                        draw_Fill('0 0 0', '1 1 0', SKINCOLOR_BACKGROUND, 1);
                        drawBackground(SKINGFX_BACKGROUND, bound(0, menuLogoAlpha, 1), SKINALIGN_BACKGROUND, true);
                        draw_reset_cropped();
-                       if(menuAlpha <= 0 && SKINALPHA_CURSOR_INTRO > 0)
+                       if (menuAlpha <= 0 && SKINALPHA_CURSOR_INTRO > 0)
                        {
                                draw_alpha = SKINALPHA_CURSOR_INTRO * bound(0, menuLogoAlpha, 1);
                                draw_drawMousePointer(menuMousePos);
@@ -789,27 +748,26 @@ void m_draw(float width, float height)
                        }
                }
        }
-       else if(SKINALPHA_BACKGROUND_INGAME)
+       else if (SKINALPHA_BACKGROUND_INGAME)
        {
-               if(menuAlpha > 0)
+               if (menuAlpha > 0)
                {
                        draw_reset_full();
-                       drawBackground(SKINGFX_BACKGROUND_INGAME, menuAlpha * SKINALPHA_BACKGROUND_INGAME, SKINALIGN_BACKGROUND_INGAME, false);
+                       drawBackground(SKINGFX_BACKGROUND_INGAME, menuAlpha * SKINALPHA_BACKGROUND_INGAME,
+                               SKINALIGN_BACKGROUND_INGAME, false);
                        draw_reset_cropped();
                }
        }
 
-       if(menuAlpha != prevMenuAlpha)
-               cvar_set("_menu_alpha", ftos(menuAlpha));
+       if (menuAlpha != prevMenuAlpha) cvar_set("_menu_alpha", ftos(menuAlpha));
 
        draw_reset_cropped();
        preMenuDraw();
        draw_reset_cropped();
 
-       if(menuAlpha <= 0)
+       if (menuAlpha <= 0)
        {
-               if(prevMenuAlpha > 0)
-                       main.initializeDialog(main, main.firstChild);
+               if (prevMenuAlpha > 0) main.initializeDialog(main, main.firstChild);
                draw_reset_cropped();
                postMenuDraw();
                return;
@@ -817,44 +775,34 @@ void m_draw(float width, float height)
 
        draw_alpha *= menuAlpha;
 
-       if(!Menu_Active)
+       if (!Menu_Active)
        {
                // do not update mouse position
                // it prevents mouse jumping to '0 0 0' when menu is fading out
        }
-       else if(menuMouseMode)
+       else if (menuMouseMode)
        {
-               vector newMouse;
-               newMouse = globalToBox(getmousepos(), draw_shift, draw_scale);
-               if(newMouse != '0 0 0')
-                       if(newMouse != menuMousePos)
-                       {
-                               menuMousePos = newMouse;
-                               if(mouseButtonsPressed)
-                                       main.mouseDrag(main, menuMousePos);
-                               else
-                                       main.mouseMove(main, menuMousePos);
-                       }
+               vector newMouse = globalToBox(getmousepos(), draw_shift, draw_scale);
+               if (newMouse != '0 0 0' && newMouse != menuMousePos)
+               {
+                       menuMousePos = newMouse;
+                       if (mouseButtonsPressed) main.mouseDrag(main, menuMousePos);
+                       else main.mouseMove(main, menuMousePos);
+               }
        }
-       else
+       else if (frametime > 0)
        {
-               if(frametime > 0)
+               vector dMouse = getmousepos() * (frametime / realFrametime);  // for capturevideo
+               if (dMouse != '0 0 0')
                {
-                       vector dMouse, minpos, maxpos;
-                       dMouse = getmousepos() * (frametime / realFrametime); // for capturevideo
-                       if(dMouse != '0 0 0')
-                       {
-                               minpos = globalToBox('0 0 0', draw_shift, draw_scale);
-                               maxpos = globalToBox(eX * (realconwidth - 1) + eY * (realconheight - 1), draw_shift, draw_scale);
-                               dMouse = globalToBoxSize(dMouse, draw_scale);
-                               menuMousePos += dMouse * cvar("menu_mouse_speed");
-                               menuMousePos.x = bound(minpos.x, menuMousePos.x, maxpos.x);
-                               menuMousePos.y = bound(minpos.y, menuMousePos.y, maxpos.y);
-                               if(mouseButtonsPressed)
-                                       main.mouseDrag(main, menuMousePos);
-                               else
-                                       main.mouseMove(main, menuMousePos);
-                       }
+                       vector minpos = globalToBox('0 0 0', draw_shift, draw_scale);
+                       vector maxpos = globalToBox(eX * (realconwidth - 1) + eY * (realconheight - 1), draw_shift, draw_scale);
+                       dMouse = globalToBoxSize(dMouse, draw_scale);
+                       menuMousePos += dMouse * cvar("menu_mouse_speed");
+                       menuMousePos.x = bound(minpos.x, menuMousePos.x, maxpos.x);
+                       menuMousePos.y = bound(minpos.y, menuMousePos.y, maxpos.y);
+                       if (mouseButtonsPressed) main.mouseDrag(main, menuMousePos);
+                       else main.mouseMove(main, menuMousePos);
                }
        }
        main.draw(main);
@@ -877,11 +825,9 @@ void m_display()
        setkeydest(KEY_MENU);
        setmousetarget((menuMouseMode ? MT_CLIENT : MT_MENU));
 
-       if(!menuInitialized)
-               return;
+       if (!menuInitialized) return;
 
-       if(mouseButtonsPressed)
-               main.mouseRelease(main, menuMousePos);
+       if (mouseButtonsPressed) main.mouseRelease(main, menuMousePos);
        mouseButtonsPressed = 0;
 
        main.focusEnter(main);
@@ -894,112 +840,94 @@ void m_hide()
        setkeydest(KEY_GAME);
        setmousetarget(MT_CLIENT);
 
-       if(!menuInitialized)
-               return;
+       if (!menuInitialized) return;
 
        main.focusLeave(main);
        main.hideNotify(main);
 }
 
-void m_toggle(float mode)
+void m_toggle(int mode)
 {
-       if(Menu_Active)
+       if (Menu_Active)
        {
-               if (mode == 1)
-                       return;
+               if (mode == 1) return;
                m_hide();
        }
        else
        {
-               if (mode == 0)
-                       return;
+               if (mode == 0) return;
                m_display();
        }
 }
 
 void Shutdown()
 {
-       entity e;
-
        m_hide();
-       for(e = NULL; (e = nextent(e)) != NULL; )
+       for (entity e = NULL; (e = nextent(e)); )
        {
-               if(e.classname != "vtbl")
-                       if(e.destroy)
-                               e.destroy(e);
+               if (e.classname == "vtbl") continue;
+               if (e.destroy) e.destroy(e);
        }
 }
 
 void m_focus_item_chain(entity outermost, entity innermost)
 {
-       if(innermost.parent != outermost)
-               m_focus_item_chain(outermost, innermost.parent);
+       if (innermost.parent != outermost) m_focus_item_chain(outermost, innermost.parent);
        innermost.parent.setFocus(innermost.parent, innermost);
 }
 
 void m_activate_window(entity wnd)
 {
-       entity par;
-       par = wnd.parent;
-       if(par)
-               m_activate_window(par);
+       entity par = wnd.parent;
+       if (par) m_activate_window(par);
 
-       if(par.instanceOfModalController)
+       if (par.instanceOfModalController)
        {
-               if(wnd.tabSelectingButton)
+               if (wnd.tabSelectingButton)
                        // tabs
                        TabButton_Click(wnd.tabSelectingButton, wnd);
                else
                        // root
                        par.initializeDialog(par, wnd);
        }
-       else if(par.instanceOfNexposee)
+       else if (par.instanceOfNexposee)
        {
                // nexposee (sorry for violating abstraction here)
                par.selectedChild = wnd;
                par.animationState = 1;
                Container_setFocus(par, NULL);
        }
-       else if(par.instanceOfContainer)
+       else if (par.instanceOfContainer)
        {
                // other containers
-               if(par.focused)
-                       par.setFocus(par, wnd);
+               if (par.focused) par.setFocus(par, wnd);
        }
 }
 
 void m_setpointerfocus(entity wnd)
 {
-       if(wnd.instanceOfContainer)
-       {
-               entity focus = wnd.preferredFocusedGrandChild(wnd);
-               if(focus)
-               {
-                       menuMousePos = focus.origin + 0.5 * focus.size;
-                       menuMousePos.x *= 1 / conwidth;
-                       menuMousePos.y *= 1 / conheight;
-                       entity par = wnd.parent;
-                       if(par.focused)
-                               par.setFocus(par, wnd);
-                       if(wnd.focused)
-                               m_focus_item_chain(wnd, focus);
-               }
-       }
+       if (!wnd.instanceOfContainer) return;
+       entity focus = wnd.preferredFocusedGrandChild(wnd);
+       if (!focus) return;
+       menuMousePos = focus.origin + 0.5 * focus.size;
+       menuMousePos.x *= 1 / conwidth;
+       menuMousePos.y *= 1 / conheight;
+       entity par = wnd.parent;
+       if (par.focused) par.setFocus(par, wnd);
+       if (wnd.focused) m_focus_item_chain(wnd, focus);
 }
 
 void m_goto(string itemname)
 {
-       entity e;
-       if(!menuInitialized)
+       if (!menuInitialized)
        {
-               if(m_goto_buffer)
-                       strunzone(m_goto_buffer);
+               if (m_goto_buffer) strunzone(m_goto_buffer);
                m_goto_buffer = strzone(itemname);
                return;
        }
-       if(itemname == "") // this can be called by GameCommand
+       if (itemname == "")  // this can be called by GameCommand
        {
-               if(gamestatus & (GAME_ISSERVER | GAME_CONNECTED))
+               if (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))
                {
                        m_hide();
                }
@@ -1011,11 +939,11 @@ void m_goto(string itemname)
        }
        else
        {
-               for(e = NULL; (e = find(e, name, itemname)); )
-                       if(e.classname != "vtbl")
-                               break;
+               entity e;
+               for (e = NULL; (e = find(e, name, itemname)); )
+                       if (e.classname != "vtbl") break;
 
-               if((e) && (!e.requiresConnection || (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))))
+               if ((e) && (!e.requiresConnection || (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))))
                {
                        m_hide();
                        m_activate_window(e);
@@ -1025,19 +953,17 @@ void m_goto(string itemname)
        }
 }
 
-float menuLastFocusSoundTime;
 void m_play_focus_sound()
 {
-       if(cvar("menu_sounds") > 1)
-               if(time - menuLastFocusSoundTime > 0.25)
-               {
-                       localsound(MENU_SOUND_FOCUS);
-                       menuLastFocusSoundTime = time;
-               }
+       static float menuLastFocusSoundTime;
+       if (cvar("menu_sounds") < 2) return;
+       if (time - menuLastFocusSoundTime <= 0.25) return;
+       localsound(MENU_SOUND_FOCUS);
+       menuLastFocusSoundTime = time;
 }
 
 void m_play_click_sound(string soundfile)
 {
-       if(cvar("menu_sounds"))
-               localsound(soundfile);
+       if (!cvar("menu_sounds")) return;
+       localsound(soundfile);
 }
index 6d45ca82f46a36b7f4e64f449275ec36f895a829..a4cdbc5f512bea1eba011c2dd64f30ea00b11c6f 100644 (file)
@@ -9,15 +9,11 @@
 #include "../common/constants.qh"
 #include "../common/util.qh"
 
-// constants
+const int GAME_ISSERVER     = BIT(0);
+const int GAME_CONNECTED    = BIT(1);
+const int GAME_DEVELOPER    = BIT(2);
 
-const int GAME_ISSERVER        = 1;
-const int GAME_CONNECTED       = 2;
-const int GAME_DEVELOPER       = 4;
-
-// prototypes
-
-float Menu_Active;
+bool Menu_Active;
 int gamestatus;
 
 const int S_SHIFT = 1;
@@ -35,20 +31,22 @@ void m_goto(string name);
 .string name;
 
 entity keyGrabber;
-.void(entity me, float key, float ascii) keyGrabbed;
+.void(entity this, float key, float ascii) keyGrabbed;
 
-float conwidth, conheight; // "virtual" conwidth/height values for other stuff to assume for scaling
+// "virtual" conwidth/height values for other stuff to assume for scaling
+float conwidth, conheight;
 
-float preMenuInit(); // you have to define this for pre-menu initialization. Return 0 if initialization needs to be retried a frame later, 1 if it succeeded.
-void preMenuDraw(); // this is run before the menu is drawn. You may put some stuff there that has to be done every frame.
-void postMenuDraw(); // this is run just after the menu is drawn (or not). Useful to draw something over everything else.
+/** you have to define this for pre-menu initialization. Return 0 if initialization needs to be retried a frame later, 1 if it succeeded. */
+float preMenuInit();
+/** this is run before the menu is drawn. You may put some stuff there that has to be done every frame. */
+void preMenuDraw();
+/** this is run just after the menu is drawn (or not). Useful to draw something over everything else. */
+void postMenuDraw();
 
 void m_sync();
 
 void draw_reset_cropped();
 
-// sounds
-
 const string MENU_SOUND_CLEAR   = "sound/menu/clear.wav";
 const string MENU_SOUND_CLOSE   = "sound/menu/close.wav";
 const string MENU_SOUND_EXECUTE = "sound/menu/execute.wav";
diff --git a/qcsrc/menu/sys-post.qh b/qcsrc/menu/sys-post.qh
deleted file mode 100644 (file)
index 2b4120e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef SYS_POST_H
-#define SYS_POST_H
-
-#pragma noref 0
-#endif
diff --git a/qcsrc/menu/sys-pre.qh b/qcsrc/menu/sys-pre.qh
deleted file mode 100644 (file)
index 333d5c6..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef SYS_PRE_H
-#define SYS_PRE_H
-
-#pragma noref 1
-#endif
index 0ac826a44064cc4752b4c828a2b9c6c119e7a6e0..63da9cd92ae56980bf6db6ba9c29925eb08ab54e 100644 (file)
@@ -60,18 +60,17 @@ bool XonoticCrosshairPicker_cellIsValid(entity me, vector cell)
 
 void XonoticCrosshairPicker_cellDraw(entity me, vector cell, vector cellPos)
 {
-       vector sz;
-       string cross = strcat("/gfx/crosshair", crosshairpicker_cellToCrosshair(me, cell));
-       sz = draw_PictureSize(cross);
+       string s = strcat("/gfx/crosshair", crosshairpicker_cellToCrosshair(me, cell));
+       vector sz = draw_PictureSize(s);
        sz = globalToBoxSize(sz, me.size);
 
        float ar = sz.x / sz.y;
        sz.x = me.realCellSize.x;
        sz.y = sz.x / ar;
-       sz = sz * 0.95;
+       sz *= 0.95;
 
        vector crosshairPos = cellPos + 0.5 * me.realCellSize;
-       draw_Picture(crosshairPos - 0.5 * sz, cross, sz, SKINCOLOR_CROSSHAIRPICKER_CROSSHAIR, SKINALPHA_CROSSHAIRPICKER_CROSSHAIR);
+       draw_Picture(crosshairPos - 0.5 * sz, s, sz, SKINCOLOR_CROSSHAIRPICKER_CROSSHAIR, SKINALPHA_CROSSHAIRPICKER_CROSSHAIR);
 
        if(cvar("crosshair_dot"))
                draw_Picture(crosshairPos - 0.5 * sz * cvar("crosshair_dot_size"), "/gfx/crosshairdot", sz * cvar("crosshair_dot_size"), SKINCOLOR_CROSSHAIRPICKER_CROSSHAIR, SKINALPHA_CROSSHAIRPICKER_CROSSHAIR);
index d8e7c4b65bec0066131d75ae8585ff59b0cdc920..6f68b332d3f98ad5bd9bb83c147f0ee0c2c54776 100644 (file)
@@ -147,7 +147,7 @@ CLASS(XonoticGameSettingsTab, XonoticTab)
                        topics.onChangeEntity = this;
 
                int
-               col = 0, width = 1.5;
+               col = 0, width = 1;
                this.gotoRC(this, 0, col);
                        this.TD(this, this.rows, width, topics);
 
index 0b7281dbff13f3cd1e3fc25b69ef229a43da989e..66dbb835127d4ffc4812f69cda19296ba461b47d 100644 (file)
@@ -184,15 +184,10 @@ void XonoticLanguageList_getLanguages(entity me)
                        continue;
                bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_ID, argv(0));
                bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_NAME, argv(1));
-               float k = strstrofs(argv(2), "(", 0);
-               if(k > 0)
-               if(substring(argv(2), strlen(argv(2)) - 1, 1) == ")")
-               {
-                       string percent = substring(argv(2), k + 1, -2);
-                       if(percent != "100%")
-                               bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_PERCENTAGE, percent);
-               }
-               bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_NAME_LOCALIZED, (k < 0) ? argv(2) : substring(argv(2), 0, k - 1));
+               bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_NAME_LOCALIZED, argv(2));
+               string percent = argv(3);
+               if(percent && percent != "100%")
+                       bufstr_set(buf, i * LANGPARM_COUNT + LANGPARM_PERCENTAGE, percent);
                ++i;
        }
        fclose(fh);
index dd131f3a6410bee532d5fa4ad265fb59f8b12f96..81d5136f9648949b18e8b7866059ea977eff7a2e 100644 (file)
@@ -345,7 +345,8 @@ void reset_map(float dorespawn)
 {
        SELFPARAM();
 
-       if (time <= game_starttime && round_handler_IsActive()) round_handler_Reset(game_starttime);
+       if (time <= game_starttime && round_handler_IsActive())
+               round_handler_Reset(game_starttime);
 
        MUTATOR_CALLHOOK(reset_map_global);
 
index 5d9436f684ea4c3b87c2b1dcd6587b3bd214ceeb..147c03ca26e60a4a1d64eea44fae528544ca74a6 100644 (file)
@@ -12,7 +12,6 @@
 #include "weapons/accuracy.qh"
 #include "weapons/csqcprojectile.qh"
 #include "weapons/selection.qh"
-#include "../common/buffs/all.qh"
 #include "../common/constants.qh"
 #include "../common/deathtypes/all.qh"
 #include "../common/notifications.qh"
@@ -262,6 +261,8 @@ float Obituary_WeaponDeath(
        return false;
 }
 
+.int buffs; // TODO: remove
+
 void Obituary(entity attacker, entity inflictor, entity targ, int deathtype)
 {
        // Sanity check
index 16a78fd6dcbccf8105c41a54ac27df1d31fa2236..85f1ce163bc72edaf028cc1c9d153c833b8ace03 100644 (file)
@@ -18,7 +18,6 @@
 #include "scores.qh"
 #include "teamplay.qh"
 #include "weapons/weaponstats.qh"
-#include "../common/buffs/all.qh"
 #include "../common/constants.qh"
 #include "../common/deathtypes/all.qh"
 #include "../common/mapinfo.qh"
index 542763fd28dcff1965b2cec466244f48c473e832..3520953ba5cf6c2858f85385db2ec07037da25c9 100644 (file)
@@ -9,8 +9,6 @@
     #include "../../common/stats.qh"
     #include "../../common/teams.qh"
     #include "../../common/util.qh"
-    #include "../../common/nades/all.qh"
-    #include "../../common/buffs/all.qh"
     #include "../../common/command/markup.qh"
     #include "../../common/command/rpn.qh"
     #include "../../common/command/generic.qh"
index 6ab895f21f9cd7936f78869e630d70b8b1a9f3b9..08a9d4d22b14f1ff50540d4f2e64ee7862f03f40 100644 (file)
 #include "../common/viewloc.qc"
 
 #include "../common/deathtypes/all.qc"
-#include "../common/buffs/all.qc"
 #include "../common/effects/all.qc"
 #include "../common/gamemodes/all.qc"
 #include "../common/items/all.qc"
 #include "../common/monsters/all.qc"
-#include "../common/nades/all.qc"
 #include "../common/turrets/all.qc"
 #include "../common/vehicles/all.qc"
 #include "../common/weapons/all.qc"
index 94663fc36534a93502fc0f6816a2d13da945417d..82646da26a01dfca79a42192c9adc9d2f77d5f06 100644 (file)
@@ -1,6 +1,5 @@
 
 #include "../common/weapons/all.qh"
-#include "../common/buffs/all.qh"
 
 spawnfunc(weapon_crylink);
 spawnfunc(weapon_electro);
@@ -155,10 +154,7 @@ spawnfunc(target_give)
 
 spawnfunc(item_flight)
 {
-       if(!cvar("g_buffs") || !cvar("g_buffs_flight"))
-               spawnfunc_item_jetpack(this);
-       else
-               buff_Init_Compat(self, BUFF_FLIGHT);
+       spawnfunc_item_jetpack(this);
 }
 
 .float notteam;
index 1a75bf4041afd671e950b4cefced2f247055a408..deb6032ce207a32b980a06804608cbd4303ad173 100644 (file)
@@ -652,7 +652,7 @@ void SV_ChangeTeam(float _color)
 
        // since this is an engine function, and gamecode doesn't have any calls earlier than this, do the connecting message here
        if(!IS_CLIENT(self))
-               Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_CONNECTING, self.netname);
+               Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_CONNECTING, self.netname);
 
        SetPlayerTeam(self, dteam, steam, !IS_CLIENT(self));
 
diff --git a/quickmenu_example.txt b/quickmenu_example.txt
new file mode 100644 (file)
index 0000000..6f97e28
--- /dev/null
@@ -0,0 +1,36 @@
+// This quickmenu example file can be loaded by setting
+// hud_panel_quickmenu_file quickmenu_example.txt
+// and executing "quickmenu file"
+// For more options see "quickmenu help"
+
+"Chat"
+       "nice one" "say :-) / nice one"
+       "good game" "say good game"
+       "hi / good luck" "say hi / good luck and have fun"
+"Chat"
+
+"Settings"
+       // nested submenu
+       "Sound settings"
+               "Hit sound" "toggle cl_hitsound"
+               "Chat sound" "toggle cl_chatsound"
+       "Sound settings"
+
+       // A toggle command displays a checkbox showing the current cvar's state
+       "enable 3rd person view" "toggle chase_active"
+       // it's possible to invert the meaning of the checkbox by inverting the
+       // parameters of toggle from the implicit 1 0 to 0 1
+       "disable 3rd person view" "toggle chase_active 0 1"
+"Settings"
+
+"screenshot" "wait; screenshot"
+
+// Commands that accept a player's name as parameter (%s), followed by one of
+// these special keywords:
+//   ALLPLAYERS_BUT_ME
+//   ALLPLAYERS
+//   OWNTEAMPLAYERS_BUT_ME
+//   OWNTEAMPLAYERS
+//   ENEMYTEAMPLAYERS
+// lets you pick a player's name from a list:
+"private chat with:" "commandmode tell \"%s\"" ALLPLAYERS_BUT_ME