A Lot of work on UI module

Outfitted almost every function with begin and end-loggers
Removed some UI's and functions that were not in use
Fixed an issue with UI_MSD not precaching

Signed-off-by: Harry Young <hendrik.gerritzen@googlemail.com>
This commit is contained in:
Harry Young 2013-09-04 17:58:49 +02:00
parent b9a73ecdad
commit 65f2b94ca2
50 changed files with 2199 additions and 8368 deletions

View file

@ -2331,7 +2331,6 @@ $(B)/$(MISSIONPACK)/vm/qagame.qvm: $(MPGVMOBJ) $(GDIR)/g_syscalls.asm $(Q3ASM)
Q3UIOBJ_ = \
$(B)/$(BASEGAME)/ui/ui_main.o \
$(B)/$(BASEGAME)/ui/bg_misc.o \
$(B)/$(BASEGAME)/ui/ui_addbots.o \
$(B)/$(BASEGAME)/ui/ui_atoms.o \
$(B)/$(BASEGAME)/ui/ui_cdkey.o \
$(B)/$(BASEGAME)/ui/ui_confirm.o \
@ -2351,18 +2350,11 @@ Q3UIOBJ_ = \
$(B)/$(BASEGAME)/ui/ui_playersettings.o \
$(B)/$(BASEGAME)/ui/ui_preferences.o \
$(B)/$(BASEGAME)/ui/ui_qmenu.o \
$(B)/$(BASEGAME)/ui/ui_removebots.o \
$(B)/$(BASEGAME)/ui/ui_serverinfo.o \
$(B)/$(BASEGAME)/ui/ui_servers2.o \
$(B)/$(BASEGAME)/ui/ui_sound.o \
$(B)/$(BASEGAME)/ui/ui_sparena.o \
$(B)/$(BASEGAME)/ui/ui_specifyserver.o \
$(B)/$(BASEGAME)/ui/ui_splevel.o \
$(B)/$(BASEGAME)/ui/ui_sppostgame.o \
$(B)/$(BASEGAME)/ui/ui_spskill.o \
$(B)/$(BASEGAME)/ui/ui_startserver.o \
$(B)/$(BASEGAME)/ui/ui_team.o \
$(B)/$(BASEGAME)/ui/ui_teamorders.o \
$(B)/$(BASEGAME)/ui/ui_video.o \
$(B)/$(BASEGAME)/ui/ui_turbolift.o \
$(B)/$(BASEGAME)/ui/ui_transporter.o \

View file

@ -1,509 +0,0 @@
/*
* Copyright (C) 1999-2000 Id Software, Inc.
*/
/*
=======================================================================
ADD BOTS MENU
=======================================================================
*/
#include "ui_local.h"
#define BOTS_VIEWABLE 11
#define ID_BACK 10
#define ID_GO 11
#define ID_LIST 12
#define ID_UP 13
#define ID_DOWN 14
#define ID_SKILL 15
#define ID_TEAM 16
#define ID_BOTNAME0 20
#define ID_BOTNAME1 21
#define ID_BOTNAME2 22
#define ID_BOTNAME3 23
#define ID_BOTNAME4 24
#define ID_BOTNAME5 25
#define ID_BOTNAME6 26
#define ID_PCLASS 27
typedef struct {
menuframework_s menu;
menubitmap_s arrows;
menubitmap_s up;
menubitmap_s down;
menutext_s bots[BOTS_VIEWABLE];
menulist_s skill;
menulist_s team;
menulist_s pclass;
menubitmap_s go;
menubitmap_s back;
int32_t numBots;
int32_t delay;
int32_t baseBotNum;
int32_t selectedBotNum;
int32_t sortedBotNums[MAX_BOTS];
char botnames[BOTS_VIEWABLE][32];
} addBotsMenuInfo_t;
static addBotsMenuInfo_t addBotsMenuInfo;
/*
=================
UI_AddBotsMenu_BotEvent
=================
*/
static void UI_AddBotsMenu_BotEvent( void* ptr, int32_t event ) {
if (event != QM_ACTIVATED) {
return;
}
addBotsMenuInfo.bots[addBotsMenuInfo.selectedBotNum].color = (float*)colorTable[CT_DKGOLD1];
addBotsMenuInfo.selectedBotNum = ((menucommon_s*)ptr)->id - ID_BOTNAME0;
addBotsMenuInfo.bots[addBotsMenuInfo.selectedBotNum].color = (float*)colorTable[CT_YELLOW];
}
/*
=================
UI_AddBotsMenu_BackEvent
=================
*/
static void UI_AddBotsMenu_BackEvent( /*@unused@*/ void* ptr, int32_t event ) {
if (event != QM_ACTIVATED) {
return;
}
UI_PopMenu();
}
/*
=================
UI_AddBotsMenu_SetBotNames
=================
*/
static void UI_AddBotsMenu_SetBotNames( void ) {
int32_t n;
const /*@shared@*/ char *info;
for ( n = 0; n < BOTS_VIEWABLE; n++ )
{
info = UI_GetBotInfoByNumber( addBotsMenuInfo.sortedBotNums[addBotsMenuInfo.baseBotNum + n] );
Q_strncpyz( addBotsMenuInfo.botnames[n], Info_ValueForKey( info, "name" ), sizeof(addBotsMenuInfo.botnames[n]) );
}
}
/*
=================
UI_AddBotsMenu_UpEvent
=================
*/
static void UI_AddBotsMenu_UpEvent( /*@unused@*/ void* ptr, int32_t event ) {
if (event != QM_ACTIVATED) {
return;
}
if( addBotsMenuInfo.baseBotNum > 0 ) {
addBotsMenuInfo.baseBotNum--;
UI_AddBotsMenu_SetBotNames();
}
}
/*
=================
UI_AddBotsMenu_DownEvent
=================
*/
static void UI_AddBotsMenu_DownEvent( /*@unused@*/ void* ptr, int32_t event ) {
if (event != QM_ACTIVATED) {
return;
}
if( addBotsMenuInfo.baseBotNum + BOTS_VIEWABLE < addBotsMenuInfo.numBots ) {
addBotsMenuInfo.baseBotNum++;
UI_AddBotsMenu_SetBotNames();
}
}
/*
=================
UI_AddBotsMenu_GetSortedBotNums
=================
*/
static int32_t QDECL UI_AddBotsMenu_SortCompare( const void *arg1, const void *arg2 ) {
int32_t num1, num2;
const char* info1;
const char* info2;
const char* name1;
const char* name2;
num1 = *(int32_t *)arg1;
num2 = *(int32_t *)arg2;
info1 = UI_GetBotInfoByNumber( num1 );
info2 = UI_GetBotInfoByNumber( num2 );
name1 = Info_ValueForKey( info1, "name" );
name2 = Info_ValueForKey( info2, "name" );
return Q_stricmp( name1, name2 );
}
static void UI_AddBotsMenu_GetSortedBotNums( void ) {
int32_t n;
/* initialize the array */
for( n = 0; n < addBotsMenuInfo.numBots; n++ ) {
addBotsMenuInfo.sortedBotNums[n] = n;
}
qsort( addBotsMenuInfo.sortedBotNums, (size_t)addBotsMenuInfo.numBots, sizeof(addBotsMenuInfo.sortedBotNums[0]), UI_AddBotsMenu_SortCompare );
}
/*
=================
UI_AddBotsMenu_Draw
=================
*/
static void UI_AddBotsMenu_Draw( void )
{
UI_MenuFrame(&addBotsMenuInfo.menu);
trap_R_SetColor( colorTable[CT_DKPURPLE2]);
UI_DrawHandlePic(30,201, 47, 90, uis.whiteShader); /* Left side of frame */
UI_DrawHandlePic(30,293, 47, 97, uis.whiteShader);
/* Bot name frame */
trap_R_SetColor( colorTable[CT_DKBLUE1]);
UI_DrawHandlePic( 81, 172, 225, 18, uis.whiteShader); /* Top */
UI_DrawHandlePic(288, 189, 18, 246, uis.whiteShader); /* Side */
UI_DrawProportionalString( 90, 173, menu_normal_text[MNT_HOLOGRAPHIC_CHARS],UI_SMALLFONT,colorTable[CT_BLACK]); /* Top */
/* Bot settings frame */
trap_R_SetColor( colorTable[CT_DKBLUE1]);
UI_DrawHandlePic( 316, 172, 295, 18, uis.whiteShader); /* Top */
UI_DrawHandlePic( 316, 185, 18, 94, uis.whiteShader); /* Side */
UI_DrawHandlePic( 316, 282, 295, 18, uis.whiteShader); /* Bottom */
UI_DrawProportionalString( 340, 173, menu_normal_text[MNT_SETTINGS],UI_SMALLFONT,colorTable[CT_BLACK]); /* Top */
/* standard menu drawing */
Menu_Draw( &addBotsMenuInfo.menu );
}
/*
=================
UI_AddBotsMenu_Init
=================
*/
static int32_t skillNames[] =
{
MNT_BABYLEVEL,
MNT_EASYLEVEL,
MNT_MEDIUMLEVEL,
MNT_HARDLEVEL,
MNT_NIGHTMARELEVEL,
0
};
static int32_t teamNames1[] =
{
MNT_FREE,
0
};
static int32_t teamNames2[] =
{
MNT_TEAM_RED,
MNT_TEAM_BLUE,
0
};
static char* Game_teamNames1[] =
{
"free",
};
static char* Game_teamNames2[] =
{
"red",
"blue",
};
static int32_t pClassNames[] =
{
MNT_PC_INFILTRATOR,
MNT_PC_SNIPER,
MNT_PC_HEAVY,
MNT_PC_DEMO,
MNT_PC_MEDIC,
MNT_PC_TECH,
0
};
static int32_t pClassNames2[] =
{
MNT_PC_NOCLASS,
0
};
static char* Game_pClassNames[] =
{
"infiltrator",
"sniper",
"heavy",
"demo",
"medic",
"tech"
};
static char* Game_pClassNames2[] =
{
"noclass"
};
/*
=================
UI_AddBotsMenu_FightEvent
=================
*/
static void UI_AddBotsMenu_FightEvent( /*@unused@*/ void* ptr, int32_t event ) {
const char *team;
const char *pclass;
int32_t skill;
if (event != QM_ACTIVATED) {
return;
}
/*team = menu_normal_text[addBotsMenuInfo.team.listnames[addBotsMenuInfo.team.curvalue]];
pclass = menu_normal_text[addBotsMenuInfo.pclass.listnames[addBotsMenuInfo.pclass.curvalue]];*/
/* can't translate these, game code is in english only */
if (addBotsMenuInfo.team.listnames == teamNames1) {
team = Game_teamNames1[addBotsMenuInfo.team.curvalue];
} else {
team = Game_teamNames2[addBotsMenuInfo.team.curvalue];
}
if (addBotsMenuInfo.pclass.listnames == pClassNames) {
pclass = Game_pClassNames[addBotsMenuInfo.pclass.curvalue];
} else {
pclass = Game_pClassNames2[addBotsMenuInfo.pclass.curvalue];
}
skill = addBotsMenuInfo.skill.curvalue + 1;
trap_Cmd_ExecuteText( EXEC_APPEND, va("addbot %s %i %s %s %i\n",
addBotsMenuInfo.botnames[addBotsMenuInfo.selectedBotNum], skill, team, pclass, addBotsMenuInfo.delay) );
addBotsMenuInfo.delay += 1500;
}
static void UI_AddBotsMenu_Init( void )
{
int32_t n;
int32_t y,x;
int32_t gametype, specialties;
int32_t count;
char info[MAX_INFO_STRING];
memset(info, 0, sizeof(char) * MAX_INFO_STRING);
trap_GetConfigString(CS_SERVERINFO, info, MAX_INFO_STRING);
gametype = atoi( Info_ValueForKey( info,"g_gametype" ) );
specialties = atoi( Info_ValueForKey( info,"g_pModSpecialties" ) );
memset( &addBotsMenuInfo, 0 ,sizeof(addBotsMenuInfo) );
addBotsMenuInfo.menu.draw = UI_AddBotsMenu_Draw;
addBotsMenuInfo.menu.fullscreen = qtrue;
addBotsMenuInfo.menu.wrapAround = qtrue;
addBotsMenuInfo.delay = 1000;
addBotsMenuInfo.menu.descX = MENU_DESC_X;
addBotsMenuInfo.menu.descY = MENU_DESC_Y;
addBotsMenuInfo.menu.titleX = MENU_TITLE_X;
addBotsMenuInfo.menu.titleY = MENU_TITLE_Y;
addBotsMenuInfo.menu.titleI = MNT_ADD_HCS_TITLE;
addBotsMenuInfo.menu.footNoteEnum = MNT_ADD_HCS;
UI_AddBots_Cache();
addBotsMenuInfo.numBots = UI_GetNumBots();
count = addBotsMenuInfo.numBots < BOTS_VIEWABLE ? addBotsMenuInfo.numBots : BOTS_VIEWABLE;
addBotsMenuInfo.up.generic.type = MTYPE_BITMAP;
addBotsMenuInfo.up.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
addBotsMenuInfo.up.generic.x = 289;
addBotsMenuInfo.up.generic.y = 196;
addBotsMenuInfo.up.generic.id = ID_UP;
addBotsMenuInfo.up.generic.callback = UI_AddBotsMenu_UpEvent;
addBotsMenuInfo.up.width = 16;
addBotsMenuInfo.up.height = 16;
addBotsMenuInfo.up.color = CT_DKGOLD1;
addBotsMenuInfo.up.color2 = CT_LTGOLD1;
addBotsMenuInfo.up.generic.name = "menu/common/arrow_up_16.tga";
addBotsMenuInfo.down.generic.type = MTYPE_BITMAP;
addBotsMenuInfo.down.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
addBotsMenuInfo.down.generic.x = 289;
addBotsMenuInfo.down.generic.y = 407;
addBotsMenuInfo.down.generic.id = ID_DOWN;
addBotsMenuInfo.down.generic.callback = UI_AddBotsMenu_DownEvent;
addBotsMenuInfo.down.width = 16;
addBotsMenuInfo.down.height = 16;
addBotsMenuInfo.down.color = CT_DKGOLD1;
addBotsMenuInfo.down.color2 = CT_LTGOLD1;
addBotsMenuInfo.down.generic.name = "menu/common/arrow_dn_16.tga";
for( n = 0, y = 194; n < count; n++, y += 20 )
{
addBotsMenuInfo.bots[n].generic.type = MTYPE_PTEXT;
addBotsMenuInfo.bots[n].generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
addBotsMenuInfo.bots[n].generic.id = ID_BOTNAME0 + n;
addBotsMenuInfo.bots[n].generic.x = 108;
addBotsMenuInfo.bots[n].generic.y = y;
addBotsMenuInfo.bots[n].generic.callback = UI_AddBotsMenu_BotEvent;
addBotsMenuInfo.bots[n].string = addBotsMenuInfo.botnames[n];
addBotsMenuInfo.bots[n].color = colorTable[CT_DKGOLD1];
addBotsMenuInfo.bots[n].color2 = colorTable[CT_LTGOLD1];
addBotsMenuInfo.bots[n].style = UI_LEFT|UI_SMALLFONT;
}
y = 204;
x = 348;
/* team button */
UI_InitSpinControl(&addBotsMenuInfo.team);
addBotsMenuInfo.team.generic.x = x;
addBotsMenuInfo.team.generic.y = y;
addBotsMenuInfo.team.textEnum = MBT_TEAM;
addBotsMenuInfo.team.generic.id = ID_TEAM;
if( gametype >= GT_TEAM )
{
addBotsMenuInfo.team.listnames = teamNames2;
}
else
{
addBotsMenuInfo.team.listnames = teamNames1;
addBotsMenuInfo.team.generic.flags = QMF_GRAYED;
}
/* MCG ADDED: */
/* class button */
y += SMALLCHAR_HEIGHT + 8;
UI_InitSpinControl(&addBotsMenuInfo.pclass);
addBotsMenuInfo.pclass.generic.x = x;
addBotsMenuInfo.pclass.generic.y = y;
addBotsMenuInfo.pclass.textEnum = MBT_PLAYERCLASS;
addBotsMenuInfo.pclass.generic.id = ID_PCLASS;
if ( specialties )
{
addBotsMenuInfo.pclass.listnames = pClassNames;
}
else
{
addBotsMenuInfo.pclass.listnames = pClassNames2;
addBotsMenuInfo.pclass.generic.flags = QMF_GRAYED;
}
/* MCG END */
/* skill button */
y += SMALLCHAR_HEIGHT + 8;
UI_InitSpinControl(&addBotsMenuInfo.skill);
addBotsMenuInfo.skill.generic.x = x;
addBotsMenuInfo.skill.generic.y = y;
addBotsMenuInfo.skill.generic.id = ID_SKILL;
addBotsMenuInfo.skill.curvalue = Com_Clamp( 0, 4, (int32_t)trap_Cvar_VariableValue( "g_spSkill" ) - 1 );
addBotsMenuInfo.skill.textEnum = MBT_SKILL;
/*addBotsMenuInfo.skill.generic.id = ID_TEAM;*/
addBotsMenuInfo.skill.listnames = skillNames;
/* go button */
addBotsMenuInfo.go.generic.type = MTYPE_BITMAP;
addBotsMenuInfo.go.generic.name = GRAPHIC_SQUARE;
addBotsMenuInfo.go.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
addBotsMenuInfo.go.generic.id = ID_GO;
addBotsMenuInfo.go.generic.callback = UI_AddBotsMenu_FightEvent;
addBotsMenuInfo.go.generic.x = 356;
addBotsMenuInfo.go.generic.y = 342;
addBotsMenuInfo.go.width = MENU_BUTTON_MED_WIDTH;
addBotsMenuInfo.go.height = MENU_BUTTON_MED_HEIGHT * 2;
addBotsMenuInfo.go.color = CT_DKPURPLE1;
addBotsMenuInfo.go.color2 = CT_LTPURPLE1;
addBotsMenuInfo.go.textX = MENU_BUTTON_TEXT_X;
addBotsMenuInfo.go.textY = MENU_BUTTON_TEXT_Y;
addBotsMenuInfo.go.textEnum = MBT_ACCEPT;
addBotsMenuInfo.go.textcolor = CT_BLACK;
addBotsMenuInfo.go.textcolor2 = CT_WHITE;
/* back button */
addBotsMenuInfo.back.generic.type = MTYPE_BITMAP;
addBotsMenuInfo.back.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
addBotsMenuInfo.back.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
addBotsMenuInfo.back.generic.id = ID_BACK;
addBotsMenuInfo.back.generic.callback = UI_AddBotsMenu_BackEvent;
addBotsMenuInfo.back.generic.x = 482;
addBotsMenuInfo.back.generic.y = 136;
addBotsMenuInfo.back.width = MENU_BUTTON_MED_WIDTH;
addBotsMenuInfo.back.height = MENU_BUTTON_MED_HEIGHT;
addBotsMenuInfo.back.color = CT_DKPURPLE1;
addBotsMenuInfo.back.color2 = CT_LTPURPLE1;
addBotsMenuInfo.back.textX = MENU_BUTTON_TEXT_X;
addBotsMenuInfo.back.textY = MENU_BUTTON_TEXT_Y;
addBotsMenuInfo.back.textEnum = MBT_INGAMEMENU;
addBotsMenuInfo.back.textcolor = CT_BLACK;
addBotsMenuInfo.back.textcolor2 = CT_WHITE;
addBotsMenuInfo.baseBotNum = 0;
addBotsMenuInfo.selectedBotNum = 0;
/*addBotsMenuInfo.bots[0].color = color_white;*/
UI_AddBotsMenu_GetSortedBotNums();
UI_AddBotsMenu_SetBotNames();
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.up );
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.down );
for( n = 0; n < count; n++ )
{
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.bots[n] );
}
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.skill );
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.team );
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.pclass );
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.go );
Menu_AddItem( &addBotsMenuInfo.menu, &addBotsMenuInfo.back );
}
/*
=================
UI_AddBots_Cache
=================
*/
void UI_AddBots_Cache( void )
{
trap_R_RegisterShaderNoMip( "menu/common/arrow_up_16.tga" );
trap_R_RegisterShaderNoMip( "menu/common/arrow_dn_16.tga" );
}
/*
=================
UI_AddBotsMenu
=================
*/
void UI_AddBotsMenu( void )
{
UI_AddBotsMenu_Init();
UI_PushMenu( &addBotsMenuInfo.menu );
}

View file

@ -12,6 +12,7 @@ ingame.
*/
#include "ui_local.h"
#include "ui_logger.h"
// Defines
//general
#define PIC_ARROW_UP "menu/common/arrow_up_16.tga"
@ -232,35 +233,6 @@ adminGeneric_t s_adminGeneric;
static char *fxList[10];
/*static char* giveItems[] =
{
"all",
"health",
"weapons",
"ammo",
"forcefield",
"transporter",
"phaser",
"phaser_rifle",
"coffee",
"disruptor",
"coffee",
"admin_gun",
"tr-116",
"photon_burst",
"dermal_regen",
"hypospray",
"toolkit",
"medkit",
"tricorder",
"padd",
"neutrino_probe",
"cloak",
"flight",
"god",
0
};*/ /* hardcoded = blegh + 1 for 0 */
/*
===============
AdminGeneric_InitLists
@ -271,6 +243,7 @@ we'll need for different menus
===============
*/
void AdminGeneric_InitLists( void ) {
UI_LogFuncBegin();
int32_t i;
char info[MAX_TOKEN_CHARS];
@ -311,6 +284,7 @@ void AdminGeneric_InitLists( void ) {
s_adminGeneric.numChars++;
}
s_adminGeneric.charListPtr[ s_adminGeneric.numChars ] = 0;
UI_LogFuncEnd();
}
@ -327,6 +301,7 @@ all of them. :)
*/
static void AdminMenu_DrawLCARSBox ( int32_t x, int32_t y, int32_t w, int32_t h, vec4_t color, int32_t title ) {
UI_LogFuncBegin();
trap_R_SetColor( color );
@ -355,6 +330,7 @@ static void AdminMenu_DrawLCARSBox ( int32_t x, int32_t y, int32_t w, int32_t h,
if ( menu_normal_text[ title ] ) {
UI_DrawProportionalString( x + 15, y + 1, menu_normal_text[ title ], UI_LEFT | UI_SMALLFONT, colorTable[CT_BLACK] );
}
UI_LogFuncEnd();
}
/*
@ -364,6 +340,7 @@ AdminMenu_DrawCommon
*/
static void AdminMenu_DrawCommon ( void ) {
UI_LogFuncBegin();
/* Left side LCARS bars */
trap_R_SetColor( colorTable[CT_LTBROWN1]);
@ -408,6 +385,7 @@ static void AdminMenu_DrawCommon ( void ) {
UI_DrawHandlePic( s_admin.adminMain.generic.x - 14, s_admin.adminMain.generic.y, 18, 18, uis.graphicButtonLeftEnd );
UI_DrawHandlePic( s_admin.adminClients.generic.x - 14, s_admin.adminClients.generic.y, 18, 18, uis.graphicButtonLeftEnd );
UI_DrawHandlePic( s_admin.adminAudio.generic.x - 14, s_admin.adminAudio.generic.y, 18, 18, uis.graphicButtonLeftEnd );
UI_LogFuncEnd();
}
/*
@ -417,6 +395,7 @@ AdminMenu_InitButtons
*/
static void AdminMenu_InitButtons( menuframework_s *menu ) {
UI_LogFuncBegin();
s_admin.mainMenu.generic.type = MTYPE_BITMAP;
s_admin.mainMenu.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
@ -494,6 +473,7 @@ static void AdminMenu_InitButtons( menuframework_s *menu ) {
Menu_AddItem( menu, &s_admin.adminMain );
Menu_AddItem( menu, &s_admin.adminClients );
Menu_AddItem( menu, &s_admin.adminAudio );
UI_LogFuncEnd();
}
/*
@ -502,6 +482,7 @@ AdminMenu_Event
===============
*/
static void AdminMenu_Event( void* ptr, int32_t event ) {
UI_LogFuncBegin();
if ( event != QM_ACTIVATED )
return;
@ -651,6 +632,7 @@ static void AdminMenu_Event( void* ptr, int32_t event ) {
UI_PopMenu();
break;
}
UI_LogFuncEnd();
}
/*
@ -659,6 +641,7 @@ AdminMenu_Draw
===============
*/
static void AdminMenu_Draw( void ) {
UI_LogFuncBegin();
vec_t* color = colorTable[CT_LTORANGE];
char msg1[36];
char msg2[36];
@ -711,9 +694,11 @@ static void AdminMenu_Draw( void ) {
/* Lines for player model frame */
Menu_Draw( &s_admin.menu );
UI_LogFuncEnd();
}
static sfxHandle_t AdminMenu_KeyEvent( int32_t key ) {
UI_LogFuncBegin();
int32_t i, j;
menucommon_s *s;
char command[256];
@ -795,15 +780,18 @@ static sfxHandle_t AdminMenu_KeyEvent( int32_t key ) {
}
end:
UI_LogFuncEnd();
return ( Menu_DefaultKey( &s_admin.menu, key ) );
}
void UI_AdminMenu_Cache( void ) {
UI_LogFuncBegin();
trap_R_RegisterShaderNoMip(PIC_ARROW_UP);
trap_R_RegisterShaderNoMip(PIC_ARROW_DOWN);
s_admin.corner_ll_4_18 = trap_R_RegisterShaderNoMip( "menu/common/corner_ll_4_18" );
s_admin.corner_ll_4_4 = trap_R_RegisterShaderNoMip( "menu/common/corner_ll_4_4" );
UI_LogFuncEnd();
}
/*
@ -818,6 +806,7 @@ are rendered.
===============
*/
static void AdminMenu_DrawButton ( void *self ) {
UI_LogFuncBegin();
qboolean focus;
menuaction_s* action;
int32_t color;
@ -864,6 +853,7 @@ static void AdminMenu_DrawButton ( void *self ) {
if ( menu_button_text[action->textEnum][0] ) {
UI_DrawProportionalString( x + action->textX, y + action->textY, menu_button_text[action->textEnum][0], UI_SMALLFONT, colorTable[ textColor ] );
}
UI_LogFuncEnd();
}
/*
@ -872,6 +862,7 @@ AdminMenu_DrawBinding
===============
*/
static void AdminMenu_DrawBinding( void *self ) {
UI_LogFuncBegin();
qboolean focus;
menuaction_s *action;
int32_t x,y;
@ -945,6 +936,7 @@ static void AdminMenu_DrawBinding( void *self ) {
else
textColor = CT_WHITE;
UI_DrawProportionalString( x + width + 5, y+1, name, UI_SMALLFONT, colorTable[textColor] );
UI_LogFuncEnd();
}
/*
@ -953,6 +945,7 @@ AdminMenu_Init
===============
*/
static void AdminMenu_Init( void ) {
UI_LogFuncBegin();
int32_t i, j;
char binding[256];
@ -1518,6 +1511,7 @@ static void AdminMenu_Init( void ) {
* ... could be the lack of null pointer at the end ROFL
*/
s_admin.reviveList.numitems = 2;
UI_LogFuncEnd();
}
/*
@ -1526,6 +1520,7 @@ UI_AdminMenu
===============
*/
void UI_AdminMenu( qboolean fromConsole ) {
UI_LogFuncBegin();
memset( &s_admin, 0, sizeof( s_admin ) );
s_admin.fromConsole = fromConsole;
@ -1535,6 +1530,7 @@ void UI_AdminMenu( qboolean fromConsole ) {
Mouse_Show();
UI_PushMenu( &s_admin.menu );
UI_LogFuncEnd();
}
/*========================================================================*/
@ -1590,6 +1586,7 @@ the currently selected player
static void ClientAdmin_GetClient ( int32_t listNum )
{
UI_LogFuncBegin();
/* get the currently selected client, and parse their info string */
char info[MAX_TOKEN_CHARS];
@ -1613,6 +1610,7 @@ static void ClientAdmin_GetClient ( int32_t listNum )
Q_strncpyz( s_clientAdmin.clientStats.model, Info_ValueForKey( info, "model" ), sizeof( s_clientAdmin.clientStats.model ) );
Q_strncpyz( s_clientAdmin.clientStats.race, Info_ValueForKey( info, "race" ), sizeof( s_clientAdmin.clientStats.race ) );
Q_strncpyz( s_clientAdmin.clientStats.age, Info_ValueForKey( info, "age" ), sizeof( s_clientAdmin.clientStats.age ) );
UI_LogFuncEnd();
}
@ -1623,9 +1621,12 @@ ClientAdmin_Event
*/
static void ClientAdmin_Event( void *ptr, int32_t event ) {
UI_LogFuncBegin();
if ( event != QM_ACTIVATED )
if ( event != QM_ACTIVATED ){
UI_LogFuncEnd();
return;
}
switch( ((menucommon_s *)ptr)->id ) {
case ID_CLIENT_SELECT:
@ -1671,6 +1672,7 @@ static void ClientAdmin_Event( void *ptr, int32_t event ) {
break;
}
UI_LogFuncEnd();
}
/*
@ -1679,6 +1681,7 @@ ClientAdmin_Draw
===================
*/
static void ClientAdmin_Draw( void ) {
UI_LogFuncBegin();
vec_t* color = colorTable[CT_LTORANGE];
char string[MAX_QPATH];
int32_t x, y;
@ -1745,6 +1748,7 @@ static void ClientAdmin_Draw( void ) {
AdminMenu_DrawCommon();
Menu_Draw( &s_clientAdmin.menu );
UI_LogFuncEnd();
}
/*
@ -1753,6 +1757,7 @@ ClientAdmin_Init
===================
*/
static void ClientAdmin_Init( void ) {
UI_LogFuncBegin();
AdminGeneric_InitLists();
@ -1987,6 +1992,7 @@ static void ClientAdmin_Init( void ) {
Menu_AddItem( &s_clientAdmin.menu, &s_clientAdmin.forceExecute );
ClientAdmin_GetClient( 0 );
UI_LogFuncEnd();
}
/*
@ -1996,12 +2002,14 @@ UI_ClientAdminMenu
*/
void UI_ClientAdminMenu( void ) {
UI_LogFuncBegin();
memset( &s_clientAdmin, 0, sizeof( s_clientAdmin ) );
ClientAdmin_Init();
Mouse_Show();
UI_PushMenu( &s_clientAdmin.menu );
UI_LogFuncEnd();
}
/*****************************************************************************************/
@ -2061,6 +2069,7 @@ when we click an arrow button
static void AdminAudio_OffsetList ( soundList_t *soundList, int32_t *offset, int32_t numSounds, menubitmap_s *btnList )
{
UI_LogFuncBegin();
int32_t i;
char *buffer;
@ -2092,6 +2101,7 @@ static void AdminAudio_OffsetList ( soundList_t *soundList, int32_t *offset, int
btnList[i].generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
btnList[i].textPtr = buffer;
}
UI_LogFuncEnd();
}
/*
@ -2105,6 +2115,7 @@ for sound/music files
*/
static void AdminAudio_InitFilesList ( void )
{
UI_LogFuncBegin();
int32_t numFiles;
char buffer[20000];
char* strPtr;
@ -2350,6 +2361,7 @@ static void AdminAudio_InitFilesList ( void )
j++;
}
}
UI_LogFuncEnd();
}
/*
@ -2360,8 +2372,11 @@ AdminAudio_Event
static void AdminAudio_Event( void *ptr, int32_t event )
{
if ( event != QM_ACTIVATED )
UI_LogFuncBegin();
if ( event != QM_ACTIVATED ){
UI_LogFuncEnd();
return;
}
switch( ((menucommon_s *)ptr)->id )
{
@ -2426,6 +2441,7 @@ static void AdminAudio_Event( void *ptr, int32_t event )
trap_Cmd_ExecuteText( EXEC_APPEND, va( "playSound %s.%s", s_adminAudio.soundList[s_adminAudio.selectedSound].fileRoute, s_adminAudio.soundList[s_adminAudio.selectedSound].format == TYPE_MP3 ? "mp3" : "wav" ) );
break;
}
UI_LogFuncEnd();
}
/*
@ -2436,6 +2452,7 @@ AdminAudio_Draw
static void AdminAudio_Draw( void )
{
UI_LogFuncBegin();
int32_t i;
int32_t x, y, w, h;
@ -2543,6 +2560,7 @@ static void AdminAudio_Draw( void )
AdminMenu_DrawCommon();
Menu_Draw( &s_adminAudio.menu );
UI_LogFuncEnd();
}
/*static void AdminAudio_Cache( void )
@ -2559,6 +2577,7 @@ AdminAudio_Init
static void AdminAudio_Init( void )
{
UI_LogFuncBegin();
int32_t i, x, y;
s_adminAudio.selectedSong = -1;
@ -2769,6 +2788,7 @@ static void AdminAudio_Init( void )
AdminAudio_OffsetList( s_adminAudio.musicList, &s_adminAudio.songOffset, s_adminAudio.numSongs, s_adminAudio.songButtons );
AdminAudio_OffsetList( s_adminAudio.soundList, &s_adminAudio.soundOffset, s_adminAudio.numSounds, s_adminAudio.soundButtons );
UI_LogFuncEnd();
}
/*
@ -2779,12 +2799,14 @@ UI_AdminAudioMenu
void UI_AdminAudioMenu( void )
{
UI_LogFuncBegin();
memset( &s_adminAudio, 0, sizeof( s_adminAudio ) );
AdminAudio_Init();
Mouse_Show();
UI_PushMenu( &s_adminAudio.menu );
UI_LogFuncEnd();
}
/**********************************************************************
@ -2819,7 +2841,9 @@ UI_LoginSetSqlkey
=================
*/
void UI_LoginSetSqlkey(int32_t key) {
UI_LogFuncBegin();
sqlkey = (byte)key;
UI_LogFuncEnd();
}
/*
@ -2828,6 +2852,7 @@ M_Login_Event
=================
*/
static void M_Login_Event(void* ptr, int32_t notification) {
UI_LogFuncBegin();
int32_t id;
id = ((menucommon_s*)ptr)->id;
@ -2846,6 +2871,7 @@ static void M_Login_Event(void* ptr, int32_t notification) {
}
break;
}
UI_LogFuncEnd();
}
/*
@ -2854,6 +2880,8 @@ LoginMenu_Key
=================
*/
sfxHandle_t LoginMenu_Key(int32_t key) {
UI_LogFuncBegin();
UI_LogFuncEnd();
return (Menu_DefaultKey(&s_login.menu, key));
}
@ -2863,6 +2891,7 @@ LoginMenu_Draw
===============
*/
static void LoginMenu_Draw(void) {
UI_LogFuncBegin();
int32_t length;
AdminMenu_DrawCommon();
@ -2889,6 +2918,7 @@ static void LoginMenu_Draw(void) {
}
Menu_Draw(&s_login.menu);
UI_LogFuncEnd();
}
/*
@ -2897,6 +2927,7 @@ LoginMenu_Init
===============
*/
void LoginMenu_Init(void) {
UI_LogFuncBegin();
if( s_login.isAdmin || s_login.isSQL > 0){
UI_AdminMenu_Cache();
@ -3003,6 +3034,7 @@ void LoginMenu_Init(void) {
AdminMenu_InitButtons( &s_login.menu );
}
UI_LogFuncEnd();
}
@ -3012,6 +3044,7 @@ UI_LoginMenu
===============
*/
void UI_LoginMenu(qboolean fromConsole) {
UI_LogFuncBegin();
memset(&s_login, 0, sizeof(s_login));
uis.menusp = 0;
@ -3031,4 +3064,5 @@ void UI_LoginMenu(qboolean fromConsole) {
UI_PushMenu(&s_login.menu);
Menu_AdjustCursor(&s_login.menu, 1);
UI_LogFuncEnd();
}

View file

@ -12,6 +12,7 @@ ingame.
*/
#include "ui_local.h"
#include "ui_logger.h"
#define ID_MAINMENU 15
#define ID_ADMIN_MAIN 16

File diff suppressed because it is too large Load diff

View file

@ -10,6 +10,7 @@ CD KEY MENU
#include "ui_local.h"
#include "ui_logger.h"
#define ID_CDKEY 10
#define ID_ACCEPT 11
@ -38,11 +39,13 @@ UI_CDKeyMenu_PreValidateKey
*/
static int32_t UI_CDKeyMenu_PreValidateKey( const char *key )
{
UI_LogFuncBegin();
int32_t cnt, i;
// With dashes can't be more than 21 long
if( strlen( key ) > 22 )
{
UI_LogFuncEnd();
return -1;
}
@ -60,10 +63,11 @@ static int32_t UI_CDKeyMenu_PreValidateKey( const char *key )
// Count without dashes (Should be 18 but 0's at the end weren't printed on the documentation so we're allowing 16 and adding the 0's in the keycheck)
if ((cnt < 16) || (cnt > 18))
// if (cnt != 18)
{
UI_LogFuncEnd();
return -1;
}
UI_LogFuncEnd();
return 0;
}
@ -75,8 +79,10 @@ UI_CDKeyMenu_Event
*/
static void UI_CDKeyMenu_Event( void *ptr, int32_t event )
{
UI_LogFuncBegin();
if( event != QM_ACTIVATED )
{
UI_LogFuncEnd();
return;
}
@ -116,6 +122,7 @@ static void UI_CDKeyMenu_Event( void *ptr, int32_t event )
break;
}
UI_LogFuncEnd();
}
@ -126,6 +133,7 @@ UI_CDKeyMenu_DrawKey
*/
static void UI_CDKeyMenu_DrawKey( void *self )
{
UI_LogFuncBegin();
menufield_s *f;
qboolean focus;
int32_t style;
@ -171,7 +179,7 @@ static void UI_CDKeyMenu_DrawKey( void *self )
UI_DrawChar( x + f->field.cursor * SMALLCHAR_WIDTH, y, c, style, color_white );
}
UI_LogFuncEnd();
}
/*
@ -181,6 +189,7 @@ CDKeyMenu_Graphics
*/
void CDKeyMenu_Graphics (void)
{
UI_LogFuncBegin();
int32_t x,y;
// Draw the basic screen layout
@ -216,7 +225,7 @@ void CDKeyMenu_Graphics (void)
}
UI_Setup_MenuButtons();
UI_LogFuncEnd();
}
/*
@ -226,8 +235,10 @@ CDKey_MenuDraw
*/
static void CDKey_MenuDraw (void)
{
UI_LogFuncBegin();
CDKeyMenu_Graphics();
Menu_Draw( &cdkeyMenuInfo.menu );
UI_LogFuncEnd();
}
/*
@ -237,6 +248,7 @@ UI_CDKeyMenu_Init
*/
static void UI_CDKeyMenu_Init( void )
{
UI_LogFuncBegin();
memset( &cdkeyMenuInfo, 0, sizeof(cdkeyMenuInfo) );
UI_CDKeyMenu_Cache();
@ -293,6 +305,7 @@ static void UI_CDKeyMenu_Init( void )
} else {
cdkeyMenuInfo.keyResult = 1;
}
UI_LogFuncEnd();
}
@ -303,7 +316,9 @@ UI_CDKeyMenu_Cache
*/
void UI_CDKeyMenu_Cache( void )
{
UI_LogFuncBegin();
cdkeyMenuInfo.halfround = trap_R_RegisterShaderNoMip( "menu/common/halfround_r_24.tga" );
UI_LogFuncEnd();
}
@ -314,8 +329,10 @@ UI_CDKeyMenu
*/
void UI_CDKeyMenu( void )
{
UI_LogFuncBegin();
UI_CDKeyMenu_Init();
UI_PushMenu( &cdkeyMenuInfo.menu );
UI_LogFuncEnd();
}
@ -326,11 +343,14 @@ M_CDKey2Menu_Key
*/
sfxHandle_t M_CDKey2Menu_Key (int32_t key)
{
UI_LogFuncBegin();
if (key == K_ESCAPE)
{
UI_LogFuncEnd();
return(0);
}
UI_LogFuncEnd();
return ( Menu_DefaultKey( &cdkeyMenuInfo.menu, key ) );
}
@ -341,6 +361,7 @@ CDKeyMenu2_Graphics
*/
void CDKeyMenu2_Graphics (void)
{
UI_LogFuncBegin();
int32_t x,y;
// Draw the basic screen layout
@ -376,6 +397,7 @@ void CDKeyMenu2_Graphics (void)
{
UI_DrawProportionalString( x, y, menu_normal_text[MNT_CDKEY_INVALID], UI_CENTER|UI_SMALLFONT, colorTable[CT_RED] );
}
UI_LogFuncEnd();
}
/*
@ -385,8 +407,10 @@ CDKey2_MenuDraw
*/
static void CDKey2_MenuDraw (void)
{
UI_LogFuncBegin();
CDKeyMenu2_Graphics();
Menu_Draw( &cdkeyMenuInfo.menu );
UI_LogFuncEnd();
}
@ -397,6 +421,7 @@ UI_CDKeyMenu2_Init
*/
static void UI_CDKeyMenu2_Init( void )
{//initial first time menu
UI_LogFuncBegin();
memset( &cdkeyMenuInfo, 0, sizeof(cdkeyMenuInfo) );
cdkeyMenuInfo.fromMenu = 1;
@ -470,6 +495,7 @@ static void UI_CDKeyMenu2_Init( void )
} else {
cdkeyMenuInfo.keyResult = 1;
}
UI_LogFuncEnd();
}
/*
@ -479,8 +505,10 @@ UI_CDKeyMenu
*/
void UI_CDKeyMenu2( void )
{
UI_LogFuncBegin();
UI_CDKeyMenu2_Init();
UI_PushMenu( &cdkeyMenuInfo.menu );
UI_LogFuncEnd();
}
/*
@ -490,5 +518,7 @@ UI_CDKeyMenu_f
*/
void UI_CDKeyMenu_f( void )
{
UI_LogFuncBegin();
UI_CDKeyMenu2();
UI_LogFuncEnd();
}

View file

@ -10,6 +10,7 @@ CONFIRMATION MENU
#include "ui_local.h"
#include "ui_logger.h"
#define ID_CONFIRM_NO 10
@ -40,10 +41,12 @@ ConfirmMenu_Event
*/
static void ConfirmMenu_Event( void* ptr, int32_t event )
{
UI_LogFuncBegin();
qboolean result;
if( event != QM_ACTIVATED )
{
UI_LogFuncEnd();
return;
}
@ -62,6 +65,7 @@ static void ConfirmMenu_Event( void* ptr, int32_t event )
{
s_confirm.action( result );
}
UI_LogFuncEnd();
}
@ -72,6 +76,7 @@ ConfirmMenu_Key
*/
static sfxHandle_t ConfirmMenu_Key( int32_t key )
{
UI_LogFuncBegin();
switch ( key )
{
case K_KP_LEFTARROW:
@ -92,6 +97,7 @@ static sfxHandle_t ConfirmMenu_Key( int32_t key )
break;
}
UI_LogFuncEnd();
return Menu_DefaultKey( &s_confirm.menu, key );
}
@ -103,6 +109,7 @@ ConfirmMenu_Draw
*/
static void ConfirmMenu_Draw( void )
{
UI_LogFuncBegin();
UI_MenuFrame(&s_confirm.menu);
// End of upper line
@ -187,6 +194,7 @@ static void ConfirmMenu_Draw( void )
{
s_confirm.draw();
}
UI_LogFuncEnd();
}
@ -197,49 +205,62 @@ ConfirmMenu_Cache
*/
void ConfirmMenu_Cache( void )
{
UI_LogFuncBegin();
s_confirm.cornerPic = trap_R_RegisterShaderNoMip("menu/common/corner_ll_47_18.tga");
UI_LogFuncEnd();
}
static const char* TranslateQuestion(const char *question) {
UI_LogFuncBegin();
static char translatedQuestion[128];
if (!strcmp(question, "Unpure client detected. Invalid .PK3 files referenced!")) {
UI_LogFuncEnd();
return menu_normal_text[MNT_UNPURECLIENT];
}
if (!strcmp(question, "Cannot validate pure client!")) {
UI_LogFuncEnd();
return menu_normal_text[MNT_CANNOTVALIDATE];
}
if (!strcmp(question, "kicked")) {
UI_LogFuncEnd();
return menu_normal_text[MNT_KICKED];
}
if (!strcmp(question, "timed out")) {
UI_LogFuncEnd();
return menu_normal_text[MNT_TIMEDOUT];
}
if (!strcmp(question, "server shut down")) {
UI_LogFuncEnd();
return menu_normal_text[MNT_SERVERSHUTDOWN];
}
if (!strcmp(question, "disconnected")) {
UI_LogFuncEnd();
return menu_normal_text[MNT_DISCONNECTED];
}
if (!strcmp(question, "broken download")) {
UI_LogFuncEnd();
return menu_normal_text[MNT_BROKENDOWNLOAD];
}
if (!strcmp(question, "Server command overflow")) {
UI_LogFuncEnd();
return menu_normal_text[MNT_SERVERCOMMANDOVERFLOW];
}
if (!strcmp(question, "Lost reliable commands")) {
UI_LogFuncEnd();
return menu_normal_text[MNT_LOSTRELIABLECOMMANDS];
}
Q_strncpyz(translatedQuestion, question, sizeof(translatedQuestion));
UI_LogFuncEnd();
return translatedQuestion;
}
@ -250,7 +271,7 @@ UI_ConfirmMenu
*/
void UI_ConfirmMenu( const char *question, void (*draw)( void ), void (*action)( qboolean result ) )
{
// uiClientState_t cstate;
UI_LogFuncBegin();
// zero set all our globals
memset( &s_confirm, 0, sizeof(s_confirm) );
@ -274,17 +295,6 @@ void UI_ConfirmMenu( const char *question, void (*draw)( void ), void (*action)(
s_confirm.menu.titleI = MNT_CONFIRMATIONMENU_TITLE;
s_confirm.menu.footNoteEnum = MNT_CONFIRMATION;
/* trap_GetClientState( &cstate );
if ( cstate.connState >= CA_CONNECTED )
{
s_confirm.menu.fullscreen = qfalse;
}
else
{
s_confirm.menu.fullscreen = qtrue;
}
*/
s_confirm.yes.generic.type = MTYPE_BITMAP;
s_confirm.yes.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_confirm.yes.generic.x = 215;
@ -327,4 +337,6 @@ void UI_ConfirmMenu( const char *question, void (*draw)( void ), void (*action)(
UI_PushMenu( &s_confirm.menu );
Menu_SetCursorToItem( &s_confirm.menu, &s_confirm.no );
UI_LogFuncEnd();
}

View file

@ -1,6 +1,7 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#include "ui_local.h"
#include "ui_logger.h"
/*
===============================================================================
@ -18,6 +19,7 @@ static char lastLoadingText[MAX_INFO_VALUE];
static void UI_ReadableSize ( char *buf, int32_t bufsize, int32_t value )
{
UI_LogFuncBegin();
if (value > 1024*1024*1024 ) { // gigs
Com_sprintf( buf, bufsize, "%d", value / (1024*1024*1024) );
Com_sprintf( buf+strlen(buf), bufsize-strlen(buf), ".%02d GB",
@ -31,10 +33,12 @@ static void UI_ReadableSize ( char *buf, int32_t bufsize, int32_t value )
} else { // bytes
Com_sprintf( buf, bufsize, "%d bytes", value );
}
UI_LogFuncEnd();
}
// Assumes time is in msec
static void UI_PrintTime ( char *buf, int32_t bufsize, int32_t time ) {
UI_LogFuncBegin();
time /= 1000; // change to seconds
if (time > 3600) { // in the hours range
@ -44,10 +48,12 @@ static void UI_PrintTime ( char *buf, int32_t bufsize, int32_t time ) {
} else { // secs
Com_sprintf( buf, bufsize, "%d sec", time );
}
UI_LogFuncEnd();
}
static void UI_DisplayDownloadInfo( const char *downloadName ) {
UI_LogFuncBegin();
const char *dlText = menu_normal_text[MNT_DOWNLOADING];
const char *etaText = menu_normal_text[MNT_ESTIMATEDTIMELEFT];
const char *xferText = menu_normal_text[MNT_TRANSFERRATE];
@ -129,6 +135,7 @@ static void UI_DisplayDownloadInfo( const char *downloadName ) {
UI_DrawProportionalString( leftWidth, xferYpos, va(xSeconds, xferRateBuf), style, color_white );
}
}
UI_LogFuncEnd();
}
/*
@ -141,6 +148,7 @@ overlay is in cg_info.c, CG_DrawInformation
========================
*/
void UI_DrawConnectScreen( qboolean overlay ) {
UI_LogFuncBegin();
const char *s;
uiClientState_t cstate;
char info[MAX_INFO_VALUE];
@ -149,9 +157,6 @@ void UI_DrawConnectScreen( qboolean overlay ) {
Menu_Cache();
if ( !overlay ) {
// draw the dialog background
// trap_R_SetColor( color_white );
// UI_DrawHandlePic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, uis.menuBackShader );
trap_R_SetColor( colorTable[CT_BLACK] );
UI_DrawHandlePic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, uis.whiteShader );
@ -264,20 +269,25 @@ void UI_DrawConnectScreen( qboolean overlay ) {
trap_Cvar_VariableStringBuffer( "cl_downloadName", downloadName, sizeof(downloadName) );
if (*downloadName) {
UI_DisplayDownloadInfo( downloadName );
UI_LogFuncEnd();
return;
}
}
s = menu_normal_text[MNT_AWAITINGGAMESTATE];
break;
case CA_LOADING:
UI_LogFuncEnd();
return;
case CA_PRIMED:
UI_LogFuncEnd();
return;
default:
UI_LogFuncEnd();
return;
}
UI_DrawProportionalString( 222, 442, s, UI_SMALLFONT|UI_DROPSHADOW, colorTable[CT_LTGOLD1] );
UI_LogFuncEnd();
// password required / connection rejected information goes here
}
@ -289,8 +299,11 @@ UI_KeyConnect
===================
*/
void UI_KeyConnect( int32_t key ) {
UI_LogFuncBegin();
if ( key == K_ESCAPE ) {
trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect\n" );
UI_LogFuncEnd();
return;
}
UI_LogFuncEnd();
}

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,7 @@
#include "ui_local.h"
#include "ui_logger.h"
#define MAX_DEVS 15 //Max number of developers per menu
#define MAX_MENUS 9 //Max number of menus
@ -326,146 +327,6 @@ static creditsInfo_t creditsInfo[MAX_MENUS] =
};
/*char *ra_leads[11] =
{
"PROJECT LEADS",
"Dominic 'Phenix' Black",
"Project Leader",
"Jason 'J2J' Griffith",
"Lead Programmer",
"Nazar 'Sharky' Surmai",
"Lead 2-D & Audio Artist",
"Timothy 'TiM' Oliver",
"Lead 3-D Artist",
"Sniper",
"Lead Level Designer"
};
char *ra_coders[11] =
{
"PROGRAMMING",
"Jason 'J2J' Griffith",
"Lead Programmer",
"Dominic 'Phenix' Black",
"Primary Coding",
"Stephen 'RedTechie' Shamakian",
"Primary Coding",
"Timothy 'TiM' Oliver",
"Graphics Coding",
"Scooter",
"Additional Coding"
};
char *ra_2D[11] =
{
"2-D ART",
"Nazar 'Sharky' Surmai",
"Lead 2-D Artist",
"Tom 'Simmo666' Simpson",
"Secondary 2-D Artist / LCARS Design Guru",
"Dominic 'Phenix' Black",
"Additional 2-D Art",
"Timothy 'TiM' Oliver",
"Additional 2-D Art",
"Steven Marriott",
"Rank Icons Creator"
};
char *ra_3D[7] =
{
"3-D ART",
"Timothy 'TiM' Oliver",
"Lead 3-D Artist",
"Ralph Schoberth",
"Enterprise-E LightWave Mesh",
"Timothy 'TiM' Oliver",
"Opening Cinematic"
};
char *ra_mappers[17] = //urk! how the hell is this going to fit?!?!? O_o
{
"LEVEL DESIGN",
"Sniper",
"Lead Level Artist",
"Anthony",
"Level Artist",
"Jack Amzadi",
"Level Artist",
"Johan",
"Level Artist",
"RED-RUM",
"Level Artist",
"Phenix",
"Level Artist",
"Scooter",
"Level Artist",
"William Riker",
"Level Artist",
};
char *ra_sounds[11] =
{
"AUDIO DESIGN",
"Nazar 'Sharky' Surmai",
"Audio Lead",
"Jaren",
"Additional Audio",
"Dominic 'Phenix' Black",
"Additional Audio",
"Timothy 'TiM' Oliver",
"Additional Audio",
"Scooter",
"Additional Audio"
};
char *ra_adds[11] =
{
"ADDITIONAL SUPPORT",
"Scooter",
"Canon Inspector",
"Highlander",
"Public Relations",
"Dominic 'Phenix' Black",
"Mod Documentation",
"Nazar 'Sharky' Surmai",
"Mod Documentation",
"Stephen 'RedTechie' Shamakian",
"Mod Documentation"
};
char *ra_betas[14] =
{
"BETA TESTERS",
"Alex L.",
"Alex Mcpherson",
"AlphaOmega",
"Andrew",
"Crusader",
"Diaz",
"Fred",
"Jake Conhale",
"Martin",
"Mr Fibbles",
"Myntz",
"Nuttycomputer",
"Rigs",
};
char *ra_thanks[11] =
{
"SPECIAL THANKS",
"Gene Roddenberry",
"Creator of Star Trek",
"Raven Software",
"Creators of Elite Force",
"The EF RPG Community",
"For Suggestions and Additional Testing",
"Steve",
"Creator of the original EF RPG Mod",
"James Monroe",
"Our friend from RavenSoft"
};*/
/*
=================
UI_drawCreditNames
@ -476,6 +337,7 @@ for each set
*/
void UI_drawCreditNames( int32_t creditsIndex )
{
UI_LogFuncBegin();
int32_t timeDeviation; //used to separate the times when each credit appears
int32_t yDeviation; //used to place each separate credit down the y-axis each loop
@ -560,7 +422,7 @@ void UI_drawCreditNames( int32_t creditsIndex )
}
}
UI_LogFuncEnd();
}
/*
@ -570,6 +432,7 @@ Credits_MenuEvent
*/
static void Credits_MenuEvent( void *ptr, int32_t event )
{
UI_LogFuncBegin();
if( event != QM_ACTIVATED )
{
return;
@ -596,6 +459,7 @@ static void Credits_MenuEvent( void *ptr, int32_t event )
s_credits.creditsNum = ((menucommon_s*)ptr)->id;
break;
}
UI_LogFuncEnd();
}
/*
@ -605,7 +469,7 @@ C_MainMenu_Graphics
*/
void CreditsMenu_Graphics (void)
{
UI_LogFuncBegin();
// Draw the basic screen layout
UI_MenuFrame(&s_credits.menu);
@ -627,17 +491,6 @@ void CreditsMenu_Graphics (void)
*/
trap_R_SetColor( colorTable[CT_WHITE]);
UI_DrawHandlePic(85, 169, 306, 256, spaceBackdrop);
/*
// Grid over top of space map
trap_R_SetColor( colorTable[CT_LTBLUE1]);
UI_DrawHandlePic( 89, 234, 296, 1, uis.whiteShader);
UI_DrawHandlePic( 89, 296, 296, 1, uis.whiteShader);
UI_DrawHandlePic( 89, 364, 296, 1, uis.whiteShader);
UI_DrawHandlePic( 116, 169, 1, 256, uis.whiteShader);
UI_DrawHandlePic( 234, 169, 1, 256, uis.whiteShader);
UI_DrawHandlePic( 354, 169, 1, 256, uis.whiteShader);
*/
//Left Bracket around galaxy picture
trap_R_SetColor( colorTable[CT_DKPURPLE2]);
@ -703,10 +556,12 @@ void CreditsMenu_Graphics (void)
UI_DrawHandlePic(s_credits.betas.generic.x - 14, s_credits.betas.generic.y,MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
UI_DrawHandlePic(s_credits.thanks.generic.x - 14, s_credits.thanks.generic.y,MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
UI_LogFuncBegin();
}
static void UI_drawLogo ( void )
{
UI_LogFuncBegin();
refdef_t refdef;
refEntity_t ent;
vec3_t origin = {0.0, 0.0, 0.0};
@ -774,6 +629,8 @@ static void UI_drawLogo ( void )
trap_R_AddRefEntityToScene( &ent );
trap_R_RenderScene( &refdef );
UI_LogFuncBegin();
}
/*
@ -783,6 +640,7 @@ CreditsMenu_Draw
*/
void CreditsMenu_Draw (void)
{
UI_LogFuncBegin();
CreditsMenu_Graphics();
@ -792,38 +650,7 @@ void CreditsMenu_Draw (void)
UI_drawCreditNames( s_credits.creditsNum-1 );
/*switch(s_credits.creditsNum)
{
case 0:
UI_drawCreditNames( ra_leads, 11 );
break;
case 1:
UI_drawCreditNames( ra_coders, 11 );
break;
case 2:
UI_drawCreditNames( ra_2D, 11 );
break;
case 3:
UI_drawCreditNames( ra_3D, 7 );
break;
case 4:
UI_drawCreditNames( ra_mappers, 17 );
break;
case 5:
UI_drawCreditNames( ra_sounds, 11 );
break;
case 6:
UI_drawCreditNames( ra_adds, 11 );
break;
case 7:
UI_drawCreditNames( ra_betas, 14 );
break;
case 8:
UI_drawCreditNames( ra_thanks, 11 );
break;
}*/
UI_LogFuncBegin();
}
/*
@ -833,10 +660,13 @@ UI_Credits_Cache
*/
void UI_CreditsMenu_Cache( void )
{
UI_LogFuncBegin();
s_credits.logoModel = trap_R_RegisterModel( MAIN_LOGO_MODEL );
s_credits.pingSound = trap_S_RegisterSound( LCARS_BLIP );
cornerUpper = trap_R_RegisterShaderNoMip( LCARS_CORNER_U );
spaceBackdrop = trap_R_RegisterShaderNoMip( LCARS_LOGO_BACKDROP );
UI_LogFuncBegin();
}
/*
@ -846,6 +676,7 @@ UI_Credits_MenuInit
*/
static void UI_Credits_MenuInit( void )
{
UI_LogFuncBegin();
memset( &s_credits, 0 ,sizeof(credits_t) );
s_credits.creditsNum = ID_LEADS;
@ -1045,6 +876,8 @@ static void UI_Credits_MenuInit( void )
Menu_AddItem( &s_credits.menu, &s_credits.extras );
Menu_AddItem( &s_credits.menu, &s_credits.betas );
Menu_AddItem( &s_credits.menu, &s_credits.thanks );
UI_LogFuncBegin();
}
/*
@ -1054,8 +887,9 @@ UI_CreditsMenu
*/
void UI_CreditsMenu( void )
{
UI_LogFuncBegin();
UI_Credits_MenuInit();
UI_PushMenu( &s_credits.menu );
UI_LogFuncBegin();
}

View file

@ -1,4 +1,5 @@
#include "ui_local.h"
#include "ui_logger.h"
//===================================================================
@ -15,15 +16,19 @@ InvertMouseCallback
*/
void InvertMouseCallback( void *s, int32_t notification )
{
UI_LogFuncBegin();
menulist_s *box = (menulist_s *) s;
if (notification != QM_ACTIVATED)
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
if ( box->curvalue )
trap_Cvar_SetValue( "m_pitch", -fabs( trap_Cvar_VariableValue( "m_pitch" ) ) );
else
trap_Cvar_SetValue( "m_pitch", fabs( trap_Cvar_VariableValue( "m_pitch" ) ) );
UI_LogFuncEnd();
}
@ -34,12 +39,16 @@ MouseSpeedCallback
*/
void MouseSpeedCallback( void *s, int32_t notification )
{
UI_LogFuncBegin();
menuslider_s *slider = (menuslider_s *) s;
if (notification != QM_ACTIVATED)
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
trap_Cvar_SetValue( "sensitivity", slider->curvalue );
UI_LogFuncEnd();
}
/*
@ -49,12 +58,16 @@ SmoothMouseCallback
*/
void SmoothMouseCallback( void *s, int32_t notification )
{
UI_LogFuncBegin();
menulist_s *box = (menulist_s *) s;
if (notification != QM_ACTIVATED)
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
trap_Cvar_SetValue( "m_filter", box->curvalue );
UI_LogFuncEnd();
}
/*
@ -64,12 +77,16 @@ GammaCallback
*/
void GammaCallback( void *s, int32_t notification )
{
UI_LogFuncBegin();
menuslider_s *slider = ( menuslider_s * ) s;
if (notification != QM_ACTIVATED)
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
trap_Cvar_SetValue( "r_gamma", slider->curvalue / 10.0f );
UI_LogFuncEnd();
}
@ -80,12 +97,16 @@ IntensityCallback
*/
void IntensityCallback( void *s, int32_t notification )
{
UI_LogFuncBegin();
menuslider_s *slider = ( menuslider_s * ) s;
if (notification != QM_ACTIVATED)
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
trap_Cvar_SetValue( "r_intensity", slider->curvalue / 10.0f );
UI_LogFuncEnd();
}
/*
@ -95,12 +116,16 @@ ScreensizeCallback
*/
void ScreensizeCallback( void *s, int32_t notification )
{
UI_LogFuncBegin();
menuslider_s *slider = ( menuslider_s * ) s;
if (notification != QM_ACTIVATED)
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
trap_Cvar_SetValue( "cg_viewsize", slider->curvalue);
UI_LogFuncEnd();
}
/*
@ -110,12 +135,16 @@ AlwaysRunCallback
*/
void AlwaysRunCallback( void *s, int32_t notification )
{
UI_LogFuncBegin();
menulist_s *s_alwaysrun_box = ( menulist_s * ) s;
if (notification != QM_ACTIVATED)
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
trap_Cvar_SetValue( "cl_run", s_alwaysrun_box->curvalue );
UI_LogFuncEnd();
}
@ -126,12 +155,16 @@ AutoswitchCallback
*/
void AutoswitchCallback( void *unused, int32_t notification )
{
UI_LogFuncBegin();
static menulist_s s_autoswitch_box;
if (notification != QM_ACTIVATED)
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
trap_Cvar_SetValue( "cg_autoswitch", s_autoswitch_box.curvalue );
UI_LogFuncEnd();
}
@ -142,14 +175,16 @@ AnisotropicFilteringCallback
*/
void AnisotropicFilteringCallback( void *s, int32_t notification )
{
UI_LogFuncBegin();
menulist_s *anisotropicfiltering = ( menulist_s * ) s;
if (notification != QM_ACTIVATED)
{
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
trap_Cvar_SetValue( "r_ext_texture_filter_anisotropic", anisotropicfiltering->curvalue );
UI_LogFuncEnd();
}
/*
@ -159,12 +194,16 @@ JoyXButtonCallback
*/
void JoyXButtonCallback( void *s, int32_t notification )
{
UI_LogFuncBegin();
menulist_s *box = (menulist_s *) s;
if (notification != QM_ACTIVATED)
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
trap_Cvar_SetValue( "joy_xbutton", box->curvalue );
UI_LogFuncEnd();
}
/*
@ -174,10 +213,14 @@ JoyYButtonCallback
*/
void JoyYButtonCallback( void *s, int32_t notification )
{
UI_LogFuncBegin();
menulist_s *box = (menulist_s *) s;
if (notification != QM_ACTIVATED)
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
trap_Cvar_SetValue( "joy_ybutton", box->curvalue );
UI_LogFuncEnd();
}

View file

@ -10,6 +10,7 @@ DEMOS MENU
#include "ui_local.h"
#include "ui_logger.h"
#define MAX_DEMOS 128
@ -107,6 +108,7 @@ of demos we have
=================
*/
void DemoMenu_PopulateList ( int32_t startingIndex ) {
UI_LogFuncBegin();
int32_t i=0, len;
char* demoName;
@ -148,6 +150,7 @@ void DemoMenu_PopulateList ( int32_t startingIndex ) {
i++;
}
UI_LogFuncEnd();
}
/*
@ -157,6 +160,7 @@ DemoMenu_Graphics
*/
static void DemoMenu_Graphics (void)
{
UI_LogFuncBegin();
// Draw the basic screen layout
UI_MenuFrame(&s_demos.menu);
@ -213,6 +217,7 @@ static void DemoMenu_Graphics (void)
UI_DrawProportionalString( 124, 67, "67B",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 220, 169, menu_normal_text[MNT_CURRENTDEMOSAVAILABLE], UI_SMALLFONT, colorTable[CT_BLACK]);
UI_LogFuncEnd();
}
/*
@ -222,11 +227,12 @@ Demos_MenuDraw
*/
static void Demos_MenuDraw (void)
{
UI_LogFuncBegin();
// Draw graphics particular to Demo Menu
DemoMenu_Graphics();
Menu_Draw( &s_demos.menu );
UI_LogFuncEnd();
}
@ -237,10 +243,12 @@ Demos_MenuEvent
*/
static void Demos_MenuEvent( void *ptr, int32_t event )
{
UI_LogFuncBegin();
int32_t index;
if( event != QM_ACTIVATED )
{
UI_LogFuncEnd();
return;
}
@ -298,6 +306,7 @@ static void Demos_MenuEvent( void *ptr, int32_t event )
UI_PopMenu();
break;
}
UI_LogFuncEnd();
}
@ -308,6 +317,8 @@ UI_DemosMenu_Key
*/
static sfxHandle_t UI_DemosMenu_Key( int32_t key )
{
UI_LogFuncBegin();
UI_LogFuncEnd();
return Menu_DefaultKey( &s_demos.menu, key );
}
@ -318,6 +329,7 @@ UI_DemosMenu_Cache
*/
void UI_DemosMenu_Cache( void )
{
UI_LogFuncBegin();
s_demos.currentGameTopLeft = trap_R_RegisterShaderNoMip("menu/common/corner_ul_18_24.tga");
s_demos.currentGameBotLeft = trap_R_RegisterShaderNoMip("menu/common/corner_ll_18_18.tga");
s_demos.currentGameTopRight = trap_R_RegisterShaderNoMip("menu/common/corner_ur_18_24.tga");
@ -328,7 +340,7 @@ void UI_DemosMenu_Cache( void )
trap_R_RegisterShaderNoMip( "menu/common/arrow_up_16.tga" );
trap_R_RegisterShaderNoMip( "menu/common/arrow_dn_16.tga" );
trap_R_RegisterShaderNoMip( PIC_UNDERLINE );
UI_LogFuncEnd();
}
@ -339,6 +351,7 @@ Demos_MenuInit
*/
static void Demos_MenuInit( void )
{
UI_LogFuncBegin();
int32_t i,x,y;
int32_t len;
char *demoname;
@ -529,6 +542,7 @@ static void Demos_MenuInit( void )
Menu_AddItem( &s_demos.menu, &s_demos.currentFile );
Menu_AddItem( &s_demos.menu, &s_demos.upArrow );
Menu_AddItem( &s_demos.menu, &s_demos.downArrow );
UI_LogFuncEnd();
}
@ -539,6 +553,8 @@ UI_DemosMenu
*/
void UI_DemosMenu( void )
{
UI_LogFuncBegin();
Demos_MenuInit();
UI_PushMenu( &s_demos.menu );
UI_LogFuncEnd();
}

View file

@ -12,6 +12,7 @@ they want their characters to play ingame.
*/
#include "ui_local.h"
#include "ui_logger.h"
#define ID_RECENT 1
#define ID_FAVORITES 2
@ -65,14 +66,6 @@ static void PlayerEmotes_FillEmotesArray( int32_t emoteCategory );
static void PlayerEmotes_UpdateScrollBar( menuaction_s *bar );
static void PlayerEmotes_SetupScrollBar( menuaction_s *bar );
//Un-necessary, emoteNum can be derived from
//the order in the list
/*typedef struct {
char emoteNameUpr[16];
int32_t emoteNum;
} listEmote_t;*/
//TiM - data necessary for a scroll bar
typedef struct
{
@ -157,11 +150,13 @@ Player_SpinPlayer
*/
static void PlayerEmotes_SpinPlayer( void* ptr, int32_t event)
{
UI_LogFuncBegin();
if ( event == QM_ACTIVATED )
{
uis.spinView = qtrue;
uis.cursorpx = uis.cursorx;
}
UI_LogFuncEnd();
}
/*
@ -171,6 +166,7 @@ Player_InitModel
*/
static void PlayerEmotes_InitModel( void )
{
UI_LogFuncBegin();
memset( &s_playerEmotes.playerInfo, 0, sizeof(playerInfo_t) );
UI_PlayerInfo_SetModel( &s_playerEmotes.playerInfo, UI_Cvar_VariableString( "model" ) );
@ -192,6 +188,7 @@ static void PlayerEmotes_InitModel( void )
trap_Cvar_VariableValue( "height" ),
trap_Cvar_VariableValue( "weight" ),
qfalse );
UI_LogFuncEnd();
}
/*
@ -201,6 +198,7 @@ Player_DrawPlayer
*/
static void PlayerEmotes_DrawPlayer( void ) //*self )
{
UI_LogFuncBegin();
vec3_t origin = {-20, 5, -4 };//{ 0, 3.8, 0};
char buf[MAX_QPATH];
@ -224,6 +222,7 @@ static void PlayerEmotes_DrawPlayer( void ) //*self )
}
UI_DrawPlayer( s_playerEmotes.playerMdl.generic.x, s_playerEmotes.playerMdl.generic.y, s_playerEmotes.playerMdl.width, s_playerEmotes.playerMdl.height, origin, &s_playerEmotes.playerInfo, uis.realtime );
UI_LogFuncEnd();
}
/*
@ -235,6 +234,7 @@ do the emote animation
=================
*/
static void Player_DoEmote( int32_t emoteNum ) {
UI_LogFuncBegin();
emoteList_t *emote;
int32_t torsoAnim = BOTH_STAND1;
int32_t legsAnim = BOTH_STAND1;
@ -245,8 +245,10 @@ static void Player_DoEmote( int32_t emoteNum ) {
//Com_Printf( S_COLOR_RED "Emote num: %i, Enum: %i, Legs time: %i\n", emoteNum, emote->enumName );
if ( !emote )
if ( !emote ){
UI_LogFuncEnd();
return;
}
if ( emote->bodyFlags & EMOTE_LOWER )
{
@ -283,6 +285,7 @@ static void Player_DoEmote( int32_t emoteNum ) {
s_playerEmotes.viewAngles[YAW] = uis.lastYaw;
UI_PlayerInfo_SetInfo( &s_playerEmotes.playerInfo, legsAnim, torsoAnim, s_playerEmotes.viewAngles, vec3_origin, WP_0, trap_Cvar_VariableValue( "height" ), trap_Cvar_VariableValue( "weight" ), qfalse );
UI_LogFuncEnd();
}
/*
@ -296,17 +299,20 @@ well as when the arrow key is clicked
*/
static void PlayerEmotes_BuildEmotesList( int32_t *emoteListOffset )
{
UI_LogFuncBegin();
int32_t i;
int32_t offset;
//clamp the offset value
if ( *emoteListOffset < 0 ) {
*emoteListOffset = 0;
UI_LogFuncEnd();
return;
}
if ( s_playerEmotes.numEmotes > MAX_MENULISTITEMS && *emoteListOffset > s_playerEmotes.numEmotes - MAX_MENULISTITEMS ) {
*emoteListOffset = s_playerEmotes.numEmotes - MAX_MENULISTITEMS;
UI_LogFuncEnd();
return;
}
@ -331,6 +337,7 @@ static void PlayerEmotes_BuildEmotesList( int32_t *emoteListOffset )
s_playerEmotes.emotesMenu[i].generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_playerEmotes.emotesMenu[i].textPtr = s_playerEmotes.emoteNames[i];
}
UI_LogFuncEnd();
}
/*
@ -344,6 +351,7 @@ with these new emotes
===============
*/
static void PlayerEmotes_FillEmotesArray( int32_t emoteCategory ) {
UI_LogFuncBegin();
int32_t i;
emoteList_t *emote;
@ -483,6 +491,7 @@ static void PlayerEmotes_FillEmotesArray( int32_t emoteCategory ) {
s_playerEmotes.emoteListOffset = 0;
PlayerEmotes_BuildEmotesList( &s_playerEmotes.emoteListOffset );
UI_LogFuncEnd();
}
/*
@ -493,7 +502,8 @@ Now to handle the tonnes of button
checks n' stuff
===============
*/
static void PlayerEmotes_HandleNewEmote( int32_t buttonId ) {
static void PlayerEmotes_HandleNewEmote( int32_t buttonId ) {
UI_LogFuncBegin();
int32_t i;
int32_t buttonPressed = buttonId - 100; //offset by 100 so they wouldn't get in the way
char binding[256];
@ -542,6 +552,7 @@ static void PlayerEmotes_HandleNewEmote( int32_t buttonId ) {
//make our player character do teh emote
Player_DoEmote( s_playerEmotes.selectedEmote );
UI_LogFuncEnd();
}
/*
@ -550,13 +561,16 @@ PlayerEmotes_HandleFav
===============
*/
static void PlayerEmotes_HandleFav( void ) {
UI_LogFuncBegin();
int32_t i;
char* cvar;
//safety net lol
if ( s_playerEmotes.selectedEmote < 0 )
if ( s_playerEmotes.selectedEmote < 0 ){
UI_LogFuncEnd();
return;
}
//this emote's been favved, so I guess we're unfaving it now
if ( s_playerEmotes.favvedEmote > 0 ) {
@ -620,6 +634,7 @@ static void PlayerEmotes_HandleFav( void ) {
s_playerEmotes.addFav.textEnum = MBT_KILL_FAV_EMOTE;
}
}
UI_LogFuncEnd();
}
/*
@ -628,12 +643,14 @@ PlayerEmotes_ExecuteOffset
===============
*/
static void PlayerEmotes_ExecuteOffset( void ) {
UI_LogFuncBegin();
int32_t offset;
offset = atoi( s_playerEmotes.modelOffset.field.buffer );
if ( offset != s_playerEmotes.prevOffset )
trap_Cmd_ExecuteText( EXEC_APPEND, va( "modelOffset %i\n", offset ) );
UI_LogFuncEnd();
}
/*
@ -642,9 +659,12 @@ PlayerEmotes_Event
===============
*/
static void PlayerEmotes_Event( void* ptr, int32_t event ) {
UI_LogFuncBegin();
if ( event != QM_ACTIVATED )
if ( event != QM_ACTIVATED ){
UI_LogFuncEnd();
return;
}
s_playerEmotes.keyBindActive = qfalse;
@ -710,6 +730,7 @@ static void PlayerEmotes_Event( void* ptr, int32_t event ) {
UI_PopMenu();
break;
}
UI_LogFuncEnd();
}
/*
@ -718,6 +739,7 @@ PlayerEmotes_Draw
===============
*/
static void PlayerEmotes_Draw( void ) {
UI_LogFuncBegin();
UI_MenuFrame( &s_playerEmotes.menu );
//Left side LCARS bars
@ -855,6 +877,7 @@ static void PlayerEmotes_Draw( void ) {
s_playerEmotes.playEmote.textEnum = MBT_DO_EMOTE;
Menu_Draw( &s_playerEmotes.menu );
UI_LogFuncEnd();
}
/*
@ -863,6 +886,7 @@ PlayerEmotes_DrawBinding
===============
*/
static void PlayerEmotes_DrawBinding( void *self ) {
UI_LogFuncBegin();
qboolean focus;
menuaction_s *action;
int32_t x,y;
@ -936,6 +960,7 @@ static void PlayerEmotes_DrawBinding( void *self ) {
else
textColor = CT_WHITE;
UI_DrawProportionalString( x + action->textX, y + action->textY + MENU_BUTTON_MED_HEIGHT + 4, name, UI_CENTER | UI_SMALLFONT, colorTable[textColor] );
UI_LogFuncEnd();
}
/*
@ -945,6 +970,7 @@ PlayerEmotes_DrawScrollBar
*/
static void PlayerEmotes_DrawScrollBar( void *self )
{
UI_LogFuncBegin();
qboolean focus;
menuaction_s *bar;
int32_t *y;
@ -965,8 +991,10 @@ static void PlayerEmotes_DrawScrollBar( void *self )
UI_DrawHandlePic( bar->generic.x, bar->generic.y, bar->width, bar->height, uis.whiteShader);
trap_R_SetColor( NULL );
if ( !s_playerEmotes.scrollData.mouseDown )
if ( !s_playerEmotes.scrollData.mouseDown ){
UI_LogFuncEnd();
return;
}
if ( !trap_Key_IsDown( K_MOUSE1 ) )
{
@ -975,8 +1003,10 @@ static void PlayerEmotes_DrawScrollBar( void *self )
return;
}
if ( uis.cursory == s_playerEmotes.scrollData.yStart )
if ( uis.cursory == s_playerEmotes.scrollData.yStart ){
UI_LogFuncEnd();
return;
}
y = &bar->generic.y;
@ -998,6 +1028,7 @@ static void PlayerEmotes_DrawScrollBar( void *self )
bar->generic.bottom = *y + bar->height;
s_playerEmotes.scrollData.yStart = uis.cursory;
UI_LogFuncEnd();
}
/*
@ -1007,12 +1038,14 @@ PlayerEmotes_SetupScrollBar
*/
static void PlayerEmotes_SetupScrollBar( menuaction_s *bar )
{
UI_LogFuncBegin();
int32_t height;
//first make sure it's worth enabling this at all
if ( s_playerEmotes.numEmotes <= MAX_MENULISTITEMS )
{
bar->generic.flags = QMF_INACTIVE | QMF_HIDDEN;
UI_LogFuncEnd();
return;
}
@ -1041,6 +1074,7 @@ static void PlayerEmotes_SetupScrollBar( menuaction_s *bar )
bar->height = height;
bar->generic.bottom = bar->generic.y + height;
UI_LogFuncEnd();
}
@ -1051,9 +1085,11 @@ PlayerEmotes_UpdateScrollBar
*/
static void PlayerEmotes_UpdateScrollBar( menuaction_s *bar )
{
UI_LogFuncBegin();
bar->generic.y = MAX_SCROLLTOP + s_playerEmotes.emoteListOffset*(s_playerEmotes.scrollData.doubleStep ? 0.5 : 1);
bar->generic.top = bar->generic.y;
bar->generic.bottom = bar->generic.top + bar->height;
UI_LogFuncEnd();
}
/*
@ -1062,6 +1098,7 @@ PlayerEmotes_KeyEvent
===============
*/
static sfxHandle_t PlayerEmotes_KeyEvent ( int32_t key ) {
UI_LogFuncBegin();
menucommon_s *s;
int32_t i;
char command[256];
@ -1099,6 +1136,7 @@ static sfxHandle_t PlayerEmotes_KeyEvent ( int32_t key ) {
s_playerEmotes.keyBindActive = qfalse;
UI_LogFuncEnd();
return ( menu_out_sound );
}
else {
@ -1117,6 +1155,7 @@ static sfxHandle_t PlayerEmotes_KeyEvent ( int32_t key ) {
s_playerEmotes.bindValue = -1;
}
}
UI_LogFuncEnd();
return ( menu_out_sound );
}
}
@ -1139,15 +1178,18 @@ static sfxHandle_t PlayerEmotes_KeyEvent ( int32_t key ) {
trap_Cmd_ExecuteText( EXEC_APPEND, va( "wait 5;emote %s\n", bg_emoteList[emoteId].name ) );
UI_ForceMenuOff();
UI_LogFuncEnd();
return menu_out_sound;
}
}
end:
UI_LogFuncEnd();
return ( Menu_DefaultKey( &s_playerEmotes.menu, key ) );
}
void UI_PlayerEmotes_Cache( void ) {
UI_LogFuncBegin();
s_playerEmotes.corner_ll_4_4 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_4_4");
s_playerEmotes.corner_ll_4_18 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_4_18");
@ -1157,6 +1199,7 @@ void UI_PlayerEmotes_Cache( void ) {
trap_R_RegisterShaderNoMip(PIC_ARROW_UP);
trap_R_RegisterShaderNoMip(PIC_ARROW_DOWN);
UI_LogFuncEnd();
}
/*
@ -1165,6 +1208,7 @@ PlayerEmotes_Init
===============
*/
static void PlayerEmotes_Init( void ) {
UI_LogFuncBegin();
int32_t x, y;
int32_t i;
qboolean showRecent = qfalse;
@ -1557,6 +1601,7 @@ static void PlayerEmotes_Init( void ) {
PlayerEmotes_SetupScrollBar( &s_playerEmotes.scrollBar );
PlayerEmotes_UpdateScrollBar( &s_playerEmotes.scrollBar );
UI_LogFuncEnd();
}
/*
@ -1565,6 +1610,7 @@ UI_EmotesMenu
===============
*/
void UI_EmotesMenu( qboolean fromConsole ) {
UI_LogFuncBegin();
memset( &s_playerEmotes, 0, sizeof( s_playerEmotes ) );
s_playerEmotes.fromConsole = fromConsole;
@ -1574,4 +1620,5 @@ void UI_EmotesMenu( qboolean fromConsole ) {
Mouse_Show();
UI_PushMenu( &s_playerEmotes.menu );
UI_LogFuncEnd();
}

View file

@ -1,4 +1,5 @@
#include "ui_local.h"
#include "ui_logger.h"
//===================================================================
//
@ -21,12 +22,6 @@ static int32_t currentFont;
#define ID_FONT_GRID 304
static menuframework_s s_fonts_menu;
//static menubitmap_s s_cdkey_mainmenu;
//static menubitmap_s s_cdkey_controls;
//static menubitmap_s s_cdkey_video;
//static menubitmap_s s_cdkey_sound;
//static menubitmap_s s_cdkey_game;
//static menubitmap_s s_cdkey_cdkey;
static menubitmap_s s_fonts_small;
static menubitmap_s s_fonts_medium;
static menubitmap_s s_fonts_large;
@ -39,6 +34,7 @@ M_GridFont_Graphics
*/
void M_GridFont_Graphics (void)
{
UI_LogFuncBegin();
int32_t x,y;
int32_t i,i2,xInc;
char character[2];
@ -67,6 +63,7 @@ void M_GridFont_Graphics (void)
}
y += (SMALLCHAR_HEIGHT * 1.25);
}
UI_LogFuncEnd();
}
/*
@ -76,6 +73,7 @@ M_LargeFont_Graphics
*/
void M_LargeFont_Graphics (void)
{
UI_LogFuncBegin();
int32_t x,y,color;
int32_t i,i2,xInc;
char character[2];
@ -104,7 +102,7 @@ void M_LargeFont_Graphics (void)
}
y += 30;
}
UI_LogFuncEnd();
}
/*
@ -114,6 +112,7 @@ M_MediumFont_Graphics
*/
void M_MediumFont_Graphics (void)
{
UI_LogFuncBegin();
int32_t x,y,color;
int32_t i,i2,xInc;
char character[2];
@ -142,6 +141,7 @@ void M_MediumFont_Graphics (void)
}
y += 24;
}
UI_LogFuncEnd();
}
/*
@ -151,6 +151,7 @@ M_SmallFont_Graphics
*/
void M_SmallFont_Graphics (void)
{
UI_LogFuncBegin();
int32_t x,y,color;
int32_t i,i2,xInc;
char character[2];
@ -179,6 +180,7 @@ void M_SmallFont_Graphics (void)
}
y += 16;
}
UI_LogFuncEnd();
}
@ -189,7 +191,7 @@ M_Fonts_Graphics
*/
void M_Fonts_Graphics (void)
{
UI_LogFuncBegin();
UI_MenuFrame(&s_fonts_menu);
UI_Setup_MenuButtons();
@ -213,7 +215,7 @@ void M_Fonts_Graphics (void)
M_GridFont_Graphics();
break;
}
UI_LogFuncEnd();
}
/*
@ -223,9 +225,11 @@ M_Fonts_MenuDraw
*/
void M_Fonts_MenuDraw (void)
{
UI_LogFuncBegin();
M_Fonts_Graphics();
Menu_Draw( &s_fonts_menu );
UI_LogFuncEnd();
}
/*
@ -235,8 +239,11 @@ Fonts_MenuEvent
*/
static void Fonts_MenuEvent( void* ptr, int32_t notification )
{
if (notification != QM_ACTIVATED)
UI_LogFuncBegin();
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
switch (((menucommon_s*)ptr)->id)
{
@ -272,6 +279,7 @@ static void Fonts_MenuEvent( void* ptr, int32_t notification )
UI_PopMenu();
break;
}
UI_LogFuncEnd();
}
/*
@ -281,6 +289,8 @@ M_Fonts_MenuKey
*/
static sfxHandle_t M_Fonts_MenuKey( int32_t key )
{
UI_LogFuncBegin();
UI_LogFuncEnd();
return Menu_DefaultKey( &s_fonts_menu, key );
}
@ -292,7 +302,8 @@ UI_FontsMenu_Cache
*/
void UI_FontsMenu_Cache( void )
{
;
UI_LogFuncBegin();
UI_LogFuncEnd();
}
@ -303,6 +314,7 @@ FontsMenu_Init
*/
void FontsMenu_Init(void)
{
UI_LogFuncBegin();
UI_FontsMenu_Cache();
s_fonts_menu.nitems = 0;
@ -394,7 +406,7 @@ void FontsMenu_Init(void)
Menu_AddItem( &s_fonts_menu, ( void * )&s_fonts_grid);
currentFont = ID_FONT_SMALL;
UI_LogFuncEnd();
}
/*
@ -404,9 +416,10 @@ UI_FontsMenu
*/
void UI_FontsMenu( void)
{
UI_LogFuncBegin();
FontsMenu_Init();
UI_PushMenu( &s_fonts_menu);
UI_LogFuncEnd();
}

View file

@ -5,6 +5,7 @@
//
#include "ui_local.h"
#include "ui_logger.h"
//
@ -37,10 +38,12 @@ UI_Alloc
===============
*/
void *UI_Alloc( int32_t size ) {
UI_LogFuncBegin();
char *p;
if ( allocPoint + size > POOLSIZE ) {
outOfMemory = qtrue;
UI_LogFuncEnd();
return NULL;
}
@ -48,6 +51,7 @@ void *UI_Alloc( int32_t size ) {
allocPoint += ( size + 31 ) & ~31;
UI_LogFuncEnd();
return p;
}
@ -57,8 +61,10 @@ UI_InitMemory
===============
*/
void UI_InitMemory( void ) {
UI_LogFuncBegin();
allocPoint = 0;
outOfMemory = qfalse;
UI_LogFuncEnd();
}
/*
@ -67,6 +73,7 @@ UI_ParseInfos
===============
*/
int32_t UI_ParseInfos( char *buf, int32_t max, char *infos[] ) {
UI_LogFuncBegin();
char *token;
int32_t count;
char key[MAX_TOKEN_CHARS];
@ -114,6 +121,7 @@ int32_t UI_ParseInfos( char *buf, int32_t max, char *infos[] ) {
count++;
}
}
UI_LogFuncEnd();
return count;
}
@ -123,6 +131,7 @@ UI_LoadArenasFromFile
===============
*/
static void UI_LoadArenasFromFile( char *filename ) {
UI_LogFuncBegin();
int32_t len;
fileHandle_t f;
char buf[MAX_ARENAS_TEXT];
@ -130,11 +139,13 @@ static void UI_LoadArenasFromFile( char *filename ) {
len = trap_FS_FOpenFile( filename, &f, FS_READ );
if ( !f ) {
trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) );
UI_LogFuncEnd();
return;
}
if ( len >= MAX_ARENAS_TEXT ) {
trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_ARENAS_TEXT ) );
trap_FS_FCloseFile( f );
UI_LogFuncEnd();
return;
}
@ -152,6 +163,7 @@ UI_LoadArenas
===============
*/
static void UI_LoadArenas( void ) {
UI_LogFuncBegin();
int32_t numdirs;
vmCvar_t arenasFile;
char filename[128];
@ -216,12 +228,6 @@ static void UI_LoadArenas( void ) {
}
}
// n = ui_numSinglePlayerArenas % ARENAS_PER_TIER;
// if( n != 0 ) {
// ui_numSinglePlayerArenas -= n;
// trap_Print( va( "%i arenas ignored to make count divisible by %i\n", n, ARENAS_PER_TIER ) );
// }
// go through once more and assign number to the levels
singlePlayerNum = 0;
specialNum = singlePlayerNum + ui_numSinglePlayerArenas;
@ -255,21 +261,24 @@ UI_GetArenaInfoByNumber
===============
*/
const char *UI_GetArenaInfoByNumber( int32_t num ) {
UI_LogFuncBegin();
int32_t n;
char *value;
if( num < 0 || num >= ui_numArenas ) {
trap_Print( va( S_COLOR_RED "Invalid arena number: %i\n", num ) );
UI_LogFuncEnd();
return NULL;
}
for( n = 0; n < ui_numArenas; n++ ) {
value = Info_ValueForKey( ui_arenaInfos[n], "num" );
if( *value && atoi(value) == num ) {
UI_LogFuncEnd();
return ui_arenaInfos[n];
}
}
UI_LogFuncEnd();
return NULL;
}
@ -280,14 +289,16 @@ UI_GetArenaInfoByMap
===============
*/
const char *UI_GetArenaInfoByMap( const char *map ) {
UI_LogFuncBegin();
int32_t n;
for( n = 0; n < ui_numArenas; n++ ) {
if( Q_stricmp( Info_ValueForKey( ui_arenaInfos[n], "map" ), map ) == 0 ) {
UI_LogFuncEnd();
return ui_arenaInfos[n];
}
}
UI_LogFuncEnd();
return NULL;
}
@ -298,14 +309,16 @@ UI_GetSpecialArenaInfo
===============
*/
const char *UI_GetSpecialArenaInfo( const char *tag ) {
UI_LogFuncBegin();
int32_t n;
for( n = 0; n < ui_numArenas; n++ ) {
if( Q_stricmp( Info_ValueForKey( ui_arenaInfos[n], "special" ), tag ) == 0 ) {
UI_LogFuncEnd();
return ui_arenaInfos[n];
}
}
UI_LogFuncEnd();
return NULL;
}
@ -315,6 +328,7 @@ UI_LoadBotsFromFile
===============
*/
static void UI_LoadBotsFromFile( char *filename ) {
UI_LogFuncBegin();
int32_t len;
fileHandle_t f;
char buf[MAX_BOTS_TEXT];
@ -322,11 +336,13 @@ static void UI_LoadBotsFromFile( char *filename ) {
len = trap_FS_FOpenFile( filename, &f, FS_READ );
if ( !f ) {
trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) );
UI_LogFuncEnd();
return;
}
if ( len >= MAX_BOTS_TEXT ) {
trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_BOTS_TEXT ) );
trap_FS_FCloseFile( f );
UI_LogFuncEnd();
return;
}
@ -336,6 +352,7 @@ static void UI_LoadBotsFromFile( char *filename ) {
ui_numBots += UI_ParseInfos( buf, MAX_BOTS - ui_numBots, &ui_botInfos[ui_numBots] );
if (outOfMemory) trap_Print(S_COLOR_YELLOW"WARNING: not enough memory in pool to load all bots\n");
UI_LogFuncEnd();
}
@ -345,6 +362,7 @@ UI_LoadBots
===============
*/
static void UI_LoadBots( void ) {
UI_LogFuncBegin();
vmCvar_t botsFile;
int32_t numdirs;
char filename[128];
@ -373,6 +391,7 @@ static void UI_LoadBots( void ) {
UI_LoadBotsFromFile(filename);
}
trap_Print( va( "%i bots parsed\n", ui_numBots ) );
UI_LogFuncEnd();
}
@ -382,10 +401,13 @@ UI_GetBotInfoByNumber
===============
*/
char *UI_GetBotInfoByNumber( int32_t num ) {
UI_LogFuncBegin();
if( num < 0 || num >= ui_numBots ) {
trap_Print( va( S_COLOR_RED "Invalid bot number: %i\n", num ) );
UI_LogFuncEnd();
return NULL;
}
UI_LogFuncEnd();
return ui_botInfos[num];
}
@ -396,16 +418,18 @@ UI_GetBotInfoByName
===============
*/
char *UI_GetBotInfoByName( const char *name ) {
UI_LogFuncBegin();
int32_t n;
char *value;
for ( n = 0; n < ui_numBots ; n++ ) {
value = Info_ValueForKey( ui_botInfos[n], "name" );
if ( !Q_stricmp( value, name ) ) {
UI_LogFuncEnd();
return ui_botInfos[n];
}
}
UI_LogFuncEnd();
return NULL;
}
@ -422,6 +446,7 @@ Returns the player's best finish on a given level, 0 if the have not played the
===============
*/
void UI_GetBestScore( int32_t level, int32_t *score, int32_t *skill ) {
UI_LogFuncBegin();
int32_t n;
int32_t skillScore;
int32_t bestScore;
@ -430,10 +455,12 @@ void UI_GetBestScore( int32_t level, int32_t *score, int32_t *skill ) {
char scores[MAX_INFO_VALUE];
if( !score || !skill ) {
UI_LogFuncEnd();
return;
}
if( level < 0 || level > ui_numArenas ) {
UI_LogFuncEnd();
return;
}
@ -458,6 +485,7 @@ void UI_GetBestScore( int32_t level, int32_t *score, int32_t *skill ) {
*score = bestScore;
*skill = bestScoreSkill;
UI_LogFuncEnd();
}
@ -469,6 +497,7 @@ Set the player's best finish for a level
===============
*/
void UI_SetBestScore( int32_t level, int32_t score ) {
UI_LogFuncBegin();
int32_t skill;
int32_t oldScore;
char arenaKey[16];
@ -476,12 +505,14 @@ void UI_SetBestScore( int32_t level, int32_t score ) {
// validate score
if( score < 1 || score > 8 ) {
UI_LogFuncEnd();
return;
}
// validate skill
skill = (int32_t)trap_Cvar_VariableValue( "g_spSkill" );
if( skill < 1 || skill > 5 ) {
UI_LogFuncEnd();
return;
}
@ -492,12 +523,14 @@ void UI_SetBestScore( int32_t level, int32_t score ) {
Com_sprintf( arenaKey, sizeof( arenaKey ), "l%i", level );
oldScore = atoi( Info_ValueForKey( scores, arenaKey ) );
if( oldScore && oldScore <= score ) {
UI_LogFuncEnd();
return;
}
// update scores
Info_SetValueForKey( scores, arenaKey, va( "%i", score ) );
trap_Cvar_Set( va( "g_spScores%i", skill ), scores );
UI_LogFuncEnd();
}
@ -507,16 +540,19 @@ UI_LogAwardData
===============
*/
void UI_LogAwardData( int32_t award, int32_t data ) {
UI_LogFuncBegin();
char key[16];
char awardData[MAX_INFO_VALUE];
int32_t oldValue;
if( data == 0 ) {
UI_LogFuncEnd();
return;
}
if( award >= AWARD_MAX ) {
trap_Print( va( S_COLOR_RED "Bad award %i in UI_LogAwardData\n", award ) );
UI_LogFuncEnd();
return;
}
@ -536,12 +572,14 @@ UI_GetAwardLevel
===============
*/
int32_t UI_GetAwardLevel( int32_t award ) {
UI_LogFuncBegin();
char key[16];
char awardData[MAX_INFO_VALUE];
trap_Cvar_VariableStringBuffer( "g_spAwards", awardData, sizeof(awardData) );
Com_sprintf( key, sizeof(key), "a%i", award );
UI_LogFuncEnd();
return atoi( Info_ValueForKey( awardData, key ) );
}
@ -552,6 +590,7 @@ UI_TierCompleted
===============
*/
int32_t UI_TierCompleted( int32_t levelWon ) {
UI_LogFuncBegin();
int32_t level;
int32_t n;
int32_t tier;
@ -566,12 +605,15 @@ int32_t UI_TierCompleted( int32_t levelWon ) {
if( tier == UI_GetNumSPTiers() ) {
info = UI_GetSpecialArenaInfo( "training" );
if( levelWon == atoi( Info_ValueForKey( info, "num" ) ) ) {
UI_LogFuncEnd();
return 0;
}
info = UI_GetSpecialArenaInfo( "final" );
if( !info || levelWon == atoi( Info_ValueForKey( info, "num" ) ) ) {
UI_LogFuncEnd();
return tier + 1;
}
UI_LogFuncEnd();
return -1;
}
@ -583,9 +625,11 @@ int32_t UI_TierCompleted( int32_t levelWon ) {
for( n = 0; n < maxarenas; n++, level++ ) {
UI_GetBestScore( level, &score, &skill );
if ( score != 1 ) {
UI_LogFuncEnd();
return -1;
}
}
UI_LogFuncEnd();
return tier + 1;
}
@ -599,6 +643,7 @@ Returns the next level the player has not won
===============
*/
int32_t UI_GetCurrentGame( int32_t curLevel ) {
UI_LogFuncBegin();
int32_t level;
int32_t rank;
int32_t skill;
@ -609,6 +654,7 @@ int32_t UI_GetCurrentGame( int32_t curLevel ) {
level = atoi( Info_ValueForKey( info, "num" ) );
UI_GetBestScore( level, &rank, &skill );
if ( !rank || rank > 1 ) {
UI_LogFuncEnd();
return level;
}
}
@ -622,23 +668,28 @@ int32_t UI_GetCurrentGame( int32_t curLevel ) {
UI_GetBestScore( level, &rank, &skill );
if ( !rank || rank > 1 )
{
UI_LogFuncEnd();
return level;
}
}
info = UI_GetSpecialArenaInfo( "final" );
if( !info ) {
UI_LogFuncEnd();
return -1;
}
UI_LogFuncEnd();
return atoi( Info_ValueForKey( info, "num" ) );
}
else if ((curLevel >= 0) && (curLevel < (ui_numSinglePlayerArenas-1)))
{
// go to next map
UI_LogFuncEnd();
return curLevel+1;
}
else if (curLevel == (ui_numSinglePlayerArenas-1))
{
// finished final map...back to the beginning
UI_LogFuncEnd();
return 0;
}
else
@ -646,39 +697,13 @@ int32_t UI_GetCurrentGame( int32_t curLevel ) {
// bogus value for curLevel
info = UI_GetSpecialArenaInfo( "final" );
if( !info ) {
UI_LogFuncEnd();
return -1;
}
UI_LogFuncEnd();
return atoi( Info_ValueForKey( info, "num" ) );
}
/*
if ((curLevel != -1) && (curLevel == (ui_numSinglePlayerArenas-1)))
{
return 0;
}
for( level = 0; level < ui_numSinglePlayerArenas; level++ ) {
UI_GetBestScore( level, &rank, &skill );
if ( !rank || rank > 1 )
{
if (curLevel != -1)
{
if (level > curLevel)
{
return level;
}
continue;
}
return level;
}
}
info = UI_GetSpecialArenaInfo( "final" );
if( !info ) {
return -1;
}
return atoi( Info_ValueForKey( info, "num" ) );
*/
UI_LogFuncEnd();
}
@ -690,6 +715,7 @@ Clears the scores and sets the difficutly level
===============
*/
void UI_NewGame( void ) {
UI_LogFuncBegin();
trap_Cvar_Set( "g_spScores1", "" );
trap_Cvar_Set( "g_spScores2", "" );
trap_Cvar_Set( "g_spScores3", "" );
@ -697,6 +723,7 @@ void UI_NewGame( void ) {
trap_Cvar_Set( "g_spScores5", "" );
trap_Cvar_Set( "g_spAwards", "" );
trap_Cvar_Set( "g_spVideos", "" );
UI_LogFuncEnd();
}
@ -706,6 +733,8 @@ UI_GetNumArenas
===============
*/
int32_t UI_GetNumArenas( void ) {
UI_LogFuncBegin();
UI_LogFuncEnd();
return ui_numArenas;
}
@ -716,6 +745,8 @@ UI_GetNumSPArenas
===============
*/
int32_t UI_GetNumSPArenas( void ) {
UI_LogFuncBegin();
UI_LogFuncEnd();
return ui_numSinglePlayerArenas;
}
@ -727,6 +758,7 @@ UI_GetNumSPTiers
*/
int32_t UI_GetNumSPTiers( void )
{
UI_LogFuncBegin();
int32_t remainder;
remainder = ui_numSinglePlayerArenas % ARENAS_PER_TIER;
@ -736,6 +768,7 @@ int32_t UI_GetNumSPTiers( void )
remainder = 1;
}
UI_LogFuncEnd();
return ((ui_numSinglePlayerArenas / ARENAS_PER_TIER) + remainder);
}
@ -746,6 +779,8 @@ UI_GetNumBots
===============
*/
int32_t UI_GetNumBots( void ) {
UI_LogFuncBegin();
UI_LogFuncEnd();
return ui_numBots;
}
@ -756,7 +791,7 @@ UI_InitGameinfo
===============
*/
void UI_InitGameinfo( void ) {
UI_LogFuncBegin();
UI_InitMemory();
UI_LoadArenas();
UI_LoadBots();
@ -767,4 +802,5 @@ void UI_InitGameinfo( void ) {
else {
uis.demoversion = qfalse;
}
UI_LogFuncEnd();
}

View file

@ -4,6 +4,7 @@
User interface trigger from within game
**********************************************************************/
#include "ui_local.h"
#include "ui_logger.h"
typedef struct {
char name[5][MAX_QPATH];
@ -33,12 +34,17 @@ typedef struct //static
holodeck_t s_holodeck;
void HoloDataReceived(const char *data) {
UI_LogFuncBegin();
char *temp;
if(holoData.currentPart < 0) return;
if(holoData.currentPart < 0){
UI_LogFuncEnd();
return;
}
if(!holoData.numProgs) {
holoData.numProgs = atoi(data);
holoData.currentProg = 0;
holoData.currentPart = 0;
UI_LogFuncEnd();
return;
}
switch(holoData.currentPart) {
@ -64,6 +70,7 @@ void HoloDataReceived(const char *data) {
holoData.currentProg = 0;
holoData.currentPart++;
}
UI_LogFuncEnd();
}
/*
@ -72,12 +79,14 @@ PrgmList_Init
===============
*/
void PrgmList_Init(void) {
UI_LogFuncBegin();
int32_t i;
for(i = 0; i < holoData.numProgs; i++) {
s_holodeck.prgListPtr[i] = holoData.name[i];
}
s_holodeck.prgListPtr[holoData.numProgs] = 0;
UI_LogFuncEnd();
}
void HolodeckMenu_LoadText (void);
@ -98,6 +107,7 @@ M_Holodeck_Event
*/
static void M_Holodeck_Event (void* ptr, int32_t notification)
{
UI_LogFuncBegin();
int32_t id;
int32_t i;
@ -121,6 +131,7 @@ static void M_Holodeck_Event (void* ptr, int32_t notification)
UI_HolodeckMenu(i);
break;
}
UI_LogFuncEnd();
}
/*
@ -130,6 +141,8 @@ HolodeckMenu_Key
*/
sfxHandle_t HolodeckMenu_Key (int32_t key)
{
UI_LogFuncBegin();
UI_LogFuncEnd();
return ( Menu_DefaultKey( &s_holodeck.menu, key ) );
}
@ -149,6 +162,7 @@ M_HolodeckMenu_Graphics
*/
static void M_HolodeckMenu_Graphics (void)
{
UI_LogFuncBegin();
int32_t i,length,xTurboStart;
int32_t numColor,roundColor;
@ -227,7 +241,7 @@ static void M_HolodeckMenu_Graphics (void)
UI_DrawHandlePic(592.5, 301, 22.5, 137, uis.whiteShader);
UI_DrawProportionalString(346, 289, va("%s", holoData.desc[0]), UI_TINYFONT, colorTable[CT_WHITE]);
UI_LogFuncEnd();
}
/*
@ -237,10 +251,12 @@ HolodeckMenu_Draw
*/
static void HolodeckMenu_Draw(void)
{
UI_LogFuncBegin();
// Draw graphics particular to Main Menu
M_HolodeckMenu_Graphics();
Menu_Draw( &s_holodeck.menu );
UI_LogFuncEnd();
}
/*
@ -250,6 +266,7 @@ UI_HolodeckMenu_Cache
*/
void UI_HolodeckMenu_Cache (void)
{
UI_LogFuncBegin();
leftRound = trap_R_RegisterShaderNoMip("menu/common/halfroundl_24.tga");
corner_ul_24_60 = trap_R_RegisterShaderNoMip("menu/common/corner_ul_24_60.tga");
corner_ll_12_60 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_12_60.tga");
@ -263,6 +280,7 @@ void UI_HolodeckMenu_Cache (void)
prgImage4 = trap_R_RegisterShaderNoMip(holoData.image[3]);
if(holoData.image[4][0])
prgImage5 = trap_R_RegisterShaderNoMip(holoData.image[4]);
UI_LogFuncEnd();
}
/*
@ -272,6 +290,7 @@ HolodeckMenu_Init
*/
void HolodeckMenu_Init()
{
UI_LogFuncBegin();
int32_t y,pad,x;
int32_t i,width;
@ -351,6 +370,7 @@ void HolodeckMenu_Init()
Menu_AddItem( &s_holodeck.menu, &s_holodeck.progButton );
Menu_AddItem( &s_holodeck.menu, &s_holodeck.engage );
Menu_AddItem( &s_holodeck.menu, &s_holodeck.quitmenu );
UI_LogFuncEnd();
}
/*
@ -360,8 +380,11 @@ UI_HolodeckMenu
*/
void UI_HolodeckMenu (int32_t trNum)
{
if ( !trNum )
UI_LogFuncBegin();
if ( !trNum ){
UI_LogFuncEnd();
return;
}
memset( &s_holodeck, 0, sizeof( s_holodeck ) );
@ -380,5 +403,6 @@ void UI_HolodeckMenu (int32_t trNum)
UI_PushMenu( &s_holodeck.menu );
Menu_AdjustCursor( &s_holodeck.menu, 1 );
UI_LogFuncEnd();
}

View file

@ -9,6 +9,7 @@ INGAME MENU
*/
#include "ui_local.h"
#include "ui_logger.h"
void UI_SetupWeaponsMenu( void );
@ -99,22 +100,6 @@ typedef struct
static ingamemenu_t s_ingame;
/*static int32_t ingame_buttons[10][2] =
{
{152,220},
{152,220 + INGAME_MENU_VERTICAL_SPACING},
{152,220 + (INGAME_MENU_VERTICAL_SPACING *2)},
{152,220 + (INGAME_MENU_VERTICAL_SPACING *3)},
{152,220 + (INGAME_MENU_VERTICAL_SPACING *4)},
{368,220},
{368,220 + INGAME_MENU_VERTICAL_SPACING},
{368,220 + (INGAME_MENU_VERTICAL_SPACING *2)},
{368,220 + (INGAME_MENU_VERTICAL_SPACING *3)},
{368,220 + (INGAME_MENU_VERTICAL_SPACING *4)},
};*/
typedef struct
{
menuframework_s menu;
@ -135,6 +120,7 @@ and had an appropriately set FOV
*/
static void IngamePlayer_DrawPlayer( void *self )
{
UI_LogFuncBegin();
menubitmap_s *b;
vec3_t viewangles;
vec3_t origin = {-20, 5, -4 }; //-3.8
@ -158,7 +144,7 @@ static void IngamePlayer_DrawPlayer( void *self )
b = &s_ingame.playermdl;
UI_DrawPlayer( b->generic.x, b->generic.y, b->width, b->height, origin, &s_ingame.playerinfo, uis.realtime );
UI_LogFuncEnd();
}
/*
@ -168,11 +154,12 @@ Player_ModelEvent
*/
static void Player_ModelEvent ( void *self, int32_t result ) {
UI_LogFuncBegin();
if ( result == QM_ACTIVATED ) {
uis.cursorpx = uis.cursorx;
uis.spinView = qtrue;
}
UI_LogFuncEnd();
}
/*
@ -182,13 +169,16 @@ InGame_RestartAction
*/
static void InGame_RestartAction( qboolean result )
{
UI_LogFuncBegin();
if( !result )
{
UI_LogFuncEnd();
return;
}
UI_PopMenu();
trap_Cmd_ExecuteText( EXEC_APPEND, "callvote map_restart 0\n" );
UI_LogFuncEnd();
}
/*
@ -198,14 +188,17 @@ InGame_LeaveAction
*/
void InGame_LeaveAction( qboolean result )
{
UI_LogFuncBegin();
if( !result )
{
UI_LogFuncEnd();
return;
}
//trap_Cvar_Set ("rpg_playIntro", "0");
UI_PopMenu();
trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect\n" );
UI_LogFuncEnd();
}
@ -216,68 +209,41 @@ InGame_Event
*/
void InGame_Event( void *ptr, int32_t notification )
{
UI_LogFuncBegin();
if( notification != QM_ACTIVATED )
{
UI_LogFuncEnd();
return;
}
switch( ((menucommon_s*)ptr)->id )
{
// case ID_TEAM:
//// InGame_SaveChanges();
// UI_TeamMainMenu();
// break;
case ID_SETUP:
// InGame_SaveChanges();
UI_SetupWeaponsMenu();
break;
case ID_SCREENSHOT:
// InGame_SaveChanges();
UI_ForceMenuOff();
trap_Cmd_ExecuteText( EXEC_APPEND, "wait; wait; wait; wait; screenshot\n" );
break;
case ID_LEAVEARENA:
// InGame_SaveChanges();
UI_ConfirmMenu( menu_normal_text[MNT_LEAVE_MATCH], 0, InGame_LeaveAction );
// trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect\n" );
break;
case ID_RESTART:
// InGame_SaveChanges();
UI_ConfirmMenu( menu_normal_text[MNT_RESTART_MATCH], 0, InGame_RestartAction );
break;
case ID_QUIT:
// InGame_SaveChanges();
UI_QuitMenu();
// UI_ConfirmMenu( "EXIT GAME?", NULL, InGame_QuitAction );
break;
case ID_SERVERINFO:
// InGame_SaveChanges();
UI_ServerInfoMenu();
break;
case ID_ADDBOTS:
// InGame_SaveChanges();
UI_AddBotsMenu();
break;
case ID_REMOVEBOTS:
// InGame_SaveChanges();
UI_RemoveBotsMenu();
break;
case ID_TEAMORDERS:
// InGame_SaveChanges();
UI_TeamOrdersMenu(0);
break;
case ID_RESUME:
// InGame_SaveChanges();
UI_PopMenu();
break;
@ -286,19 +252,15 @@ void InGame_Event( void *ptr, int32_t notification )
break;
case ID_PLAYER_MODEL:
// UI_PopMenu();
// PlayerSettings_SaveChanges();
UI_PlayerModelMenu( s_ingame.prevMenu );
break;
case ID_JOIN:
// InGame_SaveChanges();
trap_Cmd_ExecuteText( EXEC_APPEND, "cmd team free\n" );
UI_ForceMenuOff();
break;
case ID_SPECTATE:
// InGame_SaveChanges();
trap_Cmd_ExecuteText( EXEC_APPEND, "cmd team spectator\n" );
UI_ForceMenuOff();
break;
@ -308,7 +270,7 @@ void InGame_Event( void *ptr, int32_t notification )
break;
case ID_ADMIN:
UI_LoginMenu(qfalse);
UI_AdminMenu(qfalse);
break;
case ID_MOTD: // RPG-X | Marcin | 03/01/2008
@ -317,12 +279,11 @@ void InGame_Event( void *ptr, int32_t notification )
break;
case ID_RESPAWN: // RPG-X | Marcin | 03/01/2008
//trap_Cmd_ExecuteText( EXEC_APPEND, "cmd team spectator\n" );
//trap_Cmd_ExecuteText( EXEC_APPEND, "cmd team free\n" );
trap_Cmd_ExecuteText( EXEC_APPEND, "respawn\n" );
UI_ForceMenuOff();
break;
}
UI_LogFuncEnd();
}
/*
@ -332,6 +293,7 @@ UI_InGameMenu_Draw
*/
static void UI_InGameMenu_Draw( void )
{
UI_LogFuncBegin();
char* playerClass;
char string[256];
float scale;
@ -341,37 +303,6 @@ static void UI_InGameMenu_Draw( void )
playerClass = uis.classData[s_ingame.pclass].classNameFull;
/*switch ( s_ingame.pclass ) {
case PC_ADMIN:
playerClass = "Admin";
break;
case PC_SECURITY:
playerClass = "Security";
break;
case PC_ALIEN:
playerClass = "Alien";
break;
case PC_COMMAND:
playerClass = "Command";
break;
case PC_SCIENCE:
playerClass = "Science";
break;
case PC_ENGINEER:
playerClass = "Engineer";
break;
case PC_ALPHAOMEGA22:
playerClass = "Marine";
break;
case PC_N00B:
playerClass = "n00b";
break;
case PC_NOCLASS:
default:
playerClass = "Unknown";
break;
}*/
UI_MenuFrame(&s_ingame.menu);
// Rounded button that takes place of INGAME MENU button
@ -598,6 +529,7 @@ static void UI_InGameMenu_Draw( void )
// standard menu drawing
Menu_Draw( &s_ingame.menu );
UI_LogFuncEnd();
}
/*
@ -607,6 +539,7 @@ InGame_MenuInit
*/
void InGame_MenuInit( void )
{
UI_LogFuncBegin();
int32_t y,x;
uiClientState_t cs;
char info[MAX_INFO_STRING];
@ -630,9 +563,6 @@ void InGame_MenuInit( void )
UI_InitRanksData( Info_ValueForKey( info_server, "rpg_rankSet" ) );
UI_InitClassData( Info_ValueForKey( info_server, "rpg_classSet" ) );
//TiM: Reset Class Data
//UI_LoadClassString();
// Player_MenuInit();
s_ingame.menu.wrapAround = qtrue;
@ -647,22 +577,6 @@ void InGame_MenuInit( void )
x = 284; //305
y = 62; //196
/*s_ingame.team.generic.type = MTYPE_BITMAP;
s_ingame.team.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_ingame.team.generic.x = x;
s_ingame.team.generic.y = y;
s_ingame.team.generic.id = ID_TEAM;
s_ingame.team.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
s_ingame.team.generic.callback = InGame_Event;
s_ingame.team.width = MENU_BUTTON_MED_WIDTH;
s_ingame.team.height = MENU_BUTTON_MED_HEIGHT;
s_ingame.team.color = CT_DKPURPLE1;
s_ingame.team.color2 = CT_LTPURPLE1;
s_ingame.team.textX = MENU_BUTTON_TEXT_X;
s_ingame.team.textY = MENU_BUTTON_TEXT_Y;
s_ingame.team.textEnum = MBT_TEAMCLASS;
s_ingame.team.textcolor = CT_BLACK;
s_ingame.team.textcolor2 = CT_WHITE;*/
// y += INGAME_MENU_VERTICAL_SPACING;
@ -740,7 +654,6 @@ void InGame_MenuInit( void )
y += INGAME_MENU_VERTICAL_SPACING;
s_ingame.admin.generic.type = MTYPE_BITMAP;
s_ingame.admin.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_ingame.admin.generic.x = x;
s_ingame.admin.generic.y = y;
s_ingame.admin.generic.id = ID_ADMIN;
@ -755,41 +668,11 @@ void InGame_MenuInit( void )
s_ingame.admin.textEnum = MBT_ADMIN_MENU;
s_ingame.admin.textcolor = CT_BLACK;
s_ingame.admin.textcolor2 = CT_WHITE;
/*y += INGAME_MENU_VERTICAL_SPACING;
s_ingame.teamorders.generic.type = MTYPE_BITMAP;
s_ingame.teamorders.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_ingame.teamorders.generic.x = x;
s_ingame.teamorders.generic.y = y;
s_ingame.teamorders.generic.id = ID_TEAMORDERS;
s_ingame.teamorders.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
s_ingame.teamorders.generic.callback = InGame_Event;
s_ingame.teamorders.width = MENU_BUTTON_MED_WIDTH;
s_ingame.teamorders.height = MENU_BUTTON_MED_HEIGHT;
s_ingame.teamorders.color = CT_DKPURPLE1;
s_ingame.teamorders.color2 = CT_LTPURPLE1;
s_ingame.teamorders.textX = MENU_BUTTON_TEXT_X;
s_ingame.teamorders.textY = MENU_BUTTON_TEXT_Y;
s_ingame.teamorders.textEnum = MBT_INGAMETEAMORDERS;
s_ingame.teamorders.textcolor = CT_BLACK;
s_ingame.teamorders.textcolor2 = CT_WHITE;
// make sure it's a team game
trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
if( (atoi( Info_ValueForKey( info, "g_gametype" ) )) < GT_TEAM)
{
s_ingame.teamorders.generic.flags |= QMF_GRAYED;
if( atoi( Info_ValueForKey( info, "admin" )) == 0 ) {
s_ingame.admin.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
} else {
s_ingame.admin.generic.flags = QMF_GRAYED;
}
else
{
trap_GetClientState( &cs );
trap_GetConfigString( CS_PLAYERS + cs.clientNum, info, MAX_INFO_STRING );
team = atoi( Info_ValueForKey( info, "t" ) );
if( team == TEAM_SPECTATOR )
{
s_ingame.teamorders.generic.flags |= QMF_GRAYED;
}
}*/
x = 121;
y = 62;
@ -962,51 +845,6 @@ void InGame_MenuInit( void )
s_ingame.pmodel.textcolor = CT_BLACK;
s_ingame.pmodel.textcolor2 = CT_WHITE;
/* s_ingame.playerName.generic.type = MTYPE_FIELD;
s_ingame.playerName.field.widthInChars = MAX_NAMELENGTH;
s_ingame.playerName.field.maxchars = MAX_NAMELENGTH;
s_ingame.playerName.generic.x = 319;
s_ingame.playerName.generic.y = 193;
s_ingame.playerName.field.style = UI_SMALLFONT;
// s_ingame.playerName.field.titleEnum = MBT_PLAYER_NAME;
s_ingame.playerName.field.titlecolor = CT_LTGOLD1;
s_ingame.playerName.field.textcolor = CT_DKGOLD1;
s_ingame.playerName.field.textcolor2 = CT_LTGOLD1;
s_ingame.pClass.generic.type = MTYPE_SPINCONTROL;
s_ingame.pClass.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_ingame.pClass.generic.callback = InGame_Event;
s_ingame.pClass.generic.id = ID_CLASS;
s_ingame.pClass.generic.x = 265;
s_ingame.pClass.generic.y = 213;
s_ingame.pClass.textEnum = MBT_CLASS;
s_ingame.pClass.textcolor = CT_BLACK;
s_ingame.pClass.textcolor2 = CT_WHITE;
s_ingame.pClass.color = CT_DKPURPLE1;
s_ingame.pClass.color2 = CT_LTPURPLE1;
s_ingame.pClass.listcolor = CT_LTGOLD1;
s_ingame.pClass.width = 40; //80
s_ingame.pClass.textX = 5;
s_ingame.pClass.textY = 2;
s_ingame.pClass.itemnames = pclass_items;
s_ingame.pRank.generic.type = MTYPE_SPINCONTROL;
s_ingame.pRank.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_ingame.pRank.generic.callback = InGame_Event;
s_ingame.pRank.generic.id = ID_RANK;
s_ingame.pRank.generic.x = 265;
s_ingame.pRank.generic.y = 235;
s_ingame.pRank.textEnum = MBT_RANK;
s_ingame.pRank.textcolor = CT_BLACK;
s_ingame.pRank.textcolor2 = CT_WHITE;
s_ingame.pRank.color = CT_DKPURPLE1;
s_ingame.pRank.color2 = CT_LTPURPLE1;
s_ingame.pRank.listcolor = CT_LTGOLD1;
s_ingame.pRank.width = 40;
s_ingame.pRank.textX = 5;
s_ingame.pRank.textY = 2;
s_ingame.pRank.itemnames = prank_items_formal;*/
s_ingame.join.generic.type = MTYPE_BITMAP;
s_ingame.join.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_ingame.join.generic.x = 285; //126 //306
@ -1089,6 +927,7 @@ void InGame_MenuInit( void )
Menu_AddItem( &s_ingame.menu, &s_ingame.respawn );
// Player_InitModel();
UI_LogFuncEnd();
}
/*
@ -1098,6 +937,7 @@ InGameQuit_Cache
*/
void InGame_Cache( void )
{
UI_LogFuncBegin();
s_ingame.graphic_12_8_LU = trap_R_RegisterShaderNoMip( "menu/common/corner_ul_8_12.tga" );
s_ingame.graphic_12_8_LL = trap_R_RegisterShaderNoMip( "menu/common/corner_ll_8_12.tga" );
s_ingame.graphic_12_8_RU = trap_R_RegisterShaderNoMip( "menu/common/corner_ur_8_12.tga" );
@ -1111,6 +951,7 @@ UI_InGameMenu
*/
void UI_InGameMenu( void )
{
UI_LogFuncBegin();
// force as top level menu
uis.menusp = 0;
@ -1123,6 +964,7 @@ void UI_InGameMenu( void )
InGame_MenuInit();
UI_PushMenu( &s_ingame.menu );
UI_LogFuncEnd();
}
@ -1134,8 +976,10 @@ InGameQuitMenu_Event
*/
void InGameQuitMenu_Event( void *ptr, int32_t notification )
{
UI_LogFuncBegin();
if( notification != QM_ACTIVATED )
{
UI_LogFuncEnd();
return;
}
@ -1144,12 +988,15 @@ void InGameQuitMenu_Event( void *ptr, int32_t notification )
case ID_INGAME_QUIT_NO:
case ID_INGAMEMENU:
UI_PopMenu();
UI_LogFuncEnd();
return;
case ID_INGAME_QUIT_YES:
UI_PopMenu();
UI_QuitMenu();
UI_LogFuncEnd();
return;
}
UI_LogFuncEnd();
}
/*
@ -1159,6 +1006,7 @@ UI_InGameQuitMenu_Draw
*/
static void UI_InGameQuitMenu_Draw( void )
{
UI_LogFuncBegin();
UI_MenuFrame(&s_ingamequit.menu);
// Rounded button that takes place of INGAME MENU button
@ -1171,7 +1019,7 @@ static void UI_InGameQuitMenu_Draw( void )
// standard menu drawing
Menu_Draw( &s_ingamequit.menu );
UI_LogFuncEnd();
}
/*
@ -1181,7 +1029,7 @@ InGameQuitMenu_Init
*/
void InGameQuitMenu_Init( void )
{
UI_LogFuncBegin();
memset( &s_ingame, 0 ,sizeof(ingamemenu_t) );
InGame_Cache();
@ -1250,6 +1098,7 @@ void InGameQuitMenu_Init( void )
Menu_AddItem( &s_ingamequit.menu, &s_ingamequit.ingamemenu );
Menu_AddItem( &s_ingamequit.menu, &s_ingamequit.no );
Menu_AddItem( &s_ingamequit.menu, &s_ingamequit.yes );
UI_LogFuncEnd();
}
/*
@ -1259,7 +1108,9 @@ UI_InGameQuitMenu
*/
void UI_InGameQuitMenu( void )
{
UI_LogFuncBegin();
InGameQuitMenu_Init();
UI_PushMenu( &s_ingamequit.menu );
UI_LogFuncEnd();
}

View file

@ -7,6 +7,7 @@
//
#include "ui_local.h"
#include "ui_logger.h"
#define ID_MAINTOPICBUTTON1 11
#define ID_MAINTOPICBUTTON2 12
@ -239,6 +240,7 @@ UI_LanguageFilename - create a filename with an extension based on the value in
*/
void UI_LanguageFilename(char *baseName,char *baseExtension,char *finalName)
{
UI_LogFuncBegin();
char language[32];
fileHandle_t file;
@ -265,6 +267,7 @@ void UI_LanguageFilename(char *baseName,char *baseExtension,char *finalName)
trap_FS_FCloseFile( file );
}
}
UI_LogFuncEnd();
}
/*
@ -274,6 +277,7 @@ CrewMenu_Blinkies
*/
void LogMenu_Blinkies (void)
{
UI_LogFuncBegin();
// Turning on description a line at a time
if ((logmenu_graphics[LMG_CURRENT_DESC].timer < uis.realtime) && (logmenu_graphics[LMG_CURRENT_DESC].type == MG_VAR))
{
@ -292,7 +296,8 @@ void LogMenu_Blinkies (void)
logmenu_graphics[LMG_CURRENT_DESC].timer = uis.realtime + LOGWAITTIME;
}
}
}
}
UI_LogFuncEnd();
}
/*
@ -302,6 +307,7 @@ SplitLogDesc
*/
static void SplitLogDesc(char *s,int32_t width)
{
UI_LogFuncBegin();
int32_t lineWidth,currentWidth,charCnt,currentLineI;
char *holds;
char holdChar[2];
@ -375,7 +381,7 @@ static void SplitLogDesc(char *s,int32_t width)
++charCnt; // So the NULL will be properly placed at the end of the string of Q_strncpyz
Q_strncpyz( logDesc[currentLineI], holds, charCnt);
logDesc[currentLineI][charCnt] = 0; //NULL
UI_LogFuncEnd();
}
/*
@ -385,6 +391,7 @@ TurnOnLogDesc
*/
static void TurnOnLogDesc(char *s,int32_t lineWidth,int32_t startY)
{
UI_LogFuncBegin();
int32_t y,i;
logmenu_graphics[LMG_BIO_DESC1].type = MG_STRING;
@ -404,12 +411,12 @@ static void TurnOnLogDesc(char *s,int32_t lineWidth,int32_t startY)
logmenu_graphics[i].y = y;
y += 12;
}
UI_LogFuncEnd();
}
static void UI_Draw3DModel( float x, float y, float w, float h, qhandle_t model, vec3_t origin, vec3_t angles)
{
UI_LogFuncBegin();
refdef_t refdef;
refEntity_t ent;
@ -422,11 +429,6 @@ static void UI_Draw3DModel( float x, float y, float w, float h, qhandle_t model,
VectorCopy( origin, ent.origin );
ent.hModel = model;
// if (Cvar_VariableValue("r_dynamiclight") ) {
// ent.renderfx = RF_LOWLIGHT|RF_NOSHADOW; // keep it dark, and no stencil shadows
// } else {
// ent.renderfx = RF_NOSHADOW; // no stencil shadows
// }
refdef.rdflags = RDF_NOWORLDMODEL;
AxisClear( refdef.viewaxis );
@ -450,11 +452,9 @@ static void UI_Draw3DModel( float x, float y, float w, float h, qhandle_t model,
trap_R_AddLightToScene( origin, 500, 1.0, 1.0, 1.0 );
trap_R_RenderScene( &refdef );
UI_LogFuncEnd();
}
//void Controls_DrawPlayer( void *self );
//void Controls_UpdateModel( int32_t anim );
/*
================
UI_LibraryDrawMD3Model
@ -462,6 +462,7 @@ UI_LibraryDrawMD3Model
*/
static void UI_LibraryDrawMD3Model(qhandle_t modelHandle,int32_t x, int32_t y,int32_t modelDistance,int32_t modelYaw,int32_t modelPitch,int32_t modelRoll,int32_t modelOriginY)
{
UI_LogFuncBegin();
vec3_t origin = {50,0,2};
vec3_t angles;
@ -505,6 +506,7 @@ static void UI_LibraryDrawMD3Model(qhandle_t modelHandle,int32_t x, int32_t y,in
}
UI_Draw3DModel( x, y, 447, 305, modelHandle, origin, angles);
UI_LogFuncEnd();
}
@ -515,12 +517,14 @@ ClearLibraryDesc
*/
void ClearLibraryDesc(void)
{
UI_LogFuncBegin();
int32_t i;
for (i=0;i<(LMG_MAX - LMG_BIO_DESC1);++i)
{
logmenu_graphics[LMG_BIO_DESC1 + i].type = MG_OFF; // Turn off text
}
UI_LogFuncEnd();
}
/*
@ -530,10 +534,12 @@ ChangeLibraryDesc
*/
void ChangeLibraryDesc(int32_t id)
{
UI_LogFuncBegin();
int32_t i,y,width;
if (s_library.subTopic == id)
{
UI_LogFuncEnd();
return; // Just hitting the same key again
}
else // Turn off old description
@ -576,11 +582,7 @@ void ChangeLibraryDesc(int32_t id)
TurnOnLogDesc(libraryText[s_library.mainTopic].text[s_library.subTopic],
width,libraryText[s_library.mainTopic].textY[s_library.subTopic]);
//if ((libraryText[s_library.mainTopic].soundHandle[s_library.subTopic]) &&
// (s_library.computerVoice.textEnum == MBT_COMPUTERVOICEON))
//{
// trap_S_StartLocalSound( libraryText[s_library.mainTopic].soundHandle[s_library.subTopic], CHAN_MENU2 );
// }
UI_LogFuncEnd();
}
@ -591,11 +593,13 @@ M_Transporter_Event
*/
void M_Library_Event (void* ptr, int32_t notification)
{
UI_LogFuncBegin();
int32_t id,i;
menubitmap_s *holdSubTopicButton,*holdMainTopicButton;
if (notification != QM_ACTIVATED)
{
UI_LogFuncEnd();
return;
}
@ -603,19 +607,6 @@ void M_Library_Event (void* ptr, int32_t notification)
switch (id)
{
/*case ID_COMPUTERVOICE:
if (s_library.computerVoice.textEnum == MBT_COMPUTERVOICEON)
{
s_library.computerVoice.textEnum = MBT_COMPUTERVOICEOFF;
trap_S_StartLocalSound( nullSound, CHAN_MENU2 );
}
else
{
s_library.computerVoice.textEnum = MBT_COMPUTERVOICEON;
}
break;
*/
case ID_ARROW1UP:
if ((s_library.topMainTopic - 1) >= 0)
{
@ -861,9 +852,6 @@ void M_Library_Event (void* ptr, int32_t notification)
++holdSubTopicButton;
}
// Highlight chosen button
// if (((id + s_library.topSubTopic - ID_SUBTOPICBUTTON1) > 0) &&
// ((id + s_library.topSubTopic - ID_SUBTOPICBUTTON1) < MAXSUBTOPICDISPLAYED))
holdSubTopicButton = &s_library.subTopicButton1 + (id - ID_SUBTOPICBUTTON1);
holdSubTopicButton->textcolor = CT_VLTGOLD1;
@ -871,12 +859,6 @@ void M_Library_Event (void* ptr, int32_t notification)
ChangeLibraryDesc(s_library.topSubTopic + (id-ID_SUBTOPICBUTTON1));
// if ((libraryText[s_library.mainTopic].soundHandle[s_library.subTopic]) &&
// (s_library.computerVoice.textEnum == MBT_COMPUTERVOICEON))
// {
// trap_S_StartLocalSound( libraryText[s_library.mainTopic].soundHandle[s_library.subTopic], CHAN_MENU2 );
// }
// If there's a .mdr
if (libraryText[s_library.mainTopic].modelLegs[s_library.subTopic])
{
@ -898,45 +880,9 @@ void M_Library_Event (void* ptr, int32_t notification)
break;
}
UI_LogFuncEnd();
}
/*
=================
Library_StatusBar
=================
*/
/*static void Library_StatusBar(void *itemptr)
{
int32_t id;
id = ((menucommon_s*)itemptr)->id;
switch (id)
{
case ID_MAINTOPICBUTTON1:
case ID_MAINTOPICBUTTON2:
case ID_MAINTOPICBUTTON3:
case ID_MAINTOPICBUTTON4:
UI_DrawProportionalString( 320, 410, libraryText[id + s_library.topMainTopic-ID_MAINTOPICBUTTON1].mainTopicDesc, UI_CENTER|UI_SMALLFONT, colorTable[CT_VLTGOLD1]);
break;
case ID_SUBTOPICBUTTON1:
case ID_SUBTOPICBUTTON2:
case ID_SUBTOPICBUTTON3:
case ID_SUBTOPICBUTTON4:
case ID_SUBTOPICBUTTON5:
case ID_SUBTOPICBUTTON6:
case ID_SUBTOPICBUTTON7:
case ID_SUBTOPICBUTTON8:
case ID_SUBTOPICBUTTON9:
case ID_SUBTOPICBUTTON10:
UI_DrawProportionalString( 320, 410,
libraryText[s_library.mainTopic].subTopicDesc[id + s_library.topSubTopic - ID_SUBTOPICBUTTON1],
UI_CENTER|UI_SMALLFONT, colorTable[CT_VLTGOLD1]);
break;
}
}*/
/*
=================
LibraryMenu_Key
@ -944,6 +890,7 @@ LibraryMenu_Key
*/
sfxHandle_t LibraryMenu_Key (int32_t key)
{
UI_LogFuncBegin();
if ( key == K_ESCAPE )
{
trap_S_StartLocalSound( nullSound, CHAN_MENU1 );
@ -953,6 +900,7 @@ sfxHandle_t LibraryMenu_Key (int32_t key)
}
}
UI_LogFuncEnd();
return ( Menu_DefaultKey( &s_library.menu, key ) );
}
@ -963,6 +911,7 @@ M_LibraryMenu_Graphics
*/
void M_LibraryMenu_Graphics (void)
{
UI_LogFuncBegin();
trap_R_SetColor( colorTable[CT_VDKPURPLE2]);
UI_DrawHandlePic( 30, 24,16, 32, s_library.leftRound);
@ -1066,6 +1015,8 @@ void M_LibraryMenu_Graphics (void)
UI_PrintMenuGraphics(logmenu_graphics,LMG_MAX);
UI_LogFuncEnd();
}
/*
@ -1075,9 +1026,12 @@ LibraryMenu_Draw
*/
void LibraryMenu_Draw(void)
{
UI_LogFuncBegin();
M_LibraryMenu_Graphics();
Menu_Draw( &s_library.menu );
UI_LogFuncEnd();
}
/*
@ -1087,6 +1041,7 @@ LibraryMenu_Init
*/
void LibraryMenu_Init(void)
{
UI_LogFuncBegin();
menubitmap_s *holdMainTopicButton,*holdSubTopicButton;
int32_t x,y,pad,i;
@ -1167,26 +1122,11 @@ void LibraryMenu_Init(void)
s_library.subTopicArrowDown.color = CT_DKORANGE;
s_library.subTopicArrowDown.color2 = CT_LTORANGE;
/* s_library.computerVoice.generic.type = MTYPE_BITMAP;
s_library.computerVoice.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_library.computerVoice.generic.x = 360;
s_library.computerVoice.generic.y = 368;
s_library.computerVoice.generic.name = GRAPHIC_SQUARE;
s_library.computerVoice.generic.id = ID_COMPUTERVOICE;
s_library.computerVoice.generic.callback = M_Library_Event;
s_library.computerVoice.width = MENU_BUTTON_MED_WIDTH + 30;
s_library.computerVoice.height = MENU_BUTTON_MED_HEIGHT;
s_library.computerVoice.color = CT_DKORANGE;
s_library.computerVoice.CT_DKBROWN1 = CT_LTORANGE;
s_library.computerVoice.textEnum = MBT_COMPUTERVOICEON;
s_library.computerVoice.textX = MENU_BUTTON_TEXT_X + 10;*/
Menu_AddItem( &s_library.menu, &s_library.quitMenu );
Menu_AddItem( &s_library.menu, &s_library.topicArrowUp );
Menu_AddItem( &s_library.menu, &s_library.topicArrowDown );
Menu_AddItem( &s_library.menu, &s_library.subTopicArrowUp );
Menu_AddItem( &s_library.menu, &s_library.subTopicArrowDown );
// Menu_AddItem( &s_library.menu, &s_library.computerVoice );
holdMainTopicButton = &s_library.mainTopicButton1;
pad = 22;
@ -1204,7 +1144,6 @@ void LibraryMenu_Init(void)
holdMainTopicButton->generic.name = GRAPHIC_BUTTONRIGHT;
holdMainTopicButton->generic.id = ID_MAINTOPICBUTTON1 + i;
holdMainTopicButton->generic.callback = M_Library_Event;
// holdMainTopicButton->generic.statusbarfunc = Library_StatusBar;
holdMainTopicButton->width = MENU_BUTTON_MED_WIDTH + 20;
holdMainTopicButton->height = MENU_BUTTON_MED_HEIGHT;
holdMainTopicButton->color = CT_DKORANGE;
@ -1252,7 +1191,6 @@ void LibraryMenu_Init(void)
holdSubTopicButton->generic.name = GRAPHIC_SQUARE;
holdSubTopicButton->generic.id = ID_SUBTOPICBUTTON1 + i;
holdSubTopicButton->generic.callback = M_Library_Event;
// holdSubTopicButton->generic.statusbarfunc = Library_StatusBar;
holdSubTopicButton->width = MENU_BUTTON_MED_WIDTH;
holdSubTopicButton->height = MENU_BUTTON_MED_HEIGHT;
holdSubTopicButton->color = CT_LTORANGE;
@ -1326,6 +1264,7 @@ void LibraryMenu_Init(void)
s_library.subTopic = -1;
ChangeLibraryDesc(0);
UI_LogFuncEnd();
}
/*
@ -1335,6 +1274,7 @@ UI_ParseLibraryText
*/
static void UI_ParseLibraryText()
{
UI_LogFuncBegin();
char *token;
char *buffer,*holdPtr;
int32_t len;
@ -1540,6 +1480,7 @@ static void UI_ParseLibraryText()
*holdPtr = 0; //NULL
}
}
UI_LogFuncEnd();
}
/*
@ -1549,6 +1490,7 @@ UI_LibraryMenu_Cache
*/
void UI_LibraryMenu_Cache (void)
{
UI_LogFuncBegin();
//char *buffer/*,*filePtr*/;
// char* buffer;
char filename[MAX_QPATH];
@ -1570,12 +1512,14 @@ void UI_LibraryMenu_Cache (void)
if ( !f )
{
Com_Error(ERR_FATAL, va("UI_LibraryMenu_Cache : sp_library.dat file not found!\n"));
UI_LogFuncEnd();
return;
}
if ( len > MAXLIBRARYTEXT )
{
Com_Printf( S_COLOR_RED "UI_LibraryMenu_Cache : sp_library.dat size (%d) > max (%d)!\n", len, MAXLIBRARYTEXT);
UI_LogFuncEnd();
return;
}
@ -1601,6 +1545,7 @@ void UI_LibraryMenu_Cache (void)
}
}
}
UI_LogFuncEnd();
}
/*
@ -1610,7 +1555,9 @@ UI_Library_SpecialCache
*/
void UI_Library_SpecialCache(void)
{
UI_LogFuncBegin();
UI_LibraryMenu_Cache();
UI_LogFuncEnd();
}
/*
@ -1620,7 +1567,9 @@ LibraryMenu_LoadText
*/
void LibraryMenu_LoadText (void)
{
UI_LogFuncBegin();
UI_LibraryMenu_Cache();
UI_LogFuncEnd();
}
/*
@ -1630,6 +1579,8 @@ UI_LibraryMenu
*/
void UI_LibraryMenu(void)
{
UI_LogFuncBegin();
uis.menusp = 0;
ingameFlag = qtrue; // true when in game menu is in use
@ -1645,6 +1596,8 @@ void UI_LibraryMenu(void)
UI_PushMenu( &s_library.menu );
Menu_AdjustCursor( &s_library.menu, 1 );
UI_LogFuncEnd();
}
@ -1655,6 +1608,8 @@ M_Accessing_Graphics
*/
void LibraryAccessingMenu_Draw (void)
{
UI_LogFuncBegin();
int32_t y;
y = 50;
@ -1683,6 +1638,7 @@ void LibraryAccessingMenu_Draw (void)
UI_PopMenu();
UI_LibraryMenu();
}
UI_LogFuncEnd();
}
/*
@ -1692,7 +1648,9 @@ UI_AccessingMenu_Cache
*/
void UI_AccessingMenu_Cache (void)
{
UI_LogFuncBegin();
s_libraryaccessing.cornerPic = trap_R_RegisterShaderNoMip("menu/common/corner_ll_47_18.tga");
UI_LogFuncEnd();
}
/*
@ -1702,6 +1660,7 @@ AccessingMenu_Init
*/
void AccessingMenu_Init(void)
{
UI_LogFuncBegin();
UI_AccessingMenu_Cache();
@ -1718,6 +1677,8 @@ void AccessingMenu_Init(void)
s_libraryaccessing.menu.footNoteEnum = MNT_CREDITS;
s_libraryaccessing.timer = uis.realtime + 1000;
UI_LogFuncEnd();
}
/*
@ -1727,10 +1688,14 @@ UI_AccessingMenu
*/
void UI_AccessingMenu()
{
UI_LogFuncBegin();
ingameFlag = qtrue; // true when in game menu is in use
Mouse_Hide();
AccessingMenu_Init();
UI_PushMenu( &s_libraryaccessing.menu );
UI_LogFuncEnd();
}

View file

@ -1796,12 +1796,6 @@ extern void UI_InGameMenu(void);
extern void ConfirmMenu_Cache( void );
extern void UI_ConfirmMenu( const char *question, void (*draw)( void ), void (*action)( qboolean result ) );
//
// ui_team.c
//
//extern void UI_TeamMainMenu( void );
//extern void TeamMain_Cache( void );
//
// ui_connect.c
//
@ -1857,6 +1851,7 @@ extern void UI_LoginMenu( qboolean fromConsole );
//
// ui_msd.c
//
extern void UI_msdMenu_Cache( void );
extern void UI_msdMenu(int32_t maxhull, int32_t currhull, int32_t maxshield, int32_t currshield, int32_t shieldstate, int32_t warpstate, int32_t turbostate, int32_t transstate, int32_t alertstate, char *model);
//
@ -2240,32 +2235,6 @@ extern int32_t UI_InitClassData( char* fileName );
extern qboolean m_entersound;
extern uiStatic_t uis;
//
// ui_spLevel.c
//
void UI_SPLevelMenu_Cache( void );
void UI_SPLevelMenu( void );
void UI_SPLevelMenu_f( void );
void UI_SPLevelMenu_ReInit( void );
extern void UI_ResetGameMenu_Cache(void);
//
// ui_spArena.c
//
void UI_SPArena_Start( const char *arenaInfo );
//
// ui_spPostgame.c
//
void UI_SPPostgameMenu_Cache( void );
void UI_SPPostgameMenu_f( void );
//
// ui_spSkill.c
//
void UI_SPSkillMenu( const char *arenaInfo );
void UI_SPSkillMenu_Cache( void );
//
// ui_syscalls.c
//
@ -2340,13 +2309,6 @@ void UI_AddBotsMenu( void );
void UI_RemoveBots_Cache( void );
void UI_RemoveBotsMenu( void );
//
// ui_teamorders.c
//
extern void UI_TeamOrdersMenu( int32_t fromMenu );
extern void UI_TeamOrdersMenu_f( void );
extern void UI_TeamOrdersMenu_Cache( void );
//
// ui_display.c
//

View file

@ -10,6 +10,7 @@ USER INTERFACE MAIN
#include "ui_local.h"
#include "ui_logger.h"
/*
@ -484,6 +485,7 @@ UI_RegisterCvars
=================
*/
void UI_RegisterCvars( void ) {
UI_LogFuncBegin();
int32_t i;
cvarTable_t *cv;
@ -493,6 +495,7 @@ void UI_RegisterCvars( void ) {
for ( i = 0, cv = cvarTable ; i < cvarTableSize ; i++, cv++ ) {
trap_Cvar_Register( cv->vmCvar, cv->cvarName, cv->defaultString, cv->cvarFlags );
UI_LogFuncEnd();
}
}
@ -502,6 +505,7 @@ UI_UpdateCvars
=================
*/
void UI_UpdateCvars( void ) {
UI_LogFuncBegin();
int32_t i;
cvarTable_t *cv;
@ -513,6 +517,7 @@ void UI_UpdateCvars( void ) {
}
else
trap_Cvar_Update( cv->vmCvar );
UI_LogFuncEnd();
}
}
@ -521,6 +526,7 @@ void UI_UpdateCvars( void ) {
int32_t UI_GetAnim ( int32_t anim, int32_t weapon, qboolean upper )
{
UI_LogFuncBegin();
// Called when player is in idle crouching
switch ( anim ) {
case ANIM_CROUCH:
@ -529,33 +535,45 @@ int32_t UI_GetAnim ( int32_t anim, int32_t weapon, qboolean upper )
case WP_7:
case WP_8:
case WP_9:
if (upper)
if (upper){
UI_LogFuncEnd();
return BOTH_STAND2;
else
}else{
UI_LogFuncEnd();
return LEGS_KNEEL1;
}
break;
//2 handed weapon - "light"
case WP_6:
//case WP_7:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_WEAPONREADY2;
else
}else{
UI_LogFuncEnd();
return LEGS_KNEEL1;
}
break;
//1 handed weapon - "phaser"
case WP_5:
case WP_10:
if ( upper )
if ( upper ){
UI_LogFuncEnd();
return TORSO_WEAPONPOSE1;
else
}else{
UI_LogFuncEnd();
return BOTH_CROUCH1IDLE;
}
break;
case WP_4:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_COFFEE;
}
//break;
//Generic tools - "everything else"
default:
UI_LogFuncEnd();
return BOTH_CROUCH2IDLE;
break;
}
@ -569,25 +587,32 @@ int32_t UI_GetAnim ( int32_t anim, int32_t weapon, qboolean upper )
case WP_8:
case WP_9:
case WP_7:
UI_LogFuncEnd();
return BOTH_STAND4;
break;
//2 handed weapon - "light"
case WP_6:
UI_LogFuncEnd();
return BOTH_STAND4;
break;
//1 handed weapon - "phaser"
case WP_5:
case WP_10:
UI_LogFuncEnd();
return BOTH_STAND1;
break;
//Generic tools - "everything else"
case WP_4:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_COFFEE;
else
}else{
UI_LogFuncEnd();
return BOTH_STAND1;
}
break;
default:
UI_LogFuncEnd();
return BOTH_STAND1;
break;
}
@ -601,89 +626,90 @@ int32_t UI_GetAnim ( int32_t anim, int32_t weapon, qboolean upper )
case WP_8:
case WP_9:
case WP_7:
UI_LogFuncEnd();
return BOTH_ATTACK3;
break;
//2 handed weapon - "light"
case WP_6:
if (upper)
if (upper){
UI_LogFuncEnd();
return BOTH_ATTACK2;
else
}else{
UI_LogFuncEnd();
return BOTH_ATTACK3;
}
break;
//1 handed weapon - "phaser"
case WP_5:
case WP_10:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_WEAPONREADY1;
else
}else{
UI_LogFuncEnd();
return BOTH_STAND1;
}
break;
//Other Tools "padd"
case WP_3:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_PADD1;
else
}else{
UI_LogFuncEnd();
return BOTH_STAND1;
}
break;
//Other Tools "tricorder"
case WP_2:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_TRICORDER1;
else
}else{
UI_LogFuncEnd();
return BOTH_STAND1;
}
break;
//Other: "Medkit"
case WP_11:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_ACTIVATEMEDKIT1;
else
}else{
UI_LogFuncEnd();
return BOTH_STAND1;
}
break;
//Other: "Hypo
case WP_12:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_HYPOSPRAY1;
else
}else{
UI_LogFuncEnd();
return BOTH_STAND1;
//Other: "Toolkit"
/*case WP_14:
//Return nothing.
//A bit hacky, but the engine accepts it :P
break;*/
//Other Tools "everything else"
/*case WP_1:
switch(rand()%13)
{
case 0: return TORSO_HANDGESTURE1;
case 1: return TORSO_HANDGESTURE2;
case 2: return TORSO_HANDGESTURE3;
case 3: return TORSO_HANDGESTURE4;
case 4: //PM_StartTorsoAnim( TORSO_HANDGESTURE5 ); break;
case 5: return TORSO_HANDGESTURE6;
case 6: return TORSO_HANDGESTURE7;
case 7: return TORSO_HANDGESTURE8;
case 8: return TORSO_HANDGESTURE9;
case 9: return TORSO_HANDGESTURE10;
case 10: return TORSO_HANDGESTURE11;
case 11: return TORSO_HANDGESTURE12;
case 12: return TORSO_HANDGESTURE13;
}
break;*/
case WP_4:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_COFFEE;
}
//break;
default:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_WEAPONREADY1;
else
}else{
UI_LogFuncEnd();
return BOTH_STAND1;
}
break;
}
break;
//When the player jumps
case ANIM_JUMP:
UI_LogFuncEnd();
return BOTH_JUMP1;
//When the player runs
@ -695,17 +721,23 @@ int32_t UI_GetAnim ( int32_t anim, int32_t weapon, qboolean upper )
case WP_9:
case WP_6:
case WP_7:
if (upper)
if (upper){
UI_LogFuncEnd();
return BOTH_RUN2;
else
}else{
UI_LogFuncEnd();
return BOTH_RUN1;
}
break;
case WP_4:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_COFFEE;
}
//break;
//EVERYTHING ELSE
default:
UI_LogFuncEnd();
return BOTH_RUN1;
}
break;
@ -723,10 +755,13 @@ int32_t UI_GetAnim ( int32_t anim, int32_t weapon, qboolean upper )
break;
//Other Tools "everything else"
case WP_4:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_COFFEE;
}
//break;
default:
UI_LogFuncEnd();
return BOTH_WALK1;
break;
}
@ -742,26 +777,34 @@ int32_t UI_GetAnim ( int32_t anim, int32_t weapon, qboolean upper )
case WP_9:
case WP_6:
case WP_7:
if ( upper )
if ( upper ){
UI_LogFuncEnd();
return BOTH_WALK4;
else
}else{
UI_LogFuncEnd();
return LEGS_WALKBACK1;
}
break;
case WP_4:
if (upper)
if (upper){
UI_LogFuncEnd();
return TORSO_COFFEE;
//break;
}
//Other Tools "everything else"
default:
if ( upper )
if ( upper ){
UI_LogFuncEnd();
return BOTH_WALK1;
else
}else{
UI_LogFuncEnd();
return LEGS_WALKBACK1;
}
break;
}
break;
}
UI_LogFuncEnd();
return BOTH_STAND1;
}

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,7 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#include "ui_local.h"
#include "ui_logger.h"
/*
===================
@ -11,6 +12,7 @@ x, y, are in pixels
===================
*/
void MField_Draw( mfield_t *edit, int32_t x, int32_t y, int32_t style, vec4_t color,int32_t cursor ) {
UI_LogFuncBegin();
int32_t len;
int32_t charw;
int32_t drawLen;
@ -57,6 +59,7 @@ void MField_Draw( mfield_t *edit, int32_t x, int32_t y, int32_t style, vec4_t co
// draw the cursor
if (!cursor)
{
UI_LogFuncEnd();
return;
}
@ -102,6 +105,7 @@ void MField_Draw( mfield_t *edit, int32_t x, int32_t y, int32_t style, vec4_t co
{
UI_DrawChar( x, y+2, cursorChar, style & ~(UI_CENTER|UI_RIGHT), color );
}
UI_LogFuncEnd();
}
/*
@ -110,6 +114,7 @@ MField_Paste
================
*/
void MField_Paste( mfield_t *edit ) {
UI_LogFuncBegin();
char pasteBuffer[64];
int32_t pasteLen, i;
@ -120,6 +125,7 @@ void MField_Paste( mfield_t *edit ) {
for ( i = 0 ; i < pasteLen ; i++ ) {
MField_CharEvent( edit, pasteBuffer[i] );
}
UI_LogFuncEnd();
}
/*
@ -133,11 +139,13 @@ Key events are used for non-printable characters, others are gotten from char ev
=================
*/
void MField_KeyDownEvent( mfield_t *edit, int32_t key ) {
UI_LogFuncBegin();
int32_t len;
// shift-insert is paste
if ( ( ( key == K_INS ) || ( key == K_KP_INS ) ) && trap_Key_IsDown( K_SHIFT ) ) {
MField_Paste( edit );
UI_LogFuncEnd();
return;
}
@ -148,6 +156,7 @@ void MField_KeyDownEvent( mfield_t *edit, int32_t key ) {
memmove( edit->buffer + edit->cursor,
edit->buffer + edit->cursor + 1, len - edit->cursor );
}
UI_LogFuncEnd();
return;
}
@ -160,6 +169,7 @@ void MField_KeyDownEvent( mfield_t *edit, int32_t key ) {
{
edit->scroll++;
}
UI_LogFuncEnd();
return;
}
@ -172,12 +182,14 @@ void MField_KeyDownEvent( mfield_t *edit, int32_t key ) {
{
edit->scroll--;
}
UI_LogFuncEnd();
return;
}
if ( key == K_HOME || key == K_KP_HOME || ( tolower(key) == 'a' && trap_Key_IsDown( K_CTRL ) ) ) {
edit->cursor = 0;
edit->scroll = 0;
UI_LogFuncEnd();
return;
}
@ -186,13 +198,16 @@ void MField_KeyDownEvent( mfield_t *edit, int32_t key ) {
edit->scroll = len - edit->widthInChars + 1;
if (edit->scroll < 0)
edit->scroll = 0;
UI_LogFuncEnd();
return;
}
if ( key == K_INS || key == K_KP_INS ) {
trap_Key_SetOverstrikeMode( !trap_Key_GetOverstrikeMode() );
UI_LogFuncEnd();
return;
}
UI_LogFuncEnd();
}
/*
@ -201,15 +216,18 @@ MField_CharEvent
==================
*/
void MField_CharEvent( mfield_t *edit, int32_t ch ) {
UI_LogFuncBegin();
int32_t len;
if ( ch == 'v' - 'a' + 1 ) { // ctrl-v is paste
MField_Paste( edit );
UI_LogFuncEnd();
return;
}
if ( ch == 'c' - 'a' + 1 ) { // ctrl-c clears the field
MField_Clear( edit );
UI_LogFuncEnd();
return;
}
@ -225,12 +243,14 @@ void MField_CharEvent( mfield_t *edit, int32_t ch ) {
edit->scroll--;
}
}
UI_LogFuncEnd();
return;
}
if ( ch == 'a' - 'a' + 1 ) { // ctrl-a is home
edit->cursor = 0;
edit->scroll = 0;
UI_LogFuncEnd();
return;
}
@ -239,6 +259,7 @@ void MField_CharEvent( mfield_t *edit, int32_t ch ) {
edit->scroll = edit->cursor - edit->widthInChars + 1;
if (edit->scroll < 0)
edit->scroll = 0;
UI_LogFuncEnd();
return;
}
@ -246,16 +267,21 @@ void MField_CharEvent( mfield_t *edit, int32_t ch ) {
// ignore any other non printable chars
//
if ( ch < 32 ) {
UI_LogFuncEnd();
return;
}
if ( !trap_Key_GetOverstrikeMode() ) {
if ((edit->cursor == MAX_EDIT_LINE - 1) || (edit->maxchars && edit->cursor >= edit->maxchars))
if ((edit->cursor == MAX_EDIT_LINE - 1) || (edit->maxchars && edit->cursor >= edit->maxchars)){
UI_LogFuncEnd();
return;
}
} else {
// insert mode
if (( len == MAX_EDIT_LINE - 1 ) || (edit->maxchars && len >= edit->maxchars))
if (( len == MAX_EDIT_LINE - 1 ) || (edit->maxchars && len >= edit->maxchars)){
UI_LogFuncEnd();
return;
}
memmove( edit->buffer + edit->cursor + 1, edit->buffer + edit->cursor, len + 1 - edit->cursor );
}
@ -271,6 +297,7 @@ void MField_CharEvent( mfield_t *edit, int32_t ch ) {
if ( edit->cursor == len + 1) {
edit->buffer[edit->cursor] = 0;
}
UI_LogFuncEnd();
}
/*
@ -279,9 +306,11 @@ MField_Clear
==================
*/
void MField_Clear( mfield_t *edit ) {
UI_LogFuncBegin();
edit->buffer[0] = 0;
edit->cursor = 0;
edit->scroll = 0;
UI_LogFuncEnd();
}
/*
@ -290,6 +319,7 @@ MenuField_Init
==================
*/
void MenuField_Init( menufield_s* m ) {
UI_LogFuncBegin();
int32_t l;
int32_t w;
int32_t h;
@ -317,13 +347,7 @@ void MenuField_Init( menufield_s* m ) {
h = SMALLCHAR_HEIGHT;
}
//TiM: This is leftover from Quake III. We'll be using this variable elsewhere now :)
/*if (m->generic.name) {
l = (strlen( m->generic.name )+1) * w;
}
else {*/
l = 0;
//}
l = 0;
if ( m->field.style & UI_CENTER ) {
m->generic.right = m->generic.x + (w + ( m->field.widthInChars*w ) ) / 2;
@ -341,6 +365,7 @@ void MenuField_Init( menufield_s* m ) {
if ( m->generic.name ) {
m->generic.bottom += MENU_BUTTON_MED_HEIGHT + 4;
}
UI_LogFuncEnd();
}
/*
@ -350,6 +375,7 @@ MenuField_Draw
*/
void MenuField_Draw( menufield_s *f )
{
UI_LogFuncBegin();
int32_t x;
int32_t y;
int32_t w;
@ -470,7 +496,7 @@ void MenuField_Draw( menufield_s *f )
}// TiM 5 = 10 previously
MField_Draw( &f->field, x, y+offset, style, colorTable[color],focus );
UI_LogFuncEnd();
}
/*
@ -480,6 +506,7 @@ MenuField_Key
*/
sfxHandle_t MenuField_Key( menufield_s* m, int32_t* key )
{
UI_LogFuncBegin();
int32_t keycode;
keycode = *key;
@ -513,6 +540,7 @@ sfxHandle_t MenuField_Key( menufield_s* m, int32_t* key )
else if ((m->generic.flags & QMF_LOWERCASE) && Q_isupper( keycode ))
keycode -= 'A' - 'a';
else if ((m->generic.flags & QMF_NUMBERSONLY) && Q_isalpha( keycode ))
UI_LogFuncEnd();
return (menu_buzz_sound);
MField_CharEvent( &m->field, keycode);
@ -526,7 +554,7 @@ sfxHandle_t MenuField_Key( menufield_s* m, int32_t* key )
break;
}
UI_LogFuncEnd();
return (0);
}

View file

@ -1,6 +1,7 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#include "ui_local.h"
#include "ui_logger.h"
#define MAX_MODS 64
#define NAMEBUFSIZE ( MAX_MODS * 48 )
@ -46,8 +47,10 @@ Mods_MenuEvent
*/
static void Mods_MenuEvent( void *ptr, int32_t event )
{
UI_LogFuncBegin();
if( event != QM_ACTIVATED )
{
UI_LogFuncEnd();
return;
}
@ -63,6 +66,7 @@ static void Mods_MenuEvent( void *ptr, int32_t event )
UI_PopMenu();
break;
}
UI_LogFuncEnd();
}
@ -73,6 +77,7 @@ UI_Mods_ParseInfos
*/
static void UI_Mods_ParseInfos( char *modDir, char *modDesc )
{
UI_LogFuncBegin();
s_mods.fs_gameList[s_mods.list.numitems] = s_mods.fs_gamePtr;
Q_strncpyz( s_mods.fs_gamePtr, modDir, 16 );
@ -83,49 +88,9 @@ static void UI_Mods_ParseInfos( char *modDir, char *modDesc )
s_mods.descriptionPtr += strlen( s_mods.descriptionPtr ) + 1;
s_mods.fs_gamePtr += strlen( s_mods.fs_gamePtr ) + 1;
s_mods.list.numitems++;
UI_LogFuncEnd();
}
/*
===============
UI_Mods_LoadModsFromFile
===============
*/
/*
static void UI_Mods_LoadModsFromFile( char *filename )
{
int32_t len;
fileHandle_t f;
char buf[1024];
len = trap_FS_FOpenFile( filename, &f, FS_READ );
if ( !f )
{
trap_Print( va( S_COLOR_RED "File not found: %s\n", filename ) );
return;
}
if ( len >= sizeof(buf) )
{
trap_Print( va( S_COLOR_RED "File too large: %s is %i, max allowed is %i", filename, len, sizeof(buf) ));
trap_FS_FCloseFile( f );
return;
}
trap_FS_Read( buf, len, f );
buf[len] = 0;
trap_FS_FCloseFile( f );
len = strlen( filename );
if( !Q_stricmp(filename + len - 4,".mod") )
{
filename[len-4] = '\0';
}
UI_Mods_ParseInfos( filename, buf );
}
*/
/*
===============
Mods_LoadMods
@ -133,6 +98,7 @@ Mods_LoadMods
*/
static void Mods_LoadMods( void )
{
UI_LogFuncBegin();
int32_t numdirs;
char dirlist[4096];
char *dirptr;
@ -164,6 +130,7 @@ static void Mods_LoadMods( void )
{
s_mods.list.numitems = MAX_MODS;
}
UI_LogFuncEnd();
}
@ -174,6 +141,7 @@ M_MainMenu_Graphics
*/
void ModsMenu_Graphics (void)
{
UI_LogFuncBegin();
// Draw the basic screen layout
UI_MenuFrame(&s_mods.menu);
@ -208,6 +176,7 @@ void ModsMenu_Graphics (void)
trap_R_SetColor( colorTable[CT_LTBROWN1]);
UI_DrawProportionalString( 152, 168, menu_normal_text[MNT_AVAILABLEMODS], UI_SMALLFONT, colorTable[CT_BLACK]); //colorTable[CT_LTPURPLE3] //210
UI_DrawProportionalString( 568, 170, "38-56",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_LogFuncEnd();
}
/*
@ -217,10 +186,12 @@ ModsMenu_Draw
*/
void ModsMenu_Draw (void)
{
UI_LogFuncBegin();
// Draw graphics particular to Mods Menu
ModsMenu_Graphics();
Menu_Draw( &s_mods.menu );
UI_LogFuncEnd();
}
/*
@ -230,10 +201,12 @@ UI_Mods_Cache
*/
void UI_ModsMenu_Cache( void )
{
UI_LogFuncBegin();
s_mods.corner_ul = trap_R_RegisterShaderNoMip("menu/common/corner_ul_18_18.tga");
s_mods.corner_ur = trap_R_RegisterShaderNoMip("menu/common/corner_ur_18_18.tga");
s_mods.corner_ll = trap_R_RegisterShaderNoMip("menu/common/corner_ll_18_18.tga");
s_mods.corner_lr = trap_R_RegisterShaderNoMip("menu/common/corner_lr_18_18.tga");
UI_LogFuncEnd();
}
/*
@ -243,6 +216,7 @@ UI_Mods_MenuInit
*/
static void UI_Mods_MenuInit( void )
{
UI_LogFuncBegin();
// Menu Data
memset( &s_mods, 0 ,sizeof(mods_t) );
s_mods.menu.wrapAround = qtrue;
@ -307,6 +281,7 @@ static void UI_Mods_MenuInit( void )
Menu_AddItem( &s_mods.menu, &s_mods.mainmenu );
Menu_AddItem( &s_mods.menu, &s_mods.list );
Menu_AddItem( &s_mods.menu, &s_mods.go );
UI_LogFuncEnd();
}
@ -317,6 +292,8 @@ UI_ModsMenu
*/
void UI_ModsMenu( void )
{
UI_LogFuncBegin();
UI_Mods_MenuInit();
UI_PushMenu( &s_mods.menu );
UI_LogFuncEnd();
}

View file

@ -7,6 +7,7 @@
#include "../qcommon/stv_version.h"
#include "ui_local.h"
#include "ui_logger.h"
#define ID_CONTINUE 10
#define ID_DISCONNECT 11
@ -41,7 +42,9 @@ M_Motd_Event
*/
static void M_MotdMenu_Event( void *ptr, int32_t notification )
{
UI_LogFuncBegin();
if( notification != QM_ACTIVATED ) {
UI_LogFuncEnd();
return;
}
@ -62,7 +65,8 @@ static void M_MotdMenu_Event( void *ptr, int32_t notification )
if ( s_motdstuff.scrollnum + MIN_MOTD_LINES < motdtextnum ) {
s_motdstuff.scrollnum += 3;
}
}
}
UI_LogFuncEnd();
}
/*
@ -72,6 +76,8 @@ MotdMenu_Key
*/
sfxHandle_t MotdMenu_Key( int32_t key )
{
UI_LogFuncBegin();
UI_LogFuncEnd();
return ( Menu_DefaultKey( &s_motdstuff.menu, key ) );
}
@ -82,6 +88,7 @@ M_MotdMenu_Graphics
*/
static void M_MotdMenu_Graphics( void )
{
UI_LogFuncBegin();
int32_t i;
int32_t x = 15;
int32_t y = 15;
@ -111,6 +118,7 @@ static void M_MotdMenu_Graphics( void )
UI_DrawHandlePic( 319, 440, 25, 25, uis.halfroundr_22);
trap_R_SetColor(NULL);
UI_LogFuncEnd();
}
/*
@ -120,7 +128,9 @@ MotdMenu_Draw
*/
static void MotdMenu_Draw( void )
{
UI_LogFuncBegin();
M_MotdMenu_Graphics();
UI_LogFuncEnd();
Menu_Draw( &s_motdstuff.menu );
}
@ -131,7 +141,9 @@ UI_MotdMenu_Cache
*/
void UI_MotdMenu_Cache( void )
{
s_motdstuff.halfroundl_22 = trap_R_RegisterShaderNoMip( "menu/common/halfroundl_22.tga" );
UI_LogFuncBegin();
s_motdstuff.halfroundl_22 = trap_R_RegisterShaderNoMip( "menu/common/halfroundl_22.tga" );
UI_LogFuncEnd();
}
/*
@ -141,6 +153,7 @@ MotdMenu_Init
*/
void MotdMenu_Init( void )
{
UI_LogFuncBegin();
s_motdstuff.menu.nitems = 0;
s_motdstuff.menu.draw = MotdMenu_Draw;
s_motdstuff.menu.key = MotdMenu_Key;
@ -222,6 +235,7 @@ void MotdMenu_Init( void )
Menu_AddItem( &s_motdstuff.menu, &s_motdstuff.disconnect );
Menu_AddItem( &s_motdstuff.menu, &s_motdstuff.arrowup );
Menu_AddItem( &s_motdstuff.menu, &s_motdstuff.arrowdwn );
UI_LogFuncEnd();
}
/*
@ -231,12 +245,14 @@ MotdReset
*/
void MotdReset( void )
{
UI_LogFuncBegin();
int32_t i;
motdtextnum = 0;
for ( i = 0; i < MAX_MOTD_LINES; ++i ) {
*motdtext[i] = '\0';
}
UI_LogFuncEnd();
}
/*
@ -246,8 +262,10 @@ MotdReceiveLine
*/
void MotdReceiveLine( const char *txt )
{
UI_LogFuncBegin();
Q_strncpyz(motdtext[motdtextnum], txt, sizeof (motdtext[motdtextnum]));
motdtextnum++;
UI_LogFuncEnd();
}
/*
@ -257,6 +275,7 @@ UI_MotdMenu
*/
void UI_MotdMenu( void )
{
UI_LogFuncBegin();
memset( &s_motdstuff, 0, sizeof( s_motdstuff ) );
uis.menusp = 0;
@ -272,4 +291,5 @@ void UI_MotdMenu( void )
UI_PushMenu( &s_motdstuff.menu );
Menu_AdjustCursor( &s_motdstuff.menu, 1 );
UI_LogFuncEnd();
}

View file

@ -4,6 +4,7 @@
User interface trigger from within game
**********************************************************************/
#include "ui_local.h"
#include "ui_logger.h"
typedef struct //static
{
@ -37,6 +38,7 @@ M_msd_Event
*/
static void M_msd_Event (void* ptr, int32_t notification)
{
UI_LogFuncBegin();
int32_t id;
//menubitmap_s *holdLocation;
//menubitmap_s *holdServer;
@ -50,6 +52,7 @@ static void M_msd_Event (void* ptr, int32_t notification)
if ((id == ID_QUIT) && (notification == QM_ACTIVATED))
UI_PopMenu();
UI_LogFuncEnd();
}
/*
@ -82,6 +85,7 @@ M_msdMenu_Graphics
*/
static void M_msdMenu_Graphics (void)
{
UI_LogFuncBegin();
/*Notes:
Color-Types in Frame:
trap_R_SetColor( colorTable[CT_DKPURPLE3]);
@ -277,7 +281,8 @@ static void M_msdMenu_Graphics (void)
UI_DrawHandlePic( 386, 381, 88, 43, uis.whiteShader);
UI_DrawProportionalString(386, 382, "Transporter-ODN-", UI_TINYFONT, colorTable[CT_MDGREY]);
UI_DrawProportionalString(387, 397, "Update required", UI_TINYFONT, colorTable[CT_MDGREY]);
}
}
UI_LogFuncEnd();
}
@ -289,9 +294,11 @@ msdMenu_Draw
static void msdMenu_Draw(void)
{
// Draw graphics particular to Main Menu
UI_LogFuncBegin();
M_msdMenu_Graphics();
Menu_Draw( &s_msd.menu );
UI_LogFuncEnd();
}
/*
@ -301,6 +308,7 @@ UI_msdMenu_Cache
*/
void UI_msdMenu_Cache (void)
{
UI_LogFuncBegin();
leftRound = trap_R_RegisterShaderNoMip("menu/common/halfroundl_24.tga");
corner_ul_24_60 = trap_R_RegisterShaderNoMip("menu/common/corner_ul_24_60.tga");
corner_ll_12_60 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_12_60.tga");
@ -313,6 +321,7 @@ void UI_msdMenu_Cache (void)
yellowalert = trap_R_RegisterShaderNoMip("menu/alert/yellow");
bluealert = trap_R_RegisterShaderNoMip("menu/alert/blue");
model = trap_R_RegisterShaderNoMip(s_msd.model);
UI_LogFuncEnd();
}
/*
@ -322,6 +331,7 @@ msdMenu_Init
*/
void msdMenu_Init(void)
{
UI_LogFuncBegin();
s_msd.menu.nitems = 0;
s_msd.menu.draw = msdMenu_Draw;
s_msd.menu.key = msdMenu_Key;
@ -350,6 +360,7 @@ void msdMenu_Init(void)
s_msd.quitmenu.textStyle = UI_TINYFONT;
Menu_AddItem( &s_msd.menu, &s_msd.quitmenu );
UI_LogFuncEnd();
}
/*
@ -359,6 +370,7 @@ UI_msdMenu
*/
void UI_msdMenu(int32_t maxhull, int32_t currhull, int32_t maxshield, int32_t currshield, int32_t shieldstate, int32_t warpstate, int32_t turbostate, int32_t transstate, int32_t alertstate, char *model)
{
UI_LogFuncBegin();
memset( &s_msd, 0, sizeof( s_msd ) );
s_msd.maxhull = maxhull;
@ -385,4 +397,5 @@ void UI_msdMenu(int32_t maxhull, int32_t currhull, int32_t maxshield, int32_t cu
UI_PushMenu( &s_msd.menu );
Menu_AdjustCursor( &s_msd.menu, 1 );
UI_LogFuncEnd();
}

View file

@ -9,6 +9,7 @@ NETWORK OPTIONS MENU
*/
#include "ui_local.h"
#include "ui_logger.h"
#define ID_GRAPHICS 10
@ -59,8 +60,10 @@ UI_NetworkOptionsMenu_Event
*/
static void UI_NetworkOptionsMenu_Event( void* ptr, int32_t event )
{
UI_LogFuncBegin();
if( event != QM_ACTIVATED )
{
UI_LogFuncEnd();
return;
}
@ -108,6 +111,7 @@ static void UI_NetworkOptionsMenu_Event( void* ptr, int32_t event )
break;
}
UI_LogFuncEnd();
}
@ -118,6 +122,7 @@ M_NetworkMenu_Graphics
*/
void M_NetworkMenu_Graphics (void)
{
UI_LogFuncBegin();
UI_MenuFrame(&networkOptionsInfo.menu);
UI_Setup_MenuButtons();
@ -152,7 +157,7 @@ void M_NetworkMenu_Graphics (void)
UI_DrawHandlePic(494,406, 128, 128, networkOptionsInfo.swooshBottom); // Bottom swoosh
UI_DrawHandlePic(174,420, 320, 8, uis.whiteShader); // Bottom line
UI_LogFuncEnd();
}
@ -163,10 +168,11 @@ Network_MenuDraw
*/
static void Network_MenuDraw (void)
{
UI_LogFuncBegin();
M_NetworkMenu_Graphics();
Menu_Draw( &networkOptionsInfo.menu );
UI_LogFuncEnd();
}
/*
@ -176,6 +182,7 @@ UI_NetworkOptionsMenu_Init
*/
static void UI_NetworkOptionsMenu_Init( void )
{
UI_LogFuncBegin();
int32_t rate;
memset( &networkOptionsInfo, 0, sizeof(networkOptionsInfo) );
@ -238,6 +245,7 @@ static void UI_NetworkOptionsMenu_Init( void )
{
networkOptionsInfo.rate.curvalue = 4;
}
UI_LogFuncEnd();
}
@ -248,8 +256,10 @@ UI_NetworkOptionsMenu_Cache
*/
void UI_NetworkOptionsMenu_Cache( void )
{
UI_LogFuncBegin();
networkOptionsInfo.swooshTop = trap_R_RegisterShaderNoMip("menu/common/swoosh_top.tga");
networkOptionsInfo.swooshBottom= trap_R_RegisterShaderNoMip("menu/common/swoosh_bottom.tga");
UI_LogFuncEnd();
}
@ -260,9 +270,10 @@ UI_NetworkOptionsMenu
*/
void UI_NetworkOptionsMenu( void )
{
UI_LogFuncBegin();
UI_NetworkOptionsMenu_Init();
UI_PushMenu( &networkOptionsInfo.menu );
UI_LogFuncEnd();
}

View file

@ -10,6 +10,7 @@
//
//=================================================
#include "ui_local.h"
#include "ui_logger.h"
#define PIC_ARROW_UP "menu/common/arrow_up_16.tga"
#define PIC_ARROW_DOWN "menu/common/arrow_dn_16.tga"
@ -195,9 +196,12 @@ Mental Note: Study Pointer Arithmetic more....
static int32_t PlayerModel_CheckInFilter( char* string, filterData_t *filter, int32_t width, int32_t *num ) {
int32_t i=0;
UI_LogFuncBegin();
while( filter[i].filterName[0] && i < width ) {
if ( !Q_stricmp( filter[i].filterName, string ) ) {
//Com_Printf( S_COLOR_RED "String %s already in cell %i\n", array[i], i );
UI_LogFuncEnd();
return i;
}
@ -214,34 +218,10 @@ static int32_t PlayerModel_CheckInFilter( char* string, filterData_t *filter, in
//Com_Printf( S_COLOR_RED "Added %s to cell %i", array[i], i );
UI_LogFuncEnd();
return i;
}
//static int32_t PlayerModel_CheckInArray( char* string, void *array, size_t length ) {
// int32_t i=0;
// char *str=NULL;
//
// for (i = 0; i < length; i++ ) {
// str = ((char **)array)[i]; //funky, yet awesome use of the void type lol
//
// Com_Printf( S_COLOR_RED ": %s\n", str );
//
// if ( !str )
// break;
//
// if ( !Q_stricmp( str, string ) ) {
// return i;
// }
// }
//
// if ( i < length )
// {
// Q_strncpyz( ((char **)array)[i], string, length );
// }
//
// return i;
//}
/*
=================
PlayerModel_LoadAvailableModels
@ -264,8 +244,12 @@ static int32_t PlayerModel_LoadAvailableModels( void ) {
char* temp;
char fileRoute[MAX_QPATH];
if ( s_playermodel.selectedChar == -1 )
UI_LogFuncBegin();
if ( s_playermodel.selectedChar == -1 ){
UI_LogFuncEnd();
return -1;
}
Com_sprintf( fileRoute, MAX_QPATH,
"models/players_rpgx/%s",
@ -275,8 +259,10 @@ static int32_t PlayerModel_LoadAvailableModels( void ) {
memset( &fileList, 0, sizeof ( fileList ) );
numFiles = trap_FS_GetFileList( fileRoute, ".model", fileList, sizeof(fileList) );
if ( numFiles <=0 )
if ( numFiles <=0 ){
UI_LogFuncEnd();
return -1;
}
//Convert to ptr for easier manip
filePtr = fileList;
@ -330,6 +316,7 @@ static int32_t PlayerModel_LoadAvailableModels( void ) {
s_playermodel.modelList[i] = Q_strupr( s_playermodel.modelNamesUpr[i] );
}
UI_LogFuncEnd();
return j;
}
@ -360,8 +347,12 @@ static void PlayerModel_LoadAvailableSkins( void ) {
int32_t starFlags;
char skins[MAX_PLAYERSKINS][64];
if ( s_playermodel.selectedChar == -1 )
UI_LogFuncBegin();
if ( s_playermodel.selectedChar == -1 ){
UI_LogFuncEnd();
return;
}
/*memset( s_playermodel.skinNames, 0, sizeof( s_playermodel.skinNames ) );
memset( s_playermodel.skinNamesUpr, 0, sizeof( s_playermodel.skinNamesUpr ) );
@ -392,6 +383,7 @@ static void PlayerModel_LoadAvailableSkins( void ) {
if ( numFiles <= 0 )
{
Com_Printf( S_COLOR_RED "ERROR: No Skinset files found!\n" );
UI_LogFuncEnd();
return;
}
@ -429,8 +421,10 @@ static void PlayerModel_LoadAvailableSkins( void ) {
j = 0;
while ( j < MAX_PLAYERMODELS )
{
if ( !s_playermodel.modelNames[j][0] )
if ( !s_playermodel.modelNames[j][0] ){
UI_LogFuncEnd();
break;
}
Com_sprintf( filePath, sizeof( filePath ),
"models/players_rpgx/%s/%s.model",
@ -442,11 +436,13 @@ static void PlayerModel_LoadAvailableSkins( void ) {
if ( fileLen <= 0 ) {
Com_Printf( S_COLOR_RED "File not found: %s\n", filePath );
UI_LogFuncEnd();
return;
}
if ( fileLen > 20000 ) {
Com_Printf( S_COLOR_RED "File exceeded maximum size: %s\n", filePath );
UI_LogFuncEnd();
return;
}
@ -455,8 +451,10 @@ static void PlayerModel_LoadAvailableSkins( void ) {
trap_FS_FCloseFile( f );
if ( !fileBuffer[0] )
if ( !fileBuffer[0] ){
UI_LogFuncEnd();
return;
}
filePtr = fileBuffer;
@ -556,6 +554,7 @@ static void PlayerModel_LoadAvailableSkins( void ) {
numSkins=0;
j++;
}
UI_LogFuncEnd();
}
static int32_t QDECL CharMediaList_Compare( const void *ptr1, const void *ptr2 )
@ -563,22 +562,13 @@ static int32_t QDECL CharMediaList_Compare( const void *ptr1, const void *ptr2 )
const char *str1, *str2;
char chr1, chr2;
UI_LogFuncBegin();
str1 = (const char *)ptr1;
str2 = (const char *)ptr2;
//Com_Printf( "STR1: %s STR2: %s\n", str1, str2 );
//default data always comes first
//Actually... we came this far, let's just make it all alphabetic
/*if ( !Q_stricmp( str1, DEFAULT_SKIN ) || !Q_stricmp( str1, DEFAULT_MODEL ) )
{
return -1;
}
else if ( !Q_stricmp( str2, DEFAULT_SKIN ) || !Q_stricmp( str2, DEFAULT_MODEL ) )
{
return 1;
}*/
chr1 = *str1;
chr2 = *str2;
@ -594,6 +584,7 @@ static int32_t QDECL CharMediaList_Compare( const void *ptr1, const void *ptr2 )
}
//based off of their ASCII order.
UI_LogFuncEnd();
return ((int32_t)chr1 - (int32_t)chr2);
}
@ -602,12 +593,16 @@ static int32_t QDECL FilterList_Compare( const void *ptr1, const void *ptr2 )
const char *str1, *str2;
char chr1, chr2;
UI_LogFuncBegin();
str1 = ((filterData_t *)ptr1)->filterName;
str2 = ((filterData_t *)ptr2)->filterName;
//hacky override. Make sure 'All' comes first.
if ( !Q_stricmp( str1, "ALL" ) )
if ( !Q_stricmp( str1, "ALL" ) ){
UI_LogFuncEnd();
return -1;
}
chr1 = *str1;
chr2 = *str2;
@ -627,6 +622,7 @@ static int32_t QDECL FilterList_Compare( const void *ptr1, const void *ptr2 )
}
//based off of their ASCII order.
UI_LogFuncEnd();
return ((int32_t)chr1 - (int32_t)chr2);
}
@ -639,8 +635,11 @@ static int32_t PlayerModel_PopulateSkinsList ( void ) {
int32_t i;
int32_t j;
UI_LogFuncBegin();
if ( !s_playermodel.skinNames[s_playermodel.charModel.curvalue][0][0] ) {
Com_Printf( S_COLOR_RED "ERROR: No valid skins found.\n" );
UI_LogFuncEnd();
return -1;
}
@ -671,6 +670,7 @@ static int32_t PlayerModel_PopulateSkinsList ( void ) {
}
}
UI_LogFuncEnd();
return j;
}
@ -690,6 +690,8 @@ static void PlayerModel_OffsetCharList( int32_t* offset ) {
char* buffer; //intermediate value so performing strupr won't pwn our case sensitive data
int32_t i;
UI_LogFuncBegin();
if ( *offset < 0 ) {
*offset = 0;
}
@ -719,6 +721,7 @@ static void PlayerModel_OffsetCharList( int32_t* offset ) {
Q_strupr( s_playermodel.charMenu[i].textPtr );
}
UI_LogFuncEnd();
}
/*
@ -734,6 +737,8 @@ static void PlayerModel_RebuildCharMenu( void ) {
qboolean raceValid=qfalse;
qboolean genderValid=qfalse;
UI_LogFuncBegin();
s_playermodel.numChars = 0;
memset( &s_playermodel.charNamesUpr, 0, sizeof( s_playermodel.charNamesUpr ) );
@ -778,6 +783,7 @@ static void PlayerModel_RebuildCharMenu( void ) {
s_playermodel.scrollOffset = 0;
PlayerModel_OffsetCharList( &s_playermodel.scrollOffset );
UI_LogFuncEnd();
}
/*
@ -787,11 +793,13 @@ PlayerModel_SpinPlayer
*/
static void PlayerModel_SpinPlayer( void* ptr, int32_t event)
{
UI_LogFuncBegin();
if ( event == QM_ACTIVATED )
{
uis.spinView = qtrue;
uis.cursorpx = uis.cursorx;
}
UI_LogFuncEnd();
}
/*
@ -801,6 +809,8 @@ PlayerModel_UpdateModel
*/
static void PlayerModel_UpdateModel( void )
{
UI_LogFuncBegin();
vec3_t viewangles;
vec3_t moveangles;
@ -813,7 +823,7 @@ static void PlayerModel_UpdateModel( void )
UI_PlayerInfo_SetModel( &s_playermodel.playerinfo, s_playermodel.modelData );
UI_PlayerInfo_SetInfo( &s_playermodel.playerinfo, BOTH_WALK1, BOTH_WALK1, viewangles, moveangles, WP_0, trap_Cvar_VariableValue( "height" ), trap_Cvar_VariableValue( "weight" ), qfalse );
UI_LogFuncEnd();
}
/*
@ -823,6 +833,8 @@ PlayerModel_SaveChanges
*/
static void PlayerModel_SaveChanges( void )
{
UI_LogFuncBegin();
trap_Cvar_Set( "model", va("%s/%s/%s",
s_playermodel.charNames[s_playermodel.selectedChar].charName,
s_playermodel.modelNames[s_playermodel.charModel.curvalue],
@ -835,6 +847,7 @@ static void PlayerModel_SaveChanges( void )
Q_strncpyz( s_playermodel.modelData, UI_Cvar_VariableString( "model" ), sizeof ( s_playermodel.modelData ) );
PlayerModel_UpdateModel( );
UI_LogFuncEnd();
}
/*
@ -843,6 +856,8 @@ PlayerModel_CheckForChange
==================
*/
static void PlayerModel_CheckForChange( void ) {
UI_LogFuncBegin();
qboolean enableSaveButton=qfalse;
if ( s_playermodel.storedData.orgChar != s_playermodel.selectedChar )
@ -866,6 +881,7 @@ static void PlayerModel_CheckForChange( void ) {
else {
s_playermodel.apply.generic.flags = QMF_INACTIVE | QMF_GRAYED;
}
UI_LogFuncEnd();
}
/*
@ -875,12 +891,15 @@ PlayerModel_SetupScrollBar
*/
static void PlayerModel_SetupScrollBar( menuaction_s *bar )
{
UI_LogFuncBegin();
int32_t height;
//first make sure it's worth enabling this at all
if ( s_playermodel.numChars <= MAX_MENULISTITEMS )
{
bar->generic.flags = QMF_INACTIVE | QMF_HIDDEN;
UI_LogFuncEnd();
return;
}
@ -909,7 +928,7 @@ static void PlayerModel_SetupScrollBar( menuaction_s *bar )
bar->height = height;
bar->generic.bottom = bar->generic.y + height;
UI_LogFuncEnd();
}
/*
@ -919,9 +938,11 @@ PlayerModel_UpdateScrollBar
*/
static void PlayerModel_UpdateScrollBar( menuaction_s *bar )
{
UI_LogFuncBegin();
bar->generic.y = MAX_SCROLLTOP + s_playermodel.scrollOffset*(s_playermodel.scrollData.doubleStep ? 0.5 : 1);
bar->generic.top = bar->generic.y;
bar->generic.bottom = bar->generic.top + bar->height;
UI_LogFuncEnd();
}
/*
@ -931,9 +952,11 @@ PlayerModel_MenuEvent
*/
static void PlayerModel_MenuEvent( void* ptr, int32_t event )
{
if (event != QM_ACTIVATED)
UI_LogFuncBegin();
if (event != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
switch (((menucommon_s*)ptr)->id)
{
@ -1072,6 +1095,7 @@ static void PlayerModel_MenuEvent( void* ptr, int32_t event )
break;
}
PlayerModel_CheckForChange();
UI_LogFuncEnd();
}
/*
@ -1081,6 +1105,7 @@ PlayerModel_MenuKey
*/
static sfxHandle_t PlayerModel_MenuKey( int32_t key )
{
UI_LogFuncBegin();
switch( key )
{
case K_MOUSE1:
@ -1093,6 +1118,7 @@ static sfxHandle_t PlayerModel_MenuKey( int32_t key )
break;
}
UI_LogFuncEnd();
return ( Menu_DefaultKey( &s_playermodel.menu, key ) );
}
@ -1103,6 +1129,7 @@ PlayerModel_DrawPlayer
*/
static void PlayerModel_DrawPlayer( void *self )
{
UI_LogFuncBegin();
menubitmap_s* b;
vec3_t origin = {-40, 2.5, -4 }; //-3.8
@ -1110,10 +1137,12 @@ static void PlayerModel_DrawPlayer( void *self )
if( trap_MemoryRemaining() <= LOW_MEMORY ) {
UI_DrawProportionalString( b->generic.x, b->generic.y + b->height / 2, "LOW MEMORY", UI_LEFT, color_red );
UI_LogFuncEnd();
return;
}
UI_DrawPlayer( (float)b->generic.x, (float)b->generic.y, (float)b->width, (float)b->height, origin, &s_playermodel.playerinfo, (int32_t)(uis.realtime/1.5) );
UI_LogFuncEnd();
}
/*
@ -1132,6 +1161,7 @@ static int32_t QDECL PlayerListOrder_Compare( const void *ptr1, const void *ptr2
static void PlayerModel_BuildList( void )
{
UI_LogFuncBegin();
int32_t numdirs;
int32_t numfiles;
char dirlist[8192];
@ -1238,27 +1268,6 @@ static void PlayerModel_BuildList( void )
//Com_Printf( S_COLOR_RED "Race %s Loaded\n", token );
//tempBuff->race = PlayerModel_CheckInArray( token, s_playermodel.raceNames, MAX_RACES );
//big dirty hack
/*for( k=0; k < MAX_RACES; k++ )
{
if ( !s_playermodel.raceNames[k].raceName[0] )
{
Q_strncpyz( s_playermodel.raceNames[k].raceName, token, sizeof( s_playermodel.raceNames[k].raceName ) );
tempBuff->race = s_playermodel.raceNames[k].raceIndex = k;
s_playermodel.numRaces++;
break;
}
if ( !Q_stricmp( s_playermodel.raceNames[k].raceName, token ) )
{
tempBuff->race = s_playermodel.raceNames[k].raceIndex = k;
break;
}
}*/
tempBuff->race = PlayerModel_CheckInFilter( token, s_playermodel.raceList, MAX_RACES, &s_playermodel.numRaces );
//Com_Printf( S_COLOR_RED "Number of races now: %i\n", s_playermodel.numRaces );
@ -1278,24 +1287,6 @@ static void PlayerModel_BuildList( void )
}
}
//TiM - Flip the array so it's the right order
/*
* RPG-X | Phenix | 27/03/2007
* Removed code for Task#39 (List was fliped to be Z-A!!!!)*/
//for ( i = 0; i < s_playermodel.numChars; i++ ) {
// offset = ( ( s_playermodel.numChars - i ) - 1);
// Q_strncpyz( s_playermodel.charNames[i].charName,
// tempBuff[offset].charName,
// sizeof( s_playermodel.charNames[i].charName ) );
// s_playermodel.charNames[i].race = tempBuff[offset].race;
// s_playermodel.charNames[i].gender = tempBuff[offset].gender;
// s_playermodel.charNames[i].index = tempBuff[offset].index;
// Q_strncpyz( s_playermodel.charNamesUpr[i], s_playermodel.charNames[i].charName, sizeof( s_playermodel.charNamesUpr[i] ) );
//}
//RPG-X | TiM | 30-4-2007
//This loop obviously isn't working well enough.
//Bringing out the big guns. Using the Windows/Q3
@ -1307,6 +1298,7 @@ static void PlayerModel_BuildList( void )
//copy to the upper case list for rendering to the menu
for ( i = 0; i < s_playermodel.numChars; i++ )
Q_strncpyz( s_playermodel.charNamesUpr[i], s_playermodel.charNames[i].charName, sizeof( s_playermodel.charNamesUpr[i] ) );
UI_LogFuncEnd();
}
/*
@ -1323,6 +1315,7 @@ name.
*/
static int32_t QDECL PlayerListOrder_Compare( const void *ptr1, const void *ptr2 )
{
UI_LogFuncBegin();
char *chr1, *chr2;
int32_t delta;
@ -1338,8 +1331,10 @@ static int32_t QDECL PlayerListOrder_Compare( const void *ptr1, const void *ptr2
delta = (int32_t)*chr1 - (int32_t)*chr2;
//if characters weren't the same
if ( delta != 0 )
if ( delta != 0 ){
UI_LogFuncEnd();
return delta;
}
//else loop through the rest
while ( chr1 && chr2 && delta == 0 )
@ -1350,6 +1345,7 @@ static int32_t QDECL PlayerListOrder_Compare( const void *ptr1, const void *ptr2
chr2++;
}
UI_LogFuncEnd();
return delta;
}
@ -1360,6 +1356,7 @@ PlayerModel_SetMenuItems
*/
static void PlayerModel_SetMenuItems( void )
{
UI_LogFuncBegin();
int32_t i;
char* temp;
//char model[64];
@ -1480,6 +1477,7 @@ static void PlayerModel_SetMenuItems( void )
s_playermodel.storedData.orgChar = s_playermodel.selectedChar;
s_playermodel.storedData.orgModel = s_playermodel.charModel.curvalue;
s_playermodel.storedData.orgSkin = s_playermodel.charSkin.curvalue;
UI_LogFuncEnd();
}
/*
@ -1489,6 +1487,7 @@ PlayerModel_DrawScrollBar
*/
static void PlayerModel_DrawScrollBar( void *self )
{
UI_LogFuncBegin();
qboolean focus;
menuaction_s *bar;
int32_t *y;
@ -1509,18 +1508,23 @@ static void PlayerModel_DrawScrollBar( void *self )
UI_DrawHandlePic( bar->generic.x, bar->generic.y, bar->width, bar->height, uis.whiteShader);
trap_R_SetColor( NULL );
if ( !s_playermodel.scrollData.mouseDown )
if ( !s_playermodel.scrollData.mouseDown ){
UI_LogFuncEnd();
return;
}
if ( !trap_Key_IsDown( K_MOUSE1 ) )
{
s_playermodel.scrollData.mouseDown = qfalse;
uis.activemenu->noNewSelecting = qfalse;
UI_LogFuncEnd();
return;
}
if ( uis.cursory == s_playermodel.scrollData.yStart )
if ( uis.cursory == s_playermodel.scrollData.yStart ){
UI_LogFuncEnd();
return;
}
y = &bar->generic.y;
@ -1542,6 +1546,7 @@ static void PlayerModel_DrawScrollBar( void *self )
bar->generic.bottom = *y + bar->height;
s_playermodel.scrollData.yStart = uis.cursory;
UI_LogFuncEnd();
}
@ -1552,6 +1557,7 @@ PlayerSettingsMenu_Graphics
*/
void PlayerModelMenu_Graphics (void)
{
UI_LogFuncBegin();
// Draw the basic screen layout
UI_MenuFrame2(&s_playermodel.menu);
@ -1676,6 +1682,7 @@ void PlayerModelMenu_Graphics (void)
}
}
UI_LogFuncEnd();
}
/*
@ -1685,9 +1692,11 @@ PlayerSettings_MenuDraw
*/
static void PlayerModel_MenuDraw (void)
{
UI_LogFuncBegin();
PlayerModelMenu_Graphics();
Menu_Draw( &s_playermodel.menu );
UI_LogFuncEnd();
}
/*
=================
@ -1696,6 +1705,7 @@ PlayerModel_MenuInit
*/
static void PlayerModel_MenuInit(int32_t menuFrom)
{
UI_LogFuncBegin();
int32_t i;
//int32_t j;
//int32_t k;
@ -2081,6 +2091,7 @@ static void PlayerModel_MenuInit(int32_t menuFrom)
// update user interface
PlayerModel_UpdateModel();
UI_LogFuncEnd();
}
/*
@ -2090,6 +2101,7 @@ PlayerModel_Cache
*/
void PlayerModel_Cache( void )
{
UI_LogFuncBegin();
//int32_t i;
s_playermodel.corner_ll_4_18 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_4_18");
@ -2100,6 +2112,7 @@ void PlayerModel_Cache( void )
trap_R_RegisterShaderNoMip(PIC_ARROW_UP);
trap_R_RegisterShaderNoMip(PIC_ARROW_DOWN);
UI_LogFuncEnd();
}
/*
@ -2109,6 +2122,7 @@ PlayerModel_DrawLoading
*/
static void PlayerModel_DrawLoading( void )
{
UI_LogFuncBegin();
//register the corners now
qhandle_t cornerPic = trap_R_RegisterShaderNoMip("menu/common/corner_ll_47_18.tga");
int32_t y = 50;
@ -2129,6 +2143,7 @@ static void PlayerModel_DrawLoading( void )
UI_DrawHandlePic(214,y+265, 261, 18, uis.whiteShader); // Bottom
UI_DrawProportionalString(345,y+159,menu_normal_text[MNT_LOADING],UI_SMALLFONT | UI_CENTER,colorTable[CT_LTGOLD1]);
UI_LogFuncEnd();
}
/*
@ -2138,6 +2153,7 @@ PlayerModel_Cache
*/
void UI_PlayerModelMenu(int32_t menuFrom)
{
UI_LogFuncBegin();
//TiM - Spawn a quick "loading" box
//Sometimes this gives me the eerie creeps the game froze
PlayerModel_DrawLoading();
@ -2147,6 +2163,7 @@ void UI_PlayerModelMenu(int32_t menuFrom)
UI_PushMenu( &s_playermodel.menu );
//Menu_SetCursorToItem( &s_playermodel.menu, &s_playermodel.pics[s_playermodel.selectedmodel % MAX_MODELSPERPAGE] );
UI_LogFuncEnd();
}

View file

@ -9,6 +9,7 @@
//
//=================================================
#include "ui_local.h"
#include "ui_logger.h"
#define MODEL_SELECT "menu/art/opponents_select"
#define MODEL_SELECTED "menu/art/opponents_selected"
@ -171,6 +172,7 @@ time we refresh this, we'll need to update ourselves.
=================
*/
int32_t PlayerModel_LoadAvailableModels( char* charModels[] ) {
UI_LogFuncBegin();
int32_t i;
int32_t numFiles;
char fileList[2048]; //Hopefully, this will never be exceed ROFL
@ -182,8 +184,10 @@ int32_t PlayerModel_LoadAvailableModels( char* charModels[] ) {
memset( &fileList, 0, sizeof ( fileList ) );
numFiles = trap_FS_GetFileList( va( "models/players_rpgx/%s", s_playermodel.charNames[s_playermodel.selectedChar + s_playermodel.scrollOffset] ), ".model", fileList, sizeof(fileList) );
if ( !numFiles )
if ( !numFiles ){
UI_LogFuncEnd();
return 0;
}
//Convert to ptr for easier manip
filePtr = fileList;
@ -203,7 +207,7 @@ int32_t PlayerModel_LoadAvailableModels( char* charModels[] ) {
charModels[i][strLen-6] = '\0';
}
}
UI_LogFuncEnd();
return i;
}
@ -217,6 +221,7 @@ Hoi... this could get complicated... O_o
================
*/
int32_t PlayerModel_LoadAvailableSkins( char* charSkins[] ) {
UI_LogFuncBegin();
int32_t i=0;
int32_t fileLen;
char fileBuffer[2048];
@ -235,18 +240,22 @@ int32_t PlayerModel_LoadAvailableSkins( char* charSkins[] ) {
if ( fileLen <= 0 ) {
Com_Printf( S_COLOR_RED "File not found: %s\n", filePath );
UI_LogFuncEnd();
return 0;
}
if ( fileLen > sizeof ( fileBuffer ) ) {
Com_Printf( S_COLOR_RED "File exceeded maximum size: %s\n", filePath );
UI_LogFuncEnd();
return 0;
}
trap_FS_Read( fileBuffer, sizeof( fileBuffer ), f );
if ( !fileBuffer[0] )
if ( !fileBuffer[0] ){
UI_LogFuncEnd();
return 0;
}
filePtr = fileBuffer;
@ -268,6 +277,7 @@ int32_t PlayerModel_LoadAvailableSkins( char* charSkins[] ) {
}
}
UI_LogFuncEnd();
return i;
}
@ -281,6 +291,7 @@ So it'll cycle the value of each one up and down.
*/
void PlayerModel_OffsetCharList( int32_t* offset ) {
UI_LogFuncBegin();
char* buffer; //intermediate value so performing strupr won't pwn our case sensitive data
int32_t i;
@ -303,79 +314,9 @@ void PlayerModel_OffsetCharList( int32_t* offset ) {
s_playermodel.charMenu[i].generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_playermodel.charMenu[i].textPtr = Q_strupr( buffer );
}
UI_LogFuncEnd();
}
/*
=================
PlayerModel_UpdateGrid
=================
*/
/*static void PlayerModel_UpdateGrid( void )
{
int32_t i;
int32_t j;
j = s_playermodel.modelpage * MAX_MODELSPERPAGE;
for (i=0; i<PLAYERGRID_ROWS*PLAYERGRID_COLS; i++,j++)
{
if (j < s_playermodel.nummodels)
{
// model/skin portrait
s_playermodel.pics[i].generic.name = s_playermodel.modelnames[j];
s_playermodel.picbuttons[i].generic.flags &= ~QMF_INACTIVE;
}
else
{
// dead slot
s_playermodel.pics[i].generic.name = NULL;
s_playermodel.picbuttons[i].generic.flags |= QMF_INACTIVE;
}
s_playermodel.pics[i].generic.flags &= ~QMF_HIGHLIGHT;
s_playermodel.pics[i].shader = 0;
s_playermodel.picbuttons[i].generic.flags |= QMF_PULSEIFFOCUS;
}
if (s_playermodel.selectedmodel/MAX_MODELSPERPAGE == s_playermodel.modelpage)
{
// set selected model
i = s_playermodel.selectedmodel % MAX_MODELSPERPAGE;
s_playermodel.pics[i].generic.flags |= QMF_HIGHLIGHT;
s_playermodel.picbuttons[i].generic.flags &= ~QMF_PULSEIFFOCUS;
}
if (s_playermodel.numpages > 1)
{
if (s_playermodel.modelpage > 0)
{
s_playermodel.left.generic.flags &= ~QMF_INACTIVE;
s_playermodel.left.generic.flags &= ~QMF_GRAYED;
}
else
{
s_playermodel.left.generic.flags |= QMF_INACTIVE | QMF_GRAYED;
}
if (s_playermodel.modelpage < s_playermodel.numpages-1)
{
s_playermodel.right.generic.flags &= ~QMF_INACTIVE;
s_playermodel.right.generic.flags &= ~QMF_GRAYED;
}
else
{
s_playermodel.right.generic.flags |= QMF_INACTIVE | QMF_GRAYED;
}
}
else
{
// hide left/right markers
s_playermodel.left.generic.flags |= QMF_INACTIVE | QMF_GRAYED;
s_playermodel.right.generic.flags |= QMF_INACTIVE | QMF_GRAYED;
}
}*/
/*
=================
PlayerModel_SpinPlayer
@ -383,11 +324,13 @@ PlayerModel_SpinPlayer
*/
static void PlayerModel_SpinPlayer( void* ptr, int32_t event)
{
UI_LogFuncBegin();
if ( event == QM_ACTIVATED )
{
uis.spinView = qtrue;
uis.cursorpx = uis.cursorx;
}
UI_LogFuncEnd();
}
/*
@ -397,6 +340,7 @@ PlayerModel_UpdateModel
*/
static void PlayerModel_UpdateModel( void )
{
UI_LogFuncBegin();
vec3_t viewangles;
vec3_t moveangles;
@ -415,7 +359,7 @@ static void PlayerModel_UpdateModel( void )
UI_PlayerInfo_SetModel( &s_playermodel.playerinfo, s_playermodel.modelData );
UI_PlayerInfo_SetInfo( &s_playermodel.playerinfo, BOTH_STAND4, BOTH_STAND4, viewangles, moveangles, WP_COMPRESSION_RIFLE, qfalse );
UI_LogFuncEnd();
}
/*
@ -435,28 +379,14 @@ PlayerModel_MenuEvent
*/
static void PlayerModel_MenuEvent( void* ptr, int32_t event )
{
if (event != QM_ACTIVATED)
UI_LogFuncBegin();
if (event != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
switch (((menucommon_s*)ptr)->id)
{
/*case ID_PREVPAGE:
if (s_playermodel.modelpage > 0)
{
s_playermodel.modelpage--;
PlayerModel_UpdateGrid();
}
break;
case ID_NEXTPAGE:
if (s_playermodel.modelpage < s_playermodel.numpages-1)
{
s_playermodel.modelpage++;
PlayerModel_UpdateGrid();
}
break;*/
case ID_BACK:
PlayerModel_SaveChanges();
UI_PopMenu();
@ -504,12 +434,8 @@ static void PlayerModel_MenuEvent( void* ptr, int32_t event )
s_playermodel.playerIcon = trap_R_RegisterShaderNoMip( va( "models/players_rpgx/%s/model_icon.jpg", s_playermodel.charNames[s_playermodel.selectedChar] ) );
break;
//case ID_SKINFILTER:
//PlayerModel_BuildList();
//PlayerModel_UpdateGrid();
break;
}
UI_LogFuncEnd();
}
/*
@ -519,152 +445,18 @@ PlayerModel_MenuKey
*/
static sfxHandle_t PlayerModel_MenuKey( int32_t key )
{
//menucommon_s* m;
//int32_t picnum;
UI_LogFuncBegin();
switch (key)
{
/*case K_KP_LEFTARROW:
case K_LEFTARROW:
m = Menu_ItemAtCursor(&s_playermodel.menu);
picnum = m->id - ID_PLAYERPIC0;
if (picnum >= 0 && picnum <= 15)
{
if (picnum > 0)
{
Menu_SetCursor(&s_playermodel.menu,s_playermodel.menu.cursor-1);
return (menu_move_sound);
}
else if (s_playermodel.modelpage > 0)
{
s_playermodel.modelpage--;
Menu_SetCursor(&s_playermodel.menu,s_playermodel.menu.cursor+15);
PlayerModel_UpdateGrid();
return (menu_move_sound);
}
else
return (menu_buzz_sound);
}
break;
case K_KP_RIGHTARROW:
case K_RIGHTARROW:
m = Menu_ItemAtCursor(&s_playermodel.menu);
picnum = m->id - ID_PLAYERPIC0;
if (picnum >= 0 && picnum <= 15)
{
if ((picnum < 15) && (s_playermodel.modelpage*MAX_MODELSPERPAGE + picnum+1 < s_playermodel.nummodels))
{
Menu_SetCursor(&s_playermodel.menu,s_playermodel.menu.cursor+1);
return (menu_move_sound);
}
else if ((picnum == 15) && (s_playermodel.modelpage < s_playermodel.numpages-1))
{
s_playermodel.modelpage++;
Menu_SetCursor(&s_playermodel.menu,s_playermodel.menu.cursor-15);
PlayerModel_UpdateGrid();
return (menu_move_sound);
}
else
return (menu_buzz_sound);
}
break;*/
{
case K_MOUSE2:
case K_ESCAPE:
PlayerModel_SaveChanges();
break;
}
UI_LogFuncEnd();
return ( Menu_DefaultKey( &s_playermodel.menu, key ) );
}
/*
=================
PlayerModel_PicEvent
=================
*/
/*static void PlayerModel_PicEvent( void* ptr, int32_t event )
{
int32_t modelnum;
int32_t maxlen;
char* buffptr;
char* pdest;
int32_t i;
if (event != QM_ACTIVATED)
return;
for (i=0; i<PLAYERGRID_ROWS*PLAYERGRID_COLS; i++)
{
// reset
s_playermodel.pics[i].generic.flags &= ~QMF_HIGHLIGHT;
s_playermodel.picbuttons[i].generic.flags |= QMF_PULSEIFFOCUS;
}
// set selected
i = ((menucommon_s*)ptr)->id - ID_PLAYERPIC0;
s_playermodel.pics[i].generic.flags |= QMF_HIGHLIGHT;
s_playermodel.picbuttons[i].generic.flags &= ~QMF_PULSEIFFOCUS;
// get model and strip icon_
modelnum = s_playermodel.modelpage*MAX_MODELSPERPAGE + i;
buffptr = s_playermodel.modelnames[modelnum] + strlen("models/players2/");
pdest = strstr(buffptr,"icon_");
if (pdest)
{
// track the whole model/skin name
Q_strncpyz(s_playermodel.modelData,buffptr,pdest-buffptr+1);
strcat(s_playermodel.modelData,pdest + 5);
// seperate the model name
maxlen = pdest-buffptr;
if (maxlen > 16)
maxlen = 16;
Q_strncpyz( s_playermodel.modelname.string, buffptr, maxlen );
Q_strupr( s_playermodel.modelname.string );
// seperate the skin name
maxlen = strlen(pdest+5)+1;
if (maxlen > 16)
maxlen = 16;
Q_strncpyz( s_playermodel.skinname.string, pdest+5, maxlen );
Q_strupr( s_playermodel.skinname.string );
s_playermodel.selectedmodel = modelnum;
// kef -- make sure something like "chell/nelson" doesn't occur
if (Q_stricmp( s_playermodel.skinname.string, "red") &&
Q_stricmp( s_playermodel.skinname.string, "blue") &&
Q_stricmp( s_playermodel.skinname.string, "black") &&
Q_stricmp( s_playermodel.skinname.string, "default"))
{
// assume something like "chell/nelson" has occurred
Q_strncpyz( s_playermodel.modelname.string, s_playermodel.skinname.string, strlen(s_playermodel.skinname.string)+1 );
Q_strncpyz( s_playermodel.skinname.string, "DEFAULT", 8 );
}
// Kind of a hack to display the externalized text
if (!Q_stricmp( s_playermodel.skinname.string, "red"))
{
Q_strncpyz( s_playermodel.skinnameviewed.string, menu_normal_text[MNT_RED], strlen(menu_normal_text[MNT_RED])+1 );
}
else if (!Q_stricmp( s_playermodel.skinname.string, "blue"))
{
Q_strncpyz( s_playermodel.skinnameviewed.string, menu_normal_text[MNT_BLUE], strlen(menu_normal_text[MNT_BLUE])+1 );
}
else if (!Q_stricmp( s_playermodel.skinname.string, "default"))
{
Q_strncpyz( s_playermodel.skinnameviewed.string, menu_normal_text[MNT_DEFAULT], strlen(menu_normal_text[MNT_DEFAULT])+1 );
}
if( trap_MemoryRemaining() > LOW_MEMORY ) {
PlayerModel_UpdateModel();
}
}
}*/
/*
=================
PlayerModel_DrawPlayer
@ -672,6 +464,7 @@ PlayerModel_DrawPlayer
*/
static void PlayerModel_DrawPlayer( void *self )
{
UI_LogFuncBegin();
menubitmap_s* b;
vec3_t origin = {-15, 0, 0 }; //-3.8
@ -679,46 +472,14 @@ static void PlayerModel_DrawPlayer( void *self )
if( trap_MemoryRemaining() <= LOW_MEMORY ) {
UI_DrawProportionalString( b->generic.x, b->generic.y + b->height / 2, "LOW MEMORY", UI_LEFT, color_red );
UI_LogFuncEnd();
return;
}
UI_DrawPlayer( b->generic.x, b->generic.y, b->width, b->height, origin, &s_playermodel.playerinfo, uis.realtime/2 );
UI_LogFuncEnd();
}
/*void precacheSpecificGroups(char *race_list)
{
char current_race_name[125];
char *s = race_list;
char *max_place = race_list + strlen(race_list);
char *marker;
memset(current_race_name, 0, sizeof(current_race_name));
// look through the list till it's empty
while (s < max_place)
{
marker = s;
// figure out from where we are where the next ',' or 0 is
while (*s != ',' && *s != 0)
{
s++;
}
// copy just that name
Q_strncpyz(current_race_name, marker, s-marker+1);
// avoid the comma or increment us past the end of the string so we fail the main while loop
s++;
// register the group wins announce sound
trap_S_RegisterSound( va( "sound/voice/computer/misc/%s_wins.wav",current_race_name ) );
// register the blue and red flag images
trap_R_RegisterShaderNoMip( va( "models/flags/%s_red", current_race_name));
trap_R_RegisterShaderNoMip( va( "models/flags/%s_blue", current_race_name));
}
}*/
extern char* BG_RegisterRace( const char *name );
@ -735,6 +496,7 @@ We'll work the rest out later
*/
static void PlayerModel_BuildList( void )
{
UI_LogFuncBegin();
int32_t numdirs;
int32_t numfiles;
char dirlist[8192];
@ -786,86 +548,8 @@ static void PlayerModel_BuildList( void )
Q_strncpyz( s_playermodel.charNames[s_playermodel.numChars], dirptr, sizeof( s_playermodel.charNames[s_playermodel.numChars] ) );
s_playermodel.numChars++;
}
//fileptr = filelist;
//for (j=0; j<numfiles && s_playermodel.nummodels < MAX_PLAYERMODELS;j++,fileptr+=filelen+1)
//{
// filelen = strlen(fileptr);
// COM_StripExtension(fileptr,skinname);
// // look for icon_????
// if (!Q_stricmpn(skinname,"icon_",5))
// { //inside here skinname is always "icon_*"
// if (!precache) {
// if (s_playermodel.skinfilter.curvalue == 0)
// {
// // no nelson/kenn team skins
// if (Q_stricmp(skinname+5 ,"default"))
// {
// continue;
// }
// // No red team skins
// if (!Q_stricmp(skinname+5 ,"red"))
// {
// continue;
// }
// // No blue team skins
// if (!Q_stricmp(skinname+5 ,"blue"))
// {
// continue;
// }
// }
//
// if (s_playermodel.skinfilter.curvalue == 1)
// {
// // Only blue team skins
// if (Q_stricmp(skinname+5 ,"blue"))
// {
// continue;
// }
// }
//
// if (s_playermodel.skinfilter.curvalue == 2)
// {
// // Only blue team skins
// if (Q_stricmp(skinname+5 ,"red"))
// {
// continue;
// }
// }
// }
// //Com_sprintf( s_playermodel.modelnames[s_playermodel.nummodels++],
// //sizeof( s_playermodel.modelnames[s_playermodel.nummodels] ),
// //"models/players2/%s/%s", dirptr, skinname );
//
// /*if( precache ) { //per skin type inside a dir
// if( Q_stricmp( skinname+5, "default" ) == 0 ) { //+5 to skip past "icon_"
// continue;
// }
// if( Q_stricmp( skinname+5, "red" ) == 0 ) {
// continue;
// }
// if( Q_stricmp( skinname+5, "blue" ) == 0 ) {
// continue;
// }
// trap_S_RegisterSound( va( "sound/voice/computer/misc/%s_wins.wav",skinname+5 ) );
// }*/
// }
//}
/*if( precache ) { //per modelname (dir)
trap_S_RegisterSound( va( "sound/voice/computer/misc/%s_wins.wav",dirptr ) );
trap_S_RegisterSound( va( "sound/voice/computer/misc/%s.wav", dirptr ) );
precacheSpecificGroups( BG_RegisterRace(va("models/players2/%s/groups.cfg", dirptr)));
}*/
}
/*s_playermodel.numpages = s_playermodel.nummodels/MAX_MODELSPERPAGE;
if (s_playermodel.nummodels % MAX_MODELSPERPAGE)
s_playermodel.numpages++;*/
}
UI_LogFuncEnd();
}
/*
@ -875,6 +559,7 @@ PlayerModel_SetMenuItems
*/
static void PlayerModel_SetMenuItems( void )
{
UI_LogFuncBegin();
int32_t i;
//int32_t maxlen;
//char modelskin[64];
@ -905,57 +590,14 @@ static void PlayerModel_SetMenuItems( void )
s_playermodel.selectedChar = i;
break;
}
// strip icon_
/*buffptr = s_playermodel.charnames[i] + strlen("models/players2/");
pdest = strstr(buffptr,"icon_");
if (pdest)
{
Q_strncpyz(modelskin,buffptr,pdest-buffptr+1);
strcat(modelskin,pdest + 5);
}
else
continue;
if (!Q_stricmp( s_playermodel.modelData, modelskin ))
{
// found pic, set selection here
s_playermodel.selectedmodel = i;
s_playermodel.modelpage = i/MAX_MODELSPERPAGE;
// seperate the model name
maxlen = pdest-buffptr;
if (maxlen > 16)
maxlen = 16;
Q_strncpyz( s_playermodel.modelname.string, buffptr, maxlen );
Q_strupr( s_playermodel.modelname.string );
// seperate the skin name
maxlen = strlen(pdest+5)+1;
if (maxlen > 16)
maxlen = 16;
Q_strncpyz( s_playermodel.skinname.string, pdest+5, maxlen );
Q_strupr( s_playermodel.skinname.string );
// kef -- make sure something like "chell/nelson" doesn't occur
if (Q_stricmp( s_playermodel.skinname.string, "red") &&
Q_stricmp( s_playermodel.skinname.string, "blue") &&
Q_stricmp( s_playermodel.skinname.string, "default"))
{
// assume something like "chell/nelson" has occurred
Q_strncpyz( s_playermodel.modelname.string, s_playermodel.skinname.string, strlen(s_playermodel.skinname.string)+1 );
Q_strncpyz( s_playermodel.skinname.string, "DEFAULT", 8 );
}
break;
}*/
}
//try to register the current shader icon
s_playermodel.playerIcon = trap_R_RegisterShaderNoMip( va( "models/players_rpgx/%s/model_icon", s_playermodel.modelName ) );
//Huh... guess whatever the hell's in the console, we don't have it on our list
if ( s_playermodel.selectedChar == -1 ) {
if ( s_playermodel.selectedChar == -1 ) {
UI_LogFuncEnd();
return;
}
@ -965,16 +607,7 @@ static void PlayerModel_SetMenuItems( void )
PlayerModel_OffsetCharList( &s_playermodel.scrollOffset );
}
//Set the model and skin data
/*{
char* buf[24];
s_playermodel.charModel.numitems = PlayerModel_LoadAvailableModels( buf );
s_playermodel.charModel.itemnames = buf;
s_playermodel.charSkin.numitems = PlayerModel_LoadAvailableSkins( buf );
s_playermodel.charSkin.itemnames = buf;
}*/
UI_LogFuncEnd();
}
/*
@ -984,6 +617,7 @@ PlayerSettingsMenu_Graphics
*/
void PlayerModelMenu_Graphics (void)
{
UI_LogFuncBegin();
// Draw the basic screen layout
UI_MenuFrame2(&s_playermodel.menu);
@ -992,14 +626,6 @@ void PlayerModelMenu_Graphics (void)
// Frame around model pictures
trap_R_SetColor( colorTable[CT_LTORANGE]);
//UI_DrawHandlePic( 114, 50, 8, -32, s_playermodel.corner_ll_4_18); // UL Corner
//UI_DrawHandlePic( 114, 355, 8, 32, s_playermodel.corner_ll_4_18); // LL Corner
//UI_DrawHandlePic( 411, 50, 8, -32, s_playermodel.corner_lr_4_18); // UR Corner
//UI_DrawHandlePic( 411, 355, 8, 32, s_playermodel.corner_lr_4_18); // LR Corner
//UI_DrawHandlePic( 114, 81, 4, 284, uis.whiteShader); // Left side
//UI_DrawHandlePic( 414, 81, 4, 284, uis.whiteShader); // Right side
//UI_DrawHandlePic( 120, 62, 293, 18, uis.whiteShader); // Top
//UI_DrawHandlePic( 120, 357, 293, 18, uis.whiteShader); // Bottom
//TiM - Frame around the models selection list
UI_DrawHandlePic( 96, 50, 8, -32, s_playermodel.corner_ll_4_18); // UL Corner
@ -1081,7 +707,7 @@ void PlayerModelMenu_Graphics (void)
UI_DrawProportionalString( 74, 206, "600",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 74, 395, "3-44",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_LogFuncEnd();
}
/*
@ -1091,9 +717,11 @@ PlayerSettings_MenuDraw
*/
static void PlayerModel_MenuDraw (void)
{
UI_LogFuncBegin();
PlayerModelMenu_Graphics();
Menu_Draw( &s_playermodel.menu );
UI_LogFuncEnd();
}
/*
=================
@ -1102,6 +730,7 @@ PlayerModel_MenuInit
*/
static void PlayerModel_MenuInit(int32_t menuFrom)
{
UI_LogFuncBegin();
int32_t i;
//int32_t j;
//int32_t k;
@ -1241,40 +870,6 @@ static void PlayerModel_MenuInit(int32_t menuFrom)
y += 24;
}
/*for (i=0,k=0; i<PLAYERGRID_ROWS; i++)
{
x = 129;
for (j=0; j<PLAYERGRID_COLS; j++,k++)
{
s_playermodel.pics[k].generic.type = MTYPE_BITMAP;
s_playermodel.pics[k].generic.flags = QMF_LEFT_JUSTIFY|QMF_INACTIVE;
s_playermodel.pics[k].generic.x = x;
s_playermodel.pics[k].generic.y = y;
s_playermodel.pics[k].width = 66;
s_playermodel.pics[k].height = 66;
s_playermodel.pics[k].focuspic = MODEL_SELECTED;
s_playermodel.pics[k].focuscolor = colorTable[CT_WHITE];
s_playermodel.picbuttons[k].generic.type = MTYPE_BITMAP;
s_playermodel.picbuttons[k].generic.flags = QMF_LEFT_JUSTIFY|QMF_NODEFAULTINIT|QMF_PULSEIFFOCUS;
s_playermodel.picbuttons[k].generic.id = ID_PLAYERPIC0+k;
s_playermodel.picbuttons[k].generic.callback = PlayerModel_PicEvent;
s_playermodel.picbuttons[k].generic.x = x - 16;
s_playermodel.picbuttons[k].generic.y = y - 16;
s_playermodel.picbuttons[k].generic.left = x;
s_playermodel.picbuttons[k].generic.top = y;
s_playermodel.picbuttons[k].generic.right = x + 64;
s_playermodel.picbuttons[k].generic.bottom = y + 64;
s_playermodel.picbuttons[k].width = 128;
s_playermodel.picbuttons[k].height = 128;
s_playermodel.picbuttons[k].focuspic = MODEL_SELECT;
s_playermodel.picbuttons[k].focuscolor = colorTable[CT_WHITE];
x += 64+6;
}
y += 64+8;
}*/
s_playermodel.playername.generic.type = MTYPE_PTEXT;
s_playermodel.playername.generic.flags = QMF_INACTIVE;
s_playermodel.playername.generic.x = 444;
@ -1299,14 +894,6 @@ static void PlayerModel_MenuInit(int32_t menuFrom)
s_playermodel.skinname.style = UI_RIGHT;
s_playermodel.skinname.color = colorTable[CT_LTBLUE1];
/*s_playermodel.skinnameviewed.generic.type = MTYPE_PTEXT;
s_playermodel.skinnameviewed.generic.flags = QMF_INACTIVE;
s_playermodel.skinnameviewed.generic.x = 323;
s_playermodel.skinnameviewed.generic.y = 338;
s_playermodel.skinnameviewed.string = skinnameviewed;
s_playermodel.skinnameviewed.style = UI_RIGHT;
s_playermodel.skinnameviewed.color = colorTable[CT_LTBLUE1];*/
s_playermodel.player.generic.type = MTYPE_BITMAP;
s_playermodel.player.generic.flags = QMF_SILENT;
s_playermodel.player.generic.ownerdraw = PlayerModel_DrawPlayer;
@ -1407,33 +994,11 @@ static void PlayerModel_MenuInit(int32_t menuFrom)
s_playermodel.apply.textcolor = CT_BLACK;
s_playermodel.apply.textcolor2 = CT_WHITE;
/*s_playermodel.skinfilter.generic.type = MTYPE_SPINCONTROL;
s_playermodel.skinfilter.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_playermodel.skinfilter.generic.x = 190;
s_playermodel.skinfilter.generic.y = 311;
s_playermodel.skinfilter.generic.id = ID_SKINFILTER;
s_playermodel.skinfilter.generic.callback = PlayerModel_MenuEvent;
s_playermodel.skinfilter.textEnum = MBT_GROUPFILTER;
s_playermodel.skinfilter.textcolor = CT_BLACK;
s_playermodel.skinfilter.textcolor2 = CT_WHITE;
s_playermodel.skinfilter.color = CT_DKPURPLE1;
s_playermodel.skinfilter.color2 = CT_LTPURPLE1;
s_playermodel.skinfilter.textX = MENU_BUTTON_TEXT_X;
s_playermodel.skinfilter.textY = MENU_BUTTON_TEXT_Y;
s_playermodel.skinfilter.listnames = s_SkinFilter_Names;*/
Menu_AddItem( &s_playermodel.menu, &s_playermodel.model );
Menu_AddItem( &s_playermodel.menu, &s_playermodel.data );
Menu_AddItem( &s_playermodel.menu, &s_playermodel.player );
Menu_AddItem( &s_playermodel.menu, &s_playermodel.playername );
Menu_AddItem( &s_playermodel.menu, &s_playermodel.modelname );
//Menu_AddItem( &s_playermodel.menu, &s_playermodel.skinfilter );
/*for (i=0; i<MAX_MODELSPERPAGE; i++)
{
Menu_AddItem( &s_playermodel.menu, &s_playermodel.pics[i] );
Menu_AddItem( &s_playermodel.menu, &s_playermodel.picbuttons[i] );
}*/
Menu_AddItem( &s_playermodel.menu, &s_playermodel.upArrow );
Menu_AddItem( &s_playermodel.menu, &s_playermodel.dnArrow );
@ -1456,8 +1021,8 @@ static void PlayerModel_MenuInit(int32_t menuFrom)
}
// update user interface
//PlayerModel_UpdateGrid();
PlayerModel_UpdateModel();
UI_LogFuncEnd();
}
/*
@ -1467,7 +1032,7 @@ PlayerModel_Cache
*/
void PlayerModel_Cache( void )
{
//int32_t i;
UI_LogFuncBegin();
s_playermodel.corner_ll_4_4 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_4_4");
s_playermodel.corner_ll_4_18 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_4_18");
@ -1477,18 +1042,7 @@ void PlayerModel_Cache( void )
trap_R_RegisterShaderNoMip(PIC_ARROW_UP);
trap_R_RegisterShaderNoMip(PIC_ARROW_DOWN);
/*for( i = 0; playermodel_artlist[i]; i++ )
{
trap_R_RegisterShaderNoMip( playermodel_artlist[i] );
}*/
//PlayerModel_BuildList();
/*for( i = 0; i < s_playermodel.nummodels; i++ )
{
trap_R_RegisterShaderNoMip( s_playermodel.modelnames[i] );
}*/
UI_LogFuncEnd();
}
/*
@ -1498,11 +1052,13 @@ PlayerModel_Cache
*/
void UI_PlayerModelMenu(int32_t menuFrom)
{
UI_LogFuncBegin();
PlayerModel_MenuInit(menuFrom);
UI_PushMenu( &s_playermodel.menu );
//Menu_SetCursorToItem( &s_playermodel.menu, &s_playermodel.pics[s_playermodel.selectedmodel % MAX_MODELSPERPAGE] );
UI_LogFuncEnd();
}

View file

@ -3,6 +3,7 @@
// ui_players.c
#include "ui_local.h"
#include "ui_logger.h"
#define UI_TIMER_GESTURE 2300
@ -39,6 +40,7 @@ UI_PlayerInfo_SetWeapon
===============
*/
static void UI_PlayerInfo_SetWeapon( playerInfo_t *pi, weapon_t weaponNum ) {
UI_LogFuncBegin();
gitem_t * item;
char path[MAX_QPATH];
@ -124,6 +126,7 @@ tryagain:
MAKERGB( pi->flashDlightColor, 1, 1, 1 );
break;
}
UI_LogFuncEnd();
}
@ -133,11 +136,13 @@ UI_ForceLegsAnim
===============
*/
static void UI_ForceLegsAnim( playerInfo_t *pi, int32_t anim ) {
UI_LogFuncBegin();
pi->legsAnim = ( ( pi->legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
if ( anim == BOTH_JUMP1 ) {
pi->legsAnimationTimer = UI_TIMER_JUMP;
}
UI_LogFuncEnd();
}
@ -147,11 +152,13 @@ UI_SetLegsAnim
===============
*/
static void UI_SetLegsAnim( playerInfo_t *pi, int32_t anim ) {
UI_LogFuncBegin();
if ( pi->pendingLegsAnim ) {
anim = pi->pendingLegsAnim;
pi->pendingLegsAnim = 0;
}
UI_ForceLegsAnim( pi, anim );
UI_LogFuncEnd();
}
@ -161,15 +168,13 @@ UI_ForceTorsoAnim
===============
*/
static void UI_ForceTorsoAnim( playerInfo_t *pi, int32_t anim ) {
UI_LogFuncBegin();
pi->torsoAnim = ( ( pi->torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim;
/*.if ( anim == TORSO_GESTURE ) {
pi->torsoAnimationTimer = UI_TIMER_GESTURE;
}*/
if ( anim == UI_GetAnim( ANIM_ATTACK, pi->currentWeapon, qtrue ) ) { //BOTH_ATTACK1 //Hack ROFL. Code can't see the ANIM defines from here. ANIM_ATTACK = 22
pi->torsoAnimationTimer = UI_TIMER_ATTACK;
}
UI_LogFuncEnd();
}
@ -179,12 +184,14 @@ UI_SetTorsoAnim
===============
*/
static void UI_SetTorsoAnim( playerInfo_t *pi, int32_t anim ) {
UI_LogFuncBegin();
if ( pi->pendingTorsoAnim ) {
anim = pi->pendingTorsoAnim;
pi->pendingTorsoAnim = 0;
}
UI_ForceTorsoAnim( pi, anim );
UI_LogFuncEnd();
}
@ -194,6 +201,7 @@ UI_TorsoSequencing
===============
*/
static void UI_TorsoSequencing( playerInfo_t *pi ) {
UI_LogFuncBegin();
int32_t currentAnim;
currentAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;
@ -206,6 +214,7 @@ static void UI_TorsoSequencing( playerInfo_t *pi ) {
}
if ( pi->torsoAnimationTimer > 0 ) {
UI_LogFuncEnd();
return;
}
@ -227,7 +236,7 @@ static void UI_TorsoSequencing( playerInfo_t *pi ) {
{
UI_SetTorsoAnim( pi, BOTH_STAND4 ); //TORSO_STAND
}
UI_LogFuncEnd();
return;
}
@ -235,11 +244,13 @@ static void UI_TorsoSequencing( playerInfo_t *pi ) {
UI_PlayerInfo_SetWeapon( pi, pi->weapon );
pi->torsoAnimationTimer = UI_TIMER_WEAPON_SWITCH;
UI_ForceTorsoAnim( pi, TORSO_RAISEWEAP1 ); //TORSO_RAISE
UI_LogFuncEnd();
return;
}
if ( currentAnim == TORSO_RAISEWEAP1 ) {
UI_SetTorsoAnim( pi, BOTH_STAND1 ); //STAND2
UI_LogFuncEnd();
return;
}
@ -255,8 +266,10 @@ static void UI_TorsoSequencing( playerInfo_t *pi ) {
UI_SetTorsoAnim( pi, pi->upperLoopEmote );
pi->upperEmoting = qfalse;
}
UI_LogFuncEnd();
return;
}
UI_LogFuncEnd();
}
@ -266,6 +279,7 @@ UI_LegsSequencing
===============
*/
static void UI_LegsSequencing( playerInfo_t *pi ) {
UI_LogFuncBegin();
int32_t currentAnim;
currentAnim = pi->legsAnim & ~ANIM_TOGGLEBIT;
@ -274,6 +288,7 @@ static void UI_LegsSequencing( playerInfo_t *pi ) {
if ( currentAnim == BOTH_JUMP1) {
jumpHeight = JUMP_HEIGHT * sin( M_PI * ( UI_TIMER_JUMP - pi->legsAnimationTimer ) / UI_TIMER_JUMP );
}
UI_LogFuncEnd();
return;
}
@ -281,11 +296,13 @@ static void UI_LegsSequencing( playerInfo_t *pi ) {
UI_ForceLegsAnim( pi, BOTH_LAND1 );
pi->legsAnimationTimer = UI_TIMER_LAND;
jumpHeight = 0;
UI_LogFuncEnd();
return;
}
if ( currentAnim == BOTH_LAND1 ) {
UI_SetLegsAnim( pi, BOTH_STAND1 );
UI_LogFuncEnd();
return;
}
@ -301,8 +318,10 @@ static void UI_LegsSequencing( playerInfo_t *pi ) {
UI_SetLegsAnim( pi, pi->lowerLoopEmote );
pi->lowerEmoting = qfalse;
}
UI_LogFuncEnd();
return;
}
UI_LogFuncEnd();
}
@ -313,6 +332,7 @@ UI_PositionEntityOnTag
*/
static void UI_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
clipHandle_t parentModel, char *tagName ) {
UI_LogFuncBegin();
int32_t i;
orientation_t lerped;
@ -329,6 +349,7 @@ static void UI_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *pare
// cast away const because of compiler problems
MatrixMultiply( lerped.axis, ((refEntity_t*)parent)->axis, entity->axis );
entity->backlerp = parent->backlerp;
UI_LogFuncEnd();
}
@ -339,6 +360,7 @@ UI_PositionRotatedEntityOnTag
*/
static void UI_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
clipHandle_t parentModel, char *tagName ) {
UI_LogFuncBegin();
int32_t i;
orientation_t lerped;
vec3_t tempAxis[3];
@ -356,6 +378,7 @@ static void UI_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_
// cast away const because of compiler problems
MatrixMultiply( entity->axis, ((refEntity_t *)parent)->axis, tempAxis );
MatrixMultiply( lerped.axis, tempAxis, entity->axis );
UI_LogFuncEnd();
}
@ -365,6 +388,7 @@ UI_SetLerpFrameAnimation
===============
*/
static void UI_SetLerpFrameAnimation( playerInfo_t *ci, lerpFrame_t *lf, int32_t newAnimation ) {
UI_LogFuncBegin();
animation_t *anim;
lf->animationNumber = newAnimation;
@ -378,6 +402,7 @@ static void UI_SetLerpFrameAnimation( playerInfo_t *ci, lerpFrame_t *lf, int32_t
lf->animation = anim;
lf->animationTime = lf->frameTime + anim->initialLerp;
UI_LogFuncEnd();
}
@ -387,6 +412,7 @@ UI_RunLerpFrame
===============
*/
static void UI_RunLerpFrame( playerInfo_t *ci, lerpFrame_t *lf, int32_t newAnimation ) {
UI_LogFuncBegin();
animation_t *anim;
// see if the animation sequence is switching
@ -444,6 +470,7 @@ static void UI_RunLerpFrame( playerInfo_t *ci, lerpFrame_t *lf, int32_t newAnima
} else {
lf->backlerp = 1.0 - (float)( dp_realtime - lf->oldFrameTime ) / ( lf->frameTime - lf->oldFrameTime );
}
UI_LogFuncEnd();
}
@ -454,7 +481,7 @@ UI_PlayerAnimation
*/
static void UI_PlayerAnimation( playerInfo_t *pi, int32_t *legsOld, int32_t *legs, float *legsBackLerp,
int32_t *torsoOld, int32_t *torso, float *torsoBackLerp ) {
UI_LogFuncBegin();
// legs animation
pi->legsAnimationTimer -= uis.frametime;
if ( pi->legsAnimationTimer < 0 ) {
@ -487,6 +514,7 @@ static void UI_PlayerAnimation( playerInfo_t *pi, int32_t *legsOld, int32_t *leg
*torsoOld = pi->torso.oldFrame;
*torso = pi->torso.frame;
*torsoBackLerp = pi->torso.backlerp;
UI_LogFuncEnd();
}
@ -497,6 +525,7 @@ UI_SwingAngles
*/
static void UI_SwingAngles( float destination, float swingTolerance, float clampTolerance,
float speed, float *angle, qboolean *swinging ) {
UI_LogFuncBegin();
float swing;
float move;
float scale;
@ -510,6 +539,7 @@ static void UI_SwingAngles( float destination, float swingTolerance, float clamp
}
if ( !*swinging ) {
UI_LogFuncEnd();
return;
}
@ -549,59 +579,16 @@ static void UI_SwingAngles( float destination, float swingTolerance, float clamp
} else if ( swing < -clampTolerance ) {
*angle = AngleMod( destination + (clampTolerance - 1) );
}
UI_LogFuncEnd();
}
/*
======================
UI_MovedirAdjustment
======================
*/
/*static float UI_MovedirAdjustment( playerInfo_t *pi ) {
vec3_t relativeAngles;
vec3_t moveVector;
VectorSubtract( pi->viewAngles, pi->moveAngles, relativeAngles );
AngleVectors( relativeAngles, moveVector, NULL, NULL );
if ( Q_fabs( moveVector[0] ) < 0.01 ) {
moveVector[0] = 0.0;
}
if ( Q_fabs( moveVector[1] ) < 0.01 ) {
moveVector[1] = 0.0;
}
if ( moveVector[1] == 0 && moveVector[0] > 0 ) {
return 0;
}
if ( moveVector[1] < 0 && moveVector[0] > 0 ) {
return 22;
}
if ( moveVector[1] < 0 && moveVector[0] == 0 ) {
return 45;
}
if ( moveVector[1] < 0 && moveVector[0] < 0 ) {
return -22;
}
if ( moveVector[1] == 0 && moveVector[0] < 0 ) {
return 0;
}
if ( moveVector[1] > 0 && moveVector[0] < 0 ) {
return 22;
}
if ( moveVector[1] > 0 && moveVector[0] == 0 ) {
return -45;
}
return -22;
}*/
/*
===============
UI_PlayerAngles
===============
*/
static void UI_PlayerAngles( playerInfo_t *pi, vec3_t legs[3], vec3_t torso[3], vec3_t head[3] ) {
UI_LogFuncBegin();
vec3_t legsAngles, torsoAngles, headAngles;
float dest;
@ -655,6 +642,7 @@ static void UI_PlayerAngles( playerInfo_t *pi, vec3_t legs[3], vec3_t torso[3],
AnglesToAxis( legsAngles, legs );
AnglesToAxis( torsoAngles, torso );
AnglesToAxis( headAngles, head );
UI_LogFuncEnd();
}
@ -664,6 +652,7 @@ UI_PlayerFloatSprite
===============
*/
static void UI_PlayerFloatSprite( playerInfo_t *pi, vec3_t origin, qhandle_t shader ) {
UI_LogFuncBegin();
refEntity_t ent;
memset( &ent, 0, sizeof( ent ) );
@ -674,52 +663,17 @@ static void UI_PlayerFloatSprite( playerInfo_t *pi, vec3_t origin, qhandle_t sha
ent.data.sprite.radius = 10;
ent.renderfx = 0;
trap_R_AddRefEntityToScene( &ent );
UI_LogFuncEnd();
}
/*
======================
UI_MachinegunSpinAngle
======================
*/
/*float UI_MachinegunSpinAngle( playerInfo_t *pi ) {
int32_t delta;
float angle;
float speed;
int32_t torsoAnim;
delta = dp_realtime - pi->barrelTime;
if ( pi->barrelSpinning ) {
angle = pi->barrelAngle + delta * SPIN_SPEED;
} else {
if ( delta > COAST_TIME ) {
delta = COAST_TIME;
}
speed = 0.5 * ( SPIN_SPEED + (float)( COAST_TIME - delta ) / COAST_TIME );
angle = pi->barrelAngle + delta * speed;
}
torsoAnim = pi->torsoAnim & ~ANIM_TOGGLEBIT;
if( torsoAnim == TORSO_ATTACK2 ) {
torsoAnim = TORSO_ATTACK;
}
if ( pi->barrelSpinning == !(torsoAnim == TORSO_ATTACK) ) {
pi->barrelTime = dp_realtime;
pi->barrelAngle = AngleMod( angle );
pi->barrelSpinning = !!(torsoAnim == TORSO_ATTACK);
}
return angle;
}*/
/*
===============
UI_DrawPlayer
===============
*/
void UI_DrawPlayer( float x, float y, float w, float h, vec3_t pOrigin, playerInfo_t *pi, int32_t time ) { //RPG-X : TiM- Origin added
UI_LogFuncBegin();
refdef_t refdef;
refEntity_t legs;
refEntity_t torso;
@ -734,6 +688,7 @@ void UI_DrawPlayer( float x, float y, float w, float h, vec3_t pOrigin, playerIn
float xx;
if ( !pi->legsModel || !pi->torsoModel || !pi->headModel || !pi->animations[0].numFrames ) {
UI_LogFuncEnd();
return;
}
@ -859,6 +814,7 @@ void UI_DrawPlayer( float x, float y, float w, float h, vec3_t pOrigin, playerIn
trap_R_AddRefEntityToScene( &legs );
if (!legs.hModel) {
UI_LogFuncEnd();
return;
}
@ -867,6 +823,7 @@ void UI_DrawPlayer( float x, float y, float w, float h, vec3_t pOrigin, playerIn
//
torso.hModel = pi->torsoModel;
if (!torso.hModel) {
UI_LogFuncEnd();
return;
}
@ -885,6 +842,7 @@ void UI_DrawPlayer( float x, float y, float w, float h, vec3_t pOrigin, playerIn
//
head.hModel = pi->headModel;
if (!head.hModel) {
UI_LogFuncEnd();
return;
}
head.customSkin = pi->headSkin;
@ -952,44 +910,16 @@ void UI_DrawPlayer( float x, float y, float w, float h, vec3_t pOrigin, playerIn
trap_R_AddLightToScene( origin, 100, 1.0, 0.0, 0.0 );
trap_R_RenderScene( &refdef );
UI_LogFuncEnd();
}
/*
==========================
UI_RegisterClientSkin
==========================
*/
/*extern char* BG_RegisterRace( const char *name );
static qboolean UI_RegisterClientSkin( playerInfo_t *pi, const char *modelName, const char *skinName ) {
char filename[MAX_QPATH];
Com_sprintf( filename, sizeof( filename ), "models/players2/%s/lower_%s.skin", modelName, skinName );
pi->legsSkin = trap_R_RegisterSkin( filename );
Com_sprintf( filename, sizeof( filename ), "models/players2/%s/upper_%s.skin", modelName, skinName );
pi->torsoSkin = trap_R_RegisterSkin( filename );
Com_sprintf( filename, sizeof( filename ), "models/players2/%s/head_%s.skin", modelName, skinName );
pi->headSkin = trap_R_RegisterSkin( filename );
Com_sprintf( filename, sizeof( filename ), "models/players2/%s/groups.cfg", modelName);
strcpy(pi->race, BG_RegisterRace( filename ));
if ( !pi->legsSkin || !pi->torsoSkin || !pi->headSkin ) {
return qfalse;
}
return qtrue;
}*/
/*
======================
UI_ParseAnimationFile
======================
*/
static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animations ) {
UI_LogFuncBegin();
char *text_p, *prev;
int32_t len;
int32_t i;
@ -1004,10 +934,12 @@ static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animat
// load the file
len = trap_FS_FOpenFile( filename, &f, FS_READ );
if ( len <= 0 ) {
UI_LogFuncEnd();
return qfalse;
}
if ( len >= ( sizeof( text ) - 1 ) ) {
Com_Printf( "File %s too long\n", filename );
UI_LogFuncEnd();
return qfalse;
}
trap_FS_Read( text, len, f );
@ -1104,9 +1036,10 @@ static qboolean UI_ParseAnimationFile( const char *filename, animation_t *animat
if ( i != MAX_ANIMATIONS ) {
Com_Printf( "Error parsing animation file: %s", filename );
UI_LogFuncEnd();
return qfalse;
}
UI_LogFuncEnd();
return qtrue;
}
@ -1128,6 +1061,7 @@ specified.
*/
static void UI_InitModelData( playerInfo_t *pi ) {
UI_LogFuncBegin();
pi->hasRanks = qfalse;
//initialize all model + skin data as 0, so it can be told if they don't get
@ -1154,6 +1088,7 @@ static void UI_InitModelData( playerInfo_t *pi ) {
pi->headSkinTalk[3] = 0;
memset( &pi->boltonTags, 0, sizeof(pi->boltonTags));
UI_LogFuncEnd();
}
/*
@ -1169,6 +1104,7 @@ for this model.
static qboolean UI_ParseSkinSetDataFile( playerInfo_t *pi, const char *skinSetFrame, const char *charName, const char *skinName )
{
UI_LogFuncBegin();
char* skinStar;
char skinSetName[MAX_QPATH];
char skinSetRoute[MAX_QPATH];
@ -1183,6 +1119,7 @@ static qboolean UI_ParseSkinSetDataFile( playerInfo_t *pi, const char *skinSetFr
if ( ( skinStar = strstr( skinSetFrame, "*" ) ) == NULL )
{
Com_Printf( S_COLOR_RED "ERROR: No '*' specified in model skin set!\n" );
UI_LogFuncEnd();
return qfalse;
}
else
@ -1202,6 +1139,7 @@ static qboolean UI_ParseSkinSetDataFile( playerInfo_t *pi, const char *skinSetFr
else
{
Com_Printf( "ERROR: The '*' in %s must be on either the start or end, not the middle.\n", skinSetFrame );
UI_LogFuncEnd();
return qfalse;
}
}
@ -1215,12 +1153,14 @@ static qboolean UI_ParseSkinSetDataFile( playerInfo_t *pi, const char *skinSetFr
if ( len <= 0 )
{
Com_Printf( S_COLOR_RED "ERROR: Could not open file: %s\n", skinSetRoute );
UI_LogFuncEnd();
return qfalse;
}
if ( len > sizeof( buffer) - 1 )
{
Com_Printf( S_COLOR_RED "ERROR: Imported file is too big for buffer: %s. Len is %i\n", skinSetRoute, len );
UI_LogFuncEnd();
return qfalse;
}
@ -1231,6 +1171,7 @@ static qboolean UI_ParseSkinSetDataFile( playerInfo_t *pi, const char *skinSetFr
if ( !buffer[0] )
{
Com_Printf( S_COLOR_RED "ERROR: Could not import data from %s\n", skinSetRoute );
UI_LogFuncEnd();
return qfalse;
}
@ -1351,7 +1292,7 @@ static qboolean UI_ParseSkinSetDataFile( playerInfo_t *pi, const char *skinSetFr
}
}
}
UI_LogFuncEnd();
return qtrue;
}
@ -1369,6 +1310,7 @@ a character model.
qboolean UI_ParseModelDataFile( playerInfo_t *pi, const char *charName,
const char *modelName, const char *skinName ) {
UI_LogFuncBegin();
fileHandle_t file;
int32_t file_len;
char charText[20000];
@ -1389,11 +1331,13 @@ qboolean UI_ParseModelDataFile( playerInfo_t *pi, const char *charName,
//Error handle
//if length was 0, ie file not found or was empty
if (file_len <= 0 ) {
UI_LogFuncEnd();
return qfalse;
}
//Another error... if text is WAY bigger than our available buffer O_O
if ( file_len >= sizeof( charText ) - 1 ) {
Com_Printf( S_COLOR_RED "Model Data File %s too long... WAY too long\n", fileName );
UI_LogFuncEnd();
return qfalse;
}
@ -1426,11 +1370,13 @@ qboolean UI_ParseModelDataFile( playerInfo_t *pi, const char *charName,
//every parse call. O_O
if ( !token[0] ) {
Com_Printf( S_COLOR_RED "No data found in model data buffer!\n");
UI_LogFuncEnd();
return qfalse;
}
if ( Q_stricmp(token, "{" ) ) {
Com_Printf(S_COLOR_RED "Missing { in %s\n", fileName);
UI_LogFuncEnd();
return qfalse;
}
@ -1485,6 +1431,7 @@ qboolean UI_ParseModelDataFile( playerInfo_t *pi, const char *charName,
pi->legsModel = trap_R_RegisterModel( token );
if (!pi->legsModel) {
Com_Printf( S_COLOR_RED "ERROR: Unable to load legs model: %s\n", token);
UI_LogFuncEnd();
return qfalse;
}
@ -1507,6 +1454,7 @@ qboolean UI_ParseModelDataFile( playerInfo_t *pi, const char *charName,
if (!pi->torsoModel) {
Com_Printf( S_COLOR_RED "ERROR: Unable to load torso model: %s\n", token);
UI_LogFuncEnd();
return qfalse;
}
continue;
@ -1523,6 +1471,7 @@ qboolean UI_ParseModelDataFile( playerInfo_t *pi, const char *charName,
pi->headModel = trap_R_RegisterModel( token );
if (!pi->headModel) {
Com_Printf( S_COLOR_RED "ERROR: Unable to load head model: %s\n", token);
UI_LogFuncEnd();
return qfalse;
}
continue;
@ -1621,11 +1570,13 @@ qboolean UI_ParseModelDataFile( playerInfo_t *pi, const char *charName,
//if any of the models or skins were left blank, then output false. Coz we need them. :P
if (!pi->headModel || !pi->torsoModel || !pi->legsModel ) {
Com_Printf( S_COLOR_RED "One or more necessary model files weren't loaded from %s\n", fileName );
UI_LogFuncEnd();
return qfalse;
}
if (!pi->headSkin || !pi->torsoSkin || !pi->legsSkin ) {
Com_Printf( S_COLOR_RED "One or more necessary skin files weren't loaded from %s\n", fileName );
UI_LogFuncEnd();
return qfalse;
}
@ -1646,6 +1597,7 @@ qboolean UI_ParseModelDataFile( playerInfo_t *pi, const char *charName,
if (i <= 0) {
//we obviously have no animation directory :(
Com_Printf(S_COLOR_RED "ERROR: Was unable to calculate location of animation.cfg for %s\n", fileName);
UI_LogFuncEnd();
return qfalse;
}
@ -1666,18 +1618,21 @@ qboolean UI_ParseModelDataFile( playerInfo_t *pi, const char *charName,
//Parse it
if ( !UI_ParseAnimationFile( legsFileRoute, pi->animations) ) {
Com_Printf( "Tried loading anim data from location %s, however nothing was valid.\n", legsFileRoute );
UI_LogFuncEnd();
return qfalse;
}
}
else {
if ( !legsFileRoute[0] ) {
Com_Printf( S_COLOR_RED "Couldn't load/locate any player animation data for player: %s.\n", charName );
UI_LogFuncEnd();
return qfalse;
}
}
//holy fudgenuggets. after all that checking, we actually made it to the end and have a valid freaking
//model! OWNED!
UI_LogFuncEnd();
return qtrue;
}
@ -1688,6 +1643,7 @@ UI_RegisterClientModelname
==========================
*/
qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName ) {
UI_LogFuncBegin();
char charName[MAX_QPATH];
char modelName[MAX_QPATH];
char skinName[MAX_QPATH];
@ -1700,21 +1656,12 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName
pi->headModel = 0;
if ( !modelSkinName[0] ) {
UI_LogFuncEnd();
return qfalse;
}
Q_strncpyz( charName, modelSkinName, sizeof( charName ) );
/*slash = strchr( modelName, '/' );
if ( !slash ) {
// modelName did not include a skin name
Q_strncpyz( skinName, "default", sizeof( skinName ) );
} else {
Q_strncpyz( skinName, slash + 1, sizeof( skinName ) );
// truncate modelName
*slash = 0;
}*/
//step 1, take the first bit of the string and put it in the charName var.
if ( ( model = strchr( charName, '/') ) == NULL ) { //if there's no slash
Q_strncpyz( charName, modelSkinName, sizeof( charName ) ); //just set it
@ -1784,60 +1731,13 @@ qboolean UI_RegisterClientModelname( playerInfo_t *pi, const char *modelSkinName
if ( !UI_ParseModelDataFile( pi, DEFAULT_CHAR, DEFAULT_MODEL, DEFAULT_SKIN ) )
{
//if all else fails, try and load the normal default model
UI_LogFuncEnd();
return qfalse;
}
}
}
}
/*Com_sprintf( filename, sizeof( filename ), "models/players2/%s/lower.mdr", modelName );
pi->legsModel = trap_R_RegisterModel( filename );
if ( !pi->legsModel )
{
Com_sprintf( filename, sizeof( filename ), "models/players2/%s/lower.md3", modelName );
pi->legsModel = trap_R_RegisterModel( filename );
if ( !pi->legsModel )
{
Com_Printf( S_COLOR_RED"Failed to load model file %s\n", filename );
return qfalse;
}
}
Com_sprintf( filename, sizeof( filename ), "models/players2/%s/upper.mdr", modelName );
pi->torsoModel = trap_R_RegisterModel( filename );
if ( !pi->torsoModel )
{
Com_sprintf( filename, sizeof( filename ), "models/players2/%s/upper.md3", modelName );
pi->torsoModel = trap_R_RegisterModel( filename );
if ( !pi->torsoModel ) {
Com_Printf( S_COLOR_RED"Failed to load model file %s\n", filename );
return qfalse;
}
}
Com_sprintf( filename, sizeof( filename ), "models/players2/%s/head.md3", modelName );
pi->headModel = trap_R_RegisterModel( filename );
if ( !pi->headModel )
{
Com_Printf( S_COLOR_RED"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 ) ) {
if ( !UI_RegisterClientSkin( pi, modelName, "default" ) ) {
Com_Printf( "Failed to load skin file: %s : %s\n", modelName, skinName );
return qfalse;
}
}
// load the animations
Com_sprintf( filename, sizeof( filename ), "models/players2/%s/animation.cfg", modelName );
if ( !UI_ParseAnimationFile( filename, pi->animations ) ) {
Com_Printf( "Failed to load animation file %s\n", filename );
return qfalse;
}*/
UI_LogFuncEnd();
return qtrue;
}
@ -1848,6 +1748,7 @@ UI_PlayerInfo_SetModel
===============
*/
void UI_PlayerInfo_SetModel( playerInfo_t *pi, const char *model ) {
UI_LogFuncBegin();
memset( pi, 0, sizeof(*pi) );
UI_RegisterClientModelname( pi, model );
Q_strncpyz( pi->modelName, model, sizeof( pi->modelName ) );
@ -1859,6 +1760,7 @@ void UI_PlayerInfo_SetModel( playerInfo_t *pi, const char *model ) {
pi->chat = qfalse;
pi->newModel = qtrue;
UI_PlayerInfo_SetWeapon( pi, pi->weapon );
UI_LogFuncEnd();
}
@ -1868,6 +1770,7 @@ UI_PlayerInfo_SetInfo
===============
*/
void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int32_t legsAnim, int32_t torsoAnim, vec3_t viewAngles, vec3_t moveAngles, weapon_t weaponNumber, float height, float weight, qboolean chat ) {
UI_LogFuncBegin();
int32_t currentAnim;
weapon_t weaponNum;
@ -1914,6 +1817,7 @@ void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int32_t legsAnim, int32_t torsoAni
UI_PlayerInfo_SetWeapon( pi, pi->weapon );
}
UI_LogFuncEnd();
return;
}
@ -1941,6 +1845,7 @@ void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int32_t legsAnim, int32_t torsoAni
pi->pendingTorsoAnim = 0;
UI_ForceTorsoAnim( pi, torsoAnim );
UI_LogFuncEnd();
return;
}
@ -1957,50 +1862,11 @@ void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int32_t legsAnim, int32_t torsoAni
// torso animation
//if ( torsoAnim == TORSO_STAND || torsoAnim == TORSO_STAND2) //TiM: TORSO_STAND2
if ( torsoAnim == UI_GetAnim( ANIM_IDLE, pi->currentWeapon, qtrue ) )
{
/*if ( weaponNum == WP_0 || weaponNum == WP_5 )
{
torsoAnim = TORSO_STAND2;
}
else
{
torsoAnim = TORSO_STAND2;
}*/
/*if ( weaponNum == WP_6 || weaponNum == WP_7 )
{
torsoAnim = TORSO_STAND;
}
else
{
torsoAnim = TORSO_STAND2;
}*/
torsoAnim = UI_GetAnim( ANIM_IDLE, pi->currentWeapon, qtrue );
}
torsoAnim = UI_GetAnim( ANIM_IDLE, pi->currentWeapon, qtrue );
//if ( torsoAnim == TORSO_ATTACK || torsoAnim == TORSO_ATTACK2 )
if ( torsoAnim == UI_GetAnim( ANIM_ATTACK, pi->currentWeapon, qtrue ) )
{
/*if ( weaponNum == WP_0 || weaponNum == WP_5 )
{
torsoAnim = TORSO_ATTACK2;
}
else
{
torsoAnim = TORSO_ATTACK;
}*/
/*if ( weaponNum == WP_6 || weaponNum == WP_7 )
{
torsoAnim = TORSO_ATTACK;
}
else
{
torsoAnim = TORSO_ATTACK2;
}*/
torsoAnim = UI_GetAnim( ANIM_ATTACK, pi->currentWeapon, qtrue );
pi->muzzleFlashTime = dp_realtime + UI_TIMER_MUZZLE_FLASH;
@ -2019,4 +1885,5 @@ void UI_PlayerInfo_SetInfo( playerInfo_t *pi, int32_t legsAnim, int32_t torsoAni
pi->pendingTorsoAnim = 0;
UI_ForceTorsoAnim( pi, torsoAnim );
}
UI_LogFuncEnd();
}

View file

@ -1,6 +1,7 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#include "ui_local.h"
#include "ui_logger.h"
#define ID_NAME 9
#define ID_CLASS 10
@ -126,170 +127,6 @@ typedef struct {
static playersettings_t s_playersettings;
//static int32_t gamecodetoui[] = {4,2,3,0,5,1,6};
//static int32_t uitogamecode[] = {4,6,2,3,1,5,7};
/*
static int32_t handicap_items[] =
{
MNT_HANDICAP_NONE,
MNT_HANDICAP_95,
MNT_HANDICAP_90,
MNT_HANDICAP_85,
MNT_HANDICAP_80,
MNT_HANDICAP_75,
MNT_HANDICAP_70,
MNT_HANDICAP_65,
MNT_HANDICAP_60,
MNT_HANDICAP_55,
MNT_HANDICAP_50,
MNT_HANDICAP_45,
MNT_HANDICAP_40,
MNT_HANDICAP_35,
MNT_HANDICAP_30,
MNT_HANDICAP_25,
MNT_HANDICAP_20,
MNT_HANDICAP_15,
MNT_HANDICAP_10,
MNT_HANDICAP_05,
0
}; */
//QVM HACK!
//TiM - You're a QVM hack. :)
//Okay... with the new rank system... here's what I guess we'll do.
//We're going to have to build a list of all the rank files we have,
//go thru each one, and find the rank that they're using right now and what set it's from
//From there... we'll make a button so they can scroll rank files, as well as what ranks there are. :)
/*const char* prank_items_formal3[] =
{
"Crewman",
"Cadet 4th Class",
"Cadet 3rd Class",
"Cadet 2nd Class",
"Cadet 1st Class",
"Ensign",
"Lieutenant J.G",
"Lieutenant",
"Lt. Commander",
"Commander",
"Captain",
"Commodore",
"Rear Admiral",
"Vice Admiral",
"Admiral",
"Fleet Admiral",
0
};
const char* prank_items_actual3[] =
{
"crewman",
"cadet1",
"cadet2",
"cadet3",
"cadet4",
"ensign",
"ltjg",
"lt",
"ltcmdr",
"cmdr",
"capt",
"cmmdr",
"adm2",
"adm3",
"adm4",
"adm5",
0
};*/
/*typedef enum
{
CLASS_NONE = 0,
CLASS_COMMAND,
CLASS_SCIENCE,
CLASS_MEDICAL,
CLASS_ENGINEER,
CLASS_SECURITY,
CLASS_ALIEN,
CLASS_MARINE,
CLASS_ADMIN,
CLASS_OTHER,
MAX_CLASSES
} ingamemenu_class_t;*/
/*const char* playerClassList[] =
{
"None",
"Command",
"Science",
"Medical",
"Engineer",
"Security",
"Alien",
"Marine",
"Admin",
"Other",
0
};*/
/*static float yawDelta3;
static float yaw3 = 180 - 30;
static float placeHolder3 = 180 - 30;*/
/*
=======================
PlayerSettings_LoadProfiles
TiM: Loads user profiles from external cfgs
=======================
*/
/*static void PlayerSettings_LoadProfiles( void ) {
int32_t numDirs;
char dirList[4096];
char* dirptr;
int32_t dirlen;
int32_t i;
//get list
numDirs = trap_FS_GetFileList( "profiles", ".cfg", dirList, sizeof( dirList ) );
dirptr = dirList;
for (i = 0; i < numDirs; i++, dirptr+= dirlen+1) {
dirlen = strlen( dirptr );
if ( !Q_stricmp( dirptr + dirlen - 4, ".cfg" ) ) {
dirptr[dirlen-4]='\0';
}
Q_strncpyz( s_playersettings.profileList[s_playersettings.numProfiles], dirptr, sizeof( s_playersettings.profileList[s_playersettings.numProfiles] ) );
s_playersettings.numProfiles++;
}
//link from the char array to the ptr array so we can add this to the spin control
for ( i=0; i<s_playersettings.numProfiles; i++ ) {
s_playersettings.profileListPtr[i] = s_playersettings.profileList[i];
}
}
static void PlayerSettings_ExecuteProfileConfig( void ) {
char fileRoute[MAX_QPATH];
if ( !s_playersettings.profileList[s_playersettings.profiles.curvalue][0] ) {
return;
}
Com_sprintf( fileRoute, MAX_QPATH, "%s/%s.cfg", PROFILE_PATH, s_playersettings.profileList[s_playersettings.profiles.curvalue] );
trap_Cmd_ExecuteText( EXEC_APPEND, va( "execute %s", fileRoute ) );
//refresh the mainlist
PlayerSettings_SetMenuItems();
}*/
/*
=======================
PlayerSettings_SettingsAreDifferent
@ -302,6 +139,7 @@ button appear.
*/
static qboolean PlayerSettings_SettingsAreDifferent ( void ) {
UI_LogFuncBegin();
qboolean endResult=qfalse;
//Name
@ -357,72 +195,10 @@ static qboolean PlayerSettings_SettingsAreDifferent ( void ) {
//Com_Printf( S_COLOR_RED "Rank text changed!\n");
endResult = qtrue;
}
UI_LogFuncEnd();
return endResult;
}
/*
=================
PlayerSettings_AffectModel
=================
*/
/*static void PlayerSettings_AffectModel( void )
{
char buf[MAX_QPATH];
char tempBuf[MAX_QPATH];
int32_t i;
char* slash;
trap_Cvar_VariableStringBuffer( "model", buf, sizeof( buf ) );
slash = strchr( UI_Cvar_VariableString("model"), '/' ); //check if we gotz a slash in the string
if (slash)
{ //gotta get rid of everything after the slash :S
for( i =0; i<= MAX_QPATH; i++ )
{
if ( buf[i] != '/' )
{
tempBuf[i] = buf[i];
}
else
{
tempBuf[i] = 0;
break;
}
}
Q_strncpyz(buf, tempBuf, sizeof(buf) );
//Com_Printf( "buf = %s", buf );
}
slash = strchr( buf, '/' ); //check if we gotz a slash in the string
if ( !slash ) {
switch ( s_playersettings.pClass.curvalue ) { //Change model skin depending on what class
case 0: //no class
case 6: //alien
case 4: //engineer
case 5: //security
Q_strcat( buf, MAX_QPATH, "/default" );
// Com_Printf( "buf = %s \n", buf );
break;
case 1: //command
Q_strcat( buf, MAX_QPATH, "/red" );
break;
case 2: //science
case 3: //medical
Q_strcat( buf, MAX_QPATH, "/blue" );
break;
}
//Com_Printf( "buf = %s \n", buf );
trap_Cvar_Set( "model", buf );
}
}*/
/*
=================
PlayerSettings_DrawPlayer
@ -432,17 +208,12 @@ and had an appropriately set FOV
*/
static void PlayerSettings_DrawPlayer( void *self )
{
UI_LogFuncBegin();
menubitmap_s *b;
vec3_t viewangles;
vec3_t origin = {-40, 2.5, -4 }; //-3.8
char buf[MAX_QPATH];
//if (uis.spinView) {
// yawDelta3 = ( uis.cursorx - uis.cursorpx ) + placeHolder3 /*/ ( uis.frametime / 1000.0f ) ) / 20.0f*/; //5.0f
// yaw3 = AngleNormalize360 ( yawDelta3 );
//}
viewangles[YAW] = uis.lastYaw; //180 - 30
viewangles[PITCH] = 0;
viewangles[ROLL] = 0;
@ -454,25 +225,15 @@ static void PlayerSettings_DrawPlayer( void *self )
UI_PlayerInfo_SetModel( &s_playersettings.playerinfo, buf );
strcpy( s_playersettings.playerModel, buf );
/* viewangles[YAW] = 180 - 30; //30
viewangles[PITCH] = 0;
viewangles[ROLL] = 0; */
uis.lastYaw = viewangles[YAW] = 180 - 30; //180 - 30
}
/*s_playersettings.playerinfo.height = s_playersettings.height.curvalue;
s_playersettings.playerinfo.weight = s_playersettings.weight.curvalue;*/
UI_PlayerInfo_SetInfo( &s_playersettings.playerinfo, BOTH_WALK1, BOTH_WALK1, viewangles, vec3_origin, WP_0, s_playersettings.height.curvalue, s_playersettings.weight.curvalue, qfalse );
b = (menubitmap_s*) self;
UI_DrawPlayer( (float)b->generic.x, (float)b->generic.y, (float)b->width, (float)b->height, origin, &s_playersettings.playerinfo, (int32_t)(uis.realtime/1.5) );
/*if ( uis.spinView == qtrue && !trap_Key_IsDown( K_MOUSE1 )) {
uis.spinView = qfalse;
placeHolder3 = yaw3;
}*/
UI_LogFuncEnd();
}
@ -483,6 +244,7 @@ PlayerSettings_SaveChanges
*/
static void PlayerSettings_SaveChanges( void )
{
UI_LogFuncBegin();
// name
trap_Cvar_Set( "name", s_playersettings.name.field.buffer );
@ -540,18 +302,7 @@ static void PlayerSettings_SaveChanges( void )
//Display the 'applied msg'
s_playersettings.displayChangedSettings = qtrue;
// handicap
// trap_Cvar_SetValue( "handicap", 100 - s_playersettings.handicap.curvalue * 5 );
//if ( s_playersettings.pClass.curvalue == 0 || s_playersettings.pClass.curvalue == 6 ) {
// trap_Cvar_Set( "ui_playerrank", "crewman" );
// s_playersettings.pRank.curvalue = 0;
//}
//else
// trap_Cvar_Set( "ui_playerRank", uis.rankSet.rankNames[s_playersettings.pRank.curvalue].consoleName );
//trap_Cvar_Set( "ui_playerrank", prank_items_actual3[s_playersettings.pRank.curvalue] );
// effects color
// trap_Cvar_SetValue( "color", uitogamecode[s_playersettings.effects.curvalue] );
UI_LogFuncEnd();
}
@ -562,15 +313,6 @@ PlayerSettings_MenuKey
*/
static sfxHandle_t PlayerSettings_MenuKey( int32_t key )
{
//TiM - Don't save it this way
/*if( key == K_MOUSE2 || key == K_ESCAPE )
{
PlayerSettings_SaveChanges();
}*/
/*if ( ( key == K_MOUSE1 || key == K_ENTER ) && s_playersettings.commit.generic.flags & QMF_HASMOUSEFOCUS )
return menu_out_sound;*/
return Menu_DefaultKey( &s_playersettings.menu, key );
}
@ -582,11 +324,11 @@ PlayerSettings_SetMenuItems
*/
static void PlayerSettings_SetMenuItems( void )
{
UI_LogFuncBegin();
int32_t i;
// Player Name
Q_strncpyz( s_playersettings.name.field.buffer, UI_Cvar_VariableString("name"), sizeof(s_playersettings.name.field.buffer) );
//Q_strncpyz( s_playersettings.initData.name, s_playersettings.name.field.buffer, sizeof( s_playersettings.initData.name ) );
//Player class
{
@ -650,11 +392,9 @@ static void PlayerSettings_SetMenuItems( void )
//Player Age
Q_strncpyz( s_playersettings.age.field.buffer, UI_Cvar_VariableString( "age" ), sizeof( s_playersettings.age.field.buffer ) );
//Q_strncpyz( s_playersettings.initData.age, s_playersettings.age.field.buffer, sizeof( s_playersettings.initData.age ) );
//Player Race
Q_strncpyz( s_playersettings.race.field.buffer, UI_Cvar_VariableString( "race" ), sizeof( s_playersettings.race.field.buffer ) );
//Q_strncpyz( s_playersettings.initData.race, s_playersettings.race.field.buffer, sizeof( s_playersettings.initData.race ) );
//Player Height
{
@ -666,7 +406,6 @@ static void PlayerSettings_SetMenuItems( void )
height = 1.0f;
s_playersettings.height.curvalue = height;
//s_playersettings.initData.height = s_playersettings.height.curvalue;
}
@ -680,33 +419,9 @@ static void PlayerSettings_SetMenuItems( void )
weight = 1.0f;
s_playersettings.weight.curvalue = weight;
//s_playersettings.initData.weight = s_playersettings.weight.curvalue;
}
/*
// effects color
c = trap_Cvar_VariableValue( "color" ) - 1;
if( c < 0 || c > 6 ) {
c = 6;
}
s_playersettings.effects.curvalue = gamecodetoui[c];
// model/skin
memset( &s_playersettings.playerinfo, 0, sizeof(playerInfo_t) );
viewangles[YAW] = 180 - 30;
viewangles[PITCH] = 0;
viewangles[ROLL] = 0;
UI_PlayerInfo_SetModel( &s_playersettings.playerinfo, UI_Cvar_VariableString( "model" ) );
UI_PlayerInfo_SetInfo( &s_playersettings.playerinfo, LEGS_IDLE, TORSO_STAND2, viewangles, vec3_origin, WP_6, qfalse );
// handicap
h = Com_Clamp( 5, 100, trap_Cvar_VariableValue("handicap") );
s_playersettings.handicap.curvalue = 20 - h / 5;
*/
//PlayerSettings_AffectModel();
UI_LogFuncEnd();
}
/*
@ -716,11 +431,13 @@ PlayerSettings_SpinPlayer
*/
static void PlayerSettings_SpinPlayer( void* ptr, int32_t event)
{
UI_LogFuncBegin();
if ( event == QM_ACTIVATED )
{
uis.spinView = qtrue;
uis.cursorpx = uis.cursorx;
}
UI_LogFuncEnd();
}
/*
@ -730,8 +447,10 @@ PlayerSettings_MenuEvent
*/
static void PlayerSettings_MenuEvent( void* ptr, int32_t event )
{
UI_LogFuncBegin();
if( event != QM_ACTIVATED )
{
UI_LogFuncEnd();
return;
}
@ -741,10 +460,6 @@ static void PlayerSettings_MenuEvent( void* ptr, int32_t event )
switch( ((menucommon_s*)ptr)->id )
{
/* case ID_HANDICAP:
trap_Cvar_Set( "handicap", va( "%i", 100 - 25 * s_playersettings.handicap.curvalue ) );
break;*/
case ID_MODEL:
UI_PopMenu();
//PlayerSettings_SaveChanges();
@ -823,6 +538,7 @@ static void PlayerSettings_MenuEvent( void* ptr, int32_t event )
break;
}
UI_LogFuncEnd();
}
@ -833,6 +549,7 @@ PlayerSettingsMenu_Graphics
*/
void PlayerSettingsMenu_Graphics (void)
{
UI_LogFuncBegin();
// Draw the basic screen layout
UI_MenuFrame2(&s_playersettings.menu);
@ -890,14 +607,6 @@ void PlayerSettingsMenu_Graphics (void)
UI_DrawHandlePic(s_playersettings.mainmenu.generic.x - 14, s_playersettings.mainmenu.generic.y,
MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
/* trap_R_SetColor( colorTable[s_playersettings.loadProfile.color]);
UI_DrawHandlePic(s_playersettings.loadProfile.generic.x - 14, s_playersettings.loadProfile.generic.y,
MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
trap_R_SetColor( colorTable[s_playersettings.saveProfile.color]);
UI_DrawHandlePic(s_playersettings.saveProfile.generic.x - 14, s_playersettings.saveProfile.generic.y,
MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);*/
UI_DrawProportionalString( 74, 28, "881",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 74, 150, "2445",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 74, 206, "600",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
@ -940,15 +649,7 @@ void PlayerSettingsMenu_Graphics (void)
UI_DrawProportionalString( 444, 63, s_playersettings.name.field.buffer, UI_LEFT | UI_SMALLFONT, colorTable[CT_WHITE] );
//They can do ranks anytime they want now, but ingame, they won't have ranks in those classes
/*if (s_playersettings.pClass.curvalue == 6 || s_playersettings.pClass.curvalue == 0 ) { //if current class is alien or none
s_playersettings.pRank.generic.flags |= QMF_GRAYED; //gray out the rank, since aliens or nobodies don't 'do' ranks
// s_playersettings.pRank.color = CT_MDGREY;
}
else {
s_playersettings.pRank.generic.flags &= ~QMF_GRAYED;
// s_playersettings.pRank.color = CT_DKPURPLE1;
}*/
UI_LogFuncEnd();
}
@ -959,8 +660,10 @@ PlayerSettings_MenuDraw
*/
static void PlayerSettings_MenuDraw (void)
{
UI_LogFuncBegin();
PlayerSettingsMenu_Graphics();
Menu_Draw( &s_playersettings.menu );
UI_LogFuncEnd();
}
@ -971,8 +674,8 @@ PlayerSettings_MenuInit
*/
static void PlayerSettings_MenuInit(int32_t menuFrom)
{
UI_LogFuncBegin();
int32_t y;
//static char playername[32];
int32_t i;
memset(&s_playersettings,0,sizeof(playersettings_t));
@ -1234,14 +937,6 @@ static void PlayerSettings_MenuInit(int32_t menuFrom)
s_playersettings.weight.thumbGraphicWidth = 9;
s_playersettings.weight.thumbColor = CT_DKBLUE1;
s_playersettings.weight.thumbColor2 = CT_LTBLUE1;
// if (s_playersettings.pClass.curvalue == 6 || s_playersettings.pClass.curvalue == 0 ) { //if current class is alien or none
// s_playersettings.pRank.generic.flags |= QMF_INACTIVE; //gray out the rank, since aliens or nobodies don't 'do' ranks
// s_playersettings.pRank.color = CT_MDGREY;
// }
// else {
// s_playersettings.pRank.generic.flags &= ~QMF_INACTIVE;
// s_playersettings.pRank.color = CT_DKPURPLE1;
// }
if ( s_playersettings.numRankSets > 1 ) {
s_playersettings.rankSets.generic.type = MTYPE_SPINCONTROL;
@ -1332,74 +1027,6 @@ static void PlayerSettings_MenuInit(int32_t menuFrom)
s_playersettings.model.textEnum = MBT_CHANGEMODEL;
s_playersettings.model.textcolor = CT_BLACK;
s_playersettings.model.textcolor2 = CT_WHITE;
/*#if 0 //RPG-X: TiM- Damn this statement is cool!
if ( ingameFlag ) //Why was this here? It means people cant change their models? O_o
{
s_playersettings.model.generic.flags |= QMF_GRAYED;
}
#endif*/
/*
s_playersettings.profiles.generic.type = MTYPE_SPINCONTROL;
s_playersettings.profiles.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_playersettings.profiles.generic.x = 96;//134;
s_playersettings.profiles.generic.y = 58;//207;
s_playersettings.profiles.numitems = s_playersettings.numProfiles;
s_playersettings.profiles.textEnum = MBT_PROFILESCROLL;
s_playersettings.profiles.textcolor = CT_BLACK;
s_playersettings.profiles.textcolor2 = CT_WHITE;
s_playersettings.profiles.color = CT_DKPURPLE1;
s_playersettings.profiles.color2 = CT_LTPURPLE1;
s_playersettings.profiles.width = 90;//80;
s_playersettings.profiles.textX = 5;
s_playersettings.profiles.textY = 2;
s_playersettings.profiles.itemnames = (const char**)s_playersettings.profileListPtr;
s_playersettings.loadProfile.generic.type = MTYPE_BITMAP;
s_playersettings.loadProfile.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_playersettings.loadProfile.generic.x = 110;
s_playersettings.loadProfile.generic.y = 80;
s_playersettings.loadProfile.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
s_playersettings.loadProfile.generic.callback = PlayerSettings_MenuEvent;
s_playersettings.loadProfile.generic.id = ID_LOADPROFILE;
s_playersettings.loadProfile.width = 110;
s_playersettings.loadProfile.height = 18;
s_playersettings.loadProfile.color = CT_DKPURPLE1;
s_playersettings.loadProfile.color2 = CT_LTPURPLE1;
s_playersettings.loadProfile.textX = MENU_BUTTON_TEXT_X;
s_playersettings.loadProfile.textY = MENU_BUTTON_TEXT_Y;
s_playersettings.loadProfile.textcolor = CT_BLACK;
s_playersettings.loadProfile.textcolor2 = CT_WHITE;
s_playersettings.loadProfile.textEnum = MBT_LOADPROFILE;
s_playersettings.profileName.generic.type = MTYPE_FIELD;
s_playersettings.profileName.field.widthInChars = MAX_NAMELENGTH;
s_playersettings.profileName.field.maxchars = MAX_NAMELENGTH;
s_playersettings.profileName.generic.callback = PlayerSettings_MenuEvent;
s_playersettings.profileName.generic.x = 96 + 12 + UI_ProportionalStringWidth( menu_button_text[MBT_PROFILENAME][0], UI_SMALLFONT );//159;//180;
s_playersettings.profileName.generic.y = 340;//182;
s_playersettings.profileName.field.style = UI_SMALLFONT;
s_playersettings.profileName.field.titleEnum = MBT_PROFILENAME;
s_playersettings.profileName.field.titlecolor = CT_LTGOLD1;
s_playersettings.profileName.field.textcolor = CT_DKGOLD1;
s_playersettings.profileName.field.textcolor2 = CT_LTGOLD1;
s_playersettings.saveProfile.generic.type = MTYPE_BITMAP;
s_playersettings.saveProfile.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_playersettings.saveProfile.generic.x = 110;
s_playersettings.saveProfile.generic.y = 359;
s_playersettings.saveProfile.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
s_playersettings.saveProfile.generic.callback = PlayerSettings_MenuEvent;
s_playersettings.saveProfile.generic.id = ID_SAVEPROFILE;
s_playersettings.saveProfile.width = 110;
s_playersettings.saveProfile.height = 18;
s_playersettings.saveProfile.color = CT_DKPURPLE1;
s_playersettings.saveProfile.color2 = CT_LTPURPLE1;
s_playersettings.saveProfile.textX = MENU_BUTTON_TEXT_X;
s_playersettings.saveProfile.textY = MENU_BUTTON_TEXT_Y;
s_playersettings.saveProfile.textcolor = CT_BLACK;
s_playersettings.saveProfile.textcolor2 = CT_WHITE;
s_playersettings.saveProfile.textEnum = MBT_SAVEPROFILE;*/
s_playersettings.player.generic.type = MTYPE_BITMAP;
s_playersettings.player.generic.flags = QMF_SILENT;
@ -1410,14 +1037,6 @@ static void PlayerSettings_MenuInit(int32_t menuFrom)
s_playersettings.player.width = 151; //32*7.3
s_playersettings.player.height = 291; //56*7.3
/*s_playersettings.playername.generic.type = MTYPE_PTEXT;
s_playersettings.playername.generic.flags = QMF_INACTIVE;
s_playersettings.playername.generic.x = 444;
s_playersettings.playername.generic.y = 63;
s_playersettings.playername.string = UI_Cvar_VariableString("name"); //s_playersettings.name.field.buffer
s_playersettings.playername.style = UI_SMALLFONT;
s_playersettings.playername.color = colorTable[CT_BLACK];*/
s_playersettings.item_null.generic.type = MTYPE_BITMAP;
s_playersettings.item_null.generic.flags = QMF_LEFT_JUSTIFY|QMF_MOUSEONLY|QMF_SILENT;
s_playersettings.item_null.generic.x = 0;
@ -1425,16 +1044,8 @@ static void PlayerSettings_MenuInit(int32_t menuFrom)
s_playersettings.item_null.width = 640;
s_playersettings.item_null.height = 480;
// if (s_playersettings.prevMenu == PS_MENU_CONTROLS)
// {
// SetupMenu_TopButtons(&s_playersettings.menu,MENU_PLAYER);
// }
Menu_AddItem( &s_playersettings.menu, &s_playersettings.mainmenu);
Menu_AddItem( &s_playersettings.menu, &s_playersettings.back);
//Menu_AddItem( &s_playersettings.menu, &s_playersettings.profiles );
//Menu_AddItem( &s_playersettings.menu, &s_playersettings.loadProfile );
//Menu_AddItem( &s_playersettings.menu, &s_playersettings.playername );
Menu_AddItem( &s_playersettings.menu, &s_playersettings.name );
Menu_AddItem( &s_playersettings.menu, &s_playersettings.classTxt );
Menu_AddItem( &s_playersettings.menu, &s_playersettings.pClass );
@ -1445,8 +1056,6 @@ static void PlayerSettings_MenuInit(int32_t menuFrom)
Menu_AddItem( &s_playersettings.menu, &s_playersettings.height );
Menu_AddItem( &s_playersettings.menu, &s_playersettings.weight );
Menu_AddItem( &s_playersettings.menu, &s_playersettings.commit );
//Menu_AddItem( &s_playersettings.menu, &s_playersettings.profileName );
//Menu_AddItem( &s_playersettings.menu, &s_playersettings.saveProfile );
Menu_AddItem( &s_playersettings.menu, &s_playersettings.model );
Menu_AddItem( &s_playersettings.menu, &s_playersettings.data );
@ -1460,8 +1069,6 @@ static void PlayerSettings_MenuInit(int32_t menuFrom)
}
Menu_AddItem( &s_playersettings.menu, &s_playersettings.player );
// Menu_AddItem( &s_playersettings.menu, &s_playersettings.item_null );
//PlayerSettings_AffectModel();
@ -1504,6 +1111,7 @@ static void PlayerSettings_MenuInit(int32_t menuFrom)
s_playersettings.pClass.numitems = s_playersettings.numClasses;
}
UI_LogFuncEnd();
}
@ -1514,6 +1122,7 @@ PlayerSettings_Cache
*/
void PlayerSettings_Cache( void )
{
UI_LogFuncBegin();
s_playersettings.corner_ul_4_4 = trap_R_RegisterShaderNoMip("menu/common/corner_ul_4_4");
s_playersettings.corner_ur_4_4 = trap_R_RegisterShaderNoMip("menu/common/corner_ur_4_4");
s_playersettings.corner_ll_4_4 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_4_4");
@ -1522,6 +1131,7 @@ void PlayerSettings_Cache( void )
trap_R_RegisterShaderNoMip(PIC_MONBAR2);
trap_R_RegisterShaderNoMip(PIC_SLIDER);
UI_LogFuncEnd();
}
@ -1532,7 +1142,9 @@ UI_PlayerSettingsMenu
*/
void UI_PlayerSettingsMenu(int32_t menuFrom)
{
UI_LogFuncBegin();
PlayerSettings_MenuInit(menuFrom);
UI_PushMenu( &s_playersettings.menu );
UI_LogFuncEnd();
}

View file

@ -10,6 +10,7 @@ GAME OPTIONS MENU
#include "ui_local.h"
#include "ui_logger.h"
#define NUM_CROSSHAIRS 12
@ -103,17 +104,10 @@ int32_t s_voicelanguage_Names[] =
MNT_NONE
};
/*static int32_t teamoverlay_names[] =
{
MNT_TO_OFF,
MNT_TO_UPPER_RIGHT,
MNT_TO_LOWER_RIGHT,
MNT_TO_LOWER_LEFT,
0
};*/
static void Preferences_SetMenuItems( void )
{
UI_LogFuncBegin();
char buffer[32];
int32_t *language;
@ -122,7 +116,6 @@ static void Preferences_SetMenuItems( void )
s_preferences.wallmarks.curvalue = trap_Cvar_VariableValue( "cg_marks" ) != 0;
s_preferences.identifytarget.curvalue = trap_Cvar_VariableValue( "cg_drawCrosshairNames" ) != 0;
s_preferences.dynamiclights.curvalue = trap_Cvar_VariableValue( "r_dynamiclight" ) != 0;
// s_preferences.highqualitysky.curvalue = trap_Cvar_VariableValue ( "r_fastsky" ) == 0;
s_preferences.synceveryframe.curvalue = trap_Cvar_VariableValue( "r_finish" ) != 0;
s_preferences.forcemodel.curvalue = trap_Cvar_VariableValue( "cg_forcemodel" ) != 0;
s_preferences.drawteamoverlay.curvalue = Com_Clamp( 0, 3, trap_Cvar_VariableValue( "cg_drawTeamOverlay" ) );
@ -171,25 +164,22 @@ static void Preferences_SetMenuItems( void )
s_preferences.voicelanguage.curvalue = 0;
}
}
UI_LogFuncEnd();
}
static void Preferences_Event( void* ptr, int32_t notification )
{
UI_LogFuncBegin();
if( notification != QM_ACTIVATED )
{
UI_LogFuncEnd();
return;
}
switch( ((menucommon_s*)ptr)->id )
{
case ID_CROSSHAIR:
/*s_preferences.currentcrosshair++;
if( s_preferences.currentcrosshair == NUM_CROSSHAIRS )
{
s_preferences.currentcrosshair = 0;
}*/
//trap_Cvar_SetValue( "cg_drawCrosshair", s_preferences.currentcrosshair );
trap_Cvar_SetValue( "cg_drawCrosshair", s_preferences.crosshair.curvalue );
break;
@ -245,59 +235,9 @@ static void Preferences_Event( void* ptr, int32_t notification )
UI_PopMenu();
break;
}
UI_LogFuncEnd();
}
/*
=================
Crosshair_Draw
=================
*/
/*
static void Crosshair_Draw( void *self ) {
menulist_s *s;
float *color;
int32_t x, y;
int32_t style;
qboolean focus;
s = (menulist_s *)self;
x = s->generic.x;
y = s->generic.y;
style = UI_SMALLFONT;
focus = (s->generic.parent->cursor == s->generic.menuPosition);
if ( s->generic.flags & QMF_GRAYED )
color = text_color_disabled;
else if ( focus )
{
color = text_color_highlight;
style |= UI_PULSE;
}
else if ( s->generic.flags & QMF_BLINK )
{
color = text_color_highlight;
style |= UI_BLINK;
}
else
color = text_color_normal;
if ( focus )
{
// draw cursor
UI_FillRect( s->generic.left, s->generic.top, s->generic.right-s->generic.left+1, s->generic.bottom-s->generic.top+1, listbar_color );
UI_DrawChar( x, y, 13, UI_CENTER|UI_BLINK|UI_SMALLFONT, color);
}
UI_DrawString( x - SMALLCHAR_WIDTH, y, s->generic.name, style|UI_RIGHT, color );
if( !s->curvalue ) {
return;
}
UI_DrawHandlePic( x + SMALLCHAR_WIDTH, y - 4, 24, 24, s_preferences.crosshairShader[s->curvalue] );
}
*/
/*
=================
GameOptions_MenuDraw
@ -305,7 +245,7 @@ GameOptions_MenuDraw
*/
static void GameOptions_MenuDraw( void )
{
//int32_t x;
UI_LogFuncBegin();
UI_MenuFrame(&s_gameoptions.menu);
@ -313,40 +253,6 @@ static void GameOptions_MenuDraw( void )
trap_R_SetColor( colorTable[CT_DKPURPLE2]);
UI_DrawHandlePic(30,203, 47, 186, uis.whiteShader); // Long left hand column square
/*
UI_DrawHandlePic( 543, 171, 128, 32, s_gameoptions.swooptop);
UI_DrawHandlePic( 543, 396, 128, 32, s_gameoptions.swoopbottom);
UI_DrawHandlePic(548, 195, 64, 8, uis.whiteShader); // Top of right hand column
UI_DrawHandlePic(548, 389, 64, 7, uis.whiteShader); // Bottom of right hand column
UI_DrawHandlePic( 548, 206, 64, 180, uis.whiteShader); //
UI_DrawHandlePic( 104, 171, 436, 12, uis.whiteShader); // Top
UI_DrawHandlePic( 104, 182, 16, 227, uis.whiteShader); // Side
UI_DrawHandlePic( 104, 408, 436, 12, uis.whiteShader); // Bottom
*/
//RPG-X TiM : We can't customize our crosshairs no more. :'(
// trap_R_SetColor( colorTable[CT_DKBLUE1]);
// UI_DrawHandlePic(387, 245, 8, 87, uis.whiteShader); // Lefthand side of CROSSHAIR box
// UI_DrawHandlePic(513, 245, 8, 87, uis.whiteShader); // Righthand side of CROSSHAIR box
// UI_DrawHandlePic(395, 335, 116, 3, uis.whiteShader); // Bottom of CROSSHAIR box
// UI_DrawHandlePic( 387, 332, 16, 16,s_gameoptions.lswoop); // lower left hand swoop
// UI_DrawHandlePic( 510, 332, 16, 16,s_gameoptions.lswoop2); // lower right hand swoop
//
// UI_DrawHandlePic( 387, 224, 16, 32, s_gameoptions.tallswoop); // upper left hand swoop
// UI_DrawHandlePic( 507, 224, 16, 32, s_gameoptions.tallswoop2); // upper right hand swoop
//
// trap_R_SetColor( colorTable[CT_YELLOW]);
// x = 438;
// if (s_preferences.currentcrosshair)
// {
// UI_DrawHandlePic(x,270, 32, 32, s_preferences.crosshairShader[s_preferences.currentcrosshair]); // Draw crosshair
// }
// else
// {
// UI_DrawProportionalString( 454, 275, menu_normal_text[MNT_CROSSHAIR_NONE],UI_CENTER|UI_SMALLFONT, colorTable[CT_LTGOLD1]); // No crosshair
// }
// Menu frame numbers
UI_DrawProportionalString( 74, 66, "1776",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
@ -356,6 +262,7 @@ static void GameOptions_MenuDraw( void )
UI_DrawProportionalString( 74, 395, "1001001",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
Menu_Draw( &s_gameoptions.menu );
UI_LogFuncEnd();
}
/*
@ -374,7 +281,7 @@ UI_GameOptionsMenu_Cache
*/
void UI_GameOptionsMenu_Cache( void )
{
//int32_t i;
UI_LogFuncBegin();
s_gameoptions.slant1 = trap_R_RegisterShaderNoMip("menu/lcarscontrols/slant1.tga");
s_gameoptions.slant2 = trap_R_RegisterShaderNoMip("menu/lcarscontrols/slant2.tga");
@ -391,13 +298,7 @@ void UI_GameOptionsMenu_Cache( void )
s_gameoptions.tallswoop2 = trap_R_RegisterShaderNoMip("menu/lcarscontrols/tallswoop2.tga");
trap_R_RegisterShaderNoMip(PIC_BUTTON2);
// Precache crosshairs
/*for( i = 0; i < NUM_CROSSHAIRS; i++ )
{
s_preferences.crosshairShader[i] = trap_R_RegisterShaderNoMip( va("gfx/2d/crosshair%c", 'a' + i ) );
}*/
UI_LogFuncEnd();
}
/*
@ -407,6 +308,7 @@ GameOptions_MenuInit
*/
static void GameOptions_MenuInit( void )
{
UI_LogFuncBegin();
int32_t x,y,inc,width;
UI_GameOptionsMenu_Cache();
@ -551,22 +453,6 @@ static void GameOptions_MenuInit( void )
s_preferences.crosshair.textcolor2 = CT_WHITE;
s_preferences.crosshair.listnames = s_OffOnNone_Names;;
/*s_preferences.drawteamoverlay.generic.type = MTYPE_SPINCONTROL;
s_preferences.drawteamoverlay.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_preferences.drawteamoverlay.generic.x = x;
s_preferences.drawteamoverlay.generic.y = y;
s_preferences.drawteamoverlay.generic.callback = Preferences_Event;
s_preferences.drawteamoverlay.generic.id = ID_DRAWTEAMOVERLAY;
s_preferences.drawteamoverlay.textEnum = MBT_DRAWTEAMOVERLAY;
s_preferences.drawteamoverlay.textcolor = CT_BLACK;
s_preferences.drawteamoverlay.textcolor2 = CT_WHITE;
s_preferences.drawteamoverlay.color = CT_DKPURPLE1;
s_preferences.drawteamoverlay.color2 = CT_LTPURPLE1;
s_preferences.drawteamoverlay.textX = MENU_BUTTON_TEXT_X;
s_preferences.drawteamoverlay.textY = MENU_BUTTON_TEXT_Y;
s_preferences.drawteamoverlay.listnames = teamoverlay_names;
s_preferences.drawteamoverlay.width = width;*/
y += inc;
s_preferences.allowdownload.generic.type = MTYPE_SPINCONTROL;
s_preferences.allowdownload.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
@ -637,30 +523,12 @@ static void GameOptions_MenuInit( void )
s_preferences.voicelanguage.listnames = s_voicelanguage_Names;
s_preferences.voicelanguage.width = width;
/* s_preferences.crosshair.generic.type = MTYPE_BITMAP;
s_preferences.crosshair.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
s_preferences.crosshair.generic.x = 404;
s_preferences.crosshair.generic.y = 224;
s_preferences.crosshair.generic.name = PIC_BUTTON2;
s_preferences.crosshair.generic.id = ID_CROSSHAIR;
s_preferences.crosshair.generic.callback = Preferences_Event;
s_preferences.crosshair.width = 100;
s_preferences.crosshair.height = 32;
s_preferences.crosshair.color = CT_DKBLUE1;
s_preferences.crosshair.color2 = CT_LTBLUE1;
s_preferences.crosshair.textX = 20;
s_preferences.crosshair.textY = 1;
s_preferences.crosshair.textEnum = MBT_CROSSHAIR;
s_preferences.crosshair.textcolor = CT_BLACK;
s_preferences.crosshair.textcolor2 = CT_WHITE;*/
Menu_AddItem( &s_gameoptions.menu, &s_preferences.flares );
Menu_AddItem( &s_gameoptions.menu, &s_preferences.wallmarks );
Menu_AddItem( &s_gameoptions.menu, &s_preferences.dynamiclights );
Menu_AddItem( &s_gameoptions.menu, &s_preferences.identifytarget );
Menu_AddItem( &s_gameoptions.menu, &s_preferences.synceveryframe );
Menu_AddItem( &s_gameoptions.menu, &s_preferences.forcemodel );
//Menu_AddItem( &s_gameoptions.menu, &s_preferences.drawteamoverlay );
Menu_AddItem( &s_gameoptions.menu, &s_preferences.allowdownload );
Menu_AddItem( &s_gameoptions.menu, &s_preferences.simpleitems );
Menu_AddItem( &s_gameoptions.menu, &s_preferences.textlanguage );
@ -670,6 +538,7 @@ static void GameOptions_MenuInit( void )
s_gameoptions.menu.initialized = qtrue; // Show we've been here
Preferences_SetMenuItems();
UI_LogFuncEnd();
}
/*
@ -679,9 +548,10 @@ UI_GameOptionsMenu
*/
void UI_GameOptionsMenu( void )
{
UI_LogFuncBegin();
GameOptions_MenuInit();
UI_PushMenu( &s_gameoptions.menu );
UI_LogFuncEnd();
}

View file

@ -6,6 +6,7 @@
Quake's menu framework system.
**********************************************************************/
#include "ui_local.h"
#include "ui_logger.h"
sfxHandle_t menu_in_sound;
sfxHandle_t menu_move_sound;
@ -77,6 +78,7 @@ Text_Init
*/
static void Text_Init( menutext_s *t )
{
UI_LogFuncBegin();
int32_t x,y,w=0,h;
char buff[512];
char buff2[512];
@ -240,6 +242,7 @@ static void Text_Init( menutext_s *t )
t->generic.right = x + w;
t->generic.top = y;
t->generic.bottom = y + h;
UI_LogFuncEnd();
}
/*
@ -250,6 +253,7 @@ Text_Draw
//static void Text_Draw( menutext_s *t )
static void Text_Draw(menuframework_s *menu, menutext_s *t )
{
UI_LogFuncBegin();
int32_t x;
int32_t y,incY;
char buff[512];
@ -364,8 +368,7 @@ static void Text_Draw(menuframework_s *menu, menutext_s *t )
y +=incY;
UI_DrawProportionalString( x, y, buff3, t->style, color );
}
UI_LogFuncEnd();
}
/*
@ -385,6 +388,7 @@ BText_Draw
*/
static void BText_Draw( menutext_s *t )
{
UI_LogFuncBegin();
int32_t x;
int32_t y;
float* color;
@ -398,6 +402,7 @@ static void BText_Draw( menutext_s *t )
color = t->color;
UI_DrawBannerString( x, y, t->string, t->style, color );
UI_LogFuncEnd();
}
/*
@ -407,6 +412,7 @@ PText_Init
*/
static void PText_Init( menutext_s *t )
{
UI_LogFuncBegin();
int32_t x;
int32_t y;
int32_t w;
@ -431,6 +437,7 @@ static void PText_Init( menutext_s *t )
t->generic.right = x + w + PROP_GAP_WIDTH * sizeScale;
t->generic.top = y;
t->generic.bottom = y + h;
UI_LogFuncEnd();
}
/*
@ -440,6 +447,7 @@ PText_Draw
*/
static void PText_Draw( menutext_s *t )
{
UI_LogFuncBegin();
int32_t x;
int32_t y;
float * color;
@ -469,6 +477,7 @@ static void PText_Draw( menutext_s *t )
}
UI_DrawProportionalString( x, y, t->string, style, color );
UI_LogFuncEnd();
}
/*
@ -478,6 +487,7 @@ Bitmap_Init
*/
void Bitmap_Init( menubitmap_s *b )
{
UI_LogFuncBegin();
int32_t x;
int32_t y;
int32_t w;
@ -510,6 +520,7 @@ void Bitmap_Init( menubitmap_s *b )
b->shader = 0;
b->focusshader = 0;
UI_LogFuncEnd();
}
/*
@ -519,6 +530,7 @@ Bitmap_Draw
*/
void Bitmap_Draw( menubitmap_s *b )
{
UI_LogFuncBegin();
float x;
float y;
float w;
@ -684,7 +696,7 @@ void Bitmap_Draw( menubitmap_s *b )
UI_DrawProportionalString( x + b->textX, y + b->textY + incY , menu_button_text[b->textEnum2][0], textStyle, colorTable[colorI]);
}
}
UI_LogFuncEnd();
}
/*
@ -694,21 +706,9 @@ Action_Init
*/
static void Action_Init( menuaction_s *a )
{
UI_LogFuncBegin();
int32_t x,y,w,h;
/* int32_t len;
// calculate bounds
if (a->generic.name)
len = strlen(a->generic.name);
else
len = 0;
// left justify text
a->generic.left = a->generic.x;
a->generic.right = a->generic.x + len*BIGCHAR_WIDTH;
a->generic.top = a->generic.y;
a->generic.bottom = a->generic.y + BIGCHAR_HEIGHT;
*/
x = a->generic.x;
y = a->generic.y;
w = a->width;
@ -728,8 +728,7 @@ static void Action_Init( menuaction_s *a )
a->generic.top = y;
a->generic.bottom = y + h;
UI_LogFuncEnd();
}
/*
@ -739,9 +738,9 @@ Action_Draw
*/
static void Action_Draw( menuaction_s *a )
{
UI_LogFuncBegin();
int32_t x, y;
int32_t style;
// float* color;
int32_t textColor,buttonColor;
style = 0;
@ -784,17 +783,9 @@ static void Action_Draw( menuaction_s *a )
x = a->generic.x;
y = a->generic.y;
// UI_DrawString( x, y, a->generic.name, UI_LEFT|style, color );
trap_R_SetColor( colorTable[buttonColor]);
UI_DrawHandlePic(x,y, a->width, a->height, uis.whiteShader);
// if ( a->generic.parent->cursor == a->generic.menuPosition )
// {
// // draw cursor
// UI_DrawChar( x - BIGCHAR_WIDTH, y, 13, UI_LEFT|UI_BLINK, color);
// }
// Draw button text
if (menu_button_text[a->textEnum][0])
{
@ -817,7 +808,7 @@ static void Action_Draw( menuaction_s *a )
// Print second line of text
UI_DrawProportionalString( x + a->textX, y + a->textY + incY , menu_button_text[a->textEnum2][0], style, colorTable[textColor]);
}
UI_LogFuncEnd();
}
/*
@ -827,6 +818,7 @@ RadioButton_Init
*/
static void RadioButton_Init( menuradiobutton_s *rb )
{
UI_LogFuncBegin();
int32_t len;
// calculate bounds
@ -839,6 +831,7 @@ static void RadioButton_Init( menuradiobutton_s *rb )
rb->generic.right = rb->generic.x + 6*SMALLCHAR_WIDTH;
rb->generic.top = rb->generic.y;
rb->generic.bottom = rb->generic.y + SMALLCHAR_HEIGHT;
UI_LogFuncEnd();
}
/*
@ -848,6 +841,7 @@ RadioButton_Key
*/
static sfxHandle_t RadioButton_Key( menuradiobutton_s *rb, int32_t key )
{
UI_LogFuncBegin();
switch (key)
{
case K_MOUSE1:
@ -867,11 +861,12 @@ static sfxHandle_t RadioButton_Key( menuradiobutton_s *rb, int32_t key )
rb->curvalue = !rb->curvalue;
if ( rb->generic.callback )
rb->generic.callback( rb, QM_ACTIVATED );
UI_LogFuncEnd();
return (menu_move_sound);
}
// key not handled
UI_LogFuncEnd();
return 0;
}
@ -882,6 +877,7 @@ RadioButton_Draw
*/
static void RadioButton_Draw( menuradiobutton_s *rb )
{
UI_LogFuncBegin();
int32_t x;
int32_t y;
float *color;
@ -929,6 +925,7 @@ static void RadioButton_Draw( menuradiobutton_s *rb )
UI_DrawHandlePic( x + SMALLCHAR_WIDTH, y + 2, 16, 16, uis.rb_on );
UI_DrawString( x + SMALLCHAR_WIDTH + 16, y, "on", style, color, qtrue );
}
UI_LogFuncEnd();
}
/*
@ -938,6 +935,7 @@ Slider_Init
*/
static void Slider_Init( menuslider_s *s )
{
UI_LogFuncBegin();
// Labels go on the left side.
if (s->picX)
{
@ -968,6 +966,7 @@ static void Slider_Init( menuslider_s *s )
{
s->shader = trap_R_RegisterShaderNoMip( s->generic.name);
}
UI_LogFuncEnd();
}
/*
@ -977,6 +976,7 @@ Slider_Key
*/
static sfxHandle_t Slider_Key( menuslider_s *s, int32_t key )
{
UI_LogFuncBegin();
sfxHandle_t sound;
int32_t x;
int32_t oldvalue;
@ -1038,6 +1038,7 @@ static sfxHandle_t Slider_Key( menuslider_s *s, int32_t key )
if ( sound && s->generic.callback )
s->generic.callback( s, QM_ACTIVATED );
UI_LogFuncEnd();
return (sound);
}
@ -1049,6 +1050,7 @@ Slider_Draw
*/
static void Slider_Draw( menuslider_s *s )
{
UI_LogFuncBegin();
int32_t color;
int32_t textColor=CT_RED;
int32_t thumbColor=CT_LTGREY,backgroundColor=CT_DKGREY;
@ -1146,6 +1148,7 @@ static void Slider_Draw( menuslider_s *s )
trap_R_SetColor( colorTable[thumbColor]);
UI_DrawHandlePic( thumbX, s->generic.y, s->thumbWidth, s->thumbHeight, s->thumbShader);
}
UI_LogFuncEnd();
}
#else
/*
@ -1155,6 +1158,7 @@ Slider_Draw
*/
static void Slider_Draw( menuslider_s *s )
{
UI_LogFuncBegin();
float *color;
int32_t style;
int32_t i;
@ -1215,6 +1219,7 @@ static void Slider_Draw( menuslider_s *s )
style |= UI_BLINK;
}
UI_DrawChar( (int32_t)( x + 2*SMALLCHAR_WIDTH + (SLIDER_RANGE-1)*SMALLCHAR_WIDTH* s->range ), y, 131, UI_LEFT|style, color);
UI_LogFuncEnd();
}
#endif
@ -1225,8 +1230,10 @@ SpinControl_Init
*/
static void SpinControl_Init( menulist_s *s )
{
UI_LogFuncBegin();
if ((!s->listnames) && (!s->itemnames))
{
UI_LogFuncEnd();
return;
}
@ -1262,10 +1269,11 @@ static void SpinControl_Init( menulist_s *s )
s->generic.top = s->generic.y;
s->generic.bottom = s->generic.y + s->focusHeight;
}
UI_LogFuncEnd();
}
static sfxHandle_t SpinControl_InitListRender( menulist_s* s ) {
UI_LogFuncBegin();
if ( !s->generic.parent->displaySpinList ) {
if ( (s->generic.flags & QMF_HASMOUSEFOCUS) ) { //we clicked on the button, and the list wasn't open lol
//in case the data was changed, init the box height data and such again
@ -1362,6 +1370,7 @@ static sfxHandle_t SpinControl_InitListRender( menulist_s* s ) {
s->generic.parent->displaySpinList = s;
s->generic.parent->noNewSelecting = qtrue;
UI_LogFuncEnd();
return menu_move_sound;
}
}
@ -1397,16 +1406,18 @@ static sfxHandle_t SpinControl_InitListRender( menulist_s* s ) {
s->generic.parent->displaySpinList = NULL;
s->generic.parent->noNewSelecting = qfalse;
UI_LogFuncEnd();
return menu_out_sound;
}
else //clicked outside the box, so just cancel
{
s->generic.parent->displaySpinList = NULL;
s->generic.parent->noNewSelecting = qfalse;
UI_LogFuncEnd();
return menu_out_sound;
}
}
UI_LogFuncEnd();
return menu_move_sound;
}
@ -1417,6 +1428,7 @@ SpinControl_Key
*/
static sfxHandle_t SpinControl_Key( menulist_s *s, int32_t key )
{
UI_LogFuncBegin();
sfxHandle_t sound;
qboolean callback=qfalse;
@ -1441,18 +1453,6 @@ static sfxHandle_t SpinControl_Key( menulist_s *s, int32_t key )
callback=qtrue;
}
break;
/*if (!(s->generic.flags & QMF_HASMOUSEFOCUS))
{
break;
}*/
/*case K_ENTER:
case K_KP_ENTER:
s->curvalue++;
if (s->curvalue >= s->numitems)
s->curvalue = 0;
sound = menu_move_sound;
break;*/
case K_KP_LEFTARROW:
case K_LEFTARROW:
@ -1482,6 +1482,7 @@ static sfxHandle_t SpinControl_Key( menulist_s *s, int32_t key )
if ( sound && s->generic.callback && callback)
s->generic.callback( s, QM_ACTIVATED );
UI_LogFuncEnd();
return (sound);
}
@ -1492,6 +1493,7 @@ SpinControl_Draw
*/
static void SpinControl_Draw( menulist_s *s )
{
UI_LogFuncBegin();
int32_t x,y,buttonColor,buttonTextColor;
int32_t boxWidth,color;
char text[64];
@ -1650,7 +1652,7 @@ static void SpinControl_Draw( menulist_s *s )
}
}
}
UI_LogFuncEnd();
}
/*
@ -1660,6 +1662,7 @@ ScrollList_Init
*/
static void ScrollList_Init( menulist_s *l )
{
UI_LogFuncBegin();
int32_t w;
l->oldvalue = 0;
@ -1685,6 +1688,7 @@ static void ScrollList_Init( menulist_s *l )
l->generic.left -= w / 2;
l->generic.right -= w / 2;
}
UI_LogFuncEnd();
}
/*
@ -1694,6 +1698,7 @@ ScrollList_Key
*/
sfxHandle_t ScrollList_Key( menulist_s *l, int32_t key )
{
UI_LogFuncBegin();
int32_t x;
int32_t y;
int32_t w;
@ -1731,12 +1736,14 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int32_t key )
if (l->oldvalue != l->curvalue && l->generic.callback)
{
l->generic.callback( l, QM_GOTFOCUS );
UI_LogFuncEnd();
return (menu_move_sound);
}
}
}
// absorbed, silent sound effect
UI_LogFuncEnd();
return (menu_null_sound);
}
break;
@ -1750,8 +1757,10 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int32_t key )
if (l->oldvalue != l->curvalue && l->generic.callback)
{
l->generic.callback( l, QM_GOTFOCUS );
UI_LogFuncEnd();
return (menu_move_sound);
}
UI_LogFuncEnd();
return (menu_buzz_sound);
case K_KP_END:
@ -1771,13 +1780,16 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int32_t key )
if (l->oldvalue != l->curvalue && l->generic.callback)
{
l->generic.callback( l, QM_GOTFOCUS );
UI_LogFuncEnd();
return (menu_move_sound);
}
UI_LogFuncEnd();
return (menu_buzz_sound);
case K_PGUP:
case K_KP_PGUP:
if( l->columns > 1 ) {
UI_LogFuncEnd();
return menu_null_sound;
}
@ -1793,14 +1805,16 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int32_t key )
if (l->generic.callback)
l->generic.callback( l, QM_GOTFOCUS );
UI_LogFuncEnd();
return (menu_move_sound);
}
UI_LogFuncEnd();
return (menu_buzz_sound);
case K_PGDN:
case K_KP_PGDN:
if( l->columns > 1 ) {
UI_LogFuncEnd();
return menu_null_sound;
}
@ -1816,14 +1830,16 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int32_t key )
if (l->generic.callback)
l->generic.callback( l, QM_GOTFOCUS );
UI_LogFuncEnd();
return (menu_move_sound);
}
UI_LogFuncEnd();
return (menu_buzz_sound);
case K_KP_UPARROW:
case K_UPARROW:
if( l->curvalue == 0 ) {
UI_LogFuncEnd();
return menu_buzz_sound;
}
@ -1842,12 +1858,13 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int32_t key )
if( l->generic.callback ) {
l->generic.callback( l, QM_GOTFOCUS );
}
UI_LogFuncEnd();
return (menu_move_sound);
case K_KP_DOWNARROW:
case K_DOWNARROW:
if( l->curvalue == l->numitems - 1 ) {
UI_LogFuncEnd();
return menu_buzz_sound;
}
@ -1866,16 +1883,18 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int32_t key )
if( l->generic.callback ) {
l->generic.callback( l, QM_GOTFOCUS );
}
UI_LogFuncEnd();
return menu_move_sound;
case K_KP_LEFTARROW:
case K_LEFTARROW:
if( l->columns == 1 ) {
UI_LogFuncEnd();
return menu_null_sound;
}
if( l->curvalue < l->height ) {
UI_LogFuncEnd();
return menu_buzz_sound;
}
@ -1889,18 +1908,20 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int32_t key )
if( l->generic.callback ) {
l->generic.callback( l, QM_GOTFOCUS );
}
UI_LogFuncEnd();
return menu_move_sound;
case K_KP_RIGHTARROW:
case K_RIGHTARROW:
if( l->columns == 1 ) {
UI_LogFuncEnd();
return menu_null_sound;
}
c = l->curvalue + l->height;
if( c >= l->numitems ) {
UI_LogFuncEnd();
return menu_buzz_sound;
}
@ -1914,13 +1935,15 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int32_t key )
if( l->generic.callback ) {
l->generic.callback( l, QM_GOTFOCUS );
}
UI_LogFuncEnd();
return menu_move_sound;
}
// cycle look for ascii key inside list items
if ( !Q_isprint( key ) )
if ( !Q_isprint( key ) ){
UI_LogFuncEnd();
return (0);
}
// force to lower for case insensitive compare
if ( Q_isupper( key ) )
@ -1958,13 +1981,14 @@ sfxHandle_t ScrollList_Key( menulist_s *l, int32_t key )
l->curvalue = j;
if (l->generic.callback)
l->generic.callback( l, QM_GOTFOCUS );
UI_LogFuncEnd();
return ( menu_move_sound );
}
UI_LogFuncEnd();
return (menu_buzz_sound);
}
}
UI_LogFuncEnd();
return (menu_buzz_sound);
}
@ -1975,6 +1999,7 @@ ScrollList_Draw
*/
void ScrollList_Draw( menulist_s *l )
{
UI_LogFuncBegin();
int32_t x;
int32_t u;
int32_t y;
@ -2033,6 +2058,7 @@ void ScrollList_Draw( menulist_s *l )
}
x += (l->width + l->seperation) * SMALLCHAR_WIDTH;
}
UI_LogFuncEnd();
}
/*
@ -2042,6 +2068,7 @@ Menu_AddItem
*/
void Menu_AddItem( menuframework_s *menu, void *item )
{
UI_LogFuncBegin();
menucommon_s *itemptr;
if (menu->nitems >= MAX_MENUITEMS)
@ -2105,6 +2132,7 @@ void Menu_AddItem( menuframework_s *menu, void *item )
}
menu->nitems++;
UI_LogFuncEnd();
}
/*
@ -2114,10 +2142,13 @@ Menu_CursorMoved
*/
void Menu_CursorMoved( menuframework_s *m )
{
UI_LogFuncBegin();
void (*callback)( void *self, int32_t notification );
if (m->cursor_prev == m->cursor)
if (m->cursor_prev == m->cursor){
UI_LogFuncEnd();
return;
}
if (m->cursor_prev >= 0 && m->cursor_prev < m->nitems)
{
@ -2132,6 +2163,7 @@ void Menu_CursorMoved( menuframework_s *m )
if (callback)
callback(m->items[m->cursor],QM_GOTFOCUS);
}
UI_LogFuncEnd();
}
/*
@ -2141,9 +2173,11 @@ Menu_SetCursor
*/
void Menu_SetCursor( menuframework_s *m, int32_t cursor )
{
UI_LogFuncBegin();
if (((menucommon_s*)(m->items[cursor]))->flags & (QMF_GRAYED|QMF_INACTIVE))
{
// cursor can't go there
UI_LogFuncEnd();
return;
}
@ -2151,6 +2185,7 @@ void Menu_SetCursor( menuframework_s *m, int32_t cursor )
m->cursor = cursor;
Menu_CursorMoved( m );
UI_LogFuncEnd();
}
/*
@ -2160,6 +2195,7 @@ Menu_SetCursorToItem
*/
void Menu_SetCursorToItem( menuframework_s *m, void* ptr )
{
UI_LogFuncBegin();
int32_t i;
for (i=0; i<m->nitems; i++)
@ -2167,9 +2203,11 @@ void Menu_SetCursorToItem( menuframework_s *m, void* ptr )
if (m->items[i] == ptr)
{
Menu_SetCursor( m, i );
UI_LogFuncEnd();
return;
}
}
UI_LogFuncEnd();
}
/*
@ -2180,6 +2218,7 @@ void Menu_SetCursorToItem( menuframework_s *m, void* ptr )
** slot.
*/
void Menu_AdjustCursor( menuframework_s *m, int32_t dir ) {
UI_LogFuncBegin();
menucommon_s *item = NULL;
qboolean wrapped = qfalse;
@ -2199,6 +2238,7 @@ wrap:
if ( m->wrapAround ) {
if ( wrapped ) {
m->cursor = m->cursor_prev;
UI_LogFuncEnd();
return;
}
m->cursor = 0;
@ -2213,6 +2253,7 @@ wrap:
if ( m->wrapAround ) {
if ( wrapped ) {
m->cursor = m->cursor_prev;
UI_LogFuncEnd();
return;
}
m->cursor = m->nitems - 1;
@ -2222,6 +2263,7 @@ wrap:
m->cursor = m->cursor_prev;
}
}
UI_LogFuncEnd();
}
/*
@ -2231,6 +2273,7 @@ Menu_Draw
*/
void Menu_Draw( menuframework_s *menu )
{
UI_LogFuncBegin();
int32_t i;
menucommon_s *itemptr;
@ -2415,6 +2458,7 @@ void Menu_Draw( menuframework_s *menu )
}
}
}
UI_LogFuncEnd();
}
/*
@ -2424,9 +2468,12 @@ Menu_ItemAtCursor
*/
void *Menu_ItemAtCursor( menuframework_s *m )
{
if ( m->cursor < 0 || m->cursor >= m->nitems )
UI_LogFuncBegin();
if ( m->cursor < 0 || m->cursor >= m->nitems ){
UI_LogFuncEnd();
return 0;
}
UI_LogFuncEnd();
return m->items[m->cursor];
}
@ -2436,13 +2483,15 @@ Menu_ActivateItem
=================
*/
sfxHandle_t Menu_ActivateItem( menuframework_s *s, menucommon_s* item ) {
UI_LogFuncBegin();
if ( item->callback ) {
item->callback( item, QM_ACTIVATED );
if( !( item->flags & QMF_SILENT ) ) {
UI_LogFuncEnd();
return menu_move_sound;
}
}
UI_LogFuncEnd();
return 0;
}
@ -2453,6 +2502,7 @@ Menu_DefaultKey
*/
sfxHandle_t Menu_DefaultKey( menuframework_s *m, int32_t key )
{
UI_LogFuncBegin();
sfxHandle_t sound = 0;
menucommon_s *item;
int32_t cursor_prev;
@ -2466,17 +2516,20 @@ sfxHandle_t Menu_DefaultKey( menuframework_s *m, int32_t key )
if ( m->displaySpinList ) {
m->displaySpinList = NULL;
m->noNewSelecting = qfalse;
UI_LogFuncEnd();
return menu_out_sound;
}
else {
UI_PopMenu();
UI_LogFuncEnd();
return menu_out_sound;
}
}
if (!m || !m->nitems)
if (!m || !m->nitems){
UI_LogFuncEnd();
return 0;
}
// route key stimulus to widget
item = Menu_ItemAtCursor( m );
@ -2507,6 +2560,7 @@ sfxHandle_t Menu_DefaultKey( menuframework_s *m, int32_t key )
if (sound) {
// key was handled
UI_LogFuncEnd();
return sound;
}
}
@ -2553,8 +2607,10 @@ sfxHandle_t Menu_DefaultKey( menuframework_s *m, int32_t key )
case K_MOUSE4:
case K_MOUSE5:
if (item)
if ((item->flags & QMF_HASMOUSEFOCUS) && !(item->flags & (QMF_GRAYED|QMF_INACTIVE)))
if ((item->flags & QMF_HASMOUSEFOCUS) && !(item->flags & (QMF_GRAYED|QMF_INACTIVE))){
UI_LogFuncEnd();
return (Menu_ActivateItem( m, item ));
}
break;
case K_JOY1:
@ -2580,11 +2636,13 @@ sfxHandle_t Menu_DefaultKey( menuframework_s *m, int32_t key )
case K_KP_ENTER:
case K_ENTER:
if (item)
if (!(item->flags & (QMF_MOUSEONLY|QMF_GRAYED|QMF_INACTIVE)))
if (!(item->flags & (QMF_MOUSEONLY|QMF_GRAYED|QMF_INACTIVE))){
UI_LogFuncEnd();
return (Menu_ActivateItem( m, item ));
}
break;
}
UI_LogFuncEnd();
return sound;
}
@ -2595,6 +2653,7 @@ Menu_Cache
*/
void Menu_Cache( void )
{
UI_LogFuncBegin();
int32_t i;
static const char *smallNumbers[]=
{
@ -2664,7 +2723,7 @@ void Menu_Cache( void )
uis.menu_datadisp1_snd = trap_S_RegisterSound( "sound/interface/button4.wav" );
uis.menu_datadisp2_snd = trap_S_RegisterSound( "sound/interface/button7.wav" );
uis.menu_datadisp3_snd = trap_S_RegisterSound( "sound/interface/button5.wav" );
UI_LogFuncEnd();
}
/*
@ -2674,6 +2733,7 @@ Mouse_Hide
*/
void Mouse_Hide(void)
{
UI_LogFuncBegin();
uis.cursorDraw = qfalse;
}
@ -2684,5 +2744,6 @@ Mouse_Show
*/
void Mouse_Show(void)
{
UI_LogFuncBegin();
uis.cursorDraw = qtrue;
}

View file

@ -1,335 +0,0 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
/*
=======================================================================
REMOVE BOTS MENU
=======================================================================
*/
#include "ui_local.h"
#define ID_BACK 14
#define ID_UP 11
#define ID_DOWN 12
#define ID_DELETE 13
#define ID_BOTNAME0 20
#define ID_BOTNAME1 21
#define ID_BOTNAME2 22
#define ID_BOTNAME3 23
#define ID_BOTNAME4 24
#define ID_BOTNAME5 25
#define ID_BOTNAME6 26
#define BOTS_VIEWABLE 11
typedef struct {
menuframework_s menu;
menubitmap_s up;
menubitmap_s down;
menutext_s bots[BOTS_VIEWABLE];
menubitmap_s delete;
menubitmap_s back;
int32_t numBots;
int32_t baseBotNum;
int32_t selectedBotNum;
char botnames[BOTS_VIEWABLE][32];
int32_t botClientNums[MAX_BOTS];
} removeBotsMenuInfo_t;
static removeBotsMenuInfo_t removeBotsMenuInfo;
/*
=================
UI_RemoveBotsMenu_SetBotNames
=================
*/
static void UI_RemoveBotsMenu_SetBotNames( void ) {
int32_t n;
char info[MAX_INFO_STRING];
for ( n = 0; (n < BOTS_VIEWABLE) && (removeBotsMenuInfo.baseBotNum + n < removeBotsMenuInfo.numBots); n++ ) {
trap_GetConfigString( CS_PLAYERS + removeBotsMenuInfo.botClientNums[removeBotsMenuInfo.baseBotNum + n], info, MAX_INFO_STRING );
Q_strncpyz( removeBotsMenuInfo.botnames[n], Info_ValueForKey( info, "n" ), sizeof(removeBotsMenuInfo.botnames[n]) );
Q_CleanStr( removeBotsMenuInfo.botnames[n] );
}
}
/*
=================
UI_RemoveBotsMenu_DeleteEvent
=================
*/
static void UI_RemoveBotsMenu_DeleteEvent( void* ptr, int32_t event ) {
if (event != QM_ACTIVATED) {
return;
}
trap_Cmd_ExecuteText( EXEC_APPEND, va("kick %i\n", removeBotsMenuInfo.botClientNums[removeBotsMenuInfo.baseBotNum + removeBotsMenuInfo.selectedBotNum]) );
// Blank out name on screen so they know it's been kicked
memset(removeBotsMenuInfo.botnames[removeBotsMenuInfo.baseBotNum + removeBotsMenuInfo.selectedBotNum],0,sizeof(removeBotsMenuInfo.botnames[removeBotsMenuInfo.baseBotNum + removeBotsMenuInfo.selectedBotNum]));
}
/*
=================
UI_RemoveBotsMenu_BotEvent
=================
*/
static void UI_RemoveBotsMenu_BotEvent( void* ptr, int32_t event ) {
if (event != QM_ACTIVATED) {
return;
}
removeBotsMenuInfo.bots[removeBotsMenuInfo.selectedBotNum].color = colorTable[CT_DKGOLD1];
removeBotsMenuInfo.selectedBotNum = ((menucommon_s*)ptr)->id - ID_BOTNAME0;
removeBotsMenuInfo.bots[removeBotsMenuInfo.selectedBotNum].color = colorTable[CT_YELLOW];
}
/*
=================
UI_RemoveAddBotsMenu_BackEvent
=================
*/
static void UI_RemoveBotsMenu_BackEvent( void* ptr, int32_t event ) {
if (event != QM_ACTIVATED) {
return;
}
UI_PopMenu();
}
/*
=================
UI_RemoveBotsMenu_UpEvent
=================
*/
static void UI_RemoveBotsMenu_UpEvent( void* ptr, int32_t event ) {
if (event != QM_ACTIVATED) {
return;
}
if( removeBotsMenuInfo.baseBotNum > 0 ) {
removeBotsMenuInfo.baseBotNum--;
UI_RemoveBotsMenu_SetBotNames();
}
}
/*
=================
UI_RemoveBotsMenu_DownEvent
=================
*/
static void UI_RemoveBotsMenu_DownEvent( void* ptr, int32_t event ) {
if (event != QM_ACTIVATED) {
return;
}
if( removeBotsMenuInfo.baseBotNum + BOTS_VIEWABLE < removeBotsMenuInfo.numBots ) {
removeBotsMenuInfo.baseBotNum++;
UI_RemoveBotsMenu_SetBotNames();
}
}
/*
=================
UI_RemoveBotsMenu_GetBots
=================
*/
static void UI_RemoveBotsMenu_GetBots( void ) {
int32_t numPlayers;
int32_t isBot;
int32_t n;
char info[MAX_INFO_STRING];
trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
numPlayers = atoi( Info_ValueForKey( info, "sv_maxclients" ) );
removeBotsMenuInfo.numBots = 0;
for( n = 0; n < numPlayers; n++ ) {
trap_GetConfigString( CS_PLAYERS + n, info, MAX_INFO_STRING );
isBot = atoi( Info_ValueForKey( info, "skill" ) );
if( !isBot ) {
continue;
}
removeBotsMenuInfo.botClientNums[removeBotsMenuInfo.numBots] = n;
removeBotsMenuInfo.numBots++;
}
}
/*
=================
UI_RemoveMenu_Draw
=================
*/
static void UI_RemoveMenu_Draw( void )
{
UI_MenuFrame(&removeBotsMenuInfo.menu);
trap_R_SetColor( colorTable[CT_DKPURPLE2]);
UI_DrawHandlePic(30,201, 47, 90, uis.whiteShader); //Left side of frame
UI_DrawHandlePic(30,293, 47, 97, uis.whiteShader);
// Bot name frame
trap_R_SetColor( colorTable[CT_DKBLUE1]);
UI_DrawHandlePic( 81, 172, 225, 18, uis.whiteShader); // Top
UI_DrawHandlePic(288, 189, 18, 246, uis.whiteShader); // Side
UI_DrawProportionalString( 90, 173, menu_normal_text[MNT_HOLOGRAPHIC_CHARS],UI_SMALLFONT,colorTable[CT_BLACK]); // Top
// standard menu drawing
Menu_Draw( &removeBotsMenuInfo.menu );
}
/*
=================
UI_RemoveBots_Cache
=================
*/
void UI_RemoveBots_Cache( void )
{
trap_R_RegisterShaderNoMip( "menu/common/arrow_up_16.tga" );
trap_R_RegisterShaderNoMip( "menu/common/arrow_dn_16.tga" );
}
/*
=================
UI_RemoveBotsMenu_Init
=================
*/
static void UI_RemoveBotsMenu_Init( void ) {
int32_t n;
int32_t count;
int32_t y;
memset( &removeBotsMenuInfo, 0 ,sizeof(removeBotsMenuInfo) );
removeBotsMenuInfo.menu.draw = UI_RemoveMenu_Draw;
removeBotsMenuInfo.menu.fullscreen = qtrue;
removeBotsMenuInfo.menu.wrapAround = qtrue;
removeBotsMenuInfo.menu.descX = MENU_DESC_X;
removeBotsMenuInfo.menu.descY = MENU_DESC_Y;
removeBotsMenuInfo.menu.titleX = MENU_TITLE_X;
removeBotsMenuInfo.menu.titleY = MENU_TITLE_Y;
removeBotsMenuInfo.menu.titleI = MNT_REMOVE_HCS_TITLE;
removeBotsMenuInfo.menu.footNoteEnum = MNT_REMOVE_HCS;
UI_RemoveBots_Cache();
UI_RemoveBotsMenu_GetBots();
UI_RemoveBotsMenu_SetBotNames();
count = removeBotsMenuInfo.numBots < BOTS_VIEWABLE ? removeBotsMenuInfo.numBots : BOTS_VIEWABLE;
removeBotsMenuInfo.up.generic.type = MTYPE_BITMAP;
removeBotsMenuInfo.up.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
removeBotsMenuInfo.up.generic.x = 289;
removeBotsMenuInfo.up.generic.y = 196;
removeBotsMenuInfo.up.generic.id = ID_UP;
removeBotsMenuInfo.up.generic.callback = UI_RemoveBotsMenu_UpEvent;
removeBotsMenuInfo.up.width = 16;
removeBotsMenuInfo.up.height = 16;
removeBotsMenuInfo.up.color = CT_DKGOLD1;
removeBotsMenuInfo.up.color2 = CT_LTGOLD1;
removeBotsMenuInfo.up.generic.name = "menu/common/arrow_up_16.tga";
removeBotsMenuInfo.down.generic.type = MTYPE_BITMAP;
removeBotsMenuInfo.down.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
removeBotsMenuInfo.down.generic.x = 289;
removeBotsMenuInfo.down.generic.y = 407;
removeBotsMenuInfo.down.generic.id = ID_DOWN;
removeBotsMenuInfo.down.generic.callback = UI_RemoveBotsMenu_DownEvent;
removeBotsMenuInfo.down.width = 16;
removeBotsMenuInfo.down.height = 16;
removeBotsMenuInfo.down.color = CT_DKGOLD1;
removeBotsMenuInfo.down.color2 = CT_LTGOLD1;
removeBotsMenuInfo.down.generic.name = "menu/common/arrow_dn_16.tga";
for( n = 0, y = 194; n < count; n++, y += 20 )
{
removeBotsMenuInfo.bots[n].generic.type = MTYPE_PTEXT;
removeBotsMenuInfo.bots[n].generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
removeBotsMenuInfo.bots[n].generic.id = ID_BOTNAME0 + n;
removeBotsMenuInfo.bots[n].generic.x = 108;
removeBotsMenuInfo.bots[n].generic.y = y;
removeBotsMenuInfo.bots[n].generic.callback = UI_RemoveBotsMenu_BotEvent;
removeBotsMenuInfo.bots[n].string = removeBotsMenuInfo.botnames[n];
removeBotsMenuInfo.bots[n].color = colorTable[CT_DKGOLD1];
removeBotsMenuInfo.bots[n].color2 = colorTable[CT_LTGOLD1];
removeBotsMenuInfo.bots[n].style = UI_LEFT|UI_SMALLFONT;
}
removeBotsMenuInfo.delete.generic.type = MTYPE_BITMAP;
removeBotsMenuInfo.delete.generic.name = GRAPHIC_SQUARE;
removeBotsMenuInfo.delete.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
removeBotsMenuInfo.delete.generic.id = ID_DELETE;
removeBotsMenuInfo.delete.generic.callback = UI_RemoveBotsMenu_DeleteEvent;
removeBotsMenuInfo.delete.generic.x = 356;
removeBotsMenuInfo.delete.generic.y = 342;
removeBotsMenuInfo.delete.width = MENU_BUTTON_MED_WIDTH;
removeBotsMenuInfo.delete.height = MENU_BUTTON_MED_HEIGHT * 2;
removeBotsMenuInfo.delete.color = CT_DKPURPLE1;
removeBotsMenuInfo.delete.color2 = CT_LTPURPLE1;
removeBotsMenuInfo.delete.textX = MENU_BUTTON_TEXT_X;
removeBotsMenuInfo.delete.textY = MENU_BUTTON_TEXT_Y;
removeBotsMenuInfo.delete.textEnum = MBT_REMOVE_HOLO;
removeBotsMenuInfo.delete.textcolor = CT_BLACK;
removeBotsMenuInfo.delete.textcolor2 = CT_WHITE;
removeBotsMenuInfo.back.generic.type = MTYPE_BITMAP;
removeBotsMenuInfo.back.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
removeBotsMenuInfo.back.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
removeBotsMenuInfo.back.generic.id = ID_BACK;
removeBotsMenuInfo.back.generic.callback = UI_RemoveBotsMenu_BackEvent;
removeBotsMenuInfo.back.generic.x = 482;
removeBotsMenuInfo.back.generic.y = 136;
removeBotsMenuInfo.back.width = MENU_BUTTON_MED_WIDTH;
removeBotsMenuInfo.back.height = MENU_BUTTON_MED_HEIGHT;
removeBotsMenuInfo.back.color = CT_DKPURPLE1;
removeBotsMenuInfo.back.color2 = CT_LTPURPLE1;
removeBotsMenuInfo.back.textX = MENU_BUTTON_TEXT_X;
removeBotsMenuInfo.back.textY = MENU_BUTTON_TEXT_Y;
removeBotsMenuInfo.back.textEnum = MBT_INGAMEMENU;
removeBotsMenuInfo.back.textcolor = CT_BLACK;
removeBotsMenuInfo.back.textcolor2 = CT_WHITE;
Menu_AddItem( &removeBotsMenuInfo.menu, &removeBotsMenuInfo.up );
Menu_AddItem( &removeBotsMenuInfo.menu, &removeBotsMenuInfo.down );
for( n = 0; n < count; n++ )
{
Menu_AddItem( &removeBotsMenuInfo.menu, &removeBotsMenuInfo.bots[n] );
}
Menu_AddItem( &removeBotsMenuInfo.menu, &removeBotsMenuInfo.delete );
Menu_AddItem( &removeBotsMenuInfo.menu, &removeBotsMenuInfo.back );
removeBotsMenuInfo.baseBotNum = 0;
removeBotsMenuInfo.selectedBotNum = 0;
removeBotsMenuInfo.bots[0].color = color_white;
}
/*
=================
UI_RemoveBotsMenu
=================
*/
void UI_RemoveBotsMenu( void )
{
UI_RemoveBotsMenu_Init();
UI_PushMenu( &removeBotsMenuInfo.menu );
}

View file

@ -1,6 +1,7 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#include "ui_local.h"
#include "ui_logger.h"
#define MAX_VIDEODRIVER_LINES 20
@ -78,14 +79,17 @@ Add current server to favorites
*/
void Favorites_Add( void )
{
UI_LogFuncBegin();
char adrstr[128];
char serverbuff[128];
int32_t i;
int32_t best;
trap_Cvar_VariableStringBuffer( "cl_currentServerAddress", serverbuff, sizeof(serverbuff) );
if (!serverbuff[0])
if (!serverbuff[0]){
UI_LogFuncEnd();
return;
}
best = 0;
for (i=0; i<MAX_FAVORITESERVERS; i++)
@ -94,6 +98,7 @@ void Favorites_Add( void )
if (!Q_stricmp(serverbuff,adrstr))
{
// already in list
UI_LogFuncEnd();
return;
}
@ -104,6 +109,8 @@ void Favorites_Add( void )
if (best)
trap_Cvar_Set( va("server%d",best), serverbuff);
UI_LogFuncEnd();
}
@ -114,6 +121,7 @@ ServerInfo_Event
*/
static void ServerInfo_Event( void* ptr, int32_t event )
{
UI_LogFuncBegin();
switch (((menucommon_s*)ptr)->id)
{
case ID_ADD:
@ -167,6 +175,7 @@ static void ServerInfo_Event( void* ptr, int32_t event )
break;
}
UI_LogFuncEnd();
}
/*
@ -176,6 +185,7 @@ ServerInfoMenu_Graphics
*/
void ServerInfoMenu_Graphics (void)
{
UI_LogFuncBegin();
// Draw the basic screen layout
UI_MenuFrame2(&s_serverinfo.menu);
@ -184,7 +194,7 @@ void ServerInfoMenu_Graphics (void)
trap_R_SetColor( colorTable[CT_LTPURPLE1]);
UI_DrawHandlePic(250,400, 180, 20, uis.whiteShader);
UI_LogFuncEnd();
}
/*
@ -194,9 +204,11 @@ ServerInfo_MenuDraw
*/
static void ServerInfo_MenuDraw( void )
{
UI_LogFuncBegin();
ServerInfoMenu_Graphics();
Menu_Draw( &s_serverinfo.menu );
UI_LogFuncEnd();
}
@ -207,6 +219,7 @@ ServerInfo_LinePrep
*/
static void ServerInfo_LinePrep( void)
{
UI_LogFuncBegin();
int32_t i;
const char *s;
char key[MAX_INFO_KEY];
@ -234,6 +247,7 @@ static void ServerInfo_LinePrep( void)
s_serverinfo.lineCnt++;
}
UI_LogFuncEnd();
}
/*
@ -264,6 +278,7 @@ PlayerSettings_MenuInit
*/
static void UI_ServerInfoMenu_Init(void)
{
UI_LogFuncBegin();
int32_t i,x,y;
menutext_s *hold_key,*hold_value;
@ -405,7 +420,7 @@ static void UI_ServerInfoMenu_Init(void)
ServerInfo_LinePrep();
s_serverinfo.arrowup.generic.flags |= QMF_HIDDEN|QMF_INACTIVE;
UI_LogFuncEnd();
}
/*
@ -415,10 +430,11 @@ UI_ServerInfoMenu
*/
void UI_ServerInfoMenu( void )
{
UI_LogFuncBegin();
UI_ServerInfoMenu_Init();
UI_PushMenu( &s_serverinfo.menu );
UI_LogFuncEnd();
}

View file

@ -10,6 +10,7 @@ MULTIPLAYER MENU (SERVER BROWSER)
#include "ui_local.h"
#include "ui_logger.h"
static menubitmap_s s_find_server;
@ -65,21 +66,6 @@ static menubitmap_s s_create_server;
#define SORT_GAME 3
#define SORT_PING 4
/*#define GAMES_ALL 0
#define GAMES_FFA 1
#define GAMES_TEAMPLAY 2
#define GAMES_TOURNEY 3
#define GAMES_CTF 4
#define GAMES_EXCESSIVE 5
#define GAMES_FEDERATION 6
#define GAMES_GLADIATOR 7
#define GAMES_IN2TAGIB 8
#define GAMES_PINBALL 9
#define GAMES_Q32EF 10
#define GAMES_RPG 11
#define GAMES_TEAMELITE 12
#define GAMES_RPGX 13*/
#define GAMES_ALL 0
#define GAMES_RPGX 1
#define GAMES_FFA 2
@ -87,33 +73,6 @@ static menubitmap_s s_create_server;
#define GAMES_TOURNEY 4
#define GAMES_CTF 5
/*
static const char *master_items[] = {
"Local",
"Mplayer",
"Internet",
"Favorites",
0
};
static const char *servertype_items[] = {
"All",
"Free For All",
"Team Deathmatch",
"Tournament",
"Capture the Flag",
0
};
static const char *sortkey_items[] = {
"Server Name",
"Map Name",
"Open Player Spots",
"Game Type",
"Ping Time",
0
};
*/
static int32_t master_items[] =
{
MNT_MASTER_ITEMS_LOCAL,
@ -135,14 +94,6 @@ static int32_t servertype_items[] =
MNT_SERVERTYPE_TEAM_DEATHMATCH,
MNT_SERVERTYPE_TOURNAMENT,
MNT_SERVERTYPE_CAPTURETHEFLAG,
/*MNT_SERVERTYPE_EXCESSIVE,
MNT_SERVERTYPE_FEDERATION,
MNT_SERVERTYPE_GLADIATOR,
MNT_SERVERTYPE_IN2TAGIB,
MNT_SERVERTYPE_PINBALL,
MNT_SERVERTYPE_Q32EF,
MNT_SERVERTYPE_RPG,
MNT_SERVERTYPE_TEAMELITE,*/
0
};
@ -180,15 +131,6 @@ char* gamenames[] = {
"SP ", // single player
"TDM", // team deathmatch
"CTF", // capture the flag
/*"EXCESSIVE",
"FEDERATION",
"GLADIATOR",
"IN2TAGIB",
"PINBALL",
"Q32EF",
"RPG",
"TEAMELITE",
"RPG-X", //The best gametype of them all ;)*/
"???",
};
@ -199,7 +141,7 @@ static char* netnames[] = {
NULL
};
static char quake3worldMessage[] = "For more information, please visit : www.rpg-x.net www.ravensoft.com/eliteforce www.startrek.com";
static char quake3worldMessage[] = "For more information, please visit : www.ubergames.net www.ravensoft.com/eliteforce www.startrek.com";
typedef struct {
char adrstr[MAX_ADDRESSLENGTH];
@ -283,8 +225,6 @@ static servernode_t g_localserverlist[MAX_LOCALSERVERS];
static int32_t g_numlocalservers;
static servernode_t g_favoriteserverlist[MAX_FAVORITESERVERS];
static int32_t g_numfavoriteservers;
//static servernode_t g_mplayerserverlist[MAX_GLOBALSERVERS];
//static int32_t g_nummplayerservers;
static int32_t g_servertype;
static int32_t g_gametype;
static int32_t g_sortkey;
@ -298,12 +238,14 @@ ArenaServers_MaxPing
=================
*/
int32_t ArenaServers_MaxPing( void ) { /*static*/
UI_LogFuncBegin();
int32_t maxPing;
maxPing = (int32_t)trap_Cvar_VariableValue( "cl_maxPing" );
if( maxPing < 100 ) {
maxPing = 100;
}
UI_LogFuncEnd();
return maxPing;
}
@ -314,6 +256,7 @@ ArenaServers_Compare
=================
*/
static int32_t QDECL ArenaServers_Compare( const void *arg1, const void *arg2 ) {
UI_LogFuncBegin();
float f1;
float f2;
servernode_t* t1;
@ -324,9 +267,11 @@ static int32_t QDECL ArenaServers_Compare( const void *arg1, const void *arg2 )
switch( g_sortkey ) {
case SORT_HOST:
UI_LogFuncEnd();
return Q_stricmp( t1->hostname, t2->hostname );
case SORT_MAP:
UI_LogFuncEnd();
return Q_stricmp( t1->mapname, t2->mapname );
case SORT_CLIENTS:
@ -341,32 +286,41 @@ static int32_t QDECL ArenaServers_Compare( const void *arg1, const void *arg2 )
}
if( f1 < f2 ) {
UI_LogFuncEnd();
return 1;
}
if( f1 == f2 ) {
UI_LogFuncEnd();
return 0;
}
UI_LogFuncEnd();
return -1;
case SORT_GAME:
if( t1->gametype < t2->gametype ) {
UI_LogFuncEnd();
return -1;
}
if( t1->gametype == t2->gametype ) {
UI_LogFuncEnd();
return 0;
}
UI_LogFuncEnd();
return 1;
case SORT_PING:
if( t1->pingtime < t2->pingtime ) {
UI_LogFuncEnd();
return -1;
}
if( t1->pingtime > t2->pingtime ) {
UI_LogFuncEnd();
return 1;
}
UI_LogFuncEnd();
return Q_stricmp( t1->hostname, t2->hostname );
}
UI_LogFuncEnd();
return 0;
}
@ -377,12 +331,14 @@ ArenaServers_Go
=================
*/
static void ArenaServers_Go( void ) {
UI_LogFuncBegin();
servernode_t* servernode;
servernode = g_arenaservers.table[g_arenaservers.list.curvalue].servernode;
if( servernode ) {
trap_Cmd_ExecuteText( EXEC_APPEND, va( "connect %s\n", servernode->adrstr ) );
}
UI_LogFuncEnd();
}
@ -392,6 +348,7 @@ ArenaServers_UpdatePicture
=================
*/
static void ArenaServers_UpdatePicture( void ) {
UI_LogFuncBegin();
static char picname[64];
servernode_t* servernodeptr;
qhandle_t hpic;
@ -415,6 +372,7 @@ static void ArenaServers_UpdatePicture( void ) {
// force shader update during draw
g_arenaservers.mappic.shader = 0;
UI_LogFuncEnd();
}
@ -424,6 +382,7 @@ ArenaServers_UpdateMenu
=================
*/
static void ArenaServers_UpdateMenu( void ) {
UI_LogFuncBegin();
int32_t i;
int32_t j;
int32_t count;
@ -517,6 +476,7 @@ static void ArenaServers_UpdateMenu( void ) {
// update picture
ArenaServers_UpdatePicture();
UI_LogFuncEnd();
return;
}
@ -565,46 +525,6 @@ static void ArenaServers_UpdateMenu( void ) {
}
break;
/*case GAMES_EXCESSIVE:
if( Q_stricmp(servernodeptr->gamename, "excessive") ) {
continue;
}
break;
case GAMES_FEDERATION:
if( Q_stricmp(servernodeptr->gamename, "federation") ) {
continue;
}
break;
case GAMES_GLADIATOR:
if( Q_stricmp(servernodeptr->gamename, "gladiator") ) {
continue;
}
break;
case GAMES_IN2TAGIB:
if( Q_stricmp(servernodeptr->gamename, "in2tagib") ) {
continue;
}
break;
case GAMES_PINBALL:
if( Q_stricmp(servernodeptr->gamename, "pinball") ) {
continue;
}
break;
case GAMES_Q32EF:
if( Q_stricmp(servernodeptr->gamename, "q32ef") ) {
continue;
}
break;
case GAMES_RPG:
if( Q_stricmp(servernodeptr->gamename, "rpg") ) {
continue;
}
break;
case GAMES_TEAMELITE:
if( Q_stricmp(servernodeptr->gamename, "teamelite") ) {
continue;
}
break;*/
case GAMES_RPGX:
if( Q_stricmp(servernodeptr->gamename, RPGX_SERVERNAME ) ) {
continue;
@ -655,6 +575,7 @@ static void ArenaServers_UpdateMenu( void ) {
// update picture
ArenaServers_UpdatePicture();
UI_LogFuncEnd();
}
@ -665,12 +586,15 @@ ArenaServers_Remove
*/
static void ArenaServers_Remove( void )
{
UI_LogFuncBegin();
int32_t i;
servernode_t* servernodeptr;
table_t* tableptr;
if (!g_arenaservers.list.numitems)
if (!g_arenaservers.list.numitems){
UI_LogFuncEnd();
return;
}
// remove selected item from display list
// items are in scattered order due to sort and cull
@ -713,6 +637,7 @@ static void ArenaServers_Remove( void )
g_arenaservers.numqueriedservers = g_arenaservers.numfavoriteaddresses;
g_arenaservers.currentping = g_arenaservers.numfavoriteaddresses;
UI_LogFuncEnd();
}
@ -723,6 +648,7 @@ ArenaServers_Insert
*/
static void ArenaServers_Insert( char* adrstr, char* info, int32_t pingtime )
{
UI_LogFuncBegin();
servernode_t* servernodeptr;
char* s;
int32_t i;
@ -730,6 +656,7 @@ static void ArenaServers_Insert( char* adrstr, char* info, int32_t pingtime )
if ((pingtime >= ArenaServers_MaxPing()) && (g_servertype != AS_FAVORITES))
{
// slow global or local servers do not get entered
UI_LogFuncEnd();
return;
}
@ -798,6 +725,7 @@ static void ArenaServers_Insert( char* adrstr, char* info, int32_t pingtime )
Q_strncpyz( servernodeptr->gamename, gamenames[i], sizeof(servernodeptr->gamename) );
}
}
UI_LogFuncEnd();
}
@ -810,6 +738,7 @@ Insert nonresponsive address book entries into display lists.
*/
void ArenaServers_InsertFavorites( void )
{
UI_LogFuncBegin();
int32_t i;
int32_t j;
char info[MAX_INFO_STRING];
@ -830,6 +759,7 @@ void ArenaServers_InsertFavorites( void )
ArenaServers_Insert( g_arenaservers.favoriteaddresses[i], info, ArenaServers_MaxPing() );
}
}
UI_LogFuncEnd();
}
@ -842,6 +772,7 @@ Load cvar address book entries into local lists.
*/
void ArenaServers_LoadFavorites( void )
{
UI_LogFuncBegin();
int32_t i;
int32_t j;
int32_t numtempitems;
@ -905,6 +836,7 @@ void ArenaServers_LoadFavorites( void )
// list will be automatically refreshed when selected
g_numfavoriteservers = 0;
}
UI_LogFuncEnd();
}
@ -915,9 +847,12 @@ ArenaServers_StopRefresh
*/
static void ArenaServers_StopRefresh( void )
{
if (!g_arenaservers.refreshservers)
UI_LogFuncBegin();
if (!g_arenaservers.refreshservers){
// not currently refreshing
UI_LogFuncEnd();
return;
}
g_arenaservers.refreshservers = qfalse;
@ -938,6 +873,7 @@ static void ArenaServers_StopRefresh( void )
qsort( g_arenaservers.serverlist, *g_arenaservers.numservers, sizeof( servernode_t ), ArenaServers_Compare);
ArenaServers_UpdateMenu();
UI_LogFuncEnd();
}
@ -948,6 +884,7 @@ ArenaServers_DoRefresh
*/
static void ArenaServers_DoRefresh( void )
{
UI_LogFuncBegin();
int32_t i;
int32_t j;
int32_t time;
@ -963,6 +900,7 @@ static void ArenaServers_DoRefresh( void )
if (!trap_LAN_GetLocalServerCount())
{
// still waiting for response
UI_LogFuncEnd();
return;
}
}
@ -971,6 +909,7 @@ static void ArenaServers_DoRefresh( void )
if (trap_LAN_GetGlobalServerCount() < 0)
{
// still waiting for master server response
UI_LogFuncEnd();
return;
}
}
@ -979,6 +918,7 @@ static void ArenaServers_DoRefresh( void )
if (uis.realtime < g_arenaservers.nextpingtime)
{
// wait for time trigger
UI_LogFuncEnd();
return;
}
@ -1061,9 +1001,6 @@ static void ArenaServers_DoRefresh( void )
break;
}
// if (g_arenaservers.numqueriedservers > g_arenaservers.maxservers)
// g_arenaservers.numqueriedservers = g_arenaservers.maxservers;
// send ping requests in reasonable bursts
// iterate ping through all found servers
for (i=0; i<MAX_PINGREQUESTS && g_arenaservers.currentping < g_arenaservers.numqueriedservers; i++)
@ -1117,11 +1054,13 @@ static void ArenaServers_DoRefresh( void )
{
// all pings completed
ArenaServers_StopRefresh();
UI_LogFuncEnd();
return;
}
// update the user interface with ping status
ArenaServers_UpdateMenu();
UI_LogFuncEnd();
}
@ -1132,6 +1071,7 @@ ArenaServers_StartRefresh
*/
static void ArenaServers_StartRefresh( void )
{
UI_LogFuncBegin();
int32_t i;
char myargs[32];
@ -1157,6 +1097,7 @@ static void ArenaServers_StartRefresh( void )
if( g_servertype == AS_LOCAL ) {
trap_Cmd_ExecuteText( EXEC_APPEND, "localservers\n" );
UI_LogFuncEnd();
return;
}
@ -1164,23 +1105,8 @@ static void ArenaServers_StartRefresh( void )
{
i = g_servertype - AS_GLOBAL1;
// if( g_servertype == AS_GLOBAL1 ) {
// i = 0;
// }
// else {
// i = 1;
// }
switch( g_arenaservers.gametype.curvalue ) {
default:
/*case GAMES_EXCESSIVE:
case GAMES_FEDERATION:
case GAMES_GLADIATOR:
case GAMES_IN2TAGIB:
case GAMES_PINBALL:
case GAMES_Q32EF:
case GAMES_RPG:
case GAMES_TEAMELITE:*/
case GAMES_RPGX:
case GAMES_ALL:
myargs[0] = 0;
@ -1203,7 +1129,6 @@ static void ArenaServers_StartRefresh( void )
break;
}
if (g_emptyservers) {
strcat(myargs, " empty");
}
@ -1214,6 +1139,7 @@ static void ArenaServers_StartRefresh( void )
trap_Cmd_ExecuteText( EXEC_APPEND, va( "globalservers %d %d%s\n", i, (int32_t)trap_Cvar_VariableValue( "protocol" ), myargs ) );
}
UI_LogFuncEnd();
}
@ -1224,6 +1150,7 @@ ArenaServers_SaveChanges
*/
void ArenaServers_SaveChanges( void )
{
UI_LogFuncBegin();
int32_t i;
for (i=0; i<g_arenaservers.numfavoriteaddresses; i++)
@ -1231,6 +1158,8 @@ void ArenaServers_SaveChanges( void )
for (; i<MAX_FAVORITESERVERS; i++)
trap_Cvar_Set( va("server%d",i+1), "" );
UI_LogFuncEnd();
}
@ -1240,12 +1169,16 @@ ArenaServers_Sort
=================
*/
void ArenaServers_Sort( int32_t type ) {
UI_LogFuncBegin();
if( g_sortkey == type ) {
UI_LogFuncEnd();
return;
}
g_sortkey = type;
qsort( g_arenaservers.serverlist, *g_arenaservers.numservers, sizeof( servernode_t ), ArenaServers_Compare);
UI_LogFuncEnd();
}
@ -1256,10 +1189,13 @@ ArenaServers_SetType
*/
void ArenaServers_SetType( int32_t type )
{
UI_LogFuncBegin();
char IP[128];
if (g_servertype == type)
if (g_servertype == type){
UI_LogFuncEnd();
return;
}
if (type == AS_GLOBAL1)
{
@ -1351,13 +1287,6 @@ void ArenaServers_SetType( int32_t type )
g_arenaservers.numservers = &g_numfavoriteservers;
g_arenaservers.maxservers = MAX_FAVORITESERVERS;
break;
// case AS_MPLAYER:
// g_arenaservers.remove.generic.flags |= (QMF_INACTIVE|QMF_HIDDEN);
// g_arenaservers.serverlist = g_mplayerserverlist;
// g_arenaservers.numservers = &g_nummplayerservers;
// g_arenaservers.maxservers = MAX_GLOBALSERVERS;
// break;
}
if( !*g_arenaservers.numservers ) {
@ -1370,6 +1299,7 @@ void ArenaServers_SetType( int32_t type )
ArenaServers_UpdateMenu();
}
strcpy(g_arenaservers.status.string,menu_normal_text[MNT_HITREFRESH]);
UI_LogFuncEnd();
}
@ -1382,12 +1312,15 @@ Add current server to favorites
*/
void ArenaServers_Favorites_Add( void )
{
UI_LogFuncBegin();
char adrstr[128];
int32_t i;
int32_t best;
if (!g_arenaservers.table[g_arenaservers.list.curvalue].servernode->adrstr)
if (!g_arenaservers.table[g_arenaservers.list.curvalue].servernode->adrstr){
UI_LogFuncEnd();
return;
}
best = 0;
for (i=0; i<MAX_FAVORITESERVERS; i++)
@ -1397,6 +1330,7 @@ void ArenaServers_Favorites_Add( void )
if (!Q_stricmp(g_arenaservers.table[g_arenaservers.list.curvalue].servernode->adrstr,adrstr))
{
// already in list
UI_LogFuncEnd();
return;
}
@ -1407,6 +1341,8 @@ void ArenaServers_Favorites_Add( void )
if (best)
trap_Cvar_Set( va("server%d",best), g_arenaservers.table[g_arenaservers.list.curvalue].servernode->adrstr);
UI_LogFuncEnd();
}
@ -1417,12 +1353,14 @@ ArenaServers_Event
=================
*/
static void ArenaServers_Event( void* ptr, int32_t event ) {
UI_LogFuncBegin();
int32_t id;
id = ((menucommon_s*)ptr)->id;
if( event != QM_ACTIVATED && id != ID_LIST )
{
UI_LogFuncEnd();
return;
}
@ -1529,6 +1467,7 @@ static void ArenaServers_Event( void* ptr, int32_t event ) {
ArenaServers_UpdateMenu();
break;
}
UI_LogFuncEnd();
}
@ -1540,6 +1479,7 @@ ArenaServers_Graphics
*/
void ArenaServers_Graphics (void)
{
UI_LogFuncBegin();
UI_MenuFrame2(&g_arenaservers.menu);
trap_R_SetColor( colorTable[CT_LTBROWN1]);
UI_DrawHandlePic( 30, 203, 47, 186, uis.whiteShader); // Left side of frame
@ -1586,6 +1526,8 @@ void ArenaServers_Graphics (void)
UI_DrawHandlePic(g_arenaservers.back.generic.x - 14, g_arenaservers.back.generic.y,
MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
UI_LogFuncEnd();
}
/*
@ -1595,6 +1537,7 @@ ArenaServers_MenuDraw
*/
static void ArenaServers_MenuDraw( void )
{
UI_LogFuncBegin();
ArenaServers_Graphics();
if (g_arenaservers.refreshservers)
@ -1604,6 +1547,7 @@ static void ArenaServers_MenuDraw( void )
trap_R_SetColor( colorTable[CT_WHITE]);
Menu_Draw( &g_arenaservers.menu );
UI_LogFuncEnd();
}
@ -1613,8 +1557,10 @@ ArenaServers_MenuKey
=================
*/
static sfxHandle_t ArenaServers_MenuKey( int32_t key ) {
UI_LogFuncBegin();
if( key == K_SPACE && g_arenaservers.refreshservers ) {
ArenaServers_StopRefresh();
UI_LogFuncEnd();
return menu_move_sound;
}
@ -1622,6 +1568,7 @@ static sfxHandle_t ArenaServers_MenuKey( int32_t key ) {
( Menu_ItemAtCursor( &g_arenaservers.menu) == &g_arenaservers.list ) ) {
ArenaServers_Remove();
ArenaServers_UpdateMenu();
UI_LogFuncEnd();
return menu_move_sound;
}
@ -1630,7 +1577,7 @@ static sfxHandle_t ArenaServers_MenuKey( int32_t key ) {
ArenaServers_SaveChanges();
}
UI_LogFuncEnd();
return Menu_DefaultKey( &g_arenaservers.menu, key );
}
@ -1642,6 +1589,7 @@ ArenaServers_MenuInit
*/
static void ArenaServers_MenuInit( void )
{
UI_LogFuncBegin();
int32_t i;
int32_t type;
static char statusbuffer[MAX_STATUSLENGTH];
@ -1975,7 +1923,7 @@ static void ArenaServers_MenuInit( void )
{
g_arenaservers.favorite.generic.flags &= ~QMF_GRAYED;
}
UI_LogFuncEnd();
}
@ -1999,6 +1947,7 @@ void UI_ArenaServersMenu( void )
{
ArenaServers_MenuInit();
UI_PushMenu( &g_arenaservers.menu );
UI_LogFuncEnd();
}
@ -2019,6 +1968,7 @@ ChooseServerType_Graphics
*/
void ChooseServerType_Graphics (void)
{
UI_LogFuncBegin();
UI_MenuFrame(&g_chooseservertype.menu);
trap_R_SetColor( colorTable[CT_LTPURPLE2]);
@ -2042,7 +1992,7 @@ void ChooseServerType_Graphics (void)
trap_R_SetColor( colorTable[s_specific_server.color]);
UI_DrawHandlePic(s_specific_server.generic.x - 14, s_specific_server.generic.y,
MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
UI_LogFuncEnd();
}
/*
@ -2052,9 +2002,11 @@ ChooseServerType_MenuDraw
*/
static void ChooseServerType_MenuDraw( void )
{
UI_LogFuncBegin();
ChooseServerType_Graphics();
Menu_Draw( &g_chooseservertype.menu );
UI_LogFuncEnd();
}
/*
@ -2072,6 +2024,7 @@ ChooseServerType_MenuInit
*/
static void ChooseServerType_MenuInit( void )
{
UI_LogFuncBegin();
// zero set all our globals
memset( &g_chooseservertype, 0 ,sizeof(chooseservertype_t) );
@ -2160,6 +2113,7 @@ static void ChooseServerType_MenuInit( void )
Menu_AddItem(&g_chooseservertype.menu, ( void * )&s_specific_server);
UI_ChooseServerTypeMenu_Cache();
UI_LogFuncEnd();
}
/*
@ -2169,8 +2123,9 @@ UI_ChooseServerTypeMenu
*/
void UI_ChooseServerTypeMenu( void )
{
UI_LogFuncBegin();
ChooseServerType_MenuInit();
UI_PushMenu( &g_chooseservertype.menu );
UI_LogFuncEnd();
}

View file

@ -1,6 +1,7 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#include "ui_local.h"
#include "ui_logger.h"
extern int32_t rate_items[];
@ -54,6 +55,7 @@ static soundOptionsInfo_t soundOptionsInfo;
static void SoundQualityAction( qboolean result )
{
UI_LogFuncBegin();
if ( result )
{
soundOptionsInfo.holdSoundQuality = soundOptionsInfo.quality.curvalue;
@ -74,6 +76,7 @@ static void SoundQualityAction( qboolean result )
{
soundOptionsInfo.quality.curvalue = soundOptionsInfo.holdSoundQuality;
}
UI_LogFuncEnd();
}
/*
@ -84,10 +87,12 @@ UI_SoundOptionsMenu_Event
static void UI_SoundOptionsMenu_Event( void* ptr, int32_t event )
{
UI_LogFuncBegin();
int32_t holdCurvalue;
if( event != QM_ACTIVATED )
{
UI_LogFuncEnd();
return;
}
@ -146,6 +151,7 @@ static void UI_SoundOptionsMenu_Event( void* ptr, int32_t event )
break;
}
UI_LogFuncEnd();
}
@ -157,6 +163,7 @@ M_Sound_Graphics
*/
void M_Sound_Graphics (void)
{
UI_LogFuncBegin();
UI_MenuFrame(&soundOptionsInfo.menu);
trap_R_SetColor( colorTable[CT_LTBROWN1]);
@ -215,7 +222,7 @@ void M_Sound_Graphics (void)
UI_DrawProportionalString( 74, 188, "45-009",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 74, 206, "18856",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 74, 395, "18857",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_LogFuncEnd();
}
/*
@ -225,9 +232,11 @@ M_Sound_MenuDraw
*/
void M_Sound_MenuDraw (void)
{
UI_LogFuncBegin();
M_Sound_Graphics();
Menu_Draw( &soundOptionsInfo.menu );
UI_LogFuncEnd();
}
@ -238,6 +247,8 @@ M_Sound_MenuKey
*/
static sfxHandle_t M_Sound_MenuKey( int32_t key )
{
UI_LogFuncBegin();
UI_LogFuncEnd();
return Menu_DefaultKey( &soundOptionsInfo.menu, key );
}
@ -249,10 +260,12 @@ SoundMenu_Cache
*/
void UI_SoundMenu_Cache( void )
{
UI_LogFuncBegin();
soundOptionsInfo.corner = trap_R_RegisterShaderNoMip("menu/common/con_ssetup.tga");
soundOptionsInfo.grid = trap_R_RegisterShaderNoMip("menu/special/grid.tga");
soundOptionsInfo.wave1 = trap_R_RegisterShaderNoMip("menu/special/sinwave_1.tga");
soundOptionsInfo.wave2 = trap_R_RegisterShaderNoMip("menu/special/sinwave_2.tga");
UI_LogFuncEnd();
}
@ -263,6 +276,7 @@ SoundMenu_Init
*/
void SoundMenu_Init(void)
{
UI_LogFuncBegin();
int32_t x,y;
int32_t rate;
@ -431,6 +445,7 @@ void SoundMenu_Init(void)
{
soundOptionsInfo.rate.curvalue = 4;
}
UI_LogFuncEnd();
}
/*
@ -440,12 +455,10 @@ UI_SoundMenu
*/
void UI_SoundMenu( void)
{
// if (!s_sound.menu.initialized)
// {
SoundMenu_Init();
// }
UI_LogFuncBegin();
SoundMenu_Init();
UI_PushMenu( &soundOptionsInfo.menu);
UI_LogFuncEnd();
}

View file

@ -1,30 +0,0 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#include "ui_local.h"
void UI_SPArena_Start( const char *arenaInfo ) {
char *map;
int32_t level;
int32_t n;
char *txt;
n = (int32_t)trap_Cvar_VariableValue( "sv_maxclients" );
if ( n < 8 ) {
trap_Cvar_SetValue( "sv_maxclients", 8 );
}
level = atoi( Info_ValueForKey( arenaInfo, "num" ) );
txt = Info_ValueForKey( arenaInfo, "special" );
if( txt[0] ) {
if( Q_stricmp( txt, "training" ) == 0 ) {
level = -4;
}
else if( Q_stricmp( txt, "final" ) == 0 ) {
level = UI_GetNumSPTiers() * ARENAS_PER_TIER;
}
}
trap_Cvar_SetValue( "ui_spSelection", level );
map = Info_ValueForKey( arenaInfo, "map" );
trap_Cmd_ExecuteText( EXEC_APPEND, va( "spmap %s\n", map ) );
}

View file

@ -1,6 +1,7 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#include "ui_local.h"
#include "ui_logger.h"
/*********************************************************************************
SPECIFY SERVER
@ -37,10 +38,12 @@ SpecifyServer_Event
*/
static void SpecifyServer_Event( void* ptr, int32_t event )
{
UI_LogFuncBegin();
char buff[256];
if (event != QM_ACTIVATED)
{
UI_LogFuncEnd();
return;
}
@ -66,6 +69,7 @@ static void SpecifyServer_Event( void* ptr, int32_t event )
UI_PopMenu();
break;
}
UI_LogFuncEnd();
}
/*
@ -75,6 +79,7 @@ SpecifyServer_Graphics
*/
void SpecifyServer_Graphics (void)
{
UI_LogFuncBegin();
UI_MenuFrame2(&s_specifyserver.menu);
trap_R_SetColor( colorTable[CT_LTBROWN1]);
@ -122,6 +127,8 @@ void SpecifyServer_Graphics (void)
trap_R_SetColor( colorTable[s_specifyserver.back.color]);
UI_DrawHandlePic(s_specifyserver.back.generic.x - 14, s_specifyserver.back.generic.y,
MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
UI_LogFuncEnd();
}
/*
@ -131,9 +138,12 @@ SpecifyServer_MenuDraw
*/
static void SpecifyServer_MenuDraw( void )
{
UI_LogFuncBegin();
SpecifyServer_Graphics();
Menu_Draw( &s_specifyserver.menu );
UI_LogFuncEnd();
}
/*
@ -143,6 +153,7 @@ SpecifyServer_MenuInit
*/
void SpecifyServer_MenuInit( void )
{
UI_LogFuncBegin();
// zero set all our globals
memset( &s_specifyserver, 0 ,sizeof(specifyserver_t) );
@ -241,6 +252,7 @@ void SpecifyServer_MenuInit( void )
Menu_AddItem( &s_specifyserver.menu, &s_specifyserver.back );
Com_sprintf( s_specifyserver.port.field.buffer, 6, "%i", 27960 );
UI_LogFuncEnd();
}
/*
@ -250,10 +262,12 @@ SpecifyServer_Cache
*/
void SpecifyServer_Cache( void )
{
UI_LogFuncBegin();
s_specifyserver.corner_ul = trap_R_RegisterShaderNoMip("menu/common/corner_ul_18_18.tga");
s_specifyserver.corner_ur = trap_R_RegisterShaderNoMip("menu/common/corner_ur_18_18.tga");
s_specifyserver.corner_ll = trap_R_RegisterShaderNoMip("menu/common/corner_ll_18_18.tga");
s_specifyserver.corner_lr = trap_R_RegisterShaderNoMip("menu/common/corner_lr_18_18.tga");
UI_LogFuncEnd();
}
/*
@ -263,7 +277,9 @@ UI_SpecifyServerMenu
*/
void UI_SpecifyServerMenu( void )
{
UI_LogFuncBegin();
SpecifyServer_MenuInit();
UI_PushMenu( &s_specifyserver.menu );
UI_LogFuncEnd();
}

File diff suppressed because it is too large Load diff

View file

@ -1,379 +0,0 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
/*
=============================================================================
SINGLE PLAYER POSTGAME MENU
=============================================================================
*/
#include "ui_local.h"
#define MAX_SCOREBOARD_CLIENTS 8
#define AWARD_PRESENTATION_TIME 2000
#define ID_AGAIN 10
#define ID_NEXT 11
#define ID_MENU 12
typedef struct {
menuframework_s menu;
menubitmap_s item_again;
menubitmap_s item_next;
menubitmap_s item_menu;
int32_t phase;
int32_t ignoreKeysTime;
int32_t starttime;
int32_t scoreboardtime;
int32_t serverId;
int32_t clientNums[MAX_SCOREBOARD_CLIENTS];
int32_t ranks[MAX_SCOREBOARD_CLIENTS];
int32_t scores[MAX_SCOREBOARD_CLIENTS];
char placeNames[3][64];
int32_t level;
int32_t numClients;
int32_t won;
int32_t numAwards;
int32_t awardsEarned[6];
int32_t awardsLevels[6];
qboolean playedSound[6];
int32_t lastTier;
sfxHandle_t winnerSound;
} postgameMenuInfo_t;
static postgameMenuInfo_t postgameMenuInfo;
static char arenainfo[MAX_INFO_VALUE];
char *ui_medalNames[] =
{
"Efficiency", // AWARD_EFFICIENCY, Accuracy
"Sharpshooter", // AWARD_SHARPSHOOTER, Most compression rifle frags
"Untouchable", // AWARD_UNTOUCHABLE, Perfect (no deaths)
"Logistics", // AWARD_LOGISTICS, Most pickups
"Tactician", // AWARD_TACTICIAN, Kills with all weapons
"Demolitionist", // AWARD_DEMOLITIONIST, Most explosive damage kills
"Streak", // AWARD_STREAK, Ace/Expert/Master/Champion
"Role", // AWARD_TEAM, MVP/Defender/Warrior/Carrier/Interceptor/Bravery
"Section 31" // AWARD_SECTION31 All-around god
};
char *ui_medalPicNames[] = {
"menu/medals/medal_efficiency", // AWARD_EFFICIENCY,
"menu/medals/medal_sharpshooter", // AWARD_SHARPSHOOTER,
"menu/medals/medal_untouchable", // AWARD_UNTOUCHABLE,
"menu/medals/medal_logistics", // AWARD_LOGISTICS,
"menu/medals/medal_tactician", // AWARD_TACTICIAN,
"menu/medals/medal_demolitionist", // AWARD_DEMOLITIONIST,
"menu/medals/medal_ace", // AWARD_STREAK,
"menu/medals/medal_teammvp", // AWARD_TEAM,
"menu/medals/medal_section31" // AWARD_SECTION31
};
char *ui_medalSounds[] = {
"sound/voice/computer/misc/effic.wav", // AWARD_EFFICIENCY,
"sound/voice/computer/misc/sharp.wav", // AWARD_SHARPSHOOTER,
"sound/voice/computer/misc/untouch.wav", // AWARD_UNTOUCHABLE,
"sound/voice/computer/misc/log.wav", // AWARD_LOGISTICS,
"sound/voice/computer/misc/tact.wav", // AWARD_TACTICIAN,
"sound/voice/computer/misc/demo.wav", // AWARD_DEMOLITIONIST,
"sound/voice/computer/misc/ace.wav", // AWARD_STREAK,
"sound/voice/computer/misc/mvp.wav", // AWARD_TEAM,
"sound/voice/computer/misc/sec31.wav", // AWARD_SECTION31
};
/*
=================
UI_SPPostgameMenu_AgainEvent
=================
*/
static void UI_SPPostgameMenu_AgainEvent( void* ptr, int32_t event )
{
if (event != QM_ACTIVATED) {
return;
}
UI_PopMenu();
trap_Cmd_ExecuteText( EXEC_APPEND, "map_restart 0\n" );
}
/*
=================
UI_SPPostgameMenu_NextEvent
=================
*/
static void UI_SPPostgameMenu_NextEvent( void* ptr, int32_t event ) {
int32_t level;
const char *arenaInfo;
if (event != QM_ACTIVATED) {
return;
}
UI_PopMenu();
// handle specially if we just won the training map
if( postgameMenuInfo.won == 0 ) {
level = 0;
}
else {
level = postgameMenuInfo.level + 1;
}
#if 0
currentLevel = UI_GetCurrentGame();
if( currentLevel == -1 ) {
currentLevel = postgameMenuInfo.level;
}
currentSet = currentLevel / ARENAS_PER_TIER;
if( levelSet > currentSet || levelSet == UI_GetNumSPTiers() ) {
level = currentLevel;
}
#else
level = UI_GetCurrentGame(postgameMenuInfo.level);
if (level == UI_GetNumSPArenas())
{
level = 0;
}
#endif
arenaInfo = UI_GetArenaInfoByNumber( level );
if ( !arenaInfo ) {
return;
}
UI_SPArena_Start( arenaInfo );
}
/*
=================
UI_SPPostgameMenu_MenuEvent
=================
*/
static void UI_SPPostgameMenu_MenuEvent( void* ptr, int32_t event )
{
if (event != QM_ACTIVATED) {
return;
}
UI_PopMenu();
trap_Cmd_ExecuteText( EXEC_APPEND, "disconnect; levelselect\n" );
}
/*
=================
UI_SPPostgameMenu_MenuKey
=================
*/
static sfxHandle_t UI_SPPostgameMenu_MenuKey( int32_t key ) {
if ( uis.realtime < postgameMenuInfo.ignoreKeysTime ) {
return 0;
}
postgameMenuInfo.starttime = uis.realtime;
postgameMenuInfo.ignoreKeysTime = uis.realtime + 250;
// NO ESCAPE FOR YOU!!!
if( key == K_ESCAPE || key == K_MOUSE2 ) {
return 0;
}
return Menu_DefaultKey( &postgameMenuInfo.menu, key );
}
// ____________________________________________________________________ FIX ME!!!!
/*
static int32_t medalLocations[6] = {144, 448, 88, 504, 32, 560};
static void UI_SPPostgameMenu_DrawAwardsMedals( int32_t max ) {
}
static void UI_SPPostgameMenu_DrawAwardsPresentation( int32_t timer ) {
}
static void UI_SPPostgameMenu_MenuDrawScoreLine( int32_t n, int32_t y ) {
}
*/
/*
=================
UI_SPPostgameMenu_MenuDraw
=================
*/
/*
static void UI_SPPostgameMenu_MenuDraw( void ) {
int32_t serverId;
char info[MAX_INFO_STRING];
trap_GetConfigString( CS_SYSTEMINFO, info, sizeof(info) );
serverId = atoi( Info_ValueForKey( info, "sv_serverid" ) );
if( serverId != postgameMenuInfo.serverId ) {
UI_PopMenu();
return;
}
postgameMenuInfo.item_again.generic.flags &= ~QMF_INACTIVE;
postgameMenuInfo.item_next.generic.flags &= ~QMF_INACTIVE;
postgameMenuInfo.item_menu.generic.flags &= ~QMF_INACTIVE;
Menu_Draw( &postgameMenuInfo.menu );
}
*/
/*
=================
UI_SPPostgameMenu_Cache
=================
*/
void UI_SPPostgameMenu_Cache( void ) {
qboolean buildscript;
buildscript = trap_Cvar_VariableValue("com_buildscript");
if( buildscript ) { //cache these for the pack file!
trap_Cmd_ExecuteText( EXEC_APPEND, "music music/win\n" );
trap_Cmd_ExecuteText( EXEC_APPEND, "music music/loss\n" );
}
}
/*
=================
UI_SPPostgameMenu_Init
=================
Sets up the exact look of the menu buttons at the bottom
*/
static void UI_SPPostgameMenu_Init( void ) {
postgameMenuInfo.menu.wrapAround = qtrue;
postgameMenuInfo.menu.key = UI_SPPostgameMenu_MenuKey;
// postgameMenuInfo.menu.draw = UI_SPPostgameMenu_MenuDraw;
postgameMenuInfo.ignoreKeysTime = uis.realtime + 1500;
UI_SPPostgameMenu_Cache();
postgameMenuInfo.item_menu.generic.type = MTYPE_BITMAP;
postgameMenuInfo.item_menu.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
postgameMenuInfo.item_menu.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
postgameMenuInfo.item_menu.generic.x = 33;
postgameMenuInfo.item_menu.generic.y = 446;
postgameMenuInfo.item_menu.generic.callback = UI_SPPostgameMenu_MenuEvent;
postgameMenuInfo.item_menu.generic.id = ID_MENU;
postgameMenuInfo.item_menu.width = MENU_BUTTON_MED_WIDTH;
postgameMenuInfo.item_menu.height = MENU_BUTTON_MED_HEIGHT;
postgameMenuInfo.item_menu.color = CT_DKPURPLE1;
postgameMenuInfo.item_menu.color2 = CT_LTPURPLE1;
postgameMenuInfo.item_menu.textX = 5;
postgameMenuInfo.item_menu.textY = 1;
postgameMenuInfo.item_menu.textEnum = MBT_RETURNMENU;
postgameMenuInfo.item_menu.textcolor = CT_BLACK;
postgameMenuInfo.item_menu.textcolor2 = CT_WHITE;
postgameMenuInfo.item_again.generic.type = MTYPE_BITMAP;
postgameMenuInfo.item_again.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
postgameMenuInfo.item_again.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
postgameMenuInfo.item_again.generic.x = 256;
postgameMenuInfo.item_again.generic.y = 446;
postgameMenuInfo.item_again.generic.callback = UI_SPPostgameMenu_AgainEvent;
postgameMenuInfo.item_again.generic.id = ID_AGAIN;
postgameMenuInfo.item_again.width = MENU_BUTTON_MED_WIDTH;
postgameMenuInfo.item_again.height = MENU_BUTTON_MED_HEIGHT;
postgameMenuInfo.item_again.color = CT_DKPURPLE1;
postgameMenuInfo.item_again.color2 = CT_LTPURPLE1;
postgameMenuInfo.item_again.textX = 5;
postgameMenuInfo.item_again.textY = 1;
postgameMenuInfo.item_again.textEnum = MBT_REPLAY;
postgameMenuInfo.item_again.textcolor = CT_BLACK;
postgameMenuInfo.item_again.textcolor2 = CT_WHITE;
postgameMenuInfo.item_next.generic.type = MTYPE_BITMAP;
postgameMenuInfo.item_next.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
postgameMenuInfo.item_next.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
postgameMenuInfo.item_next.generic.x = 477;
postgameMenuInfo.item_next.generic.y = 446;
postgameMenuInfo.item_next.generic.callback = UI_SPPostgameMenu_NextEvent;
postgameMenuInfo.item_next.generic.id = ID_NEXT;
postgameMenuInfo.item_next.width = MENU_BUTTON_MED_WIDTH;
postgameMenuInfo.item_next.height = MENU_BUTTON_MED_HEIGHT;
postgameMenuInfo.item_next.color = CT_DKPURPLE1;
postgameMenuInfo.item_next.color2 = CT_LTPURPLE1;
postgameMenuInfo.item_next.textX = 5;
postgameMenuInfo.item_next.textY = 1;
postgameMenuInfo.item_next.textEnum = MBT_NEXTMATCH;
postgameMenuInfo.item_next.textcolor = CT_BLACK;
postgameMenuInfo.item_next.textcolor2 = CT_WHITE;
Menu_AddItem( &postgameMenuInfo.menu, ( void * )&postgameMenuInfo.item_menu );
Menu_AddItem( &postgameMenuInfo.menu, ( void * )&postgameMenuInfo.item_next );
Menu_AddItem( &postgameMenuInfo.menu, ( void * )&postgameMenuInfo.item_again );
}
/*
=================
UI_SPPostgameMenu_f
=================
*/
void UI_SPPostgameMenu_f( void ) {
int32_t playerGameRank;
// int32_t oldFrags, newFrags;
const char *arena;
char map[MAX_QPATH];
char info[MAX_INFO_STRING];
Mouse_Show();
memset( &postgameMenuInfo, 0, sizeof(postgameMenuInfo) );
trap_GetConfigString( CS_SYSTEMINFO, info, sizeof(info) );
postgameMenuInfo.serverId = atoi( Info_ValueForKey( info, "sv_serverid" ) );
postgameMenuInfo.menu.nobackground = qtrue;
trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
Q_strncpyz( map, Info_ValueForKey( info, "mapname" ), sizeof(map) );
arena = UI_GetArenaInfoByMap( map );
if ( !arena ) {
return;
}
Q_strncpyz( arenainfo, arena, sizeof(arenainfo) );
postgameMenuInfo.level = atoi( Info_ValueForKey( arenainfo, "num" ) );
playerGameRank = 8; // in case they ended game as a spectator
playerGameRank = atoi( UI_Argv(1));
UI_SetBestScore( postgameMenuInfo.level, playerGameRank+1 );
postgameMenuInfo.starttime = uis.realtime;
postgameMenuInfo.scoreboardtime = uis.realtime;
trap_Key_SetCatcher( KEYCATCH_UI );
uis.menusp = 0;
UI_SPPostgameMenu_Init();
UI_PushMenu( &postgameMenuInfo.menu );
if (playerGameRank == 0)
{
postgameMenuInfo.won = 1;
Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_next );
}
else {
Menu_SetCursorToItem( &postgameMenuInfo.menu, &postgameMenuInfo.item_menu );
}
// trap_Cmd_ExecuteText( EXEC_APPEND, "music music/win\n" ); //?? always win? should this be deleted and playing cg_scoreboard now?
postgameMenuInfo.lastTier = UI_GetNumSPTiers();
if ( UI_GetSpecialArenaInfo( "final" ) ) {
postgameMenuInfo.lastTier++;
}
}

View file

@ -1,173 +0,0 @@
/*
=======================================================================
RESET MENU
=======================================================================
*/
#include "ui_local.h"
#define ART_FRAME "menu/art/cut_frame"
#define ID_NO 100
#define ID_YES 101
typedef struct
{
menuframework_s menu;
menutext_s no;
menutext_s yes;
int32_t slashX;
} resetMenu_t;
static resetMenu_t s_reset;
/*
=================
Reset_MenuEvent
=================
*/
void Reset_MenuEvent(void* ptr, int32_t event) {
if( event != QM_ACTIVATED ) {
return;
}
UI_PopMenu();
if( ((menucommon_s*)ptr)->id == ID_NO ) {
return;
}
// reset the game, pop the level menu and restart it so it updates
UI_NewGame();
trap_Cvar_SetValue( "ui_spSelection", 0 );
UI_PopMenu();
UI_SPLevelMenu();
}
/*
=================
Reset_MenuKey
=================
*/
static sfxHandle_t Reset_MenuKey( int32_t key ) {
switch ( key ) {
case K_KP_LEFTARROW:
case K_LEFTARROW:
case K_KP_RIGHTARROW:
case K_RIGHTARROW:
key = K_TAB;
break;
case 'n':
case 'N':
Reset_MenuEvent( &s_reset.no, QM_ACTIVATED );
break;
case 'y':
case 'Y':
Reset_MenuEvent( &s_reset.yes, QM_ACTIVATED );
break;
}
return Menu_DefaultKey( &s_reset.menu, key );
}
/*
=================
Reset_MenuDraw
=================
*/
static void Reset_MenuDraw( void ) {
UI_DrawNamedPic( 142, 118, 359, 256, ART_FRAME );
UI_DrawProportionalString( 320, 194 + 10, "RESET GAME?", UI_CENTER|UI_INVERSE, color_red );
UI_DrawProportionalString( s_reset.slashX, 265, "/", UI_LEFT|UI_INVERSE, color_red );
Menu_Draw( &s_reset.menu );
UI_DrawProportionalString( SCREEN_WIDTH/2, 356 + PROP_HEIGHT * 0, "WARNING: This resets all of the", UI_CENTER|UI_SMALLFONT, color_yellow );
UI_DrawProportionalString( SCREEN_WIDTH/2, 356 + PROP_HEIGHT * 1, "single player game variables.", UI_CENTER|UI_SMALLFONT, color_yellow );
UI_DrawProportionalString( SCREEN_WIDTH/2, 356 + PROP_HEIGHT * 2, "Do this only if you want to", UI_CENTER|UI_SMALLFONT, color_yellow );
UI_DrawProportionalString( SCREEN_WIDTH/2, 356 + PROP_HEIGHT * 3, "start over from the beginning.", UI_CENTER|UI_SMALLFONT, color_yellow );
}
/*
=================
Reset_Cache
=================
*/
void Reset_Cache( void ) {
trap_R_RegisterShaderNoMip( ART_FRAME );
}
/*
=================
UI_ResetMenu
=================
*/
void UI_ResetMenu(void) {
uiClientState_t cstate;
int32_t n1, n2, n3;
int32_t l1, l2, l3;
// zero set all our globals
memset( &s_reset, 0, sizeof(s_reset) );
Reset_Cache();
n1 = UI_ProportionalStringWidth( "YES/NO", UI_BIGFONT);
n2 = UI_ProportionalStringWidth( "YES", UI_BIGFONT) + PROP_GAP_WIDTH;
n3 = UI_ProportionalStringWidth( "/", UI_BIGFONT) + PROP_GAP_WIDTH;
l1 = 320 - ( n1 / 2 );
l2 = l1 + n2;
l3 = l2 + n3;
s_reset.slashX = l2;
s_reset.menu.draw = Reset_MenuDraw;
s_reset.menu.key = Reset_MenuKey;
s_reset.menu.wrapAround = qtrue;
trap_GetClientState( &cstate );
if ( cstate.connState >= CA_CONNECTED ) {
// float on top of running game
s_reset.menu.fullscreen = qfalse;
}
else {
// game not running
s_reset.menu.fullscreen = qtrue;
}
s_reset.yes.generic.type = MTYPE_PTEXT;
s_reset.yes.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
s_reset.yes.generic.callback = Reset_MenuEvent;
s_reset.yes.generic.id = ID_YES;
s_reset.yes.generic.x = l1;
s_reset.yes.generic.y = 264;
s_reset.yes.string = "YES";
s_reset.yes.color = color_red;
s_reset.yes.style = UI_LEFT;
s_reset.no.generic.type = MTYPE_PTEXT;
s_reset.no.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
s_reset.no.generic.callback = Reset_MenuEvent;
s_reset.no.generic.id = ID_NO;
s_reset.no.generic.x = l3;
s_reset.no.generic.y = 264;
s_reset.no.string = "NO";
s_reset.no.color = color_red;
s_reset.no.style = UI_LEFT;
Menu_AddItem( &s_reset.menu, &s_reset.yes );
Menu_AddItem( &s_reset.menu, &s_reset.no );
UI_PushMenu( &s_reset.menu );
Menu_SetCursorToItem( &s_reset.menu, &s_reset.no );
}

View file

@ -1,488 +0,0 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
/*
=============================================================================
SINGLE PLAYER SKILL MENU
=============================================================================
*/
#include "ui_local.h"
#define ART_MAP_COMPLETE1 "menu/art/level_complete1"
#define ART_MAP_COMPLETE2 "menu/art/level_complete2"
#define ART_MAP_COMPLETE3 "menu/art/level_complete3"
#define ART_MAP_COMPLETE4 "menu/art/level_complete4"
#define ART_MAP_COMPLETE5 "menu/art/level_complete5"
#define ID_BABY 10
#define ID_EASY 11
#define ID_MEDIUM 12
#define ID_HARD 13
#define ID_NIGHTMARE 14
#define ID_BACK 15
#define ID_FIGHT 16
#define ID_MAINMENU 17
typedef struct
{
menuframework_s menu;
menubitmap_s item_baby;
menubitmap_s item_easy;
menubitmap_s item_medium;
menubitmap_s item_hard;
menubitmap_s item_nightmare;
menubitmap_s item_dotl;
menubitmap_s item_dotr;
menubitmap_s mainmenu;
menubitmap_s art_skillPic;
menubitmap_s item_back;
menubitmap_s item_fight;
qhandle_t corner_18_50;
const char *arenaInfo;
qhandle_t skillpics[5];
sfxHandle_t nightmareSound; // Do we need this for Voyager??? RWL
sfxHandle_t silenceSound;
} skillMenuInfo_t;
static skillMenuInfo_t skillMenuInfo;
int32_t skillButtonY[5] =
{
131,
161,
191,
221,
251
};
/*
=================
SetSkillColor
=================
*/
static void SetSkillColor( int32_t skill, int32_t color )
{
switch( skill )
{
case 1:
skillMenuInfo.item_baby.color = color;
break;
case 2:
skillMenuInfo.item_easy.color = color;
break;
case 3:
skillMenuInfo.item_medium.color = color;
break;
case 4:
skillMenuInfo.item_hard.color = color;
break;
case 5:
skillMenuInfo.item_nightmare.color = color;
break;
default:
break;
}
}
/*
=================
UI_SPSkillMenu_SkillEvent
=================
*/
static void UI_SPSkillMenu_SkillEvent( void *ptr, int32_t notification )
{
int32_t id;
int32_t skill;
if (notification != QM_ACTIVATED)
{
return;
}
// SetSkillColor( (int32_t)trap_Cvar_VariableValue( "g_spSkill" ), CT_RED );
id = ((menucommon_s*)ptr)->id;
skill = id - ID_BABY + 1;
trap_Cvar_SetValue( "g_spSkill", skill );
skillMenuInfo.item_dotl.generic.y= skillButtonY[skill-1];
skillMenuInfo.item_dotr.generic.y= skillButtonY[skill-1];
skillMenuInfo.art_skillPic.shader = skillMenuInfo.skillpics[skill - 1];
// if( id == ID_NIGHTMARE )
// {
// trap_S_StartLocalSound( skillMenuInfo.nightmareSound, CHAN_ANNOUNCER );
// }
// else
// {
trap_S_StartLocalSound( skillMenuInfo.silenceSound, CHAN_ANNOUNCER );
// }
}
/*
=================
UI_SPSkillMenu_FightEvent
=================
*/
static void UI_SPSkillMenu_FightEvent( void *ptr, int32_t notification )
{
if (notification != QM_ACTIVATED)
{
return;
}
UI_SPArena_Start( skillMenuInfo.arenaInfo );
}
/*
=================
UI_SPSkillMenu_BackEvent
=================
*/
static void UI_SPSkillMenu_BackEvent( void* ptr, int32_t notification )
{
if (notification != QM_ACTIVATED)
{
return;
}
trap_S_StartLocalSound( skillMenuInfo.silenceSound, CHAN_ANNOUNCER );
UI_PopMenu();
}
/*
=================
UI_SPSkillMenu_MainEvent
=================
*/
static void UI_SPSkillMenu_MainEvent( void* ptr, int32_t notification )
{
if (notification != QM_ACTIVATED)
{
return;
}
UI_PopMenu();
UI_MainMenu();
}
/*
=================
UI_SPSkillMenu_Key
=================
*/
static sfxHandle_t UI_SPSkillMenu_Key( int32_t key )
{
if( key == K_MOUSE2 || key == K_ESCAPE )
{
trap_S_StartLocalSound( skillMenuInfo.silenceSound, CHAN_ANNOUNCER );
}
return Menu_DefaultKey( &skillMenuInfo.menu, key );
}
/*
=================
UI_SPSkillMenu_MenuDraw
=================
*/
static void UI_SPSkillMenu_MenuDraw( void )
{
UI_MenuFrame2(&skillMenuInfo.menu);
trap_R_SetColor( colorTable[CT_LTBROWN1]);
UI_DrawHandlePic(30,203, 47, 186, uis.whiteShader); // Long left column square on bottom 3rd
trap_R_SetColor( colorTable[CT_DKPURPLE2]);
UI_DrawHandlePic( 146, 83, 64, 32, skillMenuInfo.corner_18_50); // UL corner
UI_DrawHandlePic( 479, 83, -64, 32, skillMenuInfo.corner_18_50); // UR corner
UI_DrawHandlePic( 146, 273, 64, -32, skillMenuInfo.corner_18_50); // LL corner
UI_DrawHandlePic( 479, 273, -64, -32, skillMenuInfo.corner_18_50); // LR corner
UI_DrawHandlePic( 156, 83, 377, 18, uis.whiteShader); // Top
UI_DrawHandlePic( 146, 101, 50, 51, uis.whiteShader); // Left top
UI_DrawHandlePic( 146, 155, 50, 90, uis.whiteShader); // Left middle
UI_DrawHandlePic( 146, 248, 50, 39, uis.whiteShader); // Left bottom
UI_DrawHandlePic( 156, 287, 377, 18, uis.whiteShader); // Bottom
UI_DrawHandlePic( 493, 101, 50, 51, uis.whiteShader); // Right top
UI_DrawHandlePic( 493, 155, 50, 90, uis.whiteShader); // Right middle
UI_DrawHandlePic( 493, 248, 50, 39, uis.whiteShader); // Right bottom
UI_DrawProportionalString( 208, 84, menu_normal_text[MNT_SKILLLEVEL],UI_SMALLFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 192, 138, "876-0",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 192, 158, "876-1",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 192, 251, "876-2",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 496, 138, "878-0",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 496, 158, "878-1",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 496, 251, "878-2",UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 73, 130, "323",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 73, 150, "7240",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 73, 206, "1155",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 73, 375, "4550",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString( 73, 395, "533",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
// Left rounded ends for mainmenu and back buttons
trap_R_SetColor( colorTable[skillMenuInfo.mainmenu.color]);
UI_DrawHandlePic(110 - 14, skillMenuInfo.mainmenu.generic.y,
MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
trap_R_SetColor( colorTable[ skillMenuInfo.item_back.color]);
UI_DrawHandlePic(110 - 14, skillMenuInfo.item_back.generic.y,
MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
// standard menu drawing
Menu_Draw( &skillMenuInfo.menu );
}
/*
=================
UI_SPSkillMenu_Cache
=================
*/
void UI_SPSkillMenu_Cache( void )
{
skillMenuInfo.skillpics[0] = trap_R_RegisterShaderNoMip( ART_MAP_COMPLETE1 );
skillMenuInfo.skillpics[1] = trap_R_RegisterShaderNoMip( ART_MAP_COMPLETE2 );
skillMenuInfo.skillpics[2] = trap_R_RegisterShaderNoMip( ART_MAP_COMPLETE3 );
skillMenuInfo.skillpics[3] = trap_R_RegisterShaderNoMip( ART_MAP_COMPLETE4 );
skillMenuInfo.skillpics[4] = trap_R_RegisterShaderNoMip( ART_MAP_COMPLETE5 );
skillMenuInfo.corner_18_50 = trap_R_RegisterShaderNoMip("menu/common/corner_ul_18_50" );
// skillMenuInfo.nightmareSound = trap_S_RegisterSound( "sound/misc/nightmare.wav" );
skillMenuInfo.silenceSound = trap_S_RegisterSound( "sound/silence.wav" );
}
/*
=================
UI_SPSkillMenu_Init
=================
*/
static void UI_SPSkillMenu_Init( void )
{
int32_t skill,x;
memset( &skillMenuInfo, 0, sizeof(skillMenuInfo) );
skillMenuInfo.menu.fullscreen = qtrue;
skillMenuInfo.menu.key = UI_SPSkillMenu_Key;
skillMenuInfo.menu.draw = UI_SPSkillMenu_MenuDraw;
skillMenuInfo.menu.descX = MENU_DESC_X;
skillMenuInfo.menu.descY = MENU_DESC_Y;
skillMenuInfo.menu.titleX = MENU_TITLE_X;
skillMenuInfo.menu.titleY = MENU_TITLE_Y;
skillMenuInfo.menu.titleI = MNT_SINGLEPLAYER_TITLE;
skillMenuInfo.menu.footNoteEnum = MNT_SINGLEPLAYER;
UI_SPSkillMenu_Cache();
x = 280;
skillMenuInfo.item_dotl.generic.type = MTYPE_BITMAP;
skillMenuInfo.item_dotl.generic.name = "menu/common/barbuttonleft.tga";
skillMenuInfo.item_dotl.generic.x = x - 20;
skillMenuInfo.item_dotl.generic.y = skillButtonY[0];
skillMenuInfo.item_dotl.width = MENU_BUTTON_MED_HEIGHT;
skillMenuInfo.item_dotl.height = MENU_BUTTON_MED_HEIGHT;
skillMenuInfo.item_dotl.color = CT_LTGOLD1;
skillMenuInfo.item_dotr.generic.type = MTYPE_BITMAP;
skillMenuInfo.item_dotr.generic.name = "menu/common/barbuttonleft.tga";
skillMenuInfo.item_dotr.generic.x = x + MENU_BUTTON_MED_WIDTH + 2;
skillMenuInfo.item_dotr.generic.y = skillButtonY[0];
skillMenuInfo.item_dotr.width = -MENU_BUTTON_MED_HEIGHT;
skillMenuInfo.item_dotr.height = MENU_BUTTON_MED_HEIGHT;
skillMenuInfo.item_dotr.color = CT_LTGOLD1;
skillMenuInfo.item_baby.generic.type = MTYPE_BITMAP;
skillMenuInfo.item_baby.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
skillMenuInfo.item_baby.generic.name = "menu/common/square.tga";
skillMenuInfo.item_baby.generic.x = x;
skillMenuInfo.item_baby.generic.y = skillButtonY[0];
skillMenuInfo.item_baby.generic.callback = UI_SPSkillMenu_SkillEvent;
skillMenuInfo.item_baby.generic.id = ID_BABY;
skillMenuInfo.item_baby.width = MENU_BUTTON_MED_WIDTH;
skillMenuInfo.item_baby.height = MENU_BUTTON_MED_HEIGHT;
skillMenuInfo.item_baby.color = CT_DKPURPLE1;
skillMenuInfo.item_baby.color2 = CT_LTPURPLE1;
skillMenuInfo.item_baby.textX = MENU_BUTTON_TEXT_X;
skillMenuInfo.item_baby.textY = MENU_BUTTON_TEXT_Y;
skillMenuInfo.item_baby.textEnum = MBT_BABYLEVEL;
skillMenuInfo.item_baby.textcolor = CT_BLACK;
skillMenuInfo.item_baby.textcolor2 = CT_WHITE;
skillMenuInfo.item_easy.generic.type = MTYPE_BITMAP;
skillMenuInfo.item_easy.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
skillMenuInfo.item_easy.generic.name = "menu/common/square.tga";
skillMenuInfo.item_easy.generic.x = x;
skillMenuInfo.item_easy.generic.y = skillButtonY[1];
skillMenuInfo.item_easy.generic.callback = UI_SPSkillMenu_SkillEvent;
skillMenuInfo.item_easy.generic.id = ID_EASY;
skillMenuInfo.item_easy.width = MENU_BUTTON_MED_WIDTH;
skillMenuInfo.item_easy.height = MENU_BUTTON_MED_HEIGHT;
skillMenuInfo.item_easy.color = CT_DKPURPLE1;
skillMenuInfo.item_easy.color2 = CT_LTPURPLE1;
skillMenuInfo.item_easy.textX = MENU_BUTTON_TEXT_X;
skillMenuInfo.item_easy.textY = MENU_BUTTON_TEXT_Y;
skillMenuInfo.item_easy.textEnum = MBT_EASYLEVEL;
skillMenuInfo.item_easy.textcolor = CT_BLACK;
skillMenuInfo.item_easy.textcolor2 = CT_WHITE;
skillMenuInfo.item_medium.generic.type = MTYPE_BITMAP;
skillMenuInfo.item_medium.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
skillMenuInfo.item_medium.generic.name = "menu/common/square.tga";
skillMenuInfo.item_medium.generic.x = x;
skillMenuInfo.item_medium.generic.y = skillButtonY[2];
skillMenuInfo.item_medium.generic.callback = UI_SPSkillMenu_SkillEvent;
skillMenuInfo.item_medium.generic.id = ID_MEDIUM;
skillMenuInfo.item_medium.width = MENU_BUTTON_MED_WIDTH;
skillMenuInfo.item_medium.height = MENU_BUTTON_MED_HEIGHT;
skillMenuInfo.item_medium.color = CT_DKPURPLE1;
skillMenuInfo.item_medium.color2 = CT_LTPURPLE1;
skillMenuInfo.item_medium.textX = MENU_BUTTON_TEXT_X;
skillMenuInfo.item_medium.textY = MENU_BUTTON_TEXT_Y;
skillMenuInfo.item_medium.textEnum = MBT_MEDIUMLEVEL;
skillMenuInfo.item_medium.textcolor = CT_BLACK;
skillMenuInfo.item_medium.textcolor2 = CT_WHITE;
skillMenuInfo.item_hard.generic.type = MTYPE_BITMAP;
skillMenuInfo.item_hard.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
skillMenuInfo.item_hard.generic.name = "menu/common/square.tga";
skillMenuInfo.item_hard.generic.x = x;
skillMenuInfo.item_hard.generic.y = skillButtonY[3];
skillMenuInfo.item_hard.generic.callback = UI_SPSkillMenu_SkillEvent;
skillMenuInfo.item_hard.generic.id = ID_HARD;
skillMenuInfo.item_hard.width = MENU_BUTTON_MED_WIDTH;
skillMenuInfo.item_hard.height = MENU_BUTTON_MED_HEIGHT;
skillMenuInfo.item_hard.color = CT_DKPURPLE1;
skillMenuInfo.item_hard.color2 = CT_LTPURPLE1;
skillMenuInfo.item_hard.textX = MENU_BUTTON_TEXT_X;
skillMenuInfo.item_hard.textY = MENU_BUTTON_TEXT_Y;
skillMenuInfo.item_hard.textEnum = MBT_HARDLEVEL;
skillMenuInfo.item_hard.textcolor = CT_BLACK;
skillMenuInfo.item_hard.textcolor2 = CT_WHITE;
skillMenuInfo.item_nightmare.generic.type = MTYPE_BITMAP;
skillMenuInfo.item_nightmare.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
skillMenuInfo.item_nightmare.generic.name = "menu/common/square.tga";
skillMenuInfo.item_nightmare.generic.x = x;
skillMenuInfo.item_nightmare.generic.y = skillButtonY[4];
skillMenuInfo.item_nightmare.generic.callback = UI_SPSkillMenu_SkillEvent;
skillMenuInfo.item_nightmare.generic.id = ID_NIGHTMARE;
skillMenuInfo.item_nightmare.width = MENU_BUTTON_MED_WIDTH;
skillMenuInfo.item_nightmare.height = MENU_BUTTON_MED_HEIGHT;
skillMenuInfo.item_nightmare.color = CT_DKPURPLE1;
skillMenuInfo.item_nightmare.color2 = CT_LTPURPLE1;
skillMenuInfo.item_nightmare.textX = MENU_BUTTON_TEXT_X;
skillMenuInfo.item_nightmare.textY = MENU_BUTTON_TEXT_Y;
skillMenuInfo.item_nightmare.textEnum = MBT_NIGHTMARELEVEL;
skillMenuInfo.item_nightmare.textcolor = CT_BLACK;
skillMenuInfo.item_nightmare.textcolor2 = CT_WHITE;
skillMenuInfo.mainmenu.generic.type = MTYPE_BITMAP;
skillMenuInfo.mainmenu.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
skillMenuInfo.mainmenu.generic.x = 110;
skillMenuInfo.mainmenu.generic.y = 391;
skillMenuInfo.mainmenu.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
skillMenuInfo.mainmenu.generic.id = ID_MAINMENU;
skillMenuInfo.mainmenu.generic.callback = UI_SPSkillMenu_MainEvent;
skillMenuInfo.mainmenu.width = MENU_BUTTON_MED_WIDTH;
skillMenuInfo.mainmenu.height = MENU_BUTTON_MED_HEIGHT;
skillMenuInfo.mainmenu.color = CT_DKPURPLE1;
skillMenuInfo.mainmenu.color2 = CT_LTPURPLE1;
skillMenuInfo.mainmenu.textX = MENU_BUTTON_TEXT_X;
skillMenuInfo.mainmenu.textY = MENU_BUTTON_TEXT_Y;
skillMenuInfo.mainmenu.textEnum = MBT_MAINMENU;
skillMenuInfo.mainmenu.textcolor = CT_BLACK;
skillMenuInfo.mainmenu.textcolor2 = CT_WHITE;
skillMenuInfo.item_back.generic.type = MTYPE_BITMAP;
skillMenuInfo.item_back.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
skillMenuInfo.item_back.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
skillMenuInfo.item_back.generic.x = 110;
skillMenuInfo.item_back.generic.y = 415;
skillMenuInfo.item_back.generic.callback = UI_SPSkillMenu_BackEvent;
skillMenuInfo.item_back.generic.id = ID_BACK;
skillMenuInfo.item_back.width = MENU_BUTTON_MED_WIDTH;
skillMenuInfo.item_back.height = MENU_BUTTON_MED_HEIGHT;
skillMenuInfo.item_back.color = CT_DKPURPLE1;
skillMenuInfo.item_back.color2 = CT_LTPURPLE1;
skillMenuInfo.item_back.textX = MENU_BUTTON_TEXT_X;
skillMenuInfo.item_back.textY = MENU_BUTTON_TEXT_Y;
skillMenuInfo.item_back.textEnum = MBT_BACK;
skillMenuInfo.item_back.textcolor = CT_BLACK;
skillMenuInfo.item_back.textcolor2 = CT_WHITE;
skillMenuInfo.item_fight.generic.type = MTYPE_BITMAP;
skillMenuInfo.item_fight.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
skillMenuInfo.item_fight.generic.name = "menu/common/square.tga";
skillMenuInfo.item_fight.generic.x = 462;
skillMenuInfo.item_fight.generic.y = 391;
skillMenuInfo.item_fight.generic.callback = UI_SPSkillMenu_FightEvent;
skillMenuInfo.item_fight.generic.id = ID_FIGHT;
skillMenuInfo.item_fight.width = 150;
skillMenuInfo.item_fight.height = 42;
skillMenuInfo.item_fight.color = CT_DKPURPLE1;
skillMenuInfo.item_fight.color2 = CT_LTPURPLE1;
skillMenuInfo.item_fight.textX = MENU_BUTTON_TEXT_X;
skillMenuInfo.item_fight.textY = MENU_BUTTON_TEXT_Y;
skillMenuInfo.item_fight.textEnum = MBT_ENGAGE;
skillMenuInfo.item_fight.textcolor = CT_BLACK;
skillMenuInfo.item_fight.textcolor2 = CT_WHITE;
skillMenuInfo.art_skillPic.generic.type = MTYPE_BITMAP;
skillMenuInfo.art_skillPic.generic.flags = QMF_CENTER_JUSTIFY|QMF_INACTIVE;
skillMenuInfo.art_skillPic.generic.x = 354;
skillMenuInfo.art_skillPic.generic.y = 324;
skillMenuInfo.art_skillPic.width = 128;
skillMenuInfo.art_skillPic.height = 96;
Menu_AddItem( &skillMenuInfo.menu, ( void * )&skillMenuInfo.item_dotl );
Menu_AddItem( &skillMenuInfo.menu, ( void * )&skillMenuInfo.item_dotr );
Menu_AddItem( &skillMenuInfo.menu, ( void * )&skillMenuInfo.item_baby );
Menu_AddItem( &skillMenuInfo.menu, ( void * )&skillMenuInfo.item_easy );
Menu_AddItem( &skillMenuInfo.menu, ( void * )&skillMenuInfo.item_medium );
Menu_AddItem( &skillMenuInfo.menu, ( void * )&skillMenuInfo.item_hard );
Menu_AddItem( &skillMenuInfo.menu, ( void * )&skillMenuInfo.item_nightmare );
Menu_AddItem( &skillMenuInfo.menu, ( void * )&skillMenuInfo.art_skillPic );
Menu_AddItem( &skillMenuInfo.menu, ( void * )&skillMenuInfo.mainmenu );
Menu_AddItem( &skillMenuInfo.menu, ( void * )&skillMenuInfo.item_back );
Menu_AddItem( &skillMenuInfo.menu, ( void * )&skillMenuInfo.item_fight );
skill = (int32_t)Com_Clamp( 1, 5, trap_Cvar_VariableValue( "g_spSkill" ) );
SetSkillColor( skill, CT_DKPURPLE1 );
skillMenuInfo.art_skillPic.shader = skillMenuInfo.skillpics[skill - 1];
skillMenuInfo.item_dotl.generic.y= skillButtonY[skill-1];
skillMenuInfo.item_dotr.generic.y= skillButtonY[skill-1];
}
/*
=================
UI_SPSkillMenu
=================
*/
void UI_SPSkillMenu( const char *arenaInfo )
{
UI_SPSkillMenu_Init();
skillMenuInfo.arenaInfo = arenaInfo;
UI_PushMenu( &skillMenuInfo.menu );
Menu_SetCursorToItem( &skillMenuInfo.menu, &skillMenuInfo.item_fight );
}

View file

@ -5,6 +5,7 @@
**********************************************************************/
#include "ui_local.h"
#include "ui_logger.h"
typedef struct {
menuframework_s menu;
@ -30,6 +31,8 @@ M_sql_Event
static void M_sql_Event(void *ptr, int32_t notification) {
int32_t id;
UI_LogFuncBegin();
id = ((menucommon_s*)ptr)->id;
switch (id)
@ -47,6 +50,7 @@ static void M_sql_Event(void *ptr, int32_t notification) {
default:
break;
}
UI_LogFuncEnd();
}
/*
@ -70,6 +74,7 @@ M_sqlMenu_Graphics
*/
static void M_sqlMenu_Graphics (void)
{
UI_LogFuncBegin();
float bg[] = { 0, 0, 0, 0.7 };
trap_R_SetColor(bg);
@ -87,6 +92,7 @@ static void M_sqlMenu_Graphics (void)
UI_DrawString(234, 132, "LCARS AUTH", UI_LEFT|UI_SMALLFONT, colorTable[CT_BLACK], qtrue); // TODO multi lang text
// TODO
UI_LogFuncEnd();
}
/*
@ -96,8 +102,10 @@ UI_sqlMenu_Cache
*/
void UI_sqlMenu_Cache (void)
{
UI_LogFuncBegin();
box_rounded = trap_R_RegisterShaderNoMip("menu/common/box_rounded.tga");
corner_lu = trap_R_RegisterShaderNoMip("menu/common/corner_lu.tga");
UI_LogFuncEnd();
}
/*
@ -107,10 +115,12 @@ sqlMenu_Draw
*/
static void sqlMenu_Draw(void)
{
UI_LogFuncBegin();
// Draw graphics particular to Main Menu
M_sqlMenu_Graphics();
Menu_Draw( &s_sql.menu );
UI_LogFuncEnd();
}
/*
@ -120,6 +130,7 @@ msdMenu_Init
*/
void sqlMenu_Init(void)
{
UI_LogFuncBegin();
s_sql.menu.nitems = 0;
s_sql.menu.draw = sqlMenu_Draw;
s_sql.menu.key = sqlMenu_Key;
@ -181,6 +192,7 @@ void sqlMenu_Init(void)
Menu_AddItem( &s_sql.menu, &s_sql.quitmenu );
Menu_AddItem( &s_sql.menu, &s_sql.login );
Menu_AddItem( &s_sql.menu, &s_sql.user);
UI_LogFuncEnd();
}
/*
@ -189,6 +201,7 @@ UI_sqlMenu
===============
*/
void UI_sqlMenu(void) {
UI_LogFuncBegin();
memset( &s_sql, 0, sizeof( s_sql ) );
uis.menusp = 0;
@ -203,5 +216,6 @@ void UI_sqlMenu(void) {
UI_PushMenu( &s_sql.menu );
Menu_AdjustCursor( &s_sql.menu, 1 );
Menu_AdjustCursor( &s_sql.menu, 1 );
UI_LogFuncEnd();
}

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@
User interface trigger from within game
**********************************************************************/
#include "ui_local.h"
#include "ui_logger.h"
typedef struct {
char weaponName[MAX_QPATH];
@ -58,6 +59,8 @@ static void M_Tactical_Event (void* ptr, int32_t notification) {
int32_t id;
menubitmap_s *holdWeapon;
UI_LogFuncBegin();
id = ((menucommon_s*)ptr)->id;
switch(id)
@ -96,6 +99,7 @@ static void M_Tactical_Event (void* ptr, int32_t notification) {
}
break;
}
UI_LogFuncEnd();
}
/*
@ -122,6 +126,8 @@ M_TacticalMenu_Graphics
static void M_TacticalMenu_Graphics (void) {
menubitmap_s *holdWeapon;
UI_LogFuncBegin();
vec4_t bgColor = { 0.1, 0.1, 0.1, .75 };
// background
@ -135,6 +141,7 @@ static void M_TacticalMenu_Graphics (void) {
trap_R_SetColor(colorTable[CT_DKPURPLE1]);
UI_DrawHandlePic(151, 376, 75, 50, corner_tact_ul);
UI_DrawHandlePic(218, 376, 270, 28, uis.whiteShader);
UI_LogFuncEnd();
}
/*
@ -144,10 +151,12 @@ TacticalMenu_Draw
*/
static void TacticalMenu_Draw(void)
{
UI_LogFuncBegin();
// Draw graphics particular to Main Menu
M_TacticalMenu_Graphics();
Menu_Draw( &s_tactical.menu );
UI_LogFuncEnd();
}
/*
@ -157,12 +166,14 @@ UI_TacticalMenu_Cache
*/
void UI_TacticalMenu_Cache (void)
{
UI_LogFuncBegin();
leftRound = trap_R_RegisterShaderNoMip("menu/common/halfroundl_24.tga");
tactical = trap_R_RegisterShaderNoMip("menu/common/lift_button.tga");
square_rl = trap_R_RegisterShaderNoMip("menu/common/square_rounded_left.tga");
square_rr = trap_R_RegisterShaderNoMip("menu/common/square_rounded_right.tga");
corner_tact_ll = trap_R_RegisterShaderNoMip("menu/common/corner_tact_ll.tga");
corner_tact_ul = trap_R_RegisterShaderNoMip("menu/common/corner_ul_18_50.tga");
UI_LogFuncEnd();
}
static void UI_TacticalMenu_LoadWeapons( void )
@ -171,13 +182,16 @@ static void UI_TacticalMenu_LoadWeapons( void )
int32_t i;
char *temp;
UI_LogFuncBegin();
s_tactical.numWeapons = 0;
//load the string
trap_GetConfigString( CS_TACTICAL_DATA, buffer, sizeof( buffer ) );
if ( !buffer[0] )
if ( !buffer[0] ){
UI_LogFuncEnd();
return;
}
memset( &s_tactical.weaponData, 0, sizeof( s_tactical.weaponData ) );
@ -196,6 +210,7 @@ static void UI_TacticalMenu_LoadWeapons( void )
s_tactical.numWeapons++;
}
UI_LogFuncEnd();
}
static void UI_ManageWeaponLoading( void )
@ -209,6 +224,7 @@ static void UI_ManageWeaponLoading( void )
char buffer[20000];
char *token;
UI_LogFuncBegin();
//get the map name
trap_GetConfigString( CS_SERVERINFO, info, sizeof( info ) );
Com_sprintf( mapRoute, sizeof( fileRoute ), "maps/%s", Info_ValueForKey( info, "mapname" ) );
@ -222,6 +238,7 @@ static void UI_ManageWeaponLoading( void )
{
//Com_Printf( S_COLOR_YELLOW "WARNING: Attempted to load %s, but wasn't found.\n", fileRoute );
UI_TacticalMenu_LoadWeapons();
UI_LogFuncEnd();
return;
}
@ -232,6 +249,7 @@ static void UI_ManageWeaponLoading( void )
{
Com_Printf( S_COLOR_RED "ERROR: Attempted to load %s, but no data was read.\n", fileRoute );
UI_TacticalMenu_LoadWeapons();
UI_LogFuncEnd();
return;
}
@ -278,6 +296,7 @@ static void UI_ManageWeaponLoading( void )
}
UI_LogFuncEnd();
}
/*
@ -291,6 +310,7 @@ void TacticalMenu_Init(void)
menubitmap_s *holdWeapon;
int32_t i,width;
UI_LogFuncBegin();
UI_ManageWeaponLoading();
s_tactical.menu.fullscreen = qfalse;
@ -393,6 +413,7 @@ void TacticalMenu_Init(void)
}
holdWeapon++;
}
UI_LogFuncEnd();
}
/*
@ -402,6 +423,7 @@ UI_TacticalMenu
*/
void UI_TacticalMenu ( void )
{
UI_LogFuncBegin();
memset( &s_tactical, 0, sizeof( s_tactical ) );
uis.menusp = 0;
@ -417,4 +439,5 @@ void UI_TacticalMenu ( void )
UI_PushMenu( &s_tactical.menu );
Menu_AdjustCursor( &s_tactical.menu, 1 );
UI_LogFuncEnd();
}

View file

@ -1,549 +0,0 @@
//// Copyright (C) 1999-2000 Id Software, Inc.
////
////
//// ui_team.c
////
//
#include "ui_local.h"
//
//#define ID_INGAMEMENU 50
//#define ID_JOINRED 100
//#define ID_JOINBLUE 101
//#define ID_JOINAUTO 102
//#define ID_JOINGAME 103
//#define ID_SPECTATE 104
//#define ID_PLAYERCLASS 105
//
////RPG-X: RedTechie - RPG-X Enhanced
//static int32_t player_classes[] =
//{
// MNT_PC_INFILTRATOR,//RPG-X: RedTechie - Security
// MNT_PC_SNIPER,//RPG-X: RedTechie - Medical
// MNT_PC_HEAVY,//RPG-X: RedTechie - ALIEN
// MNT_PC_DEMO,//RPG-X: RedTechie - Command
// MNT_PC_MEDIC,//RPG-X: RedTechie - Science
// MNT_PC_TECH,//RPG-X: RedTechie - Engineer
// MNT_PC_NOCLASS,
// MNT_PC_ALPHAOMEGA22,
// MNT_PC_N00B,
// 0
//};
//
////RPG-X: RedTechie - Not needed anymore
///*static int32_t player_classes2[] =
//{
// MNT_PC_INFILTRATOR,//RPG-X: RedTechie - Security
// MNT_PC_SNIPER,//RPG-X: RedTechie - Medical
// MNT_PC_HEAVY,//RPG-X: RedTechie - ALIEN
// MNT_PC_DEMO,//RPG-X: RedTechie - Command
// MNT_PC_MEDIC,//RPG-X: RedTechie - Science
// MNT_PC_TECH,//RPG-X: RedTechie - Engineer
// MNT_ACTIONHERO,
// MNT_PC_BORG,
// MNT_PC_NOCLASS,
// MNT_PC_ALPHAOMEGA22,
// MNT_PC_N00B,
// 0
//};*/
//
////RPG-X: RedTechie - RPG-X Enhanced
//// Class Text enum
//typedef enum
//{
// TM_INFILTRATOR,//RPG-X: RedTechie - Security
// TM_SNIPER,//RPG-X: RedTechie - Medical
// TM_HEAVY,//RPG-X: RedTechie - ALIEN
// TM_DEMO,//RPG-X: RedTechie - Command
// TM_MEDIC,//RPG-X: RedTechie - Science
// TM_TECH,//RPG-X: RedTechie - Engineer
// //TM_ACTIONHERO,
// //TM_BORG,
// TM_NOCLASS,
// TM_ALPHAOMEGA22,
// TM_N00B
//} teamClassType_t;
//
//
//
//
//typedef struct
//{
// menuframework_s menu;
// menubitmap_s ingamemenu;
// menubitmap_s joinred;
// menubitmap_s joinblue;
// menubitmap_s joinauto;
// menubitmap_s joingame;
// menubitmap_s spectate;
// menulist_s playerClass;
// int32_t holdClass;
// qhandle_t pClassShaders[NUM_PLAYER_CLASSES];
//} teammain_t;
//
//static teammain_t s_teammain;
//
//static void UpdatePlayerClass(void)
//{
// // Hasn't changed so don't do anything
// if (s_teammain.holdClass == s_teammain.playerClass.curvalue)
// {
// return;
// }
//
//
// switch( s_teammain.playerClass.curvalue )
// {
// case TM_NOCLASS:
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd class noclass\n" );
// break;
// case TM_INFILTRATOR:
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd class security\n" );
// break;
// case TM_SNIPER:
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd class medical\n" );
// break;
// case TM_HEAVY:
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd class alien\n" );
// break;
// case TM_DEMO:
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd class command\n" );
// break;
// case TM_MEDIC:
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd class science\n" );
// break;
// case TM_TECH:
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd class engineer\n" );
// break;
// case TM_ALPHAOMEGA22:
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd class marine\n" );
// break;
// case TM_N00B:
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd class n00b\n" );
// break;
// /*case TM_BORG:
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd class Borg\n" );
// break;
// case TM_ACTIONHERO:
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd class Hero\n" );
// break;*/
// //break;
// }
//
//
//}
//
///*
//===============
//TeamMain_MenuEvent
//===============
//*/
//static void TeamMain_MenuEvent( void* ptr, int32_t event )
//{
// if( event != QM_ACTIVATED )
// {
// return;
// }
//
// switch( ((menucommon_s*)ptr)->id )
// {
// case ID_INGAMEMENU:
// UpdatePlayerClass();
// UI_PopMenu();
// break;
// case ID_JOINRED:
// UpdatePlayerClass();
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd team red\n" );
// UI_ForceMenuOff();
// break;
//
// case ID_JOINBLUE:
// UpdatePlayerClass();
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd team blue\n" );
// UI_ForceMenuOff();
// break;
//
// case ID_JOINAUTO:
// UpdatePlayerClass();
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd team auto\n" );
// UI_ForceMenuOff();
// break;
//
// case ID_PLAYERCLASS:
// break;
//
// case ID_JOINGAME:
// UpdatePlayerClass();
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd team free\n" );
// UI_ForceMenuOff();
// break;
//
// case ID_SPECTATE:
// trap_Cmd_ExecuteText( EXEC_APPEND, "cmd team spectator\n" );
// UI_ForceMenuOff();
// break;
//
// }
//}
//
///*
//=================
//UI_TeamMainMenu_Draw
//=================
//*/
//static void UI_TeamMainMenu_Draw( void )
//{
// UI_MenuFrame(&s_teammain.menu);
//
// trap_R_SetColor( colorTable[CT_LTBROWN1]);
// UI_DrawHandlePic(30,203, 47, 186, uis.whiteShader); // Long left column square on bottom 3rd
//
//
// trap_R_SetColor( colorTable[CT_WHITE]);
// UI_DrawHandlePic(s_teammain.playerClass.generic.x + 160, s_teammain.playerClass.generic.y,
// MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, s_teammain.pClassShaders[s_teammain.playerClass.curvalue]);
//
// // Left rounded ends for buttons
// trap_R_SetColor( colorTable[CT_DKPURPLE1]);
// UI_DrawHandlePic(s_teammain.joinred.generic.x - 14, s_teammain.joinred.generic.y,
// MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
//
// UI_DrawHandlePic(s_teammain.joinblue.generic.x - 14, s_teammain.joinblue.generic.y,
// MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
//
// UI_DrawHandlePic(s_teammain.joinauto.generic.x - 14, s_teammain.joinauto.generic.y,
// MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
//
// UI_DrawHandlePic(s_teammain.joingame.generic.x - 14, s_teammain.joingame.generic.y,
// MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
//
// UI_DrawHandlePic(s_teammain.spectate.generic.x - 14, s_teammain.spectate.generic.y,
// MENU_BUTTON_MED_HEIGHT, MENU_BUTTON_MED_HEIGHT, uis.graphicButtonLeftEnd);
//
// // standard menu drawing
// Menu_Draw( &s_teammain.menu );
//
//}
//
//static sfxHandle_t TeamMenu_MenuKey( int32_t key )
//{
// switch (key)
// {
// case K_ESCAPE:
// UpdatePlayerClass();
// break;
// default :
// goto ignorekey;
// }
//
//ignorekey:
// return Menu_DefaultKey( &s_teammain.menu, key );
//}
//
//void SetServerButtons(int32_t gameType,menulist_s *assimilation,menulist_s *specialties,menulist_s *disintegration,menulist_s *elimination,menulist_s *actionhero);
//
///*
//===============
//TeamMain_MenuInit
//===============
//*/
//void TeamMain_MenuInit( void )
//{
// int32_t y,pad,x;
// int32_t gametype;
// char info[MAX_INFO_STRING];
//
// memset( &s_teammain, 0, sizeof(s_teammain) );
//
// TeamMain_Cache();
//
// trap_GetConfigString(CS_SERVERINFO, info, MAX_INFO_STRING);
//
// s_teammain.menu.wrapAround = qtrue;
// s_teammain.menu.fullscreen = qtrue;
// s_teammain.menu.descX = MENU_DESC_X;
// s_teammain.menu.descY = MENU_DESC_Y;
// s_teammain.menu.draw = UI_TeamMainMenu_Draw;
// s_teammain.menu.key = TeamMenu_MenuKey;
// s_teammain.menu.titleX = MENU_TITLE_X;
// s_teammain.menu.titleY = MENU_TITLE_Y;
// s_teammain.menu.titleI = MNT_TEAMMENU_TITLE;
// s_teammain.menu.footNoteEnum = MNT_TEAM_MENU;
//
// s_teammain.ingamemenu.generic.type = MTYPE_BITMAP;
// s_teammain.ingamemenu.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
// s_teammain.ingamemenu.generic.x = 482;
// s_teammain.ingamemenu.generic.y = 136;
// s_teammain.ingamemenu.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
// s_teammain.ingamemenu.generic.id = ID_INGAMEMENU;
// s_teammain.ingamemenu.generic.callback = TeamMain_MenuEvent;
// s_teammain.ingamemenu.width = MENU_BUTTON_MED_WIDTH;
// s_teammain.ingamemenu.height = MENU_BUTTON_MED_HEIGHT;
// s_teammain.ingamemenu.color = CT_DKPURPLE1;
// s_teammain.ingamemenu.color2 = CT_LTPURPLE1;
// s_teammain.ingamemenu.textX = 5;
// s_teammain.ingamemenu.textY = 2;
// s_teammain.ingamemenu.textEnum = MBT_INGAMEMENU;
// s_teammain.ingamemenu.textcolor = CT_BLACK;
// s_teammain.ingamemenu.textcolor2 = CT_WHITE;
//
// y = 200;
// x = 290;
// s_teammain.joinred.generic.type = MTYPE_BITMAP;
// s_teammain.joinred.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
// s_teammain.joinred.generic.x = x;
// s_teammain.joinred.generic.y = y;
// s_teammain.joinred.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
// s_teammain.joinred.generic.id = ID_JOINRED;
// s_teammain.joinred.generic.callback = TeamMain_MenuEvent;
// s_teammain.joinred.width = MENU_BUTTON_MED_WIDTH;
// s_teammain.joinred.height = MENU_BUTTON_MED_HEIGHT;
// s_teammain.joinred.color = CT_DKPURPLE1;
// s_teammain.joinred.color2 = CT_LTPURPLE1;
// s_teammain.joinred.textX = MENU_BUTTON_TEXT_X;
// s_teammain.joinred.textY = MENU_BUTTON_TEXT_Y;
// s_teammain.joinred.textEnum = MBT_REDTEAM;
// s_teammain.joinred.textcolor = CT_BLACK;
// s_teammain.joinred.textcolor2 = CT_WHITE;
//
// pad = 36;
// y += pad;
// s_teammain.joinblue.generic.type = MTYPE_BITMAP;
// s_teammain.joinblue.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
// s_teammain.joinblue.generic.x = x;
// s_teammain.joinblue.generic.y = y;
// s_teammain.joinblue.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
// s_teammain.joinblue.generic.id = ID_JOINBLUE;
// s_teammain.joinblue.generic.callback = TeamMain_MenuEvent;
// s_teammain.joinblue.width = MENU_BUTTON_MED_WIDTH;
// s_teammain.joinblue.height = MENU_BUTTON_MED_HEIGHT;
// s_teammain.joinblue.color = CT_DKPURPLE1;
// s_teammain.joinblue.color2 = CT_LTPURPLE1;
// s_teammain.joinblue.textX = MENU_BUTTON_TEXT_X;
// s_teammain.joinblue.textY = MENU_BUTTON_TEXT_Y;
// s_teammain.joinblue.textEnum = MBT_BLUETEAM;
// s_teammain.joinblue.textcolor = CT_BLACK;
// s_teammain.joinblue.textcolor2 = CT_WHITE;
//
// y += pad;
// s_teammain.joinauto.generic.type = MTYPE_BITMAP;
// s_teammain.joinauto.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
// s_teammain.joinauto.generic.x = x;
// s_teammain.joinauto.generic.y = y;
// s_teammain.joinauto.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
// s_teammain.joinauto.generic.id = ID_JOINAUTO;
// s_teammain.joinauto.generic.callback = TeamMain_MenuEvent;
// s_teammain.joinauto.width = MENU_BUTTON_MED_WIDTH;
// s_teammain.joinauto.height = MENU_BUTTON_MED_HEIGHT;
// s_teammain.joinauto.color = CT_DKPURPLE1;
// s_teammain.joinauto.color2 = CT_LTPURPLE1;
// s_teammain.joinauto.textX = MENU_BUTTON_TEXT_X;
// s_teammain.joinauto.textY = MENU_BUTTON_TEXT_Y;
// s_teammain.joinauto.textEnum = MBT_AUTOTEAM;
// s_teammain.joinauto.textcolor = CT_BLACK;
// s_teammain.joinauto.textcolor2 = CT_WHITE;
//
// y += pad;
// s_teammain.playerClass.generic.type = MTYPE_SPINCONTROL;
// s_teammain.playerClass.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
// s_teammain.playerClass.generic.x = x - 14;
// s_teammain.playerClass.generic.y = y;
// s_teammain.playerClass.generic.name = GRAPHIC_SQUARE;
// s_teammain.playerClass.generic.id = ID_PLAYERCLASS;
// s_teammain.playerClass.generic.callback = TeamMain_MenuEvent;
// s_teammain.playerClass.color = CT_DKPURPLE1;
// s_teammain.playerClass.color2 = CT_LTPURPLE1;
// s_teammain.playerClass.textX = MENU_BUTTON_TEXT_X;
// s_teammain.playerClass.textY = MENU_BUTTON_TEXT_Y;
// s_teammain.playerClass.textEnum = MBT_PLAYERCLASS;
// s_teammain.playerClass.textcolor = CT_BLACK;
// s_teammain.playerClass.textcolor2 = CT_WHITE;
//
// // If assimilation is on then use player_class2 which includes Borg as a class
///* if (atoi( Info_ValueForKey( info, "g_pModAssimilation" )) == 0)
// {
// s_teammain.playerClass.listnames = player_classes;
// }
// else
// {
// s_teammain.playerClass.listnames = player_classes2;
// }
//*/
//
// /*if (atoi( Info_ValueForKey( info, "g_pModSpecialties" )) == 0)
// {
// s_teammain.playerClass.generic.flags |= QMF_GRAYED;
// s_teammain.playerClass.listnames = player_classes2;
// }
// else
// {
// s_teammain.playerClass.listnames = player_classes;
// }*/
//
// //RPG-X: RedTechie - Originaly was trying to grey out menu if n00b but this just remberes so nexts time they connect its still greyed out ROFL
// /*if (!Q_stricmp( ui_playerClass.string, "N00B" ))
// {
// s_teammain.playerClass.generic.flags |= QMF_GRAYED;
// s_teammain.playerClass.listnames = player_classes;
// }
// else
// {*/
// s_teammain.playerClass.listnames = player_classes;
// /*}*/
//
// s_teammain.playerClass.listX = 188;
//
// y += pad;
// s_teammain.joingame.generic.type = MTYPE_BITMAP;
// s_teammain.joingame.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
// s_teammain.joingame.generic.x = x;
// s_teammain.joingame.generic.y = y;
// s_teammain.joingame.generic.id = ID_JOINGAME;
// s_teammain.joingame.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
// s_teammain.joingame.generic.callback = TeamMain_MenuEvent;
// s_teammain.joingame.width = MENU_BUTTON_MED_WIDTH;
// s_teammain.joingame.height = MENU_BUTTON_MED_HEIGHT;
// s_teammain.joingame.color = CT_DKPURPLE1;
// s_teammain.joingame.color2 = CT_LTPURPLE1;
// s_teammain.joingame.textX = MENU_BUTTON_TEXT_X;
// s_teammain.joingame.textY = MENU_BUTTON_TEXT_Y;
// s_teammain.joingame.textEnum = MBT_JOINMATCH;
// s_teammain.joingame.textcolor = CT_BLACK;
// s_teammain.joingame.textcolor2 = CT_WHITE;
//
// y += pad;
// s_teammain.spectate.generic.type = MTYPE_BITMAP;
// s_teammain.spectate.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
// s_teammain.spectate.generic.x = x;
// s_teammain.spectate.generic.y = y;
// s_teammain.spectate.generic.id = ID_SPECTATE;
// s_teammain.spectate.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
// s_teammain.spectate.generic.callback = TeamMain_MenuEvent;
// s_teammain.spectate.width = MENU_BUTTON_MED_WIDTH;
// s_teammain.spectate.height = MENU_BUTTON_MED_HEIGHT;
// s_teammain.spectate.color = CT_DKPURPLE1;
// s_teammain.spectate.color2 = CT_LTPURPLE1;
// s_teammain.spectate.textX = MENU_BUTTON_TEXT_X;
// s_teammain.spectate.textY = MENU_BUTTON_TEXT_Y;
// s_teammain.spectate.textEnum = MBT_OBSERVER;
// s_teammain.spectate.textcolor = CT_BLACK;
// s_teammain.spectate.textcolor2 = CT_WHITE;
//
//
// gametype = atoi( Info_ValueForKey( info,"g_gametype" ) );
//
// // set initial states
// switch( gametype )
// {
// case GT_SINGLE_PLAYER:
// case GT_FFA:
// case GT_TOURNAMENT:
// s_teammain.joinred.generic.flags |= QMF_GRAYED;
// s_teammain.joinblue.generic.flags |= QMF_GRAYED;
// s_teammain.joinauto.generic.flags |= QMF_GRAYED;
//// s_teammain.playerClass.generic.flags |= QMF_GRAYED;
// break;
//
// default:
// case GT_TEAM:
// case GT_CTF:
// s_teammain.joingame.generic.flags |= QMF_GRAYED;
// break;
// }
//
//
// Menu_AddItem( &s_teammain.menu, (void*) &s_teammain.ingamemenu );
// Menu_AddItem( &s_teammain.menu, (void*) &s_teammain.joinred );
// Menu_AddItem( &s_teammain.menu, (void*) &s_teammain.joinblue );
// Menu_AddItem( &s_teammain.menu, (void*) &s_teammain.joinauto );
// Menu_AddItem( &s_teammain.menu, (void*) &s_teammain.playerClass );
// Menu_AddItem( &s_teammain.menu, (void*) &s_teammain.joingame );
// Menu_AddItem( &s_teammain.menu, (void*) &s_teammain.spectate );
//
// // Set up current value based on class
// if ( !Q_stricmp( ui_playerClass.string, "NOCLASS" ) )
// {
// s_teammain.playerClass.curvalue = TM_NOCLASS;
// }
// else if ( !Q_stricmp( ui_playerClass.string, "SECURITY" ) )
// {
// s_teammain.playerClass.curvalue = TM_INFILTRATOR;
// }
// else if ( !Q_stricmp( ui_playerClass.string, "MEDICAL" ) )
// {
// s_teammain.playerClass.curvalue = TM_SNIPER;
// }
// else if ( !Q_stricmp( ui_playerClass.string, "ALIEN" ) )
// {
// s_teammain.playerClass.curvalue = TM_HEAVY;
// }
// else if ( !Q_stricmp( ui_playerClass.string, "COMMAND" ) )
// {
// s_teammain.playerClass.curvalue = TM_DEMO;
// }
// else if ( !Q_stricmp( ui_playerClass.string, "SCIENCE" ) )
// {
// s_teammain.playerClass.curvalue = TM_MEDIC;
// }
// else if ( !Q_stricmp( ui_playerClass.string, "ENGINEER" ) )
// {
// s_teammain.playerClass.curvalue = TM_TECH;
// }
// else if ( !Q_stricmp( ui_playerClass.string, "MARINE" ) )
// {
// s_teammain.playerClass.curvalue = TM_ALPHAOMEGA22;
// }
// else if ( !Q_stricmp( ui_playerClass.string, "N00B" ) )
// {
// s_teammain.playerClass.curvalue = TM_N00B;
// }
// else
// {
// /*else if ( !Q_stricmp( ui_playerClass.string, "BORG" ) )
// {
// s_teammain.playerClass.curvalue = TM_BORG;
// }
// else if ( !Q_stricmp( ui_playerClass.string, "HERO" ) )
// {
// s_teammain.playerClass.curvalue = TM_ACTIONHERO;
// }
// else
// {*/
// s_teammain.playerClass.curvalue = TM_NOCLASS;
// }
//
// s_teammain.holdClass = s_teammain.playerClass.curvalue;
//
//}
//
//
///*
//===============
//TeamMain_Cache
//===============
//*/
//void TeamMain_Cache( void )
//{
// s_teammain.pClassShaders[TM_NOCLASS] = trap_R_RegisterShaderNoMip( "menu/art/pc_noclass.tga" );//PC_NOCLASS,
// s_teammain.pClassShaders[TM_INFILTRATOR] = trap_R_RegisterShaderNoMip( "menu/art/pc_security.tga" );//PC_INFILTRATOR,//fast, low attack
// s_teammain.pClassShaders[TM_SNIPER] = trap_R_RegisterShaderNoMip( "menu/art/pc_medical.tga" );//PC_SNIPER,//sneaky, snipe only
// s_teammain.pClassShaders[TM_HEAVY] = trap_R_RegisterShaderNoMip( "menu/art/pc_alien.tga" );//PC_HEAVY,//slow, heavy attack
// s_teammain.pClassShaders[TM_DEMO] = trap_R_RegisterShaderNoMip( "menu/art/pc_command.tga" );//PC_DEMO,//go boom
// s_teammain.pClassShaders[TM_MEDIC] = trap_R_RegisterShaderNoMip( "menu/art/pc_science.tga" );//PC_MEDIC,//heal
// s_teammain.pClassShaders[TM_TECH] = trap_R_RegisterShaderNoMip( "menu/art/pc_engineer.tga" );//PC_TECH,//operate
// s_teammain.pClassShaders[TM_ALPHAOMEGA22] = trap_R_RegisterShaderNoMip( "menu/art/pc_marine.tga" );//PC_MEDIC,//heal
// s_teammain.pClassShaders[TM_N00B] = trap_R_RegisterShaderNoMip( "menu/art/pc_n00b.tga" );//PC_TECH,//operate
// /*s_teammain.pClassShaders[TM_BORG] = trap_R_RegisterShaderNoMip( "menu/art/pc_borg.tga" );//PC_BORG,//special weapons, slower, adapting shields
// s_teammain.pClassShaders[TM_ACTIONHERO] = trap_R_RegisterShaderNoMip( "menu/art/pc_hero.tga" );//PC_ACTIONHERO,//has everything*/
//}
//
//
///*
//===============
//UI_TeamMainMenu
//===============
//*/
//void UI_TeamMainMenu( void )
//{
// TeamMain_MenuInit();
// UI_PushMenu ( &s_teammain.menu );
//}

View file

@ -1,506 +0,0 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
/*
=======================================================================
TEAM ORDERS MENU
=======================================================================
*/
#include "ui_local.h"
#define ID_LIST_BOTS 10
#define ID_LIST_CTF_ORDERS 11
#define ID_LIST_TEAM_ORDERS 12
typedef struct {
menuframework_s menu;
menulist_s list;
menubitmap_s back;
int32_t gametype;
int32_t numBots;
int32_t selectedBot;
char *bots[9];
char botNames[9][16];
} teamOrdersMenuInfo_t;
static teamOrdersMenuInfo_t teamOrdersMenuInfo;
#define NUM_CTF_ORDERS 7
//you can translate this list
/*
static const char *ctfOrders[] =
{
"I Am the Leader",
"Defend the Base",
"Follow Me",
"Get Enemy Flag",
"Camp Here",
"Report",
"I Relinquish Command"
};
*/
//you can translate this list
static int32_t ctfOrders[] =
{
MNT_ORDER_IMLEADER,
MNT_ORDER_DEFEND,
MNT_ORDER_FOLLOW,
MNT_ORDER_GETFLAG,
MNT_ORDER_CAMP,
MNT_ORDER_REPORT,
MNT_ORDER_IRELINQUISH,
MNT_NONE
};
//!! Cannot translate these !!
static const char *ctfMessages[] =
{
"i am the leader",
"%s defend the base",
"%s follow me",
"%s get enemy flag",
"%s camp here",
"%s report",
"i stop being the leader",
NULL
};
#define NUM_TEAM_ORDERS 6
//you can translate this list
/*
static const char *teamOrders[] =
{
"I Am the Leader",
"Follow Me",
"Roam"
"Camp Here",
"Report",
"I Relinquish Command"
};
*/
int32_t teamOrders[] =
{
MNT_ORDER_IMLEADER,
MNT_ORDER_FOLLOW,
MNT_ORDER_ROAM,
MNT_ORDER_CAMP,
MNT_ORDER_REPORT,
MNT_ORDER_IRELINQUISH,
MNT_NONE
};
//!! Cannot translate these !!
static const char *teamMessages[] =
{
"i am the leader",
"%s follow me",
"%s roam",
"%s camp here",
"%s report",
"i stop being the leader",
NULL
};
/*
===============
UI_TeamOrdersMenu_BackEvent
===============
*/
static void UI_TeamOrdersMenu_BackEvent( void *ptr, int32_t event ) {
if( event != QM_ACTIVATED ) {
return;
}
UI_PopMenu();
}
/*
===============
UI_TeamOrdersMenu_SetList
===============
*/
static void UI_TeamOrdersMenu_SetList( int32_t id ) {
switch( id ) {
default:
case ID_LIST_BOTS:
teamOrdersMenuInfo.list.generic.id = id;
teamOrdersMenuInfo.list.numitems = teamOrdersMenuInfo.numBots;
teamOrdersMenuInfo.list.itemnames = (const char **)teamOrdersMenuInfo.bots;
teamOrdersMenuInfo.list.listnames = NULL;
break;
case ID_LIST_CTF_ORDERS:
teamOrdersMenuInfo.list.generic.id = id;
teamOrdersMenuInfo.list.numitems = NUM_CTF_ORDERS;
teamOrdersMenuInfo.list.itemnames = NULL;
teamOrdersMenuInfo.list.listnames = ctfOrders;
break;
case ID_LIST_TEAM_ORDERS:
teamOrdersMenuInfo.list.generic.id = id;
teamOrdersMenuInfo.list.numitems = NUM_TEAM_ORDERS;
teamOrdersMenuInfo.list.itemnames = NULL;
teamOrdersMenuInfo.list.listnames = teamOrders;
break;
}
teamOrdersMenuInfo.list.generic.bottom = teamOrdersMenuInfo.list.generic.top + teamOrdersMenuInfo.list.numitems * PROP_HEIGHT;
}
/*
=================
UI_TeamOrdersMenu_Key
=================
*/
sfxHandle_t UI_TeamOrdersMenu_Key( int32_t key ) {
menulist_s *l;
int32_t x;
int32_t y;
int32_t index;
l = (menulist_s *)Menu_ItemAtCursor( &teamOrdersMenuInfo.menu );
if( l != &teamOrdersMenuInfo.list ) {
return Menu_DefaultKey( &teamOrdersMenuInfo.menu, key );
}
switch( key ) {
case K_MOUSE1:
x = l->generic.left;
y = l->generic.top;
if( UI_CursorInRect( x, y, l->generic.right - x, l->generic.bottom - y ) ) {
index = (uis.cursory - y) / PROP_HEIGHT;
l->oldvalue = l->curvalue;
l->curvalue = index;
if( l->generic.callback ) {
l->generic.callback( l, QM_ACTIVATED );
return menu_move_sound;
}
}
return menu_null_sound;
case K_KP_UPARROW:
case K_UPARROW:
l->oldvalue = l->curvalue;
if( l->curvalue == 0 ) {
l->curvalue = l->numitems - 1;
}
else {
l->curvalue--;
}
return menu_move_sound;
case K_KP_DOWNARROW:
case K_DOWNARROW:
l->oldvalue = l->curvalue;
if( l->curvalue == l->numitems - 1 ) {
l->curvalue = 0;;
}
else {
l->curvalue++;
}
return menu_move_sound;
}
return Menu_DefaultKey( &teamOrdersMenuInfo.menu, key );
}
/*
=================
UI_TeamOrdersMenu_ListDraw
=================
*/
static void UI_TeamOrdersMenu_ListDraw( void *self ) {
menulist_s *l;
int32_t x;
int32_t y;
int32_t i;
float *color;
qboolean hasfocus;
int32_t style;
l = (menulist_s *)self;
hasfocus = (l->generic.parent->cursor == l->generic.menuPosition);
x = 320;//l->generic.x;
y = l->generic.y;
for( i = 0; i < l->numitems; i++ )
{
style = UI_LEFT|UI_SMALLFONT|UI_CENTER;
if( i == l->curvalue )
{
color = colorTable[CT_DKGOLD1];
if( hasfocus )
{
color = colorTable[CT_LTGOLD1];
}
}
else
{
color = colorTable[CT_DKGOLD1];
}
if (l->listnames)
{
UI_DrawProportionalString( x, y, menu_normal_text[l->listnames[i]], style, color );
}
else
{
UI_DrawProportionalString( x, y, l->itemnames[i], style, color );
}
y += PROP_HEIGHT;
}
}
/*
===============
UI_TeamOrdersMenu_ListEvent
===============
*/
static void UI_TeamOrdersMenu_ListEvent( void *ptr, int32_t event ) {
int32_t id;
int32_t selection;
char message[256];
if (event != QM_ACTIVATED)
return;
id = ((menulist_s *)ptr)->generic.id;
selection = ((menulist_s *)ptr)->curvalue;
if( id == ID_LIST_BOTS )
{
teamOrdersMenuInfo.selectedBot = selection;
if( teamOrdersMenuInfo.gametype == GT_CTF )
{
UI_TeamOrdersMenu_SetList( ID_LIST_CTF_ORDERS );
}
else
{
UI_TeamOrdersMenu_SetList( ID_LIST_TEAM_ORDERS );
}
return;
}
if( id == ID_LIST_CTF_ORDERS )
{
Com_sprintf( message, sizeof(message), ctfMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot] );
}
else
{
Com_sprintf( message, sizeof(message), teamMessages[selection], teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.selectedBot] );
}
trap_Cmd_ExecuteText( EXEC_APPEND, va( "say_team \"%s\"\n", message ) );
UI_PopMenu();
}
/*
===============
UI_TeamOrdersMenu_BuildBotList
===============
*/
static void UI_TeamOrdersMenu_BuildBotList( void ) {
uiClientState_t cs;
int32_t numPlayers;
int32_t isBot;
int32_t n;
char playerTeam=0;
char botTeam;
char info[MAX_INFO_STRING];
for( n = 0; n < 9; n++ ) {
teamOrdersMenuInfo.bots[n] = teamOrdersMenuInfo.botNames[n];
}
trap_GetClientState( &cs );
Q_strncpyz( teamOrdersMenuInfo.botNames[0], "Everyone", 16 );
teamOrdersMenuInfo.numBots = 1;
trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
numPlayers = atoi( Info_ValueForKey( info, "sv_maxclients" ) );
teamOrdersMenuInfo.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) );
for( n = 0; n < numPlayers && teamOrdersMenuInfo.numBots < 9; n++ ) {
trap_GetConfigString( CS_PLAYERS + n, info, MAX_INFO_STRING );
if( n == cs.clientNum ) {
playerTeam = *Info_ValueForKey( info, "t" );
continue;
}
isBot = atoi( Info_ValueForKey( info, "skill" ) );
if( !isBot ) {
continue;
}
botTeam = *Info_ValueForKey( info, "t" );
if( botTeam != playerTeam ) {
continue;
}
Q_strncpyz( teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.numBots], Info_ValueForKey( info, "n" ), 16 );
Q_CleanStr( teamOrdersMenuInfo.botNames[teamOrdersMenuInfo.numBots] );
teamOrdersMenuInfo.numBots++;
}
}
/*
=================
UI_TeamOrdersMenu_Draw
=================
*/
static void UI_TeamOrdersMenu_Draw( void )
{
UI_MenuFrame(&teamOrdersMenuInfo.menu);
trap_R_SetColor( colorTable[CT_DKPURPLE2]);
UI_DrawHandlePic(30,201, 47, 90, uis.whiteShader); //Left side of frame
UI_DrawHandlePic(30,293, 47, 97, uis.whiteShader);
// standard menu drawing
Menu_Draw( &teamOrdersMenuInfo.menu );
}
/*
===============
UI_TeamOrdersMenu_Init
===============
*/
static void UI_TeamOrdersMenu_Init(int32_t fromMenu )
{
UI_TeamOrdersMenu_Cache();
memset( &teamOrdersMenuInfo, 0, sizeof(teamOrdersMenuInfo) );
teamOrdersMenuInfo.menu.fullscreen = qtrue;
teamOrdersMenuInfo.menu.wrapAround = qtrue;
teamOrdersMenuInfo.menu.key = UI_TeamOrdersMenu_Key;
teamOrdersMenuInfo.menu.draw = UI_TeamOrdersMenu_Draw;
teamOrdersMenuInfo.menu.descX = MENU_DESC_X;
teamOrdersMenuInfo.menu.descY = MENU_DESC_Y;
teamOrdersMenuInfo.menu.titleX = MENU_TITLE_X;
teamOrdersMenuInfo.menu.titleY = MENU_TITLE_Y;
teamOrdersMenuInfo.menu.titleI = MNT_TEAM_ORDERS_TITLE;
teamOrdersMenuInfo.menu.footNoteEnum = MNT_TEAM_ORDERS;
UI_TeamOrdersMenu_BuildBotList();
teamOrdersMenuInfo.list.generic.type = MTYPE_SCROLLLIST;
teamOrdersMenuInfo.list.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
teamOrdersMenuInfo.list.generic.ownerdraw = UI_TeamOrdersMenu_ListDraw;
teamOrdersMenuInfo.list.generic.callback = UI_TeamOrdersMenu_ListEvent;
teamOrdersMenuInfo.list.generic.x = 320-64;
teamOrdersMenuInfo.list.generic.y = 170;
teamOrdersMenuInfo.list.color = CT_DKGOLD1;
teamOrdersMenuInfo.list.color2 = CT_LTGOLD1;
teamOrdersMenuInfo.back.generic.type = MTYPE_BITMAP;
teamOrdersMenuInfo.back.generic.flags = QMF_HIGHLIGHT_IF_FOCUS;
teamOrdersMenuInfo.back.generic.name = BUTTON_GRAPHIC_LONGRIGHT;
teamOrdersMenuInfo.back.generic.callback = UI_TeamOrdersMenu_BackEvent;
teamOrdersMenuInfo.back.generic.x = 482;
teamOrdersMenuInfo.back.generic.y = 136;
teamOrdersMenuInfo.back.width = MENU_BUTTON_MED_WIDTH;
teamOrdersMenuInfo.back.height = MENU_BUTTON_MED_HEIGHT;
teamOrdersMenuInfo.back.color = CT_DKPURPLE1;
teamOrdersMenuInfo.back.color2 = CT_LTPURPLE1;
teamOrdersMenuInfo.back.textX = MENU_BUTTON_TEXT_X;
teamOrdersMenuInfo.back.textY = MENU_BUTTON_TEXT_Y;
if (!fromMenu)
{
teamOrdersMenuInfo.back.textEnum = MBT_INGAMEMENU;
}
else
{
teamOrdersMenuInfo.back.textEnum = MBT_INGAMERESUME;
}
teamOrdersMenuInfo.back.textcolor = CT_BLACK;
teamOrdersMenuInfo.back.textcolor2 = CT_WHITE;
Menu_AddItem( &teamOrdersMenuInfo.menu, &teamOrdersMenuInfo.list );
Menu_AddItem( &teamOrdersMenuInfo.menu, &teamOrdersMenuInfo.back );
teamOrdersMenuInfo.list.generic.left = 220;
teamOrdersMenuInfo.list.generic.top = teamOrdersMenuInfo.list.generic.y;
teamOrdersMenuInfo.list.generic.right = 420;
UI_TeamOrdersMenu_SetList( ID_LIST_BOTS );
}
/*
=================
UI_TeamOrdersMenu_Cache
=================
*/
void UI_TeamOrdersMenu_Cache( void )
{
}
/*
===============
UI_TeamOrdersMenu
===============
*/
void UI_TeamOrdersMenu(int32_t fromMenu )
{
UI_TeamOrdersMenu_Init(fromMenu);
UI_PushMenu( &teamOrdersMenuInfo.menu );
}
/*
===============
UI_TeamOrdersMenu_f
===============
*/
void UI_TeamOrdersMenu_f( void )
{
uiClientState_t cs;
char info[MAX_INFO_STRING];
int32_t team;
// make sure it's a team game
trap_GetConfigString( CS_SERVERINFO, info, sizeof(info) );
teamOrdersMenuInfo.gametype = atoi( Info_ValueForKey( info, "g_gametype" ) );
if( teamOrdersMenuInfo.gametype < GT_TEAM )
{
return;
}
// not available to spectators
trap_GetClientState( &cs );
trap_GetConfigString( CS_PLAYERS + cs.clientNum, info, MAX_INFO_STRING );
team = atoi( Info_ValueForKey( info, "t" ) );
if( team == TEAM_SPECTATOR )
{
return;
}
Mouse_Show();
UI_TeamOrdersMenu(1);
}

View file

@ -4,6 +4,7 @@
User interface trigger from within game
**********************************************************************/
#include "ui_local.h"
#include "ui_logger.h"
char *delayList[20] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12", "13", "14", "15", "20", "30", "60", 0 };
@ -55,12 +56,15 @@ void TransDataReceived(const char *data) {
char *temp;
int32_t i;
UI_LogFuncBegin();
for(i = 0; i < 6; i++) {
temp = Info_ValueForKey(data, va("d%i", i));
if(!temp[0]) break;
Q_strncpyz(srvList[i], temp, sizeof(srvList[i]));
srvCount++;
}
UI_LogFuncEnd();
}
/*
@ -76,6 +80,8 @@ static void M_Transporter_Event (void* ptr, int32_t notification)
id = ((menucommon_s*)ptr)->id;
UI_LogFuncBegin();
/*if ( notification != QM_ACTIVATED )
{
return;
@ -130,6 +136,7 @@ static void M_Transporter_Event (void* ptr, int32_t notification)
}
break;
}
UI_LogFuncEnd();
}
/*
@ -164,6 +171,8 @@ static void M_TransporterMenu_Graphics (void)
int32_t length,xTurboStart;
//int32_t numColor, roundColor;
UI_LogFuncBegin();
// Draw the basic screen frame
// Upper corners
@ -256,6 +265,7 @@ static void M_TransporterMenu_Graphics (void)
UI_DrawProportionalString(596, 318, "67", UI_TINYFONT, colorTable[CT_BLACK]);
UI_DrawProportionalString(502, 405, "27", UI_TINYFONT, colorTable[CT_BLACK]);
UI_LogFuncEnd();
}
/*
@ -265,11 +275,13 @@ TransporterMenu_Draw
*/
static void TransporterMenu_Draw(void)
{
UI_LogFuncBegin();
// Draw graphics particular to Main Menu
M_TransporterMenu_Graphics();
Menu_Draw( &s_transporter.menu );
UI_LogFuncEnd();
}
/*
@ -279,6 +291,7 @@ UI_TransporterMenu_Cache
*/
void UI_TransporterMenu_Cache (void)
{
UI_LogFuncBegin();
leftRound = trap_R_RegisterShaderNoMip("menu/common/halfroundl_24.tga");
corner_ul_24_60 = trap_R_RegisterShaderNoMip("menu/common/corner_ul_24_60.tga");
corner_ll_12_60 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_12_60.tga");
@ -288,6 +301,7 @@ void UI_TransporterMenu_Cache (void)
loading3 = trap_R_RegisterShaderNoMip("menu/new/nav_lb.tga");
loading4 = trap_R_RegisterShaderNoMip("menu/new/nav_db.tga");
loading5 = trap_R_RegisterShaderNoMip("menu/new/nab_o.tga");
UI_LogFuncEnd();
}
/*
@ -301,6 +315,8 @@ void TransporterMenu_Init(void)
//int32_t i;
int32_t width;
UI_LogFuncBegin();
AdminGeneric_InitLists();
s_transporter.menu.nitems = 0;
@ -433,6 +449,7 @@ void TransporterMenu_Init(void)
Menu_AddItem( &s_transporter.menu, &s_transporter.engage );
Menu_AddItem( &s_transporter.menu, &s_transporter.engage2 );
Menu_AddItem( &s_transporter.menu, &s_transporter.quitmenu );
UI_LogFuncEnd();
}
/*
@ -443,11 +460,13 @@ SrvData_Init
void SrvData_Init(void) {
int32_t i;
UI_LogFuncBegin();
for(i = 0; i < 6; i++) {
if(!srvList[i][0]) break;
s_transporter.srvListPtr[i] = srvList[i];
}
s_transporter.srvListPtr[i+1] = 0;
UI_LogFuncEnd();
}
/*
@ -457,8 +476,12 @@ UI_TransporterMenu
*/
void UI_TransporterMenu (int32_t trNum)
{
if ( !trNum )
UI_LogFuncBegin();
if ( !trNum ){
UI_LogFuncEnd();
return;
}
memset( &s_transporter, 0, sizeof( s_transporter ) );
@ -479,4 +502,6 @@ void UI_TransporterMenu (int32_t trNum)
UI_PushMenu( &s_transporter.menu );
Menu_AdjustCursor( &s_transporter.menu, 1 );
UI_LogFuncEnd();
}

View file

@ -4,6 +4,7 @@
User interface trigger from within game
**********************************************************************/
#include "ui_local.h"
#include "ui_logger.h"
typedef struct
{
@ -87,6 +88,8 @@ static void M_Turbolift_Event (void* ptr, int32_t notification)
id = ((menucommon_s*)ptr)->id;
UI_LogFuncBegin();
/*if ( notification != QM_ACTIVATED )
{
return;
@ -143,6 +146,7 @@ static void M_Turbolift_Event (void* ptr, int32_t notification)
}
break;
}
UI_LogFuncEnd();
}
/*
@ -171,6 +175,8 @@ static void M_TurboliftMenu_Graphics (void)
int32_t i,length,xTurboStart;
int32_t numColor,roundColor;
UI_LogFuncBegin();
// Draw the basic screen frame
// Upper corners
@ -290,6 +296,8 @@ static void M_TurboliftMenu_Graphics (void)
s_turbolift.quitmenu.generic.y,
MENU_BUTTON_MED_HEIGHT, s_turbolift.quitmenu.height, uis.graphicButtonLeftEnd);
UI_LogFuncEnd();
}
/*
@ -299,10 +307,14 @@ TurboliftMenu_Draw
*/
static void TurboliftMenu_Draw(void)
{
UI_LogFuncBegin();
// Draw graphics particular to Main Menu
M_TurboliftMenu_Graphics();
Menu_Draw( &s_turbolift.menu );
UI_LogFuncEnd();
}
/*
@ -312,10 +324,14 @@ UI_TurboliftMenu_Cache
*/
void UI_TurboliftMenu_Cache (void)
{
UI_LogFuncBegin();
leftRound = trap_R_RegisterShaderNoMip("menu/common/halfroundl_24.tga");
corner_ul_24_60 = trap_R_RegisterShaderNoMip("menu/common/corner_ul_24_60.tga");
corner_ll_12_60 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_12_60.tga");
turbolift = trap_R_RegisterShaderNoMip("menu/common/lift_button.tga");
UI_LogFuncEnd();
}
@ -325,6 +341,8 @@ static int32_t QDECL SortDecks( const void *arg1, const void *arg2 )
int32_t deck1;
int32_t deck2;
UI_LogFuncBegin();
deck1 = ( (deckData_t *)arg1)->deckNum;
deck2 = ( (deckData_t *)arg2)->deckNum;
@ -334,12 +352,17 @@ static int32_t QDECL SortDecks( const void *arg1, const void *arg2 )
if ( deck2 < 0 )
deck2 = 0;
if ( deck1 > deck2 )
if ( deck1 > deck2 ){
UI_LogFuncEnd();
return 1;
}
if ( deck1 == deck2 )
if ( deck1 == deck2 ){
UI_LogFuncEnd();
return 0;
}
UI_LogFuncEnd();
return -1;
}
@ -351,11 +374,15 @@ static void UI_TurboliftMenu_LoadDecks( void )
s_turbolift.numDecks = 0;
UI_LogFuncBegin();
//load the string
trap_GetConfigString( CS_TURBOLIFT_DATA, buffer, sizeof( buffer ) );
if ( !buffer[0] )
if ( !buffer[0] ){
UI_LogFuncEnd();
return;
}
memset( &s_turbolift.deckData, 0, sizeof( s_turbolift.deckData ) );
@ -377,6 +404,7 @@ static void UI_TurboliftMenu_LoadDecks( void )
//TiM - sort the decks into their sequential order
qsort( s_turbolift.deckData, s_turbolift.numDecks, sizeof( deckData_t ), SortDecks );
UI_LogFuncEnd();
}
static void UI_ManageDeckLoading( void )
@ -390,6 +418,8 @@ static void UI_ManageDeckLoading( void )
char buffer[20000];
char *token;
UI_LogFuncBegin();
//get the map name
trap_GetConfigString( CS_SERVERINFO, info, sizeof( info ) );
Com_sprintf( mapRoute, sizeof( fileRoute ), "maps/%s", Info_ValueForKey( info, "mapname" ) );
@ -403,6 +433,7 @@ static void UI_ManageDeckLoading( void )
{
//Com_Printf( S_COLOR_YELLOW "WARNING: Attempted to load %s, but wasn't found.\n", fileRoute );
UI_TurboliftMenu_LoadDecks();
UI_LogFuncEnd();
return;
}
@ -413,6 +444,7 @@ static void UI_ManageDeckLoading( void )
{
Com_Printf( S_COLOR_RED "ERROR: Attempted to load %s, but no data was read.\n", fileRoute );
UI_TurboliftMenu_LoadDecks();
UI_LogFuncEnd();
return;
}
@ -459,6 +491,7 @@ static void UI_ManageDeckLoading( void )
}
qsort( s_turbolift.deckData, s_turbolift.numDecks, sizeof( deckData_t ), SortDecks );
UI_LogFuncEnd();
}
/*
@ -472,6 +505,8 @@ void TurboliftMenu_Init(void)
menubitmap_s *holdDeck;
int32_t i,width;
UI_LogFuncBegin();
UI_ManageDeckLoading();
s_turbolift.menu.nitems = 0;
@ -573,6 +608,7 @@ void TurboliftMenu_Init(void)
}
holdDeck++;
}
UI_LogFuncEnd();
}
/*
@ -582,8 +618,12 @@ UI_TurboliftMenu
*/
void UI_TurboliftMenu ( int32_t liftNum )
{
if ( !liftNum )
UI_LogFuncBegin();
if ( !liftNum ){
UI_LogFuncEnd();
return;
}
memset( &s_turbolift, 0, sizeof( s_turbolift ) );
@ -602,5 +642,6 @@ void UI_TurboliftMenu ( int32_t liftNum )
UI_PushMenu( &s_turbolift.menu );
Menu_AdjustCursor( &s_turbolift.menu, 1 );
UI_LogFuncEnd();
}

View file

@ -1,6 +1,7 @@
// Copyright (C) 1999-2000 Id Software, Inc.
//
#include "ui_local.h"
#include "ui_logger.h"
void UI_VideoDriverMenu( void );
void VideoDriver_Lines(int32_t increment);
@ -361,6 +362,8 @@ static void DriverInfo_MenuDraw( void )
int32_t i;
int32_t y;
UI_LogFuncBegin();
Menu_Draw( &s_driverinfo.menu );
UI_DrawString( 320, 80, "VENDOR", UI_CENTER|UI_SMALLFONT, color_red, qtrue );
@ -382,6 +385,8 @@ static void DriverInfo_MenuDraw( void )
if (s_driverinfo.numstrings & 1)
UI_DrawString( 320, y, s_driverinfo.strings[s_driverinfo.numstrings-1], UI_CENTER|UI_SMALLFONT, text_color_normal, qtrue );
UI_LogFuncEnd();
}
/*
@ -405,6 +410,8 @@ static void UI_DriverInfo_Menu( void )
int32_t i;
int32_t len;
UI_LogFuncBegin();
// zero set all our globals
memset( &s_driverinfo, 0 ,sizeof(driverinfo_t) );
@ -479,6 +486,8 @@ static void UI_DriverInfo_Menu( void )
Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.back );
UI_PushMenu( &s_driverinfo.menu );
UI_LogFuncEnd();
}
/*
@ -590,6 +599,8 @@ GraphicsOptions_GetInitialVideo
*/
static void GraphicsOptions_GetInitialVideo( void )
{
UI_LogFuncBegin();
s_ivo.colordepth = s_graphicsoptions.colordepth.curvalue;
s_ivo.mode = s_graphicsoptions.mode.curvalue;
s_ivo.aspectRatio = s_graphicsoptions.aspectRatio.curvalue;
@ -602,6 +613,8 @@ static void GraphicsOptions_GetInitialVideo( void )
s_ivo.texturebits = s_graphicsoptions.texturebits.curvalue;
s_ivo.simpleshaders = s_graphicsoptions.simpleshaders.curvalue;
s_ivo.compresstextures = s_graphicsoptions.compresstextures.curvalue;
UI_LogFuncEnd();
}
@ -614,6 +627,8 @@ static void GraphicsOptions_CheckConfig( void )
{
int32_t i;
UI_LogFuncBegin();
for ( i = 0; i < NUM_IVO_TEMPLATES; i++ )
{
if ( s_ivo_templates[i].colordepth != s_graphicsoptions.colordepth.curvalue )
@ -640,9 +655,11 @@ static void GraphicsOptions_CheckConfig( void )
// if ( s_ivo_templates[i].texturebits != s_graphicsoptions.texturebits.curvalue )
// continue;
s_graphicsoptions.list.curvalue = i;
UI_LogFuncEnd();
return;
}
s_graphicsoptions.list.curvalue = 4;
UI_LogFuncEnd();
}
/*
@ -652,6 +669,7 @@ GraphicsOptions_UpdateMenuItems
*/
static void GraphicsOptions_UpdateMenuItems( void )
{
UI_LogFuncBegin();
if ( s_graphicsoptions.fs.curvalue == 0 )
{
@ -769,6 +787,7 @@ static void GraphicsOptions_UpdateMenuItems( void )
}
GraphicsOptions_CheckConfig();
UI_LogFuncEnd();
}
/*
@ -778,10 +797,14 @@ ApplyChanges - Apply the changes from the video data screen
*/
static void ApplyChanges2( void *unused, int32_t notification )
{
if (notification != QM_ACTIVATED)
UI_LogFuncBegin();
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" );
UI_LogFuncEnd();
}
/*
=================
@ -790,8 +813,12 @@ GraphicsOptions_ApplyChanges
*/
static void GraphicsOptions_ApplyChanges( void *unused, int32_t notification )
{
if (notification != QM_ACTIVATED)
UI_LogFuncBegin();
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
switch ( s_graphicsoptions.texturebits.curvalue )
{
@ -877,6 +904,7 @@ static void GraphicsOptions_ApplyChanges( void *unused, int32_t notification )
}
trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" );
UI_LogFuncEnd();
}
/*
@ -888,7 +916,10 @@ static void GraphicsOptions_Event( void* ptr, int32_t event )
{
InitialVideoOptions_s *ivo;
UI_LogFuncBegin();
if( event != QM_ACTIVATED ) {
UI_LogFuncEnd();
return;
}
@ -947,6 +978,7 @@ static void GraphicsOptions_Event( void* ptr, int32_t event )
UI_NetworkOptionsMenu();
break;
}
UI_LogFuncEnd();
}
@ -958,9 +990,11 @@ GraphicsOptions_MenuDraw
void GraphicsOptions_MenuDraw (void)
{
//APSFIX - rework this
UI_LogFuncBegin();
GraphicsOptions_UpdateMenuItems();
Menu_Draw( &s_graphicsoptions.menu );
UI_LogFuncEnd();
}
static qboolean GraphicsOptions_CheckWidescreen( void )
@ -970,9 +1004,13 @@ static qboolean GraphicsOptions_CheckWidescreen( void )
int32_t customHeight = trap_Cvar_VariableValue( "r_customHeight" );
videoResolutions_t *v;
UI_LogFuncBegin();
//double check
if ( s_graphicsoptions.mode.curvalue >= 0 )
if ( s_graphicsoptions.mode.curvalue >= 0 ){
UI_LogFuncEnd();
return qfalse;
}
for ( j=0; j < s_wideScreenSets; j++ )
{
@ -992,12 +1030,14 @@ static qboolean GraphicsOptions_CheckWidescreen( void )
s_graphicsoptions.mode.numitems = s_resolutionNums[s_graphicsoptions.aspectRatio.curvalue];
s_graphicsoptions.mode.curvalue = i;
UI_LogFuncEnd();
return qtrue;
}
}
}
//ffs... no luck
UI_LogFuncEnd();
return qfalse;
}
@ -1008,6 +1048,7 @@ GraphicsOptions_SetMenuItems
*/
static void GraphicsOptions_SetMenuItems( void )
{
UI_LogFuncBegin();
s_graphicsoptions.aspectRatio.curvalue = ASPECTRATIO_4X3; //set aspect to 'Normal' for now
@ -1090,6 +1131,7 @@ static void GraphicsOptions_SetMenuItems( void )
{
s_graphicsoptions.colordepth.curvalue = 0;
}
UI_LogFuncEnd();
}
@ -1097,10 +1139,12 @@ static void GraphicsOptions_SetMenuItems( void )
void VideoSideButtonsAction( qboolean result )
{
UI_LogFuncBegin();
if ( result ) // Yes - do it
{
Video_MenuEvent(holdControlPtr, holdControlEvent);
}
UI_LogFuncEnd();
}
/*
@ -1110,9 +1154,12 @@ VideoSideButtons_MenuEvent
*/
static void VideoSideButtons_MenuEvent (void* ptr, int32_t event)
{
UI_LogFuncBegin();
if (event != QM_ACTIVATED)
if (event != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
holdControlPtr = ptr;
holdControlEvent = event;
@ -1125,6 +1172,7 @@ static void VideoSideButtons_MenuEvent (void* ptr, int32_t event)
{
Video_MenuEvent (holdControlPtr, holdControlEvent);
}
UI_LogFuncEnd();
}
/*
@ -1136,8 +1184,12 @@ static void Video_MenuEvent (void* ptr, int32_t event)
{
menuframework_s* m;
if (event != QM_ACTIVATED)
UI_LogFuncBegin();
if (event != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
m = ((menucommon_s*)ptr)->parent;
@ -1207,6 +1259,7 @@ static void Video_MenuEvent (void* ptr, int32_t event)
break;
}
UI_LogFuncEnd();
}
/*
@ -1216,6 +1269,8 @@ M_VideoDataMenu_Graphics
*/
void M_VideoDataMenu_Graphics (void)
{
UI_LogFuncBegin();
UI_MenuFrame(&s_videodata.menu);
UI_DrawProportionalString( 74, 66, "207",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
@ -1248,6 +1303,8 @@ void M_VideoDataMenu_Graphics (void)
UI_DrawHandlePic(494,406, 128, 128, s_videodata.swooshBottom); // Bottom swoosh
UI_DrawHandlePic(174,420, 320, 8, uis.whiteShader); // Bottom line
UI_LogFuncEnd();
}
/*
=================
@ -1256,11 +1313,15 @@ VideoData_MenuDraw
*/
static void VideoData_MenuDraw (void)
{
UI_LogFuncBegin();
GraphicsOptions_UpdateMenuItems();
M_VideoDataMenu_Graphics();
Menu_Draw( &s_videodata.menu );
UI_LogFuncEnd();
}
/*
@ -1270,10 +1331,12 @@ UI_VideoDataMenu_Cache
*/
void UI_VideoDataMenu_Cache(void)
{
UI_LogFuncBegin();
s_videodata.swooshTop = trap_R_RegisterShaderNoMip("menu/common/swoosh_top.tga");
s_videodata.swooshBottom= trap_R_RegisterShaderNoMip("menu/common/swoosh_bottom.tga");
s_videodata.swooshTopSmall= trap_R_RegisterShaderNoMip("menu/common/swoosh_topsmall.tga");
s_videodata.swooshBottomSmall= trap_R_RegisterShaderNoMip("menu/common/swoosh_bottomsmall.tga");
UI_LogFuncEnd();
}
@ -1286,6 +1349,8 @@ static void VideoData_MenuInit( void )
{
int32_t x,y,width,inc;
UI_LogFuncBegin();
UI_VideoDataMenu_Cache();
// Menu Data
@ -1558,6 +1623,7 @@ static void VideoData_MenuInit( void )
{
s_graphicsoptions.driver.generic.flags |= QMF_HIDDEN|QMF_INACTIVE;
}*/
UI_LogFuncEnd();
}
@ -1568,9 +1634,11 @@ UI_VideoDataMenu
*/
void UI_VideoDataMenu( void )
{
UI_LogFuncBegin();
VideoData_MenuInit();
UI_PushMenu( &s_videodata.menu );
UI_LogFuncEnd();
}
/*
@ -1580,6 +1648,7 @@ Video_SideButtons
*/
void Video_SideButtons(menuframework_s *menu,int32_t menuType)
{
UI_LogFuncBegin();
// Button Data
s_video_data.generic.type = MTYPE_BITMAP;
@ -1687,6 +1756,7 @@ void Video_SideButtons(menuframework_s *menu,int32_t menuType)
Menu_AddItem( menu, ( void * )&s_video_data2);
Menu_AddItem( menu, ( void * )&s_video_drivers);
UI_LogFuncEnd();
}
@ -1699,6 +1769,8 @@ void VideoDriver_Lines(int32_t increment)
{
int32_t i,i2;
UI_LogFuncBegin();
s_videodriver.currentDriverLine += increment;
i=0;
@ -1708,17 +1780,20 @@ void VideoDriver_Lines(int32_t increment)
if (i<0)
{
s_videodriver.currentDriverLine = 0;
UI_LogFuncEnd();
return;
}
if (i>s_videodriver.driverCnt)
{
s_videodriver.currentDriverLine = (s_videodriver.driverCnt/2);
UI_LogFuncEnd();
return;
}
else if (i==s_videodriver.driverCnt)
{
s_videodriver.currentDriverLine = (s_videodriver.driverCnt/2) - 1;
UI_LogFuncEnd();
return;
}
@ -1726,6 +1801,7 @@ void VideoDriver_Lines(int32_t increment)
{
s_videodriver.currentDriverLine -= increment;
s_videodriver.activeArrowDwn = qfalse;
UI_LogFuncEnd();
return;
}
@ -1774,8 +1850,10 @@ void VideoDriver_Lines(int32_t increment)
if (!s_videodriver.drivers[i + 24])
{
s_videodriver.activeArrowDwn = qfalse;
UI_LogFuncEnd();
return;
}
UI_LogFuncEnd();
}
@ -1786,6 +1864,7 @@ VideoDriver_LineSetup
*/
void VideoDriver_LineSetup(void)
{
UI_LogFuncBegin();
char *bufhold;
char *eptr;
int32_t i;
@ -1829,6 +1908,7 @@ void VideoDriver_LineSetup(void)
}
s_videodriver.currentDriverLine = 0;
UI_LogFuncEnd();
}
@ -1853,6 +1933,7 @@ void M_VideoDriverMenu_Graphics (void)
float textColor[] = { 1, 1, 1, 1 };
int32_t x,y,x2;
UI_LogFuncBegin();
UI_MenuFrame(&s_videodriver.menu);
UI_DrawProportionalString( 74, 66, "207",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
@ -1915,6 +1996,7 @@ void M_VideoDriverMenu_Graphics (void)
UI_DrawProportionalString( x, y, menu_normal_text[MNT_PIXELFORMAT], UI_LEFT|UI_TINYFONT, labelColor );
UI_DrawProportionalString( x2, y, va("color(%d-bits) Z(%d-bit) stencil(%d-bits)", uis.glconfig.colorBits, uis.glconfig.depthBits, uis.glconfig.stencilBits), UI_LEFT|UI_TINYFONT, textColor );
UI_LogFuncEnd();
}
/*
@ -1924,10 +2006,11 @@ VideoDriver_MenuDraw
*/
static void VideoDriver_MenuDraw (void)
{
UI_LogFuncBegin();
M_VideoDriverMenu_Graphics();
Menu_Draw( &s_videodriver.menu );
UI_LogFuncEnd();
}
/*
@ -1937,9 +2020,11 @@ UI_VideoDriverMenu_Cache
*/
void UI_VideoDriverMenu_Cache(void)
{
UI_LogFuncBegin();
s_videodriver.corner_ll_16_16 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_16_16.tga");
s_videodriver.corner_ll_8_16 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_8_16.tga");
s_videodriver.arrow_dn = trap_R_RegisterShaderNoMip("menu/common/arrow_dn_16.tga");
UI_LogFuncEnd();
}
@ -1952,6 +2037,7 @@ static void VideoDriver_MenuInit( void )
{
int32_t i,x,y,x2;
UI_LogFuncBegin();
UI_VideoDriverMenu_Cache();
s_videodriver.menu.nitems = 0;
@ -2042,6 +2128,7 @@ static void VideoDriver_MenuInit( void )
// Print extensions
VideoDriver_LineSetup();
UI_LogFuncEnd();
}
@ -2052,12 +2139,14 @@ UI_VideoDriverMenu
*/
void UI_VideoDriverMenu( void )
{
UI_LogFuncBegin();
if (!s_videodriver.menu.initialized)
{
VideoDriver_MenuInit();
}
UI_PushMenu( &s_videodriver.menu );
UI_LogFuncEnd();
}
/*
@ -2067,13 +2156,17 @@ GammaCallback2
*/
void GammaCallback2( void *s, int32_t notification )
{
if (notification != QM_ACTIVATED)
UI_LogFuncBegin();
if (notification != QM_ACTIVATED){
UI_LogFuncEnd();
return;
}
s_videodata2.apply_action2.generic.flags &= ~QMF_GRAYED;
s_videodata2.apply_action2.generic.flags |= QMF_BLINK;
GammaCallback(s,notification );
UI_LogFuncEnd();
}
@ -2087,6 +2180,7 @@ void M_VideoData2Menu_Graphics (void)
{
int32_t y;
UI_LogFuncBegin();
UI_MenuFrame(&s_videodata2.menu);
UI_DrawProportionalString( 74, 66, "925",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]);
@ -2130,6 +2224,7 @@ void M_VideoData2Menu_Graphics (void)
UI_DrawHandlePic(579,412, 32, -16, s_videodata2.top); // Corner, LR
UI_DrawHandlePic(174,420, 408, 8, uis.whiteShader); // Bottom line
UI_LogFuncEnd();
}
/*
@ -2139,10 +2234,11 @@ VideoData2_MenuDraw
*/
static void VideoData2_MenuDraw (void)
{
UI_LogFuncBegin();
M_VideoData2Menu_Graphics();
Menu_Draw( &s_videodata2.menu );
UI_LogFuncEnd();
}
@ -2153,10 +2249,12 @@ UI_VideoData2Menu_Cache
*/
void UI_VideoData2Menu_Cache(void)
{
UI_LogFuncBegin();
s_videodata2.top = trap_R_RegisterShaderNoMip("menu/common/corner_ur_8_30.tga");
s_videodata2.gamma = trap_R_RegisterShaderNoMip("menu/special/gamma_test.tga");
trap_R_RegisterShaderNoMip(PIC_MONBAR2);
trap_R_RegisterShaderNoMip(PIC_SLIDER);
UI_LogFuncEnd();
}
/*
@ -2168,6 +2266,7 @@ static void VideoData2_MenuInit( void )
{
int32_t x,y;
UI_LogFuncBegin();
UI_VideoData2Menu_Cache();
// Menu Data
@ -2296,6 +2395,7 @@ static void VideoData2_MenuInit( void )
}
Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.screensize_slider);
Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.anisotropicfiltering);
UI_LogFuncEnd();
}
@ -2306,9 +2406,11 @@ UI_VideoData2SettingsGetCvars
*/
static void UI_VideoData2SettingsGetCvars(void)
{
UI_LogFuncBegin();
s_videodata2.gamma_slider.curvalue = trap_Cvar_VariableValue( "r_gamma" ) * 10.0f;
s_videodata2.screensize_slider.curvalue = trap_Cvar_VariableValue( "cg_viewsize" );
s_videodata2.anisotropicfiltering.curvalue = trap_Cvar_VariableValue( "r_ext_texture_filter_anisotropic" );
UI_LogFuncEnd();
}
/*
@ -2318,6 +2420,7 @@ UI_VideoData2SettingsMenu
*/
void UI_VideoData2SettingsMenu( void )
{
UI_LogFuncBegin();
UI_VideoData2SettingsGetCvars();
if (!s_videodata2.menu.initialized)
@ -2326,5 +2429,6 @@ void UI_VideoData2SettingsMenu( void )
}
UI_PushMenu( &s_videodata2.menu );
UI_LogFuncEnd();
}