]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/debug.qh
Merge branch 'master' into martin-t/dmgtext
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / debug.qh
index 936f1e028857e121d97fcdc985af76011bde90e3..b1dea6dcc431a84c1063d36f567047222c3d530c 100644 (file)
@@ -1,5 +1,9 @@
 #pragma once
 
+#ifdef CSQC
+#include <client/resources.qh>
+#endif
+
 
 // This includes some functions useful for debugging.
 // Some more bot-specific ones are in server/pathlib/debug.qc.
@@ -288,7 +292,7 @@ MUTATOR_HOOKFUNCTION(trace, SV_StartFrame)
                it.debug_trace_button = btn;
                if (!btn || skip) continue;
                FOREACH_ENTITY(true, {
-                   it.solid_prev = it.solid;
+                       it.solid_prev = it.solid;
                        it.solid = SOLID_BBOX;
                });
                vector forward = '0 0 0'; vector right = '0 0 0'; vector up = '0 0 0';
@@ -296,8 +300,8 @@ MUTATOR_HOOKFUNCTION(trace, SV_StartFrame)
                vector pos = it.origin + it.view_ofs;
                traceline(pos, pos + forward * max_shot_distance, MOVE_NORMAL, it);
                FOREACH_ENTITY(true, {
-                   it.solid = it.solid_prev;
-            it.solid_prev = 0;
+                       it.solid = it.solid_prev;
+                       it.solid_prev = 0;
                });
                entity e = trace_ent;
                int i = etof(e);
@@ -403,7 +407,7 @@ CLASS(DebugText3d, Object)
                CONSTRUCT(DebugText3d);
                this.origin = pos;
                this.message = strzone(msg);
-               this.health = align;
+               SetResourceAmount(this, RESOURCE_HEALTH, align);
                this.hit_time = time;
                this.fade_rate = fade_rate_;
                this.velocity = vel;
@@ -411,7 +415,7 @@ CLASS(DebugText3d, Object)
        }
 
        DESTRUCTOR(DebugText3d) {
-               strunzone(this.message);
+               strfree(this.message);
        }
 
        void DebugText3d_draw2d(DebugText3d this) {
@@ -425,7 +429,7 @@ CLASS(DebugText3d, Object)
 
                int size = 8;
                vector screen_pos = project_3d_to_2d(this.origin) + since_created * this.velocity;
-               float align = this.health;
+               float align = GetResourceAmount(this, RESOURCE_HEALTH);
                if (align > 0)
                        screen_pos.x -= stringwidth(this.message, true, size * '1 1 0') * min(1, align);
                if (screen_pos.z < 0) return; // behind camera