no message

This commit is contained in:
Andrei Drexler 2002-02-21 18:40:25 +00:00
parent 272d246553
commit c100c543ae
20 changed files with 816 additions and 457 deletions

View file

@ -1,15 +1,3 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2002/02/10 02:36:52 jbravo
// Adding ta_ui files from Makro into CVS
//
//
//-----------------------------------------------------------------------------
// Copyright (C) 1999-2000 Id Software, Inc.
//
#ifndef __KEYCODES_H__

View file

@ -1,15 +1,3 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2002/02/10 02:36:52 jbravo
// Adding ta_ui files from Makro into CVS
//
//
//-----------------------------------------------------------------------------
#define ITEM_TYPE_TEXT 0 // simple text
#define ITEM_TYPE_BUTTON 1 // button, basically text with a border

View file

@ -8,12 +8,12 @@ CFG=ui - Win32 Debug TA
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "ui.mak".
!MESSAGE NMAKE /f "ta_ui.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "ui.mak" CFG="ui - Win32 Debug TA"
!MESSAGE NMAKE /f "ta_ui.mak" CFG="ui - Win32 Debug TA"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE

Binary file not shown.

Binary file not shown.

View file

@ -6,13 +6,22 @@
--------------------Configuration: ui - Win32 Release TA--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPF7.tmp" with contents
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPBF.tmp" with contents
[
/nologo /G6 /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "UI_EXPORTS" /Fp"Release_TA/ta_ui.pch" /YX /Fo"Release_TA/" /Fd"Release_TA/" /FD /c
"C:\Games\Quake3\rq3source\reaction\game\bg_misc.c"
"C:\Games\Quake3\rq3source\reaction\game\q_math.c"
"C:\Games\Quake3\rq3source\reaction\game\q_shared.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_atoms.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_gameinfo.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_main.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_players.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_shared.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_syscalls.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_util.c"
]
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPF7.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPF8.tmp" with contents
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPBF.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPC0.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:"uix86.dll" /implib:"Release_TA/uix86.lib"
.\Release_TA\bg_misc.obj
@ -26,17 +35,30 @@ Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPF8.tmp" with conten
.\Release_TA\ui_syscalls.obj
.\Release_TA\ui_util.obj
]
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPF8.tmp"
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPC0.tmp"
<h3>Output Window</h3>
Compiling...
bg_misc.c
C:\Games\Quake3\rq3source\reaction\game\bg_misc.c(866) : warning C4033: 'BG_FindItemForHoldable' must return a value
C:\Games\Quake3\rq3source\reaction\game\bg_misc.c(1458) : warning C4101: 'p' : unreferenced local variable
C:\Games\Quake3\rq3source\reaction\game\bg_misc.c(1457) : warning C4101: 'angles' : unreferenced local variable
q_math.c
C:\Games\Quake3\rq3source\reaction\game\bg_misc.c(877) : warning C4715: 'BG_FindItemForHoldable' : not all control paths return a value
q_shared.c
ui_atoms.c
ui_gameinfo.c
ui_main.c
ui_players.c
ui_shared.c
ui_syscalls.c
ui_util.c
Linking...
Creating library Release_TA/uix86.lib and object Release_TA/uix86.exp
<h3>Results</h3>
uix86.dll - 0 error(s), 0 warning(s)
uix86.dll - 0 error(s), 4 warning(s)
</pre>
</body>
</html>

Binary file not shown.

Binary file not shown.

View file

@ -1,4 +1,4 @@
-o "\quake3\missionpack\vm\ui"
-o "\quake3\baseq3\vm\ui"
ui_main
..\ui_syscalls
ui_atoms

View file

@ -1,15 +1,3 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2002/02/10 02:36:52 jbravo
// Adding ta_ui files from Makro into CVS
//
//
//-----------------------------------------------------------------------------
// Copyright (C) 1999-2000 Id Software, Inc.
//
/**********************************************************************
@ -73,18 +61,21 @@ void UI_StartDemoLoop( void ) {
}
#ifndef MISSIONPACK // bk001206
static void NeedCDAction( qboolean result ) {
if ( !result ) {
trap_Cmd_ExecuteText( EXEC_APPEND, "quit\n" );
}
}
#endif // MISSIONPACK
#ifndef MISSIONPACK // bk001206
static void NeedCDKeyAction( qboolean result ) {
if ( !result ) {
trap_Cmd_ExecuteText( EXEC_APPEND, "quit\n" );
}
}
#endif // MISSIONPACK
char *UI_Argv( int arg ) {
static char buffer[MAX_STRING_CHARS];
@ -336,14 +327,30 @@ qboolean UI_ConsoleCommand( int realTime ) {
}
if ( Q_stricmp (cmd, "remapShader") == 0 ) {
if (trap_Argc() == 4) {
char shader1[MAX_QPATH];
char shader2[MAX_QPATH];
Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
trap_R_RemapShader(shader1, shader2, UI_Argv(3));
return qtrue;
//Makro - disabling shader remapping when cheats are off
if ( trap_Cvar_VariableValue("sv_cheats") == 1 ) {
if (trap_Argc() >= 4) {
char shader1[MAX_QPATH];
char shader2[MAX_QPATH];
Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
trap_R_RemapShader(shader1, shader2, UI_Argv(3));
}
else
//Makro - if no delay is specified, use 0
if (trap_Argc() == 3) {
char shader1[MAX_QPATH];
char shader2[MAX_QPATH];
Q_strncpyz(shader1, UI_Argv(1), sizeof(shader1));
Q_strncpyz(shader2, UI_Argv(2), sizeof(shader2));
trap_R_RemapShader(shader1, shader2, 0);
}
else
Com_Printf("Usage: remapShader <oldShader> <newShader> [delay]\n");
}
else
Com_Printf("Shader remapping is cheat-protected\n");
return qtrue;
}
if ( Q_stricmp (cmd, "postgame") == 0 ) {
@ -367,6 +374,15 @@ qboolean UI_ConsoleCommand( int realTime ) {
return qtrue;
}
//Makro - adding popup for choose commands
if ( Q_stricmp (cmd, "ui_RQ3_loadout") == 0 ) {
if ( trap_Cvar_VariableValue("g_gametype") == GT_TEAMPLAY )
_UI_SetActiveMenu(UIMENU_RQ3_WEAPON);
else
Com_Printf("Not playing teamplay\n");
return qtrue;
}
return qfalse;
}

View file

@ -1,15 +1,3 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2002/02/10 02:36:52 jbravo
// Adding ta_ui files from Makro into CVS
//
//
//-----------------------------------------------------------------------------
// Copyright (C) 1999-2000 Id Software, Inc.
//
//
@ -30,8 +18,10 @@ static char *ui_botInfos[MAX_BOTS];
static int ui_numArenas;
static char *ui_arenaInfos[MAX_ARENAS];
#ifndef MISSIONPACK // bk001206
static int ui_numSinglePlayerArenas;
static int ui_numSpecialSinglePlayerArenas;
#endif
/*
===============

View file

@ -1,15 +1,3 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2002/02/10 02:36:52 jbravo
// Adding ta_ui files from Makro into CVS
//
//
//-----------------------------------------------------------------------------
// Copyright (C) 1999-2000 Id Software, Inc.
//
#ifndef __UI_LOCAL_H__
@ -122,7 +110,8 @@ extern vmCvar_t ui_scoreTime;
extern vmCvar_t ui_smallFont;
extern vmCvar_t ui_bigFont;
extern vmCvar_t ui_serverStatusTimeOut;
//Makro - cvar for player model display
extern vmCvar_t ui_RQ3_model_command;
//
@ -604,7 +593,7 @@ typedef struct {
#define MAX_MAPS 128
#define MAX_SPMAPS 16
#define PLAYERS_PER_TEAM 5
#define MAX_PINGREQUESTS 16
#define MAX_PINGREQUESTS 32
#define MAX_ADDRESSLENGTH 64
#define MAX_HOSTNAMELENGTH 22
#define MAX_MAPNAMELENGTH 16
@ -616,6 +605,7 @@ typedef struct {
#define MAX_SERVERSTATUS_TEXT 1024
#define MAX_FOUNDPLAYER_SERVERS 16
#define TEAM_MEMBERS 5
//Makro - I don't think these are used anywhere
#define GAMES_ALL 0
#define GAMES_FFA 1
#define GAMES_TEAMPLAY 2
@ -633,7 +623,9 @@ typedef struct {
const char *name;
const char *imageName;
qhandle_t headImage;
qboolean female;
const char *base;
qboolean active;
int reference;
} characterInfo;
typedef struct {

View file

@ -1,15 +1,3 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2002/02/10 02:36:52 jbravo
// Adding ta_ui files from Makro into CVS
//
//
//-----------------------------------------------------------------------------
// Copyright (C) 1999-2000 Id Software, Inc.
//
/*
@ -55,13 +43,15 @@ static const char *netSources[] = {
static const int numNetSources = sizeof(netSources) / sizeof(const char*);
static const serverFilter_t serverFilters[] = {
/* Makro removed all,added reaction
{"All", "" },
//Makro - we just want Reaction servers in the server list
/* {"All", "" },
{"Quake 3 Arena", "" },
{"Team Arena", "missionpack" },
{"Rocket Arena", "arena" },
{"Alliance", "alliance" },*/
{"Reaction", "reaction"}
{"Alliance", "alliance20" },
{"Weapons Factory Arena", "wfa" },
{"OSP", "osp" },*/
{"Reaction", "reaction" }
};
static const char *teamArenaGameTypes[] = {
@ -69,6 +59,8 @@ static const char *teamArenaGameTypes[] = {
"TOURNAMENT",
"SP",
"TEAM DM",
//Makro - inserted teamplay
"TEAMPLAY",
"CTF",
"1FCTF",
"OVERLOAD",
@ -80,10 +72,12 @@ static int const numTeamArenaGameTypes = sizeof(teamArenaGameTypes) / sizeof(con
static const char *teamArenaGameNames[] = {
"Free For All",
"RQ3 Deathmatch",
"Tournament",
"Single Player",
"RQ3 Deathmatch (SP)",
"Team Deathmatch",
//Makro - inserted teamplay
"RQ3 Teamplay",
"Capture the Flag",
"One Flag CTF",
"Overload",
@ -112,7 +106,9 @@ static char* netnames[] = {
NULL
};
#ifndef MISSIONPACK // bk001206
static char quake3worldMessage[] = "Visit www.quake3world.com - News, Community, Events, Files";
#endif
static int gamecodetoui[] = {4,2,3,0,5,1,6};
static int uitogamecode[] = {4,6,2,3,1,5,7};
@ -127,9 +123,11 @@ static void UI_BuildServerStatus(qboolean force);
static void UI_BuildFindPlayerList(qboolean force);
static int QDECL UI_ServersQsortCompare( const void *arg1, const void *arg2 );
static int UI_MapCountByGameType(qboolean singlePlayer);
static int UI_HeadCountByTeam( void );
static void UI_ParseGameInfo(const char *teamFile);
static void UI_ParseTeamInfo(const char *teamFile);
static const char *UI_SelectedMap(int index, int *actual);
static const char *UI_SelectedHead(int index, int *actual);
static int UI_GetIndexFromSelection(int actual);
int ProcessNewUI( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6 );
@ -191,8 +189,8 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a
case UI_DRAW_CONNECT_SCREEN:
UI_DrawConnectScreen( arg0 );
return 0;
case UI_HASUNIQUECDKEY: // mod authors need to observe this
return qtrue;
case UI_HASUNIQUECDKEY: // mod authors need to observe this
return qtrue; // bk010117 - change this to qfalse for mods!
}
@ -245,6 +243,99 @@ void _UI_DrawTopBottom(float x, float y, float w, float h, float size) {
trap_R_DrawStretchPic( x, y, w, size, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
trap_R_DrawStretchPic( x, y + h - size, w, size, 0, 0, 0, 0, uiInfo.uiDC.whiteShader );
}
//Makro - use different animations for the player model depending on ui_RQ3_model_command
animNumber_t UI_RQ3_GetAnimForLegs()
{
/* if ( Q_stricmp (ui_RQ3_model_command.string, "jump") == 0 )
return LEGS_JUMP;
else
if ( Q_stricmp (ui_RQ3_model_command.string, "crouch") == 0 )
return LEGS_IDLECR;
else
if ( Q_stricmp (ui_RQ3_model_command.string, "crouch_fwd") == 0 )
return LEGS_WALKCR;
else
if ( Q_stricmp (ui_RQ3_model_command.string, "crouch_bk") == 0 )
return LEGS_BACKCR;
else
return LEGS_IDLE;
*/
switch (ui_RQ3_model_command.integer) {
case 2:
return LEGS_BACK;
case 3:
return LEGS_RUN;
case 4:
return LEGS_WALK;
case 5:
return LEGS_JUMP;
case 6:
return LEGS_IDLECR;
case 7:
return LEGS_WALKCR;
default:
return LEGS_IDLE;
}
}
//Makro - use different animations for the player model depending on ui_RQ3_model_command
animNumber_t UI_RQ3_GetAnimForTorso()
{
switch (ui_RQ3_model_command.integer) {
case 101:
return TORSO_RAISE;
case 102:
return TORSO_RAISE;
case 103:
return TORSO_RAISE;
case 104:
return TORSO_RAISE;
case 105:
return TORSO_RAISE;
case 106:
return TORSO_RAISE;
case 107:
return TORSO_RAISE;
case 108:
return TORSO_RAISE;
case 109:
return TORSO_RAISE;
default:
return TORSO_GESTURE;
}
}
//Makro - use different weapons for the player model depending on ui_RQ3_model_command
weapon_t UI_RQ3_GetWeaponForPlayer()
{
switch (ui_RQ3_model_command.integer) {
case 102:
return WP_M3;
case 103:
return WP_MP5;
case 104:
return WP_HANDCANNON;
case 105:
return WP_SSG3000;
case 106:
return WP_M4;
case 107:
return WP_AKIMBO;
case 108:
return WP_KNIFE;
case 109:
return WP_GRENADE;
default:
return WP_PISTOL;
}
}
/*
================
UI_DrawRect
@ -269,6 +360,9 @@ int Text_Width(const char *text, float scale, int limit) {
float out;
glyphInfo_t *glyph;
float useScale;
// TTimo: FIXME: use const unsigned char to avoid getting a warning in linux debug (.so) when using glyph = &font->glyphs[*s];
// but use const char to build with lcc..
// const unsigned char *s = text; // bk001206 - unsigned
const char *s = text;
fontInfo_t *font = &uiInfo.uiDC.Assets.textFont;
if (scale <= ui_smallFont.value) {
@ -289,7 +383,7 @@ int Text_Width(const char *text, float scale, int limit) {
s += 2;
continue;
} else {
glyph = &font->glyphs[*s];
glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
out += glyph->xSkip;
s++;
count++;
@ -304,7 +398,9 @@ int Text_Height(const char *text, float scale, int limit) {
float max;
glyphInfo_t *glyph;
float useScale;
const char *s = text;
// TTimo: FIXME
// const unsigned char *s = text; // bk001206 - unsigned
const char *s = text; // bk001206 - unsigned
fontInfo_t *font = &uiInfo.uiDC.Assets.textFont;
if (scale <= ui_smallFont.value) {
font = &uiInfo.uiDC.Assets.smallFont;
@ -324,7 +420,7 @@ int Text_Height(const char *text, float scale, int limit) {
s += 2;
continue;
} else {
glyph = &font->glyphs[*s];
glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
if (max < glyph->height) {
max = glyph->height;
}
@ -357,7 +453,9 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f
}
useScale = scale * font->glyphScale;
if (text) {
const char *s = text;
// TTimo: FIXME
// const unsigned char *s = text; // bk001206 - unsigned
const char *s = text; // bk001206 - unsigned
trap_R_SetColor( color );
memcpy(&newColor[0], &color[0], sizeof(vec4_t));
len = strlen(text);
@ -366,7 +464,7 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f
}
count = 0;
while (s && *s && count < len) {
glyph = &font->glyphs[*s];
glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
//int yadj = Assets.textFont.glyphs[text[i]].bottom + Assets.textFont.glyphs[text[i]].top;
//float yadj = scale * (Assets.textFont.glyphs[text[i]].imageHeight - Assets.textFont.glyphs[text[i]].height);
if ( Q_IsColorString( s ) ) {
@ -426,7 +524,9 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha
}
useScale = scale * font->glyphScale;
if (text) {
const char *s = text;
// TTimo: FIXME
// const unsigned char *s = text; // bk001206 - unsigned
const char *s = text; // bk001206 - unsigned
trap_R_SetColor( color );
memcpy(&newColor[0], &color[0], sizeof(vec4_t));
len = strlen(text);
@ -434,9 +534,9 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha
len = limit;
}
count = 0;
glyph2 = &font->glyphs[cursor];
glyph2 = &font->glyphs[ (int) cursor]; // bk001206 - possible signed char
while (s && *s && count < len) {
glyph = &font->glyphs[*s];
glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
//int yadj = Assets.textFont.glyphs[text[i]].bottom + Assets.textFont.glyphs[text[i]].top;
//float yadj = scale * (Assets.textFont.glyphs[text[i]].imageHeight - Assets.textFont.glyphs[text[i]].height);
if ( Q_IsColorString( s ) ) {
@ -518,7 +618,9 @@ static void Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4_t
vec4_t newColor;
glyphInfo_t *glyph;
if (text) {
const char *s = text;
// TTimo: FIXME
// const unsigned char *s = text; // bk001206 - unsigned
const char *s = text; // bk001206 - unsigned
float max = *maxX;
float useScale;
fontInfo_t *font = &uiInfo.uiDC.Assets.textFont;
@ -535,7 +637,7 @@ static void Text_Paint_Limit(float *maxX, float x, float y, float scale, vec4_t
}
count = 0;
while (s && *s && count < len) {
glyph = &font->glyphs[*s];
glyph = &font->glyphs[(int)*s]; // TTimo: FIXME: getting nasty warnings without the cast, hopefully this doesn't break the VM build
if ( Q_IsColorString( s ) ) {
memcpy( newColor, g_color_table[ColorIndex(*(s+1))], sizeof( newColor ) );
newColor[3] = color[3];
@ -1001,7 +1103,9 @@ void UI_Load() {
}
static const char *handicapValues[] = {"None","95","90","85","80","75","70","65","60","55","50","45","40","35","30","25","20","15","10","5",NULL};
#ifndef MISSIONPACK // bk001206
static int numHandicaps = sizeof(handicapValues) / sizeof(const char*);
#endif
static void UI_DrawHandicap(rectDef_t *rect, float scale, vec4_t color, int textStyle) {
int i, h;
@ -1101,6 +1205,9 @@ static void UI_DrawClanCinematic(rectDef_t *rect, float scale, vec4_t color) {
trap_CIN_SetExtents(uiInfo.teamList[i].cinematic, rect->x, rect->y, rect->w, rect->h);
trap_CIN_DrawCinematic(uiInfo.teamList[i].cinematic);
} else {
trap_R_SetColor( color );
UI_DrawHandlePic( rect->x, rect->y, rect->w, rect->h, uiInfo.teamList[i].teamIcon_Metal);
trap_R_SetColor(NULL);
uiInfo.teamList[i].cinematic = -2;
}
} else {
@ -1264,7 +1371,7 @@ static void UI_DrawPlayerModel(rectDef_t *rect) {
vec3_t viewangles;
vec3_t moveangles;
if (trap_Cvar_VariableValue("ui_Q3Model")) {
if (trap_Cvar_VariableValue("ui_Q3Model")) {
strcpy(model, UI_Cvar_VariableString("model"));
strcpy(head, UI_Cvar_VariableString("headmodel"));
if (!q3Model) {
@ -1273,27 +1380,29 @@ static void UI_DrawPlayerModel(rectDef_t *rect) {
}
team[0] = '\0';
} else {
strcpy(model, UI_Cvar_VariableString("team_model"));
strcpy(team, UI_Cvar_VariableString("ui_teamName"));
strcpy(model, UI_Cvar_VariableString("team_model"));
strcpy(head, UI_Cvar_VariableString("team_headmodel"));
strcpy(team, UI_Cvar_VariableString("ui_teamName"));
if (q3Model) {
q3Model = qfalse;
updateModel = qtrue;
}
}
if (updateModel) {
updateModel = updateModel || (ui_RQ3_model_command.integer != 0);
if (updateModel) {
memset( &info, 0, sizeof(playerInfo_t) );
//Makro - angle was 180 - 10
viewangles[YAW] = 180 + 35;
viewangles[YAW] = 180 + 40;
viewangles[PITCH] = 0;
viewangles[ROLL] = 0;
VectorClear( moveangles );
UI_PlayerInfo_SetModel( &info, model, head, team);
/* Makro - was using WP_MACHINEGUN
UI_PlayerInfo_SetInfo( &info, LEGS_IDLE, TORSO_STAND, viewangles, vec3_origin, WP_MACHINEGUN, qfalse );
*/
UI_PlayerInfo_SetInfo( &info, LEGS_IDLE, TORSO_STAND, viewangles, vec3_origin, WP_PISTOL, qfalse );
//Blaze: Changed WP_MACHINEGUN to WP_PISTOL
//Makro: Changed from WP_PISTOL to custom function
UI_PlayerInfo_SetInfo( &info, UI_RQ3_GetAnimForLegs(), UI_RQ3_GetAnimForTorso(), viewangles, vec3_origin, UI_RQ3_GetWeaponForPlayer(), qfalse );
// UI_RegisterClientModelname( &info, model, head, team);
trap_Cvar_SetValue( "ui_RQ3_model_command", 0);
updateModel = qfalse;
}
@ -1404,10 +1513,12 @@ static void UI_DrawTierGameType(rectDef_t *rect, float scale, vec4_t color, int
}
#ifndef MISSIONPACK // bk001206
static const char *UI_OpponentLeaderName() {
int i = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_opponentName"));
return uiInfo.teamList[i].teamMembers[0];
}
#endif
static const char *UI_AIFromName(const char *name) {
int j;
@ -1419,6 +1530,7 @@ static const char *UI_AIFromName(const char *name) {
return "James";
}
#ifndef MISSIONPACK // bk001206
static const int UI_AIIndex(const char *name) {
int j;
for (j = 0; j < uiInfo.characterCount; j++) {
@ -1428,7 +1540,9 @@ static const int UI_AIIndex(const char *name) {
}
return 0;
}
#endif
#ifndef MISSIONPACK // bk001206
static const int UI_AIIndexFromName(const char *name) {
int j;
for (j = 0; j < uiInfo.aliasCount; j++) {
@ -1438,28 +1552,28 @@ static const int UI_AIIndexFromName(const char *name) {
}
return 0;
}
#endif
#ifndef MISSIONPACK // bk001206
static const char *UI_OpponentLeaderHead() {
const char *leader = UI_OpponentLeaderName();
return UI_AIFromName(leader);
}
#endif
#ifndef MISSIONPACK // bk001206
static const char *UI_OpponentLeaderModel() {
int i;
const char *head = UI_OpponentLeaderHead();
for (i = 0; i < uiInfo.characterCount; i++) {
if (Q_stricmp(head, uiInfo.characterList[i].name) == 0) {
if (uiInfo.characterList[i].female) {
return "Janet";
} else {
return "James";
}
return uiInfo.characterList[i].base;
}
}
return "James";
}
#endif
static qboolean updateOpponentModel = qtrue;
@ -1471,6 +1585,7 @@ static void UI_DrawOpponent(rectDef_t *rect) {
vec3_t viewangles;
vec3_t moveangles;
updateOpponentModel = updateOpponentModel || (ui_RQ3_model_command.integer !=0);
if (updateOpponentModel) {
strcpy(model, UI_Cvar_VariableString("ui_opponentModel"));
@ -1483,12 +1598,11 @@ static void UI_DrawOpponent(rectDef_t *rect) {
viewangles[ROLL] = 0;
VectorClear( moveangles );
UI_PlayerInfo_SetModel( &info2, model, headmodel, "");
/* Makro - was using WP_MACHINEGUN
UI_PlayerInfo_SetInfo( &info2, LEGS_IDLE, TORSO_STAND, viewangles, vec3_origin, WP_MACHINEGUN, qfalse );
*/
UI_PlayerInfo_SetInfo( &info2, LEGS_IDLE, TORSO_STAND, viewangles, vec3_origin, WP_PISTOL, qfalse );
UI_RegisterClientModelname( &info2, model, headmodel, team);
//Makro - changed to custom function
UI_PlayerInfo_SetInfo( &info2, UI_RQ3_GetAnimForLegs(), UI_RQ3_GetAnimForTorso(), viewangles, vec3_origin, UI_RQ3_GetWeaponForPlayer(), qfalse );
UI_RegisterClientModelname( &info2, model, headmodel, team);
updateOpponentModel = qfalse;
trap_Cvar_SetValue( "ui_RQ3_model_command", 0);
}
UI_DrawPlayer( rect->x, rect->y, rect->w, rect->h, &info2, uiInfo.uiDC.realTime / 2);
@ -1696,6 +1810,7 @@ static int UI_OwnerDrawWidth(int ownerDraw, float scale) {
if (ui_netSource.integer < 0 || ui_netSource.integer > uiInfo.numJoinGameTypes) {
ui_netSource.integer = 0;
}
s = va("Source: %s", netSources[ui_netSource.integer]);
break;
case UI_NETFILTER:
@ -1909,7 +2024,7 @@ static void UI_DrawServerMOTD(rectDef_t *rect, float scale, vec4_t color) {
}
static void UI_DrawKeyBindStatus(rectDef_t *rect, float scale, vec4_t color, int textStyle) {
int ofs = 0;
// int ofs = 0; TTimo: unused
if (Display_KeyBindPending()) {
Text_Paint(rect->x, rect->y, scale, color, "Waiting for new key... Press ESCAPE to cancel", 0, 0, textStyle);
} else {
@ -2168,6 +2283,7 @@ static qboolean UI_OwnerDrawVisible(int flags) {
if (!(ui_selectedPlayer.integer < uiInfo.myTeamCount && uiInfo.teamClientNums[ui_selectedPlayer.integer] == uiInfo.playerNumber)) {
vis = qfalse;
}
// these need to show when this client can give orders to a player or a group
}
flags &= ~UI_SHOW_NOTLEADER;
}
@ -2276,7 +2392,7 @@ static qboolean UI_Effects_HandleKey(int flags, float *special, int key) {
uiInfo.effectsColor = 6;
}
trap_Cvar_SetValue( "color", uitogamecode[uiInfo.effectsColor] );
trap_Cvar_SetValue( "color1", uitogamecode[uiInfo.effectsColor] );
return qtrue;
}
return qfalse;
@ -2301,7 +2417,9 @@ static qboolean UI_ClanName_HandleKey(int flags, float *special, int key) {
i = uiInfo.teamCount - 1;
}
trap_Cvar_Set( "ui_teamName", uiInfo.teamList[i].teamName);
updateModel = qtrue;
UI_HeadCountByTeam();
UI_FeederSelection(FEEDER_HEADS, 0);
updateModel = qtrue;
return qtrue;
}
return qfalse;
@ -3082,7 +3200,7 @@ static void UI_Update(const char *name) {
trap_Cvar_SetValue( "r_lodbias", 0 );
trap_Cvar_SetValue( "r_colorbits", 0 );
trap_Cvar_SetValue( "r_depthbits", 24 );
trap_Cvar_SetValue( "r_picmip", 0 );
trap_Cvar_SetValue( "r_picmip", 1 );
trap_Cvar_SetValue( "r_mode", 3 );
trap_Cvar_SetValue( "r_texturebits", 0 );
trap_Cvar_SetValue( "r_fastSky", 0 );
@ -3133,24 +3251,25 @@ static void UI_Update(const char *name) {
}
}
//Makro - this is interesting. uiScripts run here
static void UI_RunMenuScript(char **args) {
const char *name, *name2;
char buff[1024];
if (String_Parse(args, &name)) {
if (Q_stricmp(name, "StartServer") == 0) {
int i, clients;
int i, clients, oldclients;
float skill;
trap_Cvar_Set("cg_thirdPerson", "0");
trap_Cvar_Set("cg_cameraOrbit", "0");
trap_Cvar_Set("ui_singlePlayerActive", "0");
trap_Cvar_SetValue( "dedicated", Com_Clamp( 0, 2, ui_dedicated.integer ) );
trap_Cvar_SetValue( "g_gametype", Com_Clamp( 0, 8, uiInfo.gameTypes[ui_netGameType.integer].gtEnum ) );
trap_Cvar_Set("g_redTeam", UI_Cvar_VariableString("ui_teamName"));
trap_Cvar_Set("g_blueTeam", UI_Cvar_VariableString("ui_opponentName"));
trap_Cmd_ExecuteText( EXEC_APPEND, va( "wait ; wait ; map %s\n", uiInfo.mapList[ui_currentNetMap.integer].mapLoadName ) );
skill = trap_Cvar_VariableValue( "g_spSkill" );
// set max clients based on spots
oldclients = trap_Cvar_VariableValue( "sv_maxClients" );
clients = 0;
for (i = 0; i < PLAYERS_PER_TEAM; i++) {
int bot = trap_Cvar_VariableValue( va("ui_blueteam%i", i+1));
@ -3165,6 +3284,11 @@ static void UI_RunMenuScript(char **args) {
if (clients == 0) {
clients = 8;
}
if (oldclients > clients) {
clients = oldclients;
}
trap_Cvar_Set("sv_maxClients", va("%d",clients));
for (i = 0; i < PLAYERS_PER_TEAM; i++) {
@ -3259,7 +3383,7 @@ static void UI_RunMenuScript(char **args) {
UI_BuildServerDisplayList(qtrue);
} else if (Q_stricmp(name, "RunSPDemo") == 0) {
if (uiInfo.demoAvailable) {
trap_Cmd_ExecuteText( EXEC_APPEND, va("demo %s_%i", uiInfo.mapList[ui_currentMap.integer].mapLoadName, uiInfo.gameTypes[ui_gameType.integer].gtEnum));
trap_Cmd_ExecuteText( EXEC_APPEND, va("demo %s_%i\n", uiInfo.mapList[ui_currentMap.integer].mapLoadName, uiInfo.gameTypes[ui_gameType.integer].gtEnum));
}
} else if (Q_stricmp(name, "LoadDemos") == 0) {
UI_LoadDemos();
@ -3540,6 +3664,81 @@ static int UI_MapCountByGameType(qboolean singlePlayer) {
return c;
}
qboolean UI_hasSkinForBase(const char *base, const char *team) {
char test[1024];
Com_sprintf( test, sizeof( test ), "models/players/%s/%s/lower_default.skin", base, team );
if (trap_FS_FOpenFile(test, 0, FS_READ)) {
return qtrue;
}
Com_sprintf( test, sizeof( test ), "models/players/characters/%s/%s/lower_default.skin", base, team );
if (trap_FS_FOpenFile(test, 0, FS_READ)) {
return qtrue;
}
return qfalse;
}
/*
==================
UI_MapCountByTeam
==================
*/
static int UI_HeadCountByTeam() {
static int init = 0;
int i, j, k, c, tIndex;
c = 0;
if (!init) {
for (i = 0; i < uiInfo.characterCount; i++) {
uiInfo.characterList[i].reference = 0;
for (j = 0; j < uiInfo.teamCount; j++) {
if (UI_hasSkinForBase(uiInfo.characterList[i].base, uiInfo.teamList[j].teamName)) {
uiInfo.characterList[i].reference |= (1<<j);
}
}
}
init = 1;
}
tIndex = UI_TeamIndexFromName(UI_Cvar_VariableString("ui_teamName"));
// do names
for (i = 0; i < uiInfo.characterCount; i++) {
uiInfo.characterList[i].active = qfalse;
for(j = 0; j < TEAM_MEMBERS; j++) {
if (uiInfo.teamList[tIndex].teamMembers[j] != NULL) {
if (uiInfo.characterList[i].reference&(1<<tIndex)) {// && Q_stricmp(uiInfo.teamList[tIndex].teamMembers[j], uiInfo.characterList[i].name)==0) {
uiInfo.characterList[i].active = qtrue;
c++;
break;
}
}
}
}
// and then aliases
for(j = 0; j < TEAM_MEMBERS; j++) {
for(k = 0; k < uiInfo.aliasCount; k++) {
if (uiInfo.aliasList[k].name != NULL) {
if (Q_stricmp(uiInfo.teamList[tIndex].teamMembers[j], uiInfo.aliasList[k].name)==0) {
for (i = 0; i < uiInfo.characterCount; i++) {
if (uiInfo.characterList[i].headImage != -1 && uiInfo.characterList[i].reference&(1<<tIndex) && Q_stricmp(uiInfo.aliasList[k].ai, uiInfo.characterList[i].name)==0) {
if (uiInfo.characterList[i].active == qfalse) {
uiInfo.characterList[i].active = qtrue;
c++;
}
break;
}
}
}
}
}
}
return c;
}
/*
==================
UI_InsertServerIntoDisplayList
@ -3625,7 +3824,7 @@ UI_BuildServerDisplayList
static void UI_BuildServerDisplayList(qboolean force) {
int i, count, clients, maxClients, ping, game, len, visible;
char info[MAX_STRING_CHARS];
qboolean startRefresh = qtrue;
// qboolean startRefresh = qtrue; TTimo: unused
static int numinvisible;
if (!(force || uiInfo.uiDC.realTime > uiInfo.serverStatus.nextDisplayRefresh)) {
@ -3913,7 +4112,7 @@ UI_BuildFindPlayerList
==================
*/
static void UI_BuildFindPlayerList(qboolean force) {
static numFound, numTimeOuts;
static int numFound, numTimeOuts;
int i, j, resend;
serverStatusInfo_t info;
char name[MAX_NAME_LENGTH+2];
@ -4083,7 +4282,7 @@ UI_FeederCount
*/
static int UI_FeederCount(float feederID) {
if (feederID == FEEDER_HEADS) {
return uiInfo.characterCount;
return UI_HeadCountByTeam();
} else if (feederID == FEEDER_Q3HEADS) {
return uiInfo.q3HeadCount;
} else if (feederID == FEEDER_CINEMATICS) {
@ -4133,6 +4332,23 @@ static const char *UI_SelectedMap(int index, int *actual) {
return "";
}
static const char *UI_SelectedHead(int index, int *actual) {
int i, c;
c = 0;
*actual = 0;
for (i = 0; i < uiInfo.characterCount; i++) {
if (uiInfo.characterList[i].active) {
if (c == index) {
*actual = i;
return uiInfo.characterList[i].name;
} else {
c++;
}
}
}
return "";
}
static int UI_GetIndexFromSelection(int actual) {
int i, c;
c = 0;
@ -4158,13 +4374,12 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan
static char info[MAX_STRING_CHARS];
static char hostname[1024];
static char clientBuff[32];
static lastColumn = -1;
static lastTime = 0;
static int lastColumn = -1;
static int lastTime = 0;
*handle = -1;
if (feederID == FEEDER_HEADS) {
if (index >= 0 && index < uiInfo.characterCount) {
return uiInfo.characterList[index].name;
}
int actual;
return UI_SelectedHead(index, &actual);
} else if (feederID == FEEDER_Q3HEADS) {
if (index >= 0 && index < uiInfo.q3HeadCount) {
return uiInfo.q3HeadNames[index];
@ -4197,7 +4412,14 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan
return hostname;
}
else {
return Info_ValueForKey(info, "hostname");
if (atoi(Info_ValueForKey(info, "sv_allowAnonymous")) != 0) { // anonymous server
Com_sprintf( hostname, sizeof(hostname), "(A) %s",
Info_ValueForKey(info, "hostname"));
} else {
Com_sprintf( hostname, sizeof(hostname), "%s",
Info_ValueForKey(info, "hostname"));
}
return hostname;
}
}
case SORT_MAP : return Info_ValueForKey(info, "mapname");
@ -4261,12 +4483,15 @@ static const char *UI_FeederItemText(float feederID, int index, int column, qhan
static qhandle_t UI_FeederItemImage(float feederID, int index) {
if (feederID == FEEDER_HEADS) {
if (index >= 0 && index < uiInfo.characterCount) {
if (uiInfo.characterList[index].headImage == -1) {
uiInfo.characterList[index].headImage = trap_R_RegisterShaderNoMip(uiInfo.characterList[index].imageName);
}
return uiInfo.characterList[index].headImage;
}
int actual;
UI_SelectedHead(index, &actual);
index = actual;
if (index >= 0 && index < uiInfo.characterCount) {
if (uiInfo.characterList[index].headImage == -1) {
uiInfo.characterList[index].headImage = trap_R_RegisterShaderNoMip(uiInfo.characterList[index].imageName);
}
return uiInfo.characterList[index].headImage;
}
} else if (feederID == FEEDER_Q3HEADS) {
if (index >= 0 && index < uiInfo.q3HeadCount) {
return uiInfo.q3HeadIcons[index];
@ -4288,10 +4513,13 @@ static qhandle_t UI_FeederItemImage(float feederID, int index) {
static void UI_FeederSelection(float feederID, int index) {
static char info[MAX_STRING_CHARS];
if (feederID == FEEDER_HEADS) {
int actual;
UI_SelectedHead(index, &actual);
index = actual;
if (index >= 0 && index < uiInfo.characterCount) {
trap_Cvar_Set( "team_model", uiInfo.characterList[index].female ? "janet" : "james");
trap_Cvar_Set( "team_headmodel", va("*%s", uiInfo.characterList[index].name));
updateModel = qtrue;
trap_Cvar_Set( "team_model", va("%s", uiInfo.characterList[index].base));
trap_Cvar_Set( "team_headmodel", va("*%s", uiInfo.characterList[index].name));
updateModel = qtrue;
}
} else if (feederID == FEEDER_Q3HEADS) {
if (index >= 0 && index < uiInfo.q3HeadCount) {
@ -4455,13 +4683,15 @@ static qboolean Character_Parse(char **p) {
uiInfo.characterList[uiInfo.characterCount].headImage = -1;
uiInfo.characterList[uiInfo.characterCount].imageName = String_Alloc(va("models/players/heads/%s/icon_default.tga", uiInfo.characterList[uiInfo.characterCount].name));
if (tempStr && (tempStr[0] == 'f' || tempStr[0] == 'F')) {
uiInfo.characterList[uiInfo.characterCount].female = qtrue;
} else {
uiInfo.characterList[uiInfo.characterCount].female = qfalse;
}
if (tempStr && (!Q_stricmp(tempStr, "female"))) {
uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("Janet"));
} else if (tempStr && (!Q_stricmp(tempStr, "male"))) {
uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("James"));
} else {
uiInfo.characterList[uiInfo.characterCount].base = String_Alloc(va("%s",tempStr));
}
Com_Printf("Loaded %s character %s.\n", tempStr, uiInfo.characterList[uiInfo.characterCount].name);
Com_Printf("Loaded %s character %s.\n", uiInfo.characterList[uiInfo.characterCount].base, uiInfo.characterList[uiInfo.characterCount].name);
if (uiInfo.characterCount < MAX_HEADS) {
uiInfo.characterCount++;
} else {
@ -4532,7 +4762,7 @@ static void UI_ParseTeamInfo(const char *teamFile) {
char *token;
char *p;
char *buff = NULL;
int mode = 0;
//static int mode = 0; TTimo: unused
buff = GetMenuBuffer(teamFile);
if (!buff) {
@ -4702,7 +4932,7 @@ static void UI_ParseGameInfo(const char *teamFile) {
char *token;
char *p;
char *buff = NULL;
int mode = 0;
//int mode = 0; TTimo: unused
buff = GetMenuBuffer(teamFile);
if (!buff) {
@ -4760,8 +4990,12 @@ static void UI_Pause(qboolean b) {
}
}
#ifndef MISSIONPACK // bk001206
static int UI_OwnerDraw_Width(int ownerDraw) {
// bk001205 - LCC missing return value
return 0;
}
#endif
static int UI_PlayCinematic(const char *name, float x, float y, float w, float h) {
return trap_CIN_PlayCinematic(name, x, y, w, h, (CIN_loop | CIN_silent));
@ -4817,10 +5051,11 @@ static void UI_BuildQ3Model_List( void )
char dirlist[2048];
char filelist[2048];
char skinname[64];
char scratch[256];
char* dirptr;
char* fileptr;
int i;
int j;
int j, k, dirty;
int dirlen;
int filelen;
@ -4837,6 +5072,10 @@ static void UI_BuildQ3Model_List( void )
if (!strcmp(dirptr,".") || !strcmp(dirptr,".."))
continue;
// NiceAss:
if (strcmp(dirptr,"grunt"))
continue;
// iterate all skin files in directory
numfiles = trap_FS_GetFileList( va("models/players/%s",dirptr), "tga", filelist, 2048 );
@ -4851,11 +5090,21 @@ static void UI_BuildQ3Model_List( void )
if (Q_stricmpn(skinname, "icon_", 5) == 0 && !(Q_stricmp(skinname,"icon_blue") == 0 || Q_stricmp(skinname,"icon_red") == 0))
{
if (Q_stricmp(skinname, "icon_default") == 0) {
Com_sprintf( uiInfo.q3HeadNames[uiInfo.q3HeadCount], sizeof(uiInfo.q3HeadNames[uiInfo.q3HeadCount]), dirptr);
Com_sprintf( scratch, sizeof(scratch), dirptr);
} else {
Com_sprintf( uiInfo.q3HeadNames[uiInfo.q3HeadCount], sizeof(uiInfo.q3HeadNames[uiInfo.q3HeadCount]), "%s/%s",dirptr, skinname + 5);
Com_sprintf( scratch, sizeof(scratch), "%s/%s",dirptr, skinname + 5);
}
dirty = 0;
for(k=0;k<uiInfo.q3HeadCount;k++) {
if (!Q_stricmp(scratch, uiInfo.q3HeadNames[uiInfo.q3HeadCount])) {
dirty = 1;
break;
}
}
if (!dirty) {
Com_sprintf( uiInfo.q3HeadNames[uiInfo.q3HeadCount], sizeof(uiInfo.q3HeadNames[uiInfo.q3HeadCount]), scratch);
uiInfo.q3HeadIcons[uiInfo.q3HeadCount++] = trap_R_RegisterShaderNoMip(va("models/players/%s/%s",dirptr,skinname));
}
uiInfo.q3HeadIcons[uiInfo.q3HeadCount++] = trap_R_RegisterShaderNoMip(va("models/players/%s/%s",dirptr,skinname));
}
}
@ -4979,7 +5228,7 @@ void _UI_Init( qboolean inGameLoad ) {
#if 0
if (uiInfo.inGameLoad) {
UI_LoadMenus("ui/ingame.txt", qtrue);
} else {
} else { // bk010222: left this: UI_LoadMenus(menuSet, qtrue);
}
#else
UI_LoadMenus(menuSet, qtrue);
@ -4989,13 +5238,13 @@ void _UI_Init( qboolean inGameLoad ) {
Menus_CloseAll();
trap_LAN_LoadCachedServers();
UI_LoadBestScores(uiInfo.mapList[0].mapLoadName, uiInfo.gameTypes[ui_gameType.integer].gtEnum);
UI_LoadBestScores(uiInfo.mapList[ui_currentMap.integer].mapLoadName, uiInfo.gameTypes[ui_gameType.integer].gtEnum);
UI_BuildQ3Model_List();
UI_LoadBots();
// sets defaults for ui temp cvars
uiInfo.effectsColor = gamecodetoui[(int)trap_Cvar_VariableValue("color")-1];
uiInfo.effectsColor = gamecodetoui[(int)trap_Cvar_VariableValue("color1")-1];
uiInfo.currentCrosshair = (int)trap_Cvar_VariableValue("cg_drawCrosshair");
trap_Cvar_Set("ui_mousePitch", (trap_Cvar_VariableValue("m_pitch") >= 0) ? "0" : "1");
@ -5009,6 +5258,8 @@ void _UI_Init( qboolean inGameLoad ) {
}
trap_Cvar_Register(NULL, "debug_protocol", "", 0 );
trap_Cvar_Set("ui_actualNetGameType", va("%d", ui_netGameType.integer));
}
@ -5144,6 +5395,13 @@ void _UI_SetActiveMenu( uiMenuCommand_t menu ) {
Menus_CloseAll();
Menus_ActivateByName("ingame");
return;
case UIMENU_RQ3_WEAPON:
trap_Cvar_Set( "cl_paused", "1" );
trap_Key_SetCatcher( KEYCATCH_UI );
UI_BuildPlayerList();
Menus_CloseAll();
Menus_ActivateByName("ingame_weapon");
return;
}
}
}
@ -5212,8 +5470,8 @@ static void UI_DisplayDownloadInfo( const char *downloadName, float centerPoint,
UI_SetColor(colorWhite);
Text_PaintCenter(centerPoint, yStart + 112, scale, colorWhite, dlText, 0);
Text_PaintCenter(centerPoint, yStart + 144, scale, colorWhite, etaText, 0);
Text_PaintCenter(centerPoint, yStart + 208, scale, colorWhite, xferText, 0);
Text_PaintCenter(centerPoint, yStart + 192, scale, colorWhite, etaText, 0);
Text_PaintCenter(centerPoint, yStart + 248, scale, colorWhite, xferText, 0);
if (downloadSize > 0) {
s = va( "%s (%d%%)", downloadName, downloadCount * 100 / downloadSize );
@ -5221,14 +5479,14 @@ static void UI_DisplayDownloadInfo( const char *downloadName, float centerPoint,
s = downloadName;
}
Text_Paint(centerPoint, yStart + 244, 0.6f, colorWhite, s, 0, 0, ITEM_TEXTSTYLE_SHADOWEDMORE);
Text_PaintCenter(centerPoint, yStart+136, scale, colorWhite, s, 0);
UI_ReadableSize( dlSizeBuf, sizeof dlSizeBuf, downloadCount );
UI_ReadableSize( totalSizeBuf, sizeof totalSizeBuf, downloadSize );
if (downloadCount < 4096 || !downloadTime) {
Text_PaintCenter(leftWidth, 160, 0.6f, colorWhite, "estimating", 0);
Text_PaintCenter(leftWidth, 192, 0.6f, colorWhite, va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), 0);
Text_PaintCenter(leftWidth, yStart+216, scale, colorWhite, "estimating", 0);
Text_PaintCenter(leftWidth, yStart+160, scale, colorWhite, va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), 0);
} else {
if ((uiInfo.uiDC.realTime - downloadTime) / 1000) {
xferRate = downloadCount / ((uiInfo.uiDC.realTime - downloadTime) / 1000);
@ -5245,19 +5503,19 @@ static void UI_DisplayDownloadInfo( const char *downloadName, float centerPoint,
UI_PrintTime ( dlTimeBuf, sizeof dlTimeBuf,
(n - (((downloadCount/1024) * n) / (downloadSize/1024))) * 1000);
Text_PaintCenter(leftWidth, 160, 0.6f, colorWhite, dlTimeBuf, 0);
Text_PaintCenter(leftWidth, 192, 0.6f, colorWhite, va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), 0);
Text_PaintCenter(leftWidth, yStart+216, scale, colorWhite, dlTimeBuf, 0);
Text_PaintCenter(leftWidth, yStart+160, scale, colorWhite, va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), 0);
} else {
Text_PaintCenter(leftWidth, 160, 0.6f, colorWhite, "estimating", 0);
Text_PaintCenter(leftWidth, yStart+216, scale, colorWhite, "estimating", 0);
if (downloadSize) {
Text_PaintCenter(leftWidth, 160, 0.6f, colorWhite, va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), 0);
Text_PaintCenter(leftWidth, yStart+160, scale, colorWhite, va("(%s of %s copied)", dlSizeBuf, totalSizeBuf), 0);
} else {
Text_PaintCenter(leftWidth, 160, 0.6f, colorWhite, va("(%s copied)", dlSizeBuf), 0);
Text_PaintCenter(leftWidth, yStart+160, scale, colorWhite, va("(%s copied)", dlSizeBuf), 0);
}
}
if (xferRate) {
Text_PaintCenter(leftWidth, 160, 0.6f, colorWhite, va("%s/Sec", xferRateBuf), 0);
Text_PaintCenter(leftWidth, yStart+272, scale, colorWhite, va("%s/Sec", xferRateBuf), 0);
}
}
}
@ -5489,9 +5747,12 @@ vmCvar_t ui_recordSPDemo;
vmCvar_t ui_realCaptureLimit;
vmCvar_t ui_realWarmUp;
vmCvar_t ui_serverStatusTimeOut;
//Makro - cvar for player model display
vmCvar_t ui_RQ3_model_command;
cvarTable_t cvarTable[] = {
// bk001129 - made static to avoid aliasing
static cvarTable_t cvarTable[] = {
{ &ui_ffa_fraglimit, "ui_ffa_fraglimit", "20", CVAR_ARCHIVE },
{ &ui_ffa_timelimit, "ui_ffa_timelimit", "0", CVAR_ARCHIVE },
@ -5558,7 +5819,7 @@ cvarTable_t cvarTable[] = {
{ &ui_gameType, "ui_gametype", "3", CVAR_ARCHIVE },
{ &ui_joinGameType, "ui_joinGametype", "0", CVAR_ARCHIVE },
{ &ui_netGameType, "ui_netGametype", "3", CVAR_ARCHIVE },
{ &ui_actualNetGameType, "ui_actualNetGametype", "0", CVAR_ARCHIVE },
{ &ui_actualNetGameType, "ui_actualNetGametype", "3", CVAR_ARCHIVE },
{ &ui_redteam1, "ui_redteam1", "0", CVAR_ARCHIVE },
{ &ui_redteam2, "ui_redteam2", "0", CVAR_ARCHIVE },
{ &ui_redteam3, "ui_redteam3", "0", CVAR_ARCHIVE },
@ -5610,10 +5871,13 @@ cvarTable_t cvarTable[] = {
{ &ui_realWarmUp, "g_warmup", "20", CVAR_ARCHIVE},
{ &ui_realCaptureLimit, "capturelimit", "8", CVAR_SERVERINFO | CVAR_ARCHIVE | CVAR_NORESTART},
{ &ui_serverStatusTimeOut, "ui_serverStatusTimeOut", "7000", CVAR_ARCHIVE},
//Makro - cvar for player model display
{ &ui_RQ3_model_command, "ui_RQ3_model_command", "0", CVAR_ARCHIVE},
};
int cvarTableSize = sizeof(cvarTable) / sizeof(cvarTable[0]);
// bk001129 - made static to avoid aliasing
static int cvarTableSize = sizeof(cvarTable) / sizeof(cvarTable[0]);
/*
@ -5676,6 +5940,7 @@ static void UI_StopServerRefresh( void )
ArenaServers_MaxPing
=================
*/
#ifndef MISSIONPACK // bk001206
static int ArenaServers_MaxPing( void ) {
int maxPing;
@ -5685,6 +5950,7 @@ static int ArenaServers_MaxPing( void ) {
}
return maxPing;
}
#endif
/*
=================

View file

@ -1,15 +1,3 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2002/02/10 02:36:52 jbravo
// Adding ta_ui files from Makro into CVS
//
//
//-----------------------------------------------------------------------------
// Copyright (C) 1999-2000 Id Software, Inc.
//
// ui_players.c
@ -62,119 +50,78 @@ tryagain:
if ( item->giType != IT_WEAPON ) {
continue;
}
if ( item->giTag == weaponNum ) {
break;
}
}
if ( item->classname ) {
pi->weaponModel = trap_R_RegisterModel( item->world_model[0] );
}
if( pi->weaponModel == 0 ) {
//Makro - changed to WP_PISTOL from WP_MACHINEGUN
//Blaze: Changed from WP_MACHINEGUN to WP_PISTOL
if( weaponNum == WP_PISTOL ) {
weaponNum = WP_NONE;
goto tryagain;
}
//Makro - changed to WP_PISTOL from WP_MACHINEGUN
//Blaze: Changed from WP_MACHINEGUN to WP_PISTOL
weaponNum = WP_PISTOL;
goto tryagain;
}
/* Makro - old check:
if ( weaponNum == WP_MACHINEGUN || weaponNum == WP_GAUNTLET || weaponNum == WP_BFG ) {
*/
if ( weaponNum == WP_PISTOL ) {
//Blaze: none of our weapons have barrel models
/*if ( weaponNum == WP_PISTOL || weaponNum == WP_GAUNTLET || weaponNum == WP_BFG ) {
strcpy( path, item->world_model[0] );
COM_StripExtension( path, path );
strcat( path, "_barrel.md3" );
pi->barrelModel = trap_R_RegisterModel( path );
}
}*/
strcpy( path, item->world_model[0] );
COM_StripExtension( path, path );
strcat( path, "_flash.md3" );
pi->flashModel = trap_R_RegisterModel( path );
//Blaze: I think this makes some funky colors or something, I dont really know ;)
//Blaze: Reaction Weapons
switch( weaponNum ) {
/* Makro - removed and replaced with rq3 weapons
case WP_GAUNTLET:
case WP_KNIFE:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
break;
case WP_MACHINEGUN:
case WP_PISTOL:
MAKERGB( pi->flashDlightColor, 1, 1, 0 );
break;
case WP_SHOTGUN:
case WP_M4:
MAKERGB( pi->flashDlightColor, 1, 1, 0 );
break;
case WP_GRENADE_LAUNCHER:
case WP_SSG3000:
MAKERGB( pi->flashDlightColor, 1, 0.7f, 0.5f );
break;
case WP_ROCKET_LAUNCHER:
MAKERGB( pi->flashDlightColor, 1, 0.75f, 0 );
break;
case WP_LIGHTNING:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
break;
case WP_RAILGUN:
MAKERGB( pi->flashDlightColor, 1, 0.5f, 0 );
break;
case WP_PLASMAGUN:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
break;
case WP_BFG:
MAKERGB( pi->flashDlightColor, 1, 0.7f, 1 );
break;
case WP_GRAPPLING_HOOK:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
break;
*/
case WP_PISTOL:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
break;
case WP_M3:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
break;
case WP_MP5:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
MAKERGB( pi->flashDlightColor, 1, 0.75f, 0 );
break;
case WP_HANDCANNON:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
break;
case WP_SSG3000:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
break;
case WP_M4:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
case WP_M3:
MAKERGB( pi->flashDlightColor, 1, 0.5f, 0 );
break;
case WP_AKIMBO:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
break;
case WP_KNIFE:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
case WP_GRENADE:
MAKERGB( pi->flashDlightColor, 1, 0.7f, 1 );
break;
case WP_GRENADE:
MAKERGB( pi->flashDlightColor, 0.6f, 0.6f, 1 );
break;
default:
MAKERGB( pi->flashDlightColor, 1, 1, 1 );
break;
@ -728,7 +675,8 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti
refEntity_t torso;
refEntity_t head;
refEntity_t gun;
refEntity_t barrel;
//Makro - barrel is no longer used
//refEntity_t barrel;
refEntity_t flash;
vec3_t origin;
int renderfx;
@ -779,7 +727,7 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti
refdef.fov_x = (int)((float)refdef.width / 640.0f * 90.0f);
xx = refdef.width / tan( refdef.fov_x / 360 * M_PI );
refdef.fov_y = atan2( refdef.height, xx );
refdef.fov_y *= ( 360 / M_PI );
refdef.fov_y *= ( 360 / (float)M_PI );
// calculate distance so the player nearly fills the box
len = 0.7 * ( maxs[2] - mins[2] );
@ -868,7 +816,8 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti
//
// add the spinning barrel
//
/* Makro - removed this - do we need a spinning barrel ?!
//Blaze: No spinning barrels in rq3
/*
if ( pi->realWeapon == WP_MACHINEGUN || pi->realWeapon == WP_GAUNTLET || pi->realWeapon == WP_BFG ) {
vec3_t angles;
@ -890,7 +839,7 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti
trap_R_AddRefEntityToScene( &barrel );
}
*/
*/
//
// add muzzle flash
@ -935,6 +884,72 @@ void UI_DrawPlayer( float x, float y, float w, float h, playerInfo_t *pi, int ti
trap_R_RenderScene( &refdef );
}
/*
==========================
UI_FileExists
==========================
*/
static qboolean UI_FileExists(const char *filename) {
int len;
len = trap_FS_FOpenFile( filename, 0, FS_READ );
if (len>0) {
return qtrue;
}
return qfalse;
}
/*
==========================
UI_FindClientHeadFile
==========================
*/
static qboolean UI_FindClientHeadFile( char *filename, int length, const char *teamName, const char *headModelName, const char *headSkinName, const char *base, const char *ext ) {
char *team, *headsFolder;
int i;
team = "default";
if ( headModelName[0] == '*' ) {
headsFolder = "heads/";
headModelName++;
}
else {
headsFolder = "";
}
while(1) {
for ( i = 0; i < 2; i++ ) {
if ( i == 0 && teamName && *teamName ) {
Com_sprintf( filename, length, "models/players/%s%s/%s/%s%s_%s.%s", headsFolder, headModelName, headSkinName, teamName, base, team, ext );
}
else {
Com_sprintf( filename, length, "models/players/%s%s/%s/%s_%s.%s", headsFolder, headModelName, headSkinName, base, team, ext );
}
if ( UI_FileExists( filename ) ) {
return qtrue;
}
if ( i == 0 && teamName && *teamName ) {
Com_sprintf( filename, length, "models/players/%s%s/%s%s_%s.%s", headsFolder, headModelName, teamName, base, headSkinName, ext );
}
else {
Com_sprintf( filename, length, "models/players/%s%s/%s_%s.%s", headsFolder, headModelName, base, headSkinName, ext );
}
if ( UI_FileExists( filename ) ) {
return qtrue;
}
if ( !teamName || !*teamName ) {
break;
}
}
// if tried the heads folder first
if ( headsFolder[0] ) {
break;
}
headsFolder = "heads/";
}
return qfalse;
}
/*
==========================
@ -942,7 +957,7 @@ UI_RegisterClientSkin
==========================
*/
static qboolean UI_RegisterClientSkin( playerInfo_t *pi, const char *modelName, const char *skinName, const char *headModelName, const char *headSkinName , const char *teamName) {
char filename[MAX_QPATH];
char filename[MAX_QPATH*2];
if (teamName && *teamName) {
Com_sprintf( filename, sizeof( filename ), "models/players/%s/%s/lower_%s.skin", modelName, teamName, skinName );
@ -950,6 +965,14 @@ static qboolean UI_RegisterClientSkin( playerInfo_t *pi, const char *modelName,
Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower_%s.skin", modelName, skinName );
}
pi->legsSkin = trap_R_RegisterSkin( filename );
if (!pi->legsSkin) {
if (teamName && *teamName) {
Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/%s/lower_%s.skin", modelName, teamName, skinName );
} else {
Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/lower_%s.skin", modelName, skinName );
}
pi->legsSkin = trap_R_RegisterSkin( filename );
}
if (teamName && *teamName) {
Com_sprintf( filename, sizeof( filename ), "models/players/%s/%s/upper_%s.skin", modelName, teamName, skinName );
@ -957,20 +980,16 @@ static qboolean UI_RegisterClientSkin( playerInfo_t *pi, const char *modelName,
Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper_%s.skin", modelName, skinName );
}
pi->torsoSkin = trap_R_RegisterSkin( filename );
if( headModelName[0] == '*' ) {
Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/head_%s.skin", &headModelName[1], headSkinName );
} else {
if (!pi->torsoSkin) {
if (teamName && *teamName) {
Com_sprintf( filename, sizeof( filename ), "models/players/%s/%s/head_%s.skin", headModelName, teamName, headSkinName );
Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/%s/upper_%s.skin", modelName, teamName, skinName );
} else {
Com_sprintf( filename, sizeof( filename ), "models/players/%s/head_%s.skin", headModelName, headSkinName );
Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/upper_%s.skin", modelName, skinName );
}
pi->torsoSkin = trap_R_RegisterSkin( filename );
}
pi->headSkin = trap_R_RegisterSkin( filename );
if ( !pi->headSkin && headModelName[0] != '*' ) {
Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/head_%s.skin", headModelName, headSkinName );
if ( UI_FindClientHeadFile( filename, sizeof(filename), teamName, headModelName, headSkinName, "head", "skin" ) ) {
pi->headSkin = trap_R_RegisterSkin( filename );
}
@ -1104,18 +1123,18 @@ static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animat
return qtrue;
}
/*
==========================
UI_RegisterClientModelname
==========================
*/
qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName, const char *headName, const char *teamName ) {
qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName, const char *headModelSkinName, const char *teamName ) {
char modelName[MAX_QPATH];
char headModelName[MAX_QPATH];
char skinName[MAX_QPATH];
char headModelName[MAX_QPATH];
char headSkinName[MAX_QPATH];
char filename[MAX_QPATH];
char *slash, *headslash;
char *slash;
pi->torsoModel = 0;
pi->headModel = 0;
@ -1125,7 +1144,6 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName
}
Q_strncpyz( modelName, modelSkinName, sizeof( modelName ) );
Q_strncpyz( headModelName, headName, sizeof( headModelName ) );
slash = strchr( modelName, '/' );
if ( !slash ) {
@ -1133,13 +1151,17 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName
Q_strncpyz( skinName, "default", sizeof( skinName ) );
} else {
Q_strncpyz( skinName, slash + 1, sizeof( skinName ) );
// truncate modelName
*slash = 0;
*slash = '\0';
}
headslash = strchr( headModelName, '/' );
if ( headslash ) {
*headslash = 0;
Q_strncpyz( headModelName, headModelSkinName, sizeof( headModelName ) );
slash = strchr( headModelName, '/' );
if ( !slash ) {
// modelName did not include a skin name
Q_strncpyz( headSkinName, "default", sizeof( skinName ) );
} else {
Q_strncpyz( headSkinName, slash + 1, sizeof( skinName ) );
*slash = '\0';
}
// load cmodels before models so filecache works
@ -1147,37 +1169,45 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName
Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower.md3", modelName );
pi->legsModel = trap_R_RegisterModel( filename );
if ( !pi->legsModel ) {
Com_Printf( "Failed to load model file %s\n", filename );
return qfalse;
Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/lower.md3", modelName );
pi->legsModel = trap_R_RegisterModel( filename );
if ( !pi->legsModel ) {
Com_Printf( "Failed to load model file %s\n", filename );
return qfalse;
}
}
Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper.md3", modelName );
pi->torsoModel = trap_R_RegisterModel( filename );
if ( !pi->torsoModel ) {
Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/upper.md3", modelName );
pi->torsoModel = trap_R_RegisterModel( filename );
if ( !pi->torsoModel ) {
Com_Printf( "Failed to load model file %s\n", filename );
return qfalse;
}
}
if (headModelName && headModelName[0] == '*' ) {
Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", &headModelName[1], &headModelName[1] );
}
else {
Com_sprintf( filename, sizeof( filename ), "models/players/%s/head.md3", headModelName );
}
pi->headModel = trap_R_RegisterModel( filename );
if ( !pi->headModel && headModelName[0] != '*') {
Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", headModelName, headModelName );
pi->headModel = trap_R_RegisterModel( filename );
}
if (!pi->headModel) {
Com_Printf( "Failed to load model file %s\n", filename );
return qfalse;
}
if (headName && headName[0] == '*' ) {
Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", &headName[1], &headName[1] );
}
else {
Com_sprintf( filename, sizeof( filename ), "models/players/%s/head.md3", headModelName );
}
pi->headModel = trap_R_RegisterModel( filename );
if ( !pi->headModel && headName[0] != '*') {
Com_sprintf( filename, sizeof( filename ), "models/players/heads/%s/%s.md3", headName, headName );
pi->headModel = trap_R_RegisterModel( filename );
}
if (!pi->headModel) {
Com_Printf( "Failed to load model file %s\n", filename );
return qfalse;
}
// if any skins failed to load, fall back to default
if ( !UI_RegisterClientSkin( pi, modelName, skinName, headModelName, skinName, teamName) ) {
if ( !UI_RegisterClientSkin( pi, modelName, "default", headName, "default", teamName ) ) {
if ( !UI_RegisterClientSkin( pi, modelName, skinName, headModelName, headSkinName, teamName) ) {
if ( !UI_RegisterClientSkin( pi, modelName, "default", headModelName, "default", teamName ) ) {
Com_Printf( "Failed to load skin file: %s : %s\n", modelName, skinName );
return qfalse;
}
@ -1186,8 +1216,11 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName
// load the animations
Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName );
if ( !UI_ParseAnimationFile( filename, pi->animations ) ) {
Com_Printf( "Failed to load animation file %s\n", filename );
return qfalse;
Com_sprintf( filename, sizeof( filename ), "models/players/characters/%s/animation.cfg", modelName );
if ( !UI_ParseAnimationFile( filename, pi->animations ) ) {
Com_Printf( "Failed to load animation file %s\n", filename );
return qfalse;
}
}
return qtrue;
@ -1202,7 +1235,7 @@ UI_PlayerInfo_SetModel
void UI_PlayerInfo_SetModel( playerInfo_t *pi, const char *model, const char *headmodel, char *teamName ) {
memset( pi, 0, sizeof(*pi) );
UI_RegisterClientModelname( pi, model, headmodel, teamName );
//Makro - changed WP_MACHINEGUN to WP_PISTOL
//Blaze: Changed from WP_MACHINEGUN to WP_PISTOL
pi->weapon = WP_PISTOL;
pi->currentWeapon = pi->weapon;
pi->lastWeapon = pi->weapon;
@ -1296,8 +1329,8 @@ void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_
}
// torso animation
//Makro - changed WP_GAUNTLET to WP_KNIFE
if ( torsoAnim == TORSO_STAND || torsoAnim == TORSO_STAND2 ) {
//Changed from WP_GAUNTLET to WP_KNIFE
if ( weaponNum == WP_NONE || weaponNum == WP_KNIFE ) {
torsoAnim = TORSO_STAND2;
}
@ -1306,8 +1339,8 @@ void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int legsAnim, int torsoAnim, vec3_
}
}
//Makro - changed WP_GAUNTLET to WP_KNIFE
if ( torsoAnim == TORSO_ATTACK || torsoAnim == TORSO_ATTACK2 ) {
//Changed from WP_GAUNTLET to WP_KNIFE
if ( weaponNum == WP_NONE || weaponNum == WP_KNIFE ) {
torsoAnim = TORSO_ATTACK2;
}

View file

@ -1,15 +1,3 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2002/02/10 02:36:52 jbravo
// Adding ta_ui files from Makro into CVS
//
//
//-----------------------------------------------------------------------------
// Copyright (C) 1999-2000 Id Software, Inc.
//
#ifndef __UI_PUBLIC_H__
@ -132,7 +120,9 @@ typedef enum {
UIMENU_NEED_CD,
UIMENU_BAD_CD_KEY,
UIMENU_TEAM,
UIMENU_POSTGAME
UIMENU_POSTGAME,
//Makro - added weapon menu
UIMENU_RQ3_WEAPON
} uiMenuCommand_t;
#define SORT_HOST 0

View file

@ -1,15 +1,3 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2002/02/10 02:36:52 jbravo
// Adding ta_ui files from Makro into CVS
//
//
//-----------------------------------------------------------------------------
//
// string allocation/managment
@ -31,6 +19,55 @@ typedef struct scrollInfo_s {
qboolean scrollDir;
} scrollInfo_t;
//Makro - data for the shortcut keys
typedef struct {
char *Name;
int Value;
} RQ3_keyAlias_t;
static RQ3_keyAlias_t RQ3_KeyAliases[] =
{
{"0", '0'},
{"1", '1'},
{"2", '2'},
{"3", '3'},
{"4", '4'},
{"5", '5'},
{"6", '6'},
{"7", '7'},
{"8", '8'},
{"9", '9'},
{"A", 'a'},
{"B", 'b'},
{"C", 'c'},
{"D", 'd'},
{"E", 'e'},
{"F", 'f'},
{"G", 'g'},
{"H", 'h'},
{"I", 'i'},
{"J", 'j'},
{"K", 'k'},
{"L", 'l'},
{"M", 'm'},
{"N", 'n'},
{"O", 'o'},
{"P", 'p'},
{"Q", 'q'},
{"R", 'r'},
{"S", 's'},
{"T", 't'},
{"U", 'u'},
{"V", 'v'},
{"W", 'w'},
{"X", 'x'},
{"Y", 'y'},
{"Z", 'z'},
{"", K_LAST_KEY}
};
static scrollInfo_t scrollInfo;
static void (*captureFunc) (void *p) = NULL;
@ -525,7 +562,7 @@ qboolean PC_Script_Parse(int handle, const char **out) {
}
Q_strcat(script, 1024, " ");
}
//return qfalse;
return qfalse; // bk001105 - LCC missing return value
}
// display, window, menu, item code
@ -1316,12 +1353,15 @@ qboolean Item_SetFocus(itemDef_t *item, float x, float y) {
itemDef_t *oldFocus;
sfxHandle_t *sfx = &DC->Assets.itemFocusSound;
qboolean playSound = qfalse;
menuDef_t *parent = (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
if (item == NULL || item->window.flags & WINDOW_DECORATION || item->window.flags & WINDOW_HASFOCUS || !(item->window.flags & WINDOW_VISIBLE)) {
return qfalse;
}
// bk001206 - this can be NULL.
parent = (menuDef_t*)item->parent;
// items can be enabled and disabled based on cvars
if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) {
return qfalse;
@ -2345,7 +2385,8 @@ qboolean Item_HandleKey(itemDef_t *item, int key, qboolean down) {
captureFunc = NULL;
captureData = NULL;
} else {
if (down && key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3) {
// bk001206 - parentheses
if ( down && ( key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3 ) ) {
Item_StartCapture(item, key);
}
}
@ -2560,6 +2601,34 @@ static rectDef_t *Item_CorrectedTextRect(itemDef_t *item) {
return &rect;
}
//Makro - for shortcut keys
int UI_RQ3_KeyNumFromChar( const char *keystr ) {
int i;
for (i = 0; RQ3_KeyAliases[i].Value != K_LAST_KEY; i++) {
if (Q_stricmp(RQ3_KeyAliases[i].Name, keystr) == 0)
return RQ3_KeyAliases[i].Value;
}
return K_LAST_KEY;
}
//Makro - search for items that have shortcuts
qboolean RQ3_TriggerShortcut(menuDef_t *menu, int key) {
int i;
if (menu == NULL) {
return qfalse;
}
for (i = 0; i < menu->itemCount; i++) {
if ( UI_RQ3_KeyNumFromChar(menu->items[i]->window.shortcutKey) == key ) {
Item_Action(menu->items[i]);
return qtrue;
}
}
return qfalse;
}
void Menu_HandleKey(menuDef_t *menu, int key, qboolean down) {
int i;
itemDef_t *item = NULL;
@ -2599,7 +2668,8 @@ void Menu_HandleKey(menuDef_t *menu, int key, qboolean down) {
// see if the mouse is within the window bounds and if so is this a mouse click
if (down && !(menu->window.flags & WINDOW_POPUP) && !Rect_ContainsPoint(&menu->window.rect, DC->cursorx, DC->cursory)) {
static qboolean inHandleKey = qfalse;
if (!inHandleKey && key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3) {
// bk001206 - parentheses
if (!inHandleKey && ( key == K_MOUSE1 || key == K_MOUSE2 || key == K_MOUSE3 ) ) {
inHandleKey = qtrue;
Menus_HandleOOBClick(menu, key, down);
inHandleKey = qfalse;
@ -2628,6 +2698,11 @@ void Menu_HandleKey(menuDef_t *menu, int key, qboolean down) {
return;
}
//Makro - check for shortcuts
if (RQ3_TriggerShortcut(menu, key)) {
return;
}
// default handling
switch ( key ) {
@ -3101,79 +3176,59 @@ typedef struct
static bind_t g_bindings[] =
{
{"+scores", K_TAB, -1, -1, -1},
{"+button2", K_ENTER, -1, -1, -1},
{"+speed", K_SHIFT, -1, -1, -1},
{"+forward", K_UPARROW, -1, -1, -1},
{"+back", K_DOWNARROW, -1, -1, -1},
{"+moveleft", ',', -1, -1, -1},
{"+moveright", '.', -1, -1, -1},
{"+moveup", K_SPACE, -1, -1, -1},
{"+movedown", 'c', -1, -1, -1},
{"+left", K_LEFTARROW, -1, -1, -1},
{"+right", K_RIGHTARROW, -1, -1, -1},
{"+strafe", K_ALT, -1, -1, -1},
{"+lookup", K_PGDN, -1, -1, -1},
{"+lookdown", K_DEL, -1, -1, -1},
{"+mlook", '/', -1, -1, -1},
{"centerview", K_END, -1, -1, -1},
{"+zoom", -1, -1, -1, -1},
{"weapon 1", '1', -1, -1, -1},
{"weapon 2", '2', -1, -1, -1},
{"weapon 3", '3', -1, -1, -1},
{"weapon 4", '4', -1, -1, -1},
{"weapon 5", '5', -1, -1, -1},
{"weapon 6", '6', -1, -1, -1},
{"weapon 7", '7', -1, -1, -1},
{"weapon 8", '8', -1, -1, -1},
{"weapon 9", '9', -1, -1, -1},
{"weapon 10", '0', -1, -1, -1},
{"weapon 11", -1, -1, -1, -1},
{"weapon 12", -1, -1, -1, -1},
{"weapon 13", -1, -1, -1, -1},
{"+attack", K_CTRL, -1, -1, -1},
{"weapprev", '[', -1, -1, -1},
{"weapnext", ']', -1, -1, -1},
{"+button3", K_MOUSE3, -1, -1, -1},
{"prevTeamMember", 'w', -1, -1, -1},
{"nextTeamMember", 'r', -1, -1, -1},
{"nextOrder", 't', -1, -1, -1},
{"confirmOrder", 'y', -1, -1, -1},
{"denyOrder", 'n', -1, -1, -1},
{"taskOffense", 'o', -1, -1, -1},
{"taskDefense", 'd', -1, -1, -1},
{"taskPatrol", 'p', -1, -1, -1},
{"taskCamp", 'c', -1, -1, -1},
{"taskFollow", 'f', -1, -1, -1},
{"taskRetrieve", 'v', -1, -1, -1},
{"taskEscort", 'e', -1, -1, -1},
{"taskOwnFlag", 'i', -1, -1, -1},
{"taskSuicide", 'k', -1, -1, -1},
{"tauntKillInsult", K_F1, -1, -1, -1},
{"tauntPraise", K_F2, -1, -1, -1},
{"tauntTaunt", K_F3, -1, -1, -1},
{"tauntDeathInsult", K_F4, -1, -1, -1},
{"tauntGauntlet", K_F5, -1, -1, -1},
{"scoresUp", K_KP_PGUP, -1, -1, -1},
{"scoresDown", K_KP_PGDN, -1, -1, -1},
{"messagemode", '-1', -1, -1, -1},
{"messagemode2", -1, -1, -1, -1},
{"messagemode3", -1, -1, -1, -1},
{"messagemode4", -1, -1, -1, -1},
//Makro - added RQ3 stuff
{"bandage", -1, -1, -1, -1},
{"opendoor", -1, -1, -1, -1},
{"+button5", -1, -1, -1, -1},
{"specialweapon", -1, -1, -1, -1},
{"weapon", -1, -1, -1, -1},
{"dropweapon", -1, -1, -1, -1},
{"dropitem", -1, -1, -1, -1},
{"irvision", -1, -1, -1, -1}
{"+scores", K_TAB, -1, -1, -1},
{"+button2", K_ENTER, -1, -1, -1},
{"+speed", K_SHIFT, -1, -1, -1},
{"+forward", K_UPARROW, -1, -1, -1},
{"+back", K_DOWNARROW, -1, -1, -1},
{"+moveleft", ',', -1, -1, -1},
{"+moveright", '.', -1, -1, -1},
{"+moveup", K_SPACE, -1, -1, -1},
{"+movedown", 'c', -1, -1, -1},
{"+left", K_LEFTARROW, -1, -1, -1},
{"+right", K_RIGHTARROW, -1, -1, -1},
{"+strafe", K_ALT, -1, -1, -1},
{"+lookup", K_PGDN, -1, -1, -1},
{"+lookdown", K_DEL, -1, -1, -1},
{"+mlook", '/', -1, -1, -1},
{"centerview", K_END, -1, -1, -1},
{"+zoom", -1, -1, -1, -1},
//Blaze: Reaction Weapon binds
//Jbravo: order is important.
{"weapon 1", '1', -1, -1, -1},
{"weapon 2", '2', -1, -1, -1},
{"weapon 3", '3', -1, -1, -1},
{"weapon 4", '4', -1, -1, -1},
{"weapon 5", '5', -1, -1, -1},
{"weapon 6", '6', -1, -1, -1},
{"weapon 7", '7', -1, -1, -1},
{"weapon 8", '8', -1, -1, -1},
{"weapon 9", '9', -1, -1, -1},
{"+attack", K_CTRL, -1, -1, -1},
{"weapprev", '[', -1, -1, -1},
{"weapnext", ']', -1, -1, -1},
{"+button3", K_MOUSE3, -1, -1, -1},
{"messagemode", 't', -1, -1, -1},
{"messagemode2", -1, -1, -1, -1},
{"messagemode3", -1, -1, -1, -1},
{"messagemode4", -1, -1, -1, -1},
{"bandage", -1, -1, -1, -1},
{"+button5", -1, -1, -1, -1},
{"weapon", -1, -1, -1, -1},
{"opendoor", -1, -1, -1, -1},
{"dropweapon", -1, -1, -1, -1},
{"dropitem", -1, -1, -1, -1},
{"irvision", -1, -1, -1, -1},
//Makro - this one was missing
{"specialweapon", -1, -1, -1, -1},
//Makro - for the weapon/item menus
{"ui_RQ3_loadout", -1, -1, -1, -1}
};
static const int g_bindCount = sizeof(g_bindings) / sizeof(bind_t);
#ifndef MISSIONPACK // bk001206
static configcvar_t g_configcvars[] =
{
{"cl_run", 0, 0},
@ -3186,6 +3241,7 @@ static configcvar_t g_configcvars[] =
{"cl_freelook", 0, 0},
{NULL, 0, 0}
};
#endif
/*
=================
@ -3567,6 +3623,7 @@ void Item_Model_Paint(itemDef_t *item) {
origin[1] = 0.5 * ( mins[1] + maxs[1] );
// calculate distance so the model nearly fills the box
// Makro - note - this doesn't seem right to me
if (qtrue) {
float len = 0.5 * ( maxs[2] - mins[2] );
origin[0] = len / 0.268; // len / tan( fov/2 )
@ -3575,7 +3632,7 @@ void Item_Model_Paint(itemDef_t *item) {
origin[0] = item->textscale;
}
refdef.fov_x = (modelPtr->fov_x) ? modelPtr->fov_x : w;
refdef.fov_x = (modelPtr->fov_y) ? modelPtr->fov_y : h;
refdef.fov_y = (modelPtr->fov_y) ? modelPtr->fov_y : h;
//refdef.fov_x = (int)((float)refdef.width / 640.0f * 90.0f);
//xx = refdef.width / tan( refdef.fov_x / 360 * M_PI );
@ -3598,12 +3655,23 @@ void Item_Model_Paint(itemDef_t *item) {
if (modelPtr->rotationSpeed) {
if (DC->realTime > item->window.nextTime) {
item->window.nextTime = DC->realTime + modelPtr->rotationSpeed;
modelPtr->angle = (int)(modelPtr->angle + 1) % 360;
//Makro - now we're using 3 angles, not jsut one
//modelPtr->angle = (int)(modelPtr->angle + 1) % 360;
modelPtr->angles[0] = (int)(modelPtr->angles[0] + 1) % 360;
}
}
VectorSet( angles, 0, modelPtr->angle, 0 );
//Makro - now we're using 3 angles, not jsut one
//VectorSet( angles, 0, modelPtr->angle, 0 );
angles[YAW] = modelPtr->angles[0];
angles[PITCH] = modelPtr->angles[1];
angles[ROLL] = modelPtr->angles[2];
AnglesToAxis( angles, ent.axis );
//Makro - maybe this will fix the origin bug (model_origin not being taken into account)
origin[0] += modelPtr->origin[0];
origin[1] += modelPtr->origin[1];
origin[2] += modelPtr->origin[2];
ent.hModel = item->asset;
VectorCopy( origin, ent.origin );
VectorCopy( origin, ent.lightingOrigin );
@ -3816,7 +3884,7 @@ void Item_OwnerDraw_Paint(itemDef_t *item) {
}
if (item->cvarFlags & (CVAR_ENABLE | CVAR_DISABLE) && !Item_EnableShowViaCvar(item, CVAR_ENABLE)) {
memcpy(color, parent->disableColor, sizeof(vec4_t));
memcpy(color, parent->disableColor, sizeof(vec4_t)); // bk001207 - FIXME: Com_Memcpy
}
if (item->text) {
@ -4349,6 +4417,15 @@ qboolean ItemParse_name( itemDef_t *item, int handle ) {
return qtrue;
}
// Makro - shortcutKey <key>
qboolean ItemParse_shortcutKey( itemDef_t *item, int handle ) {
if (!PC_String_Parse(handle, &item->window.shortcutKey)) {
return qfalse;
}
//Com_Printf(S_COLOR_BLUE "^4MDEBUG: Shortcut key read: %s\n^7", item->window.shortcutKey);
return qtrue;
}
// name <string>
qboolean ItemParse_focusSound( itemDef_t *item, int handle ) {
const char *temp;
@ -4387,7 +4464,9 @@ qboolean ItemParse_asset_model( itemDef_t *item, int handle ) {
return qfalse;
}
item->asset = DC->registerModel(temp);
modelPtr->angle = rand() % 360;
//Makro - we're using 3 angles now, not just one
//modelPtr->angle = rand() % 360;
modelPtr->angles[0] = rand() % 360;
return qtrue;
}
@ -4454,17 +4533,38 @@ qboolean ItemParse_model_rotation( itemDef_t *item, int handle ) {
return qtrue;
}
// model_angle <integer>
// Makro - I'm going to make it so that we can rotate models around all 3 axis
// model_angle <integer> - old one
qboolean ItemParse_model_angle( itemDef_t *item, int handle ) {
modelDef_t *modelPtr;
Item_ValidateTypeData(item);
modelPtr = (modelDef_t*)item->typeData;
if (!PC_Int_Parse(handle, &modelPtr->angle)) {
//Makro - changed from Int to Float
if (!PC_Float_Parse(handle, &modelPtr->angles[0])) {
return qfalse;
}
return qtrue;
}
// model_angles <yaw> <pitch> <roll>
qboolean ItemParse_model_angles( itemDef_t *item, int handle ) {
modelDef_t *modelPtr;
Item_ValidateTypeData(item);
modelPtr = (modelDef_t*)item->typeData;
if (PC_Float_Parse(handle, &modelPtr->angles[0])) {
if (PC_Float_Parse(handle, &modelPtr->angles[1])) {
if (PC_Float_Parse(handle, &modelPtr->angles[2])) {
return qtrue;
}
}
}
return qfalse;
}
// rect <rectangle>
qboolean ItemParse_rect( itemDef_t *item, int handle ) {
@ -4938,8 +5038,7 @@ qboolean ItemParse_cvarStrList( itemDef_t *item, int handle ) {
}
}
//return qfalse;
return qfalse; // bk001205 - LCC missing return value
}
qboolean ItemParse_cvarFloatList( itemDef_t *item, int handle ) {
@ -4984,8 +5083,7 @@ qboolean ItemParse_cvarFloatList( itemDef_t *item, int handle ) {
}
}
//return qfalse;
return qfalse; // bk001205 - LCC missing return value
}
@ -5049,6 +5147,7 @@ qboolean ItemParse_hideCvar( itemDef_t *item, int handle ) {
keywordHash_t itemParseKeywords[] = {
{"name", ItemParse_name, NULL},
{"shortcutkey", ItemParse_shortcutKey, NULL},
{"text", ItemParse_text, NULL},
{"group", ItemParse_group, NULL},
{"asset_model", ItemParse_asset_model, NULL},
@ -5058,6 +5157,8 @@ keywordHash_t itemParseKeywords[] = {
{"model_fovy", ItemParse_model_fovy, NULL},
{"model_rotation", ItemParse_model_rotation, NULL},
{"model_angle", ItemParse_model_angle, NULL},
//Makro - support for 3 angles
{"model_angles", ItemParse_model_angles, NULL},
{"rect", ItemParse_rect, NULL},
{"style", ItemParse_style, NULL},
{"decoration", ItemParse_decoration, NULL},
@ -5164,6 +5265,7 @@ qboolean Item_Parse(int handle, itemDef_t *item) {
return qfalse;
}
}
return qfalse; // bk001205 - LCC missing return value
}
@ -5217,7 +5319,7 @@ qboolean MenuParse_name( itemDef_t *item, int handle ) {
qboolean MenuParse_fullscreen( itemDef_t *item, int handle ) {
menuDef_t *menu = (menuDef_t*)item;
if (!PC_Int_Parse(handle, &menu->fullScreen)) {
if (!PC_Int_Parse(handle, (int*) &menu->fullScreen)) { // bk001206 - cast qboolean
return qfalse;
}
return qtrue;
@ -5566,6 +5668,7 @@ qboolean Menu_Parse(int handle, menuDef_t *menu) {
return qfalse;
}
}
return qfalse; // bk001205 - LCC missing return value
}
/*
@ -5613,8 +5716,10 @@ displayContextDef_t *Display_GetContext() {
return DC;
}
#ifndef MISSIONPACK // bk001206
static float captureX;
static float captureY;
#endif
void *Display_CaptureItem(int x, int y) {
int i;
@ -5754,4 +5859,3 @@ static qboolean Menu_OverActiveItem(menuDef_t *menu, float x, float y) {
}
return qfalse;
}

View file

@ -1,15 +1,3 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2002/02/10 02:36:52 jbravo
// Adding ta_ui files from Makro into CVS
//
//
//-----------------------------------------------------------------------------
#ifndef __UI_SHARED_H
#define __UI_SHARED_H
@ -116,6 +104,8 @@ typedef struct {
Rectangle rect; // client coord rectangle
Rectangle rectClient; // screen coord rectangle
const char *name; //
//Makro - adding support for shortcut keys
const char *shortcutKey;
const char *group; // if it belongs to a group
const char *cinematicName; // cinematic name
int cinematic; // cinematic handle
@ -197,7 +187,9 @@ typedef struct multiDef_s {
} multiDef_t;
typedef struct modelDef_s {
int angle;
//Makro - adding full rotation
//int angle;
vec3_t angles;
vec3_t origin;
float fov_x;
float fov_y;
@ -211,7 +203,7 @@ typedef struct modelDef_s {
typedef struct itemDef_s {
Window window; // common positional, border, style, layout info
Rectangle textRect; // rectangle the text ( if any ) consumes
Rectangle textRect; // rectangle the text ( if any ) consumes
int type; // text, button, radiobutton, checkbox, textfield, listbox, combo
int alignment; // left center right
int textalignment; // ( optional ) alignment for text within rect based on text width
@ -439,3 +431,5 @@ int trap_PC_ReadToken( int handle, pc_token_t *pc_token );
int trap_PC_SourceFileAndLine( int handle, char *filename, int *line );
#endif

View file

@ -95,6 +95,6 @@ equ sin -104
equ cos -105
equ atan2 -106
equ sqrt -107
equ floor -111
equ ceil -112
equ floor -108
equ ceil -109

View file

@ -1,15 +1,3 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2002/02/10 02:36:52 jbravo
// Adding ta_ui files from Makro into CVS
//
//
//-----------------------------------------------------------------------------
// Copyright (C) 1999-2000 Id Software, Inc.
//
#include "ui_local.h"

View file

@ -1,15 +1,3 @@
//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.1 2002/02/10 02:36:52 jbravo
// Adding ta_ui files from Makro into CVS
//
//
//-----------------------------------------------------------------------------
// ui_util.c
//
// origin: rad