]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/all.qh
Merge branch 'master' into Mario/csqc_muzzleflash
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / all.qh
index e82dce3da57d68d273f5b292ae4a46afb32a1867..d02a496e8175f4d7a8b7fb1c537b6520219dcc0b 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)); }
 
@@ -82,10 +81,10 @@ GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt", false) //
         default:
         case CMD_REQUEST_USAGE:
         {
-            LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpweapons [filename]");
-            LOG_INFO("  Where 'filename' is the file to write (default is weapons_dump.cfg),");
-            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(), " dumpweapons [filename]");
+            LOG_HELP("  Where 'filename' is the file to write (default is weapons_dump.cfg),");
+            LOG_HELP("  if supplied with '-' output to console as well as default,");
+            LOG_HELP("  if left blank, it will only write to default.");
             return;
         }
     }
@@ -126,8 +125,9 @@ 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)
+Weapon Weapon_from_name(string s)
 {
     FOREACH(Weapons, it != WEP_Null && it.netname == s, return it);
     return WEP_Null;
@@ -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));
 }
@@ -394,4 +394,8 @@ REPLICATE(cvar_cl_accuracy_data_receive, bool, "cl_accuracy_data_receive");
 #ifdef SVQC
 void wframe_send(entity actor, entity weaponentity, int wepframe, float attackrate, bool restartanim);
 #endif
+
+#ifdef SVQC
+void W_MuzzleFlash(entity actor, .entity weaponentity, entity eff, vector shotorg, vector shotdir);
+#endif
 #endif