]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/debug.qh
Merge branch 'master' into martin-t/globals
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / debug.qh
index b1dea6dcc431a84c1063d36f567047222c3d530c..05064ca96742c395ab0beb863f6bffb186549867 100644 (file)
@@ -205,8 +205,7 @@ GENERIC_COMMAND(bufstr_get, "Examine a string buffer object")
                {
                        int bufhandle = stof(argv(1));
                        int string_index = stof(argv(2));
-                       string s = bufstr_get(bufhandle, string_index);
-                       LOG_INFOF("%s", s);
+                       LOG_INFO(bufstr_get(bufhandle, string_index));
                        return;
                }
 
@@ -296,7 +295,7 @@ MUTATOR_HOOKFUNCTION(trace, SV_StartFrame)
                        it.solid = SOLID_BBOX;
                });
                vector forward = '0 0 0'; vector right = '0 0 0'; vector up = '0 0 0';
-               MAKEVECTORS(makevectors, it.v_angle, forward, right, up);
+               MAKE_VECTORS(it.v_angle, forward, right, up);
                vector pos = it.origin + it.view_ofs;
                traceline(pos, pos + forward * max_shot_distance, MOVE_NORMAL, it);
                FOREACH_ENTITY(true, {
@@ -407,7 +406,7 @@ CLASS(DebugText3d, Object)
                CONSTRUCT(DebugText3d);
                this.origin = pos;
                this.message = strzone(msg);
-               SetResourceAmount(this, RESOURCE_HEALTH, align);
+               SetResource(this, RES_HEALTH, align);
                this.hit_time = time;
                this.fade_rate = fade_rate_;
                this.velocity = vel;
@@ -427,16 +426,25 @@ CLASS(DebugText3d, Object)
                        return;
                }
 
-               int size = 8;
+               int size = 11;
                vector screen_pos = project_3d_to_2d(this.origin) + since_created * this.velocity;
-               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
+
                screen_pos.z = 0;
+               float align = GetResource(this, RES_HEALTH);
+               string msg;
+               vector msg_pos;
+
+               int n = tokenizebyseparator(this.message, "\n");
+               for(int k = 0; k < n; ++k)
+               {
+                       msg = argv(k);
+                       msg_pos = screen_pos + k * 1.25 * size * eY;
+                       if (align > 0)
+                               msg_pos.x -= stringwidth(msg, true, size * '1 1 0') * min(1, align);
 
-               vector rgb = '1 1 0';
-               drawcolorcodedstring2_builtin(screen_pos, this.message, size * '1 1 0', rgb, alpha_, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring_builtin(msg_pos, msg, size * '1 1 0', alpha_, DRAWFLAG_NORMAL);
+               }
        }
        ATTRIB(DebugText3d, draw2d, void(DebugText3d), DebugText3d_draw2d);
 ENDCLASS(DebugText3d)