if(filename == "")
{
- filename = "notifications.cfg";
+ filename = "notifications_dump.cfg";
alsoprint = FALSE;
}
else if(filename == "-")
{
- filename = "notifications.cfg";
+ filename = "notifications_dump.cfg";
alsoprint = TRUE;
}
fh = fopen(filename, FILE_WRITE);
case CMD_REQUEST_USAGE:
{
print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [filename]"));
- print(" Where 'filename' is the file to write (default is notifications.cfg),\n");
+ print(" Where 'filename' is the file to write (default is notifications_dump.cfg),\n");
+ print(" if supplied with '-' output to console as well as default,\n");
+ print(" if left blank, it will only write to default.\n");
+ return;
+ }
+ }
+}
+
+void GenericCommand_dumpweapons(float request) // WEAPONTODO: make this work with other progs than just server
+{
+ switch(request)
+ {
+ case CMD_REQUEST_COMMAND:
+ {
+ #ifdef SVQC
+ wep_config_file = -1;
+ wep_config_alsoprint = -1;
+ string filename = argv(1);
+
+ if(filename == "")
+ {
+ filename = "weapons_dump.cfg";
+ wep_config_alsoprint = FALSE;
+ }
+ else if(filename == "-")
+ {
+ filename = "weapons_dump.cfg";
+ wep_config_alsoprint = TRUE;
+ }
+ wep_config_file = fopen(filename, FILE_WRITE);
+
+ if(wep_config_file >= 0)
+ {
+ Dump_Weapon_Settings();
+ print(sprintf("Dumping weapons... File located in ^2data/data/%s^7.\n", filename));
+ fclose(wep_config_file);
+ wep_config_file = -1;
+ wep_config_alsoprint = -1;
+ }
+ else
+ {
+ print(sprintf("^1Error: ^7Could not open file '%s'!\n", filename));
+ }
+ #else
+ print(_("Weapons dump command only works with sv_cmd.\n"));
+ #endif
+ return;
+ }
+
+ default:
+ case CMD_REQUEST_USAGE:
+ {
+ print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpweapons [filename]"));
+ print(" Where 'filename' is the file to write (default is weapons_dump.cfg),\n");
print(" if supplied with '-' output to console as well as default,\n");
print(" if left blank, it will only write to default.\n");
return;
GENERIC_COMMAND("addtolist", GenericCommand_addtolist(request, arguments), "Add a string to a cvar") \
GENERIC_COMMAND("dumpcommands", GenericCommand_dumpcommands(request), "Dump all commands on the program to *_cmd_dump.txt") \
GENERIC_COMMAND("dumpnotifs", GenericCommand_dumpnotifs(request), "Dump all notifications into notifications_dump.txt") \
+ GENERIC_COMMAND("dumpweapons", GenericCommand_dumpweapons(request), "Dump all weapons into weapons_dump.txt") \
GENERIC_COMMAND("maplist", GenericCommand_maplist(request, arguments), "Automatic control of maplist") \
GENERIC_COMMAND("nextframe", GenericCommand_nextframe(request, arguments, command), "Execute the given command next frame of this VM") \
GENERIC_COMMAND("qc_curl", GenericCommand_qc_curl(request, arguments), "Queries a URL") \
// Balance Config Generator
// ==========================
-void Dump_Weapon_Settings(float fh, float alsoprint)
+void Dump_Weapon_Settings(void)
{
float i;
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
{
- WEP_ACTION(i, WR_CONFIG)
+ WEP_CONFIG_WRITE(sprintf("// {{{ #%d: %s\n", i, W_Name(i)))
+ WEP_ACTION(i, WR_CONFIG);
+ WEP_CONFIG_WRITE("// }}}\n")
}
-
+}
/*
#define WEP_BAL_WRITE(a) { \
fputs(fh, a); \
return;
#undef NOTIF_WRITE_HARDCODED
#undef NOTIF_WRITE_ENTITY
- #undef NOTIF_WRITE*/
-}
+ #undef NOTIF_WRITE
+}*/
// Balance Config Generator
// ==========================
-void Dump_Weapon_Settings(float fh, float alsoprint);
+void Dump_Weapon_Settings(void);
float wep_config_file;
float wep_config_alsoprint;
#define WEP_CONFIG_WRITE_CVARS(weapon,mode,name) \
#if mode == MO_PRI \
- WEP_CONFIG_WRITE(sprintf("set g_balance_%s_primary_%s", #weapon, #name)) \
+ { WEP_CONFIG_WRITE(sprintf( \
+ "set g_balance_%s_primary_%s %f\n", \
+ #weapon, \
+ #name, \
+ autocvar_g_balance_##weapon##_primary_##name)) } \
#endif \
#if mode == MO_SEC \
- WEP_CONFIG_WRITE(sprintf("set g_balance_%s_secondary_%s", #weapon, #name)) \
+ { WEP_CONFIG_WRITE(sprintf("set g_balance_%s_secondary_%s %f\n", \
+ #weapon, \
+ #name, \
+ autocvar_g_balance_##weapon##_secondary_##name)) } \
#endif \
#if mode == MO_BOTH \
- WEP_CONFIG_WRITE(sprintf("set g_balance_%s_primary_%s", #weapon, #name)) \
- WEP_CONFIG_WRITE(sprintf("set g_balance_%s_secondary_%s", #weapon, #name)) \
+ { WEP_CONFIG_WRITE(sprintf("set g_balance_%s_primary_%s %f\n", \
+ #weapon, \
+ #name, \
+ autocvar_g_balance_##weapon##_primary_##name)) } \
+ { WEP_CONFIG_WRITE(sprintf("set g_balance_%s_secondary_%s %f\n", \
+ #weapon, \
+ #name, \
+ autocvar_g_balance_##weapon##_secondary_##name)) } \
#endif \
#if mode == MO_NONE \
- WEP_CONFIG_WRITE(sprintf("set g_balance_%s_%s", #weapon, #name)) \
+ { WEP_CONFIG_WRITE(sprintf("set g_balance_%s_%s %f\n", \
+ #weapon, \
+ #name, \
+ autocvar_g_balance_##weapon##_##name)) } \
#endif
#define WEP_CONFIG_WRITE_PROPS(weapon,prop,name) \
- { WEP_CONFIG_WRITE(sprintf("set g_balance_%s_%s", #weapon, #name)) }
+ { WEP_CONFIG_WRITE(sprintf("set g_balance_%s_%s %f\n", \
+ #weapon, \
+ #name, \
+ autocvar_g_balance_##weapon##_##name)) }
float ammo_amount;
switch(req)
{
- case WR_AIM:
+ case WR_AIM: // WEAPONTODO: rewrite this, it's WAY too complicated for what it should be
{
// aim and decide to fire if appropriate
self.BUTTON_ATCK = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), FALSE);
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,mode,name)
- ARC_SETTINGS(devastator)
+ #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
return TRUE;
weapons/main.qc
weapons/common.qc
weapons/csqcprojectile.qc // TODO
+../common/weapons/config.qc
../common/weapons/weapons.qc // TODO
t_items.qc