mirror of
https://github.com/Q3Rally-Team/q3rally.git
synced 2024-12-11 21:11:31 +00:00
1500 lines
42 KiB
C
1500 lines
42 KiB
C
/*
|
|
===========================================================================
|
|
Copyright (C) 1999-2005 Id Software, Inc.
|
|
Copyright (C) 2002-2015 Q3Rally Team (Per Thormann - q3rally@gmail.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
|
|
===========================================================================
|
|
*/
|
|
//
|
|
#include "ui_local.h"
|
|
|
|
// STONELANCE
|
|
/*
|
|
#define ART_FRAMEL "menu/art/frame2_l"
|
|
#define ART_FRAMER "menu/art/frame1_r"
|
|
#define ART_MODEL0 "menu/art/model_0"
|
|
#define ART_MODEL1 "menu/art/model_1"
|
|
#define ART_BACK0 "menu/art/back_0"
|
|
#define ART_BACK1 "menu/art/back_1"
|
|
*/
|
|
#define ART_SELECT "menu/art/menu_select"
|
|
#define ART_SELECTED "menu/art/menu_selected"
|
|
#define ART_PORT "menu/art/menu_port"
|
|
#define ART_LEFT0 "menu/art/arrow_l0"
|
|
#define ART_LEFT1 "menu/art/arrow_l1"
|
|
#define ART_RIGHT0 "menu/art/arrow_r0"
|
|
#define ART_RIGHT1 "menu/art/arrow_r1"
|
|
// END
|
|
#define ART_FX_BASE "menu/art/fx_base"
|
|
#define ART_FX_BLUE "menu/art/fx_blue"
|
|
#define ART_FX_CYAN "menu/art/fx_cyan"
|
|
#define ART_FX_GREEN "menu/art/fx_grn"
|
|
#define ART_FX_RED "menu/art/fx_red"
|
|
#define ART_FX_TEAL "menu/art/fx_teal"
|
|
#define ART_FX_WHITE "menu/art/fx_white"
|
|
#define ART_FX_YELLOW "menu/art/fx_yel"
|
|
|
|
#define ID_NAME 10
|
|
#define ID_HANDICAP 11
|
|
#define ID_EFFECTS 12
|
|
#define ID_BACK 13
|
|
// STONELANCE
|
|
// #define ID_MODEL 14
|
|
#define ID_CUSTOMIZE 14
|
|
|
|
#define ID_FAVORITE1 15
|
|
#define ID_FAVORITE2 16
|
|
#define ID_FAVORITE3 17
|
|
#define ID_FAVORITE4 18
|
|
#define ID_LEFT 19
|
|
#define ID_RIGHT 20
|
|
#define ID_PLATE 21
|
|
// END
|
|
|
|
#define MAX_NAMELENGTH 20
|
|
// STONELANCE
|
|
#define NUM_FAVORITES 4
|
|
#define MAX_PLAYERMODELS 256
|
|
// END
|
|
|
|
|
|
typedef struct {
|
|
menuframework_s menu;
|
|
|
|
menutext_s banner;
|
|
// STONELANCE
|
|
/*
|
|
menubitmap_s framel;
|
|
menubitmap_s framer;
|
|
*/
|
|
// END
|
|
menubitmap_s player;
|
|
|
|
menufield_s name;
|
|
menulist_s handicap;
|
|
menulist_s effects;
|
|
|
|
// STONELANCE
|
|
// menubitmap_s back;
|
|
menutext_s back;
|
|
menutext_s customize;
|
|
menutext_s plate;
|
|
|
|
menubitmap_s left;
|
|
menutext_s modelname;
|
|
menubitmap_s right;
|
|
|
|
menutext_s favorites;
|
|
menubitmap_s favpics[NUM_FAVORITES];
|
|
menubitmap_s favpicbuttons[NUM_FAVORITES];
|
|
menubitmap_s ports[NUM_FAVORITES];
|
|
|
|
char modelList[MAX_PLAYERMODELS][MAX_QPATH];
|
|
int selectedModel;
|
|
int numModels;
|
|
int allModels;
|
|
|
|
char modelskin[MAX_QPATH];
|
|
char rimskin[MAX_QPATH];
|
|
char headskin[MAX_QPATH];
|
|
|
|
char favIcons[NUM_FAVORITES][MAX_QPATH];
|
|
qboolean modelChanged;
|
|
// END
|
|
|
|
qhandle_t fxBasePic;
|
|
qhandle_t fxPic[7];
|
|
playerInfo_t playerinfo;
|
|
int current_fx;
|
|
char playerModel[MAX_QPATH];
|
|
} playersettings_t;
|
|
|
|
static playersettings_t s_playersettings;
|
|
|
|
static int gamecodetoui[] = {4,2,3,0,5,1,6};
|
|
static int uitogamecode[] = {4,6,2,3,1,5,7};
|
|
|
|
static const char *handicap_items[] = {
|
|
"None",
|
|
"95",
|
|
"90",
|
|
"85",
|
|
"80",
|
|
"75",
|
|
"70",
|
|
"65",
|
|
"60",
|
|
"55",
|
|
"50",
|
|
"45",
|
|
"40",
|
|
"35",
|
|
"30",
|
|
"25",
|
|
"20",
|
|
"15",
|
|
"10",
|
|
"5",
|
|
0
|
|
};
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_DrawName
|
|
=================
|
|
*/
|
|
static void PlayerSettings_DrawName( void *self ) {
|
|
menufield_s *f;
|
|
qboolean focus;
|
|
int style;
|
|
char *txt;
|
|
char c;
|
|
float *color;
|
|
int n;
|
|
int basex, x, y;
|
|
// STONELANCE
|
|
// char name[32];
|
|
// END
|
|
|
|
f = (menufield_s*)self;
|
|
basex = f->generic.x;
|
|
y = f->generic.y;
|
|
focus = (f->generic.parent->cursor == f->generic.menuPosition);
|
|
|
|
style = UI_LEFT|UI_SMALLFONT;
|
|
// STONELANCE
|
|
/*
|
|
color = text_color_normal;
|
|
if( focus ) {
|
|
style |= UI_PULSE;
|
|
color = text_color_highlight;
|
|
}
|
|
UI_DrawProportionalString( basex, y, "Name", style, color );
|
|
*/
|
|
color = uis.text_color;
|
|
if( focus ) {
|
|
style |= UI_PULSE;
|
|
color = text_color_highlight;
|
|
}
|
|
|
|
UI_DrawProportionalString( basex + 16, y, "Name", style, color );
|
|
// END
|
|
|
|
// draw the actual name
|
|
basex += 64;
|
|
// STONELANCE
|
|
// y += PROP_HEIGHT;
|
|
y += 18;
|
|
// END
|
|
txt = f->field.buffer;
|
|
// STONELANCE
|
|
// color = g_color_table[ColorIndex(COLOR_WHITE)];
|
|
// END
|
|
x = basex;
|
|
while ( (c = *txt) != 0 ) {
|
|
if ( !focus && Q_IsColorString( txt ) ) {
|
|
n = ColorIndex( *(txt+1) );
|
|
if( n == 0 ) {
|
|
n = 7;
|
|
}
|
|
color = g_color_table[n];
|
|
txt += 2;
|
|
continue;
|
|
}
|
|
UI_DrawChar( x, y, c, style, color );
|
|
txt++;
|
|
x += SMALLCHAR_WIDTH;
|
|
}
|
|
|
|
// draw cursor if we have focus
|
|
if( focus ) {
|
|
if ( trap_Key_GetOverstrikeMode() ) {
|
|
c = 11;
|
|
} else {
|
|
c = 10;
|
|
}
|
|
|
|
style &= ~UI_PULSE;
|
|
style |= UI_BLINK;
|
|
|
|
UI_DrawChar( basex + f->field.cursor * SMALLCHAR_WIDTH, y, c, style, color_white );
|
|
}
|
|
|
|
// STONELANCE
|
|
/*
|
|
// draw at bottom also using proportional font
|
|
Q_strncpyz( name, f->field.buffer, sizeof(name) );
|
|
Q_CleanStr( name );
|
|
UI_DrawProportionalString( 320, 440, name, UI_CENTER|UI_BIGFONT, text_color_normal );
|
|
*/
|
|
// END
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_DrawHandicap
|
|
=================
|
|
*/
|
|
static void PlayerSettings_DrawHandicap( void *self ) {
|
|
menulist_s *item;
|
|
qboolean focus;
|
|
int style;
|
|
float *color;
|
|
|
|
item = (menulist_s *)self;
|
|
focus = (item->generic.parent->cursor == item->generic.menuPosition);
|
|
|
|
style = UI_LEFT|UI_SMALLFONT;
|
|
// STONELANCE
|
|
/*
|
|
color = text_color_normal;
|
|
if( focus ) {
|
|
style |= UI_PULSE;
|
|
color = text_color_highlight;
|
|
}
|
|
|
|
UI_DrawProportionalString( item->generic.x, item->generic.y, "Handicap", style, color );
|
|
UI_DrawProportionalString( item->generic.x + 64, item->generic.y + PROP_HEIGHT, handicap_items[item->curvalue], style, color );
|
|
*/
|
|
color = uis.text_color;
|
|
if( focus && !(uis.transitionIn || uis.transitionOut)) {
|
|
style |= UI_PULSE;
|
|
color = text_color_highlight;
|
|
}
|
|
|
|
UI_DrawProportionalString( item->generic.x + 16, item->generic.y, "Handicap", style, color );
|
|
UI_DrawString( item->generic.x + 64, item->generic.y + 18, handicap_items[item->curvalue], style, color );
|
|
// END
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_DrawEffects
|
|
=================
|
|
*/
|
|
static void PlayerSettings_DrawEffects( void *self ) {
|
|
menulist_s *item;
|
|
qboolean focus;
|
|
int style;
|
|
float *color;
|
|
|
|
item = (menulist_s *)self;
|
|
focus = (item->generic.parent->cursor == item->generic.menuPosition);
|
|
|
|
style = UI_LEFT|UI_SMALLFONT;
|
|
// STONELANCE
|
|
/*
|
|
color = text_color_normal;
|
|
if( focus ) {
|
|
style |= UI_PULSE;
|
|
color = text_color_highlight;
|
|
}
|
|
|
|
UI_DrawProportionalString( item->generic.x, item->generic.y, "Effects", style, color );
|
|
|
|
UI_DrawHandlePic( item->generic.x + 64, item->generic.y + PROP_HEIGHT + 8, 128, 8, s_playersettings.fxBasePic );
|
|
UI_DrawHandlePic( item->generic.x + 64 + item->curvalue * 16 + 8, item->generic.y + PROP_HEIGHT + 6, 16, 12, s_playersettings.fxPic[item->curvalue] );
|
|
*/
|
|
|
|
color = uis.text_color;
|
|
if( focus && !(uis.transitionIn || uis.transitionOut)) {
|
|
style |= UI_PULSE;
|
|
color = text_color_highlight;
|
|
}
|
|
|
|
UI_DrawProportionalString( item->generic.x + 16, item->generic.y, "Effects", style, color );
|
|
|
|
UI_DrawHandlePic( item->generic.x + 18, item->generic.y + 20, 128, 16, s_playersettings.fxBasePic );
|
|
UI_DrawHandlePic( item->generic.x + 23 + item->curvalue * 17, item->generic.y + 20, 16, 16, s_playersettings.fxPic[item->curvalue] );
|
|
// END
|
|
}
|
|
|
|
|
|
// STONELANCE
|
|
/*
|
|
=================
|
|
PlayerSettings_DrawCustomize
|
|
=================
|
|
*/
|
|
static void PlayerSettings_DrawCustomize( void *self ) {
|
|
menulist_s *item;
|
|
qboolean focus;
|
|
int style;
|
|
float *color;
|
|
|
|
item = (menulist_s *)self;
|
|
focus = (item->generic.parent->cursor == item->generic.menuPosition);
|
|
|
|
style = UI_RIGHT | UI_SMALLFONT;
|
|
color = uis.text_color;
|
|
if( focus && !(uis.transitionIn || uis.transitionOut)) {
|
|
style |= UI_PULSE;
|
|
color = text_color_highlight;
|
|
}
|
|
|
|
UI_DrawProportionalString( item->generic.x, item->generic.y, "CUSTOMIZE", style, color );
|
|
UI_DrawProportionalString( item->generic.x, item->generic.y + 20, "THIS CAR >", style, color );
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_DrawBackShaders
|
|
=================
|
|
*/
|
|
static void PlayerSettings_DrawBackShaders( void ) {
|
|
vec4_t color;
|
|
|
|
Vector4Copy(menu_back_color, color);
|
|
color[3] *= uis.tFrac;
|
|
|
|
UI_FillRect( 24, 80, 592, 48, color);
|
|
UI_FillRect( 124, 138, 392, 32, menu_back_color);
|
|
|
|
Menu_Draw( &s_playersettings.menu );
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_UpdateModel
|
|
=================
|
|
*/
|
|
static void PlayerSettings_UpdateModel( void )
|
|
{
|
|
vec3_t viewangles;
|
|
vec3_t moveangles;
|
|
char plate[MAX_QPATH];
|
|
|
|
memset( &s_playersettings.playerinfo, 0, sizeof(playerInfo_t) );
|
|
|
|
VectorClear( viewangles );
|
|
VectorClear( moveangles );
|
|
|
|
trap_Cvar_VariableStringBuffer( "plate", plate, sizeof( plate ) );
|
|
UI_PlayerInfo_SetModel( &s_playersettings.playerinfo, s_playersettings.modelskin, s_playersettings.rimskin, s_playersettings.headskin, plate);
|
|
UI_PlayerInfo_SetInfo( &s_playersettings.playerinfo, LEGS_IDLE, TORSO_STAND, viewangles, moveangles, WP_NONE, qfalse );
|
|
}
|
|
// END
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_DrawPlayer
|
|
=================
|
|
*/
|
|
static void PlayerSettings_DrawPlayer( void *self ) {
|
|
menubitmap_s *b;
|
|
// STONELANCE
|
|
/*
|
|
vec3_t viewangles;
|
|
char buf[MAX_QPATH];
|
|
|
|
trap_Cvar_VariableStringBuffer( "model", buf, sizeof( buf ) );
|
|
if ( strcmp( buf, s_playersettings.playerModel ) != 0 ) {
|
|
UI_PlayerInfo_SetModel( &s_playersettings.playerinfo, buf );
|
|
strcpy( s_playersettings.playerModel, buf );
|
|
|
|
viewangles[YAW] = 180 - 30;
|
|
viewangles[PITCH] = 0;
|
|
viewangles[ROLL] = 0;
|
|
UI_PlayerInfo_SetInfo( &s_playersettings.playerinfo, LEGS_IDLE, TORSO_STAND, viewangles, vec3_origin, WP_MACHINEGUN, qfalse );
|
|
}
|
|
*/
|
|
// END
|
|
b = (menubitmap_s*) self;
|
|
UI_DrawPlayer( b->generic.x, b->generic.y, b->width, b->height, &s_playersettings.playerinfo, uis.realtime );
|
|
}
|
|
|
|
|
|
// STONELANCE (new function)
|
|
/*
|
|
=================
|
|
LoadFavorite
|
|
|
|
=================
|
|
*/
|
|
static void LoadFavorite( const char *favorite ) {
|
|
char modelName[MAX_QPATH];
|
|
char skinName[MAX_QPATH];
|
|
char rimName[MAX_QPATH];
|
|
char headName[MAX_QPATH];
|
|
int i;
|
|
qboolean carFound;
|
|
|
|
GetValuesFromFavorite(favorite, modelName, skinName, rimName, headName);
|
|
|
|
// find model in our list
|
|
carFound = qfalse;
|
|
for (i = 0; i < s_playersettings.allModels; i++)
|
|
{
|
|
if (!Q_stricmp( modelName, s_playersettings.modelList[i] ))
|
|
{
|
|
// found pic, set selection here
|
|
s_playersettings.selectedModel = i;
|
|
s_playersettings.modelname.string = s_playersettings.modelList[s_playersettings.selectedModel];
|
|
carFound = qtrue;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!carFound){
|
|
s_playersettings.selectedModel = 0;
|
|
|
|
// get model
|
|
Com_sprintf(s_playersettings.modelskin, sizeof(s_playersettings.modelskin), "%s/%s", s_playersettings.modelList[s_playersettings.selectedModel], DEFAULT_SKIN);
|
|
|
|
s_playersettings.modelname.string = s_playersettings.modelList[s_playersettings.selectedModel];
|
|
|
|
// FIXME: check to see if these exist
|
|
Q_strncpyz(s_playersettings.rimskin, DEFAULT_RIM, sizeof(s_playersettings.rimskin));
|
|
Q_strncpyz(s_playersettings.headskin, DEFAULT_HEAD, sizeof(s_playersettings.headskin));
|
|
|
|
s_playersettings.modelChanged = qtrue;
|
|
}
|
|
else {
|
|
Com_sprintf(s_playersettings.modelskin, sizeof(s_playersettings.modelskin), "%s/%s", modelName, skinName);
|
|
Q_strncpyz(s_playersettings.rimskin, rimName, sizeof(s_playersettings.rimskin));
|
|
Q_strncpyz(s_playersettings.headskin, headName, sizeof(s_playersettings.headskin));
|
|
|
|
trap_Cvar_Set( "model", s_playersettings.modelskin );
|
|
trap_Cvar_Set( "rim", rimName );
|
|
trap_Cvar_Set( "head", headName );
|
|
|
|
s_playersettings.modelChanged = qtrue;
|
|
}
|
|
}
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_UpdateFavorites
|
|
|
|
=================
|
|
*/
|
|
static void PlayerSettings_UpdateFavorites( void ) {
|
|
int i;
|
|
char buf[MAX_QPATH];
|
|
char modelName[MAX_QPATH];
|
|
char skinName[MAX_QPATH];
|
|
qboolean error;
|
|
|
|
for (i=0; i < NUM_FAVORITES; i++){
|
|
Com_sprintf(buf, sizeof(buf), "favoritecar%i", (i+1));
|
|
error = GetValuesFromFavorite(buf, modelName, skinName, NULL, NULL);
|
|
|
|
if (!error){
|
|
Com_sprintf(s_playersettings.favIcons[i], sizeof(s_playersettings.favIcons[i]), "models/players/%s/icon_%s", modelName, skinName);
|
|
s_playersettings.favpics[i].generic.name = s_playersettings.favIcons[i];
|
|
s_playersettings.favpicbuttons[i].generic.flags &= ~QMF_INACTIVE;
|
|
}
|
|
else{
|
|
s_playersettings.favpics[i].generic.name = NULL;
|
|
s_playersettings.favpicbuttons[i].generic.flags |= QMF_INACTIVE;
|
|
}
|
|
|
|
s_playersettings.favpics[i].shader = 0;
|
|
}
|
|
}
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_Update
|
|
=================
|
|
*/
|
|
void PlayerSettings_Update( void ){
|
|
trap_Cvar_VariableStringBuffer( "rim", s_playersettings.rimskin, sizeof( s_playersettings.rimskin ) );
|
|
trap_Cvar_VariableStringBuffer( "head", s_playersettings.headskin, sizeof( s_playersettings.headskin ) );
|
|
trap_Cvar_VariableStringBuffer( "model", s_playersettings.modelskin, sizeof( s_playersettings.modelskin ) );
|
|
|
|
PlayerSettings_UpdateFavorites();
|
|
PlayerSettings_UpdateModel();
|
|
}
|
|
// END
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_SaveChanges
|
|
=================
|
|
*/
|
|
static void PlayerSettings_SaveChanges( void ) {
|
|
// name
|
|
trap_Cvar_Set( "name", s_playersettings.name.field.buffer );
|
|
|
|
// STONELANCE
|
|
if (s_playersettings.modelChanged){
|
|
trap_Cvar_Set( "model", s_playersettings.modelskin );
|
|
}
|
|
// END
|
|
|
|
// handicap
|
|
trap_Cvar_SetValue( "handicap", 100 - s_playersettings.handicap.curvalue * 5 );
|
|
|
|
// effects color
|
|
trap_Cvar_SetValue( "color", uitogamecode[s_playersettings.effects.curvalue] );
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_MenuKey
|
|
=================
|
|
*/
|
|
static sfxHandle_t PlayerSettings_MenuKey( int key ) {
|
|
if( key == K_MOUSE2 || key == K_ESCAPE ) {
|
|
// STONELANCE
|
|
// PlayerSettings_SaveChanges();
|
|
s_playersettings.menu.transitionMenu = ID_BACK;
|
|
uis.transitionOut = uis.realtime;
|
|
return 0;
|
|
// END
|
|
}
|
|
return Menu_DefaultKey( &s_playersettings.menu, key );
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_SetMenuItems
|
|
=================
|
|
*/
|
|
static void PlayerSettings_SetMenuItems( void ) {
|
|
// vec3_t viewangles;
|
|
int c;
|
|
int h;
|
|
|
|
// STONELANCE
|
|
int i;
|
|
char modelName[MAX_QPATH];
|
|
char *slash;
|
|
qboolean carFound;
|
|
|
|
trap_Cvar_VariableStringBuffer( "rim", s_playersettings.rimskin, sizeof( s_playersettings.rimskin ) );
|
|
trap_Cvar_VariableStringBuffer( "head", s_playersettings.headskin, sizeof( s_playersettings.headskin ) );
|
|
trap_Cvar_VariableStringBuffer( "model", s_playersettings.modelskin, sizeof( s_playersettings.modelskin ) );
|
|
// END
|
|
|
|
// name
|
|
Q_strncpyz( s_playersettings.name.field.buffer, UI_Cvar_VariableString("name"), sizeof(s_playersettings.name.field.buffer) );
|
|
|
|
// 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;
|
|
*/
|
|
// STONELANCE
|
|
Q_strncpyz( modelName, s_playersettings.modelskin, sizeof( modelName ) );
|
|
slash = strchr( modelName, '/' );
|
|
if ( slash ) {
|
|
*slash = 0;
|
|
}
|
|
|
|
s_playersettings.modelChanged = qfalse;
|
|
|
|
// find model in our list
|
|
carFound = qfalse;
|
|
for (i = 0; i < s_playersettings.allModels; i++)
|
|
{
|
|
if (!Q_stricmp( modelName, s_playersettings.modelList[i] )){
|
|
// found pic, set selection here
|
|
s_playersettings.selectedModel = i;
|
|
s_playersettings.modelname.string = s_playersettings.modelList[s_playersettings.selectedModel];
|
|
carFound = qtrue;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!carFound){
|
|
s_playersettings.selectedModel = 0;
|
|
|
|
// get model
|
|
Com_sprintf( s_playersettings.modelskin, sizeof(s_playersettings.modelskin), "%s/%s", s_playersettings.modelList[s_playersettings.selectedModel], DEFAULT_SKIN);
|
|
s_playersettings.modelname.string = s_playersettings.modelList[s_playersettings.selectedModel];
|
|
s_playersettings.modelChanged = qtrue;
|
|
}
|
|
|
|
/*
|
|
UI_PlayerInfo_SetModel( &s_playersettings.playerinfo, UI_Cvar_VariableString( "model" ) );
|
|
UI_PlayerInfo_SetInfo( &s_playersettings.playerinfo, LEGS_IDLE, TORSO_STAND, viewangles, vec3_origin, WP_MACHINEGUN, qfalse );
|
|
*/
|
|
|
|
PlayerSettings_UpdateModel();
|
|
PlayerSettings_UpdateFavorites();
|
|
// END
|
|
|
|
// handicap
|
|
h = Com_Clamp( 5, 100, trap_Cvar_VariableValue("handicap") );
|
|
s_playersettings.handicap.curvalue = 20 - h / 5;
|
|
}
|
|
|
|
|
|
// STONELANCE
|
|
/*
|
|
=================
|
|
PlayerSettings_PicEvent
|
|
=================
|
|
*/
|
|
static void PlayerSettings_PicEvent( void* ptr, int event )
|
|
{
|
|
if (event != QM_ACTIVATED)
|
|
return;
|
|
|
|
switch(((menucommon_s*)ptr)->id){
|
|
case ID_FAVORITE1:
|
|
LoadFavorite("favoritecar1");
|
|
break;
|
|
|
|
case ID_FAVORITE2:
|
|
LoadFavorite("favoritecar2");
|
|
break;
|
|
|
|
case ID_FAVORITE3:
|
|
LoadFavorite("favoritecar3");
|
|
break;
|
|
|
|
case ID_FAVORITE4:
|
|
LoadFavorite("favoritecar4");
|
|
break;
|
|
}
|
|
|
|
PlayerSettings_UpdateModel();
|
|
}
|
|
// END
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_MenuEvent
|
|
=================
|
|
*/
|
|
static void PlayerSettings_MenuEvent( void* ptr, int event ) {
|
|
if( event != QM_ACTIVATED ) {
|
|
return;
|
|
}
|
|
|
|
switch( ((menucommon_s*)ptr)->id ) {
|
|
case ID_HANDICAP:
|
|
trap_Cvar_Set( "handicap", va( "%i", 100 - 25 * s_playersettings.handicap.curvalue ) );
|
|
break;
|
|
|
|
// STONELANCE
|
|
/*
|
|
case ID_MODEL:
|
|
PlayerSettings_SaveChanges();
|
|
UI_PlayerModelMenu();
|
|
break;
|
|
|
|
case ID_BACK:
|
|
PlayerSettings_SaveChanges();
|
|
UI_PopMenu();
|
|
break;
|
|
*/
|
|
|
|
case ID_CUSTOMIZE:
|
|
case ID_BACK:
|
|
s_playersettings.menu.transitionMenu = ((menucommon_s*)ptr)->id;
|
|
uis.transitionOut = uis.realtime;
|
|
break;
|
|
|
|
case ID_PLATE:
|
|
UI_PlateSelectionMenu();
|
|
break;
|
|
|
|
case ID_LEFT:
|
|
//Com_Printf("Clicked car selection LEFT\n");
|
|
if (s_playersettings.selectedModel > 0)
|
|
{
|
|
s_playersettings.selectedModel--;
|
|
|
|
//Com_Printf("PS: Car selected, %i\n", s_playersettings.selectedmodel);
|
|
|
|
// get model
|
|
Com_sprintf(s_playersettings.modelskin, sizeof(s_playersettings.modelskin), "%s/%s", s_playersettings.modelList[s_playersettings.selectedModel], DEFAULT_SKIN);
|
|
|
|
//Com_Printf("PS: modelskin set to: %s\n", s_playersettings.modelskin);
|
|
|
|
s_playersettings.modelname.string = s_playersettings.modelList[s_playersettings.selectedModel];
|
|
|
|
//Com_Printf("PS: modelname set to: %s\n", s_playersettings.modelname.string);
|
|
|
|
s_playersettings.modelChanged = qtrue;
|
|
|
|
PlayerSettings_UpdateModel();
|
|
}
|
|
break;
|
|
|
|
case ID_RIGHT:
|
|
//Com_Printf("Clicked car selection RIGHT\n");
|
|
if (s_playersettings.selectedModel < s_playersettings.numModels - 1 )
|
|
{
|
|
s_playersettings.selectedModel++;
|
|
|
|
//Com_Printf("PS: Car selected, %i\n", s_playersettings.selectedmodel);
|
|
|
|
// get model
|
|
Com_sprintf(s_playersettings.modelskin, sizeof(s_playersettings.modelskin), "%s/%s", s_playersettings.modelList[s_playersettings.selectedModel], DEFAULT_SKIN);
|
|
|
|
//Com_Printf("PS: modelskin set to: %s\n", s_playersettings.modelskin);
|
|
|
|
s_playersettings.modelname.string = s_playersettings.modelList[s_playersettings.selectedModel];
|
|
|
|
//Com_Printf("PS: modelname set to: %s\n", s_playersettings.modelname.string);
|
|
|
|
s_playersettings.modelChanged = qtrue;
|
|
|
|
PlayerSettings_UpdateModel();
|
|
}
|
|
break;
|
|
// END
|
|
}
|
|
}
|
|
|
|
|
|
// STONELANCE
|
|
/*
|
|
=================
|
|
PlayerSettigns_ChangeMenu
|
|
=================
|
|
*/
|
|
void PlayerSettigns_ChangeMenu( int menuID ){
|
|
|
|
switch(menuID){
|
|
case ID_CUSTOMIZE:
|
|
PlayerSettings_SaveChanges();
|
|
s_playersettings.modelChanged = qfalse;
|
|
UI_PlayerModelMenu( s_playersettings.modelname.string );
|
|
break;
|
|
|
|
case ID_BACK:
|
|
PlayerSettings_SaveChanges();
|
|
s_playersettings.modelChanged = qfalse;
|
|
// uis.transitionIn = uis.realtime;
|
|
UI_PopMenu();
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_RunTransition
|
|
=================
|
|
*/
|
|
void PlayerSettings_RunTransition(float frac){
|
|
int i, y;
|
|
|
|
uis.text_color[0] = text_color_normal[0];
|
|
uis.text_color[1] = text_color_normal[1];
|
|
uis.text_color[2] = text_color_normal[2];
|
|
uis.text_color[3] = text_color_normal[3] * frac;
|
|
|
|
s_playersettings.banner.color = uis.text_color;
|
|
|
|
s_playersettings.customize.color = uis.text_color;
|
|
s_playersettings.favorites.color = uis.text_color;
|
|
s_playersettings.modelname.color = uis.text_color;
|
|
s_playersettings.plate.color = uis.text_color;
|
|
|
|
if (s_playersettings.menu.transitionMenu != ID_CUSTOMIZE){
|
|
y = 403 + (int)(77 * (1 - frac));
|
|
for (i=0; i<NUM_FAVORITES; i++){
|
|
s_playersettings.ports[i].generic.y = y;
|
|
s_playersettings.favpics[i].generic.y = y;
|
|
s_playersettings.favpicbuttons[i].generic.y = y;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_BuildList
|
|
=================
|
|
*/
|
|
static void PlayerSettings_BuildList( void ){
|
|
// get car list
|
|
s_playersettings.numModels = UI_BuildFileList("models/players", "md3", "body", qtrue, qtrue, BL_EXCLUDE, 0, s_playersettings.modelList);
|
|
s_playersettings.allModels = UI_BuildFileList("models/players", "md3", "body", qtrue, qtrue, BL_ONLY, s_playersettings.numModels, s_playersettings.modelList);
|
|
}
|
|
// END
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_MenuInit
|
|
=================
|
|
*/
|
|
static void PlayerSettings_MenuInit( void ) {
|
|
int y;
|
|
// STONELANCE
|
|
int i, j, x;
|
|
static char modelname[32];
|
|
// END
|
|
|
|
memset(&s_playersettings,0,sizeof(playersettings_t));
|
|
|
|
PlayerSettings_Cache();
|
|
|
|
s_playersettings.menu.key = PlayerSettings_MenuKey;
|
|
s_playersettings.menu.wrapAround = qtrue;
|
|
s_playersettings.menu.fullscreen = qtrue;
|
|
// STONELANCE
|
|
s_playersettings.menu.draw = PlayerSettings_DrawBackShaders;
|
|
s_playersettings.menu.transition = PlayerSettings_RunTransition;
|
|
s_playersettings.menu.changeMenu = PlayerSettigns_ChangeMenu;
|
|
// END
|
|
|
|
s_playersettings.banner.generic.type = MTYPE_BTEXT;
|
|
s_playersettings.banner.generic.x = 320;
|
|
// STONELANCE
|
|
s_playersettings.banner.generic.y = 17;
|
|
// END
|
|
s_playersettings.banner.string = "PLAYER SETTINGS";
|
|
// STONELANCE
|
|
s_playersettings.banner.color = text_color_normal;
|
|
// END
|
|
s_playersettings.banner.style = UI_CENTER;
|
|
|
|
// STONELANCE
|
|
/*
|
|
s_playersettings.framel.generic.type = MTYPE_BITMAP;
|
|
s_playersettings.framel.generic.name = ART_FRAMEL;
|
|
s_playersettings.framel.generic.flags = QMF_LEFT_JUSTIFY|QMF_INACTIVE;
|
|
s_playersettings.framel.generic.x = 0;
|
|
s_playersettings.framel.generic.y = 78;
|
|
s_playersettings.framel.width = 256;
|
|
s_playersettings.framel.height = 329;
|
|
|
|
s_playersettings.framer.generic.type = MTYPE_BITMAP;
|
|
s_playersettings.framer.generic.name = ART_FRAMER;
|
|
s_playersettings.framer.generic.flags = QMF_LEFT_JUSTIFY|QMF_INACTIVE;
|
|
s_playersettings.framer.generic.x = 376;
|
|
s_playersettings.framer.generic.y = 76;
|
|
s_playersettings.framer.width = 256;
|
|
s_playersettings.framer.height = 334;
|
|
*/
|
|
|
|
// y = 144;
|
|
y = 86;
|
|
// END
|
|
s_playersettings.name.generic.type = MTYPE_FIELD;
|
|
s_playersettings.name.generic.flags = QMF_NODEFAULTINIT;
|
|
s_playersettings.name.generic.ownerdraw = PlayerSettings_DrawName;
|
|
s_playersettings.name.field.widthInChars = MAX_NAMELENGTH;
|
|
s_playersettings.name.field.maxchars = MAX_NAMELENGTH;
|
|
// STONELANCE
|
|
/*
|
|
s_playersettings.name.generic.x = 192;
|
|
s_playersettings.name.generic.y = y;
|
|
s_playersettings.name.generic.left = 192 - 8;
|
|
s_playersettings.name.generic.top = y - 8;
|
|
s_playersettings.name.generic.right = 192 + 200;
|
|
s_playersettings.name.generic.bottom = y + 2 * PROP_HEIGHT;
|
|
*/
|
|
s_playersettings.name.generic.x = 30;
|
|
s_playersettings.name.generic.y = y;
|
|
s_playersettings.name.generic.left = 30;
|
|
s_playersettings.name.generic.top = y;
|
|
s_playersettings.name.generic.right = 30 + 203;
|
|
s_playersettings.name.generic.bottom = y + 36;
|
|
|
|
// y += 3 * PROP_HEIGHT;
|
|
// END
|
|
s_playersettings.handicap.generic.type = MTYPE_SPINCONTROL;
|
|
s_playersettings.handicap.generic.flags = QMF_NODEFAULTINIT;
|
|
s_playersettings.handicap.generic.id = ID_HANDICAP;
|
|
s_playersettings.handicap.generic.ownerdraw = PlayerSettings_DrawHandicap;
|
|
// STONELANCE
|
|
/*
|
|
s_playersettings.handicap.generic.x = 192;
|
|
s_playersettings.handicap.generic.y = y;
|
|
s_playersettings.handicap.generic.left = 192 - 8;
|
|
s_playersettings.handicap.generic.top = y - 8;
|
|
s_playersettings.handicap.generic.right = 192 + 200;
|
|
s_playersettings.handicap.generic.bottom = y + 2 * PROP_HEIGHT;
|
|
*/
|
|
s_playersettings.handicap.generic.x = 262;
|
|
s_playersettings.handicap.generic.y = y;
|
|
s_playersettings.handicap.generic.left = 262;
|
|
s_playersettings.handicap.generic.top = y;
|
|
s_playersettings.handicap.generic.right = 262 + 194;
|
|
s_playersettings.handicap.generic.bottom = y + 36;
|
|
// END
|
|
s_playersettings.handicap.numitems = 20;
|
|
|
|
// STONELANCE
|
|
// y += 3 * PROP_HEIGHT;
|
|
// END
|
|
s_playersettings.effects.generic.type = MTYPE_SPINCONTROL;
|
|
s_playersettings.effects.generic.flags = QMF_NODEFAULTINIT;
|
|
s_playersettings.effects.generic.id = ID_EFFECTS;
|
|
s_playersettings.effects.generic.ownerdraw = PlayerSettings_DrawEffects;
|
|
// STONELANCE
|
|
/*
|
|
s_playersettings.effects.generic.x = 192;
|
|
s_playersettings.effects.generic.y = y;
|
|
s_playersettings.effects.generic.left = 192 - 8;
|
|
s_playersettings.effects.generic.top = y - 8;
|
|
s_playersettings.effects.generic.right = 192 + 200;
|
|
s_playersettings.effects.generic.bottom = y + 2* PROP_HEIGHT;
|
|
*/
|
|
s_playersettings.effects.generic.x = 463;
|
|
s_playersettings.effects.generic.y = y;
|
|
s_playersettings.effects.generic.left = 463;
|
|
s_playersettings.effects.generic.top = y;
|
|
s_playersettings.effects.generic.right = 463 + 147;
|
|
s_playersettings.effects.generic.bottom = y + 36;
|
|
// END
|
|
s_playersettings.effects.numitems = 7;
|
|
|
|
// STONELANCE
|
|
/*
|
|
s_playersettings.model.generic.type = MTYPE_BITMAP;
|
|
s_playersettings.model.generic.name = ART_MODEL0;
|
|
s_playersettings.model.generic.flags = QMF_RIGHT_JUSTIFY|QMF_PULSEIFFOCUS;
|
|
s_playersettings.model.generic.id = ID_MODEL;
|
|
s_playersettings.model.generic.callback = PlayerSettings_MenuEvent;
|
|
s_playersettings.model.generic.x = 640;
|
|
s_playersettings.model.generic.y = 480-64;
|
|
s_playersettings.model.width = 128;
|
|
s_playersettings.model.height = 64;
|
|
s_playersettings.model.focuspic = ART_MODEL1;
|
|
*/
|
|
s_playersettings.customize.generic.type = MTYPE_PTEXT;
|
|
s_playersettings.customize.generic.flags = QMF_NODEFAULTINIT;
|
|
s_playersettings.customize.generic.id = ID_CUSTOMIZE;
|
|
s_playersettings.customize.generic.ownerdraw= PlayerSettings_DrawCustomize;
|
|
s_playersettings.customize.generic.x = 640 - 20;
|
|
s_playersettings.customize.generic.y = 480 - 60;
|
|
s_playersettings.customize.generic.left = 640 - 20 - 100;
|
|
s_playersettings.customize.generic.top = 480 - 60;
|
|
s_playersettings.customize.generic.right = 640 - 20;
|
|
s_playersettings.customize.generic.bottom = 480 - 20;
|
|
s_playersettings.customize.generic.callback = PlayerSettings_MenuEvent;
|
|
s_playersettings.customize.color = text_color_normal;
|
|
s_playersettings.customize.style = UI_RIGHT;
|
|
// END
|
|
|
|
s_playersettings.player.generic.type = MTYPE_BITMAP;
|
|
s_playersettings.player.generic.flags = QMF_INACTIVE;
|
|
s_playersettings.player.generic.ownerdraw = PlayerSettings_DrawPlayer;
|
|
// STONELANCE
|
|
/*
|
|
s_playersettings.player.generic.x = 400;
|
|
s_playersettings.player.generic.y = -40;
|
|
s_playersettings.player.width = 32*10;
|
|
s_playersettings.player.height = 56*10;
|
|
*/
|
|
s_playersettings.player.generic.x = 40;
|
|
s_playersettings.player.generic.y = 0;
|
|
s_playersettings.player.width = 560;
|
|
s_playersettings.player.height = 480;
|
|
|
|
|
|
y = 138;
|
|
s_playersettings.modelname.generic.type = MTYPE_PTEXT;
|
|
s_playersettings.modelname.generic.flags = QMF_CENTER_JUSTIFY|QMF_INACTIVE;
|
|
s_playersettings.modelname.generic.x = 320;
|
|
s_playersettings.modelname.generic.y = y + 4;
|
|
s_playersettings.modelname.string = modelname;
|
|
s_playersettings.modelname.style = UI_CENTER;
|
|
s_playersettings.modelname.color = text_color_normal;
|
|
|
|
s_playersettings.left.generic.type = MTYPE_BITMAP;
|
|
s_playersettings.left.generic.name = ART_LEFT0;
|
|
s_playersettings.left.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
|
|
s_playersettings.left.generic.callback = PlayerSettings_MenuEvent;
|
|
s_playersettings.left.generic.id = ID_LEFT;
|
|
s_playersettings.left.generic.x = 124 - 16;
|
|
s_playersettings.left.generic.y = y;
|
|
s_playersettings.left.width = 32;
|
|
s_playersettings.left.height = 32;
|
|
s_playersettings.left.focuspic = ART_LEFT1;
|
|
|
|
s_playersettings.right.generic.type = MTYPE_BITMAP;
|
|
s_playersettings.right.generic.name = ART_RIGHT0;
|
|
s_playersettings.right.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
|
|
s_playersettings.right.generic.callback = PlayerSettings_MenuEvent;
|
|
s_playersettings.right.generic.id = ID_RIGHT;
|
|
s_playersettings.right.generic.x = 124 + 392 - 16;
|
|
s_playersettings.right.generic.y = y;
|
|
s_playersettings.right.width = 32;
|
|
s_playersettings.right.height = 32;
|
|
s_playersettings.right.focuspic = ART_RIGHT1;
|
|
|
|
s_playersettings.favorites.generic.type = MTYPE_PTEXT;
|
|
s_playersettings.favorites.generic.flags = QMF_CENTER_JUSTIFY|QMF_INACTIVE;
|
|
s_playersettings.favorites.generic.x = 320;
|
|
s_playersettings.favorites.generic.y = 378;
|
|
s_playersettings.favorites.string = "LOAD FAVORITE";
|
|
s_playersettings.favorites.style = UI_CENTER|UI_SMALLFONT;
|
|
s_playersettings.favorites.color = text_color_normal;
|
|
|
|
x = 183;
|
|
y = 403;
|
|
for (j=0; j<NUM_FAVORITES; j++)
|
|
{
|
|
s_playersettings.ports[j].generic.type = MTYPE_BITMAP;
|
|
s_playersettings.ports[j].generic.name = ART_PORT;
|
|
s_playersettings.ports[j].generic.flags = QMF_LEFT_JUSTIFY|QMF_INACTIVE;
|
|
s_playersettings.ports[j].generic.x = x;
|
|
s_playersettings.ports[j].generic.y = y;
|
|
s_playersettings.ports[j].width = 64;
|
|
s_playersettings.ports[j].height = 64;
|
|
|
|
s_playersettings.favpics[j].generic.type = MTYPE_BITMAP;
|
|
s_playersettings.favpics[j].generic.flags = QMF_LEFT_JUSTIFY|QMF_INACTIVE;
|
|
s_playersettings.favpics[j].generic.x = x;
|
|
s_playersettings.favpics[j].generic.y = y;
|
|
s_playersettings.favpics[j].width = 64;
|
|
s_playersettings.favpics[j].height = 64;
|
|
s_playersettings.favpics[j].focuspic = ART_SELECTED;
|
|
s_playersettings.favpics[j].focuscolor = text_color_highlight;
|
|
|
|
s_playersettings.favpicbuttons[j].generic.type = MTYPE_BITMAP;
|
|
s_playersettings.favpicbuttons[j].generic.flags = QMF_LEFT_JUSTIFY|QMF_NODEFAULTINIT|QMF_PULSEIFFOCUS;
|
|
s_playersettings.favpicbuttons[j].generic.id = ID_FAVORITE1 + j;
|
|
s_playersettings.favpicbuttons[j].generic.callback = PlayerSettings_PicEvent;
|
|
s_playersettings.favpicbuttons[j].generic.x = x;
|
|
s_playersettings.favpicbuttons[j].generic.y = y;
|
|
s_playersettings.favpicbuttons[j].generic.left = x;
|
|
s_playersettings.favpicbuttons[j].generic.top = y;
|
|
s_playersettings.favpicbuttons[j].generic.right = x + 64;
|
|
s_playersettings.favpicbuttons[j].generic.bottom = y + 64;
|
|
s_playersettings.favpicbuttons[j].width = 64;
|
|
s_playersettings.favpicbuttons[j].height = 64;
|
|
s_playersettings.favpicbuttons[j].focuspic = ART_SELECT;
|
|
s_playersettings.favpicbuttons[j].focuscolor = text_color_highlight;
|
|
|
|
x += 64+6;
|
|
}
|
|
|
|
s_playersettings.plate.generic.type = MTYPE_PTEXT;
|
|
s_playersettings.plate.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
|
|
s_playersettings.plate.generic.x = 640 - 140;
|
|
s_playersettings.plate.generic.y = 378;
|
|
s_playersettings.plate.generic.id = ID_PLATE;
|
|
s_playersettings.plate.generic.callback = PlayerSettings_MenuEvent;
|
|
s_playersettings.plate.string = "CHANGE PLATE";
|
|
s_playersettings.plate.color = text_color_normal;
|
|
s_playersettings.plate.style = UI_LEFT | UI_SMALLFONT;
|
|
|
|
|
|
s_playersettings.back.generic.type = MTYPE_PTEXT;
|
|
s_playersettings.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
|
|
s_playersettings.back.generic.x = 20;
|
|
s_playersettings.back.generic.y = 480 - 50;
|
|
s_playersettings.back.generic.id = ID_BACK;
|
|
s_playersettings.back.generic.callback = PlayerSettings_MenuEvent;
|
|
s_playersettings.back.string = "< BACK";
|
|
s_playersettings.back.color = text_color_normal;
|
|
s_playersettings.back.style = UI_LEFT | UI_SMALLFONT;
|
|
|
|
/*
|
|
s_playersettings.back.generic.type = MTYPE_BITMAP;
|
|
s_playersettings.back.generic.name = ART_BACK0;
|
|
s_playersettings.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
|
|
s_playersettings.back.generic.id = ID_BACK;
|
|
s_playersettings.back.generic.callback = PlayerSettings_MenuEvent;
|
|
s_playersettings.back.generic.x = 0;
|
|
s_playersettings.back.generic.y = 480-64;
|
|
s_playersettings.back.width = 128;
|
|
s_playersettings.back.height = 64;
|
|
s_playersettings.back.focuspic = ART_BACK1;
|
|
|
|
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;
|
|
s_playersettings.item_null.generic.y = 0;
|
|
s_playersettings.item_null.width = 640;
|
|
s_playersettings.item_null.height = 480;
|
|
*/
|
|
// END
|
|
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.banner );
|
|
// STONELANCE
|
|
/*
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.framel );
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.framer );
|
|
*/
|
|
// END
|
|
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.name );
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.handicap );
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.effects );
|
|
|
|
// STONELANCE
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.favorites );
|
|
for (i=0; i<NUM_FAVORITES; i++)
|
|
{
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.ports[i] );
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.favpicbuttons[i] );
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.favpics[i] );
|
|
}
|
|
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.player );
|
|
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.left );
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.right );
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.modelname );
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.customize );
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.plate );
|
|
// END
|
|
|
|
// STONELANCE
|
|
// Menu_AddItem( &s_playersettings.menu, &s_playersettings.model );
|
|
// END
|
|
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.back );
|
|
|
|
Menu_AddItem( &s_playersettings.menu, &s_playersettings.player );
|
|
|
|
// STONELANCE
|
|
// Menu_AddItem( &s_playersettings.menu, &s_playersettings.item_null );
|
|
// END
|
|
|
|
PlayerSettings_SetMenuItems();
|
|
|
|
// STONELANCE
|
|
uis.transitionIn = uis.realtime;
|
|
// END
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlayerSettings_Cache
|
|
=================
|
|
*/
|
|
void PlayerSettings_Cache( void ) {
|
|
// STONELANCE
|
|
/*
|
|
trap_R_RegisterShaderNoMip( ART_FRAMEL );
|
|
trap_R_RegisterShaderNoMip( ART_FRAMER );
|
|
trap_R_RegisterShaderNoMip( ART_MODEL0 );
|
|
trap_R_RegisterShaderNoMip( ART_MODEL1 );
|
|
trap_R_RegisterShaderNoMip( ART_BACK0 );
|
|
trap_R_RegisterShaderNoMip( ART_BACK1 );
|
|
*/
|
|
// END
|
|
|
|
s_playersettings.fxBasePic = trap_R_RegisterShaderNoMip( ART_FX_BASE );
|
|
s_playersettings.fxPic[0] = trap_R_RegisterShaderNoMip( ART_FX_RED );
|
|
s_playersettings.fxPic[1] = trap_R_RegisterShaderNoMip( ART_FX_YELLOW );
|
|
s_playersettings.fxPic[2] = trap_R_RegisterShaderNoMip( ART_FX_GREEN );
|
|
s_playersettings.fxPic[3] = trap_R_RegisterShaderNoMip( ART_FX_TEAL );
|
|
s_playersettings.fxPic[4] = trap_R_RegisterShaderNoMip( ART_FX_BLUE );
|
|
s_playersettings.fxPic[5] = trap_R_RegisterShaderNoMip( ART_FX_CYAN );
|
|
s_playersettings.fxPic[6] = trap_R_RegisterShaderNoMip( ART_FX_WHITE );
|
|
|
|
// STONELANCE
|
|
PlayerSettings_BuildList();
|
|
// END
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
UI_PlayerSettingsMenu
|
|
=================
|
|
*/
|
|
void UI_PlayerSettingsMenu( void ) {
|
|
PlayerSettings_MenuInit();
|
|
UI_PushMenu( &s_playersettings.menu );
|
|
}
|
|
|
|
|
|
// STONELANCE
|
|
/*****************************************************
|
|
|
|
Plate Selection
|
|
|
|
*****************************************************/
|
|
|
|
|
|
#define ID_LIST 1
|
|
#define ID_CANCEL 2
|
|
#define ID_ACCEPT 3
|
|
|
|
|
|
#define MAX_PLATEMODELS 256
|
|
|
|
typedef struct {
|
|
menuframework_s menu;
|
|
|
|
menulist_s list;
|
|
|
|
menutext_s cancel;
|
|
menutext_s accept;
|
|
|
|
char plateList[MAX_PLATEMODELS][MAX_QPATH];
|
|
char* items[MAX_PLATEMODELS];
|
|
int numPlates;
|
|
|
|
char plateSkin[MAX_QPATH];
|
|
} plateSelection_t;
|
|
|
|
static plateSelection_t s_plateSelection;
|
|
|
|
|
|
/*
|
|
=================
|
|
PlateSelection_Event
|
|
=================
|
|
*/
|
|
static void PlateSelection_Event( void* ptr, int event ) {
|
|
int id;
|
|
|
|
id = ((menucommon_s*)ptr)->id;
|
|
|
|
if( event != QM_ACTIVATED && id != ID_LIST ) {
|
|
return;
|
|
}
|
|
|
|
switch( id ) {
|
|
case ID_LIST:
|
|
// update plateSkin
|
|
Q_strncpyz( s_plateSelection.plateSkin, s_plateSelection.plateList[s_plateSelection.list.curvalue], sizeof(s_plateSelection.plateSkin) );
|
|
break;
|
|
|
|
case ID_CANCEL:
|
|
UI_PopMenu();
|
|
uis.transitionIn = 0;
|
|
break;
|
|
|
|
case ID_ACCEPT:
|
|
trap_Cvar_Set( "plate", s_plateSelection.plateSkin );
|
|
PlayerSettings_UpdateModel();
|
|
UI_PopMenu();
|
|
uis.transitionIn = 0;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlateSelection_DrawMenu
|
|
=================
|
|
*/
|
|
static void PlateSelection_DrawMenu( void ) {
|
|
refdef_t refdef;
|
|
refEntity_t ent;
|
|
vec3_t origin;
|
|
vec3_t angles;
|
|
float x, y, w, h;
|
|
|
|
// setup the refdef
|
|
|
|
memset( &refdef, 0, sizeof( refdef ) );
|
|
|
|
refdef.rdflags = RDF_NOWORLDMODEL;
|
|
|
|
AxisClear( refdef.viewaxis );
|
|
|
|
x = 150;
|
|
y = 115;
|
|
w = 328;
|
|
h = 232;
|
|
UI_AdjustFrom640( &x, &y, &w, &h );
|
|
refdef.x = x;
|
|
refdef.y = y;
|
|
refdef.width = w;
|
|
refdef.height = h;
|
|
|
|
refdef.fov_x = 180;
|
|
refdef.fov_y = 180;
|
|
|
|
refdef.time = uis.realtime;
|
|
|
|
origin[0] = 300;
|
|
origin[1] = 0;
|
|
origin[2] = 0;
|
|
|
|
trap_R_ClearScene();
|
|
|
|
// draw license plate with selected skin
|
|
|
|
memset( &ent, 0, sizeof(ent) );
|
|
|
|
VectorSet( angles, 45, 45, 45 );
|
|
AnglesToAxis( angles, ent.axis );
|
|
|
|
if (strstr(s_plateSelection.plateSkin, "usa_"))
|
|
ent.hModel = trap_R_RegisterModel("models/players/plates/plate_usa.md3");
|
|
else
|
|
ent.hModel = trap_R_RegisterModel("models/players/plates/plate_eu.md3");
|
|
ent.customShader = trap_R_RegisterShaderNoMip( va("models/players/plates/%s", s_plateSelection.plateSkin) );
|
|
|
|
VectorCopy( origin, ent.origin );
|
|
VectorCopy( origin, ent.lightingOrigin );
|
|
ent.renderfx = RF_LIGHTING_ORIGIN | RF_NOSHADOW;
|
|
VectorCopy( ent.origin, ent.oldorigin );
|
|
|
|
trap_R_AddRefEntityToScene( &ent );
|
|
|
|
trap_R_RenderScene( &refdef );
|
|
|
|
/*
|
|
qhandle_t plate;
|
|
plate = trap_R_RegisterShaderNoMip( va("models/players/plates/%s", s_plateSelection.plateSkin) );
|
|
|
|
if (strstr(s_plateSelection.plateSkin, "usa_"))
|
|
UI_DrawHandlePic(250+32, 215, 64, 32, plate);
|
|
else
|
|
UI_DrawHandlePic(250, 215, 128, 32, plate);
|
|
*/
|
|
|
|
Menu_Draw( &s_plateSelection.menu );
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlateSelection_SetMenuItems
|
|
=================
|
|
*/
|
|
static void PlateSelection_SetMenuItems( void ) {
|
|
int i;
|
|
|
|
trap_Cvar_VariableStringBuffer( "plate", s_plateSelection.plateSkin, sizeof( s_plateSelection.plateSkin ) );
|
|
|
|
if (!s_plateSelection.numPlates)
|
|
return;
|
|
|
|
// find model in our list
|
|
for (i = 0; i < s_plateSelection.numPlates; i++)
|
|
{
|
|
if (!Q_stricmp( s_plateSelection.plateSkin, s_plateSelection.plateList[i] )){
|
|
// found pic, set selection here
|
|
s_plateSelection.list.curvalue = i;
|
|
if (s_plateSelection.list.top + s_plateSelection.list.height > s_plateSelection.numPlates)
|
|
s_plateSelection.list.top = s_plateSelection.numPlates - s_plateSelection.list.height;
|
|
|
|
if (s_plateSelection.list.top < 0)
|
|
s_plateSelection.list.top = 0;
|
|
else
|
|
s_plateSelection.list.top = i;
|
|
|
|
return;
|
|
}
|
|
}
|
|
|
|
s_plateSelection.list.curvalue = 0;
|
|
s_plateSelection.list.top = 0;
|
|
Q_strncpyz(s_plateSelection.plateSkin, s_plateSelection.plateList[0], sizeof(s_plateSelection.plateSkin));
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlateSelection_Cache
|
|
=================
|
|
*/
|
|
void PlateSelection_Cache( void ) {
|
|
// get car list
|
|
s_plateSelection.numPlates = UI_BuildFileList("models/players/plates", "tga", "*usa_", qtrue, qfalse, qtrue, 0, s_plateSelection.plateList);
|
|
s_plateSelection.numPlates = UI_BuildFileList("models/players/plates", "tga", "*eu_", qtrue, qfalse, qtrue, s_plateSelection.numPlates, s_plateSelection.plateList);
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
PlateSelection_MenuInit
|
|
=================
|
|
*/
|
|
static void PlateSelection_MenuInit( void ) {
|
|
int i;
|
|
|
|
memset(&s_plateSelection, 0, sizeof(plateSelection_t));
|
|
|
|
PlateSelection_Cache();
|
|
|
|
s_plateSelection.menu.wrapAround = qtrue;
|
|
s_plateSelection.menu.transparent = qtrue;
|
|
s_plateSelection.menu.fullscreen = qtrue;
|
|
s_plateSelection.menu.draw = PlateSelection_DrawMenu;
|
|
|
|
|
|
s_plateSelection.list.generic.type = MTYPE_LISTBOX;
|
|
s_plateSelection.list.scrollbarAlignment = SB_RIGHT;
|
|
s_plateSelection.list.generic.flags = QMF_LEFT_JUSTIFY|QMF_HIGHLIGHT_IF_FOCUS;
|
|
s_plateSelection.list.generic.id = ID_LIST;
|
|
s_plateSelection.list.generic.callback = PlateSelection_Event;
|
|
s_plateSelection.list.generic.x = 50;
|
|
s_plateSelection.list.generic.y = 175;
|
|
s_plateSelection.list.width = 25;
|
|
s_plateSelection.list.height = 11;
|
|
s_plateSelection.list.itemnames = (const char **)s_plateSelection.items;
|
|
s_plateSelection.list.numitems = s_plateSelection.numPlates;
|
|
for( i = 0; i < MAX_PLATEMODELS; i++ ) {
|
|
s_plateSelection.items[i] = s_plateSelection.plateList[i];
|
|
}
|
|
|
|
s_plateSelection.cancel.generic.type = MTYPE_PTEXT;
|
|
s_plateSelection.cancel.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
|
|
s_plateSelection.cancel.generic.x = 250;
|
|
s_plateSelection.cancel.generic.y = 350;
|
|
s_plateSelection.cancel.generic.id = ID_CANCEL;
|
|
s_plateSelection.cancel.generic.callback = PlateSelection_Event;
|
|
s_plateSelection.cancel.string = "Cancel";
|
|
s_plateSelection.cancel.color = text_color_normal;
|
|
s_plateSelection.cancel.style = UI_LEFT | UI_SMALLFONT;
|
|
|
|
s_plateSelection.accept.generic.type = MTYPE_PTEXT;
|
|
s_plateSelection.accept.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS;
|
|
s_plateSelection.accept.generic.x = 350;
|
|
s_plateSelection.accept.generic.y = 350;
|
|
s_plateSelection.accept.generic.id = ID_ACCEPT;
|
|
s_plateSelection.accept.generic.callback = PlateSelection_Event;
|
|
s_plateSelection.accept.string = "Accept";
|
|
s_plateSelection.accept.color = text_color_normal;
|
|
s_plateSelection.accept.style = UI_LEFT | UI_SMALLFONT;
|
|
|
|
|
|
Menu_AddItem( &s_plateSelection.menu, &s_plateSelection.list );
|
|
Menu_AddItem( &s_plateSelection.menu, &s_plateSelection.cancel );
|
|
Menu_AddItem( &s_plateSelection.menu, &s_plateSelection.accept );
|
|
|
|
|
|
PlateSelection_SetMenuItems();
|
|
}
|
|
|
|
|
|
/*
|
|
=================
|
|
UI_PlateSelectionMenu
|
|
=================
|
|
*/
|
|
void UI_PlateSelectionMenu( void ) {
|
|
PlateSelection_MenuInit();
|
|
UI_PushMenu( &s_plateSelection.menu );
|
|
}
|
|
// END
|