Cleaned up about menu code

Made the weapon menu unavailable in TDM if g_RQ3_tdmMode is not 0
This commit is contained in:
Andrei Drexler 2002-11-09 14:17:51 +00:00
parent 8362dc262f
commit a3f576a514
4 changed files with 72 additions and 42 deletions

View file

@ -6,7 +6,7 @@
--------------------Configuration: ui - Win32 Release TA--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPA6.tmp" with contents
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP12C.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"
@ -17,8 +17,8 @@ Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPA6.tmp" with conten
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_shared.c"
"C:\Games\Quake3\rq3source\reaction\ta_ui\ui_syscalls.c"
]
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPA6.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPA7.tmp" with contents
Creating command line "cl.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP12C.tmp"
Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP12D.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
@ -32,14 +32,13 @@ Creating temporary file "D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSPA7.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\RSPA7.tmp"
Creating command line "link.exe @D:\DOCUME~1\Andrei\LOCALS~1\Temp\RSP12D.tmp"
<h3>Output Window</h3>
Compiling...
bg_misc.c
ui_atoms.c
ui_gameinfo.c
ui_main.c
C:\Games\Quake3\rq3source\reaction\ta_ui\ui_main.c(4861) : warning C4101: 'game' : unreferenced local variable
ui_players.c
ui_shared.c
ui_syscalls.c
@ -49,7 +48,7 @@ Linking...
<h3>Results</h3>
uix86.dll - 0 error(s), 1 warning(s)
uix86.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.18 2002/11/09 14:17:51 makro
// Cleaned up about menu code
// Made the weapon menu unavailable in TDM if g_RQ3_tdmMode is not 0
//
// Revision 1.17 2002/10/29 01:34:52 jbravo
// Added g_RQ3_tdmMode (0 = TP style, 1 = DM style) including UI support.
//
@ -356,6 +360,22 @@ static void UI_CalcPostGameStats()
}
//Makro - returns qtrue if the player can access the WeaponMenu
qboolean UI_RQ3_WeaponMenuAccess()
{
char info[MAX_INFO_STRING];
int game, tdmMode;
trap_GetConfigString(CS_SERVERINFO, info, sizeof(info));
game = atoi(Info_ValueForKey(info, "g_gametype"));
tdmMode = atoi(Info_ValueForKey(info, "g_RQ3_tdmMode"));
if (game == GT_TEAMPLAY || game == GT_CTF || (game == GT_TEAM && !tdmMode))
return qtrue;
else
return qfalse;
}
/*
=================
UI_ConsoleCommand
@ -434,11 +454,10 @@ qboolean UI_ConsoleCommand(int realTime)
}
//Makro - adding popup for choose commands
if (Q_stricmp(cmd, "ui_RQ3_loadout") == 0) {
if (trap_Cvar_VariableValue("g_gametype") == GT_TEAMPLAY || trap_Cvar_VariableValue("g_gametype") == GT_CTF ||
trap_Cvar_VariableValue("g_gametype") == GT_TEAM)
if (UI_RQ3_WeaponMenuAccess())
_UI_SetActiveMenu(UIMENU_RQ3_WEAPON);
else
Com_Printf("Not playing teamplay.\n");
Com_Printf("Weapon/item menus are not available in this gametype.\n");
return qtrue;
}
//Makro - join menu

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.21 2002/11/09 14:17:51 makro
// Cleaned up about menu code
// Made the weapon menu unavailable in TDM if g_RQ3_tdmMode is not 0
//
// Revision 1.20 2002/08/30 17:22:28 makro
// Added clientNum info to the UI; made ref kick and referee ui scripts
// use client nums instead of names
@ -708,6 +712,9 @@ typedef struct {
qboolean firstdraw;
} uiStatic_t;
//Makro - added
qboolean UI_RQ3_WeaponMenuAccess();
// new ui stuff
#define UI_NUMFX 7
#define MAX_HEADS 64

View file

@ -5,6 +5,10 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.57 2002/11/09 14:17:51 makro
// Cleaned up about menu code
// Made the weapon menu unavailable in TDM if g_RQ3_tdmMode is not 0
//
// Revision 1.56 2002/11/09 13:05:02 makro
// g_RQ3_teamXname cvars are now used in the join menu
//
@ -2322,16 +2326,17 @@ void AddIngameLine(char *key, char *val)
void UI_BuildIngameServerInfoList()
{
char info[MAX_INFO_STRING];
char serverInfo[MAX_INFO_STRING], systemInfo[MAX_INFO_STRING];
char *p, *key, *val;
memset(uiInfo.ingameServerInfo, 0, sizeof(uiInfo.ingameServerInfo));
uiInfo.ingameServerInfoLineCount = 0;
trap_GetConfigString(CS_SERVERINFO, info, sizeof(info));
trap_GetConfigString(CS_SERVERINFO, serverInfo, sizeof(serverInfo));
trap_GetConfigString(CS_SYSTEMINFO, systemInfo, sizeof(systemInfo));
//detailed info
if (trap_Cvar_VariableValue("ui_RQ3_ingameDetails")) {
p = info;
p = serverInfo;
while (*p == '\\')
p++;
// get the cvars
@ -2352,43 +2357,42 @@ void UI_BuildIngameServerInfoList()
//basic info
} else {
//to avoid reading some stuff more than once
int gametype = atoi(Info_ValueForKey(info, "g_gametype"));
int matchmode = atoi(Info_ValueForKey(info, "g_RQ3_matchmode"));
int limit = atoi(Info_ValueForKey(info, "timelimit"));
int tdmMode = atoi(Info_ValueForKey(info, "g_RQ3_tdmMode"));
int gametype = atoi(Info_ValueForKey(serverInfo, "g_gametype"));
int matchmode = atoi(Info_ValueForKey(serverInfo, "g_RQ3_matchmode"));
int limit = atoi(Info_ValueForKey(serverInfo, "timelimit"));
AddIngameLine("RQ3 Version", Info_ValueForKey(info, "g_RQ3_version"));
AddIngameLine("Host name", Info_ValueForKey(info, "sv_hostname"));
AddIngameLine("Map name", Info_ValueForKey(info, "mapname"));
AddIngameLine("RQ3 Version", Info_ValueForKey(serverInfo, "g_RQ3_version"));
AddIngameLine("Host name", Info_ValueForKey(serverInfo, "sv_hostname"));
AddIngameLine("Map name", Info_ValueForKey(serverInfo, "mapname"));
AddIngameLine("Gametype", (char*)teamArenaGameNames[gametype]);
AddIngameLine("Time limit", (limit !=0 ) ? va("%i", limit) : "None");
switch (gametype) {
case GT_TEAMPLAY:
{
limit = atoi(Info_ValueForKey(info, "g_RQ3_roundlimit"));
limit = atoi(Info_ValueForKey(serverInfo, "g_RQ3_roundlimit"));
AddIngameLine("Round limit", (limit !=0 ) ? va("%i", limit) : "None");
limit = atoi(Info_ValueForKey(info, "g_RQ3_roundtimelimit"));
limit = atoi(Info_ValueForKey(serverInfo, "g_RQ3_roundtimelimit"));
AddIngameLine("Round time limit", (limit !=0 ) ? va("%i", limit) : "None");
AddIngameLine("Team 1", va("%s (%s)", Info_ValueForKey(info, "g_RQ3_team1Name"), Info_ValueForKey(info, "g_RQ3_team1model")));
AddIngameLine("Team 2", va("%s (%s)", Info_ValueForKey(info, "g_RQ3_team2Name"), Info_ValueForKey(info, "g_RQ3_team2model")));
AddIngameLine("Team 1", va("%s (%s)", Info_ValueForKey(serverInfo, "g_RQ3_team1Name"), Info_ValueForKey(systemInfo, "g_RQ3_team1model")));
AddIngameLine("Team 2", va("%s (%s)", Info_ValueForKey(serverInfo, "g_RQ3_team2Name"), Info_ValueForKey(systemInfo, "g_RQ3_team2model")));
break;
}
case GT_TEAM:
{
AddIngameLine("Team 1", va("%s (%s)", Info_ValueForKey(info, "g_RQ3_team1Name"), Info_ValueForKey(info, "g_RQ3_team1model")));
AddIngameLine("Team 2", va("%s (%s)", Info_ValueForKey(info, "g_RQ3_team2Name"), Info_ValueForKey(info, "g_RQ3_team2model")));
AddIngameLine("TeamDM Mode", (tdmMode != 0) ? "Classic" : "TP style");
AddIngameLine("Team 1", va("%s (%s)", Info_ValueForKey(serverInfo, "g_RQ3_team1Name"), Info_ValueForKey(systemInfo, "g_RQ3_team1model")));
AddIngameLine("Team 2", va("%s (%s)", Info_ValueForKey(serverInfo, "g_RQ3_team2Name"), Info_ValueForKey(systemInfo, "g_RQ3_team2model")));
AddIngameLine("TeamDM Mode", (atoi(Info_ValueForKey(serverInfo, "g_RQ3_tdmMode")) != 0) ? "Classic" : "TP style");
break;
}
case GT_CTF:
{
limit = atoi(Info_ValueForKey(info, "capturelimit"));
limit = atoi(Info_ValueForKey(serverInfo, "capturelimit"));
AddIngameLine("Capture limit", (limit !=0 ) ? va("%i", limit) : "None");
break;
}
default:
{
limit = atoi(Info_ValueForKey(info, "fraglimit"));
limit = atoi(Info_ValueForKey(serverInfo, "fraglimit"));
AddIngameLine("Frag limit", (limit !=0 ) ? va("%i", limit) : "None");
break;
}
@ -2396,19 +2400,19 @@ void UI_BuildIngameServerInfoList()
AddIngameLine("Match mode", (matchmode != 0) ? "On" : "Off");
if (matchmode) {
//int refID = atoi(Info_ValueForKey(info, "g_RQ3_refID"));
int allowRef = atoi(Info_ValueForKey(info, "g_RQ3_allowRef"));
AddIngameLine("Allow referee", (allowRef != 0) ? "On" : "Off");
int allowRef = atoi(Info_ValueForKey(serverInfo, "g_RQ3_allowRef"));
AddIngameLine("Allow referee", (allowRef != 0) ? va("Yes (%i max)", atoi(Info_ValueForKey(serverInfo, "g_RQ3_maxRefs"))) : "No");
//if (allowRef && refID != -1) {
// char info2[MAX_INFO_STRING];
// trap_GetConfigString(CS_PLAYERS + refID, info2, sizeof(info2));
// AddIngameLine("Referee", Info_ValueForKey(info2, "name"));
//}
}
AddIngameLine("Max clients", Info_ValueForKey(info, "sv_maxClients"));
AddIngameLine("Bot/min players", Info_ValueForKey(info, "bot_minplayers"));
AddIngameLine("Password required", (atoi(Info_ValueForKey(info, "g_needPass")) != 0) ? "Yes" : "No");
AddIngameLine("Protocol", Info_ValueForKey(info, "protocol"));
AddIngameLine("Q3 Version", Info_ValueForKey(info, "version"));
AddIngameLine("Max clients", Info_ValueForKey(serverInfo, "sv_maxClients"));
AddIngameLine("Bot/min players", Info_ValueForKey(serverInfo, "bot_minplayers"));
AddIngameLine("Password required", (atoi(Info_ValueForKey(serverInfo, "g_needPass")) != 0) ? "Yes" : "No");
AddIngameLine("Protocol", Info_ValueForKey(serverInfo, "protocol"));
AddIngameLine("Q3 Version", Info_ValueForKey(serverInfo, "version"));
}
}
@ -4395,10 +4399,11 @@ static void UI_RunMenuScript(char **args)
//Makro - maybe a wait command will make the music volume get saved before exiting
trap_Cmd_ExecuteText(EXEC_APPEND, "wait ; quit\n");
//Makro - weapon menu after joining a team
} else if (Q_stricmp(name, "weapAfterJoin") == 0) {
} else if (Q_stricmp(name, "weapAfterJoin") == 0)
{
//only in teamplay
if (trap_Cvar_VariableValue("g_gametype") == GT_TEAMPLAY || trap_Cvar_VariableValue("g_gametype") == GT_CTF ||
trap_Cvar_VariableValue("g_gametype") == GT_TEAM) {
if (UI_RQ3_WeaponMenuAccess())
{
if (ui_RQ3_weapAfterJoin.integer) {
_UI_SetActiveMenu(UIMENU_RQ3_WEAPON);
}
@ -4861,7 +4866,7 @@ UI_BuildServerDisplayList
*/
static void UI_BuildServerDisplayList(qboolean force)
{
int i, count, clients, maxClients, ping, game, len, visible;
int i, count, clients, maxClients, ping, len, visible;
char info[MAX_STRING_CHARS];
// qboolean startRefresh = qtrue; TTimo: unused