mirror of
https://github.com/Q3Rally-Team/q3rally.git
synced 2024-11-26 22:01:50 +00:00
336 lines
10 KiB
C
336 lines
10 KiB
C
|
/*
|
||
|
===========================================================================
|
||
|
Copyright (C) 1999-2005 Id Software, Inc.
|
||
|
Copyright (C) 2002-2009 Q3Rally Team (Per Thormann - perle@q3rally.com)
|
||
|
|
||
|
This file is part of q3rally source code.
|
||
|
|
||
|
q3rally source code is free software; you can redistribute it
|
||
|
and/or modify it under the terms of the GNU General Public License as
|
||
|
published by the Free Software Foundation; either version 2 of the License,
|
||
|
or (at your option) any later version.
|
||
|
|
||
|
q3rally source code is distributed in the hope that it will be
|
||
|
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with q3rally; if not, write to the Free Software
|
||
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||
|
===========================================================================
|
||
|
*/
|
||
|
//
|
||
|
/*
|
||
|
=======================================================================
|
||
|
|
||
|
NETWORK OPTIONS MENU
|
||
|
|
||
|
=======================================================================
|
||
|
*/
|
||
|
|
||
|
#include "ui_local.h"
|
||
|
|
||
|
|
||
|
// STONELANCE
|
||
|
/*
|
||
|
#define ART_FRAMEL "menu/art/frame2_l"
|
||
|
#define ART_FRAMER "menu/art/frame1_r"
|
||
|
#define ART_BACK0 "menu/art/back_0"
|
||
|
#define ART_BACK1 "menu/art/back_1"
|
||
|
*/
|
||
|
// END
|
||
|
|
||
|
#define ID_GRAPHICS 10
|
||
|
#define ID_DISPLAY 11
|
||
|
#define ID_SOUND 12
|
||
|
#define ID_NETWORK 13
|
||
|
#define ID_RATE 14
|
||
|
#define ID_BACK 15
|
||
|
|
||
|
|
||
|
static const char *rate_items[] = {
|
||
|
"<= 28.8K",
|
||
|
"33.6K",
|
||
|
"56K",
|
||
|
"ISDN",
|
||
|
"LAN/Cable/xDSL",
|
||
|
0
|
||
|
};
|
||
|
|
||
|
typedef struct {
|
||
|
menuframework_s menu;
|
||
|
|
||
|
menutext_s banner;
|
||
|
// STONELANCE
|
||
|
/*
|
||
|
menubitmap_s framel;
|
||
|
menubitmap_s framer;
|
||
|
*/
|
||
|
// END
|
||
|
|
||
|
menutext_s graphics;
|
||
|
menutext_s display;
|
||
|
menutext_s sound;
|
||
|
menutext_s network;
|
||
|
|
||
|
menulist_s rate;
|
||
|
|
||
|
// STONELANCE
|
||
|
// menubitmap_s back;
|
||
|
menutext_s back;
|
||
|
// END
|
||
|
} networkOptionsInfo_t;
|
||
|
|
||
|
static networkOptionsInfo_t networkOptionsInfo;
|
||
|
|
||
|
|
||
|
/*
|
||
|
=================
|
||
|
UI_NetworkOptionsMenu_Event
|
||
|
=================
|
||
|
*/
|
||
|
static void UI_NetworkOptionsMenu_Event( void* ptr, int event ) {
|
||
|
if( event != QM_ACTIVATED ) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
switch( ((menucommon_s*)ptr)->id ) {
|
||
|
case ID_GRAPHICS:
|
||
|
UI_PopMenu();
|
||
|
UI_GraphicsOptionsMenu();
|
||
|
break;
|
||
|
|
||
|
case ID_DISPLAY:
|
||
|
UI_PopMenu();
|
||
|
UI_DisplayOptionsMenu();
|
||
|
break;
|
||
|
|
||
|
case ID_SOUND:
|
||
|
UI_PopMenu();
|
||
|
UI_SoundOptionsMenu();
|
||
|
break;
|
||
|
|
||
|
case ID_NETWORK:
|
||
|
break;
|
||
|
|
||
|
case ID_RATE:
|
||
|
if( networkOptionsInfo.rate.curvalue == 0 ) {
|
||
|
trap_Cvar_SetValue( "rate", 2500 );
|
||
|
}
|
||
|
else if( networkOptionsInfo.rate.curvalue == 1 ) {
|
||
|
trap_Cvar_SetValue( "rate", 3000 );
|
||
|
}
|
||
|
else if( networkOptionsInfo.rate.curvalue == 2 ) {
|
||
|
trap_Cvar_SetValue( "rate", 4000 );
|
||
|
}
|
||
|
else if( networkOptionsInfo.rate.curvalue == 3 ) {
|
||
|
trap_Cvar_SetValue( "rate", 5000 );
|
||
|
}
|
||
|
else if( networkOptionsInfo.rate.curvalue == 4 ) {
|
||
|
trap_Cvar_SetValue( "rate", 25000 );
|
||
|
}
|
||
|
break;
|
||
|
|
||
|
case ID_BACK:
|
||
|
UI_PopMenu();
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
/*
|
||
|
===============
|
||
|
UI_NetworkOptionsMenu_Init
|
||
|
===============
|
||
|
*/
|
||
|
static void UI_NetworkOptionsMenu_Init( void ) {
|
||
|
int y;
|
||
|
int rate;
|
||
|
|
||
|
memset( &networkOptionsInfo, 0, sizeof(networkOptionsInfo) );
|
||
|
|
||
|
UI_NetworkOptionsMenu_Cache();
|
||
|
networkOptionsInfo.menu.wrapAround = qtrue;
|
||
|
networkOptionsInfo.menu.fullscreen = qtrue;
|
||
|
|
||
|
networkOptionsInfo.banner.generic.type = MTYPE_BTEXT;
|
||
|
networkOptionsInfo.banner.generic.flags = QMF_CENTER_JUSTIFY;
|
||
|
networkOptionsInfo.banner.generic.x = 320;
|
||
|
networkOptionsInfo.banner.generic.y = 16;
|
||
|
networkOptionsInfo.banner.string = "SYSTEM SETUP";
|
||
|
networkOptionsInfo.banner.color = color_white;
|
||
|
networkOptionsInfo.banner.style = UI_CENTER;
|
||
|
|
||
|
// STONELANCE
|
||
|
/*
|
||
|
networkOptionsInfo.framel.generic.type = MTYPE_BITMAP;
|
||
|
networkOptionsInfo.framel.generic.name = ART_FRAMEL;
|
||
|
networkOptionsInfo.framel.generic.flags = QMF_INACTIVE;
|
||
|
networkOptionsInfo.framel.generic.x = 0;
|
||
|
networkOptionsInfo.framel.generic.y = 78;
|
||
|
networkOptionsInfo.framel.width = 256;
|
||
|
networkOptionsInfo.framel.height = 329;
|
||
|
|
||
|
networkOptionsInfo.framer.generic.type = MTYPE_BITMAP;
|
||
|
networkOptionsInfo.framer.generic.name = ART_FRAMER;
|
||
|
networkOptionsInfo.framer.generic.flags = QMF_INACTIVE;
|
||
|
networkOptionsInfo.framer.generic.x = 376;
|
||
|
networkOptionsInfo.framer.generic.y = 76;
|
||
|
networkOptionsInfo.framer.width = 256;
|
||
|
networkOptionsInfo.framer.height = 334;
|
||
|
*/
|
||
|
// END
|
||
|
|
||
|
networkOptionsInfo.graphics.generic.type = MTYPE_PTEXT;
|
||
|
networkOptionsInfo.graphics.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
|
||
|
networkOptionsInfo.graphics.generic.id = ID_GRAPHICS;
|
||
|
networkOptionsInfo.graphics.generic.callback = UI_NetworkOptionsMenu_Event;
|
||
|
networkOptionsInfo.graphics.generic.x = 216;
|
||
|
networkOptionsInfo.graphics.generic.y = 240 - 2 * PROP_HEIGHT;
|
||
|
networkOptionsInfo.graphics.string = "GRAPHICS";
|
||
|
networkOptionsInfo.graphics.style = UI_RIGHT;
|
||
|
// BAGPUSS
|
||
|
// networkOptionsInfo.graphics.color = color_red;
|
||
|
networkOptionsInfo.graphics.color = text_color_normal;
|
||
|
// END
|
||
|
|
||
|
networkOptionsInfo.display.generic.type = MTYPE_PTEXT;
|
||
|
networkOptionsInfo.display.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
|
||
|
networkOptionsInfo.display.generic.id = ID_DISPLAY;
|
||
|
networkOptionsInfo.display.generic.callback = UI_NetworkOptionsMenu_Event;
|
||
|
networkOptionsInfo.display.generic.x = 216;
|
||
|
networkOptionsInfo.display.generic.y = 240 - PROP_HEIGHT;
|
||
|
networkOptionsInfo.display.string = "DISPLAY";
|
||
|
networkOptionsInfo.display.style = UI_RIGHT;
|
||
|
// BAGPUSS
|
||
|
// networkOptionsInfo.display.color = color_red;
|
||
|
networkOptionsInfo.display.color = text_color_normal;
|
||
|
// END
|
||
|
|
||
|
networkOptionsInfo.sound.generic.type = MTYPE_PTEXT;
|
||
|
networkOptionsInfo.sound.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
|
||
|
networkOptionsInfo.sound.generic.id = ID_SOUND;
|
||
|
networkOptionsInfo.sound.generic.callback = UI_NetworkOptionsMenu_Event;
|
||
|
networkOptionsInfo.sound.generic.x = 216;
|
||
|
networkOptionsInfo.sound.generic.y = 240;
|
||
|
networkOptionsInfo.sound.string = "SOUND";
|
||
|
networkOptionsInfo.sound.style = UI_RIGHT;
|
||
|
networkOptionsInfo.sound.color = color_red;
|
||
|
// BAGPUSS
|
||
|
// networkOptionsInfo.sound.color = color_red;
|
||
|
networkOptionsInfo.sound.color = text_color_normal;
|
||
|
// END
|
||
|
|
||
|
networkOptionsInfo.network.generic.type = MTYPE_PTEXT;
|
||
|
networkOptionsInfo.network.generic.flags = QMF_RIGHT_JUSTIFY;
|
||
|
networkOptionsInfo.network.generic.id = ID_NETWORK;
|
||
|
networkOptionsInfo.network.generic.callback = UI_NetworkOptionsMenu_Event;
|
||
|
networkOptionsInfo.network.generic.x = 216;
|
||
|
networkOptionsInfo.network.generic.y = 240 + PROP_HEIGHT;
|
||
|
networkOptionsInfo.network.string = "NETWORK";
|
||
|
networkOptionsInfo.network.style = UI_RIGHT;
|
||
|
// BAGPUSS
|
||
|
// networkOptionsInfo.network.color = color_red;
|
||
|
networkOptionsInfo.network.color = text_color_normal;
|
||
|
// END
|
||
|
|
||
|
y = 240 - 1 * (BIGCHAR_HEIGHT+2);
|
||
|
networkOptionsInfo.rate.generic.type = MTYPE_SPINCONTROL;
|
||
|
networkOptionsInfo.rate.generic.name = "Data Rate:";
|
||
|
networkOptionsInfo.rate.generic.flags = QMF_PULSEIFFOCUS|QMF_SMALLFONT;
|
||
|
networkOptionsInfo.rate.generic.callback = UI_NetworkOptionsMenu_Event;
|
||
|
networkOptionsInfo.rate.generic.id = ID_RATE;
|
||
|
networkOptionsInfo.rate.generic.x = 400;
|
||
|
networkOptionsInfo.rate.generic.y = y;
|
||
|
networkOptionsInfo.rate.itemnames = rate_items;
|
||
|
|
||
|
// STONELANCE
|
||
|
/*
|
||
|
networkOptionsInfo.back.generic.type = MTYPE_BITMAP;
|
||
|
networkOptionsInfo.back.generic.name = ART_BACK0;
|
||
|
networkOptionsInfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
|
||
|
networkOptionsInfo.back.generic.callback = UI_NetworkOptionsMenu_Event;
|
||
|
networkOptionsInfo.back.generic.id = ID_BACK;
|
||
|
networkOptionsInfo.back.generic.x = 0;
|
||
|
networkOptionsInfo.back.generic.y = 480-64;
|
||
|
networkOptionsInfo.back.width = 128;
|
||
|
networkOptionsInfo.back.height = 64;
|
||
|
networkOptionsInfo.back.focuspic = ART_BACK1;
|
||
|
*/
|
||
|
networkOptionsInfo.back.generic.type = MTYPE_PTEXT;
|
||
|
networkOptionsInfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
|
||
|
networkOptionsInfo.back.generic.x = 20;
|
||
|
networkOptionsInfo.back.generic.y = 480 - 50;
|
||
|
networkOptionsInfo.back.generic.id = ID_BACK;
|
||
|
networkOptionsInfo.back.generic.callback = UI_NetworkOptionsMenu_Event;
|
||
|
networkOptionsInfo.back.string = "< BACK";
|
||
|
networkOptionsInfo.back.color = text_color_normal;
|
||
|
networkOptionsInfo.back.style = UI_LEFT | UI_SMALLFONT;
|
||
|
// END
|
||
|
|
||
|
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.banner );
|
||
|
// STONELANCE
|
||
|
/*
|
||
|
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.framel );
|
||
|
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.framer );
|
||
|
*/
|
||
|
// END
|
||
|
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.graphics );
|
||
|
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.display );
|
||
|
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.sound );
|
||
|
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.network );
|
||
|
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.rate );
|
||
|
Menu_AddItem( &networkOptionsInfo.menu, ( void * ) &networkOptionsInfo.back );
|
||
|
|
||
|
rate = trap_Cvar_VariableValue( "rate" );
|
||
|
if( rate <= 2500 ) {
|
||
|
networkOptionsInfo.rate.curvalue = 0;
|
||
|
}
|
||
|
else if( rate <= 3000 ) {
|
||
|
networkOptionsInfo.rate.curvalue = 1;
|
||
|
}
|
||
|
else if( rate <= 4000 ) {
|
||
|
networkOptionsInfo.rate.curvalue = 2;
|
||
|
}
|
||
|
else if( rate <= 5000 ) {
|
||
|
networkOptionsInfo.rate.curvalue = 3;
|
||
|
}
|
||
|
else {
|
||
|
networkOptionsInfo.rate.curvalue = 4;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
/*
|
||
|
===============
|
||
|
UI_NetworkOptionsMenu_Cache
|
||
|
===============
|
||
|
*/
|
||
|
void UI_NetworkOptionsMenu_Cache( void ) {
|
||
|
// STONELANCE
|
||
|
/*
|
||
|
trap_R_RegisterShaderNoMip( ART_FRAMEL );
|
||
|
trap_R_RegisterShaderNoMip( ART_FRAMER );
|
||
|
trap_R_RegisterShaderNoMip( ART_BACK0 );
|
||
|
trap_R_RegisterShaderNoMip( ART_BACK1 );
|
||
|
*/
|
||
|
// END
|
||
|
}
|
||
|
|
||
|
|
||
|
/*
|
||
|
===============
|
||
|
UI_NetworkOptionsMenu
|
||
|
===============
|
||
|
*/
|
||
|
void UI_NetworkOptionsMenu( void ) {
|
||
|
// STONELANCE FIXME: get rid of this after proper tansitions are added
|
||
|
uis.transitionIn = 0;
|
||
|
// END
|
||
|
|
||
|
UI_NetworkOptionsMenu_Init();
|
||
|
UI_PushMenu( &networkOptionsInfo.menu );
|
||
|
Menu_SetCursorToItem( &networkOptionsInfo.menu, &networkOptionsInfo.network );
|
||
|
}
|