]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement detection of items (%x) in formatmessage making use of an existing function...
authorterencehill <piuntn@gmail.com>
Mon, 6 Aug 2018 06:57:39 +0000 (08:57 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 6 Aug 2018 13:12:12 +0000 (15:12 +0200)
qcsrc/server/miscfunctions.qc
qcsrc/server/miscfunctions.qh

index 11d7a8b5c04e12f8e42d2ec5603ce4120ba85bd0..444427784a549b65fe5985dd799842803dc828ac 100644 (file)
@@ -42,6 +42,16 @@ void crosshair_trace(entity pl)
 }
 
 void crosshair_trace_plusvisibletriggers(entity pl)
+{
+       crosshair_trace_plusvisibletriggers__is_wz(pl, false);
+}
+
+void WarpZone_crosshair_trace_plusvisibletriggers(entity pl)
+{
+       crosshair_trace_plusvisibletriggers__is_wz(pl, true);
+}
+
+void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz)
 {
        FOREACH_ENTITY_FLOAT(solid, SOLID_TRIGGER,
        {
@@ -52,7 +62,10 @@ void crosshair_trace_plusvisibletriggers(entity pl)
                }
        });
 
-       crosshair_trace(pl);
+       if (is_wz)
+               WarpZone_crosshair_trace(pl);
+       else
+               crosshair_trace(pl);
 
        IL_EACH(g_ctrace_changed, true, { it.solid = SOLID_TRIGGER; });
 
@@ -215,7 +228,6 @@ string AmmoNameFromWeaponentity(Weapon wep)
        return ammoitems;
 }
 
-.int solid_prev;
 string formatmessage(entity this, string msg)
 {
        float p, p1, p2;
@@ -252,17 +264,7 @@ string formatmessage(entity this, string msg)
 
                if(!traced)
                {
-                       IL_EACH(g_items, true,
-                       {
-                               it.solid_prev = it.solid;
-                               it.solid = SOLID_BSP;
-                       });
-                       WarpZone_crosshair_trace(this);
-                       IL_EACH(g_items, true,
-                       {
-                               it.solid = it.solid_prev;
-                               it.solid_prev = 0;
-                       });
+                       WarpZone_crosshair_trace_plusvisibletriggers(this);
                        cursor = trace_endpos;
                        cursor_ent = trace_ent;
                        traced = true;
index 1455054d2c5cad597ec87e84412d45b74ea6dc00..fc1fd5bd12995afb44840d79c67c8029c0b7fd42 100644 (file)
@@ -62,6 +62,8 @@ void attach_sameorigin(entity e, entity to, string tag);
 void crosshair_trace(entity pl);
 
 void crosshair_trace_plusvisibletriggers(entity pl);
+void WarpZone_crosshair_trace_plusvisibletriggers(entity pl);
+void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz);
 
 void detach_sameorigin(entity e);