]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Registry API: add REGISTRY_GET
authorterencehill <piuntn@gmail.com>
Wed, 27 May 2020 19:46:32 +0000 (21:46 +0200)
committerterencehill <piuntn@gmail.com>
Wed, 27 May 2020 20:01:44 +0000 (22:01 +0200)
74 files changed:
qcsrc/client/commands/cl_cmd.qh
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud.qh
qcsrc/client/hud/hud_config.qc
qcsrc/client/hud/panel/notify.qc
qcsrc/client/hud/panel/radar.qc
qcsrc/client/main.qc
qcsrc/client/view.qc
qcsrc/client/weapons/projectile.qc
qcsrc/common/animdecide.qh
qcsrc/common/command/reg.qh
qcsrc/common/deathtypes/all.qc
qcsrc/common/deathtypes/all.qh
qcsrc/common/effects/all.qc
qcsrc/common/effects/all.qh
qcsrc/common/effects/effectinfo.qc
qcsrc/common/effects/qc/casings.qc
qcsrc/common/effects/qc/globalsound.qc
qcsrc/common/effects/qc/globalsound.qh
qcsrc/common/ent_cs.qc
qcsrc/common/impulses/all.qh
qcsrc/common/items/all.qh
qcsrc/common/items/inventory.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.inc
qcsrc/common/models/all.qh
qcsrc/common/monsters/all.qh
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/mutators/base.qh
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/buffs/buffs.qh
qcsrc/common/mutators/mutator/buffs/cl_buffs.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/nades/nades.qh
qcsrc/common/mutators/mutator/nix/sv_nix.qc
qcsrc/common/mutators/mutator/waypoints/all.qh
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/notifications/all.qh
qcsrc/common/scores.qh
qcsrc/common/sounds/all.inc
qcsrc/common/sounds/all.qh
qcsrc/common/t_items.qc
qcsrc/common/turrets/all.qh
qcsrc/common/util.qc
qcsrc/common/vehicles/all.qh
qcsrc/common/vehicles/cl_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle/bumblebee_weapons.qc
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/all.qh
qcsrc/common/wepent.qc
qcsrc/lib/net.qh
qcsrc/lib/registry.qh
qcsrc/lib/stats.qh
qcsrc/menu/gamesettings.qh
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc
qcsrc/menu/xonotic/dialog_settings_game.qc
qcsrc/menu/xonotic/serverlist.qc
qcsrc/menu/xonotic/weaponslist.qc
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/scripting.qc
qcsrc/server/command/common.qh
qcsrc/server/command/reg.qh
qcsrc/server/g_damage.qc
qcsrc/server/impulse.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/selection.qc
qcsrc/server/weapons/selection.qh
qcsrc/server/weapons/throwing.qc
qcsrc/server/weapons/weaponsystem.qc

index f6f96501aee2abb928a8de29ca923f602f80ea6b..725baa408e9c0c47dd748a596e26a751e1b05683 100644 (file)
@@ -8,10 +8,11 @@ void ConsoleCommand_macro_init();
 void LocalCommand_macro_write_aliases(int fh);
 
 REGISTRY(CLIENT_COMMANDS, BITS(7))
-#define CLIENT_COMMANDS_from(i) _CLIENT_COMMANDS_from(i, NULL)
 REGISTER_REGISTRY(CLIENT_COMMANDS)
 REGISTRY_SORT(CLIENT_COMMANDS)
 
+REGISTRY_DEFINE_GET(CLIENT_COMMANDS, NULL)
+
 #define CLIENT_COMMAND(id, description) \
        CLASS(clientcommand_##id, Command) \
                ATTRIB(clientcommand_##id, m_name, string, #id); \
index dd91dbd687894840efea279dd9c87899ef037334..91770fd724ecc9b3b477ce5d279a88077e0448d0 100644 (file)
@@ -408,7 +408,7 @@ void HUD_Vehicle()
        if(hud == HUD_BUMBLEBEE_GUN)
                CSQC_BUMBLE_GUN_HUD();
        else {
-               Vehicle info = Vehicles_from(hud);
+               Vehicle info = REGISTRY_GET(Vehicles, hud);
                info.vr_hud(info);
        }
 
@@ -708,7 +708,7 @@ void HUD_Main()
        hud_draw_maximized = 0;
        // draw panels in the order specified by panel_order array
        for(i = REGISTRY_COUNT(hud_panels) - 1; i >= 0; --i)
-               HUD_Panel_Draw(hud_panels_from(panel_order[i]));
+               HUD_Panel_Draw(REGISTRY_GET(hud_panels, panel_order[i]));
 
        HUD_Vehicle();
 
index c0a322244d3431946ba3db32e9007d3c69075c75..38ca8a0187c9845f43bbfcc40c37ee66b7c30961 100644 (file)
@@ -11,9 +11,10 @@ bool HUD_WouldShowCursor();
 bool QuickMenu_IsOpened();
 
 REGISTRY(hud_panels, BITS(6))
-#define hud_panels_from(i) _hud_panels_from(i, NULL)
 REGISTER_REGISTRY(hud_panels)
 
+REGISTRY_DEFINE_GET(hud_panels, NULL)
+
 #define _REGISTER_HUD_PANEL(id, draw_func, export_func, configflags, showflags) \
        void draw_func(); \
        void export_func(int fh); \
index 61f0d4dcb59f94bf49ce37f3c63c0debd372a7e5..9b768e0258ddcfe566b60b456cca7c119f84b1bd 100644 (file)
@@ -62,7 +62,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                // common cvars for all panels
                for (int i = 0; i < REGISTRY_COUNT(hud_panels); ++i)
                {
-                       panel = hud_panels_from(i);
+                       panel = REGISTRY_GET(hud_panels, i);
 
                        HUD_Write_PanelCvar("_pos");
                        HUD_Write_PanelCvar("_size");
@@ -103,7 +103,7 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize)
        vector myTarget = myPos;
        int i;
        for (i = 0; i < REGISTRY_COUNT(hud_panels); ++i) {
-               panel = hud_panels_from(i);
+               panel = REGISTRY_GET(hud_panels, i);
                if(!(panel.panel_configflags & PANEL_CONFIG_MAIN)) continue;
                if(panel == highlightedPanel) continue;
                HUD_Panel_UpdatePosSize();
@@ -200,7 +200,7 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
        float ratio = mySize.x/mySize.y;
        int i;
        for (i = 0; i < REGISTRY_COUNT(hud_panels); ++i) {
-               panel = hud_panels_from(i);
+               panel = REGISTRY_GET(hud_panels, i);
                if(!(panel.panel_configflags & PANEL_CONFIG_MAIN)) continue;
                if(panel == highlightedPanel) continue;
                HUD_Panel_UpdatePosSize();
@@ -647,7 +647,7 @@ LABEL(find_tab_panel)
                {
                        for(i = 0; i < REGISTRY_COUNT(hud_panels); ++i)
                        {
-                               panel = hud_panels_from(i);
+                               panel = REGISTRY_GET(hud_panels, i);
                                if(!(panel.panel_configflags & PANEL_CONFIG_MAIN))
                                        continue;
                                if (panel == tab_panels[i] || panel == starting_panel)
@@ -799,7 +799,7 @@ int HUD_Panel_Check_Mouse_Pos(bool allow_move)
                i = panel_order[j];
                j += 1;
 
-               panel = hud_panels_from(i);
+               panel = REGISTRY_GET(hud_panels, i);
                if(!(panel.panel_configflags & PANEL_CONFIG_MAIN)) continue;
                HUD_Panel_UpdatePosSize();
 
@@ -879,7 +879,7 @@ void HUD_Panel_Highlight(float allow_move)
                i = panel_order[j];
                j += 1;
 
-               panel = hud_panels_from(i);
+               panel = REGISTRY_GET(hud_panels, i);
                if(!(panel.panel_configflags & PANEL_CONFIG_MAIN))
                        continue;
                HUD_Panel_UpdatePosSize();
@@ -889,7 +889,7 @@ void HUD_Panel_Highlight(float allow_move)
                // move
                if(allow_move && mousepos.x > panel_pos.x && mousepos.y > panel_pos.y && mousepos.x < panel_pos.x + panel_size.x && mousepos.y < panel_pos.y + panel_size.y)
                {
-                       highlightedPanel = hud_panels_from(i);
+                       highlightedPanel = REGISTRY_GET(hud_panels, i);
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 1;
                        panel_click_distance = mousepos - panel_pos;
@@ -898,7 +898,7 @@ void HUD_Panel_Highlight(float allow_move)
                // resize from topleft border
                else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
                {
-                       highlightedPanel = hud_panels_from(i);
+                       highlightedPanel = REGISTRY_GET(hud_panels, i);
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 1;
@@ -909,7 +909,7 @@ void HUD_Panel_Highlight(float allow_move)
                // resize from topright border
                else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y - border && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + 0.5 * panel_size.y)
                {
-                       highlightedPanel = hud_panels_from(i);
+                       highlightedPanel = REGISTRY_GET(hud_panels, i);
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 2;
@@ -921,7 +921,7 @@ void HUD_Panel_Highlight(float allow_move)
                // resize from bottomleft border
                else if(mousepos.x >= panel_pos.x - border && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + 0.5 * panel_size.x && mousepos.y <= panel_pos.y + panel_size.y + border)
                {
-                       highlightedPanel = hud_panels_from(i);
+                       highlightedPanel = REGISTRY_GET(hud_panels, i);
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 3;
@@ -933,7 +933,7 @@ void HUD_Panel_Highlight(float allow_move)
                // resize from bottomright border
                else if(mousepos.x >= panel_pos.x + 0.5 * panel_size.x && mousepos.y >= panel_pos.y + 0.5 * panel_size.y && mousepos.x <= panel_pos.x + panel_size.x + border && mousepos.y <= panel_pos.y + panel_size.y + border)
                {
-                       highlightedPanel = hud_panels_from(i);
+                       highlightedPanel = REGISTRY_GET(hud_panels, i);
                        HUD_Panel_FirstInDrawQ(i);
                        highlightedAction = 2;
                        resizeCorner = 4;
@@ -1083,7 +1083,7 @@ void HUD_Configure_Frame()
                {
                        hudShiftState = 0;
                        for(i = REGISTRY_COUNT(hud_panels) - 1; i >= 0; --i)
-                               hud_panels_from(panel_order[i]).update_time = time;
+                               REGISTRY_GET(hud_panels, panel_order[i]).update_time = time;
                }
 
                // NOTE this check is necessary because _menu_alpha isn't updated the frame the menu gets enabled
index bfb23bf2c7e6bf2183bf092d09b55964958226f1..0dfb11db766bf0865ab7fd999e9b9d4cbd2e4ba5 100644 (file)
@@ -126,7 +126,7 @@ void HUD_Notify()
                {
                        attacker = sprintf(_("Player %d"), count + 1);
                        victim = sprintf(_("Player %d"), count + 2);
-                       icon = Weapons_from(min(WEP_FIRST + count * 2, WEP_LAST)).model2;
+                       icon = REGISTRY_GET(Weapons, min(WEP_FIRST + count * 2, WEP_LAST)).model2;
                        alpha = bound(0, 1.2 - count / entry_count, 1);
                }
                else
index b75b36d33fbd632bda6c81609e76bd2b2fb1cbfe..e31aa01e91724a4efbf271d15737c5cbeb13111e 100644 (file)
@@ -368,7 +368,7 @@ void HUD_Radar()
                                drawpic(coord - '8 8 0', "gfx/teamradar_icon_glow", '16 16 0', brightcolor, panel_fg_alpha, 0);
                        }
                }
-               entity icon = RadarIcons_from(it.teamradar_icon);
+               entity icon = REGISTRY_GET(RadarIcons, it.teamradar_icon);
                draw_teamradar_icon(it.origin, icon, it, spritelookupcolor(it, icon.netname, it.teamradar_color), panel_fg_alpha);
        });
        AL_EACH(_entcs, e, it != NULL, {
index d6a073a5de91d4798917c424c2f37cc8b3fd70eb..e51adebd02c8a2ecf08f95979f94d272775d1034 100644 (file)
@@ -1228,7 +1228,7 @@ NET_HANDLE(TE_CSQC_PINGPLREPORT, bool isNew)
 NET_HANDLE(TE_CSQC_WEAPONCOMPLAIN, bool isNew)
 {
        int weapon_id = ReadByte();
-       complain_weapon = Weapons_from(weapon_id);
+       complain_weapon = REGISTRY_GET(Weapons, weapon_id);
        complain_weapon_type = ReadByte();
        return = true;
 
index c5de3aeeacf7d0a41dc5257de08dd790cfe48d87..3fccbb3bb3d30473a24a6eb6c27881ece04f0826 100644 (file)
@@ -787,7 +787,7 @@ void View_EventChase(entity this)
                {
                        if(hud != HUD_BUMBLEBEE_GUN)
                        {
-                               Vehicle info = Vehicles_from(hud);
+                               Vehicle info = REGISTRY_GET(Vehicles, hud);
                                vehicle_viewdist = info.height;
                                vehicle_viewofs = info.view_ofs;
                                if(vehicle_viewdist < 0) // when set below 0, this vehicle doesn't use third person view (gunner slots)
@@ -898,7 +898,7 @@ void HUD_Crosshair_Vehicle(entity this)
 {
        if(hud != HUD_BUMBLEBEE_GUN)
        {
-               Vehicle info = Vehicles_from(hud);
+               Vehicle info = REGISTRY_GET(Vehicles, hud);
                info.vr_crosshair(info, this);
        }
 }
@@ -1552,7 +1552,7 @@ void SpecialCommand()
                        vector splash_size = '0 0 0';
                        splash_size.x = max(vid_conwidth, vid_conheight) * SPECIALCOMMAND_SIZE;
                        splash_size.y = max(vid_conwidth, vid_conheight) * SPECIALCOMMAND_SIZE;
-                       entity wep = Weapons_from(slot.z);
+                       entity wep = REGISTRY_GET(Weapons, slot.z);
                        if(wep == WEP_Null)
                                drawpic(vec2(slot), "gfx/smile", vec2(splash_size), specialcommand_colors[j], 0.95, DRAWFLAG_NORMAL);
                        else
index 067c0badb7da09a184c192daf1841d47c782da81..fcdac111e401aedbbd01c54a14a82bf294179385 100644 (file)
@@ -48,7 +48,8 @@ void Projectile_DrawTrail(entity this, vector to)
        if (this.traileffect)
        {
                particles_alphamin = particles_alphamax = particles_fade = sqrt(this.alpha);
-               boxparticles(particleeffectnum(Effects_from(this.traileffect)), this, from, to, this.velocity, this.velocity, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE | PARTICLES_DRAWASTRAIL);
+               entity eff = REGISTRY_GET(Effects, this.traileffect);
+               boxparticles(particleeffectnum(eff), this, from, to, this.velocity, this.velocity, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE | PARTICLES_DRAWASTRAIL);
        }
 }
 
index 16feb948c35d5c2264b9bdc21329c531c47ae2d9..bfbba7cb80b5ebb7a32988175e40878390deb773 100644 (file)
@@ -24,7 +24,8 @@ ENDCLASS(Animation)
 
 REGISTRY(Animations, BITS(8))
 REGISTER_REGISTRY(Animations)
-#define Animations_from(id) _Animations_from(id, NULL)
+
+REGISTRY_DEFINE_GET(Animations, NULL)
 #define WriteAnimation(to, it) WriteRegistered(Animations, to, it)
 #define ReadAnimation() ReadRegistered(Animations)
 #define REGISTER_ANIMATION(id, framenames) \
index a6f669fd91e04c461a2710837ae760e070c9523a..abb40b509de08165e613a1eae1f7c6b32c7ef06d 100644 (file)
@@ -2,10 +2,11 @@
 
 #include "command.qh"
 REGISTRY(GENERIC_COMMANDS, BITS(7))
-#define GENERIC_COMMANDS_from(i) _GENERIC_COMMANDS_from(i, NULL)
 REGISTER_REGISTRY(GENERIC_COMMANDS)
 REGISTRY_SORT(GENERIC_COMMANDS)
 
+REGISTRY_DEFINE_GET(GENERIC_COMMANDS, NULL)
+
 .bool m_menubased; // switch to tell whether this alias should be registered as a menu or client based command
 
 #define GENERIC_COMMAND(id, description, menubased) \
index 823a20f8e0467a5e97d1986c16de124389f1090f..6bc2995b232b2cc57a051c41b16b83957107b5ad 100644 (file)
@@ -3,7 +3,7 @@
 string Deathtype_Name(int deathtype)
 {
        if (DEATH_ISSPECIAL(deathtype)) {
-               entity deathent = Deathtypes_from(deathtype - DT_FIRST);
+               entity deathent = REGISTRY_GET(Deathtypes, deathtype - DT_FIRST);
                if (!deathent) { backtrace("Deathtype_Name: Could not find deathtype entity!\n"); return ""; }
                return deathent.nent_name;
        }
index 2169c8bd762bd3abe5e708e1f24e1b8b99333740..f4b49801872c8be06fff89cd4a04e08dca055312 100644 (file)
@@ -3,10 +3,11 @@
 #include <common/notifications/all.qh>
 
 REGISTRY(Deathtypes, BITS(8))
-#define Deathtypes_from(i) _Deathtypes_from(i, NULL)
 REGISTER_REGISTRY(Deathtypes)
 REGISTRY_CHECK(Deathtypes)
 
+REGISTRY_DEFINE_GET(Deathtypes, NULL)
+
 .entity death_msgself;
 .entity death_msgmurder;
 .string death_msgextra;
@@ -32,12 +33,12 @@ const int DEATH_HITTYPEMASK = HITTYPE_SECONDARY | HITTYPE_SPLASH | HITTYPE_BOUNC
 const int DT_FIRST = BIT(13);
 
 #define DEATH_ISSPECIAL(t)      (t >= DT_FIRST)
-#define DEATH_IS(t, dt)         (DEATH_ISSPECIAL(t) && (Deathtypes_from(t - DT_FIRST)) == dt)
-#define DEATH_ENT(t)            (DEATH_ISSPECIAL(t) ?  (Deathtypes_from(t - DT_FIRST)) : NULL)
-#define DEATH_ISVEHICLE(t)      (DEATH_ISSPECIAL(t) && (Deathtypes_from(t - DT_FIRST)).death_msgextra == "vehicle")
-#define DEATH_ISTURRET(t)       (DEATH_ISSPECIAL(t) && (Deathtypes_from(t - DT_FIRST)).death_msgextra == "turret")
-#define DEATH_ISMONSTER(t)      (DEATH_ISSPECIAL(t) && (Deathtypes_from(t - DT_FIRST)).death_msgextra == "monster")
-#define DEATH_WEAPONOF(t)       (DEATH_ISSPECIAL(t) ? WEP_Null : Weapons_from((t) & DEATH_WEAPONMASK))
+#define DEATH_IS(t, dt)         (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)) == dt)
+#define DEATH_ENT(t)            (DEATH_ISSPECIAL(t) ?  (REGISTRY_GET(Deathtypes, t - DT_FIRST)) : NULL)
+#define DEATH_ISVEHICLE(t)      (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)).death_msgextra == "vehicle")
+#define DEATH_ISTURRET(t)       (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)).death_msgextra == "turret")
+#define DEATH_ISMONSTER(t)      (DEATH_ISSPECIAL(t) && (REGISTRY_GET(Deathtypes, t - DT_FIRST)).death_msgextra == "monster")
+#define DEATH_WEAPONOF(t)       (DEATH_ISSPECIAL(t) ? WEP_Null : REGISTRY_GET(Weapons, (t) & DEATH_WEAPONMASK))
 #define DEATH_ISWEAPON(t, w)    (DEATH_WEAPONOF(t) == (w))
 
 string Deathtype_Name(int deathtype);
index 99849deb99d4787b673e2941476dc0facc0ea77a..9ee58f5fe1c07323097ca2c08ff2f9df091bf34f 100644 (file)
@@ -6,7 +6,7 @@ NET_HANDLE(net_effect, bool isNew)
 {
        int net_name = (REGISTRY_COUNT(Effects) >= 255) ? ReadShort() : ReadByte();
 
-       entity eff = Effects_from(net_name);
+       entity eff = REGISTRY_GET(Effects, net_name);
 
        vector vel = '0 0 0';
        int eff_cnt = 1;
index 7581618375bd5bfc0b949b0b023435db4bebdd8e..fe7bbc31a595596debb3be13632472e11d7cf905 100644 (file)
@@ -8,11 +8,11 @@ void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt);
 #endif
 
 REGISTRY(Effects, BITS(8))
-#define Effects_from(i) _Effects_from(i, EFFECT_Null)
 REGISTER_REGISTRY(Effects)
 REGISTRY_CHECK(Effects)
 #define EFFECT(istrail, name, realname) \
     REGISTER(Effects, EFFECT, name, m_id, Create_Effect_Entity(realname, istrail));
 
 EFFECT(0, Null, string_null)
+REGISTRY_DEFINE_GET(Effects, EFFECT_Null)
 #include "all.inc"
index 79d31eb46bc5efdb473e4322a02b985101511401..6b97dd91b55fa94abeb488e48fd5a6cdc45eb9f2 100644 (file)
@@ -322,8 +322,9 @@ GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt", fa
 
 
 REGISTRY(EffectInfos, BITS(9))
-#define EffectInfos_from(i) _EffectInfos_from(i, NULL)
 REGISTER_REGISTRY(EffectInfos)
+
+REGISTRY_DEFINE_GET(EffectInfos, NULL)
 #define EFFECTINFO(name) \
     ACCUMULATE void effectinfo_##name(EffectInfoGroup parent, EffectInfo this) { } \
     REGISTER(EffectInfos, EFFECTINFO, name, m_id, NEW(EffectInfoGroup)) { \
index d07557f9ac011be83a17d6cd2aacaa74bce1a1bb..68eccb461227c1e7797adab66a7985b320ee1c31 100644 (file)
@@ -81,13 +81,13 @@ SOUND(BRASS1, W_Sound("brass1"));
 SOUND(BRASS2, W_Sound("brass2"));
 SOUND(BRASS3, W_Sound("brass3"));
 Sound SND_BRASS_RANDOM() {
-    return Sounds_from(SND_BRASS1.m_id + floor(prandom() * 3));
+    return REGISTRY_GET(Sounds, SND_BRASS1.m_id + floor(prandom() * 3));
 }
 SOUND(CASINGS1, W_Sound("casings1"));
 SOUND(CASINGS2, W_Sound("casings2"));
 SOUND(CASINGS3, W_Sound("casings3"));
 Sound SND_CASINGS_RANDOM() {
-    return Sounds_from(SND_CASINGS1.m_id + floor(prandom() * 3));
+    return REGISTRY_GET(Sounds, SND_CASINGS1.m_id + floor(prandom() * 3));
 }
 
 void Casing_Touch(entity this, entity toucher)
index 9fc46ff67537b6cbf42d9a33e03e467feda2772b..4e8467e8a45746bb0c2fd364358a404843f566d5 100644 (file)
@@ -85,7 +85,7 @@
 
                NET_HANDLE(globalsound, bool isnew)
                {
-                       entity gs = GlobalSounds_from(ReadByte());
+                       entity gs = REGISTRY_GET(GlobalSounds, ReadByte());
                        float r = ReadByte() / 255;
                        string sample = GlobalSound_sample(gs.m_globalsoundstr, r);
                        int who = ReadByte();
 
                NET_HANDLE(playersound, bool isnew)
                {
-                       entity ps = PlayerSounds_from(ReadByte());
+                       entity ps = REGISTRY_GET(PlayerSounds, ReadByte());
                        float r = ReadByte() / 255;
                        int who = ReadByte();
                        entity e = entcs_receiver(who - 1);
index b5631ed5fd246774277adb823dae760d31700b9d..2b6b52896f88fd3ec4d935c74dc20f8efaca256a 100644 (file)
@@ -11,7 +11,6 @@
 ..string m_playersoundfld;
 
 REGISTRY(PlayerSounds, BITS(8) - 1)
-#define PlayerSounds_from(i) _PlayerSounds_from(i, NULL)
 #define REGISTER_PLAYERSOUND(id) \
        .string _playersound_##id; \
        REGISTER(PlayerSounds, playersound, id, m_id, new_pure(PlayerSound)) \
@@ -21,6 +20,8 @@ REGISTRY(PlayerSounds, BITS(8) - 1)
        }
 REGISTER_REGISTRY(PlayerSounds)
 REGISTRY_SORT(PlayerSounds)
+
+REGISTRY_DEFINE_GET(PlayerSounds, NULL)
 STATIC_INIT(PlayerSounds_renumber)
 {
        FOREACH(PlayerSounds, true, it.m_id = i);
@@ -84,7 +85,6 @@ REGISTER_VOICEMSG(seenenemy, VOICETYPE_TEAMRADIO, false)
 
 .string m_globalsoundstr;
 REGISTRY(GlobalSounds, BITS(8) - 1)
-#define GlobalSounds_from(i) _GlobalSounds_from(i, NULL)
 #define REGISTER_GLOBALSOUND(id, str) \
        REGISTER(GlobalSounds, GS, id, m_id, new_pure(GlobalSound)) \
        { \
@@ -92,6 +92,8 @@ REGISTRY(GlobalSounds, BITS(8) - 1)
        }
 REGISTER_REGISTRY(GlobalSounds)
 REGISTRY_SORT(GlobalSounds)
+
+REGISTRY_DEFINE_GET(GlobalSounds, NULL)
 STATIC_INIT(GlobalSounds_renumber)
 {
        FOREACH(GlobalSounds, true, it.m_id = i);
index 2675d3201867c3397c4ecdba7db65cc7d3f23553..a7aa27961139530a73a9a7feda0d4ae1fe8d54f4 100644 (file)
@@ -6,10 +6,11 @@
 #endif
 
 REGISTRY(EntCSProps, BITS(16) - 1)
-#define EntCSProps_from(i) _EntCSProps_from(i, NULL)
 REGISTER_REGISTRY(EntCSProps)
 REGISTRY_SORT(EntCSProps)
 REGISTRY_CHECK(EntCSProps)
+
+REGISTRY_DEFINE_GET(EntCSProps, NULL)
 STATIC_INIT(EntCSProps_renumber) { FOREACH(EntCSProps, true, it.m_id = i); }
 
 // these entcs_props ids need to be referenced directly
index e5a2b7b6019a6bb7309908b51989426b208bdca7..d870e6d2c232cf7825a94f46711831e96afc4320 100644 (file)
@@ -3,6 +3,8 @@
 REGISTRY(IMPULSES, 255)
 REGISTER_REGISTRY(IMPULSES)
 REGISTRY_SORT(IMPULSES)
+
+REGISTRY_DEFINE_GET(IMPULSES, NULL)
 STATIC_INIT(IMPULSES_renumber)
 {
        FOREACH(IMPULSES, true, it.m_id = i);
index 3ae473503db46e24d8f8877a2fb05cd998142082..840eb0a88b05c33f98e9ed2954cc6d7d74058123 100644 (file)
@@ -6,7 +6,6 @@
 
 // 24 so it matches the limit for the .items field
 REGISTRY(Items, 24)
-#define Items_from(i) _Items_from(i, NULL)
 #ifdef GAMEQC
 REGISTRY_DEPENDS(Items, Models)
 #endif
@@ -15,6 +14,8 @@ REGISTER_REGISTRY(Items)
 
 REGISTRY_SORT(Items)
 REGISTRY_CHECK(Items)
+
+REGISTRY_DEFINE_GET(Items, NULL)
 STATIC_INIT(Items) { FOREACH(Items, true, it.m_id = i); }
 
 void Dump_Items();
index 29a02047f22938a2345b59998f24d626875a8d09..1c9d21669d2b8d9502d1e5f69d6a8c91fb549ecd 100644 (file)
@@ -38,7 +38,7 @@ NET_HANDLE(ENT_CLIENT_INVENTORY, bool isnew)
             if (!(minorBits & BIT(j))) {
                 continue;
             }
-            const GameItem it = Items_from(Inventory_groups_minor * i + j);
+            const GameItem it = REGISTRY_GET(Items, Inventory_groups_minor * i + j);
             .int fld = inv_items[it.m_id];
             int prev = this.(fld);
             int next = this.(fld) = ReadByte();
@@ -86,7 +86,7 @@ void Inventory_Write(Inventory data)
                        if (!(minorBits & BIT(j)))
                                continue;
 
-                       const entity it = Items_from(Inventory_groups_minor * i + j);
+                       const entity it = REGISTRY_GET(Items, Inventory_groups_minor * i + j);
                        WriteByte(MSG_ENTITY, data.inv_items[it.m_id]);
                }
        }
index f771b0f83cfea0d7c2a9545c96ea28f04af00d10..ae387e3db9a576df164c92765a250bd1d9681923 100644 (file)
@@ -1147,7 +1147,7 @@ int MapInfo_CurrentFeatures()
 
 Gametype MapInfo_CurrentGametype()
 {
-       Gametype prev = Gametypes_from(cvar("gamecfg"));
+       Gametype prev = REGISTRY_GET(Gametypes, cvar("gamecfg"));
        FOREACH(Gametypes, cvar(it.netname) && it != prev, return it);
        return prev ? prev : MAPINFO_TYPE_DEATHMATCH;
 }
index b669ba1f7b63aa2a8c74ab7bc7e1f91caaed1de3..4d598e88caa2346378b9295fdd7dc36c7ec59dbc 100644 (file)
@@ -101,9 +101,10 @@ CLASS(Gametype, Object)
 ENDCLASS(Gametype)
 
 REGISTRY(Gametypes, 24)
-#define Gametypes_from(i) _Gametypes_from(i, NULL)
 REGISTER_REGISTRY(Gametypes)
 REGISTRY_CHECK(Gametypes)
+
+REGISTRY_DEFINE_GET(Gametypes, NULL)
 #define REGISTER_GAMETYPE(NAME, inst) REGISTER(Gametypes, MAPINFO_TYPE, NAME, m_id, inst)
 
 #define IS_GAMETYPE(NAME) (MapInfo_LoadedGametype == MAPINFO_TYPE_##NAME)
index 415984a2a8a914b17822a98a69a861d927315c2d..5b4b8a3bd3300f37b976bce5a4102d9dfab485bb 100644 (file)
@@ -101,9 +101,10 @@ void minigame_prompt();
 
 
 REGISTRY(Minigames, BITS(4))
-#define Minigames_from(i) _Minigames_from(i, NULL)
 REGISTER_REGISTRY(Minigames)
 REGISTRY_CHECK(Minigames)
+
+REGISTRY_DEFINE_GET(Minigames, NULL)
 #define REGISTER_MINIGAME(name,nicename) \
     REGISTER(Minigames, MINIGAME_##name, m_id, new_pure(minigame_descriptor)); \
     void name##_hud_board(vector, vector); \
index b5015a1f40fd3e452d83ce2d23ed5a510ce63c4c..28a524d0463a5f59ebcd53fdd7004a6910dd09a8 100644 (file)
@@ -46,9 +46,10 @@ entity minigame_sessions;
 bool minigame_SendEntity(entity this, entity to, int sf);
 
 REGISTRY(Minigames, BITS(4))
-#define Minigames_from(i) _Minigames_from(i, NULL)
 REGISTER_REGISTRY(Minigames)
 REGISTRY_CHECK(Minigames)
+
+REGISTRY_DEFINE_GET(Minigames, NULL)
 #define REGISTER_MINIGAME(name,nicename) \
     REGISTER(Minigames, MINIGAME_##name, m_id, new_pure(minigame_descriptor)); \
     int name##_server_event(entity, string, ...); \
index eb95d7c28260d2a81ad306a1a37b00c97b4802ca..fe5c7b93d47ac40803901a18c847c4fa45b3e389 100644 (file)
@@ -147,7 +147,7 @@ MODEL(GIB_ROBO_7,                       "models/gibs/robo7.md3");
 MODEL(GIB_ROBO_8,                       "models/gibs/robo8.md3");
 Model MDL_GIB_ROBO_RANDOM() {
     int i = floor(random() * 8);
-    return Models_from(MDL_GIB_ROBO_1.m_id + i);
+    return REGISTRY_GET(Models, MDL_GIB_ROBO_1.m_id + i);
 }
 
 MODEL(CASING_SHELL,                     "models/casing_shell.mdl");
@@ -350,7 +350,7 @@ MODEL(9,                                "models/sprites/9.spr32");
 MODEL(10,                               "models/sprites/10.spr32");
 Model MDL_NUM(int i) {
     if ((i >= 0 && i <= 10))
-        return Models_from(MDL_0.m_id + i);
+        return REGISTRY_GET(Models, MDL_0.m_id + i);
     return MDL_Null;
 }
 
index ce98629411fd0cd6c3ce798a813acf5dd0fd602f..c4f865ddb9f056c1b35008d1eb814adeaab988d9 100644 (file)
@@ -3,7 +3,6 @@
 #include "model.qh"
 
 REGISTRY(Models, BITS(9))
-#define Models_from(i) _Models_from(i, MDL_Null)
 REGISTER_REGISTRY(Models)
 
 #define MODEL(name, path) \
@@ -20,4 +19,5 @@ PRECACHE(Models) {
 }
 
 MODEL(Null, "null");
+REGISTRY_DEFINE_GET(Models, MDL_Null)
 #include "all.inc"
index e31fd0bad47aed4fb8725d63c5d316324f2f63be..58840159ef60c60a386dbc5a817b3ad52ae93bc8 100644 (file)
@@ -3,8 +3,7 @@
 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)
+#define get_monsterinfo(i) REGISTRY_GET(Monsters, i)
 REGISTER_REGISTRY(Monsters)
 REGISTRY_CHECK(Monsters)
 const int MON_FIRST = 1;
@@ -14,3 +13,4 @@ const int MON_FIRST = 1;
 #include "monster.qh"
 
 REGISTER_MONSTER(Null, NEW(Monster));
+REGISTRY_DEFINE_GET(Monsters, MON_Null)
index 4f2139cc170a56c78d49548f47b360e8ca8e78b3..d85b16b0e7988d92d694e6e7911bc4f489913d4b 100644 (file)
@@ -78,7 +78,7 @@ bool Monster_ValidTarget(entity this, entity targ)
 
        if((targ == this)
        || (autocvar_g_monsters_lineofsight && !checkpvs(this.origin + this.view_ofs, targ)) // enemy cannot be seen
-       || (IS_VEHICLE(targ) && !((Monsters_from(this.monsterid)).spawnflags & MON_FLAG_RANGED)) // melee vs vehicle is useless
+       || (IS_VEHICLE(targ) && !((REGISTRY_GET(Monsters, this.monsterid)).spawnflags & MON_FLAG_RANGED)) // melee vs vehicle is useless
        || (time < game_starttime) // monsters do nothing before match has started
        || (targ.takedamage == DAMAGE_NO)
        || (game_stopped)
@@ -260,7 +260,7 @@ void Monster_Sound_Precache(string f)
 
 void Monster_Sounds_Precache(entity this)
 {
-       string m = (Monsters_from(this.monsterid)).m_model.model_str();
+       string m = (REGISTRY_GET(Monsters, this.monsterid)).m_model.model_str();
        float globhandle, n, i;
        string f;
 
@@ -465,7 +465,7 @@ void Monster_UpdateModel(entity this)
        this.anim_die2   = animfixfps(this, '9 1 0.01', '0 0 0');*/
 
        // then get the real values
-       Monster mon = Monsters_from(this.monsterid);
+       Monster mon = REGISTRY_GET(Monsters, this.monsterid);
        mon.mr_anim(mon, this);
 }
 
@@ -977,7 +977,7 @@ void Monster_Dead(entity this, entity attacker, float gibbed)
 
        CSQCModel_UnlinkEntity(this);
 
-       Monster mon = Monsters_from(this.monsterid);
+       Monster mon = REGISTRY_GET(Monsters, this.monsterid);
        mon.mr_death(mon, this);
 
        if(this.candrop && this.weapon)
@@ -1008,7 +1008,7 @@ void Monster_Damage(entity this, entity inflictor, entity attacker, float damage
        float take = v.x;
        //float save = v.y;
 
-       Monster mon = Monsters_from(this.monsterid);
+       Monster mon = REGISTRY_GET(Monsters, this.monsterid);
        take = mon.mr_pain(mon, this, take, attacker, deathtype);
 
        if(take)
@@ -1235,7 +1235,7 @@ void Monster_Think(entity this)
                this.last_enemycheck = time + 1; // check for enemies every second
        }
 
-       Monster mon = Monsters_from(this.monsterid);
+       Monster mon = REGISTRY_GET(Monsters, this.monsterid);
        if(mon.mr_think(mon, this))
        {
                Monster_Move(this, this.speed2, this.speed, this.stopspeed);
@@ -1251,7 +1251,7 @@ void Monster_Think(entity this)
 
 bool Monster_Spawn_Setup(entity this)
 {
-       Monster mon = Monsters_from(this.monsterid);
+       Monster mon = REGISTRY_GET(Monsters, this.monsterid);
        mon.mr_setup(mon, this);
 
        // ensure some basic needs are met
@@ -1317,7 +1317,7 @@ bool Monster_Spawn_Setup(entity this)
 bool Monster_Spawn(entity this, bool check_appear, int mon_id)
 {
        // setup the basic required properties for a monster
-       entity mon = Monsters_from(mon_id);
+       entity mon = REGISTRY_GET(Monsters, mon_id);
        if(!mon.monsterid) { return false; } // invalid monster
 
        if(!autocvar_g_monsters) { Monster_Remove(this); return false; }
index cc4cc0129593044474468adff6b9434636fcdcf9..2b4d3e34cbe23f61c1bd84ed587dbe705b07edfe 100644 (file)
@@ -165,7 +165,8 @@ CLASS(Mutator, Object)
 ENDCLASS(Mutator)
 
 REGISTRY(Mutators, BITS(7))
-#define Mutators_from(i) _Mutators_from(i, NULL)
+
+REGISTRY_DEFINE_GET(Mutators, NULL)
 bool Mutator_Add(Mutator mut);
 void Mutator_Remove(Mutator mut);
 bool mutator_log = false;
index 4a5dcc82aaa1ded918115799619f366f321b3d87..2ab07ddf28fd1785297497b87122ad43e613537a 100644 (file)
@@ -2,7 +2,7 @@
 
 string BUFF_NAME(int i)
 {
-    Buff b = Buffs_from(i);
+    Buff b = REGISTRY_GET(Buffs, i);
     return strcat(rgb_to_hexcolor(b.m_color), b.m_name);
 }
 
index b381db4be19a6f0d9c8338f4f406d7f2f3a6e868..91f56066f61b0f7a9eed9532cdff15c9ffb295a5 100644 (file)
@@ -13,7 +13,6 @@ REGISTER_RADARICON(Buff, 1);
 #endif
 
 REGISTRY(Buffs, BITS(5))
-#define Buffs_from(i) _Buffs_from(i, BUFF_Null)
 REGISTER_REGISTRY(Buffs)
 REGISTRY_CHECK(Buffs)
 
@@ -72,4 +71,5 @@ entity buff_FirstFromFlags(int _buffs);
 REGISTER_BUFF(Null);
 BUFF_SPAWNFUNCS(random, BUFF_Null)
 
+REGISTRY_DEFINE_GET(Buffs, BUFF_Null)
 #include "all.inc"
index 349ca20b872c17f468117dccecaa1152128778ca..f33e3ff63a93fe1a1bbea3dfb5936f3a09f108d6 100644 (file)
@@ -15,7 +15,7 @@ MUTATOR_HOOKFUNCTION(cl_buffs, WP_Format)
     string s = M_ARGV(1, string);
     if (s == WP_Buff.netname || s == RADARICON_Buff.netname)
     {
-        Buff b = Buffs_from(this.wp_extra);
+        Buff b = REGISTRY_GET(Buffs, this.wp_extra);
         M_ARGV(2, vector) = b.m_color;
         M_ARGV(3, string) = b.m_name;
         M_ARGV(4, string) = strcat("buff_", b.netname);
index 9ac33b45bb328a612a395fb74f5a206fd62a7644..7dffc0f4d0fc9a8d4b6122f00709feb82d2ad127 100644 (file)
@@ -125,7 +125,7 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan
        float bonusNades    = STAT(NADE_BONUS);
        float bonusProgress = STAT(NADE_BONUS_SCORE);
        float bonusType     = STAT(NADE_BONUS_TYPE);
-       Nade def = Nades_from(bonusType);
+       Nade def = REGISTRY_GET(Nades, bonusType);
        vector nadeColor    = def.m_color;
        string nadeIcon     = def.m_icon;
 
@@ -181,7 +181,7 @@ void nade_timer_think(entity this)
 
 void nade_burn_spawn(entity _nade)
 {
-       CSQCProjectile(_nade, true, Nades_from(STAT(NADE_BONUS_TYPE, _nade)).m_projectile[true], true);
+       CSQCProjectile(_nade, true, REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, _nade)).m_projectile[true], true);
 }
 
 void nade_spawn(entity _nade)
@@ -199,7 +199,7 @@ void nade_spawn(entity _nade)
 
        _nade.effects |= EF_LOWPRECISION;
 
-       CSQCProjectile(_nade, true, Nades_from(STAT(NADE_BONUS_TYPE, _nade)).m_projectile[false], true);
+       CSQCProjectile(_nade, true, REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, _nade)).m_projectile[false], true);
 }
 
 void napalm_damage(entity this, float dist, float damage, float edgedamage, float burntime)
@@ -714,7 +714,7 @@ void nade_boom(entity this)
        entity expef = NULL;
        bool nade_blast = true;
 
-       switch ( Nades_from(STAT(NADE_BONUS_TYPE, this)) )
+       switch ( REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, this)) )
        {
                case NADE_TYPE_NAPALM:
                        nade_blast = autocvar_g_nades_napalm_blast;
@@ -776,7 +776,7 @@ void nade_boom(entity this)
        }
 
        if(this.takedamage)
-       switch ( Nades_from(STAT(NADE_BONUS_TYPE, this)) )
+       switch ( REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, this)) )
        {
                case NADE_TYPE_NAPALM: nade_napalm_boom(this); break;
                case NADE_TYPE_ICE: nade_ice_boom(this); break;
@@ -1074,7 +1074,10 @@ bool nade_customize(entity this, entity client)
        {
                //this.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
                if(!this.traileffectnum)
-                       this.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(STAT(NADE_BONUS_TYPE, this)).m_projectile[false], this.team).eent_eff_name);
+               {
+                       entity nade = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, this));
+                       this.traileffectnum = _particleeffectnum(Nade_TrailEffect(nade.m_projectile[false], this.team).eent_eff_name);
+               }
                this.alpha = 1;
        }
 
@@ -1088,7 +1091,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        STAT(NADE_BONUS_TYPE, n) = max(1, ntype);
        n.pokenade_type = pntype;
 
-       if(Nades_from(STAT(NADE_BONUS_TYPE, n)) == NADE_TYPE_Null)
+       if(REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)) == NADE_TYPE_Null)
                STAT(NADE_BONUS_TYPE, n) = NADE_TYPE_NORMAL.m_id;
 
        .entity weaponentity = weaponentities[0]; // TODO: unhardcode
@@ -1097,8 +1100,8 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        //setattachment(n, player, "bip01 l hand");
        n.exteriormodeltoclient = player;
        setcefc(n, nade_customize);
-       n.traileffectnum = _particleeffectnum(Nade_TrailEffect(Nades_from(STAT(NADE_BONUS_TYPE, n)).m_projectile[false], player.team).eent_eff_name);
-       n.colormod = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_color;
+       n.traileffectnum = _particleeffectnum(Nade_TrailEffect(REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_projectile[false], player.team).eent_eff_name);
+       n.colormod = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_color;
        n.realowner = nowner;
        n.colormap = player.colormap;
        n.glowmod = player.glowmod;
@@ -1109,19 +1112,19 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        n.projectiledeathtype = DEATH_NADE.m_id;
        n.weaponentity_fld = weaponentity;
        n.nade_lifetime = ntime;
-       n.alpha = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_alpha;
+       n.alpha = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_alpha;
 
        setmodel(fn, MDL_NADE_VIEW);
        //setattachment(fn, player.(weaponentity), "");
        fn.viewmodelforclient = player;
        fn.realowner = fn.owner = player;
-       fn.colormod = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_color;
+       fn.colormod = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_color;
        fn.colormap = player.colormap;
        fn.glowmod = player.glowmod;
        setthink(fn, SUB_Remove);
        fn.nextthink = n.wait;
        fn.weaponentity_fld = weaponentity;
-       fn.alpha = Nades_from(STAT(NADE_BONUS_TYPE, n)).m_alpha;
+       fn.alpha = REGISTRY_GET(Nades, STAT(NADE_BONUS_TYPE, n)).m_alpha;
 
        player.nade = n;
        player.fake_nade = fn;
index d76eb941450274fb626b8f1732ef4ecebf88e4f1..963dbce38d5d9253c36933f4632c18b272bc8c3b 100644 (file)
@@ -22,7 +22,6 @@ const int PROJECTILE_NADE_VEIL = 86;
 const int PROJECTILE_NADE_VEIL_BURN = 87;
 
 REGISTRY(Nades, BITS(4))
-#define Nades_from(i) _Nades_from(i, NADE_TYPE_Null)
 REGISTER_REGISTRY(Nades)
 REGISTRY_CHECK(Nades)
 
@@ -42,6 +41,7 @@ CLASS(Nade, Object)
 ENDCLASS(Nade)
 
 REGISTER_NADE(Null);
+REGISTRY_DEFINE_GET(Nades, NADE_TYPE_Null)
 
 Nade Nade_FromProjectile(int proj)
 {
index 7214a699e1122e759026f2b5995ee4a99305a943..b399d3c62f68893cc2822eb09ac23bf3a891a1aa 100644 (file)
@@ -80,7 +80,7 @@ REGISTER_MUTATOR(nix, expr_evaluate(cvar_string("g_nix")) && !MUTATOR_IS_ENABLED
 
 bool NIX_CanChooseWeapon(int wpn)
 {
-       entity e = Weapons_from(wpn);
+       entity e = REGISTRY_GET(Weapons, wpn);
        if (e == WEP_Null) return false; // skip dummies
        if(g_weaponarena)
        {
@@ -125,12 +125,12 @@ void NIX_GiveCurrentWeapon(entity this)
                        nix_nextchange = time; // start the first round now!
                else
                        nix_nextchange = time + autocvar_g_balance_nix_roundtime;
-               // Weapon w = Weapons_from(nix_weapon);
+               // Weapon w = REGISTRY_GET(Weapons, nix_weapon);
                // w.wr_init(w); // forget it, too slow
        }
 
        // get weapon info
-       entity wpn = Weapons_from(nix_weapon);
+       entity wpn = REGISTRY_GET(Weapons, nix_weapon);
 
        if(nix_nextchange != this.nix_lastchange_id) // this shall only be called once per round!
        {
index 13260023760f977ea1a70cea96c92928635eb10b..fa1cbd31a1548d45a15770902c71fe858ccaa805 100644 (file)
@@ -3,7 +3,6 @@
 #include "waypointsprites.qh"
 
 REGISTRY(Waypoints, BITS(7))
-#define Waypoints_from(i) _Waypoints_from(i, WP_Null)
 REGISTER_REGISTRY(Waypoints)
 REGISTRY_CHECK(Waypoints)
 
@@ -30,7 +29,6 @@ ENDCLASS(Waypoint)
 #define REGISTER_WAYPOINT(id, text, icon, color, blink) REGISTER_WAYPOINT_(id, NEW(Waypoint, #id, text, icon, color, blink))
 
 REGISTRY(RadarIcons, BITS(7))
-#define RadarIcons_from(i) _RadarIcons_from(i, RADARICON_NONE)
 REGISTER_REGISTRY(RadarIcons)
 REGISTRY_CHECK(RadarIcons)
 
@@ -38,8 +36,11 @@ REGISTRY_CHECK(RadarIcons)
 #define REGISTER_RADARICON(id, num) REGISTER(RadarIcons, RADARICON, id, m_id, new_pure(RadarIcon)) { this.m_radaricon = num; this.netname = #id; }
 
 REGISTER_WAYPOINT(Null, "", "", '0 0 0', 1);
+REGISTRY_DEFINE_GET(Waypoints, WP_Null)
 
 REGISTER_RADARICON(NONE,            0);
+REGISTRY_DEFINE_GET(RadarIcons, RADARICON_NONE)
+
 REGISTER_RADARICON(FLAG,            1);
 REGISTER_RADARICON(FLAGCARRIER,     1);
 
index 0b4fe28ff33bfde36cb81653d0cac7ac3c291ae5..786971645f2063a7498e2f08d90e00a5e27d1ebd 100644 (file)
@@ -213,10 +213,10 @@ void Ent_WaypointSprite(entity this, bool isnew)
 float spritelookupblinkvalue(entity this, string s)
 {
     if (s == WP_Weapon.netname) {
-        if (Weapons_from(this.wp_extra).spawnflags & WEP_FLAG_SUPERWEAPON)
+        if (REGISTRY_GET(Weapons, this.wp_extra).spawnflags & WEP_FLAG_SUPERWEAPON)
             return 2;
     }
-    if (s == WP_Item.netname) return Items_from(this.wp_extra).m_waypointblink;
+    if (s == WP_Item.netname) return REGISTRY_GET(Items, this.wp_extra).m_waypointblink;
     if(s == WP_FlagReturn.netname) return 2;
 
     return 1;
@@ -224,8 +224,8 @@ float spritelookupblinkvalue(entity this, string s)
 
 vector spritelookupcolor(entity this, string s, vector def)
 {
-    if (s == WP_Weapon.netname  || s == RADARICON_Weapon.netname) return Weapons_from(this.wp_extra).wpcolor;
-    if (s == WP_Item.netname    || s == RADARICON_Item.netname) return Items_from(this.wp_extra).m_color;
+    if (s == WP_Weapon.netname  || s == RADARICON_Weapon.netname) return REGISTRY_GET(Weapons, this.wp_extra).wpcolor;
+    if (s == WP_Item.netname    || s == RADARICON_Item.netname) return REGISTRY_GET(Items, this.wp_extra).m_color;
     if (MUTATOR_CALLHOOK(WP_Format, this, s))
     {
         return M_ARGV(2, vector);
@@ -238,8 +238,8 @@ string spritelookuptext(entity this, string s)
        if(autocvar_g_waypointsprite_spam && waypointsprite_count >= autocvar_g_waypointsprite_spam)
                return "Spam"; // no need to translate this debug string
     if (s == WP_RaceStartFinish.netname) return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start");
-    if (s == WP_Weapon.netname) return Weapons_from(this.wp_extra).m_name;
-    if (s == WP_Item.netname) return Items_from(this.wp_extra).m_waypoint;
+    if (s == WP_Weapon.netname) return REGISTRY_GET(Weapons, this.wp_extra).m_name;
+    if (s == WP_Item.netname) return REGISTRY_GET(Items, this.wp_extra).m_waypoint;
     if (s == WP_Monster.netname) return get_monsterinfo(this.wp_extra).monster_name;
     if (MUTATOR_CALLHOOK(WP_Format, this, s))
     {
@@ -257,9 +257,9 @@ string spritelookuptext(entity this, string s)
 string spritelookupicon(entity this, string s)
 {
     // TODO: needs icons! //if (s == WP_RaceStartFinish.netname) return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start");
-    if (s == WP_Weapon.netname) return Weapons_from(this.wp_extra).model2;
-    if (s == WP_Item.netname) return Items_from(this.wp_extra).m_icon;
-    if (s == WP_Vehicle.netname) return Vehicles_from(this.wp_extra).m_icon;
+    if (s == WP_Weapon.netname) return REGISTRY_GET(Weapons, this.wp_extra).model2;
+    if (s == WP_Item.netname) return REGISTRY_GET(Items, this.wp_extra).m_icon;
+    if (s == WP_Vehicle.netname) return REGISTRY_GET(Vehicles, this.wp_extra).m_icon;
     //if (s == WP_Monster.netname) return get_monsterinfo(this.wp_extra).m_icon;
     if (MUTATOR_CALLHOOK(WP_Format, this, s))
     {
index 3b009b25637a296b28cf93d2978e858df993cf73..bbaa8845e8de8ad4636a6bc2a0db5cfb25813c69 100644 (file)
@@ -435,7 +435,7 @@ string BUFF_NAME(int i);
        ARG_CASE(ARG_CS_SV,     "spree_inf",     (autocvar_notification_show_sprees ? notif_arg_spree_inf(1, input, s2, f2) : "")) \
        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",  Weapons_from(f1).m_name) \
+       ARG_CASE(ARG_CS_SV,     "item_wepname",  REGISTRY_GET(Weapons, f1).m_name) \
        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",  (f2 > 0 ? notif_arg_item_wepammo(f1, f2) : "")) \
@@ -633,7 +633,7 @@ string notif_arg_spree_inf(float type, string input, string player, float spree)
 string notif_arg_item_wepammo(float f1, float f2)
 {
        string ammoitems = "";
-       Weapon wep = Weapons_from(f1);
+       Weapon wep = REGISTRY_GET(Weapons, f1);
        switch (wep.ammo_type)
        {
                case RES_SHELLS:  ammoitems = ITEM_Shells.m_name;      break;
@@ -701,6 +701,8 @@ string notif_arg_item_wepammo(float f1, float f2)
 REGISTRY(Notifications, BITS(11))
 REGISTER_REGISTRY(Notifications)
 REGISTRY_SORT(Notifications);
+
+REGISTRY_DEFINE_GET(Notifications, NULL)
 STATIC_INIT(Notifications) { FOREACH(Notifications, true, it.m_id = i); }
 REGISTRY_CHECK(Notifications)
 
@@ -730,7 +732,7 @@ string Get_Notif_CvarName(Notification notif)
 
 Notification Get_Notif_Ent(MSG net_type, int net_name)
 {
-       Notification it = _Notifications_from(net_name, NULL);
+       Notification it = REGISTRY_GET(Notifications, net_name);
        if (it.nent_type != net_type) {
                LOG_WARNF("Get_Notif_Ent(%s (%d), %s (%d)): Improper net type '%s'!",
                        Get_Notif_TypeName(net_type), net_type,
index 377a780770300554275d3685e3e6d53e90122bb8..3bc6c55636c65fa4e3875d0bf2b328e0f3a0aa02 100644 (file)
@@ -4,10 +4,11 @@
 
 #define REGISTER_SP(id) REGISTER(Scores, SP, id, m_id, new_pure(PlayerScoreField))
 REGISTRY(Scores, MAX_SCORE);
-#define Scores_from(i) _Scores_from(i, NULL)
 REGISTER_REGISTRY(Scores)
 REGISTRY_SORT(Scores);
 REGISTRY_CHECK(Scores);
+
+REGISTRY_DEFINE_GET(Scores, NULL)
 STATIC_INIT(Scores_renumber) { FOREACH(Scores, true, it.m_id = i); }
 
 /*
index 29f2946b059d7d4c65c9f2c9cf1e8cef3da52753..58b145a4c2cd647e28372fdb7488fc204de6d02d 100644 (file)
@@ -39,7 +39,7 @@ SOUND(GRENADE_BOUNCE4, W_Sound("grenade_bounce4"));
 SOUND(GRENADE_BOUNCE5, W_Sound("grenade_bounce5"));
 SOUND(GRENADE_BOUNCE6, W_Sound("grenade_bounce6"));
 Sound SND_GRENADE_BOUNCE_RANDOM() {
-    return Sounds_from(SND_GRENADE_BOUNCE1.m_id + rint(random() * 5));
+    return REGISTRY_GET(Sounds, SND_GRENADE_BOUNCE1.m_id + rint(random() * 5));
 }
 SOUND(GRENADE_FIRE, W_Sound("grenade_fire"));
 SOUND(GRENADE_IMPACT, W_Sound("grenade_impact"));
@@ -51,7 +51,7 @@ SOUND(HAGEXP1, W_Sound("hagexp1"));
 SOUND(HAGEXP2, W_Sound("hagexp2"));
 SOUND(HAGEXP3, W_Sound("hagexp3"));
 Sound SND_HAGEXP_RANDOM() {
-    return Sounds_from(SND_HAGEXP1.m_id + rint(random() * 2));
+    return REGISTRY_GET(Sounds, SND_HAGEXP1.m_id + rint(random() * 2));
 }
 
 SOUND(HOOKBOMB_FIRE, W_Sound("hookbomb_fire"));
@@ -74,7 +74,7 @@ SOUND(NEXWHOOSH1, W_Sound("nexwhoosh1"));
 SOUND(NEXWHOOSH2, W_Sound("nexwhoosh2"));
 SOUND(NEXWHOOSH3, W_Sound("nexwhoosh3"));
 Sound SND_NEXWHOOSH_RANDOM() {
-    return Sounds_from(SND_NEXWHOOSH1.m_id + rint(random() * 2));
+    return REGISTRY_GET(Sounds, SND_NEXWHOOSH1.m_id + rint(random() * 2));
 }
 SOUND(RELOAD, W_Sound("reload")); // until weapons have individual reload sounds, precache the reload sound here
 
@@ -82,7 +82,7 @@ SOUND(RIC1, W_Sound("ric1"));
 SOUND(RIC2, W_Sound("ric2"));
 SOUND(RIC3, W_Sound("ric3"));
 Sound SND_RIC_RANDOM() {
-    return Sounds_from(SND_RIC1.m_id + rint(random() * 2));
+    return REGISTRY_GET(Sounds, SND_RIC1.m_id + rint(random() * 2));
 }
 
 SOUND(ROCKET_DET, W_Sound("rocket_det"));
@@ -265,7 +265,7 @@ SOUND(GIB_SPLAT02, "misc/gib_splat02");
 SOUND(GIB_SPLAT03, "misc/gib_splat03");
 SOUND(GIB_SPLAT04, "misc/gib_splat04");
 Sound SND_GIB_SPLAT_RANDOM() {
-    return Sounds_from(SND_GIB_SPLAT01.m_id + floor(prandom() * 4));
+    return REGISTRY_GET(Sounds, SND_GIB_SPLAT01.m_id + floor(prandom() * 4));
 }
 
 SOUND(HIT, "misc/hit");
index b7b296341b5a02ba5829035e158f13ad673cbefe..6d011e21ad0b3f9cb29102fc438fca1e47233b7c 100644 (file)
@@ -3,7 +3,6 @@
 #include "sound.qh"
 
 REGISTRY(Sounds, BITS(9))
-#define Sounds_from(i) _Sounds_from(i, SND_Null)
 REGISTER_REGISTRY(Sounds)
 
 #define SOUND(name, path) \
@@ -18,5 +17,6 @@ PRECACHE(Sounds) {
 }
 
 SOUND(Null, "misc/null");
+REGISTRY_DEFINE_GET(Sounds, SND_Null)
 #include "all.inc"
 #include "all.qc"
index e1d9d583bfbec7c42e13a557dbc2b0642fa56d51..7ecbd58e9c7c2481b776018524c471b85e17e089 100644 (file)
@@ -505,7 +505,7 @@ void Item_RespawnCountdown(entity this)
                {
                        do {
                                {
-                                       entity wi = Weapons_from(this.weapon);
+                                       entity wi = REGISTRY_GET(Weapons, this.weapon);
                                        if (wi != WEP_Null) {
                                                entity wp = WaypointSprite_Spawn(WP_Weapon, 0, 0, this, '0 0 64', NULL, 0, this, waypointsprite_attached, true, RADARICON_Weapon);
                                                wp.wp_extra = wi.m_id;
@@ -853,7 +853,7 @@ bool Item_GiveTo(entity item, entity player)
                {
                        .entity weaponentity = weaponentities[slot];
                        if(player.(weaponentity).m_weapon != WEP_Null || slot == 0)
-                               W_SwitchWeapon_Force(player, Weapons_from(item.weapon), weaponentity);
+                               W_SwitchWeapon_Force(player, REGISTRY_GET(Weapons, item.weapon), weaponentity);
                }
                return true;
        }
@@ -1200,7 +1200,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
        }
 
        if(weaponid)
-               STAT(WEAPONS, this) = WepSet_FromWeapon(Weapons_from(weaponid));
+               STAT(WEAPONS, this) = WepSet_FromWeapon(REGISTRY_GET(Weapons, weaponid));
 
        this.flags = FL_ITEM | itemflags;
        IL_PUSH(g_items, this);
@@ -1304,7 +1304,7 @@ void _StartItem(entity this, entity def, float defaultrespawntime, float default
                        this.is_item = true;
                }
 
-               weaponsInMap |= WepSet_FromWeapon(Weapons_from(weaponid));
+               weaponsInMap |= WepSet_FromWeapon(REGISTRY_GET(Weapons, weaponid));
 
                if (   def.instanceOfPowerup
                        || def.instanceOfWeaponPickup
@@ -1588,7 +1588,7 @@ spawnfunc(target_items)
 float GiveWeapon(entity e, float wpn, float op, float val)
 {
        WepSet v0, v1;
-       WepSet s = WepSet_FromWeapon(Weapons_from(wpn));
+       WepSet s = WepSet_FromWeapon(REGISTRY_GET(Weapons, wpn));
        v0 = (STAT(WEAPONS, e) & s);
        switch(op)
        {
index ee0e1918e4b9194c3d5f75b510d864095476b81e..5727234e26cb36f5e8d3195881886fa2f21a73ff 100644 (file)
@@ -6,8 +6,7 @@
 #include "turret.qh"
 
 REGISTRY(Turrets, BITS(5))
-#define Turrets_from(i) _Turrets_from(i, TUR_Null)
-#define get_turretinfo(i) Turrets_from(i)
+#define get_turretinfo(i) REGISTRY_GET(Turrets, i)
 REGISTER_REGISTRY(Turrets)
 REGISTRY_CHECK(Turrets)
 
@@ -117,5 +116,6 @@ const int TUR_FIRST = 1;
 #define REGISTER_TURRET(id, inst) REGISTER(Turrets, TUR, id, m_id, inst)
 
 REGISTER_TURRET(Null, NEW(Turret));
+REGISTRY_DEFINE_GET(Turrets, TUR_Null)
 
 #include "turret/_mod.qh"
index 3b7513013dc036475976c872d628ec572d8a4b67..3567a2b095d522857ec2e2e4454de22c3e2d3dd5 100644 (file)
@@ -508,7 +508,7 @@ string fixPriorityList(string order, float from, float to, float subtract, float
                n = tokenize_console(neworder);
                for(w = to; w >= from; --w)
                {
-                       int wflags = Weapons_from(w).spawnflags;
+                       int wflags = REGISTRY_GET(Weapons, w).spawnflags;
                        if(wflags & WEP_FLAG_SPECIALATTACK)
                                continue;
                        for(i = 0; i < n; ++i)
index 94af40c66ffc9f3ca50a30467b884d54d2b26f96..2e4a2be5043b9a51d2eef18c92ae3eb090128454 100644 (file)
@@ -3,7 +3,6 @@
 #include "vehicle.qh"
 
 REGISTRY(Vehicles, BITS(4))
-#define Vehicles_from(i) _Vehicles_from(i, VEH_Null)
 REGISTER_REGISTRY(Vehicles)
 REGISTRY_CHECK(Vehicles)
 
@@ -19,5 +18,6 @@ const int VEH_FIRST = 1;
 #endif
 
 REGISTER_VEHICLE(Null, NEW(Vehicle));
+REGISTRY_DEFINE_GET(Vehicles, VEH_Null)
 
 #include "vehicle/_mod.qh"
index 06c8484ff8eec45d17be6d3f18e0caaa6d1f2c5b..667c1f75a31b65587fcd9a9886c000affa454606 100644 (file)
@@ -134,7 +134,7 @@ NET_HANDLE(TE_CSQC_VEHICLESETUP, bool isnew)
                AuxiliaryXhair[0].axh_image = vCROSS_BURST; // Plasma cannons
                AuxiliaryXhair[1].axh_image = vCROSS_BURST; // Raygun
        } else {
-               Vehicle info = Vehicles_from(hud_id);
+               Vehicle info = REGISTRY_GET(Vehicles, hud_id);
        info.vr_setup(info, NULL);
        }
 }
index 3ec02901dc14c06435cc35f4d5b738ad940f7add..cc2e13e223fb6c1b827430a67b2b82531c3b4428 100644 (file)
@@ -450,7 +450,7 @@ void vehicles_reset_colors(entity this, entity player)
        this.velocity  = '0 0 0';
        this.effects   = eff;
 
-       Vehicle info = Vehicles_from(this.vehicleid);
+       Vehicle info = REGISTRY_GET(Vehicles, this.vehicleid);
        info.vr_setcolors(info, this);
 }
 
@@ -741,7 +741,7 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag
 
                antilag_clear(this, this);
 
-               Vehicle info = Vehicles_from(this.vehicleid);
+               Vehicle info = REGISTRY_GET(Vehicles, this.vehicleid);
                info.vr_death(info, this);
                vehicles_setreturn(this);
        }
@@ -931,7 +931,7 @@ void vehicles_touch(entity this, entity toucher)
                }
 
                if(this.play_time < time) {
-                       Vehicle info = Vehicles_from(this.vehicleid);
+                       Vehicle info = REGISTRY_GET(Vehicles, this.vehicleid);
                        info.vr_impact(info, this);
                }
 
@@ -976,7 +976,7 @@ void vehicles_enter(entity pl, entity veh)
        || (pl.vehicle)
        ) { return; }
 
-       Vehicle info = Vehicles_from(veh.vehicleid);
+       Vehicle info = REGISTRY_GET(Vehicles, veh.vehicleid);
 
        if(autocvar_g_vehicles_enter) // vehicle's touch function should handle this if entering via use key is disabled (TODO)
        if(veh.vehicle_flags & VHF_MULTISLOT)
@@ -1115,7 +1115,7 @@ void vehicles_think(entity this)
        if(this.owner)
                STAT(VEHICLESTAT_W2MODE, this.owner) = STAT(VEHICLESTAT_W2MODE, this);
 
-       Vehicle info = Vehicles_from(this.vehicleid);
+       Vehicle info = REGISTRY_GET(Vehicles, this.vehicleid);
        info.vr_think(info, this);
 
        vehicles_painframe(this);
@@ -1188,7 +1188,7 @@ void vehicles_spawn(entity this)
        });
 
 
-       Vehicle info = Vehicles_from(this.vehicleid);
+       Vehicle info = REGISTRY_GET(Vehicles, this.vehicleid);
        info.vr_spawn(info, this);
 
        vehicles_reset_colors(this, NULL);
index 81fd93aa02d5e2da6178ac312b0a056cbcfee878..0afd31f8c77e00d6bdc7b349efdbc15837d0d6e6 100644 (file)
@@ -96,7 +96,8 @@ void bumble_raygun_draw(entity this)
 
     if(this.bumble_raygun_nextdraw < time)
     {
-        boxparticles(particleeffectnum(Effects_from(this.traileffect)), this, this.origin, this.origin + _dir * -64, _dir * -_len , _dir * -_len, 1, PARTICLES_USEALPHA);
+        entity eff = REGISTRY_GET(Effects, this.traileffect);
+        boxparticles(particleeffectnum(eff), this, this.origin, this.origin + _dir * -64, _dir * -_len , _dir * -_len, 1, PARTICLES_USEALPHA);
         boxparticles(this.lip, this, this.bumble_origin, this.bumble_origin + _dir * -64, _dir * -200 , _dir * -200, 1, PARTICLES_USEALPHA);
         this.bumble_raygun_nextdraw = time + 0.1;
     }
index 45ba22906e042185002f639456f96558972ad455..736ed9c9d23be1050ff57350be5a4cbe2bca2b97 100644 (file)
@@ -107,7 +107,7 @@ string W_NameWeaponOrder_MapFunc(string s)
        int i = stof(s);
        if (s == "0" || i)
        {
-               entity wi = Weapons_from(i);
+               entity wi = REGISTRY_GET(Weapons, i);
                if (wi != WEP_Null) return wi.netname;
        }
        return s;
@@ -156,9 +156,9 @@ void W_FixWeaponOrder_BuildImpulseList_swap(int i, int j, entity pass)
 float W_FixWeaponOrder_BuildImpulseList_cmp(int i, int j, entity pass)
 {
        int si = W_FixWeaponOrder_BuildImpulseList_buf[i];
-       Weapon e1 = Weapons_from(si);
+       Weapon e1 = REGISTRY_GET(Weapons, si);
        int sj = W_FixWeaponOrder_BuildImpulseList_buf[j];
-       Weapon e2 = Weapons_from(sj);
+       Weapon e2 = REGISTRY_GET(Weapons, sj);
        int d = (e1.impulse + 9) % 10 - (e2.impulse + 9) % 10;
        if (d != 0) return -d;  // high impulse first!
        return strstrofs(strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " "),
index e82dce3da57d68d273f5b292ae4a46afb32a1867..1a6dddbc2356de009b958737e1c7d2dc16ec941d 100644 (file)
@@ -25,7 +25,6 @@ WepSet ReadWepSet();
 #include <common/util.qh>
 
 REGISTRY(Weapons, 72) // Increase as needed. Can be up to 72.
-#define Weapons_from(i) _Weapons_from(i, WEP_Null)
 REGISTER_REGISTRY(Weapons)
 STATIC_INIT(WeaponPickup) { FOREACH(Weapons, true, it.m_pickup = NEW(WeaponPickup, it)); }
 
@@ -126,6 +125,7 @@ STATIC_INIT_LATE(W_PROP_reloader)
     [[alias("WEP_" #id)]] Weapon _wep_##sname
 
 REGISTER_WEAPON(Null, NEW(Weapon));
+REGISTRY_DEFINE_GET(Weapons, WEP_Null)
 
 Weapon Weapons_fromstr(string s)
 {
@@ -256,7 +256,7 @@ const .float reloading_time = reload_time;
             .void(Weapon this, int i) wr_net;
             NET_HANDLE(WeaponUpdate, bool isnew)
             {
-                Weapon w = Weapons_from(ReadByte());
+                Weapon w = REGISTRY_GET(Weapons, ReadByte());
                 for (int i; (i = ReadByte()); )
                 {
                     w.wr_net(w, i);
@@ -333,7 +333,7 @@ STATIC_INIT(register_weapons_done)
     #endif
     weaponorder_byid = "";
     for (int i = REGISTRY_MAX(Weapons) - 1; i >= 1; --i)
-        if (Weapons_from(i))
+        if (REGISTRY_GET(Weapons, i))
             weaponorder_byid = strcat(weaponorder_byid, " ", ftos(i));
     weaponorder_byid = strzone(substring(weaponorder_byid, 1, -1));
 }
index 38ef3bd1f7d4c5303e5f639f5c6306711d1385ba..5e78207d4a7986ea754e0a0dc692e96d86b391c1 100644 (file)
@@ -8,15 +8,15 @@ MACRO_END
 #define WEPENT_NETPROPS(PROP) PROP(false, sv_entnum, WEPENT_SET_NORMAL, {}, {}) /* sentinel */ \
        PROP(false, m_switchweapon, WEPENT_SET_NORMAL, \
        { WriteByte(chan, this.m_switchweapon.m_id); }, \
-       { (viewmodels[this.m_wepent_slot]).switchweapon = Weapons_from(ReadByte()); }) \
+       { (viewmodels[this.m_wepent_slot]).switchweapon = REGISTRY_GET(Weapons, ReadByte()); }) \
     \
     PROP(false, m_switchingweapon, WEPENT_SET_NORMAL, \
        { WriteByte(chan, this.m_switchingweapon.m_id); }, \
-       { (viewmodels[this.m_wepent_slot]).switchingweapon = Weapons_from(ReadByte()); }) \
+       { (viewmodels[this.m_wepent_slot]).switchingweapon = REGISTRY_GET(Weapons, ReadByte()); }) \
     \
     PROP(false, m_weapon, WEPENT_SET_NORMAL, \
        { WriteByte(chan, this.m_weapon.m_id); }, \
-       { (viewmodels[this.m_wepent_slot]).activeweapon = Weapons_from(ReadByte()); }) \
+       { (viewmodels[this.m_wepent_slot]).activeweapon = REGISTRY_GET(Weapons, ReadByte()); }) \
     \
     PROP(false, m_alpha, WEPENT_SET_NORMAL, \
        { WriteByte(chan, rint(bound(-1, 254 * this.m_alpha, 254) - -1)); }, \
index a6c363b8f7cc87e9ea337ff7b3d4aa14d95d8b6d..71950fb73cb67120d632a4d70ed0fd4bb60f276a 100644 (file)
@@ -40,10 +40,11 @@ string _net_prevmsgstr;
 #define REGISTER_NET_S2C(id) REGISTER_NET_TEMP(id)
 
 REGISTRY(TempEntities, BITS(8) - 80)
-#define TempEntities_from(i) _TempEntities_from(i, NULL)
 REGISTER_REGISTRY(TempEntities)
 REGISTRY_SORT(TempEntities)
 REGISTRY_CHECK(TempEntities)
+
+REGISTRY_DEFINE_GET(TempEntities, NULL)
 STATIC_INIT(TempEntities_renumber) { FOREACH(TempEntities, true, it.m_id = 80 + i); }
 
 
@@ -72,10 +73,11 @@ STATIC_INIT(TempEntities_renumber) { FOREACH(TempEntities, true, it.m_id = 80 +
 #endif
 
 REGISTRY(LinkedEntities, BITS(8) - 1)
-#define LinkedEntities_from(i) _LinkedEntities_from(i, NULL)
 REGISTER_REGISTRY(LinkedEntities)
 REGISTRY_SORT(LinkedEntities)
 REGISTRY_CHECK(LinkedEntities)
+
+REGISTRY_DEFINE_GET(LinkedEntities, NULL)
 STATIC_INIT(LinkedEntities_renumber) { FOREACH(LinkedEntities, true, it.m_id = 1 + i); }
 
 
@@ -98,10 +100,11 @@ STATIC_INIT(LinkedEntities_renumber) { FOREACH(LinkedEntities, true, it.m_id = 1
 #endif
 
 REGISTRY(C2S_Protocol, BITS(8) - 1)
-#define C2S_Protocol_from(i) _C2S_Protocol_from(i, NULL)
 REGISTER_REGISTRY(C2S_Protocol)
 REGISTRY_SORT(C2S_Protocol)
 REGISTRY_CHECK(C2S_Protocol)
+
+REGISTRY_DEFINE_GET(C2S_Protocol, NULL)
 STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
 
 #ifdef SVQC
@@ -170,7 +173,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
                STRING_ITERATOR_SET(g_buf, buf, 0);
                for (int C2S; (C2S = ReadByte()) >= 0; )
                {
-                       entity reader = C2S_Protocol_from(C2S);
+                       entity reader = REGISTRY_GET(C2S_Protocol, C2S);
                        if (reader && reader.m_read && reader.m_read(NULL, sender, true)) continue;
                        LOG_SEVEREF("Net_ClientCommand() with malformed C2S=%d", C2S);
                        return;
@@ -283,7 +286,7 @@ MACRO_END
 
 // serialization: old
 
-#define ReadRegistered(r) r##_from(Read_byte())
+#define ReadRegistered(r) REGISTRY_GET(r, Read_byte())
 #define WriteRegistered(r, to, it) Write_byte(to, it.m_id)
 
 #define Read_byte() ReadByte()
index 2db3ae34fb8eb0e88111e5392533fd9fd861a470..8f0d91ce95ccd663fbe6e1b0f353dd0d3d91a854 100644 (file)
        noref entity id##_first, id##_last; \
        _R_MAP(_##id, id##_MAX); \
        SHUTDOWN(id) { _R_DEL(_##id); } \
-       entity _##id##_from(int i, entity null) { if (i >= 0 && i < id##_COUNT) { entity e = _R_GET(_##id, i); if (e) return e; } return null; }
+
+#define REGISTRY_DEFINE_GET(id, null) \
+       entity id##_from(int i) { if (i >= 0 && i < id##_COUNT) { entity e = _R_GET(_##id, i); if (e) return e; } return null; }
+
+#define REGISTRY_GET(id, i) id##_from(i)
 
 /** Add registry dependencies to a registry */
 #define REGISTRY_DEPENDS(id, dep) void Register##dep(); void REGISTRY_DEPENDS_(id) { Register##dep(); }
index 5a2b53b69f3796da2c23802c617567d221ddbeb6..9bd4a3af94802718fcbd51e0e27046c5b366b6db 100644 (file)
@@ -168,6 +168,8 @@ REGISTRY(Stats, 256 - STATS_ENGINE_RESERVE)
 REGISTER_REGISTRY(Stats)
 REGISTRY_SORT(Stats)
 REGISTRY_CHECK(Stats)
+
+REGISTRY_DEFINE_GET(Stats, NULL)
 STATIC_INIT(Stats_renumber)
 {
        FOREACH(Stats, true, {
index 80133b8b374dd7bb9d7dfa86373cfa3a984f06e3..291b55b27aefff385e756c294ffcfc9a4b4067a9 100644 (file)
@@ -5,8 +5,9 @@
 #include "xonotic/tab.qh"
 
 REGISTRY(Settings, BITS(3))
-#define Settings_from(i) _Settings_from(i, NULL)
 REGISTER_REGISTRY(Settings)
+
+REGISTRY_DEFINE_GET(Settings, NULL)
 #define REGISTER_SETTINGS(id, impl) \
     LAZY_NEW(id, impl) \
     REGISTER(Settings, MENU, id, m_id, NEW(Lazy, LAZY(id)))
index eac6f754d8082755219a8ce81c3f91ba0fad97c6..e8dcd79995fdb3be9b75384db2fe06c82369d07e 100644 (file)
@@ -255,7 +255,7 @@ void XonoticMutatorsDialog_fill(entity me)
                me.TDempty(me, 0.1); // fix initial position
        for(i = WEP_FIRST, j = 0; i <= WEP_LAST; ++i)
        {
-               w = Weapons_from(i);
+               w = REGISTRY_GET(Weapons, i);
                if (w.spawnflags & (WEP_FLAG_HIDDEN | WEP_FLAG_SPECIALATTACK))
                        continue;
                if ((j % 3) == 0)
index fc0790d4ba18574691b946aaddd3b21614f30ce0..b617d4915d4925787c06450c55c343deaade6567 100644 (file)
@@ -4,14 +4,14 @@
 
 METHOD(SettingSource, getEntry, entity(entity this, int i, void(string name, string icon) returns))
 {
-    Lazy l = Settings_from(i);
+    Lazy l = REGISTRY_GET(Settings, i);
     entity it = l.m_get();
     if (returns) returns(it.title, string_null);
     return it;
 }
 METHOD(SettingSource, getEntryTooltip, entity(entity this, int i, void(string theTooltip) returns))
 {
-    Lazy l = Settings_from(i);
+    Lazy l = REGISTRY_GET(Settings, i);
     entity it = l.m_get();
     if (returns) returns(it.titleTooltip);
     return it;
index 21278f720cc6e37c1ed13d78dc5eca8280885c33..65797e2bffc827e7e48c57a11693eee78fb4d85f 100644 (file)
@@ -623,7 +623,7 @@ void ServerList_TypeSort_Click(entity btn, entity me)
                // the type was found
                // choose the next one
                flag = true;
-               s = MapInfo_Type_ToString(Gametypes_from(it.m_id + 1));
+               s = MapInfo_Type_ToString(REGISTRY_GET(Gametypes, it.m_id + 1));
                if (s == "") s = MapInfo_Type_ToString(first);
                break;
        });
index 7b3d7375b7760018cf4ab267e3f8d2daab6bc137..157d22ffee2453db8d1713a90dc647f918ec4049 100644 (file)
@@ -76,7 +76,7 @@ string XonoticWeaponsList_toString(entity me)
        s = "";
        for(i = 0; i < n; ++i)
        {
-               e = Weapons_from(stof(argv(i)));
+               e = REGISTRY_GET(Weapons, stof(argv(i)));
                s = strcat(s, e.m_name, ", ");
        }
        return substring(s, 0, strlen(s) - 2);
@@ -91,7 +91,7 @@ void XonoticWeaponsList_drawListBoxItem(entity me, int i, vector absSize, bool i
                me.focusedItemAlpha = getFadedAlpha(me.focusedItemAlpha, SKINALPHA_LISTBOX_FOCUSED, SKINFADEALPHA_LISTBOX_FOCUSED);
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_FOCUSED, me.focusedItemAlpha);
        }
-       e = Weapons_from(stof(argv(i)));
+       e = REGISTRY_GET(Weapons, stof(argv(i)));
        string msg = e.m_name;
        if(e.spawnflags & WEP_FLAG_MUTATORBLOCKED)
                msg = strcat(msg, "*");
index 3d744f7d972762b00fd63d6eba8efb2741593b21..d0c6da839ceb26d2b902657ef494f308b3bbeccf 100644 (file)
@@ -1478,11 +1478,11 @@ void havocbot_chooseweapon(entity this, .entity weaponentity)
                if ( distance > bot_distance_far ) {
                        for(i=0; i < REGISTRY_COUNT(Weapons) && bot_weapons_far[i] != -1 ; ++i){
                                w = bot_weapons_far[i];
-                               if ( client_hasweapon(this, Weapons_from(w), weaponentity, true, false) )
+                               if ( client_hasweapon(this, REGISTRY_GET(Weapons, w), weaponentity, true, false) )
                                {
                                        if ((this.(weaponentity).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(this, weaponentity, w))
                                                continue;
-                                       this.(weaponentity).m_switchweapon = Weapons_from(w);
+                                       this.(weaponentity).m_switchweapon = REGISTRY_GET(Weapons, w);
                                        return;
                                }
                        }
@@ -1492,11 +1492,11 @@ void havocbot_chooseweapon(entity this, .entity weaponentity)
                if ( distance > bot_distance_close) {
                        for(i=0; i < REGISTRY_COUNT(Weapons) && bot_weapons_mid[i] != -1 ; ++i){
                                w = bot_weapons_mid[i];
-                               if ( client_hasweapon(this, Weapons_from(w), weaponentity, true, false) )
+                               if ( client_hasweapon(this, REGISTRY_GET(Weapons, w), weaponentity, true, false) )
                                {
                                        if ((this.(weaponentity).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(this, weaponentity, w))
                                                continue;
-                                       this.(weaponentity).m_switchweapon = Weapons_from(w);
+                                       this.(weaponentity).m_switchweapon = REGISTRY_GET(Weapons, w);
                                        return;
                                }
                        }
@@ -1505,11 +1505,11 @@ void havocbot_chooseweapon(entity this, .entity weaponentity)
                // Choose weapons for close distance
                for(i=0; i < REGISTRY_COUNT(Weapons) && bot_weapons_close[i] != -1 ; ++i){
                        w = bot_weapons_close[i];
-                       if ( client_hasweapon(this, Weapons_from(w), weaponentity, true, false) )
+                       if ( client_hasweapon(this, REGISTRY_GET(Weapons, w), weaponentity, true, false) )
                        {
                                if ((this.(weaponentity).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(this, weaponentity, w))
                                        continue;
-                               this.(weaponentity).m_switchweapon = Weapons_from(w);
+                               this.(weaponentity).m_switchweapon = REGISTRY_GET(Weapons, w);
                                return;
                        }
                }
index 9c2c6825db0342164159eef90cd99c0e59f8ca91..955d15af6a7b270b71ee7b4467dae04c937f696d 100644 (file)
@@ -588,10 +588,10 @@ float bot_cmd_select_weapon(entity this)
                if(this.(weaponentity).m_weapon == WEP_Null && slot != 0)
                        continue;
 
-               if(client_hasweapon(this, Weapons_from(id), weaponentity, true, false))
+               if(client_hasweapon(this, REGISTRY_GET(Weapons, id), weaponentity, true, false))
                {
                        success = true;
-                       this.(weaponentity).m_switchweapon = Weapons_from(id);
+                       this.(weaponentity).m_switchweapon = REGISTRY_GET(Weapons, id);
                }
        }
 
index f03a815de26b6de896ddee64a71dc6e05e0476c2..ea3af546935bb3903ee290a3e2e504d62be058ef 100644 (file)
@@ -2,10 +2,11 @@
 
 #include <common/command/_mod.qh>
 REGISTRY(COMMON_COMMANDS, BITS(7))
-#define COMMON_COMMANDS_from(i) _COMMON_COMMANDS_from(i, NULL)
 REGISTER_REGISTRY(COMMON_COMMANDS)
 REGISTRY_SORT(COMMON_COMMANDS)
 
+REGISTRY_DEFINE_GET(COMMON_COMMANDS, NULL)
+
 #define COMMON_COMMAND(id, description) \
        CLASS(commoncommand_##id, Command) \
                ATTRIB(commoncommand_##id, m_name, string, #id); \
index 8115d712ebe9f46b39f131a9c1dce48f74250377..71ace677ab47d0b0ed829e379f9ee56e10031526 100644 (file)
@@ -1,10 +1,11 @@
 #pragma once
 
 REGISTRY(SERVER_COMMANDS, BITS(7))
-#define SERVER_COMMANDS_from(i) _SERVER_COMMANDS_from(i, NULL)
 REGISTER_REGISTRY(SERVER_COMMANDS)
 REGISTRY_SORT(SERVER_COMMANDS)
 
+REGISTRY_DEFINE_GET(SERVER_COMMANDS, NULL)
+
 #define SERVER_COMMAND(id, description) \
        CLASS(servercommand_##id, Command) \
                ATTRIB(servercommand_##id, m_name, string, #id); \
index 555a73472fb35cff23435bc2c9b7f2cdfbc66525..e5363db7738fd9a79b5206fbcaa0262110350a49 100644 (file)
@@ -129,7 +129,7 @@ void Obituary_SpecialDeath(
                return;
        }
 
-       entity deathent = Deathtypes_from(deathtype - DT_FIRST);
+       entity deathent = REGISTRY_GET(Deathtypes, deathtype - DT_FIRST);
        if (!deathent)
        {
                backtrace("Obituary_SpecialDeath: Could not find deathtype entity!\n");
index 49685d49d7ec088c9a3a5a83c993dadbb7f89bbf..62acd99d8df93ac608b6d32b431529da000189c3 100644 (file)
@@ -149,7 +149,7 @@ X(9, next)
                for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) \
                { \
                        .entity weaponentity = weaponentities[slot]; \
-                       W_SwitchWeapon_TryOthers(this, Weapons_from(WEP_FIRST + i), weaponentity); \
+                       W_SwitchWeapon_TryOthers(this, REGISTRY_GET(Weapons, WEP_FIRST + i), weaponentity); \
                        if(autocvar_g_weaponswitch_debug != 1) \
                                break; \
                } \
index 9dd468c2d74982c15a6e83691debb4b4c9254bcb..6e2fe4b16e5f316db4960e0d66bdd0078a21822c 100644 (file)
@@ -243,7 +243,7 @@ string WeaponNameFromWeaponentity(entity this, .entity weaponentity)
                return wepent.m_weapon.m_name;
        else if(wepent.m_switchweapon != WEP_Null)
                return wepent.m_switchweapon.m_name;
-       return "none"; //Weapons_from(wepent.cnt).m_name;
+       return "none"; //REGISTRY_GET(Weapons, wepent.cnt).m_name;
 }
 
 string formatmessage(entity this, string msg)
index 06615c4eac8575465aed85fe57cbe5181c423940..9486404b9bb008820ad66be17f2b17e001a564fb 100644 (file)
@@ -30,7 +30,7 @@ void W_GiveWeapon(entity e, int wep)
 {
        if (!wep) return;
 
-       STAT(WEAPONS, e) |= WepSet_FromWeapon(Weapons_from(wep));
+       STAT(WEAPONS, e) |= WepSet_FromWeapon(REGISTRY_GET(Weapons, wep));
 
        if (IS_PLAYER(e)) {
            Send_Notification(NOTIF_ONE, e, MSG_MULTI, ITEM_WEAPON_GOT, wep);
index f1866eab089311a0ce2c2a052d6b9b3fbaf00031..3f821b44fa8deb3e7507f6c62d0e0ee7525aa892 100644 (file)
@@ -151,7 +151,7 @@ float W_GetCycleWeapon(entity this, string weaponorder, float dir, float imp, fl
        while(rest != "")
        {
                weaponwant = stof(car(rest)); rest = cdr(rest);
-               wep = Weapons_from(weaponwant);
+               wep = REGISTRY_GET(Weapons, weaponwant);
                wepset = wep.m_wepset;
                if(imp >= 0)
                if(wep.impulse != imp)
@@ -207,7 +207,7 @@ float W_GetCycleWeapon(entity this, string weaponorder, float dir, float imp, fl
                while(rest != "")
                {
                        weaponwant = stof(car(rest)); rest = cdr(rest);
-                       wep = Weapons_from(weaponwant);
+                       wep = REGISTRY_GET(Weapons, weaponwant);
                        wepset = wep.m_wepset;
                        if(imp >= 0)
                                if(wep.impulse != imp)
@@ -301,7 +301,7 @@ void W_CycleWeapon(entity this, string weaponorder, float dir, .entity weaponent
        float w;
        w = W_GetCycleWeapon(this, weaponorder, dir, -1, 1, true, weaponentity);
        if(w > 0)
-               W_SwitchWeapon(this, Weapons_from(w), weaponentity);
+               W_SwitchWeapon(this, REGISTRY_GET(Weapons, w), weaponentity);
 }
 
 void W_NextWeaponOnImpulse(entity this, float imp, .entity weaponentity)
@@ -309,7 +309,7 @@ void W_NextWeaponOnImpulse(entity this, float imp, .entity weaponentity)
        float w;
        w = W_GetCycleWeapon(this, CS(this).cvar_cl_weaponpriority, +1, imp, 1, (CS(this).cvar_cl_weaponimpulsemode == 0), weaponentity);
        if(w > 0)
-               W_SwitchWeapon(this, Weapons_from(w), weaponentity);
+               W_SwitchWeapon(this, REGISTRY_GET(Weapons, w), weaponentity);
 }
 
 // next weapon
@@ -337,7 +337,7 @@ void W_PreviousWeapon(entity this, float list, .entity weaponentity)
 // previously used if exists and has ammo, (second) best otherwise
 void W_LastWeapon(entity this, .entity weaponentity)
 {
-       Weapon wep = Weapons_from(this.(weaponentity).cnt);
+       Weapon wep = REGISTRY_GET(Weapons, this.(weaponentity).cnt);
        if (client_hasweapon(this, wep, weaponentity, true, false))
                W_SwitchWeapon(this, wep, weaponentity);
        else
index dd21e6419da58f6772f3f541f18c588e782b71d1..2fff84e4fb5a4980064b91f0f0a120295d492f7a 100644 (file)
@@ -12,7 +12,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
 .int weaponcomplainindex;
 float W_GetCycleWeapon(entity this, string weaponorder, float dir, float imp, float complain, float skipmissing, .entity weaponentity);
 
-#define w_getbestweapon(ent,wepent) Weapons_from(W_GetCycleWeapon(ent, CS(ent).cvar_cl_weaponpriority, 0, -1, false, true, wepent))
+#define w_getbestweapon(ent,wepent) REGISTRY_GET(Weapons, W_GetCycleWeapon(ent, CS(ent).cvar_cl_weaponpriority, 0, -1, false, true, wepent))
 
 void W_SwitchWeapon_Force(Player this, Weapon w, .entity weaponentity);
 
index ba039fc1055baf6655a3bc91724635df4d69281f..e36bc68c62af99b39d543d4811140b9c35cee65a 100644 (file)
@@ -36,7 +36,7 @@ void thrown_wep_think(entity this)
 // returns amount of ammo used, or -1 for failure, or 0 for no ammo count
 float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo, .entity weaponentity)
 {
-       Weapon info = Weapons_from(wpn);
+       Weapon info = REGISTRY_GET(Weapons, wpn);
        int ammotype = info.ammo_type;
 
        entity wep = spawn();
@@ -51,7 +51,7 @@ float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector
 
        W_DropEvent(wr_drop,own,wpn,wep,weaponentity);
 
-       if(WepSet_FromWeapon(Weapons_from(wpn)) & WEPSET_SUPERWEAPONS)
+       if(WepSet_FromWeapon(REGISTRY_GET(Weapons, wpn)) & WEPSET_SUPERWEAPONS)
        {
                Item_SetExpiring(wep, true);
                if(own.items & IT_UNLIMITED_SUPERWEAPONS)
@@ -138,7 +138,7 @@ bool W_IsWeaponThrowable(entity this, int w)
        if (w == WEP_Null.m_id)
                return false;
 
-       return (Weapons_from(w)).weaponthrowable;
+       return (REGISTRY_GET(Weapons, w)).weaponthrowable;
 }
 
 // toss current weapon
index 5f4f6f8332deb1d0b4d171c31a839922b4267bd3..a10274ab6861b620c5d38470daad2f6dc6bf4a0b 100644 (file)
@@ -55,7 +55,7 @@ bool CL_Weaponentity_CustomizeEntityForClient(entity this, entity client)
 
 vector CL_Weapon_GetShotOrg(int wpn)
 {
-       entity wi = Weapons_from(wpn);
+       entity wi = REGISTRY_GET(Weapons, wpn);
        entity e = spawn();
        CL_WeaponEntity_SetModel(e, wi.mdl, false);
        vector ret = e.movedir;
@@ -846,7 +846,7 @@ void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sen
 
 void W_DropEvent(.void(Weapon, entity actor, .entity) event, entity player, float weapon_type, entity weapon_item, .entity weaponentity)
 {
-       Weapon w = Weapons_from(weapon_type);
+       Weapon w = REGISTRY_GET(Weapons, weapon_type);
        weapon_dropevent_item = weapon_item;
        w.event(w, player, weaponentity);
 }