From: Samual Lenks Date: Mon, 1 Jul 2013 01:02:00 +0000 (-0400) Subject: Clean up some more macros (sort of :D) X-Git-Tag: xonotic-v0.8.0~152^2~354 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5fe7633e6f4c366ff469f0da02fc63a1e1a2c835;p=xonotic%2Fxonotic-data.pk3dir.git Clean up some more macros (sort of :D) --- diff --git a/qcsrc/common/weapons/config.qc b/qcsrc/common/weapons/config.qc index 47bfe2e21..078224365 100644 --- a/qcsrc/common/weapons/config.qc +++ b/qcsrc/common/weapons/config.qc @@ -42,10 +42,10 @@ void Dump_Weapon_Settings(void) heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, world); // step 4: write queue - WEP_CONFIG_WRITE(sprintf("// {{{ #%d: %s\n// %d settings\n", i, W_Name(i), WEP_CONFIG_COUNT)) + WEP_CONFIG_WRITETOFILE(sprintf("// {{{ #%d: %s\n// %d settings\n", i, W_Name(i), WEP_CONFIG_COUNT)) for(x = 0; x <= WEP_CONFIG_COUNT; ++x) - { WEP_CONFIG_WRITE(wep_config_queue[x]) } - WEP_CONFIG_WRITE("// }}}\n") + { WEP_CONFIG_WRITETOFILE(wep_config_queue[x]) } + WEP_CONFIG_WRITETOFILE("// }}}\n") } } /* diff --git a/qcsrc/common/weapons/config.qh b/qcsrc/common/weapons/config.qh index b2dd89f39..12ce34078 100644 --- a/qcsrc/common/weapons/config.qh +++ b/qcsrc/common/weapons/config.qh @@ -14,7 +14,7 @@ string wep_config_queue[MAX_WEP_CONFIG]; wep_config_queue[WEP_CONFIG_COUNT] = a; \ ++WEP_CONFIG_COUNT; } -#define WEP_CONFIG_WRITE(a) { \ +#define WEP_CONFIG_WRITETOFILE(a) { \ fputs(wep_config_file, a); \ if(wep_config_alsoprint) { print(a); } } @@ -55,3 +55,10 @@ string wep_config_queue[MAX_WEP_CONFIG]; #weapon, \ #name, \ autocvar_g_balance_##weapon##_##name)) } + +#define WEP_CONFIG_SETTINGS(wepsettings) \ + #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) \ + #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) \ + wepsettings \ + #undef WEP_ADD_CVAR \ + #undef WEP_ADD_PROP diff --git a/qcsrc/common/weapons/w_arc.qc b/qcsrc/common/weapons/w_arc.qc index 10c7c262e..f7944ae0d 100644 --- a/qcsrc/common/weapons/w_arc.qc +++ b/qcsrc/common/weapons/w_arc.qc @@ -264,11 +264,7 @@ float w_arc(float req) } case WR_CONFIG: { - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) - ARC_SETTINGS(arc) - #undef WEP_ADD_CVAR - #undef WEP_ADD_PROP + WEP_CONFIG_SETTINGS(ARC_SETTINGS(arc)) return TRUE; } case WR_KILLMESSAGE: diff --git a/qcsrc/common/weapons/w_crylink.qc b/qcsrc/common/weapons/w_crylink.qc index 443362cb8..e12fae8ad 100644 --- a/qcsrc/common/weapons/w_crylink.qc +++ b/qcsrc/common/weapons/w_crylink.qc @@ -670,11 +670,7 @@ float w_crylink(float req) } case WR_CONFIG: { - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) - CRYLINK_SETTINGS(crylink) - #undef WEP_ADD_CVAR - #undef WEP_ADD_PROP + WEP_CONFIG_SETTINGS(CRYLINK_SETTINGS(crylink)) return TRUE; } case WR_RELOAD: diff --git a/qcsrc/common/weapons/w_devastator.qc b/qcsrc/common/weapons/w_devastator.qc index 4bee14be9..12d7cdb83 100644 --- a/qcsrc/common/weapons/w_devastator.qc +++ b/qcsrc/common/weapons/w_devastator.qc @@ -503,11 +503,7 @@ float W_Devastator(float req) } case WR_CONFIG: { - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) - DEVASTATOR_SETTINGS(devastator) - #undef WEP_ADD_CVAR - #undef WEP_ADD_PROP + WEP_CONFIG_SETTINGS(DEVASTATOR_SETTINGS(devastator)) return TRUE; } case WR_RESETPLAYER: diff --git a/qcsrc/common/weapons/w_fireball.qc b/qcsrc/common/weapons/w_fireball.qc index f2a558fc2..19879ac86 100644 --- a/qcsrc/common/weapons/w_fireball.qc +++ b/qcsrc/common/weapons/w_fireball.qc @@ -416,11 +416,7 @@ float w_fireball(float req) } case WR_CONFIG: { - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) - FIREBALL_SETTINGS(fireball) - #undef WEP_ADD_CVAR - #undef WEP_ADD_PROP + WEP_CONFIG_SETTINGS(FIREBALL_SETTINGS(fireball)) return TRUE; } case WR_RESETPLAYER: diff --git a/qcsrc/common/weapons/w_hagar.qc b/qcsrc/common/weapons/w_hagar.qc index fe183e606..711f5b531 100644 --- a/qcsrc/common/weapons/w_hagar.qc +++ b/qcsrc/common/weapons/w_hagar.qc @@ -477,11 +477,7 @@ float w_hagar(float req) } case WR_CONFIG: { - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) - HAGAR_SETTINGS(hagar) - #undef WEP_ADD_CVAR - #undef WEP_ADD_PROP + WEP_CONFIG_SETTINGS(HAGAR_SETTINGS(hagar)) return TRUE; } case WR_RESETPLAYER: diff --git a/qcsrc/common/weapons/w_hook.qc b/qcsrc/common/weapons/w_hook.qc index 6d4c39fee..4c277069d 100644 --- a/qcsrc/common/weapons/w_hook.qc +++ b/qcsrc/common/weapons/w_hook.qc @@ -313,11 +313,7 @@ float w_hook(float req) } case WR_CONFIG: { - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) - HOOK_SETTINGS(hook) - #undef WEP_ADD_CVAR - #undef WEP_ADD_PROP + WEP_CONFIG_SETTINGS(HOOK_SETTINGS(hook)) return TRUE; } case WR_RESETPLAYER: diff --git a/qcsrc/common/weapons/w_machinegun.qc b/qcsrc/common/weapons/w_machinegun.qc index cc12a99ce..d84c2b14d 100644 --- a/qcsrc/common/weapons/w_machinegun.qc +++ b/qcsrc/common/weapons/w_machinegun.qc @@ -351,11 +351,7 @@ float w_uzi(float req) } case WR_CONFIG: { - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) - UZI_SETTINGS(uzi) - #undef WEP_ADD_CVAR - #undef WEP_ADD_PROP + WEP_CONFIG_SETTINGS(UZI_SETTINGS(uzi)) return TRUE; } case WR_RELOAD: diff --git a/qcsrc/common/weapons/w_minelayer.qc b/qcsrc/common/weapons/w_minelayer.qc index 931d599dc..811d18fa4 100644 --- a/qcsrc/common/weapons/w_minelayer.qc +++ b/qcsrc/common/weapons/w_minelayer.qc @@ -565,11 +565,7 @@ float w_minelayer(float req) } case WR_CONFIG: { - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) - MINELAYER_SETTINGS(minelayer) - #undef WEP_ADD_CVAR - #undef WEP_ADD_PROP + WEP_CONFIG_SETTINGS(MINELAYER_SETTINGS(minelayer)) return TRUE; } case WR_RESETPLAYER: diff --git a/qcsrc/common/weapons/w_mortar.qc b/qcsrc/common/weapons/w_mortar.qc index 9fcefa174..73e3c2210 100644 --- a/qcsrc/common/weapons/w_mortar.qc +++ b/qcsrc/common/weapons/w_mortar.qc @@ -414,11 +414,7 @@ float w_glauncher(float req) } case WR_CONFIG: { - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) - MORTAR_SETTINGS(mortar) - #undef WEP_ADD_CVAR - #undef WEP_ADD_PROP + WEP_CONFIG_SETTINGS(MORTAR_SETTINGS(mortar)) return TRUE; } case WR_RELOAD: diff --git a/qcsrc/common/weapons/w_nex.qc b/qcsrc/common/weapons/w_nex.qc index dcabbc586..44bf35926 100644 --- a/qcsrc/common/weapons/w_nex.qc +++ b/qcsrc/common/weapons/w_nex.qc @@ -276,11 +276,7 @@ float w_nex(float req) } case WR_CONFIG: { - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) - NEX_SETTINGS(nex) - #undef WEP_ADD_CVAR - #undef WEP_ADD_PROP + WEP_CONFIG_SETTINGS(NEX_SETTINGS(nex)) return TRUE; } case WR_RELOAD: diff --git a/qcsrc/common/weapons/w_porto.qc b/qcsrc/common/weapons/w_porto.qc index a0eb6cc0e..6706266d1 100644 --- a/qcsrc/common/weapons/w_porto.qc +++ b/qcsrc/common/weapons/w_porto.qc @@ -299,11 +299,7 @@ float w_porto(float req) } case WR_CONFIG: { - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) - PORTO_SETTINGS(porto) - #undef WEP_ADD_CVAR - #undef WEP_ADD_PROP + WEP_CONFIG_SETTINGS(PORTO_SETTINGS(porto)) return TRUE; } case WR_THINK: diff --git a/qcsrc/common/weapons/w_rifle.qc b/qcsrc/common/weapons/w_rifle.qc index a7c7e262e..404a1f0b2 100644 --- a/qcsrc/common/weapons/w_rifle.qc +++ b/qcsrc/common/weapons/w_rifle.qc @@ -232,11 +232,7 @@ float w_rifle(float req) } case WR_CONFIG: { - #define WEP_ADD_CVAR(weapon,mode,name) WEP_CONFIG_WRITE_CVARS(weapon,mode,name) - #define WEP_ADD_PROP(weapon,prop,name) WEP_CONFIG_WRITE_PROPS(weapon,prop,name) - RIFLE_SETTINGS(rifle) - #undef WEP_ADD_CVAR - #undef WEP_ADD_PROP + WEP_CONFIG_SETTINGS(RIFLE_SETTINGS(rifle)) return TRUE; } case WR_RESETPLAYER: