02 Apr 2011

This commit is contained in:
g-cont 2011-04-02 00:00:00 +04:00 committed by Alibek Omarov
parent 3f821c16f9
commit 40e25d5589
23 changed files with 141 additions and 222 deletions

View File

@ -1,3 +1,9 @@
build 1516
Engine: fix Sys_Error blowout
GameUI: implement new credits effect in Half-Life (when game is end)
GameUI: use system cursor instead of emulated
build 1515
Engine: fix some bugs

View File

@ -772,12 +772,6 @@ CL_ClearState
*/
void CL_ClearState( void )
{
if( !cls.changelevel )
{
// continue playing if we are changing level
S_StopBackgroundTrack ();
}
S_StopAllSounds ();
CL_ClearEffects ();
CL_FreeEdicts ();
@ -842,6 +836,7 @@ void CL_Disconnect( void )
CL_SendDisconnectMessage();
CL_ClearState ();
S_StopBackgroundTrack ();
SCR_EndLoadingPlaque (); // get rid of loading plaque
// clear the network channel, too.
@ -1468,6 +1463,9 @@ void CL_Escape_f( void )
if( cls.key_dest == key_menu )
return;
// the final credits is running
if( UI_CreditsActive( )) return;
if( cls.state == ca_cinematic )
SCR_StopCinematic();
else UI_SetActiveMenu( true );
@ -1665,14 +1663,11 @@ void CL_Init( void )
CL_InitLocal();
R_Init(); // init renderer
S_Init(); // init sound
if( !CL_LoadProgs( va( "%s/client.dll", GI->dll_path )))
Host_Error( "can't initialize client.dll\n" );
// NOTE: hlfx has nasty hack with SetWindowHook which do mouse lag
// we must initialize sound after loading client.dll to avoid it
S_Init(); // init sound
cls.initialized = true;
cl.maxclients = 1; // allow to drawing player in menu
}

View File

@ -8,6 +8,7 @@
#include "const.h"
#include "gl_local.h"
#include "library.h"
#include "input.h"
static MENUAPI GetMenuAPI;
@ -941,6 +942,8 @@ static ui_enginefuncs_t gEngfuncs =
pfnHostEndGame,
Com_RandomFloat,
Com_RandomLong,
IN_SetCursor,
pfnIsMapValid,
};
void UI_UnloadProgs( void )

View File

@ -608,6 +608,12 @@ void CL_ParseServerData( sizebuf_t *msg )
cl.background = BF_ReadOneBit( msg );
Q_strncpy( gamefolder, BF_ReadString( msg ), MAX_STRING );
if( !cls.changelevel )
{
// continue playing if we are changing level
S_StopBackgroundTrack ();
}
if( !CL_ChangeGame( gamefolder, false ))
{
clgame.dllFuncs.pfnVidInit();
@ -1180,6 +1186,15 @@ void CL_ParseUserMessage( sizebuf_t *msg, int svc_num )
if( clgame.msg[i].func )
{
clgame.msg[i].func( clgame.msg[i].name, iSize, pbuf );
// HACKHACK: run final credits for Half-Life
// because hl1 doesn't have call END_SECTION
if( !Q_stricmp( clgame.msg[i].name, "HudText" ) && !Q_stricmp( GI->gamefolder, "valve" ))
{
// it's a end, so we should run credits
if( !Q_strcmp( (char *)pbuf, "END3" ))
Host_Credits();
}
}
else
{

View File

@ -2356,7 +2356,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
if( RI.currentmodel == NULL )
return 0;
m_pStudioHeader = (studiohdr_t *)Mod_Extradata( RI.currentmodel );
R_StudioSetHeader((studiohdr_t *)Mod_Extradata( RI.currentmodel ));
if( pplayer->gaitsequence )
{
@ -2520,7 +2520,7 @@ static int R_StudioDrawModel( int flags )
return result;
}
m_pStudioHeader = (studiohdr_t *)Mod_Extradata( RI.currentmodel );
R_StudioSetHeader((studiohdr_t *)Mod_Extradata( RI.currentmodel ));
R_StudioSetUpTransform( RI.currententity );

View File

@ -565,6 +565,7 @@ void pfnDelCommand( const char *cmd_name );
void *Cache_Check( byte *mempool, struct cache_user_s *c );
edict_t* pfnPEntityOfEntIndex( int iEntIndex );
void pfnGetGameDir( char *szGetGameDir );
int pfnIsMapValid( char *filename );
char *pfnCmd_Args( void );
char *pfnCmd_Argv( int argc );
void Con_DPrintf( char *fmt, ... );
@ -665,6 +666,7 @@ int R_CreateDecalList( decallist_t *pList, qboolean changelevel );
struct cl_entity_s *CL_GetEntityByIndex( int index );
struct cl_entity_s *CL_GetLocalPlayer( void );
struct player_info_s *CL_GetPlayerInfo( int playerIndex );
qboolean UI_CreditsActive( void );
void CL_ExtraUpdate( void );
int CL_GetMaxClients( void );
qboolean CL_IsPlaybackDemo( void );

View File

@ -213,6 +213,8 @@ void Con_ToggleConsole_f( void )
{
if( !host.developer ) return; // disabled
if( UI_CreditsActive( )) return; // diabled by final credits
// show console only in game or by special call from menu
if( cls.state != ca_active || cls.key_dest == key_menu )
return;

View File

@ -11,14 +11,12 @@
#define WND_HEADSIZE wnd_caption // some offset
#define WND_BORDER 3 // sentinel border in pixels
HICON in_mousecursor;
qboolean in_mouseactive; // false when not focus app
qboolean in_restore_spi;
qboolean in_mouseinitialized;
int in_originalmouseparms[3];
int in_mouse_oldbuttonstate;
int in_newmouseparms[3] = { 0, 0, 1 };
qboolean in_mouse_suspended;
qboolean in_mouseparmsvalid;
int in_mouse_buttons;
RECT window_rect, real_rect;
uint in_mouse_wheel;
@ -112,7 +110,6 @@ void IN_StartupMouse( void )
if( Sys_CheckParm( "-nomouse" )) return;
in_mouse_buttons = 8;
in_mouseparmsvalid = SystemParametersInfo( SPI_GETMOUSE, 0, in_originalmouseparms, 0 );
in_mouseinitialized = true;
in_mouse_wheel = RegisterWindowMessage( "MSWHEEL_ROLLMSG" );
}
@ -138,6 +135,22 @@ static qboolean IN_CursorInRect( void )
return true;
}
static void IN_ActivateCursor( void )
{
if( cls.key_dest == key_menu )
{
while( ShowCursor( true ) < 0 );
SetCursor( in_mousecursor );
}
}
void IN_SetCursor( HICON hCursor )
{
in_mousecursor = hCursor;
IN_ActivateCursor();
}
/*
===========
IN_ToggleClientMouse
@ -157,6 +170,14 @@ void IN_ToggleClientMouse( int newstate, int oldstate )
{
clgame.dllFuncs.IN_ActivateMouse();
}
if( newstate == key_menu )
{
in_mouseactive = false;
ClipCursor( NULL );
ReleaseCapture();
while( ShowCursor( true ) < 0 );
}
}
/*
@ -170,8 +191,6 @@ void IN_ActivateMouse( qboolean force )
{
int width, height;
static int oldstate;
POINT global_pos;
int x, y;
if( !in_mouseinitialized )
return;
@ -189,18 +208,10 @@ void IN_ActivateMouse( qboolean force )
{
if( in_mouse_suspended )
{
UI_GetCursorPos( &global_pos.x, &global_pos.y );
ClipCursor( NULL );
ReleaseCapture();
while( ShowCursor( true ) < 0 );
UI_ShowCursor( false );
x = real_rect.left + global_pos.x;
y = real_rect.top + global_pos.y + WND_HEADSIZE;
// set system cursor position
SetCursorPos( x, y );
}
}
@ -208,15 +219,8 @@ void IN_ActivateMouse( qboolean force )
if( in_mouse_suspended && IN_CursorInRect( ))
{
GetCursorPos( &global_pos );
in_mouse_suspended = false;
in_mouseactive = false; // re-initialize mouse
x = global_pos.x - real_rect.left;
y = global_pos.y - real_rect.top - WND_HEADSIZE;
// set menu cursor position
UI_SetCursorPos( x, y );
UI_ShowCursor( true );
}
}
@ -224,14 +228,12 @@ void IN_ActivateMouse( qboolean force )
if( in_mouseactive ) return;
in_mouseactive = true;
if( UI_IsVisible( )) return;
if( cls.key_dest == key_game )
{
clgame.dllFuncs.IN_ActivateMouse();
}
else if( in_mouseparmsvalid )
{
in_restore_spi = SystemParametersInfo( SPI_SETMOUSE, 0, in_newmouseparms, 0 );
}
width = GetSystemMetrics( SM_CXSCREEN );
height = GetSystemMetrics( SM_CYSCREEN );
@ -267,10 +269,6 @@ void IN_DeactivateMouse( void )
{
clgame.dllFuncs.IN_DeactivateMouse();
}
else if( in_restore_spi )
{
SystemParametersInfo( SPI_SETMOUSE, 0, in_originalmouseparms, 0 );
}
in_mouseactive = false;
ClipCursor( NULL );
@ -286,23 +284,18 @@ IN_Mouse
void IN_MouseMove( void )
{
POINT current_pos;
int mx, my;
if( !in_mouseinitialized || !in_mouseactive || in_mouse_suspended || cls.key_dest == key_game )
if( !in_mouseinitialized || !in_mouseactive || !UI_IsVisible( ))
return;
// find mouse movement
GetCursorPos( &current_pos );
// force the mouse to the center, so there's room to move
SetCursorPos( host.window_center_x, host.window_center_y );
mx = current_pos.x - host.window_center_x;
my = current_pos.y - host.window_center_y;
if(( !mx && !my ) || !UI_IsVisible( )) return;
ScreenToClient( host.hWnd, &current_pos );
// if the menu is visible, move the menu cursor
UI_MouseMove( mx, my );
UI_MouseMove( current_pos.x, current_pos.y );
IN_ActivateCursor();
}
/*
@ -409,8 +402,8 @@ void Host_InputFrame( void )
return;
}
if( cl.refdef.paused && cls.key_dest == key_game )
shutdownMouse = true; // release mouse during pause
if(( cl.refdef.paused && cls.key_dest == key_game ) || cls.key_dest == key_console )
shutdownMouse = true; // release mouse during pause or console typeing
if( shutdownMouse && !Cvar_VariableInteger( "fullscreen" ))
{
@ -445,6 +438,9 @@ long IN_WndProc( void *hWnd, uint uMsg, uint wParam, long lParam )
if( Cvar_VariableInteger( "fullscreen" ))
ShowWindow( host.hWnd, SW_SHOWMINNOACTIVE );
break;
case WM_SETCURSOR:
IN_ActivateCursor();
break;
case WM_MOUSEWHEEL:
if( !in_mouseactive ) break;
if(( short )HIWORD( wParam ) > 0 )

View File

@ -40,6 +40,7 @@ void IN_ActivateMouse( qboolean force );
void IN_DeactivateMouse( void );
void IN_ToggleClientMouse( int newstate, int oldstate );
long IN_WndProc( void *hWnd, uint uMsg, uint wParam, long lParam );
void IN_SetCursor( HICON hCursor );
#ifdef __cplusplus
}

View File

@ -407,7 +407,10 @@ void Sys_Error( const char *error, ... )
SV_SysError( text );
if( host.type == HOST_NORMAL )
CL_Shutdown(); // kill video
{
if( host.hWnd ) ShowWindow( host.hWnd, SW_HIDE );
VID_RestoreGamma();
}
if( host.developer > 0 )
{

View File

@ -144,6 +144,9 @@ typedef struct ui_enginefuncs_s
// new functions starts here
float (*pfnRandomFloat)( float flLow, float flHigh );
long (*pfnRandomLong)( long lLow, long lHigh );
void (*pfnSetCursor)( void *hCursor ); // change cursor
int (*pfnIsMapValid)( char *filename );
} ui_enginefuncs_t;
typedef struct

View File

@ -1503,6 +1503,8 @@ void SV_Pause_f( sv_client_t *cl )
{
string message;
if( UI_CreditsActive( )) return;
if( !sv_pausable->integer )
{
SV_ClientPrintf( cl, PRINT_HIGH, "Pause not allowed.\n" );

View File

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ui_menu.c -- main menu interface
#define OEMRESOURCE // for OCR_* cursor junk
#include "extdll.h"
#include "basemenu.h"
@ -31,7 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "ui_title_anim.h"
cvar_t *ui_precache;
cvar_t *ui_sensitivity;
uiStatic_t uiStatic;
@ -280,13 +280,10 @@ UI_DrawMouseCursor
void UI_DrawMouseCursor( void )
{
menuCommon_s *item;
HIMAGE hCursor = -1;
int w = UI_CURSOR_SIZE;
int h = UI_CURSOR_SIZE;
HICON hCursor = NULL;
int i;
if( uiStatic.hideCursor ) return;
UI_ScaleCoords( NULL, NULL, &w, &h );
for( i = 0; i < uiStatic.menuActive->numItems; i++ )
{
@ -298,17 +295,21 @@ void UI_DrawMouseCursor( void )
if ( !UI_CursorInRect( item->x, item->y, item->width, item->height ))
continue;
if ( !(item->flags & QMF_GRAYED) && item->type == QMTYPE_FIELD )
if ( item->flags & QMF_GRAYED )
{
hCursor = PIC_Load( UI_CURSOR_TYPING, typing_tga, sizeof( typing_tga ));
hCursor = (HICON)LoadCursor( NULL, (LPCTSTR)OCR_NO );
}
else
{
if( item->type == QMTYPE_FIELD )
hCursor = (HICON)LoadCursor( NULL, (LPCTSTR)OCR_IBEAM );
}
break;
}
if( hCursor == -1 ) hCursor = PIC_Load( UI_CURSOR_NORMAL, cursor_tga, sizeof( cursor_tga ));
if( !hCursor ) hCursor = (HICON)LoadCursor( NULL, (LPCTSTR)OCR_NORMAL );
PIC_Set( hCursor, 255, 255, 255 );
PIC_DrawTrans( uiStatic.cursorX, uiStatic.cursorY, w, h );
SET_CURSOR( hCursor );
}
/*
@ -873,6 +874,8 @@ void UI_UpdateMenu( float flTime )
if( !uiStatic.initialized )
return;
UI_DrawFinalCredits ();
if( !uiStatic.visible )
return;
@ -901,7 +904,6 @@ void UI_UpdateMenu( float flTime )
if( uiStatic.firstDraw )
{
UI_MouseMove( 0, 0 );
uiStatic.firstDraw = false;
static int first = TRUE;
@ -1011,11 +1013,9 @@ void UI_MouseMove( int x, int y )
if( !uiStatic.menuActive )
return;
x *= ui_sensitivity->value;
y *= ui_sensitivity->value;
uiStatic.cursorX += x;
uiStatic.cursorY += y;
// now menu uses absolute coordinates
uiStatic.cursorX = x;
uiStatic.cursorY = y;
if( UI_CursorInRect( 1, 1, ScreenWidth - 1, ScreenHeight - 1 ))
uiStatic.mouseInRect = true;
@ -1152,8 +1152,8 @@ void UI_GetCursorPos( int *pos_x, int *pos_y )
void UI_SetCursorPos( int pos_x, int pos_y )
{
uiStatic.cursorX = bound( 0, pos_x, ScreenWidth );
uiStatic.cursorY = bound( 0, pos_y, ScreenHeight );
// uiStatic.cursorX = bound( 0, pos_x, ScreenWidth );
// uiStatic.cursorY = bound( 0, pos_y, ScreenHeight );
uiStatic.mouseInRect = true;
}
@ -1378,7 +1378,6 @@ void UI_Init( void )
{
// register our cvars and commands
ui_precache = CVAR_REGISTER( "ui_precache", "0", FCVAR_ARCHIVE );
ui_sensitivity = CVAR_REGISTER( "ui_sensitivity", "1", FCVAR_ARCHIVE );
Cmd_AddCommand( "menu_main", UI_Main_Menu );
Cmd_AddCommand( "menu_newgame", UI_NewGame_Menu );

View File

@ -390,6 +390,7 @@ const char *UI_DefaultKey( menuFramework_s *menu, int key, int down );
const char *UI_ActivateItem( menuFramework_s *menu, menuCommon_s *item );
void UI_RefreshServerList( void );
int UI_CreditsActive( void );
void UI_DrawFinalCredits( void );
void UI_CloseMenu( void );
void UI_PushMenu( menuFramework_s *menu );

View File

@ -71,6 +71,7 @@ inline HIMAGE PIC_Load( const char *szPicName, const byte *ucRawImage, long ulRa
#define KEY_GetOverstrike (*g_engfuncs.pfnKeyGetOverstrikeMode)
#define KEY_SetOverstrike (*g_engfuncs.pfnKeySetOverstrikeMode)
#define Key_GetState (*g_engfuncs.pfnKeyGetState)
#define SET_CURSOR (*g_engfuncs.pfnSetCursor)
#define Cmd_AddCommand (*g_engfuncs.pfnAddCommand)
#define Cmd_RemoveCommand (*g_engfuncs.pfnDelCommand)
@ -87,6 +88,7 @@ inline HIMAGE PIC_Load( const char *szPicName, const byte *ucRawImage, long ulRa
#define HOST_ENDGAME (*g_engfuncs.pfnHostEndGame)
#define GET_CLIPBOARD (*g_engfuncs.pfnGetClipboardData)
#define FS_SEARCH (*g_engfuncs.pfnGetFilesList)
#define MAP_IS_VALID (*g_engfuncs.pfnIsMapValid)
#define GET_SAVE_COMMENT (*g_engfuncs.pfnGetSaveComment)
#define GET_DEMO_COMMENT (*g_engfuncs.pfnGetDemoComment)

View File

@ -5,144 +5,6 @@
#ifndef IMAGES_H
#define IMAGES_H
const byte cursor_tga[] =
{
0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,
0x00,0x20,0x00,0x20,0x08,0x00,0x0e,0x0a,0x00,0x0d,0x9e,0xff,0xff,
0xff,0x00,0x00,0x0e,0x0a,0x00,0x0d,0x9e,0xff,0xff,0xff,0x00,0x00,
0x0e,0x0a,0x00,0x0d,0x9e,0xff,0xff,0xff,0x00,0x00,0x0e,0x0a,0x00,
0x0d,0x9e,0xff,0xff,0xff,0x00,0x00,0x0e,0x0a,0x00,0x0d,0x9e,0xff,
0xff,0xff,0x00,0x00,0x0e,0x0a,0x00,0x0d,0x9e,0xff,0xff,0xff,0x00,
0x00,0x0e,0x0a,0x00,0x0d,0x9e,0xff,0xff,0xff,0x00,0x00,0x0e,0x0a,
0x00,0x0d,0x9e,0xff,0xff,0xff,0x00,0x00,0x0e,0x0a,0x00,0x0d,0x81,
0xff,0xff,0xff,0x00,0x84,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x06,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x00,0x94,0xff,0xff,0xff,
0x00,0x00,0x0e,0x0a,0x00,0x0d,0x81,0xff,0xff,0xff,0x00,0x84,0x00,
0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x6e,0x00,0x00,0x00,0xb2,0x00,
0x00,0x00,0x55,0x94,0xff,0xff,0xff,0x00,0x00,0x0e,0x0a,0x00,0x0d,
0x81,0xff,0xff,0xff,0x00,0x83,0x00,0x00,0x00,0x00,0x06,0x00,0x00,
0x00,0x1d,0x28,0x28,0x28,0xf3,0x45,0x45,0x45,0xff,0x00,0x00,0x00,
0xee,0x00,0x00,0x00,0xe2,0x00,0x00,0x00,0x96,0x00,0x00,0x00,0x02,
0x91,0xff,0xff,0xff,0x00,0x00,0x0e,0x0a,0x00,0x0d,0x81,0xff,0xff,
0xff,0x00,0x81,0x00,0x00,0x00,0x00,0x81,0xff,0xff,0xff,0x00,0x05,
0x00,0x00,0x00,0x6b,0xad,0xad,0xad,0xff,0xff,0xff,0xff,0xff,0xa8,
0xa8,0xa8,0xff,0x03,0x03,0x03,0xfc,0x00,0x00,0x00,0x3b,0x92,0xff,
0xff,0xff,0x00,0x00,0x0e,0x0a,0x00,0x0d,0x81,0xff,0xff,0xff,0x00,
0x81,0x00,0x00,0x00,0x00,0x06,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
0x13,0x34,0x34,0x34,0xee,0xfa,0xfa,0xfa,0xff,0xff,0xff,0xff,0xff,
0x8b,0x8b,0x8b,0xff,0x00,0x00,0x00,0xb4,0x93,0xff,0xff,0xff,0x00,
0x02,0x0e,0x0a,0x00,0x0d,0x00,0x00,0x00,0x17,0x00,0x00,0x00,0x03,
0x81,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x05,0x00,0x00,0x00,
0xb0,0xb4,0xb4,0xb4,0xff,0xff,0xff,0xff,0xff,0xeb,0xeb,0xeb,0xff,
0x16,0x16,0x16,0xfb,0x00,0x00,0x00,0x3a,0x93,0xff,0xff,0xff,0x00,
0x0a,0x0e,0x0a,0x00,0x0d,0x00,0x00,0x00,0xa9,0x00,0x00,0x00,0x6a,
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5a,0x35,
0x35,0x35,0xfa,0xfd,0xfd,0xfd,0xff,0xff,0xff,0xff,0xff,0x88,0x88,
0x88,0xff,0x00,0x00,0x00,0xb6,0x85,0xff,0xff,0xff,0x00,0x00,0x00,
0x00,0x00,0x00,0x8d,0xff,0xff,0xff,0x00,0x0a,0x0e,0x0a,0x00,0x0d,
0x07,0x07,0x07,0xf4,0x00,0x00,0x00,0xe8,0x00,0x00,0x00,0x76,0x00,
0x00,0x00,0x06,0x00,0x00,0x00,0xcf,0xb1,0xb1,0xb1,0xff,0xff,0xff,
0xff,0xff,0xf0,0xf0,0xf0,0xff,0x1c,0x1c,0x1c,0xfc,0x00,0x00,0x00,
0x3b,0x85,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x01,0x8d,0xff,
0xff,0xff,0x00,0x09,0x0e,0x0a,0x00,0x0d,0x52,0x52,0x52,0xee,0x80,
0x80,0x80,0xff,0x00,0x00,0x00,0xe9,0x00,0x00,0x00,0x9e,0x38,0x38,
0x38,0xf9,0xfd,0xfd,0xfd,0xff,0xff,0xff,0xff,0xff,0x8d,0x8d,0x8d,
0xff,0x00,0x00,0x00,0xb6,0x85,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
0x00,0x0a,0x8e,0xff,0xff,0xff,0x00,0x09,0x0e,0x0a,0x00,0x0d,0x54,
0x54,0x54,0xed,0xff,0xff,0xff,0xff,0x87,0x87,0x87,0xff,0x03,0x03,
0x03,0xff,0xaf,0xaf,0xaf,0xff,0xff,0xff,0xff,0xff,0xf4,0xf4,0xf4,
0xff,0x20,0x20,0x20,0xfc,0x00,0x00,0x00,0xa9,0x95,0xff,0xff,0xff,
0x00,0x01,0x0e,0x0a,0x00,0x0d,0x51,0x51,0x51,0xed,0x81,0xff,0xff,
0xff,0xff,0x05,0xc3,0xc3,0xc3,0xff,0xf8,0xf8,0xf8,0xff,0xff,0xff,
0xff,0xff,0x8b,0x8b,0x8b,0xff,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,
0xe9,0x81,0x00,0x00,0x00,0xea,0x02,0x00,0x00,0x00,0xe8,0x00,0x00,
0x00,0xde,0x00,0x00,0x00,0x2a,0x90,0xff,0xff,0xff,0x00,0x01,0x0e,
0x0a,0x00,0x0d,0x51,0x51,0x51,0xed,0x84,0xff,0xff,0xff,0xff,0x00,
0xc0,0xc0,0xc0,0xff,0x81,0xaa,0xaa,0xaa,0xff,0x03,0xad,0xad,0xad,
0xff,0x96,0x96,0x96,0xff,0x0e,0x0e,0x0e,0xf9,0x00,0x00,0x00,0x35,
0x91,0xff,0xff,0xff,0x00,0x01,0x0e,0x0a,0x00,0x0d,0x51,0x51,0x51,
0xed,0x88,0xff,0xff,0xff,0xff,0x01,0x4f,0x4f,0x4f,0xf9,0x00,0x00,
0x00,0x3d,0x92,0xff,0xff,0xff,0x00,0x01,0x0e,0x0a,0x00,0x0d,0x51,
0x51,0x51,0xed,0x86,0xff,0xff,0xff,0xff,0x02,0xf1,0xf1,0xf1,0xff,
0x43,0x43,0x43,0xfc,0x00,0x00,0x00,0x44,0x93,0xff,0xff,0xff,0x00,
0x01,0x0e,0x0a,0x00,0x0d,0x51,0x51,0x51,0xed,0x85,0xff,0xff,0xff,
0xff,0x02,0xf5,0xf5,0xf5,0xff,0x40,0x40,0x40,0xff,0x00,0x00,0x00,
0x4b,0x94,0xff,0xff,0xff,0x00,0x01,0x0e,0x0a,0x00,0x0d,0x51,0x51,
0x51,0xed,0x84,0xff,0xff,0xff,0xff,0x02,0xf9,0xf9,0xf9,0xff,0x50,
0x50,0x50,0xff,0x00,0x00,0x00,0x57,0x95,0xff,0xff,0xff,0x00,0x01,
0x0e,0x0a,0x00,0x0d,0x51,0x51,0x51,0xed,0x83,0xff,0xff,0xff,0xff,
0x02,0xf7,0xf7,0xf7,0xff,0x4f,0x4f,0x4f,0xff,0x00,0x00,0x00,0x5e,
0x96,0xff,0xff,0xff,0x00,0x01,0x0e,0x0a,0x00,0x0d,0x51,0x51,0x51,
0xed,0x82,0xff,0xff,0xff,0xff,0x02,0xfb,0xfb,0xfb,0xff,0x4f,0x4f,
0x4f,0xff,0x00,0x00,0x00,0x68,0x97,0xff,0xff,0xff,0x00,0x01,0x0e,
0x0a,0x00,0x0d,0x51,0x51,0x51,0xed,0x81,0xff,0xff,0xff,0xff,0x02,
0xfd,0xfd,0xfd,0xff,0x5d,0x5d,0x5d,0xff,0x00,0x00,0x00,0x74,0x87,
0xff,0xff,0xff,0x00,0x82,0x00,0x00,0x00,0x00,0x8d,0xff,0xff,0xff,
0x00,0x05,0x0e,0x0a,0x00,0x0d,0x51,0x51,0x51,0xed,0xff,0xff,0xff,
0xff,0xfc,0xfc,0xfc,0xff,0x5a,0x5a,0x5a,0xff,0x00,0x00,0x00,0x7d,
0x86,0xff,0xff,0xff,0x00,0x84,0x00,0x00,0x00,0x00,0x8d,0xff,0xff,
0xff,0x00,0x05,0x0e,0x0a,0x00,0x0d,0x56,0x56,0x56,0xed,0xff,0xff,
0xff,0xff,0x61,0x61,0x61,0xff,0x00,0x00,0x00,0x71,0x00,0x00,0x00,
0x02,0x83,0xff,0xff,0xff,0x00,0x87,0x00,0x00,0x00,0x00,0x8d,0xff,
0xff,0xff,0x00,0x06,0x0e,0x0a,0x00,0x0d,0x53,0x53,0x53,0xef,0x75,
0x75,0x75,0xff,0x00,0x00,0x00,0x97,0x00,0x00,0x00,0x02,0x00,0x00,
0x00,0x0e,0xff,0xff,0xff,0x00,0x8a,0x00,0x00,0x00,0x00,0x8d,0xff,
0xff,0xff,0x00,0x03,0x0e,0x0a,0x00,0x0d,0x06,0x06,0x06,0xfc,0x00,
0x00,0x00,0x9b,0x00,0x00,0x00,0x01,0x9b,0xff,0xff,0xff,0x00,0x02,
0x0e,0x0a,0x00,0x0d,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x05,0x8e,
0x00,0x00,0x00,0x00,0x8d,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x54,0x52,0x55,0x45,0x56,0x49,0x53,0x49,0x4f,
0x4e,0x2d,0x58,0x46,0x49,0x4c,0x45,0x2e,0x00,0x00
};
const byte typing_tga[] =
{
0x00,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,
0x00,0x20,0x00,0x20,0x08,0x9f,0xff,0xff,0xff,0x00,0x9f,0xff,0xff,
0xff,0x00,0x9f,0xff,0xff,0xff,0x00,0x9f,0xff,0xff,0xff,0x00,0x9f,
0xff,0xff,0xff,0x00,0x9f,0xff,0xff,0xff,0x00,0x9f,0xff,0xff,0xff,
0x00,0x9f,0xff,0xff,0xff,0x00,0x9f,0xff,0xff,0xff,0x00,0x9f,0xff,
0xff,0xff,0x00,0x9f,0xff,0xff,0xff,0x00,0x9f,0xff,0xff,0xff,0x00,
0x9f,0xff,0xff,0xff,0x00,0x9f,0xff,0xff,0xff,0x00,0x9f,0xff,0xff,
0xff,0x00,0x00,0xff,0xff,0xff,0x00,0x88,0x54,0x54,0x54,0xff,0x95,
0xff,0xff,0xff,0x00,0x02,0xff,0xff,0xff,0x00,0x54,0x54,0x54,0xff,
0xde,0xde,0xde,0xff,0x85,0xdf,0xdf,0xdf,0xff,0x00,0x54,0x54,0x54,
0xff,0x95,0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0x00,0x83,0x54,
0x54,0x54,0xff,0x00,0xdf,0xdf,0xdf,0xff,0x83,0x54,0x54,0x54,0xff,
0x95,0xff,0xff,0xff,0x00,0x81,0xff,0xff,0xff,0x00,0x81,0x00,0x00,
0x00,0x00,0x02,0x54,0x54,0x54,0xff,0xdf,0xdf,0xdf,0xff,0x54,0x54,
0x54,0xff,0x98,0xff,0xff,0xff,0x00,0x81,0xff,0xff,0xff,0x00,0x81,
0x00,0x00,0x00,0x00,0x02,0x54,0x54,0x54,0xff,0xde,0xde,0xde,0xff,
0x54,0x54,0x54,0xff,0x98,0xff,0xff,0xff,0x00,0x81,0xff,0xff,0xff,
0x00,0x81,0x00,0x00,0x00,0x00,0x02,0x54,0x54,0x54,0xff,0xdf,0xdf,
0xdf,0xff,0x54,0x54,0x54,0xff,0x98,0xff,0xff,0xff,0x00,0x81,0xff,
0xff,0xff,0x00,0x81,0x00,0x00,0x00,0x00,0x02,0x54,0x54,0x54,0xff,
0xde,0xde,0xde,0xff,0x54,0x54,0x54,0xff,0x98,0xff,0xff,0xff,0x00,
0x81,0xff,0xff,0xff,0x00,0x81,0x00,0x00,0x00,0x00,0x02,0x54,0x54,
0x54,0xff,0xdf,0xdf,0xdf,0xff,0x54,0x54,0x54,0xff,0x98,0xff,0xff,
0xff,0x00,0x81,0xff,0xff,0xff,0x00,0x81,0x00,0x00,0x00,0x00,0x02,
0x54,0x54,0x54,0xff,0xde,0xde,0xde,0xff,0x54,0x54,0x54,0xff,0x98,
0xff,0xff,0xff,0x00,0x81,0xff,0xff,0xff,0x00,0x81,0x00,0x00,0x00,
0x00,0x02,0x54,0x54,0x54,0xff,0xdf,0xdf,0xdf,0xff,0x54,0x54,0x54,
0xff,0x98,0xff,0xff,0xff,0x00,0x81,0xff,0xff,0xff,0x00,0x81,0x00,
0x00,0x00,0x00,0x02,0x54,0x54,0x54,0xff,0xdf,0xdf,0xdf,0xff,0x54,
0x54,0x54,0xff,0x98,0xff,0xff,0xff,0x00,0x81,0xff,0xff,0xff,0x00,
0x81,0x00,0x00,0x00,0x00,0x02,0x54,0x54,0x54,0xff,0xdf,0xdf,0xdf,
0xff,0x54,0x54,0x54,0xff,0x98,0xff,0xff,0xff,0x00,0x81,0xff,0xff,
0xff,0x00,0x81,0x00,0x00,0x00,0x00,0x02,0x54,0x54,0x54,0xff,0xdf,
0xdf,0xdf,0xff,0x54,0x54,0x54,0xff,0x98,0xff,0xff,0xff,0x00,0x81,
0xff,0xff,0xff,0x00,0x81,0x00,0x00,0x00,0x00,0x02,0x54,0x54,0x54,
0xff,0xdf,0xdf,0xdf,0xff,0x54,0x54,0x54,0xff,0x98,0xff,0xff,0xff,
0x00,0x00,0xff,0xff,0xff,0x00,0x83,0x54,0x54,0x54,0xff,0x00,0xde,
0xde,0xde,0xff,0x83,0x54,0x54,0x54,0xff,0x95,0xff,0xff,0xff,0x00,
0x04,0xff,0xff,0xff,0x00,0x54,0x54,0x54,0xff,0xde,0xde,0xde,0xff,
0xdf,0xdf,0xdf,0xff,0xde,0xde,0xde,0xff,0x83,0xdf,0xdf,0xdf,0xff,
0x00,0x54,0x54,0x54,0xff,0x95,0xff,0xff,0xff,0x00,0x00,0xff,0xff,
0xff,0x00,0x88,0x54,0x54,0x54,0xff,0x95,0xff,0xff,0xff,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x54,0x52,0x55,0x45,0x56,0x49,
0x53,0x49,0x4f,0x4e,0x2d,0x58,0x46,0x49,0x4c,0x45,0x2e,0x00,0x00
};
const byte font_tga[] =
{

View File

@ -54,7 +54,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /opt:nowin98
# ADD LINK32 msvcrt.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /def:".\mainui.def" /out:"..\temp\mainui\!release/menu.dll" /opt:nowin98
# ADD LINK32 msvcrt.lib user32.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /def:".\mainui.def" /out:"..\temp\mainui\!release/menu.dll" /opt:nowin98
# SUBTRACT LINK32 /profile /nodefaultlib
# Begin Custom Build
TargetDir=\Xash3D\src_main\temp\mainui\!release
@ -91,7 +91,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /def:".\mainui.def" /pdbtype:sept
# ADD LINK32 msvcrtd.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /def:".\mainui.def" /out:"..\temp\mainui\!debug/menu.dll" /pdbtype:sept
# ADD LINK32 msvcrtd.lib user32.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /def:".\mainui.def" /out:"..\temp\mainui\!debug/menu.dll" /pdbtype:sept
# SUBTRACT LINK32 /incremental:no /nodefaultlib
# Begin Custom Build
TargetDir=\Xash3D\src_main\temp\mainui\!debug

View File

@ -150,7 +150,7 @@ void UI_LoadBmpButtons( void )
int CuttedBmpSize = sizeof( bmphdr_t ) + pInfoHdr->biSize + pallete_sz + cutted_img_sz;
byte *img_data = &bmp_buffer[bmp_len_holder-cutted_img_sz];
if (pInfoHdr->biBitCount==8)
if ( pInfoHdr->biBitCount == 8 )
{
byte*pallete=&bmp_buffer[sizeof( bmphdr_t ) + pInfoHdr->biSize];
byte*firstpixel_col=&pallete[img_data[0]*4];
@ -165,7 +165,7 @@ void UI_LoadBmpButtons( void )
byte *raw_img_buff = (byte *)MALLOC( sizeof( bmphdr_t ) + pInfoHdr->biSize + pallete_sz + cutted_img_sz );
// 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 : PC_BUTTONCOUNT - 2;
for( int i = 0; i < pic_count; i++ )
{

View File

@ -86,6 +86,9 @@ UI_CreateGame_Begin
*/
static void UI_CreateGame_Begin( void )
{
if( !MAP_IS_VALID( uiCreateGame.mapName[uiCreateGame.mapsList.curItem] ))
return; // bad map
if( CVAR_GET_FLOAT( "host_serverstate" ))
CLIENT_COMMAND( TRUE, "killserver\n" );
@ -465,6 +468,9 @@ UI_CreateGame_Menu
*/
void UI_CreateGame_Menu( void )
{
if ( gMenu.m_gameinfo.gamemode == GAME_SINGLEPLAYER_ONLY )
return;
UI_CreateGame_Precache();
UI_CreateGame_Init();

View File

@ -115,6 +115,7 @@ UI_Credits_DrawFunc
static void UI_Credits_DrawFunc( void )
{
int i, y;
float speed = 40.0f;
int w = UI_MED_CHAR_WIDTH;
int h = UI_MED_CHAR_HEIGHT;
int color = 0;
@ -122,12 +123,14 @@ static void UI_Credits_DrawFunc( void )
// draw the background first
if( !uiCredits.finalCredits && !CVAR_GET_FLOAT( "sv_background" ))
UI_DrawPic( 0, 0, 1024 * uiStatic.scaleX, 768 * uiStatic.scaleY, uiColorWhite, ART_BACKGROUND );
else speed = 45.0f; // syncronize with final background track :-)
// otherwise running on cutscene
// now draw the credits
UI_ScaleCoords( NULL, NULL, &w, &h );
y = ScreenHeight - (( uiStatic.realTime - uiCredits.startTime ) / 40.0f );
y = ScreenHeight - (((gpGlobals->time * 1000) - uiCredits.startTime ) / speed );
// draw the credits
for ( i = 0; i < uiCredits.numLines && uiCredits.credits[i]; i++, y += 20 )
@ -137,7 +140,7 @@ static void UI_Credits_DrawFunc( void )
if(( y < ( ScreenHeight - h ) / 2 ) && i == uiCredits.numLines - 1 )
{
if( !uiCredits.fadeTime ) uiCredits.fadeTime = uiStatic.realTime;
if( !uiCredits.fadeTime ) uiCredits.fadeTime = (gpGlobals->time * 1000);
color = UI_FadeAlpha( uiCredits.fadeTime, uiCredits.showTime );
if( UnpackAlpha( color ))
UI_DrawString( 0, ( ScreenHeight - h ) / 2, 1024 * uiStatic.scaleX, h, uiCredits.credits[i], color, true, w, h, 1, true );
@ -235,15 +238,21 @@ static void UI_Credits_Init( void )
}
// run credits
uiCredits.startTime = uiStatic.realTime + 500; // make half-seconds delay
uiCredits.showTime = bound( 100, strlen( uiCredits.credits[uiCredits.numLines - 1]) * 1000, 12000 );
uiCredits.startTime = (gpGlobals->time * 1000) + 500; // make half-seconds delay
uiCredits.showTime = bound( 1000, strlen( uiCredits.credits[uiCredits.numLines - 1]) * 1000, 10000 );
uiCredits.fadeTime = 0; // will be determined later
uiCredits.active = true;
}
void UI_DrawFinalCredits( void )
{
if( uiCredits.finalCredits && uiCredits.active )
UI_Credits_DrawFunc ();
}
int UI_CreditsActive( void )
{
return uiCredits.active;
return uiCredits.active && uiCredits.finalCredits;
}
/*
@ -271,6 +280,6 @@ void UI_Credits_Menu( void )
void UI_FinalCredits( void )
{
UI_Credits_Menu();
uiCredits.finalCredits = true;
UI_Credits_Init();
}

View File

@ -164,6 +164,9 @@ static void UI_LanGame_GetGamesList( void )
// calculate number of visible rows
uiLanGame.gameList.numRows = (uiLanGame.gameList.generic.height2 / uiLanGame.gameList.generic.charHeight) - 2;
if( uiLanGame.gameList.numRows > uiLanGame.gameList.numItems ) uiLanGame.gameList.numRows = uiLanGame.gameList.numItems;
if( uiStatic.numServers )
uiLanGame.joinGame.generic.flags &= ~QMF_GRAYED;
}
/*
@ -299,7 +302,7 @@ static void UI_LanGame_Init( void )
uiLanGame.joinGame.generic.id = ID_JOINGAME;
uiLanGame.joinGame.generic.type = QMTYPE_BM_BUTTON;
uiLanGame.joinGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
uiLanGame.joinGame.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_GRAYED;
uiLanGame.joinGame.generic.x = 72;
uiLanGame.joinGame.generic.y = 230;
uiLanGame.joinGame.generic.name = "Join game";
@ -453,6 +456,9 @@ UI_LanGame_Menu
*/
void UI_LanGame_Menu( void )
{
if ( gMenu.m_gameinfo.gamemode == GAME_SINGLEPLAYER_ONLY )
return;
UI_LanGame_Precache();
UI_LanGame_Init();

View File

@ -208,6 +208,9 @@ UI_MultiPlayer_Menu
*/
void UI_MultiPlayer_Menu( void )
{
if ( gMenu.m_gameinfo.gamemode == GAME_SINGLEPLAYER_ONLY )
return;
UI_MultiPlayer_Precache();
UI_MultiPlayer_Init();

View File

@ -476,6 +476,9 @@ UI_PlayerSetup_Menu
*/
void UI_PlayerSetup_Menu( void )
{
if ( gMenu.m_gameinfo.gamemode == GAME_SINGLEPLAYER_ONLY )
return;
UI_PlayerSetup_Precache();
UI_PlayerSetup_Init();