]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_draw.c
pr_comp: Add the rest of FTEQW's opcodes
[xonotic/darkplaces.git] / gl_draw.c
index 0b97a28881bc58b9d02d0a1ac89e675fa031d5c3..3de01e19d5c3443f6989a24851d893f1a3b3ef1d 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -782,7 +782,7 @@ qbool r_draw2d_force = false;
 
 void DrawQ_Pic(float x, float y, cachepic_t *pic, float width, float height, float red, float green, float blue, float alpha, int flags)
 {
-       dp_model_t *mod = CL_Mesh_UI();
+       model_t *mod = CL_Mesh_UI();
        msurface_t *surf;
        int e0, e1, e2, e3;
        if (!pic)
@@ -810,7 +810,7 @@ void DrawQ_RotPic(float x, float y, cachepic_t *pic, float width, float height,
        float cosaf = cos(af);
        float sinar = sin(ar);
        float cosar = cos(ar);
-       dp_model_t *mod = CL_Mesh_UI();
+       model_t *mod = CL_Mesh_UI();
        msurface_t *surf;
        int e0, e1, e2, e3;
        if (!pic)
@@ -1095,7 +1095,7 @@ float DrawQ_String_Scale(float startx, float starty, const char *text, size_t ma
        size_t bytes_left;
        float dw, dh;
        const float *width_of;
-       dp_model_t *mod = CL_Mesh_UI();
+       model_t *mod = CL_Mesh_UI();
        msurface_t *surf = NULL;
        int e0, e1, e2, e3;
        int tw, th;
@@ -1384,7 +1384,7 @@ static int DrawQ_BuildColoredText(char *output2c, size_t maxoutchars, const char
 
 void DrawQ_SuperPic(float x, float y, cachepic_t *pic, float width, float height, float s1, float t1, float r1, float g1, float b1, float a1, float s2, float t2, float r2, float g2, float b2, float a2, float s3, float t3, float r3, float g3, float b3, float a3, float s4, float t4, float r4, float g4, float b4, float a4, int flags)
 {
-       dp_model_t *mod = CL_Mesh_UI();
+       model_t *mod = CL_Mesh_UI();
        msurface_t *surf;
        int e0, e1, e2, e3;
        if (!pic)
@@ -1404,9 +1404,9 @@ void DrawQ_SuperPic(float x, float y, cachepic_t *pic, float width, float height
        Mod_Mesh_AddTriangle(mod, surf, e0, e2, e3);
 }
 
-void DrawQ_Line (float width, float x1, float y1, float x2, float y2, float r, float g, float b, float alpha, int flags)
+void DrawQ_Line (float width, float x1, float y1, float x2, float y2, float r, float g, float b, float alpha, int flags, qbool fast)
 {
-       dp_model_t *mod = CL_Mesh_UI();
+       model_t *mod = CL_Mesh_UI();
        msurface_t *surf;
        int e0, e1, e2, e3;
        float offsetx, offsety;
@@ -1422,10 +1422,21 @@ void DrawQ_Line (float width, float x1, float y1, float x2, float y2, float r, f
                offsety = 0;
        }
        surf = Mod_Mesh_AddSurface(mod, Mod_Mesh_GetTexture(mod, "white", 0, 0, MATERIALFLAG_WALL | MATERIALFLAG_VERTEXCOLOR | MATERIALFLAG_ALPHAGEN_VERTEX | MATERIALFLAG_ALPHA | MATERIALFLAG_BLENDED | MATERIALFLAG_NOSHADOW), true);
-       e0 = Mod_Mesh_IndexForVertex(mod, surf, x1 - offsetx, y1 - offsety, 10, 0, 0, -1, 0, 0, 0, 0, r, g, b, alpha);
-       e1 = Mod_Mesh_IndexForVertex(mod, surf, x2 - offsetx, y2 - offsety, 10, 0, 0, -1, 0, 0, 0, 0, r, g, b, alpha);
-       e2 = Mod_Mesh_IndexForVertex(mod, surf, x2 + offsetx, y2 + offsety, 10, 0, 0, -1, 0, 0, 0, 0, r, g, b, alpha);
-       e3 = Mod_Mesh_IndexForVertex(mod, surf, x1 + offsetx, y1 + offsety, 10, 0, 0, -1, 0, 0, 0, 0, r, g, b, alpha);
+       if (fast)
+       {
+               Mod_Mesh_CheckResize_Vertex(mod, surf);
+               e0 = Mod_Mesh_AddVertex(mod, surf, x1 - offsetx, y1 - offsety, 10, 0, 0, -1, 0, 0, 0, 0, r, g, b, alpha);
+               e1 = Mod_Mesh_AddVertex(mod, surf, x2 - offsetx, y2 - offsety, 10, 0, 0, -1, 0, 0, 0, 0, r, g, b, alpha);
+               e2 = Mod_Mesh_AddVertex(mod, surf, x2 + offsetx, y2 + offsety, 10, 0, 0, -1, 0, 0, 0, 0, r, g, b, alpha);
+               e3 = Mod_Mesh_AddVertex(mod, surf, x1 + offsetx, y1 + offsety, 10, 0, 0, -1, 0, 0, 0, 0, r, g, b, alpha);
+       }
+       else
+       {
+               e0 = Mod_Mesh_IndexForVertex(mod, surf, x1 - offsetx, y1 - offsety, 10, 0, 0, -1, 0, 0, 0, 0, r, g, b, alpha);
+               e1 = Mod_Mesh_IndexForVertex(mod, surf, x2 - offsetx, y2 - offsety, 10, 0, 0, -1, 0, 0, 0, 0, r, g, b, alpha);
+               e2 = Mod_Mesh_IndexForVertex(mod, surf, x2 + offsetx, y2 + offsety, 10, 0, 0, -1, 0, 0, 0, 0, r, g, b, alpha);
+               e3 = Mod_Mesh_IndexForVertex(mod, surf, x1 + offsetx, y1 + offsety, 10, 0, 0, -1, 0, 0, 0, 0, r, g, b, alpha);
+       }
        Mod_Mesh_AddTriangle(mod, surf, e0, e1, e2);
        Mod_Mesh_AddTriangle(mod, surf, e0, e2, e3);
 }
@@ -1473,7 +1484,7 @@ void DrawQ_RecalcView(void)
 
 void DrawQ_FlushUI(void)
 {
-       dp_model_t *mod = CL_Mesh_UI();
+       model_t *mod = CL_Mesh_UI();
        if (mod->num_surfaces == 0)
                return;