no message

This commit is contained in:
Andrei Drexler 2006-04-14 18:02:06 +00:00
parent d1b890dddc
commit 2c009a994e
8 changed files with 710 additions and 440 deletions

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.14 2006/04/14 18:02:06 makro
// no message
//
// Revision 1.13 2005/09/07 20:24:33 makro // Revision 1.13 2005/09/07 20:24:33 makro
// Vector support for most item types // Vector support for most item types
// //
@ -115,6 +118,8 @@
#define FEEDER_MMHEADS 0x11 #define FEEDER_MMHEADS 0x11
//Makro - replacements //Makro - replacements
#define FEEDER_REPLACEMENTS 0x12 #define FEEDER_REPLACEMENTS 0x12
//Makro - driver info
#define FEEDER_GLDRIVER_INFO 0x13
// display flags // display flags
#define CG_SHOW_BLUE_TEAM_HAS_REDFLAG 0x00000001 #define CG_SHOW_BLUE_TEAM_HAS_REDFLAG 0x00000001

View file

@ -72,8 +72,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0 # PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UI_EXPORTS" /FR /YX /FD /GZ /c # ADD BASE CPP /nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UI_EXPORTS" /FR /YX /FD /GZ /c
# ADD CPP /nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UI_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UI_EXPORTS" /Fr /YX /FD /GZ /c
# SUBTRACT CPP /Fr
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD BASE RSC /l 0x409 /d "_DEBUG"

View file

@ -3,18 +3,18 @@
<pre> <pre>
<h1>Build Log</h1> <h1>Build Log</h1>
<h3> <h3>
--------------------Configuration: ui - Win32 Debug TA-------------------- --------------------Configuration: ui - Win32 Release TA--------------------
</h3> </h3>
<h3>Command Lines</h3> <h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP51.tmp" with contents Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP75.tmp" with contents
[ [
/nologo /G5 /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UI_EXPORTS" /Fp"D:\Work\rq3source\reaction\Release/ta_ui.pch" /YX /Fo"D:\Work\rq3source\reaction\Release/" /Fd"D:\Work\rq3source\reaction\Release/" /FD /GZ /c /nologo /G6 /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UI_EXPORTS" /Fp"D:\Work\rq3source\reaction\Release/ta_ui.pch" /YX /Fo"D:\Work\rq3source\reaction\Release/" /Fd"D:\Work\rq3source\reaction\Release/" /FD /c
"D:\Work\rq3source\reaction\ta_ui\ui_main.c" "D:\Work\rq3source\reaction\ta_ui\ui_shared.c"
] ]
Creating command line "cl.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP51.tmp" Creating command line "cl.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP75.tmp"
Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP52.tmp" with contents Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP76.tmp" with contents
[ [
/nologo /base:"0x40000000" /dll /incremental:yes /pdb:"../Debug/ui.pdb" /map:"D:\Work\rq3source\reaction\Release/uix86.map" /debug /machine:I386 /def:".\ui.def" /out:"D:\Work\rq3source\reaction\Release\uix86.dll" /implib:"D:\Work\rq3source\reaction\Release/uix86.lib" /pdbtype:sept /nologo /base:"0x40000000" /dll /incremental:no /pdb:"D:\Work\rq3source\reaction\Release/uix86.pdb" /map:"D:\Work\rq3source\reaction\Release/uix86.map" /machine:I386 /def:".\ui.def" /out:"D:\Work\rq3source\reaction\Release\uix86.dll" /implib:"D:\Work\rq3source\reaction\Release/uix86.lib"
\Work\rq3source\reaction\Release\bg_misc.obj \Work\rq3source\reaction\Release\bg_misc.obj
\Work\rq3source\reaction\Release\q_math.obj \Work\rq3source\reaction\Release\q_math.obj
\Work\rq3source\reaction\Release\q_shared.obj \Work\rq3source\reaction\Release\q_shared.obj
@ -26,11 +26,12 @@ Creating temporary file "C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP52.tmp" with conten
\Work\rq3source\reaction\Release\ui_syscalls.obj \Work\rq3source\reaction\Release\ui_syscalls.obj
\Work\rq3source\reaction\Release\ui_util.obj \Work\rq3source\reaction\Release\ui_util.obj
] ]
Creating command line "link.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP52.tmp" Creating command line "link.exe @C:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP76.tmp"
<h3>Output Window</h3> <h3>Output Window</h3>
Compiling... Compiling...
ui_main.c ui_shared.c
Linking... Linking...
Creating library D:\Work\rq3source\reaction\Release/uix86.lib and object D:\Work\rq3source\reaction\Release/uix86.exp

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.12 2006/04/14 18:02:06 makro
// no message
//
// Revision 1.11 2003/03/31 01:23:54 jbravo // Revision 1.11 2003/03/31 01:23:54 jbravo
// Fixing 2 compiler warnings // Fixing 2 compiler warnings
// //
@ -101,7 +104,7 @@ int UI_ParseInfos(char *buf, int max, char *infos[])
count = 0; count = 0;
while (1) { INFINITE_LOOP {
token = COM_Parse(&buf); token = COM_Parse(&buf);
if (!token[0]) { if (!token[0]) {
break; break;
@ -117,7 +120,7 @@ int UI_ParseInfos(char *buf, int max, char *infos[])
} }
info[0] = '\0'; info[0] = '\0';
while (1) { INFINITE_LOOP {
token = COM_ParseExt(&buf, qtrue); token = COM_ParseExt(&buf, qtrue);
if (!token[0]) { if (!token[0]) {
Com_Printf("Unexpected end of info file\n"); Com_Printf("Unexpected end of info file\n");

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.28 2006/04/14 18:02:06 makro
// no message
//
// Revision 1.27 2005/09/07 20:24:33 makro // Revision 1.27 2005/09/07 20:24:33 makro
// Vector support for most item types // Vector support for most item types
// //
@ -273,7 +276,10 @@ extern vmCvar_t ui_RQ3_teamModel;
//Makro - maxpolys hack //Makro - maxpolys hack
extern vmCvar_t ui_maxpolys; extern vmCvar_t ui_maxpolys;
extern vmCvar_t ui_maxpolyverts;
//Makro - player gender; irrelevant actually
extern vmCvar_t ui_RQ3_gender;
// //
// ui_qmenu.c // ui_qmenu.c
// //
@ -466,6 +472,7 @@ extern vec4_t listbar_color;
extern vec4_t text_color_disabled; extern vec4_t text_color_disabled;
extern vec4_t text_color_normal; extern vec4_t text_color_normal;
extern vec4_t text_color_highlight; extern vec4_t text_color_highlight;
extern menuDef_t *g_anchoredMenu;
extern char *ui_medalNames[]; extern char *ui_medalNames[];
extern char *ui_medalPicNames[]; extern char *ui_medalPicNames[];

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.83 2006/04/14 18:02:06 makro
// no message
//
// Revision 1.82 2005/09/07 20:24:33 makro // Revision 1.82 2005/09/07 20:24:33 makro
// Vector support for most item types // Vector support for most item types
// //
@ -477,7 +480,7 @@ vmCvar_t ui_new;
//vmCvar_t ui_debug; //vmCvar_t ui_debug;
vmCvar_t ui_developer; vmCvar_t ui_developer;
vmCvar_t ui_initialized; vmCvar_t ui_initialized;
vmCvar_t ui_teamArenaFirstRun; vmCvar_t ui_reaction33FirstRun;
void _UI_Init(qboolean); void _UI_Init(qboolean);
void _UI_Shutdown(void); void _UI_Shutdown(void);
@ -551,6 +554,16 @@ qboolean UI_FileExists(const char *filename)
return qfalse; return qfalse;
} }
//Makro - registers an asset; path is relative to the assetsPath
qhandle_t Asset_RegisterShaderNoMip(const char *path)
{
if (!path)
return 0;
if (!uiInfo.uiDC.Assets.assetsPath)
return trap_R_RegisterShaderNoMip(va("ui/assets/%s", path));
return trap_R_RegisterShaderNoMip(va("%s/%s", uiInfo.uiDC.Assets.assetsPath, path));
}
void AssetCache() void AssetCache()
{ {
int n, ssg; int n, ssg;
@ -559,7 +572,7 @@ void AssetCache()
//} //}
//Assets.background = trap_R_RegisterShaderNoMip( ASSET_BACKGROUND ); //Assets.background = trap_R_RegisterShaderNoMip( ASSET_BACKGROUND );
//Com_Printf("Menu Size: %i bytes\n", sizeof(Menus)); //Com_Printf("Menu Size: %i bytes\n", sizeof(Menus));
uiInfo.uiDC.Assets.gradientBar = trap_R_RegisterShaderNoMip(ASSET_GRADIENTBAR); uiInfo.uiDC.Assets.gradientBar = Asset_RegisterShaderNoMip(ASSET_GRADIENTBAR);
uiInfo.uiDC.Assets.fxBasePic = trap_R_RegisterShaderNoMip(ART_FX_BASE); uiInfo.uiDC.Assets.fxBasePic = trap_R_RegisterShaderNoMip(ART_FX_BASE);
uiInfo.uiDC.Assets.fxPic[0] = trap_R_RegisterShaderNoMip(ART_FX_RED); uiInfo.uiDC.Assets.fxPic[0] = trap_R_RegisterShaderNoMip(ART_FX_RED);
uiInfo.uiDC.Assets.fxPic[1] = trap_R_RegisterShaderNoMip(ART_FX_YELLOW); uiInfo.uiDC.Assets.fxPic[1] = trap_R_RegisterShaderNoMip(ART_FX_YELLOW);
@ -568,20 +581,21 @@ void AssetCache()
uiInfo.uiDC.Assets.fxPic[4] = trap_R_RegisterShaderNoMip(ART_FX_BLUE); uiInfo.uiDC.Assets.fxPic[4] = trap_R_RegisterShaderNoMip(ART_FX_BLUE);
uiInfo.uiDC.Assets.fxPic[5] = trap_R_RegisterShaderNoMip(ART_FX_CYAN); uiInfo.uiDC.Assets.fxPic[5] = trap_R_RegisterShaderNoMip(ART_FX_CYAN);
uiInfo.uiDC.Assets.fxPic[6] = trap_R_RegisterShaderNoMip(ART_FX_WHITE); uiInfo.uiDC.Assets.fxPic[6] = trap_R_RegisterShaderNoMip(ART_FX_WHITE);
uiInfo.uiDC.Assets.scrollBarH = trap_R_RegisterShaderNoMip(ASSET_SCROLLBAR_H); uiInfo.uiDC.Assets.scrollBarH = Asset_RegisterShaderNoMip(ASSET_SCROLLBAR_H);
uiInfo.uiDC.Assets.scrollBarV = trap_R_RegisterShaderNoMip(ASSET_SCROLLBAR_V); uiInfo.uiDC.Assets.scrollBarV = Asset_RegisterShaderNoMip(ASSET_SCROLLBAR_V);
uiInfo.uiDC.Assets.scrollBarArrowDown = trap_R_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWDOWN); uiInfo.uiDC.Assets.scrollBarArrowDown = Asset_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWDOWN);
uiInfo.uiDC.Assets.scrollBarArrowUp = trap_R_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWUP); uiInfo.uiDC.Assets.scrollBarArrowUp = Asset_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWUP);
uiInfo.uiDC.Assets.scrollBarArrowLeft = trap_R_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWLEFT); uiInfo.uiDC.Assets.scrollBarArrowLeft = Asset_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWLEFT);
uiInfo.uiDC.Assets.scrollBarArrowRight = trap_R_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWRIGHT); uiInfo.uiDC.Assets.scrollBarArrowRight = Asset_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWRIGHT);
uiInfo.uiDC.Assets.scrollBarThumb = trap_R_RegisterShaderNoMip(ASSET_SCROLL_THUMB); uiInfo.uiDC.Assets.scrollBarThumb = Asset_RegisterShaderNoMip(ASSET_SCROLL_THUMB);
//Makro - shown when clicked //Makro - shown when clicked
uiInfo.uiDC.Assets.scrollBarArrowDown2 = trap_R_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWDOWN2); uiInfo.uiDC.Assets.scrollBarArrowDown2 = Asset_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWDOWN2);
uiInfo.uiDC.Assets.scrollBarArrowUp2 = trap_R_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWUP2); uiInfo.uiDC.Assets.scrollBarArrowUp2 = Asset_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWUP2);
uiInfo.uiDC.Assets.scrollBarArrowLeft2 = trap_R_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWLEFT2); uiInfo.uiDC.Assets.scrollBarArrowLeft2 = Asset_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWLEFT2);
uiInfo.uiDC.Assets.scrollBarArrowRight2 = trap_R_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWRIGHT2); uiInfo.uiDC.Assets.scrollBarArrowRight2 = Asset_RegisterShaderNoMip(ASSET_SCROLLBAR_ARROWRIGHT2);
uiInfo.uiDC.Assets.sliderBar = trap_R_RegisterShaderNoMip(ASSET_SLIDER_BAR); uiInfo.uiDC.Assets.sliderBar0 = Asset_RegisterShaderNoMip(ASSET_SLIDER_BAR0);
uiInfo.uiDC.Assets.sliderThumb = trap_R_RegisterShaderNoMip(ASSET_SLIDER_THUMB); uiInfo.uiDC.Assets.sliderBar1 = Asset_RegisterShaderNoMip(ASSET_SLIDER_BAR1);
uiInfo.uiDC.Assets.sliderThumb = Asset_RegisterShaderNoMip(ASSET_SLIDER_THUMB);
for (n = 0; n < NUM_CROSSHAIRS; n++) { for (n = 0; n < NUM_CROSSHAIRS; n++) {
uiInfo.uiDC.Assets.crosshairShader[n] = trap_R_RegisterShaderNoMip(va("gfx/2d/crosshair%c", 'a' + n)); uiInfo.uiDC.Assets.crosshairShader[n] = trap_R_RegisterShaderNoMip(va("gfx/2d/crosshair%c", 'a' + n));
@ -594,10 +608,10 @@ void AssetCache()
//Makro - for drop shadows //Makro - for drop shadows
for (n = 0; n < 4; n++) { for (n = 0; n < 4; n++) {
uiInfo.uiDC.Assets.dropShadowCorners[n] = uiInfo.uiDC.Assets.dropShadowCorners[n] =
trap_R_RegisterShaderNoMip(va("ui/assets/rq3-ingame-shadow-c%i", n + 1)); Asset_RegisterShaderNoMip(va("rq3-ingame-shadow-c%i", n + 1));
} }
uiInfo.uiDC.Assets.dropShadowRight = trap_R_RegisterShaderNoMip("ui/assets/rq3-ingame-shadow-right"); uiInfo.uiDC.Assets.dropShadowRight = Asset_RegisterShaderNoMip("rq3-ingame-shadow-right");
uiInfo.uiDC.Assets.dropShadowBottom = trap_R_RegisterShaderNoMip("ui/assets/rq3-ingame-shadow-bottom"); uiInfo.uiDC.Assets.dropShadowBottom = trap_R_RegisterShaderNoMip("rq3-ingame-shadow-bottom");
uiInfo.newHighScoreSound = trap_S_RegisterSound("sound/feedback/voc_newhighscore.wav", qfalse); uiInfo.newHighScoreSound = trap_S_RegisterSound("sound/feedback/voc_newhighscore.wav", qfalse);
} }
@ -1478,7 +1492,7 @@ void _UI_Refresh(int realtime)
Vector2Subtract(dif, uiInfo.uiDC.mouseDownPos, dif); Vector2Subtract(dif, uiInfo.uiDC.mouseDownPos, dif);
norm = sqrt(Vector2Norm2(dif)); norm = sqrt(Vector2Norm2(dif));
angle = -RAD2DEG(atan2(dif[1], dif[0])); angle = -RAD2DEG(atan2(dif[1], dif[0]));
Text_Paint(20, 20, 0.225f, colorCyan, va("(%i, %i) - (%i,%i) = (%i, %i) = %.2f = %.3f deg", Text_Paint(20, 12, 0.225f, colorCyan, va("(%i, %i) - (%i,%i) = (%i, %i) = %.2f = %.3f deg",
uiInfo.uiDC.mouseDownPos[0], uiInfo.uiDC.mouseDownPos[1], uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory, uiInfo.uiDC.mouseDownPos[0], uiInfo.uiDC.mouseDownPos[1], uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory,
dif[0], dif[1], norm, angle), 0, 0, 0, ITEM_TEXTSTYLE_SHADOWED, qfalse); dif[0], dif[1], norm, angle), 0, 0, 0, ITEM_TEXTSTYLE_SHADOWED, qfalse);
if (norm) if (norm)
@ -1499,9 +1513,9 @@ void _UI_Refresh(int realtime)
} else { } else {
s = va("(%i, %i)", uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory); s = va("(%i, %i)", uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory);
} }
Text_Paint(20, 20, 0.225f, colorCyan, s, 0, 0, 0, ITEM_TEXTSTYLE_SHADOWED, qfalse); Text_Paint(20, 12, 0.225f, colorCyan, s, 0, 0, 0, ITEM_TEXTSTYLE_SHADOWED, qfalse);
} }
Text_Paint(20, 40, 0.225f, colorCyan, va("%i fps", uiInfo.uiDC.smoothFPS), 0, 0, 0, Text_Paint(20, 32, 0.225f, colorCyan, va("%i fps", uiInfo.uiDC.smoothFPS), 0, 0, 0,
ITEM_TEXTSTYLE_SHADOWED, qfalse); ITEM_TEXTSTYLE_SHADOWED, qfalse);
} }
//any left-overs? //any left-overs?
@ -1616,7 +1630,7 @@ qboolean Asset_Parse(int handle)
return qfalse; return qfalse;
} }
while (1) { INFINITE_LOOP {
memset(&token, 0, sizeof(pc_token_t)); memset(&token, 0, sizeof(pc_token_t));
@ -1707,6 +1721,14 @@ qboolean Asset_Parse(int handle)
continue; continue;
} }
//Makro - this allows us to have more than one UI
if (Q_stricmp(token.string, "assetsPath") == 0) {
if (!PC_String_Parse(handle, &uiInfo.uiDC.Assets.assetsPath)) {
return qfalse;
}
continue;
}
//Makro - key bind status 1 //Makro - key bind status 1
if (Q_stricmp(token.string, "keyBindStatus1") == 0) { if (Q_stricmp(token.string, "keyBindStatus1") == 0) {
if (!PC_String_Parse(handle, &uiInfo.keyBindStatus1)) { if (!PC_String_Parse(handle, &uiInfo.keyBindStatus1)) {
@ -1793,7 +1815,8 @@ qboolean Asset_Parse(int handle)
} }
return qfalse; //Makro - unreachable
//return qfalse;
} }
void Font_Report() void Font_Report()
@ -1826,7 +1849,7 @@ void UI_ParseMenu(const char *menuFile)
return; return;
} }
while (1) { INFINITE_LOOP {
memset(&token, 0, sizeof(pc_token_t)); memset(&token, 0, sizeof(pc_token_t));
if (!trap_PC_ReadToken(handle, &token)) { if (!trap_PC_ReadToken(handle, &token)) {
break; break;
@ -1871,7 +1894,7 @@ qboolean Load_Menu(int handle)
return qfalse; return qfalse;
} }
while (1) { INFINITE_LOOP {
if (!trap_PC_ReadToken(handle, &token)) if (!trap_PC_ReadToken(handle, &token))
return qfalse; return qfalse;
@ -1886,7 +1909,8 @@ qboolean Load_Menu(int handle)
UI_ParseMenu(token.string); UI_ParseMenu(token.string);
} }
return qfalse; //Makro - unreachable
//return qfalse;
} }
void UI_LoadMenus(const char *menuFile, qboolean reset) void UI_LoadMenus(const char *menuFile, qboolean reset)
@ -1914,7 +1938,7 @@ void UI_LoadMenus(const char *menuFile, qboolean reset)
Menu_Reset(); Menu_Reset();
} }
while (1) { INFINITE_LOOP {
if (!trap_PC_ReadToken(handle, &token)) if (!trap_PC_ReadToken(handle, &token))
break; break;
if (token.string[0] == 0 || token.string[0] == '}') { if (token.string[0] == 0 || token.string[0] == '}') {
@ -3578,53 +3602,54 @@ static void UI_DrawKeyBindStatus(itemDef_t *item, rectDef_t * rect, float scale,
} }
} }
//Makro - rewrote this function - added more info and support for vectors; moved extensions to FEEDER_GLDRIVER_INFO
#define GLINFO_STRING1 va("RENDERER: %s / %s", uiInfo.uiDC.glconfig.renderer_string, uiInfo.uiDC.glconfig.vendor_string)
#define GLINFO_STRING2 va("VERSION: %s", uiInfo.uiDC.glconfig.version_string)
#define GLINFO_STRING3 va("PIXELFORMAT: color(%d) Z(%d) stencil(%d); REFRESH: %d Hz", uiInfo.uiDC.glconfig.colorBits,\
uiInfo.uiDC.glconfig.depthBits, uiInfo.uiDC.glconfig.stencilBits, uiInfo.uiDC.glconfig.displayFrequency)
#define GLINFO_STRING4 va("TEX: %d units, %d x %d max%s%s", uiInfo.uiDC.glconfig.maxActiveTextures,\
uiInfo.uiDC.glconfig.maxTextureSize, uiInfo.uiDC.glconfig.maxTextureSize,\
(uiInfo.uiDC.glconfig.textureCompression == TC_NONE) ? "" : ", compressed", uiInfo.uiDC.glconfig.smpActive ? "; SMP: on" : "")
static void UI_DrawGLInfo(rectDef_t * rect, float scale, vec4_t color, int textStyle) static void UI_DrawGLInfo(rectDef_t * rect, float scale, vec4_t color, int textStyle)
{ {
char *eptr; float p[2];
char buff[1024]; float u[2] = {1, 0};
const char *lines[64]; float v[2] = {0, 1};
int y, numLines, i;
//Makro - changed from 30 to 48; changed pixelformat display from (x-bits) to (x) Vector2Set(p, rect->x, rect->y);
Text_Paint(rect->x + 2, rect->y, scale, color, va("VENDOR: %s", uiInfo.uiDC.glconfig.vendor_string), 0, 48, 0,
textStyle, qfalse);
Text_Paint(rect->x + 2, rect->y + 15, scale, color,
va("VERSION: %s: %s", uiInfo.uiDC.glconfig.version_string, uiInfo.uiDC.glconfig.renderer_string), 0,
48, 0, textStyle, qfalse);
Text_Paint(rect->x + 2, rect->y + 30, scale, color,
va("PIXELFORMAT: color(%d) Z(%d) stencil(%d)", uiInfo.uiDC.glconfig.colorBits,
uiInfo.uiDC.glconfig.depthBits, uiInfo.uiDC.glconfig.stencilBits), 0, 48, 0, textStyle, qfalse);
// build null terminated extension strings //Makro - vectors?
Q_strncpyz(buff, uiInfo.uiDC.glconfig.extensions_string, 1024); if (rect->hasVectors)
eptr = buff; {
y = rect->y + 45; Vector2Copy(rect->u, u);
numLines = 0; Vector2Copy(rect->v, v);
while (y < rect->y + rect->h && *eptr) {
while (*eptr && *eptr == ' ')
*eptr++ = '\0';
// track start of valid string
if (*eptr && *eptr != ' ') {
lines[numLines++] = eptr;
} }
while (*eptr && *eptr != ' ') //Makro - rewrote this code
eptr++; if (rect->hasVectors)
} {
#define GLINFO_OUTPUT_STRING_ANGLED(str)\
Text_PaintAngled(p[0], p[1], u, v, scale, color, str, 0, 0, rect->w, textStyle, qfalse);\
Vector2MA(p, 64 * scale, v, p)
i = 0; GLINFO_OUTPUT_STRING_ANGLED(GLINFO_STRING1);
while (i < numLines) { GLINFO_OUTPUT_STRING_ANGLED(GLINFO_STRING2);
Text_Paint(rect->x + 2, y, scale, color, lines[i++], 0, 20, 0, textStyle, qfalse); GLINFO_OUTPUT_STRING_ANGLED(GLINFO_STRING3);
if (i < numLines) { GLINFO_OUTPUT_STRING_ANGLED(GLINFO_STRING4);
Text_Paint(rect->x + rect->w / 2, y, scale, color, lines[i++], 0, 20, 0, textStyle, qfalse);
}
y += 10;
if (y > rect->y + rect->h - 11) {
break;
}
} }
else
{
#define GLINFO_OUTPUT_STRING(str)\
Text_Paint(p[0], p[1], scale, color, str, 0, 0, rect->w, textStyle, qfalse);\
Vector2MA(p, 64 * scale, v, p)
GLINFO_OUTPUT_STRING(GLINFO_STRING1);
GLINFO_OUTPUT_STRING(GLINFO_STRING2);
GLINFO_OUTPUT_STRING(GLINFO_STRING3);
GLINFO_OUTPUT_STRING(GLINFO_STRING4);
}
} }
//Makro - startup menu text //Makro - startup menu text
@ -5844,15 +5869,13 @@ static void UI_RunMenuScript(char **args)
trap_Cvar_Set("ui_singlePlayerActive", "0"); trap_Cvar_Set("ui_singlePlayerActive", "0");
//Makro - see if we have to restore the music volume //Makro - see if we have to restore the music volume
if (uiInfo.savedMusicVol) { if (uiInfo.savedMusicVol) {
trap_Cmd_ExecuteText(EXEC_APPEND, trap_Cmd_ExecuteText(EXEC_APPEND, va("set s_musicvolume %f ; wait\n", uiInfo.oldMusicVol));
va("set s_musicvolume %f ; wait\n", uiInfo.oldMusicVol));
} }
//trap_Cmd_ExecuteText( EXEC_NOW, "quit"); //trap_Cmd_ExecuteText( EXEC_NOW, "quit");
//Makro - maybe a wait command will make the music volume get saved before exiting //Makro - saved config file before exiting
trap_Cmd_ExecuteText(EXEC_APPEND, "wait ; quit\n"); trap_Cmd_ExecuteText(EXEC_APPEND, "writeconfig q3config.cfg ; quit\n");
//Makro - weapon menu after joining a team //Makro - weapon menu after joining a team
} else if (Q_stricmp(name, "weapAfterJoin") == 0) } else if (Q_stricmp(name, "weapAfterJoin") == 0) {
{
//only in teamplay //only in teamplay
if (UI_RQ3_WeaponMenuAccess()) if (UI_RQ3_WeaponMenuAccess())
{ {
@ -6882,6 +6905,9 @@ static int UI_FeederCount(float feederID)
//Makro - model replacements //Makro - model replacements
} else if (feederID == FEEDER_REPLACEMENTS) { } else if (feederID == FEEDER_REPLACEMENTS) {
return uiInfo.replacements.Count; return uiInfo.replacements.Count;
//Makro - gl driver extensions
} else if (feederID == FEEDER_GLDRIVER_INFO) {
return uiInfo.uiDC.numGlExtensions;
} }
return 0; return 0;
} }
@ -7094,6 +7120,9 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan
return uiInfo.ingameServerInfo[index][column]; return uiInfo.ingameServerInfo[index][column];
} }
} }
} else if (feederID == FEEDER_GLDRIVER_INFO) {
if (index >= 0 && index < uiInfo.uiDC.numGlExtensions)
return uiInfo.uiDC.glExtensions[index];
/* /*
//Makro - model replacements //Makro - model replacements
} else if (feederID == FEEDER_REPLACEMENTS) { } else if (feederID == FEEDER_REPLACEMENTS) {
@ -7259,7 +7288,7 @@ static qboolean Team_Parse(char **p)
return qfalse; return qfalse;
} }
while (1) { INFINITE_LOOP {
token = COM_ParseExt(p, qtrue); token = COM_ParseExt(p, qtrue);
@ -7308,7 +7337,8 @@ static qboolean Team_Parse(char **p)
} }
} }
return qfalse; //Makro - unreachable
//return qfalse;
} }
static qboolean Character_Parse(char **p) static qboolean Character_Parse(char **p)
@ -7322,7 +7352,7 @@ static qboolean Character_Parse(char **p)
return qfalse; return qfalse;
} }
while (1) { INFINITE_LOOP {
token = COM_ParseExt(p, qtrue); token = COM_ParseExt(p, qtrue);
if (Q_stricmp(token, "}") == 0) { if (Q_stricmp(token, "}") == 0) {
@ -7369,7 +7399,8 @@ static qboolean Character_Parse(char **p)
} }
} }
return qfalse; //Makro - unreachable
//return qfalse;
} }
static qboolean Alias_Parse(char **p) static qboolean Alias_Parse(char **p)
@ -7382,7 +7413,7 @@ static qboolean Alias_Parse(char **p)
return qfalse; return qfalse;
} }
while (1) { INFINITE_LOOP {
token = COM_ParseExt(p, qtrue); token = COM_ParseExt(p, qtrue);
if (Q_stricmp(token, "}") == 0) { if (Q_stricmp(token, "}") == 0) {
@ -7416,7 +7447,8 @@ static qboolean Alias_Parse(char **p)
} }
} }
return qfalse; //Makro - unreachable
//return qfalse;
} }
// mode // mode
@ -7438,7 +7470,7 @@ static void UI_ParseTeamInfo(const char *teamFile)
p = buff; p = buff;
while (1) { INFINITE_LOOP {
token = COM_ParseExt(&p, qtrue); token = COM_ParseExt(&p, qtrue);
if (!token || token[0] == 0 || token[0] == '}') { if (!token || token[0] == 0 || token[0] == '}') {
break; break;
@ -7494,7 +7526,7 @@ joingametypes {
uiInfo.numGameTypes = 0; uiInfo.numGameTypes = 0;
} }
while (1) { INFINITE_LOOP {
token = COM_ParseExt(p, qtrue); token = COM_ParseExt(p, qtrue);
if (Q_stricmp(token, "}") == 0) { if (Q_stricmp(token, "}") == 0) {
@ -7542,7 +7574,8 @@ joingametypes {
} }
} }
} }
return qfalse; //Makro - unreachable
//return qfalse;
} }
static qboolean MapList_Parse(char **p) static qboolean MapList_Parse(char **p)
@ -7557,7 +7590,7 @@ static qboolean MapList_Parse(char **p)
uiInfo.mapCount = 0; uiInfo.mapCount = 0;
while (1) { INFINITE_LOOP {
token = COM_ParseExt(p, qtrue); token = COM_ParseExt(p, qtrue);
if (Q_stricmp(token, "}") == 0) { if (Q_stricmp(token, "}") == 0) {
@ -7581,7 +7614,7 @@ static qboolean MapList_Parse(char **p)
uiInfo.mapList[uiInfo.mapCount].typeBits = 0; uiInfo.mapList[uiInfo.mapCount].typeBits = 0;
while (1) { INFINITE_LOOP {
token = COM_ParseExt(p, qtrue); token = COM_ParseExt(p, qtrue);
if (token[0] >= '0' && token[0] <= '9') { if (token[0] >= '0' && token[0] <= '9') {
uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << (token[0] - 0x030)); uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << (token[0] - 0x030));
@ -7611,7 +7644,8 @@ static qboolean MapList_Parse(char **p)
} }
} }
} }
return qfalse; //Makro - unreachable
//return qfalse;
} }
static void UI_ParseGameInfo(const char *teamFile) static void UI_ParseGameInfo(const char *teamFile)
@ -7629,7 +7663,7 @@ static void UI_ParseGameInfo(const char *teamFile)
p = buff; p = buff;
while (1) { INFINITE_LOOP {
token = COM_ParseExt(&p, qtrue); token = COM_ParseExt(&p, qtrue);
if (!token || token[0] == 0 || token[0] == '}') { if (!token || token[0] == 0 || token[0] == '}') {
break; break;
@ -7879,6 +7913,34 @@ void UI_DrawPolyStretchPic(float x, float y, float w, float h, float s1, float t
trap_R_DrawStretchPic(x, y, w, h, s1, t1, s2, t2, hShader); trap_R_DrawStretchPic(x, y, w, h, s1, t1, s2, t2, hShader);
} }
static void UI_MakeExtensionsList()
{
char *eptr;
uiInfo.uiDC.numGlExtensions = 0;
// build null terminated extension strings
eptr = uiInfo.uiDC.glconfig.extensions_string;
while (*eptr && uiInfo.uiDC.numGlExtensions < MAX_NUM_GL_EXTENSIONS)
{
// skip whitespace
while (*eptr && *eptr == ' ')
*eptr++ = '\0';
// track start of valid string
if (*eptr && *eptr != ' ')
uiInfo.uiDC.glExtensions[uiInfo.uiDC.numGlExtensions++] = eptr;
while (*eptr && *eptr != ' ')
eptr++;
// end token
if (*eptr)
*eptr++ = '\0';
}
}
/* /*
================= =================
@ -7892,6 +7954,7 @@ void _UI_Init(qboolean inGameLoad)
char info[MAX_INFO_STRING]; char info[MAX_INFO_STRING];
// //
int start; int start;
qboolean needRestart = qfalse;
//uiInfo.inGameLoad = inGameLoad; //uiInfo.inGameLoad = inGameLoad;
@ -7902,10 +7965,23 @@ void _UI_Init(qboolean inGameLoad)
// cache redundant calulations // cache redundant calulations
trap_GetGlconfig(&uiInfo.uiDC.glconfig); trap_GetGlconfig(&uiInfo.uiDC.glconfig);
UI_MakeExtensionsList();
//Makro - 8192 polys should be enough for the new UI... //Makro - 8192 polys should be enough for the new UI...
if (ui_maxpolys.integer < 8192) if (ui_maxpolys.integer < 8192)
{ {
trap_Cvar_SetValue("r_maxpolys", 8192); trap_Cvar_SetValue("r_maxpolys", 8192);
needRestart = qtrue;
}
//Makro - 32768 poly verts should be enough for the new UI...
if (ui_maxpolyverts.integer < 32768)
{
trap_Cvar_SetValue("r_maxpolyverts", 32768);
needRestart = qtrue;
}
if (needRestart)
{
trap_Cmd_ExecuteText(EXEC_INSERT, "vid_restart"); trap_Cmd_ExecuteText(EXEC_INSERT, "vid_restart");
} }
@ -8082,10 +8158,10 @@ void _UI_Init(qboolean inGameLoad)
uiInfo.serverStatus.currentServerCinematic = -1; uiInfo.serverStatus.currentServerCinematic = -1;
uiInfo.previewMovie = -1; uiInfo.previewMovie = -1;
if (trap_Cvar_VariableValue("ui_TeamArenaFirstRun") == 0) { if (trap_Cvar_VariableValue("ui_reaction33FirstRun") == 0) {
trap_Cvar_Set("s_volume", "0.8"); trap_Cvar_Set("s_volume", "0.8");
trap_Cvar_Set("s_musicvolume", "0.5"); trap_Cvar_Set("s_musicvolume", "0.5");
trap_Cvar_Set("ui_TeamArenaFirstRun", "1"); trap_Cvar_Set("ui_reaction33FirstRun", "1");
} }
trap_Cvar_Register(NULL, "debug_protocol", "", 0); trap_Cvar_Register(NULL, "debug_protocol", "", 0);
@ -8175,7 +8251,7 @@ void _UI_MouseEvent(int dx, int dy)
if (Menu_Count() > 0) { if (Menu_Count() > 0) {
//menuDef_t *menu = Menu_GetFocused(); //menuDef_t *menu = Menu_GetFocused();
//Menu_HandleMouseMove(menu, uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory); //Menu_HandleMouseMove(menu, uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory);
Display_MouseMove(NULL, uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory); Display_MouseMove(g_anchoredMenu, uiInfo.uiDC.cursorx, uiInfo.uiDC.cursory);
} }
//Makro - update the time //Makro - update the time
@ -8366,7 +8442,7 @@ void Text_PaintCenter_AutoWrapped(float x, float y, float xmax, float ystep, flo
Q_strncpyz(buf, str, sizeof(buf)); Q_strncpyz(buf, str, sizeof(buf));
s1 = s2 = s3 = buf; s1 = s2 = s3 = buf;
while (1) { INFINITE_LOOP {
do { do {
s3++; s3++;
} while (*s3 != ' ' && *s3 != '\0'); } while (*s3 != ' ' && *s3 != '\0');
@ -8736,6 +8812,7 @@ vmCvar_t ui_RQ3_joinPort;
vmCvar_t ui_RQ3_demoName; vmCvar_t ui_RQ3_demoName;
//Makro - maxpolys hack //Makro - maxpolys hack
vmCvar_t ui_maxpolys; vmCvar_t ui_maxpolys;
vmCvar_t ui_maxpolyverts;
//Makro - matchmode settings //Makro - matchmode settings
vmCvar_t ui_RQ3_timelimit; vmCvar_t ui_RQ3_timelimit;
vmCvar_t ui_RQ3_roundlimit; vmCvar_t ui_RQ3_roundlimit;
@ -8785,6 +8862,8 @@ vmCvar_t ui_RQ3_radioPreset9Script;
vmCvar_t ui_RQ3_radioPreset10Desc; vmCvar_t ui_RQ3_radioPreset10Desc;
vmCvar_t ui_RQ3_radioPreset10Script; vmCvar_t ui_RQ3_radioPreset10Script;
//Makro - player gender; irrelevant for now
vmCvar_t ui_RQ3_gender;
// bk001129 - made static to avoid aliasing // bk001129 - made static to avoid aliasing
@ -8907,7 +8986,7 @@ static cvarTable_t cvarTable[] = {
{&ui_Q3Model, "ui_q3model", "1", CVAR_ARCHIVE | CVAR_ROM}, {&ui_Q3Model, "ui_q3model", "1", CVAR_ARCHIVE | CVAR_ROM},
{&ui_hudFiles, "cg_hudFiles", "ui/hud.txt", CVAR_ARCHIVE}, {&ui_hudFiles, "cg_hudFiles", "ui/hud.txt", CVAR_ARCHIVE},
{&ui_recordSPDemo, "ui_recordSPDemo", "0", CVAR_ARCHIVE}, {&ui_recordSPDemo, "ui_recordSPDemo", "0", CVAR_ARCHIVE},
{&ui_teamArenaFirstRun, "ui_teamArenaFirstRun", "0", CVAR_ARCHIVE}, {&ui_reaction33FirstRun, "ui_reaction33FirstRun", "0", CVAR_ARCHIVE | CVAR_ROM},
{&ui_realWarmUp, "g_warmup", "20", CVAR_ARCHIVE}, {&ui_realWarmUp, "g_warmup", "20", CVAR_ARCHIVE},
{&ui_realCaptureLimit, "capturelimit", "8", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART}, {&ui_realCaptureLimit, "capturelimit", "8", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART},
{&ui_serverStatusTimeOut, "ui_serverStatusTimeOut", "7000", CVAR_ARCHIVE}, {&ui_serverStatusTimeOut, "ui_serverStatusTimeOut", "7000", CVAR_ARCHIVE},
@ -8931,6 +9010,7 @@ static cvarTable_t cvarTable[] = {
{&ui_RQ3_demoName, "ui_RQ3_demoName", "", 0}, {&ui_RQ3_demoName, "ui_RQ3_demoName", "", 0},
//Makro - maxpolys hack //Makro - maxpolys hack
{&ui_maxpolys, "r_maxpolys", "4096", CVAR_ARCHIVE}, {&ui_maxpolys, "r_maxpolys", "4096", CVAR_ARCHIVE},
{&ui_maxpolyverts, "r_maxpolyverts", "16384", CVAR_ARCHIVE},
//Makro - matchmode settings //Makro - matchmode settings
{&ui_RQ3_timelimit, "ui_RQ3_timelimit", "0", 0}, {&ui_RQ3_timelimit, "ui_RQ3_timelimit", "0", 0},
{&ui_RQ3_roundlimit, "ui_RQ3_roundlimit", "0", 0}, {&ui_RQ3_roundlimit, "ui_RQ3_roundlimit", "0", 0},
@ -8978,7 +9058,9 @@ static cvarTable_t cvarTable[] = {
{&ui_RQ3_radioPreset9Script, "ui_RQ3_radioPreset9Script", "say_team Right; radio right", CVAR_ARCHIVE}, {&ui_RQ3_radioPreset9Script, "ui_RQ3_radioPreset9Script", "say_team Right; radio right", CVAR_ARCHIVE},
//10 //10
{&ui_RQ3_radioPreset10Desc, "ui_RQ3_radioPreset10Desc", "", CVAR_ARCHIVE}, {&ui_RQ3_radioPreset10Desc, "ui_RQ3_radioPreset10Desc", "", CVAR_ARCHIVE},
{&ui_RQ3_radioPreset10Script, "ui_RQ3_radioPreset10Script", "", CVAR_ARCHIVE} {&ui_RQ3_radioPreset10Script, "ui_RQ3_radioPreset10Script", "", CVAR_ARCHIVE},
//Makro - player gender; irrelevant for now
{&ui_RQ3_gender, "ui_RQ3_gender", "0", CVAR_ARCHIVE}
}; };
// bk001129 - made static to avoid aliasing // bk001129 - made static to avoid aliasing

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.34 2006/04/14 18:02:06 makro
// no message
//
// Revision 1.33 2005/09/18 16:56:45 makro // Revision 1.33 2005/09/18 16:56:45 makro
// no message // no message
// //
@ -108,9 +111,10 @@
// string allocation/managment // string allocation/managment
#include "ui_shared.h" #include "ui_shared.h"
#include "../game/bg_public.h"
//Makro - to avoid a warning //Makro - avoid warnings
int UI_SelectedQ3Head(qboolean doUpdate); int UI_SelectedQ3Head(qboolean);
qboolean UI_NeedToUpdateModel(); qboolean UI_NeedToUpdateModel();
#define SCROLL_TIME_START 500 #define SCROLL_TIME_START 500
@ -160,6 +164,9 @@ int openMenuCount = 0;
//Makro - previous menu //Makro - previous menu
static menuDef_t *prevMenu = NULL; static menuDef_t *prevMenu = NULL;
//Makro - menu to be moved around
menuDef_t *g_anchoredMenu = NULL;
float g_anchorX = 0, g_anchorY = 0;
static qboolean debugMode = qfalse; static qboolean debugMode = qfalse;
@ -253,10 +260,13 @@ static int UI_RQ3_lastCheckForShortcuts = 0;
static int UI_RQ3_ShortcutCheckDelay = 50; static int UI_RQ3_ShortcutCheckDelay = 50;
//Makro - for shortcut keys //Makro - for shortcut keys
int UI_RQ3_KeyNumFromChar(const char *keystr) ID_INLINE int UI_RQ3_KeyNumFromChar(const char *keystr)
{ {
int i; int i;
if (!keystr || !*keystr)
return -1;
for (i = 0; RQ3_KeyAliases[i].Value != K_LAST_KEY; i++) { for (i = 0; RQ3_KeyAliases[i].Value != K_LAST_KEY; i++) {
//let's make sure we have valid strings //let's make sure we have valid strings
if (RQ3_KeyAliases[i].Name[0] && keystr && keystr[0]) { if (RQ3_KeyAliases[i].Name[0] && keystr && keystr[0]) {
@ -689,7 +699,7 @@ qboolean PC_Script_Parse(int handle, const char **out)
return qfalse; return qfalse;
} }
while (1) { INFINITE_LOOP {
if (!trap_PC_ReadToken(handle, &token)) if (!trap_PC_ReadToken(handle, &token))
return qfalse; return qfalse;
@ -705,7 +715,8 @@ qboolean PC_Script_Parse(int handle, const char **out)
} }
Q_strcat(script, 1024, " "); Q_strcat(script, 1024, " ");
} }
return qfalse; // bk001105 - LCC missing return value //Makro - unreachable
//return qfalse; // bk001105 - LCC missing return value
} }
// display, window, menu, item code // display, window, menu, item code
@ -780,7 +791,7 @@ void UI_RQ3_HandleFading(Window * w)
if ((w->timeFade.active)) { if ((w->timeFade.active)) {
if (DC->realTime > w->timeFade.endTime) { if (DC->realTime > w->timeFade.endTime) {
w->timeFade.active = qfalse; w->timeFade.active = qfalse;
if ((w->timeFade.colorType = FORECOLOR)) { if (FORECOLOR == w->timeFade.colorType) {
memcpy(w->foreColor, w->timeFade.color2, sizeof(vec4_t)); memcpy(w->foreColor, w->timeFade.color2, sizeof(vec4_t));
//autohide //autohide
if (w->foreColor[3] == 0) if (w->foreColor[3] == 0)
@ -887,6 +898,25 @@ void Window_Paint(Window * w, float fadeAmount, float fadeClamp, float fadeCycle
GradientBar_Paint(&fillRect, w->backColor); GradientBar_Paint(&fillRect, w->backColor);
// gradient bar // gradient bar
} else if (w->style == WINDOW_STYLE_SHADER) { } else if (w->style == WINDOW_STYLE_SHADER) {
float coords[4] = {0, 0, 1, 1};
// randomized texture co-ordinates?
if (w->flags & WINDOW_RANDOM_TCGEN)
{
coords[0] = (rand() % 45) / 90.0f;
coords[1] = (rand() % 45) / 90.0f;
coords[2] = coords[0] + 0.5f ;
coords[3] = coords[1] + 0.5f;
if (rand() % 2)
{
coords[0] = 1 - coords[0];
coords[2] = 1 - coords[2];
}
if (rand() % 2)
{
coords[1] = 1 - coords[1];
coords[3] = 1 - coords[3];
}
}
if (w->flags & WINDOW_FORECOLORSET) { if (w->flags & WINDOW_FORECOLORSET) {
DC->setColor(w->foreColor); DC->setColor(w->foreColor);
memcpy(&color[0], &w->foreColor[0], sizeof(color)); memcpy(&color[0], &w->foreColor[0], sizeof(color));
@ -894,9 +924,10 @@ void Window_Paint(Window * w, float fadeAmount, float fadeClamp, float fadeCycle
//Makro - angled? //Makro - angled?
if (w->rectClient.hasVectors) if (w->rectClient.hasVectors)
{ {
DC->drawAngledPic(fillRect.x, fillRect.y, fillRect.w, fillRect.h, w->rectClient.u, w->rectClient.v, w->foreColor, 0, 0, 1, 1, w->background); DC->drawAngledPic(fillRect.x, fillRect.y, fillRect.w, fillRect.h, w->rectClient.u, w->rectClient.v, w->foreColor, coords[0], coords[1], coords[2], coords[3], w->background);
} else { } else {
DC->drawHandlePic(fillRect.x, fillRect.y, fillRect.w, fillRect.h, w->background); //DC->drawHandlePic(fillRect.x, fillRect.y, fillRect.w, fillRect.h, w->background);
DC->drawStretchPic(fillRect.x, fillRect.y, fillRect.w, fillRect.h, coords[0], coords[1], coords[2], coords[3], w->background, qtrue);
} }
DC->setColor(NULL); DC->setColor(NULL);
} else if (w->style == WINDOW_STYLE_TEAMCOLOR) { } else if (w->style == WINDOW_STYLE_TEAMCOLOR) {
@ -1086,9 +1117,10 @@ itemDef_t *Menu_ClearFocus(menuDef_t * menu)
} }
for (i = 0; i < menu->itemCount; i++) { for (i = 0; i < menu->itemCount; i++) {
if (menu->items[i]->window.flags & WINDOW_HASFOCUS) { if (!(menu->items[i]->window.flags & WINDOW_HASFOCUS))
continue;
ret = menu->items[i]; ret = menu->items[i];
}
menu->items[i]->window.flags &= ~WINDOW_HASFOCUS; menu->items[i]->window.flags &= ~WINDOW_HASFOCUS;
if (menu->items[i]->leaveFocus) { if (menu->items[i]->leaveFocus) {
Item_RunScript(menu->items[i], menu->items[i]->leaveFocus); Item_RunScript(menu->items[i], menu->items[i]->leaveFocus);
@ -1116,19 +1148,41 @@ qboolean Rect_ContainsPoint(rectDef_t * rect, float x, float y)
return qfalse; return qfalse;
} }
/*
========================================
ItemMatchesString
Returns true if any of the tokens in the
name, group or subgroup fields of the given
items (param #1) matches any of the tokens
in the given string (param #2)
Added by Makro
========================================
*/
ID_INLINE qboolean ItemMatchesString(itemDef_t *item, const char *match)
{
if (!item || !match)
return qfalse;
return
(item->window.name && IdMatchesString(item->window.name, match)) ||
(item->window.group && IdMatchesString(item->window.group, match)) ||
(item->window.subgroup && IdMatchesString(item->window.subgroup, match));
}
int Menu_ItemsMatchingGroup(menuDef_t * menu, const char *name) int Menu_ItemsMatchingGroup(menuDef_t * menu, const char *name)
{ {
int i; int i;
int count = 0; int count = 0;
//Makro - added subgroup //Makro - added subgroup
for (i = 0; i < menu->itemCount; i++) { //10-14-2005 - new code
if (Q_stricmp(menu->items[i]->window.name, name) == 0 for (i = 0; i < menu->itemCount; i++)
|| (menu->items[i]->window.group && Q_stricmp(menu->items[i]->window.group, name) == 0) {
|| (menu->items[i]->window.subgroup && Q_stricmp(menu->items[i]->window.subgroup, name) == 0)) { if (ItemMatchesString(menu->items[i], name))
count++; count++;
} }
}
return count; return count;
} }
@ -1138,13 +1192,13 @@ itemDef_t *Menu_GetMatchingItemByNumber(menuDef_t * menu, int index, const char
int count = 0; int count = 0;
//Makro - added subgroup //Makro - added subgroup
for (i = 0; i < menu->itemCount; i++) { //10-14-2005 - new code
if (Q_stricmp(menu->items[i]->window.name, name) == 0 for (i = 0; i < menu->itemCount; i++)
|| (menu->items[i]->window.group && Q_stricmp(menu->items[i]->window.group, name) == 0) {
|| (menu->items[i]->window.subgroup && Q_stricmp(menu->items[i]->window.subgroup, name) == 0)) { if (ItemMatchesString(menu->items[i], name))
if (count == index) { {
if (count == index)
return menu->items[i]; return menu->items[i];
}
count++; count++;
} }
} }
@ -1157,20 +1211,21 @@ void Script_FadeOverlay(itemDef_t *item, char **args)
int offset, duration; int offset, duration;
float f; float f;
//color
for (offset=0; offset<4; offset++) for (offset=0; offset<4; offset++)
{ {
if (!Float_Parse(args, &f)) { if (!Float_Parse(args, &f))
return; return;
}
DC->overlayColor[offset] = DC->overlayColor2[offset]; DC->overlayColor[offset] = DC->overlayColor2[offset];
if (IsBetween(f, 0, 1)) { if (IsBetween(f, 0, 1))
DC->overlayColor2[offset] = f; DC->overlayColor2[offset] = f;
} }
}
//offset & duration //offset & duration
if (!Int_Parse(args, &offset) || !Int_Parse(args, &duration)) { if (!Int_Parse(args, &offset) || !Int_Parse(args, &duration))
return; return;
}
DC->overlayFadeStart = DC->realTime + offset; DC->overlayFadeStart = DC->realTime + offset;
DC->overlayFadeEnd = DC->overlayFadeStart + duration; DC->overlayFadeEnd = DC->overlayFadeStart + duration;
} }
@ -1182,13 +1237,12 @@ void Script_SetOverlayColor(itemDef_t *item, char **args)
for (i=0; i<4; i++) for (i=0; i<4; i++)
{ {
if (!Float_Parse(args, &f)) { if (!Float_Parse(args, &f))
return; return;
}
if (IsBetween(f, 0, 1)) { if (IsBetween(f, 0, 1))
DC->overlayColor2[i] = f; DC->overlayColor2[i] = f;
} }
}
DC->overlayFadeStart = DC->overlayFadeEnd = 0; DC->overlayFadeStart = DC->overlayFadeEnd = 0;
} }
@ -1308,8 +1362,10 @@ itemDef_t *Menu_FindItemByName(menuDef_t * menu, const char *p)
return NULL; return NULL;
} }
for (i = 0; i < menu->itemCount; i++) { for (i = 0; i < menu->itemCount; i++)
if (Q_stricmp(p, menu->items[i]->window.name) == 0) { {
//Makro - replaced Q_stricmp
if (ItemMatchesString(menu->items[i], p)) {
return menu->items[i]; return menu->items[i];
} }
} }
@ -1536,6 +1592,8 @@ void Menus_Close(menuDef_t *menu)
break; break;
} }
} }
if (g_anchoredMenu == menu)
g_anchoredMenu = NULL;
Menu_RunCloseScript(menu); Menu_RunCloseScript(menu);
menu->window.flags &= ~(WINDOW_HASFOCUS | WINDOW_VISIBLE); menu->window.flags &= ~(WINDOW_HASFOCUS | WINDOW_VISIBLE);
} }
@ -1631,13 +1689,14 @@ void Menu_TimeFadeItemByName(menuDef_t * menu, const char *name, vec4_t endColor
int i; int i;
//if (offset+duration > 0) { //if (offset+duration > 0) {
for (i = 0; i < menu->itemCount; i++) {
if (!Q_stricmp(menu->items[i]->window.name, name) //Makro - added subgroup
|| !Q_stricmp(menu->items[i]->window.group, name) //10-14-2005 - new code
|| !Q_stricmp(menu->items[i]->window.subgroup, name)) { for (i = 0; i < menu->itemCount; i++)
{
if (ItemMatchesString(menu->items[i], name))
UI_RQ3_TimeFadeItem(menu->items[i], endColor, offset, duration, colorType); UI_RQ3_TimeFadeItem(menu->items[i], endColor, offset, duration, colorType);
} }
}
//} //}
} }
} }
@ -1855,6 +1914,8 @@ void Script_Orbit(itemDef_t * item, char **args)
} }
} }
qboolean Item_SetFocus(itemDef_t * item, float x, float y, qboolean forced);
void Script_SetFocus(itemDef_t * item, char **args) void Script_SetFocus(itemDef_t * item, char **args)
{ {
const char *name; const char *name;
@ -1862,24 +1923,9 @@ void Script_SetFocus(itemDef_t * item, char **args)
if (String_Parse(args, &name)) { if (String_Parse(args, &name)) {
focusItem = Menu_FindItemByName(item->parent, name); focusItem = Menu_FindItemByName(item->parent, name);
if (focusItem && !(focusItem->window.flags & WINDOW_DECORATION) //Makro - removed focus/decoration checks - they're done in Item_SetFocus anyway
&& !(focusItem->window.flags & WINDOW_HASFOCUS)) { if (focusItem)
//Makro - added Item_SetFocus(focusItem, 0, 0, qtrue);
menuDef_t *menu = (menuDef_t *) item->parent;
Menu_ClearFocus(item->parent);
focusItem->window.flags |= WINDOW_HASFOCUS;
//Makro - cursorItem was not set
menu->cursorItem = focusItem - menu->items[0];
if (focusItem->onFocus) {
Item_RunScript(focusItem, focusItem->onFocus);
}
if (DC->Assets.itemFocusSound) {
DC->startLocalSound(DC->Assets.itemFocusSound, CHAN_LOCAL_SOUND);
}
}
} }
} }
@ -2067,7 +2113,7 @@ void Item_RunScript(itemDef_t * item, const char *s)
if (item && s && s[0]) { if (item && s && s[0]) {
Q_strcat(script, 1024, s); Q_strcat(script, 1024, s);
p = script; p = script;
while (1) { INFINITE_LOOP {
const char *command; const char *command;
// expect command then arguments, ; ends command, NULL ends script // expect command then arguments, ; ends command, NULL ends script
@ -2107,7 +2153,7 @@ qboolean Item_EnableShowViaCvar(itemDef_t * item, int flag)
Q_strcat(script, 1024, item->enableCvar); Q_strcat(script, 1024, item->enableCvar);
p = script; p = script;
while (1) { INFINITE_LOOP {
const char *val; const char *val;
// expect value then ; or NULL, NULL ends list // expect value then ; or NULL, NULL ends list
@ -2131,13 +2177,14 @@ qboolean Item_EnableShowViaCvar(itemDef_t * item, int flag)
} }
} }
return (item->cvarFlags & flag) ? qfalse : qtrue; //Makro - unreachable
//return (item->cvarFlags & flag) ? qfalse : qtrue;
} }
return qtrue; return qtrue;
} }
// will optionaly set focus to this item // will optionaly set focus to this item
qboolean Item_SetFocus(itemDef_t * item, float x, float y) qboolean Item_SetFocus(itemDef_t * item, float x, float y, qboolean forced)
{ {
int i; int i;
itemDef_t *oldFocus; itemDef_t *oldFocus;
@ -2146,10 +2193,14 @@ qboolean Item_SetFocus(itemDef_t * item, float x, float y)
menuDef_t *parent; // bk001206: = (menuDef_t*)item->parent; menuDef_t *parent; // bk001206: = (menuDef_t*)item->parent;
// sanity check, non-null, not a decoration and does not already have the focus // sanity check, non-null, not a decoration and does not already have the focus
if (item == NULL || item->window.flags & WINDOW_DECORATION || item->window.flags & WINDOW_HASFOCUS if (item == NULL || item->window.flags & WINDOW_DECORATION || !(item->window.flags & WINDOW_VISIBLE)) {
|| !(item->window.flags & WINDOW_VISIBLE)) {
return qfalse; return qfalse;
} }
//Makro - only check focus if not forced
if (!forced && item->window.flags & WINDOW_HASFOCUS)
return qfalse;
// bk001206 - this can be NULL. // bk001206 - this can be NULL.
parent = (menuDef_t *) item->parent; parent = (menuDef_t *) item->parent;
@ -2164,7 +2215,7 @@ qboolean Item_SetFocus(itemDef_t * item, float x, float y)
oldFocus = Menu_ClearFocus(item->parent); oldFocus = Menu_ClearFocus(item->parent);
if (item->type == ITEM_TYPE_TEXT) { if (item->type == ITEM_TYPE_TEXT && !forced) {
rectDef_t r; rectDef_t r;
r = item->textRect; r = item->textRect;
@ -2741,10 +2792,12 @@ qboolean Item_ListBox_HandleKey(itemDef_t * item, int key, qboolean down, qboole
listBoxDef_t *listPtr = (listBoxDef_t *) item->typeData; listBoxDef_t *listPtr = (listBoxDef_t *) item->typeData;
int count = DC->feederCount(item->special); int count = DC->feederCount(item->special);
int max, viewmax; int max, viewmax;
int ok = force || Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) ||
(!UI_IsMouse(key) && item->window.flags & WINDOW_HASFOCUS);
if (!ok)
return qfalse;
if (force
|| (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)
&& item->window.flags & WINDOW_HASFOCUS)) {
max = Item_ListBox_MaxScroll(item); max = Item_ListBox_MaxScroll(item);
//horizontal //horizontal
if (item->window.flags & WINDOW_HORIZONTAL) { if (item->window.flags & WINDOW_HORIZONTAL) {
@ -2940,7 +2993,6 @@ qboolean Item_ListBox_HandleKey(itemDef_t * item, int key, qboolean down, qboole
} }
return qtrue; return qtrue;
} }
}
return qfalse; return qfalse;
} }
@ -2956,7 +3008,8 @@ qboolean Item_YesNo_HandleKey(itemDef_t * item, int key)
ok = qtrue; ok = qtrue;
} }
} else { } else {
if (key == K_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW) { if (key == K_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW ||
key == K_MWHEELUP || key == K_MWHEELDOWN) {
ok = qtrue; ok = qtrue;
} }
} }
@ -3059,7 +3112,7 @@ qboolean Item_Multi_HandleKey(itemDef_t * item, int key)
} }
} else { } else {
if (key == K_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW || key == K_HOME if (key == K_ENTER || key == K_LEFTARROW || key == K_RIGHTARROW || key == K_HOME
|| key == K_END) { || key == K_END || key == K_MWHEELUP || key == K_MWHEELDOWN) {
ok = qtrue; ok = qtrue;
} }
} }
@ -3072,6 +3125,7 @@ qboolean Item_Multi_HandleKey(itemDef_t * item, int key)
switch (key) { switch (key) {
case K_LEFTARROW: case K_LEFTARROW:
case K_MWHEELDOWN:
case K_MOUSE2: case K_MOUSE2:
current = Item_Multi_FindCvarByValue(item) - 1; current = Item_Multi_FindCvarByValue(item) - 1;
break; break;
@ -3736,57 +3790,47 @@ void Item_Action(itemDef_t * item)
itemDef_t *Menu_SetPrevCursorItem(menuDef_t * menu) itemDef_t *Menu_SetPrevCursorItem(menuDef_t * menu)
{ {
qboolean wrapped = qfalse;
int oldCursor = menu->cursorItem; int oldCursor = menu->cursorItem;
int i;
if (menu->cursorItem < 0) { if (!menu || menu->itemCount <= 0)
menu->cursorItem = menu->itemCount - 1;
wrapped = qtrue;
}
while (menu->cursorItem > -1) {
menu->cursorItem--;
if (menu->cursorItem < 0 && !wrapped) {
wrapped = qtrue;
menu->cursorItem = menu->itemCount - 1;
}
if (Item_SetFocus(menu->items[menu->cursorItem], DC->cursorx, DC->cursory)) {
Menu_HandleMouseMove(menu, menu->items[menu->cursorItem]->window.rect.x + 1,
menu->items[menu->cursorItem]->window.rect.y + 1);
return menu->items[menu->cursorItem];
}
}
menu->cursorItem = oldCursor;
return NULL; return NULL;
if (menu->cursorItem > menu->itemCount || menu->cursorItem <= 0)
menu->cursorItem = menu->itemCount - 1;
else
menu->cursorItem--;
for (i=0; i<menu->itemCount; i++)
{
if (Item_SetFocus(menu->items[menu->cursorItem], 0, 0, qtrue))
return menu->items[menu->cursorItem];
menu->cursorItem = (menu->cursorItem == 0) ? menu->itemCount - 1 : menu->cursorItem - 1;
}
menu->cursorItem = oldCursor;
return NULL;
} }
itemDef_t *Menu_SetNextCursorItem(menuDef_t * menu) itemDef_t *Menu_SetNextCursorItem(menuDef_t * menu)
{ {
qboolean wrapped = qfalse;
int oldCursor = menu->cursorItem; int oldCursor = menu->cursorItem;
int i;
if (menu->cursorItem == -1) { if (!menu || menu->itemCount <= 0)
return NULL;
if (menu->cursorItem >= menu->itemCount || menu->cursorItem < 0)
menu->cursorItem = 0; menu->cursorItem = 0;
wrapped = qtrue; else
}
while (menu->cursorItem < menu->itemCount) {
menu->cursorItem++; menu->cursorItem++;
if (menu->cursorItem >= menu->itemCount && !wrapped) {
wrapped = qtrue;
menu->cursorItem = 0;
}
if (Item_SetFocus(menu->items[menu->cursorItem], DC->cursorx, DC->cursory)) {
Menu_HandleMouseMove(menu, menu->items[menu->cursorItem]->window.rect.x + 1,
menu->items[menu->cursorItem]->window.rect.y + 1);
return menu->items[menu->cursorItem];
}
for (i=0; i<menu->itemCount; i++)
{
if (Item_SetFocus(menu->items[menu->cursorItem], 0, 0, qtrue))
return menu->items[menu->cursorItem];
menu->cursorItem = (menu->cursorItem == menu->itemCount) ? 0 : menu->cursorItem + 1;
} }
menu->cursorItem = oldCursor; menu->cursorItem = oldCursor;
@ -4009,6 +4053,7 @@ void Menu_HandleKey(menuDef_t * menu, int key, qboolean down)
int i; int i;
itemDef_t *item = NULL; itemDef_t *item = NULL;
qboolean inHandler = qfalse; qboolean inHandler = qfalse;
static qboolean shiftPressed = qfalse;
//Makro - skip check for shortcut keys //Makro - skip check for shortcut keys
qboolean skipCheck = qfalse; qboolean skipCheck = qfalse;
@ -4017,6 +4062,10 @@ void Menu_HandleKey(menuDef_t * menu, int key, qboolean down)
return; return;
} }
//Makro - added
if (key == K_SHIFT)
shiftPressed = down;
inHandler = qtrue; inHandler = qtrue;
if (g_waitingForKey && down) { if (g_waitingForKey && down) {
Item_Bind_HandleKey(g_bindItem, key, down); Item_Bind_HandleKey(g_bindItem, key, down);
@ -4077,6 +4126,13 @@ void Menu_HandleKey(menuDef_t * menu, int key, qboolean down)
} }
} }
//Makro - menu anchor?
if (key == K_MOUSE1 && !down && g_anchoredMenu)
{
g_anchoredMenu = NULL;
return;
}
if (!down) { if (!down) {
inHandler = qfalse; inHandler = qfalse;
return; return;
@ -4095,6 +4151,7 @@ void Menu_HandleKey(menuDef_t * menu, int key, qboolean down)
return; return;
} }
} }
// default handling // default handling
switch (key) { switch (key) {
@ -4111,6 +4168,9 @@ void Menu_HandleKey(menuDef_t * menu, int key, qboolean down)
break; break;
case K_KP_UPARROW: case K_KP_UPARROW:
case K_UPARROW: case K_UPARROW:
if (shiftPressed)
Menu_SetNextCursorItem(menu);
else
Menu_SetPrevCursorItem(menu); Menu_SetPrevCursorItem(menu);
break; break;
@ -4125,6 +4185,9 @@ void Menu_HandleKey(menuDef_t * menu, int key, qboolean down)
case K_TAB: case K_TAB:
case K_KP_DOWNARROW: case K_KP_DOWNARROW:
case K_DOWNARROW: case K_DOWNARROW:
if (shiftPressed)
Menu_SetPrevCursorItem(menu);
else
Menu_SetNextCursorItem(menu); Menu_SetNextCursorItem(menu);
break; break;
@ -4134,6 +4197,7 @@ void Menu_HandleKey(menuDef_t * menu, int key, qboolean down)
if (item->type == ITEM_TYPE_TEXT) { if (item->type == ITEM_TYPE_TEXT) {
if (Rect_ContainsPoint(Item_CorrectedTextRect(item), DC->cursorx, DC->cursory)) { if (Rect_ContainsPoint(Item_CorrectedTextRect(item), DC->cursorx, DC->cursory)) {
Item_Action(item); Item_Action(item);
return;
} }
} else if (item->type == ITEM_TYPE_EDITFIELD || item->type == ITEM_TYPE_NUMERICFIELD) { } else if (item->type == ITEM_TYPE_EDITFIELD || item->type == ITEM_TYPE_NUMERICFIELD) {
if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) { if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) {
@ -4141,10 +4205,28 @@ void Menu_HandleKey(menuDef_t * menu, int key, qboolean down)
g_editingField = qtrue; g_editingField = qtrue;
g_editItem = item; g_editItem = item;
DC->setOverstrikeMode(qtrue); DC->setOverstrikeMode(qtrue);
return;
} }
} else { } else {
if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) { if (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory)) {
Item_Action(item); Item_Action(item);
return;
}
}
}
//Makro - menu anchor?
if (!g_anchoredMenu && key == K_MOUSE1)
{
for (i=0; i<menu->itemCount; i++)
{
itemDef_t *pItem = menu->items[i];
if (pItem && Rect_ContainsPoint(&pItem->window.rect, DC->cursorx, DC->cursory) &&
(pItem->window.flags & (WINDOW_MENU_ANCHOR|WINDOW_VISIBLE)) == (WINDOW_MENU_ANCHOR|WINDOW_VISIBLE))
{
g_anchoredMenu = menu;
g_anchorX = DC->cursorx;
g_anchorY = DC->cursory;
return;
} }
} }
} }
@ -4322,13 +4404,15 @@ void Item_TextColor(itemDef_t * item, vec4_t * newColor)
//lowLight[2] = 0.8 * parent->focusColor[2]; //lowLight[2] = 0.8 * parent->focusColor[2];
//lowLight[3] = 0.8 * parent->focusColor[3]; //lowLight[3] = 0.8 * parent->focusColor[3];
memcpy(lowLight, item->window.foreColor, sizeof(vec4_t)); memcpy(lowLight, item->window.foreColor, sizeof(vec4_t));
LerpColor(parent->focusColor, lowLight, *newColor, 0.5 + 0.5 * sin(DC->realTime / PULSE_DIVISOR)); LerpColor(parent->focusColor, lowLight, *newColor, 0.5 + 0.5 * sin(DC->realTime / (float)PULSE_DIVISOR));
//LerpColor(parent->focusColor, lowLight, *newColor, SawTooth(DC->realTime, PULSE_SAWTOOTH_PERIOD));
} else if (item->textStyle == ITEM_TEXTSTYLE_BLINK && !((DC->realTime / BLINK_DIVISOR) & 1)) { } else if (item->textStyle == ITEM_TEXTSTYLE_BLINK && !((DC->realTime / BLINK_DIVISOR) & 1)) {
lowLight[0] = 0.8 * item->window.foreColor[0]; lowLight[0] = 0.8 * item->window.foreColor[0];
lowLight[1] = 0.8 * item->window.foreColor[1]; lowLight[1] = 0.8 * item->window.foreColor[1];
lowLight[2] = 0.8 * item->window.foreColor[2]; lowLight[2] = 0.8 * item->window.foreColor[2];
lowLight[3] = 0.8 * item->window.foreColor[3]; lowLight[3] = 0.8 * item->window.foreColor[3];
LerpColor(item->window.foreColor, lowLight, *newColor, 0.5 + 0.5 * sin(DC->realTime / PULSE_DIVISOR)); LerpColor(item->window.foreColor, lowLight, *newColor, 0.5 + 0.5 * sin(DC->realTime / (float)PULSE_DIVISOR));
//LerpColor(item->window.foreColor, lowLight, *newColor, SawTooth(DC->realTime, PULSE_SAWTOOTH_PERIOD));
} else { } else {
memcpy(newColor, item->window.foreColor, sizeof(vec4_t)); memcpy(newColor, item->window.foreColor, sizeof(vec4_t));
// items can be enabled and disabled based on cvars // items can be enabled and disabled based on cvars
@ -4578,6 +4662,7 @@ void Item_TextField_Paint(itemDef_t * item)
char buff[1024]; char buff[1024];
vec4_t newColor, lowLight; vec4_t newColor, lowLight;
int offset; int offset;
float p[2];
menuDef_t *parent = (menuDef_t *) item->parent; menuDef_t *parent = (menuDef_t *) item->parent;
editFieldDef_t *editPtr = (editFieldDef_t *) item->typeData; editFieldDef_t *editPtr = (editFieldDef_t *) item->typeData;
//int maxChars = Text_maxPaintChars(buff+editPtr->paintOffset, item->textscale, item->window.rect.w+item->textalignx); //int maxChars = Text_maxPaintChars(buff+editPtr->paintOffset, item->textscale, item->window.rect.w+item->textalignx);
@ -4605,16 +4690,21 @@ void Item_TextField_Paint(itemDef_t * item)
} }
offset = (item->text && *item->text) ? 8 : 0; offset = (item->text && *item->text) ? 8 : 0;
Vector2Set(p, item->textRect.x, item->textRect.y);
if (item->window.rect.hasVectors)
Vector2MA(p, item->textRect.w + offset, item->window.rect.u, p);
else
p[0] += item->textRect.w + offset;
if (item->window.flags & WINDOW_HASFOCUS && g_editingField) { if (item->window.flags & WINDOW_HASFOCUS && g_editingField) {
char cursor = DC->getOverstrikeMode()? '_' : '|'; char cursor = DC->getOverstrikeMode()? '_' : '|';
if (item->window.rect.hasVectors) if (item->window.rect.hasVectors)
DC->drawAngledTextWithCursor(item->textRect.x + item->textRect.w + offset, item->textRect.y, DC->drawAngledTextWithCursor(p[0], p[1],
item->window.rect.u, item->window.rect.v, item->textscale, item->window.rect.u, item->window.rect.v, item->textscale,
newColor, buff + editPtr->paintOffset, item->cursorPos - editPtr->paintOffset, newColor, buff + editPtr->paintOffset, item->cursorPos - editPtr->paintOffset,
cursor, editPtr->maxPaintChars, item->textStyle); cursor, editPtr->maxPaintChars, item->textStyle);
else else
DC->drawTextWithCursor(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, DC->drawTextWithCursor(p[0], p[1], item->textscale,
newColor, buff + editPtr->paintOffset, item->cursorPos - editPtr->paintOffset, newColor, buff + editPtr->paintOffset, item->cursorPos - editPtr->paintOffset,
cursor, editPtr->maxPaintChars, item->textStyle); cursor, editPtr->maxPaintChars, item->textStyle);
/* /*
@ -4624,11 +4714,11 @@ void Item_TextField_Paint(itemDef_t * item)
*/ */
} else { } else {
if (item->window.rect.hasVectors) if (item->window.rect.hasVectors)
DC->drawAngledText(item->textRect.x + item->textRect.w + offset, item->textRect.y, DC->drawAngledText(p[0], p[1],
item->window.rect.u, item->window.rect.v, item->textscale, newColor, item->window.rect.u, item->window.rect.v, item->textscale, newColor,
buff + editPtr->paintOffset, 0, editPtr->maxPaintChars, 0, item->textStyle, qfalse); buff + editPtr->paintOffset, 0, editPtr->maxPaintChars, 0, item->textStyle, qfalse);
else else
DC->drawText(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, newColor, DC->drawText(p[0], p[1], item->textscale, newColor,
buff + editPtr->paintOffset, 0, editPtr->maxPaintChars, 0, item->textStyle, qfalse); buff + editPtr->paintOffset, 0, editPtr->maxPaintChars, 0, item->textStyle, qfalse);
/* /*
DC->drawText(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, newColor, DC->drawText(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, newColor,
@ -4664,7 +4754,9 @@ void Item_YesNo_Paint(itemDef_t * item)
//lowLight[2] = 0.8 * parent->focusColor[2]; //lowLight[2] = 0.8 * parent->focusColor[2];
//lowLight[3] = 0.8 * parent->focusColor[3]; //lowLight[3] = 0.8 * parent->focusColor[3];
memcpy(lowLight, &item->window.foreColor, sizeof(vec4_t)); memcpy(lowLight, &item->window.foreColor, sizeof(vec4_t));
LerpColor(parent->focusColor, lowLight, newColor, 0.5 + 0.5 * sin(DC->realTime / PULSE_DIVISOR)); //Com_Printf("FRAC: %.4f\n", sin((float)DC->realTime / PULSE_DIVISOR));
LerpColor(parent->focusColor, lowLight, newColor, 0.5 + 0.5 * sin((float)DC->realTime / PULSE_DIVISOR));
//LerpColor(parent->focusColor, lowLight, newColor, SawTooth(DC->realTime, 1000));
} else { } else {
memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t)); memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t));
} }
@ -4720,6 +4812,8 @@ void Item_YesNo_Paint(itemDef_t * item)
{ {
imgColor[3] = (float) (DC->realTime - data->lastChangeTime) / YESNO_MARK_FADETIME; imgColor[3] = (float) (DC->realTime - data->lastChangeTime) / YESNO_MARK_FADETIME;
} }
if (item->window.flags & WINDOW_FORECOLORSET)
imgColor[3] *= item->window.foreColor[3];
//compute drawing position //compute drawing position
if (data->kind == YESNO_ICON_LEFT) if (data->kind == YESNO_ICON_LEFT)
@ -4749,7 +4843,9 @@ void Item_YesNo_Paint(itemDef_t * item)
{ {
DC->drawAngledPic(p[0], p[1], SCROLLBAR_SIZE, SCROLLBAR_SIZE, item->window.rect.u, item->window.rect.v, DC->drawAngledPic(p[0], p[1], SCROLLBAR_SIZE, SCROLLBAR_SIZE, item->window.rect.u, item->window.rect.v,
imgColor, 0, 0, 1, 1, front); imgColor, 0, 0, 1, 1, front);
imgColor[3] = 1.0f - imgColor[3]; imgColor[3] = ((item->window.flags & WINDOW_FORECOLORSET) ? item->window.foreColor[3] : 1.0f) - imgColor[3];
if (item->window.flags & WINDOW_FORECOLORSET)
imgColor[3] *= item->window.foreColor[3];
DC->drawAngledPic(p[0], p[1], SCROLLBAR_SIZE, SCROLLBAR_SIZE, item->window.rect.u, item->window.rect.v, DC->drawAngledPic(p[0], p[1], SCROLLBAR_SIZE, SCROLLBAR_SIZE, item->window.rect.u, item->window.rect.v,
imgColor, 0, 0, 1, 1, back); imgColor, 0, 0, 1, 1, back);
} else { } else {
@ -4764,7 +4860,7 @@ void Item_Multi_Paint(itemDef_t * item)
vec4_t newColor, lowLight; vec4_t newColor, lowLight;
const char *text; const char *text;
menuDef_t *parent = (menuDef_t *) item->parent; menuDef_t *parent = (menuDef_t *) item->parent;
float x; float p[2];
if (item->window.flags & WINDOW_HASFOCUS) { if (item->window.flags & WINDOW_HASFOCUS) {
//Makro - changed to fade from normal text color to focus color //Makro - changed to fade from normal text color to focus color
@ -4783,20 +4879,27 @@ void Item_Multi_Paint(itemDef_t * item)
if (!text) if (!text)
text = ""; text = "";
x = item->textRect.x;
if (item->text) if (item->text)
{ {
Item_Text_Paint(item); Item_Text_Paint(item);
x += item->textRect.w + 8; Vector2Set(p, item->textRect.x, item->textRect.y);
//Makro - vectors?
if (item->window.rect.hasVectors)
Vector2MA(p, item->textRect.w + 8, item->textRect.u, p);
else
p[0] += item->textRect.w + 8;
} }
else
Vector2Set(p, item->textRect.x, item->textRect.y);
//Makro - vectors? //Makro - vectors?
if (item->window.rect.hasVectors) if (item->window.rect.hasVectors)
{ {
DC->drawAngledText(x, item->textRect.y, DC->drawAngledText(p[0], p[1],
item->window.rect.u, item->window.rect.v, item->textscale, newColor, text, item->window.rect.u, item->window.rect.v, item->textscale, newColor, text,
0, 0, 0, item->textStyle, qfalse); 0, 0, 0, item->textStyle, qfalse);
} else { } else {
DC->drawText(x, item->textRect.y, item->textscale, newColor, text, DC->drawText(p[0], p[1], item->textscale, newColor, text,
0, 0, 0, item->textStyle, qfalse); 0, 0, 0, item->textStyle, qfalse);
} }
} }
@ -5063,24 +5166,21 @@ void Item_Slider_Paint(itemDef_t * item)
vec4_t newColor; vec4_t newColor;
float x, y, value; float x, y, value;
menuDef_t *parent = (menuDef_t *) item->parent; menuDef_t *parent = (menuDef_t *) item->parent;
float frac;
editFieldDef_t *editDef = item->typeData;
Point pt; Point pt;
value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0; if (!editDef)
return;
if (item->window.flags & WINDOW_HASFOCUS) { value = (item->cvar) ? DC->getCVarValue(item->cvar) : 0;
//Makro - changed to fade from normal text color to focus color if (value > editDef->maxVal)
//lowLight[0] = 0.8 * parent->focusColor[0]; value = editDef->maxVal;
//lowLight[1] = 0.8 * parent->focusColor[1]; else if (value < editDef->minVal)
//lowLight[2] = 0.8 * parent->focusColor[2]; value = editDef->minVal;
//lowLight[3] = 0.8 * parent->focusColor[3]; frac = (editDef->maxVal > editDef->minVal) ? (value - editDef->minVal)/(editDef->maxVal - editDef->minVal) : 0;
//Makro - changed again, this time from focus color to white
LerpColor(colorWhite, parent->focusColor, newColor, 0.5 + 0.5 * sin(DC->realTime / PULSE_DIVISOR)); Item_TextColor(item, &newColor);
} else {
//Makro - slider should be painted in white when not focused
//this is so we can have visibile sliders with black text
//memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t));
memcpy(newColor, colorWhite, sizeof(vec4_t));
}
if (item->text) { if (item->text) {
Item_Text_Paint(item); Item_Text_Paint(item);
@ -5102,11 +5202,20 @@ void Item_Slider_Paint(itemDef_t * item)
if (item->textRect.hasVectors) if (item->textRect.hasVectors)
{ {
DC->drawAngledPic(x, y, SLIDER_WIDTH, SLIDER_HEIGHT, item->textRect.u, item->textRect.v, DC->drawAngledPic(x, y, SLIDER_WIDTH, SLIDER_HEIGHT, item->textRect.u, item->textRect.v,
colorWhite, 0, 0, 1, 1, DC->Assets.sliderBar); item->window.foreColor, 0, 0, 1, 1, DC->Assets.sliderBar0);
//paint the partial selection
if (frac > 0)
DC->drawAngledPic(x, y, SLIDER_WIDTH * frac, SLIDER_HEIGHT, item->textRect.u, item->textRect.v,
newColor, 0, 0, frac, 1, DC->Assets.sliderBar1);
} else { } else {
DC->setColor(colorWhite); DC->setColor(item->window.foreColor);
DC->drawHandlePic(x, y, SLIDER_WIDTH, SLIDER_HEIGHT, DC->Assets.sliderBar); DC->drawHandlePic(x, y, SLIDER_WIDTH, SLIDER_HEIGHT, DC->Assets.sliderBar0);
//paint the partial selection
DC->setColor(newColor);
if (frac > 0)
DC->drawStretchPic(x, y, SLIDER_WIDTH * frac, 0, 0, frac, 1, SLIDER_HEIGHT, DC->Assets.sliderBar1, qtrue);
} }
DC->setColor(NULL);
pt = Item_Slider_ThumbPosition(item); pt = Item_Slider_ThumbPosition(item);
//paint the thumb //paint the thumb
@ -5152,7 +5261,7 @@ void Item_Bind_Paint(itemDef_t * item)
//lowLight[3] = 0.8f * parent->focusColor[3]; //lowLight[3] = 0.8f * parent->focusColor[3];
memcpy(lowLight, &item->window.foreColor, sizeof(item->window.foreColor)); memcpy(lowLight, &item->window.foreColor, sizeof(item->window.foreColor));
} }
LerpColor(parent->focusColor, lowLight, newColor, 0.5 + 0.5 * sin(DC->realTime / PULSE_DIVISOR)); LerpColor(parent->focusColor, lowLight, newColor, 0.5 + 0.5 * sin(DC->realTime / (float)PULSE_DIVISOR));
} else { } else {
memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t)); memcpy(&newColor, &item->window.foreColor, sizeof(vec4_t));
} }
@ -5211,8 +5320,8 @@ qboolean Item_Bind_HandleKey(itemDef_t * item, int key, qboolean down)
qboolean ok, returnVal; qboolean ok, returnVal;
//Makro - the mouse doesn't have to be over the item unless we're clicking on it instead of using the keyboard //Makro - the mouse doesn't have to be over the item unless we're clicking on it instead of using the keyboard
ok = (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) && UI_IsMouse(key)) ok = (item->window.flags & WINDOW_HASFOCUS) &&
|| (item->window.flags && WINDOW_HASFOCUS); (Rect_ContainsPoint(&item->window.rect, DC->cursorx, DC->cursory) || !UI_IsMouse(key));
if (ok && !g_waitingForKey) { if (ok && !g_waitingForKey) {
returnVal = qfalse; returnVal = qfalse;
@ -5228,11 +5337,11 @@ qboolean Item_Bind_HandleKey(itemDef_t * item, int key, qboolean down)
return returnVal; return returnVal;
} else { } else {
if (!g_waitingForKey || g_bindItem == NULL) { if (!g_waitingForKey || g_bindItem == NULL) {
return qtrue; return qfalse;
} }
if (key & K_CHAR_FLAG) { if (key & K_CHAR_FLAG) {
return qtrue; return qfalse;
} }
switch (key) { switch (key) {
@ -6350,7 +6459,7 @@ void Menu_HandleMouseMove(menuDef_t * menu, float x, float y)
// if item is not a decoration see if it can take focus // if item is not a decoration see if it can take focus
if (!focusSet) { if (!focusSet) {
focusSet = Item_SetFocus(overItem, x, y); focusSet = Item_SetFocus(overItem, x, y, qfalse);
} }
} }
if (menu->items[i]->type == ITEM_TYPE_LISTBOX) { if (menu->items[i]->type == ITEM_TYPE_LISTBOX) {
@ -6646,6 +6755,8 @@ qboolean ItemParse_shortcutKey(itemDef_t * item, int handle)
return qfalse; return qfalse;
c = (strlen(temp) == 1) ? temp[0] : UI_RQ3_KeyNumFromChar(temp); c = (strlen(temp) == 1) ? temp[0] : UI_RQ3_KeyNumFromChar(temp);
if (c <= 0)
return qfalse;
if (c>='A' && c<='Z') if (c>='A' && c<='Z')
c -= 'A'-'a'; c -= 'A'-'a';
item->window.shortcutKey[i] = c; item->window.shortcutKey[i] = c;
@ -6684,6 +6795,20 @@ qboolean ItemParse_text(itemDef_t * item, int handle)
return qtrue; return qtrue;
} }
//Makro - cleanText <string>
qboolean ItemParse_cleanText(itemDef_t * item, int handle)
{
const char *tmp = NULL;
char *s = NULL;
if (!PC_String_Parse(handle, &tmp)) {
return qfalse;
}
if ( !(s = UI_Alloc(strlen(tmp) + 1)) )
return qfalse;
item->text = Q_CleanStr(strcpy(s, tmp));
return qtrue;
}
// group <string> // group <string>
qboolean ItemParse_group(itemDef_t * item, int handle) qboolean ItemParse_group(itemDef_t * item, int handle)
{ {
@ -7017,6 +7142,21 @@ qboolean ItemParse_forceTextColor(itemDef_t * item, int handle)
return qtrue; return qtrue;
} }
//Makro - randomized texture co-ordinates for stretched shaders
qboolean ItemParse_randomizeTexCoords(itemDef_t * item, int handle)
{
item->window.flags |= WINDOW_RANDOM_TCGEN;
return qtrue;
}
//Makro - menu anchor
qboolean ItemParse_menuAnchor(itemDef_t * item, int handle)
{
item->window.flags |= WINDOW_MENU_ANCHOR;
return qtrue;
}
qboolean ItemParse_renderpoint(itemDef_t * item, int handle) qboolean ItemParse_renderpoint(itemDef_t * item, int handle)
{ {
item->window.flags |= WINDOW_RENDERPOINT; item->window.flags |= WINDOW_RENDERPOINT;
@ -7569,7 +7709,7 @@ qboolean ItemParse_cvarStrList(itemDef_t * item, int handle)
} }
pass = 0; pass = 0;
while (1) { INFINITE_LOOP {
if (!trap_PC_ReadToken(handle, &token)) { if (!trap_PC_ReadToken(handle, &token)) {
PC_SourceError(handle, "end of file inside menu item\n"); PC_SourceError(handle, "end of file inside menu item\n");
return qfalse; return qfalse;
@ -7596,7 +7736,8 @@ qboolean ItemParse_cvarStrList(itemDef_t * item, int handle)
} }
} }
return qfalse; // bk001205 - LCC missing return value //Makro - unreachable
//return qfalse; // bk001205 - LCC missing return value
} }
qboolean ItemParse_cvarFloatList(itemDef_t * item, int handle) qboolean ItemParse_cvarFloatList(itemDef_t * item, int handle)
@ -7617,7 +7758,7 @@ qboolean ItemParse_cvarFloatList(itemDef_t * item, int handle)
return qfalse; return qfalse;
} }
while (1) { INFINITE_LOOP {
if (!trap_PC_ReadToken(handle, &token)) { if (!trap_PC_ReadToken(handle, &token)) {
PC_SourceError(handle, "end of file inside menu item\n"); PC_SourceError(handle, "end of file inside menu item\n");
return qfalse; return qfalse;
@ -7642,7 +7783,8 @@ qboolean ItemParse_cvarFloatList(itemDef_t * item, int handle)
} }
} }
return qfalse; // bk001205 - LCC missing return value //Makro - unreachable
//return qfalse; // bk001205 - LCC missing return value
} }
qboolean ItemParse_addColorRange(itemDef_t * item, int handle) qboolean ItemParse_addColorRange(itemDef_t * item, int handle)
@ -7707,6 +7849,10 @@ qboolean ItemParse_hideCvar(itemDef_t * item, int handle)
return qfalse; return qfalse;
} }
#define ADD_HASH_FUNC(keyword, func) \
{keyword, func, NULL},
keywordHash_t itemParseKeywords[] = { keywordHash_t itemParseKeywords[] = {
{"name", ItemParse_name, NULL}, {"name", ItemParse_name, NULL},
//Makro - support for shortcut keys //Makro - support for shortcut keys
@ -7714,6 +7860,7 @@ keywordHash_t itemParseKeywords[] = {
//Makro - fixed text height for autowrapped items //Makro - fixed text height for autowrapped items
{"textHeight", ItemParse_textHeight, NULL}, {"textHeight", ItemParse_textHeight, NULL},
{"text", ItemParse_text, NULL}, {"text", ItemParse_text, NULL},
ADD_HASH_FUNC("cleanText", ItemParse_cleanText)
{"group", ItemParse_group, NULL}, {"group", ItemParse_group, NULL},
//Makro - added subgroup //Makro - added subgroup
{"subgroup", ItemParse_subgroup, NULL}, {"subgroup", ItemParse_subgroup, NULL},
@ -7737,6 +7884,10 @@ keywordHash_t itemParseKeywords[] = {
{"vectors", ItemParse_vectors, NULL}, {"vectors", ItemParse_vectors, NULL},
{"anglevectors", ItemParse_anglevectors, NULL}, {"anglevectors", ItemParse_anglevectors, NULL},
{"normalizevectors", ItemParse_normalizevectors, NULL}, {"normalizevectors", ItemParse_normalizevectors, NULL},
//Makro - randomized texture co-ordinates for stretched shaders
{"randomizeTexCoords", ItemParse_randomizeTexCoords, NULL},
//Makro - menu anchor
{"menuAnchor", ItemParse_menuAnchor, NULL},
{"style", ItemParse_style, NULL}, {"style", ItemParse_style, NULL},
{"decoration", ItemParse_decoration, NULL}, {"decoration", ItemParse_decoration, NULL},
{"notselectable", ItemParse_notselectable, NULL}, {"notselectable", ItemParse_notselectable, NULL},
@ -7834,7 +7985,7 @@ qboolean Item_Parse(int handle, itemDef_t * item)
if (*token.string != '{') { if (*token.string != '{') {
return qfalse; return qfalse;
} }
while (1) { INFINITE_LOOP {
if (!trap_PC_ReadToken(handle, &token)) { if (!trap_PC_ReadToken(handle, &token)) {
PC_SourceError(handle, "end of file inside menu item\n"); PC_SourceError(handle, "end of file inside menu item\n");
return qfalse; return qfalse;
@ -7854,7 +8005,8 @@ qboolean Item_Parse(int handle, itemDef_t * item)
return qfalse; return qfalse;
} }
} }
return qfalse; // bk001205 - LCC missing return value //Makro - unreachable
//return qfalse; // bk001205 - LCC missing return value
} }
// Item_InitControls // Item_InitControls
@ -8520,7 +8672,7 @@ qboolean Menu_Parse(int handle, menuDef_t * menu)
return qfalse; return qfalse;
} }
while (1) { INFINITE_LOOP {
memset(&token, 0, sizeof(pc_token_t)); memset(&token, 0, sizeof(pc_token_t));
if (!trap_PC_ReadToken(handle, &token)) { if (!trap_PC_ReadToken(handle, &token)) {
@ -8542,7 +8694,8 @@ qboolean Menu_Parse(int handle, menuDef_t * menu)
return qfalse; return qfalse;
} }
} }
return qfalse; // bk001205 - LCC missing return value //Makro - unreachable
//return qfalse; // bk001205 - LCC missing return value
} }
/* /*
@ -8624,6 +8777,7 @@ void *Display_CaptureItem(int x, int y)
} }
// FIXME: // FIXME:
//Makro - fixed :)
qboolean Display_MouseMove(void *p, int x, int y) qboolean Display_MouseMove(void *p, int x, int y)
{ {
int i; int i;
@ -8641,8 +8795,10 @@ qboolean Display_MouseMove(void *p, int x, int y)
Menu_HandleMouseMove(&Menus[i], x, y); Menu_HandleMouseMove(&Menus[i], x, y);
} }
} else { } else {
menu->window.rect.x += x; menu->window.rect.x += x - g_anchorX;
menu->window.rect.y += y; menu->window.rect.y += y - g_anchorY;
g_anchorX = x;
g_anchorY = y;
Menu_UpdatePosition(menu); Menu_UpdatePosition(menu);
} }
return qtrue; return qtrue;
@ -8764,3 +8920,4 @@ static qboolean Menu_OverActiveItem(menuDef_t * menu, float x, float y)
} }
return qfalse; return qfalse;
} }

View file

@ -5,6 +5,9 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// $Log$ // $Log$
// Revision 1.22 2006/04/14 18:02:06 makro
// no message
//
// Revision 1.21 2005/09/07 20:24:33 makro // Revision 1.21 2005/09/07 20:24:33 makro
// Vector support for most item types // Vector support for most item types
// //
@ -116,7 +119,10 @@
#define WINDOW_RENDERPOINT 0x01000000 #define WINDOW_RENDERPOINT 0x01000000
//Makro - forced text color //Makro - forced text color
#define WINDOW_FORCE_TEXT_COLOR 0x02000000 #define WINDOW_FORCE_TEXT_COLOR 0x02000000
//Makro - randomizes texture co-ordinates (useful for simulating screen static)
#define WINDOW_RANDOM_TCGEN 0x04000000
//Makro - parent is moved around when this item is clicked
#define WINDOW_MENU_ANCHOR 0x08000000
// CGAME cursor type bits // CGAME cursor type bits
#define CURSOR_NONE 0x00000001 #define CURSOR_NONE 0x00000001
@ -142,22 +148,24 @@
#define ART_FX_WHITE "menu/art/fx_white" #define ART_FX_WHITE "menu/art/fx_white"
#define ART_FX_YELLOW "menu/art/fx_yel" #define ART_FX_YELLOW "menu/art/fx_yel"
#define ASSET_GRADIENTBAR "ui/assets/gradientbar2.tga" //Makro - removed "ui/assets" from these defines
#define ASSET_SCROLLBAR_V "ui/assets/scrollbar_vert.tga" #define ASSET_GRADIENTBAR "gradientbar2.tga"
#define ASSET_SCROLLBAR_V "scrollbar_vert.tga"
//Makro - horizontal scrollbar //Makro - horizontal scrollbar
#define ASSET_SCROLLBAR_H "ui/assets/scrollbar_horz.tga" #define ASSET_SCROLLBAR_H "scrollbar_horz.tga"
#define ASSET_SCROLLBAR_ARROWDOWN "ui/assets/scrollbar_arrow_dwn_a.tga" #define ASSET_SCROLLBAR_ARROWDOWN "scrollbar_arrow_dwn_a.tga"
#define ASSET_SCROLLBAR_ARROWUP "ui/assets/scrollbar_arrow_up_a.tga" #define ASSET_SCROLLBAR_ARROWUP "scrollbar_arrow_up_a.tga"
#define ASSET_SCROLLBAR_ARROWLEFT "ui/assets/scrollbar_arrow_left_a.tga" #define ASSET_SCROLLBAR_ARROWLEFT "scrollbar_arrow_left_a.tga"
#define ASSET_SCROLLBAR_ARROWRIGHT "ui/assets/scrollbar_arrow_right_a.tga" #define ASSET_SCROLLBAR_ARROWRIGHT "scrollbar_arrow_right_a.tga"
//Makro - displayed when clicked //Makro - displayed when clicked
#define ASSET_SCROLLBAR_ARROWDOWN2 "ui/assets/scrollbar_arrow_dwn_b.tga" #define ASSET_SCROLLBAR_ARROWDOWN2 "scrollbar_arrow_dwn_b.tga"
#define ASSET_SCROLLBAR_ARROWUP2 "ui/assets/scrollbar_arrow_up_b.tga" #define ASSET_SCROLLBAR_ARROWUP2 "scrollbar_arrow_up_b.tga"
#define ASSET_SCROLLBAR_ARROWLEFT2 "ui/assets/scrollbar_arrow_left_b.tga" #define ASSET_SCROLLBAR_ARROWLEFT2 "scrollbar_arrow_left_b.tga"
#define ASSET_SCROLLBAR_ARROWRIGHT2 "ui/assets/scrollbar_arrow_right_b.tga" #define ASSET_SCROLLBAR_ARROWRIGHT2 "scrollbar_arrow_right_b.tga"
#define ASSET_SCROLL_THUMB "ui/assets/scrollbar_thumb.tga" #define ASSET_SCROLL_THUMB "scrollbar_thumb.tga"
#define ASSET_SLIDER_BAR "ui/assets/slider2.tga" #define ASSET_SLIDER_BAR0 "slider2_0.tga"
#define ASSET_SLIDER_THUMB "ui/assets/sliderbutt_1.tga" #define ASSET_SLIDER_BAR1 "slider2_1.tga"
#define ASSET_SLIDER_THUMB "sliderbutt_1.tga"
#define SCROLLBAR_SIZE 16.0 #define SCROLLBAR_SIZE 16.0
#define SLIDER_WIDTH 96.0 #define SLIDER_WIDTH 96.0
#define SLIDER_HEIGHT 16.0 #define SLIDER_HEIGHT 16.0
@ -425,6 +433,8 @@ typedef struct {
const char *fontStr; const char *fontStr;
const char *cursorStr; const char *cursorStr;
const char *gradientStr; const char *gradientStr;
//Makro - this allows us to have more than one UI dir
const char *assetsPath;
fontInfo_t textFont; fontInfo_t textFont;
fontInfo_t smallFont; fontInfo_t smallFont;
fontInfo_t bigFont; fontInfo_t bigFont;
@ -446,7 +456,7 @@ typedef struct {
qhandle_t buttonMiddle; qhandle_t buttonMiddle;
qhandle_t buttonInside; qhandle_t buttonInside;
qhandle_t solidBox; qhandle_t solidBox;
qhandle_t sliderBar; qhandle_t sliderBar0, sliderBar1;
qhandle_t sliderThumb; qhandle_t sliderThumb;
sfxHandle_t menuEnterSound; sfxHandle_t menuEnterSound;
sfxHandle_t menuExitSound; sfxHandle_t menuExitSound;
@ -489,6 +499,8 @@ typedef struct {
(intvec)[(pos)>>5] &= ~(1 << ((pos) & 31))\ (intvec)[(pos)>>5] &= ~(1 << ((pos) & 31))\
#define MAX_NUM_GL_EXTENSIONS 128
typedef struct { typedef struct {
qhandle_t(*registerShaderNoMip) (const char *p); qhandle_t(*registerShaderNoMip) (const char *p);
void (*setColor) (const vec4_t v); void (*setColor) (const vec4_t v);
@ -597,6 +609,10 @@ typedef struct {
int overlayFadeStart, overlayFadeEnd; int overlayFadeStart, overlayFadeEnd;
//Makro - keep track of key presses //Makro - keep track of key presses
int keysStatus[1024/(8*sizeof(int))]; int keysStatus[1024/(8*sizeof(int))];
//Makro - gl extensions
const char *glExtensions[MAX_NUM_GL_EXTENSIONS];
int numGlExtensions;
} displayContextDef_t; } displayContextDef_t;
const char *String_Alloc(const char *p); const char *String_Alloc(const char *p);