22 Mar 2011

This commit is contained in:
g-cont 2011-03-22 00:00:00 +03:00 committed by Alibek Omarov
parent bbf9dede90
commit b22f91358d
14 changed files with 72 additions and 12 deletions

View File

@ -432,7 +432,7 @@ void CL_WritePacket( void )
{
if(( host.realtime - cls.netchan.last_received ) > CONNECTION_PROBLEM_TIME && !cls.demoplayback )
{
MsgDev( D_WARN, "^1 Connection Problem^7\n" );
Con_NPrintf( 1, "^3Warning:^1 Connection Problem^7\n" );
cl.validsequence = 0;
}
}

View File

@ -8,6 +8,7 @@
#include "gl_local.h"
#include "vgui_draw.h"
convar_t *vgui_colorstrings;
int g_textures[VGUI_MAX_TEXTURES];
int g_textureId = 0;
int g_iBoundTexture;
@ -23,6 +24,8 @@ void VGUI_DrawInit( void )
{
Q_memset( g_textures, 0, sizeof( g_textures ));
g_textureId = g_iBoundTexture = 0;
vgui_colorstrings = Cvar_Get( "vgui_colorstrings", "0", CVAR_ARCHIVE, "allow colorstrings in VGUI texts" );
}
/*

View File

@ -11,6 +11,9 @@ extern "C" {
#define VGUI_MAX_TEXTURES 2048 // a half of total textures count
extern rgba_t g_color_table[8]; // for colored strings support
extern convar_t *vgui_colorstrings;
// VGUI generic vertex
typedef struct
{

View File

@ -139,6 +139,9 @@ void CEngineSurface :: drawSetTextPos( int x, int y )
void CEngineSurface :: drawPrintText( const char* text, int textLen )
{
static bool hasColor = 0;
static int numColor = 7;
if( !text || !_hCurrentFont || _drawTextColor[3] >= 255 )
return;
@ -147,7 +150,38 @@ void CEngineSurface :: drawPrintText( const char* text, int textLen )
int iTall = _hCurrentFont->getTall();
int iTotalWidth = 0;
int j, iTotalWidth = 0;
int curTextColor[4];
// HACKHACK: allow color strings in VGUI
if( numColor != 7 && vgui_colorstrings->integer )
{
for( j = 0; j < 3; j++ ) // grab predefined color
curTextColor[j] = g_color_table[numColor][j];
}
else
{
for( j = 0; j < 3; j++ ) // revert default color
curTextColor[j] = _drawTextColor[j];
}
curTextColor[3] = _drawTextColor[3]; // copy alpha
if( textLen == 1 && vgui_colorstrings->integer )
{
if( *text == '^' )
{
hasColor = true;
return; // skip '^'
}
else if( hasColor && isdigit( *text ))
{
numColor = ColorIndex( *text );
hasColor = false; // handled
return; // skip colornum
}
else hasColor = false;
}
for( int i = 0; i < textLen; i++ )
{
char ch = text[i];
@ -188,7 +222,7 @@ void CEngineSurface :: drawPrintText( const char* text, int textLen )
continue;
drawSetTexture( iTexId );
VGUI_SetupDrawingText( _drawTextColor );
VGUI_SetupDrawingText( curTextColor );
VGUI_DrawQuad( &clippedRect[0], &clippedRect[1] ); // draw the letter
}

View File

@ -27,6 +27,7 @@ extern "C" {
// color strings
#define IsColorString( p ) ( p && *( p ) == '^' && *(( p ) + 1) && *(( p ) + 1) >= '0' && *(( p ) + 1 ) <= '9' )
#define ColorIndex( c ) ((( c ) - '0' ) & 7 )
typedef unsigned long dword;
typedef unsigned int uint;

View File

@ -19,7 +19,6 @@ convar_t *con_fontsize;
#define COLOR_DEFAULT '7'
#define CON_HISTORY 64
#define MAX_DBG_NOTIFY 128
#define ColorIndex( c ) ((( c ) - '0' ) & 7 )
#define CON_TEXTSIZE 131072 // 128 kb buffer

View File

@ -782,7 +782,15 @@ int EXPORT Host_Main( const char *progname, int bChangeGame, pfnChangeGame func
}
// allow to change game from the console
if( pChangeGame != NULL ) Cmd_AddCommand( "game", Host_ChangeGame_f, "change game" );
if( pChangeGame != NULL )
{
Cmd_AddCommand( "game", Host_ChangeGame_f, "change game" );
Cvar_Get( "host_allow_changegame", "1", CVAR_READ_ONLY, "allows to change games" );
}
else
{
Cvar_Get( "host_allow_changegame", "0", CVAR_READ_ONLY, "allows to change games" );
}
host.errorframe = 0;
Cbuf_Execute();

View File

@ -233,7 +233,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
{
char buf[512], trim[512];
char *pCurrentText = NULL, *pNameHeap;
char currentName[512], nameHeap[16384];
char currentName[512], nameHeap[32768];
int mode = MSGFILE_NAME; // searching for a message name
int lineNumber, filePos, lastLinePos;
client_textmessage_t textMessages[MAX_MESSAGES];
@ -281,7 +281,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
int length = Q_strlen( currentName );
// save name on name heap
if( lastNamePos + length > 8192 )
if( lastNamePos + length > 16384 )
{
MsgDev( D_ERROR, "TextMessage: error while parsing!\n" );
return;

View File

@ -3825,7 +3825,7 @@ pfnEndSection
*/
void pfnEndSection( const char *pszSection )
{
if( !Q_stricmp( "credits", pszSection ))
if( !Q_stricmp( "oem_end_credits", pszSection ))
Host_Credits ();
else Host_EndGame( pszSection );
}

View File

@ -12,7 +12,7 @@ typedef int (*pfnInit)( const char *progname, int bChangeGame, pfnChangeGame fun
typedef void (*pfnShutdown)( void );
pfnInit Host_Main;
pfnShutdown Host_Shutdown;
pfnShutdown Host_Shutdown = NULL;
char szGameDir[128]; // safe place to keep gamedir
HINSTANCE hEngine;

BIN
game_launch/game.ncb Normal file

Binary file not shown.

BIN
game_launch/game.opt Normal file

Binary file not shown.

View File

@ -371,6 +371,10 @@ UI_CustomGame_Menu
*/
void UI_CustomGame_Menu( void )
{
// current instance is not support game change
if( !CVAR_GET_FLOAT( "host_allow_changegame" ))
return;
UI_CustomGame_Precache();
UI_CustomGame_Init();

View File

@ -317,6 +317,7 @@ UI_Main_Init
static void UI_Main_Init( void )
{
bool bTrainMap;
bool bCustomGame;
memset( &uiMain, 0, sizeof( uiMain_t ));
@ -325,6 +326,10 @@ static void UI_Main_Init( void )
bTrainMap = true;
else bTrainMap = false;
if( CVAR_GET_FLOAT( "host_allow_changegame" ))
bCustomGame = true;
else bCustomGame = false;
// precache .avi file and get logo width and height
PRECACHE_LOGO( "logo.avi" );
@ -466,7 +471,7 @@ static void UI_Main_Init( void )
uiMain.credits.generic.name = "About";
uiMain.credits.generic.statusText = "Game credits";
uiMain.credits.generic.x = 72;
uiMain.credits.generic.y = bTrainMap ? 580 : 530;
uiMain.credits.generic.y = (bCustomGame) ? (bTrainMap ? 580 : 530) : (bTrainMap ? 530 : 480);
uiMain.credits.generic.callback = UI_Main_Callback;
UI_UtilSetupPicButton( &uiMain.credits, PC_VIEW_README );
@ -477,7 +482,7 @@ static void UI_Main_Init( void )
uiMain.quit.generic.name = "Quit";
uiMain.quit.generic.statusText = "Quit from game";
uiMain.quit.generic.x = 72;
uiMain.quit.generic.y = bTrainMap ? 630 : 580;
uiMain.quit.generic.y = (bCustomGame) ? (bTrainMap ? 630 : 580) : (bTrainMap ? 580 : 530);
uiMain.quit.generic.callback = UI_Main_Callback;
UI_UtilSetupPicButton( &uiMain.quit, PC_QUIT );
@ -568,7 +573,10 @@ static void UI_Main_Init( void )
UI_AddItem( &uiMain.menu, (void *)&uiMain.saveRestore );
UI_AddItem( &uiMain.menu, (void *)&uiMain.configuration );
UI_AddItem( &uiMain.menu, (void *)&uiMain.multiPlayer );
UI_AddItem( &uiMain.menu, (void *)&uiMain.customGame );
if ( bCustomGame )
UI_AddItem( &uiMain.menu, (void *)&uiMain.customGame );
UI_AddItem( &uiMain.menu, (void *)&uiMain.credits );
UI_AddItem( &uiMain.menu, (void *)&uiMain.quit );
UI_AddItem( &uiMain.menu, (void *)&uiMain.minimizeBtn );