]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/all.qc
Merge branch 'master' into TimePath/csqc_viewmodels
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / all.qc
index 11f0414e63d9b13b1957273ef51cebbfdd16ba21..177d12c2d36d54e221be9ef5aec6145c09e2f5ea 100644 (file)
@@ -277,18 +277,7 @@ string GetAmmoPicture(.int ammotype)
 
 string W_Sound(string w_snd)
 {
-       #define extensions(X) X(wav) X(ogg)
-       #define tryext(ext) { if (fexists(strcat("sound/", output = strcat("weapons/", w_snd, "." #ext)))) break; }
-       string output;
-       do
-       {
-               extensions(tryext);
-#undef tryext
-#undef extensions
-               output = strcat("weapons/", w_snd);
-       }
-       while (0);
-
+       string output = strcat("weapons/", w_snd);
 #ifdef SVQC
                MUTATOR_CALLHOOK(WeaponSound, w_snd, output);
                return weapon_sound_output;
@@ -582,8 +571,9 @@ void CL_WeaponEntity_SetModel(entity this, string name)
 
 #ifndef MENUQC
 
-REGISTER_NET_TEMP(wframe, bool isNew)
+REGISTER_NET_TEMP(wframe)
 #ifdef CSQC
+NET_HANDLE(wframe, bool isNew)
 {
        vector a;
        a.x = ReadCoord();
@@ -592,11 +582,13 @@ REGISTER_NET_TEMP(wframe, bool isNew)
        bool restartanim = ReadByte();
        setanim(viewmodel, a, restartanim == false, restartanim, restartanim);
        viewmodel.state = ReadByte();
+       viewmodel.alpha = ReadByte() / 255;
+       return true;
 }
 #endif
 
 #ifdef SVQC
-void wframe_send(entity actor, .entity weaponentity, vector a, bool restartanim)
+void wframe_send(entity actor, entity weaponentity, vector a, bool restartanim)
 {
        if (!IS_REAL_CLIENT(actor)) return;
        int channel = MSG_ONE;
@@ -606,7 +598,34 @@ void wframe_send(entity actor, .entity weaponentity, vector a, bool restartanim)
        WriteCoord(channel, a.y);
        WriteCoord(channel, a.z);
        WriteByte(channel, restartanim);
-       WriteByte(channel, actor.(weaponentity).state);
+       WriteByte(channel, weaponentity.state);
+       WriteByte(channel, weaponentity.alpha * 255);
+}
+#endif
+
+REGISTER_NET_TEMP(wglow)
+#ifdef CSQC
+NET_HANDLE(wglow, bool isNew)
+{
+       vector g = '0 0 0';
+       g.x = ReadCoord();
+       g.y = ReadCoord();
+       g.z = ReadCoord();
+       viewmodel.glowmod = g;
+       return true;
+}
+#endif
+
+#ifdef SVQC
+void wglow_send(entity actor, vector g)
+{
+       if (!IS_REAL_CLIENT(actor)) return;
+       int channel = MSG_ONE;
+       msg_entity = actor;
+       WriteHeader(channel, wglow);
+       WriteCoord(channel, g.x);
+       WriteCoord(channel, g.y);
+       WriteCoord(channel, g.z);
 }
 #endif