Update menu code from engine's branch

This commit is contained in:
a1batross 2016-08-08 00:15:15 +06:00
parent a5082ff3ae
commit e9528282ad
30 changed files with 1208 additions and 725 deletions

View File

@ -24,11 +24,12 @@ cmake_minimum_required(VERSION 2.6.0)
project (MAINUI)
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -m32")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
set (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os")
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -O3")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
if(PANDORA)
add_definitions(-DPANDORA)

View File

@ -140,6 +140,44 @@ void UI_DrawPicAdditive( int x, int y, int width, int height, const int color, c
PIC_DrawAdditive( x, y, width, height );
}
/*
=================
UI_DrawPicAdditive
=================
*/
void UI_DrawPicTrans( int x, int y, int width, int height, const int color, const char *pic )
{
HIMAGE hPic = PIC_Load( pic );
if (!hPic)
return;
int r, g, b, a;
UnpackRGBA( r, g, b, a, color );
PIC_Set( hPic, r, g, b, a );
PIC_DrawTrans( x, y, width, height );
}
/*
=================
UI_DrawPicAdditive
=================
*/
void UI_DrawPicHoles( int x, int y, int width, int height, const int color, const char *pic )
{
HIMAGE hPic = PIC_Load( pic );
if (!hPic)
return;
int r, g, b, a;
UnpackRGBA( r, g, b, a, color );
PIC_Set( hPic, r, g, b, a );
PIC_DrawHoles( x, y, width, height );
}
/*
=================
UI_FillRect
@ -204,7 +242,7 @@ void UI_DrawString( int x, int y, int w, int h, const char *string, const int co
{
int modulate, shadowModulate;
char line[1024], *l;
int xx, yy, ofsX, ofsY, len, ch;
int xx = 0, yy, ofsX = 0, ofsY = 0, len, ch;
if( !string || !string[0] )
return;
@ -270,9 +308,9 @@ void UI_DrawString( int x, int y, int w, int h, const char *string, const int co
ch &= 255;
#if 0
#ifdef _WIN32
// fix for letter пїЅ
if( ch == 0xB8 ) ch = (byte)'пїЅ';
if( ch == 0xA8 ) ch = (byte)'пїЅ';
// fix for letter <EFBFBD>
if( ch == 0xB8 ) ch = (byte)'<EFBFBD>';
if( ch == 0xA8 ) ch = (byte)'<EFBFBD>';
#endif
#endif
ch = UtfProcessChar( (unsigned char) ch );
@ -578,6 +616,20 @@ void *UI_ItemAtCursor( menuFramework_s *menu )
return menu->items[menu->cursor];
}
/*
================
UI_IsCurrentElement
Checks given menu is current selected
================
*/
bool UI_IsCurrentSelected( void *menu )
{
assert( menu );
return (menuCommon_s *)menu == UI_ItemAtCursor( ((menuAction_s *)menu)->generic.parent );
}
/*
=================
UI_AdjustCursor
@ -637,7 +689,7 @@ UI_DrawMenu
*/
void UI_DrawMenu( menuFramework_s *menu )
{
static long statusFadeTime;
static int statusFadeTime;
static menuCommon_s *lastItem;
menuCommon_s *item;
int i;
@ -693,19 +745,20 @@ void UI_DrawMenu( menuFramework_s *menu )
// flash on selected button (like in GoldSrc)
if( item ) item->lastFocusTime = uiStatic.realTime;
statusFadeTime = uiStatic.realTime;
lastItem = item;
}
if( item && ( item->flags & QMF_HASMOUSEFOCUS && !( item->flags & QMF_NOTIFY )) && ( item->statusText != NULL ))
if( item && (item == lastItem) && ( item->statusText != NULL ))
{
// fade it in, but wait a second
int alpha = bound( 0, ((( uiStatic.realTime - statusFadeTime ) - 1000 ) * 0.001f ) * 255, 255 );
float alpha = bound(0, ((( uiStatic.realTime - statusFadeTime ) - 100 ) * 0.01f ), 1);
int r, g, b, x, len;
GetConsoleStringSize( item->statusText, &len, NULL );
UnpackRGB( r, g, b, uiColorHelp );
TextMessageSetColor( r, g, b, alpha );
TextMessageSetColor( r, g, b, alpha * 255 );
x = ( ScreenWidth - len ) * 0.5; // centering
DrawConsoleString( x, 720 * uiStatic.scaleY, item->statusText );
@ -718,19 +771,12 @@ void UI_DrawMenu( menuFramework_s *menu )
UI_DefaultKey
=================
*/
extern bool ignore;
const char *UI_DefaultKey( menuFramework_s *menu, int key, int down )
{
const char *sound = NULL;
menuCommon_s *item;
int cursorPrev;
if( ignore )
{
ignore = false;
return 0;
}
// menu system key
if( down && key == K_ESCAPE )
{
@ -794,6 +840,9 @@ const char *UI_DefaultKey( menuFramework_s *menu, int key, int down )
UI_CursorMoved( menu );
if( !(((menuCommon_s *)menu->items[menu->cursor])->flags & QMF_SILENT ))
sound = uiSoundMove;
((menuCommon_s*)menu->items[menu->cursorPrev])->flags &= ~QMF_HASKEYBOARDFOCUS;
((menuCommon_s*)menu->items[menu->cursor])->flags |= QMF_HASKEYBOARDFOCUS;
}
break;
case K_DOWNARROW:
@ -811,6 +860,9 @@ const char *UI_DefaultKey( menuFramework_s *menu, int key, int down )
UI_CursorMoved(menu);
if( !(((menuCommon_s *)menu->items[menu->cursor])->flags & QMF_SILENT ))
sound = uiSoundMove;
((menuCommon_s*)menu->items[menu->cursorPrev])->flags &= ~QMF_HASKEYBOARDFOCUS;
((menuCommon_s*)menu->items[menu->cursor])->flags |= QMF_HASKEYBOARDFOCUS;
}
break;
case K_MOUSE1:
@ -860,8 +912,11 @@ UI_RefreshServerList
void UI_RefreshServerList( void )
{
uiStatic.numServers = 0;
uiStatic.serversRefreshTime = gpGlobals->time;
memset( uiStatic.serverAddresses, 0, sizeof( uiStatic.serverAddresses ));
memset( uiStatic.serverNames, 0, sizeof( uiStatic.serverNames ));
memset( uiStatic.serverPings, 0, sizeof( uiStatic.serverPings ));
CLIENT_COMMAND( FALSE, "localservers\n" );
}
@ -874,8 +929,11 @@ UI_RefreshInternetServerList
void UI_RefreshInternetServerList( void )
{
uiStatic.numServers = 0;
uiStatic.serversRefreshTime = gpGlobals->time;
memset( uiStatic.serverAddresses, 0, sizeof( uiStatic.serverAddresses ));
memset( uiStatic.serverNames, 0, sizeof( uiStatic.serverNames ));
memset( uiStatic.serverPings, 0, sizeof( uiStatic.serverPings ));
CLIENT_COMMAND( FALSE, "internetservers\n" );
}
@ -1113,7 +1171,7 @@ void UI_KeyEvent( int key, int down )
return;
if( key == K_MOUSE1 )
{
cursorDown = !!down;
cursorDown = down;
}
if( uiStatic.menuActive->keyFunc )
@ -1197,12 +1255,28 @@ void UI_MouseMove( int x, int y )
if( !uiStatic.menuActive )
return;
// now menu uses absolute coordinates
uiStatic.cursorX = x;
uiStatic.cursorY = y;
// hack: prevent changing focus when field active
#if defined(__ANDROID__) || defined(MENU_FIELD_RESIZE_HACK)
if( !uiStatic.menuActive->vidInitFunc )
{
menuField_s *f = (menuField_s *)UI_ItemAtCursor( uiStatic.menuActive );
if( f && ((menuCommon_s *)f)->type == QMTYPE_FIELD )
{
float y = f->generic.y;
if( y > ScreenHeight - f->generic.height - 40 )
y = ScreenHeight - f->generic.height - 15;
if( UI_CursorInRect( f->generic.x - 30, y - 30, f->generic.width + 60, f->generic.height + 60 ) )
return;
}
}
#endif
if( UI_CursorInRect( 1, 1, ScreenWidth - 1, ScreenHeight - 1 ))
uiStatic.mouseInRect = true;
else uiStatic.mouseInRect = false;
@ -1215,12 +1289,14 @@ void UI_MouseMove( int x, int y )
{
item = (menuCommon_s *)uiStatic.menuActive->items[i];
if( item->flags & (QMF_GRAYED|QMF_INACTIVE|QMF_HIDDEN))
if( item->flags & (QMF_GRAYED|QMF_INACTIVE|QMF_HIDDEN) )
{
if( item->flags & QMF_HASMOUSEFOCUS )
if( item->flags & (QMF_HASMOUSEFOCUS) )
{
if( !UI_CursorInRect( item->x, item->y, item->width, item->height ))
{
item->flags &= ~QMF_HASMOUSEFOCUS;
}
else item->lastFocusTime = uiStatic.realTime;
}
continue;
@ -1237,6 +1313,8 @@ void UI_MouseMove( int x, int y )
{
UI_SetCursor( uiStatic.menuActive, i );
((menuCommon_s *)(uiStatic.menuActive->items[uiStatic.menuActive->cursorPrev]))->flags &= ~QMF_HASMOUSEFOCUS;
// reset a keyboard focus also, because we are changed cursor
((menuCommon_s *)(uiStatic.menuActive->items[uiStatic.menuActive->cursorPrev]))->flags &= ~QMF_HASKEYBOARDFOCUS;
if (!(((menuCommon_s *)(uiStatic.menuActive->items[uiStatic.menuActive->cursor]))->flags & QMF_SILENT ))
UI_StartSound( uiSoundMove );
@ -1316,7 +1394,8 @@ void UI_AddServerToList( netadr_t adr, const char *info )
// add it to the list
uiStatic.updateServers = true; // info has been updated
uiStatic.serverAddresses[uiStatic.numServers] = adr;
strncpy( uiStatic.serverNames[uiStatic.numServers], info, sizeof( uiStatic.serverNames[uiStatic.numServers] ));
strncpy( uiStatic.serverNames[uiStatic.numServers], info, 256 );
uiStatic.serverPings[uiStatic.numServers] = gpGlobals->time - uiStatic.serversRefreshTime;
uiStatic.numServers++;
}
@ -1391,6 +1470,7 @@ void UI_Precache( void )
UI_Controls_Precache();
UI_AdvControls_Precache();
UI_GameOptions_Precache();
UI_GamePad_Precache();
UI_CreateGame_Precache();
UI_Audio_Precache();
UI_Video_Precache();
@ -1402,8 +1482,8 @@ void UI_Precache( void )
UI_TouchButtons_Precache();
UI_TouchEdit_Precache();
UI_FileDialog_Precache();
UI_PlayDemo_Precache();
UI_PlayRec_Precache();
UI_PlayDemo_Precache();
UI_RecDemo_Precache();
}
@ -1518,6 +1598,8 @@ UI_VidInit
*/
int UI_VidInit( void )
{
static bool calledOnce = true;
UI_Precache ();
// Sizes are based on screen height
uiStatic.scaleX = uiStatic.scaleY = ScreenHeight / 768.0f;
@ -1563,11 +1645,37 @@ int UI_VidInit( void )
{
menuFramework_s *item = uiStatic.menuStack[i];
// do vid restart for all pushed elements
if( item && item->vidInitFunc )
{
int cursor, cursorPrev;
bool valid = false;
// HACKHACK: Save cursor values when VidInit is called once
// this don't let menu "forget" actual cursor values after, for example, window resizing
if( calledOnce
&& item->cursor > 0 // ignore 0, because useless
&& item->cursor < item->numItems
&& item->cursorPrev > 0
&& item->cursorPrev < item->numItems )
{
valid = true;
cursor = item->cursor;
cursorPrev = item->cursorPrev;
}
// do vid restart for all pushed elements
item->vidInitFunc();
if( valid )
{
item->cursor = cursor;
item->cursorPrev = cursorPrev;
}
}
}
if( !calledOnce ) calledOnce = true;
return 1;
}
@ -1582,6 +1690,9 @@ void UI_Init( void )
ui_precache = CVAR_REGISTER( "ui_precache", "0", FCVAR_ARCHIVE );
ui_showmodels = CVAR_REGISTER( "ui_showmodels", "0", FCVAR_ARCHIVE );
// show cl_predict dialog
CVAR_REGISTER( "menu_mp_firsttime", "1", FCVAR_ARCHIVE );
Cmd_AddCommand( "menu_main", UI_Main_Menu );
Cmd_AddCommand( "menu_multiplayer", UI_MultiPlayer_Menu );
Cmd_AddCommand( "menu_options", UI_Options_Menu );
@ -1592,6 +1703,7 @@ void UI_Init( void )
Cmd_AddCommand( "menu_advcontrols", UI_AdvControls_Menu );
Cmd_AddCommand( "menu_gameoptions", UI_GameOptions_Menu );
Cmd_AddCommand( "menu_creategame", UI_CreateGame_Menu );
Cmd_AddCommand( "menu_gamepad", UI_GamePad_Menu );
Cmd_AddCommand( "menu_audio", UI_Audio_Menu );
Cmd_AddCommand( "menu_video", UI_Video_Menu );
Cmd_AddCommand( "menu_vidoptions", UI_VidOptions_Menu );
@ -1633,23 +1745,27 @@ void UI_Shutdown( void )
Cmd_RemoveCommand( "menu_main" );
Cmd_RemoveCommand( "menu_multiplayer" );
Cmd_RemoveCommand( "menu_options" );
Cmd_RemoveCommand( "menu_intenetgames" );
Cmd_RemoveCommand( "menu_langame" );
Cmd_RemoveCommand( "menu_intenetgames" );
Cmd_RemoveCommand( "menu_playersetup" );
Cmd_RemoveCommand( "menu_controls" );
Cmd_RemoveCommand( "menu_advcontrols" );
Cmd_RemoveCommand( "menu_gameoptions" );
Cmd_RemoveCommand( "menu_creategame" );
Cmd_RemoveCommand( "menu_gamepad" );
Cmd_RemoveCommand( "menu_audio" );
Cmd_RemoveCommand( "menu_video" );
Cmd_RemoveCommand( "menu_vidoptions" );
Cmd_RemoveCommand( "menu_vidmodes" );
Cmd_RemoveCommand( "menu_advanced" );
Cmd_RemoveCommand( "menu_performance" );
Cmd_RemoveCommand( "menu_network" );
Cmd_RemoveCommand( "menu_defaults" );
Cmd_RemoveCommand( "menu_cinematics" );
Cmd_RemoveCommand( "menu_quit" );
Cmd_RemoveCommand( "menu_customgame" );
Cmd_RemoveCommand( "menu_touch" );
Cmd_RemoveCommand( "menu_touchoptions" );
Cmd_RemoveCommand( "menu_touchbuttons" );
Cmd_RemoveCommand( "menu_touchedit" );
Cmd_RemoveCommand( "menu_filedialog" );
Cmd_RemoveCommand( "menu_playrec" );
Cmd_RemoveCommand( "menu_playdemo" );
Cmd_RemoveCommand( "menu_recdemo" );
memset( &uiStatic, 0, sizeof( uiStatic_t ));
}

View File

@ -74,7 +74,7 @@ GNU General Public License for more details.
#define UI_OUTLINE_WIDTH uiStatic.outlineWidth // outline thickness
#define UI_MAXGAMES 900 // slots for savegame/demos
#define UI_MAX_SERVERS 32
#define UI_MAX_SERVERS 256
#define UI_MAX_BGMAPS 32
#define MAX_HINT_TEXT 512
@ -102,34 +102,35 @@ typedef enum
QMTYPE_FIELD,
QMTYPE_ACTION,
QMTYPE_BITMAP,
// CR: пїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅпїЅ
// CR: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
QMTYPE_BM_BUTTON
} menuType_t;
// Generic flags
#define QMF_LEFT_JUSTIFY (1<<0)
#define QMF_CENTER_JUSTIFY (1<<1)
#define QMF_RIGHT_JUSTIFY (1<<2)
#define QMF_GRAYED (1<<3) // Grays and disables
#define QMF_INACTIVE (1<<4) // Disables any input
#define QMF_HIDDEN (1<<5) // Doesn't draw
#define QMF_NUMBERSONLY (1<<6) // Edit field is only numbers
#define QMF_LOWERCASE (1<<7) // Edit field is all lower case
#define QMF_UPPERCASE (1<<8) // Edit field is all upper case
#define QMF_DRAW_ADDITIVE (1<<9) // enable additive for this bitmap
#define QMF_PULSEIFFOCUS (1<<10)
#define QMF_HIGHLIGHTIFFOCUS (1<<11)
#define QMF_SMALLFONT (1<<12)
#define QMF_BIGFONT (1<<13)
#define QMF_DROPSHADOW (1<<14)
#define QMF_SILENT (1<<15) // Don't play sounds
#define QMF_HASMOUSEFOCUS (1<<16)
#define QMF_MOUSEONLY (1<<17) // Only mouse input allowed
#define QMF_FOCUSBEHIND (1<<18) // Focus draws behind normal item
#define QMF_NOTIFY (1<<19) // draw notify at right screen side
#define QMF_ACT_ONRELEASE (1<<20) // call Key_Event when button is released
#define QMF_ALLOW_COLORSTRINGS (1<<21) // allow colorstring in MENU_FIELD
#define QMF_HIDEINPUT (1<<22) // used for "password" field
#define QMF_LEFT_JUSTIFY (1U << 0)
#define QMF_CENTER_JUSTIFY (1U << 1)
#define QMF_RIGHT_JUSTIFY (1U << 2)
#define QMF_GRAYED (1U << 3) // Grays and disables
#define QMF_INACTIVE (1U << 4) // Disables any input
#define QMF_HIDDEN (1U << 5) // Doesn't draw
#define QMF_NUMBERSONLY (1U << 6) // Edit field is only numbers
#define QMF_LOWERCASE (1U << 7) // Edit field is all lower case
#define QMF_UPPERCASE (1U << 8) // Edit field is all upper case
#define QMF_DRAW_ADDITIVE (1U << 9) // enable additive for this bitmap
#define QMF_PULSEIFFOCUS (1U << 10)
#define QMF_HIGHLIGHTIFFOCUS (1U << 11)
#define QMF_SMALLFONT (1U << 12)
#define QMF_BIGFONT (1U << 13)
#define QMF_DROPSHADOW (1U << 14)
#define QMF_SILENT (1U << 15) // Don't play sounds
#define QMF_HASMOUSEFOCUS (1U << 16)
#define QMF_MOUSEONLY (1U << 17) // Only mouse input allowed
#define QMF_FOCUSBEHIND (1U << 18) // Focus draws behind normal item
#define QMF_NOTIFY (1U << 19) // draw notify at right screen side
#define QMF_ACT_ONRELEASE (1U << 20) // call Key_Event when button is released
#define QMF_ALLOW_COLORSTRINGS (1U << 21) // allow colorstring in MENU_FIELD
#define QMF_HIDEINPUT (1U << 22) // used for "password" field
#define QMF_HASKEYBOARDFOCUS (1U << 23)
// Callback notifications
#define QM_GOTFOCUS 1
@ -138,6 +139,12 @@ typedef enum
#define QM_CHANGED 4
#define QM_PRESSED 5
// Server browser
#define QMSB_GAME_LENGTH 25
#define QMSB_MAPNAME_LENGTH 20+QMSB_GAME_LENGTH
#define QMSB_MAXCL_LENGTH 10+QMSB_MAPNAME_LENGTH
#define QMSB_PING_LENGTH 10+QMSB_MAXCL_LENGTH
typedef struct
{
int cursor;
@ -335,6 +342,8 @@ typedef struct
netadr_t serverAddresses[UI_MAX_SERVERS];
char serverNames[UI_MAX_SERVERS][256];
float serverPings[UI_MAX_SERVERS];
int serversRefreshTime;
int numServers;
int updateServers; // true is receive new info about servers
@ -412,6 +421,8 @@ int UI_CursorInRect( int x, int y, int w, int h );
void UI_UtilSetupPicButton( menuPicButton_s *pic, int ID );
void UI_DrawPic( int x, int y, int w, int h, const int color, const char *pic );
void UI_DrawPicAdditive( int x, int y, int w, int h, const int color, const char *pic );
void UI_DrawPicTrans( int x, int y, int width, int height, const int color, const char *pic );
void UI_DrawPicHoles( int x, int y, int width, int height, const int color, const char *pic );
void UI_FillRect( int x, int y, int w, int h, const int color );
#define UI_DrawRectangle( x, y, w, h, color ) UI_DrawRectangleExt( x, y, w, h, color, uiStatic.outlineWidth )
void UI_DrawRectangleExt( int in_x, int in_y, int in_w, int in_h, const int color, int outlineWidth );
@ -425,6 +436,7 @@ void UI_CursorMoved( menuFramework_s *menu );
void UI_SetCursor( menuFramework_s *menu, int cursor );
void UI_SetCursorToItem( menuFramework_s *menu, void *item );
void *UI_ItemAtCursor( menuFramework_s *menu );
bool UI_IsCurrentSelected( void *menu );
void UI_AdjustCursor( menuFramework_s *menu, int dir );
void UI_DrawMenu( menuFramework_s *menu );
const char *UI_DefaultKey( menuFramework_s *menu, int key, int down );
@ -454,16 +466,15 @@ void UI_Video_Precache( void );
void UI_VidOptions_Precache( void );
void UI_VidModes_Precache( void );
void UI_Credits_Precache( void );
void UI_GoToSite_Precache( void );
void UI_Touch_Precache( void );
void UI_TouchOptions_Precache( void );
void UI_TouchButtons_Precache( void );
void UI_TouchEdit_Precache( void );
void UI_FileDialog_Precache( void );
void UI_GamePad_Precache( void );
void UI_PlayDemo_Precache( void );
void UI_RecDemo_Precache( void );
void UI_PlayRec_Precache( void );
void UI_RecDemo_Precache( void );
// Menus
void UI_Main_Menu( void );
@ -486,12 +497,12 @@ void UI_TouchOptions_Menu( void );
void UI_TouchButtons_Menu( void );
void UI_TouchEdit_Menu( void );
void UI_FileDialog_Menu( void );
void UI_PlayDemo_Menu( void );
void UI_RecDemo_Menu( void );
void UI_PlayRec_Menu( void );
void UI_TouchButtons_AddButtonToList( const char *name, const char *texture, const char *command, unsigned char *color, int flags );
void UI_TouchButtons_GetButtonList();
void UI_GamePad_Menu( void );
void UI_PlayDemo_Menu( void );
void UI_PlayRec_Menu( void );
void UI_RecDemo_Menu( void );
//
//-----------------------------------------------------
//

View File

@ -141,16 +141,26 @@ inline void PIC_DrawTrans( int x, int y, int width, int height )
g_engfuncs.pfnPIC_DrawTrans( x, y, width, height, NULL );
}
inline void PIC_DrawTrans( int x, int y, int width, int height, const wrect_t *prc )
{
g_engfuncs.pfnPIC_DrawTrans( x, y, width, height, prc );
}
inline void PIC_DrawHoles( int x, int y, const wrect_t *prc )
{
g_engfuncs.pfnPIC_DrawHoles( x, y, -1, -1, prc );
}
inline void SPR_DrawHoles( int x, int y, int width, int height )
inline void PIC_DrawHoles( int x, int y, int width, int height )
{
g_engfuncs.pfnPIC_DrawHoles( x, y, width, height, NULL );
}
inline void PIC_DrawHoles( int x, int y, int width, int height, const wrect_t *prc )
{
g_engfuncs.pfnPIC_DrawHoles( x, y, width, height, prc );
}
inline void PIC_DrawAdditive( int x, int y, int width, int height )
{
g_engfuncs.pfnPIC_DrawAdditive( x, y, width, height, NULL );
@ -210,4 +220,4 @@ inline int UtfProcessChar( int in )
return in;
}
#endif//ENGINECALLBACKS_H
#endif//ENGINECALLBACKS_H

View File

@ -16,14 +16,6 @@ GNU General Public License for more details.
#ifndef EXTDLL_H
#define EXTDLL_H
// shut-up compiler warnings
#if defined(MSC_VER)
#pragma warning(disable : 4305) // int or float data truncation
#pragma warning(disable : 4201) // nameless struct/union
#pragma warning(disable : 4514) // unreferenced inline function removed
#pragma warning(disable : 4100) // unreferenced formal parameter
#pragma warning(disable : 4244) // conversion from 'float' to 'int', possible loss of data
#endif
// Misc C-runtime library headers
#include <assert.h>
#include <string.h>

View File

@ -52,7 +52,6 @@ typedef struct
} uiPlayRec_t;
static uiPlayRec_t uiPlayRec;
static const char *uiEmptyString = "";
bool ignore = false;
/*

View File

@ -1,201 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="basemenu.h" />
<ClInclude Include="enginecallback.h" />
<ClInclude Include="extdll.h" />
<ClInclude Include="menufont.h" />
<ClInclude Include="menu_btnsbmp_table.h" />
<ClInclude Include="menu_strings.h" />
<ClInclude Include="ui_title_anim.h" />
<ClInclude Include="utils.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="basemenu.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_advcontrols.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_audio.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_btns.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_configuration.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_controls.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_creategame.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_credits.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_customgame.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_gameoptions.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_internetgames.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_langame.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_loadgame.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_main.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_multiplayer.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_newgame.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_playersetup.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_savegame.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_saveload.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_strings.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_video.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_vidmodes.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="menu_vidoptions.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="udll_int.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="ui_title_anim.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="utils.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{90F48F37-D9F8-4F36-B04F-1FC8CC834424}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>mainui</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../engine;../common;../pm_shared</IncludePath>
<TargetName>menu</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);../engine;../common;../pm_shared</IncludePath>
<TargetName>menu</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>XASH_VGUI;XASH_SDL;WIN32;MAINUI_EXPORTS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>XASH_VGUI;WIN32;MAINUI_EXPORTS;%(PreprocessorDefinitions);_CRT_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="basemenu.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="enginecallback.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="extdll.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="menu_btnsbmp_table.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="menu_strings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="menufont.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="ui_title_anim.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="utils.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="basemenu.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_advcontrols.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_audio.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_btns.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_configuration.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_controls.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_creategame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_credits.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_customgame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_gameoptions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_internetgames.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_langame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_loadgame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_multiplayer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_newgame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_playersetup.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_savegame.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_saveload.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_strings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_video.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_vidmodes.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="menu_vidoptions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="udll_int.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ui_title_anim.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -222,7 +222,7 @@ static void UI_AdvControls_Init( void )
uiAdvControls.crosshair.generic.id = ID_CROSSHAIR;
uiAdvControls.crosshair.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.crosshair.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.crosshair.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiAdvControls.crosshair.generic.x = 72;
uiAdvControls.crosshair.generic.y = 230;
uiAdvControls.crosshair.generic.name = "Crosshair";
@ -231,7 +231,7 @@ static void UI_AdvControls_Init( void )
uiAdvControls.invertMouse.generic.id = ID_INVERTMOUSE;
uiAdvControls.invertMouse.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.invertMouse.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.invertMouse.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiAdvControls.invertMouse.generic.x = 72;
uiAdvControls.invertMouse.generic.y = 280;
uiAdvControls.invertMouse.generic.name = MenuStrings[HINT_REVERSE_MOUSE];
@ -240,7 +240,7 @@ static void UI_AdvControls_Init( void )
uiAdvControls.mouseLook.generic.id = ID_MOUSELOOK;
uiAdvControls.mouseLook.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.mouseLook.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.mouseLook.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiAdvControls.mouseLook.generic.x = 72;
uiAdvControls.mouseLook.generic.y = 330;
uiAdvControls.mouseLook.generic.name = "Mouse look";
@ -249,7 +249,7 @@ static void UI_AdvControls_Init( void )
uiAdvControls.lookSpring.generic.id = ID_LOOKSPRING;
uiAdvControls.lookSpring.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.lookSpring.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.lookSpring.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiAdvControls.lookSpring.generic.x = 72;
uiAdvControls.lookSpring.generic.y = 380;
uiAdvControls.lookSpring.generic.name = "Look spring";
@ -258,7 +258,7 @@ static void UI_AdvControls_Init( void )
uiAdvControls.lookStrafe.generic.id = ID_LOOKSTRAFE;
uiAdvControls.lookStrafe.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.lookStrafe.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.lookStrafe.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiAdvControls.lookStrafe.generic.x = 72;
uiAdvControls.lookStrafe.generic.y = 430;
uiAdvControls.lookStrafe.generic.name = "Look strafe";
@ -267,7 +267,7 @@ static void UI_AdvControls_Init( void )
uiAdvControls.mouseFilter.generic.id = ID_MOUSEFILTER;
uiAdvControls.mouseFilter.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.mouseFilter.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.mouseFilter.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiAdvControls.mouseFilter.generic.x = 72;
uiAdvControls.mouseFilter.generic.y = 480;
uiAdvControls.mouseFilter.generic.name = "Mouse filter";
@ -276,7 +276,7 @@ static void UI_AdvControls_Init( void )
uiAdvControls.autoaim.generic.id = ID_AUTOAIM;
uiAdvControls.autoaim.generic.type = QMTYPE_CHECKBOX;
uiAdvControls.autoaim.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAdvControls.autoaim.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_NOTIFY|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiAdvControls.autoaim.generic.x = 72;
uiAdvControls.autoaim.generic.y = 530;
uiAdvControls.autoaim.generic.name = "Autoaim";
@ -285,7 +285,7 @@ static void UI_AdvControls_Init( void )
uiAdvControls.sensitivity.generic.id = ID_SENSITIVITY;
uiAdvControls.sensitivity.generic.type = QMTYPE_SLIDER;
uiAdvControls.sensitivity.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiAdvControls.sensitivity.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW|QMF_HIGHLIGHTIFFOCUS;
uiAdvControls.sensitivity.generic.name = MenuStrings[HINT_MOUSE_SENSE];
uiAdvControls.sensitivity.generic.x = 72;
uiAdvControls.sensitivity.generic.y = 625;

View File

@ -214,7 +214,7 @@ static void UI_Audio_Init( void )
uiAudio.soundVolume.generic.id = ID_SOUNDVOLUME;
uiAudio.soundVolume.generic.type = QMTYPE_SLIDER;
uiAudio.soundVolume.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiAudio.soundVolume.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW|QMF_HIGHLIGHTIFFOCUS;
uiAudio.soundVolume.generic.name = "Game sound volume";
uiAudio.soundVolume.generic.x = 320;
uiAudio.soundVolume.generic.y = 280;
@ -226,7 +226,7 @@ static void UI_Audio_Init( void )
uiAudio.musicVolume.generic.id = ID_MUSICVOLUME;
uiAudio.musicVolume.generic.type = QMTYPE_SLIDER;
uiAudio.musicVolume.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiAudio.musicVolume.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW|QMF_HIGHLIGHTIFFOCUS;
uiAudio.musicVolume.generic.name = "Game music volume";
uiAudio.musicVolume.generic.x = 320;
uiAudio.musicVolume.generic.y = 340;
@ -238,7 +238,7 @@ static void UI_Audio_Init( void )
uiAudio.suitVolume.generic.id = ID_SUITVOLUME;
uiAudio.suitVolume.generic.type = QMTYPE_SLIDER;
uiAudio.suitVolume.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiAudio.suitVolume.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW|QMF_HIGHLIGHTIFFOCUS;
uiAudio.suitVolume.generic.name = "Suit volume";
uiAudio.suitVolume.generic.x = 320;
uiAudio.suitVolume.generic.y = 400;
@ -250,7 +250,7 @@ static void UI_Audio_Init( void )
uiAudio.lerping.generic.id = ID_INTERP;
uiAudio.lerping.generic.type = QMTYPE_CHECKBOX;
uiAudio.lerping.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAudio.lerping.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiAudio.lerping.generic.name = "Enable sound interpolation";
uiAudio.lerping.generic.x = 320;
uiAudio.lerping.generic.y = 470;
@ -259,7 +259,7 @@ static void UI_Audio_Init( void )
uiAudio.noDSP.generic.id = ID_NODSP;
uiAudio.noDSP.generic.type = QMTYPE_CHECKBOX;
uiAudio.noDSP.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiAudio.noDSP.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiAudio.noDSP.generic.name = "Disable DSP effects";
uiAudio.noDSP.generic.x = 320;
uiAudio.noDSP.generic.y = 520;
@ -268,7 +268,7 @@ static void UI_Audio_Init( void )
uiAudio.muteFocusLost.generic.id = ID_MUTEFOCUSLOST;
uiAudio.muteFocusLost.generic.type = QMTYPE_CHECKBOX;
uiAudio.muteFocusLost.generic.flags = QMF_HIGHLIGHTIFFOCUS | QMF_ACT_ONRELEASE | QMF_MOUSEONLY | QMF_DROPSHADOW;
uiAudio.muteFocusLost.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiAudio.muteFocusLost.generic.name = "Mute when inactive";
uiAudio.muteFocusLost.generic.x = 320;
uiAudio.muteFocusLost.generic.y = 570;
@ -277,7 +277,7 @@ static void UI_Audio_Init( void )
uiAudio.vibrationEnable.generic.id = ID_VIBRATION_ENABLE;
uiAudio.vibrationEnable.generic.type = QMTYPE_CHECKBOX;
uiAudio.vibrationEnable.generic.flags = QMF_HIGHLIGHTIFFOCUS | QMF_ACT_ONRELEASE | QMF_MOUSEONLY | QMF_DROPSHADOW;
uiAudio.vibrationEnable.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiAudio.vibrationEnable.generic.name = "Enable vibration";
uiAudio.vibrationEnable.generic.x = 320;
uiAudio.vibrationEnable.generic.y = 620;
@ -286,12 +286,12 @@ static void UI_Audio_Init( void )
uiAudio.vibration.generic.id = ID_VIBRATION;
uiAudio.vibration.generic.type = QMTYPE_SLIDER;
uiAudio.vibration.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiAudio.vibration.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW|QMF_HIGHLIGHTIFFOCUS;
uiAudio.vibration.generic.name = "Vibration";
uiAudio.vibration.generic.x = 320;
uiAudio.vibration.generic.y = 720;
uiAudio.vibration.generic.callback = UI_Audio_Callback;
uiAudio.vibration.generic.statusText = "Singleplayer suit volume";
uiAudio.vibration.generic.statusText = "Vibration length";
uiAudio.vibration.minValue = 0.0;
uiAudio.vibration.maxValue = 1.0;
uiAudio.vibration.range = 0.05f;
@ -307,8 +307,8 @@ static void UI_Audio_Init( void )
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.lerping );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.noDSP );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.muteFocusLost );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.vibration );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.vibrationEnable );
UI_AddItem( &uiAudio.menu, (void *)&uiAudio.vibration );
}
/*

View File

@ -155,13 +155,13 @@ void UI_LoadBmpButtons( void )
if ( bhdr.biBitCount <= 8 )
{
byte* palette=&bmp_buffer[sizeof( bmp_t ) + sizeof( short )];
byte* firstpixel_col=&palette[img_data[0]*4];
byte* pallete=&bmp_buffer[sizeof( bmp_t ) + sizeof( short )];
byte* firstpixel_col=&pallete[img_data[0]*4];
firstpixel_col[0]=firstpixel_col[1]=firstpixel_col[2]=0;
}
// determine buttons count by image height...
// int pic_count = ( pInfoHdr->biHeight == 5538 ) ? PC_BUTTONCOUNT : PC_BUTTONCOUNT - 2;
// int pic_count = ( pInfoHdr->biHeight == 5538 ) ? PC_BUTTONCOUNT
int pic_count = ( bhdr.biHeight / 78 );
bhdr.biHeight = 78; //uiStatic.buttons_height;
@ -189,7 +189,7 @@ void UI_LoadBmpButtons( void )
memcpy( &raw_img_buff[offset], img_data, cutted_img_sz );
// upload image into video memory
// upload image into viedo memory
uiStatic.buttonsPics[i] = PIC_Load( fname, raw_img_buff, CuttedBmpSize );
img_data -= cutted_img_sz;

View File

@ -29,16 +29,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#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
#define ID_MSGBOX 7
#define ID_MSGTEXT 8
#define ID_TOUCH 9
#define ID_YES 130
#define ID_NO 131
#define ID_CONTROLS 2
#define ID_AUDIO 3
#define ID_VIDEO 4
#define ID_UPDATE 5
#define ID_DONE 6
#define ID_MSGBOX 7
#define ID_MSGTEXT 8
#define ID_TOUCH 9
#define ID_GAMEPAD 10
#define ID_YES 130
#define ID_NO 131
typedef struct
{
@ -52,6 +53,7 @@ typedef struct
menuPicButton_s video;
menuPicButton_s touch;
menuPicButton_s update;
menuPicButton_s gamepad;
menuPicButton_s done;
// update dialog
@ -137,6 +139,9 @@ static void UI_Options_Callback( void *self, int event )
case ID_TOUCH:
UI_Touch_Menu();
break;
case ID_GAMEPAD:
UI_GamePad_Menu();
break;
case ID_UPDATE:
UI_CheckUpdatesDialog();
break;
@ -224,11 +229,23 @@ static void UI_Options_Init( void )
//UI_UtilSetupPicButton( &uiOptions.video, PC_TOUCH );
uiOptions.gamepad.generic.id = ID_GAMEPAD;
uiOptions.gamepad.generic.type = QMTYPE_BM_BUTTON;
uiOptions.gamepad.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY | QMF_ACT_ONRELEASE;
uiOptions.gamepad.generic.x = 72;
uiOptions.gamepad.generic.y = 430;
uiOptions.gamepad.generic.name = "Gamepad";
uiOptions.gamepad.generic.statusText = "Change gamepad axis and button settings";
uiOptions.gamepad.generic.callback = UI_Options_Callback;
uiOptions.gamepad.pic = PIC_Load("gfx/shell/btn_gamepad");
//UI_UtilSetupPicButton( &uiOptions.video, PC_TOUCH );
uiOptions.update.generic.id = ID_UPDATE;
uiOptions.update.generic.type = QMTYPE_BM_BUTTON;
uiOptions.update.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiOptions.update.generic.x = 72;
uiOptions.update.generic.y = 430;
uiOptions.update.generic.y = 480;
uiOptions.update.generic.name = "Update";
uiOptions.update.generic.statusText = "Donwload the latest version of the Xash3D engine";
uiOptions.update.generic.callback = UI_Options_Callback;
@ -241,7 +258,7 @@ static void UI_Options_Init( void )
uiOptions.done.generic.type = QMTYPE_BM_BUTTON;
uiOptions.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiOptions.done.generic.x = 72;
uiOptions.done.generic.y = 480;
uiOptions.done.generic.y = 530;
uiOptions.done.generic.name = "Done";
uiOptions.done.generic.statusText = "Go back to the Main Menu";
uiOptions.done.generic.callback = UI_Options_Callback;
@ -291,6 +308,7 @@ static void UI_Options_Init( void )
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.audio );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.video );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.touch );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.gamepad );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.update );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.msgBox );
UI_AddItem( &uiOptions.menu, (void *)&uiOptions.updatePrompt );

View File

@ -90,8 +90,6 @@ static void UI_ResetToDefaultsDialog( void )
uiControls.done.generic.flags ^= QMF_INACTIVE;
uiControls.cancel.generic.flags ^= QMF_INACTIVE;
uiControls.keysList.generic.flags ^= QMF_INACTIVE;
uiControls.msgBox2.generic.flags ^= QMF_HIDDEN;
uiControls.promptMessage.generic.flags ^= QMF_HIDDEN;
uiControls.yes.generic.flags ^= QMF_HIDDEN;
@ -172,11 +170,11 @@ static void UI_Controls_ParseKeysList( void )
if( !stricmp( token, "blank" ))
{
// separator
// seperator
pfile = COM_ParseFile( pfile, token );
if( !pfile ) break; // technically an error
sprintf( str, "^6%s^7", token ); // enable uiPromptTextColor
snprintf( str, sizeof(str), "^6%s^7", token ); // enable uiPromptTextColor
StringConcat( uiControls.keysDescription[i], str, strlen( str ) + 1 );
AddSpaces( uiControls.keysDescription[i], 256 ); // empty
uiControls.keysDescriptionPtr[i] = uiControls.keysDescription[i];
@ -196,7 +194,7 @@ static void UI_Controls_ParseKeysList( void )
pfile = COM_ParseFile( pfile, token );
if( !pfile ) break; // technically an error
sprintf( str, "^6%s^7", token ); // enable uiPromptTextColor
snprintf( str, sizeof( str ), "^6%s^7", token ); // enable uiPromptTextColor
if( keys[0] == -1 ) strcpy( uiControls.firstKey[i], "" );
else strncpy( uiControls.firstKey[i], KEY_KeynumToString( keys[0] ), sizeof( uiControls.firstKey[i] ));
@ -209,15 +207,15 @@ static void UI_Controls_ParseKeysList( void )
// HACKHACK this color should be get from kb_keys.lst
if( !strnicmp( uiControls.firstKey[i], "MOUSE", 5 ))
sprintf( str, "^5%s^7", uiControls.firstKey[i] ); // cyan
else sprintf( str, "^3%s^7", uiControls.firstKey[i] ); // yellow
snprintf( str, sizeof( str ), "^5%s^7", uiControls.firstKey[i] ); // cyan
else snprintf( str, sizeof( str ), "^3%s^7", uiControls.firstKey[i] ); // yellow
StringConcat( uiControls.keysDescription[i], str, KEY1_LENGTH );
AddSpaces( uiControls.keysDescription[i], KEY1_LENGTH );
// HACKHACK this color should be get from kb_keys.lst
if( !strnicmp( uiControls.secondKey[i], "MOUSE", 5 ))
sprintf( str, "^5%s^7", uiControls.secondKey[i] );// cyan
else sprintf( str, "^3%s^7", uiControls.secondKey[i] ); // yellow
snprintf( str, sizeof( str ), "^5%s^7", uiControls.secondKey[i] );// cyan
else snprintf( str, sizeof( str ), "^3%s^7", uiControls.secondKey[i] ); // yellow
StringConcat( uiControls.keysDescription[i], str, KEY2_LENGTH );
AddSpaces( uiControls.keysDescription[i],KEY2_LENGTH );
@ -251,6 +249,8 @@ static void UI_Controls_RestartMenu( void )
{
int lastSelectedKey = uiControls.keysList.curItem;
int lastTopItem = uiControls.keysList.topItem;
int cursor = uiControls.menu.cursor;
int cursorPrev = uiControls.menu.cursorPrev;
// HACK to prevent mismatch anim stack
hold_button_stack = true;
@ -262,6 +262,8 @@ static void UI_Controls_RestartMenu( void )
hold_button_stack = false;
// restore last key and top item
uiControls.menu.cursor = cursor;
uiControls.menu.cursorPrev = cursorPrev;
uiControls.keysList.curItem = lastSelectedKey;
uiControls.keysList.topItem = lastTopItem;
}
@ -297,7 +299,7 @@ static void UI_Controls_ResetKeysList( void )
UI_UnbindCommand( token );
sprintf( cmd, "bind \"%s\" \"%s\"\n", key, token );
snprintf( cmd, sizeof( cmd ), "bind \"%s\" \"%s\"\n", key, token );
CLIENT_COMMAND( TRUE, cmd );
}
@ -345,7 +347,10 @@ static const char *UI_Controls_KeyFunc( int key, int down )
return uiSoundLaunch;
}
if( down && ( key == K_ENTER || key == K_AUX31 || key == K_AUX32 ) && uiControls.dlgMessage.generic.flags & QMF_HIDDEN ) // ENTER, A or SELECT
if( down
&& ( key == K_ENTER || key == K_AUX1 || key == K_AUX31 || key == K_AUX32 )
&& uiControls.dlgMessage.generic.flags & QMF_HIDDEN
&& UI_IsCurrentSelected( &uiControls.keysList ) ) // ENTER, A or SELECT
{
if( !strlen( uiControls.keysBind[uiControls.keysList.curItem] ))
{
@ -365,7 +370,9 @@ static const char *UI_Controls_KeyFunc( int key, int down )
return uiSoundKey;
}
if(( key == K_BACKSPACE || key == K_DEL || key == K_AUX30 ) && uiControls.dlgMessage.generic.flags & QMF_HIDDEN )
if(( key == K_BACKSPACE || key == K_DEL || key == K_AUX30 )
&& uiControls.dlgMessage.generic.flags & QMF_HIDDEN
&& UI_IsCurrentSelected( &uiControls.keysList ) )
{
// delete bindings

View File

@ -91,11 +91,13 @@ static void UI_CreateGame_Begin( void )
if( !MAP_IS_VALID( uiCreateGame.mapName[uiCreateGame.mapsList.curItem] ))
return; // bad map
if( CVAR_GET_FLOAT( "host_serverstate" ) && CVAR_GET_FLOAT( "maxplayers" ) == 1 )
HOST_ENDGAME( "end of the game" );
if( atoi( uiCreateGame.maxClients.buffer ) > 32 )
strcpy( uiCreateGame.maxClients.buffer, "32" );
if( CVAR_GET_FLOAT( "host_serverstate" ) )
{
if( CVAR_GET_FLOAT( "maxplayers" ) == 1 )
HOST_ENDGAME( "end of the game" );
else
HOST_ENDGAME( "starting new server" );
}
CVAR_SET_FLOAT( "deathmatch", 1.0f ); // start deathmatch as default
CVAR_SET_FLOAT( "maxplayers", atoi( uiCreateGame.maxClients.buffer ));
@ -122,9 +124,17 @@ static void UI_CreateGame_Begin( void )
HOST_WRITECONFIG ( CVAR_GET_STRING( "lservercfgfile" ));
char cmd[128];
sprintf( cmd, "exec %s\nmap %s\n", CVAR_GET_STRING( "lservercfgfile" ), CVAR_GET_STRING( "defaultmap" ));
sprintf( cmd, "exec %s\n", CVAR_GET_STRING( "lservercfgfile" ) );
CLIENT_COMMAND( TRUE, cmd );
// dirty listenserver config form old xash may rewrite maxplayers
CVAR_SET_FLOAT( "maxplayers", atoi( uiCreateGame.maxClients.buffer ));
// hack: wait three frames allowing server to completely shutdown, reapply maxplayers and start new map
sprintf( cmd, "host_endgame;wait;wait;wait;maxplayers %i;latch;map %s\n", atoi( uiCreateGame.maxClients.buffer ), CVAR_GET_STRING( "defaultmap" ) );
CLIENT_COMMAND( FALSE, cmd );
}
}
@ -275,7 +285,7 @@ static void UI_CreateGame_Init( void )
{
memset( &uiCreateGame, 0, sizeof( uiCreateGame_t ));
uiCreateGame.menu.vidInitFunc = UI_CreateGame_Init;
//uiCreateGame.menu.vidInitFunc = UI_CreateGame_Init;
uiCreateGame.menu.keyFunc = UI_CreateGame_KeyFunc;
StringConcat( uiCreateGame.hintText, "Map", MAPNAME_LENGTH );
@ -336,7 +346,7 @@ static void UI_CreateGame_Init( void )
uiCreateGame.dedicatedServer.generic.id = ID_DEDICATED;
uiCreateGame.dedicatedServer.generic.type = QMTYPE_CHECKBOX;
uiCreateGame.dedicatedServer.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiCreateGame.dedicatedServer.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiCreateGame.dedicatedServer.generic.name = "Dedicated server";
uiCreateGame.dedicatedServer.generic.x = 72;
uiCreateGame.dedicatedServer.generic.y = 685;
@ -345,7 +355,7 @@ static void UI_CreateGame_Init( void )
uiCreateGame.hltv.generic.id = ID_HLTV;
uiCreateGame.hltv.generic.type = QMTYPE_CHECKBOX;
uiCreateGame.hltv.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiCreateGame.hltv.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiCreateGame.hltv.generic.name = "HLTV";
uiCreateGame.hltv.generic.x = 72;
uiCreateGame.hltv.generic.y = 635;

View File

@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static const char *uiCreditsDefault[] =
{
"CS16Client v1.1-",
"CS16Client v1.1",
"Build Date:" __DATE__ " " __TIME__ ,
"",
"Developers: ",

View File

@ -104,6 +104,16 @@ static void UI_FileDialog_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
switch( item->id )
{/*
// checkboxes
case ID_XXX
if( event == QM_PRESSED )
((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
break;*/
}
if( event == QM_CHANGED )
{
switch( item->id )

View File

@ -47,25 +47,26 @@ enum
ID_AUTOHELP,
ID_ENDGAME_SCREENSHOT,
ID_OBSERVERCROSSHAIR,
ID_TRANSPARENTRADAR
ID_TRANSPARENTRADAR,
ID_MAXPACKET,
ID_MAXPACKETMESSAGE
};
typedef struct
{
float cl_corpsestay;
float mp_decals;
float maxPacket;
//float max_sheels;
//float max_smoke_puffs;
bool fast_smoke_gas;
bool hand;
bool oldstylemenu;
bool extendedmenus;
bool cl_autowepswitch;
bool hud_centerid;
bool auto_help;
//bool endgame_screenshot;
//bool observer_crosshair;
bool radar_type;
byte fast_smoke_gas;
byte hand;
byte oldstylemenu;
byte extendedmenus;
byte cl_autowepswitch;
byte hud_centerid;
byte auto_help;
byte radar_type;
} uiGameValues_t;
typedef struct
@ -93,6 +94,10 @@ typedef struct
//menuCheckBox_s endgame_screenshot;
//menuCheckBox_s observer_crosshair;
menuCheckBox_s radar_type;
menuSpinControl_s maxPacket;
menuAction_s maxPacketmessage1;
menuAction_s maxPacketmessage2;
} uiGameOptions_t;
static uiGameOptions_t uiGameOptions;
@ -106,10 +111,24 @@ UI_GameOptions_UpdateConfig
static void UI_GameOptions_UpdateConfig( void )
{
static char corpseStayText[8];
static char maxpacketText[8];
sprintf( corpseStayText, "%.f", uiGameOptions.cl_corpsestay.curValue );
uiGameOptions.cl_corpsestay.generic.name = corpseStayText;
if( uiGameOptions.maxPacket.curValue >= 1500 )
{
sprintf( maxpacketText, "default" );
// even do not send it to server
CVAR_SET_FLOAT( "cl_maxpacket", 40000 );
}
else
{
sprintf( maxpacketText, "%.f", uiGameOptions.maxPacket.curValue );
CVAR_SET_FLOAT( "cl_maxpacket", uiGameOptions.maxPacket.curValue );
}
uiGameOptions.maxPacket.generic.name = maxpacketText;
CVAR_SET_FLOAT( "hand", !uiGameOptions.hand.enabled );
CVAR_SET_FLOAT( "cl_corpsestay", uiGameOptions.cl_corpsestay.curValue );
@ -149,6 +168,7 @@ static void UI_GameOptions_DiscardChanges( void )
//CVAR_SET_FLOAT( "_extended_menus", uiGameOptions.endgame_screenshot.enabled );
//CVAR_SET_FLOAT( "", uiGameInitial.observer_crosshair );
CVAR_SET_FLOAT( "cl_radartype", uiGameInitial.radar_type );
CVAR_SET_FLOAT( "cl_maxpacket", uiGameInitial.maxPacket );
}
/*
@ -258,7 +278,7 @@ UI_GameOptions_Init
*/
static void UI_GameOptions_Init( void )
{
static unsigned int iTypicalFlags = QMF_HIGHLIGHTIFFOCUS | QMF_ACT_ONRELEASE | QMF_MOUSEONLY | QMF_DROPSHADOW;
static unsigned int iTypicalFlags = QMF_HIGHLIGHTIFFOCUS | QMF_ACT_ONRELEASE | QMF_DROPSHADOW;
const int gap = 50;
memset( &uiGameInitial, 0, sizeof( uiGameValues_t ));
memset( &uiGameOptions, 0, sizeof( uiGameOptions_t ));
@ -305,11 +325,11 @@ static void UI_GameOptions_Init( void )
UI_GenItemInit( uiGameOptions.cl_corpsestay_message.generic, 10000, QMTYPE_ACTION, QMF_SMALLFONT| QMF_INACTIVE|QMF_DROPSHADOW,
400, y = 240, "Time before dead bodies disappear:", NULL);
420, y = 240, "Time before dead bodies disappear:", NULL);
uiGameOptions.cl_corpsestay_message.generic.color = uiColorHelp;
UI_GenItemInit( uiGameOptions.cl_corpsestay.generic, ID_CORSPESTAY, QMTYPE_SPINCONTROL, QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW,
430, y += gap, "600", NULL );
450, y += gap, "600", NULL );
uiGameOptions.cl_corpsestay.generic.height = 26;
uiGameOptions.cl_corpsestay.generic.width = 168;
uiGameOptions.cl_corpsestay.minValue = 0;
@ -317,42 +337,74 @@ static void UI_GameOptions_Init( void )
uiGameOptions.cl_corpsestay.range = 50;
UI_GenItemInit( uiGameOptions.mp_decals_message.generic, 10000, QMTYPE_ACTION, QMF_SMALLFONT|QMF_INACTIVE|QMF_DROPSHADOW,
400, y += gap, "Multiplayer decal limit:", NULL);
420, y += gap, "Multiplayer decal limit:", NULL);
uiGameOptions.mp_decals_message.generic.color = uiColorHelp;
UI_GenItemInit( uiGameOptions.mp_decals.generic, ID_CORSPESTAY, QMTYPE_SPINCONTROL, QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW,
430, y += gap, "300", NULL );
450, y += gap, "300", NULL );
uiGameOptions.mp_decals.generic.height = 26;
uiGameOptions.mp_decals.generic.width = 168;
uiGameOptions.mp_decals.minValue = 0;
uiGameOptions.mp_decals.maxValue = 1000;
uiGameOptions.mp_decals.range = 50;
uiGameOptions.maxPacketmessage1.generic.id = ID_MAXPACKETMESSAGE;
uiGameOptions.maxPacketmessage1.generic.type = QMTYPE_ACTION;
uiGameOptions.maxPacketmessage1.generic.flags = QMF_SMALLFONT|QMF_INACTIVE|QMF_DROPSHADOW;
uiGameOptions.maxPacketmessage1.generic.x = 420;
uiGameOptions.maxPacketmessage1.generic.y = (y += gap);
uiGameOptions.maxPacketmessage1.generic.name = "Limit network packet size";
uiGameOptions.maxPacketmessage1.generic.color = uiColorHelp;
uiGameOptions.maxPacket.generic.id = ID_MAXPACKET;
uiGameOptions.maxPacket.generic.type = QMTYPE_SPINCONTROL;
uiGameOptions.maxPacket.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiGameOptions.maxPacket.generic.x = 450;
uiGameOptions.maxPacket.generic.y = (y += gap);
uiGameOptions.maxPacket.generic.width = 168;
uiGameOptions.maxPacket.generic.height = 26;
uiGameOptions.maxPacket.generic.callback = UI_GameOptions_Callback;
uiGameOptions.maxPacket.generic.statusText = "Limit packet size durning connection";
uiGameOptions.maxPacket.minValue = 200;
uiGameOptions.maxPacket.maxValue = 1500;
uiGameOptions.maxPacket.range = 50;
uiGameOptions.maxPacketmessage2.generic.id = ID_MAXPACKETMESSAGE;
uiGameOptions.maxPacketmessage2.generic.type = QMTYPE_ACTION;
uiGameOptions.maxPacketmessage2.generic.flags = QMF_SMALLFONT|QMF_INACTIVE|QMF_DROPSHADOW;
uiGameOptions.maxPacketmessage2.generic.x = 420;
uiGameOptions.maxPacketmessage2.generic.y = (y += gap);
uiGameOptions.maxPacketmessage2.generic.name = "^3Use 700 or less if connection hangs\nafter \"^6Spooling demo header^3\" message";
uiGameOptions.maxPacketmessage2.generic.color = uiColorWhite;
UI_GenItemInit( uiGameOptions.done.generic, ID_DONE, QMTYPE_BM_BUTTON, QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW,
430, y += gap * 3 - 10, "Done", "Save changes and go back to the Customize Menu");
450, y += gap, "Done", "Save changes and go back to the Customize Menu");
UI_UtilSetupPicButton( &uiGameOptions.done, PC_DONE );
UI_GenItemInit( uiGameOptions.cancel.generic, ID_CANCEL, QMTYPE_BM_BUTTON, QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW,
430, y += gap, "Cancel", "Go back to the Customize Menu");
450, y += gap, "Cancel", "Go back to the Customize Menu");
UI_UtilSetupPicButton( &uiGameOptions.cancel, PC_CANCEL );
UI_GameOptions_GetConfig();
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.background );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.banner );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.done );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.cancel );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.cl_corpsestay );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.cl_corpsestay_message );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.mp_decals );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.mp_decals_message );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.hand );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.fast_smoke_gas );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.extendedmenus );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.oldstylemenu );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.extendedmenus );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.cl_autowepswitch );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.hud_centerid );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.auto_help );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.radar_type );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.cl_corpsestay );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.cl_corpsestay_message );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.mp_decals );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.mp_decals_message );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.maxPacket );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.maxPacketmessage1 );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.maxPacketmessage2 );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.done );
UI_AddItem( &uiGameOptions.menu, (void *)&uiGameOptions.cancel );
}
/*

513
mainui/menu_gamepad.cpp Normal file
View File

@ -0,0 +1,513 @@
/*
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 "extdll.h"
#include "basemenu.h"
#include "utils.h"
#include "menu_btnsbmp_table.h"
#define ART_BANNER "gfx/shell/head_audio"
#define ID_BACKGROUND 0
enum
{
ID_BANNER = 1,
ID_DONE,
ID_RT_COMMAND,
ID_RT_THRESHOLD,
ID_LT_COMMAND,
ID_LT_THRESHOLD,
ID_SIDE,
ID_FORWARD,
ID_PITCH,
ID_YAW,
ID_INVERT_SIDE,
ID_INVERT_FORWARD,
ID_INVERT_PITCH,
ID_INVERT_YAW,
ID_AXIS_BIND1,
ID_AXIS_BIND2,
ID_AXIS_BIND3,
ID_AXIS_BIND4,
ID_AXIS_BIND5,
ID_AXIS_BIND6
};
enum engineAxis_t
{
JOY_AXIS_SIDE = 0,
JOY_AXIS_FWD,
JOY_AXIS_PITCH,
JOY_AXIS_YAW,
JOY_AXIS_RT,
JOY_AXIS_LT,
JOY_AXIS_NULL
};
static const char *axisNames[7] =
{
"Side Movement",
"Forward Movement",
"Camera Vertical Turn",
"Camera Horizontal Turn",
"Right Trigger",
"Left Trigger",
"NOT BOUND"
};
typedef struct
{
menuFramework_s menu;
menuBitmap_s background;
menuBitmap_s banner;
menuPicButton_s done;
menuField_s rt_command, lt_command;
menuSlider_s side, forward, pitch, yaw;
menuCheckBox_s invSide, invFwd, invPitch, invYaw;
menuSpinControl_s axisBind[6];
menuAction_s axisBind_label;
menuAction_s rt_command_label;
menuAction_s lt_command_label;
} uiGamePad_t;
static uiGamePad_t uiGamePad;
/*
=================
UI_GamePad_GetConfig
=================
*/
static void UI_GamePad_GetConfig( void )
{
float side, forward, pitch, yaw;
char binding[7] = { 0 };
strcpy( uiGamePad.rt_command.buffer, CVAR_GET_STRING( "joy_rt_command") );
strcpy( uiGamePad.lt_command.buffer, CVAR_GET_STRING( "joy_lt_command") );
strncpy( binding, CVAR_GET_STRING( "joy_axis_binding"), sizeof( binding ));
side = CVAR_GET_FLOAT( "joy_side" );
forward = CVAR_GET_FLOAT( "joy_forward" );
pitch = CVAR_GET_FLOAT( "joy_pitch" );
yaw = CVAR_GET_FLOAT( "joy_yaw" );
uiGamePad.side.curValue = fabs( side );
uiGamePad.forward.curValue = fabs( forward );
uiGamePad.pitch.curValue = fabs( pitch );
uiGamePad.yaw.curValue = fabs( yaw );
uiGamePad.invSide.enabled = side < 0.0f ? true: false;
uiGamePad.invFwd.enabled = forward < 0.0f ? true: false;
uiGamePad.invPitch.enabled = pitch < 0.0f ? true: false;
uiGamePad.invYaw.enabled = yaw < 0.0f ? true: false;
// I made a monster...
for( size_t i = 0; i < sizeof( binding ) - 1; i++ )
{
switch( binding[i] )
{
case 's':
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_SIDE];
uiGamePad.axisBind[i].curValue = JOY_AXIS_SIDE;
break;
case 'f':
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_FWD];
uiGamePad.axisBind[i].curValue = JOY_AXIS_FWD;
break;
case 'p':
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_PITCH];
uiGamePad.axisBind[i].curValue = JOY_AXIS_PITCH;
break;
case 'y':
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_YAW];
uiGamePad.axisBind[i].curValue = JOY_AXIS_YAW;
break;
case 'r':
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_RT];
uiGamePad.axisBind[i].curValue = JOY_AXIS_RT;
break;
case 'l':
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_LT];
uiGamePad.axisBind[i].curValue = JOY_AXIS_LT;
break;
default:
uiGamePad.axisBind[i].generic.name = axisNames[JOY_AXIS_NULL];
uiGamePad.axisBind[i].curValue = JOY_AXIS_NULL;
}
}
}
/*
=================
UI_GamePad_SetConfig
=================
*/
static void UI_GamePad_SetConfig( void )
{
float side, forward, pitch, yaw;
char binding[7] = { 0 };
side = uiGamePad.side.curValue;
if( uiGamePad.invSide.enabled )
side *= -1;
forward = uiGamePad.forward.curValue;
if( uiGamePad.invFwd.enabled )
forward *= -1;
pitch = uiGamePad.pitch.curValue;
if( uiGamePad.invPitch.enabled )
pitch *= -1;
yaw = uiGamePad.yaw.curValue;
if( uiGamePad.invYaw.enabled )
yaw *= -1;
for( int i = 0; i < 6; i++ )
{
switch( (int)uiGamePad.axisBind[i].curValue )
{
case JOY_AXIS_SIDE: binding[i] = 's'; break;
case JOY_AXIS_FWD: binding[i] = 'f'; break;
case JOY_AXIS_PITCH: binding[i] = 'p'; break;
case JOY_AXIS_YAW: binding[i] = 'y'; break;
case JOY_AXIS_RT: binding[i] = 'r'; break;
case JOY_AXIS_LT: binding[i] = 'l'; break;
default: binding[i] = '0'; break;
}
}
CVAR_SET_FLOAT( "joy_side", side );
CVAR_SET_FLOAT( "joy_forward", forward );
CVAR_SET_FLOAT( "joy_pitch", pitch );
CVAR_SET_FLOAT( "joy_yaw", yaw );
CVAR_SET_STRING( "joy_axis_binding", binding );
CVAR_SET_STRING( "joy_rt_command", uiGamePad.rt_command.buffer );
CVAR_SET_STRING( "joy_lt_command", uiGamePad.lt_command.buffer );
}
/*
=================
UI_GamePad_UpdateConfig
=================
*/
static void UI_GamePad_UpdateConfig( void )
{
UI_GamePad_SetConfig();
UI_GamePad_GetConfig();
}
/*
=================
UI_GamePad_Callback
=================
*/
static void UI_GamePad_Callback( void *self, int event )
{
menuCommon_s *item = (menuCommon_s *)self;
switch( item->id )
{
case ID_INVERT_SIDE:
case ID_INVERT_FORWARD:
case ID_INVERT_PITCH:
case ID_INVERT_YAW:
if( event == QM_PRESSED )
((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
break;
}
if( event == QM_CHANGED )
{
UI_GamePad_UpdateConfig();
return;
}
if( event != QM_ACTIVATED )
return;
switch( item->id )
{
case ID_DONE:
UI_PopMenu();
break;
}
}
/*
=================
UI_GamePad_Init
=================
*/
static void UI_GamePad_Init( void )
{
memset( &uiGamePad, 0, sizeof( uiGamePad_t ));
uiGamePad.menu.vidInitFunc = UI_GamePad_Init;
uiGamePad.background.generic.id = ID_BACKGROUND;
uiGamePad.background.generic.type = QMTYPE_BITMAP;
uiGamePad.background.generic.flags = QMF_INACTIVE;
uiGamePad.background.generic.x = 0;
uiGamePad.background.generic.y = 0;
uiGamePad.background.generic.width = uiStatic.width;
uiGamePad.background.generic.height = 768;
uiGamePad.background.pic = ART_BACKGROUND;
uiGamePad.banner.generic.id = ID_BANNER;
uiGamePad.banner.generic.type = QMTYPE_BITMAP;
uiGamePad.banner.generic.flags = QMF_INACTIVE|QMF_DRAW_ADDITIVE;
uiGamePad.banner.generic.x = UI_BANNER_POSX;
uiGamePad.banner.generic.y = UI_BANNER_POSY;
uiGamePad.banner.generic.width = UI_BANNER_WIDTH;
uiGamePad.banner.generic.height = UI_BANNER_HEIGHT;
uiGamePad.banner.pic = ART_BANNER;
uiGamePad.done.generic.id = ID_DONE;
uiGamePad.done.generic.type = QMTYPE_BM_BUTTON;
uiGamePad.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiGamePad.done.generic.x = 72;
uiGamePad.done.generic.y = 630;
uiGamePad.done.generic.name = "Done";
uiGamePad.done.generic.statusText = "Go back to the Configuration Menu";
uiGamePad.done.generic.callback = UI_GamePad_Callback;
UI_UtilSetupPicButton( &uiGamePad.done, PC_DONE );
uiGamePad.axisBind_label.generic.type = QMTYPE_ACTION;
uiGamePad.axisBind_label.generic.flags = QMF_CENTER_JUSTIFY|QMF_INACTIVE|QMF_DROPSHADOW;
uiGamePad.axisBind_label.generic.x = 52;
uiGamePad.axisBind_label.generic.y = 180;
uiGamePad.axisBind_label.generic.color = uiColorHelp;
uiGamePad.axisBind_label.generic.height = 26;
uiGamePad.axisBind_label.generic.width = 200;
uiGamePad.axisBind_label.generic.charHeight = 30;
uiGamePad.axisBind_label.generic.charWidth = 17;
uiGamePad.axisBind_label.generic.callback = UI_GamePad_Callback;
uiGamePad.axisBind_label.generic.name = "Axis binding map";
for( int i = 0, y = 230; i < 6; i++, y += 50 )
{
uiGamePad.axisBind[i].generic.id = ID_AXIS_BIND1 + i;
uiGamePad.axisBind[i].generic.type = QMTYPE_SPINCONTROL;
uiGamePad.axisBind[i].generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiGamePad.axisBind[i].generic.x = 72;
uiGamePad.axisBind[i].generic.y = y;
uiGamePad.axisBind[i].generic.height = 26;
uiGamePad.axisBind[i].generic.width = 256;
uiGamePad.axisBind[i].generic.charWidth = 11;
uiGamePad.axisBind[i].generic.charHeight = 22;
uiGamePad.axisBind[i].generic.callback = UI_GamePad_Callback;
uiGamePad.axisBind[i].generic.statusText = "Set axis binding";
uiGamePad.axisBind[i].minValue = JOY_AXIS_SIDE;
uiGamePad.axisBind[i].maxValue = JOY_AXIS_NULL;
uiGamePad.axisBind[i].range = 1;
}
uiGamePad.side.generic.id = ID_SIDE;
uiGamePad.side.generic.type = QMTYPE_SLIDER;
uiGamePad.side.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiGamePad.side.generic.x = 400;
uiGamePad.side.generic.y = 250;
uiGamePad.side.generic.callback = UI_GamePad_Callback;
uiGamePad.side.generic.name = "Side";
uiGamePad.side.generic.statusText = "Side movement sensitivity";
uiGamePad.side.minValue = 0.0f;
uiGamePad.side.maxValue = 2.0f;
uiGamePad.side.range = 0.1f;
uiGamePad.invSide.generic.id = ID_INVERT_SIDE;
uiGamePad.invSide.generic.type = QMTYPE_CHECKBOX;
uiGamePad.invSide.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiGamePad.invSide.generic.name = "Invert";
uiGamePad.invSide.generic.x = 620;
uiGamePad.invSide.generic.y = 230;
uiGamePad.invSide.generic.callback = UI_GamePad_Callback;
uiGamePad.invSide.generic.statusText = "Invert side movement axis";
uiGamePad.forward.generic.id = ID_FORWARD;
uiGamePad.forward.generic.type = QMTYPE_SLIDER;
uiGamePad.forward.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiGamePad.forward.generic.x = 400;
uiGamePad.forward.generic.y = 300;
uiGamePad.forward.generic.callback = UI_GamePad_Callback;
uiGamePad.forward.generic.name = "Forward";
uiGamePad.forward.generic.statusText = "Forward movement sensitivity";
uiGamePad.forward.minValue = 0.0f;
uiGamePad.forward.maxValue = 2.0f;
uiGamePad.forward.range = 0.1f;
uiGamePad.invFwd.generic.id = ID_INVERT_FORWARD;
uiGamePad.invFwd.generic.type = QMTYPE_CHECKBOX;
uiGamePad.invFwd.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiGamePad.invFwd.generic.name = "Invert";
uiGamePad.invFwd.generic.x = 620;
uiGamePad.invFwd.generic.y = 280;
uiGamePad.invFwd.generic.callback = UI_GamePad_Callback;
uiGamePad.invFwd.generic.statusText = "Invert forward movement axis";
uiGamePad.pitch.generic.id = ID_PITCH;
uiGamePad.pitch.generic.type = QMTYPE_SLIDER;
uiGamePad.pitch.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiGamePad.pitch.generic.x = 400;
uiGamePad.pitch.generic.y = 350;
uiGamePad.pitch.generic.callback = UI_GamePad_Callback;
uiGamePad.pitch.generic.name = "Pitch";
uiGamePad.pitch.generic.statusText = "Pitch rotating sensitivity";
uiGamePad.pitch.minValue = 0.0f;
uiGamePad.pitch.maxValue = 200.0f;
uiGamePad.pitch.range = 1.0f;
uiGamePad.invPitch.generic.id = ID_INVERT_PITCH;
uiGamePad.invPitch.generic.type = QMTYPE_CHECKBOX;
uiGamePad.invPitch.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiGamePad.invPitch.generic.name = "Invert";
uiGamePad.invPitch.generic.x = 620;
uiGamePad.invPitch.generic.y = 330;
uiGamePad.invPitch.generic.callback = UI_GamePad_Callback;
uiGamePad.invPitch.generic.statusText = "Invert pitch axis";
uiGamePad.yaw.generic.id = ID_YAW;
uiGamePad.yaw.generic.type = QMTYPE_SLIDER;
uiGamePad.yaw.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiGamePad.yaw.generic.x = 400;
uiGamePad.yaw.generic.y = 400;
uiGamePad.yaw.generic.callback = UI_GamePad_Callback;
uiGamePad.yaw.generic.name = "Yaw";
uiGamePad.yaw.generic.statusText = "Yaw rotating sensitivity";
uiGamePad.yaw.minValue = 0.0f;
uiGamePad.yaw.maxValue = 200.0f;
uiGamePad.yaw.range = 1.0f;
uiGamePad.invYaw.generic.id = ID_INVERT_YAW;
uiGamePad.invYaw.generic.type = QMTYPE_CHECKBOX;
uiGamePad.invYaw.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiGamePad.invYaw.generic.name = "Invert";
uiGamePad.invYaw.generic.x = 620;
uiGamePad.invYaw.generic.y = 380;
uiGamePad.invYaw.generic.callback = UI_GamePad_Callback;
uiGamePad.invYaw.generic.statusText = "Invert yaw axis";
uiGamePad.rt_command.generic.id = ID_RT_COMMAND;
uiGamePad.rt_command.generic.type = QMTYPE_FIELD;
uiGamePad.rt_command.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiGamePad.rt_command.generic.x = 400;
uiGamePad.rt_command.generic.y = 430;
uiGamePad.rt_command.generic.height = 26;
uiGamePad.rt_command.generic.width = 200;
uiGamePad.rt_command.generic.charHeight = 22;
uiGamePad.rt_command.generic.charWidth = 14;
uiGamePad.rt_command.generic.callback = UI_GamePad_Callback;
uiGamePad.rt_command.generic.statusText = "When execute right trigger command";
uiGamePad.lt_command.generic.id = ID_LT_COMMAND;
uiGamePad.lt_command.generic.type = QMTYPE_FIELD;
uiGamePad.lt_command.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiGamePad.lt_command.generic.x = 400;
uiGamePad.lt_command.generic.y = 480;
uiGamePad.lt_command.generic.height = 26;
uiGamePad.lt_command.generic.width = 200;
uiGamePad.lt_command.generic.charHeight = 22;
uiGamePad.lt_command.generic.charWidth = 14;
uiGamePad.lt_command.generic.callback = UI_GamePad_Callback;
uiGamePad.lt_command.generic.statusText = "When execute left trigger command";
uiGamePad.rt_command_label.generic.type = QMTYPE_ACTION;
uiGamePad.rt_command_label.generic.flags = QMF_CENTER_JUSTIFY|QMF_INACTIVE|QMF_DROPSHADOW;
uiGamePad.rt_command_label.generic.x = 610;
uiGamePad.rt_command_label.generic.y = 430;
uiGamePad.rt_command_label.generic.color = uiColorHelp;
uiGamePad.rt_command_label.generic.height = 26;
uiGamePad.rt_command_label.generic.width = 200;
uiGamePad.rt_command_label.generic.charHeight = 22;
uiGamePad.rt_command_label.generic.charWidth = 11;
uiGamePad.rt_command_label.generic.callback = UI_GamePad_Callback;
uiGamePad.rt_command_label.generic.name = "Right trigger command";
uiGamePad.lt_command_label.generic.type = QMTYPE_ACTION;
uiGamePad.lt_command_label.generic.flags = QMF_CENTER_JUSTIFY|QMF_INACTIVE|QMF_DROPSHADOW;
uiGamePad.lt_command_label.generic.x = 610;
uiGamePad.lt_command_label.generic.y = 480;
uiGamePad.lt_command_label.generic.color = uiColorHelp;
uiGamePad.lt_command_label.generic.height = 26;
uiGamePad.lt_command_label.generic.width = 200;
uiGamePad.lt_command_label.generic.charHeight = 22;
uiGamePad.lt_command_label.generic.charWidth = 11;
uiGamePad.lt_command_label.generic.callback = UI_GamePad_Callback;
uiGamePad.lt_command_label.generic.name = "Left trigger command";
UI_GamePad_GetConfig();
UI_AddItem( &uiGamePad.menu, &uiGamePad.background );
UI_AddItem( &uiGamePad.menu, &uiGamePad.done );
for( int i = 0; i < 6; i++ )
{
UI_AddItem( &uiGamePad.menu, &uiGamePad.axisBind[i] );
}
UI_AddItem( &uiGamePad.menu, &uiGamePad.side );
UI_AddItem( &uiGamePad.menu, &uiGamePad.invSide );
UI_AddItem( &uiGamePad.menu, &uiGamePad.forward );
UI_AddItem( &uiGamePad.menu, &uiGamePad.invFwd );
UI_AddItem( &uiGamePad.menu, &uiGamePad.pitch );
UI_AddItem( &uiGamePad.menu, &uiGamePad.invPitch );
UI_AddItem( &uiGamePad.menu, &uiGamePad.yaw );
UI_AddItem( &uiGamePad.menu, &uiGamePad.invYaw );
UI_AddItem( &uiGamePad.menu, &uiGamePad.rt_command );
UI_AddItem( &uiGamePad.menu, &uiGamePad.lt_command );
UI_AddItem( &uiGamePad.menu, &uiGamePad.lt_command_label );
UI_AddItem( &uiGamePad.menu, &uiGamePad.rt_command_label );
UI_AddItem( &uiGamePad.menu, &uiGamePad.axisBind_label );
}
/*
=================
UI_GamePad_Precache
=================
*/
void UI_GamePad_Precache( void )
{
PIC_Load( ART_BACKGROUND );
PIC_Load( ART_BANNER );
}
/*
=================
UI_GamePad_Menu
=================
*/
void UI_GamePad_Menu( void )
{
UI_GamePad_Precache();
UI_GamePad_Init();
UI_GamePad_UpdateConfig();
UI_PushMenu( &uiGamePad.menu );
}

View File

@ -41,11 +41,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ID_YES 130
#define ID_NO 131
#define GAME_LENGTH 18
#define MAPNAME_LENGTH 20+GAME_LENGTH
#define TYPE_LENGTH 16+MAPNAME_LENGTH
#define MAXCL_LENGTH 15+TYPE_LENGTH
typedef struct
{
char gameDescription[UI_MAX_SERVERS][256];
@ -122,23 +117,28 @@ static void UI_InternetGames_GetGamesList( void )
for( i = 0; i < uiStatic.numServers; i++ )
{
if( i >= UI_MAX_SERVERS ) break;
if( i >= UI_MAX_SERVERS )
break;
info = uiStatic.serverNames[i];
StringConcat( uiInternetGames.gameDescription[i], Info_ValueForKey( info, "host" ), GAME_LENGTH );
AddSpaces( uiInternetGames.gameDescription[i], GAME_LENGTH );
StringConcat( uiInternetGames.gameDescription[i], Info_ValueForKey( info, "map" ), MAPNAME_LENGTH );
AddSpaces( uiInternetGames.gameDescription[i], MAPNAME_LENGTH );
if( !strcmp( Info_ValueForKey( info, "dm" ), "1" ))
StringConcat( uiInternetGames.gameDescription[i], "deathmatch", TYPE_LENGTH );
else if( !strcmp( Info_ValueForKey( info, "coop" ), "1" ))
StringConcat( uiInternetGames.gameDescription[i], "coop", TYPE_LENGTH );
else if( !strcmp( Info_ValueForKey( info, "team" ), "1" ))
StringConcat( uiInternetGames.gameDescription[i], "teamplay", TYPE_LENGTH );
AddSpaces( uiInternetGames.gameDescription[i], TYPE_LENGTH );
StringConcat( uiInternetGames.gameDescription[i], Info_ValueForKey( info, "numcl" ), MAXCL_LENGTH );
StringConcat( uiInternetGames.gameDescription[i], "\\", MAXCL_LENGTH );
StringConcat( uiInternetGames.gameDescription[i], Info_ValueForKey( info, "maxcl" ), MAXCL_LENGTH );
AddSpaces( uiInternetGames.gameDescription[i], MAXCL_LENGTH );
uiInternetGames.gameDescription[i][0] = 0; // mark this string as empty
StringConcat( uiInternetGames.gameDescription[i], Info_ValueForKey( info, "host" ), QMSB_GAME_LENGTH );
AddSpaces( uiInternetGames.gameDescription[i], QMSB_GAME_LENGTH );
StringConcat( uiInternetGames.gameDescription[i], Info_ValueForKey( info, "map" ), QMSB_MAPNAME_LENGTH );
AddSpaces( uiInternetGames.gameDescription[i], QMSB_MAPNAME_LENGTH );
StringConcat( uiInternetGames.gameDescription[i], Info_ValueForKey( info, "numcl" ), QMSB_MAXCL_LENGTH );
StringConcat( uiInternetGames.gameDescription[i], "\\", QMSB_MAXCL_LENGTH );
StringConcat( uiInternetGames.gameDescription[i], Info_ValueForKey( info, "maxcl" ), QMSB_MAXCL_LENGTH );
AddSpaces( uiInternetGames.gameDescription[i], QMSB_MAXCL_LENGTH );
char ping[10];
snprintf( ping, 10, "%.f ms", uiStatic.serverPings[i] * 1000 );
StringConcat( uiInternetGames.gameDescription[i], ping, QMSB_PING_LENGTH );
AddSpaces( uiInternetGames.gameDescription[i], QMSB_PING_LENGTH );
uiInternetGames.gameDescriptionPtr[i] = uiInternetGames.gameDescription[i];
}
@ -147,6 +147,7 @@ static void UI_InternetGames_GetGamesList( void )
uiInternetGames.gameList.itemNames = (const char **)uiInternetGames.gameDescriptionPtr;
uiInternetGames.gameList.numItems = 0; // reset it
uiInternetGames.gameList.curItem = 0; // reset it
if( !uiInternetGames.gameList.generic.charHeight )
return; // to avoid divide integer by zero
@ -183,8 +184,6 @@ UI_Background_Ownerdraw
*/
static void UI_Background_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
if( !CVAR_GET_FLOAT( "cl_background" ))
UI_DrawBackground_Callback( self );
@ -267,14 +266,14 @@ static void UI_InternetGames_Init( void )
uiInternetGames.menu.vidInitFunc = UI_InternetGames_Init;
uiInternetGames.menu.keyFunc = UI_InternetGames_KeyFunc;
StringConcat( uiInternetGames.hintText, "Game", GAME_LENGTH );
AddSpaces( uiInternetGames.hintText, GAME_LENGTH );
StringConcat( uiInternetGames.hintText, "Map", MAPNAME_LENGTH );
AddSpaces( uiInternetGames.hintText, MAPNAME_LENGTH );
StringConcat( uiInternetGames.hintText, "Type", TYPE_LENGTH );
AddSpaces( uiInternetGames.hintText, TYPE_LENGTH );
StringConcat( uiInternetGames.hintText, "Num/Max Clients", MAXCL_LENGTH );
AddSpaces( uiInternetGames.hintText, MAXCL_LENGTH );
StringConcat( uiInternetGames.hintText, "Name", QMSB_GAME_LENGTH );
AddSpaces( uiInternetGames.hintText, QMSB_GAME_LENGTH );
StringConcat( uiInternetGames.hintText, "Map", QMSB_MAPNAME_LENGTH );
AddSpaces( uiInternetGames.hintText, QMSB_MAPNAME_LENGTH );
StringConcat( uiInternetGames.hintText, "Players", QMSB_MAXCL_LENGTH );
AddSpaces( uiInternetGames.hintText, QMSB_MAXCL_LENGTH );
StringConcat( uiInternetGames.hintText, "Ping", QMSB_PING_LENGTH );
AddSpaces( uiInternetGames.hintText, QMSB_PING_LENGTH );
uiInternetGames.background.generic.id = ID_BACKGROUND;
uiInternetGames.background.generic.type = QMTYPE_BITMAP;
@ -398,15 +397,15 @@ static void UI_InternetGames_Init( void )
uiInternetGames.hintMessage.generic.flags = QMF_INACTIVE|QMF_SMALLFONT;
uiInternetGames.hintMessage.generic.color = uiColorHelp;
uiInternetGames.hintMessage.generic.name = uiInternetGames.hintText;
uiInternetGames.hintMessage.generic.x = 360;
uiInternetGames.hintMessage.generic.x = 340;
uiInternetGames.hintMessage.generic.y = 225;
uiInternetGames.gameList.generic.id = ID_SERVERSLIST;
uiInternetGames.gameList.generic.type = QMTYPE_SCROLLLIST;
uiInternetGames.gameList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_SMALLFONT;
uiInternetGames.gameList.generic.x = 360;
uiInternetGames.gameList.generic.x = 340;
uiInternetGames.gameList.generic.y = 255;
uiInternetGames.gameList.generic.width = 640;
uiInternetGames.gameList.generic.width = 660;
uiInternetGames.gameList.generic.height = 440;
uiInternetGames.gameList.generic.callback = UI_InternetGames_Callback;
uiInternetGames.gameList.itemNames = (const char **)uiInternetGames.gameDescriptionPtr;
@ -465,5 +464,8 @@ void UI_InternetGames_Menu( void )
UI_InternetGames_Precache();
UI_InternetGames_Init();
uiInternetGames.refreshTime = uiStatic.realTime + 10000; // refresh every 10 secs
UI_RefreshInternetServerList();
UI_PushMenu( &uiInternetGames.menu );
}

View File

@ -41,11 +41,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ID_YES 130
#define ID_NO 131
#define GAME_LENGTH 18
#define MAPNAME_LENGTH 20+GAME_LENGTH
#define TYPE_LENGTH 16+MAPNAME_LENGTH
#define MAXCL_LENGTH 15+TYPE_LENGTH
typedef struct
{
char gameDescription[UI_MAX_SERVERS][256];
@ -124,28 +119,25 @@ static void UI_LanGame_GetGamesList( void )
{
if( i >= UI_MAX_SERVERS ) break;
info = uiStatic.serverNames[i];
#if 1
// NOTE: Xash3D is support hot switching between games in multiplayer
// but this feature not detail tested and may be bugly
if( stricmp( gMenu.m_gameinfo.gamefolder, Info_ValueForKey( info, "gamedir" )))
continue; // filter by game
#endif
StringConcat( uiLanGame.gameDescription[i], Info_ValueForKey( info, "host" ), GAME_LENGTH );
AddSpaces( uiLanGame.gameDescription[i], GAME_LENGTH );
StringConcat( uiLanGame.gameDescription[i], Info_ValueForKey( info, "map" ), MAPNAME_LENGTH );
AddSpaces( uiLanGame.gameDescription[i], MAPNAME_LENGTH );
if( !strcmp( Info_ValueForKey( info, "dm" ), "1" ))
StringConcat( uiLanGame.gameDescription[i], "deathmatch", TYPE_LENGTH );
else if( !strcmp( Info_ValueForKey( info, "coop" ), "1" ))
StringConcat( uiLanGame.gameDescription[i], "coop", TYPE_LENGTH );
else if( !strcmp( Info_ValueForKey( info, "team" ), "1" ))
StringConcat( uiLanGame.gameDescription[i], "teamplay", TYPE_LENGTH );
AddSpaces( uiLanGame.gameDescription[i], TYPE_LENGTH );
StringConcat( uiLanGame.gameDescription[i], Info_ValueForKey( info, "numcl" ), MAXCL_LENGTH );
StringConcat( uiLanGame.gameDescription[i], "\\", MAXCL_LENGTH );
StringConcat( uiLanGame.gameDescription[i], Info_ValueForKey( info, "maxcl" ), MAXCL_LENGTH );
AddSpaces( uiLanGame.gameDescription[i], MAXCL_LENGTH );
uiLanGame.gameDescription[i][0] = 0; // mark this string as empty
StringConcat( uiLanGame.gameDescription[i], Info_ValueForKey( info, "host" ), QMSB_GAME_LENGTH );
AddSpaces( uiLanGame.gameDescription[i], QMSB_GAME_LENGTH );
StringConcat( uiLanGame.gameDescription[i], Info_ValueForKey( info, "map" ), QMSB_MAPNAME_LENGTH );
AddSpaces( uiLanGame.gameDescription[i], QMSB_MAPNAME_LENGTH );
StringConcat( uiLanGame.gameDescription[i], Info_ValueForKey( info, "numcl" ), QMSB_MAXCL_LENGTH );
StringConcat( uiLanGame.gameDescription[i], "\\", QMSB_MAXCL_LENGTH );
StringConcat( uiLanGame.gameDescription[i], Info_ValueForKey( info, "maxcl" ), QMSB_MAXCL_LENGTH );
AddSpaces( uiLanGame.gameDescription[i], QMSB_MAXCL_LENGTH );
char ping[10];
snprintf( ping, 10, "%.f ms", uiStatic.serverPings[i] * 1000 );
StringConcat( uiLanGame.gameDescription[i], ping, QMSB_PING_LENGTH );
AddSpaces( uiLanGame.gameDescription[i], QMSB_PING_LENGTH );
uiLanGame.gameDescriptionPtr[i] = uiLanGame.gameDescription[i];
}
@ -190,8 +182,6 @@ UI_Background_Ownerdraw
*/
static void UI_Background_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
if( !CVAR_GET_FLOAT( "cl_background" ))
UI_DrawBackground_Callback( self );
@ -274,14 +264,14 @@ static void UI_LanGame_Init( void )
uiLanGame.menu.vidInitFunc = UI_LanGame_Init;
uiLanGame.menu.keyFunc = UI_LanGame_KeyFunc;
StringConcat( uiLanGame.hintText, "Game", GAME_LENGTH );
AddSpaces( uiLanGame.hintText, GAME_LENGTH );
StringConcat( uiLanGame.hintText, "Map", MAPNAME_LENGTH );
AddSpaces( uiLanGame.hintText, MAPNAME_LENGTH );
StringConcat( uiLanGame.hintText, "Type", TYPE_LENGTH );
AddSpaces( uiLanGame.hintText, TYPE_LENGTH );
StringConcat( uiLanGame.hintText, "Num/Max Clients", MAXCL_LENGTH );
AddSpaces( uiLanGame.hintText, MAXCL_LENGTH );
StringConcat( uiLanGame.hintText, "Name", QMSB_GAME_LENGTH );
AddSpaces( uiLanGame.hintText, QMSB_GAME_LENGTH );
StringConcat( uiLanGame.hintText, "Map", QMSB_MAPNAME_LENGTH );
AddSpaces( uiLanGame.hintText, QMSB_MAPNAME_LENGTH );
StringConcat( uiLanGame.hintText, "Players", QMSB_MAXCL_LENGTH );
AddSpaces( uiLanGame.hintText, QMSB_MAXCL_LENGTH );
StringConcat( uiLanGame.hintText, "Ping", QMSB_PING_LENGTH );
AddSpaces( uiLanGame.hintText, QMSB_PING_LENGTH );
uiLanGame.background.generic.id = ID_BACKGROUND;
uiLanGame.background.generic.type = QMTYPE_BITMAP;
@ -411,9 +401,9 @@ static void UI_LanGame_Init( void )
uiLanGame.gameList.generic.id = ID_SERVERSLIST;
uiLanGame.gameList.generic.type = QMTYPE_SCROLLLIST;
uiLanGame.gameList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_SMALLFONT;
uiLanGame.gameList.generic.x = 360;
uiLanGame.gameList.generic.x = 340;
uiLanGame.gameList.generic.y = 255;
uiLanGame.gameList.generic.width = 640;
uiLanGame.gameList.generic.width = 660;
uiLanGame.gameList.generic.height = 440;
uiLanGame.gameList.generic.callback = UI_LanGame_Callback;
uiLanGame.gameList.itemNames = (const char **)uiLanGame.gameDescriptionPtr;
@ -472,5 +462,8 @@ void UI_LanGame_Menu( void )
UI_LanGame_Precache();
UI_LanGame_Init();
uiLanGame.refreshTime = uiStatic.realTime + 10000; // refresh every 10 secs
UI_RefreshServerList();
UI_PushMenu( &uiLanGame.menu );
}

View File

@ -41,12 +41,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ID_SAVERESTORE 6
#define ID_MULTIPLAYER 7
#define ID_CUSTOMGAME 8
#define ID_PREVIEWS 9
#define ID_credits 9
#define ID_QUIT 10
#define ID_QUIT_BUTTON 11
#define ID_MINIMIZE 12
#define ID_MSGBOX 13
#define ID_MSGTEXT 14
#define ID_DISCONNECT 15
#define ID_YES 130
#define ID_NO 131
@ -57,9 +58,10 @@ typedef struct
menuBitmap_s background;
menuPicButton_s console;
menuPicButton_s resumeGame;
menuPicButton_s disconnect;
menuPicButton_s configuration;
menuPicButton_s credits;
menuPicButton_s multiPlayer;
menuPicButton_s credits;
menuPicButton_s quit;
menuBitmap_s minimizeBtn;
@ -94,8 +96,6 @@ UI_Background_Ownerdraw
*/
static void UI_Background_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
// map has background
if( CVAR_GET_FLOAT( "cl_background" ))
return;
@ -119,7 +119,6 @@ static void UI_Background_Ownerdraw( void *self )
logoPosY = 70 * scaleY; // 70 it's empirically determined value (magic number)
DRAW_LOGO( "logo.avi", 0, logoPosY, logoWidth, logoHeight );
//UI_DrawPic( 0, logoPosY, logoWidth, logoHeight)
}
static void UI_QuitDialog( void )
@ -128,8 +127,10 @@ static void UI_QuitDialog( void )
// show\hide quit dialog
uiMain.console.generic.flags ^= QMF_INACTIVE;
uiMain.resumeGame.generic.flags ^= QMF_INACTIVE;
uiMain.disconnect.generic.flags ^= QMF_INACTIVE;
uiMain.configuration.generic.flags ^= QMF_INACTIVE;
uiMain.multiPlayer.generic.flags ^= QMF_INACTIVE;
uiMain.credits.generic.flags ^= QMF_INACTIVE;
uiMain.quit.generic.flags ^= QMF_INACTIVE;
uiMain.minimizeBtn.generic.flags ^= QMF_INACTIVE;
uiMain.quitButton.generic.flags ^= QMF_INACTIVE;
@ -147,8 +148,10 @@ static void UI_PromptDialog( void )
// show\hide quit dialog
uiMain.console.generic.flags ^= QMF_INACTIVE;
uiMain.resumeGame.generic.flags ^= QMF_INACTIVE;
uiMain.disconnect.generic.flags ^= QMF_INACTIVE;
uiMain.configuration.generic.flags ^= QMF_INACTIVE;
uiMain.multiPlayer.generic.flags ^= QMF_INACTIVE;
uiMain.credits.generic.flags ^= QMF_INACTIVE;
uiMain.quit.generic.flags ^= QMF_INACTIVE;
uiMain.minimizeBtn.generic.flags ^= QMF_INACTIVE;
uiMain.quitButton.generic.flags ^= QMF_INACTIVE;
@ -191,11 +194,14 @@ UI_Main_ActivateFunc
static void UI_Main_ActivateFunc( void )
{
if ( !CL_IsActive( ))
{
uiMain.resumeGame.generic.flags |= QMF_HIDDEN;
uiMain.disconnect.generic.flags |= QMF_HIDDEN;
}
if( gpGlobals->developer )
{
uiMain.console.generic.y = CL_IsActive() ? 380 : 430;
uiMain.console.generic.y = CL_IsActive() ? 330 : 430;
UI_ScaleCoords( NULL, &uiMain.console.generic.y, NULL, NULL );
}
}
@ -256,14 +262,21 @@ static void UI_Main_Callback( void *self, int event )
case ID_RESUME:
UI_CloseMenu();
break;
case ID_DISCONNECT:
if( CVAR_GET_FLOAT( "host_serverstate" ) )
CLIENT_COMMAND( TRUE, "endgame;wait;wait;wait;menu_options;menu_main\n");
else
CLIENT_COMMAND( TRUE, "cmd disconnect;wait;wait;wait;menu_options;menu_main\n");
UI_Main_Menu();
break;
case ID_MULTIPLAYER:
UI_MultiPlayer_Menu();
break;
case ID_CONFIGURATION:
UI_Options_Menu();
break;
case ID_PREVIEWS:
UI_Credits_Menu( );
case ID_credits:
UI_Credits_Menu();
break;
case ID_QUIT:
case ID_QUIT_BUTTON:
@ -316,7 +329,7 @@ static void UI_Main_Init( void )
uiMain.console.generic.name = "Console";
uiMain.console.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiMain.console.generic.x = 72;
uiMain.console.generic.y = CL_IsActive() ? 330 : 380;
uiMain.console.generic.y = CL_IsActive() ? 330 : 430;
uiMain.console.generic.callback = UI_Main_Callback;
UI_UtilSetupPicButton( &uiMain.console, PC_CONSOLE );
@ -327,26 +340,21 @@ static void UI_Main_Init( void )
uiMain.resumeGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.resumeGame.generic.statusText = MenuStrings[HINT_RESUME_GAME];
uiMain.resumeGame.generic.x = 72;
uiMain.resumeGame.generic.y = 430;
uiMain.resumeGame.generic.y = 380;
uiMain.resumeGame.generic.callback = UI_Main_Callback;
UI_UtilSetupPicButton( &uiMain.resumeGame, PC_RESUME_GAME );
if( !CL_IsActive( ))
{
uiMain.resumeGame.generic.flags |= QMF_HIDDEN;
}
uiMain.disconnect.generic.id = ID_DISCONNECT;
uiMain.disconnect.generic.type = QMTYPE_BM_BUTTON;
uiMain.disconnect.generic.name = "Disconnect";
uiMain.disconnect.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.disconnect.generic.statusText = "Disconnect from server";
uiMain.disconnect.generic.x = 72;
uiMain.disconnect.generic.y = 430;
uiMain.disconnect.generic.callback = UI_Main_Callback;
uiMain.multiPlayer.generic.id = ID_MULTIPLAYER;
uiMain.multiPlayer.generic.type = QMTYPE_BM_BUTTON;
uiMain.multiPlayer.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.multiPlayer.generic.name = "Multiplayer";
uiMain.multiPlayer.generic.statusText = MenuStrings[HINT_MULTIPLAYER];
uiMain.multiPlayer.generic.x = 72;
uiMain.multiPlayer.generic.y = 480 ;
uiMain.multiPlayer.generic.callback = UI_Main_Callback;
UI_UtilSetupPicButton( &uiMain.multiPlayer, PC_MULTIPLAYER );
UI_UtilSetupPicButton( &uiMain.disconnect, PC_DISCONNECT );
uiMain.configuration.generic.id = ID_CONFIGURATION;
uiMain.configuration.generic.type = QMTYPE_BM_BUTTON;
@ -354,24 +362,32 @@ static void UI_Main_Init( void )
uiMain.configuration.generic.name = "Configuration";
uiMain.configuration.generic.statusText = MenuStrings[HINT_CONFIGURATION];
uiMain.configuration.generic.x = 72;
uiMain.configuration.generic.y = 530;
uiMain.configuration.generic.y = 480;
uiMain.configuration.generic.callback = UI_Main_Callback;
UI_UtilSetupPicButton( &uiMain.configuration, PC_CONFIG );
uiMain.credits.generic.id = ID_PREVIEWS;
uiMain.multiPlayer.generic.id = ID_MULTIPLAYER;
uiMain.multiPlayer.generic.type = QMTYPE_BM_BUTTON;
uiMain.multiPlayer.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.multiPlayer.generic.name = "Multiplayer";
uiMain.multiPlayer.generic.statusText = MenuStrings[HINT_MULTIPLAYER];
uiMain.multiPlayer.generic.x = 72;
uiMain.multiPlayer.generic.y = 530;
uiMain.multiPlayer.generic.callback = UI_Main_Callback;
UI_UtilSetupPicButton( &uiMain.multiPlayer, PC_MULTIPLAYER );
uiMain.credits.generic.id = ID_credits;
uiMain.credits.generic.type = QMTYPE_BM_BUTTON;
uiMain.credits.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMain.credits.generic.name = "Credits";
uiMain.credits.generic.statusText = "Developer credits";
uiMain.credits.generic.statusText = "Show developer credits";
uiMain.credits.generic.x = 72;
uiMain.credits.generic.y = 580;
uiMain.credits.generic.callback = UI_Main_Callback;
UI_UtilSetupPicButton( &uiMain.credits, PC_VIEW_README );
if ( gMenu.m_gameinfo.gamemode == GAME_SINGLEPLAYER_ONLY )
uiMain.multiPlayer.generic.flags |= QMF_GRAYED;
UI_UtilSetupPicButton( &uiMain.credits, PC_VIEW_README );
uiMain.quit.generic.id = ID_QUIT;
uiMain.quit.generic.type = QMTYPE_BM_BUTTON;
@ -458,12 +474,11 @@ static void UI_Main_Init( void )
if ( gpGlobals->developer )
UI_AddItem( &uiMain.menu, (void *)&uiMain.console );
UI_AddItem( &uiMain.menu, (void *)&uiMain.disconnect );
UI_AddItem( &uiMain.menu, (void *)&uiMain.resumeGame );
UI_AddItem( &uiMain.menu, (void *)&uiMain.configuration );
UI_AddItem( &uiMain.menu, (void *)&uiMain.multiPlayer );
UI_AddItem( &uiMain.menu, (void *)&uiMain.credits );
UI_AddItem( &uiMain.menu, (void *)&uiMain.credits );
UI_AddItem( &uiMain.menu, (void *)&uiMain.quit );
UI_AddItem( &uiMain.menu, (void *)&uiMain.minimizeBtn );
UI_AddItem( &uiMain.menu, (void *)&uiMain.quitButton );

View File

@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "basemenu.h"
#include "utils.h"
#include "menu_btnsbmp_table.h"
#include "keydefs.h"
#define ART_BANNER "gfx/shell/head_multi"
@ -34,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ID_CUSTOMIZE 5
#define ID_CONTROLS 6
#define ID_DONE 7
#define ID_DEMOS 8
typedef struct
{
menuFramework_s menu;
@ -48,11 +49,22 @@ typedef struct
menuPicButton_s Customize; // playersetup
menuPicButton_s Controls;
menuPicButton_s done;
menuPicButton_s demos;
} uiMultiPlayer_t;
static uiMultiPlayer_t uiMultiPlayer;
/*
=================
UI_MsgBox_Ownerdraw
=================
*/
static void UI_MsgBox_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
UI_FillRect( item->x, item->y, item->width, item->height, uiPromptBgColor );
}
/*
=================
UI_MultiPlayer_Callback
@ -85,9 +97,6 @@ static void UI_MultiPlayer_Callback( void *self, int event )
case ID_DONE:
UI_PopMenu();
break;
case ID_DEMOS:
UI_PlayRec_Menu();
break;
}
}
@ -175,20 +184,11 @@ static void UI_MultiPlayer_Init( void )
UI_UtilSetupPicButton( &uiMultiPlayer.Controls, PC_CONTROLS );
uiMultiPlayer.demos.generic.id = ID_DEMOS;
uiMultiPlayer.demos.generic.type = QMTYPE_BM_BUTTON;
uiMultiPlayer.demos.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMultiPlayer.demos.generic.x = 72;
uiMultiPlayer.demos.generic.y = 480;
uiMultiPlayer.demos.generic.name = "Demos";
uiMultiPlayer.demos.generic.statusText = "Play or record the demos";
uiMultiPlayer.demos.generic.callback = UI_MultiPlayer_Callback;
uiMultiPlayer.done.generic.id = ID_DONE;
uiMultiPlayer.done.generic.type = QMTYPE_BM_BUTTON;
uiMultiPlayer.done.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_NOTIFY;
uiMultiPlayer.done.generic.x = 72;
uiMultiPlayer.done.generic.y = 530;
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;
@ -203,7 +203,6 @@ static void UI_MultiPlayer_Init( void )
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.Customize );
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.Controls );
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.done );
UI_AddItem( &uiMultiPlayer.menu, (void *)&uiMultiPlayer.demos );
}
/*

View File

@ -467,7 +467,7 @@ static void UI_PlayerSetup_Init( void )
uiPlayerSetup.crosshairTranslucent.generic.id = ID_CROSSHAIRCOLOR;
uiPlayerSetup.crosshairTranslucent.generic.type = QMTYPE_CHECKBOX;
uiPlayerSetup.crosshairTranslucent.generic.flags = QMF_HIGHLIGHTIFFOCUS | QMF_ACT_ONRELEASE | QMF_MOUSEONLY | QMF_DROPSHADOW;
uiPlayerSetup.crosshairTranslucent.generic.flags = QMF_HIGHLIGHTIFFOCUS | QMF_ACT_ONRELEASE | QMF_DROPSHADOW;
uiPlayerSetup.crosshairTranslucent.generic.x = 320;
uiPlayerSetup.crosshairTranslucent.generic.y = 420;
uiPlayerSetup.crosshairTranslucent.generic.callback = UI_PlayerSetup_Callback;

View File

@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "utils.h"
#include "menu_btnsbmp_table.h"
#include "mobility_int.h"
#define ART_BANNER "gfx/shell/head_touch_buttons"
#define ID_BACKGROUND 0
@ -51,6 +53,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ID_ADDITIVE 24
#define ID_EDITOR 25
#define ID_CANCEL 26
#define ID_PRECISION 27
#define ID_YES 130
#define ID_NO 131
typedef struct
@ -82,6 +85,7 @@ typedef struct
menuCheckBox_s mp;
menuCheckBox_s lock;
menuCheckBox_s additive;
menuCheckBox_s precision;
menuPicButton_s reset;
menuPicButton_s remove;
menuPicButton_s save;
@ -106,18 +110,6 @@ typedef struct
static uiTouchButtons_t uiTouchButtons;
#define BIT(i) ( 1<<i )
#define TOUCH_FL_HIDE BIT( 0 )
#define TOUCH_FL_NOEDIT BIT( 1 )
#define TOUCH_FL_CLIENT BIT( 2 )
#define TOUCH_FL_MP BIT( 3 )
#define TOUCH_FL_SP BIT( 4 )
#define TOUCH_FL_DEF_SHOW BIT( 5 )
#define TOUCH_FL_DEF_HIDE BIT( 6 )
#define TOUCH_FL_DRAW_ADDITIVE BIT( 7 )
#define TOUCH_FL_STROKE BIT( 8 )
static void UI_TouchButtons_UpdateFields( void );
void UI_TouchButtons_AddButtonToList( const char *name, const char *texture, const char *command, unsigned char *color, int flags )
@ -198,7 +190,7 @@ static void UI_Color_Ownerdraw( void *self )
static void UI_DeleteButton()
{
char command[256];
snprintf(command, 256, "touch_removebutton %s\n", uiTouchButtons.selectedName );
snprintf(command, 256, "touch_removebutton \"%s\"\n", uiTouchButtons.selectedName );
CLIENT_COMMAND(1, command);
UI_TouchButtons_GetButtonList();
}
@ -206,7 +198,7 @@ static void UI_DeleteButton()
static void UI_ResetButtons()
{
CLIENT_COMMAND( 0, "touch_removeall\n" );
CLIENT_COMMAND( 0, "touch_loaddefaults\n" );
CLIENT_COMMAND( 1, "touch_loaddefaults\n" );
UI_TouchButtons_GetButtonList();
}
@ -225,6 +217,7 @@ static void UI_TouchButtons_UpdateFields()
uiTouchButtons.lock.enabled = !!( uiTouchButtons.curflags & TOUCH_FL_NOEDIT );
uiTouchButtons.hide.enabled = !!( uiTouchButtons.curflags & TOUCH_FL_HIDE );
uiTouchButtons.additive.enabled = !!( uiTouchButtons.curflags & TOUCH_FL_DRAW_ADDITIVE );
uiTouchButtons.precision.enabled = !!( uiTouchButtons.curflags & TOUCH_FL_PRECISION );
if( uiTouchButtons.texture.buffer[0] && uiTouchButtons.texture.buffer[0] != '#' )
uiTouchButtons.textureid = PIC_Load(uiTouchButtons.texture.buffer);
else
@ -262,6 +255,7 @@ static void UI_TouchButtons_DisableButtons()
uiTouchButtons.mp.generic.flags |= QMF_INACTIVE;
uiTouchButtons.lock.generic.flags |= QMF_INACTIVE;
uiTouchButtons.additive.generic.flags |= QMF_INACTIVE;
uiTouchButtons.precision.generic.flags |= QMF_INACTIVE;
uiTouchButtons.editor.generic.flags |= QMF_INACTIVE;
}
static void UI_TouchButtons_EnableButtons()
@ -283,6 +277,7 @@ static void UI_TouchButtons_EnableButtons()
uiTouchButtons.mp.generic.flags &= ~QMF_INACTIVE;
uiTouchButtons.lock.generic.flags &= ~QMF_INACTIVE;
uiTouchButtons.additive.generic.flags &= ~QMF_INACTIVE;
uiTouchButtons.precision.generic.flags &= ~QMF_INACTIVE;
uiTouchButtons.editor.generic.flags &= ~QMF_INACTIVE;
}
static void UI_TouchButtons_FileDialogCallback( bool success )
@ -315,12 +310,13 @@ static void UI_TouchButtons_Callback( void *self, int event )
uiTouchButtons.sp.enabled = false;
case ID_HIDE:
case ID_ADDITIVE:
case ID_PRECISION:
case ID_LOCK:
if( event == QM_PRESSED )
((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
// clean all flags that we may change
uiTouchButtons.curflags &= ~ ( TOUCH_FL_HIDE | TOUCH_FL_NOEDIT | TOUCH_FL_MP | TOUCH_FL_SP | TOUCH_FL_DRAW_ADDITIVE );
uiTouchButtons.curflags &= ~ ( TOUCH_FL_HIDE | TOUCH_FL_NOEDIT | TOUCH_FL_MP | TOUCH_FL_SP | TOUCH_FL_DRAW_ADDITIVE | TOUCH_FL_PRECISION );
if( uiTouchButtons.mp.enabled )
uiTouchButtons.curflags |= TOUCH_FL_MP;
if( uiTouchButtons.sp.enabled )
@ -331,6 +327,8 @@ static void UI_TouchButtons_Callback( void *self, int event )
uiTouchButtons.curflags |= TOUCH_FL_NOEDIT;
if( uiTouchButtons.additive.enabled )
uiTouchButtons.curflags |= TOUCH_FL_DRAW_ADDITIVE;
if( uiTouchButtons.precision.enabled )
uiTouchButtons.curflags |= TOUCH_FL_PRECISION;
break;
}
@ -456,7 +454,7 @@ static void UI_TouchButtons_Init( void )
//uiTouchOptions.hTestImage = PIC_Load( ART_GAMMA, PIC_KEEP_RGBDATA );
uiTouchButtons.menu.vidInitFunc = UI_TouchButtons_Init;
//uiTouchButtons.menu.vidInitFunc = UI_TouchButtons_Init;
uiTouchButtons.initialized = true;
uiTouchButtons.background.generic.id = ID_BACKGROUND;
@ -504,7 +502,7 @@ static void UI_TouchButtons_Init( void )
uiTouchButtons.cancel.generic.x = 72;
uiTouchButtons.cancel.generic.y = 600;
uiTouchButtons.cancel.generic.name = "Cancel";
uiTouchButtons.cancel.generic.statusText = "Discard changes and go back to the Video Menu";
uiTouchButtons.cancel.generic.statusText = "Discard changes and go back to the Touch Menu";
uiTouchButtons.cancel.generic.callback = UI_TouchButtons_Callback;
UI_UtilSetupPicButton( &uiTouchButtons.cancel, PC_CANCEL );
@ -570,7 +568,7 @@ static void UI_TouchButtons_Init( void )
uiTouchButtons.additive.generic.type = QMTYPE_CHECKBOX;
uiTouchButtons.additive.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiTouchButtons.additive.generic.name = "Additive";
uiTouchButtons.additive.generic.x = 384 - 72 + 400;
uiTouchButtons.additive.generic.x = 650;
uiTouchButtons.additive.generic.y = 470;
uiTouchButtons.additive.generic.callback = UI_TouchButtons_Callback;
uiTouchButtons.additive.generic.statusText = "Set button additive draw mode";
@ -602,6 +600,14 @@ static void UI_TouchButtons_Init( void )
uiTouchButtons.lock.generic.callback = UI_TouchButtons_Callback;
uiTouchButtons.lock.generic.statusText = "Lock button editing";
uiTouchButtons.precision.generic.id = ID_PRECISION;
uiTouchButtons.precision.generic.type = QMTYPE_CHECKBOX;
uiTouchButtons.precision.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiTouchButtons.precision.generic.name = "Look precision";
uiTouchButtons.precision.generic.x = 400;
uiTouchButtons.precision.generic.y = 470;
uiTouchButtons.precision.generic.callback = UI_TouchButtons_Callback;
uiTouchButtons.precision.generic.statusText = "Increase look precision";
uiTouchButtons.buttonList.generic.id = ID_BUTTONLIST;
uiTouchButtons.buttonList.generic.type = QMTYPE_SCROLLLIST;
@ -616,7 +622,7 @@ static void UI_TouchButtons_Init( void )
uiTouchButtons.save.generic.type = QMTYPE_BM_BUTTON;
uiTouchButtons.save.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW | QMF_ACT_ONRELEASE;
uiTouchButtons.save.generic.x = 384 - 72 + 320;
uiTouchButtons.save.generic.y = 520;
uiTouchButtons.save.generic.y = 550;
uiTouchButtons.save.generic.name = "Save";
uiTouchButtons.save.generic.statusText = "Save as new button";
uiTouchButtons.save.generic.callback = UI_TouchButtons_Callback;
@ -626,7 +632,7 @@ static void UI_TouchButtons_Init( void )
uiTouchButtons.editor.generic.type = QMTYPE_BM_BUTTON;
uiTouchButtons.editor.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW | QMF_ACT_ONRELEASE;
uiTouchButtons.editor.generic.x = 384 - 72 + 320;
uiTouchButtons.editor.generic.y = 580;
uiTouchButtons.editor.generic.y = 600;
uiTouchButtons.editor.generic.name = "Editor";
uiTouchButtons.editor.generic.statusText = "Open interactive editor";
uiTouchButtons.editor.generic.callback = UI_TouchButtons_Callback;
@ -647,7 +653,7 @@ static void UI_TouchButtons_Init( void )
uiTouchButtons.name.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiTouchButtons.name.generic.name = "New Button:";
uiTouchButtons.name.generic.x = 400;
uiTouchButtons.name.generic.y = 520;
uiTouchButtons.name.generic.y = 550;
uiTouchButtons.name.generic.width = 205;
uiTouchButtons.name.generic.height = 32;
uiTouchButtons.name.generic.callback = UI_TouchButtons_Callback;
@ -734,7 +740,7 @@ static void UI_TouchButtons_Init( void )
uiTouchButtons.reset.generic.flags = QMF_HIGHLIGHTIFFOCUS | QMF_DROPSHADOW | QMF_ACT_ONRELEASE;
uiTouchButtons.reset.generic.name = "Reset";
uiTouchButtons.reset.generic.x = 384 - 72 + 480;
uiTouchButtons.reset.generic.y = 580;
uiTouchButtons.reset.generic.y = 600;
uiTouchButtons.reset.generic.callback = UI_TouchButtons_Callback;
uiTouchButtons.reset.generic.statusText = "Reset touch to default state";
uiTouchButtons.reset.pic = PIC_Load("gfx/shell/btn_touch_reset");
@ -743,9 +749,9 @@ static void UI_TouchButtons_Init( void )
uiTouchButtons.remove.generic.type = QMTYPE_BM_BUTTON;
uiTouchButtons.remove.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiTouchButtons.remove.generic.x = 384 - 72 + 480;
uiTouchButtons.remove.generic.y = 520;
uiTouchButtons.remove.generic.y = 550;
uiTouchButtons.remove.generic.name = "Delete";
uiTouchButtons.remove.generic.statusText = "Delete saved game";
uiTouchButtons.remove.generic.statusText = "Delete selected button";
uiTouchButtons.remove.generic.callback = UI_TouchButtons_Callback;
UI_UtilSetupPicButton( &uiTouchButtons.remove, PC_DELETE );
@ -762,6 +768,7 @@ static void UI_TouchButtons_Init( void )
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.alpha );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.hide );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.additive );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.precision );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.sp );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.mp );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.lock );
@ -772,12 +779,12 @@ static void UI_TouchButtons_Init( void )
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.select );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.editor );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.name );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.banner );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.command );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.texture );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.color );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.preview );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.command );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.texture );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.name );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.msgBox );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.promptMessage );
UI_AddItem( &uiTouchButtons.menu, (void *)&uiTouchButtons.no );

View File

@ -264,7 +264,7 @@ static void UI_TouchOptions_Callback( void *self, int event )
COM_FileBase( CVAR_GET_STRING( "touch_config_file" ), curprofile );
isCurrent = !strcmp( curprofile, uiTouchOptions.profileDesc[ uiTouchOptions.profiles.curItem ]);
// Scrolllist changed, update available options
// Scrolllist changed, update availiable options
uiTouchOptions.remove.generic.flags |= QMF_GRAYED;
if( ( uiTouchOptions.profiles.curItem > uiTouchOptions.firstProfile ) && !isCurrent )
uiTouchOptions.remove.generic.flags &= ~QMF_GRAYED;
@ -426,7 +426,7 @@ static void UI_TouchOptions_Init( void )
//uiTouchOptions.hTestImage = PIC_Load( ART_GAMMA, PIC_KEEP_RGBDATA );
uiTouchOptions.menu.vidInitFunc = UI_TouchOptions_Init;
//uiTouchOptions.menu.vidInitFunc = UI_TouchOptions_Init;
uiTouchOptions.background.generic.id = ID_BACKGROUND;
uiTouchOptions.background.generic.type = QMTYPE_BITMAP;

View File

@ -231,19 +231,19 @@ static void UI_VidModes_Init( void )
uiVidModes.vidList.generic.id = ID_VIDMODELIST;
uiVidModes.vidList.generic.type = QMTYPE_SCROLLLIST;
uiVidModes.vidList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_SMALLFONT;
#if defined(__ANDROID__) // it's impossible to change resolution on Android, so grey it out
uiVidModes.vidList.generic.flags = QMF_INACTIVE;
uiVidModes.vidList.generic.color = uiColorDkGrey;
#endif
uiVidModes.vidList.generic.x = 400;
uiVidModes.vidList.generic.y = 300;
uiVidModes.vidList.generic.width = 560;
uiVidModes.vidList.generic.height = 300;
uiVidModes.vidList.generic.callback = UI_VidModes_Callback;
#if defined(__ANDROID__) // it's impossible to change resolution on Android, so grey it out
uiVidModes.vidList.generic.flags = QMF_INACTIVE;
uiVidModes.vidList.generic.color = uiColorDkGrey;
#endif
uiVidModes.windowed.generic.id = ID_FULLSCREEN;
uiVidModes.windowed.generic.type = QMTYPE_CHECKBOX;
uiVidModes.windowed.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiVidModes.windowed.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiVidModes.windowed.generic.name = "Run in a window";
uiVidModes.windowed.generic.x = 400;
uiVidModes.windowed.generic.y = 620;
@ -252,7 +252,7 @@ static void UI_VidModes_Init( void )
uiVidModes.vsync.generic.id = ID_VERTICALSYNC;
uiVidModes.vsync.generic.type = QMTYPE_CHECKBOX;
uiVidModes.vsync.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiVidModes.vsync.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiVidModes.vsync.generic.name = "Vertical sync";
uiVidModes.vsync.generic.x = 400;
uiVidModes.vsync.generic.y = 670;

View File

@ -34,7 +34,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ID_GLARE_REDUCTION 5
#define ID_SIMPLE_SKY 6
#define ID_ALLOW_MATERIALS 7
//#define ID_VRMODE 8
typedef struct
{
@ -52,7 +51,6 @@ typedef struct
menuSlider_s glareReduction;
menuCheckBox_s fastSky;
menuCheckBox_s hiTextures;
//menuCheckBox_s vrmode;
HIMAGE hTestImage;
} uiVidOptions_t;
@ -83,9 +81,6 @@ static void UI_VidOptions_GetConfig( void )
if( CVAR_GET_FLOAT( "host_allow_materials" ))
uiVidOptions.hiTextures.enabled = 1;
/*if( CVAR_GET_FLOAT( "vrmode" ))
uiVidOptions.vrmode.enabled = 1;*/
uiVidOptions.outlineWidth = 2;
UI_ScaleCoords( NULL, NULL, &uiVidOptions.outlineWidth, NULL );
}
@ -101,7 +96,7 @@ static void UI_VidOptions_UpdateConfig( void )
CVAR_SET_FLOAT( "r_flaresize", (uiVidOptions.glareReduction.curValue * 200.0f ) + 100.0f );
CVAR_SET_FLOAT( "r_fastsky", uiVidOptions.fastSky.enabled );
CVAR_SET_FLOAT( "host_allow_materials", uiVidOptions.hiTextures.enabled );
//CVAR_SET_FLOAT( "vrmode", uiVidOptions.vrmode.enabled );
if( CVAR_GET_FLOAT( "gl_ignorehwgamma" ))
PIC_SetGamma( uiVidOptions.hTestImage, RemapVal( uiVidOptions.gammaIntensity.curValue, 0.0f, 1.0f, 1.8f, 7.0f ));
else CVAR_SET_FLOAT( "gamma", RemapVal( uiVidOptions.gammaIntensity.curValue, 0.0f, 1.0f, 0.5f, 2.3f ));
@ -113,7 +108,7 @@ static void UI_VidOptions_SetConfig( void )
CVAR_SET_FLOAT( "r_flaresize", (uiVidOptions.glareReduction.curValue * 200.0f ) + 100.0f );
CVAR_SET_FLOAT( "r_fastsky", uiVidOptions.fastSky.enabled );
CVAR_SET_FLOAT( "host_allow_materials", uiVidOptions.hiTextures.enabled );
//CVAR_SET_FLOAT( "vrmode", uiVidOptions.vrmode.enabled );
if( CVAR_GET_FLOAT( "gl_ignorehwgamma" ))
CVAR_SET_FLOAT( "gamma", RemapVal( uiVidOptions.gammaIntensity.curValue, 0.0f, 1.0f, 1.8f, 7.0f ));
else CVAR_SET_FLOAT( "gamma", RemapVal( uiVidOptions.gammaIntensity.curValue, 0.0f, 1.0f, 0.5f, 2.3f ));
@ -172,7 +167,6 @@ static void UI_VidOptions_Callback( void *self, int event )
{
case ID_SIMPLE_SKY:
case ID_ALLOW_MATERIALS:
//case ID_VRMODE:
if( event == QM_PRESSED )
((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
@ -251,7 +245,7 @@ static void UI_VidOptions_Init( void )
uiVidOptions.screenSize.generic.id = ID_SCREEN_SIZE;
uiVidOptions.screenSize.generic.type = QMTYPE_SLIDER;
uiVidOptions.screenSize.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiVidOptions.screenSize.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW|QMF_HIGHLIGHTIFFOCUS;
uiVidOptions.screenSize.generic.name = "Screen size";
uiVidOptions.screenSize.generic.x = 72;
uiVidOptions.screenSize.generic.y = 280;
@ -263,7 +257,7 @@ static void UI_VidOptions_Init( void )
uiVidOptions.gammaIntensity.generic.id = ID_GAMMA;
uiVidOptions.gammaIntensity.generic.type = QMTYPE_SLIDER;
uiVidOptions.gammaIntensity.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiVidOptions.gammaIntensity.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW|QMF_HIGHLIGHTIFFOCUS;
uiVidOptions.gammaIntensity.generic.name = "Gamma";
uiVidOptions.gammaIntensity.generic.x = 72;
uiVidOptions.gammaIntensity.generic.y = 340;
@ -275,7 +269,7 @@ static void UI_VidOptions_Init( void )
uiVidOptions.glareReduction.generic.id = ID_GLARE_REDUCTION;
uiVidOptions.glareReduction.generic.type = QMTYPE_SLIDER;
uiVidOptions.glareReduction.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
uiVidOptions.glareReduction.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW|QMF_HIGHLIGHTIFFOCUS;
uiVidOptions.glareReduction.generic.name = "Glare reduction";
uiVidOptions.glareReduction.generic.x = 72;
uiVidOptions.glareReduction.generic.y = 400;
@ -287,7 +281,7 @@ static void UI_VidOptions_Init( void )
uiVidOptions.fastSky.generic.id = ID_SIMPLE_SKY;
uiVidOptions.fastSky.generic.type = QMTYPE_CHECKBOX;
uiVidOptions.fastSky.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiVidOptions.fastSky.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiVidOptions.fastSky.generic.name = "Draw simple sky";
uiVidOptions.fastSky.generic.x = 72;
uiVidOptions.fastSky.generic.y = 615;
@ -296,22 +290,13 @@ static void UI_VidOptions_Init( void )
uiVidOptions.hiTextures.generic.id = ID_ALLOW_MATERIALS;
uiVidOptions.hiTextures.generic.type = QMTYPE_CHECKBOX;
uiVidOptions.hiTextures.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiVidOptions.hiTextures.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_DROPSHADOW;
uiVidOptions.hiTextures.generic.name = "Allow materials";
uiVidOptions.hiTextures.generic.x = 72;
uiVidOptions.hiTextures.generic.y = 665;
uiVidOptions.hiTextures.generic.callback = UI_VidOptions_Callback;
uiVidOptions.hiTextures.generic.statusText = "let engine replace 8-bit textures with full color hi-res prototypes (if present)";
/*uiVidOptions.vrmode.generic.id = ID_VRMODE;
uiVidOptions.vrmode.generic.type = QMTYPE_CHECKBOX;
uiVidOptions.vrmode.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiVidOptions.vrmode.generic.name = "Activate VR";
uiVidOptions.vrmode.generic.x = 72;
uiVidOptions.vrmode.generic.y = 565;
uiVidOptions.vrmode.generic.callback = UI_VidOptions_Callback;
uiVidOptions.vrmode.generic.statusText = "Activate Virtual Reality mode.";*/
UI_VidOptions_GetConfig();
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.background );
@ -322,7 +307,6 @@ static void UI_VidOptions_Init( void )
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.glareReduction );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.fastSky );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.hiTextures );
//UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.vrmode );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.testImage );
}

View File

@ -53,8 +53,8 @@ float UI_GetTitleTransFraction( void )
void LerpQuad( ui_quad_t a, ui_quad_t b, float frac, ui_quad_t *c )
{
c->x = a.x + (b.x - a.x ) * frac;
c->y = a.y + (b.y - a.y ) * frac;
c->x = a.x + (b.x - a.x) * frac;
c->y = a.y + (b.y - a.y) * frac;
c->lx = a.lx + (b.lx - a.lx) * frac;
c->ly = a.ly + (b.ly - a.ly) * frac;
}
@ -76,6 +76,7 @@ void UI_DrawTitleAnim()
wrect_t r = { 0, uiStatic.buttons_width, 26, 51 };
float frac = UI_GetTitleTransFraction();/*(sin(gpGlobals->time*4)+1)/2*/;
#ifdef TA_ALT_MODE
if( frac == 1 && transition_state == AS_TO_BUTTON )
return;
@ -97,7 +98,7 @@ void UI_DrawTitleAnim()
void UI_SetTitleAnim( int anim_state, menuPicButton_s *button )
{
// skip buttons which don't call new menu
if( !button || (PreClickDepth == uiStatic.menuDepth && anim_state == AS_TO_TITLE) )
if( !button || ( PreClickDepth == uiStatic.menuDepth && anim_state == AS_TO_TITLE ) )
return;
// replace cancel\done button with button which called this menu

View File

@ -15,5 +15,5 @@ typedef struct
void UI_PopPButtonStack( void );
void UI_ClearButtonStack( void );
// использовать кусок из btns_main.bmp заместо head_%s.bmp
// использовать кусок из btns_main.bmp заместо head_%s.bmp
//#define TA_ALT_MODE 1

View File

@ -318,6 +318,8 @@ void UI_ScrollList_Init( menuScrollList_s *sl )
{
if( !sl->generic.name ) sl->generic.name = "";
sl->generic.charWidth = 1;
sl->generic.charHeight = 1;
if( sl->generic.flags & QMF_BIGFONT )
{
sl->generic.charWidth = UI_BIG_CHAR_WIDTH;
@ -336,6 +338,9 @@ void UI_ScrollList_Init( menuScrollList_s *sl )
UI_ScaleCoords( NULL, NULL, &sl->generic.charWidth, &sl->generic.charHeight );
if( sl->generic.charWidth < 1 ) sl->generic.charWidth = 1;
if( sl->generic.charHeight < 1 ) sl->generic.charHeight = 1;
if(!(sl->generic.flags & (QMF_LEFT_JUSTIFY|QMF_CENTER_JUSTIFY|QMF_RIGHT_JUSTIFY)))
sl->generic.flags |= QMF_LEFT_JUSTIFY;
@ -554,7 +559,7 @@ UI_ScrollList_Draw
*/
void UI_ScrollList_Draw( menuScrollList_s *sl )
{
int justify;
int justify = 0;
int shadow;
int i, x, y, w, h;
int selColor = 0xFF503818; // Red 80, Green 56, Blue 24, Alpha 255
@ -615,13 +620,21 @@ void UI_ScrollList_Draw( menuScrollList_s *sl )
}
else
{
int color;
if( sl->generic.flags & QMF_HIGHLIGHTIFFOCUS && sl->generic.flags & QMF_HASKEYBOARDFOCUS )
color = uiInputTextColor;
else
color = uiInputFgColor;
x = sl->generic.x2 - UI_OUTLINE_WIDTH;
y = sl->generic.y2;
w = UI_OUTLINE_WIDTH;
h = sl->generic.height2;
// draw left
UI_FillRect( x, y, w, h, uiInputFgColor );
UI_FillRect( x, y, w, h, color );
x = sl->generic.x2 + sl->generic.width2;
y = sl->generic.y2;
@ -629,7 +642,7 @@ void UI_ScrollList_Draw( menuScrollList_s *sl )
h = sl->generic.height2;
// draw right
UI_FillRect( x, y, w, h, uiInputFgColor );
UI_FillRect( x, y, w, h, color );
x = sl->generic.x2;
y = sl->generic.y2;
@ -637,7 +650,7 @@ void UI_ScrollList_Draw( menuScrollList_s *sl )
h = UI_OUTLINE_WIDTH;
// draw top
UI_FillRect( x, y, w, h, uiInputFgColor );
UI_FillRect( x, y, w, h, color );
// draw bottom
x = sl->generic.x2;
@ -645,7 +658,7 @@ void UI_ScrollList_Draw( menuScrollList_s *sl )
w = sl->generic.width2 + UI_OUTLINE_WIDTH;
h = UI_OUTLINE_WIDTH;
UI_FillRect( x, y, w, h, uiInputFgColor );
UI_FillRect( x, y, w, h, color );
}
// glue with right top and right bottom corners
@ -760,7 +773,7 @@ void UI_ScrollList_Draw( menuScrollList_s *sl )
UI_DrawPic( downX, downY, arrowWidth, arrowHeight, uiColorDkGrey, sl->downArrow );
}
else
{
{
scrollbarFocus = UI_CursorInRect( sl->scrollBarX, sl->scrollBarY, sl->scrollBarWidth, sl->scrollBarHeight );
// special case if we sliding but lost focus
@ -1008,7 +1021,7 @@ UI_SpinControl_Draw
*/
void UI_SpinControl_Draw( menuSpinControl_s *sc )
{
int justify;
int justify = 0;
int shadow;
int x, y, w, h;
int arrowWidth, arrowHeight, leftX, leftY, rightX, rightY;
@ -1143,7 +1156,7 @@ void UI_Slider_Init( menuSlider_s *sl )
// scale the center box
sl->generic.x2 = sl->generic.x;
sl->generic.y2 = sl->generic.y;
sl->generic.width2 = sl->generic.width / 5;
sl->generic.width2 = sl->generic.width / 5.0f;
sl->generic.height2 = 4;
UI_ScaleCoords( &sl->generic.x2, &sl->generic.y2, &sl->generic.width2, &sl->generic.height2 );
@ -1153,8 +1166,8 @@ void UI_Slider_Init( menuSlider_s *sl )
sl->generic.height += uiStatic.sliderWidth * 2;
sl->generic.y2 -= uiStatic.sliderWidth;
sl->drawStep = (sl->generic.width - sl->generic.width2) / ((sl->maxValue - sl->minValue) / sl->range);
sl->numSteps = ((sl->maxValue - sl->minValue) / sl->range) + 1;
sl->numSteps = (sl->maxValue - sl->minValue) / sl->range + 1;
sl->drawStep = (float)(sl->generic.width - sl->generic.width2) / (float)sl->numSteps;
}
/*
@ -1164,8 +1177,6 @@ UI_Slider_Key
*/
const char *UI_Slider_Key( menuSlider_s *sl, int key, int down )
{
int sliderX;
if( !down )
{
if( sl->keepSlider )
@ -1186,21 +1197,53 @@ const char *UI_Slider_Key( menuSlider_s *sl, int key, int down )
return uiSoundNull;
// find the current slider position
sliderX = sl->generic.x2 + (sl->drawStep * (sl->curValue * sl->numSteps));
sl->keepSlider = true;
int dist, numSteps;
// immediately move slider into specified place
dist = uiStatic.cursorX - sl->generic.x2 - (sl->generic.width2>>2);
numSteps = dist / (int)sl->drawStep;
numSteps = round(dist / sl->drawStep);
sl->curValue = bound( sl->minValue, numSteps * sl->range, sl->maxValue );
// tell menu about changes
if( sl->generic.callback )
sl->generic.callback( sl, QM_CHANGED );
return uiSoundNull;
break;
case K_LEFTARROW:
sl->curValue -= sl->range;
if( sl->curValue < sl->minValue )
{
sl->curValue = sl->minValue;
return uiSoundBuzz;
}
// tell menu about changes
if( sl->generic.callback )
sl->generic.callback( sl, QM_CHANGED );
return uiSoundKey;
break;
case K_RIGHTARROW:
sl->curValue += sl->range;
if( sl->curValue > sl->maxValue )
{
sl->curValue = sl->maxValue;
return uiSoundBuzz;
}
// tell menu about changes
if( sl->generic.callback )
sl->generic.callback( sl, QM_CHANGED );
return uiSoundKey;
break;
}
return uiSoundNull;
return 0;
}
/*
@ -1210,7 +1253,7 @@ UI_Slider_Draw
*/
void UI_Slider_Draw( menuSlider_s *sl )
{
int justify;
int justify = 0;
int shadow;
int textHeight, sliderX;
@ -1225,14 +1268,15 @@ void UI_Slider_Draw( menuSlider_s *sl )
if( sl->keepSlider )
{
int dist, numSteps;
if( !UI_CursorInRect( sl->generic.x, sl->generic.y - 40, sl->generic.width, sl->generic.height + 80 ) )
sl->keepSlider = false;
else
{
int dist, numSteps;
// move slider follow the holded mouse button
dist = uiStatic.cursorX - sl->generic.x2 - (sl->generic.width2>>2);
numSteps = dist / (int)sl->drawStep;
numSteps = round(dist / sl->drawStep);
sl->curValue = bound( sl->minValue, numSteps * sl->range, sl->maxValue );
// tell menu about changes
@ -1244,10 +1288,15 @@ void UI_Slider_Draw( menuSlider_s *sl )
sl->curValue = bound( sl->minValue, sl->curValue, sl->maxValue );
// calc slider position
sliderX = sl->generic.x2 + (sl->drawStep * (sl->curValue * sl->numSteps));
sliderX = sl->generic.x2 + (sl->drawStep * (sl->curValue / sl->range)); // TODO: fix behaviour when values goes negative
//sliderX = bound( sl->generic.x2, sliderX, sl->generic.x2 + sl->generic.width - uiStatic.sliderWidth);
UI_DrawRectangleExt( sl->generic.x, sl->generic.y + uiStatic.sliderWidth, sl->generic.width, sl->generic.height2, uiInputBgColor, uiStatic.sliderWidth );
UI_DrawPic( sliderX, sl->generic.y2, sl->generic.width2, sl->generic.height, uiColorWhite, UI_SLIDER_MAIN );
if( sl->generic.flags & QMF_HIGHLIGHTIFFOCUS && sl == UI_ItemAtCursor( sl->generic.parent ))
UI_DrawPic( sliderX, sl->generic.y2, sl->generic.width2, sl->generic.height, uiColorHelp, UI_SLIDER_MAIN );
else
UI_DrawPic( sliderX, sl->generic.y2, sl->generic.width2, sl->generic.height, uiColorWhite, UI_SLIDER_MAIN );
textHeight = sl->generic.y - (sl->generic.charHeight * 1.5f);
UI_DrawString( sl->generic.x, textHeight, sl->generic.width, sl->generic.charHeight, sl->generic.name, uiColorHelp, true, sl->generic.charWidth, sl->generic.charHeight, justify, shadow );
@ -1314,7 +1363,8 @@ const char *UI_CheckBox_Key( menuCheckBox_s *cb, int key, int down )
break;
case K_ENTER:
case K_KP_ENTER:
if( !down ) return sound;
case K_AUX1:
//if( !down ) return sound;
if( cb->generic.flags & QMF_MOUSEONLY )
break;
sound = uiSoundGlow;
@ -1345,8 +1395,8 @@ const char *UI_CheckBox_Key( menuCheckBox_s *cb, int key, int down )
{
cb->enabled = !cb->enabled;
cb->generic.callback( cb, QM_CHANGED );
}
}
}
}
return sound;
}
@ -1402,15 +1452,8 @@ void UI_CheckBox_Draw( menuCheckBox_s *cb )
return; // grayed
}
if(( cb->generic.flags & QMF_MOUSEONLY ) && !( cb->generic.flags & QMF_HASMOUSEFOCUS ))
{
if( !cb->enabled )
UI_DrawPic( cb->generic.x, cb->generic.y, cb->generic.width, cb->generic.height, cb->generic.color, cb->emptyPic );
else UI_DrawPic( cb->generic.x, cb->generic.y, cb->generic.width, cb->generic.height, cb->generic.color, cb->checkPic );
return; // no focus
}
if((menuCommon_s *)cb != (menuCommon_s *)UI_ItemAtCursor( cb->generic.parent ))
if( ( ( cb->generic.flags & QMF_MOUSEONLY ) && !( cb->generic.flags & QMF_HASMOUSEFOCUS ) )
|| ( (menuCommon_s *)cb != (menuCommon_s *)UI_ItemAtCursor( cb->generic.parent ) ) )
{
if( !cb->enabled )
UI_DrawPic( cb->generic.x, cb->generic.y, cb->generic.width, cb->generic.height, cb->generic.color, cb->emptyPic );
@ -1422,11 +1465,19 @@ void UI_CheckBox_Draw( menuCheckBox_s *cb )
{
UI_DrawPic( cb->generic.x, cb->generic.y, cb->generic.width, cb->generic.height, cb->generic.focusColor, cb->focusPic );
}
else if( !cb->enabled )
{
UI_DrawPic( cb->generic.x, cb->generic.y, cb->generic.width, cb->generic.height, cb->generic.color, cb->emptyPic );
}
else if( cb->generic.flags & QMF_HIGHLIGHTIFFOCUS )
{
// use two textures for it. Second is just focus texture, slightly orange. Looks pretty.
UI_DrawPic( cb->generic.x, cb->generic.y, cb->generic.width, cb->generic.height, cb->generic.color, UI_CHECKBOX_PRESSED );
UI_DrawPicAdditive( cb->generic.x, cb->generic.y, cb->generic.width, cb->generic.height, uiInputTextColor, cb->focusPic );
}
else
{
if( !cb->enabled )
UI_DrawPic( cb->generic.x, cb->generic.y, cb->generic.width, cb->generic.height, cb->generic.color, cb->emptyPic );
else UI_DrawPic( cb->generic.x, cb->generic.y, cb->generic.width, cb->generic.height, cb->generic.color, cb->checkPic );
UI_DrawPic( cb->generic.x, cb->generic.y, cb->generic.width, cb->generic.height, cb->generic.color, cb->checkPic );
}
}
@ -1584,7 +1635,12 @@ const char *UI_Field_Key( menuField_s *f, int key, int down )
if( key == K_MOUSE1 )
{
if( UI_CursorInRect( f->generic.x, f->generic.y, f->generic.width, f->generic.height ) )
float y = f->generic.y;
if( y > ScreenHeight - f->generic.height - 40 )
y = ScreenHeight - f->generic.height - 15;
if( UI_CursorInRect( f->generic.x, y, f->generic.width, f->generic.height ) )
{
int charpos = (uiStatic.cursorX - f->generic.x) / f->generic.charWidth;
f->cursor = f->scroll + charpos;
@ -1694,12 +1750,21 @@ UI_Field_Draw
*/
void UI_Field_Draw( menuField_s *f )
{
int justify;
int justify = 0;
int shadow;
char text[UI_MAX_FIELD_LINE];
int len, drawLen, prestep;
int cursor, x, textHeight;
char cursor_char[3];
float y = f->generic.y;
if( y > ScreenHeight - f->generic.height - 40 )
{
if((menuCommon_s *)f == (menuCommon_s *)UI_ItemAtCursor( f->generic.parent ))
y = ScreenHeight - f->generic.height - 15;
else
return;
}
if( f->generic.flags & QMF_LEFT_JUSTIFY )
justify = 0;
@ -1763,64 +1828,64 @@ void UI_Field_Draw( menuField_s *f )
if( f->background )
{
UI_DrawPic( f->generic.x, f->generic.y, f->generic.width, f->generic.height, uiColorWhite, f->background );
UI_DrawPic( f->generic.x, 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, uiInputBgColor );
UI_FillRect( f->generic.x, y, f->generic.width, f->generic.height, uiInputBgColor );
// draw the rectangle
UI_DrawRectangle( f->generic.x, f->generic.y, f->generic.width, f->generic.height, uiInputFgColor );
UI_DrawRectangle( f->generic.x, y, f->generic.width, f->generic.height, uiInputFgColor );
}
textHeight = f->generic.y - (f->generic.charHeight * 1.5f);
textHeight = y - (f->generic.charHeight * 1.5f);
UI_DrawString( f->generic.x, textHeight, f->generic.width, f->generic.charHeight, f->generic.name, uiColorHelp, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
if( f->generic.flags & QMF_GRAYED )
{
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, uiColorDkGrey, true, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawString( f->generic.x, y, f->generic.width, f->generic.height, text, uiColorDkGrey, true, f->generic.charWidth, f->generic.charHeight, justify, shadow );
return; // grayed
}
if((menuCommon_s *)f != (menuCommon_s *)UI_ItemAtCursor( f->generic.parent ))
{
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawString( f->generic.x, y, f->generic.width, f->generic.height, text, f->generic.color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
return; // no focus
}
if( !( f->generic.flags & QMF_FOCUSBEHIND ))
{
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawString( f->generic.x, y, f->generic.width, f->generic.height, text, f->generic.color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
if(( uiStatic.realTime & 499 ) < 250 )
UI_DrawString( x + (cursor * f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, cursor_char, f->generic.color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
UI_DrawString( x + (cursor * f->generic.charWidth), y, f->generic.charWidth, f->generic.height, cursor_char, f->generic.color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
}
if( f->generic.flags & QMF_HIGHLIGHTIFFOCUS )
{
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.focusColor, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawString( f->generic.x, y, f->generic.width, f->generic.height, text, f->generic.focusColor, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
if(( uiStatic.realTime & 499 ) < 250 )
UI_DrawString( x + (cursor * f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, cursor_char, f->generic.focusColor, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
UI_DrawString( x + (cursor * f->generic.charWidth), y, f->generic.charWidth, f->generic.height, cursor_char, f->generic.focusColor, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
}
else if( f->generic.flags & QMF_PULSEIFFOCUS )
{
int color;
color = PackAlpha( f->generic.color, 255 * (0.5 + 0.5 * sin( (float)uiStatic.realTime / UI_PULSE_DIVISOR )));
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawString( f->generic.x, y, f->generic.width, f->generic.height, text, color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
if(( uiStatic.realTime & 499 ) < 250 )
UI_DrawString( x + (cursor * f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, cursor_char, color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
UI_DrawString( x + (cursor * f->generic.charWidth), y, f->generic.charWidth, f->generic.height, cursor_char, color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
}
if( f->generic.flags & QMF_FOCUSBEHIND )
{
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawString( f->generic.x, y, f->generic.width, f->generic.height, text, f->generic.color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
if(( uiStatic.realTime & 499 ) < 250 )
UI_DrawString( x + (cursor * f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, cursor_char, f->generic.color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
UI_DrawString( x + (cursor * f->generic.charWidth), y, f->generic.charWidth, f->generic.height, cursor_char, f->generic.color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
}
}
@ -1895,7 +1960,8 @@ const char *UI_Action_Key( menuAction_s *a, int key, int down )
break;
case K_ENTER:
case K_KP_ENTER:
if( !down ) return sound;
case K_AUX1:
//if( !down ) return sound;
if( a->generic.flags & QMF_MOUSEONLY )
break;
sound = uiSoundLaunch;
@ -1924,7 +1990,7 @@ const char *UI_Action_Key( menuAction_s *a, int key, int down )
{
if( sound && a->generic.callback )
a->generic.callback( a, QM_ACTIVATED );
}
}
return sound;
}
@ -1936,7 +2002,7 @@ UI_Action_Draw
*/
void UI_Action_Draw( menuAction_s *a )
{
int justify;
int justify = 0;
int shadow;
if( a->generic.flags & QMF_LEFT_JUSTIFY )
@ -2035,7 +2101,8 @@ const char *UI_Bitmap_Key( menuBitmap_s *b, int key, int down )
break;
case K_ENTER:
case K_KP_ENTER:
if( !down ) return sound;
case K_AUX1:
//if( !down ) return sound;
if( b->generic.flags & QMF_MOUSEONLY )
break;
sound = uiSoundLaunch;
@ -2195,10 +2262,10 @@ const char *UI_PicButton_Key( menuPicButton_s *b, int key, int down )
break;
case K_ENTER:
case K_KP_ENTER:
case K_AUX1:
if( b->generic.flags & QMF_MOUSEONLY )
break;
sound = uiSoundLaunch;
break;
}
if( sound && ( b->generic.flags & QMF_SILENT ))
sound = uiSoundNull;
@ -2225,7 +2292,7 @@ const char *UI_PicButton_Key( menuPicButton_s *b, int key, int down )
{
if( sound && b->generic.callback )
b->generic.callback( b, QM_ACTIVATED );
}
}
return sound;
}
@ -2239,7 +2306,7 @@ void UI_PicButton_Draw( menuPicButton_s *item )
{
int state = BUTTON_NOFOCUS;
if( item->generic.flags & QMF_HASMOUSEFOCUS )
if( item->generic.flags & (QMF_HASMOUSEFOCUS|QMF_HASKEYBOARDFOCUS))
state = BUTTON_FOCUS;
// make sure what cursor in rect
@ -2288,14 +2355,14 @@ void UI_PicButton_Draw( menuPicButton_s *item )
a = (512 - (uiStatic.realTime - item->generic.lastFocusTime)) >> 1;
if( state == BUTTON_NOFOCUS && a > 0 )
{
{
PIC_Set( item->pic, r, g, b, a );
PIC_DrawAdditive( item->generic.x, item->generic.y, uiStatic.buttons_draw_width, uiStatic.buttons_draw_height, &rects[BUTTON_FOCUS] );
}
}
else
{
int justify;
int justify = 0;
int shadow;
if( item->generic.flags & QMF_LEFT_JUSTIFY )