17 Jul 2017

This commit is contained in:
g-cont 2017-07-17 00:00:00 +03:00 committed by Alibek Omarov
parent 45c51675de
commit 596de93657
12 changed files with 78 additions and 18 deletions

View File

@ -692,6 +692,13 @@ void CL_ParseServerData( sizebuf_t *msg )
Q_strncpy( gamefolder, MSG_ReadString( msg ), MAX_STRING ); Q_strncpy( gamefolder, MSG_ReadString( msg ), MAX_STRING );
host.features = (uint)MSG_ReadLong( msg ); host.features = (uint)MSG_ReadLong( msg );
if( Con_FixedFont( ))
{
// seperate the printfs so the server message can have a color
Con_Print( "\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n" );
Con_Print( va( "%c%s\n\n", 2, clgame.maptitle ));
}
// receive the player hulls // receive the player hulls
for( i = 0; i < MAX_MAP_HULLS * 3; i++ ) for( i = 0; i < MAX_MAP_HULLS * 3; i++ )
{ {
@ -789,6 +796,7 @@ void CL_ParseServerData( sizebuf_t *msg )
memset( &clgame.movevars, 0, sizeof( clgame.movevars )); memset( &clgame.movevars, 0, sizeof( clgame.movevars ));
memset( &clgame.oldmovevars, 0, sizeof( clgame.oldmovevars )); memset( &clgame.oldmovevars, 0, sizeof( clgame.oldmovevars ));
memset( &clgame.centerPrint, 0, sizeof( clgame.centerPrint ));
} }
/* /*

View File

@ -88,7 +88,7 @@ CL_IsPredicted
*/ */
qboolean CL_IsPredicted( void ) qboolean CL_IsPredicted( void )
{ {
if( cl_nopred->value ) if( cl_nopred->value || cl.intermission )
return false; return false;
return true; return true;
} }
@ -100,6 +100,8 @@ CL_LocalWeapons
*/ */
qboolean CL_LocalWeapons( void ) qboolean CL_LocalWeapons( void )
{ {
if( cl.intermission )
return false;
if( cl_lw && cl_lw->value ) if( cl_lw && cl_lw->value )
return true; return true;
return false; return false;
@ -1238,7 +1240,7 @@ void CL_PredictMovement( qboolean repredicting )
CL_SetUpPlayerPrediction( false, false ); CL_SetUpPlayerPrediction( false, false );
if( !cl.validsequence || cl.intermission ) if( !cl.validsequence )
return; return;
if(( cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged ) >= CL_UPDATE_MASK ) if(( cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged ) >= CL_UPDATE_MASK )

View File

@ -480,6 +480,7 @@ qboolean SCR_LoadFixedWidthFont( const char *fontname )
cls.creditsFont.hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_IMAGE, NULL ); cls.creditsFont.hFontTexture = GL_LoadTexture( fontname, NULL, 0, TF_IMAGE, NULL );
R_GetTextureParms( &fontWidth, NULL, cls.creditsFont.hFontTexture ); R_GetTextureParms( &fontWidth, NULL, cls.creditsFont.hFontTexture );
cls.creditsFont.charHeight = clgame.scrInfo.iCharHeight = fontWidth / 16; cls.creditsFont.charHeight = clgame.scrInfo.iCharHeight = fontWidth / 16;
cls.creditsFont.type = FONT_FIXED;
cls.creditsFont.valid = true; cls.creditsFont.valid = true;
// build fixed rectangles // build fixed rectangles
@ -519,6 +520,7 @@ qboolean SCR_LoadVariableWidthFont( const char *fontname )
{ {
src = (qfont_t *)buffer; src = (qfont_t *)buffer;
cls.creditsFont.charHeight = clgame.scrInfo.iCharHeight = src->rowheight; cls.creditsFont.charHeight = clgame.scrInfo.iCharHeight = src->rowheight;
cls.creditsFont.type = FONT_VARIABLE;
// build rectangles // build rectangles
for( i = 0; i < 256; i++ ) for( i = 0; i < 256; i++ )

View File

@ -294,12 +294,16 @@ typedef struct
pfnEventHook func; // user-defined function pfnEventHook func; // user-defined function
} cl_user_event_t; } cl_user_event_t;
#define FONT_FIXED 0
#define FONT_VARIABLE 1
typedef struct typedef struct
{ {
int hFontTexture; // handle to texture int hFontTexture; // handle to texture
wrect_t fontRc[256]; // rectangles wrect_t fontRc[256]; // rectangles
byte charWidths[256]; byte charWidths[256];
int charHeight; int charHeight;
int type;
qboolean valid; // all rectangles are valid qboolean valid; // all rectangles are valid
} cl_font_t; } cl_font_t;
@ -732,6 +736,7 @@ int pfnDecalIndexFromName( const char *szDecalName );
int pfnIndexFromTrace( struct pmtrace_s *pTrace ); int pfnIndexFromTrace( struct pmtrace_s *pTrace );
void NetAPI_CancelAllRequests( void ); void NetAPI_CancelAllRequests( void );
int CL_FindModelIndex( const char *m ); int CL_FindModelIndex( const char *m );
cl_entity_t *CL_GetLocalPlayer( void );
model_t *CL_LoadClientSprite( const char *filename ); model_t *CL_LoadClientSprite( const char *filename );
HSPRITE pfnSPR_Load( const char *szPicName ); HSPRITE pfnSPR_Load( const char *szPicName );
HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags ); HSPRITE pfnSPR_LoadExt( const char *szPicName, uint texFlags );
@ -885,6 +890,7 @@ void CL_RunLightStyles( void );
// //
extern convar_t *con_fontsize; extern convar_t *con_fontsize;
qboolean Con_Visible( void ); qboolean Con_Visible( void );
qboolean Con_FixedFont( void );
void Con_VidInit( void ); void Con_VidInit( void );
void Con_Shutdown( void ); void Con_Shutdown( void );
void Con_ToggleConsole_f( void ); void Con_ToggleConsole_f( void );

View File

@ -535,7 +535,7 @@ void *Mod_LoadAllSkins( int numskins, daliasskintype_t *pskintype )
{ {
if( pskintype->type == ALIAS_SKIN_SINGLE ) if( pskintype->type == ALIAS_SKIN_SINGLE )
{ {
Mod_FloodFillSkin( skin, m_pAliasHeader->skinwidth, m_pAliasHeader->skinheight ); // Mod_FloodFillSkin( skin, m_pAliasHeader->skinwidth, m_pAliasHeader->skinheight );
// save 8 bit texels for the player model to remap // save 8 bit texels for the player model to remap
m_pAliasHeader->texels[i] = Mem_Alloc( loadmodel->mempool, size ); m_pAliasHeader->texels[i] = Mem_Alloc( loadmodel->mempool, size );
@ -574,7 +574,7 @@ void *Mod_LoadAllSkins( int numskins, daliasskintype_t *pskintype )
for( j = 0; j < groupskins; j++ ) for( j = 0; j < groupskins; j++ )
{ {
Mod_FloodFillSkin( skin, m_pAliasHeader->skinwidth, m_pAliasHeader->skinheight ); // Mod_FloodFillSkin( skin, m_pAliasHeader->skinwidth, m_pAliasHeader->skinheight );
if( j == 0 ) if( j == 0 )
{ {
m_pAliasHeader->texels[i] = Mem_Alloc( loadmodel->mempool, size ); m_pAliasHeader->texels[i] = Mem_Alloc( loadmodel->mempool, size );

View File

@ -69,6 +69,7 @@ particle_t *cl_active_tracers;
particle_t *cl_free_particles; particle_t *cl_free_particles;
particle_t *cl_particles = NULL; // particle pool particle_t *cl_particles = NULL; // particle pool
static vec3_t cl_avelocities[NUMVERTEXNORMALS]; static vec3_t cl_avelocities[NUMVERTEXNORMALS];
static float cl_lasttimewarn = 0.0f;
/* /*
================ ================
@ -221,7 +222,12 @@ particle_t *R_AllocParticle( void (*callback)( particle_t*, float ))
if( !cl_free_particles ) if( !cl_free_particles )
{ {
MsgDev( D_ERROR, "Overflow %d particles\n", GI->max_particles ); if( cl_lasttimewarn < host.realtime )
{
// don't spam about overflow
MsgDev( D_ERROR, "Overflow %d particles\n", GI->max_particles );
cl_lasttimewarn = host.realtime + 1.0f;
}
return NULL; return NULL;
} }
@ -267,7 +273,12 @@ particle_t *R_AllocTracer( const vec3_t org, const vec3_t vel, float life )
if( !cl_free_particles ) if( !cl_free_particles )
{ {
MsgDev( D_ERROR, "Overflow %d tracers\n", GI->max_particles ); if( cl_lasttimewarn < host.realtime )
{
// don't spam about overflow
MsgDev( D_ERROR, "Overflow %d tracers\n", GI->max_particles );
cl_lasttimewarn = host.realtime + 1.0f;
}
return NULL; return NULL;
} }

View File

@ -1294,7 +1294,7 @@ int S_GetCurrentDynamicSounds( soundlist_t *pout, int size )
looped = ( channels[i].use_loop && channels[i].sfx->cache->loopStart != -1 ); looped = ( channels[i].use_loop && channels[i].sfx->cache->loopStart != -1 );
if( channels[i].entchannel == CHAN_STATIC && looped ) if( channels[i].entchannel == CHAN_STATIC && looped && !FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
continue; // never serialize static looped sounds. It will be restoring in game code continue; // never serialize static looped sounds. It will be restoring in game code
if( channels[i].isSentence && channels[i].name[0] ) if( channels[i].isSentence && channels[i].name[0] )

View File

@ -534,6 +534,18 @@ qboolean Con_Visible( void )
return (con.vislines > 0); return (con.vislines > 0);
} }
/*
================
Con_FixedFont
================
*/
qboolean Con_FixedFont( void )
{
if( con.curFont && con.curFont->valid && con.curFont->type == FONT_FIXED )
return true;
return false;
}
static qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font ) static qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font )
{ {
int i, fontWidth; int i, fontWidth;
@ -550,6 +562,7 @@ static qboolean Con_LoadFixedWidthFont( const char *fontname, cl_font_t *font )
if( font->hFontTexture && fontWidth != 0 ) if( font->hFontTexture && fontWidth != 0 )
{ {
font->charHeight = fontWidth / 16; font->charHeight = fontWidth / 16;
font->type = FONT_FIXED;
// build fixed rectangles // build fixed rectangles
for( i = 0; i < 256; i++ ) for( i = 0; i < 256; i++ )
@ -592,6 +605,7 @@ static qboolean Con_LoadVariableWidthFont( const char *fontname, cl_font_t *font
{ {
src = (qfont_t *)buffer; src = (qfont_t *)buffer;
font->charHeight = src->rowheight; font->charHeight = src->rowheight;
font->type = FONT_VARIABLE;
// build rectangles // build rectangles
for( i = 0; i < 256; i++ ) for( i = 0; i < 256; i++ )
@ -694,7 +708,7 @@ static int Con_DrawGenericChar( int x, int y, int number, rgba_t color )
if( !con.curFont || !con.curFont->valid ) if( !con.curFont || !con.curFont->valid )
return 0; return 0;
if( number < 32 ) return 0; // if( number < 32 ) return 0;
if( y < -con.curFont->charHeight ) if( y < -con.curFont->charHeight )
return 0; return 0;
@ -966,11 +980,19 @@ void Con_Print( const char *txt )
static int cr_pending = 0; static int cr_pending = 0;
static char buf[MAX_PRINT_MSG]; static char buf[MAX_PRINT_MSG];
static int bufpos = 0; static int bufpos = 0;
int c, mask;
// client not running // client not running
if( !con.initialized || !con.buffer || host.type == HOST_DEDICATED ) if( !con.initialized || !con.buffer || host.type == HOST_DEDICATED )
return; return;
if( txt[0] == 2 )
{
mask = 128; // go to colored text
txt++;
}
else mask = 0;
for( ; *txt; txt++ ) for( ; *txt; txt++ )
{ {
if( cr_pending ) if( cr_pending )
@ -979,7 +1001,9 @@ void Con_Print( const char *txt )
cr_pending = 0; cr_pending = 0;
} }
switch( *txt ) c = *txt;
switch( c )
{ {
case '\0': case '\0':
break; break;
@ -993,7 +1017,7 @@ void Con_Print( const char *txt )
bufpos = 0; bufpos = 0;
break; break;
default: default:
buf[bufpos++] = *txt; buf[bufpos++] = c | mask;
if(( bufpos >= sizeof( buf ) - 1 ) || bufpos >= ( con.linewidth - 1 )) if(( bufpos >= sizeof( buf ) - 1 ) || bufpos >= ( con.linewidth - 1 ))
{ {
Con_AddLine( buf, bufpos ); Con_AddLine( buf, bufpos );

View File

@ -582,6 +582,8 @@ void Sys_Print( const char *pMsg )
} }
else else
{ {
if( msg[i] == '\1' || msg[i] == '\2' )
i++;
*b = *c = msg[i]; *b = *c = msg[i];
b++, c++; b++, c++;
} }

View File

@ -1928,6 +1928,8 @@ void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float
msg_dest = MSG_INIT; msg_dest = MSG_INIT;
else if( chan == CHAN_STATIC ) else if( chan == CHAN_STATIC )
msg_dest = MSG_ALL; msg_dest = MSG_ALL;
else if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ))
msg_dest = MSG_ALL;
else msg_dest = MSG_PAS_R; else msg_dest = MSG_PAS_R;
// always sending stop sound command // always sending stop sound command
@ -2726,9 +2728,10 @@ void pfnWriteString( const char *src )
int len = Q_strlen( src ) + 1; int len = Q_strlen( src ) + 1;
int rem = (255 - svgame.msg_realsize); int rem = (255 - svgame.msg_realsize);
if( len >= rem ) if( len == 1 || len >= rem )
{ {
MsgDev( D_ERROR, "pfnWriteString: exceeds %i symbols\n", rem ); if( len >= rem )
MsgDev( D_ERROR, "pfnWriteString: exceeds %i symbols\n", rem );
MSG_WriteChar( &sv.multicast, 0 ); MSG_WriteChar( &sv.multicast, 0 );
svgame.msg_realsize += 1; svgame.msg_realsize += 1;
return; return;

View File

@ -58,6 +58,8 @@ int SV_ModelIndex( const char *filename )
if( sv.state != ss_loading ) if( sv.state != ss_loading )
{ {
MsgDev( D_WARN, "late precache of %s\n", name );
// send the update to everyone // send the update to everyone
MSG_BeginServerCmd( &sv.reliable_datagram, svc_modelindex ); MSG_BeginServerCmd( &sv.reliable_datagram, svc_modelindex );
MSG_WriteUBitLong( &sv.reliable_datagram, i, MAX_MODEL_BITS ); MSG_WriteUBitLong( &sv.reliable_datagram, i, MAX_MODEL_BITS );
@ -103,6 +105,8 @@ int SV_SoundIndex( const char *filename )
if( sv.state != ss_loading ) if( sv.state != ss_loading )
{ {
MsgDev( D_WARN, "late precache of %s\n", name );
// send the update to everyone // send the update to everyone
MSG_BeginServerCmd( &sv.reliable_datagram, svc_soundindex ); MSG_BeginServerCmd( &sv.reliable_datagram, svc_soundindex );
MSG_WriteUBitLong( &sv.reliable_datagram, i, MAX_SOUND_BITS ); MSG_WriteUBitLong( &sv.reliable_datagram, i, MAX_SOUND_BITS );

View File

@ -2035,7 +2035,7 @@ int SV_SaveGameSlot( const char *pSaveName, const char *pSaveComment )
return 1; return 1;
} }
int SV_SaveReadHeader( file_t *pFile, GAME_HEADER *pHeader, int readGlobalState ) int SV_SaveReadHeader( file_t *pFile, GAME_HEADER *pHeader )
{ {
int i, tag, size, tokenCount, tokenSize; int i, tag, size, tokenCount, tokenSize;
char *pszTokenList; char *pszTokenList;
@ -2092,13 +2092,11 @@ int SV_SaveReadHeader( file_t *pFile, GAME_HEADER *pHeader, int readGlobalState
SaveRestore_Init( pSaveData, (char *)(pszTokenList), size ); SaveRestore_Init( pSaveData, (char *)(pszTokenList), size );
FS_Read( pFile, SaveRestore_GetBuffer( pSaveData ), size ); FS_Read( pFile, SaveRestore_GetBuffer( pSaveData ), size );
if( readGlobalState ) svgame.dllFuncs.pfnResetGlobalState();
svgame.dllFuncs.pfnResetGlobalState();
svgame.dllFuncs.pfnSaveReadFields( pSaveData, "GameHeader", pHeader, gGameHeader, ARRAYSIZE( gGameHeader )); svgame.dllFuncs.pfnSaveReadFields( pSaveData, "GameHeader", pHeader, gGameHeader, ARRAYSIZE( gGameHeader ));
if( readGlobalState ) svgame.dllFuncs.pfnRestoreGlobalState( pSaveData );
svgame.dllFuncs.pfnRestoreGlobalState( pSaveData );
SV_SaveFinish( pSaveData ); SV_SaveFinish( pSaveData );
@ -2141,7 +2139,7 @@ qboolean SV_LoadGame( const char *pName )
if( pFile ) if( pFile )
{ {
if( SV_SaveReadHeader( pFile, &gameHeader, 1 )) if( SV_SaveReadHeader( pFile, &gameHeader ))
{ {
SV_DirectoryExtract( pFile, gameHeader.mapCount ); SV_DirectoryExtract( pFile, gameHeader.mapCount );
validload = true; validload = true;