2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-24 17:55:31 +01:00

Merge 4143 update

This commit is contained in:
Alibek Omarov 2018-06-12 12:18:14 +03:00
commit 7cdead7bac
18 changed files with 75 additions and 37 deletions

View File

@ -1217,6 +1217,7 @@ static qboolean CL_LoadHudSprite( const char *szSpriteName, model_t *m_pSprite,
}
else
{
Con_Printf( S_ERROR "%s couldn't load\n", szSpriteName );
Mod_UnloadSpriteModel( m_pSprite );
return false;
}
@ -1866,7 +1867,8 @@ int pfnDrawConsoleString( int x, int y, char *string )
{
int drawLen;
if( !string || !*string ) return 0; // silent ignore
if( !COM_CheckString( string ))
return 0; // silent ignore
Con_SetFont( con_fontsize->value );
clgame.ds.adjust_size = true;

View File

@ -215,7 +215,7 @@ An svc_signonnum has been received, perform a client side setup
void CL_SignonReply( void )
{
// g-cont. my favorite message :-)
Con_DPrintf( "CL_SignonReply: %i\n", cls.signon );
Con_Reportf( "CL_SignonReply: %i\n", cls.signon );
switch( cls.signon )
{
@ -1740,7 +1740,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
Cmd_TokenizeString( args );
c = Cmd_Argv( 0 );
MsgDev( D_NOTE, "CL_ConnectionlessPacket: %s : %s\n", NET_AdrToString( from ), c );
Con_Reportf( "CL_ConnectionlessPacket: %s : %s\n", NET_AdrToString( from ), c );
// server connection
if( !Q_strcmp( c, "client_connect" ))
@ -2389,7 +2389,7 @@ qboolean CL_PrecacheResources( void )
if( cl.models[pRes->nIndex] == NULL )
{
MsgDev( D_ERROR, "submodel %s not found\n", pRes->szFileName );
Con_Printf( S_ERROR "submodel %s not found\n", pRes->szFileName );
if( FBitSet( pRes->ucFlags, RES_FATALIFMISSING ))
{
@ -2416,6 +2416,7 @@ qboolean CL_PrecacheResources( void )
{
if( FBitSet( pRes->ucFlags, RES_WASMISSING ))
{
Con_Printf( S_ERROR "%s%s couldn't load\n", DEFAULT_SOUNDPATH, pRes->szFileName );
cl.sound_precache[pRes->nIndex][0] = 0;
cl.sound_index[pRes->nIndex] = 0;
}

View File

@ -481,9 +481,6 @@ void CL_AddLinksToPmove( frame_t *frame )
if( VectorIsNull( state->mins ) && VectorIsNull( state->maxs ))
continue;
if ( !model->hulls[1].lastclipnode && model->type != mod_studio )
continue;
if( state->solid == SOLID_NOT && state->skin < CONTENTS_EMPTY )
{
if( clgame.pmove->nummoveent >= MAX_MOVEENTS )
@ -495,6 +492,9 @@ void CL_AddLinksToPmove( frame_t *frame )
}
else
{
if( !model->hulls[1].lastclipnode && model->type != mod_studio )
continue;
// reserve slots for all the clients
if( clgame.pmove->numphysent >= ( MAX_PHYSENTS - cl.maxclients ))
continue;

View File

@ -597,8 +597,8 @@ void SCR_InstallParticlePalette( void )
int i;
// first check 'palette.lmp' then 'palette.pal'
pic = FS_LoadImage( "gfx/palette.lmp", NULL, 0 );
if( !pic ) pic = FS_LoadImage( "gfx/palette.pal", NULL, 0 );
pic = FS_LoadImage( DEFAULT_INTERNAL_PALETTE, NULL, 0 );
if( !pic ) pic = FS_LoadImage( DEFAULT_EXTERNAL_PALETTE, NULL, 0 );
// NOTE: imagelib required this fakebuffer for loading internal palette
if( !pic ) pic = FS_LoadImage( "#valve.pal", (byte *)&i, 768 );
@ -615,13 +615,13 @@ void SCR_InstallParticlePalette( void )
}
else
{
// someone deleted internal palette from code...
for( i = 0; i < 256; i++ )
{
clgame.palette[i].r = i;
clgame.palette[i].g = i;
clgame.palette[i].b = i;
}
MsgDev( D_WARN, "CL_InstallParticlePalette: failed. Force to grayscale\n" );
}
}
@ -745,12 +745,12 @@ void SCR_Init( void )
host.allow_console = true; // we need console, because menu is missing
}
SCR_VidInit();
SCR_LoadCreditsFont ();
SCR_InstallParticlePalette ();
SCR_RegisterTextures ();
SCR_InstallParticlePalette ();
SCR_InitCinematic();
CL_InitNetgraph();
SCR_VidInit();
if( host.allow_console && Sys_CheckParm( "-toconsole" ))
Cbuf_AddText( "toggleconsole\n" );

View File

@ -1897,14 +1897,14 @@ void CL_ParseViewBeam( sizebuf_t *msg, int beamType )
startFrame = MSG_ReadByte( msg );
frameRate = (float)(MSG_ReadByte( msg ));
life = (float)(MSG_ReadByte( msg ) * 0.1f);
width = (float)(MSG_ReadByte( msg ) * 0.1f);
noise = (float)(MSG_ReadByte( msg ) * 0.01f);
width = (float)(MSG_ReadByte( msg ));
noise = (float)(MSG_ReadByte( msg ) * 0.1f);
r = (float)MSG_ReadByte( msg ) / 255.0f;
g = (float)MSG_ReadByte( msg ) / 255.0f;
b = (float)MSG_ReadByte( msg ) / 255.0f;
a = (float)MSG_ReadByte( msg ) / 255.0f;
speed = (float)MSG_ReadByte( msg );
R_BeamCirclePoints( beamType, start, end, modelIndex, life, width, noise, a, speed / 10.0f, startFrame, frameRate, r, g, b );
speed = (float)(MSG_ReadByte( msg ) / 0.1f);
R_BeamCirclePoints( beamType, start, end, modelIndex, life, width, noise, a, speed, startFrame, frameRate, r, g, b );
break;
case TE_BEAMFOLLOW:
startEnt = MSG_ReadShort( msg );

View File

@ -355,9 +355,9 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
if( dm != NULL )
{
vec3_t srcNormal, lightNormal;
float f = (1.0f / 255.0f);
float f = (1.0f / 128.0f);
VectorSet( srcNormal, (dm->r * f) * 2.0f - 1.0f, (dm->g * f) * 2.0f - 1.0f, (dm->b * f) * 2.0f - 1.0f );
VectorSet( srcNormal, ((float)dm->r - 128.0f) * f, ((float)dm->g - 128.0f) * f, ((float)dm->b - 128.0f) * f );
Matrix3x4_VectorIRotate( tbn, srcNormal, lightNormal ); // turn to world space
VectorScale( lightNormal, (float)scale * -1.0f, lightNormal ); // turn direction from light
VectorAdd( g_trace_lightvec, lightNormal, g_trace_lightvec );

View File

@ -48,7 +48,7 @@ int Q_buildnum( void )
return b;
#else
return 4140;
return 4143;
#endif
}

View File

@ -41,6 +41,10 @@ GNU General Public License for more details.
// debug beams
#define DEFAULT_LASERBEAM_PATH "sprites/laserbeam.spr"
#define DEFAULT_INTERNAL_PALETTE "gfx/palette.lmp"
#define DEFAULT_EXTERNAL_PALETTE "gfx/palette.pal"
// path to folders where placed all sounds
#define DEFAULT_SOUNDPATH "sound/"

View File

@ -366,6 +366,10 @@ void Host_InitDecals( void )
int i, num_decals = 0;
search_t *t;
// NOTE: only once resource without which engine can't continue work
if( !FS_FileExists( "gfx/conchars", false ))
Sys_Error( "W_LoadWadFile: couldn't load gfx.wad\n" );
memset( host.draw_decals, 0, sizeof( host.draw_decals ));
// lookup all the decals in decals.wad (basedir, gamedir, falldir)

View File

@ -159,7 +159,7 @@ void COM_Frame( float time )
{
int oldState = GameState->curstate;
// execute the current state (and transition to the next state if not in HS_RUN)
// execute the current state (and transition to the next state if not in STATE_RUNFRAME)
switch( GameState->curstate )
{
case STATE_LOAD_LEVEL:

View File

@ -28,6 +28,7 @@ GNU General Public License for more details.
typedef struct wadlist_s
{
char wadnames[MAX_MAP_WADS][32];
int wadusage[MAX_MAP_WADS];
int count;
} wadlist_t;
@ -334,11 +335,10 @@ static void Mod_LoadLump( const byte *in, mlumpinfo_t *info, mlumpstat_t *stat,
loadstat.numerrors++;
return;
}
else
else if( !FBitSet( flags, LUMP_SILENT ))
{
// just throw warning
if( !FBitSet( flags, LUMP_SILENT ))
MsgDev( D_WARN, "map ^2%s^7 has too many %s\n", loadstat.name, msg1 );
MsgDev( D_WARN, "map ^2%s^7 has too many %s\n", loadstat.name, msg1 );
loadstat.numwarnings++;
}
}
@ -1595,6 +1595,7 @@ static void Mod_LoadEntities( dbspmodel_t *bmod )
{
int num = bmod->wadlist.count++;
Q_strncpy( bmod->wadlist.wadnames[num], token, sizeof( bmod->wadlist.wadnames[0] ));
bmod->wadlist.wadusage[num] = 0;
}
if( bmod->wadlist.count >= MAX_MAP_WADS )
@ -1891,6 +1892,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( FS_FileExists( texpath, false ))
{
tx->gl_texturenum = GL_LoadTexture( texpath, NULL, 0, 0, filter );
bmod->wadlist.wadusage[j]++; // this wad are really used
break;
}
}
@ -1947,6 +1949,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
if( FS_FileExists( texpath, false ))
{
src = FS_LoadFile( texpath, &srcSize, false );
bmod->wadlist.wadusage[j]++; // this wad are really used
break;
}
}
@ -2702,11 +2705,15 @@ qboolean Mod_LoadBmodelLumps( const byte *mod_base, qboolean isworld )
}
for( i = 0; i < bmod->wadlist.count; i++ )
{
if( !bmod->wadlist.wadusage[i] )
continue;
Q_strncat( wadvalue, va( "%s.wad; ", bmod->wadlist.wadnames[i] ), sizeof( wadvalue ));
}
if( COM_CheckString( wadvalue ))
{
wadvalue[Q_strlen( wadvalue ) - 2] = '\0';
wadvalue[Q_strlen( wadvalue ) - 2] = '\0'; // kill the last semicolon
Con_DPrintf( "Wad files required to run the map: \"%s\"\n", wadvalue );
}
@ -2984,17 +2991,30 @@ only empty lumps is allows
*/
int Mod_SaveLump( const char *filename, const int lump, void *lumpdata, int lumpsize )
{
file_t *f = FS_Open( filename, "e+b", true );
byte buffer[sizeof( dheader_t ) + sizeof( dextrahdr_t )];
size_t prefetch_size = sizeof( buffer );
int result, dummy = lumpsize;
dextrahdr_t *extrahdr;
dheader_t *header;
if( !f ) return LUMP_SAVE_COULDNT_OPEN;
file_t *f;
if( !lumpdata || lumpsize <= 0 )
return LUMP_SAVE_NO_DATA;
// make sure what .bsp is placed into gamedir and not in pak
if( !FS_GetDiskPath( filename, true ))
return LUMP_SAVE_COULDNT_OPEN;
// first we should sure what we allow to rewrite this .bsp
result = Mod_CheckLump( filename, lump, &dummy );
if( result != LUMP_LOAD_NOT_EXIST )
return result;
f = FS_Open( filename, "e+b", true );
if( !f ) return LUMP_SAVE_COULDNT_OPEN;
if( FS_Read( f, buffer, prefetch_size ) != prefetch_size )
{
FS_Close( f );
@ -3003,6 +3023,7 @@ int Mod_SaveLump( const char *filename, const int lump, void *lumpdata, int lump
header = (dheader_t *)buffer;
// these checks below are redundant
if( header->version != HLBSP_VERSION )
{
FS_Close( f );

View File

@ -711,6 +711,7 @@ void Mod_ReleaseHullPolygons( void )
hull_model_t *model = &world.hull_models[i];
free_hull_polys( &model->polys );
}
world.num_hull_models = 0;
}
void R_DrawWorldHull( void )

View File

@ -299,7 +299,7 @@ loc0:
{
trace->fraction = midf;
VectorCopy( mid, trace->endpos );
MsgDev( D_WARN, "trace backed up past 0.0\n" );
Con_Reportf( S_WARN "trace backed up past 0.0\n" );
return false;
}

View File

@ -1084,7 +1084,7 @@ void GL_InitExtensions( void )
glConfig.renderer_string = pglGetString( GL_RENDERER );
glConfig.version_string = pglGetString( GL_VERSION );
glConfig.extensions_string = pglGetString( GL_EXTENSIONS );
MsgDev( D_INFO, "Video: %s\n", glConfig.renderer_string );
MsgDev( D_INFO, "^3Video^7: %s\n", glConfig.renderer_string );
#ifdef XASH_GLES
GL_InitExtensionsGLES();

View File

@ -331,7 +331,7 @@ void SV_ConnectClient( netadr_t from )
}
else
{
MsgDev( D_INFO, "%s:reconnect\n", NET_AdrToString( from ));
Con_Reportf( S_NOTE "%s:reconnect\n", NET_AdrToString( from ));
}
// find a client slot
@ -2088,7 +2088,7 @@ void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
Cmd_TokenizeString( args );
pcmd = Cmd_Argv( 0 );
Con_DPrintf( "SV_ConnectionlessPacket: %s : %s\n", NET_AdrToString( from ), pcmd );
Con_Reportf( "SV_ConnectionlessPacket: %s : %s\n", NET_AdrToString( from ), pcmd );
if( !Q_strcmp( pcmd, "ping" )) SV_Ping( from );
else if( !Q_strcmp( pcmd, "ack" )) SV_Ack( from );

View File

@ -315,7 +315,7 @@ SV_Load_f
*/
void SV_Load_f( void )
{
string path;
char path[MAX_QPATH];
if( Cmd_Argc() != 2 )
{

View File

@ -1320,6 +1320,7 @@ void pfnChangeLevel( const char *level, const char *landmark )
COM_StripExtension( mapname );
landname[0] ='\0';
#ifdef HACKS_RELATED_HLMODS
// g-cont. some level-designers wrote landmark name with space
// and Cmd_TokenizeString separating all the after space as next argument
// emulate this bug for compatibility
@ -1328,9 +1329,13 @@ void pfnChangeLevel( const char *level, const char *landmark )
text = (char *)landname;
while( *landmark && ((byte)*landmark) != ' ' )
*text++ = *landmark++;
smooth = true;
*text = '\0';
}
#else
Q_strncpy( landname, landmark, sizeof( landname ));
#endif
if( COM_CheckString( landname ))
smooth = true;
// determine spawn entity classname
if( svs.maxclients == 1 )
@ -2401,7 +2406,7 @@ void pfnServerExecute( void )
Cbuf_Execute();
if( host.sv_cvars_restored > 0 )
Con_DPrintf( "server executing ^2config.cfg^7 (%i cvars)\n", host.sv_cvars_restored );
Con_Reportf( "server executing ^2config.cfg^7 (%i cvars)\n", host.sv_cvars_restored );
host.apply_game_config = false;
svgame.config_executed = true;
@ -3411,7 +3416,7 @@ OBSOLETE, UNUSED
*/
uint pfnGetPlayerWONId( edict_t *e )
{
return -1;
return (uint)-1;
}
/*
@ -4846,7 +4851,7 @@ qboolean SV_LoadProgs( const char *name )
return false;
}
}
else Con_DPrintf( "SV_LoadProgs: ^2initailized extended EntityAPI ^7ver. %i\n", version );
else Con_Reportf( "SV_LoadProgs: ^2initailized extended EntityAPI ^7ver. %i\n", version );
}
else if( !GetEntityAPI( &svgame.dllFuncs, version ))
{

View File

@ -727,7 +727,7 @@ void SV_SetupClients( void )
svs.clients = Z_Realloc( svs.clients, sizeof( sv_client_t ) * svs.maxclients );
svs.num_client_entities = svs.maxclients * SV_UPDATE_BACKUP * NUM_PACKET_ENTITIES;
svs.packet_entities = Z_Realloc( svs.packet_entities, sizeof( entity_state_t ) * svs.num_client_entities );
Con_DPrintf( "%s alloced by server packet entities\n", Q_memprint( sizeof( entity_state_t ) * svs.num_client_entities ));
Con_Reportf( "%s alloced by server packet entities\n", Q_memprint( sizeof( entity_state_t ) * svs.num_client_entities ));
// init network stuff
NET_Config(( svs.maxclients > 1 ));