12 Dec 2009
This commit is contained in:
parent
60302daf99
commit
b148af3fbb
|
@ -1201,8 +1201,6 @@ void CL_Frame( int time )
|
|||
// update the screen
|
||||
SCR_UpdateScreen();
|
||||
|
||||
SCR_MakeScreenShot();
|
||||
|
||||
// update audio
|
||||
S_Update( &cl.refdef );
|
||||
|
||||
|
|
|
@ -175,5 +175,6 @@ void V_PostRender( void )
|
|||
UI_UpdateMenu( cls.realtime );
|
||||
Con_DrawConsole();
|
||||
}
|
||||
SCR_MakeScreenShot();
|
||||
re->EndFrame();
|
||||
}
|
|
@ -341,7 +341,7 @@ bool Cmd_GetSavesList( const char *s, char *completedname, int length )
|
|||
string matchbuf;
|
||||
int i, numsaves;
|
||||
|
||||
t = FS_Search( va( "save/%s*.bin", s ), true );
|
||||
t = FS_Search( va( "save/%s*.sav", s ), true );
|
||||
if( !t ) return false;
|
||||
|
||||
FS_FileBase( t->filenames[0], matchbuf );
|
||||
|
|
|
@ -258,11 +258,11 @@ SOURCE=.\server\sv_world.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uimenu\ui_advanced.c
|
||||
SOURCE=.\uimenu\ui_audio.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uimenu\ui_audio.c
|
||||
SOURCE=.\uimenu\ui_configuration.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
@ -274,10 +274,6 @@ SOURCE=.\uimenu\ui_credits.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uimenu\ui_defaults.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uimenu\ui_demos.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -286,10 +282,6 @@ SOURCE=.\uimenu\ui_gameoptions.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uimenu\ui_gotosite.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uimenu\ui_loadgame.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -310,22 +302,10 @@ SOURCE=.\uimenu\ui_multiplayer.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uimenu\ui_network.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uimenu\ui_newgame.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uimenu\ui_options.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uimenu\ui_performance.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\uimenu\ui_playersetup.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
|
@ -265,7 +265,7 @@ void SV_Load_f( void )
|
|||
}
|
||||
|
||||
com.strncpy( filename, Cmd_Argv( 1 ), sizeof( filename ));
|
||||
if(WAD_Check( va( "save/%s.bin", filename )) != 1 )
|
||||
if(WAD_Check( va( "save/%s.sav", filename )) != 1 )
|
||||
{
|
||||
Msg( "Can't loading %s\n", filename );
|
||||
return;
|
||||
|
@ -299,12 +299,12 @@ SV_Save_f
|
|||
*/
|
||||
void SV_Save_f( void )
|
||||
{
|
||||
if( Cmd_Argc() != 2 )
|
||||
{
|
||||
Msg( "Usage: save <name>\n" );
|
||||
return;
|
||||
}
|
||||
SV_WriteSaveFile( Cmd_Argv( 1 ), false, true );
|
||||
const char *name;
|
||||
|
||||
if( Cmd_Argc() == 1 )
|
||||
name = "new";
|
||||
else name = Cmd_Argv( 1 );
|
||||
SV_WriteSaveFile( name, false, true );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -333,7 +333,7 @@ void SV_Delete_f( void )
|
|||
}
|
||||
|
||||
// delete save and saveshot
|
||||
FS_Delete( va( "%s/save/%s.bin", GI->gamedir, Cmd_Argv( 1 )));
|
||||
FS_Delete( va( "%s/save/%s.sav", GI->gamedir, Cmd_Argv( 1 )));
|
||||
FS_Delete( va( "%s/save/%s.jpg", GI->gamedir, Cmd_Argv( 1 )));
|
||||
}
|
||||
|
||||
|
|
|
@ -318,6 +318,29 @@ static void SV_SaveServerData( wfile_t *f, const char *name, bool bUseLandMark )
|
|||
svgame.globals->pSaveData = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_SaveGetName
|
||||
==================
|
||||
*/
|
||||
void SV_SaveGetName( int lastnum, char *filename )
|
||||
{
|
||||
int a, b;
|
||||
|
||||
if( !filename ) return;
|
||||
if( lastnum < 0 || lastnum > 99 )
|
||||
{
|
||||
// bound
|
||||
com.strcpy( filename, "save99" );
|
||||
return;
|
||||
}
|
||||
|
||||
a = lastnum / 10;
|
||||
b = lastnum % 10;
|
||||
|
||||
com.sprintf( filename, "save%i%i", a, b );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
SV_WriteSaveFile
|
||||
|
@ -343,10 +366,30 @@ void SV_WriteSaveFile( const char *inname, bool autosave, bool bUseLandmark )
|
|||
}
|
||||
|
||||
if( !com.stricmp( inname, "new" ))
|
||||
com.strncpy( name, timestamp( TIME_FILENAME ), sizeof( name ));
|
||||
{
|
||||
// scan for a free filename
|
||||
for( n = 0; n < 100; n++ )
|
||||
{
|
||||
SV_SaveGetName( n, name );
|
||||
if( !FS_FileExists( va( "save/%s.sav", name )))
|
||||
break;
|
||||
}
|
||||
if( n == 100 )
|
||||
{
|
||||
Msg( "^3ERROR: no free slots for savegame\n" );
|
||||
return;
|
||||
}
|
||||
}
|
||||
else com.strncpy( name, inname, sizeof( name ));
|
||||
|
||||
com.sprintf( path, "save/%s.bin", name );
|
||||
com.sprintf( path, "save/%s.sav", name );
|
||||
|
||||
// make sure what oldsave is removed
|
||||
if( FS_FileExists( va( "save/%s.sav", name )))
|
||||
FS_Delete( va( "%s/save/%s.sav", GI->gamedir, name ));
|
||||
if( FS_FileExists( va( "save/%s.jpg", name )))
|
||||
FS_Delete( va( "%s/save/%s.jpg", GI->gamedir, name ));
|
||||
|
||||
savfile = WAD_Open( path, "wb" );
|
||||
|
||||
if( !savfile )
|
||||
|
@ -682,7 +725,7 @@ void SV_ReadSaveFile( const char *name )
|
|||
char path[MAX_SYSPATH];
|
||||
wfile_t *savfile;
|
||||
|
||||
com.sprintf( path, "save/%s.bin", name );
|
||||
com.sprintf( path, "save/%s.sav", name );
|
||||
savfile = WAD_Open( path, "rb" );
|
||||
|
||||
if( !savfile )
|
||||
|
@ -716,7 +759,7 @@ void SV_ReadLevelFile( const char *name )
|
|||
char path[MAX_SYSPATH];
|
||||
wfile_t *savfile;
|
||||
|
||||
com.sprintf( path, "save/%s.bin", name );
|
||||
com.sprintf( path, "save/%s.sav", name );
|
||||
savfile = WAD_Open( path, "rb" );
|
||||
|
||||
if( !savfile )
|
||||
|
@ -741,7 +784,7 @@ void SV_MergeLevelFile( const char *name )
|
|||
char path[MAX_SYSPATH];
|
||||
wfile_t *savfile;
|
||||
|
||||
com.sprintf( path, "save/%s.bin", name );
|
||||
com.sprintf( path, "save/%s.sav", name );
|
||||
savfile = WAD_Open( path, "rb" );
|
||||
|
||||
if( !savfile )
|
||||
|
@ -825,7 +868,7 @@ bool SV_GetComment( const char *savename, char *comment )
|
|||
|
||||
const char *SV_GetLatestSave( void )
|
||||
{
|
||||
search_t *f = FS_Search( "save/*.bin", true );
|
||||
search_t *f = FS_Search( "save/*.sav", true );
|
||||
int i, found = 0;
|
||||
long newest = 0, ft;
|
||||
string savename;
|
||||
|
|
|
@ -1,617 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
This program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "ui_local.h"
|
||||
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/banners/advanced_t"
|
||||
#define ART_TEXT1 "gfx/shell/text/advanced_text_p1"
|
||||
#define ART_TEXT2 "gfx/shell/text/advanced_text_p2"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
#define ID_BANNER 1
|
||||
|
||||
#define ID_TEXT1 2
|
||||
#define ID_TEXT2 3
|
||||
#define ID_TEXTSHADOW1 4
|
||||
#define ID_TEXTSHADOW2 5
|
||||
|
||||
#define ID_CANCEL 6
|
||||
#define ID_APPLY 7
|
||||
|
||||
#define ID_MULTITEXTURE 8
|
||||
#define ID_VBO 9
|
||||
#define ID_TEXENVCOMBINE 10
|
||||
#define ID_TEXENVADD 11
|
||||
#define ID_TEXENVDOT3 12
|
||||
#define ID_VERTEXPROGRAM 13
|
||||
#define ID_FRAGMENTPROGRAM 14
|
||||
#define ID_CUBEMAPTEXTURE 15
|
||||
#define ID_RECTANGLETEXTURE 16
|
||||
#define ID_TEXTURECOMPRESS 17
|
||||
#define ID_ANISOTROPIC 18
|
||||
#define ID_MAXANISOTROPY 19
|
||||
|
||||
static const char *uiAdvancedYesNo[] = { "False", "True" };
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float multitexture;
|
||||
float vbo;
|
||||
float texEnvCombine;
|
||||
float texEnvAdd;
|
||||
float texEnvDOT3;
|
||||
float vertexProgram;
|
||||
float fragmentProgram;
|
||||
float cubeMapTexture;
|
||||
float rectangleTexture;
|
||||
float textureCompress;
|
||||
float anisotropic;
|
||||
float maxAnisotropy;
|
||||
|
||||
} uiAdvancedValues_t;
|
||||
|
||||
static uiAdvancedValues_t uiAdvancedInitial;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
menuFramework_s menu;
|
||||
|
||||
menuBitmap_s background;
|
||||
menuBitmap_s banner;
|
||||
|
||||
menuBitmap_s textShadow1;
|
||||
menuBitmap_s textShadow2;
|
||||
menuBitmap_s text1;
|
||||
menuBitmap_s text2;
|
||||
|
||||
menuBitmap_s cancel;
|
||||
menuBitmap_s apply;
|
||||
|
||||
menuSpinControl_s multitexture;
|
||||
menuSpinControl_s vbo;
|
||||
menuSpinControl_s texEnvCombine;
|
||||
menuSpinControl_s texEnvAdd;
|
||||
menuSpinControl_s texEnvDOT3;
|
||||
menuSpinControl_s vertexProgram;
|
||||
menuSpinControl_s fragmentProgram;
|
||||
menuSpinControl_s cubeMapTexture;
|
||||
menuSpinControl_s rectangleTexture;
|
||||
menuSpinControl_s textureCompress;
|
||||
menuSpinControl_s anisotropic;
|
||||
menuSpinControl_s maxAnisotropy;
|
||||
} uiAdvanced_t;
|
||||
|
||||
static uiAdvanced_t uiAdvanced;
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Advanced_GetConfig
|
||||
=================
|
||||
*/
|
||||
static void UI_Advanced_GetConfig( void )
|
||||
{
|
||||
if( Cvar_VariableInteger( "r_arb_multitexture" ))
|
||||
uiAdvanced.multitexture.curValue = 1;
|
||||
|
||||
if( Cvar_VariableInteger( "r_arb_vertex_buffer_object" ))
|
||||
uiAdvanced.vbo.curValue = 1;
|
||||
|
||||
if( Cvar_VariableInteger( "r_arb_texture_env_combine" ))
|
||||
uiAdvanced.texEnvCombine.curValue = 1;
|
||||
|
||||
if( Cvar_VariableInteger( "r_arb_texture_env_add" ))
|
||||
uiAdvanced.texEnvAdd.curValue = 1;
|
||||
|
||||
if( Cvar_VariableInteger( "r_arb_texture_env_dot3" ))
|
||||
uiAdvanced.texEnvDOT3.curValue = 1;
|
||||
|
||||
if( Cvar_VariableInteger( "r_arb_vertex_program" ))
|
||||
uiAdvanced.vertexProgram.curValue = 1;
|
||||
|
||||
if( Cvar_VariableInteger( "r_arb_fragment_program" ))
|
||||
uiAdvanced.fragmentProgram.curValue = 1;
|
||||
|
||||
if (Cvar_VariableInteger( "r_arb_texture_cube_map" ))
|
||||
uiAdvanced.cubeMapTexture.curValue = 1;
|
||||
|
||||
if( Cvar_VariableInteger( "r_ext_texture_rectangle" ))
|
||||
uiAdvanced.rectangleTexture.curValue = 1;
|
||||
|
||||
if( Cvar_VariableInteger( "r_arb_texture_compression" ))
|
||||
uiAdvanced.textureCompress.curValue = 1;
|
||||
|
||||
if( Cvar_VariableInteger( "r_ext_texture_filter_anisotropic" ))
|
||||
uiAdvanced.anisotropic.curValue = 1;
|
||||
|
||||
uiAdvanced.maxAnisotropy.curValue = Cvar_VariableValue( "r_textureFilterAnisotropy" );
|
||||
|
||||
// save initial values
|
||||
uiAdvancedInitial.multitexture = uiAdvanced.multitexture.curValue;
|
||||
uiAdvancedInitial.vbo = uiAdvanced.vbo.curValue;
|
||||
uiAdvancedInitial.texEnvCombine = uiAdvanced.texEnvCombine.curValue;
|
||||
uiAdvancedInitial.texEnvAdd = uiAdvanced.texEnvAdd.curValue;
|
||||
uiAdvancedInitial.texEnvDOT3 = uiAdvanced.texEnvDOT3.curValue;
|
||||
uiAdvancedInitial.vertexProgram = uiAdvanced.vertexProgram.curValue;
|
||||
uiAdvancedInitial.fragmentProgram = uiAdvanced.fragmentProgram.curValue;
|
||||
uiAdvancedInitial.cubeMapTexture = uiAdvanced.cubeMapTexture.curValue;
|
||||
uiAdvancedInitial.rectangleTexture = uiAdvanced.rectangleTexture.curValue;
|
||||
uiAdvancedInitial.textureCompress = uiAdvanced.textureCompress.curValue;
|
||||
uiAdvancedInitial.anisotropic = uiAdvanced.anisotropic.curValue;
|
||||
uiAdvancedInitial.maxAnisotropy = uiAdvanced.maxAnisotropy.curValue;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Advanced_SetConfig
|
||||
=================
|
||||
*/
|
||||
static void UI_Advanced_SetConfig( void )
|
||||
{
|
||||
Cvar_SetValue( "r_arb_multitexture", uiAdvanced.multitexture.curValue );
|
||||
Cvar_SetValue( "r_arb_vertex_buffer_object", uiAdvanced.vbo.curValue );
|
||||
Cvar_SetValue( "r_arb_texture_env_combine", uiAdvanced.texEnvCombine.curValue );
|
||||
Cvar_SetValue( "r_arb_texture_env_add", uiAdvanced.texEnvAdd.curValue );
|
||||
Cvar_SetValue( "r_arb_texture_env_dot3", uiAdvanced.texEnvDOT3.curValue );
|
||||
Cvar_SetValue( "r_arb_vertex_program", uiAdvanced.vertexProgram.curValue );
|
||||
Cvar_SetValue( "r_arb_fragment_program", uiAdvanced.fragmentProgram.curValue );
|
||||
Cvar_SetValue( "r_arb_texture_cube_map", uiAdvanced.cubeMapTexture.curValue );
|
||||
Cvar_SetValue( "r_ext_texture_rectangle", uiAdvanced.rectangleTexture.curValue );
|
||||
Cvar_SetValue( "r_arb_texture_compression", uiAdvanced.textureCompress.curValue );
|
||||
Cvar_SetValue( "r_ext_texture_filter_anisotropic", uiAdvanced.anisotropic.curValue );
|
||||
Cvar_SetValue( "r_textureFilterAnisotropy", uiAdvanced.maxAnisotropy.curValue );
|
||||
|
||||
// restart video subsystem
|
||||
Cbuf_ExecuteText( EXEC_NOW, "vid_restart\n" );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Advanced_UpdateConfig
|
||||
=================
|
||||
*/
|
||||
static void UI_Advanced_UpdateConfig( void )
|
||||
{
|
||||
static char anisotropyText[8];
|
||||
|
||||
uiAdvanced.multitexture.generic.name = uiAdvancedYesNo[(int)uiAdvanced.multitexture.curValue];
|
||||
uiAdvanced.vbo.generic.name = uiAdvancedYesNo[(int)uiAdvanced.vbo.curValue];
|
||||
uiAdvanced.texEnvCombine.generic.name = uiAdvancedYesNo[(int)uiAdvanced.texEnvCombine.curValue];
|
||||
uiAdvanced.texEnvAdd.generic.name = uiAdvancedYesNo[(int)uiAdvanced.texEnvAdd.curValue];
|
||||
uiAdvanced.texEnvDOT3.generic.name = uiAdvancedYesNo[(int)uiAdvanced.texEnvDOT3.curValue];
|
||||
uiAdvanced.vertexProgram.generic.name = uiAdvancedYesNo[(int)uiAdvanced.vertexProgram.curValue];
|
||||
uiAdvanced.fragmentProgram.generic.name = uiAdvancedYesNo[(int)uiAdvanced.fragmentProgram.curValue];
|
||||
uiAdvanced.cubeMapTexture.generic.name = uiAdvancedYesNo[(int)uiAdvanced.cubeMapTexture.curValue];
|
||||
uiAdvanced.rectangleTexture.generic.name = uiAdvancedYesNo[(int)uiAdvanced.rectangleTexture.curValue];
|
||||
uiAdvanced.textureCompress.generic.name = uiAdvancedYesNo[(int)uiAdvanced.textureCompress.curValue];
|
||||
uiAdvanced.anisotropic.generic.name = uiAdvancedYesNo[(int)uiAdvanced.anisotropic.curValue];
|
||||
|
||||
if( !re->Support( R_ANISOTROPY_EXT )) uiAdvanced.maxAnisotropy.curValue = 2.0;
|
||||
com.snprintf( anisotropyText, sizeof( anisotropyText ), "%.2f", uiAdvanced.maxAnisotropy.curValue );
|
||||
uiAdvanced.maxAnisotropy.generic.name = anisotropyText;
|
||||
|
||||
// Some settings can be updated here
|
||||
Cvar_SetValue( "r_textureFilterAnisotropy", uiAdvanced.maxAnisotropy.curValue );
|
||||
|
||||
// See if the apply button should be enabled or disabled
|
||||
uiAdvanced.apply.generic.flags |= QMF_GRAYED;
|
||||
|
||||
if( uiAdvancedInitial.multitexture != uiAdvanced.multitexture.curValue )
|
||||
{
|
||||
uiAdvanced.apply.generic.flags &= ~QMF_GRAYED;
|
||||
return;
|
||||
}
|
||||
if( uiAdvancedInitial.vbo != uiAdvanced.vbo.curValue )
|
||||
{
|
||||
uiAdvanced.apply.generic.flags &= ~QMF_GRAYED;
|
||||
return;
|
||||
}
|
||||
if( uiAdvancedInitial.texEnvCombine != uiAdvanced.texEnvCombine.curValue )
|
||||
{
|
||||
uiAdvanced.apply.generic.flags &= ~QMF_GRAYED;
|
||||
return;
|
||||
}
|
||||
if( uiAdvancedInitial.texEnvAdd != uiAdvanced.texEnvAdd.curValue )
|
||||
{
|
||||
uiAdvanced.apply.generic.flags &= ~QMF_GRAYED;
|
||||
return;
|
||||
}
|
||||
if( uiAdvancedInitial.texEnvDOT3 != uiAdvanced.texEnvDOT3.curValue )
|
||||
{
|
||||
uiAdvanced.apply.generic.flags &= ~QMF_GRAYED;
|
||||
return;
|
||||
}
|
||||
if( uiAdvancedInitial.vertexProgram != uiAdvanced.vertexProgram.curValue){
|
||||
uiAdvanced.apply.generic.flags &= ~QMF_GRAYED;
|
||||
return;
|
||||
}
|
||||
if( uiAdvancedInitial.fragmentProgram != uiAdvanced.fragmentProgram.curValue )
|
||||
{
|
||||
uiAdvanced.apply.generic.flags &= ~QMF_GRAYED;
|
||||
return;
|
||||
}
|
||||
if( uiAdvancedInitial.cubeMapTexture != uiAdvanced.cubeMapTexture.curValue )
|
||||
{
|
||||
uiAdvanced.apply.generic.flags &= ~QMF_GRAYED;
|
||||
return;
|
||||
}
|
||||
if( uiAdvancedInitial.rectangleTexture != uiAdvanced.rectangleTexture.curValue )
|
||||
{
|
||||
uiAdvanced.apply.generic.flags &= ~QMF_GRAYED;
|
||||
return;
|
||||
}
|
||||
if( uiAdvancedInitial.textureCompress != uiAdvanced.textureCompress.curValue )
|
||||
{
|
||||
uiAdvanced.apply.generic.flags &= ~QMF_GRAYED;
|
||||
return;
|
||||
}
|
||||
if( uiAdvancedInitial.anisotropic != uiAdvanced.anisotropic.curValue )
|
||||
{
|
||||
uiAdvanced.apply.generic.flags &= ~QMF_GRAYED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Advanced_Callback
|
||||
=================
|
||||
*/
|
||||
static void UI_Advanced_Callback( void *self, int event )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( event == QM_CHANGED )
|
||||
{
|
||||
UI_Advanced_UpdateConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
if( event != QM_ACTIVATED )
|
||||
return;
|
||||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_CANCEL:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_APPLY:
|
||||
UI_Advanced_SetConfig();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Advanced_Ownerdraw
|
||||
=================
|
||||
*/
|
||||
static void UI_Advanced_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( uiAdvanced.menu.items[uiAdvanced.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
|
||||
if( item->flags & QMF_GRAYED )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorDkGrey, ((menuBitmap_s *)self)->pic );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Advanced_Init
|
||||
=================
|
||||
*/
|
||||
static void UI_Advanced_Init( void )
|
||||
{
|
||||
|
||||
Mem_Set( &uiAdvanced, 0, sizeof( uiAdvanced_t ));
|
||||
|
||||
uiAdvanced.background.generic.id = ID_BACKGROUND;
|
||||
uiAdvanced.background.generic.type = QMTYPE_BITMAP;
|
||||
uiAdvanced.background.generic.flags = QMF_INACTIVE;
|
||||
uiAdvanced.background.generic.x = 0;
|
||||
uiAdvanced.background.generic.y = 0;
|
||||
uiAdvanced.background.generic.width = 1024;
|
||||
uiAdvanced.background.generic.height = 768;
|
||||
uiAdvanced.background.pic = ART_BACKGROUND;
|
||||
|
||||
uiAdvanced.banner.generic.id = ID_BANNER;
|
||||
uiAdvanced.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiAdvanced.banner.generic.flags = QMF_INACTIVE;
|
||||
uiAdvanced.banner.generic.x = 0;
|
||||
uiAdvanced.banner.generic.y = 66;
|
||||
uiAdvanced.banner.generic.width = 1024;
|
||||
uiAdvanced.banner.generic.height = 46;
|
||||
uiAdvanced.banner.pic = ART_BANNER;
|
||||
|
||||
uiAdvanced.textShadow1.generic.id = ID_TEXTSHADOW1;
|
||||
uiAdvanced.textShadow1.generic.type = QMTYPE_BITMAP;
|
||||
uiAdvanced.textShadow1.generic.flags = QMF_INACTIVE;
|
||||
uiAdvanced.textShadow1.generic.x = 182;
|
||||
uiAdvanced.textShadow1.generic.y = 170;
|
||||
uiAdvanced.textShadow1.generic.width = 256;
|
||||
uiAdvanced.textShadow1.generic.height = 256;
|
||||
uiAdvanced.textShadow1.generic.color = uiColorBlack;
|
||||
uiAdvanced.textShadow1.pic = ART_TEXT1;
|
||||
|
||||
uiAdvanced.textShadow2.generic.id = ID_TEXTSHADOW2;
|
||||
uiAdvanced.textShadow2.generic.type = QMTYPE_BITMAP;
|
||||
uiAdvanced.textShadow2.generic.flags = QMF_INACTIVE;
|
||||
uiAdvanced.textShadow2.generic.x = 182;
|
||||
uiAdvanced.textShadow2.generic.y = 426;
|
||||
uiAdvanced.textShadow2.generic.width = 256;
|
||||
uiAdvanced.textShadow2.generic.height = 256;
|
||||
uiAdvanced.textShadow2.generic.color = uiColorBlack;
|
||||
uiAdvanced.textShadow2.pic = ART_TEXT2;
|
||||
|
||||
uiAdvanced.text1.generic.id = ID_TEXT1;
|
||||
uiAdvanced.text1.generic.type = QMTYPE_BITMAP;
|
||||
uiAdvanced.text1.generic.flags = QMF_INACTIVE;
|
||||
uiAdvanced.text1.generic.x = 180;
|
||||
uiAdvanced.text1.generic.y = 168;
|
||||
uiAdvanced.text1.generic.width = 256;
|
||||
uiAdvanced.text1.generic.height = 256;
|
||||
uiAdvanced.text1.pic = ART_TEXT1;
|
||||
|
||||
uiAdvanced.text2.generic.id = ID_TEXT2;
|
||||
uiAdvanced.text2.generic.type = QMTYPE_BITMAP;
|
||||
uiAdvanced.text2.generic.flags = QMF_INACTIVE;
|
||||
uiAdvanced.text2.generic.x = 180;
|
||||
uiAdvanced.text2.generic.y = 424;
|
||||
uiAdvanced.text2.generic.width = 256;
|
||||
uiAdvanced.text2.generic.height = 256;
|
||||
uiAdvanced.text2.pic = ART_TEXT2;
|
||||
|
||||
uiAdvanced.cancel.generic.id = ID_CANCEL;
|
||||
uiAdvanced.cancel.generic.type = QMTYPE_BITMAP;
|
||||
uiAdvanced.cancel.generic.x = 310;
|
||||
uiAdvanced.cancel.generic.y = 656;
|
||||
uiAdvanced.cancel.generic.width = 198;
|
||||
uiAdvanced.cancel.generic.height = 38;
|
||||
uiAdvanced.cancel.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.cancel.generic.ownerdraw = UI_Advanced_Ownerdraw;
|
||||
uiAdvanced.cancel.pic = UI_CANCELBUTTON;
|
||||
|
||||
uiAdvanced.apply.generic.id = ID_APPLY;
|
||||
uiAdvanced.apply.generic.type = QMTYPE_BITMAP;
|
||||
uiAdvanced.apply.generic.x = 516;
|
||||
uiAdvanced.apply.generic.y = 656;
|
||||
uiAdvanced.apply.generic.width = 198;
|
||||
uiAdvanced.apply.generic.height = 38;
|
||||
uiAdvanced.apply.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.apply.generic.ownerdraw = UI_Advanced_Ownerdraw;
|
||||
uiAdvanced.apply.pic = UI_APPLYBUTTON;
|
||||
|
||||
uiAdvanced.multitexture.generic.id = ID_MULTITEXTURE;
|
||||
uiAdvanced.multitexture.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiAdvanced.multitexture.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiAdvanced.multitexture.generic.x = 580;
|
||||
uiAdvanced.multitexture.generic.y = 160;
|
||||
uiAdvanced.multitexture.generic.width = 198;
|
||||
uiAdvanced.multitexture.generic.height = 30;
|
||||
uiAdvanced.multitexture.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.multitexture.generic.statusText = "Allow multitexturing to save rendering passes";
|
||||
uiAdvanced.multitexture.minValue = 0;
|
||||
uiAdvanced.multitexture.maxValue = 1;
|
||||
uiAdvanced.multitexture.range = 1;
|
||||
|
||||
uiAdvanced.vbo.generic.id = ID_VBO;
|
||||
uiAdvanced.vbo.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiAdvanced.vbo.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiAdvanced.vbo.generic.x = 580;
|
||||
uiAdvanced.vbo.generic.y = 192;
|
||||
uiAdvanced.vbo.generic.width = 198;
|
||||
uiAdvanced.vbo.generic.height = 30;
|
||||
uiAdvanced.vbo.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.vbo.generic.statusText = "Allow geometry to be stored in fast video or AGP memory";
|
||||
uiAdvanced.vbo.minValue = 0;
|
||||
uiAdvanced.vbo.maxValue = 1;
|
||||
uiAdvanced.vbo.range = 1;
|
||||
|
||||
uiAdvanced.texEnvCombine.generic.id = ID_TEXENVCOMBINE;
|
||||
uiAdvanced.texEnvCombine.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiAdvanced.texEnvCombine.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiAdvanced.texEnvCombine.generic.x = 580;
|
||||
uiAdvanced.texEnvCombine.generic.y = 224;
|
||||
uiAdvanced.texEnvCombine.generic.width = 198;
|
||||
uiAdvanced.texEnvCombine.generic.height = 30;
|
||||
uiAdvanced.texEnvCombine.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.texEnvCombine.generic.statusText = "Allow advanced texture blending in shader effects";
|
||||
uiAdvanced.texEnvCombine.minValue = 0;
|
||||
uiAdvanced.texEnvCombine.maxValue = 1;
|
||||
uiAdvanced.texEnvCombine.range = 1;
|
||||
|
||||
uiAdvanced.texEnvAdd.generic.id = ID_TEXENVADD;
|
||||
uiAdvanced.texEnvAdd.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiAdvanced.texEnvAdd.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiAdvanced.texEnvAdd.generic.x = 580;
|
||||
uiAdvanced.texEnvAdd.generic.y = 256;
|
||||
uiAdvanced.texEnvAdd.generic.width = 198;
|
||||
uiAdvanced.texEnvAdd.generic.height = 30;
|
||||
uiAdvanced.texEnvAdd.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.texEnvAdd.generic.statusText = "Allow additive texture blending to save rendering passes";
|
||||
uiAdvanced.texEnvAdd.minValue = 0;
|
||||
uiAdvanced.texEnvAdd.maxValue = 1;
|
||||
uiAdvanced.texEnvAdd.range = 1;
|
||||
|
||||
uiAdvanced.texEnvDOT3.generic.id = ID_TEXENVDOT3;
|
||||
uiAdvanced.texEnvDOT3.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiAdvanced.texEnvDOT3.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiAdvanced.texEnvDOT3.generic.x = 580;
|
||||
uiAdvanced.texEnvDOT3.generic.y = 288;
|
||||
uiAdvanced.texEnvDOT3.generic.width = 198;
|
||||
uiAdvanced.texEnvDOT3.generic.height = 30;
|
||||
uiAdvanced.texEnvDOT3.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.texEnvDOT3.generic.statusText = "Allow DOT3 texture blending in shader effects";
|
||||
uiAdvanced.texEnvDOT3.minValue = 0;
|
||||
uiAdvanced.texEnvDOT3.maxValue = 1;
|
||||
uiAdvanced.texEnvDOT3.range = 1;
|
||||
|
||||
uiAdvanced.vertexProgram.generic.id = ID_VERTEXPROGRAM;
|
||||
uiAdvanced.vertexProgram.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiAdvanced.vertexProgram.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiAdvanced.vertexProgram.generic.x = 580;
|
||||
uiAdvanced.vertexProgram.generic.y = 320;
|
||||
uiAdvanced.vertexProgram.generic.width = 198;
|
||||
uiAdvanced.vertexProgram.generic.height = 30;
|
||||
uiAdvanced.vertexProgram.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.vertexProgram.generic.statusText = "Allow vertex programs in shader effects";
|
||||
uiAdvanced.vertexProgram.minValue = 0;
|
||||
uiAdvanced.vertexProgram.maxValue = 1;
|
||||
uiAdvanced.vertexProgram.range = 1;
|
||||
|
||||
uiAdvanced.fragmentProgram.generic.id = ID_FRAGMENTPROGRAM;
|
||||
uiAdvanced.fragmentProgram.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiAdvanced.fragmentProgram.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiAdvanced.fragmentProgram.generic.x = 580;
|
||||
uiAdvanced.fragmentProgram.generic.y = 352;
|
||||
uiAdvanced.fragmentProgram.generic.width = 198;
|
||||
uiAdvanced.fragmentProgram.generic.height = 30;
|
||||
uiAdvanced.fragmentProgram.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.fragmentProgram.generic.statusText = "Allow fragment programs in shader effects";
|
||||
uiAdvanced.fragmentProgram.minValue = 0;
|
||||
uiAdvanced.fragmentProgram.maxValue = 1;
|
||||
uiAdvanced.fragmentProgram.range = 1;
|
||||
|
||||
uiAdvanced.cubeMapTexture.generic.id = ID_CUBEMAPTEXTURE;
|
||||
uiAdvanced.cubeMapTexture.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiAdvanced.cubeMapTexture.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiAdvanced.cubeMapTexture.generic.x = 580;
|
||||
uiAdvanced.cubeMapTexture.generic.y = 384;
|
||||
uiAdvanced.cubeMapTexture.generic.width = 198;
|
||||
uiAdvanced.cubeMapTexture.generic.height = 30;
|
||||
uiAdvanced.cubeMapTexture.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.cubeMapTexture.generic.statusText = "Allow cube map textures in shader effects";
|
||||
uiAdvanced.cubeMapTexture.minValue = 0;
|
||||
uiAdvanced.cubeMapTexture.maxValue = 1;
|
||||
uiAdvanced.cubeMapTexture.range = 1;
|
||||
|
||||
uiAdvanced.rectangleTexture.generic.id = ID_RECTANGLETEXTURE;
|
||||
uiAdvanced.rectangleTexture.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiAdvanced.rectangleTexture.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiAdvanced.rectangleTexture.generic.x = 580;
|
||||
uiAdvanced.rectangleTexture.generic.y = 416;
|
||||
uiAdvanced.rectangleTexture.generic.width = 198;
|
||||
uiAdvanced.rectangleTexture.generic.height = 30;
|
||||
uiAdvanced.rectangleTexture.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.rectangleTexture.generic.statusText = "Allow rectangle textures for motion blur";
|
||||
uiAdvanced.rectangleTexture.minValue = 0;
|
||||
uiAdvanced.rectangleTexture.maxValue = 1;
|
||||
uiAdvanced.rectangleTexture.range = 1;
|
||||
|
||||
uiAdvanced.textureCompress.generic.id = ID_TEXTURECOMPRESS;
|
||||
uiAdvanced.textureCompress.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiAdvanced.textureCompress.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiAdvanced.textureCompress.generic.x = 580;
|
||||
uiAdvanced.textureCompress.generic.y = 448;
|
||||
uiAdvanced.textureCompress.generic.width = 198;
|
||||
uiAdvanced.textureCompress.generic.height = 30;
|
||||
uiAdvanced.textureCompress.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.textureCompress.generic.statusText = "Allow texture compression to save texture memory";
|
||||
uiAdvanced.textureCompress.minValue = 0;
|
||||
uiAdvanced.textureCompress.maxValue = 1;
|
||||
uiAdvanced.textureCompress.range = 1;
|
||||
|
||||
uiAdvanced.anisotropic.generic.id = ID_ANISOTROPIC;
|
||||
uiAdvanced.anisotropic.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiAdvanced.anisotropic.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiAdvanced.anisotropic.generic.x = 580;
|
||||
uiAdvanced.anisotropic.generic.y = 480;
|
||||
uiAdvanced.anisotropic.generic.width = 198;
|
||||
uiAdvanced.anisotropic.generic.height = 30;
|
||||
uiAdvanced.anisotropic.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.anisotropic.generic.statusText = "Allow anisotropic texture filtering";
|
||||
uiAdvanced.anisotropic.minValue = 0;
|
||||
uiAdvanced.anisotropic.maxValue = 1;
|
||||
uiAdvanced.anisotropic.range = 1;
|
||||
|
||||
uiAdvanced.maxAnisotropy.generic.id = ID_MAXANISOTROPY;
|
||||
uiAdvanced.maxAnisotropy.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiAdvanced.maxAnisotropy.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiAdvanced.maxAnisotropy.generic.x = 580;
|
||||
uiAdvanced.maxAnisotropy.generic.y = 512;
|
||||
uiAdvanced.maxAnisotropy.generic.width = 198;
|
||||
uiAdvanced.maxAnisotropy.generic.height = 30;
|
||||
uiAdvanced.maxAnisotropy.generic.callback = UI_Advanced_Callback;
|
||||
uiAdvanced.maxAnisotropy.generic.statusText = "Set anisotropy filter level (Higher values = Better quality)";
|
||||
uiAdvanced.maxAnisotropy.minValue = 1.0;
|
||||
|
||||
// FIXME: get maximum anisotropy level from render
|
||||
// uiAdvanced.maxAnisotropy.maxValue = uiStatic.glConfig.maxTextureMaxAnisotropy;
|
||||
uiAdvanced.maxAnisotropy.range = 1.0;
|
||||
|
||||
UI_Advanced_GetConfig();
|
||||
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.background );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.banner );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.textShadow1 );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.textShadow2 );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.text1 );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.text2 );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.cancel );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.apply );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.multitexture );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.vbo );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.texEnvCombine );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.texEnvAdd );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.texEnvDOT3 );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.vertexProgram );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.fragmentProgram );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.cubeMapTexture );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.rectangleTexture );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.textureCompress );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.anisotropic );
|
||||
UI_AddItem( &uiAdvanced.menu, (void *)&uiAdvanced.maxAnisotropy );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Advanced_Precache
|
||||
=================
|
||||
*/
|
||||
void UI_Advanced_Precache( void )
|
||||
{
|
||||
if( !re ) return;
|
||||
|
||||
re->RegisterShader( ART_BACKGROUND, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_BANNER, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_TEXT1, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_TEXT2, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Advanced_Menu
|
||||
=================
|
||||
*/
|
||||
void UI_Advanced_Menu( void )
|
||||
{
|
||||
UI_Advanced_Precache();
|
||||
UI_Advanced_Init();
|
||||
|
||||
UI_Advanced_UpdateConfig();
|
||||
UI_PushMenu( &uiAdvanced.menu );
|
||||
}
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/banners/audio_t"
|
||||
#define ART_BANNER "gfx/shell/head_audio"
|
||||
#define ART_TEXT1 "gfx/shell/text/audio_text_p1"
|
||||
#define ART_TEXT2 "gfx/shell/text/audio_text_p2"
|
||||
|
||||
|
@ -32,14 +32,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define ID_TEXT1 2
|
||||
#define ID_TEXT2 3
|
||||
#define ID_TEXTSHADOW1 4
|
||||
#define ID_TEXTSHADOW2 5
|
||||
|
||||
#define ID_CANCEL 6
|
||||
#define ID_DONE 6
|
||||
#define ID_APPLY 7
|
||||
|
||||
#define ID_CDMUSIC 8
|
||||
#define ID_CDVOLUME 9
|
||||
#define ID_AUDIODEVICE 10
|
||||
#define ID_MASTERVOLUME 11
|
||||
#define ID_SFXVOLUME 12
|
||||
|
@ -75,13 +71,11 @@ typedef struct
|
|||
menuBitmap_s background;
|
||||
menuBitmap_s banner;
|
||||
|
||||
menuBitmap_s textShadow1;
|
||||
menuBitmap_s textShadow2;
|
||||
menuBitmap_s text1;
|
||||
menuBitmap_s text2;
|
||||
|
||||
menuBitmap_s cancel;
|
||||
menuBitmap_s apply;
|
||||
menuAction_s done;
|
||||
menuAction_s apply;
|
||||
|
||||
menuSpinControl_s audioDevice;
|
||||
menuSpinControl_s masterVolume;
|
||||
|
@ -231,7 +225,7 @@ static void UI_Audio_Callback( void *self, int event )
|
|||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_CANCEL:
|
||||
case ID_DONE:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_APPLY:
|
||||
|
@ -242,24 +236,6 @@ static void UI_Audio_Callback( void *self, int event )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Audio_Ownerdraw
|
||||
=================
|
||||
*/
|
||||
static void UI_Audio_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( uiAudio.menu.items[uiAudio.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
|
||||
if( item->flags & QMF_GRAYED )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorDkGrey, ((menuBitmap_s *)self)->pic );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Audio_Init
|
||||
|
@ -281,32 +257,12 @@ static void UI_Audio_Init( void )
|
|||
uiAudio.banner.generic.id = ID_BANNER;
|
||||
uiAudio.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiAudio.banner.generic.flags = QMF_INACTIVE;
|
||||
uiAudio.banner.generic.x = 0;
|
||||
uiAudio.banner.generic.y = 66;
|
||||
uiAudio.banner.generic.width = 1024;
|
||||
uiAudio.banner.generic.height = 46;
|
||||
uiAudio.banner.generic.x = 65;
|
||||
uiAudio.banner.generic.y = 92;
|
||||
uiAudio.banner.generic.width = 690;
|
||||
uiAudio.banner.generic.height = 120;
|
||||
uiAudio.banner.pic = ART_BANNER;
|
||||
|
||||
uiAudio.textShadow1.generic.id = ID_TEXTSHADOW1;
|
||||
uiAudio.textShadow1.generic.type = QMTYPE_BITMAP;
|
||||
uiAudio.textShadow1.generic.flags = QMF_INACTIVE;
|
||||
uiAudio.textShadow1.generic.x = 182;
|
||||
uiAudio.textShadow1.generic.y = 170;
|
||||
uiAudio.textShadow1.generic.width = 256;
|
||||
uiAudio.textShadow1.generic.height = 256;
|
||||
uiAudio.textShadow1.generic.color = uiColorBlack;
|
||||
uiAudio.textShadow1.pic = ART_TEXT1;
|
||||
|
||||
uiAudio.textShadow2.generic.id = ID_TEXTSHADOW2;
|
||||
uiAudio.textShadow2.generic.type = QMTYPE_BITMAP;
|
||||
uiAudio.textShadow2.generic.flags = QMF_INACTIVE;
|
||||
uiAudio.textShadow2.generic.x = 182;
|
||||
uiAudio.textShadow2.generic.y = 426;
|
||||
uiAudio.textShadow2.generic.width = 256;
|
||||
uiAudio.textShadow2.generic.height = 256;
|
||||
uiAudio.textShadow2.generic.color = uiColorBlack;
|
||||
uiAudio.textShadow2.pic = ART_TEXT2;
|
||||
|
||||
uiAudio.text1.generic.id = ID_TEXT1;
|
||||
uiAudio.text1.generic.type = QMTYPE_BITMAP;
|
||||
uiAudio.text1.generic.flags = QMF_INACTIVE;
|
||||
|
@ -325,25 +281,23 @@ static void UI_Audio_Init( void )
|
|||
uiAudio.text2.generic.height = 256;
|
||||
uiAudio.text2.pic = ART_TEXT2;
|
||||
|
||||
uiAudio.cancel.generic.id = ID_CANCEL;
|
||||
uiAudio.cancel.generic.type = QMTYPE_BITMAP;
|
||||
uiAudio.cancel.generic.x = 310;
|
||||
uiAudio.cancel.generic.y = 656;
|
||||
uiAudio.cancel.generic.width = 198;
|
||||
uiAudio.cancel.generic.height = 38;
|
||||
uiAudio.cancel.generic.callback = UI_Audio_Callback;
|
||||
uiAudio.cancel.generic.ownerdraw = UI_Audio_Ownerdraw;
|
||||
uiAudio.cancel.pic = UI_CANCELBUTTON;
|
||||
|
||||
uiAudio.apply.generic.id = ID_APPLY;
|
||||
uiAudio.apply.generic.type = QMTYPE_BITMAP;
|
||||
uiAudio.apply.generic.x = 516;
|
||||
uiAudio.apply.generic.y = 656;
|
||||
uiAudio.apply.generic.width = 198;
|
||||
uiAudio.apply.generic.height = 38;
|
||||
uiAudio.apply.generic.type = QMTYPE_ACTION;
|
||||
uiAudio.apply.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiAudio.apply.generic.x = 72;
|
||||
uiAudio.apply.generic.y = 230;
|
||||
uiAudio.apply.generic.name = "Apply";
|
||||
uiAudio.apply.generic.statusText = "Apply changes";
|
||||
uiAudio.apply.generic.callback = UI_Audio_Callback;
|
||||
uiAudio.apply.generic.ownerdraw = UI_Audio_Ownerdraw;
|
||||
uiAudio.apply.pic = UI_APPLYBUTTON;
|
||||
|
||||
uiAudio.done.generic.id = ID_DONE;
|
||||
uiAudio.done.generic.type = QMTYPE_ACTION;
|
||||
uiAudio.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiAudio.done.generic.x = 72;
|
||||
uiAudio.done.generic.y = 280;
|
||||
uiAudio.done.generic.name = "Done";
|
||||
uiAudio.done.generic.statusText = "Go back to the Configuration Menu";
|
||||
uiAudio.done.generic.callback = UI_Audio_Callback;
|
||||
|
||||
uiAudio.audioDevice.generic.id = ID_AUDIODEVICE;
|
||||
uiAudio.audioDevice.generic.type = QMTYPE_SPINCONTROL;
|
||||
|
@ -440,11 +394,9 @@ static void UI_Audio_Init( void )
|
|||
|
||||
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.background );
|
||||
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.banner );
|
||||
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.textShadow1 );
|
||||
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.textShadow2 );
|
||||
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.text1 );
|
||||
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.text2 );
|
||||
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.cancel );
|
||||
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.done );
|
||||
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.apply );
|
||||
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.audioDevice );
|
||||
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.masterVolume );
|
||||
|
|
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
This program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "ui_local.h"
|
||||
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/head_config"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
#define ID_BANNER 1
|
||||
|
||||
#define ID_CONTROLS 2
|
||||
#define ID_AUDIO 3
|
||||
#define ID_VIDEO 4
|
||||
#define ID_UPDATE 5
|
||||
#define ID_DONE 6
|
||||
|
||||
typedef struct
|
||||
{
|
||||
menuFramework_s menu;
|
||||
|
||||
menuBitmap_s background;
|
||||
menuBitmap_s banner;
|
||||
|
||||
menuAction_s controls;
|
||||
menuAction_s audio;
|
||||
menuAction_s video;
|
||||
menuAction_s update;
|
||||
menuAction_s done;
|
||||
} uiOptions_t;
|
||||
|
||||
static uiOptions_t uiOptions;
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Options_Callback
|
||||
=================
|
||||
*/
|
||||
static void UI_Options_Callback( void *self, int event )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( event != QM_ACTIVATED )
|
||||
return;
|
||||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_DONE:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_CONTROLS:
|
||||
UI_Controls_Menu();
|
||||
break;
|
||||
case ID_AUDIO:
|
||||
UI_Audio_Menu();
|
||||
break;
|
||||
case ID_VIDEO:
|
||||
UI_Video_Menu();
|
||||
break;
|
||||
case ID_UPDATE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Options_Init
|
||||
=================
|
||||
*/
|
||||
static void UI_Options_Init( void )
|
||||
{
|
||||
Mem_Set( &uiOptions, 0, sizeof( uiOptions_t ));
|
||||
|
||||
uiOptions.background.generic.id = ID_BACKGROUND;
|
||||
uiOptions.background.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.background.generic.flags = QMF_INACTIVE;
|
||||
uiOptions.background.generic.x = 0;
|
||||
uiOptions.background.generic.y = 0;
|
||||
uiOptions.background.generic.width = 1024;
|
||||
uiOptions.background.generic.height = 768;
|
||||
uiOptions.background.pic = ART_BACKGROUND;
|
||||
|
||||
uiOptions.banner.generic.id = ID_BANNER;
|
||||
uiOptions.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.banner.generic.flags = QMF_INACTIVE;
|
||||
uiOptions.banner.generic.x = 65;
|
||||
uiOptions.banner.generic.y = 92;
|
||||
uiOptions.banner.generic.width = 690;
|
||||
uiOptions.banner.generic.height = 120;
|
||||
uiOptions.banner.pic = ART_BANNER;
|
||||
|
||||
uiOptions.controls.generic.id = ID_CONTROLS;
|
||||
uiOptions.controls.generic.type = QMTYPE_ACTION;
|
||||
uiOptions.controls.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiOptions.controls.generic.x = 72;
|
||||
uiOptions.controls.generic.y = 230;
|
||||
uiOptions.controls.generic.name = "Controls";
|
||||
uiOptions.controls.generic.statusText = "Change keyboard and mouse settings";
|
||||
uiOptions.controls.generic.callback = UI_Options_Callback;
|
||||
|
||||
uiOptions.audio.generic.id = ID_AUDIO;
|
||||
uiOptions.audio.generic.type = QMTYPE_ACTION;
|
||||
uiOptions.audio.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiOptions.audio.generic.x = 72;
|
||||
uiOptions.audio.generic.y = 280;
|
||||
uiOptions.audio.generic.name = "Audio";
|
||||
uiOptions.audio.generic.statusText = "Change sound volume and quality";
|
||||
uiOptions.audio.generic.callback = UI_Options_Callback;
|
||||
|
||||
uiOptions.video.generic.id = ID_VIDEO;
|
||||
uiOptions.video.generic.type = QMTYPE_ACTION;
|
||||
uiOptions.video.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiOptions.video.generic.x = 72;
|
||||
uiOptions.video.generic.y = 330;
|
||||
uiOptions.video.generic.name = "Video";
|
||||
uiOptions.video.generic.statusText = "Change screen size, video mode and gamma";
|
||||
uiOptions.video.generic.callback = UI_Options_Callback;
|
||||
|
||||
uiOptions.update.generic.id = ID_UPDATE;
|
||||
uiOptions.update.generic.type = QMTYPE_ACTION;
|
||||
uiOptions.update.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY|QMF_GRAYED; // FIXME:implement
|
||||
uiOptions.update.generic.x = 72;
|
||||
uiOptions.update.generic.y = 380;
|
||||
uiOptions.update.generic.name = "Update";
|
||||
uiOptions.update.generic.statusText = "Donwload the latest version of the Xash3D engine";
|
||||
uiOptions.update.generic.callback = UI_Options_Callback;
|
||||
|
||||
uiOptions.done.generic.id = ID_DONE;
|
||||
uiOptions.done.generic.type = QMTYPE_ACTION;
|
||||
uiOptions.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiOptions.done.generic.x = 72;
|
||||
uiOptions.done.generic.y = 430;
|
||||
uiOptions.done.generic.name = "Done";
|
||||
uiOptions.done.generic.statusText = "Go back to the Main Menu";
|
||||
uiOptions.done.generic.callback = UI_Options_Callback;
|
||||
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.background );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.banner );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.done );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.controls );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.audio );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.video );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.update );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Options_Precache
|
||||
=================
|
||||
*/
|
||||
void UI_Options_Precache( void )
|
||||
{
|
||||
if( !re ) return;
|
||||
|
||||
re->RegisterShader( ART_BACKGROUND, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_BANNER, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Options_Menu
|
||||
=================
|
||||
*/
|
||||
void UI_Options_Menu( void )
|
||||
{
|
||||
UI_Options_Precache();
|
||||
UI_Options_Init();
|
||||
|
||||
UI_PushMenu( &uiOptions.menu );
|
||||
}
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "input.h"
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/banners/controls_t"
|
||||
#define ART_BANNER "gfx/shell/head_controls"
|
||||
#define ART_TEXT_LOOK "gfx/shell/text/cont_look_text_p1"
|
||||
#define ART_TEXT_LOOK2 "gfx/shell/text/cont_look_text_p2"
|
||||
#define ART_TEXT_MOVE "gfx/shell/text/cont_move_text_p1"
|
||||
|
@ -667,10 +667,10 @@ static void UI_Controls_Init( void )
|
|||
uiControls.banner.generic.id = ID_BANNER;
|
||||
uiControls.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiControls.banner.generic.flags = QMF_INACTIVE;
|
||||
uiControls.banner.generic.x = 0;
|
||||
uiControls.banner.generic.y = 66;
|
||||
uiControls.banner.generic.width = 1024;
|
||||
uiControls.banner.generic.height = 46;
|
||||
uiControls.banner.generic.x = 65;
|
||||
uiControls.banner.generic.y = 92;
|
||||
uiControls.banner.generic.width = 690;
|
||||
uiControls.banner.generic.height = 120;
|
||||
uiControls.banner.pic = ART_BANNER;
|
||||
|
||||
uiControls.textShadow1.generic.id = ID_TEXTSHADOW1;
|
||||
|
|
|
@ -1,174 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
This program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "ui_local.h"
|
||||
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_MSGBOX "gfx/shell/misc/defaults_warn"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
|
||||
#define ID_MSGBOX 1
|
||||
#define ID_YES 2
|
||||
#define ID_NO 3
|
||||
|
||||
typedef struct
|
||||
{
|
||||
menuFramework_s menu;
|
||||
menuBitmap_s background;
|
||||
|
||||
menuBitmap_s msgBox;
|
||||
menuBitmap_s no;
|
||||
menuBitmap_s yes;
|
||||
} uiDefaults_t;
|
||||
|
||||
static uiDefaults_t uiDefaults;
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Defaults_Callback
|
||||
=================
|
||||
*/
|
||||
static void UI_Defaults_Callback( void *self, int event )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( event != QM_ACTIVATED )
|
||||
return;
|
||||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_YES:
|
||||
// set default bindings and restart all cvars
|
||||
Cbuf_ExecuteText( EXEC_APPEND, "unsetall\n" );
|
||||
Cbuf_ExecuteText( EXEC_APPEND, "unbindall\n" );
|
||||
Cbuf_ExecuteText( EXEC_APPEND, "exec basekeys.rc\n" );
|
||||
Cbuf_ExecuteText( EXEC_APPEND, "exec basevars.rc\n" );
|
||||
|
||||
// restart all the subsystems for the changes to take effect
|
||||
Cbuf_ExecuteText( EXEC_APPEND, "net_restart\n" );
|
||||
Cbuf_ExecuteText( EXEC_APPEND, "snd_restart\n" );
|
||||
Cbuf_ExecuteText( EXEC_APPEND, "vid_restart\n" );
|
||||
break;
|
||||
case ID_NO:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Defaults_Ownerdraw
|
||||
=================
|
||||
*/
|
||||
static void UI_Defaults_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( uiDefaults.menu.items[uiDefaults.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Defaults_Init
|
||||
=================
|
||||
*/
|
||||
static void UI_Defaults_Init( void )
|
||||
{
|
||||
Mem_Set( &uiDefaults, 0, sizeof( uiDefaults_t ));
|
||||
|
||||
uiDefaults.background.generic.id = ID_BACKGROUND;
|
||||
uiDefaults.background.generic.type = QMTYPE_BITMAP;
|
||||
uiDefaults.background.generic.flags = QMF_INACTIVE | QMF_GRAYED;
|
||||
uiDefaults.background.generic.x = 0;
|
||||
uiDefaults.background.generic.y = 0;
|
||||
uiDefaults.background.generic.width = 1024;
|
||||
uiDefaults.background.generic.height = 768;
|
||||
uiDefaults.background.pic = ART_BACKGROUND;
|
||||
|
||||
uiDefaults.msgBox.generic.id = ID_MSGBOX;
|
||||
uiDefaults.msgBox.generic.type = QMTYPE_BITMAP;
|
||||
uiDefaults.msgBox.generic.flags = QMF_INACTIVE;
|
||||
uiDefaults.msgBox.generic.x = 174;
|
||||
uiDefaults.msgBox.generic.y = 256;
|
||||
uiDefaults.msgBox.generic.width = 676;
|
||||
uiDefaults.msgBox.generic.height = 256;
|
||||
uiDefaults.msgBox.pic = ART_MSGBOX;
|
||||
|
||||
uiDefaults.no.generic.id = ID_NO;
|
||||
uiDefaults.no.generic.type = QMTYPE_BITMAP;
|
||||
uiDefaults.no.generic.flags = 0;
|
||||
uiDefaults.no.generic.x = 310;
|
||||
uiDefaults.no.generic.y = 434;
|
||||
uiDefaults.no.generic.width = 198;
|
||||
uiDefaults.no.generic.height = 38;
|
||||
uiDefaults.no.generic.callback = UI_Defaults_Callback;
|
||||
uiDefaults.no.generic.ownerdraw = UI_Defaults_Ownerdraw;
|
||||
uiDefaults.no.pic = UI_CANCELBUTTON;
|
||||
|
||||
uiDefaults.yes.generic.id = ID_YES;
|
||||
uiDefaults.yes.generic.type = QMTYPE_BITMAP;
|
||||
uiDefaults.yes.generic.flags = 0;
|
||||
uiDefaults.yes.generic.x = 516;
|
||||
uiDefaults.yes.generic.y = 434;
|
||||
uiDefaults.yes.generic.width = 198;
|
||||
uiDefaults.yes.generic.height = 38;
|
||||
uiDefaults.yes.generic.callback = UI_Defaults_Callback;
|
||||
uiDefaults.yes.generic.ownerdraw = UI_Defaults_Ownerdraw;
|
||||
uiDefaults.yes.pic = UI_ACCEPTBUTTON;
|
||||
|
||||
UI_AddItem( &uiDefaults.menu, (void *)&uiDefaults.background );
|
||||
UI_AddItem( &uiDefaults.menu, (void *)&uiDefaults.msgBox );
|
||||
UI_AddItem( &uiDefaults.menu, (void *)&uiDefaults.no );
|
||||
UI_AddItem( &uiDefaults.menu, (void *)&uiDefaults.yes );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Defaults_Precache
|
||||
=================
|
||||
*/
|
||||
void UI_Defaults_Precache( void )
|
||||
{
|
||||
if( !re ) return;
|
||||
|
||||
re->RegisterShader( ART_BACKGROUND, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_MSGBOX, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Defaults_Menu
|
||||
=================
|
||||
*/
|
||||
void UI_Defaults_Menu( void )
|
||||
{
|
||||
UI_Defaults_Precache();
|
||||
UI_Defaults_Init();
|
||||
|
||||
UI_PushMenu( &uiDefaults.menu );
|
||||
}
|
|
@ -23,39 +23,40 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/banners/demos_t"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
#define ID_BANNER 1
|
||||
|
||||
#define ID_BACK 2
|
||||
#define ID_LOAD 3
|
||||
|
||||
#define ID_CANCEL 1
|
||||
#define ID_PLAY 2
|
||||
#define ID_DELETE 3
|
||||
#define ID_DEMOLIST 4
|
||||
#define ID_TABLEHINT 5
|
||||
|
||||
#define MAX_DEMOS 64
|
||||
#define MAX_DEMOS 100
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char demos[MAX_DEMOS][MAX_STRING];
|
||||
char *demosPtr[MAX_DEMOS];
|
||||
char demos[MAX_DEMOS][CS_SIZE];
|
||||
char *demosPtr[MAX_DEMOS];
|
||||
|
||||
menuFramework_s menu;
|
||||
menuFramework_s menu;
|
||||
|
||||
menuBitmap_s background;
|
||||
menuBitmap_s banner;
|
||||
menuBitmap_s back;
|
||||
menuBitmap_s load;
|
||||
menuBitmap_s background;
|
||||
menuAction_s play;
|
||||
menuAction_s delete;
|
||||
menuAction_s cancel;
|
||||
|
||||
menuScrollList_s demoList;
|
||||
menuScrollList_s demoList;
|
||||
|
||||
menuAction_s hintMessage;
|
||||
char hintText[MAX_SYSPATH];
|
||||
} uiDemos_t;
|
||||
|
||||
static uiDemos_t uiDemos;
|
||||
static uiDemos_t uiDemos;
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Demos_GetDemoList
|
||||
UI_Demos_GetDemosList
|
||||
=================
|
||||
*/
|
||||
static void UI_Demos_GetDemoList( void )
|
||||
|
@ -69,8 +70,7 @@ static void UI_Demos_GetDemoList( void )
|
|||
{
|
||||
if( search && i < search->numfilenames )
|
||||
{
|
||||
com.strncpy( uiDemos.demos[i], search->filenames[i], sizeof( uiDemos.demos[i] ));
|
||||
FS_StripExtension( uiDemos.demos[i] );
|
||||
FS_FileBase( search->filenames[i], uiDemos.demos[i] );
|
||||
uiDemos.demosPtr[i] = uiDemos.demos[i];
|
||||
}
|
||||
else uiDemos.demosPtr[i] = NULL;
|
||||
|
@ -94,31 +94,19 @@ static void UI_Demos_Callback( void *self, int event )
|
|||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_BACK:
|
||||
case ID_CANCEL:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_LOAD:
|
||||
case ID_PLAY:
|
||||
Cbuf_ExecuteText( EXEC_APPEND, va( "playdemo %s\n", uiDemos.demos[uiDemos.demoList.curItem] ));
|
||||
break;
|
||||
case ID_DELETE:
|
||||
FS_Delete( va( "%s/demos/%s.dem", GI->gamedir, uiDemos.demos[uiDemos.demoList.curItem] ));
|
||||
UI_Demos_GetDemoList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Demos_Ownerdraw
|
||||
=================
|
||||
*/
|
||||
static void UI_Demos_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( uiDemos.menu.items[uiDemos.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Demos_Init
|
||||
|
@ -128,6 +116,9 @@ static void UI_Demos_Init( void )
|
|||
{
|
||||
Mem_Set( &uiDemos, 0, sizeof( uiDemos_t ));
|
||||
|
||||
com.strncat( uiDemos.hintText, "Demo Name", MAX_STRING );
|
||||
com.strncat( uiDemos.hintText, uiEmptyString, MAX_STRING );
|
||||
|
||||
uiDemos.background.generic.id = ID_BACKGROUND;
|
||||
uiDemos.background.generic.type = QMTYPE_BITMAP;
|
||||
uiDemos.background.generic.flags = QMF_INACTIVE;
|
||||
|
@ -137,49 +128,56 @@ static void UI_Demos_Init( void )
|
|||
uiDemos.background.generic.height = 768;
|
||||
uiDemos.background.pic = ART_BACKGROUND;
|
||||
|
||||
uiDemos.banner.generic.id = ID_BANNER;
|
||||
uiDemos.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiDemos.banner.generic.flags = QMF_INACTIVE;
|
||||
uiDemos.banner.generic.x = 0;
|
||||
uiDemos.banner.generic.y = 66;
|
||||
uiDemos.banner.generic.width = 1024;
|
||||
uiDemos.banner.generic.height = 46;
|
||||
uiDemos.banner.pic = ART_BANNER;
|
||||
uiDemos.play.generic.id = ID_PLAY;
|
||||
uiDemos.play.generic.type = QMTYPE_ACTION;
|
||||
uiDemos.play.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiDemos.play.generic.x = 72;
|
||||
uiDemos.play.generic.y = 230;
|
||||
uiDemos.play.generic.name = "Play";
|
||||
uiDemos.play.generic.statusText = "Playback selected demo";
|
||||
uiDemos.play.generic.callback = UI_Demos_Callback;
|
||||
|
||||
uiDemos.back.generic.id = ID_BACK;
|
||||
uiDemos.back.generic.type = QMTYPE_BITMAP;
|
||||
uiDemos.back.generic.x = 310;
|
||||
uiDemos.back.generic.y = 656;
|
||||
uiDemos.back.generic.width = 198;
|
||||
uiDemos.back.generic.height = 38;
|
||||
uiDemos.back.generic.callback = UI_Demos_Callback;
|
||||
uiDemos.back.generic.ownerdraw = UI_Demos_Ownerdraw;
|
||||
uiDemos.back.pic = UI_BACKBUTTON;
|
||||
uiDemos.delete.generic.id = ID_DELETE;
|
||||
uiDemos.delete.generic.type = QMTYPE_ACTION;
|
||||
uiDemos.delete.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiDemos.delete.generic.x = 72;
|
||||
uiDemos.delete.generic.y = 280;
|
||||
uiDemos.delete.generic.name = "Delete";
|
||||
uiDemos.delete.generic.statusText = "Delete selected demo";
|
||||
uiDemos.delete.generic.callback = UI_Demos_Callback;
|
||||
|
||||
uiDemos.load.generic.id = ID_LOAD;
|
||||
uiDemos.load.generic.type = QMTYPE_BITMAP;
|
||||
uiDemos.load.generic.x = 516;
|
||||
uiDemos.load.generic.y = 656;
|
||||
uiDemos.load.generic.width = 198;
|
||||
uiDemos.load.generic.height = 38;
|
||||
uiDemos.load.generic.callback = UI_Demos_Callback;
|
||||
uiDemos.load.generic.ownerdraw = UI_Demos_Ownerdraw;
|
||||
uiDemos.load.pic = UI_LOADBUTTON;
|
||||
uiDemos.cancel.generic.id = ID_CANCEL;
|
||||
uiDemos.cancel.generic.type = QMTYPE_ACTION;
|
||||
uiDemos.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiDemos.cancel.generic.x = 72;
|
||||
uiDemos.cancel.generic.y = 330;
|
||||
uiDemos.cancel.generic.name = "Cancel";
|
||||
uiDemos.cancel.generic.statusText = "Return back to main menu";
|
||||
uiDemos.cancel.generic.callback = UI_Demos_Callback;
|
||||
|
||||
uiDemos.hintMessage.generic.id = ID_TABLEHINT;
|
||||
uiDemos.hintMessage.generic.type = QMTYPE_ACTION;
|
||||
uiDemos.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
|
||||
uiDemos.hintMessage.generic.color = uiColorLtGrey;
|
||||
uiDemos.hintMessage.generic.name = uiDemos.hintText;
|
||||
uiDemos.hintMessage.generic.x = 360;
|
||||
uiDemos.hintMessage.generic.y = 225;
|
||||
|
||||
uiDemos.demoList.generic.id = ID_DEMOLIST;
|
||||
uiDemos.demoList.generic.type = QMTYPE_SCROLLLIST;
|
||||
uiDemos.demoList.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiDemos.demoList.generic.x = 256;
|
||||
uiDemos.demoList.generic.y = 208;
|
||||
uiDemos.demoList.generic.width = 512;
|
||||
uiDemos.demoList.generic.height = 352;
|
||||
uiDemos.demoList.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW|QMF_SMALLFONT;
|
||||
uiDemos.demoList.generic.x = 360;
|
||||
uiDemos.demoList.generic.y = 255;
|
||||
uiDemos.demoList.generic.width = 640;
|
||||
uiDemos.demoList.generic.height = 440;
|
||||
|
||||
UI_Demos_GetDemoList();
|
||||
|
||||
UI_AddItem( &uiDemos.menu, (void *)&uiDemos.background );
|
||||
UI_AddItem( &uiDemos.menu, (void *)&uiDemos.banner );
|
||||
UI_AddItem( &uiDemos.menu, (void *)&uiDemos.back );
|
||||
UI_AddItem( &uiDemos.menu, (void *)&uiDemos.load );
|
||||
UI_AddItem( &uiDemos.menu, (void *)&uiDemos.play );
|
||||
UI_AddItem( &uiDemos.menu, (void *)&uiDemos.delete );
|
||||
UI_AddItem( &uiDemos.menu, (void *)&uiDemos.cancel );
|
||||
UI_AddItem( &uiDemos.menu, (void *)&uiDemos.hintMessage );
|
||||
UI_AddItem( &uiDemos.menu, (void *)&uiDemos.demoList );
|
||||
}
|
||||
|
||||
|
@ -193,7 +191,6 @@ void UI_Demos_Precache( void )
|
|||
if( !re ) return;
|
||||
|
||||
re->RegisterShader( ART_BACKGROUND, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_BANNER, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/banners/gameoptions_t"
|
||||
#define ART_BANNER "gfx/shell/head_advanced"
|
||||
#define ART_TEXT1 "gfx/shell/text/gameoptions_text_p1"
|
||||
#define ART_TEXT2 "gfx/shell/text/gameoptions_text_p2"
|
||||
|
||||
|
@ -32,12 +32,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define ID_TEXT1 2
|
||||
#define ID_TEXT2 3
|
||||
#define ID_TEXTSHADOW1 4
|
||||
#define ID_TEXTSHADOW2 5
|
||||
|
||||
#define ID_BACK 6
|
||||
#define ID_DONE 6
|
||||
#define ID_CANCEL 7
|
||||
|
||||
#define ID_CROSSHAIR 7
|
||||
#define ID_MAXFPS 8
|
||||
#define ID_FOV 9
|
||||
#define ID_HAND 10
|
||||
|
@ -48,21 +46,17 @@ static const char *uiGameOptionsHand[] = { "Right", "Left", "Hidden" };
|
|||
|
||||
typedef struct
|
||||
{
|
||||
int showCrosshair;
|
||||
|
||||
menuFramework_s menu;
|
||||
|
||||
menuBitmap_s background;
|
||||
menuBitmap_s banner;
|
||||
|
||||
menuBitmap_s textShadow1;
|
||||
menuBitmap_s textShadow2;
|
||||
menuBitmap_s text1;
|
||||
menuBitmap_s text2;
|
||||
|
||||
menuBitmap_s back;
|
||||
menuAction_s done;
|
||||
menuAction_s cancel;
|
||||
|
||||
menuBitmap_s crosshair;
|
||||
menuField_s maxFPS;
|
||||
menuField_s fov;
|
||||
menuSpinControl_s hand;
|
||||
|
@ -79,9 +73,7 @@ UI_GameOptions_GetConfig
|
|||
*/
|
||||
static void UI_GameOptions_GetConfig( void )
|
||||
{
|
||||
uiGameOptions.showCrosshair = Cvar_VariableInteger( "cl_crosshair" );
|
||||
|
||||
com.snprintf( uiGameOptions.maxFPS.buffer, sizeof( uiGameOptions.maxFPS.buffer ), "%i", Cvar_VariableInteger( "cl_maxfps "));
|
||||
com.snprintf( uiGameOptions.maxFPS.buffer, sizeof( uiGameOptions.maxFPS.buffer ), "%i", Cvar_VariableInteger( "host_maxfps "));
|
||||
com.snprintf( uiGameOptions.fov.buffer, sizeof( uiGameOptions.fov.buffer ), "%i", Cvar_VariableInteger( "fov" ));
|
||||
uiGameOptions.hand.curValue = bound( 0, Cvar_VariableInteger( "hand" ), 2 );
|
||||
|
||||
|
@ -95,10 +87,8 @@ UI_GameOptions_SetConfig
|
|||
*/
|
||||
static void UI_GameOptions_SetConfig( void )
|
||||
{
|
||||
Cvar_SetValue( "cl_crosshair", uiGameOptions.showCrosshair );
|
||||
|
||||
if( com.atoi( uiGameOptions.maxFPS.buffer ) >= 0 )
|
||||
Cvar_SetValue( "cl_maxfps", com.atof( uiGameOptions.maxFPS.buffer ));
|
||||
if( com.atoi( uiGameOptions.maxFPS.buffer ) > 0 )
|
||||
Cvar_SetValue( "host_maxfps", com.atof( uiGameOptions.maxFPS.buffer ));
|
||||
|
||||
if( com.atoi( uiGameOptions.fov.buffer ) >= 1 && com.atoi( uiGameOptions.fov.buffer ) <= 179 )
|
||||
Cvar_SetValue( "fov", com.atof( uiGameOptions.fov.buffer ));
|
||||
|
@ -127,25 +117,18 @@ static void UI_GameOptions_Callback( void *self, int event )
|
|||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( event == QM_CHANGED )
|
||||
{
|
||||
UI_GameOptions_UpdateConfig();
|
||||
UI_GameOptions_SetConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
if( event != QM_ACTIVATED )
|
||||
return;
|
||||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_BACK:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_CROSSHAIR:
|
||||
uiGameOptions.showCrosshair = !uiGameOptions.showCrosshair;
|
||||
case ID_DONE:
|
||||
UI_GameOptions_UpdateConfig();
|
||||
UI_GameOptions_SetConfig();
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_CANCEL:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -159,17 +142,11 @@ static void UI_GameOptions_Ownerdraw( void *self )
|
|||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( self == (void *)&uiGameOptions.crosshair )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if( uiGameOptions.menu.items[uiGameOptions.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
if( uiGameOptions.menu.items[uiGameOptions.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -193,32 +170,12 @@ static void UI_GameOptions_Init( void )
|
|||
uiGameOptions.banner.generic.id = ID_BANNER;
|
||||
uiGameOptions.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiGameOptions.banner.generic.flags = QMF_INACTIVE;
|
||||
uiGameOptions.banner.generic.x = 0;
|
||||
uiGameOptions.banner.generic.y = 66;
|
||||
uiGameOptions.banner.generic.width = 1024;
|
||||
uiGameOptions.banner.generic.height = 46;
|
||||
uiGameOptions.banner.generic.x = 65;
|
||||
uiGameOptions.banner.generic.y = 92;
|
||||
uiGameOptions.banner.generic.width = 690;
|
||||
uiGameOptions.banner.generic.height = 120;
|
||||
uiGameOptions.banner.pic = ART_BANNER;
|
||||
|
||||
uiGameOptions.textShadow1.generic.id = ID_TEXTSHADOW1;
|
||||
uiGameOptions.textShadow1.generic.type = QMTYPE_BITMAP;
|
||||
uiGameOptions.textShadow1.generic.flags = QMF_INACTIVE;
|
||||
uiGameOptions.textShadow1.generic.x = 182;
|
||||
uiGameOptions.textShadow1.generic.y = 170;
|
||||
uiGameOptions.textShadow1.generic.width = 256;
|
||||
uiGameOptions.textShadow1.generic.height = 256;
|
||||
uiGameOptions.textShadow1.generic.color = uiColorBlack;
|
||||
uiGameOptions.textShadow1.pic = ART_TEXT1;
|
||||
|
||||
uiGameOptions.textShadow2.generic.id = ID_TEXTSHADOW2;
|
||||
uiGameOptions.textShadow2.generic.type = QMTYPE_BITMAP;
|
||||
uiGameOptions.textShadow2.generic.flags = QMF_INACTIVE;
|
||||
uiGameOptions.textShadow2.generic.x = 182;
|
||||
uiGameOptions.textShadow2.generic.y = 426;
|
||||
uiGameOptions.textShadow2.generic.width = 256;
|
||||
uiGameOptions.textShadow2.generic.height = 256;
|
||||
uiGameOptions.textShadow2.generic.color = uiColorBlack;
|
||||
uiGameOptions.textShadow2.pic = ART_TEXT2;
|
||||
|
||||
uiGameOptions.text1.generic.id = ID_TEXT1;
|
||||
uiGameOptions.text1.generic.type = QMTYPE_BITMAP;
|
||||
uiGameOptions.text1.generic.flags = QMF_INACTIVE;
|
||||
|
@ -237,26 +194,23 @@ static void UI_GameOptions_Init( void )
|
|||
uiGameOptions.text2.generic.height = 256;
|
||||
uiGameOptions.text2.pic = ART_TEXT2;
|
||||
|
||||
uiGameOptions.back.generic.id = ID_BACK;
|
||||
uiGameOptions.back.generic.type = QMTYPE_BITMAP;
|
||||
uiGameOptions.back.generic.x = 413;
|
||||
uiGameOptions.back.generic.y = 656;
|
||||
uiGameOptions.back.generic.width = 198;
|
||||
uiGameOptions.back.generic.height = 38;
|
||||
uiGameOptions.back.generic.callback = UI_GameOptions_Callback;
|
||||
uiGameOptions.back.generic.ownerdraw = UI_GameOptions_Ownerdraw;
|
||||
uiGameOptions.back.pic = UI_BACKBUTTON;
|
||||
uiGameOptions.done.generic.id = ID_DONE;
|
||||
uiGameOptions.done.generic.type = QMTYPE_ACTION;
|
||||
uiGameOptions.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiGameOptions.done.generic.x = 72;
|
||||
uiGameOptions.done.generic.y = 230;
|
||||
uiGameOptions.done.generic.name = "Done";
|
||||
uiGameOptions.done.generic.statusText = "Save changes and go back to the Customize Menu";
|
||||
uiGameOptions.done.generic.callback = UI_GameOptions_Callback;
|
||||
|
||||
uiGameOptions.crosshair.generic.id = ID_CROSSHAIR;
|
||||
uiGameOptions.crosshair.generic.type = QMTYPE_BITMAP;
|
||||
uiGameOptions.crosshair.generic.flags = 0;
|
||||
uiGameOptions.crosshair.generic.x = 646;
|
||||
uiGameOptions.crosshair.generic.y = 144;
|
||||
uiGameOptions.crosshair.generic.width = 64;
|
||||
uiGameOptions.crosshair.generic.height = 64;
|
||||
uiGameOptions.crosshair.generic.callback = UI_GameOptions_Callback;
|
||||
uiGameOptions.crosshair.generic.ownerdraw = UI_GameOptions_Ownerdraw;
|
||||
uiGameOptions.crosshair.generic.statusText = "Click to change crosshair color";
|
||||
uiGameOptions.cancel.generic.id = ID_CANCEL;
|
||||
uiGameOptions.cancel.generic.type = QMTYPE_ACTION;
|
||||
uiGameOptions.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiGameOptions.cancel.generic.x = 72;
|
||||
uiGameOptions.cancel.generic.y = 280;
|
||||
uiGameOptions.cancel.generic.name = "Cancel";
|
||||
uiGameOptions.cancel.generic.statusText = "Go back to the Customize Menu";
|
||||
uiGameOptions.cancel.generic.callback = UI_GameOptions_Callback;
|
||||
|
||||
uiGameOptions.maxFPS.generic.id = ID_MAXFPS;
|
||||
uiGameOptions.maxFPS.generic.type = QMTYPE_FIELD;
|
||||
|
@ -310,12 +264,10 @@ static void UI_GameOptions_Init( void )
|
|||
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.background );
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.banner );
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.textShadow1 );
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.textShadow2 );
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.text1 );
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.text2 );
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.back );
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.crosshair );
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.done );
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.cancel );
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.maxFPS );
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.fov );
|
||||
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.hand );
|
||||
|
|
|
@ -1,167 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
This program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "ui_local.h"
|
||||
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_MSGBOX "gfx/shell/title_screen/site_load"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
|
||||
#define ID_MSGBOX 1
|
||||
#define ID_YES 2
|
||||
#define ID_NO 3
|
||||
|
||||
typedef struct
|
||||
{
|
||||
string webAddress;
|
||||
|
||||
menuFramework_s menu;
|
||||
menuBitmap_s background;
|
||||
menuBitmap_s msgBox;
|
||||
menuBitmap_s no;
|
||||
menuBitmap_s yes;
|
||||
} uiGoToSite_t;
|
||||
|
||||
static uiGoToSite_t uiGoToSite;
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_GoToSite_Callback
|
||||
=================
|
||||
*/
|
||||
static void UI_GoToSite_Callback( void *self, int event )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( event != QM_ACTIVATED )
|
||||
return;
|
||||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_YES:
|
||||
Sys_ShellExecute( uiGoToSite.webAddress, NULL, true );
|
||||
break;
|
||||
case ID_NO:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_GoToSite_Ownerdraw
|
||||
=================
|
||||
*/
|
||||
static void UI_GoToSite_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( uiGoToSite.menu.items[uiGoToSite.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_GoToSite_Init
|
||||
=================
|
||||
*/
|
||||
static void UI_GoToSite_Init( void )
|
||||
{
|
||||
Mem_Set( &uiGoToSite, 0, sizeof( uiGoToSite_t ));
|
||||
|
||||
uiGoToSite.background.generic.id = ID_BACKGROUND;
|
||||
uiGoToSite.background.generic.type = QMTYPE_BITMAP;
|
||||
uiGoToSite.background.generic.flags = QMF_INACTIVE | QMF_GRAYED;
|
||||
uiGoToSite.background.generic.x = 0;
|
||||
uiGoToSite.background.generic.y = 0;
|
||||
uiGoToSite.background.generic.width = 1024;
|
||||
uiGoToSite.background.generic.height = 768;
|
||||
uiGoToSite.background.pic = ART_BACKGROUND;
|
||||
|
||||
uiGoToSite.msgBox.generic.id = ID_MSGBOX;
|
||||
uiGoToSite.msgBox.generic.type = QMTYPE_BITMAP;
|
||||
uiGoToSite.msgBox.generic.flags = QMF_INACTIVE;
|
||||
uiGoToSite.msgBox.generic.x = 174;
|
||||
uiGoToSite.msgBox.generic.y = 256;
|
||||
uiGoToSite.msgBox.generic.width = 676;
|
||||
uiGoToSite.msgBox.generic.height = 256;
|
||||
uiGoToSite.msgBox.pic = ART_MSGBOX;
|
||||
|
||||
uiGoToSite.no.generic.id = ID_NO;
|
||||
uiGoToSite.no.generic.type = QMTYPE_BITMAP;
|
||||
uiGoToSite.no.generic.flags = 0;
|
||||
uiGoToSite.no.generic.x = 310;
|
||||
uiGoToSite.no.generic.y = 434;
|
||||
uiGoToSite.no.generic.width = 198;
|
||||
uiGoToSite.no.generic.height = 38;
|
||||
uiGoToSite.no.generic.callback = UI_GoToSite_Callback;
|
||||
uiGoToSite.no.generic.ownerdraw = UI_GoToSite_Ownerdraw;
|
||||
uiGoToSite.no.pic = UI_CANCELBUTTON;
|
||||
|
||||
uiGoToSite.yes.generic.id = ID_YES;
|
||||
uiGoToSite.yes.generic.type = QMTYPE_BITMAP;
|
||||
uiGoToSite.yes.generic.flags = 0;
|
||||
uiGoToSite.yes.generic.x = 516;
|
||||
uiGoToSite.yes.generic.y = 434;
|
||||
uiGoToSite.yes.generic.width = 198;
|
||||
uiGoToSite.yes.generic.height = 38;
|
||||
uiGoToSite.yes.generic.callback = UI_GoToSite_Callback;
|
||||
uiGoToSite.yes.generic.ownerdraw = UI_GoToSite_Ownerdraw;
|
||||
uiGoToSite.yes.pic = UI_ACCEPTBUTTON;
|
||||
|
||||
UI_AddItem( &uiGoToSite.menu, (void *)&uiGoToSite.background );
|
||||
UI_AddItem( &uiGoToSite.menu, (void *)&uiGoToSite.msgBox );
|
||||
UI_AddItem( &uiGoToSite.menu, (void *)&uiGoToSite.no );
|
||||
UI_AddItem( &uiGoToSite.menu, (void *)&uiGoToSite.yes );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_GoToSite_Precache
|
||||
=================
|
||||
*/
|
||||
void UI_GoToSite_Precache( void )
|
||||
{
|
||||
if( !re ) return;
|
||||
|
||||
re->RegisterShader( ART_BACKGROUND, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_MSGBOX, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_GoToSite_Menu
|
||||
=================
|
||||
*/
|
||||
void UI_GoToSite_Menu( const char *webAddress )
|
||||
{
|
||||
UI_GoToSite_Precache();
|
||||
UI_GoToSite_Init();
|
||||
|
||||
com.strncpy( uiGoToSite.webAddress, webAddress, sizeof( uiGoToSite.webAddress ));
|
||||
UI_PushMenu( &uiGoToSite.menu );
|
||||
}
|
|
@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/head_load"
|
||||
#define ART_LEVELSHOTBLUR "gfx/shell/segments/sp_mapshot"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
#define ID_BANNER 1
|
||||
|
@ -81,7 +80,7 @@ static void UI_LoadGame_GetGameList( void )
|
|||
search_t *t;
|
||||
int i;
|
||||
|
||||
t = FS_Search( "save/*.bin", true );
|
||||
t = FS_Search( "save/*.sav", true );
|
||||
|
||||
for( i = 0; t && i < t->numfilenames; i++ )
|
||||
{
|
||||
|
@ -209,8 +208,8 @@ static void UI_LoadGame_Ownerdraw( void *self )
|
|||
}
|
||||
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
|
||||
|
||||
// draw the blurred frame
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
// draw the rectangle
|
||||
UI_DrawRectangle( item->x, item->y, item->width, item->height, uiScrollOutlineColor );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +290,6 @@ static void UI_LoadGame_Init( void )
|
|||
uiLoadGame.levelShot.generic.width = LEVELSHOT_W;
|
||||
uiLoadGame.levelShot.generic.height = LEVELSHOT_H;
|
||||
uiLoadGame.levelShot.generic.ownerdraw = UI_LoadGame_Ownerdraw;
|
||||
uiLoadGame.levelShot.pic = ART_LEVELSHOTBLUR;
|
||||
|
||||
uiLoadGame.savesList.generic.id = ID_SAVELIST;
|
||||
uiLoadGame.savesList.generic.type = QMTYPE_SCROLLLIST;
|
||||
|
@ -325,7 +323,6 @@ void UI_LoadGame_Precache( void )
|
|||
|
||||
re->RegisterShader( ART_BACKGROUND, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_BANNER, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_LEVELSHOTBLUR, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -37,21 +37,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define UI_UPARROWFOCUS "gfx/shell/uparrow_f"
|
||||
#define UI_DOWNARROW "gfx/shell/dnarrow_d"
|
||||
#define UI_DOWNARROWFOCUS "gfx/shell/dnarrow_f"
|
||||
#define UI_BACKGROUNDLISTBOX "gfx/shell/segments/list_mid"
|
||||
#define UI_SELECTIONBOX "gfx/shell/misc/list_sel"
|
||||
#define UI_BACKGROUNDBOX "gfx/shell/buttons/options2_b"
|
||||
#define UI_MOVEBOX "gfx/shell/buttons/move_box"
|
||||
#define UI_MOVEBOXFOCUS "gfx/shell/buttons/move_box_s"
|
||||
#define UI_BACKBUTTON "gfx/shell/buttons/back_b"
|
||||
#define UI_LOADBUTTON "gfx/shell/buttons/load_b"
|
||||
#define UI_SAVEBUTTON "gfx/shell/buttons/save_b"
|
||||
#define UI_DELETEBUTTON "gfx/shell/buttons/delete_b"
|
||||
#define UI_CANCELBUTTON "gfx/shell/buttons/cancel_b"
|
||||
#define UI_APPLYBUTTON "gfx/shell/buttons/apply_b"
|
||||
#define UI_ACCEPTBUTTON "gfx/shell/buttons/accept_b"
|
||||
#define UI_PLAYBUTTON "gfx/shell/buttons/play_b"
|
||||
#define UI_STARTBUTTON "gfx/shell/buttons/fight_b"
|
||||
#define UI_NEWGAMEBUTTON "gfx/shell/buttons/newgame_b"
|
||||
|
||||
#define UI_MAX_MENUDEPTH 8
|
||||
#define UI_MAX_MENUITEMS 64
|
||||
|
@ -72,7 +60,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define UI_MAX_FIELD_LINE 256
|
||||
#define UI_OUTLINE_WIDTH 4 // outline thickness
|
||||
|
||||
#define UI_MAXGAMES 128
|
||||
#define UI_MAXGAMES 100 // slots for savegame
|
||||
#define UI_MAX_SERVERS 10
|
||||
|
||||
// Generic types
|
||||
|
@ -105,6 +93,7 @@ typedef enum
|
|||
#define QMF_HASMOUSEFOCUS 0x00010000
|
||||
#define QMF_MOUSEONLY 0x00020000 // Only mouse input allowed
|
||||
#define QMF_FOCUSBEHIND 0x00040000 // Focus draws behind normal item
|
||||
#define QMF_NOTIFY 0x00080000 // draw notify at right screen side
|
||||
|
||||
// Callback notifications
|
||||
#define QM_GOTFOCUS 1
|
||||
|
@ -293,11 +282,14 @@ extern rgba_t uiColorYellow;
|
|||
extern rgba_t uiColorOrange;
|
||||
extern rgba_t uiColorCyan;
|
||||
extern rgba_t uiColorMagenta;
|
||||
extern rgba_t uiScrollOutlineColor;
|
||||
extern rgba_t uiScrollSelColor;
|
||||
|
||||
void UI_ScaleCoords( int *x, int *y, int *w, int *h );
|
||||
bool UI_CursorInRect( int x, int y, int w, int h );
|
||||
void UI_DrawPic( int x, int y, int w, int h, const rgba_t color, const char *pic );
|
||||
void UI_FillRect( int x, int y, int w, int h, const rgba_t color );
|
||||
void UI_DrawRectangle( int in_x, int in_y, int in_w, int in_h, const rgba_t color );
|
||||
void UI_DrawString( int x, int y, int w, int h, const char *string, const rgba_t color, bool forceColor, int charW, int charH, int justify, bool shadow );
|
||||
void UI_StartSound( const char *sound );
|
||||
|
||||
|
@ -330,10 +322,6 @@ void UI_Controls_Precache( void );
|
|||
void UI_GameOptions_Precache( void );
|
||||
void UI_Audio_Precache( void );
|
||||
void UI_Video_Precache( void );
|
||||
void UI_Advanced_Precache( void );
|
||||
void UI_Performance_Precache( void );
|
||||
void UI_Network_Precache( void );
|
||||
void UI_Defaults_Precache( void );
|
||||
void UI_Demos_Precache( void );
|
||||
void UI_CustomGame_Precache( void );
|
||||
void UI_Credits_Precache( void );
|
||||
|
@ -352,13 +340,8 @@ void UI_Controls_Menu( void );
|
|||
void UI_GameOptions_Menu( void );
|
||||
void UI_Audio_Menu( void );
|
||||
void UI_Video_Menu( void );
|
||||
void UI_Advanced_Menu( void );
|
||||
void UI_Performance_Menu( void );
|
||||
void UI_Network_Menu( void );
|
||||
void UI_Defaults_Menu( void );
|
||||
void UI_Demos_Menu( void );
|
||||
void UI_CustomGame_Menu( void );
|
||||
void UI_Credits_Menu( void );
|
||||
void UI_GoToSite_Menu( const char *webAddress );
|
||||
|
||||
#endif // UI_LOCAL_H
|
|
@ -34,17 +34,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define ID_CONSOLE 1
|
||||
#define ID_RESUME 2
|
||||
#define ID_NEWGAME 3
|
||||
#define ID_CONFIGURATION 4
|
||||
#define ID_SAVERESTORE 5
|
||||
#define ID_MULTIPLAYER 6
|
||||
#define ID_CUSTOMGAME 7
|
||||
#define ID_CREDITS 8
|
||||
#define ID_QUIT 9
|
||||
#define ID_MINIMIZE 10
|
||||
#define ID_MSGBOX 11
|
||||
#define ID_MSGTEXT 12
|
||||
#define ID_YES 13
|
||||
#define ID_NO 14
|
||||
#define ID_HAZARDCOURSE 4
|
||||
#define ID_CONFIGURATION 5
|
||||
#define ID_SAVERESTORE 6
|
||||
#define ID_MULTIPLAYER 7
|
||||
#define ID_CUSTOMGAME 8
|
||||
#define ID_CREDITS 9
|
||||
#define ID_QUIT 10
|
||||
#define ID_MINIMIZE 11
|
||||
#define ID_MSGBOX 12
|
||||
#define ID_MSGTEXT 13
|
||||
#define ID_YES 14
|
||||
#define ID_NO 15
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -54,6 +55,7 @@ typedef struct
|
|||
menuAction_s console;
|
||||
menuAction_s resumeGame;
|
||||
menuAction_s newGame;
|
||||
menuAction_s hazardCourse;
|
||||
menuAction_s configuration;
|
||||
menuAction_s saveRestore;
|
||||
menuAction_s multiPlayer;
|
||||
|
@ -92,6 +94,7 @@ static void UI_QuitDialog( void )
|
|||
uiMain.console.generic.flags ^= QMF_INACTIVE;
|
||||
uiMain.resumeGame.generic.flags ^= QMF_INACTIVE;
|
||||
uiMain.newGame.generic.flags ^= QMF_INACTIVE;
|
||||
uiMain.hazardCourse.generic.flags ^= QMF_INACTIVE;
|
||||
uiMain.saveRestore.generic.flags ^= QMF_INACTIVE;
|
||||
uiMain.configuration.generic.flags ^= QMF_INACTIVE;
|
||||
uiMain.multiPlayer.generic.flags ^= QMF_INACTIVE;
|
||||
|
@ -126,6 +129,23 @@ static const char *UI_Main_KeyFunc( int key )
|
|||
return UI_DefaultKey( &uiMain.menu, key );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Main_HazardCourse
|
||||
=================
|
||||
*/
|
||||
static void UI_Main_HazardCourse( void )
|
||||
{
|
||||
Cvar_SetValue( "skill", 0.0f );
|
||||
Cvar_SetValue( "deathmatch", 0.0f );
|
||||
Cvar_SetValue( "gamerules", 0.0f );
|
||||
Cvar_SetValue( "teamplay", 0.0f );
|
||||
Cvar_SetValue( "pausable", 1.0f ); // singleplayer is always allowing pause
|
||||
Cvar_SetValue( "coop", 0.0f );
|
||||
|
||||
Cbuf_ExecuteText( EXEC_APPEND, va( "loading; killserver; wait; map %s\n", GI->trainmap ));
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Main_Callback
|
||||
|
@ -150,6 +170,9 @@ static void UI_Main_Callback( void *self, int event )
|
|||
case ID_NEWGAME:
|
||||
UI_NewGame_Menu();
|
||||
break;
|
||||
case ID_HAZARDCOURSE:
|
||||
UI_Main_HazardCourse();
|
||||
break;
|
||||
case ID_MULTIPLAYER:
|
||||
UI_MultiPlayer_Menu();
|
||||
break;
|
||||
|
@ -215,7 +238,7 @@ static void UI_Main_Init( void )
|
|||
uiMain.resumeGame.generic.id = ID_RESUME;
|
||||
uiMain.resumeGame.generic.type = QMTYPE_ACTION;
|
||||
uiMain.resumeGame.generic.name = "Resume game";
|
||||
uiMain.resumeGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiMain.resumeGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiMain.resumeGame.generic.statusText = "Return to game.";
|
||||
uiMain.resumeGame.generic.x = 72;
|
||||
uiMain.resumeGame.generic.y = 180;
|
||||
|
@ -224,20 +247,32 @@ static void UI_Main_Init( void )
|
|||
uiMain.newGame.generic.id = ID_NEWGAME;
|
||||
uiMain.newGame.generic.type = QMTYPE_ACTION;
|
||||
uiMain.newGame.generic.name = "New game";
|
||||
uiMain.newGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiMain.newGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiMain.newGame.generic.statusText = "Start a new game.";
|
||||
uiMain.newGame.generic.x = 72;
|
||||
uiMain.newGame.generic.y = 230;
|
||||
uiMain.newGame.generic.callback = UI_Main_Callback;
|
||||
|
||||
uiMain.hazardCourse.generic.id = ID_HAZARDCOURSE;
|
||||
uiMain.hazardCourse.generic.type = QMTYPE_ACTION;
|
||||
uiMain.hazardCourse.generic.name = "Hazard course";
|
||||
uiMain.hazardCourse.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiMain.hazardCourse.generic.statusText = "Learn how to play the game";
|
||||
uiMain.hazardCourse.generic.x = 72;
|
||||
uiMain.hazardCourse.generic.y = 280;
|
||||
uiMain.hazardCourse.generic.callback = UI_Main_Callback;
|
||||
|
||||
uiMain.saveRestore.generic.id = ID_SAVERESTORE;
|
||||
uiMain.saveRestore.generic.type = QMTYPE_ACTION;
|
||||
uiMain.saveRestore.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiMain.saveRestore.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
|
||||
// server.dll needs for reading savefiles
|
||||
// server.dll needs for reading savefiles or startup newgame
|
||||
Com_BuildPath( "server", libpath );
|
||||
if( !FS_FileExists( libpath ))
|
||||
{
|
||||
uiMain.saveRestore.generic.flags |= QMF_GRAYED;
|
||||
uiMain.newGame.generic.flags |= QMF_GRAYED;
|
||||
}
|
||||
|
||||
if( cls.state == ca_active )
|
||||
{
|
||||
|
@ -251,52 +286,52 @@ static void UI_Main_Init( void )
|
|||
uiMain.resumeGame.generic.flags |= QMF_HIDDEN;
|
||||
}
|
||||
uiMain.saveRestore.generic.x = 72;
|
||||
uiMain.saveRestore.generic.y = 280;
|
||||
uiMain.saveRestore.generic.y = com.strlen( GI->trainmap ) ? 330 : 280;
|
||||
uiMain.saveRestore.generic.callback = UI_Main_Callback;
|
||||
|
||||
uiMain.configuration.generic.id = ID_CONFIGURATION;
|
||||
uiMain.configuration.generic.type = QMTYPE_ACTION;
|
||||
uiMain.configuration.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiMain.configuration.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiMain.configuration.generic.name = "Configuration";
|
||||
uiMain.configuration.generic.statusText = "Change game settings, configure controls";
|
||||
uiMain.configuration.generic.x = 72;
|
||||
uiMain.configuration.generic.y = 330;
|
||||
uiMain.configuration.generic.y = com.strlen( GI->trainmap ) ? 380 : 330;
|
||||
uiMain.configuration.generic.callback = UI_Main_Callback;
|
||||
|
||||
uiMain.multiPlayer.generic.id = ID_MULTIPLAYER;
|
||||
uiMain.multiPlayer.generic.type = QMTYPE_ACTION;
|
||||
uiMain.multiPlayer.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiMain.multiPlayer.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiMain.multiPlayer.generic.name = "Multiplayer";
|
||||
uiMain.multiPlayer.generic.statusText = "Search for internet servers, configure character";
|
||||
uiMain.multiPlayer.generic.x = 72;
|
||||
uiMain.multiPlayer.generic.y = 380;
|
||||
uiMain.multiPlayer.generic.y = com.strlen( GI->trainmap ) ? 430 : 380;
|
||||
uiMain.multiPlayer.generic.callback = UI_Main_Callback;
|
||||
|
||||
uiMain.customGame.generic.id = ID_CUSTOMGAME;
|
||||
uiMain.customGame.generic.type = QMTYPE_ACTION;
|
||||
uiMain.customGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiMain.customGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiMain.customGame.generic.name = "Custom Game";
|
||||
uiMain.customGame.generic.statusText = "Select a custom game";
|
||||
uiMain.customGame.generic.x = 72;
|
||||
uiMain.customGame.generic.y = 430;
|
||||
uiMain.customGame.generic.y = com.strlen( GI->trainmap ) ? 480 : 430;
|
||||
uiMain.customGame.generic.callback = UI_Main_Callback;
|
||||
|
||||
uiMain.credits.generic.id = ID_CREDITS;
|
||||
uiMain.credits.generic.type = QMTYPE_ACTION;
|
||||
uiMain.credits.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiMain.credits.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiMain.credits.generic.name = "About";
|
||||
uiMain.credits.generic.statusText = "Game credits";
|
||||
uiMain.credits.generic.x = 72;
|
||||
uiMain.credits.generic.y = 480;
|
||||
uiMain.credits.generic.y = com.strlen( GI->trainmap ) ? 530 : 480;
|
||||
uiMain.credits.generic.callback = UI_Main_Callback;
|
||||
|
||||
uiMain.quit.generic.id = ID_QUIT;
|
||||
uiMain.quit.generic.type = QMTYPE_ACTION;
|
||||
uiMain.quit.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiMain.quit.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiMain.quit.generic.name = "Quit";
|
||||
uiMain.quit.generic.statusText = "Quit from game";
|
||||
uiMain.quit.generic.x = 72;
|
||||
uiMain.quit.generic.y = 530;
|
||||
uiMain.quit.generic.y = com.strlen( GI->trainmap ) ? 580 : 530;
|
||||
uiMain.quit.generic.callback = UI_Main_Callback;
|
||||
|
||||
uiMain.minimizeBtn.generic.id = ID_MINIMIZE;
|
||||
|
@ -357,6 +392,8 @@ static void UI_Main_Init( void )
|
|||
if( host.developer ) UI_AddItem( &uiMain.menu, (void *)&uiMain.console );
|
||||
UI_AddItem( &uiMain.menu, (void *)&uiMain.resumeGame );
|
||||
UI_AddItem( &uiMain.menu, (void *)&uiMain.newGame );
|
||||
if( com.strlen( GI->trainmap ))
|
||||
UI_AddItem( &uiMain.menu, (void *)&uiMain.hazardCourse );
|
||||
UI_AddItem( &uiMain.menu, (void *)&uiMain.saveRestore );
|
||||
UI_AddItem( &uiMain.menu, (void *)&uiMain.configuration );
|
||||
UI_AddItem( &uiMain.menu, (void *)&uiMain.multiPlayer );
|
||||
|
|
|
@ -121,6 +121,48 @@ void UI_FillRect( int x, int y, int w, int h, const rgba_t color )
|
|||
re->SetColor( NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_DrawRectangle
|
||||
=================
|
||||
*/
|
||||
void UI_DrawRectangle( int in_x, int in_y, int in_w, int in_h, const rgba_t color )
|
||||
{
|
||||
int x, y, w, h;
|
||||
|
||||
x = in_x - UI_OUTLINE_WIDTH;
|
||||
y = in_y - UI_OUTLINE_WIDTH;
|
||||
w = UI_OUTLINE_WIDTH;
|
||||
h = in_h + UI_OUTLINE_WIDTH + UI_OUTLINE_WIDTH;
|
||||
|
||||
// draw left
|
||||
UI_FillRect( x, y, w, h, color );
|
||||
|
||||
x = in_x + in_w;
|
||||
y = in_y - UI_OUTLINE_WIDTH;
|
||||
w = UI_OUTLINE_WIDTH;
|
||||
h = in_h + UI_OUTLINE_WIDTH + UI_OUTLINE_WIDTH;
|
||||
|
||||
// draw right
|
||||
UI_FillRect( x, y, w, h, color );
|
||||
|
||||
x = in_x;
|
||||
y = in_y - UI_OUTLINE_WIDTH;
|
||||
w = in_w;
|
||||
h = UI_OUTLINE_WIDTH;
|
||||
|
||||
// draw top
|
||||
UI_FillRect( x, y, w, h, color );
|
||||
|
||||
// draw bottom
|
||||
x = in_x;
|
||||
y = in_y + in_h;
|
||||
w = in_w;
|
||||
h = UI_OUTLINE_WIDTH;
|
||||
|
||||
UI_FillRect( x, y, w, h, color );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_DrawString
|
||||
|
@ -490,7 +532,7 @@ void UI_DrawMenu( menuFramework_s *menu )
|
|||
lastItem = item;
|
||||
}
|
||||
|
||||
if( item && ( item->flags & QMF_HASMOUSEFOCUS ) && ( item->statusText != NULL ))
|
||||
if( item && ( item->flags & QMF_HASMOUSEFOCUS && !( item->flags & QMF_NOTIFY )) && ( item->statusText != NULL ))
|
||||
{
|
||||
// fade it in, but wait a second
|
||||
color[3] = bound( 0.0, ((uiStatic.realTime - statusFadeTime) - 1000) * 0.001f, 1.0f ) * 255;
|
||||
|
@ -966,21 +1008,9 @@ void UI_Precache( void )
|
|||
re->RegisterShader( UI_UPARROWFOCUS, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_DOWNARROW, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_DOWNARROWFOCUS, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_BACKGROUNDLISTBOX, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_SELECTIONBOX, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_BACKGROUNDBOX, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_MOVEBOX, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_MOVEBOXFOCUS, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_BACKBUTTON, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_LOADBUTTON, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_SAVEBUTTON, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_DELETEBUTTON, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_CANCELBUTTON, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_APPLYBUTTON, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_ACCEPTBUTTON, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_PLAYBUTTON, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_STARTBUTTON, SHADER_NOMIP );
|
||||
re->RegisterShader( UI_NEWGAMEBUTTON, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
if( ui_precache->integer == 1 )
|
||||
|
@ -998,14 +1028,9 @@ void UI_Precache( void )
|
|||
UI_GameOptions_Precache();
|
||||
UI_Audio_Precache();
|
||||
UI_Video_Precache();
|
||||
UI_Advanced_Precache();
|
||||
UI_Performance_Precache();
|
||||
UI_Network_Precache();
|
||||
UI_Defaults_Precache();
|
||||
UI_Demos_Precache();
|
||||
UI_CustomGame_Precache();
|
||||
UI_Credits_Precache();
|
||||
UI_GoToSite_Precache();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1031,10 +1056,6 @@ void UI_Init( void )
|
|||
Cmd_AddCommand( "menu_gameoptions", UI_GameOptions_Menu, "open the game options menu" );
|
||||
Cmd_AddCommand( "menu_audio", UI_Audio_Menu, "open the sound options menu" );
|
||||
Cmd_AddCommand( "menu_video", UI_Video_Menu, "open the video options menu" );
|
||||
Cmd_AddCommand( "menu_advanced", UI_Advanced_Menu, "open the advanced video options menu" );
|
||||
Cmd_AddCommand( "menu_performance", UI_Performance_Menu, "open the perfomance options menu" );
|
||||
Cmd_AddCommand( "menu_network", UI_Network_Menu, "open the network options menu" );
|
||||
Cmd_AddCommand( "menu_defaults", UI_Defaults_Menu, "open the 'reset to defaults' dialog" );
|
||||
Cmd_AddCommand( "menu_demos", UI_Demos_Menu, "open the demos viewer menu" );
|
||||
Cmd_AddCommand( "menu_customgame", UI_CustomGame_Menu, "open the change game menu" );
|
||||
|
||||
|
|
|
@ -27,12 +27,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "input.h"
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/banners/multiplayer_t"
|
||||
#define ART_BANNER "gfx/shell/head_multi"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
#define ID_BANNER 1
|
||||
|
||||
#define ID_BACK 2
|
||||
#define ID_INTERNETGAMES 2
|
||||
#define ID_SPECTATEGAMES 3
|
||||
#define ID_LANGAME 4
|
||||
#define ID_CUSTOMIZE 5
|
||||
#define ID_CONTROLS 6
|
||||
#define ID_DONE 7
|
||||
|
||||
#define ID_ADDRESSBOOK 3
|
||||
#define ID_REFRESH 4
|
||||
|
@ -63,9 +68,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define ID_DMOPTIONS 9
|
||||
#define ID_BEGIN 10
|
||||
|
||||
#define ID_JOINSERVER 3
|
||||
#define ID_STARTSERVER 4
|
||||
|
||||
static const char *uiDMOptionsYesNo[] = { "False", "True" };
|
||||
|
||||
typedef struct
|
||||
|
@ -152,12 +154,15 @@ typedef struct
|
|||
{
|
||||
menuFramework_s menu;
|
||||
|
||||
menuBitmap_s back;
|
||||
menuBitmap_s background;
|
||||
menuBitmap_s banner;
|
||||
|
||||
menuAction_s joinServer;
|
||||
menuAction_s startServer;
|
||||
menuAction_s internetGames;
|
||||
menuAction_s spectateGames;
|
||||
menuAction_s LANGame;
|
||||
menuAction_s Customize; // playersetup
|
||||
menuAction_s Controls;
|
||||
menuAction_s done;
|
||||
} uiMultiPlayer_t;
|
||||
|
||||
static uiMultiPlayer_t uiMultiPlayer;
|
||||
|
@ -206,7 +211,7 @@ static void UI_AddressBook_Callback( void *self, int event )
|
|||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_BACK:
|
||||
case ID_DONE:
|
||||
UI_AddressBook_SaveServers();
|
||||
UI_PopMenu();
|
||||
break;
|
||||
|
@ -260,7 +265,7 @@ static void UI_AddressBook_Init( void )
|
|||
uiAddressBook.banner.generic.height = 46;
|
||||
uiAddressBook.banner.pic = ART_BANNER;
|
||||
|
||||
uiAddressBook.back.generic.id = ID_BACK;
|
||||
uiAddressBook.back.generic.id = ID_DONE;
|
||||
uiAddressBook.back.generic.type = QMTYPE_BITMAP;
|
||||
uiAddressBook.back.generic.x = 413;
|
||||
uiAddressBook.back.generic.y = 656;
|
||||
|
@ -305,7 +310,7 @@ static void UI_JoinServer_Callback( void *self, int event )
|
|||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_BACK:
|
||||
case ID_DONE:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_ADDRESSBOOK:
|
||||
|
@ -371,7 +376,7 @@ static void UI_JoinServer_Init( void )
|
|||
uiJoinServer.banner.generic.height = 46;
|
||||
uiJoinServer.banner.pic = ART_BANNER;
|
||||
|
||||
uiJoinServer.back.generic.id = ID_BACK;
|
||||
uiJoinServer.back.generic.id = ID_DONE;
|
||||
uiJoinServer.back.generic.type = QMTYPE_BITMAP;
|
||||
uiJoinServer.back.generic.x = 413;
|
||||
uiJoinServer.back.generic.y = 656;
|
||||
|
@ -476,7 +481,7 @@ static void UI_DMOptions_Callback( void *self, int event )
|
|||
|
||||
if( event == QM_ACTIVATED )
|
||||
{
|
||||
if( item->id == ID_BACK )
|
||||
if( item->id == ID_DONE )
|
||||
{
|
||||
UI_PopMenu();
|
||||
return;
|
||||
|
@ -648,7 +653,7 @@ static void UI_DMOptions_Init( void )
|
|||
uiDMOptions.banner.generic.height = 46;
|
||||
uiDMOptions.banner.pic = ART_BANNER;
|
||||
|
||||
uiDMOptions.back.generic.id = ID_BACK;
|
||||
uiDMOptions.back.generic.id = ID_DONE;
|
||||
uiDMOptions.back.generic.type = QMTYPE_BITMAP;
|
||||
uiDMOptions.back.generic.x = 413;
|
||||
uiDMOptions.back.generic.y = 656;
|
||||
|
@ -981,7 +986,7 @@ static void UI_StartServer_Callback( void *self, int event )
|
|||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_BACK:
|
||||
case ID_DONE:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_DMOPTIONS:
|
||||
|
@ -1075,7 +1080,7 @@ static void UI_StartServer_Init( void )
|
|||
uiStartServer.banner.generic.height = 46;
|
||||
uiStartServer.banner.pic = ART_BANNER;
|
||||
|
||||
uiStartServer.back.generic.id = ID_BACK;
|
||||
uiStartServer.back.generic.id = ID_DONE;
|
||||
uiStartServer.back.generic.type = QMTYPE_BITMAP;
|
||||
uiStartServer.back.generic.x = 413;
|
||||
uiStartServer.back.generic.y = 656;
|
||||
|
@ -1209,43 +1214,22 @@ static void UI_MultiPlayer_Callback( void *self, int event )
|
|||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_BACK:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_JOINSERVER:
|
||||
case ID_INTERNETGAMES:
|
||||
case ID_SPECTATEGAMES:
|
||||
UI_JoinServer_Init();
|
||||
break;
|
||||
case ID_STARTSERVER:
|
||||
case ID_LANGAME:
|
||||
UI_StartServer_Init();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_MultiPlayer_Ownerdraw
|
||||
=================
|
||||
*/
|
||||
static void UI_MultiPlayer_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( item->id == ID_BACKGROUND )
|
||||
{
|
||||
int x = 0, y = 128, w = 1024, h = 50, cw = 20, ch = 40;
|
||||
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
|
||||
UI_ScaleCoords( &x, &y, &w, &h );
|
||||
UI_ScaleCoords( NULL, NULL, &cw, &ch );
|
||||
UI_DrawString( x, y, w, h, "UNDER CONSTRUCTION!!!", uiColorWhite, true, cw, ch, 1, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if( uiMultiPlayer.menu.items[uiMultiPlayer.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
case ID_CUSTOMIZE:
|
||||
UI_PlayerSetup_Menu();
|
||||
break;
|
||||
case ID_CONTROLS:
|
||||
UI_Controls_Menu();
|
||||
break;
|
||||
case ID_DONE:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1265,55 +1249,79 @@ static void UI_MultiPlayer_Init( void )
|
|||
uiMultiPlayer.background.generic.y = 0;
|
||||
uiMultiPlayer.background.generic.width = 1024;
|
||||
uiMultiPlayer.background.generic.height = 768;
|
||||
uiMultiPlayer.background.generic.ownerdraw = UI_MultiPlayer_Ownerdraw;
|
||||
uiMultiPlayer.background.pic = ART_BACKGROUND;
|
||||
|
||||
uiMultiPlayer.banner.generic.id = ID_BANNER;
|
||||
uiMultiPlayer.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiMultiPlayer.banner.generic.flags = QMF_INACTIVE;
|
||||
uiMultiPlayer.banner.generic.x = 0;
|
||||
uiMultiPlayer.banner.generic.y = 66;
|
||||
uiMultiPlayer.banner.generic.width = 1024;
|
||||
uiMultiPlayer.banner.generic.height = 46;
|
||||
uiMultiPlayer.banner.generic.x = 65;
|
||||
uiMultiPlayer.banner.generic.y = 92;
|
||||
uiMultiPlayer.banner.generic.width = 690;
|
||||
uiMultiPlayer.banner.generic.height = 120;
|
||||
uiMultiPlayer.banner.pic = ART_BANNER;
|
||||
|
||||
uiMultiPlayer.back.generic.id = ID_BACK;
|
||||
uiMultiPlayer.back.generic.type = QMTYPE_BITMAP;
|
||||
uiMultiPlayer.back.generic.x = 413;
|
||||
uiMultiPlayer.back.generic.y = 656;
|
||||
uiMultiPlayer.back.generic.width = 198;
|
||||
uiMultiPlayer.back.generic.height = 38;
|
||||
uiMultiPlayer.back.generic.callback = UI_MultiPlayer_Callback;
|
||||
uiMultiPlayer.back.generic.ownerdraw = UI_MultiPlayer_Ownerdraw;
|
||||
uiMultiPlayer.back.pic = UI_BACKBUTTON;
|
||||
uiMultiPlayer.internetGames.generic.id = ID_INTERNETGAMES;
|
||||
uiMultiPlayer.internetGames.generic.type = QMTYPE_ACTION;
|
||||
uiMultiPlayer.internetGames.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY|QMF_GRAYED;
|
||||
uiMultiPlayer.internetGames.generic.x = 72;
|
||||
uiMultiPlayer.internetGames.generic.y = 230;
|
||||
uiMultiPlayer.internetGames.generic.name = "Internet games";
|
||||
uiMultiPlayer.internetGames.generic.statusText = "View list of a game internet servers and join the one of your choise";
|
||||
uiMultiPlayer.internetGames.generic.callback = UI_MultiPlayer_Callback;
|
||||
|
||||
uiMultiPlayer.joinServer.generic.id = ID_JOINSERVER;
|
||||
uiMultiPlayer.joinServer.generic.name = "Join Server";
|
||||
uiMultiPlayer.joinServer.generic.type = QMTYPE_ACTION;
|
||||
uiMultiPlayer.joinServer.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiMultiPlayer.joinServer.generic.x = 413;
|
||||
uiMultiPlayer.joinServer.generic.y = 354;
|
||||
uiMultiPlayer.joinServer.generic.width = 198;
|
||||
uiMultiPlayer.joinServer.generic.height = 30;
|
||||
uiMultiPlayer.joinServer.generic.callback = UI_MultiPlayer_Callback;
|
||||
uiMultiPlayer.joinServer.background = "";
|
||||
uiMultiPlayer.spectateGames.generic.id = ID_SPECTATEGAMES;
|
||||
uiMultiPlayer.spectateGames.generic.type = QMTYPE_ACTION;
|
||||
uiMultiPlayer.spectateGames.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY|QMF_GRAYED;
|
||||
uiMultiPlayer.spectateGames.generic.x = 72;
|
||||
uiMultiPlayer.spectateGames.generic.y = 280;
|
||||
uiMultiPlayer.spectateGames.generic.name = "Spectate games";
|
||||
uiMultiPlayer.spectateGames.generic.statusText = "Spectate internet games";
|
||||
uiMultiPlayer.spectateGames.generic.callback = UI_MultiPlayer_Callback;
|
||||
|
||||
uiMultiPlayer.startServer.generic.id = ID_STARTSERVER;
|
||||
uiMultiPlayer.startServer.generic.name = "Start Server";
|
||||
uiMultiPlayer.startServer.generic.type = QMTYPE_ACTION;
|
||||
uiMultiPlayer.startServer.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiMultiPlayer.startServer.generic.x = 413;
|
||||
uiMultiPlayer.startServer.generic.y = 384;
|
||||
uiMultiPlayer.startServer.generic.width = 198;
|
||||
uiMultiPlayer.startServer.generic.height = 30;
|
||||
uiMultiPlayer.startServer.generic.callback = UI_MultiPlayer_Callback;
|
||||
uiMultiPlayer.startServer.background = "";
|
||||
uiMultiPlayer.LANGame.generic.id = ID_LANGAME;
|
||||
uiMultiPlayer.LANGame.generic.type = QMTYPE_ACTION;
|
||||
uiMultiPlayer.LANGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY|QMF_GRAYED;
|
||||
uiMultiPlayer.LANGame.generic.x = 72;
|
||||
uiMultiPlayer.LANGame.generic.y = 330;
|
||||
uiMultiPlayer.LANGame.generic.name = "LAN game";
|
||||
uiMultiPlayer.LANGame.generic.statusText = "Set up the game on the local area network";
|
||||
uiMultiPlayer.LANGame.generic.callback = UI_MultiPlayer_Callback;
|
||||
|
||||
uiMultiPlayer.Customize.generic.id = ID_CUSTOMIZE;
|
||||
uiMultiPlayer.Customize.generic.type = QMTYPE_ACTION;
|
||||
uiMultiPlayer.Customize.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiMultiPlayer.Customize.generic.x = 72;
|
||||
uiMultiPlayer.Customize.generic.y = 380;
|
||||
uiMultiPlayer.Customize.generic.name = "Customize";
|
||||
uiMultiPlayer.Customize.generic.statusText = "Choose your player name, and select visual options for your character";
|
||||
uiMultiPlayer.Customize.generic.callback = UI_MultiPlayer_Callback;
|
||||
|
||||
uiMultiPlayer.Controls.generic.id = ID_CONTROLS;
|
||||
uiMultiPlayer.Controls.generic.type = QMTYPE_ACTION;
|
||||
uiMultiPlayer.Controls.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiMultiPlayer.Controls.generic.x = 72;
|
||||
uiMultiPlayer.Controls.generic.y = 430;
|
||||
uiMultiPlayer.Controls.generic.name = "Controls";
|
||||
uiMultiPlayer.Controls.generic.statusText = "Change keyboard and mouse settings";
|
||||
uiMultiPlayer.Controls.generic.callback = UI_MultiPlayer_Callback;
|
||||
|
||||
uiMultiPlayer.done.generic.id = ID_DONE;
|
||||
uiMultiPlayer.done.generic.type = QMTYPE_ACTION;
|
||||
uiMultiPlayer.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiMultiPlayer.done.generic.x = 72;
|
||||
uiMultiPlayer.done.generic.y = 480;
|
||||
uiMultiPlayer.done.generic.name = "Done";
|
||||
uiMultiPlayer.done.generic.statusText = "Go back to the Main Menu";
|
||||
uiMultiPlayer.done.generic.callback = UI_MultiPlayer_Callback;
|
||||
|
||||
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.background );
|
||||
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.banner );
|
||||
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.back );
|
||||
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.joinServer );
|
||||
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.startServer );
|
||||
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.internetGames );
|
||||
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.spectateGames );
|
||||
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.LANGame );
|
||||
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.Customize );
|
||||
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.Controls );
|
||||
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.done );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,422 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
This program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "ui_local.h"
|
||||
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/banners/network_t"
|
||||
#define ART_TEXT1 "gfx/shell/text/network_text_p1"
|
||||
#define ART_TEXT2 "gfx/shell/text/network_text_p2"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
#define ID_BANNER 1
|
||||
|
||||
#define ID_TEXT1 2
|
||||
#define ID_TEXT2 3
|
||||
#define ID_TEXTSHADOW1 4
|
||||
#define ID_TEXTSHADOW2 5
|
||||
|
||||
#define ID_CANCEL 6
|
||||
#define ID_APPLY 7
|
||||
|
||||
#define ID_RATE 8
|
||||
#define ID_SOCKS 9
|
||||
#define ID_SOCKSSERVER 10
|
||||
#define ID_SOCKSPORT 11
|
||||
#define ID_SOCKSUSERNAME 12
|
||||
#define ID_SOCKSPASSWORD 13
|
||||
|
||||
static const char *uiNetworkRate[] = { "28.8K Modem", "33.6K Modem", "56K Modem", "ISDN", "LAN/Cable/xDSL" };
|
||||
static const char *uiNetworkYesNo[] = { "False", "True" };
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float rate;
|
||||
float socks;
|
||||
} uiNetworkValues_t;
|
||||
|
||||
static uiNetworkValues_t uiNetworkInitial;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
menuFramework_s menu;
|
||||
|
||||
menuBitmap_s background;
|
||||
menuBitmap_s banner;
|
||||
menuBitmap_s textShadow1;
|
||||
menuBitmap_s textShadow2;
|
||||
menuBitmap_s text1;
|
||||
menuBitmap_s text2;
|
||||
menuBitmap_s cancel;
|
||||
menuBitmap_s apply;
|
||||
|
||||
menuSpinControl_s rate;
|
||||
menuSpinControl_s socks;
|
||||
menuField_s socksServer;
|
||||
menuField_s socksPort;
|
||||
menuField_s socksUsername;
|
||||
menuField_s socksPassword;
|
||||
} uiNetwork_t;
|
||||
|
||||
static uiNetwork_t uiNetwork;
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Network_GetConfig
|
||||
=================
|
||||
*/
|
||||
static void UI_Network_GetConfig( void )
|
||||
{
|
||||
int rate;
|
||||
|
||||
rate = Cvar_VariableInteger( "rate" );
|
||||
if( rate <= 2500 ) uiNetwork.rate.curValue = 0;
|
||||
else if( rate <= 3000 ) uiNetwork.rate.curValue = 1;
|
||||
else if( rate <= 4000 ) uiNetwork.rate.curValue = 2;
|
||||
else if( rate <= 5000 ) uiNetwork.rate.curValue = 3;
|
||||
else uiNetwork.rate.curValue = 4;
|
||||
|
||||
// save initial values
|
||||
uiNetworkInitial.rate = uiNetwork.rate.curValue;
|
||||
uiNetworkInitial.socks = uiNetwork.socks.curValue;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Network_SetConfig
|
||||
=================
|
||||
*/
|
||||
static void UI_Network_SetConfig( void )
|
||||
{
|
||||
if( uiNetworkInitial.rate != uiNetwork.rate.curValue )
|
||||
{
|
||||
uiNetworkInitial.rate = uiNetwork.rate.curValue;
|
||||
|
||||
switch( (int)uiNetwork.rate.curValue )
|
||||
{
|
||||
case 0:
|
||||
Cvar_SetValue( "rate", 2500 );
|
||||
break;
|
||||
case 1:
|
||||
Cvar_SetValue( "rate", 3000 );
|
||||
break;
|
||||
case 2:
|
||||
Cvar_SetValue( "rate", 4000 );
|
||||
break;
|
||||
case 3:
|
||||
Cvar_SetValue( "rate", 5000 );
|
||||
break;
|
||||
case 4:
|
||||
Cvar_SetValue( "rate", 25000 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// restart network subsystem
|
||||
Cbuf_ExecuteText( EXEC_NOW, "net_restart\n" );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Network_UpdateConfig
|
||||
=================
|
||||
*/
|
||||
static void UI_Network_UpdateConfig( void )
|
||||
{
|
||||
uiNetwork.rate.generic.name = uiNetworkRate[(int)uiNetwork.rate.curValue];
|
||||
|
||||
// TODO!!!
|
||||
uiNetwork.socks.generic.name = uiNetworkYesNo[(int)uiNetwork.socks.curValue];
|
||||
uiNetwork.socks.generic.flags |= QMF_GRAYED;
|
||||
|
||||
uiNetwork.socksServer.generic.flags |= QMF_GRAYED;
|
||||
uiNetwork.socksPort.generic.flags |= QMF_GRAYED;
|
||||
uiNetwork.socksUsername.generic.flags |= QMF_GRAYED;
|
||||
uiNetwork.socksPassword.generic.flags |= QMF_GRAYED;
|
||||
|
||||
// some settings can be updated here
|
||||
if( uiNetworkInitial.rate != uiNetwork.rate.curValue )
|
||||
{
|
||||
uiNetworkInitial.rate = uiNetwork.rate.curValue;
|
||||
|
||||
switch( (int)uiNetwork.rate.curValue )
|
||||
{
|
||||
case 0:
|
||||
Cvar_SetValue( "rate", 2500 );
|
||||
break;
|
||||
case 1:
|
||||
Cvar_SetValue( "rate", 3000 );
|
||||
break;
|
||||
case 2:
|
||||
Cvar_SetValue( "rate", 4000 );
|
||||
break;
|
||||
case 3:
|
||||
Cvar_SetValue( "rate", 5000 );
|
||||
break;
|
||||
case 4:
|
||||
Cvar_SetValue( "rate", 25000 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// see if the apply button should be enabled or disabled
|
||||
uiNetwork.apply.generic.flags |= QMF_GRAYED;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Network_Callback
|
||||
=================
|
||||
*/
|
||||
static void UI_Network_Callback ( void *self, int event )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( event == QM_CHANGED )
|
||||
{
|
||||
UI_Network_UpdateConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
if( event != QM_ACTIVATED )
|
||||
return;
|
||||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_CANCEL:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_APPLY:
|
||||
UI_Network_SetConfig();
|
||||
UI_Network_GetConfig();
|
||||
UI_Network_UpdateConfig();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Network_Ownerdraw
|
||||
=================
|
||||
*/
|
||||
static void UI_Network_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( uiNetwork.menu.items[uiNetwork.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
|
||||
if( item->flags & QMF_GRAYED )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorDkGrey, ((menuBitmap_s *)self)->pic );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Network_Init
|
||||
=================
|
||||
*/
|
||||
static void UI_Network_Init( void )
|
||||
{
|
||||
Mem_Set( &uiNetwork, 0, sizeof( uiNetwork_t ));
|
||||
|
||||
uiNetwork.background.generic.id = ID_BACKGROUND;
|
||||
uiNetwork.background.generic.type = QMTYPE_BITMAP;
|
||||
uiNetwork.background.generic.flags = QMF_INACTIVE;
|
||||
uiNetwork.background.generic.x = 0;
|
||||
uiNetwork.background.generic.y = 0;
|
||||
uiNetwork.background.generic.width = 1024;
|
||||
uiNetwork.background.generic.height = 768;
|
||||
uiNetwork.background.pic = ART_BACKGROUND;
|
||||
|
||||
uiNetwork.banner.generic.id = ID_BANNER;
|
||||
uiNetwork.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiNetwork.banner.generic.flags = QMF_INACTIVE;
|
||||
uiNetwork.banner.generic.x = 0;
|
||||
uiNetwork.banner.generic.y = 66;
|
||||
uiNetwork.banner.generic.width = 1024;
|
||||
uiNetwork.banner.generic.height = 46;
|
||||
uiNetwork.banner.pic = ART_BANNER;
|
||||
|
||||
uiNetwork.textShadow1.generic.id = ID_TEXTSHADOW1;
|
||||
uiNetwork.textShadow1.generic.type = QMTYPE_BITMAP;
|
||||
uiNetwork.textShadow1.generic.flags = QMF_INACTIVE;
|
||||
uiNetwork.textShadow1.generic.x = 182;
|
||||
uiNetwork.textShadow1.generic.y = 170;
|
||||
uiNetwork.textShadow1.generic.width = 256;
|
||||
uiNetwork.textShadow1.generic.height = 256;
|
||||
uiNetwork.textShadow1.generic.color = uiColorBlack;
|
||||
uiNetwork.textShadow1.pic = ART_TEXT1;
|
||||
|
||||
uiNetwork.textShadow2.generic.id = ID_TEXTSHADOW2;
|
||||
uiNetwork.textShadow2.generic.type = QMTYPE_BITMAP;
|
||||
uiNetwork.textShadow2.generic.flags = QMF_INACTIVE;
|
||||
uiNetwork.textShadow2.generic.x = 182;
|
||||
uiNetwork.textShadow2.generic.y = 426;
|
||||
uiNetwork.textShadow2.generic.width = 256;
|
||||
uiNetwork.textShadow2.generic.height = 256;
|
||||
uiNetwork.textShadow2.generic.color = uiColorBlack;
|
||||
uiNetwork.textShadow2.pic = ART_TEXT2;
|
||||
|
||||
uiNetwork.text1.generic.id = ID_TEXT1;
|
||||
uiNetwork.text1.generic.type = QMTYPE_BITMAP;
|
||||
uiNetwork.text1.generic.flags = QMF_INACTIVE;
|
||||
uiNetwork.text1.generic.x = 180;
|
||||
uiNetwork.text1.generic.y = 168;
|
||||
uiNetwork.text1.generic.width = 256;
|
||||
uiNetwork.text1.generic.height = 256;
|
||||
uiNetwork.text1.pic = ART_TEXT1;
|
||||
|
||||
uiNetwork.text2.generic.id = ID_TEXT2;
|
||||
uiNetwork.text2.generic.type = QMTYPE_BITMAP;
|
||||
uiNetwork.text2.generic.flags = QMF_INACTIVE;
|
||||
uiNetwork.text2.generic.x = 180;
|
||||
uiNetwork.text2.generic.y = 424;
|
||||
uiNetwork.text2.generic.width = 256;
|
||||
uiNetwork.text2.generic.height = 256;
|
||||
uiNetwork.text2.pic = ART_TEXT2;
|
||||
|
||||
uiNetwork.cancel.generic.id = ID_CANCEL;
|
||||
uiNetwork.cancel.generic.type = QMTYPE_BITMAP;
|
||||
uiNetwork.cancel.generic.x = 310;
|
||||
uiNetwork.cancel.generic.y = 656;
|
||||
uiNetwork.cancel.generic.width = 198;
|
||||
uiNetwork.cancel.generic.height = 38;
|
||||
uiNetwork.cancel.generic.callback = UI_Network_Callback;
|
||||
uiNetwork.cancel.generic.ownerdraw = UI_Network_Ownerdraw;
|
||||
uiNetwork.cancel.pic = UI_CANCELBUTTON;
|
||||
|
||||
uiNetwork.apply.generic.id = ID_APPLY;
|
||||
uiNetwork.apply.generic.type = QMTYPE_BITMAP;
|
||||
uiNetwork.apply.generic.x = 516;
|
||||
uiNetwork.apply.generic.y = 656;
|
||||
uiNetwork.apply.generic.width = 198;
|
||||
uiNetwork.apply.generic.height = 38;
|
||||
uiNetwork.apply.generic.callback = UI_Network_Callback;
|
||||
uiNetwork.apply.generic.ownerdraw = UI_Network_Ownerdraw;
|
||||
uiNetwork.apply.pic = UI_APPLYBUTTON;
|
||||
|
||||
uiNetwork.rate.generic.id = ID_RATE;
|
||||
uiNetwork.rate.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiNetwork.rate.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiNetwork.rate.generic.x = 580;
|
||||
uiNetwork.rate.generic.y = 160;
|
||||
uiNetwork.rate.generic.width = 198;
|
||||
uiNetwork.rate.generic.height = 30;
|
||||
uiNetwork.rate.generic.callback = UI_Network_Callback;
|
||||
uiNetwork.rate.generic.statusText = "Set your internet connection's speed";
|
||||
uiNetwork.rate.minValue = 0;
|
||||
uiNetwork.rate.maxValue = 4;
|
||||
uiNetwork.rate.range = 1;
|
||||
|
||||
uiNetwork.socks.generic.id = ID_SOCKS;
|
||||
uiNetwork.socks.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiNetwork.socks.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiNetwork.socks.generic.x = 580;
|
||||
uiNetwork.socks.generic.y = 224;
|
||||
uiNetwork.socks.generic.width = 198;
|
||||
uiNetwork.socks.generic.height = 30;
|
||||
uiNetwork.socks.generic.callback = UI_Network_Callback;
|
||||
uiNetwork.socks.minValue = 0;
|
||||
uiNetwork.socks.maxValue = 1;
|
||||
uiNetwork.socks.range = 1;
|
||||
|
||||
uiNetwork.socksServer.generic.id = ID_SOCKSSERVER;
|
||||
uiNetwork.socksServer.generic.type = QMTYPE_FIELD;
|
||||
uiNetwork.socksServer.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiNetwork.socksServer.generic.x = 580;
|
||||
uiNetwork.socksServer.generic.y = 256;
|
||||
uiNetwork.socksServer.generic.width = 198;
|
||||
uiNetwork.socksServer.generic.height = 30;
|
||||
|
||||
uiNetwork.socksPort.generic.id = ID_SOCKSPORT;
|
||||
uiNetwork.socksPort.generic.type = QMTYPE_FIELD;
|
||||
uiNetwork.socksPort.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiNetwork.socksPort.generic.x = 580;
|
||||
uiNetwork.socksPort.generic.y = 288;
|
||||
uiNetwork.socksPort.generic.width = 198;
|
||||
uiNetwork.socksPort.generic.height = 30;
|
||||
|
||||
uiNetwork.socksUsername.generic.id = ID_SOCKSUSERNAME;
|
||||
uiNetwork.socksUsername.generic.type = QMTYPE_FIELD;
|
||||
uiNetwork.socksUsername.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiNetwork.socksUsername.generic.x = 580;
|
||||
uiNetwork.socksUsername.generic.y = 320;
|
||||
uiNetwork.socksUsername.generic.width = 198;
|
||||
uiNetwork.socksUsername.generic.height = 30;
|
||||
|
||||
uiNetwork.socksPassword.generic.id = ID_SOCKSPASSWORD;
|
||||
uiNetwork.socksPassword.generic.type = QMTYPE_FIELD;
|
||||
uiNetwork.socksPassword.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiNetwork.socksPassword.generic.x = 580;
|
||||
uiNetwork.socksPassword.generic.y = 352;
|
||||
uiNetwork.socksPassword.generic.width = 198;
|
||||
uiNetwork.socksPassword.generic.height = 30;
|
||||
|
||||
UI_Network_GetConfig();
|
||||
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.background );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.banner );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.textShadow1 );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.textShadow2 );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.text1 );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.text2 );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.cancel );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.apply );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.rate );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.socks );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.socksServer );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.socksPort );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.socksUsername );
|
||||
UI_AddItem( &uiNetwork.menu, (void *)&uiNetwork.socksPassword );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Network_Precache
|
||||
=================
|
||||
*/
|
||||
void UI_Network_Precache( void )
|
||||
{
|
||||
if( !re ) return;
|
||||
|
||||
re->RegisterShader( ART_BACKGROUND, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_BANNER, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_TEXT1, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_TEXT2, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Network_Menu
|
||||
=================
|
||||
*/
|
||||
void UI_Network_Menu( void )
|
||||
{
|
||||
UI_Network_Precache();
|
||||
UI_Network_Init();
|
||||
|
||||
UI_Network_UpdateConfig();
|
||||
UI_PushMenu( &uiNetwork.menu );
|
||||
}
|
|
@ -181,7 +181,7 @@ static void UI_NewGame_Init( void )
|
|||
|
||||
uiNewGame.easy.generic.id = ID_EASY;
|
||||
uiNewGame.easy.generic.type = QMTYPE_ACTION;
|
||||
uiNewGame.easy.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiNewGame.easy.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiNewGame.easy.generic.name = "Easy";
|
||||
uiNewGame.easy.generic.statusText = "Play the game on the 'easy' skill setting";
|
||||
uiNewGame.easy.generic.x = 72;
|
||||
|
@ -190,7 +190,7 @@ static void UI_NewGame_Init( void )
|
|||
|
||||
uiNewGame.medium.generic.id = ID_MEDIUM;
|
||||
uiNewGame.medium.generic.type = QMTYPE_ACTION;
|
||||
uiNewGame.medium.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiNewGame.medium.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiNewGame.medium.generic.name = "Medium";
|
||||
uiNewGame.medium.generic.statusText = "Play the game on the 'medium' skill setting";
|
||||
uiNewGame.medium.generic.x = 72;
|
||||
|
@ -199,7 +199,7 @@ static void UI_NewGame_Init( void )
|
|||
|
||||
uiNewGame.hard.generic.id = ID_DIFFICULT;
|
||||
uiNewGame.hard.generic.type = QMTYPE_ACTION;
|
||||
uiNewGame.hard.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiNewGame.hard.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiNewGame.hard.generic.name = "Difficult";
|
||||
uiNewGame.hard.generic.statusText = "Play the game on the 'difficult' skill setting";
|
||||
uiNewGame.hard.generic.x = 72;
|
||||
|
@ -208,7 +208,7 @@ static void UI_NewGame_Init( void )
|
|||
|
||||
uiNewGame.cancel.generic.id = ID_CANCEL;
|
||||
uiNewGame.cancel.generic.type = QMTYPE_ACTION;
|
||||
uiNewGame.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiNewGame.cancel.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiNewGame.cancel.generic.name = "Cancel";
|
||||
uiNewGame.cancel.generic.statusText = "Go back to the main Menu";
|
||||
uiNewGame.cancel.generic.x = 72;
|
||||
|
|
|
@ -1,314 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
This program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "ui_local.h"
|
||||
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/banners/options_t"
|
||||
#define ART_PLAYERSETUP "gfx/shell/misc/players"
|
||||
#define ART_PLAYERSETUP2 "gfx/shell/misc/players_s"
|
||||
#define ART_CONTROLS "gfx/shell/misc/controls"
|
||||
#define ART_CONTROLS2 "gfx/shell/misc/controls_s"
|
||||
#define ART_GAMEOPTIONS "gfx/shell/misc/goptions"
|
||||
#define ART_GAMEOPTIONS2 "gfx/shell/misc/goptions_s"
|
||||
#define ART_AUDIO "gfx/shell/misc/audio"
|
||||
#define ART_AUDIO2 "gfx/shell/misc/audio_s"
|
||||
#define ART_VIDEO "gfx/shell/misc/video"
|
||||
#define ART_VIDEO2 "gfx/shell/misc/video_s"
|
||||
#define ART_PERFORMANCE "gfx/shell/misc/performance"
|
||||
#define ART_PERFORMANCE2 "gfx/shell/misc/performance_s"
|
||||
#define ART_NETWORK "gfx/shell/misc/network"
|
||||
#define ART_NETWORK2 "gfx/shell/misc/network_s"
|
||||
#define ART_DEFAULTS "gfx/shell/misc/defaults"
|
||||
#define ART_DEFAULTS2 "gfx/shell/misc/defaults_s"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
#define ID_BANNER 1
|
||||
|
||||
#define ID_PLAYERSETUP 2
|
||||
#define ID_CONTROLS 3
|
||||
#define ID_GAMEOPTIONS 4
|
||||
#define ID_AUDIO 5
|
||||
#define ID_VIDEO 6
|
||||
#define ID_PERFORMANCE 7
|
||||
#define ID_NETWORK 8
|
||||
#define ID_DEFAULTS 9
|
||||
#define ID_BACK 10
|
||||
|
||||
typedef struct
|
||||
{
|
||||
menuFramework_s menu;
|
||||
|
||||
menuBitmap_s background;
|
||||
menuBitmap_s banner;
|
||||
menuBitmap_s back;
|
||||
menuBitmap_s playerSetup;
|
||||
menuBitmap_s controls;
|
||||
menuBitmap_s gameOptions;
|
||||
menuBitmap_s audio;
|
||||
menuBitmap_s video;
|
||||
menuBitmap_s performance;
|
||||
menuBitmap_s network;
|
||||
menuBitmap_s defaults;
|
||||
} uiOptions_t;
|
||||
|
||||
static uiOptions_t uiOptions;
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Options_Callback
|
||||
=================
|
||||
*/
|
||||
static void UI_Options_Callback( void *self, int event )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( event != QM_ACTIVATED )
|
||||
return;
|
||||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_BACK:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_PLAYERSETUP:
|
||||
UI_PlayerSetup_Menu();
|
||||
break;
|
||||
case ID_CONTROLS:
|
||||
UI_Controls_Menu();
|
||||
break;
|
||||
case ID_GAMEOPTIONS:
|
||||
UI_GameOptions_Menu();
|
||||
break;
|
||||
case ID_AUDIO:
|
||||
UI_Audio_Menu();
|
||||
break;
|
||||
case ID_VIDEO:
|
||||
UI_Video_Menu();
|
||||
break;
|
||||
case ID_PERFORMANCE:
|
||||
UI_Performance_Menu();
|
||||
break;
|
||||
case ID_NETWORK:
|
||||
UI_Network_Menu();
|
||||
break;
|
||||
case ID_DEFAULTS:
|
||||
UI_Defaults_Menu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Options_Ownerdraw
|
||||
=================
|
||||
*/
|
||||
static void UI_Options_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( uiOptions.menu.items[uiOptions.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Options_Init
|
||||
=================
|
||||
*/
|
||||
static void UI_Options_Init( void )
|
||||
{
|
||||
Mem_Set( &uiOptions, 0, sizeof( uiOptions_t ));
|
||||
|
||||
uiOptions.background.generic.id = ID_BACKGROUND;
|
||||
uiOptions.background.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.background.generic.flags = QMF_INACTIVE;
|
||||
uiOptions.background.generic.x = 0;
|
||||
uiOptions.background.generic.y = 0;
|
||||
uiOptions.background.generic.width = 1024;
|
||||
uiOptions.background.generic.height = 768;
|
||||
uiOptions.background.pic = ART_BACKGROUND;
|
||||
|
||||
uiOptions.banner.generic.id = ID_BANNER;
|
||||
uiOptions.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.banner.generic.flags = QMF_INACTIVE;
|
||||
uiOptions.banner.generic.x = 0;
|
||||
uiOptions.banner.generic.y = 66;
|
||||
uiOptions.banner.generic.width = 1024;
|
||||
uiOptions.banner.generic.height = 46;
|
||||
uiOptions.banner.pic = ART_BANNER;
|
||||
|
||||
uiOptions.back.generic.id = ID_BACK;
|
||||
uiOptions.back.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.back.generic.x = 413;
|
||||
uiOptions.back.generic.y = 656;
|
||||
uiOptions.back.generic.width = 198;
|
||||
uiOptions.back.generic.height = 38;
|
||||
uiOptions.back.generic.callback = UI_Options_Callback;
|
||||
uiOptions.back.generic.ownerdraw = UI_Options_Ownerdraw;
|
||||
uiOptions.back.pic = UI_BACKBUTTON;
|
||||
|
||||
uiOptions.playerSetup.generic.id = ID_PLAYERSETUP;
|
||||
uiOptions.playerSetup.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.playerSetup.generic.flags = QMF_PULSEIFFOCUS | QMF_FOCUSBEHIND;
|
||||
uiOptions.playerSetup.generic.x = 323;
|
||||
uiOptions.playerSetup.generic.y = 174;
|
||||
uiOptions.playerSetup.generic.width = 378;
|
||||
uiOptions.playerSetup.generic.height = 42;
|
||||
uiOptions.playerSetup.generic.callback = UI_Options_Callback;
|
||||
uiOptions.playerSetup.pic = ART_PLAYERSETUP;
|
||||
uiOptions.playerSetup.focusPic = ART_PLAYERSETUP2;
|
||||
|
||||
uiOptions.controls.generic.id = ID_CONTROLS;
|
||||
uiOptions.controls.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.controls.generic.flags = QMF_PULSEIFFOCUS | QMF_FOCUSBEHIND;
|
||||
uiOptions.controls.generic.x = 361;
|
||||
uiOptions.controls.generic.y = 216;
|
||||
uiOptions.controls.generic.width = 302;
|
||||
uiOptions.controls.generic.height = 42;
|
||||
uiOptions.controls.generic.callback = UI_Options_Callback;
|
||||
uiOptions.controls.pic = ART_CONTROLS;
|
||||
uiOptions.controls.focusPic = ART_CONTROLS2;
|
||||
|
||||
uiOptions.gameOptions.generic.id = ID_GAMEOPTIONS;
|
||||
uiOptions.gameOptions.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.gameOptions.generic.flags = QMF_PULSEIFFOCUS | QMF_FOCUSBEHIND;
|
||||
uiOptions.gameOptions.generic.x = 320;
|
||||
uiOptions.gameOptions.generic.y = 258;
|
||||
uiOptions.gameOptions.generic.width = 384;
|
||||
uiOptions.gameOptions.generic.height = 42;
|
||||
uiOptions.gameOptions.generic.callback = UI_Options_Callback;
|
||||
uiOptions.gameOptions.pic = ART_GAMEOPTIONS;
|
||||
uiOptions.gameOptions.focusPic = ART_GAMEOPTIONS2;
|
||||
|
||||
uiOptions.audio.generic.id = ID_AUDIO;
|
||||
uiOptions.audio.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.audio.generic.flags = QMF_PULSEIFFOCUS | QMF_FOCUSBEHIND;
|
||||
uiOptions.audio.generic.x = 406;
|
||||
uiOptions.audio.generic.y = 300;
|
||||
uiOptions.audio.generic.width = 212;
|
||||
uiOptions.audio.generic.height = 42;
|
||||
uiOptions.audio.generic.callback = UI_Options_Callback;
|
||||
uiOptions.audio.pic = ART_AUDIO;
|
||||
uiOptions.audio.focusPic = ART_AUDIO2;
|
||||
|
||||
uiOptions.video.generic.id = ID_VIDEO;
|
||||
uiOptions.video.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.video.generic.flags = QMF_PULSEIFFOCUS | QMF_FOCUSBEHIND;
|
||||
uiOptions.video.generic.x = 409;
|
||||
uiOptions.video.generic.y = 342;
|
||||
uiOptions.video.generic.width = 206;
|
||||
uiOptions.video.generic.height = 42;
|
||||
uiOptions.video.generic.callback = UI_Options_Callback;
|
||||
uiOptions.video.pic = ART_VIDEO;
|
||||
uiOptions.video.focusPic = ART_VIDEO2;
|
||||
|
||||
uiOptions.performance.generic.id = ID_PERFORMANCE;
|
||||
uiOptions.performance.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.performance.generic.flags = QMF_PULSEIFFOCUS | QMF_FOCUSBEHIND;
|
||||
uiOptions.performance.generic.x = 315;
|
||||
uiOptions.performance.generic.y = 384;
|
||||
uiOptions.performance.generic.width = 394;
|
||||
uiOptions.performance.generic.height = 42;
|
||||
uiOptions.performance.generic.callback = UI_Options_Callback;
|
||||
uiOptions.performance.pic = ART_PERFORMANCE;
|
||||
uiOptions.performance.focusPic = ART_PERFORMANCE2;
|
||||
|
||||
uiOptions.network.generic.id = ID_NETWORK;
|
||||
uiOptions.network.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.network.generic.flags = QMF_PULSEIFFOCUS | QMF_FOCUSBEHIND;
|
||||
uiOptions.network.generic.x = 364;
|
||||
uiOptions.network.generic.y = 426;
|
||||
uiOptions.network.generic.width = 296;
|
||||
uiOptions.network.generic.height = 42;
|
||||
uiOptions.network.generic.callback = UI_Options_Callback;
|
||||
uiOptions.network.pic = ART_NETWORK;
|
||||
uiOptions.network.focusPic = ART_NETWORK2;
|
||||
|
||||
uiOptions.defaults.generic.id = ID_DEFAULTS;
|
||||
uiOptions.defaults.generic.type = QMTYPE_BITMAP;
|
||||
uiOptions.defaults.generic.flags = QMF_PULSEIFFOCUS | QMF_FOCUSBEHIND;
|
||||
uiOptions.defaults.generic.x = 367;
|
||||
uiOptions.defaults.generic.y = 510;
|
||||
uiOptions.defaults.generic.width = 290;
|
||||
uiOptions.defaults.generic.height = 42;
|
||||
uiOptions.defaults.generic.callback = UI_Options_Callback;
|
||||
uiOptions.defaults.pic = ART_DEFAULTS;
|
||||
uiOptions.defaults.focusPic = ART_DEFAULTS2;
|
||||
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.background );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.banner );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.back );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.playerSetup );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.controls );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.gameOptions );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.audio );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.video );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.performance );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.network );
|
||||
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.defaults );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Options_Precache
|
||||
=================
|
||||
*/
|
||||
void UI_Options_Precache( void )
|
||||
{
|
||||
if( !re ) return;
|
||||
|
||||
re->RegisterShader( ART_BACKGROUND, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_BANNER, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_PLAYERSETUP, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_PLAYERSETUP2, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_CONTROLS, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_CONTROLS2, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_GAMEOPTIONS, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_GAMEOPTIONS2, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_AUDIO, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_AUDIO2, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_VIDEO, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_VIDEO2, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_PERFORMANCE, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_PERFORMANCE2, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_NETWORK, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_NETWORK2, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_DEFAULTS, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_DEFAULTS2, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Options_Menu
|
||||
=================
|
||||
*/
|
||||
void UI_Options_Menu( void )
|
||||
{
|
||||
UI_Options_Precache();
|
||||
UI_Options_Init();
|
||||
|
||||
UI_PushMenu( &uiOptions.menu );
|
||||
}
|
|
@ -1,483 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
This program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "ui_local.h"
|
||||
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/banners/performance_t"
|
||||
#define ART_TEXT1 "gfx/shell/text/performance_text_p1"
|
||||
#define ART_TEXT2 "gfx/shell/text/performance_text_p2"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
#define ID_BANNER 1
|
||||
|
||||
#define ID_TEXT1 2
|
||||
#define ID_TEXT2 3
|
||||
#define ID_TEXTSHADOW1 4
|
||||
#define ID_TEXTSHADOW2 5
|
||||
#define ID_BACK 6
|
||||
#define ID_SCREENSIZE 7
|
||||
#define ID_SYNCEVERYFRAME 8
|
||||
|
||||
#define ID_DYNAMICLIGHTS 10
|
||||
#define ID_SHADOWS 11
|
||||
#define ID_CAUSTICS 12
|
||||
#define ID_PARTICLES 13
|
||||
#define ID_DECALS 14
|
||||
#define ID_EJECTINGBRASS 15
|
||||
#define ID_SHELLEFFECTS 16
|
||||
#define ID_SCREENBLENDS 17
|
||||
#define ID_BLOOD 18
|
||||
|
||||
static const char *uiPerformanceYesNo[] = { "False", "True" };
|
||||
static const char *uiPerformanceShadows[] = { "None", "Planar", "Shadowmap" };
|
||||
static const char *uiPerformanceDecals[] = { "None", "Short", "Long" };
|
||||
static const char *uiPerformanceEjectBrass[] = { "None", "Low", "High" };
|
||||
static const char *uiPerformanceScreenBlends[] = { "None", "Flash", "Shader" };
|
||||
|
||||
typedef struct
|
||||
{
|
||||
menuFramework_s menu;
|
||||
|
||||
menuBitmap_s background;
|
||||
menuBitmap_s banner;
|
||||
menuBitmap_s textShadow1;
|
||||
menuBitmap_s textShadow2;
|
||||
menuBitmap_s text1;
|
||||
menuBitmap_s text2;
|
||||
menuBitmap_s back;
|
||||
|
||||
menuSpinControl_s screenSize;
|
||||
menuSpinControl_s syncEveryFrame;
|
||||
menuSpinControl_s dynamicLights;
|
||||
menuSpinControl_s shadows;
|
||||
menuSpinControl_s caustics;
|
||||
menuSpinControl_s particles;
|
||||
menuSpinControl_s decals;
|
||||
menuSpinControl_s ejectingBrass;
|
||||
menuSpinControl_s shellEffects;
|
||||
menuSpinControl_s screenBlends;
|
||||
menuSpinControl_s blood;
|
||||
} uiPerformance_t;
|
||||
|
||||
static uiPerformance_t uiPerformance;
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Performance_GetConfig
|
||||
=================
|
||||
*/
|
||||
static void UI_Performance_GetConfig( void )
|
||||
{
|
||||
uiPerformance.screenSize.curValue = bound( 30, Cvar_VariableInteger( "cl_viewsize" ), 100 );
|
||||
if( Cvar_VariableInteger( "gl_finish" )) uiPerformance.syncEveryFrame.curValue = 1;
|
||||
if( Cvar_VariableInteger( "r_dynamiclight" )) uiPerformance.dynamicLights.curValue = 1;
|
||||
uiPerformance.shadows.curValue = bound( 0, Cvar_VariableInteger( "r_shadows" ), 2 );
|
||||
if( Cvar_VariableInteger( "r_caustics" )) uiPerformance.caustics.curValue = 1;
|
||||
if( Cvar_VariableInteger( "cl_particles" )) uiPerformance.particles.curValue = 1;
|
||||
|
||||
switch( Cvar_VariableInteger( "cl_marktime" ))
|
||||
{
|
||||
case 30000:
|
||||
uiPerformance.decals.curValue = 2;
|
||||
break;
|
||||
case 15000:
|
||||
uiPerformance.decals.curValue = 1;
|
||||
break;
|
||||
default:
|
||||
uiPerformance.decals.curValue = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
switch( Cvar_VariableInteger( "cl_brasstime" ))
|
||||
{
|
||||
case 5000:
|
||||
uiPerformance.ejectingBrass.curValue = 2;
|
||||
break;
|
||||
case 2500:
|
||||
uiPerformance.ejectingBrass.curValue = 1;
|
||||
break;
|
||||
default:
|
||||
uiPerformance.ejectingBrass.curValue = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if( Cvar_VariableInteger( "cl_drawShells" )) uiPerformance.shellEffects.curValue = 1;
|
||||
uiPerformance.screenBlends.curValue = bound( 0, Cvar_VariableInteger( "cl_viewblend" ), 2 );
|
||||
if( Cvar_VariableInteger( "cl_blood" )) uiPerformance.blood.curValue = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Performance_SetConfig
|
||||
=================
|
||||
*/
|
||||
static void UI_Performance_SetConfig( void )
|
||||
{
|
||||
Cvar_SetValue( "cl_viewsize", uiPerformance.screenSize.curValue );
|
||||
Cvar_SetValue( "gl_finish", uiPerformance.syncEveryFrame.curValue );
|
||||
Cvar_SetValue( "r_dynamiclight", uiPerformance.dynamicLights.curValue );
|
||||
Cvar_SetValue( "r_shadows", uiPerformance.shadows.curValue );
|
||||
Cvar_SetValue( "r_caustics", uiPerformance.caustics.curValue );
|
||||
Cvar_SetValue( "cl_particles", uiPerformance.particles.curValue );
|
||||
Cvar_SetValue( "cl_marktime", uiPerformance.decals.curValue * 15000);
|
||||
Cvar_SetValue( "cl_brasstime", uiPerformance.ejectingBrass.curValue * 2500 );
|
||||
Cvar_SetValue( "cl_drawshells", uiPerformance.shellEffects.curValue );
|
||||
Cvar_SetValue( "cl_viewblend", uiPerformance.screenBlends.curValue );
|
||||
Cvar_SetValue( "cl_blood", uiPerformance.blood.curValue );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Performance_UpdateConfig
|
||||
=================
|
||||
*/
|
||||
static void UI_Performance_UpdateConfig( void )
|
||||
{
|
||||
static char sizeText[32];
|
||||
|
||||
com.snprintf( sizeText, sizeof( sizeText ), "%i", (int)uiPerformance.screenSize.curValue );
|
||||
uiPerformance.screenSize.generic.name = sizeText;
|
||||
|
||||
uiPerformance.syncEveryFrame.generic.name = uiPerformanceYesNo[(int)uiPerformance.syncEveryFrame.curValue];
|
||||
uiPerformance.dynamicLights.generic.name = uiPerformanceYesNo[(int)uiPerformance.dynamicLights.curValue];
|
||||
uiPerformance.shadows.generic.name = uiPerformanceShadows[(int)uiPerformance.shadows.curValue];
|
||||
uiPerformance.caustics.generic.name = uiPerformanceYesNo[(int)uiPerformance.caustics.curValue];
|
||||
uiPerformance.particles.generic.name = uiPerformanceYesNo[(int)uiPerformance.particles.curValue];
|
||||
uiPerformance.decals.generic.name = uiPerformanceDecals[(int)uiPerformance.decals.curValue];
|
||||
uiPerformance.ejectingBrass.generic.name = uiPerformanceEjectBrass[(int)uiPerformance.ejectingBrass.curValue];
|
||||
uiPerformance.shellEffects.generic.name = uiPerformanceYesNo[(int)uiPerformance.shellEffects.curValue];
|
||||
uiPerformance.screenBlends.generic.name = uiPerformanceScreenBlends[(int)uiPerformance.screenBlends.curValue];
|
||||
uiPerformance.blood.generic.name = uiPerformanceYesNo[(int)uiPerformance.blood.curValue];
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Performance_Callback
|
||||
=================
|
||||
*/
|
||||
static void UI_Performance_Callback( void *self, int event )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( event == QM_CHANGED )
|
||||
{
|
||||
UI_Performance_UpdateConfig();
|
||||
UI_Performance_SetConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
if( event != QM_ACTIVATED )
|
||||
return;
|
||||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_BACK:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Performance_Ownerdraw
|
||||
=================
|
||||
*/
|
||||
static void UI_Performance_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( uiPerformance.menu.items[uiPerformance.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Performance_Init
|
||||
=================
|
||||
*/
|
||||
static void UI_Performance_Init( void )
|
||||
{
|
||||
Mem_Set( &uiPerformance, 0, sizeof( uiPerformance_t ));
|
||||
|
||||
uiPerformance.background.generic.id = ID_BACKGROUND;
|
||||
uiPerformance.background.generic.type = QMTYPE_BITMAP;
|
||||
uiPerformance.background.generic.flags = QMF_INACTIVE;
|
||||
uiPerformance.background.generic.x = 0;
|
||||
uiPerformance.background.generic.y = 0;
|
||||
uiPerformance.background.generic.width = 1024;
|
||||
uiPerformance.background.generic.height = 768;
|
||||
uiPerformance.background.pic = ART_BACKGROUND;
|
||||
|
||||
uiPerformance.banner.generic.id = ID_BANNER;
|
||||
uiPerformance.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiPerformance.banner.generic.flags = QMF_INACTIVE;
|
||||
uiPerformance.banner.generic.x = 0;
|
||||
uiPerformance.banner.generic.y = 66;
|
||||
uiPerformance.banner.generic.width = 1024;
|
||||
uiPerformance.banner.generic.height = 46;
|
||||
uiPerformance.banner.pic = ART_BANNER;
|
||||
|
||||
uiPerformance.textShadow1.generic.id = ID_TEXTSHADOW1;
|
||||
uiPerformance.textShadow1.generic.type = QMTYPE_BITMAP;
|
||||
uiPerformance.textShadow1.generic.flags = QMF_INACTIVE;
|
||||
uiPerformance.textShadow1.generic.x = 182;
|
||||
uiPerformance.textShadow1.generic.y = 170;
|
||||
uiPerformance.textShadow1.generic.width = 256;
|
||||
uiPerformance.textShadow1.generic.height = 256;
|
||||
uiPerformance.textShadow1.generic.color = uiColorBlack;
|
||||
uiPerformance.textShadow1.pic = ART_TEXT1;
|
||||
|
||||
uiPerformance.textShadow2.generic.id = ID_TEXTSHADOW2;
|
||||
uiPerformance.textShadow2.generic.type = QMTYPE_BITMAP;
|
||||
uiPerformance.textShadow2.generic.flags = QMF_INACTIVE;
|
||||
uiPerformance.textShadow2.generic.x = 182;
|
||||
uiPerformance.textShadow2.generic.y = 426;
|
||||
uiPerformance.textShadow2.generic.width = 256;
|
||||
uiPerformance.textShadow2.generic.height = 256;
|
||||
uiPerformance.textShadow2.generic.color = uiColorBlack;
|
||||
uiPerformance.textShadow2.pic = ART_TEXT2;
|
||||
|
||||
uiPerformance.text1.generic.id = ID_TEXT1;
|
||||
uiPerformance.text1.generic.type = QMTYPE_BITMAP;
|
||||
uiPerformance.text1.generic.flags = QMF_INACTIVE;
|
||||
uiPerformance.text1.generic.x = 180;
|
||||
uiPerformance.text1.generic.y = 168;
|
||||
uiPerformance.text1.generic.width = 256;
|
||||
uiPerformance.text1.generic.height = 256;
|
||||
uiPerformance.text1.pic = ART_TEXT1;
|
||||
|
||||
uiPerformance.text2.generic.id = ID_TEXT2;
|
||||
uiPerformance.text2.generic.type = QMTYPE_BITMAP;
|
||||
uiPerformance.text2.generic.flags = QMF_INACTIVE;
|
||||
uiPerformance.text2.generic.x = 180;
|
||||
uiPerformance.text2.generic.y = 424;
|
||||
uiPerformance.text2.generic.width = 256;
|
||||
uiPerformance.text2.generic.height = 256;
|
||||
uiPerformance.text2.pic = ART_TEXT2;
|
||||
|
||||
uiPerformance.back.generic.id = ID_BACK;
|
||||
uiPerformance.back.generic.type = QMTYPE_BITMAP;
|
||||
uiPerformance.back.generic.x = 413;
|
||||
uiPerformance.back.generic.y = 656;
|
||||
uiPerformance.back.generic.width = 198;
|
||||
uiPerformance.back.generic.height = 38;
|
||||
uiPerformance.back.generic.callback = UI_Performance_Callback;
|
||||
uiPerformance.back.generic.ownerdraw = UI_Performance_Ownerdraw;
|
||||
uiPerformance.back.pic = UI_BACKBUTTON;
|
||||
|
||||
uiPerformance.screenSize.generic.id = ID_SCREENSIZE;
|
||||
uiPerformance.screenSize.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiPerformance.screenSize.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiPerformance.screenSize.generic.x = 580;
|
||||
uiPerformance.screenSize.generic.y = 160;
|
||||
uiPerformance.screenSize.generic.width = 198;
|
||||
uiPerformance.screenSize.generic.height = 30;
|
||||
uiPerformance.screenSize.generic.callback = UI_Performance_Callback;
|
||||
uiPerformance.screenSize.generic.statusText = "Set your game window's screen size";
|
||||
uiPerformance.screenSize.minValue = 30;
|
||||
uiPerformance.screenSize.maxValue = 100;
|
||||
uiPerformance.screenSize.range = 10;
|
||||
|
||||
uiPerformance.syncEveryFrame.generic.id = ID_SYNCEVERYFRAME;
|
||||
uiPerformance.syncEveryFrame.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiPerformance.syncEveryFrame.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiPerformance.syncEveryFrame.generic.x = 580;
|
||||
uiPerformance.syncEveryFrame.generic.y = 192;
|
||||
uiPerformance.syncEveryFrame.generic.width = 198;
|
||||
uiPerformance.syncEveryFrame.generic.height = 30;
|
||||
uiPerformance.syncEveryFrame.generic.callback = UI_Performance_Callback;
|
||||
uiPerformance.syncEveryFrame.generic.statusText = "Synchronize video frames";
|
||||
uiPerformance.syncEveryFrame.minValue = 0;
|
||||
uiPerformance.syncEveryFrame.maxValue = 1;
|
||||
uiPerformance.syncEveryFrame.range = 1;
|
||||
|
||||
uiPerformance.dynamicLights.generic.id = ID_DYNAMICLIGHTS;
|
||||
uiPerformance.dynamicLights.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiPerformance.dynamicLights.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiPerformance.dynamicLights.generic.x = 580;
|
||||
uiPerformance.dynamicLights.generic.y = 256;
|
||||
uiPerformance.dynamicLights.generic.width = 198;
|
||||
uiPerformance.dynamicLights.generic.height = 30;
|
||||
uiPerformance.dynamicLights.generic.callback = UI_Performance_Callback;
|
||||
uiPerformance.dynamicLights.generic.statusText = "Render dynamic lights on map and models";
|
||||
uiPerformance.dynamicLights.minValue = 0;
|
||||
uiPerformance.dynamicLights.maxValue = 1;
|
||||
uiPerformance.dynamicLights.range = 1;
|
||||
|
||||
uiPerformance.shadows.generic.id = ID_SHADOWS;
|
||||
uiPerformance.shadows.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiPerformance.shadows.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiPerformance.shadows.generic.x = 580;
|
||||
uiPerformance.shadows.generic.y = 288;
|
||||
uiPerformance.shadows.generic.width = 198;
|
||||
uiPerformance.shadows.generic.height = 30;
|
||||
uiPerformance.shadows.generic.callback = UI_Performance_Callback;
|
||||
uiPerformance.shadows.generic.statusText = "Render shadows cast by models";
|
||||
uiPerformance.shadows.minValue = 0;
|
||||
uiPerformance.shadows.maxValue = 2;
|
||||
uiPerformance.shadows.range = 1;
|
||||
|
||||
uiPerformance.caustics.generic.id = ID_CAUSTICS;
|
||||
uiPerformance.caustics.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiPerformance.caustics.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiPerformance.caustics.generic.x = 580;
|
||||
uiPerformance.caustics.generic.y = 320;
|
||||
uiPerformance.caustics.generic.width = 198;
|
||||
uiPerformance.caustics.generic.height = 30;
|
||||
uiPerformance.caustics.generic.callback = UI_Performance_Callback;
|
||||
uiPerformance.caustics.generic.statusText = "Render caustics on submerged surfaces";
|
||||
uiPerformance.caustics.minValue = 0;
|
||||
uiPerformance.caustics.maxValue = 1;
|
||||
uiPerformance.caustics.range = 1;
|
||||
|
||||
uiPerformance.particles.generic.id = ID_PARTICLES;
|
||||
uiPerformance.particles.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiPerformance.particles.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiPerformance.particles.generic.x = 580;
|
||||
uiPerformance.particles.generic.y = 352;
|
||||
uiPerformance.particles.generic.width = 198;
|
||||
uiPerformance.particles.generic.height = 30;
|
||||
uiPerformance.particles.generic.callback = UI_Performance_Callback;
|
||||
uiPerformance.particles.generic.statusText = "Enable/Disable particle effects";
|
||||
uiPerformance.particles.minValue = 0;
|
||||
uiPerformance.particles.maxValue = 1;
|
||||
uiPerformance.particles.range = 1;
|
||||
|
||||
uiPerformance.decals.generic.id = ID_DECALS;
|
||||
uiPerformance.decals.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiPerformance.decals.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiPerformance.decals.generic.x = 580;
|
||||
uiPerformance.decals.generic.y = 384;
|
||||
uiPerformance.decals.generic.width = 198;
|
||||
uiPerformance.decals.generic.height = 30;
|
||||
uiPerformance.decals.generic.callback = UI_Performance_Callback;
|
||||
uiPerformance.decals.generic.statusText = "Enable/Disable marks on walls";
|
||||
uiPerformance.decals.minValue = 0;
|
||||
uiPerformance.decals.maxValue = 2;
|
||||
uiPerformance.decals.range = 1;
|
||||
|
||||
uiPerformance.ejectingBrass.generic.id = ID_EJECTINGBRASS;
|
||||
uiPerformance.ejectingBrass.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiPerformance.ejectingBrass.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiPerformance.ejectingBrass.generic.x = 580;
|
||||
uiPerformance.ejectingBrass.generic.y = 416;
|
||||
uiPerformance.ejectingBrass.generic.width = 198;
|
||||
uiPerformance.ejectingBrass.generic.height = 30;
|
||||
uiPerformance.ejectingBrass.generic.callback = UI_Performance_Callback;
|
||||
uiPerformance.ejectingBrass.generic.statusText = "Enable/Disable ejecting bullet casings from weapons";
|
||||
uiPerformance.ejectingBrass.minValue = 0;
|
||||
uiPerformance.ejectingBrass.maxValue = 2;
|
||||
uiPerformance.ejectingBrass.range = 1;
|
||||
|
||||
uiPerformance.shellEffects.generic.id = ID_SHELLEFFECTS;
|
||||
uiPerformance.shellEffects.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiPerformance.shellEffects.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiPerformance.shellEffects.generic.x = 580;
|
||||
uiPerformance.shellEffects.generic.y = 448;
|
||||
uiPerformance.shellEffects.generic.width = 198;
|
||||
uiPerformance.shellEffects.generic.height = 30;
|
||||
uiPerformance.shellEffects.generic.callback = UI_Performance_Callback;
|
||||
uiPerformance.shellEffects.generic.statusText = "Enable/Disable player and weapon shells";
|
||||
uiPerformance.shellEffects.minValue = 0;
|
||||
uiPerformance.shellEffects.maxValue = 1;
|
||||
uiPerformance.shellEffects.range = 1;
|
||||
|
||||
uiPerformance.screenBlends.generic.id = ID_SCREENBLENDS;
|
||||
uiPerformance.screenBlends.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiPerformance.screenBlends.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiPerformance.screenBlends.generic.x = 580;
|
||||
uiPerformance.screenBlends.generic.y = 480;
|
||||
uiPerformance.screenBlends.generic.width = 198;
|
||||
uiPerformance.screenBlends.generic.height = 30;
|
||||
uiPerformance.screenBlends.generic.callback = UI_Performance_Callback;
|
||||
uiPerformance.screenBlends.generic.statusText = "Enable/Disable screen blends";
|
||||
uiPerformance.screenBlends.minValue = 0;
|
||||
uiPerformance.screenBlends.maxValue = 2;
|
||||
uiPerformance.screenBlends.range = 1;
|
||||
|
||||
uiPerformance.blood.generic.id = ID_BLOOD;
|
||||
uiPerformance.blood.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiPerformance.blood.generic.flags = QMF_CENTER_JUSTIFY | QMF_PULSEIFFOCUS | QMF_DROPSHADOW;
|
||||
uiPerformance.blood.generic.x = 580;
|
||||
uiPerformance.blood.generic.y = 512;
|
||||
uiPerformance.blood.generic.width = 198;
|
||||
uiPerformance.blood.generic.height = 30;
|
||||
uiPerformance.blood.generic.callback = UI_Performance_Callback;
|
||||
uiPerformance.blood.generic.statusText = "Enable/Disable blood effects";
|
||||
uiPerformance.blood.minValue = 0;
|
||||
uiPerformance.blood.maxValue = 1;
|
||||
uiPerformance.blood.range = 1;
|
||||
|
||||
UI_Performance_GetConfig();
|
||||
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.background );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.banner );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.textShadow1 );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.textShadow2 );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.text1 );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.text2 );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.back );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.screenSize );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.syncEveryFrame );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.dynamicLights );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.shadows );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.caustics );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.particles );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.decals );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.ejectingBrass );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.shellEffects );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.screenBlends );
|
||||
UI_AddItem( &uiPerformance.menu, (void *)&uiPerformance.blood );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Performance_Precache
|
||||
=================
|
||||
*/
|
||||
void UI_Performance_Precache( void )
|
||||
{
|
||||
if( !re ) return;
|
||||
|
||||
re->RegisterShader( ART_BACKGROUND, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_BANNER, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_TEXT1, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_TEXT2, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Performance_Menu
|
||||
=================
|
||||
*/
|
||||
void UI_Performance_Menu( void )
|
||||
{
|
||||
UI_Performance_Precache();
|
||||
UI_Performance_Init();
|
||||
|
||||
UI_Performance_UpdateConfig();
|
||||
UI_PushMenu( &uiPerformance.menu );
|
||||
}
|
|
@ -23,27 +23,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "client.h"
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/banners/playersetup_t"
|
||||
#define ART_TEXT1 "gfx/shell/text/playersetup_text_p1"
|
||||
#define ART_TEXT2 "gfx/shell/text/playersetup_text_p2"
|
||||
#define ART_PLAYERVIEW "gfx/shell/segments/player_view"
|
||||
#define ART_BANNER "gfx/shell/head_customize"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
#define ID_BANNER 1
|
||||
#define ID_DONE 2
|
||||
#define ID_ADVOPTIONS 3
|
||||
#define ID_VIEW 4
|
||||
#define ID_NAME 5
|
||||
#define ID_MODEL 6
|
||||
|
||||
#define ID_TEXT1 2
|
||||
#define ID_TEXT2 3
|
||||
#define ID_TEXTSHADOW1 4
|
||||
#define ID_TEXTSHADOW2 5
|
||||
|
||||
#define ID_BACK 6
|
||||
|
||||
#define ID_VIEW 7
|
||||
#define ID_NAME 8
|
||||
#define ID_MODEL 9
|
||||
|
||||
#define MAX_PLAYERMODELS 256
|
||||
#define MAX_PLAYERSKINS 2048
|
||||
#define MAX_PLAYERMODELS 100
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -59,11 +49,8 @@ typedef struct
|
|||
menuBitmap_s background;
|
||||
menuBitmap_s banner;
|
||||
|
||||
menuBitmap_s textShadow1;
|
||||
menuBitmap_s textShadow2;
|
||||
menuBitmap_s text1;
|
||||
menuBitmap_s text2;
|
||||
menuBitmap_s back;
|
||||
menuAction_s done;
|
||||
menuAction_s AdvOptions;
|
||||
menuBitmap_s view;
|
||||
|
||||
menuField_s name;
|
||||
|
@ -72,7 +59,6 @@ typedef struct
|
|||
|
||||
static uiPlayerSetup_t uiPlayerSetup;
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_PlayerSetup_CalcFov
|
||||
|
@ -210,9 +196,12 @@ static void UI_PlayerSetup_Callback( void *self, int event )
|
|||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_BACK:
|
||||
case ID_DONE:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_ADVOPTIONS:
|
||||
UI_GameOptions_Menu();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -224,34 +213,24 @@ UI_PlayerSetup_Ownerdraw
|
|||
static void UI_PlayerSetup_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
float realtime = uiStatic.realTime * 0.001f;
|
||||
|
||||
if( item->id == ID_VIEW )
|
||||
{
|
||||
float realtime = uiStatic.realTime * 0.001f;
|
||||
// draw the background
|
||||
UI_FillRect( item->x, item->y, item->width, item->height, uiColorDkGrey );
|
||||
|
||||
// draw the background
|
||||
UI_FillRect( item->x, item->y, item->width, item->height, uiColorDkGrey );
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, uiPlayerSetup.view.pic );
|
||||
// draw the rectangle
|
||||
UI_DrawRectangle( item->x, item->y, item->width, item->height, uiScrollOutlineColor );
|
||||
|
||||
V_ClearScene();
|
||||
V_ClearScene();
|
||||
|
||||
// update renderer timings
|
||||
uiPlayerSetup.ent.v.animtime = realtime;
|
||||
uiPlayerSetup.refdef.time = realtime;
|
||||
uiPlayerSetup.refdef.frametime = cls.frametime;
|
||||
// update renderer timings
|
||||
uiPlayerSetup.ent.v.animtime = realtime;
|
||||
uiPlayerSetup.refdef.time = realtime;
|
||||
uiPlayerSetup.refdef.frametime = cls.frametime;
|
||||
|
||||
// draw the player model
|
||||
re->AddRefEntity( &uiPlayerSetup.ent, ED_NORMAL );
|
||||
re->RenderFrame( &uiPlayerSetup.refdef );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( uiPlayerSetup.menu.items[uiPlayerSetup.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
// draw the player model
|
||||
re->AddRefEntity( &uiPlayerSetup.ent, ED_NORMAL );
|
||||
re->RenderFrame( &uiPlayerSetup.refdef );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -275,69 +254,38 @@ static void UI_PlayerSetup_Init( void )
|
|||
uiPlayerSetup.banner.generic.id = ID_BANNER;
|
||||
uiPlayerSetup.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiPlayerSetup.banner.generic.flags = QMF_INACTIVE;
|
||||
uiPlayerSetup.banner.generic.x = 0;
|
||||
uiPlayerSetup.banner.generic.y = 66;
|
||||
uiPlayerSetup.banner.generic.width = 1024;
|
||||
uiPlayerSetup.banner.generic.height = 46;
|
||||
uiPlayerSetup.banner.pic = ART_BANNER;
|
||||
uiPlayerSetup.banner.generic.x = 65;
|
||||
uiPlayerSetup.banner.generic.y = 92;
|
||||
uiPlayerSetup.banner.generic.width = 690;
|
||||
uiPlayerSetup.banner.generic.height = 120;
|
||||
uiPlayerSetup.banner.pic = ART_BANNER;
|
||||
|
||||
uiPlayerSetup.textShadow1.generic.id = ID_TEXTSHADOW1;
|
||||
uiPlayerSetup.textShadow1.generic.type = QMTYPE_BITMAP;
|
||||
uiPlayerSetup.textShadow1.generic.flags = QMF_INACTIVE;
|
||||
uiPlayerSetup.textShadow1.generic.x = 98;
|
||||
uiPlayerSetup.textShadow1.generic.y = 230;
|
||||
uiPlayerSetup.textShadow1.generic.width = 128;
|
||||
uiPlayerSetup.textShadow1.generic.height = 256;
|
||||
uiPlayerSetup.textShadow1.generic.color = uiColorBlack;
|
||||
uiPlayerSetup.textShadow1.pic = ART_TEXT1;
|
||||
uiPlayerSetup.done.generic.id = ID_DONE;
|
||||
uiPlayerSetup.done.generic.type = QMTYPE_ACTION;
|
||||
uiPlayerSetup.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiPlayerSetup.done.generic.x = 72;
|
||||
uiPlayerSetup.done.generic.y = 230;
|
||||
uiPlayerSetup.done.generic.name = "Done";
|
||||
uiPlayerSetup.done.generic.statusText = "Go back to the Multiplayer Menu";
|
||||
uiPlayerSetup.done.generic.callback = UI_PlayerSetup_Callback;
|
||||
|
||||
uiPlayerSetup.textShadow2.generic.id = ID_TEXTSHADOW2;
|
||||
uiPlayerSetup.textShadow2.generic.type = QMTYPE_BITMAP;
|
||||
uiPlayerSetup.textShadow2.generic.flags = QMF_INACTIVE;
|
||||
uiPlayerSetup.textShadow2.generic.x = 98;
|
||||
uiPlayerSetup.textShadow2.generic.y = 490;
|
||||
uiPlayerSetup.textShadow2.generic.width = 128;
|
||||
uiPlayerSetup.textShadow2.generic.height = 128;
|
||||
uiPlayerSetup.textShadow2.generic.color = uiColorBlack;
|
||||
uiPlayerSetup.textShadow2.pic = ART_TEXT2;
|
||||
|
||||
uiPlayerSetup.text1.generic.id = ID_TEXT1;
|
||||
uiPlayerSetup.text1.generic.type = QMTYPE_BITMAP;
|
||||
uiPlayerSetup.text1.generic.flags = QMF_INACTIVE;
|
||||
uiPlayerSetup.text1.generic.x = 96;
|
||||
uiPlayerSetup.text1.generic.y = 228;
|
||||
uiPlayerSetup.text1.generic.width = 128;
|
||||
uiPlayerSetup.text1.generic.height = 256;
|
||||
uiPlayerSetup.text1.pic = ART_TEXT1;
|
||||
|
||||
uiPlayerSetup.text2.generic.id = ID_TEXT2;
|
||||
uiPlayerSetup.text2.generic.type = QMTYPE_BITMAP;
|
||||
uiPlayerSetup.text2.generic.flags = QMF_INACTIVE;
|
||||
uiPlayerSetup.text2.generic.x = 96;
|
||||
uiPlayerSetup.text2.generic.y = 488;
|
||||
uiPlayerSetup.text2.generic.width = 128;
|
||||
uiPlayerSetup.text2.generic.height = 128;
|
||||
uiPlayerSetup.text2.pic = ART_TEXT2;
|
||||
|
||||
uiPlayerSetup.back.generic.id = ID_BACK;
|
||||
uiPlayerSetup.back.generic.type = QMTYPE_BITMAP;
|
||||
uiPlayerSetup.back.generic.x = 413;
|
||||
uiPlayerSetup.back.generic.y = 656;
|
||||
uiPlayerSetup.back.generic.width = 198;
|
||||
uiPlayerSetup.back.generic.height = 38;
|
||||
uiPlayerSetup.back.generic.callback = UI_PlayerSetup_Callback;
|
||||
uiPlayerSetup.back.generic.ownerdraw = UI_PlayerSetup_Ownerdraw;
|
||||
uiPlayerSetup.back.pic = UI_BACKBUTTON;
|
||||
uiPlayerSetup.AdvOptions.generic.id = ID_ADVOPTIONS;
|
||||
uiPlayerSetup.AdvOptions.generic.type = QMTYPE_ACTION;
|
||||
uiPlayerSetup.AdvOptions.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiPlayerSetup.AdvOptions.generic.x = 72;
|
||||
uiPlayerSetup.AdvOptions.generic.y = 280;
|
||||
uiPlayerSetup.AdvOptions.generic.name = "Adv. Options";
|
||||
uiPlayerSetup.AdvOptions.generic.statusText = "Configure handness, fov and other advanced options";
|
||||
uiPlayerSetup.AdvOptions.generic.callback = UI_PlayerSetup_Callback;
|
||||
|
||||
uiPlayerSetup.view.generic.id = ID_VIEW;
|
||||
uiPlayerSetup.view.generic.type = QMTYPE_BITMAP;
|
||||
uiPlayerSetup.view.generic.flags = QMF_INACTIVE;
|
||||
uiPlayerSetup.view.generic.x = 628;
|
||||
uiPlayerSetup.view.generic.y = 224;
|
||||
uiPlayerSetup.view.generic.width = 320;
|
||||
uiPlayerSetup.view.generic.height = 320;
|
||||
uiPlayerSetup.view.generic.width = 190;
|
||||
uiPlayerSetup.view.generic.height = 280;
|
||||
uiPlayerSetup.view.generic.ownerdraw = UI_PlayerSetup_Ownerdraw;
|
||||
uiPlayerSetup.view.pic = ART_PLAYERVIEW;
|
||||
|
||||
uiPlayerSetup.name.generic.id = ID_NAME;
|
||||
uiPlayerSetup.name.generic.type = QMTYPE_FIELD;
|
||||
|
@ -367,11 +315,8 @@ static void UI_PlayerSetup_Init( void )
|
|||
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.background );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.banner );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.textShadow1 );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.textShadow2 );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.text1 );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.text2 );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.back );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.done );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.AdvOptions );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.view );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.name );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.model );
|
||||
|
@ -394,12 +339,13 @@ static void UI_PlayerSetup_Init( void )
|
|||
uiPlayerSetup.ent.v.frame = -1.0f;
|
||||
uiPlayerSetup.ent.v.framerate = 1.0f;
|
||||
uiPlayerSetup.ent.v.modelindex = MAX_MODELS - 1;
|
||||
uiPlayerSetup.ent.v.effects |= EF_ANIMATE;
|
||||
uiPlayerSetup.ent.v.effects |= (EF_ANIMATE|EF_FULLBRIGHT);
|
||||
uiPlayerSetup.ent.v.controller[0] = 127;
|
||||
uiPlayerSetup.ent.v.controller[1] = 127;
|
||||
uiPlayerSetup.ent.v.controller[2] = 127;
|
||||
uiPlayerSetup.ent.v.controller[3] = 127;
|
||||
uiPlayerSetup.ent.v.origin[0] = 120;
|
||||
uiPlayerSetup.ent.v.origin[0] = 80;
|
||||
uiPlayerSetup.ent.v.origin[2] = 2;
|
||||
uiPlayerSetup.ent.v.angles[1] = 180;
|
||||
}
|
||||
|
||||
|
@ -414,9 +360,6 @@ void UI_PlayerSetup_Precache( void )
|
|||
|
||||
re->RegisterShader( ART_BACKGROUND, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_BANNER, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_TEXT1, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_TEXT2, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_PLAYERVIEW, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -60,7 +60,6 @@ void UI_ScrollList_Init( menuScrollList_s *sl )
|
|||
|
||||
if( !sl->generic.color ) sl->generic.color = uiColorOrange;
|
||||
if( !sl->generic.focusColor ) sl->generic.focusColor = uiColorYellow;
|
||||
// if( !sl->background ) sl->background = UI_BACKGROUNDLISTBOX;
|
||||
if( !sl->upArrow ) sl->upArrow = UI_UPARROW;
|
||||
if( !sl->upArrowFocus ) sl->upArrowFocus = UI_UPARROWFOCUS;
|
||||
if( !sl->downArrow ) sl->downArrow = UI_DOWNARROW;
|
||||
|
@ -462,8 +461,8 @@ void UI_SpinControl_Init( menuSpinControl_s *sc )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( sc->generic.charWidth < 1 ) sc->generic.charWidth = UI_SMALL_CHAR_WIDTH;
|
||||
if( sc->generic.charHeight < 1 ) sc->generic.charHeight = UI_SMALL_CHAR_HEIGHT;
|
||||
if( sc->generic.charWidth < 1 ) sc->generic.charWidth = UI_MED_CHAR_WIDTH;
|
||||
if( sc->generic.charHeight < 1 ) sc->generic.charHeight = UI_MED_CHAR_HEIGHT;
|
||||
}
|
||||
|
||||
UI_ScaleCoords( NULL, NULL, &sc->generic.charWidth, &sc->generic.charHeight );
|
||||
|
@ -473,9 +472,6 @@ void UI_SpinControl_Init( menuSpinControl_s *sc )
|
|||
|
||||
if( !sc->generic.color ) sc->generic.color = uiColorWhite;
|
||||
if( !sc->generic.focusColor ) sc->generic.focusColor = uiColorLtGrey;
|
||||
|
||||
if( !sc->background ) sc->background = UI_BACKGROUNDBOX;
|
||||
|
||||
if( !sc->leftArrow ) sc->leftArrow = UI_LEFTARROW;
|
||||
if( !sc->leftArrowFocus ) sc->leftArrowFocus = UI_LEFTARROWFOCUS;
|
||||
if( !sc->rightArrow ) sc->rightArrow = UI_RIGHTARROW;
|
||||
|
@ -624,7 +620,18 @@ void UI_SpinControl_Draw( menuSpinControl_s *sc )
|
|||
x = sc->generic.x2;
|
||||
y = sc->generic.y2;
|
||||
|
||||
UI_DrawPic( x, y, w, h, uiColorWhite, sc->background );
|
||||
if( sc->background )
|
||||
{
|
||||
UI_DrawPic( x, y, w, h, uiColorWhite, sc->background );
|
||||
}
|
||||
else
|
||||
{
|
||||
// draw the background
|
||||
UI_FillRect( x, y, w, h, uiColorDkGrey );
|
||||
|
||||
// draw the rectangle
|
||||
UI_DrawRectangle( x, y, w, h, uiScrollOutlineColor );
|
||||
}
|
||||
|
||||
if( sc->generic.flags & QMF_GRAYED )
|
||||
{
|
||||
|
@ -709,8 +716,8 @@ void UI_Field_Init( menuField_s *f )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( f->generic.charWidth < 1 ) f->generic.charWidth = UI_SMALL_CHAR_WIDTH;
|
||||
if( f->generic.charHeight < 1 ) f->generic.charHeight = UI_SMALL_CHAR_HEIGHT;
|
||||
if( f->generic.charWidth < 1 ) f->generic.charWidth = UI_MED_CHAR_WIDTH;
|
||||
if( f->generic.charHeight < 1 ) f->generic.charHeight = UI_MED_CHAR_HEIGHT;
|
||||
}
|
||||
|
||||
UI_ScaleCoords( NULL, NULL, &f->generic.charWidth, &f->generic.charHeight );
|
||||
|
@ -720,7 +727,6 @@ void UI_Field_Init( menuField_s *f )
|
|||
|
||||
if( !f->generic.color ) f->generic.color = uiColorWhite;
|
||||
if( !f->generic.focusColor ) f->generic.focusColor = uiColorLtGrey;
|
||||
if( !f->background ) f->background = UI_BACKGROUNDBOX;
|
||||
|
||||
f->maxLenght++;
|
||||
if( f->maxLenght <= 1 || f->maxLenght >= UI_MAX_FIELD_LINE )
|
||||
|
@ -965,7 +971,18 @@ void UI_Field_Draw( menuField_s *f )
|
|||
else if( justify == 1 ) x = f->generic.x + ((f->generic.width - (com.cstrlen( text ) * f->generic.charWidth)) / 2);
|
||||
else if( justify == 2 ) x = f->generic.x + (f->generic.width - (com.cstrlen( text ) * f->generic.charWidth));
|
||||
|
||||
UI_DrawPic( f->generic.x, f->generic.y, f->generic.width, f->generic.height, uiColorWhite, f->background );
|
||||
if( f->background )
|
||||
{
|
||||
UI_DrawPic( f->generic.x, f->generic.y, f->generic.width, f->generic.height, uiColorWhite, f->background );
|
||||
}
|
||||
else
|
||||
{
|
||||
// draw the background
|
||||
UI_FillRect( f->generic.x, f->generic.y, f->generic.width, f->generic.height, uiColorDkGrey );
|
||||
|
||||
// draw the rectangle
|
||||
UI_DrawRectangle( f->generic.x, f->generic.y, f->generic.width, f->generic.height, uiScrollOutlineColor );
|
||||
}
|
||||
|
||||
if( f->generic.flags & QMF_GRAYED )
|
||||
{
|
||||
|
@ -1056,7 +1073,6 @@ void UI_Action_Init( menuAction_s *a )
|
|||
|
||||
if( !a->generic.color ) a->generic.color = uiColorOrange;
|
||||
if( !a->generic.focusColor ) a->generic.focusColor = uiColorYellow;
|
||||
// if( !a->background ) a->background = UI_BACKGROUNDBOX;
|
||||
|
||||
if( a->generic.width < 1 || a->generic.height < 1 )
|
||||
{
|
||||
|
@ -1139,6 +1155,23 @@ void UI_Action_Draw( menuAction_s *a )
|
|||
return; // grayed
|
||||
}
|
||||
|
||||
if( a->generic.statusText && a->generic.flags & QMF_NOTIFY )
|
||||
{
|
||||
int charW, charH;
|
||||
int x, w;
|
||||
|
||||
charW = UI_SMALL_CHAR_WIDTH;
|
||||
charH = UI_SMALL_CHAR_HEIGHT;
|
||||
|
||||
UI_ScaleCoords( NULL, NULL, &charW, &charH );
|
||||
|
||||
x = 290;
|
||||
w = UI_SMALL_CHAR_WIDTH * com.strlen( a->generic.statusText );
|
||||
UI_ScaleCoords( &x, NULL, &w, NULL );
|
||||
x += a->generic.x;
|
||||
|
||||
UI_DrawString( x, a->generic.y, w, a->generic.height, a->generic.statusText, uiColorWhite, true, charW, charH, 0, true );
|
||||
}
|
||||
if((menuCommon_s *)a != (menuCommon_s *)UI_ItemAtCursor( a->generic.parent ))
|
||||
{
|
||||
UI_DrawString( a->generic.x, a->generic.y, a->generic.width, a->generic.height, a->generic.name, a->generic.color, false, a->generic.charWidth, a->generic.charHeight, justify, shadow );
|
||||
|
|
|
@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/head_save"
|
||||
#define ART_LEVELSHOTBLUR "gfx/shell/segments/sp_mapshot"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
#define ID_BANNER 1
|
||||
|
@ -81,7 +80,7 @@ static void UI_SaveGame_GetGameList( void )
|
|||
search_t *t;
|
||||
int i = 0, j;
|
||||
|
||||
t = FS_Search( "save/*.bin", true );
|
||||
t = FS_Search( "save/*.sav", true );
|
||||
|
||||
if( cls.state == ca_active )
|
||||
{
|
||||
|
@ -111,6 +110,7 @@ static void UI_SaveGame_GetGameList( void )
|
|||
com.strncat( uiSaveGame.saveDescription[i], comment, NAME_LENGTH );
|
||||
com.strncat( uiSaveGame.saveDescription[i], uiEmptyString, NAME_LENGTH );
|
||||
uiSaveGame.saveDescriptionPtr[i] = uiSaveGame.saveDescription[i];
|
||||
FS_FileBase( t->filenames[j], uiSaveGame.saveName[i] );
|
||||
FS_FileBase( t->filenames[j], uiSaveGame.delName[i] );
|
||||
}
|
||||
else uiSaveGame.saveDescriptionPtr[i] = NULL;
|
||||
|
@ -140,7 +140,7 @@ static void UI_SaveGame_GetGameList( void )
|
|||
uiSaveGame.save.generic.flags |= QMF_GRAYED;
|
||||
else uiSaveGame.save.generic.flags &= ~QMF_GRAYED;
|
||||
|
||||
if( com.strlen( uiSaveGame.delName[0] ) == 0 || cls.state != ca_active )
|
||||
if( com.strlen( uiSaveGame.delName[0] ) == 0 )
|
||||
uiSaveGame.delete.generic.flags |= QMF_GRAYED;
|
||||
else uiSaveGame.delete.generic.flags &= ~QMF_GRAYED;
|
||||
|
||||
|
@ -155,11 +155,12 @@ UI_SaveGame_Callback
|
|||
static void UI_SaveGame_Callback( void *self, int event )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
string pathJPG;
|
||||
|
||||
if( event == QM_CHANGED )
|
||||
{
|
||||
// never overwrite existing saves, because their names was never get collision
|
||||
if( com.stricmp( uiSaveGame.saveName[uiSaveGame.savesList.curItem], "new" ))
|
||||
if( com.strlen( uiSaveGame.saveName[uiSaveGame.savesList.curItem] ) == 0 || cls.state != ca_active )
|
||||
uiSaveGame.save.generic.flags |= QMF_GRAYED;
|
||||
else uiSaveGame.save.generic.flags &= ~QMF_GRAYED;
|
||||
|
||||
|
@ -180,18 +181,18 @@ static void UI_SaveGame_Callback( void *self, int event )
|
|||
case ID_SAVE:
|
||||
if( com.strlen( uiSaveGame.saveName[uiSaveGame.savesList.curItem] ))
|
||||
{
|
||||
com.snprintf( pathJPG, sizeof( pathJPG ), "save/%s.jpg", uiSaveGame.saveName[uiSaveGame.savesList.curItem] );
|
||||
Cbuf_ExecuteText( EXEC_APPEND, va( "save \"%s\"\n", uiSaveGame.saveName[uiSaveGame.savesList.curItem] ));
|
||||
if( re ) re->FreeShader( pathJPG ); // unload shader from video-memory
|
||||
UI_CloseMenu();
|
||||
}
|
||||
break;
|
||||
case ID_DELETE:
|
||||
if( com.strlen( uiSaveGame.delName[uiSaveGame.savesList.curItem] ))
|
||||
{
|
||||
string pathJPG;
|
||||
|
||||
com.snprintf( pathJPG, sizeof( pathJPG ), "save/%s.jpg", uiSaveGame.saveName[uiSaveGame.savesList.curItem] );
|
||||
com.snprintf( pathJPG, sizeof( pathJPG ), "save/%s.jpg", uiSaveGame.delName[uiSaveGame.savesList.curItem] );
|
||||
Cbuf_ExecuteText( EXEC_NOW, va( "delete \"%s\"\n", uiSaveGame.delName[uiSaveGame.savesList.curItem] ));
|
||||
if( re ) re->FreeShader( pathJPG );
|
||||
if( re ) re->FreeShader( pathJPG ); // unload shader from video-memory
|
||||
UI_SaveGame_GetGameList();
|
||||
}
|
||||
break;
|
||||
|
@ -231,8 +232,8 @@ static void UI_SaveGame_Ownerdraw( void *self )
|
|||
}
|
||||
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
|
||||
|
||||
// draw the blurred frame
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
// draw the rectangle
|
||||
UI_DrawRectangle( item->x, item->y, item->width, item->height, uiScrollOutlineColor );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -313,7 +314,6 @@ static void UI_SaveGame_Init( void )
|
|||
uiSaveGame.levelShot.generic.width = LEVELSHOT_W;
|
||||
uiSaveGame.levelShot.generic.height = LEVELSHOT_H;
|
||||
uiSaveGame.levelShot.generic.ownerdraw = UI_SaveGame_Ownerdraw;
|
||||
uiSaveGame.levelShot.pic = ART_LEVELSHOTBLUR;
|
||||
|
||||
uiSaveGame.savesList.generic.id = ID_SAVELIST;
|
||||
uiSaveGame.savesList.generic.type = QMTYPE_SCROLLLIST;
|
||||
|
@ -347,7 +347,6 @@ void UI_SaveGame_Precache( void )
|
|||
|
||||
re->RegisterShader( ART_BACKGROUND, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_BANNER, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_LEVELSHOTBLUR, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,462 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 1997-2001 Id Software, Inc.
|
||||
|
||||
This program 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.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "ui_local.h"
|
||||
#include "client.h"
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/banners/savegame_t"
|
||||
#define ART_LISTBACK "gfx/shell/segments/files_box"
|
||||
#define ART_LEVELSHOTBLUR "gfx/shell/segments/sp_mapshot"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
#define ID_BANNER 1
|
||||
|
||||
#define ID_BACK 2
|
||||
#define ID_SAVE 3
|
||||
|
||||
#define ID_LISTBACK 4
|
||||
#define ID_GAMETITLE 5
|
||||
#define ID_LISTGAMES 6
|
||||
#define ID_LEVELSHOT 20
|
||||
|
||||
#define ID_NEWGAME 21
|
||||
#define ID_LOADGAME 22
|
||||
#define ID_DELETEGAME 23
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char map[80];
|
||||
char time[16];
|
||||
char date[16];
|
||||
char name[32];
|
||||
bool valid;
|
||||
} uiSaveGameGame_t;
|
||||
|
||||
static rgba_t uiSaveGameColor = { 0, 76, 127, 255 };
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uiSaveGameGame_t games[UI_MAXGAMES];
|
||||
int currentGame;
|
||||
|
||||
int currentLevelShot;
|
||||
long fadeTime;
|
||||
|
||||
menuFramework_s menu;
|
||||
|
||||
menuBitmap_s background;
|
||||
menuBitmap_s banner;
|
||||
menuBitmap_s back;
|
||||
menuBitmap_s save;
|
||||
menuBitmap_s listBack;
|
||||
menuAction_s gameTitle;
|
||||
menuAction_s listGames[UI_MAXGAMES];
|
||||
|
||||
menuBitmap_s levelShot;
|
||||
menuBitmap_s newGame;
|
||||
menuBitmap_s loadGame;
|
||||
menuBitmap_s deleteGame;
|
||||
} uiSaveGame_t;
|
||||
|
||||
static uiSaveGame_t uiSaveGame;
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_SaveGame_GetGameList
|
||||
=================
|
||||
*/
|
||||
static void UI_SaveGame_GetGameList( void )
|
||||
{
|
||||
string name;
|
||||
int i;
|
||||
|
||||
for( i = 0; i < UI_MAXGAMES; i++ )
|
||||
{
|
||||
if( !SV_GetComment( name, i ))
|
||||
{
|
||||
// get name string even if not found - SV_GetComment can be mark saves
|
||||
// as <CORRUPTED> <OLD VERSION> <EMPTY> etc
|
||||
com.strncpy(uiSaveGame.games[i].name, name, sizeof( uiSaveGame.games[i].name ));
|
||||
com.strncpy(uiSaveGame.games[i].map, "", sizeof( uiSaveGame.games[i].map ));
|
||||
com.strncpy(uiSaveGame.games[i].time, "", sizeof( uiSaveGame.games[i].time ));
|
||||
com.strncpy(uiSaveGame.games[i].date, "", sizeof( uiSaveGame.games[i].date ));
|
||||
uiSaveGame.games[i].valid = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
com.strncpy( uiSaveGame.games[i].map, name + CS_SIZE + (CS_TIME * 2), CS_SIZE );
|
||||
com.strncpy( uiSaveGame.games[i].time, name + CS_SIZE + CS_TIME, CS_TIME );
|
||||
com.strncpy( uiSaveGame.games[i].date, name + CS_SIZE, CS_TIME );
|
||||
com.strncpy( uiSaveGame.games[i].name, name, CS_SIZE );
|
||||
uiSaveGame.games[i].valid = true;
|
||||
}
|
||||
|
||||
// select first empty slot
|
||||
for( i = 0; i < UI_MAXGAMES; i++ )
|
||||
{
|
||||
if( !uiSaveGame.games[i].valid )
|
||||
{
|
||||
uiSaveGame.listGames[i].generic.color = uiSaveGameColor;
|
||||
uiSaveGame.currentGame = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// couldn't find an empty slot, so select first
|
||||
if( i == UI_MAXGAMES )
|
||||
{
|
||||
uiSaveGame.listGames[i].generic.color = uiSaveGameColor;
|
||||
uiSaveGame.currentGame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_SaveGame_Callback
|
||||
=================
|
||||
*/
|
||||
static void UI_SaveGame_Callback( void *self, int event )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( event != QM_ACTIVATED )
|
||||
return;
|
||||
|
||||
if( item->type == QMTYPE_ACTION )
|
||||
{
|
||||
// reset color, get current game, set color
|
||||
uiSaveGame.listGames[uiSaveGame.currentGame].generic.color = uiColorWhite;
|
||||
uiSaveGame.currentGame = item->id - ID_LISTGAMES;
|
||||
uiSaveGame.listGames[uiSaveGame.currentGame].generic.color = uiSaveGameColor;
|
||||
|
||||
// restart levelshot animation
|
||||
uiSaveGame.currentLevelShot = 0;
|
||||
uiSaveGame.fadeTime = uiStatic.realTime;
|
||||
return;
|
||||
}
|
||||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_BACK:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_SAVE:
|
||||
if( Host_ServerState())
|
||||
{
|
||||
Cbuf_ExecuteText( EXEC_APPEND, va( "save save%i\n", uiSaveGame.currentGame ));
|
||||
UI_CloseMenu();
|
||||
}
|
||||
break;
|
||||
case ID_NEWGAME:
|
||||
UI_NewGame_Menu();
|
||||
break;
|
||||
case ID_LOADGAME:
|
||||
UI_LoadGame_Menu();
|
||||
break;
|
||||
case ID_DELETEGAME:
|
||||
Cbuf_ExecuteText( EXEC_NOW, va( "delete save%i\n", uiSaveGame.currentGame ));
|
||||
UI_SaveGame_GetGameList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_SaveGame_Ownerdraw
|
||||
=================
|
||||
*/
|
||||
static void UI_SaveGame_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( item->type == QMTYPE_ACTION )
|
||||
{
|
||||
rgba_t color;
|
||||
char *time, *date, *name;
|
||||
bool centered;
|
||||
|
||||
if( item->id == ID_GAMETITLE )
|
||||
{
|
||||
time = "Time";
|
||||
date = "Date";
|
||||
name = "Map Name";
|
||||
centered = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
time = uiSaveGame.games[item->id - ID_LISTGAMES].time;
|
||||
date = uiSaveGame.games[item->id - ID_LISTGAMES].date;
|
||||
name = uiSaveGame.games[item->id - ID_LISTGAMES].name;
|
||||
centered = !uiSaveGame.games[item->id - ID_LISTGAMES].valid;
|
||||
|
||||
if( com.strstr( uiSaveGame.games[item->id - ID_LISTGAMES].name, "<empty>" ))
|
||||
centered = true;
|
||||
if( com.strstr( uiSaveGame.games[item->id - ID_LISTGAMES].name, "<corrupted>" ))
|
||||
centered = true;
|
||||
}
|
||||
|
||||
if( !centered )
|
||||
{
|
||||
UI_DrawString( item->x, item->y, 82*uiStatic.scaleX, item->height, time, item->color, true, item->charWidth, item->charHeight, 1, true );
|
||||
UI_DrawString( item->x + 83*uiStatic.scaleX, item->y, 82*uiStatic.scaleX, item->height, date, item->color, true, item->charWidth, item->charHeight, 1, true );
|
||||
UI_DrawString( item->x + 83*uiStatic.scaleX + 83*uiStatic.scaleX, item->y, 296*uiStatic.scaleX, item->height, name, item->color, true, item->charWidth, item->charHeight, 1, true );
|
||||
}
|
||||
else UI_DrawString( item->x, item->y, item->width, item->height, name, item->color, true, item->charWidth, item->charHeight, 1, true );
|
||||
|
||||
if( self != UI_ItemAtCursor( item->parent ))
|
||||
return;
|
||||
|
||||
*(uint *)color = *(uint *)item->color;
|
||||
color[3] = 255 * (0.5 + 0.5 * com.sin( uiStatic.realTime / UI_PULSE_DIVISOR ));
|
||||
|
||||
if( !centered )
|
||||
{
|
||||
UI_DrawString( item->x, item->y, 82*uiStatic.scaleX, item->height, time, color, true, item->charWidth, item->charHeight, 1, true );
|
||||
UI_DrawString( item->x + 83*uiStatic.scaleX, item->y, 82*uiStatic.scaleX, item->height, date, color, true, item->charWidth, item->charHeight, 1, true );
|
||||
UI_DrawString( item->x + 83*uiStatic.scaleX + 83*uiStatic.scaleX, item->y, 296*uiStatic.scaleX, item->height, name, color, true, item->charWidth, item->charHeight, 1, true );
|
||||
}
|
||||
else UI_DrawString( item->x, item->y, item->width, item->height, name, color, true, item->charWidth, item->charHeight, 1, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( item->id == ID_LEVELSHOT )
|
||||
{
|
||||
int x, y, w, h;
|
||||
int prev;
|
||||
rgba_t color = { 255, 255, 255, 255 };
|
||||
|
||||
// draw the levelshot
|
||||
x = 570;
|
||||
y = 210;
|
||||
w = 410;
|
||||
h = 202;
|
||||
|
||||
UI_ScaleCoords( &x, &y, &w, &h );
|
||||
|
||||
if( uiSaveGame.games[uiSaveGame.currentGame].map[0] )
|
||||
{
|
||||
string pathJPG;
|
||||
|
||||
if( uiStatic.realTime - uiSaveGame.fadeTime >= 3000 )
|
||||
{
|
||||
uiSaveGame.fadeTime = uiStatic.realTime;
|
||||
|
||||
uiSaveGame.currentLevelShot++;
|
||||
if( uiSaveGame.currentLevelShot == 3 )
|
||||
uiSaveGame.currentLevelShot = 0;
|
||||
}
|
||||
|
||||
prev = uiSaveGame.currentLevelShot - 1;
|
||||
if( prev < 0 ) prev = 2;
|
||||
|
||||
color[3] = bound( 0.0f, (float)(uiStatic.realTime - uiSaveGame.fadeTime) * 0.001f, 1.0f ) * 255;
|
||||
|
||||
com.snprintf( pathJPG, sizeof( pathJPG ), "save/save%i.jpg", uiSaveGame.currentGame );
|
||||
|
||||
if( !FS_FileExists( pathJPG ))
|
||||
UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
|
||||
else UI_DrawPic( x, y, w, h, uiColorWhite, pathJPG );
|
||||
}
|
||||
else UI_DrawPic( x, y, w, h, uiColorWhite, "gfx/hud/static" );
|
||||
|
||||
// draw the blurred frame
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( uiSaveGame.menu.items[uiSaveGame.menu.cursor] == self )
|
||||
UI_DrawPic(item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic(item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_SaveGame_Init
|
||||
=================
|
||||
*/
|
||||
static void UI_SaveGame_Init( void )
|
||||
{
|
||||
int i, y;
|
||||
|
||||
Mem_Set( &uiSaveGame, 0, sizeof( uiSaveGame_t ));
|
||||
|
||||
uiSaveGame.fadeTime = uiStatic.realTime;
|
||||
|
||||
uiSaveGame.background.generic.id = ID_BACKGROUND;
|
||||
uiSaveGame.background.generic.type = QMTYPE_BITMAP;
|
||||
uiSaveGame.background.generic.flags = QMF_INACTIVE;
|
||||
uiSaveGame.background.generic.x = 0;
|
||||
uiSaveGame.background.generic.y = 0;
|
||||
uiSaveGame.background.generic.width = 1024;
|
||||
uiSaveGame.background.generic.height = 768;
|
||||
uiSaveGame.background.pic = ART_BACKGROUND;
|
||||
|
||||
uiSaveGame.banner.generic.id = ID_BANNER;
|
||||
uiSaveGame.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiSaveGame.banner.generic.flags = QMF_INACTIVE;
|
||||
uiSaveGame.banner.generic.x = 0;
|
||||
uiSaveGame.banner.generic.y = 66;
|
||||
uiSaveGame.banner.generic.width = 1024;
|
||||
uiSaveGame.banner.generic.height = 46;
|
||||
uiSaveGame.banner.pic = ART_BANNER;
|
||||
|
||||
uiSaveGame.back.generic.id = ID_BACK;
|
||||
uiSaveGame.back.generic.type = QMTYPE_BITMAP;
|
||||
uiSaveGame.back.generic.x = 310;
|
||||
uiSaveGame.back.generic.y = 656;
|
||||
uiSaveGame.back.generic.width = 198;
|
||||
uiSaveGame.back.generic.height = 38;
|
||||
uiSaveGame.back.generic.callback = UI_SaveGame_Callback;
|
||||
uiSaveGame.back.generic.ownerdraw = UI_SaveGame_Ownerdraw;
|
||||
uiSaveGame.back.pic = UI_BACKBUTTON;
|
||||
|
||||
uiSaveGame.save.generic.id = ID_SAVE;
|
||||
uiSaveGame.save.generic.type = QMTYPE_BITMAP;
|
||||
uiSaveGame.save.generic.x = 516;
|
||||
uiSaveGame.save.generic.y = 656;
|
||||
uiSaveGame.save.generic.width = 198;
|
||||
uiSaveGame.save.generic.height = 38;
|
||||
uiSaveGame.save.generic.callback = UI_SaveGame_Callback;
|
||||
uiSaveGame.save.generic.ownerdraw = UI_SaveGame_Ownerdraw;
|
||||
uiSaveGame.save.pic = UI_SAVEBUTTON;
|
||||
|
||||
uiSaveGame.listBack.generic.id = ID_LISTBACK;
|
||||
uiSaveGame.listBack.generic.type = QMTYPE_BITMAP;
|
||||
uiSaveGame.listBack.generic.flags = QMF_INACTIVE;
|
||||
uiSaveGame.listBack.generic.x = 42;
|
||||
uiSaveGame.listBack.generic.y = 146;
|
||||
uiSaveGame.listBack.generic.width = 462;
|
||||
uiSaveGame.listBack.generic.height = 476;
|
||||
uiSaveGame.listBack.pic = ART_LISTBACK;
|
||||
|
||||
uiSaveGame.gameTitle.generic.id = ID_GAMETITLE;
|
||||
uiSaveGame.gameTitle.generic.type = QMTYPE_ACTION;
|
||||
uiSaveGame.gameTitle.generic.flags = QMF_INACTIVE;
|
||||
uiSaveGame.gameTitle.generic.x = 42;
|
||||
uiSaveGame.gameTitle.generic.y = 146;
|
||||
uiSaveGame.gameTitle.generic.width = 462;
|
||||
uiSaveGame.gameTitle.generic.height = 24;
|
||||
uiSaveGame.gameTitle.generic.ownerdraw = UI_SaveGame_Ownerdraw;
|
||||
|
||||
for( i = 0, y = 182; i < UI_MAXGAMES; i++, y += 32 )
|
||||
{
|
||||
uiSaveGame.listGames[i].generic.id = ID_LISTGAMES+i;
|
||||
uiSaveGame.listGames[i].generic.type = QMTYPE_ACTION;
|
||||
uiSaveGame.listGames[i].generic.flags = QMF_SILENT;
|
||||
uiSaveGame.listGames[i].generic.x = 42;
|
||||
uiSaveGame.listGames[i].generic.y = y;
|
||||
uiSaveGame.listGames[i].generic.width = 462;
|
||||
uiSaveGame.listGames[i].generic.height = 24;
|
||||
uiSaveGame.listGames[i].generic.callback = UI_SaveGame_Callback;
|
||||
uiSaveGame.listGames[i].generic.ownerdraw = UI_SaveGame_Ownerdraw;
|
||||
}
|
||||
|
||||
uiSaveGame.levelShot.generic.id = ID_LEVELSHOT;
|
||||
uiSaveGame.levelShot.generic.type = QMTYPE_BITMAP;
|
||||
uiSaveGame.levelShot.generic.flags = QMF_INACTIVE;
|
||||
uiSaveGame.levelShot.generic.x = 568;
|
||||
uiSaveGame.levelShot.generic.y = 208;
|
||||
uiSaveGame.levelShot.generic.width = 414;
|
||||
uiSaveGame.levelShot.generic.height = 206;
|
||||
uiSaveGame.levelShot.generic.ownerdraw = UI_SaveGame_Ownerdraw;
|
||||
uiSaveGame.levelShot.pic = ART_LEVELSHOTBLUR;
|
||||
|
||||
uiSaveGame.newGame.generic.id = ID_NEWGAME;
|
||||
uiSaveGame.newGame.generic.type = QMTYPE_BITMAP;
|
||||
uiSaveGame.newGame.generic.x = 676;
|
||||
uiSaveGame.newGame.generic.y = 468;
|
||||
uiSaveGame.newGame.generic.width = 198;
|
||||
uiSaveGame.newGame.generic.height = 38;
|
||||
uiSaveGame.newGame.generic.callback = UI_SaveGame_Callback;
|
||||
uiSaveGame.newGame.generic.ownerdraw = UI_SaveGame_Ownerdraw;
|
||||
uiSaveGame.newGame.pic = UI_NEWGAMEBUTTON;
|
||||
|
||||
uiSaveGame.loadGame.generic.id = ID_LOADGAME;
|
||||
uiSaveGame.loadGame.generic.type = QMTYPE_BITMAP;
|
||||
uiSaveGame.loadGame.generic.x = 676;
|
||||
uiSaveGame.loadGame.generic.y = 516;
|
||||
uiSaveGame.loadGame.generic.width = 198;
|
||||
uiSaveGame.loadGame.generic.height = 38;
|
||||
uiSaveGame.loadGame.generic.callback = UI_SaveGame_Callback;
|
||||
uiSaveGame.loadGame.generic.ownerdraw = UI_SaveGame_Ownerdraw;
|
||||
uiSaveGame.loadGame.pic = UI_LOADBUTTON;
|
||||
|
||||
uiSaveGame.deleteGame.generic.id = ID_DELETEGAME;
|
||||
uiSaveGame.deleteGame.generic.type = QMTYPE_BITMAP;
|
||||
uiSaveGame.deleteGame.generic.x = 676;
|
||||
uiSaveGame.deleteGame.generic.y = 564;
|
||||
uiSaveGame.deleteGame.generic.width = 198;
|
||||
uiSaveGame.deleteGame.generic.height = 38;
|
||||
uiSaveGame.deleteGame.generic.callback = UI_SaveGame_Callback;
|
||||
uiSaveGame.deleteGame.generic.ownerdraw = UI_SaveGame_Ownerdraw;
|
||||
uiSaveGame.deleteGame.pic = UI_DELETEBUTTON;
|
||||
|
||||
UI_SaveGame_GetGameList();
|
||||
|
||||
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.background );
|
||||
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.banner );
|
||||
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.back );
|
||||
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.save );
|
||||
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.listBack );
|
||||
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.gameTitle );
|
||||
|
||||
for( i = 0; i < UI_MAXGAMES; i++ )
|
||||
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.listGames[i] );
|
||||
|
||||
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.levelShot );
|
||||
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.newGame );
|
||||
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.loadGame );
|
||||
UI_AddItem( &uiSaveGame.menu, (void *)&uiSaveGame.deleteGame );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_SaveGame_Precache
|
||||
=================
|
||||
*/
|
||||
void UI_SaveGame_Precache( void )
|
||||
{
|
||||
if( !re ) return;
|
||||
|
||||
re->RegisterShader( ART_BACKGROUND, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_BANNER, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_LISTBACK, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_LEVELSHOTBLUR, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_SaveGame_Menu
|
||||
=================
|
||||
*/
|
||||
void UI_SaveGame_Menu( void )
|
||||
{
|
||||
UI_SaveGame_Precache();
|
||||
UI_SaveGame_Init();
|
||||
|
||||
UI_PushMenu( &uiSaveGame.menu );
|
||||
}
|
|
@ -112,7 +112,7 @@ static void UI_SaveLoad_Init( void )
|
|||
|
||||
uiSaveLoad.load.generic.id = ID_LOAD;
|
||||
uiSaveLoad.load.generic.type = QMTYPE_ACTION;
|
||||
uiSaveLoad.load.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiSaveLoad.load.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiSaveLoad.load.generic.name = "Load game";
|
||||
uiSaveLoad.load.generic.statusText = "Load a previously saved game";
|
||||
uiSaveLoad.load.generic.x = 72;
|
||||
|
@ -121,7 +121,7 @@ static void UI_SaveLoad_Init( void )
|
|||
|
||||
uiSaveLoad.save.generic.id = ID_SAVE;
|
||||
uiSaveLoad.save.generic.type = QMTYPE_ACTION;
|
||||
uiSaveLoad.save.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiSaveLoad.save.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiSaveLoad.save.generic.name = "Save game";
|
||||
uiSaveLoad.save.generic.statusText = "Save current game";
|
||||
uiSaveLoad.save.generic.x = 72;
|
||||
|
@ -130,7 +130,7 @@ static void UI_SaveLoad_Init( void )
|
|||
|
||||
uiSaveLoad.done.generic.id = ID_DONE;
|
||||
uiSaveLoad.done.generic.type = QMTYPE_ACTION;
|
||||
uiSaveLoad.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiSaveLoad.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
|
||||
uiSaveLoad.done.generic.name = "Done";
|
||||
uiSaveLoad.done.generic.statusText = "Go back to the Main Menu";
|
||||
uiSaveLoad.done.generic.x = 72;
|
||||
|
|
|
@ -23,21 +23,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
|
||||
#define ART_BACKGROUND "gfx/shell/splash"
|
||||
#define ART_BANNER "gfx/shell/banners/video_t"
|
||||
#define ART_BANNER "gfx/shell/head_video"
|
||||
#define ART_TEXT1 "gfx/shell/text/video_text_p1"
|
||||
#define ART_TEXT2 "gfx/shell/text/video_text_p2"
|
||||
#define ART_ADVANCED "gfx/shell/buttons/advanced_b"
|
||||
|
||||
#define ID_BACKGROUND 0
|
||||
#define ID_BANNER 1
|
||||
|
||||
#define ID_TEXT1 2
|
||||
#define ID_TEXT2 3
|
||||
#define ID_TEXTSHADOW1 4
|
||||
#define ID_TEXTSHADOW2 5
|
||||
|
||||
#define ID_CANCEL 6
|
||||
#define ID_ADVANCED 7
|
||||
#define ID_DONE 6
|
||||
#define ID_APPLY 8
|
||||
|
||||
#define ID_GRAPHICSSETTINGS 9
|
||||
|
@ -108,14 +104,11 @@ typedef struct
|
|||
|
||||
menuBitmap_s background;
|
||||
menuBitmap_s banner;
|
||||
menuBitmap_s textShadow1;
|
||||
menuBitmap_s textShadow2;
|
||||
menuBitmap_s text1;
|
||||
menuBitmap_s text2;
|
||||
|
||||
menuBitmap_s cancel;
|
||||
menuBitmap_s advanced;
|
||||
menuBitmap_s apply;
|
||||
menuAction_s done;
|
||||
menuAction_s apply;
|
||||
|
||||
menuSpinControl_s graphicsSettings;
|
||||
menuSpinControl_s glExtensions;
|
||||
|
@ -422,36 +415,15 @@ static void UI_Video_Callback( void *self, int event )
|
|||
|
||||
switch( item->id )
|
||||
{
|
||||
case ID_CANCEL:
|
||||
case ID_DONE:
|
||||
UI_PopMenu();
|
||||
break;
|
||||
case ID_ADVANCED:
|
||||
UI_Advanced_Menu();
|
||||
break;
|
||||
case ID_APPLY:
|
||||
UI_Video_SetConfig();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Video_Ownerdraw
|
||||
=================
|
||||
*/
|
||||
static void UI_Video_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
if( uiVideo.menu.items[uiVideo.menu.cursor] == self )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOXFOCUS );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, UI_MOVEBOX );
|
||||
|
||||
if( item->flags & QMF_GRAYED )
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorDkGrey, ((menuBitmap_s *)self)->pic );
|
||||
else UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_Video_Init
|
||||
|
@ -473,32 +445,12 @@ static void UI_Video_Init( void )
|
|||
uiVideo.banner.generic.id = ID_BANNER;
|
||||
uiVideo.banner.generic.type = QMTYPE_BITMAP;
|
||||
uiVideo.banner.generic.flags = QMF_INACTIVE;
|
||||
uiVideo.banner.generic.x = 0;
|
||||
uiVideo.banner.generic.y = 66;
|
||||
uiVideo.banner.generic.width = 1024;
|
||||
uiVideo.banner.generic.height = 46;
|
||||
uiVideo.banner.generic.x = 65;
|
||||
uiVideo.banner.generic.y = 92;
|
||||
uiVideo.banner.generic.width = 690;
|
||||
uiVideo.banner.generic.height = 120;
|
||||
uiVideo.banner.pic = ART_BANNER;
|
||||
|
||||
uiVideo.textShadow1.generic.id = ID_TEXTSHADOW1;
|
||||
uiVideo.textShadow1.generic.type = QMTYPE_BITMAP;
|
||||
uiVideo.textShadow1.generic.flags = QMF_INACTIVE;
|
||||
uiVideo.textShadow1.generic.x = 182;
|
||||
uiVideo.textShadow1.generic.y = 170;
|
||||
uiVideo.textShadow1.generic.width = 256;
|
||||
uiVideo.textShadow1.generic.height = 256;
|
||||
uiVideo.textShadow1.generic.color = uiColorBlack;
|
||||
uiVideo.textShadow1.pic = ART_TEXT1;
|
||||
|
||||
uiVideo.textShadow2.generic.id = ID_TEXTSHADOW2;
|
||||
uiVideo.textShadow2.generic.type = QMTYPE_BITMAP;
|
||||
uiVideo.textShadow2.generic.flags = QMF_INACTIVE;
|
||||
uiVideo.textShadow2.generic.x = 182;
|
||||
uiVideo.textShadow2.generic.y = 426;
|
||||
uiVideo.textShadow2.generic.width = 256;
|
||||
uiVideo.textShadow2.generic.height = 256;
|
||||
uiVideo.textShadow2.generic.color = uiColorBlack;
|
||||
uiVideo.textShadow2.pic = ART_TEXT2;
|
||||
|
||||
uiVideo.text1.generic.id = ID_TEXT1;
|
||||
uiVideo.text1.generic.type = QMTYPE_BITMAP;
|
||||
uiVideo.text1.generic.flags = QMF_INACTIVE;
|
||||
|
@ -517,35 +469,23 @@ static void UI_Video_Init( void )
|
|||
uiVideo.text2.generic.height = 256;
|
||||
uiVideo.text2.pic = ART_TEXT2;
|
||||
|
||||
uiVideo.cancel.generic.id = ID_CANCEL;
|
||||
uiVideo.cancel.generic.type = QMTYPE_BITMAP;
|
||||
uiVideo.cancel.generic.x = 206;
|
||||
uiVideo.cancel.generic.y = 656;
|
||||
uiVideo.cancel.generic.width = 198;
|
||||
uiVideo.cancel.generic.height = 38;
|
||||
uiVideo.cancel.generic.callback = UI_Video_Callback;
|
||||
uiVideo.cancel.generic.ownerdraw = UI_Video_Ownerdraw;
|
||||
uiVideo.cancel.pic = UI_CANCELBUTTON;
|
||||
|
||||
uiVideo.advanced.generic.id = ID_ADVANCED;
|
||||
uiVideo.advanced.generic.type = QMTYPE_BITMAP;
|
||||
uiVideo.advanced.generic.x = 413;
|
||||
uiVideo.advanced.generic.y = 656;
|
||||
uiVideo.advanced.generic.width = 198;
|
||||
uiVideo.advanced.generic.height = 38;
|
||||
uiVideo.advanced.generic.callback = UI_Video_Callback;
|
||||
uiVideo.advanced.generic.ownerdraw = UI_Video_Ownerdraw;
|
||||
uiVideo.advanced.pic = ART_ADVANCED;
|
||||
|
||||
uiVideo.apply.generic.id = ID_APPLY;
|
||||
uiVideo.apply.generic.type = QMTYPE_BITMAP;
|
||||
uiVideo.apply.generic.x = 620;
|
||||
uiVideo.apply.generic.y = 656;
|
||||
uiVideo.apply.generic.width = 198;
|
||||
uiVideo.apply.generic.height = 38;
|
||||
uiVideo.apply.generic.type = QMTYPE_ACTION;
|
||||
uiVideo.apply.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiVideo.apply.generic.x = 72;
|
||||
uiVideo.apply.generic.y = 230;
|
||||
uiVideo.apply.generic.name = "Apply";
|
||||
uiVideo.apply.generic.statusText = "Apply changes";
|
||||
uiVideo.apply.generic.callback = UI_Video_Callback;
|
||||
uiVideo.apply.generic.ownerdraw = UI_Video_Ownerdraw;
|
||||
uiVideo.apply.pic = UI_APPLYBUTTON;
|
||||
|
||||
uiVideo.done.generic.id = ID_DONE;
|
||||
uiVideo.done.generic.type = QMTYPE_ACTION;
|
||||
uiVideo.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiVideo.done.generic.x = 72;
|
||||
uiVideo.done.generic.y = 280;
|
||||
uiVideo.done.generic.name = "Done";
|
||||
uiVideo.done.generic.statusText = "Go back to the Configuration Menu";
|
||||
uiVideo.done.generic.callback = UI_Video_Callback;
|
||||
|
||||
uiVideo.graphicsSettings.generic.id = ID_GRAPHICSSETTINGS;
|
||||
uiVideo.graphicsSettings.generic.type = QMTYPE_SPINCONTROL;
|
||||
|
@ -692,12 +632,9 @@ static void UI_Video_Init( void )
|
|||
|
||||
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.background );
|
||||
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.banner );
|
||||
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.textShadow1 );
|
||||
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.textShadow2 );
|
||||
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.text1 );
|
||||
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.text2 );
|
||||
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.cancel );
|
||||
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.advanced );
|
||||
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.done );
|
||||
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.apply );
|
||||
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.graphicsSettings );
|
||||
UI_AddItem( &uiVideo.menu, (void *)&uiVideo.glExtensions );
|
||||
|
@ -725,7 +662,6 @@ void UI_Video_Precache( void )
|
|||
re->RegisterShader( ART_BANNER, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_TEXT1, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_TEXT2, SHADER_NOMIP );
|
||||
re->RegisterShader( ART_ADVANCED, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1504,6 +1504,10 @@ static bool FS_ParseGameInfo( const char *filename, gameinfo_t *GameInfo )
|
|||
{
|
||||
PS_GetString( script, false, GameInfo->startmap, sizeof( GameInfo->startmap ));
|
||||
}
|
||||
else if( !com.stricmp( token.string, "trainmap" ))
|
||||
{
|
||||
PS_GetString( script, false, GameInfo->trainmap, sizeof( GameInfo->trainmap ));
|
||||
}
|
||||
else if( !com.stricmp( token.string, "url_info" ))
|
||||
{
|
||||
PS_GetString( script, false, GameInfo->game_url, sizeof( GameInfo->game_url ));
|
||||
|
|
|
@ -223,6 +223,7 @@ typedef struct gameinfo_s
|
|||
string basedir; // main game directory (like 'id1' for Quake or 'valve' for Half-Life)
|
||||
string gamedir; // game directory (can be match with basedir, used as primary dir and as write path
|
||||
string startmap; // map to start singleplayer game
|
||||
string trainmap; // map to start hazard course (if specified)
|
||||
string title; // Game Main Title
|
||||
string texmode; // configure ImageLib to use various texture formats
|
||||
float version; // game version (optional)
|
||||
|
|
|
@ -393,10 +393,10 @@ class CTriggerPush : public CBaseTrigger
|
|||
{
|
||||
Vector vecPush = (pev->speed * pev->movedir);
|
||||
if ( pOther->pev->flags & FL_BASEVELOCITY )
|
||||
vecPush = vecPush + pOther->pev->basevelocity;
|
||||
vecPush = vecPush + pOther->pev->basevelocity;
|
||||
pOther->pev->basevelocity = vecPush;
|
||||
pOther->pev->flags |= FL_BASEVELOCITY;
|
||||
ALERT( at_console, "Valve trigger_push: vel %g %g %g\n", vecPush.x, vecPush.y, vecPush.z );
|
||||
pOther->pev->flJumpPadTime = gpGlobals->time;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -488,6 +488,9 @@ void Tri_End( void )
|
|||
|
||||
void Tri_RenderCallback( int fTrans )
|
||||
{
|
||||
if( RI.refdef.flags & RDF_NOWORLDMODEL )
|
||||
return;
|
||||
|
||||
triState.fActive = true;
|
||||
|
||||
if( fTrans ) GL_SetState( GLSTATE_NO_DEPTH_TEST );
|
||||
|
|
|
@ -41,6 +41,13 @@ typedef struct
|
|||
bool (*func)( ref_shader_t *shader, ref_stage_t *pass, script_t *script );
|
||||
} ref_parsekey_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FREE_IGNORE = 0, // don't free images
|
||||
FREE_NORMAL, // free dead images that registration period is expired
|
||||
FREE_FORCE, // must be free anyway
|
||||
} e_free;
|
||||
|
||||
byte *r_shaderpool;
|
||||
static table_t *r_tablesHashTable[TABLES_HASH_SIZE];
|
||||
static ref_script_t *r_shaderScriptsHash[SHADERS_HASH_SIZE];
|
||||
|
@ -2615,7 +2622,7 @@ void R_InitShaders( void )
|
|||
R_RegisterBuiltinShaders ();
|
||||
}
|
||||
|
||||
void Shader_TouchImages( ref_shader_t *shader, bool free_unused )
|
||||
void Shader_TouchImages( ref_shader_t *shader, e_free free_unused )
|
||||
{
|
||||
int i, j;
|
||||
int c_total = 0;
|
||||
|
@ -2623,13 +2630,14 @@ void Shader_TouchImages( ref_shader_t *shader, bool free_unused )
|
|||
texture_t *texture;
|
||||
|
||||
Com_Assert( shader == NULL );
|
||||
if( !free_unused ) shader->touchFrame = tr.registration_sequence;
|
||||
if( free_unused == FREE_IGNORE )
|
||||
shader->touchFrame = tr.registration_sequence;
|
||||
|
||||
for( i = 0; i < shader->num_stages; i++ )
|
||||
{
|
||||
stage = &shader->stages[i];
|
||||
|
||||
if( free_unused && stage->cinHandle )
|
||||
if( free_unused != FREE_IGNORE && stage->cinHandle )
|
||||
Shader_FreePassCinematics( stage );
|
||||
|
||||
for( j = 0; j < stage->num_textures; j++ )
|
||||
|
@ -2638,10 +2646,18 @@ void Shader_TouchImages( ref_shader_t *shader, bool free_unused )
|
|||
texture = stage->textures[j];
|
||||
|
||||
if( !texture || !texture->texnum ) continue;
|
||||
if( texture->flags & TF_STATIC ) continue;
|
||||
if( free_unused && texture->touchFrame != tr.registration_sequence )
|
||||
|
||||
if( free_unused == FREE_FORCE )
|
||||
{
|
||||
R_FreeImage( texture );
|
||||
else texture->touchFrame = tr.registration_sequence;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( texture->flags & TF_STATIC ) continue;
|
||||
if( free_unused == FREE_NORMAL && texture->touchFrame != tr.registration_sequence )
|
||||
R_FreeImage( texture );
|
||||
else texture->touchFrame = tr.registration_sequence;
|
||||
}
|
||||
c_total++; // just for debug
|
||||
}
|
||||
}
|
||||
|
@ -2658,7 +2674,7 @@ void Shader_TouchImages( ref_shader_t *shader, bool free_unused )
|
|||
}
|
||||
}
|
||||
|
||||
void Shader_FreeShader( ref_shader_t *shader )
|
||||
void Shader_FreeShader( ref_shader_t *shader, e_free free_unused )
|
||||
{
|
||||
uint i, hashKey;
|
||||
ref_shader_t *cur, **prev;
|
||||
|
@ -2671,7 +2687,7 @@ void Shader_FreeShader( ref_shader_t *shader )
|
|||
return; // already freed
|
||||
|
||||
// free uinque shader images only
|
||||
Shader_TouchImages( shader, true );
|
||||
Shader_TouchImages( shader, free_unused );
|
||||
|
||||
// remove from hash table
|
||||
hashKey = Com_HashKey( shader->name, SHADERS_HASH_SIZE );
|
||||
|
@ -2696,23 +2712,30 @@ void Shader_FreeShader( ref_shader_t *shader )
|
|||
for( i = 0; i < 6; i++ )
|
||||
{
|
||||
if( shader->skyParms->farboxShaders[i] )
|
||||
Shader_FreeShader( shader->skyParms->farboxShaders[i] );
|
||||
Shader_FreeShader( shader->skyParms->farboxShaders[i], free_unused );
|
||||
if( shader->skyParms->nearboxShaders[i] )
|
||||
Shader_FreeShader( shader->skyParms->nearboxShaders[i] );
|
||||
Shader_FreeShader( shader->skyParms->nearboxShaders[i], free_unused );
|
||||
}
|
||||
|
||||
if( free_unused != FREE_IGNORE )
|
||||
{
|
||||
R_FreeSkydome( shader->skyParms );
|
||||
shader->skyParms = NULL;
|
||||
}
|
||||
R_FreeSkydome( shader->skyParms );
|
||||
shader->skyParms = NULL;
|
||||
}
|
||||
|
||||
if( shader->flags & SHADER_VIDEOMAP )
|
||||
if( free_unused != FREE_IGNORE && shader->flags & SHADER_VIDEOMAP )
|
||||
{
|
||||
for( i = 0, pass = shader->stages; i < shader->num_stages; i++, pass++ )
|
||||
Shader_FreePassCinematics( pass );
|
||||
}
|
||||
|
||||
// free all allocated memory by shader
|
||||
Shader_Free( shader->name );
|
||||
Mem_Set( shader, 0, sizeof( ref_shader_t ));
|
||||
if( free_unused != FREE_IGNORE )
|
||||
{
|
||||
// free all allocated memory by shader
|
||||
Shader_Free( shader->name );
|
||||
Mem_Set( shader, 0, sizeof( ref_shader_t ));
|
||||
}
|
||||
}
|
||||
|
||||
void Mod_FreeShader( const char *name )
|
||||
|
@ -2741,7 +2764,7 @@ void Mod_FreeShader( const char *name )
|
|||
if( !com.stricmp( shader->name, shortname ))
|
||||
{
|
||||
// remove shader
|
||||
Shader_FreeShader( shader );
|
||||
Shader_FreeShader( shader, FREE_FORCE );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2757,8 +2780,8 @@ void R_ShutdownShaders( void )
|
|||
|
||||
for( i = 0, shader = r_shaders; i < r_numShaders; i++, shader++ )
|
||||
{
|
||||
if( !shader->shadernum ) continue; // already freed
|
||||
Shader_FreeShader( shader );
|
||||
if( !shader->shadernum ) continue; // already freed
|
||||
Shader_FreeShader( shader, FREE_NORMAL ); // images will be frees in other place
|
||||
}
|
||||
|
||||
Mem_FreePool( &r_shaderpool );
|
||||
|
@ -3296,7 +3319,7 @@ void Shader_Finish( ref_shader_t *s )
|
|||
Shader_SetFeatures( s );
|
||||
|
||||
// refresh registration sequence
|
||||
Shader_TouchImages( s, false );
|
||||
Shader_TouchImages( s, FREE_IGNORE );
|
||||
}
|
||||
|
||||
void R_UploadCinematicShader( const ref_shader_t *shader )
|
||||
|
@ -3768,7 +3791,7 @@ static ref_shader_t *Shader_CreateDefault( ref_shader_t *shader, int type, int a
|
|||
Shader_SetRenderMode( shader );
|
||||
|
||||
// refresh registration sequence
|
||||
Shader_TouchImages( shader, false );
|
||||
Shader_TouchImages( shader, FREE_IGNORE );
|
||||
|
||||
// calculate sortkey
|
||||
shader->sortkey = Shader_Sortkey( shader, shader->sort );
|
||||
|
@ -3816,7 +3839,7 @@ ref_shader_t *R_LoadShader( const char *name, int type, bool forceDefault, int a
|
|||
else continue;
|
||||
}
|
||||
// prolonge registration
|
||||
Shader_TouchImages( shader, false );
|
||||
Shader_TouchImages( shader, FREE_IGNORE );
|
||||
return shader;
|
||||
}
|
||||
}
|
||||
|
@ -3904,7 +3927,7 @@ void R_ShaderFreeUnused( void )
|
|||
// used this sequence
|
||||
if( shader->touchFrame == tr.registration_sequence ) continue;
|
||||
if( shader->flags & SHADER_STATIC ) continue;
|
||||
Shader_FreeShader( shader );
|
||||
Shader_FreeShader( shader, FREE_NORMAL );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4040,7 +4063,7 @@ ref_shader_t *R_SetupSky( const char *name )
|
|||
}
|
||||
|
||||
index = tr.currentSkyShader->shadernum;
|
||||
Shader_FreeShader( tr.currentSkyShader ); // release old sky
|
||||
Shader_FreeShader( tr.currentSkyShader, FREE_FORCE ); // release old sky
|
||||
|
||||
// new sky shader
|
||||
tr.currentSkyShader = R_LoadShader( loadname, SHADER_SKY, force_default, 0, SHADER_INVALID );
|
||||
|
@ -4054,6 +4077,6 @@ void R_FreeSky( void )
|
|||
{
|
||||
if( tr.currentSkyShader == NULL ) return; // already freed
|
||||
|
||||
Shader_FreeShader( tr.currentSkyShader );
|
||||
Shader_FreeShader( tr.currentSkyShader, FREE_FORCE );
|
||||
tr.currentSkyShader = NULL;
|
||||
}
|
|
@ -49,12 +49,87 @@ typedef struct
|
|||
char name[64];
|
||||
} dmiptexname_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *texname;
|
||||
const char *detail;
|
||||
const char material;
|
||||
int lMin;
|
||||
int lMax;
|
||||
} dmaterial_t;
|
||||
|
||||
byte* bsp_base;
|
||||
bool bsp_halflife = false;
|
||||
dmiptexname_t *mipnames = NULL;
|
||||
int mip_count = 0;
|
||||
file_t *detail_txt;
|
||||
|
||||
static const dmaterial_t detail_table[] =
|
||||
{
|
||||
{ "crt", "dt_conc", 'C', 0, 0 }, // concrete
|
||||
{ "rock", "dt_rock", 'C', 0, 0 },
|
||||
{ "conc", "dt_conc", 'C', 0, 0 },
|
||||
{ "wall", "dt_brick", 'C', 0, 0 },
|
||||
{ "crete", "dt_conc", 'C', 0, 0 },
|
||||
{ "generic", "dt_brick", 'C', 0, 0 },
|
||||
{ "metal", "dt_metal%i", 'M', 1, 2 }, // metal
|
||||
{ "mtl", "dt_metal%i", 'M', 1, 2 },
|
||||
{ "pipe", "dt_metal%i", 'M', 1, 2 },
|
||||
{ "elev", "dt_metal%i", 'M', 1, 2 },
|
||||
{ "sign", "dt_metal%i", 'M', 1, 2 },
|
||||
{ "barrel", "dt_metal%i", 'M', 1, 2 },
|
||||
{ "bath", "dt_ssteel1", 'M', 1, 2 },
|
||||
{ "refbridge", "dt_metal%i", 'M', 1, 2 },
|
||||
{ "panel", "dt_ssteel1", 'M', 0, 0 },
|
||||
{ "brass", "dt_ssteel1", 'M', 0, 0 },
|
||||
{ "car", "dt_metal%i", 'M', 1, 2 },
|
||||
{ "circuit", "dt_metal%i", 'M', 1, 2 },
|
||||
{ "steel", "dt_ssteel1", 'M', 0, 0 },
|
||||
{ "dirt", "dt_ground%i", 'D', 1, 5 }, // dirt
|
||||
{ "drt", "dt_ground%i", 'D', 1, 5 },
|
||||
{ "out", "dt_ground%i", 'D', 1, 5 },
|
||||
{ "grass", "dt_grass1", 'D', 0, 0 },
|
||||
{ "mud", "dt_carpet1", 'D', 0, 0 }, // FIXME
|
||||
{ "vent", "dt_ssteel1", 'V', 1, 4 }, // vent
|
||||
{ "duct", "dt_ssteel1", 'V', 1, 4 },
|
||||
{ "tile", "dt_smooth%i", 'T', 1, 2 },
|
||||
{ "labflr", "dt_smooth%i", 'T', 1, 2 },
|
||||
{ "bath", "dt_smooth%i", 'T', 1, 2 },
|
||||
{ "grate", "dt_stone%i", 'G', 1, 4 }, // vent
|
||||
{ "stone", "dt_stone%i", 'G', 1, 4 },
|
||||
{ "grt", "dt_stone%i", 'G', 1, 4 },
|
||||
{ "wood", "dt_wood%i", 'W', 1, 3 },
|
||||
{ "wd", "dt_wood%i", 'W', 1, 3 },
|
||||
{ "table", "dt_wood%i", 'W', 1, 3 },
|
||||
{ "board", "dt_wood%i", 'W', 1, 3 },
|
||||
{ "chair", "dt_wood%i", 'W', 1, 3 },
|
||||
{ "brd", "dt_wood%i", 'W', 1, 3 },
|
||||
{ "carp", "dt_carpet1", 'W', 1, 3 },
|
||||
{ "book", "dt_wood%i", 'W', 1, 3 },
|
||||
{ "box", "dt_wood%i", 'W', 1, 3 },
|
||||
{ "cab", "dt_wood%i", 'W', 1, 3 },
|
||||
{ "couch", "dt_wood%i", 'W', 1, 3 },
|
||||
{ "crate", "dt_wood%i", 'W', 1, 3 },
|
||||
{ "poster", "dt_plaster%i", 'W', 1, 2 },
|
||||
{ "sheet", "dt_plaster%i", 'W', 1, 2 },
|
||||
{ "stucco", "dt_plaster%i", 'W', 1, 2 },
|
||||
{ "comp", "dt_smooth1", 'P', 0, 0 },
|
||||
{ "cmp", "dt_smooth1", 'P', 0, 0 },
|
||||
{ "elec", "dt_smooth1", 'P', 0, 0 },
|
||||
{ "vend", "dt_smooth1", 'P', 0, 0 },
|
||||
{ "monitor", "dt_smooth1", 'P', 0, 0 },
|
||||
{ "phone", "dt_smooth1", 'P', 0, 0 },
|
||||
{ "glass", "dt_ssteel1", 'Y', 0, 0 },
|
||||
{ "window", "dt_ssteel1", 'Y', 0, 0 },
|
||||
{ "flesh", "dt_rough1", 'F', 0, 0 },
|
||||
{ "meat", "dt_rough1", 'F', 0, 0 },
|
||||
{ "fls", "dt_rough1", 'F', 0, 0 },
|
||||
{ "ground", "dt_ground%i", 'D', 1, 5 },
|
||||
{ "gnd", "dt_ground%i", 'D', 1, 5 },
|
||||
{ "snow", "dt_snow%i", 'O', 1, 2 }, // snow
|
||||
{ NULL, NULL, 0, 0, 0 }
|
||||
};
|
||||
|
||||
bool MipExist( const char *name )
|
||||
{
|
||||
int i;
|
||||
|
@ -70,6 +145,8 @@ bool MipExist( const char *name )
|
|||
|
||||
static const char *DetailTextureForName( const char *name )
|
||||
{
|
||||
const dmaterial_t *table;
|
||||
|
||||
if( !name || !*name ) return NULL;
|
||||
if( !com.strnicmp( name, "sky", 3 ))
|
||||
return NULL; // never details for sky
|
||||
|
@ -114,24 +191,16 @@ static const char *DetailTextureForName( const char *name )
|
|||
if( !com.strnicmp( name, "null", 4 ))
|
||||
return NULL;
|
||||
|
||||
// at this point we can apply detail textures to the current
|
||||
if( com.stristr( name, "brick" )) return "dt_brick";
|
||||
if( com.stristr( name, "carpet" )) return "dt_carpet1";
|
||||
if( com.stristr( name, "crete" )) return "dt_conc";
|
||||
if( com.stristr( name, "generic" )) return va( "dt_fabric%i", Com_RandomLong( 1, 2 ));
|
||||
if( com.stristr( name, "grass" )) return "dt_grass1";
|
||||
if( com.stristr( name, "ground" ) || com.stristr( name, "gnd" ))
|
||||
return va( "dt_ground%i", Com_RandomLong( 1, 5 ));
|
||||
if( com.stristr( name, "metal" ) || com.stristr( name, "metl" ))
|
||||
return va( "dt_metal%i", Com_RandomLong( 1, 2 ));
|
||||
if( com.stristr( name, "rock" )) return "dt_rock1";
|
||||
if( com.stristr( name, "snow" )) return va( "dt_snow%i", Com_RandomLong( 1, 2 ));
|
||||
if( com.stristr( name, "stone" )) return va( "dt_stone%i", Com_RandomLong( 1, 4 ));
|
||||
if( com.stristr( name, "steel" )) return "dt_steel1";
|
||||
if( com.stristr( name, "wood" )) return va( "dt_wood%i", Com_RandomLong( 1, 3 ));
|
||||
|
||||
// apply default detail texture
|
||||
return "dt_brick";
|
||||
for( table = detail_table; table && table->texname; table++ )
|
||||
{
|
||||
if( com.stristr( name, table->texname ))
|
||||
{
|
||||
if(( table->lMin + table->lMax ) > 0 )
|
||||
return va( table->detail, Com_RandomLong( table->lMin, table->lMax ));
|
||||
return table->detail;
|
||||
}
|
||||
}
|
||||
return "dt_smooth1"; // default
|
||||
}
|
||||
|
||||
void Conv_BspTextures( const char *name, dlump_t *l, const char *ext )
|
||||
|
|
Reference in New Issue