27 Feb 2011
This commit is contained in:
parent
f30fb0ac4d
commit
160ddba4db
@ -1,4 +1,4 @@
|
||||
build ????
|
||||
build 1482
|
||||
|
||||
Engine: fixed critical bug
|
||||
Launch: remove all built-in tools
|
||||
@ -9,6 +9,8 @@ Engine: fixed lag on rpg laserspot
|
||||
Engine: added weapon and movement prediction (may be bugly, use with caution)
|
||||
GameUI: added pfnRandomLong and pfnRandomFloat built-ins (and keep compatibility with old versions)
|
||||
Engine: added map_background (special command for loading background maps like in Source Engine)
|
||||
GameUI: added support for chaptermapbackground.txt script-file (random choose background maps)
|
||||
Render: fix some rendering bugs for mods with custom renderer (Paranoia, HLFX etc)
|
||||
|
||||
build 1433
|
||||
|
||||
|
@ -40,7 +40,7 @@ void CL_UpdateEntityFields( cl_entity_t *ent )
|
||||
ent->curstate.scale = 1.0f;
|
||||
|
||||
if( ent->player ) // stupid Half-Life bug
|
||||
ent->angles[PITCH] = -ent->angles[PITCH];
|
||||
ent->angles[PITCH] = -ent->angles[PITCH] / 3;
|
||||
|
||||
// make me lerp
|
||||
if( ent->curstate.eflags & EFLAG_SLERP )
|
||||
@ -658,7 +658,6 @@ void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
||||
// getting a valid frame message ends the connection process
|
||||
VectorCopy( player->origin, cl.predicted_origin );
|
||||
VectorCopy( player->angles, cl.predicted_angles );
|
||||
Cbuf_AddText( "exec config.cfg\n" ); // GoldSrc rules
|
||||
}
|
||||
|
||||
CL_CheckPredictionError();
|
||||
|
@ -1462,7 +1462,7 @@ pfnSPR_Draw
|
||||
*/
|
||||
static void pfnSPR_Draw( int frame, int x, int y, const wrect_t *prc )
|
||||
{
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
GL_SetRenderMode( kRenderTransAdd );
|
||||
SPR_DrawGeneric( frame, x, y, -1, -1, prc );
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,6 @@ static void UI_DrawLogo( const char *filename, float x, float y, float width, fl
|
||||
}
|
||||
|
||||
pglDisable( GL_BLEND );
|
||||
pglDepthMask( GL_FALSE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
|
||||
@ -403,7 +402,7 @@ pfnPIC_Draw
|
||||
*/
|
||||
void pfnPIC_Draw( int x, int y, int width, int height, const wrect_t *prc )
|
||||
{
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
PIC_DrawGeneric( x, y, width, height, prc );
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,6 @@ void CL_ParseMovevars( sizebuf_t *msg )
|
||||
R_SetupSky( clgame.movevars.skyName );
|
||||
|
||||
Mem_Copy( &clgame.oldmovevars, &clgame.movevars, sizeof( movevars_t ));
|
||||
clgame.entities->curstate.scale = clgame.movevars.waveHeight;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -588,7 +587,6 @@ void CL_ParseServerData( sizebuf_t *msg )
|
||||
|
||||
// wipe the client_t struct
|
||||
CL_ClearState();
|
||||
UI_SetActiveMenu( false );
|
||||
cls.state = ca_connected;
|
||||
|
||||
// parse protocol version number
|
||||
@ -607,6 +605,8 @@ void CL_ParseServerData( sizebuf_t *msg )
|
||||
com.strncpy( clgame.maptitle, BF_ReadString( msg ), MAX_STRING );
|
||||
cl.background = BF_ReadOneBit( msg );
|
||||
|
||||
UI_SetActiveMenu( cl.background );
|
||||
|
||||
if( cl.playernum & 128 )
|
||||
{
|
||||
cl.spectator = true;
|
||||
|
@ -34,6 +34,7 @@ void V_SetupRefDef( void )
|
||||
|
||||
clent = CL_GetLocalPlayer ();
|
||||
|
||||
clgame.entities->curstate.scale = clgame.movevars.waveHeight;
|
||||
VectorCopy( cl.frame.local.client.punchangle, cl.refdef.punchangle );
|
||||
clgame.viewent.curstate.modelindex = cl.frame.local.client.viewmodel;
|
||||
clgame.viewent.model = Mod_Handle( clgame.viewent.curstate.modelindex );
|
||||
|
@ -292,55 +292,44 @@ void GL_FrontFace( GLenum front )
|
||||
|
||||
void GL_SetRenderMode( int mode )
|
||||
{
|
||||
// GoldSrc in 2D mode uses default mode as TransTexture
|
||||
if( glState.in2DMode && mode == kRenderNormal )
|
||||
mode = kRenderTransTexture;
|
||||
|
||||
switch( mode )
|
||||
{
|
||||
case kRenderNormal:
|
||||
default:
|
||||
pglDisable( GL_BLEND );
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
break;
|
||||
case kRenderTransColor:
|
||||
pglEnable( GL_BLEND );
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
break;
|
||||
case kRenderTransAlpha:
|
||||
pglDisable( GL_BLEND );
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglEnable( GL_ALPHA_TEST );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
break;
|
||||
case kRenderTransTexture:
|
||||
pglEnable( GL_BLEND );
|
||||
pglDepthMask( GL_FALSE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
break;
|
||||
case kRenderGlow:
|
||||
pglEnable( GL_BLEND );
|
||||
pglDepthMask( GL_FALSE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
break;
|
||||
case kRenderTransAdd:
|
||||
pglEnable( GL_BLEND );
|
||||
pglDepthMask( GL_FALSE );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
break;
|
||||
case kRenderTransInverse:
|
||||
pglEnable( GL_BLEND );
|
||||
pglDepthMask( GL_FALSE );
|
||||
pglBlendFunc( GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
break;
|
||||
@ -349,22 +338,16 @@ void GL_SetRenderMode( int mode )
|
||||
|
||||
void GL_SetSpriteRenderMode( int mode )
|
||||
{
|
||||
// GoldSrc in 2D mode uses default mode as TransTexture
|
||||
if( glState.in2DMode && mode == kRenderNormal )
|
||||
mode = kRenderTransTexture;
|
||||
|
||||
switch( mode )
|
||||
{
|
||||
case kRenderNormal:
|
||||
default:
|
||||
pglDisable( GL_BLEND );
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
break;
|
||||
case kRenderTransColor:
|
||||
pglEnable( GL_BLEND );
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglBlendFunc( GL_ZERO, GL_SRC_COLOR );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
@ -373,27 +356,23 @@ void GL_SetSpriteRenderMode( int mode )
|
||||
case kRenderTransTexture:
|
||||
// NOTE: TriAPI doesn't have 'solid' mode
|
||||
pglEnable( GL_BLEND );
|
||||
pglDepthMask( GL_FALSE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
break;
|
||||
case kRenderGlow:
|
||||
pglEnable( GL_BLEND );
|
||||
pglDepthMask( GL_FALSE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
break;
|
||||
case kRenderTransAdd:
|
||||
pglEnable( GL_BLEND );
|
||||
pglDepthMask( GL_FALSE );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
break;
|
||||
case kRenderTransInverse:
|
||||
pglEnable( GL_BLEND );
|
||||
pglDepthMask( GL_FALSE );
|
||||
pglBlendFunc( GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
break;
|
||||
|
@ -851,25 +851,33 @@ void DrawSingleDecal( decal_t *pDecal, msurface_t *fa )
|
||||
|
||||
void DrawSurfaceDecals( msurface_t *fa )
|
||||
{
|
||||
decal_t *p;
|
||||
decal_t *p;
|
||||
cl_entity_t *e;
|
||||
|
||||
if( !fa->pdecals ) return;
|
||||
|
||||
pglEnable( GL_BLEND );
|
||||
pglDepthMask( GL_FALSE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
e = RI.currententity;
|
||||
ASSERT( e != NULL );
|
||||
|
||||
if( e->curstate.rendermode == kRenderNormal || e->curstate.rendermode == kRenderTransAlpha )
|
||||
{
|
||||
pglDepthMask( GL_FALSE );
|
||||
pglEnable( GL_BLEND );
|
||||
}
|
||||
|
||||
pglEnable( GL_POLYGON_OFFSET_FILL );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
|
||||
for( p = fa->pdecals; p; p = p->pnext )
|
||||
DrawSingleDecal( p, fa );
|
||||
|
||||
pglDisable( GL_BLEND );
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
if( e->curstate.rendermode == kRenderNormal || e->curstate.rendermode == kRenderTransAlpha )
|
||||
{
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglDisable( GL_BLEND );
|
||||
}
|
||||
|
||||
pglDisable( GL_POLYGON_OFFSET_FILL );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -175,6 +175,7 @@ void R_Set2DMode( qboolean enable )
|
||||
}
|
||||
else
|
||||
{
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglEnable( GL_DEPTH_TEST );
|
||||
pglMatrixMode( GL_MODELVIEW );
|
||||
glState.in2DMode = false;
|
||||
|
@ -495,6 +495,7 @@ typedef struct
|
||||
int faceCull;
|
||||
int frontFace;
|
||||
|
||||
qboolean drawTrans;
|
||||
qboolean mtexEnabled; // classic Quake multi-texturing (2 units)
|
||||
qboolean stencilEnabled;
|
||||
qboolean in2DMode;
|
||||
|
@ -648,7 +648,6 @@ static void R_SetupGL( void )
|
||||
GL_Cull( GL_FRONT );
|
||||
|
||||
pglDisable( GL_BLEND );
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
}
|
||||
@ -761,6 +760,8 @@ void R_DrawEntitiesOnList( void )
|
||||
{
|
||||
int i, numErrors;
|
||||
|
||||
glState.drawTrans = false;
|
||||
|
||||
// draw the solid submodels fog
|
||||
R_DrawFog ();
|
||||
|
||||
@ -804,6 +805,8 @@ void R_DrawEntitiesOnList( void )
|
||||
|
||||
// don't fogging translucent surfaces
|
||||
pglDisable( GL_FOG );
|
||||
pglDepthMask( GL_FALSE );
|
||||
glState.drawTrans = true;
|
||||
|
||||
CL_DrawBeams( true );
|
||||
CL_DrawParticles();
|
||||
@ -845,6 +848,8 @@ void R_DrawEntitiesOnList( void )
|
||||
if( numErrors )
|
||||
MsgDev( D_ERROR, "invalid gl operation in HUD_DrawTransparentTriangles( %i errors )\n", numErrors );
|
||||
|
||||
glState.drawTrans = false;
|
||||
pglDepthMask( GL_TRUE );
|
||||
R_DrawViewModel();
|
||||
|
||||
CL_ExtraUpdate();
|
||||
|
@ -423,11 +423,14 @@ void R_BlendLightmaps( void )
|
||||
}
|
||||
}
|
||||
|
||||
pglDisable( GL_BLEND );
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglDepthFunc( GL_LEQUAL );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
if( !r_lightmap->integer )
|
||||
{
|
||||
pglDisable( GL_BLEND );
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglDepthFunc( GL_LEQUAL );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -851,7 +851,6 @@ void R_DrawSpriteModel( cl_entity_t *e )
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglEnable( GL_ALPHA_TEST );
|
||||
}
|
||||
else pglDepthMask( GL_FALSE );
|
||||
|
||||
if( e->curstate.rendermode == kRenderGlow )
|
||||
pglDisable( GL_DEPTH_TEST );
|
||||
@ -876,7 +875,6 @@ void R_DrawSpriteModel( cl_entity_t *e )
|
||||
case kRenderNormal:
|
||||
default:
|
||||
pglDisable( GL_BLEND );
|
||||
pglDepthMask( GL_TRUE );
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1001,9 +999,13 @@ void R_DrawSpriteModel( cl_entity_t *e )
|
||||
if( e->curstate.rendermode == kRenderGlow )
|
||||
pglEnable( GL_DEPTH_TEST );
|
||||
|
||||
if( psprite->texFormat == SPR_ALPHTEST )
|
||||
{
|
||||
pglDepthMask( GL_FALSE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
}
|
||||
|
||||
pglDisable( GL_BLEND );
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
pglColor4ub( 255, 255, 255, 255 );
|
||||
}
|
@ -1645,11 +1645,13 @@ static void R_StudioDrawPoints( void )
|
||||
if( flags & STUDIO_NF_TRANSPARENT )
|
||||
{
|
||||
GL_SetRenderMode( kRenderTransAlpha );
|
||||
pglDepthMask( GL_TRUE );
|
||||
alpha = 1.0f;
|
||||
}
|
||||
else if(( flags & STUDIO_NF_ADDITIVE ) || ( g_nFaceFlags & STUDIO_NF_CHROME ))
|
||||
{
|
||||
GL_SetRenderMode( kRenderTransAdd );
|
||||
pglDepthMask( GL_FALSE );
|
||||
alpha = 0.5f;
|
||||
|
||||
if( g_nFaceFlags & STUDIO_NF_CHROME )
|
||||
@ -1668,6 +1670,9 @@ static void R_StudioDrawPoints( void )
|
||||
alpha = RI.currententity->curstate.renderamt * (1.0f / 255.0f);
|
||||
if( g_iRenderMode == kRenderNormal )
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
if( !glState.drawTrans )
|
||||
pglDepthMask( GL_TRUE );
|
||||
else pglDepthMask( GL_FALSE );
|
||||
}
|
||||
|
||||
if(!( g_nFaceFlags & STUDIO_NF_CHROME ))
|
||||
@ -2011,10 +2016,12 @@ static void R_StudioRestoreRenderer( void )
|
||||
if( r_lefthand->integer == 1 ) GL_FrontFace( !glState.frontFace );
|
||||
}
|
||||
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
pglScalef( 1.0f, 1.0f, 1.0f );
|
||||
pglTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
pglShadeModel( GL_FLAT );
|
||||
|
||||
if( !glState.drawTrans )
|
||||
pglDepthMask( GL_TRUE );
|
||||
else pglDepthMask( GL_FALSE );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -338,7 +338,6 @@ void R_DrawSkyBox( void )
|
||||
// don't fogging skybox (this fix old Half-Life bug)
|
||||
pglDisable( GL_FOG );
|
||||
pglDisable( GL_BLEND );
|
||||
pglDepthMask( GL_TRUE );
|
||||
pglDisable( GL_ALPHA_TEST );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||
|
||||
|
@ -210,7 +210,7 @@ float pfnCVarGetValue( const char *szName );
|
||||
char* pfnCVarGetString( const char *szName );
|
||||
cvar_t *pfnCVarGetPointer( const char *szVarName );
|
||||
void pfnFreeFile( void *buffer );
|
||||
int pfnFileExists( const char *filename );
|
||||
int pfnFileExists( const char *filename, int gamedironly );
|
||||
void *pfnLoadLibrary( const char *name );
|
||||
void *pfnGetProcAddress( void *hInstance, const char *name );
|
||||
void pfnFreeLibrary( void *hInstance );
|
||||
|
@ -183,8 +183,9 @@ void Con_ToggleConsole_f( void )
|
||||
|
||||
if( cls.key_dest == key_console )
|
||||
{
|
||||
UI_SetActiveMenu( false );
|
||||
Key_SetKeyDest( key_game );
|
||||
if( Cvar_VariableInteger( "sv_background" ))
|
||||
UI_SetActiveMenu( true );
|
||||
else UI_SetActiveMenu( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -405,7 +406,7 @@ static int Con_DrawGenericChar( int x, int y, int number, rgba_t color )
|
||||
|
||||
static int Con_DrawCharacter( int x, int y, int number, rgba_t color )
|
||||
{
|
||||
GL_SetRenderMode( kRenderNormal );
|
||||
GL_SetRenderMode( kRenderTransTexture );
|
||||
return Con_DrawGenericChar( x, y, number, color );
|
||||
}
|
||||
|
||||
@ -1360,9 +1361,11 @@ void Con_DrawConsole( void )
|
||||
|
||||
if( cls.state == ca_connecting || cls.state == ca_connected )
|
||||
{
|
||||
if( !cl_allow_levelshots->integer && !Cvar_VariableInteger( "sv_background" ))
|
||||
if( !cl_allow_levelshots->integer )
|
||||
{
|
||||
con.displayFrac = con.finalFrac = 1.0f;
|
||||
if( Cvar_VariableInteger( "sv_background" ) && cls.key_dest != key_console )
|
||||
con.displayFrac = con.finalFrac = 0.0f;
|
||||
else con.displayFrac = con.finalFrac = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -260,9 +260,9 @@ pfnFileExists
|
||||
|
||||
=============
|
||||
*/
|
||||
int pfnFileExists( const char *filename )
|
||||
int pfnFileExists( const char *filename, int gamedironly )
|
||||
{
|
||||
return FS_FileExists( filename );
|
||||
return FS_FileExistsEx( filename, gamedironly );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -616,6 +616,8 @@ void Host_Main( void )
|
||||
{
|
||||
static double oldtime, newtime;
|
||||
|
||||
// we need to execute it again here
|
||||
Cbuf_AddText( "exec config.cfg\n" );
|
||||
oldtime = Sys_DoubleTime();
|
||||
|
||||
// main window message loop
|
||||
|
@ -536,15 +536,9 @@ void Key_Event( int key, qboolean down )
|
||||
case key_game:
|
||||
break; // handled in client.dll
|
||||
case key_console:
|
||||
if( cls.state == ca_active )
|
||||
{
|
||||
if( cls.state == ca_active && !cl.background )
|
||||
Key_SetKeyDest( key_game );
|
||||
}
|
||||
else
|
||||
{
|
||||
UI_SetActiveMenu( true );
|
||||
return; // don't pass Esc into menu
|
||||
}
|
||||
else UI_SetActiveMenu( true );
|
||||
return;
|
||||
case key_menu:
|
||||
UI_KeyEvent( key, true );
|
||||
|
@ -92,7 +92,7 @@ typedef struct ui_enginefuncs_s
|
||||
void* (*pfnGetProcAddress)( void *hInstance, const char *name );
|
||||
void (*pfnFreeLibrary)( void *hInstance );
|
||||
void (*pfnHostError)( const char *szFmt, ... );
|
||||
int (*pfnFileExists)( const char *filename );
|
||||
int (*pfnFileExists)( const char *filename, int gamedironly );
|
||||
void (*pfnGetGameDir)( char *szGetGameDir );
|
||||
|
||||
// vgui handlers
|
||||
|
@ -422,7 +422,7 @@ void SV_CheckVelocity( edict_t *ent );
|
||||
qboolean SV_CheckWater( edict_t *ent );
|
||||
qboolean SV_RunThink( edict_t *ent );
|
||||
void SV_FreeOldEntities( void );
|
||||
qboolean SV_TestEntityPosition( edict_t *ent ); // for EntityInSolid checks
|
||||
qboolean SV_TestEntityPosition( edict_t *ent, edict_t *blocker ); // for EntityInSolid checks
|
||||
qboolean SV_TestPlayerPosition( edict_t *ent ); // for PlayerInSolid checks
|
||||
void SV_Impact( edict_t *e1, trace_t *trace );
|
||||
|
||||
|
@ -267,6 +267,12 @@ void SV_MapBackground_f( void )
|
||||
return;
|
||||
}
|
||||
|
||||
if( sv.state == ss_active && !sv.background )
|
||||
{
|
||||
Msg( "SV_NewMap: can't set background map while game is active\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
// hold mapname to other place
|
||||
com.strncpy( mapname, Cmd_Argv( 1 ), sizeof( mapname ));
|
||||
flags = SV_MapIsValid( mapname, GI->sp_entity, NULL );
|
||||
|
@ -4460,6 +4460,7 @@ void SV_UnloadProgs( void )
|
||||
|
||||
// now we can unload cvars
|
||||
Cvar_FullSet( "host_gameloaded", "0", CVAR_INIT );
|
||||
Cvar_FullSet( "sv_background", "0", CVAR_READ_ONLY );
|
||||
|
||||
// must unlink all game cvars,
|
||||
// before pointers on them will be lost...
|
||||
|
@ -632,6 +632,7 @@ qboolean SV_NewGame( const char *mapName, qboolean loadGame )
|
||||
SV_DeactivateServer ();
|
||||
|
||||
sv.loadgame = loadGame;
|
||||
sv.background = false;
|
||||
|
||||
if( !SV_SpawnServer( mapName, NULL ))
|
||||
return false;
|
||||
|
@ -448,7 +448,7 @@ SV_IsSimulating
|
||||
*/
|
||||
qboolean SV_IsSimulating( void )
|
||||
{
|
||||
if( sv.background )
|
||||
if( sv.background && CL_Active( ))
|
||||
{
|
||||
if( CL_IsInConsole( ))
|
||||
return false;
|
||||
|
@ -649,7 +649,7 @@ static qboolean SV_AllowToPush( edict_t *check, edict_t *pusher, const vec3_t mi
|
||||
|
||||
oldsolid = pusher->v.solid;
|
||||
pusher->v.solid = SOLID_NOT;
|
||||
block = SV_TestEntityPosition( check );
|
||||
block = SV_TestEntityPosition( check, pusher );
|
||||
pusher->v.solid = oldsolid;
|
||||
if( block ) return false;
|
||||
|
||||
@ -665,7 +665,7 @@ static qboolean SV_AllowToPush( edict_t *check, edict_t *pusher, const vec3_t mi
|
||||
return false;
|
||||
|
||||
// see if the ent's bbox is inside the pusher's final position
|
||||
if( !SV_TestEntityPosition( check ))
|
||||
if( !SV_TestEntityPosition( check, NULL ))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -782,7 +782,7 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime )
|
||||
continue;
|
||||
|
||||
pusher->v.solid = SOLID_NOT;
|
||||
block = SV_TestEntityPosition( check );
|
||||
block = SV_TestEntityPosition( check, pusher );
|
||||
pusher->v.solid = oldsolid;
|
||||
if( block ) continue;
|
||||
|
||||
@ -798,7 +798,7 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime )
|
||||
continue;
|
||||
|
||||
// see if the ent's bbox is inside the pusher's final position
|
||||
if( !SV_TestEntityPosition( check ))
|
||||
if( !SV_TestEntityPosition( check, NULL ))
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -818,7 +818,7 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime )
|
||||
pusher->v.solid = oldsolid;
|
||||
|
||||
// if it is still inside the pusher, block
|
||||
if( SV_TestEntityPosition( check ) && block )
|
||||
if( SV_TestEntityPosition( check, NULL ) && block )
|
||||
{
|
||||
if( !SV_CanBlock( check ))
|
||||
continue;
|
||||
@ -896,7 +896,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
|
||||
continue;
|
||||
|
||||
pusher->v.solid = SOLID_NOT;
|
||||
block = SV_TestEntityPosition( check );
|
||||
block = SV_TestEntityPosition( check, pusher );
|
||||
pusher->v.solid = oldsolid;
|
||||
if( block ) continue;
|
||||
|
||||
@ -912,7 +912,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
|
||||
continue;
|
||||
|
||||
// see if the ent's bbox is inside the pusher's final position
|
||||
if( !SV_TestEntityPosition( check ))
|
||||
if( !SV_TestEntityPosition( check, NULL ))
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -943,7 +943,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
|
||||
pusher->v.solid = oldsolid;
|
||||
|
||||
// if it is still inside the pusher, block
|
||||
if( SV_TestEntityPosition( check ) && block )
|
||||
if( SV_TestEntityPosition( check, NULL ) && block )
|
||||
{
|
||||
if( !SV_CanBlock( check ))
|
||||
continue;
|
||||
|
@ -725,7 +725,7 @@ SV_TestEntityPosition
|
||||
returns true if the entity is in solid currently
|
||||
============
|
||||
*/
|
||||
qboolean SV_TestEntityPosition( edict_t *ent )
|
||||
qboolean SV_TestEntityPosition( edict_t *ent, edict_t *blocker )
|
||||
{
|
||||
trace_t trace;
|
||||
|
||||
@ -738,7 +738,15 @@ qboolean SV_TestEntityPosition( edict_t *ent )
|
||||
}
|
||||
|
||||
trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, ent->v.origin, MOVE_NORMAL|FMOVE_SIMPLEBOX, ent );
|
||||
|
||||
#if 1
|
||||
// FIXME: this is need to be detail testing
|
||||
if( SV_IsValidEdict( blocker ) && SV_IsValidEdict( trace.ent ))
|
||||
{
|
||||
if( trace.ent->v.movetype == MOVETYPE_PUSH || trace.ent == blocker )
|
||||
return trace.startsolid;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return trace.startsolid;
|
||||
}
|
||||
|
||||
@ -752,7 +760,7 @@ same as SV_TestEntityPosition but check only players
|
||||
qboolean SV_TestPlayerPosition( edict_t *ent )
|
||||
{
|
||||
if( ent->v.flags & (FL_CLIENT|FL_FAKECLIENT))
|
||||
return SV_TestEntityPosition( ent );
|
||||
return SV_TestEntityPosition( ent, NULL );
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -367,16 +367,17 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
|
||||
rendermode = LUMP_TRANSPARENT;
|
||||
|
||||
// make transparent color is black, blue color looks ugly
|
||||
if( Sys.app_name == HOST_NORMAL )
|
||||
pal[255*3+0] = pal[255*3+1] = pal[255*3+2] = 0;
|
||||
pal[255*3+0] = pal[255*3+1] = pal[255*3+2] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// clear blue color for 'transparent' decals
|
||||
if( pal[255*3+0] == 0 && pal[255*3+1] == 0 && pal[255*3+2] == 255 )
|
||||
pal[255*3+0] = pal[255*3+1] = pal[255*3+2] = 0;
|
||||
|
||||
// apply decal palette immediately
|
||||
image.flags |= IMAGE_COLORINDEX;
|
||||
if( Sys.app_name == HOST_NORMAL )
|
||||
rendermode = LUMP_DECAL;
|
||||
else rendermode = LUMP_TRANSPARENT;
|
||||
rendermode = LUMP_DECAL;
|
||||
}
|
||||
image.flags |= IMAGE_HAS_ALPHA;
|
||||
}
|
||||
|
@ -714,6 +714,23 @@ void UI_RefreshServerList( void )
|
||||
CLIENT_COMMAND( FALSE, "localservers\n" );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_StartBackGroundMap
|
||||
=================
|
||||
*/
|
||||
void UI_StartBackGroundMap( void )
|
||||
{
|
||||
if( !uiStatic.bgmapcount || CVAR_GET_FLOAT( "sv_background" ))
|
||||
return;
|
||||
|
||||
int bgmapid = RANDOM_LONG( 0, uiStatic.bgmapcount - 1 );
|
||||
|
||||
char cmd[128];
|
||||
sprintf( cmd, "map_background %s\n", uiStatic.bgmaps[bgmapid] );
|
||||
|
||||
CLIENT_COMMAND( FALSE, cmd );
|
||||
}
|
||||
|
||||
// =====================================================================
|
||||
|
||||
@ -859,6 +876,7 @@ void UI_UpdateMenu( float flTime )
|
||||
|
||||
if( first )
|
||||
{
|
||||
UI_StartBackGroundMap ();
|
||||
BACKGROUND_TRACK( "gamestartup.mp3", NULL );
|
||||
first = FALSE;
|
||||
}
|
||||
@ -1223,6 +1241,36 @@ void UI_ApplyCustomColors( void )
|
||||
FREE_FILE( afile );
|
||||
}
|
||||
|
||||
static void UI_LoadBackgroundMapList( void )
|
||||
{
|
||||
if( !g_engfuncs.pfnFileExists( "scripts/chapterbackgrounds.txt", TRUE ))
|
||||
return;
|
||||
|
||||
char *afile = (char *)LOAD_FILE( "scripts/chapterbackgrounds.txt", NULL );
|
||||
char *pfile = afile;
|
||||
char token[1024];
|
||||
|
||||
uiStatic.bgmapcount = 0;
|
||||
|
||||
if( !afile )
|
||||
{
|
||||
Con_Printf( "UI_LoadBackgroundMapList: chapterbackgrounds.txt not found\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
||||
{
|
||||
// skip the numbers (old format list)
|
||||
if( isdigit( token[0] )) continue;
|
||||
|
||||
strncpy( uiStatic.bgmaps[uiStatic.bgmapcount], token, sizeof( uiStatic.bgmaps[0] ));
|
||||
if( ++uiStatic.bgmapcount > UI_MAX_BGMAPS )
|
||||
break; // list is full
|
||||
}
|
||||
|
||||
FREE_FILE( afile );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_VidInit
|
||||
@ -1250,6 +1298,9 @@ int UI_VidInit( void )
|
||||
// trying to load colors.lst
|
||||
UI_ApplyCustomColors ();
|
||||
|
||||
// trying to load chapterbackgrounds.txt
|
||||
UI_LoadBackgroundMapList ();
|
||||
|
||||
// register ui font
|
||||
uiStatic.hFont = PIC_Load( "menufont", font_tga, sizeof( font_tga ));
|
||||
|
||||
|
@ -67,6 +67,7 @@
|
||||
|
||||
#define UI_MAXGAMES 100 // slots for savegame/demos
|
||||
#define UI_MAX_SERVERS 32
|
||||
#define UI_MAX_BGMAPS 32
|
||||
|
||||
#define MAX_HINT_TEXT 512
|
||||
|
||||
@ -288,6 +289,9 @@ typedef struct
|
||||
int numServers;
|
||||
int updateServers; // true is receive new info about servers
|
||||
|
||||
char bgmaps[UI_MAX_BGMAPS][80];
|
||||
int bgmapcount;
|
||||
|
||||
HIMAGE hFont; // mainfont
|
||||
|
||||
float scaleX;
|
||||
|
@ -54,7 +54,7 @@ inline HIMAGE PIC_Load( const char *szPicName, const byte *ucRawImage, long ulRa
|
||||
#define R_RenderFrame (*g_engfuncs.pfnRenderScene)
|
||||
|
||||
#define LOAD_FILE (*g_engfuncs.COM_LoadFile)
|
||||
#define FILE_EXISTS (*g_engfuncs.pfnFileExists)
|
||||
#define FILE_EXISTS( file ) (*g_engfuncs.pfnFileExists)( file, FALSE )
|
||||
#define FREE_FILE (*g_engfuncs.COM_FreeFile)
|
||||
#define GET_GAME_DIR (*g_engfuncs.pfnGetGameDir)
|
||||
#define LOAD_LIBRARY (*g_engfuncs.pfnLoadLibrary)
|
||||
@ -91,7 +91,7 @@ inline HIMAGE PIC_Load( const char *szPicName, const byte *ucRawImage, long ulRa
|
||||
#define GET_SAVE_COMMENT (*g_engfuncs.pfnGetSaveComment)
|
||||
#define GET_DEMO_COMMENT (*g_engfuncs.pfnGetDemoComment)
|
||||
|
||||
#define CL_IsActive (*g_engfuncs.pfnClientInGame)
|
||||
#define CL_IsActive() (g_engfuncs.pfnClientInGame() && !CVAR_GET_FLOAT( "sv_background" ))
|
||||
|
||||
inline void PIC_Set( HIMAGE hPic, int r, int g, int b )
|
||||
{
|
||||
|
@ -120,7 +120,7 @@ static void UI_Credits_DrawFunc( void )
|
||||
int color = 0;
|
||||
|
||||
// draw the background first
|
||||
if( !uiCredits.finalCredits )
|
||||
if( !uiCredits.finalCredits && !CVAR_GET_FLOAT( "sv_background" ))
|
||||
UI_DrawPic( 0, 0, 1024 * uiStatic.scaleX, 768 * uiStatic.scaleY, uiColorWhite, ART_BACKGROUND );
|
||||
// otherwise running on cutscene
|
||||
|
||||
|
@ -101,6 +101,9 @@ static void UI_Background_Ownerdraw( void *self )
|
||||
{
|
||||
menuCommon_s *item = (menuCommon_s *)self;
|
||||
|
||||
// map has background
|
||||
if( CVAR_GET_FLOAT( "sv_background" )) return;
|
||||
|
||||
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
|
||||
|
||||
if( GetLogoLength() <= 0.1 || GetLogoWidth() <= 32 )
|
||||
|
@ -1827,6 +1827,9 @@ UI_Bitmap_Draw
|
||||
*/
|
||||
void UI_Bitmap_Draw( menuBitmap_s *b )
|
||||
{
|
||||
if( CVAR_GET_FLOAT( "sv_background" ) && b->generic.id == 0 )
|
||||
return; // has background map disable images
|
||||
|
||||
if( b->generic.flags & QMF_GRAYED )
|
||||
{
|
||||
UI_DrawPic( b->generic.x, b->generic.y, b->generic.width, b->generic.height, uiColorDkGrey, b->pic );
|
||||
|
Reference in New Issue
Block a user