]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/effects/effectinfo.qc
Merge branch 'master' into Mario/csqc_muzzleflash
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / effects / effectinfo.qc
index a1b27873053917e1ba6613d9939bc36d39f0395d..1e23bb46fbf9943547b66d76a7f81939967f1917 100644 (file)
@@ -1,3 +1,5 @@
+#if ENABLE_EFFECTINFO
+
 #include "effectinfo.qh"
 #define EFFECTINFO_PARSER(on, MY) \
     on(type,                                        MY(type) \
@@ -263,21 +265,19 @@ void effectinfo_read()
 
 void effectinfo_dump(int fh, bool alsoprint)
 {
-    #define WRITE(s) MACRO_BEGIN { \
-        fputs(fh, s); \
-        if (alsoprint) LOG_INFO(s); \
-    } MACRO_END
-    WRITE("// ********************************************** //\n");
-    WRITE("// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n");
-    WRITE("// **                                          ** //\n");
-    WRITE("// **  This file is automatically generated by ** //\n");
-    WRITE("// **  code with the command 'dumpeffectinfo'. ** //\n");
-    WRITE("// **                                          ** //\n");
-    WRITE("// **  If you modify an effect, please         ** //\n");
-    WRITE("// **  regenerate this file with that command. ** //\n");
-    WRITE("// **                                          ** //\n");
-    WRITE("// ********************************************** //\n");
-    WRITE("\n");
+       #define WRITE(str) write_String_To_File(fh, str, alsoprint)
+       WRITE(
+               "// ********************************************** //\n"
+               "// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n"
+               "// **                                          ** //\n"
+               "// **  This file is automatically generated by ** //\n"
+               "// **  code with the command 'dumpeffectinfo'. ** //\n"
+               "// **                                          ** //\n"
+               "// **  If you modify an effect, please         ** //\n"
+               "// **  regenerate this file with that command. ** //\n"
+               "// **                                          ** //\n"
+               "// ********************************************** //\n"
+               "\n");
 
     for (EffectInfo it = NULL; (it = findfloat(it, instanceOfEffectInfo, true)); ) {
         if (it.classname == "vtbl") continue;
@@ -287,7 +287,7 @@ void effectinfo_dump(int fh, bool alsoprint)
     #undef WRITE
 }
 
-GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt")
+GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt", false)
 {
     switch (request) {
         case CMD_REQUEST_COMMAND: {
@@ -313,10 +313,10 @@ GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt")
         }
         default:
         case CMD_REQUEST_USAGE: {
-            LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpeffectinfo [filename]");
-            LOG_INFO("  Where 'filename' is the file to write (default is effectinfo_dump.txt),");
-            LOG_INFO("  if supplied with '-' output to console as well as default,");
-            LOG_INFO("  if left blank, it will only write to default.");
+            LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " dumpeffectinfo [filename]");
+            LOG_HELP("  Where 'filename' is the file to write (default is effectinfo_dump.txt),");
+            LOG_HELP("  if supplied with '-' output to console as well as default,");
+            LOG_HELP("  if left blank, it will only write to default.");
             return;
         }
     }
@@ -324,8 +324,9 @@ GENERIC_COMMAND(dumpeffectinfo, "Dump all effectinfo to effectinfo_dump.txt")
 
 
 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)) { \
@@ -341,3 +342,5 @@ REGISTER_REGISTRY(EffectInfos)
 #undef MY
 #undef DEF
 #undef SUB
+
+#endif