4 static byte menuplyr_pixels[4096];
6 void CL_Screen_Init(void)
11 // load the image data for the player image in the config menu
12 dat = (qpic_t *)COM_LoadFile ("gfx/menuplyr.lmp", false);
14 Sys_Error("unable to load gfx/menuplyr.lmp");
17 if (dat->width*dat->height <= 4096)
18 memcpy (menuplyr_pixels, dat->data, dat->width * dat->height);
20 Con_Printf("gfx/menuplyr.lmp larger than 4k buffer");
24 void DrawQ_Clear(void)
26 r_refdef.drawqueuesize = 0;
29 void DrawQ_Pic(float x, float y, char *picname, float width, float height, float red, float green, float blue, float alpha, int flags)
33 if (alpha < (1.0f / 255.0f))
35 size = sizeof(*dq) + ((strlen(picname) + 1 + 3) & ~3);
36 if (r_refdef.drawqueuesize + size > MAX_DRAWQUEUE)
38 red = bound(0, red, 1);
39 green = bound(0, green, 1);
40 blue = bound(0, blue, 1);
41 alpha = bound(0, alpha, 1);
42 dq = (void *)(r_refdef.drawqueue + r_refdef.drawqueuesize);
44 dq->command = DRAWQUEUE_PIC;
46 dq->color = ((unsigned int) (red * 255.0f) << 24) | ((unsigned int) (green * 255.0f) << 16) | ((unsigned int) (blue * 255.0f) << 8) | ((unsigned int) (alpha * 255.0f));
49 // if these are not zero, they override the pic's size
52 strcpy((char *)(dq + 1), picname);
53 r_refdef.drawqueuesize += dq->size;
56 void DrawQ_String(float x, float y, char *string, int maxlen, float scalex, float scaley, float red, float green, float blue, float alpha, int flags)
61 if (alpha < (1.0f / 255.0f))
66 for (len = 0;len < maxlen && string[len];len++);
67 for (;len > 0 && string[0] == ' ';string++, x += scalex, len--);
68 for (;len > 0 && string[len - 1] == ' ';len--);
71 if (x >= vid.conwidth || y >= vid.conheight || x < (-scalex * maxlen) || y < (-scaley))
73 size = sizeof(*dq) + ((len + 1 + 3) & ~3);
74 if (r_refdef.drawqueuesize + size > MAX_DRAWQUEUE)
76 red = bound(0, red, 1);
77 green = bound(0, green, 1);
78 blue = bound(0, blue, 1);
79 alpha = bound(0, alpha, 1);
80 dq = (void *)(r_refdef.drawqueue + r_refdef.drawqueuesize);
82 dq->command = DRAWQUEUE_STRING;
84 dq->color = ((unsigned int) (red * 255.0f) << 24) | ((unsigned int) (green * 255.0f) << 16) | ((unsigned int) (blue * 255.0f) << 8) | ((unsigned int) (alpha * 255.0f));
89 out = (char *)(dq + 1);
90 memcpy(out, string, len);
92 r_refdef.drawqueuesize += dq->size;
95 void DrawQ_Fill (float x, float y, float w, float h, float red, float green, float blue, float alpha, int flags)
99 if (alpha < (1.0f / 255.0f))
101 size = sizeof(*dq) + 4;
102 if (r_refdef.drawqueuesize + size > MAX_DRAWQUEUE)
104 red = bound(0, red, 1);
105 green = bound(0, green, 1);
106 blue = bound(0, blue, 1);
107 alpha = bound(0, alpha, 1);
108 dq = (void *)(r_refdef.drawqueue + r_refdef.drawqueuesize);
110 dq->command = DRAWQUEUE_PIC;
112 dq->color = ((unsigned int) (red * 255.0f) << 24) | ((unsigned int) (green * 255.0f) << 16) | ((unsigned int) (blue * 255.0f) << 8) | ((unsigned int) (alpha * 255.0f));
118 *((char *)(dq + 1)) = 0;
119 r_refdef.drawqueuesize += dq->size;
122 //only used for the player color selection menu
123 void DrawQ_PicTranslate (int x, int y, char *picname, byte *translation)
126 unsigned int trans[4096];
129 pic = Draw_CachePic(picname);
133 c = pic->width * pic->height;
136 Con_Printf("DrawQ_PicTranslate: image larger than 4k buffer\n");
140 for (i = 0;i < c;i++)
141 trans[i] = d_8to24table[translation[menuplyr_pixels[i]]];
143 // FIXME: this is renderer stuff?
144 R_UpdateTexture (pic->tex, (byte *)trans);
146 DrawQ_Pic(x, y, picname, 0, 0, 1, 1, 1, 1, 0);
149 void V_CalcRefdef (void);
150 void CL_UpdateScreen(void)
162 void CL_Screen_NewMap(void)
167 //=============================================================================
169 // LordHavoc: SHOWLMP stuff
170 #define SHOWLMP_MAXLABELS 256
171 typedef struct showlmp_s
181 showlmp_t showlmp[SHOWLMP_MAXLABELS];
183 void SHOWLMP_decodehide(void)
187 lmplabel = MSG_ReadString();
188 for (i = 0;i < SHOWLMP_MAXLABELS;i++)
189 if (showlmp[i].isactive && strcmp(showlmp[i].label, lmplabel) == 0)
191 showlmp[i].isactive = false;
196 void SHOWLMP_decodeshow(void)
199 byte lmplabel[256], picname[256];
201 strcpy(lmplabel,MSG_ReadString());
202 strcpy(picname, MSG_ReadString());
203 if (gamemode == GAME_NEHAHRA) // LordHavoc: nasty old legacy junk
214 for (i = 0;i < SHOWLMP_MAXLABELS;i++)
215 if (showlmp[i].isactive)
217 if (strcmp(showlmp[i].label, lmplabel) == 0)
220 break; // drop out to replace it
223 else if (k < 0) // find first empty one to replace
226 return; // none found to replace
227 // change existing one
228 showlmp[k].isactive = true;
229 strcpy(showlmp[k].label, lmplabel);
230 strcpy(showlmp[k].pic, picname);
235 void SHOWLMP_drawall(void)
239 for (i = 0;i < SHOWLMP_MAXLABELS;i++)
240 if (showlmp[i].isactive)
241 DrawQ_Pic(showlmp[i].x, showlmp[i].y, showlmp[i].pic, 0, 0, 1, 1, 1, 1, 0);
244 void SHOWLMP_clear(void)
247 for (i = 0;i < SHOWLMP_MAXLABELS;i++)
248 showlmp[i].isactive = false;