Reworked 2D pic drawing using a new, merged R_DrawPic() function. Moved old pic drawing functions to r_draw_removed.c.

Added new SCR_DrawPic() variants in cl_screen.c.
Added new graphics for text fields and sliders in menus.
Improved mouse interaction for menu sliders.
Added resettargets developer command to default Lazarus and  missionpack DLLs.
Added hint_test developer command to missionpack DLL.
Fixed freeze developer command in default Lazarus and missionpack DLLs so it can be used more than once.
More tweaks to Tactician Gunner prox mine safety checks in misssionpack DLL.
This commit is contained in:
Knightmare66 2021-08-07 00:43:46 -04:00
parent c531db636d
commit add4c7cc46
58 changed files with 2076 additions and 743 deletions

View file

@ -1479,6 +1479,7 @@ CIN_DrawCinematic
void CIN_DrawCinematic (cinHandle_t handle){
cinematic_t *cin;
drawStruct_t ds;
cin = CIN_GetVideoByHandle(handle);
@ -1488,14 +1489,22 @@ void CIN_DrawCinematic (cinHandle_t handle){
if (cin->frameCount == -1) // Knightmare- HACK to show JPG endscreens
{
char picname[MAX_QPATH] = "/";
float x=0, y=0, w=640, h=480;
float x=0, y=0, w=SCREEN_WIDTH, h=SCREEN_HEIGHT;
// strncat(picname, cin->name);
Q_strncatz (picname, sizeof(picname), cin->name);
SCR_ScaleCoords (&x, &y, &w, &h, ALIGN_CENTER);
if (w < viddef.width || h < viddef.height)
R_DrawFill (0, 0, viddef.width, viddef.height, 0, 0, 0, 255);
// R_DrawStretchPic (x, y, viddef.width, viddef.height, picname, 1.0);
R_DrawStretchPic (x, y, w, h, picname, 1.0);
memset (&ds, 0, sizeof(drawStruct_t));
ds.pic = &picname[0];
ds.x = x; ds.y = y; ds.w = w; ds.h = h;
Vector2Copy (vec2_origin, ds.offset);
Vector4Copy (vec4_identity, ds.color);
R_DrawPic (ds);
// R_DrawStretchPic (x, y, w, h, picname, 1.0);
return;
} // end JPG hack

View file

@ -27,13 +27,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
console_t con;
cvar_t *con_notifytime;
cvar_t *con_alpha; // Knightare- Psychospaz's transparent console
//cvar_t *con_height; // Knightmare- how far the console drops down
cvar_t *con_newconback; // whether to use new console background
cvar_t *con_oldconbar; // whether to draw bottom bar on old console
qboolean newconback_found = false; // whether to draw Q3-style console
extern char key_lines[32][MAXCMDLINE];
extern int edit_line;
extern int key_linepos;
@ -333,15 +328,12 @@ void Con_Init (void)
con_notifytime = Cvar_Get ("con_notifytime", "4", 0); // Knightmare- increased for fade
Cvar_SetDescription ("con_notifytime", "Time in seconds for console notify messages to fade away.");
// Knightmare- Psychospaz's transparent console
con_alpha = Cvar_Get ("con_alpha", "0.5", CVAR_ARCHIVE);
Cvar_SetDescription ("con_alpha", "Opacity of console background.");
// Knightmare- how far the console drops down
//con_height = Cvar_Get ("con_height", "0.5", CVAR_ARCHIVE);
con_newconback = Cvar_Get ("con_newconback", "0", CVAR_ARCHIVE); // whether to use new console background
Cvar_SetDescription ("con_newconback", "Toggles use of new console background.");
con_oldconbar = Cvar_Get ("con_oldconbar", "1", CVAR_ARCHIVE); // whether to draw bottom bar on old console
Cvar_SetDescription ("con_oldconbar", "Toggles drawing of solid color bottom bar on console with standard conback image.");
Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f);
Cmd_AddCommand ("togglechat", Con_ToggleChat_f);
Cmd_AddCommand ("messagemode", Con_MessageMode_f);
Cmd_AddCommand ("messagemode2", Con_MessageMode2_f);
Cmd_AddCommand ("clear", Con_Clear_f);
Cmd_AddCommand ("condump", Con_Dump_f);
// whether to use new-style console background
newconback_found = false;
@ -352,13 +344,6 @@ void Con_Init (void)
|| (FS_LoadFile("gfx/ui/newconback.jpg", NULL) != -1) )
newconback_found = true;
Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f);
Cmd_AddCommand ("togglechat", Con_ToggleChat_f);
Cmd_AddCommand ("messagemode", Con_MessageMode_f);
Cmd_AddCommand ("messagemode2", Con_MessageMode2_f);
Cmd_AddCommand ("clear", Con_Clear_f);
Cmd_AddCommand ("condump", Con_Dump_f);
con.initialized = true;
}
@ -901,6 +886,8 @@ void Con_DrawConsole (float frac, qboolean trans)
float alpha, barheight, conLeft, conWidth, picLeft, picWidth, picHeight, pboxWidth;
// changeable download bar color
int red, green, blue;
vec4_t picColor;
drawStruct_t ds;
// CL_TextColor ((int)alt_text_color->value, &red, &green, &blue);
CL_TextColor (alt_text_color->integer, &red, &green, &blue);
@ -911,8 +898,8 @@ void Con_DrawConsole (float frac, qboolean trans)
picHeight = SCREEN_HEIGHT;
SCR_ScaleCoords (&picLeft, NULL, &picWidth, &picHeight, ALIGN_CENTER);
// if ( (newconback_found && con_newconback->value) || con_oldconbar->value ) {
if ( (newconback_found && con_newconback->integer) || con_oldconbar->integer ) {
// if ( (newconback_found && scr_newconback->value) || scr_oldconbar->value ) {
if ( (newconback_found && scr_newconback->integer) || scr_oldconbar->integer ) {
barheight = 2;
SCR_ScaleCoords (&conLeft, NULL, &conWidth, &barheight, ALIGN_STRETCH);
}
@ -929,20 +916,40 @@ void Con_DrawConsole (float frac, qboolean trans)
lines = viddef.height;
// Psychospaz's transparent console
//alpha = (trans) ? ((frac/ (newconback_found?0.5:con_height->value) )*con_alpha->value) : 1;
// alpha = trans ? ((newconback_found && con_newconback->value) ? con_alpha->value : 2*frac*con_alpha->value) : 1;
alpha = trans ? ((newconback_found && con_newconback->integer) ? con_alpha->value : 2*frac*con_alpha->value) : 1;
//alpha = (trans) ? ((frac/ (newconback_found?0.5:scr_conheight->value) )*scr_conalpha->value) : 1;
// alpha = trans ? ((newconback_found && scr_newconback->value) ? scr_conalpha->value : 2*frac*scr_conalpha->value) : 1;
alpha = trans ? ((newconback_found && scr_newconback->integer) ? scr_conalpha->value : 2*frac*scr_conalpha->value) : 1;
Vector4Set (picColor, 1.0f, 1.0f, 1.0f, alpha);
// draw the background
//i = newconback_found ? lines - barheight : lines*(1/con_height->value);
//j = newconback_found ? 0 : (con_height->value-1)*i - barheight;
//i = newconback_found ? lines - barheight : lines*(1/scr_conheight->value);
//j = newconback_found ? 0 : (scr_conheight->value-1)*i - barheight;
y = lines - barheight;
memset (&ds, 0, sizeof(drawStruct_t));
Vector2Copy (vec2_origin, ds.offset);
Vector4Copy (picColor, ds.color);
if (y < 1) y = 0;
// else if (newconback_found && con_newconback->value) // Q3-style console
else if (newconback_found && con_newconback->integer) // Q3-style console
/* else if (newconback_found && scr_newconback->integer) // Q3-style console
R_DrawStretchPic ((int)picLeft, 0, picWidth, lines-barheight, "/gfx/ui/newconback.pcx", alpha);
else
R_DrawStretchPic ((int)picLeft, (lines-(int)picHeight-(int)barheight), picWidth, (int)picHeight, "conback", alpha);
*/
else if (newconback_found && scr_newconback->integer) { // Q3-style console
ds.pic = "/gfx/ui/newconback.pcx";
// ds.x = (int)conLeft; ds.w = conWidth;
ds.x = (int)picLeft; ds.w = picWidth;
ds.y = 0; ds.h = lines-(int)barheight;
R_DrawPic (ds);
}
else {
ds.pic = "conback";
// ds.x = (int)conLeft; ds.w = conWidth;
ds.x = (int)picLeft; ds.w = picWidth;
ds.y = (lines-(int)picHeight-(int)barheight); ds.h = (int)picHeight;
R_DrawPic (ds);
}
// pillarbox sides if console is wider than scaled pic
if (conWidth > picWidth)
@ -961,8 +968,8 @@ void Con_DrawConsole (float frac, qboolean trans)
Con_DrawString ((int)(conLeft+conWidth)-FONT_SIZE*(stringLen((const char *)&version))-3, y-(int)(1.25*FONT_SIZE), version, FONT_CONSOLE, 255);
// if ( (newconback_found && con_newconback->value) || con_oldconbar->value ) // Q3-style console bottom bar
if ( (newconback_found && con_newconback->integer) || con_oldconbar->integer ) // Q3-style console bottom bar
// if ( (newconback_found && scr_newconback->value) || scr_oldconbar->value ) // Q3-style console bottom bar
if ( (newconback_found && scr_newconback->integer) || scr_oldconbar->integer ) // Q3-style console bottom bar
R_DrawFill ((int)conLeft, y, conWidth, barheight, red, green, blue, 255);
// draw the text
@ -1015,5 +1022,3 @@ void Con_DrawConsole (float frac, qboolean trans)
// draw the input prompt, user text, and cursor if desired
Con_DrawInput ();
}

View file

@ -71,6 +71,26 @@ void Hud_DrawStringAlt (int x, int y, const char *string, int alpha, qboolean is
// CL_DrawStringGeneric (x, y, string, alpha, HUD_FONT_SIZE, (isStatusBar) ? SCALETYPE_HUD : SCALETYPE_MENU, true);
}
/*
================
Hud_DrawStringFromCharsPic
================
*/
void Hud_DrawStringFromCharsPic (float x, float y, float w, float h, vec2_t offset, float width, scralign_t align, char *string, color_t color, char *pic, int flags)
{
vec2_t scaledOffset;
Vector2Copy (offset, scaledOffset);
SCR_ScaleCoords (&x, &y, &w, &h, align);
// SCR_ScaleCoords (NULL, NULL, &offsetX, NULL, align);
// SCR_ScaleCoords (NULL, NULL, NULL, &offsetY, align);
SCR_ScaleCoords (NULL, NULL, &scaledOffset[0], &scaledOffset[1], align);
SCR_ScaleCoords (NULL, NULL, &width, NULL, align);
CL_DrawStringFromCharsPic (x, y, w, h, scaledOffset, width, string, color, pic, flags);
}
/*
===============================================================
@ -198,6 +218,8 @@ void CL_DrawLayoutField (int x, int y, int color, int width, int value, qboolean
int l, frame;
float digitWidth, digitOffset, fieldScale;
float flash_x, flashWidth;
vec4_t picColor;
drawStruct_t ds;
float (*scaleForScreen)(float in);
float (*getScreenScale)(void);
@ -233,14 +255,23 @@ void CL_DrawLayoutField (int x, int y, int color, int width, int value, qboolean
}
digitWidth = fieldScale*(float)CHAR_WIDTH;
digitOffset = width*scaleForScreen(CHAR_WIDTH) - l*digitWidth;
// x += 2 + scaledHud(CHAR_WIDTH)*(width - l);
// x += 2 + scaleForScreen(CHAR_WIDTH)*(width - l);
x += 2 + digitOffset;
flashWidth = l * digitWidth;
flash_x = x;
Vector4Set (picColor, 1.0f, 1.0f, 1.0f, scr_hudalpha->value);
if (flash)
R_DrawStretchPic (flash_x, y, flashWidth, scaleForScreen(ICON_HEIGHT), "field_3", scr_hudalpha->value);
memset (&ds, 0, sizeof(drawStruct_t));
ds.y = y; ds.h = scaleForScreen(ICON_HEIGHT);
Vector2Copy (vec2_origin, ds.offset);
Vector4Copy (picColor, ds.color);
if (flash){
ds.pic = "field_3";
ds.x = flash_x; ds.w = flashWidth;
R_DrawPic (ds);
// R_DrawStretchPic (flash_x, y, flashWidth, scaleForScreen(ICON_HEIGHT), "field_3", scr_hudalpha->value);
}
ptr = num;
while (*ptr && l)
@ -250,11 +281,10 @@ void CL_DrawLayoutField (int x, int y, int color, int width, int value, qboolean
else
frame = *ptr -'0';
// R_DrawScaledPic (x, y, HudScale(), scr_hudalpha->value,sb_nums[color][frame]);
// x += scaledHud(CHAR_WIDTH);
// R_DrawScaledPic (x, y, getScreenScale(), scr_hudalpha->value, sb_nums[color][frame]);
// x += scaleForScreen(CHAR_WIDTH);
R_DrawStretchPic (x, y, digitWidth, scaleForScreen(ICON_HEIGHT), sb_nums[color][frame], scr_hudalpha->value);
ds.pic = sb_nums[color][frame];
ds.x = x; ds.w = digitWidth;
R_DrawPic (ds);
// R_DrawStretchPic (x, y, digitWidth, scaleForScreen(ICON_HEIGHT), sb_nums[color][frame], scr_hudalpha->value);
x += digitWidth;
ptr++;
l--;
@ -371,7 +401,8 @@ void CL_ExecuteLayoutString (char *s, qboolean isStatusBar)
}
if (cl.configstrings[cs_images+value])
{
R_DrawScaledPic (x, y, getScreenScale(), scr_hudalpha->value, cl.configstrings[cs_images+value]);
// R_DrawScaledPic (x, y, getScreenScale(), scr_hudalpha->value, cl.configstrings[cs_images+value]);
SCR_DrawLegacyPic (x, y, getScreenScale(), cl.configstrings[cs_images+value], scr_hudalpha->value);
}
continue;
}
@ -410,7 +441,8 @@ void CL_ExecuteLayoutString (char *s, qboolean isStatusBar)
if (!ci->icon)
ci = &cl.baseclientinfo;
R_DrawScaledPic(x, y, getScreenScale(), scr_hudalpha->value, ci->iconname);
// R_DrawScaledPic (x, y, getScreenScale(), scr_hudalpha->value, ci->iconname);
SCR_DrawLegacyPic (x, y, getScreenScale(), ci->iconname, scr_hudalpha->value);
continue;
}
@ -487,7 +519,8 @@ void CL_ExecuteLayoutString (char *s, qboolean isStatusBar)
if (!strcmp(token, "picn"))
{ // draw a pic from a name
token = COM_Parse (&s);
R_DrawScaledPic (x, y, getScreenScale(), scr_hudalpha->value, token);
// R_DrawScaledPic (x, y, getScreenScale(), scr_hudalpha->value, token);
SCR_DrawLegacyPic (x, y, getScreenScale(), token, scr_hudalpha->value);
continue;
}
@ -878,8 +911,6 @@ void CL_DrawInventory (void)
if (top < 0)
top = 0;
//x = (viddef.width-256)/2;
//y = (viddef.height-240)/2;
// x = viddef.width/2 - SCR_ScaledHud(128);
// y = viddef.height/2 - SCR_ScaledHud(120);
x = SCREEN_WIDTH/2 - 128;
@ -891,7 +922,7 @@ void CL_DrawInventory (void)
// Hud_DrawString (x, y, S_COLOR_BOLD"hotkey ### item");
// Hud_DrawString (x, y+SCR_ScaledHud(8), S_COLOR_BOLD"------ --- ----");
// y += SCR_ScaledHud(16);
SCR_DrawPic (x, y, 256, 192, ALIGN_CENTER, "inventory", scr_hudalpha->value);
SCR_DrawPic (x, y, 256, 192, ALIGN_CENTER, false, "inventory", scr_hudalpha->value);
x += 24;
y += 20;
SCR_DrawString (x, y, 8, ALIGN_CENTER, S_COLOR_WHITE"hotkey ### item", FONT_SCREEN, 255);

View file

@ -868,7 +868,6 @@ void CL_ParseFog (void)
green = MSG_ReadByte (&net_message);
blue = MSG_ReadByte (&net_message);
// R_SetFogVars (fogenable, model, density, start, end, red, green, blue);
V_SetFogInfo (fogenable, model, density, start, end, red, green, blue);
}

View file

@ -53,6 +53,10 @@ vrect_t scr_vrect; // position of render window on screen
cvar_t *scr_viewsize;
cvar_t *scr_conspeed;
cvar_t *scr_conalpha; // Psychospaz's transparent console
cvar_t *scr_newconback; // whether to use new console background
cvar_t *scr_oldconbar; // whether to draw bottom bar on old console
//cvar_t *scr_conheight; // how far the console drops down
cvar_t *scr_letterbox;
cvar_t *scr_centertime;
//cvar_t *scr_showturtle; // unused
@ -92,6 +96,11 @@ cvar_t *cl_demomessage;
cvar_t *cl_hud; // placeholder cvar
cvar_t *cl_hud_variant; // placeholder cvar
color_t color_identity = {255, 255, 255, 255};
vec4_t vec4_identity = {1.0f, 1.0f, 1.0f, 1.0f};
vec4_t stCoord_default = {-1.0f, -1.0f, -1.0f, -1.0f};
vec4_t stCoord_tile = {-2.0f, -2.0f, -2.0f, -2.0f};
float scr_screenScale;
float scr_hudScale;
float scr_screenAspect;
@ -620,12 +629,41 @@ SCR_DrawFill
Coordinates are 640*480 virtual values
=================
*/
void SCR_DrawFill (float x, float y, float width, float height, scralign_t align, int red, int green, int blue, int alpha)
void SCR_DrawFill (float x, float y, float width, float height, scralign_t align, qboolean roundOut, int red, int green, int blue, int alpha)
{
SCR_ScaleCoords (&x, &y, &width, &height, align);
if (roundOut) {
x = floor(x); y = floor(y); width = ceil(width); height = ceil(height);
}
R_DrawFill (x, y, width, height, red, green, blue, alpha);
}
/*
================
SCR_DrawBorder
Draws a solid color border
Coordinates are 640*480 virtual values
=================
*/
void SCR_DrawBorder (float x, float y, float width, float height, float borderSize, scralign_t align, qboolean roundOut, int red, int green, int blue, int alpha)
{
float bSize = floor(SCR_ScaledScreen(borderSize));
SCR_ScaleCoords (&x, &y, &width, &height, align);
if (roundOut) {
x = floor(x); y = floor(y); width = ceil(width); height = ceil(height);
}
// top
R_DrawFill (x-bSize, y-bSize, width+bSize*2, bSize, red, green, blue, alpha);
// bottom
R_DrawFill (x-bSize, y+height, width+bSize*2, bSize, red, green, blue, alpha);
// left
R_DrawFill (x-bSize, y, bSize, height, red, green, blue, alpha);
// right
R_DrawFill (x+width, y, bSize, height, red, green, blue, alpha);
}
#if 0
/*
================
SCR_DrawPic
@ -637,6 +675,270 @@ void SCR_DrawPic (float x, float y, float width, float height, scralign_t align,
SCR_ScaleCoords (&x, &y, &width, &height, align);
R_DrawStretchPic (x, y, width, height, pic, alpha);
}
#else
/*
================
SCR_DrawPic
Coordinates are 640*480 virtual values
=================
*/
void SCR_DrawPic (float x, float y, float width, float height, scralign_t align, qboolean roundOut, char *pic, float alpha)
{
vec4_t outColor;
drawStruct_t ds;
SCR_ScaleCoords (&x, &y, &width, &height, align);
Vector4Set (outColor, 1.0f, 1.0f, 1.0f, alpha);
if (roundOut) {
x = floor(x); y = floor(y); width = ceil(width); height = ceil(height);
}
memset (&ds, 0, sizeof(drawStruct_t));
ds.pic = pic;
ds.x = x; ds.y = y; ds.w = width; ds.h = height;
Vector2Copy (vec2_origin, ds.offset);
Vector4Copy (outColor, ds.color);
R_DrawPic (ds);
}
#endif
/*
================
SCR_ScaledPic
Coordinates are actual values
=================
*/
void SCR_DrawScaledPic (float x, float y, float scale, qboolean centerCoords, qboolean roundOut, char *pic, float alpha)
{
int w, h;
float width, height;
vec4_t outColor;
drawStruct_t ds;
Vector4Set (outColor, 1.0f, 1.0f, 1.0f, alpha);
R_DrawGetPicSize (&w, &h, pic);
width = (float)w * scale;
height = (float)h * scale;
if (centerCoords) {
x -= (width * 0.5f);
y -= (height * 0.5f);
}
if (roundOut) {
x = floor(x); y = floor(y); width = ceil(width); height = ceil(height);
}
memset (&ds, 0, sizeof(drawStruct_t));
ds.pic = pic;
ds.x = x; ds.y = y; ds.w = width; ds.h = height;
Vector2Copy (vec2_origin, ds.offset);
Vector4Copy (outColor, ds.color);
R_DrawPic (ds);
}
/*
================
SCR_DrawLegacyPic
=================
*/
void SCR_DrawLegacyPic (float x, float y, float scale, char *pic, float alpha)
{
vec4_t outColor;
vec4_t stCoords;
drawStruct_t ds;
Vector4Set (outColor, 1.0f, 1.0f, 1.0f, alpha);
Vector4Set (stCoords, -3.0f, scale, 0, 0);
memset (&ds, 0, sizeof(drawStruct_t));
ds.pic = pic;
ds.x = x; ds.y = y; ds.w = 24; ds.h = 24;
ds.scale[0] = ds.scale[1] = scale;
ds.flags |= DSFLAG_SCALED;
Vector2Copy (vec2_origin, ds.offset);
Vector4Copy (outColor, ds.color);
R_DrawPic (ds);
}
/*
================
SCR_DrawColoredPic
Coordinates are 640*480 virtual values
=================
*/
void SCR_DrawColoredPic (float x, float y, float width, float height, scralign_t align, qboolean roundOut, color_t color, char *pic)
{
vec4_t outColor;
drawStruct_t ds;
SCR_ScaleCoords (&x, &y, &width, &height, align);
Vector4Set (outColor, (float)color[0]*DIV255, (float)color[1]*DIV255, (float)color[2]*DIV255, (float)color[3]*DIV255);
if (roundOut) {
x = floor(x); y = floor(y); width = ceil(width); height = ceil(height);
}
memset (&ds, 0, sizeof(drawStruct_t));
ds.pic = pic;
ds.x = x; ds.y = y; ds.w = width; ds.h = height;
Vector2Copy (vec2_origin, ds.offset);
Vector4Copy (outColor, ds.color);
R_DrawPic (ds);
}
/*
================
SCR_DrawOffsetPic
Coordinates are 640*480 virtual values
=================
*/
void SCR_DrawOffsetPic (float x, float y, float width, float height, vec2_t offset, scralign_t align, qboolean roundOut, color_t color, char *pic)
{
vec4_t outColor;
vec2_t scaledOffset;
drawStruct_t ds;
Vector2Copy (offset, scaledOffset);
SCR_ScaleCoords (&x, &y, &width, &height, align);
SCR_ScaleCoords (NULL, NULL, &scaledOffset[0], &scaledOffset[1], align);
Vector4Set (outColor, (float)color[0]*DIV255, (float)color[1]*DIV255, (float)color[2]*DIV255, (float)color[3]*DIV255);
if (roundOut) {
x = floor(x); y = floor(y); width = ceil(width); height = ceil(height);
}
memset (&ds, 0, sizeof(drawStruct_t));
ds.pic = pic;
ds.x = x; ds.y = y; ds.w = width; ds.h = height;
Vector2Copy (scaledOffset, ds.offset);
Vector4Copy (outColor, ds.color);
R_DrawPic (ds);
}
/*
================
SCR_DrawOffsetPicST
Coordinates are 640*480 virtual values
=================
*/
void SCR_DrawOffsetPicST (float x, float y, float width, float height, vec2_t offset, vec4_t texCorners, scralign_t align, qboolean roundOut, color_t color, char *pic)
{
vec4_t outColor;
vec2_t scaledOffset;
drawStruct_t ds;
Vector2Copy (offset, scaledOffset);
SCR_ScaleCoords (&x, &y, &width, &height, align);
SCR_ScaleCoords (NULL, NULL, &scaledOffset[0], &scaledOffset[1], align);
Vector4Set (outColor, (float)color[0]*DIV255, (float)color[1]*DIV255, (float)color[2]*DIV255, (float)color[3]*DIV255);
if (roundOut) {
x = floor(x); y = floor(y); width = ceil(width); height = ceil(height);
}
memset (&ds, 0, sizeof(drawStruct_t));
ds.pic = pic;
ds.x = x; ds.y = y; ds.w = width; ds.h = height;
ds.flags |= DSFLAG_USESTCOORDS;
Vector2Copy (scaledOffset, ds.offset);
Vector4Copy (texCorners, ds.stCoords);
Vector4Copy (outColor, ds.color);
R_DrawPic (ds);
}
/*
================
SCR_DrawScrollPic
Coordinates are 640*480 virtual values
=================
*/
void SCR_DrawScrollPic (float x, float y, float width, float height, vec2_t offset, vec4_t texCorners, vec2_t scroll, scralign_t align, qboolean roundOut, color_t color, char *pic)
{
vec4_t outColor;
vec2_t scaledOffset;
drawStruct_t ds;
Vector2Copy (offset, scaledOffset);
SCR_ScaleCoords (&x, &y, &width, &height, align);
SCR_ScaleCoords (NULL, NULL, &scaledOffset[0], &scaledOffset[1], align);
Vector4Set (outColor, (float)color[0]*DIV255, (float)color[1]*DIV255, (float)color[2]*DIV255, (float)color[3]*DIV255);
if (roundOut) {
x = floor(x); y = floor(y); width = ceil(width); height = ceil(height);
}
memset (&ds, 0, sizeof(drawStruct_t));
ds.pic = pic;
ds.x = x; ds.y = y; ds.w = width; ds.h = height;
ds.flags |= DSFLAG_USESTCOORDS;
Vector2Copy (scroll, ds.scroll);
Vector2Copy (scaledOffset, ds.offset);
Vector4Copy (texCorners, ds.stCoords);
Vector4Copy (outColor, ds.color);
R_DrawPic (ds);
}
/*
================
SCR_DrawMaskedPic
Coordinates are 640*480 virtual values
=================
*/
void SCR_DrawMaskedPic (float x, float y, float width, float height, vec2_t offset, vec4_t texCorners, vec2_t scroll, scralign_t align, qboolean roundOut, color_t color, char *pic, char *maskPic)
{
vec4_t outColor;
vec2_t scaledOffset;
drawStruct_t ds;
Vector2Copy (offset, scaledOffset);
SCR_ScaleCoords (&x, &y, &width, &height, align);
SCR_ScaleCoords (NULL, NULL, &scaledOffset[0], &scaledOffset[1], align);
Vector4Set (outColor, (float)color[0]*DIV255, (float)color[1]*DIV255, (float)color[2]*DIV255, (float)color[3]*DIV255);
if (roundOut) {
x = floor(x); y = floor(y); width = ceil(width); height = ceil(height);
}
memset (&ds, 0, sizeof(drawStruct_t));
ds.pic = pic;
ds.maskPic = maskPic;
ds.x = x; ds.y = y; ds.w = width; ds.h = height;
ds.flags |= DSFLAG_USESTCOORDS|DSFLAG_MASKED;
Vector2Copy (scroll, ds.scroll);
Vector2Copy (scaledOffset, ds.offset);
Vector4Copy (texCorners, ds.stCoords);
Vector4Copy (outColor, ds.color);
R_DrawPic (ds);
}
/*
================
SCR_DrawTiledPic
Coordinates are 640*480 virtual values
=================
*/
void SCR_DrawTiledPic (float x, float y, float width, float height, scralign_t align, qboolean roundOut, char *pic, float alpha)
{
vec4_t outColor;
drawStruct_t ds;
SCR_ScaleCoords (&x, &y, &width, &height, align);
Vector4Set (outColor, 1.0f, 1.0f, 1.0f, alpha);
if (roundOut) {
x = floor(x); y = floor(y); width = ceil(width); height = ceil(height);
}
memset (&ds, 0, sizeof(drawStruct_t));
ds.pic = pic;
ds.x = x; ds.y = y; ds.w = width; ds.h = height;
ds.flags |= DSFLAG_TILED;
Vector2Copy (vec2_origin, ds.offset);
Vector4Copy (outColor, ds.color);
R_DrawPic (ds);
}
/*
================
@ -652,6 +954,7 @@ void SCR_DrawChar (float x, float y, int size, scralign_t align, int num, fontsl
R_DrawChar(x, y, num, font, scale, red, green, blue, alpha, italic, last);
}
/*
================
SCR_DrawString
@ -1360,6 +1663,13 @@ void SCR_Init (void)
Cvar_SetDescription ("viewsize", "Draw size of screen in percent, from 40 to 100.");
scr_conspeed = Cvar_Get ("scr_conspeed", "3", 0);
Cvar_SetDescription ("scr_conspeed", "Scrolling speed of the console.");
scr_conalpha = Cvar_Get ("scr_conalpha", "0.5", CVAR_ARCHIVE); // Psychospaz's transparent console
Cvar_SetDescription ("scr_conalpha", "Opacity of console background.");
scr_newconback = Cvar_Get ("scr_newconback", "0", CVAR_ARCHIVE); // whether to use new console background
Cvar_SetDescription ("scr_newconback", "Toggles use of new console background.");
scr_oldconbar = Cvar_Get ("scr_oldconbar", "1", CVAR_ARCHIVE); // whether to draw bottom bar on old console
Cvar_SetDescription ("scr_oldconbar", "Toggles drawing of solid color bottom bar on console with standard conback image.");
// scr_conheight = Cvar_Get ("scr_conheight", "0.5", CVAR_ARCHIVE); // how far the console drops down
scr_letterbox = Cvar_Get ("scr_letterbox", "1", CVAR_ARCHIVE);
Cvar_SetDescription ("scr_letterbox", "Enables letterbox effect for cameras and cutscenes.");
// scr_showturtle = Cvar_Get ("scr_showturtle", "0", 0); // unused
@ -1505,7 +1815,7 @@ void SCR_DrawCrosshair (void)
// scr_vrect.y + (int)(((float)scr_vrect.height - scale*(float)crosshair_height)*0.5), // y
// scale, alpha, crosshair_pic);
SCR_DrawPic ( ((float)SCREEN_WIDTH - scaledSize)*0.5, ((float)SCREEN_HEIGHT - scaledSize)*0.5,
scaledSize, scaledSize, ALIGN_CENTER, crosshair_pic, alpha);
scaledSize, scaledSize, ALIGN_CENTER, false, crosshair_pic, alpha);
}
@ -1520,7 +1830,8 @@ void SCR_DrawNet (void)
< CMD_BACKUP-1)
return;
R_DrawPic (scr_vrect.x + SCR_ScaledHud(64), scr_vrect.y, "net");
// R_DrawPic (scr_vrect.x + SCR_ScaledHud(64), scr_vrect.y, "net");
SCR_DrawPic (scr_vrect.x+64, scr_vrect.y, 32, 32, ALIGN_TOPLEFT, false, "net", 1.0f);
}
@ -1548,10 +1859,10 @@ void SCR_DrawAlertMessagePicture (char *name, qboolean center, int yOffset)
if (center)
SCR_DrawPic((SCREEN_WIDTH - w)*0.5, (SCREEN_HEIGHT - h)*0.5,
w, h, ALIGN_CENTER, name, 1.0);
w, h, ALIGN_CENTER, false, name, 1.0);
else
SCR_DrawPic((SCREEN_WIDTH - w)*0.5, SCREEN_HEIGHT*0.5 + yOffset,
w, h, ALIGN_CENTER, name, 1.0);
w, h, ALIGN_CENTER, false, name, 1.0);
}
@ -1562,13 +1873,16 @@ SCR_DrawPause
*/
void SCR_DrawPause (void)
{
int w, h;
int w, h, x, y;
w = 129; // size of original pause.pcx = 101x25
h = 32;
x = (SCREEN_WIDTH - w)*0.5;
y = (SCREEN_HEIGHT - h)*0.5;
// if (!scr_showpause->value) // turn off for screenshots
if (!scr_showpause->integer) // turn off for screenshots
return;
// if (!cl_paused->value)
if (!cl_paused->integer)
return;
@ -1576,8 +1890,9 @@ void SCR_DrawPause (void)
if (cls.key_dest == key_menu)
return;
R_DrawGetPicSize (&w, &h, "pause");
SCR_DrawPic ((SCREEN_WIDTH-w)*0.5, (SCREEN_HEIGHT-h)*0.5, w, h, ALIGN_CENTER, "pause", 1.0);
// R_DrawGetPicSize (&w, &h, "pause");
// SCR_DrawPic ((SCREEN_WIDTH-w)*0.5, (SCREEN_HEIGHT-h)*0.5, w, h, ALIGN_CENTER, "pause", 1.0);
SCR_DrawPic (x, y, w, h, ALIGN_CENTER, false, "pause", 1.0);
}
@ -1598,11 +1913,11 @@ void SCR_DrawLoadingTagProgress (char *picName, int yOffset, int percent)
y = (SCREEN_HEIGHT - h)*0.5;
barPos = min(max(percent, 0), 100) / 4;
SCR_DrawPic (x, y + yOffset, w, h, ALIGN_CENTER, picName, 1.0);
SCR_DrawPic (x, y + yOffset, w, h, ALIGN_CENTER, false, picName, 1.0);
for (i=0; i<barPos; i++)
SCR_DrawPic (x + 33 + (i * LOADBAR_TIC_SIZE_X), y + 28 + yOffset, LOADBAR_TIC_SIZE_X, LOADBAR_TIC_SIZE_Y,
ALIGN_CENTER, "loading_led1", 1.0);
ALIGN_CENTER, false, "loading_led1", 1.0);
}
@ -1622,11 +1937,11 @@ void SCR_DrawLoadingBar (float x, float y, float w, float h, int percent, float
iRatio = 1 - fabs(sizeRatio);
hiRatio = iRatio * 0.5;
SCR_DrawFill (x, y, w, h, ALIGN_STRETCH, 255, 255, 255, 90);
SCR_DrawFill (x, y, w, h, ALIGN_STRETCH, false, 255, 255, 255, 90);
if (percent != 0)
SCR_DrawFill (x+(h*hiRatio), y+(h*hiRatio), (w-(h*iRatio))*percent*0.01, h*sizeRatio,
ALIGN_STRETCH, red, green, blue, 255);
ALIGN_STRETCH, false, red, green, blue, 255);
}
@ -1687,48 +2002,48 @@ void SCR_DrawLoading (void)
// show saveshot here
if (load_saveshot && (strlen(load_saveshot) > 8) && R_DrawFindPic(load_saveshot)) {
SCR_DrawPic (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH, load_saveshot, 1.0);
SCR_DrawPic (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH, false, load_saveshot, 1.0);
haveMapPic = true;
}
// else try levelshot
else if (/*widescreen &&*/ R_DrawFindPic(va("/levelshots/%s_widescreen.pcx", mapfile)))
{
// Draw at 16:10 aspect, don't stretch to 16:9 or wider
SCR_DrawFill (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH_ALL, 0, 0, 0, 255);
SCR_DrawFill (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH_ALL, false, 0, 0, 0, 255);
// SCR_DrawPic (-64, 0, SCREEN_WIDTH+128, SCREEN_HEIGHT, ALIGN_CENTER, va("/levelshots/%s_widescreen.pcx", mapfile), 1.0);
// Draw at native aspect
Com_sprintf(picName, sizeof(picName), "/levelshots/%s_widescreen.pcx", mapfile);
SCR_GetPicPosWidth (picName, &picX, &picW);
SCR_DrawPic (picX, 0, picW, SCREEN_HEIGHT, ALIGN_CENTER, picName, 1.0);
SCR_DrawPic (picX, 0, picW, SCREEN_HEIGHT, ALIGN_CENTER, false, picName, 1.0);
haveMapPic = true;
}
else if (R_DrawFindPic(va("/levelshots/%s.pcx", mapfile))) {
// Draw at 4:3 aspect, don't stretch to 16:9 or wider
SCR_DrawFill (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH_ALL, 0, 0, 0, 255);
SCR_DrawPic (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_CENTER, va("/levelshots/%s.pcx", mapfile), 1.0); // was ALIGN_STRETCH
SCR_DrawFill (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH_ALL, false, 0, 0, 0, 255);
SCR_DrawPic (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_CENTER, false, va("/levelshots/%s.pcx", mapfile), 1.0); // was ALIGN_STRETCH
haveMapPic = true;
}
// else fall back on loadscreen
else if (R_DrawFindPic(LOADSCREEN_NAME)) {
SCR_DrawFill (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH_ALL, 0, 0, 0, 255);
SCR_DrawFill (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH_ALL, false, 0, 0, 0, 255);
// SCR_DrawPic (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH, LOADSCREEN_NAME, 1.0);
SCR_GetPicPosWidth (LOADSCREEN_NAME, &picX, &picW);
SCR_DrawPic (picX, 0, picW, SCREEN_HEIGHT, ALIGN_CENTER, LOADSCREEN_NAME, 1.0);
SCR_DrawPic (picX, 0, picW, SCREEN_HEIGHT, ALIGN_CENTER, false, LOADSCREEN_NAME, 1.0);
}
// else draw black screen
else
SCR_DrawFill (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH_ALL, 0, 0, 0, 255);
SCR_DrawFill (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH_ALL, false, 0, 0, 0, 255);
isMap = true;
}
else if (R_DrawFindPic(LOADSCREEN_NAME)) {
SCR_DrawFill (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH_ALL, 0, 0, 0, 255);
SCR_DrawFill (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH_ALL, false, 0, 0, 0, 255);
// SCR_DrawPic (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH, LOADSCREEN_NAME, 1.0);
SCR_GetPicPosWidth (LOADSCREEN_NAME, &picX, &picW);
SCR_DrawPic (picX, 0, picW, SCREEN_HEIGHT, ALIGN_CENTER, LOADSCREEN_NAME, 1.0);
SCR_DrawPic (picX, 0, picW, SCREEN_HEIGHT, ALIGN_CENTER, false, LOADSCREEN_NAME, 1.0);
}
else
SCR_DrawFill (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH_ALL, 0, 0, 0, 255);
SCR_DrawFill (0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_STRETCH_ALL, false, 0, 0, 0, 255);
// Add Download info stuff...
#ifdef USE_CURL // HTTP downloading from R1Q2
@ -1901,12 +2216,12 @@ Scroll it up or down
void SCR_RunConsole (void)
{
// Knightmare- clamp console height
//if (con_height->value < 0.1f || con_height->value > 1.0f)
// Cvar_SetValue( "con_height", ClampCvar( 0.1, 1, con_height->value ) );
//if (scr_conheight->value < 0.1f || con_height->value > 1.0f)
// Cvar_SetValue( "scr_conheight", ClampCvar( 0.1, 1, scr_conheight->value ) );
// decide on the height of the console
if (cls.consoleActive) // (cls.key_dest == key_console)
//scr_conlines = halfconback?0.5:con_height->value; // variable height console
//scr_conlines = halfconback ? 0.5 : scr_conheight->value; // variable height console
scr_conlines = 0.5;
else
scr_conlines = 0; // none visible
@ -2106,10 +2421,10 @@ void SCR_TileClear (void)
{
int top, bottom, left, right;
int w, h;
drawStruct_t ds;
if (scr_con_current == 1.0)
return; // full screen console
// if (scr_viewsize->value == 100)
if (scr_viewsize->integer == 100)
return; // full screen rendering
if (cl.cinematictime > 0)
@ -2123,17 +2438,31 @@ void SCR_TileClear (void)
left = cl.refdef.x;
right = left + cl.refdef.width-1;
memset (&ds, 0, sizeof(drawStruct_t));
ds.pic = "backtile";
ds.flags |= DSFLAG_TILED;
Vector2Copy (vec2_origin, ds.offset);
Vector4Copy (vec4_identity, ds.color);
// clear above view screen
R_DrawTileClear (0, 0, w, top, "backtile");
ds.x = 0; ds.y = 0; ds.w = w; ds.h = top;
R_DrawPic (ds);
// R_DrawTileClear (0, 0, w, top, "backtile");
// clear below view screen
R_DrawTileClear (0, bottom, w, h - bottom, "backtile");
ds.x = 0; ds.y = bottom; ds.w = w; ds.h = h - bottom;
R_DrawPic (ds);
// R_DrawTileClear (0, bottom, w, h - bottom, "backtile");
// clear left of view screen
R_DrawTileClear (0, top, left, bottom - top + 1, "backtile");
ds.x = 0; ds.y = top; ds.w = left; ds.h = bottom - top + 1;
R_DrawPic (ds);
// R_DrawTileClear (0, top, left, bottom - top + 1, "backtile");
// clear right of view screen
R_DrawTileClear (right, top, w - right, bottom - top + 1, "backtile");
ds.x = right; ds.y = top; ds.w = w - right; ds.h = bottom - top + 1;
R_DrawPic (ds);
// R_DrawTileClear (right, top, w - right, bottom - top + 1, "backtile");
}
@ -2180,8 +2509,8 @@ void DrawDemoMessage (void)
char *message = "Running Demo";
len = (int)strlen(message);
SCR_DrawFill (0, SCREEN_HEIGHT-(MENU_FONT_SIZE+3), SCREEN_WIDTH, MENU_FONT_SIZE+4, ALIGN_BOTTOM_STRETCH, 60, 60, 60, 255); // go 1 pixel past screen bottom to prevent gap from scaling
SCR_DrawFill (0, SCREEN_HEIGHT-(MENU_FONT_SIZE+3), SCREEN_WIDTH, 1, ALIGN_BOTTOM_STRETCH, 0, 0, 0, 255);
SCR_DrawFill (0, SCREEN_HEIGHT-(MENU_FONT_SIZE+3), SCREEN_WIDTH, MENU_FONT_SIZE+4, ALIGN_BOTTOM_STRETCH, false, 60, 60, 60, 255); // go 1 pixel past screen bottom to prevent gap from scaling
SCR_DrawFill (0, SCREEN_HEIGHT-(MENU_FONT_SIZE+3), SCREEN_WIDTH, 1, ALIGN_BOTTOM_STRETCH, false, 0, 0, 0, 255);
SCR_DrawString (SCREEN_WIDTH/2-(len/2)*MENU_FONT_SIZE, SCREEN_HEIGHT-(MENU_FONT_SIZE+1), MENU_FONT_SIZE, ALIGN_BOTTOM, message, FONT_SCREEN, 255);
}
}

View file

@ -197,3 +197,127 @@ void CL_DrawStringGeneric (int x, int y, const char *string, fontslot_t font, in
character, font, textScale, red, green, blue, alpha, italic, flushChar );
}
}
/*
================
CL_DrawStringFromCharsPic
================
*/
void CL_DrawStringFromCharsPic (float x, float y, float w, float h, vec2_t offset, float width, char *string, color_t color, char *pic, int flags)
{
vec4_t modulate, shadowModulate, texCorners;
char line[1024], *l;
int len, ch;
float xx, yy, ofsX, ofsY, col, row;
char modifier;
int red, green, blue, italic, shadow, bold, reset;
qboolean modified;
drawStruct_t ds;
memset (&ds, 0, sizeof(drawStruct_t));
Vector4Set (modulate, (float)color[0] * DIV255, (float)color[1] * DIV255, (float)color[2] * DIV255, (float)color[3] * DIV255);
Vector4Set (shadowModulate, 0, 0, 0, modulate[3]);
ofsX = w * 0.125;
ofsY = h * 0.125;
yy = y;
while (*string)
{
// Get a line of text
len = 0;
while (*string)
{
if (*string == '\n') {
string++;
break;
}
line[len++] = *string++;
if (len == sizeof(line)-1)
break;
}
line[len] = 0;
// Align the text as appropriate
if (flags & DSF_LEFT)
xx = x;
else if (flags & DSF_CENTER)
xx = x + ((width - (stringLen(line) * w)) / 2);
else if (flags & DSF_RIGHT)
xx = x + (width - (stringLen(line) * w));
else // default
xx = x;
// Convert to lower/upper case if needed
if (flags & DSF_LOWERCASE)
Q_strlwr(line);
if (flags & DSF_UPPERCASE)
Q_strupr(line);
// Draw it
l = line;
while (*l)
{
/* if (Q_IsColorString(l))
{
if (!(flags & DSF_FORCECOLOR)) {
// *(unsigned *)modulate = *(unsigned *)colorTable[Q_ColorIndex(*(l+1))];
modulate[3] = (float)color[3] * DIV255;
}
l += 2;
continue;
}*/
modifier = l[0];
if (modifier & 128) modifier &= ~128;
if (modifier == '^' && *(l+1) != 0)
{
reset = 0;
modifier = l[1];
if (modifier & 128) modifier &= ~128;
if (modifier != '^')
{
modified = CL_StringSetParams(modifier, &red, &green, &blue, &bold, &shadow, &italic, &reset);
if (reset)
red = green = blue = 255;
if (modified) {
Vector4Set (modulate, (float)red*DIV255, (float)green*DIV255, (float)blue*DIV255, modulate[3]);
l += 2;
continue;
}
}
}
ch = *l++;
ch &= 255;
ch &= ~128;
if (ch != ' ')
{
col = (ch & 15) * 0.0625;
row = (ch >> 4) * 0.0625;
Vector4Set (texCorners, col, row, col + 0.0625, row + 0.0625);
ds.pic = pic;
ds.w = w; ds.h = h;
ds.flags |= DSFLAG_USESTCOORDS;
Vector2Copy (offset, ds.offset);
Vector4Copy (texCorners, ds.stCoords);
if (flags & DSF_DROPSHADOW || shadow)
{
ds.x = xx + ofsX; ds.y = yy + ofsY;
Vector4Copy (shadowModulate, ds.color);
R_DrawPic (ds);
// R_DrawPic (xx + ofsX, yy + ofsY, w, h, offset, texCorners, shadowModulate, pic);
}
ds.x = xx; ds.y = yy;
Vector4Copy (modulate, ds.color);
R_DrawPic (ds);
// R_DrawPic (xx, yy, w, h, offset, texCorners, modulate, pic);
}
xx += w;
}
yy += h;
}
}

View file

@ -412,11 +412,10 @@ extern cvar_t *cl_particle_scale;
// whether to adjust fov for wide aspect rattio
extern cvar_t *cl_widescreen_fov;
extern cvar_t *con_alpha; // Psychospaz's transparent console
//extern cvar_t *con_height; // how far the console drops down
extern cvar_t *con_newconback; // whether to use new console background
extern cvar_t *con_oldconbar; // whether to draw bottom bar on old console
extern cvar_t *scr_conalpha; // Psychospaz's transparent console
extern cvar_t *scr_newconback; // whether to use new console background
extern cvar_t *scr_oldconbar; // whether to draw bottom bar on old console
//extern cvar_t *scr_conheight; // how far the console drops down
// Psychospaz's chasecam
extern cvar_t *cg_thirdperson;
@ -565,6 +564,7 @@ extern sizebuf_t net_message;
qboolean CL_StringSetParams (char modifier, int *red, int *green, int *blue, int *bold, int *shadow, int *italic, int *reset);
void Con_DrawString (int x, int y, char *s, fontslot_t font, int alpha);
void CL_DrawStringGeneric (int x, int y, const char *string, fontslot_t font, int alpha, int fontSize, textscaletype_t scaleType, qboolean altBit);
void CL_DrawStringFromCharsPic (float x, float y, float w, float h, vec2_t offset, float width, char *string, color_t color, char *pic, int flags);
// cl_scrn.c
typedef struct
@ -767,18 +767,23 @@ void R_RenderFrame (refdef_t *fd);
void R_SetParticlePicture (int num, char *name); // Knightmare added
void R_DrawGetPicSize (int *w, int *h, char *name); // will return 0 0 if not found
void R_DrawPic (int x, int y, char *name);
// added alpha for Psychospaz's transparent console
void R_DrawStretchPic (int x, int y, int w, int h, char *name, float alpha);
void R_DrawScaledPic (int x, int y, float scale, float alpha, char *name);
// added char scaling from Quake2Max
void R_DrawChar (float x, float y, int c, fontslot_t font, float scale,
int red, int green, int blue, int alpha, qboolean italic, qboolean last);
void R_DrawString (float x, float y, const char *string, fontslot_t font, float scale,
int red, int green, int blue, int alpha, qboolean italic, qboolean shadow);
void R_DrawTileClear (int x, int y, int w, int h, char *name);
void R_DrawGetPicSize (int *w, int *h, char *name); // will return 0 0 if not found
void R_DrawPic (drawStruct_t ds);
//void R_DrawPic (int x, int y, char *name);
// added alpha for Psychospaz's transparent console
//void R_DrawStretchPic (int x, int y, int w, int h, char *name, float alpha);
//void R_DrawScaledPic (int x, int y, float scale, float alpha, char *name);
//void R_DrawTileClear (int x, int y, int w, int h, char *name);
void R_DrawFill (int x, int y, int w, int h, int red, int green, int blue, int alpha);
void R_DrawCameraEffect (void);
void R_GrabScreen (void); // screenshots for savegames
@ -786,8 +791,6 @@ void R_ScaledScreenshot (char *name); // screenshots for savegames
int R_MarkFragments (const vec3_t origin, const vec3_t axis[3], float radius, int maxPoints, vec3_t *points, int maxFragments, markFragment_t *fragments);
//void R_SetFogVars (qboolean enable, int model, int density, int start, int end, int red, int green, int blue);
float R_CharMapScale (void); // Knightmare added char scaling from Quake2Max
// Draw images for cinematic rendering (which can have a different palette). Note that calls

View file

@ -75,6 +75,27 @@ typedef enum
FONT_UI
} fontslot_t;
#define DSFLAG_USESTCOORDS 0x0001 // use passed st coords instead of texture's st coords
#define DSFLAG_TILED 0x0002 // tile image instead of stretching
#define DSFLAG_SCALED 0x0004 // scale up using scale values, instead of width and height
#define DSFLAG_CLAMP 0x0004 // texture edge clamping
#define DSFLAG_MASKED 0x0008 // use mask image
typedef struct
{
int x;
int y;
int w;
int h;
vec2_t scroll;
vec2_t scale;
vec2_t offset;
vec4_t stCoords;
vec4_t color;
char *pic;
char *maskPic;
unsigned flags;
} drawStruct_t;
typedef struct entity_s
{

View file

@ -22,18 +22,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// screen.h
typedef struct
{
float x;
float y;
float min;
} screenscale_t;
//screenscale_t screenScale;
typedef enum
{
ALIGN_UNSET = 0,
ALIGN_STRETCH,
ALIGN_STRETCH_ALL,
ALIGN_CENTER,
@ -57,10 +48,47 @@ SCALETYPE_HUD,
SCALETYPE_MENU
} textscaletype_t;
typedef struct
{
float x;
float y;
float min;
} screenscale_t;
#define STAT_MINUS 10 // num frame for '-' stats digit
#define CHAR_WIDTH 16
// flags for hud drawing items
#define DSF_FORCECOLOR 1
#define DSF_DROPSHADOW 2
#define DSF_LEFT 4
#define DSF_CENTER 8
#define DSF_RIGHT 16
#define DSF_LOWERCASE 32
#define DSF_UPPERCASE 64
#define DSF_FLIPX 128
#define DSF_FLIPY 256
#define DSF_OVERRIDEPATH 512
#define DSF_RENAMESHADER 1024
#define DSF_MASKSHADER 2048 // uses shaderMinus for mask image
// Psychospaz's scaled menu stuff
#define SCREEN_WIDTH 640.0f
#define SCREEN_HEIGHT 480.0f
#define STANDARD_ASPECT_RATIO ((float)SCREEN_WIDTH/(float)SCREEN_HEIGHT)
// rendered size of console font - everthing adjusts to this...
#define FONT_SIZE SCR_ScaledScreen(con_font_size->value)
#define CON_FONT_SCALE SCR_ScaledScreen(con_font_size->value)/8.0f
#define MENU_FONT_SIZE 8
#define MENU_LINE_SIZE 10
#define HUD_FONT_SIZE 8.0
extern char *sb_nums[2][11];
extern float scr_con_current;
@ -81,23 +109,14 @@ extern cvar_t *crosshair_pulse;
extern vrect_t scr_vrect; // position of render window
extern color_t color_identity;
extern vec4_t vec4_identity;
extern vec4_t stCoord_default;
extern vec4_t stCoord_tile;
extern char crosshair_pic[MAX_QPATH];
extern int crosshair_width, crosshair_height;
// Psychospaz's scaled menu stuff
#define SCREEN_WIDTH 640.0f
#define SCREEN_HEIGHT 480.0f
#define STANDARD_ASPECT_RATIO ((float)SCREEN_WIDTH/(float)SCREEN_HEIGHT)
// rendered size of console font - everthing adjusts to this...
#define FONT_SIZE SCR_ScaledScreen(con_font_size->value)
#define CON_FONT_SCALE SCR_ScaledScreen(con_font_size->value)/8.0f
#define MENU_FONT_SIZE 8
#define MENU_LINE_SIZE 10
#define HUD_FONT_SIZE 8.0
//
// cl_screen.c
//
@ -123,8 +142,18 @@ void SCR_ScaleCoords (float *x, float *y, float *w, float *h, scralign_t align);
float SCR_ScaledScreen (float param);
float SCR_GetScreenScale (void);
void SCR_DrawFill (float x, float y, float width, float height, scralign_t align, int red, int green, int blue, int alpha);
void SCR_DrawPic (float x, float y, float width, float height, scralign_t align, char *pic, float alpha);
void SCR_DrawFill (float x, float y, float width, float height, scralign_t align, qboolean roundOut, int red, int green, int blue, int alpha);
void SCR_DrawBorder (float x, float y, float width, float height, float borderSize, scralign_t align, qboolean roundOut, int red, int green, int blue, int alpha);
//void SCR_DrawPic (float x, float y, float width, float height, scralign_t align, char *pic, float alpha);
void SCR_DrawPic (float x, float y, float width, float height, scralign_t align, qboolean roundOut, char *pic, float alpha);
void SCR_DrawScaledPic (float x, float y, float scale, qboolean centerCoords, qboolean roundOut, char *pic, float alpha);
void SCR_DrawLegacyPic (float x, float y, float scale, char *pic, float alpha);
void SCR_DrawColoredPic (float x, float y, float width, float height, scralign_t align, qboolean roundOut, color_t color, char *pic);
void SCR_DrawOffsetPic (float x, float y, float width, float height, vec2_t offset, scralign_t align, qboolean roundOut, color_t color, char *pic);
void SCR_DrawOffsetPicST (float x, float y, float width, float height, vec2_t offset, vec4_t texCorners, scralign_t align, qboolean roundOut, color_t color, char *pic);
void SCR_DrawScrollPic (float x, float y, float width, float height, vec2_t offset, vec4_t texCorners, vec2_t scroll, scralign_t align, qboolean roundOut, color_t color, char *pic);
void SCR_DrawMaskedPic (float x, float y, float width, float height, vec2_t offset, vec4_t texCorners, vec2_t scroll, scralign_t align, qboolean roundOut, color_t color, char *pic, char *maskPic);
void SCR_DrawTiledPic (float x, float y, float width, float height, scralign_t align, qboolean roundOut, char *pic, float alpha);
void SCR_DrawChar (float x, float y, int size, scralign_t align, int num, fontslot_t font, int red, int green, int blue, int alpha, qboolean italic, qboolean last);
void SCR_DrawString (float x, float y, int size, scralign_t align, const char *string, fontslot_t font, int alpha);
void SCR_DrawCrosshair (void);

View file

@ -892,6 +892,7 @@ void S_AddLoopSounds (void)
sfxcache_t *sc;
int num;
float dist_mult;
vec3_t origin_v; // Knightmare added
entity_state_t *ent;
if (cl_paused->value)
@ -941,19 +942,27 @@ void S_AddLoopSounds (void)
if (ent->solid == 31) // special value for bmodels
{
cmodel_t *cmodel;
vec3_t origin_v;
qboolean outofbounds = false;
int k;
cmodel = cl.model_clip[ent->modelindex];
if (cmodel) {
for (k=0; k<3; k++)
if (ent->origin[k] < cmodel->mins[k] || ent->origin[k] > cmodel->maxs[k])
outofbounds = true;
}
if (cmodel && outofbounds) {
for (k=0; k<3; k++)
origin_v[k] = ent->origin[k] + 0.5 * (cmodel->mins[k] + cmodel->maxs[k]);
}
else
VectorCopy (ent->origin, origin_v);
}
else
VectorCopy (ent->origin, origin_v);
// find the total contribution of all sounds of this type
S_SpatializeOrigin (origin_v, 255.0, dist_mult, //SOUND_LOOPATTENUATE, // was ent->origin
S_SpatializeOrigin (origin_v, 255.0, dist_mult, // SOUND_LOOPATTENUATE // was ent->origin
&left_total, &right_total);
for (j=i+1; j<cl.frame.num_entities; j++)
{
@ -964,33 +973,11 @@ void S_AddLoopSounds (void)
num = (cl.frame.parse_entities + j)&(MAX_PARSE_ENTITIES-1);
ent = &cl_parse_entities[num];
S_SpatializeOrigin (origin_v, 255.0, dist_mult, //SOUND_LOOPATTENUATE, // was ent->origin
S_SpatializeOrigin (origin_v, 255.0, dist_mult, // SOUND_LOOPATTENUATE // was ent->origin
&left, &right);
left_total += left;
right_total += right;
}
}
else // somebody please tell me why this has to stay unchanged to work (pointer to ent->origin won't work)
{
// find the total contribution of all sounds of this type
S_SpatializeOrigin (ent->origin, 255.0, dist_mult, //SOUND_LOOPATTENUATE, // was ent->origin
&left_total, &right_total);
for (j=i+1 ; j<cl.frame.num_entities ; j++)
{
if (sounds[j] != sounds[i])
continue;
sounds[j] = 0; // don't check this again later
num = (cl.frame.parse_entities + j)&(MAX_PARSE_ENTITIES-1);
ent = &cl_parse_entities[num];
S_SpatializeOrigin (ent->origin, 255.0, dist_mult, //SOUND_LOOPATTENUATE, // was ent->origin
&left, &right);
left_total += left;
right_total += right;
}
}
// end Knightmare
if (left_total == 0 && right_total == 0)
continue; // not audible

View file

@ -2457,9 +2457,13 @@ void ClientCommand (edict_t *ent)
else if (developer->value)
{
if (!Q_stricmp(cmd, "lightswitch"))
{
ToggleLights ();
}
else if (!Q_stricmp(cmd, "bbox"))
{
Cmd_Bbox_f (ent);
}
else if (!Q_stricmp(cmd, "forcewall"))
{
SpawnForcewall(ent);
@ -2470,14 +2474,19 @@ void ClientCommand (edict_t *ent)
}
else if (!Q_stricmp(cmd, "freeze"))
{
if (level.freeze)
if (level.freeze) {
gi.dprintf ("Unfreezing time.\n", (int)sk_stasis_time->value);
level.freeze = false;
}
else
{
if (ent->client->jetpack)
gi.dprintf("Cannot use freeze while using jetpack\n");
else
else {
gi.dprintf ("Freezing time for %d seconds.\n", (int)sk_stasis_time->value);
level.freeze = true;
level.freezeframes = 0;
}
}
}
else if (!Q_stricmp(cmd, "hint_test"))
@ -2486,7 +2495,10 @@ void ClientCommand (edict_t *ent)
int result;
viewing = LookingAt(ent, LOOKAT_MD2, NULL, NULL);
if (!viewing)
{
gi.dprintf("Not looking at an entity.\n");
return;
}
if (viewing->monsterinfo.aiflags & AI_HINT_TEST)
{
viewing->monsterinfo.aiflags &= ~AI_HINT_TEST;
@ -2512,7 +2524,9 @@ void ClientCommand (edict_t *ent)
vtos(viewing->movetarget->s.origin),
visible(viewing, viewing->movetarget) ? "I see it." : "I don't see it.");
break;
default: gi.dprintf("Unknown error\n");
default:
gi.dprintf("Unknown error\n");
break;
}
}
else if (!Q_stricmp(cmd, "entid"))
@ -2724,6 +2738,29 @@ void ClientCommand (edict_t *ent)
}
viewing->monsterinfo.currentmove = &actor_move_switch;
}
else if (!Q_stricmp(cmd, "resettargets"))
{
edict_t *e;
int i;
int count;
gi.dprintf("Resetting all monsters' enemies...\n");
count = 0;
for (i=0, e=&g_edicts[0]; i<globals.num_edicts; i++, e++)
{
if (!e->inuse)
continue;
if ( !(e->svflags & SVF_MONSTER) )
continue;
if (e->health <= 0)
continue;
e->enemy = e->oldenemy = NULL;
e->monsterinfo.pausetime = 0;
e->monsterinfo.stand (e);
count++;
}
gi.dprintf("reset %d monsters' enemies, done.\n", count);
}
#ifndef KMQUAKE2_ENGINE_MOD // these functions moved clientside in engine
else if (!Q_stricmp(cmd, "texture"))
{

View file

@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "g_local.h"
//==========================================================
void Lights()
void Lights (void)
{
if (lights->value)
{
@ -82,7 +82,7 @@ void Lights()
}
}
void ToggleLights()
void ToggleLights (void)
{
gi.cvar_set ("lights", va("%i", !lights->value));
// lights->value = !lights->value;

View file

@ -104,6 +104,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define FL2_TURRET_DOUBLE 0x00000001 // this is a double-barreled turret
#define FL2_TURRET_DOUBLE_ALT 0x00000002 // this turret alternates firing its barrels (style is set)
#define FL2_TURRET_DOUBLE_ALT_FIRING 0x00000004 // secondary barrel in use for alternate firing
#define FL2_CRUCIFIED 0x00000008 // insane is crucified
#define FRAMETIME 0.1

View file

@ -545,7 +545,8 @@ void G_RunFrame (void)
level.freezeframes++;
if (level.freezeframes >= sk_stasis_time->value*10)
level.freeze = false;
} else
}
else
level.framenum++;
level.time = level.framenum*FRAMETIME;

View file

@ -528,7 +528,8 @@ void M_MoveFrame (edict_t *self)
// Lazarus: For live monsters weaker than gladiator who aren't already running from
// something, evade live grenades on the ground.
if ((self->health > 0) && (self->max_health < 400) && !(self->monsterinfo.aiflags & AI_CHASE_THING) && self->monsterinfo.run)
if ( (self->health > 0) && (self->max_health < 400) && !(self->monsterinfo.aiflags & AI_CHASE_THING) && self->monsterinfo.run
&& !((Q_stricmp(self->classname, "misc_insane") == 0) && (self->moreflags & FL2_CRUCIFIED)) ) // Knightmare- crucified insanes don't evade
Grenade_Evade (self);
move = self->monsterinfo.currentmove;
@ -1416,6 +1417,7 @@ int PatchMonsterModel (char *modelname)
return 1;
}
void HintTestNext (edict_t *self, edict_t *hint)
{
edict_t *next=NULL;

View file

@ -47,7 +47,8 @@ Initializes all hint_path chains in a map.
*/
void SetupHintPaths (void)
{
int i, keyofs;
int i;
size_t keyofs;
edict_t *thisPath, *ent;
// check if there are any hint_paths in this map first

View file

@ -506,7 +506,7 @@ void insane_pain (edict_t *self, edict_t *other, float kick, int damage)
// Don't go into pain frames if crucified.
// if (self->spawnflags & 8)
if ( (self->spawnflags & 8) || (self->moreflags & 8) ) // Knightmare- use moreflags field instead
if ( (self->spawnflags & 8) || (self->moreflags & FL2_CRUCIFIED) ) // Knightmare- use moreflags field instead
{
self->monsterinfo.currentmove = &insane_move_struggle_cross;
return;
@ -551,7 +551,7 @@ void insane_checkup (edict_t *self)
void insane_stand (edict_t *self)
{
// if (self->spawnflags & 8) // If crucified
if ( (self->spawnflags & 8) || (self->moreflags & 8) ) // If crucified // Knightmare- use moreflags field instead
if ( (self->spawnflags & 8) || (self->moreflags & FL2_CRUCIFIED) ) // If crucified // Knightmare- use moreflags field instead
{
self->monsterinfo.currentmove = &insane_move_cross;
self->monsterinfo.aiflags |= AI_STAND_GROUND;
@ -570,7 +570,7 @@ void insane_stand (edict_t *self)
void insane_dead (edict_t *self)
{
// if (self->spawnflags & 8)
if ( (self->spawnflags & 8) || (self->moreflags & 8) ) // Knightmare- use moreflags field instead
if ( (self->spawnflags & 8) || (self->moreflags & FL2_CRUCIFIED) ) // Knightmare- use moreflags field instead
{
self->flags |= FL_FLY;
}
@ -619,7 +619,7 @@ void insane_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damag
self->takedamage = DAMAGE_YES;
// if (self->spawnflags & 8)
if ( (self->spawnflags & 8) || (self->moreflags & 8) ) // Knightmare- use moreflags field instead
if ( (self->spawnflags & 8) || (self->moreflags & FL2_CRUCIFIED) ) // Knightmare- use moreflags field instead
{
insane_dead (self);
}
@ -708,7 +708,7 @@ void SP_misc_insane (edict_t *self)
{
// Knightmare- Spawnflag 8 collides with SF_MONSTER_GOODGUY, and can be cleared in some instances.
// This prevents it from screwing up crucified insanes.
self->moreflags |= 8;
self->moreflags |= FL2_CRUCIFIED;
VectorSet (self->mins, -16, 0, 0);
VectorSet (self->maxs, 16, 8, 32);
self->flags |= FL_NO_KNOCKBACK;

View file

@ -534,8 +534,8 @@ void SV_CalcBlend (edict_t *ent)
// add for damage
if (ent->client->damage_alpha > 0)
SV_AddBlend (ent->client->damage_blend[0],ent->client->damage_blend[1]
,ent->client->damage_blend[2], ent->client->damage_alpha, ent->client->ps.blend);
SV_AddBlend (ent->client->damage_blend[0], ent->client->damage_blend[1],
ent->client->damage_blend[2], ent->client->damage_alpha, ent->client->ps.blend);
if (ent->client->bonus_alpha > 0)
SV_AddBlend (0.85, 0.7, 0.3, ent->client->bonus_alpha, ent->client->ps.blend);

View file

@ -689,8 +689,8 @@ qboolean FindTarget (edict_t *self)
edict_t *reflection = NULL;
edict_t *self_reflection = NULL;
// if ((self->monsterinfo.aiflags & AI_CHASE_THING) || (self->monsterinfo.aiflags2 & AI2_HINT_TEST) )
// return false;
if ((self->monsterinfo.aiflags & AI_CHASE_THING) || (self->monsterinfo.aiflags2 & AI2_HINT_TEST) )
return false;
if (self->monsterinfo.aiflags & AI_GOOD_GUY)
{
@ -1328,13 +1328,14 @@ void ai_run_slide(edict_t *self, float distance)
ofs = angle;
else
ofs = -angle;
//
// if (!(self->flags & FL_FLY))
// {
// // non fliers should actually turn towards the direction their trying to run
// self->ideal_yaw += ofs;
// }
//
/* if (!(self->flags & FL_FLY))
{
// non fliers should actually turn towards the direction their trying to run
self->ideal_yaw += ofs;
}
*/
if (!(self->monsterinfo.aiflags & AI_MANUAL_STEERING))
M_ChangeYaw (self);
@ -1661,11 +1662,13 @@ void ai_run (edict_t *self, float dist)
// end Zaero
// if we're going to a combat point, just proceed
if (self->monsterinfo.aiflags & (AI_COMBAT_POINT | AI_CHASE_THING))
if ( (self->monsterinfo.aiflags & (AI_COMBAT_POINT | AI_CHASE_THING))
|| (self->monsterinfo.aiflags2 & AI2_HINT_TEST) )
{
M_MoveToGoal (self, dist);
return;
}
if ( self->monsterinfo.aiflags & AI_MEDIC_PATROL )
{
if (!FindTarget(self))
@ -1913,15 +1916,15 @@ void ai_run (edict_t *self, float dist)
return;
}
//PMM
// if (ai_checkattack (self, dist))
// return;
// if (self->monsterinfo.attack_state == AS_SLIDING)
// {
// ai_run_slide (self, dist);
// return;
// }
/* if (ai_checkattack (self, dist))
return;
if (self->monsterinfo.attack_state == AS_SLIDING)
{
ai_run_slide (self, dist);
return;
}
*/
// PGM - added a little paranoia checking here... 9/22/98
if ((self->enemy) && (self->enemy->inuse) && (enemy_vis))
{

View file

@ -2304,24 +2304,79 @@ void ClientCommand (edict_t *ent)
else
gi.dprintf("syntax: whereis <classname>\n");
}
else if (!Q_stricmp(cmd, "bbox"))
Cmd_Bbox_f (ent);
else if (developer->value)
{
if (!Q_stricmp(cmd, "forcewall"))
if (!Q_stricmp(cmd, "lightswitch"))
{
ToggleLights ();
}
else if (!Q_stricmp(cmd, "bbox"))
{
Cmd_Bbox_f (ent);
}
else if (!Q_stricmp(cmd, "forcewall"))
{
SpawnForcewall (ent);
}
else if (!Q_stricmp(cmd, "forcewall_off"))
{
ForcewallOff (ent);
}
else if (!Q_stricmp(cmd, "freeze"))
{
if (level.freeze)
if (level.freeze) {
gi.dprintf ("Unfreezing time.\n", (int)sk_stasis_time->value);
level.freeze = false;
}
else
{
if (ent->client->jetpack)
gi.dprintf("Cannot use freeze while using jetpack\n");
else
else {
gi.dprintf ("Freezing time for %d seconds.\n", (int)sk_stasis_time->value);
level.freeze = true;
level.freezeframes = 0;
}
}
}
else if (!Q_stricmp(cmd, "hint_test"))
{
edict_t *viewing;
int result;
viewing = LookingAt(ent, LOOKAT_MD2, NULL, NULL);
if (!viewing)
{
gi.dprintf("Not looking at an entity.\n");
return;
}
if (viewing->monsterinfo.aiflags2 & AI2_HINT_TEST)
{
viewing->monsterinfo.aiflags2 &= ~AI2_HINT_TEST;
gi.dprintf("%s (%s): Back to my normal self now.\n",
viewing->classname, viewing->targetname);
return;
}
if (!(viewing->svflags & SVF_MONSTER))
gi.dprintf("hint_test is only valid for monsters and actors.\n");
result = HintTestStart(viewing);
switch (result)
{
case -1:
gi.dprintf("%s (%s): I cannot see any hint_paths from here.\n");
break;
case 0:
gi.dprintf("This map does not contain hint_paths.\n");
break;
case 1:
gi.dprintf("%s (%s) searching for hint_path %s at %s. %s\n",
viewing->classname, (viewing->targetname ? viewing->targetname : "<noname>"),
(viewing->movetarget->targetname ? viewing->movetarget->targetname : "<noname>"),
vtos(viewing->movetarget->s.origin),
visible(viewing, viewing->movetarget) ? "I see it." : "I don't see it.");
break;
default:
gi.dprintf("Unknown error\n");
break;
}
}
else if (!Q_stricmp(cmd, "entid"))
@ -2520,8 +2575,29 @@ void ClientCommand (edict_t *ent)
}
viewing->monsterinfo.currentmove = &actor_move_switch;
}
// else if (!Q_stricmp(cmd,"lightswitch"))
// ToggleLights();
else if (!Q_stricmp(cmd, "resettargets"))
{
edict_t *e;
int i;
int count;
gi.dprintf("Resetting all monsters' enemies...\n");
count = 0;
for (i=0, e=&g_edicts[0]; i<globals.num_edicts; i++, e++)
{
if (!e->inuse)
continue;
if ( !(e->svflags & SVF_MONSTER) )
continue;
if (e->health <= 0)
continue;
e->enemy = e->oldenemy = NULL;
e->monsterinfo.pausetime = 0;
e->monsterinfo.stand (e);
count++;
}
gi.dprintf("reset %d monsters' enemies, done.\n", count);
}
else // anything that doesn't match a command will be a chat
Cmd_Say_f (ent, false, true);
}

View file

@ -544,7 +544,7 @@ void M_ReactToDamage (edict_t *targ, edict_t *attacker, edict_t *inflictor)
// If targ is currently chasing a "thing" or we're running a hint_path test, he
// doesn't really care what else is happening
if (targ->monsterinfo.aiflags & AI_CHASE_THING)
if ( (targ->monsterinfo.aiflags & AI_CHASE_THING) || (targ->monsterinfo.aiflags2 & AI2_HINT_TEST) )
return;
// If targ is a robot camera, ignore damage

View file

@ -2243,6 +2243,8 @@ extern qboolean blocked_checknewenemy ( edict_t * self ) ;
extern qboolean blocked_checkjump ( edict_t * self , float dist , float maxDown , float maxUp ) ;
extern qboolean blocked_checkplat ( edict_t * self , float dist ) ;
extern qboolean blocked_checkshot ( edict_t * self , float shotChance ) ;
extern int HintTestStart ( edict_t * self ) ;
extern void HintTestNext ( edict_t * self , edict_t * hint ) ;
extern int PatchMonsterModel ( char * modelname ) ;
extern void InitiallyDead ( edict_t * self ) ;
extern void monster_done_dodge ( edict_t * self ) ;
@ -2534,8 +2536,8 @@ extern void SP_target_lock_digit ( edict_t * self ) ;
extern void SP_target_lightswitch ( edict_t * self ) ;
extern void use_target_lightswitch ( edict_t * self , edict_t * other , edict_t * activator ) ;
extern void target_lightswitch_toggle ( edict_t * self ) ;
extern void ToggleLights ( ) ;
extern void Lights ( ) ;
extern void ToggleLights ( void ) ;
extern void Lights ( void ) ;
extern void Jet_ApplyJet ( edict_t * ent , usercmd_t * ucmd ) ;
extern void Jet_ApplySparks ( edict_t * ent ) ;
extern void Jet_ApplyLifting ( edict_t * ent ) ;

View file

@ -2243,6 +2243,8 @@
{"blocked_checkjump", (byte *)blocked_checkjump},
{"blocked_checkplat", (byte *)blocked_checkplat},
{"blocked_checkshot", (byte *)blocked_checkshot},
{"HintTestStart", (byte *)HintTestStart},
{"HintTestNext", (byte *)HintTestNext},
{"PatchMonsterModel", (byte *)PatchMonsterModel},
{"InitiallyDead", (byte *)InitiallyDead},
{"monster_done_dodge", (byte *)monster_done_dodge},

View file

@ -1,7 +1,7 @@
#include "g_local.h"
//==========================================================
void Lights()
void Lights (void)
{
if (lights->value)
{
@ -59,7 +59,7 @@ void Lights()
}
}
void ToggleLights()
void ToggleLights (void)
{
gi.cvar_set ("lights", va("%i", !lights->value));
// lights->value = !lights->value;

View file

@ -1388,6 +1388,8 @@ void monster_fire_flechette (edict_t *self, vec3_t start, vec3_t dir, int damage
void monster_fire_prox (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int damage_multiplier, int speed, int health, float timer, float damage_radius, int flashtype);
// SKWiD MOD
void monster_fire_plasma_rifle (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, qboolean spread);
void HintTestNext (edict_t *self, edict_t *hint);
int HintTestStart (edict_t *self);
void M_droptofloor (edict_t *ent);
void monster_think (edict_t *self);
@ -1739,6 +1741,7 @@ void kick_attack (edict_t *ent);
//
// g_newweap.c
//
#define PROX_TEST_SIZE 7.0f
//extern float nuke_framenum;
void fire_flechette (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage);
//void fire_prox (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed);

View file

@ -1120,9 +1120,10 @@ void M_MoveFrame (edict_t *self)
// Lazarus: For live monsters weaker than the tank who aren't already running from
// something, evade live grenades on the ground.
if ((self->health > 0) && (self->max_health < 750) && !(self->monsterinfo.aiflags & AI_CHASE_THING) && self->monsterinfo.run) // was self->max_health < 400
/* if ((self->health > 0) && (self->max_health < 750) && !(self->monsterinfo.aiflags & AI_CHASE_THING) && self->monsterinfo.run // was self->max_health < 400
&& !((Q_stricmp(self->classname, "misc_insane") == 0) && (self->moreflags & FL2_CRUCIFIED)) ) // Knightmare- crucified insanes don't evade
Grenade_Evade (self);
*/
move = self->monsterinfo.currentmove;
self->nextthink = level.time + FRAMETIME;
@ -2676,3 +2677,121 @@ int PatchMonsterModel (char *modelname)
free (data);
return 1;
}
void HintTestNext (edict_t *self, edict_t *hint)
{
edict_t *next=NULL;
edict_t *e;
vec3_t dir;
self->monsterinfo.aiflags2 &= ~AI2_HINT_TEST;
if (self->goalentity == hint)
self->goalentity = NULL;
if (self->movetarget == hint)
self->movetarget = NULL;
if (self->monsterinfo.pathdir == 1)
{
if (hint->hint_chain)
next = hint->hint_chain;
else
self->monsterinfo.pathdir = -1;
}
if (self->monsterinfo.pathdir == -1)
{
// e = hint_chain_starts[hint->hint_chain_id];
e = hint_path_start[hint->hint_chain_id];
while (e)
{
if (e->hint_chain == hint)
{
next = e;
break;
}
e = e->hint_chain;
}
}
if (!next)
{
self->monsterinfo.pathdir = 1;
next = hint->hint_chain;
}
if (next)
{
self->hint_chain_id = next->hint_chain_id;
VectorSubtract(next->s.origin, self->s.origin, dir);
self->ideal_yaw = vectoyaw(dir);
self->goalentity = self->movetarget = next;
self->monsterinfo.pausetime = 0;
self->monsterinfo.aiflags2 |= AI2_HINT_TEST;
// run for it
self->monsterinfo.run (self);
gi.dprintf("%s (%s): Reached hint_path %s,\nsearching for hint_path %s at %s. %s\n",
self->classname, (self->targetname ? self->targetname : "<noname>"),
(hint->targetname ? hint->targetname : "<noname>"),
(next->targetname ? next->targetname : "<noname>"),
vtos(next->s.origin),
(visible(self,next) ? "I see it." : "I don't see it."));
}
else
{
self->monsterinfo.pausetime = level.time + 100000000;
self->monsterinfo.stand (self);
gi.dprintf("%s (%s): Error finding next/previous hint_path from %s at %s.\n",
self->classname, (self->targetname ? self->targetname : "<noname>"),
(hint->targetname ? hint->targetname : "<noname>"),
vtos(hint->s.origin));
}
}
int HintTestStart (edict_t *self)
{
edict_t *e;
edict_t *hint=NULL;
float dist;
vec3_t dir;
int i;
float bestdistance=99999;
// if (!hint_chains_exist)
if (!hint_paths_present)
return 0;
for (i=game.maxclients+1; i<globals.num_edicts; i++)
{
e = &g_edicts[i];
if (!e->inuse)
continue;
if (Q_stricmp(e->classname, "hint_path"))
continue;
if (!visible(self, e))
continue;
if (!canReach(self, e))
continue;
VectorSubtract (e->s.origin, self->s.origin, dir);
dist = VectorLength(dir);
if (dist < bestdistance)
{
hint = e;
bestdistance = dist;
}
}
if (hint)
{
self->hint_chain_id = hint->hint_chain_id;
if (!self->monsterinfo.pathdir)
self->monsterinfo.pathdir = 1;
VectorSubtract(hint->s.origin, self->s.origin, dir);
self->ideal_yaw = vectoyaw(dir);
self->enemy = self->oldenemy = NULL;
self->goalentity = self->movetarget = hint;
self->monsterinfo.pausetime = 0;
self->monsterinfo.aiflags2 = AI2_HINT_TEST;
// run for it
self->monsterinfo.run (self);
return 1;
}
else
return -1;
}

View file

@ -353,7 +353,7 @@ edict_t *hintpath_findstart (edict_t *ent)
{
edict_t *e;
edict_t *last;
int field;
size_t field;
if (ent->target) // starting point
{
@ -400,7 +400,7 @@ edict_t *hintpath_other_end (edict_t *ent)
{
edict_t *e;
edict_t *last;
int field;
size_t field;
if (ent->target) // starting point
{
@ -509,7 +509,7 @@ qboolean monsterlost_checkhint (edict_t *self)
edict_t *closest;
float closest_range = 1000000;
edict_t *start, *destination;
int field;
size_t field;
int count1=0, count2=0, count3=0, count4=0, count5=0;
float r;
int i;
@ -829,7 +829,7 @@ qboolean monsterlost_checkhint (edict_t *self)
qboolean monsterlost_checkhint2 (edict_t *self)
{
edict_t *e, *e2, *goPoint;
int field;
size_t field;
int playerVisible, selfVisible;
// if there are no hint paths on this map, exit immediately.
@ -930,6 +930,13 @@ void hint_path_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t
return;
}
if (other->monsterinfo.aiflags2 & AI2_HINT_TEST)
{
if (other->movetarget == self)
HintTestNext (other, self);
return;
}
// make sure we're the target of it's obsession
if (other->movetarget == self)
{
@ -1126,7 +1133,8 @@ void SP_hint_path (edict_t *self)
void InitHintPaths (void)
{
edict_t *e, *current;
int field, i, count2;
int i, count2;
size_t field;
qboolean errors = false;
hint_paths_present = 0;

View file

@ -943,8 +943,8 @@ qboolean AimGrenade (edict_t *self, vec3_t start, vec3_t target, vec_t speed, ve
int i;
vec3_t last_aim;
// Knightmare- wider bounds to avoid prox collision
vec3_t proxMins = {-8, -8, -8};
vec3_t proxMaxs = {8, 8, 8};
vec3_t proxMins = {-PROX_TEST_SIZE, -PROX_TEST_SIZE, -PROX_TEST_SIZE};
vec3_t proxMaxs = {PROX_TEST_SIZE, PROX_TEST_SIZE, PROX_TEST_SIZE};
VectorCopy (target, aim_point);
VectorSubtract (aim_point, self->s.origin, from_origin);

View file

@ -431,19 +431,20 @@ void gunner_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damag
// Knightmare added
// This calcs horizontal spread of prox mines based on distance.
// Then it does a short-range trace at blast radius, to ensure we won't clip a wall.
#define GUNNER_PROX_DANGER_RANGE 256.0f
qboolean gunner_prox_safety_check (edict_t *self, vec3_t start, vec3_t target)
{
trace_t tr;
vec3_t closeCheckMins, closeCheckMaxs, dir, dangerOffset, dangerTarget;
float dist, dangerSpread, dangerRange = 256.0f;
float dist, dangerSpread;
// get dist to target
VectorSubtract (target, start, dir);
dist = VectorLength (dir);
// get spread at damger range
dangerSpread = (HALF_GUNNER_PROX_SPREAD / dist) * dangerRange;
dangerSpread += 8.0f; // add bounds of prox mine + 2
dangerSpread = (HALF_GUNNER_PROX_SPREAD / dist) * GUNNER_PROX_DANGER_RANGE;
dangerSpread += PROX_TEST_SIZE; // add bounds of prox mine + 1
VectorSet (closeCheckMins, -dangerSpread, -dangerSpread, -12.0f);
VectorSet (closeCheckMaxs, dangerSpread, dangerSpread, 12.0f);
@ -452,7 +453,7 @@ qboolean gunner_prox_safety_check (edict_t *self, vec3_t start, vec3_t target)
// extrapolate point on path to target at danger range
VectorNormalize (dir);
VectorScale (dir, dangerRange, dangerOffset);
VectorScale (dir, GUNNER_PROX_DANGER_RANGE, dangerOffset);
VectorAdd (start, dangerOffset, dangerTarget);
tr = gi.trace(start, closeCheckMins, closeCheckMaxs, dangerTarget, self, MASK_SHOT);
@ -479,8 +480,8 @@ qboolean gunner_grenade_check (edict_t *self)
// Knightmare- Tactician Gunner fires prox mines in a spread,
// so we need a wider safety bounds check
vec3_t checkMins, checkMaxs;
vec3_t proxMins = {-8, -8, -8};
vec3_t proxMaxs = {8, 8, 8};
vec3_t proxMins = {-PROX_TEST_SIZE, -PROX_TEST_SIZE, -PROX_TEST_SIZE};
vec3_t proxMaxs = {PROX_TEST_SIZE, PROX_TEST_SIZE, PROX_TEST_SIZE};
if (!self->enemy)
return false;

View file

@ -648,6 +648,12 @@ void SP_monster_hound (edict_t *self)
gi.linkentity (self);
self->monsterinfo.currentmove = &hound_stand1;
if (self->health < 0)
{
mmove_t *deathmoves[] = {&hound_move_death,
NULL};
M_SetDeath (self, (mmove_t **)&deathmoves);
}
self->monsterinfo.scale = MODEL_SCALE;
walkmonster_start (self);

View file

@ -1308,6 +1308,13 @@ void SP_monster_sentien (edict_t *self)
}
self->monsterinfo.currentmove = &sentien_move_stand1;
if (self->health < 0)
{
mmove_t *deathmoves[] = {&sentien_move_death1,
&sentien_move_death2,
NULL};
M_SetDeath (self, (mmove_t **)&deathmoves);
}
self->monsterinfo.scale = MODEL_SCALE;
walkmonster_start(self);

View file

@ -553,7 +553,7 @@ void R_DrawAliasMeshes (maliasmodel_t *paliashdr, entity_t *e, qboolean mirrored
}
if (!shellModel)
RB_ModifyTextureCoords (&texCoordArray[0][baseindex][0], &vertexArray[baseindex][0], mesh.num_verts, &skinParms);
RB_ModifyTextureCoords (&texCoordArray[0][baseindex][0], &vertexArray[baseindex][0], mesh.num_verts, &skinParms.tcmod);
// compare renderparms for next mesh and check for overflow
if ( k < (paliashdr->num_meshes-1) ) {

View file

@ -70,14 +70,6 @@ typedef struct
typedef struct
{
qboolean twosided;
qboolean alphatest;
qboolean fullbright;
qboolean nodraw;
qboolean noshadow;
qboolean nodiffuse;
float envmap;
float basealpha;
float translate_x;
float translate_y;
float rotate;
@ -87,7 +79,20 @@ typedef struct
waveFunc_t turb;
float scroll_x;
float scroll_y;
} tcmodParms_t;
typedef struct
{
qboolean twosided;
qboolean alphatest;
qboolean fullbright;
qboolean nodraw;
qboolean noshadow;
qboolean nodiffuse;
qboolean blend;
tcmodParms_t tcmod;
float envmap;
float basealpha;
GLenum blendfunc_src;
GLenum blendfunc_dst;
waveFunc_t glow;

View file

@ -146,7 +146,7 @@ RB_ModifyTextureCoords
borrowed from EGL & Q2E
=================
*/
void RB_ModifyTextureCoords (float *inArray, float *inVerts, int numVerts, renderparms_t *parms)
void RB_ModifyTextureCoords (float *inArray, float *inVerts, int numVerts, tcmodParms_t *parms)
{
int i;
float t1, t2, sint, cost, rad;

View file

@ -320,6 +320,7 @@ image_t *R_DrawFindPic (char *name)
return gl;
}
/*
=============
R_DrawGetPicSize
@ -343,27 +344,22 @@ void R_DrawGetPicSize (int *w, int *h, char *pic)
/*
=============
R_DrawStretchPic
R_DrawPic_Standard
Actual pic drawing code.
Not to be called from other sections.
=============
*/
void R_DrawStretchPic (int x, int y, int w, int h, char *pic, float alpha)
void R_DrawPic_Standard (int x, int y, int w, int h, vec2_t offset, vec4_t stCoords, vec4_t color, int texnum, renderparms_t *parms, qboolean texClamp)
{
image_t *gl;
int i;
vec2_t texCoord[4], verts[4];
gl = R_DrawFindPic (pic);
if (!gl)
{
VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic);
return;
}
if (!parms) return;
if (scrap_dirty)
Scrap_Upload ();
// Psychospaz's transparent console support
if (gl->has_alpha || alpha < 1.0)
if (parms->blend)
{
GL_Disable (GL_ALPHA_TEST);
GL_TexEnv (GL_MODULATE);
@ -371,17 +367,24 @@ void R_DrawStretchPic (int x, int y, int w, int h, char *pic, float alpha)
GL_DepthMask (false);
}
GL_Bind (gl->texnum);
GL_Bind (texnum);
Vector2Set(texCoord[0], gl->sl, gl->tl);
Vector2Set(texCoord[1], gl->sh, gl->tl);
Vector2Set(texCoord[2], gl->sh, gl->th);
Vector2Set(texCoord[3], gl->sl, gl->th);
if (texClamp) {
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
}
Vector2Set(verts[0], x, y);
Vector2Set(verts[1], x+w, y);
Vector2Set(verts[2], x+w, y+h);
Vector2Set(verts[3], x, y+h);
Vector2Set(texCoord[0], stCoords[0], stCoords[1]);
Vector2Set(texCoord[1], stCoords[2], stCoords[1]);
Vector2Set(texCoord[2], stCoords[2], stCoords[3]);
Vector2Set(texCoord[3], stCoords[0], stCoords[3]);
Vector2Set(verts[0], x+offset[0], y+offset[1]);
Vector2Set(verts[1], x+w+offset[0], y-offset[1]);
Vector2Set(verts[2], x+w-offset[0], y+h-offset[1]);
Vector2Set(verts[3], x-offset[0], y+h+offset[1]);
RB_ModifyTextureCoords (&texCoord[0][0], &verts[0][0], 4, &parms->tcmod);
rb_vertex = rb_index = 0;
indexArray[rb_index++] = rb_vertex+0;
@ -391,15 +394,19 @@ void R_DrawStretchPic (int x, int y, int w, int h, char *pic, float alpha)
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+3;
for (i=0; i<4; i++) {
VA_SetElem2(texCoordArray[0][rb_vertex], texCoord[i][0], texCoord[i][1]);
VA_SetElem2v(texCoordArray[0][rb_vertex], texCoord[i]);
VA_SetElem3(vertexArray[rb_vertex], verts[i][0], verts[i][1], 0);
VA_SetElem4(colorArray[rb_vertex], 1.0, 1.0, 1.0, alpha);
VA_SetElem4v(colorArray[rb_vertex], color);
rb_vertex++;
}
RB_RenderMeshGeneric (false);
// Psychospaz's transparent console support
if (gl->has_alpha || alpha < 1.0)
if (texClamp) {
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
if (parms->blend)
{
GL_DepthMask (true);
GL_TexEnv (GL_REPLACE);
@ -411,55 +418,75 @@ void R_DrawStretchPic (int x, int y, int w, int h, char *pic, float alpha)
/*
=============
R_DrawScaledPic
Psychospaz's code for drawing stretched crosshairs
R_DrawPic_Masked
=============
*/
void R_DrawScaledPic (int x, int y, float scale, float alpha, char *pic)
void R_DrawPic_Masked (int x, int y, int w, int h, vec2_t offset, vec4_t stCoords, vec4_t color, int texnum, int maskTexnum, renderparms_t *parms, qboolean texClamp)
{
float xoff, yoff;
float scale_x, scale_y;
image_t *gl;
int i;
vec2_t texCoord[4], verts[4];
vec2_t texCoord[4], scrollTexCoord[4], verts[4];
gl = R_DrawFindPic (pic);
if (!gl) {
VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic);
return;
}
if (!parms) return;
if (scrap_dirty)
Scrap_Upload ();
// add alpha support
if (gl->has_alpha || alpha < 1.0)
if (parms->blend)
{
GL_Disable (GL_ALPHA_TEST);
GL_TexEnv (GL_MODULATE);
GL_Enable (GL_BLEND);
// GL_BlendFunc (GL_SRC_ALPHA, additive ? GL_ONE : GL_ONE_MINUS_SRC_ALPHA); // GL_DST_ALPHA, GL_ONE
GL_BlendFunc (parms->blendfunc_src, parms->blendfunc_dst);
GL_DepthMask (false);
}
GL_Bind (gl->texnum);
GL_SelectTexture (0);
GL_Bind (maskTexnum);
GL_TexEnv (GL_COMBINE_ARB);
scale_x = scale_y = scale;
scale_x *= gl->replace_scale_w; // scale down if replacing a pcx image
scale_y *= gl->replace_scale_h; // scale down if replacing a pcx image
// Do nothing with this stage, it's just for alpha
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_INTERPOLATE);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_PREVIOUS_ARB);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_INTERPOLATE);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_TEXTURE);
Vector2Set(texCoord[0], gl->sl, gl->tl);
Vector2Set(texCoord[1], gl->sh, gl->tl);
Vector2Set(texCoord[2], gl->sh, gl->th);
Vector2Set(texCoord[3], gl->sl, gl->th);
GL_EnableTexture (1);
GL_Bind (texnum);
GL_TexEnv (GL_COMBINE_ARB);
xoff = gl->width*scale_x-gl->width;
yoff = gl->height*scale_y-gl->height;
if (texClamp) {
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
}
Vector2Set(verts[0], x, y);
Vector2Set(verts[1], x+gl->width+xoff, y);
Vector2Set(verts[2], x+gl->width+xoff, y+gl->height+yoff);
Vector2Set(verts[3], x, y+gl->height+yoff);
// This stage uses the previous one's alpha value
if (parms->blend) {
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_MODULATE);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_MODULATE);
}
else {
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
}
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE0); // GL_PREVIOUS_ARB
Vector2Set(texCoord[0], stCoords[0], stCoords[1]);
Vector2Set(texCoord[1], stCoords[2], stCoords[1]);
Vector2Set(texCoord[2], stCoords[2], stCoords[3]);
Vector2Set(texCoord[3], stCoords[0], stCoords[3]);
for (i=0; i<4; i++)
Vector2Copy(texCoord[i], scrollTexCoord[i]);
Vector2Set(verts[0], x+offset[0], y+offset[1]);
Vector2Set(verts[1], x+w+offset[0], y-offset[1]);
Vector2Set(verts[2], x+w-offset[0], y+h-offset[1]);
Vector2Set(verts[3], x-offset[0], y+h+offset[1]);
RB_ModifyTextureCoords (&scrollTexCoord[0][0], &verts[0][0], 4, &parms->tcmod);
rb_vertex = rb_index = 0;
indexArray[rb_index++] = rb_vertex+0;
@ -469,19 +496,36 @@ void R_DrawScaledPic (int x, int y, float scale, float alpha, char *pic)
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+3;
for (i=0; i<4; i++) {
VA_SetElem2(texCoordArray[0][rb_vertex], texCoord[i][0], texCoord[i][1]);
VA_SetElem2v(texCoordArray[0][rb_vertex], texCoord[i]);
VA_SetElem2v(texCoordArray[1][rb_vertex], scrollTexCoord[i]);
VA_SetElem3(vertexArray[rb_vertex], verts[i][0], verts[i][1], 0);
VA_SetElem4(colorArray[rb_vertex], 1.0, 1.0, 1.0, alpha);
VA_SetElem4v(colorArray[rb_vertex], color);
rb_vertex++;
}
RB_RenderMeshGeneric (false);
if (gl->has_alpha || alpha < 1.0)
if (texClamp) {
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
}
// Reset parms
GL_DisableTexture (1);
GL_SelectTexture (0);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB_ARB, GL_REPLACE);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB_ARB, GL_TEXTURE);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_RGB_ARB, GL_PREVIOUS_ARB);
qglTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA_ARB, GL_REPLACE);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA_ARB, GL_TEXTURE);
qglTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_ALPHA_ARB, GL_PREVIOUS_ARB);
GL_TexEnv (GL_REPLACE);
if (parms->blend)
{
GL_DepthMask (true);
GL_TexEnv (GL_REPLACE);
GL_BlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GL_Disable (GL_BLEND);
GL_Enable (GL_ALPHA_TEST); // add alpha support
GL_Enable (GL_ALPHA_TEST);
}
}
@ -491,102 +535,62 @@ void R_DrawScaledPic (int x, int y, float scale, float alpha, char *pic)
R_DrawPic
=============
*/
void R_DrawPic (int x, int y, char *pic)
{
image_t *gl;
int i;
vec2_t texCoord[4], verts[4];
gl = R_DrawFindPic (pic);
if (!gl) {
VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic);
return;
}
if (scrap_dirty)
Scrap_Upload ();
GL_Bind (gl->texnum);
Vector2Set(texCoord[0], gl->sl, gl->tl);
Vector2Set(texCoord[1], gl->sh, gl->tl);
Vector2Set(texCoord[2], gl->sh, gl->th);
Vector2Set(texCoord[3], gl->sl, gl->th);
Vector2Set(verts[0], x, y);
Vector2Set(verts[1], x+gl->width, y);
Vector2Set(verts[2], x+gl->width, y+gl->height);
Vector2Set(verts[3], x, y+gl->height);
rb_vertex = rb_index = 0;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+1;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+3;
for (i=0; i<4; i++) {
VA_SetElem2(texCoordArray[0][rb_vertex], texCoord[i][0], texCoord[i][1]);
VA_SetElem3(vertexArray[rb_vertex], verts[i][0], verts[i][1], 0);
VA_SetElem4(colorArray[rb_vertex], 1.0, 1.0, 1.0, 1.0);
rb_vertex++;
}
RB_RenderMeshGeneric (false);
}
/*
=============
R_DrawTileClear
This repeats a 64*64 tile graphic to fill the screen around a sized down
refresh window.
=============
*/
void R_DrawTileClear (int x, int y, int w, int h, char *pic)
void R_DrawPic (drawStruct_t ds)
{
int w, h;
float scale_x, scale_y;
vec4_t texCoords;
image_t *image;
int i;
vec2_t texCoord[4], verts[4];
image = R_DrawFindPic (pic);
renderparms_t drawParms;
image = R_DrawFindPic (ds.pic);
if (!image) {
VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic);
VID_Printf (PRINT_ALL, "Can't find pic: %s\n", ds.pic);
return;
}
GL_Bind (image->texnum);
/*
Vector2Set(texCoord[0], x/64.0, y/64.0);
Vector2Set(texCoord[1], (x+w)/64.0, y/64.0);
Vector2Set(texCoord[2], (x+w)/64.0, (y+h)/64.0);
Vector2Set(texCoord[3], x/64.0, (y+h)/64.0);
*/
Vector2Set(texCoord[0], (float)x/(float)image->width, (float)y/(float)image->height);
Vector2Set(texCoord[1], (float)(x+w)/(float)image->width, (float)y/(float)image->height);
Vector2Set(texCoord[2], (float)(x+w)/(float)image->width, (float)(y+h)/(float)image->height);
Vector2Set(texCoord[3], (float)x/(float)image->width, (float)(y+h)/(float)image->height);
w = ds.w; h = ds.h;
if (ds.flags & DSFLAG_USESTCOORDS) // use passed coords
Vector4Copy (ds.stCoords, texCoords);
else if (ds.flags & DSFLAG_TILED) // use tiled coords
Vector4Set (texCoords, (float)ds.x/(float)image->width, (float)ds.y/(float)image->height,
(float)(ds.x+ds.w)/(float)image->width, (float)(ds.y+ds.h)/(float)image->height);
else if (ds.flags & DSFLAG_SCALED) // use scaled size
{
Vector4Set (texCoords, image->sl, image->tl, image->sh, image->th);
Vector2Set(verts[0], x, y);
Vector2Set(verts[1], x+w, y);
Vector2Set(verts[2], x+w, y+h);
Vector2Set(verts[3], x, y+h);
rb_vertex = rb_index = 0;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+1;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+3;
for (i=0; i<4; i++) {
VA_SetElem2(texCoordArray[0][rb_vertex], texCoord[i][0], texCoord[i][1]);
VA_SetElem3(vertexArray[rb_vertex], verts[i][0], verts[i][1], 0);
VA_SetElem4(colorArray[rb_vertex], 1.0, 1.0, 1.0, 1.0);
rb_vertex++;
scale_x = ds.scale[0];
scale_y = ds.scale[1];
scale_x *= image->replace_scale_w; // scale down if replacing a pcx image
scale_y *= image->replace_scale_h; // scale down if replacing a pcx image
w = image->width*scale_x;
h = image->height*scale_y;
}
RB_RenderMeshGeneric (false);
else // use internal coords
Vector4Set (texCoords, image->sl, image->tl, image->sh, image->th);
Mod_SetRenderParmsDefaults (&drawParms);
drawParms.tcmod.scroll_x = ds.scroll[0];
drawParms.tcmod.scroll_y = ds.scroll[1];
// masked image option
if ( (ds.flags & DSFLAG_MASKED) && (ds.maskPic != NULL) && glConfig.mtexcombine )
{
image_t *maskImage = R_DrawFindPic (ds.maskPic);
if (maskImage != NULL)
{
// VID_Printf (PRINT_ALL, "Drawing pic with mask: %s\n", pic);
drawParms.blend = true;
drawParms.blendfunc_src = GL_SRC_ALPHA;
drawParms.blendfunc_dst = GL_ONE;
R_DrawPic_Masked (ds.x, ds.y, w, h, ds.offset, ds.stCoords, ds.color, image->texnum, maskImage->texnum, &drawParms, (ds.flags & DSFLAG_CLAMP));
return;
}
}
drawParms.blend = (image->has_alpha || ds.color[3] < 1.0f);
R_DrawPic_Standard (ds.x, ds.y, w, h, ds.offset, texCoords, ds.color, image->texnum, &drawParms, (ds.flags & DSFLAG_CLAMP));
}
@ -608,7 +612,6 @@ void R_DrawFill (int x, int y, int w, int h, int red, int green, int blue, int a
blue = min(blue, 255);
alpha = max(min(alpha, 255), 1);
// GL_DisableTexture (0);
GL_Disable (GL_ALPHA_TEST);
GL_TexEnv (GL_MODULATE);
GL_Enable (GL_BLEND);
@ -651,8 +654,6 @@ R_DrawCameraEffect
Video camera effect
=============
*/
void Mod_SetRenderParmsDefaults (renderparms_t *parms);
void R_DrawCameraEffect (void)
{
image_t *image[2];
@ -660,7 +661,7 @@ void R_DrawCameraEffect (void)
float texparms[2][4];
vec2_t texCoord[4];
vec3_t verts[4];
renderparms_t cameraParms;
tcmodParms_t cameraParms;
image[0] = R_DrawFindPic ("/gfx/2d/screenstatic.tga");
image[1] = R_DrawFindPic ("/gfx/2d/scanlines.tga");
@ -699,7 +700,7 @@ void R_DrawCameraEffect (void)
Vector2Set(texCoord[1], (x+w)/image[i]->width, y/image[i]->height);
Vector2Set(texCoord[2], (x+w)/image[i]->width, (y+h)/image[i]->height);
Vector2Set(texCoord[3], x/image[i]->width, (y+h)/image[i]->height);
Mod_SetRenderParmsDefaults (&cameraParms);
Mod_SetTCModParmsDefaults (&cameraParms);
cameraParms.scale_x = texparms[i][0];
cameraParms.scale_y = texparms[i][1];
cameraParms.scroll_x = texparms[i][2];

277
renderer/r_draw_removed.c Normal file
View file

@ -0,0 +1,277 @@
/*
===========================================================================
Copyright (C) 1997-2001 Id Software, Inc.
This file is part of Quake 2 source code.
Quake 2 source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
Quake 2 source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Quake 2 source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
// r_draw_removed.c - various removed pic drawing functions
#include "r_local.h"
#if 0
/*
=============
R_DrawStretchPic
=============
*/
void R_DrawStretchPic (int x, int y, int w, int h, char *pic, float alpha)
{
image_t *gl;
int i;
vec2_t texCoord[4], verts[4];
gl = R_DrawFindPic (pic);
if (!gl)
{
VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic);
return;
}
if (scrap_dirty)
Scrap_Upload ();
// Psychospaz's transparent console support
if (gl->has_alpha || alpha < 1.0)
{
GL_Disable (GL_ALPHA_TEST);
GL_TexEnv (GL_MODULATE);
GL_Enable (GL_BLEND);
GL_DepthMask (false);
}
GL_Bind (gl->texnum);
Vector2Set(texCoord[0], gl->sl, gl->tl);
Vector2Set(texCoord[1], gl->sh, gl->tl);
Vector2Set(texCoord[2], gl->sh, gl->th);
Vector2Set(texCoord[3], gl->sl, gl->th);
Vector2Set(verts[0], x, y);
Vector2Set(verts[1], x+w, y);
Vector2Set(verts[2], x+w, y+h);
Vector2Set(verts[3], x, y+h);
rb_vertex = rb_index = 0;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+1;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+3;
for (i=0; i<4; i++) {
VA_SetElem2(texCoordArray[0][rb_vertex], texCoord[i][0], texCoord[i][1]);
VA_SetElem3(vertexArray[rb_vertex], verts[i][0], verts[i][1], 0);
VA_SetElem4(colorArray[rb_vertex], 1.0, 1.0, 1.0, alpha);
rb_vertex++;
}
RB_RenderMeshGeneric (false);
// Psychospaz's transparent console support
if (gl->has_alpha || alpha < 1.0)
{
GL_DepthMask (true);
GL_TexEnv (GL_REPLACE);
GL_Disable (GL_BLEND);
GL_Enable (GL_ALPHA_TEST);
}
}
/*
=============
R_DrawScaledPic
Psychospaz's code for drawing stretched crosshairs
=============
*/
void R_DrawScaledPic (int x, int y, float scale, float alpha, char *pic)
{
float xoff, yoff;
float scale_x, scale_y;
image_t *gl;
int i;
vec2_t texCoord[4], verts[4];
gl = R_DrawFindPic (pic);
if (!gl) {
VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic);
return;
}
if (scrap_dirty)
Scrap_Upload ();
// add alpha support
if (gl->has_alpha || alpha < 1.0)
{
GL_Disable (GL_ALPHA_TEST);
GL_TexEnv (GL_MODULATE);
GL_Enable (GL_BLEND);
GL_DepthMask (false);
}
GL_Bind (gl->texnum);
scale_x = scale_y = scale;
scale_x *= gl->replace_scale_w; // scale down if replacing a pcx image
scale_y *= gl->replace_scale_h; // scale down if replacing a pcx image
Vector2Set(texCoord[0], gl->sl, gl->tl);
Vector2Set(texCoord[1], gl->sh, gl->tl);
Vector2Set(texCoord[2], gl->sh, gl->th);
Vector2Set(texCoord[3], gl->sl, gl->th);
xoff = gl->width*scale_x-gl->width;
yoff = gl->height*scale_y-gl->height;
Vector2Set(verts[0], x, y);
Vector2Set(verts[1], x+gl->width+xoff, y);
Vector2Set(verts[2], x+gl->width+xoff, y+gl->height+yoff);
Vector2Set(verts[3], x, y+gl->height+yoff);
rb_vertex = rb_index = 0;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+1;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+3;
for (i=0; i<4; i++) {
VA_SetElem2(texCoordArray[0][rb_vertex], texCoord[i][0], texCoord[i][1]);
VA_SetElem3(vertexArray[rb_vertex], verts[i][0], verts[i][1], 0);
VA_SetElem4(colorArray[rb_vertex], 1.0, 1.0, 1.0, alpha);
rb_vertex++;
}
RB_RenderMeshGeneric (false);
if (gl->has_alpha || alpha < 1.0)
{
GL_DepthMask (true);
GL_TexEnv (GL_REPLACE);
GL_Disable (GL_BLEND);
GL_Enable (GL_ALPHA_TEST); // add alpha support
}
}
/*
=============
R_DrawPic
=============
*/
void R_DrawPic (int x, int y, char *pic)
{
image_t *gl;
int i;
vec2_t texCoord[4], verts[4];
gl = R_DrawFindPic (pic);
if (!gl) {
VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic);
return;
}
if (scrap_dirty)
Scrap_Upload ();
GL_Bind (gl->texnum);
Vector2Set(texCoord[0], gl->sl, gl->tl);
Vector2Set(texCoord[1], gl->sh, gl->tl);
Vector2Set(texCoord[2], gl->sh, gl->th);
Vector2Set(texCoord[3], gl->sl, gl->th);
Vector2Set(verts[0], x, y);
Vector2Set(verts[1], x+gl->width, y);
Vector2Set(verts[2], x+gl->width, y+gl->height);
Vector2Set(verts[3], x, y+gl->height);
rb_vertex = rb_index = 0;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+1;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+3;
for (i=0; i<4; i++) {
VA_SetElem2(texCoordArray[0][rb_vertex], texCoord[i][0], texCoord[i][1]);
VA_SetElem3(vertexArray[rb_vertex], verts[i][0], verts[i][1], 0);
VA_SetElem4(colorArray[rb_vertex], 1.0, 1.0, 1.0, 1.0);
rb_vertex++;
}
RB_RenderMeshGeneric (false);
}
/*
=============
R_DrawTileClear
This repeats a 64*64 tile graphic to fill the screen around a sized down
refresh window.
=============
*/
void R_DrawTileClear (int x, int y, int w, int h, char *pic)
{
image_t *image;
int i;
vec2_t texCoord[4], verts[4];
image = R_DrawFindPic (pic);
if (!image) {
VID_Printf (PRINT_ALL, "Can't find pic: %s\n", pic);
return;
}
GL_Bind (image->texnum);
/*
Vector2Set(texCoord[0], x/64.0, y/64.0);
Vector2Set(texCoord[1], (x+w)/64.0, y/64.0);
Vector2Set(texCoord[2], (x+w)/64.0, (y+h)/64.0);
Vector2Set(texCoord[3], x/64.0, (y+h)/64.0);
*/
Vector2Set(texCoord[0], (float)x/(float)image->width, (float)y/(float)image->height);
Vector2Set(texCoord[1], (float)(x+w)/(float)image->width, (float)y/(float)image->height);
Vector2Set(texCoord[2], (float)(x+w)/(float)image->width, (float)(y+h)/(float)image->height);
Vector2Set(texCoord[3], (float)x/(float)image->width, (float)(y+h)/(float)image->height);
Vector2Set(verts[0], x, y);
Vector2Set(verts[1], x+w, y);
Vector2Set(verts[2], x+w, y+h);
Vector2Set(verts[3], x, y+h);
rb_vertex = rb_index = 0;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+1;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+0;
indexArray[rb_index++] = rb_vertex+2;
indexArray[rb_index++] = rb_vertex+3;
for (i=0; i<4; i++) {
VA_SetElem2(texCoordArray[0][rb_vertex], texCoord[i][0], texCoord[i][1]);
VA_SetElem3(vertexArray[rb_vertex], verts[i][0], verts[i][1], 0);
VA_SetElem4(colorArray[rb_vertex], 1.0, 1.0, 1.0, 1.0);
rb_vertex++;
}
RB_RenderMeshGeneric (false);
}
#endif

View file

@ -622,7 +622,7 @@ extern unsigned rb_vertex, rb_index;
void RB_InitBackend (void);
float RB_CalcGlowColor (renderparms_t *parms);
void RB_ModifyTextureCoords (float *inArray, float *inVerts, int numVerts, renderparms_t *parms);
void RB_ModifyTextureCoords (float *inArray, float *inVerts, int numVerts, tcmodParms_t *parms);
qboolean RB_CheckArrayOverflow (int numVerts, int numIndex);
void RB_RenderMeshGeneric (qboolean drawTris);
void RB_DrawArrays (void);
@ -716,11 +716,14 @@ char *va(char *format, ...);
void R_RefreshFont (fontslot_t font);
void R_RefreshAllFonts (void);
void R_DrawGetPicSize (int *w, int *h, char *name);
void R_DrawPic (int x, int y, char *name);
void R_DrawPic (drawStruct_t ds) ;
//void R_DrawPic (int x, int y, char *name);
// added alpha for Psychospaz's transparent console
void R_DrawStretchPic (int x, int y, int w, int h, char *name, float alpha);
//void R_DrawStretchPic (int x, int y, int w, int h, char *name, float alpha);
// Psychospaz's scaled crosshair support
void R_DrawScaledPic (int x, int y, float scale, float alpha, char *pic);
//void R_DrawScaledPic (int x, int y, float scale, float alpha, char *pic);
void R_InitChars (void);
void R_FlushChars (fontslot_t font);
void R_DrawChar (float x, float y, int num, fontslot_t font, float scale,

View file

@ -1492,41 +1492,41 @@ void Mod_ParseModelScript (maliasskin_t *skin, char **data, char *dataStart, int
break;
}
if (!Q_strcasecmp(token, "translate")) {
if (!Mod_ParseFloat(data, &skinParms->translate_x, false)) {
if (!Mod_ParseFloat(data, &skinParms->tcmod.translate_x, false)) {
VID_Printf (PRINT_ALL, S_COLOR_YELLOW"Mod_ParseModelScript: missing parameters for 'tcmod translate' in %s.%i in %s\n", meshname, skinnum, scriptname);
break;
}
if (!Mod_ParseFloat(data, &skinParms->translate_y, false)) {
if (!Mod_ParseFloat(data, &skinParms->tcmod.translate_y, false)) {
VID_Printf (PRINT_ALL, S_COLOR_YELLOW"Mod_ParseModelScript: missing parameter for 'tcmod translate' in %s.%i in %s\n", meshname, skinnum, scriptname);
skinParms->translate_x = 0.0f;
skinParms->tcmod.translate_x = 0.0f;
break;
}
}
else if (!Q_strcasecmp(token, "rotate")) {
if (!Mod_ParseFloat(data, &skinParms->rotate, false)) {
if (!Mod_ParseFloat(data, &skinParms->tcmod.rotate, false)) {
VID_Printf (PRINT_ALL, S_COLOR_YELLOW"Mod_ParseModelScript: missing parameter for 'tcmod rotate' in %s.%i in %s\n", meshname, skinnum, scriptname);
break;
}
}
else if (!Q_strcasecmp(token, "scale")) {
if (!Mod_ParseFloat(data, &skinParms->scale_x, false)) {
if (!Mod_ParseFloat(data, &skinParms->tcmod.scale_x, false)) {
VID_Printf (PRINT_ALL, S_COLOR_YELLOW"Mod_ParseModelScript: missing parameters for 'tcmod scale' in %s.%i in %s\n", meshname, skinnum, scriptname);
break;
}
if (!Mod_ParseFloat(data, &skinParms->scale_y, false)) {
if (!Mod_ParseFloat(data, &skinParms->tcmod.scale_y, false)) {
VID_Printf (PRINT_ALL, S_COLOR_YELLOW"Mod_ParseModelScript: missing parameter for 'tcmod scale' in %s.%i in %s\n", meshname, skinnum, scriptname);
skinParms->scale_x = 1.0f;
skinParms->tcmod.scale_x = 1.0f;
break;
}
}
else if (!Q_strcasecmp(token, "stretch"))
{
if (!Mod_ParseWaveFunc(data, &skinParms->stretch.type)) {
if (!Mod_ParseWaveFunc(data, &skinParms->tcmod.stretch.type)) {
VID_Printf (PRINT_ALL, S_COLOR_YELLOW"Mod_ParseModelScript: missing or invalid waveform for 'tcmod stretch' in %s.%i in %s\n", meshname, skinnum, scriptname);
break;
}
for (i=0; i<4; i++)
if (!Mod_ParseFloat(data, &skinParms->stretch.params[i], false)) {
if (!Mod_ParseFloat(data, &skinParms->tcmod.stretch.params[i], false)) {
VID_Printf (PRINT_ALL, S_COLOR_YELLOW"Mod_ParseModelScript: missing parameters for 'tcmod stretch' in %s.%i in %s\n", meshname, skinnum, scriptname);
break;
}
@ -1534,21 +1534,21 @@ void Mod_ParseModelScript (maliasskin_t *skin, char **data, char *dataStart, int
else if (!Q_strcasecmp(token, "turb"))
{ // first parm (base) is unused, so just read twice
for (i=0; i<4; i++)
if (!Mod_ParseFloat(data, &skinParms->turb.params[i], false)) {
if (!Mod_ParseFloat(data, &skinParms->tcmod.turb.params[i], false)) {
VID_Printf (PRINT_ALL, S_COLOR_YELLOW"Mod_ParseModelScript: missing parameters for 'tcmod turb' in %s.%i in %s\n", meshname, skinnum, scriptname);
break;
}
skinParms->turb.type = WAVEFORM_SIN;
skinParms->tcmod.turb.type = WAVEFORM_SIN;
}
else if (!Q_strcasecmp(token, "scroll"))
{
if (!Mod_ParseFloat(data, &skinParms->scroll_x, false)) {
if (!Mod_ParseFloat(data, &skinParms->tcmod.scroll_x, false)) {
VID_Printf (PRINT_ALL, S_COLOR_YELLOW"Mod_ParseModelScript: missing parameters for 'tcmod scroll' in %s.%i in %s\n", meshname, skinnum, scriptname);
break;
}
if (!Mod_ParseFloat(data, &skinParms->scroll_y, false)) {
if (!Mod_ParseFloat(data, &skinParms->tcmod.scroll_y, false)) {
VID_Printf (PRINT_ALL, S_COLOR_YELLOW"Mod_ParseModelScript: missing parameter for 'tcmod scroll' in %s.%i in %s\n", meshname, skinnum, scriptname);
skinParms->scroll_x = 0.0f;
skinParms->tcmod.scroll_x = 0.0f;
break;
}
}
@ -1636,6 +1636,27 @@ void Mod_ParseModelScript (maliasskin_t *skin, char **data, char *dataStart, int
}
}
/*
=================
Mod_SetTCModParmsDefaults
md3 skin protoshaders
=================
*/
void Mod_SetTCModParmsDefaults (tcmodParms_t *tcmod)
{
if (!tcmod) return;
tcmod->translate_x = 0.0f;
tcmod->translate_y = 0.0f;
tcmod->rotate = 0.0f;
tcmod->scale_x = 1.0f;
tcmod->scale_y = 1.0f;
tcmod->stretch.type = -1;
tcmod->turb.type = -1;
tcmod->scroll_x = 0.0f;
tcmod->scroll_y = 0.0f;
}
/*
=================
Mod_SetRenderParmsDefaults
@ -1656,15 +1677,15 @@ void Mod_SetRenderParmsDefaults (renderparms_t *parms)
parms->blendfunc_src = -1;
parms->blendfunc_dst = -1;
parms->glow.type = -1;
parms->translate_x = 0.0f;
parms->translate_y = 0.0f;
parms->rotate = 0.0f;
parms->scale_x = 1.0f;
parms->scale_y = 1.0f;
parms->stretch.type = -1;
parms->turb.type = -1;
parms->scroll_x = 0.0f;
parms->scroll_y = 0.0f;
parms->tcmod.translate_x = 0.0f;
parms->tcmod.translate_y = 0.0f;
parms->tcmod.rotate = 0.0f;
parms->tcmod.scale_x = 1.0f;
parms->tcmod.scale_y = 1.0f;
parms->tcmod.stretch.type = -1;
parms->tcmod.turb.type = -1;
parms->tcmod.scroll_x = 0.0f;
parms->tcmod.scroll_y = 0.0f;
}
/*

View file

@ -302,6 +302,9 @@ typedef struct model_s
void Mod_Init (void);
void Mod_ClearAll (void);
void Mod_SetTCModParmsDefaults (tcmodParms_t *tcmod);
void Mod_SetRenderParmsDefaults (renderparms_t *parms);
void Mod_LoadModelScript (model_t *mod, maliasmodel_t *aliasmod);
model_t *Mod_ForName (char *name, qboolean crash);
mleaf_t *Mod_PointInLeaf (float *p, model_t *model);
byte *Mod_ClusterPVS (int cluster, model_t *model);

View file

@ -121,18 +121,11 @@ void SubdividePolygon (int numverts, float *verts)
}
// add a point in the center to help keep warp valid
// poly = Hunk_Alloc (sizeof(glpoly_t) + ((numverts-4)+2) * VERTEXSIZE*sizeof(float));
poly = Hunk_Alloc (sizeof(glpoly_t) + ((numverts-4)+2) * sizeof(mpolyvertex_t));
poly->next = warpface->polys;
warpface->polys = poly;
poly->numverts = numverts+2;
// alloc vertex light fields
/* size = poly->numverts*3*sizeof(byte);
poly->vertexlight = Hunk_Alloc(size);
poly->vertexlightbase = Hunk_Alloc(size);
memset(poly->vertexlight, 0, size);
memset(poly->vertexlightbase, 0, size); */
poly->vertexlightset = false;
VectorClear (total);
@ -141,8 +134,10 @@ void SubdividePolygon (int numverts, float *verts)
for (i=0; i<numverts; i++, verts+=3)
{
VectorCopy (verts, poly->verts[i+1].xyz);
s = DotProduct (verts, warpface->texinfo->vecs[0]);
t = DotProduct (verts, warpface->texinfo->vecs[1]);
// s = DotProduct (verts, warpface->texinfo->vecs[0]);
// t = DotProduct (verts, warpface->texinfo->vecs[1]);
s = DotProduct (verts, warpface->texinfo->vecs[0]) + warpface->texinfo->vecs[0][3];
t = DotProduct (verts, warpface->texinfo->vecs[1]) + warpface->texinfo->vecs[1][3];
total_s += s;
total_t += t;

View file

@ -44,6 +44,20 @@ static void MenuSpinControl_DoSlide (menulist_s *s, int dir);
#define RCOLUMN_OFFSET MENU_FONT_SIZE*2 // was 16
#define LCOLUMN_OFFSET -MENU_FONT_SIZE*2 // was -16
vec4_t stCoord_arrow_left = {0.0, 0.0, 0.25, 0.25};
vec4_t stCoord_arrow_right = {0.25, 0.0, 0.5, 0.25};
vec4_t stCoord_arrow_up = {0.5, 0.0, 0.75, 0.25};
vec4_t stCoord_arrow_down = {0.75, 0.0, 1, 0.25};
vec4_t stCoord_scrollKnob_h = {0.0, 0.75, 0.25, 1.0};
vec4_t stCoord_scrollKnob_v = {0.25, 0.75, 0.5, 1.0};
vec4_t stCoord_field_left = {0.0, 0.0, 0.25, 1.0};
vec4_t stCoord_field_center = {0.25, 0.0, 0.5, 1.0};
vec4_t stCoord_field_right = {0.5, 0.0, 0.75, 1.0};
vec4_t stCoord_slider_left = {0.0, 0.0, 0.125, 1.0};
vec4_t stCoord_slider_center = {0.125, 0.0, 0.375, 1.0};
vec4_t stCoord_slider_right = {0.375, 0.0, 0.5, 1.0};
vec4_t stCoord_slider_knob = {0.5, 0.0, 0.625, 1.0};
extern viddef_t viddef;
#define VID_WIDTH viddef.width
@ -141,7 +155,14 @@ void MenuField_Draw (menufield_s *f)
offset = (int)strlen(tempbuffer);
}
SCR_DrawChar (f->generic.x + f->generic.parent->x + RCOLUMN_OFFSET,
SCR_DrawOffsetPicST (f->generic.x + f->generic.parent->x + RCOLUMN_OFFSET,
f->generic.y + f->generic.parent->y - 4, f->generic.textSize, f->generic.textSize*2, vec2_origin, stCoord_field_left,
ALIGN_CENTER, true, color_identity, UI_FIELD_PIC);
SCR_DrawOffsetPicST (f->generic.x + f->generic.parent->x + (1+f->visible_length)*f->generic.textSize + RCOLUMN_OFFSET,
f->generic.y + f->generic.parent->y - 4, f->generic.textSize, f->generic.textSize*2, vec2_origin, stCoord_field_right,
ALIGN_CENTER, true, color_identity, UI_FIELD_PIC);
/* SCR_DrawChar (f->generic.x + f->generic.parent->x + RCOLUMN_OFFSET,
f->generic.y + f->generic.parent->y - 4, f->generic.textSize, ALIGN_CENTER, 18, FONT_UI, 255,255,255,255, false, false);
SCR_DrawChar (f->generic.x + f->generic.parent->x + RCOLUMN_OFFSET,
f->generic.y + f->generic.parent->y + 4, f->generic.textSize, ALIGN_CENTER, 24, FONT_UI, 255,255,255,255, false, false);
@ -149,13 +170,18 @@ void MenuField_Draw (menufield_s *f)
f->generic.y + f->generic.parent->y - 4, f->generic.textSize, ALIGN_CENTER, 20, FONT_UI, 255,255,255,255, false, false);
SCR_DrawChar (f->generic.x + f->generic.parent->x + (1+f->visible_length)*f->generic.textSize + RCOLUMN_OFFSET,
f->generic.y + f->generic.parent->y + 4, f->generic.textSize, ALIGN_CENTER, 26, FONT_UI, 255,255,255,255, false, false);
*/
for (i = 0; i < f->visible_length; i++)
{
SCR_DrawChar (f->generic.x + f->generic.parent->x + (1+i)*f->generic.textSize + RCOLUMN_OFFSET,
SCR_DrawOffsetPicST (f->generic.x + f->generic.parent->x + (1+i)*f->generic.textSize + RCOLUMN_OFFSET,
f->generic.y + f->generic.parent->y - 4, f->generic.textSize, f->generic.textSize*2, vec2_origin, stCoord_field_center,
ALIGN_CENTER, true, color_identity, UI_FIELD_PIC);
/* SCR_DrawChar (f->generic.x + f->generic.parent->x + (1+i)*f->generic.textSize + RCOLUMN_OFFSET,
f->generic.y + f->generic.parent->y - 4, f->generic.textSize, ALIGN_CENTER, 19, FONT_UI, 255,255,255,255, false, false);
SCR_DrawChar (f->generic.x + f->generic.parent->x + (1+i)*f->generic.textSize + RCOLUMN_OFFSET,
f->generic.y + f->generic.parent->y + 4, f->generic.textSize, ALIGN_CENTER, 25, FONT_UI, 255,255,255,255, false, (i==(f->visible_length-1)));
*/
}
// add cursor thingie
@ -322,9 +348,9 @@ void MenuList_Draw (menulist_s *l)
n = l->itemnames;
// SCR_DrawFill (l->generic.parent->x + l->generic.x - 112, l->generic.parent->y + l->generic.y + (l->curvalue+1)*MENU_LINE_SIZE,
// 128, MENU_LINE_SIZE, ALIGN_CENTER, 16);
// 128, MENU_LINE_SIZE, ALIGN_CENTER, false, 16);
SCR_DrawFill (l->generic.parent->x + l->generic.x - 112, l->generic.parent->y + l->generic.y + (l->curvalue+1)*MENU_LINE_SIZE,
128, MENU_LINE_SIZE, ALIGN_CENTER, color8red(16), color8green(16), color8blue(16), 255);
128, MENU_LINE_SIZE, ALIGN_CENTER, false, color8red(16), color8green(16), color8blue(16), 255);
while (*n)
{
@ -382,7 +408,7 @@ void MenuSlider_DoSlide (menuslider_s *s, int dir)
void MenuSlider_Draw (menuslider_s *s)
{
int i, alpha = mouseOverAlpha(&s->generic);
int i, x, y, alpha = mouseOverAlpha(&s->generic);
float tmpValue;
char valueText[8];
@ -402,18 +428,35 @@ void MenuSlider_Draw (menuslider_s *s)
if (s->range > 1)
s->range = 1;
SCR_DrawChar (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET,
s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, 128, FONT_UI, 255,255,255,255, false, false);
x = s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET;
y = s->generic.y + s->generic.parent->y;
for (i = 0; i < SLIDER_RANGE; i++)
SCR_DrawChar (s->generic.x + s->generic.parent->x + (i+1)*s->generic.textSize + RCOLUMN_OFFSET,
s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, 129, FONT_UI, 255,255,255,255, false, false);
// draw left
SCR_DrawOffsetPicST (x, y, SLIDER_ENDCAP_WIDTH, SLIDER_HEIGHT,
vec2_origin, stCoord_slider_left, ALIGN_CENTER, true, color_identity, UI_SLIDER_PIC);
// SCR_DrawChar (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET,
// s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, 128, FONT_UI, 255,255,255,255, false, false);
SCR_DrawChar (s->generic.x + s->generic.parent->x + (i+1)*s->generic.textSize + RCOLUMN_OFFSET,
s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, 130, FONT_UI, 255,255,255,255, false, false);
// draw center
x += SLIDER_ENDCAP_WIDTH;
for (i = 0; i < SLIDER_RANGE; i++) {
SCR_DrawOffsetPicST (x + i*SLIDER_SECTION_WIDTH, y, SLIDER_SECTION_WIDTH, SLIDER_HEIGHT,
vec2_origin, stCoord_slider_center, ALIGN_CENTER, true, color_identity, UI_SLIDER_PIC);
// SCR_DrawChar (s->generic.x + s->generic.parent->x + (i+1)*s->generic.textSize + RCOLUMN_OFFSET,
// s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, 129, FONT_UI, 255,255,255,255, false, false);
}
SCR_DrawChar (s->generic.x + s->generic.parent->x + s->generic.textSize*((SLIDER_RANGE-1)*s->range+1) + RCOLUMN_OFFSET,
s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, 131, FONT_UI, 255,255,255,255, false, true);
// draw right
SCR_DrawOffsetPicST (x + i*SLIDER_SECTION_WIDTH, y, SLIDER_ENDCAP_WIDTH, SLIDER_HEIGHT,
vec2_origin, stCoord_slider_right, ALIGN_CENTER, true, color_identity, UI_SLIDER_PIC);
// SCR_DrawChar (s->generic.x + s->generic.parent->x + (i+1)*s->generic.textSize + RCOLUMN_OFFSET,
// s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, 130, FONT_UI, 255,255,255,255, false, false);
// draw knob
SCR_DrawOffsetPicST (x + SLIDER_RANGE*SLIDER_SECTION_WIDTH*s->range - (SLIDER_KNOB_WIDTH/2), y, SLIDER_KNOB_WIDTH, SLIDER_HEIGHT,
vec2_origin, stCoord_slider_knob, ALIGN_CENTER, true, color_identity, UI_SLIDER_PIC);
// SCR_DrawChar (s->generic.x + s->generic.parent->x + s->generic.textSize*((SLIDER_RANGE-1)*s->range+1) + RCOLUMN_OFFSET,
// s->generic.y + s->generic.parent->y, s->generic.textSize, ALIGN_CENTER, 131, FONT_UI, 255,255,255,255, false, true);
// draw value
tmpValue = s->curPos * s->increment + s->baseValue;
@ -427,8 +470,10 @@ void MenuSlider_Draw (menuslider_s *s)
else
Com_sprintf (valueText, sizeof(valueText), "%4.2f", tmpValue);
}
Menu_DrawString (s->generic.x + s->generic.parent->x + s->generic.textSize*SLIDER_RANGE + RCOLUMN_OFFSET + 2.5*MENU_FONT_SIZE,
Menu_DrawString (s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET + 2*SLIDER_ENDCAP_WIDTH + i*SLIDER_SECTION_WIDTH + MENU_FONT_SIZE/2,
s->generic.y + s->generic.parent->y + 1, MENU_FONT_SIZE-2, valueText, alpha);
// Menu_DrawString (s->generic.x + s->generic.parent->x + s->generic.textSize*SLIDER_RANGE + RCOLUMN_OFFSET + 2.5*MENU_FONT_SIZE,
// s->generic.y + s->generic.parent->y + 1, MENU_FONT_SIZE-2, valueText, alpha);
}
void MenuSpinControl_DoEnter (menulist_s *s)
@ -826,20 +871,30 @@ void Menu_Draw (menuframework_s *menu)
}
else if (item && item->type != MTYPE_FIELD)
{
char *cursor;
int cursorX;
cursor = ((int)(Sys_Milliseconds()/250)&1) ? UI_ITEMCURSOR_DEFAULT_PIC : UI_ITEMCURSOR_BLINK_PIC;
if (item->flags & QMF_LEFT_JUSTIFY)
cursorX = menu->x + item->x + item->cursor_offset - 24;
else
cursorX = menu->x + item->cursor_offset;
SCR_DrawPic (cursorX, menu->y+item->y, item->textSize, item->textSize, ALIGN_CENTER, false, cursor, 255);
/* if (item->flags & QMF_LEFT_JUSTIFY)
{
SCR_DrawChar (menu->x+item->x+item->cursor_offset-24, menu->y+item->y,
// MENU_FONT_SIZE, ALIGN_CENTER, 12+((int)(Sys_Milliseconds()/250)&1),
item->textSize, ALIGN_CENTER, 12+((int)(Sys_Milliseconds()/250)&1),
FONT_UI, 255,255,255,255, false, true);
}
else
{
SCR_DrawChar (menu->x+item->cursor_offset, menu->y+item->y,
// MENU_FONT_SIZE, ALIGN_CENTER, 12+((int)(Sys_Milliseconds()/250)&1),
item->textSize, ALIGN_CENTER, 12+((int)(Sys_Milliseconds()/250)&1),
FONT_UI, 255,255,255,255, false, true);
}
} */
}
if (item)
@ -861,12 +916,12 @@ void Menu_DrawStatusBar (const char *string)
{
int l = (int)strlen( string );
SCR_DrawFill (0, SCREEN_HEIGHT-(MENU_FONT_SIZE+3), SCREEN_WIDTH, MENU_FONT_SIZE+4, ALIGN_BOTTOM_STRETCH, 60,60,60,255 ); // go 1 pixel past screen bottom to prevent gap from scaling
SCR_DrawFill (0, SCREEN_HEIGHT-(MENU_FONT_SIZE+3), SCREEN_WIDTH, 1, ALIGN_BOTTOM_STRETCH, 0,0,0,255 );
SCR_DrawFill (0, SCREEN_HEIGHT-(MENU_FONT_SIZE+3), SCREEN_WIDTH, MENU_FONT_SIZE+4, ALIGN_BOTTOM_STRETCH, false, 60,60,60,255 ); // go 1 pixel past screen bottom to prevent gap from scaling
SCR_DrawFill (0, SCREEN_HEIGHT-(MENU_FONT_SIZE+3), SCREEN_WIDTH, 1, ALIGN_BOTTOM_STRETCH, false, 0,0,0,255 );
SCR_DrawString (SCREEN_WIDTH/2-(l/2)*MENU_FONT_SIZE, SCREEN_HEIGHT-(MENU_FONT_SIZE+1), MENU_FONT_SIZE, ALIGN_BOTTOM, string, FONT_UI, 255 );
}
else
SCR_DrawFill (0, SCREEN_HEIGHT-(MENU_FONT_SIZE+3), SCREEN_WIDTH, MENU_FONT_SIZE+4, ALIGN_BOTTOM_STRETCH, 0,0,0,255 ); // go 1 pixel past screen bottom to prevent gap from scaling
SCR_DrawFill (0, SCREEN_HEIGHT-(MENU_FONT_SIZE+3), SCREEN_WIDTH, MENU_FONT_SIZE+4, ALIGN_BOTTOM_STRETCH, false, 0,0,0,255 ); // go 1 pixel past screen bottom to prevent gap from scaling
}
void Menu_DrawString (int x, int y, int size, const char *string, int alpha)
@ -907,15 +962,29 @@ void Menu_DrawTextBox (int x, int y, int width, int lines)
{
int cx, cy;
int n;
/* vec4_t stCoord_textBox[9];
Vector4Set (stCoord_textBox[0], 0.0, 0.0, 0.25, 0.25);
Vector4Set (stCoord_textBox[1], 0.0, 0.25, 0.25, 0.5);
Vector4Set (stCoord_textBox[2], 0.0, 0.5, 0.25, 0.75);
Vector4Set (stCoord_textBox[3], 0.25, 0.0, 0.5, 0.25);
Vector4Set (stCoord_textBox[4], 0.25, 0.25, 0.5, 0.5);
Vector4Set (stCoord_textBox[5], 0.25, 0.5, 0.5, 0.75);
Vector4Set (stCoord_textBox[6], 0.5, 0.0, 0.75, 0.25);
Vector4Set (stCoord_textBox[7], 0.5, 0.25, 0.75, 0.5);
Vector4Set (stCoord_textBox[8], 0.5, 0.5, 0.75, 0.75);
*/
// draw left side
cx = x;
cy = y;
// SCR_DrawOffsetPicST (cx, cy, MENU_FONT_SIZE, MENU_FONT_SIZE, vec2_origin, stCoord_textBox[0], ALIGN_CENTER, true, color_identity, UI_TEXTBOX_PIC);
SCR_DrawChar (cx, cy, MENU_FONT_SIZE, ALIGN_CENTER, 1, FONT_UI, 255,255,255,255, false, false);
for (n = 0; n < lines; n++) {
cy += MENU_FONT_SIZE;
// SCR_DrawOffsetPicST (cx, cy, MENU_FONT_SIZE, MENU_FONT_SIZE, vec2_origin, stCoord_textBox[1], ALIGN_CENTER, true, color_identity, UI_TEXTBOX_PIC);
SCR_DrawChar (cx, cy, MENU_FONT_SIZE, ALIGN_CENTER, 4, FONT_UI, 255,255,255,255, false, false);
}
// SCR_DrawOffsetPicST (cx, cy, MENU_FONT_SIZE, MENU_FONT_SIZE, vec2_origin, stCoord_textBox[2], ALIGN_CENTER, true, color_identity, UI_TEXTBOX_PIC);
SCR_DrawChar (cx, cy+MENU_FONT_SIZE, MENU_FONT_SIZE, ALIGN_CENTER, 7, FONT_UI, 255,255,255,255, false, false);
// draw middle
@ -923,11 +992,14 @@ void Menu_DrawTextBox (int x, int y, int width, int lines)
while (width > 0)
{
cy = y;
// SCR_DrawOffsetPicST (cx, cy, MENU_FONT_SIZE, MENU_FONT_SIZE, vec2_origin, stCoord_textBox[3], ALIGN_CENTER, true, color_identity, UI_TEXTBOX_PIC);
SCR_DrawChar (cx, cy, MENU_FONT_SIZE, ALIGN_CENTER, 2, FONT_UI, 255,255,255,255, false, false);
for (n = 0; n < lines; n++) {
cy += MENU_FONT_SIZE;
// SCR_DrawOffsetPicST (cx, cy, MENU_FONT_SIZE, MENU_FONT_SIZE, vec2_origin, stCoord_textBox[4], ALIGN_CENTER, true, color_identity, UI_TEXTBOX_PIC);
SCR_DrawChar (cx, cy, MENU_FONT_SIZE, ALIGN_CENTER, 5, FONT_UI, 255,255,255,255, false, false);
}
// SCR_DrawOffsetPicST (cx, cy, MENU_FONT_SIZE, MENU_FONT_SIZE, vec2_origin, stCoord_textBox[5], ALIGN_CENTER, true, color_identity, UI_TEXTBOX_PIC);
SCR_DrawChar (cx, cy+MENU_FONT_SIZE, MENU_FONT_SIZE, ALIGN_CENTER, 8, FONT_UI, 255,255,255,255, false, false);
width -= 1;
cx += MENU_FONT_SIZE;
@ -935,11 +1007,14 @@ void Menu_DrawTextBox (int x, int y, int width, int lines)
// draw right side
cy = y;
// SCR_DrawOffsetPicST (cx, cy, MENU_FONT_SIZE, MENU_FONT_SIZE, vec2_origin, stCoord_textBox[6], ALIGN_CENTER, true, color_identity, UI_TEXTBOX_PIC);
SCR_DrawChar (cx, cy, MENU_FONT_SIZE, ALIGN_CENTER, 3, FONT_UI, 255,255,255,255, false, false);
for (n = 0; n < lines; n++) {
cy += MENU_FONT_SIZE;
// SCR_DrawOffsetPicST (cx, cy, MENU_FONT_SIZE, MENU_FONT_SIZE, vec2_origin, stCoord_textBox[7], ALIGN_CENTER, true, color_identity, UI_TEXTBOX_PIC);
SCR_DrawChar (cx, cy, MENU_FONT_SIZE, ALIGN_CENTER, 6, FONT_UI, 255,255,255,255, false, false);
}
// SCR_DrawOffsetPicST (cx, cy, MENU_FONT_SIZE, MENU_FONT_SIZE, vec2_origin, stCoord_textBox[8], ALIGN_CENTER, true, color_identity, UI_TEXTBOX_PIC);
SCR_DrawChar (cx, cy+MENU_FONT_SIZE, MENU_FONT_SIZE, ALIGN_CENTER, 9, FONT_UI, 255,255,255,255, false, true);
}
@ -954,7 +1029,7 @@ void Menu_DrawBanner (char *name)
int w, h;
R_DrawGetPicSize (&w, &h, name );
SCR_DrawPic (SCREEN_WIDTH/2-w/2, SCREEN_HEIGHT/2-150, w, h, ALIGN_CENTER, name, 1.0);
SCR_DrawPic (SCREEN_WIDTH/2-w/2, SCREEN_HEIGHT/2-150, w, h, ALIGN_CENTER, false, name, 1.0);
}
@ -1087,7 +1162,7 @@ void UI_RefreshCursorLink (void)
ui_mousecursor.menuitem = NULL;
}
#if 0
#if 1
/*
=================
Slider_CursorPositionX
@ -1097,14 +1172,19 @@ int Slider_CursorPositionX (menuslider_s *s)
{
float range;
range = (s->curvalue - s->minvalue) / (float)(s->maxvalue - s->minvalue);
if (!s)
return 0;
// range = (s->curvalue - s->minvalue) / (float)(s->maxvalue - s->minvalue);
range = (float)s->curPos / (float)s->maxPos;
if (range < 0)
range = 0;
if (range > 1)
range = 1;
return (int)(SCR_ScaledScreen(MENU_FONT_SIZE) + RCOLUMN_OFFSET + (SLIDER_RANGE)*SCR_ScaledScreen(MENU_FONT_SIZE) * range);
// return (int)(s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET + MENU_FONT_SIZE + SLIDER_RANGE*MENU_FONT_SIZE*range);
return (int)(s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET + SLIDER_ENDCAP_WIDTH + SLIDER_RANGE*SLIDER_SECTION_WIDTH*range);
}
/*
@ -1112,19 +1192,26 @@ int Slider_CursorPositionX (menuslider_s *s)
NewSliderValueForX
=================
*/
int NewSliderValueForX (int x, menuslider_s *s)
int NewSliderValueForX (menuslider_s *s, int x)
{
float newValue, sliderbase;
int newValueInt;
int pos;
sliderbase = s->generic.x + s->generic.parent->x + MENU_FONT_SIZE + RCOLUMN_OFFSET;
if (!s)
return 0;
// sliderbase = s->generic.x + s->generic.parent->x + MENU_FONT_SIZE + RCOLUMN_OFFSET;
sliderbase = s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET + SLIDER_ENDCAP_WIDTH;
SCR_ScaleCoords (&sliderbase, NULL, NULL, NULL, ALIGN_CENTER);
pos = x - sliderbase;
// pos = x - SCR_ScaledScreen(s->generic.x + s->generic.parent->x + MENU_FONT_SIZE + RCOLUMN_OFFSET);
newValue = ((float)pos)/((SLIDER_RANGE-1)*SCR_ScaledScreen(MENU_FONT_SIZE));
newValueInt = s->minvalue + newValue * (float)(s->maxvalue - s->minvalue);
// newValue = ((float)pos) / ((SLIDER_RANGE-1) * SCR_ScaledScreen(MENU_FONT_SIZE));
// newValueInt = s->minvalue + newValue * (float)(s->maxvalue - s->minvalue);
newValue = ((float)pos) / (SCR_ScaledScreen(SLIDER_RANGE*SLIDER_SECTION_WIDTH));
newValue = min(newValue, 1.0f);
newValueInt = newValue * (float)(s->maxPos);
return newValueInt;
}
@ -1136,10 +1223,14 @@ Slider_CheckSlide
*/
void Slider_CheckSlide (menuslider_s *s)
{
if (s->curvalue > s->maxvalue)
s->curvalue = s->maxvalue;
else if (s->curvalue < s->minvalue)
s->curvalue = s->minvalue;
if (!s)
return;
// if (s->curvalue > s->maxvalue)
// s->curvalue = s->maxvalue;
// else if (s->curvalue < s->minvalue)
// s->curvalue = s->minvalue;
s->curPos = min(max(s->curPos, 0), s->maxPos);
if (s->generic.callback)
s->generic.callback (s);
@ -1152,10 +1243,15 @@ Menu_DragSlideItem
*/
void Menu_DragSlideItem (menuframework_s *menu, void *menuitem)
{
// menucommon_s *item = (menucommon_s *) menuitem;
menuslider_s *slider = (menuslider_s *) menuitem;
menuslider_s *slider;
slider->curvalue = NewSliderValueForX(cursor.x, slider);
if (!menu || !menuitem)
return;
slider = (menuslider_s *) menuitem;
// slider->curvalue = NewSliderValueForX(slider, ui_mousecursor.x);
slider->curPos = NewSliderValueForX(slider, ui_mousecursor.x);
Slider_CheckSlide (slider);
}
@ -1168,19 +1264,59 @@ void Menu_ClickSlideItem (menuframework_s *menu, void *menuitem)
{
int min, max;
float x, w;
menucommon_s *item = (menucommon_s *) menuitem;
menuslider_s *slider = (menuslider_s *) menuitem;
menuslider_s *slider;
x = menu->x + item->x + Slider_CursorPositionX(slider) - 4;
w = 8;
if (!menu || !menuitem)
return;
slider = (menuslider_s *)menuitem;
// x = menu->x + item->x + Slider_CursorPositionX(slider) - 4;
// w = 8;
x = Slider_CursorPositionX(slider) - (SLIDER_KNOB_WIDTH/2);
w = SLIDER_KNOB_WIDTH;
SCR_ScaleCoords (&x, NULL, &w, NULL, ALIGN_CENTER);
min = x; max = x + w;
if (cursor.x < min)
if (ui_mousecursor.x < min)
Menu_SlideItem (menu, -1);
if (cursor.x > max)
if (ui_mousecursor.x > max)
Menu_SlideItem (menu, 1);
}
/*
=================
Menu_CheckSlider_Mouseover
=================
*/
qboolean Menu_CheckSlider_Mouseover (menuframework_s *menu, void *menuitem)
{
int min[2], max[2];
float x1, y1, x2, y2;
menuslider_s *s;
if (!menu || !menuitem)
return false;
s = (menuslider_s *)menuitem;
x1 = s->generic.x + s->generic.parent->x + RCOLUMN_OFFSET + SLIDER_ENDCAP_WIDTH;
y1 = s->generic.y + s->generic.parent->y;
x2 = x1 + SLIDER_RANGE*SLIDER_SECTION_WIDTH + SLIDER_ENDCAP_WIDTH;
y2 = y1 + SLIDER_HEIGHT;
SCR_ScaleCoords (&x1, &y1, NULL, NULL, ALIGN_CENTER);
SCR_ScaleCoords (&x2, &y2, NULL, NULL, ALIGN_CENTER);
min[0] = x1; max[0] = x2;
min[1] = y1; max[1] = y2;
if ( ui_mousecursor.x >= min[0] && ui_mousecursor.x <= max[0]
&& ui_mousecursor.y >= min[1] && ui_mousecursor.y <= max[1] )
return true;
else
return false;
}
#endif
/*
@ -1233,16 +1369,20 @@ void UI_Think_MouseCursor (void)
{
if (ui_mousecursor.menuitemtype == MENUITEM_SLIDER && !ui_mousecursor.buttonused[MOUSEBUTTON1])
{
// Menu_DragSlideItem(m, ui_mousecursor.menuitem);
if ( Menu_CheckSlider_Mouseover(m, ui_mousecursor.menuitem) ) {
Menu_DragSlideItem (m, ui_mousecursor.menuitem);
sound = menu_drag_sound;
}
else {
Menu_SlideItem (m, 1);
sound = menu_move_sound;
ui_mousecursor.buttonused[MOUSEBUTTON1] = true;
}
}
else if (!ui_mousecursor.buttonused[MOUSEBUTTON1] && ui_mousecursor.buttonclicks[MOUSEBUTTON1])
{
if (ui_mousecursor.menuitemtype == MENUITEM_ROTATE)
{
// if (ui_item_rotate->value)
if (ui_item_rotate->integer)
Menu_SlideItem (m, -1);
else
@ -1264,8 +1404,12 @@ void UI_Think_MouseCursor (void)
{
if (ui_mousecursor.menuitemtype == MENUITEM_SLIDER && !ui_mousecursor.buttonused[MOUSEBUTTON2])
{
// Menu_ClickSlideItem(m, ui_mousecursor.menuitem);
if ( Menu_CheckSlider_Mouseover(m, ui_mousecursor.menuitem) ) {
Menu_ClickSlideItem (m, ui_mousecursor.menuitem);
}
else {
Menu_SlideItem (m, -1);
}
sound = menu_move_sound;
ui_mousecursor.buttonused[MOUSEBUTTON2] = true;
}
@ -1273,7 +1417,6 @@ void UI_Think_MouseCursor (void)
{
if (ui_mousecursor.menuitemtype == MENUITEM_ROTATE)
{
// if (ui_item_rotate->value)
if (ui_item_rotate->integer)
Menu_SlideItem (m, 1);
else
@ -1321,17 +1464,19 @@ UI_Draw_Cursor
#if 1
void UI_Draw_Cursor (void)
{
int w, h;
float ofs_x, ofs_y;
// int w, h;
// float ofs_x, ofs_y;
float scale = SCR_ScaledScreen(ui_cursor_scale->value); // 0.4
char *cur_img = UI_MOUSECURSOR_PIC;
// get sizing vars
R_DrawGetPicSize( &w, &h, UI_MOUSECURSOR_PIC );
/* R_DrawGetPicSize (&w, &h, UI_MOUSECURSOR_PIC);
ofs_x = SCR_ScaledScreen(w) * ui_cursor_scale->value * 0.5;
ofs_y = SCR_ScaledScreen(h) * ui_cursor_scale->value * 0.5;
R_DrawScaledPic (ui_mousecursor.x - ofs_x, ui_mousecursor.y - ofs_y, scale, 1.0f, cur_img);
*/
SCR_DrawScaledPic (ui_mousecursor.x, ui_mousecursor.y, scale, true, false, cur_img, 1.0f);
}
#else
void UI_Draw_Cursor (void)

View file

@ -67,12 +67,12 @@ void Menu_DrawSaveshot (qboolean loadmenu)
}
shotname = UI_UpdateSaveshot (i);
SCR_DrawFill (SCREEN_WIDTH/2+44, SCREEN_HEIGHT/2-70, 244, 184, ALIGN_CENTER, 60,60,60,255);
SCR_DrawFill (SCREEN_WIDTH/2+44, SCREEN_HEIGHT/2-70, 244, 184, ALIGN_CENTER, false, 60,60,60,255);
if (shotname)
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, shotname, 1.0);
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, shotname, 1.0);
else
SCR_DrawFill (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, 0,0,0,255);
SCR_DrawFill (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, 0,0,0,255);
}
#else
void Menu_DrawSaveshot (qboolean loadmenu)
@ -94,25 +94,25 @@ void Menu_DrawSaveshot (qboolean loadmenu)
i = s_savegame_actions[s_savegame_menu.cursor].generic.localdata[0];
}
SCR_DrawFill (SCREEN_WIDTH/2+44, SCREEN_HEIGHT/2-70, 244, 184, ALIGN_CENTER, 60,60,60,255);
SCR_DrawFill (SCREEN_WIDTH/2+44, SCREEN_HEIGHT/2-70, 244, 184, ALIGN_CENTER, false, 60,60,60,255);
if ( loadmenu && (i == 0) && ui_savevalid[i] && ui_saveshotvalid[i]) // m_mapshotvalid ) // autosave shows mapshot
{
Com_sprintf(mapshotname, sizeof(mapshotname), "/levelshots/%s.pcx", ui_mapname);
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, mapshotname, 1.0);
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, mapshotname, 1.0);
}
else if ( ui_savevalid[i] && ui_saveshotvalid[i] )
{
// Com_sprintf(shotname, sizeof(shotname), "/save/kmq2save%03i/shot.jpg", i);
Com_sprintf(shotname, sizeof(shotname), "/"SAVEDIRNAME"/kmq2save%03i/shot.jpg", i);
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, shotname, 1.0);
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, shotname, 1.0);
}
else if (ui_saveshotvalid[UI_MAX_SAVEGAMES])
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, "/gfx/ui/noscreen.pcx", 1.0);
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, "/gfx/ui/noscreen.pcx", 1.0);
else
SCR_DrawFill (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, 0,0,0,255);
SCR_DrawFill (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, 0,0,0,255);
}
#endif

View file

@ -59,6 +59,11 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define LCOLUMN_OFFSET -MENU_FONT_SIZE*2 // was -16
#define SLIDER_RANGE 10
#define SLIDER_HEIGHT 8
#define SLIDER_ENDCAP_WIDTH 5 // was 8
#define SLIDER_SECTION_WIDTH 10 // was 8
#define SLIDER_KNOB_WIDTH 5 // was 8
#define SLIDER_V_OFFSET (SLIDER_HEIGHT-MENU_FONT_SIZE)/2
//
@ -190,7 +195,14 @@ typedef struct
cursor_t ui_mousecursor;
//
// ui_backend.c
//
extern vec4_t stCoord_arrow_left;
extern vec4_t stCoord_arrow_right;
extern vec4_t stCoord_arrow_up;
extern vec4_t stCoord_arrow_down;
qboolean MenuField_Key (menufield_s *field, int key);
void MenuSlider_SetValue (menuslider_s *s, float value);
float MenuSlider_GetValue (menuslider_s *s);
@ -392,15 +404,28 @@ void UI_Shutdown (void);
#define UI_MOUSECURSOR_TEXT_PIC "/gfx/ui/cursors/m_cur_text.pcx"
#define UI_MOUSECURSOR_PIC "/gfx/ui/cursors/m_mouse_cursor.pcx"
#define UI_ITEMCURSOR_DEFAULT_PIC "/gfx/ui/cursors/cursor_menuitem_default.pcx"
#define UI_ITEMCURSOR_KEYBIND_PIC "/gfx/ui/cursors/cursor_menuitem_keybind.pcx"
#define UI_ITEMCURSOR_BLINK_PIC "/gfx/ui/cursors/cursor_menuitem_blink.pcx"
#define UI_CHECKBOX_ON_PIC "/gfx/ui/widgets/checkbox_on.pcx"
#define UI_CHECKBOX_OFF_PIC "/gfx/ui/widgets/checkbox_off.pcx"
#define UI_FIELD_PIC "/gfx/ui/widgets/field.pcx"
#define UI_TEXTBOX_PIC "/gfx/ui/widgets/textbox.pcx"
#define UI_SLIDER_PIC "/gfx/ui/widgets/slider.pcx"
#define UI_ARROWS_PIC "/gfx/ui/widgets/arrows.pcx"
extern cvar_t *ui_sensitivity;
extern cvar_t *ui_background_alpha;
extern cvar_t *ui_item_rotate;
extern cvar_t *ui_cursor_scale;
static char *menu_in_sound = "misc/menu1.wav";
static char *menu_move_sound = "misc/menu2.wav";
static char *menu_out_sound = "misc/menu3.wav";
// moved these declarations to ui_subsystem.c to avoid redundancy
extern char *menu_null_sound;
extern char *menu_in_sound;
extern char *menu_move_sound;
extern char *menu_out_sound;
extern char *menu_drag_sound;
extern qboolean ui_entersound; // play after drawing a frame, so caching
// won't disrupt the sound

View file

@ -110,7 +110,7 @@ void UI_DrawMainCursor (int x, int y, int f)
Com_sprintf (cursorname, sizeof(cursorname), "m_cursor%d", f);
R_DrawGetPicSize (&w, &h, cursorname);
SCR_DrawPic (x, y, w, h, ALIGN_CENTER, cursorname, 1.0);
SCR_DrawPic (x, y, w, h, ALIGN_CENTER, false, cursorname, 1.0);
}
@ -200,7 +200,7 @@ void M_Main_Draw (void)
for (i = 0; main_names[i] != 0; i++)
if (i != m_main_cursor) {
R_DrawGetPicSize (&w, &h, main_names[i]);
SCR_DrawPic (xoffset, (ystart + i*40+3), w, h, ALIGN_CENTER, main_names[i], 1.0);
SCR_DrawPic (xoffset, (ystart + i*40+3), w, h, ALIGN_CENTER, false, main_names[i], 1.0);
}
// strncpy (litname, main_names[m_main_cursor]);
@ -208,7 +208,7 @@ void M_Main_Draw (void)
Q_strncpyz (litname, sizeof(litname), main_names[m_main_cursor]);
Q_strncatz (litname, sizeof(litname), "_sel");
R_DrawGetPicSize (&w, &h, litname);
SCR_DrawPic (xoffset-1, (ystart + m_main_cursor*40+2), w+2, h+2, ALIGN_CENTER, litname, 1.0);
SCR_DrawPic (xoffset-1, (ystart + m_main_cursor*40+2), w+2, h+2, ALIGN_CENTER, false, litname, 1.0);
// Draw our nifty quad damage model as a cursor if it's loaded.
if (quadModel_loaded)
@ -217,11 +217,11 @@ void M_Main_Draw (void)
UI_DrawMainCursor (xoffset-25, ystart+(m_main_cursor*40+1), (int)(cls.realtime/100)%NUM_MAINMENU_CURSOR_FRAMES);
R_DrawGetPicSize (&w, &h, "m_main_plaque");
SCR_DrawPic (xoffset-(w/2+50), ystart, w, h, ALIGN_CENTER, "m_main_plaque", 1.0);
SCR_DrawPic (xoffset-(w/2+50), ystart, w, h, ALIGN_CENTER, false, "m_main_plaque", 1.0);
last_h = h;
R_DrawGetPicSize (&w, &h, "m_main_logo");
SCR_DrawPic (xoffset-(w/2+50), ystart+last_h+20, w, h, ALIGN_CENTER, "m_main_logo", 1.0);
SCR_DrawPic (xoffset-(w/2+50), ystart+last_h+20, w, h, ALIGN_CENTER, false, "m_main_logo", 1.0);
}

View file

@ -457,8 +457,12 @@ void PlayerConfig_DrawSkinSelection (void)
float icon_offset = 0;
float x, y, w, h;
int i, count, color[3];
color_t arrowColor;
vec4_t arrowTemp[2];
CL_TextColor ((int)Cvar_VariableValue("alt_text_color"), &color[0], &color[1], &color[2]);
Vector4Copy (stCoord_arrow_left, arrowTemp[0]);
Vector4Copy (stCoord_arrow_right, arrowTemp[1]);
if ( (ui_pmi[s_playerconfig_model_box.curvalue].nskins < NUM_SKINBOX_ITEMS) || (s_playerconfig_skin_box.curvalue < 4) )
i = 0;
@ -468,21 +472,29 @@ void PlayerConfig_DrawSkinSelection (void)
i = s_playerconfig_skin_box.curvalue - 3;
// left arrow
if (i > 0)
Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_left.pcx");
else
Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_left_d.pcx");
SCR_DrawPic (icon_x-39, icon_y+2, 32, 32, ALIGN_CENTER, scratch, 1.0);
if (i > 0) {
Vector4Set (arrowColor, color[0], color[1], color[2], 255);
// Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_left.pcx");
}
else {
Vector4Set (arrowColor, 150, 150, 150, 255);
arrowTemp[0][1] += 0.25;
arrowTemp[0][3] += 0.25;
// Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_left_d.pcx");
}
SCR_DrawOffsetPicST (icon_x-39, icon_y+2, 32, 32, vec2_origin, arrowTemp[0], ALIGN_CENTER, false, arrowColor, UI_ARROWS_PIC);
// SCR_DrawPic (icon_x-39, icon_y+2, 32, 32, ALIGN_CENTER, false, scratch, 1.0);
// background
SCR_DrawFill (icon_x-3, icon_y-3, NUM_SKINBOX_ITEMS*34+4, 38, ALIGN_CENTER, 0,0,0,255);
if (R_DrawFindPic("/gfx/ui/listbox_background.pcx")) {
SCR_DrawFill (icon_x-3, icon_y-3, NUM_SKINBOX_ITEMS*34+4, 38, ALIGN_CENTER, false, 0, 0, 0, 255);
if (R_DrawFindPic("/gfx/ui/widgets/listbox_background.pcx")) {
x = icon_x-2; y = icon_y-2; w = NUM_SKINBOX_ITEMS * 34 + 2; h = 36;
SCR_ScaleCoords (&x, &y, &w, &h, ALIGN_CENTER);
R_DrawTileClear ((int)x, (int)y, (int)w, (int)h, "/gfx/ui/listbox_background.pcx");
SCR_DrawTiledPic (x, y, w, h, ALIGN_CENTER, true, "/gfx/ui/widgets/listbox_background.pcx", 255);
// SCR_ScaleCoords (&x, &y, &w, &h, ALIGN_CENTER);
// R_DrawTileClear ((int)x, (int)y, (int)w, (int)h, "/gfx/ui/widgets/listbox_background.pcx");
}
else
SCR_DrawFill (icon_x-2, icon_y-2, NUM_SKINBOX_ITEMS*34+2, 36, ALIGN_CENTER, 60,60,60,255);
SCR_DrawFill (icon_x-2, icon_y-2, NUM_SKINBOX_ITEMS*34+2, 36, ALIGN_CENTER, false, 60, 60, 60, 255);
for (count=0; count<NUM_SKINBOX_ITEMS; i++,count++)
{
@ -494,18 +506,25 @@ void PlayerConfig_DrawSkinSelection (void)
ui_pmi[s_playerconfig_model_box.curvalue].skinDisplayNames[i] );
if (i == s_playerconfig_skin_box.curvalue)
SCR_DrawFill (icon_x + icon_offset-1, icon_y-1, 34, 34, ALIGN_CENTER, color[0],color[1],color[2],255);
SCR_DrawPic (icon_x + icon_offset, icon_y, 32, 32, ALIGN_CENTER, scratch, 1.0);
SCR_DrawFill (icon_x + icon_offset-1, icon_y-1, 34, 34, ALIGN_CENTER, false, color[0], color[1] ,color[2], 255);
SCR_DrawPic (icon_x + icon_offset, icon_y, 32, 32, ALIGN_CENTER, false, scratch, 1.0);
icon_offset += 34;
}
// right arrow
icon_offset = NUM_SKINBOX_ITEMS*34;
if (ui_pmi[s_playerconfig_model_box.curvalue].nskins-i>0)
Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_right.pcx");
else
Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_right_d.pcx");
SCR_DrawPic (icon_x+icon_offset+5, icon_y+2, 32, 32, ALIGN_CENTER, scratch, 1.0);
if ( ui_pmi[s_playerconfig_model_box.curvalue].nskins-i > 0 ) {
Vector4Set (arrowColor, color[0], color[1], color[2], 255);
// Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_right.pcx");
}
else {
Vector4Set (arrowColor, 150, 150, 150, 255);
arrowTemp[1][1] += 0.25;
arrowTemp[1][3] += 0.25;
// Com_sprintf (scratch, sizeof(scratch), "/gfx/ui/arrows/arrow_right_d.pcx");
}
SCR_DrawOffsetPicST (icon_x+icon_offset+5, icon_y+2, 32, 32, vec2_origin, arrowTemp[1], ALIGN_CENTER, false, arrowColor, UI_ARROWS_PIC);
// SCR_DrawPic (icon_x+icon_offset+5, icon_y+2, 32, 32, ALIGN_CENTER, false, scratch, 1.0);
}

View file

@ -476,12 +476,12 @@ void DrawStartSeverLevelshot (void)
{
char *mapshotname = UI_UpdateStartSeverLevelshot (s_startmap_list.curvalue);
SCR_DrawFill (SCREEN_WIDTH/2+44, SCREEN_HEIGHT/2-70, 244, 184, ALIGN_CENTER, 60,60,60,255);
SCR_DrawFill (SCREEN_WIDTH/2+44, SCREEN_HEIGHT/2-70, 244, 184, ALIGN_CENTER, false, 60,60,60,255);
if (mapshotname)
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, mapshotname, 1.0);
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, mapshotname, 1.0);
else
SCR_DrawFill (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, 0,0,0,255);
SCR_DrawFill (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, 0,0,0,255);
}
#else
void DrawStartSeverLevelshot (void)
@ -491,7 +491,7 @@ void DrawStartSeverLevelshot (void)
int i = s_startmap_list.curvalue;
Q_strncpyz (startmap, sizeof(startmap), strchr( ui_svr_mapnames[i], '\n' ) + 1);
SCR_DrawFill (SCREEN_WIDTH/2+44, SCREEN_HEIGHT/2-70, 244, 184, ALIGN_CENTER, 60,60,60,255);
SCR_DrawFill (SCREEN_WIDTH/2+44, SCREEN_HEIGHT/2-70, 244, 184, ALIGN_CENTER, false, 60,60,60,255);
if ( ui_svr_mapshotvalid[i] == M_UNSET) { // init levelshot
Com_sprintf(mapshotname, sizeof(mapshotname), "/levelshots/%s.pcx", startmap);
@ -504,12 +504,12 @@ void DrawStartSeverLevelshot (void)
if ( ui_svr_mapshotvalid[i] == M_FOUND) {
Com_sprintf(mapshotname, sizeof(mapshotname), "/levelshots/%s.pcx", startmap);
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, mapshotname, 1.0);
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, mapshotname, 1.0);
}
else if (ui_svr_mapshotvalid[ui_svr_nummaps] == M_FOUND)
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, "/gfx/ui/noscreen.pcx", 1.0);
SCR_DrawPic (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, "/gfx/ui/noscreen.pcx", 1.0);
else
SCR_DrawFill (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, 0,0,0,255);
SCR_DrawFill (SCREEN_WIDTH/2+46, SCREEN_HEIGHT/2-68, 240, 180, ALIGN_CENTER, false, 0,0,0,255);
}
#endif

View file

@ -79,14 +79,14 @@ static void AltTextColorFunc( void *unused )
// Psychospaz's transparent console
static void ConAlphaFunc( void *unused )
{
// Cvar_SetValue( "con_alpha", s_options_interface_conalpha_slider.curvalue * 0.05 );
Cvar_SetValue( "con_alpha", MenuSlider_GetValue(&s_options_interface_conalpha_slider) );
// Cvar_SetValue( "scr_conalpha", s_options_interface_conalpha_slider.curvalue * 0.05 );
Cvar_SetValue( "scr_conalpha", MenuSlider_GetValue(&s_options_interface_conalpha_slider) );
}
// variable console height
/*static void ConHeightFunc( void *unused )
{
Cvar_SetValue( "con_height", 0.25 + (s_options_interface_conheight_slider.curvalue * 0.05) );
Cvar_SetValue( "scr_conheight", 0.25 + (s_options_interface_conheight_slider.curvalue * 0.05) );
}*/
static void SimpleLoadscreenFunc( void *unused )
@ -96,7 +96,7 @@ static void SimpleLoadscreenFunc( void *unused )
static void NewConbackFunc( void *unused )
{
Cvar_SetValue( "con_newconback", s_options_interface_newconback_box.curvalue );
Cvar_SetValue( "scr_newconback", s_options_interface_newconback_box.curvalue );
}
static void NoAltTabFunc( void *unused )
@ -185,19 +185,19 @@ static void InterfaceSetMenuItemValues (void)
Cvar_SetValue( "alt_text_color", ClampCvar( 0, 9, Cvar_VariableValue("alt_text_color") ) );
s_options_interface_alt_text_color_box.curvalue = Cvar_VariableValue("alt_text_color");
Cvar_SetValue( "con_alpha", ClampCvar( 0, 1, Cvar_VariableValue("con_alpha") ) );
// s_options_interface_conalpha_slider.curvalue = ( Cvar_VariableValue("con_alpha") ) * 20;
MenuSlider_SetValue (&s_options_interface_conalpha_slider, Cvar_VariableValue("con_alpha"));
Cvar_SetValue( "scr_conalpha", ClampCvar( 0, 1, Cvar_VariableValue("scr_conalpha") ) );
// s_options_interface_conalpha_slider.curvalue = ( Cvar_VariableValue("scr_conalpha") ) * 20;
MenuSlider_SetValue (&s_options_interface_conalpha_slider, Cvar_VariableValue("scr_conalpha"));
// Cvar_SetValue( "con_height", ClampCvar( 0.25, 0.75, Cvar_VariableValue("con_height") ) );
// s_options_interface_conheight_slider.curvalue = 20 * (Cvar_VariableValue("con_height") - 0.25);
// MenuSlider_SetValue (&s_options_interface_conheight_slider, Cvar_VariableValue("con_height"));
// Cvar_SetValue( "scr_conheight", ClampCvar( 0.25, 0.75, Cvar_VariableValue("scr_conheight") ) );
// s_options_interface_conheight_slider.curvalue = 20 * (Cvar_VariableValue("scr_conheight") - 0.25);
// MenuSlider_SetValue (&s_options_interface_conheight_slider, Cvar_VariableValue("scr_conheight"));
Cvar_SetValue( "scr_simple_loadscreen", ClampCvar( 0, 1, Cvar_VariableValue("scr_simple_loadscreen") ) );
s_options_interface_simple_loadscreen_box.curvalue = Cvar_VariableValue("scr_simple_loadscreen");
Cvar_SetValue( "con_newconback", ClampCvar( 0, 1, Cvar_VariableValue("con_newconback") ) );
s_options_interface_newconback_box.curvalue = Cvar_VariableValue("con_newconback");
Cvar_SetValue( "scr_newconback", ClampCvar( 0, 1, Cvar_VariableValue("scr_newconback") ) );
s_options_interface_newconback_box.curvalue = Cvar_VariableValue("scr_newconback");
s_options_interface_noalttab_box.curvalue = Cvar_VariableValue("win_noalttab");
}
@ -211,10 +211,10 @@ static void InterfaceResetDefaultsFunc (void *unused)
Cvar_SetToDefault ("ui_font");
Cvar_SetToDefault ("scr_font");
Cvar_SetToDefault ("alt_text_color");
Cvar_SetToDefault ("con_alpha");
// Cvar_SetToDefault ("con_height");
Cvar_SetToDefault ("scr_alpha");
// Cvar_SetToDefault ("scr_height");
Cvar_SetToDefault ("scr_simple_loadscreen");
Cvar_SetToDefault ("con_newconback");
Cvar_SetToDefault ("scr_newconback");
Cvar_SetToDefault ("win_noalttab");
InterfaceSetMenuItemValues ();

View file

@ -127,18 +127,33 @@ static void M_FindKeysForCommand (char *command, int *twokeys)
static void KeysBackCursorDrawFunc (menuaction_s *self) // back action
{
SCR_DrawChar (SCREEN_WIDTH*0.5 - 24, s_keys_menu.y + self->generic.y, MENU_FONT_SIZE, ALIGN_CENTER,
char *cursor;
cursor = ((int)(Sys_Milliseconds()/250)&1) ? UI_ITEMCURSOR_DEFAULT_PIC : UI_ITEMCURSOR_BLINK_PIC;
SCR_DrawPic (SCREEN_WIDTH*0.5 - 24, s_keys_menu.y + self->generic.y, MENU_FONT_SIZE, MENU_FONT_SIZE, ALIGN_CENTER, false, cursor, 255);
/* SCR_DrawChar (SCREEN_WIDTH*0.5 - 24, s_keys_menu.y + self->generic.y, MENU_FONT_SIZE, ALIGN_CENTER,
12+((int)(Sys_Milliseconds()/250)&1), FONT_UI, 255,255,255,255, false, true);
*/
}
static void KeyCursorDrawFunc (menuframework_s *menu)
{
char *cursor;
if (bind_grab)
cursor = UI_ITEMCURSOR_KEYBIND_PIC;
else
cursor = ((int)(Sys_Milliseconds()/250)&1) ? UI_ITEMCURSOR_DEFAULT_PIC : UI_ITEMCURSOR_BLINK_PIC;
SCR_DrawPic (menu->x, menu->y + menu->cursor * MENU_LINE_SIZE, MENU_FONT_SIZE, MENU_FONT_SIZE, ALIGN_CENTER, false, cursor, 255);
/* if (bind_grab)
SCR_DrawChar (menu->x, menu->y + menu->cursor * MENU_LINE_SIZE, MENU_FONT_SIZE, ALIGN_CENTER,
'=', FONT_UI, 255,255,255,255, false, true);
else
SCR_DrawChar (menu->x, menu->y + menu->cursor * MENU_LINE_SIZE, MENU_FONT_SIZE, ALIGN_CENTER,
12+((int)(Sys_Milliseconds()/250)&1), FONT_UI, 255,255,255,255, false, true);
*/
}
static void DrawKeyBindingFunc (void *self)

View file

@ -393,15 +393,15 @@ void MenuCrosshair_MouseClick ( void )
void DrawMenuCrosshair (void)
{
SCR_DrawFill (SCREEN_WIDTH*0.5 - 18, s_options_screen_menu.y + 42,
36, 36, ALIGN_CENTER, 60,60,60,255);
36, 36, ALIGN_CENTER, false, 60,60,60,255);
SCR_DrawFill (SCREEN_WIDTH*0.5 - 17, s_options_screen_menu.y + 43,
34, 34, ALIGN_CENTER, 0,0,0,255);
34, 34, ALIGN_CENTER, false, 0,0,0,255);
if (s_options_screen_crosshair_box.curvalue < 1)
return;
SCR_DrawPic (SCREEN_WIDTH*0.5-16, s_options_screen_menu.y + 44,
32, 32, ALIGN_CENTER, ui_crosshair_names[s_options_screen_crosshair_box.curvalue], 1.0);
32, 32, ALIGN_CENTER, false, ui_crosshair_names[s_options_screen_crosshair_box.curvalue], 1.0);
}
void Options_Screen_MenuDraw (void)

View file

@ -127,7 +127,7 @@ void M_Quit_Draw (void)
int w, h;
R_DrawGetPicSize (&w, &h, "quit");
SCR_DrawPic (SCREEN_WIDTH/2-w/2, SCREEN_HEIGHT/2-h/2, w, h, ALIGN_CENTER, "quit", 1.0);
SCR_DrawPic (SCREEN_WIDTH/2-w/2, SCREEN_HEIGHT/2-h/2, w, h, ALIGN_CENTER, false, "quit", 1.0);
#endif // QUITMENU_NOKEY
}

View file

@ -34,6 +34,13 @@ cvar_t *ui_background_alpha;
cvar_t *ui_item_rotate;
cvar_t *ui_cursor_scale;
// moved these here to avoid redundancy
char *menu_null_sound = "null";
char *menu_in_sound = "misc/menu1.wav";
char *menu_move_sound = "misc/menu2.wav";
char *menu_out_sound = "misc/menu3.wav";
char *menu_drag_sound = "drag";
qboolean ui_entersound; // play after drawing a frame, so caching
// won't disrupt the sound
qboolean ui_initialized = false; // whether UI subsystem has been initialized
@ -393,6 +400,9 @@ void UI_Precache (void)
// R_DrawFindPic (UI_MOUSECURSOR_OVER_PIC);
// R_DrawFindPic (UI_MOUSECURSOR_TEXT_PIC);
R_DrawFindPic (UI_MOUSECURSOR_PIC);
R_DrawFindPic (UI_ITEMCURSOR_DEFAULT_PIC);
R_DrawFindPic (UI_ITEMCURSOR_KEYBIND_PIC);
R_DrawFindPic (UI_ITEMCURSOR_BLINK_PIC);
for (i = 0; i < NUM_MAINMENU_CURSOR_FRAMES; i++) {
Com_sprintf (scratch, sizeof(scratch), "/pics/m_cursor%d.pcx", i);
@ -434,11 +444,19 @@ void UI_Precache (void)
// R_DrawFindPic ("/pics/yn.pcx");
// GUI elements
R_DrawFindPic ("/gfx/ui/listbox_background.pcx");
R_DrawFindPic ("/gfx/ui/arrows/arrow_left.pcx");
R_DrawFindPic ("/gfx/ui/arrows/arrow_left_d.pcx");
R_DrawFindPic ("/gfx/ui/arrows/arrow_right.pcx");
R_DrawFindPic ("/gfx/ui/arrows/arrow_right_d.pcx");
R_DrawFindPic ("/gfx/ui/widgets/listbox_background.pcx");
// R_DrawFindPic (UI_CHECKBOX_ON_PIC);
// R_DrawFindPic (UI_CHECKBOX_OFF_PIC);
R_DrawFindPic (UI_FIELD_PIC);
R_DrawFindPic (UI_TEXTBOX_PIC);
R_DrawFindPic (UI_SLIDER_PIC);
R_DrawFindPic (UI_ARROWS_PIC);
// R_DrawFindPic ("/gfx/ui/listbox_background.pcx");
// R_DrawFindPic ("/gfx/ui/arrows/arrow_left.pcx");
// R_DrawFindPic ("/gfx/ui/arrows/arrow_left_d.pcx");
// R_DrawFindPic ("/gfx/ui/arrows/arrow_right.pcx");
// R_DrawFindPic ("/gfx/ui/arrows/arrow_right_d.pcx");
}
@ -561,7 +579,7 @@ void UI_Draw (void)
{
// R_DrawStretchPic (0, 0, viddef.width, viddef.height, UI_BACKGROUND_NAME, 1.0f);
R_DrawFill (0,0,viddef.width, viddef.height, 0 ,0, 0, 255);
SCR_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_CENTER, UI_BACKGROUND_NAME, 1.0f);
SCR_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_CENTER, false, UI_BACKGROUND_NAME, 1.0f);
}
else
R_DrawFill (0,0,viddef.width, viddef.height, 0, 0, 0, 255);
@ -569,7 +587,7 @@ void UI_Draw (void)
// ingame menu uses alpha
else if (R_DrawFindPic(UI_BACKGROUND_NAME))
// R_DrawStretchPic (0, 0, viddef.width, viddef.height, UI_BACKGROUND_NAME, ui_background_alpha->value);
SCR_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_CENTER, UI_BACKGROUND_NAME, ui_background_alpha->value);
SCR_DrawPic(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ALIGN_CENTER, false, UI_BACKGROUND_NAME, ui_background_alpha->value);
else
R_DrawFill (0,0,viddef.width, viddef.height, 0, 0, 0, (int)(ui_background_alpha->value*255.0f));