VM_drawcolorcodedstring, // #326 float drawcolorcodedstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) (EXT_CSQC)
VM_stringwidth, // #327 // FIXME is this okay?
VM_drawsubpic, // #328 // FIXME is this okay?
-NULL, // #329
+VM_drawrotpic, // #329 // FIXME is this okay?
VM_CL_getstatf, // #330 float(float stnum) getstatf (EXT_CSQC)
VM_CL_getstati, // #331 float(float stnum) getstati (EXT_CSQC)
VM_CL_getstats, // #332 string(float firststnum) getstats (EXT_CSQC)
// draw an image (or a filled rectangle if pic == NULL)
void DrawQ_Pic(float x, float y, cachepic_t *pic, float width, float height, float red, float green, float blue, float alpha, int flags);
+// draw a rotated image
+void DrawQ_RotPic(float x, float y, cachepic_t *pic, float width, float height, float org_x, float org_y, float angle, float red, float green, float blue, float alpha, int flags);
// draw a filled rectangle (slightly faster than DrawQ_Pic with pic = NULL)
void DrawQ_Fill(float x, float y, float width, float height, float red, float green, float blue, float alpha, int flags);
// draw a text string,
R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
}
+void DrawQ_RotPic(float x, float y, cachepic_t *pic, float width, float height, float org_x, float org_y, float angle, float red, float green, float blue, float alpha, int flags)
+{
+ float floats[20];
+ float af = DEG2RAD(-angle); // forward
+ float ar = DEG2RAD(-angle + 90); // right
+ float sinaf = sin(af);
+ float cosaf = cos(af);
+ float sinar = sin(ar);
+ float cosar = cos(ar);
+
+ _DrawQ_ProcessDrawFlag(flags);
+ GL_Color(red, green, blue, alpha);
+
+ R_Mesh_VertexPointer(floats, 0, 0);
+ R_Mesh_ColorPointer(NULL, 0, 0);
+ R_Mesh_ResetTextureState();
+ R_SetupGenericShader(pic != NULL);
+ if (pic)
+ {
+ if (width == 0)
+ width = pic->width;
+ if (height == 0)
+ height = pic->height;
+ R_Mesh_TexBind(0, R_GetTexture(pic->tex));
+ R_Mesh_TexCoordPointer(0, 2, floats + 12, 0, 0);
+
+ floats[12] = 0.0f;floats[13] = 0.0f;
+ floats[14] = 1.0f;floats[15] = 0.0f;
+ floats[16] = 1.0f;floats[17] = 1.0f;
+ floats[18] = 0.0f;floats[19] = 1.0f;
+ }
+
+ floats[2] = floats[5] = floats[8] = floats[11] = 0;
+
+// top left
+ floats[0] = x - cosaf*org_x - cosar*org_y;
+ floats[1] = y - sinaf*org_x - sinar*org_y;
+
+// top right
+ floats[3] = x + cosaf*(width-org_x) - cosar*org_y;
+ floats[4] = y + sinaf*(width-org_x) - sinar*org_y;
+
+// bottom right
+ floats[6] = x + cosaf*(width-org_x) + cosar*(height-org_y);
+ floats[7] = y + sinaf*(width-org_x) + sinar*(height-org_y);
+
+// bottom left
+ floats[9] = x - cosaf*org_x + cosar*(height-org_y);
+ floats[10] = y - sinaf*org_x + sinar*(height-org_y);
+
+ R_Mesh_Draw(0, 4, 0, 2, NULL, polygonelements, 0, 0);
+}
+
void DrawQ_Fill(float x, float y, float width, float height, float red, float green, float blue, float alpha, int flags)
{
float floats[12];
VM_drawcolorcodedstring, // #467
VM_stringwidth, // #468
VM_drawsubpic, // #469
-NULL, // #470
+VM_drawrotpic, // #470
VM_asin, // #471 float(float s) VM_asin (DP_QC_ASINACOSATANATAN2TAN)
VM_acos, // #472 float(float c) VM_acos (DP_QC_ASINACOSATANATAN2TAN)
VM_atan, // #473 float(float t) VM_atan (DP_QC_ASINACOSATANATAN2TAN)
}
/*
=========
+VM_drawrotpic
+
+float drawrotpic(vector position, string pic, vector size, vector org, float angle, vector rgb, float alpha, float flag)
+=========
+*/
+void VM_drawrotpic(void)
+{
+ const char *picname;
+ float *size, *pos, *org, *rgb;
+ int flag;
+
+ VM_SAFEPARMCOUNT(8,VM_drawrotpic);
+
+ picname = PRVM_G_STRING(OFS_PARM1);
+ VM_CheckEmptyString (picname);
+
+ // is pic cached ? no function yet for that
+ if(!1)
+ {
+ PRVM_G_FLOAT(OFS_RETURN) = -4;
+ VM_Warning("VM_drawrotpic: %s: %s not cached !\n", PRVM_NAME, picname);
+ return;
+ }
+
+ pos = PRVM_G_VECTOR(OFS_PARM0);
+ size = PRVM_G_VECTOR(OFS_PARM2);
+ org = PRVM_G_VECTOR(OFS_PARM3);
+ rgb = PRVM_G_VECTOR(OFS_PARM5);
+ flag = (int) PRVM_G_FLOAT(OFS_PARM7);
+
+ if(flag < DRAWFLAG_NORMAL || flag >=DRAWFLAG_NUMFLAGS)
+ {
+ PRVM_G_FLOAT(OFS_RETURN) = -2;
+ VM_Warning("VM_drawrotpic: %s: wrong DRAWFLAG %i !\n",PRVM_NAME,flag);
+ return;
+ }
+
+ if(pos[2] || size[2] || org[2])
+ Con_Printf("VM_drawrotpic: z value from pos/size/org discarded\n");
+
+ DrawQ_RotPic(pos[0], pos[1], Draw_CachePic(picname), size[0], size[1], org[0], org[1], PRVM_G_FLOAT(OFS_PARM4), rgb[0], rgb[1], rgb[2], PRVM_G_FLOAT(OFS_PARM6), flag);
+ PRVM_G_FLOAT(OFS_RETURN) = 1;
+}
+/*
+=========
VM_drawsubpic
float drawsubpic(vector position, vector size, string pic, vector srcPos, vector srcSize, vector rgb, float alpha, float flag)
void VM_drawcolorcodedstring(void);
void VM_stringwidth(void);
void VM_drawpic(void);
+void VM_drawrotpic(void);
void VM_drawsubpic(void);
void VM_drawfill(void);
void VM_drawsetcliparea(void);