SSG crosshairs

This commit is contained in:
Andrei Drexler 2003-04-06 18:31:22 +00:00
parent 5cf44b7208
commit 90726c8cbd
9 changed files with 97 additions and 43 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.142 2003/04/06 18:28:30 makro
// SSG crosshairs
//
// Revision 1.141 2003/04/02 22:23:51 jbravo
// More replacements tweaks. Added zcam_stfu
//
@ -395,7 +398,8 @@
#define GIANT_WIDTH 32
#define GIANT_HEIGHT 48
#define NUM_CROSSHAIRS 10
//Makro - moved to bg_public.h
//#define NUM_CROSSHAIRS 10
#define TEAM_OVERLAY_MAXNAME_WIDTH 12
#define TEAM_OVERLAY_MAXLOCATION_WIDTH 16

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.132 2003/04/06 18:28:30 makro
// SSG crosshairs
//
// Revision 1.131 2003/04/02 22:23:51 jbravo
// More replacements tweaks. Added zcam_stfu
//
@ -2151,6 +2154,12 @@ static void CG_RegisterGraphics(void)
//Elder: C3A laser tutorial
cgs.media.laserShader = trap_R_RegisterShader("sprites/laser");
//Makro - new code
i = cg_RQ3_ssgCrosshair.integer % NUM_SSGCROSSHAIRS;
cgs.media.ssgCrosshair[0] = trap_R_RegisterShaderNoMip(va("gfx/rq3_hud/ssg2x-%i", i));
cgs.media.ssgCrosshair[1] = trap_R_RegisterShaderNoMip(va("gfx/rq3_hud/ssg4x-%i", i));
cgs.media.ssgCrosshair[2] = trap_R_RegisterShaderNoMip(va("gfx/rq3_hud/ssg6x-%i", i));
/*
//Elder: added for sniper crosshairs
switch (cg_RQ3_ssgCrosshair.integer) {
case 0:
@ -2189,6 +2198,7 @@ static void CG_RegisterGraphics(void)
cgs.media.ssgCrosshair[2] = trap_R_RegisterShaderNoMip("gfx/rq3_hud/ssg6x");
break;
}
*/
//Elder: other hud-related elements
cgs.media.rq3_healthicon = trap_R_RegisterShaderNoMip("gfx/rq3_hud/hud_health");
cgs.media.rq3_healthicon2 = trap_R_RegisterShaderNoMip("gfx/rq3_hud/hud_healthwarning");

View file

@ -284,6 +284,10 @@ SOURCE=.\cg_syscalls.c
# End Source File
# Begin Source File
SOURCE=.\cg_unlagged.c
# End Source File
# Begin Source File
SOURCE=.\cg_view.c
# End Source File
# Begin Source File

View file

@ -11,24 +11,6 @@
<h3>Results</h3>
cgamex86.dll - 0 error(s), 0 warning(s)
<h3>
--------------------Configuration: game - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
qagamex86.dll - 0 error(s), 0 warning(s)
<h3>
--------------------Configuration: ui - Win32 Release TA--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
uix86.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.105 2003/04/06 18:29:36 makro
// SSG crosshairs
//
// Revision 1.104 2003/03/31 21:04:24 makro
// no message
//
@ -1527,6 +1530,11 @@ qboolean BG_PlayerTouchesItem(playerState_t * ps, entityState_t * item, int atTi
#define MAT_BRICK 18
#define MAT_CERAMIC 19
//Makro - moved from the UI/cgame header files
#define NUM_CROSSHAIRS 10
//Makro - for the SSG crosshair preview
#define NUM_SSGCROSSHAIRS 12
int GetMaterialFromFlag(int flag);
qboolean IsMetalMat(int Material);
qboolean IsMetalFlag(int flag);

View file

@ -6,13 +6,13 @@
--------------------Configuration: ui - Win32 Release TA--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP227.tmp" with contents
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP90.tmp" with contents
[
/nologo /G6 /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UI_EXPORTS" /FR"Release_TA/" /Fp"Release_TA/ta_ui.pch" /YX /Fo"Release_TA/" /Fd"Release_TA/" /FD /c
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_main.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_shared.c"
]
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP227.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP228.tmp" with contents
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP90.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP91.tmp" with contents
[
/nologo /base:"0x40000000" /dll /incremental:no /pdb:"Release_TA/uix86.pdb" /map:"Release_TA/uix86.map" /machine:I386 /def:".\ui.def" /out:"../Release/uix86.dll" /implib:"Release_TA/uix86.lib"
.\Release_TA\bg_misc.obj
@ -26,13 +26,13 @@ Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP228.tmp" with conte
.\Release_TA\ui_syscalls.obj
.\Release_TA\ui_util.obj
]
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP228.tmp"
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP91.tmp"
<h3>Output Window</h3>
Compiling...
ui_main.c
ui_shared.c
Linking...
Creating library Release_TA/uix86.lib and object Release_TA/uix86.exp
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP22C.tmp" with contents
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP95.tmp" with contents
[
/nologo /o"Release_TA/ta_ui.bsc"
.\Release_TA\bg_misc.sbr
@ -45,7 +45,7 @@ Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP22C.tmp" with conte
.\Release_TA\ui_shared.sbr
.\Release_TA\ui_syscalls.sbr
.\Release_TA\ui_util.sbr]
Creating command line "bscmake.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP22C.tmp"
Creating command line "bscmake.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP95.tmp"
Creating browse info file...
<h3>Output Window</h3>

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.71 2003/04/06 18:31:21 makro
// SSG crosshairs
//
// Revision 1.70 2003/03/31 21:02:30 makro
// no message
//
@ -543,12 +546,8 @@ void AssetCache()
}
//Makro - for the SSG crosshair preview
ssg = (int) trap_Cvar_VariableValue("cg_RQ3_ssgCrosshair");
if (ssg <= 0 || ssg >= NUM_SSGCROSSHAIRS) {
uiInfo.uiDC.Assets.SSGcrosshairShader = trap_R_RegisterShaderNoMip("gfx/rq3_hud/ssg2x");
} else {
ssg = (int) trap_Cvar_VariableValue("cg_RQ3_ssgCrosshair") % NUM_SSGCROSSHAIRS;
uiInfo.uiDC.Assets.SSGcrosshairShader = trap_R_RegisterShaderNoMip(va("gfx/rq3_hud/ssg2x-%i", ssg));
}
//Makro - for drop shadows
for (n = 0; n < 4; n++) {
@ -677,6 +676,23 @@ int Text_Height(const char *text, float scale, int limit)
return max * useScale;
}
//Makro - added
int Text_maxPaintChars(char *text, float scale, float width)
{
char buf[1024];
int l;
if (!text)
return 0;
Q_strncpyz(buf, text, sizeof(buf));
l = strlen(buf);
while (l>=0 && Text_Width(buf, scale, 0) > width)
buf[--l]=0;
return l;
}
void Text_PaintChar(float x, float y, float width, float height, float scale, float s, float t, float s2, float t2,
qhandle_t hShader)
{
@ -3992,7 +4008,7 @@ static qboolean UI_SSG_Crosshair_HandleKey(int flags, float *special, int key)
//Makro - left/right support
if (key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER || key == K_LEFTARROW
|| key == K_RIGHTARROW) {
int current = (int) trap_Cvar_VariableValue("cg_RQ3_ssgCrosshair"), offset = 1;
int current = (int) trap_Cvar_VariableValue("cg_RQ3_ssgCrosshair") % NUM_SSGCROSSHAIRS, offset = 1;
if (key == K_MOUSE2 || key == K_LEFTARROW) {
offset = -1;
@ -4006,11 +4022,7 @@ static qboolean UI_SSG_Crosshair_HandleKey(int flags, float *special, int key)
trap_Cvar_SetValue("cg_RQ3_ssgCrosshair", (float) current);
if (current == 0)
uiInfo.uiDC.Assets.SSGcrosshairShader = trap_R_RegisterShaderNoMip("gfx/rq3_hud/ssg2x");
else
uiInfo.uiDC.Assets.SSGcrosshairShader =
trap_R_RegisterShaderNoMip(va("gfx/rq3_hud/ssg2x-%i", current));
uiInfo.uiDC.Assets.SSGcrosshairShader = trap_R_RegisterShaderNoMip(va("gfx/rq3_hud/ssg2x-%i", current));
return qtrue;
}
@ -4971,7 +4983,7 @@ static void UI_RunMenuScript(char **args)
if (String_Parse(args, &name2)) {
qboolean instant = (Q_stricmp(name2, "instant") == 0);
current = (int) trap_Cvar_VariableValue("cg_RQ3_ssgCrosshair") + offset;
current = ((int) trap_Cvar_VariableValue("cg_RQ3_ssgCrosshair") + offset) % NUM_SSGCROSSHAIRS;
if (current < 0)
current = NUM_SSGCROSSHAIRS - 1;
else if (current >= NUM_SSGCROSSHAIRS)

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.29 2003/04/06 18:31:21 makro
// SSG crosshairs
//
// Revision 1.28 2003/03/31 15:17:58 makro
// Replacements system tweaks.
// Fixed some other bugs.
@ -2646,6 +2649,15 @@ qboolean Item_TextField_HandleKey(itemDef_t * item, int key)
editPtr->paintOffset++;
return qtrue;
}
//int maxChars = Text_maxPaintChars(buff+editPtr->paintOffset, item->textscale, item->window.rect.w+item->textalignx);
/*
if (editPtr->maxPaintChars && item->cursorPos >= maxChars
&& item->cursorPos < len) {
item->cursorPos++;
editPtr->paintOffset++;
return qtrue;
}
*/
if (item->cursorPos < len) {
item->cursorPos++;
}
@ -2669,10 +2681,16 @@ qboolean Item_TextField_HandleKey(itemDef_t * item, int key)
}
if (key == K_END || key == K_KP_END) { // ( tolower(key) == 'e' && trap_Key_IsDown( K_CTRL ) ) ) {
//int maxChars = Text_maxPaintChars(buff+editPtr->paintOffset, item->textscale, item->window.rect.w+item->textalignx);
item->cursorPos = len;
if (item->cursorPos > editPtr->maxPaintChars) {
editPtr->paintOffset = len - editPtr->maxPaintChars;
}
/*
if (item->cursorPos > maxChars) {
editPtr->paintOffset = len - maxChars;
}
*/
return qtrue;
}
@ -3788,6 +3806,7 @@ void Item_TextField_Paint(itemDef_t * item)
int offset;
menuDef_t *parent = (menuDef_t *) item->parent;
editFieldDef_t *editPtr = (editFieldDef_t *) item->typeData;
//int maxChars = Text_maxPaintChars(buff+editPtr->paintOffset, item->textscale, item->window.rect.w+item->textalignx);
Item_Text_Paint(item);
@ -3818,9 +3837,18 @@ void Item_TextField_Paint(itemDef_t * item)
DC->drawTextWithCursor(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale,
newColor, buff + editPtr->paintOffset, item->cursorPos - editPtr->paintOffset,
cursor, editPtr->maxPaintChars, item->textStyle);
/*
DC->drawTextWithCursor(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale,
newColor, buff + editPtr->paintOffset, item->cursorPos - editPtr->paintOffset,
cursor, maxChars, item->textStyle);
*/
} else {
DC->drawText(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, newColor,
buff + editPtr->paintOffset, 0, editPtr->maxPaintChars, item->textStyle);
/*
DC->drawText(item->textRect.x + item->textRect.w + offset, item->textRect.y, item->textscale, newColor,
buff + editPtr->paintOffset, 0, maxChars, item->textStyle);
*/
}
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.18 2003/04/06 18:31:22 makro
// SSG crosshairs
//
// Revision 1.17 2003/03/31 00:23:18 makro
// Replacements and stuff
//
@ -138,9 +141,10 @@
#define SLIDER_HEIGHT 16.0
#define SLIDER_THUMB_WIDTH 12.0
#define SLIDER_THUMB_HEIGHT 20.0
#define NUM_CROSSHAIRS 10
//Makro - for the SSG crosshair preview
#define NUM_SSGCROSSHAIRS 6
//Makro - moved to bg_public.h
//#define NUM_CROSSHAIRS 10
////Makro - for the SSG crosshair preview
//#define NUM_SSGCROSSHAIRS 6
typedef struct {
const char *command;
@ -504,6 +508,8 @@ qboolean Menus_AnyFullScreenVisible();
void Menus_Activate(menuDef_t * menu);
//Makro - select the right player model icon
void UI_RQ3_SelectPlayerIcon(menuDef_t *menu);
//Makro - added
int Text_maxPaintChars(char *text, float scale, float width);
displayContextDef_t *Display_GetContext();
void *Display_CaptureItem(int x, int y);