From 05cbb432c21944640d1b3919d2d5bbfc58f6f119 Mon Sep 17 00:00:00 2001 From: g-cont Date: Wed, 9 May 2018 00:00:00 +0300 Subject: [PATCH] 09 May 2018 --- common/event_api.h | 2 ++ common/render_api.h | 2 +- engine/client/cl_game.c | 2 ++ engine/client/cl_pmove.c | 25 ++++++++++++++++++++++++ engine/client/client.h | 2 ++ engine/client/gl_beams.c | 9 ++------- engine/client/gl_image.c | 31 +++++++++++++++++++++--------- engine/client/gl_local.h | 4 +++- engine/client/gl_rlight.c | 2 +- engine/client/gl_rmain.c | 27 +++++++++++++++++++------- engine/client/gl_rsurf.c | 4 ++-- engine/client/gl_sprite.c | 4 ++-- engine/client/gl_studio.c | 27 ++++++++++++++++++++++---- engine/client/gl_vidnt.c | 28 +++++++++++++-------------- engine/client/vgui/vgui_surf.cpp | 2 +- engine/common/imagelib/img_utils.c | 5 +++-- engine/common/input.h | 6 +++++- engine/common/library.h | 4 ++++ engine/server/sv_pmove.c | 2 +- 19 files changed, 134 insertions(+), 54 deletions(-) diff --git a/common/event_api.h b/common/event_api.h index 535ce00c..aa01d0f8 100644 --- a/common/event_api.h +++ b/common/event_api.h @@ -51,6 +51,8 @@ typedef struct event_api_s struct pmtrace_s *( *EV_VisTraceLine )( float *start, float *end, int flags ); struct physent_s *( *EV_GetVisent )( int idx ); int ( *EV_TestLine)( const vec3_t start, const vec3_t end, int flags ); + void ( *EV_PushTraceBounds)( int hullnum, const float *mins, const float *maxs ); + void ( *EV_PopTraceBounds)( void ); } event_api_t; #endif//EVENT_API_H \ No newline at end of file diff --git a/common/render_api.h b/common/render_api.h index 413d88e8..ce16e843 100644 --- a/common/render_api.h +++ b/common/render_api.h @@ -96,7 +96,7 @@ typedef enum TF_BORDER = (1<<19), // zero clamp for projected textures TF_TEXTURE_3D = (1<<20), // this is GL_TEXTURE_3D TF_ATLAS_PAGE = (1<<21), // bit who indicate lightmap page or deluxemap page -// reserved + TF_ALPHACONTRAST = (1<<22), // special texture mode for A2C // reserved // reserved TF_IMG_UPLOADED = (1<<25), // this is set for first time when called glTexImage, otherwise it will be call glTexSubImage diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 1a3c1476..15d7c20f 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -3715,6 +3715,8 @@ static event_api_t gEventApi = CL_VisTraceLine, pfnGetVisent, CL_TestLine, + CL_PushTraceBounds, + CL_PopTraceBounds, }; static demo_api_t gDemoApi = diff --git a/engine/client/cl_pmove.c b/engine/client/cl_pmove.c index 13af30b4..027860c3 100644 --- a/engine/client/cl_pmove.c +++ b/engine/client/cl_pmove.c @@ -81,6 +81,31 @@ void CL_PopPMStates( void ) } } +/* +============= +CL_PushTraceBounds + +============= +*/ +void CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs ) +{ + hullnum = bound( 0, hullnum, 3 ); + VectorCopy( mins, clgame.pmove->player_mins[hullnum] ); + VectorCopy( maxs, clgame.pmove->player_maxs[hullnum] ); +} + +/* +============= +CL_PopTraceBounds + +============= +*/ +void CL_PopTraceBounds( void ) +{ + memcpy( clgame.pmove->player_mins, host.player_mins, sizeof( host.player_mins )); + memcpy( clgame.pmove->player_maxs, host.player_maxs, sizeof( host.player_maxs )); +} + /* =============== CL_IsPredicted diff --git a/engine/client/client.h b/engine/client/client.h index fbb1e73c..4d5f534a 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -898,6 +898,8 @@ void CL_SetupPMove( playermove_t *pmove, local_state_t *from, usercmd_t *ucmd, q int CL_TestLine( const vec3_t start, const vec3_t end, int flags ); pmtrace_t *CL_VisTraceLine( vec3_t start, vec3_t end, int flags ); pmtrace_t CL_TraceLine( vec3_t start, vec3_t end, int flags ); +void CL_PushTraceBounds( int hullnum, const float *mins, const float *maxs ); +void CL_PopTraceBounds( void ); void CL_MoveSpectatorCamera( void ); void CL_SetLastUpdate( void ); void CL_RedoPrediction( void ); diff --git a/engine/client/gl_beams.c b/engine/client/gl_beams.c index 5fa9948e..dc1e4134 100644 --- a/engine/client/gl_beams.c +++ b/engine/client/gl_beams.c @@ -442,20 +442,15 @@ static void R_DrawSegs( vec3_t source, vec3_t delta, float width, float scale, f } // Iterator to resample noise waveform (it needs to be generated in powers of 2) - noiseStep = (int)((float)( NOISE_DIVISIONS - 1 ) * div * 65536.0f ); - noiseIndex = 0; - + noiseStep = noiseIndex = (int)((float)( NOISE_DIVISIONS - 1 ) * div * 65536.0f ); + if( FBitSet( flags, FBEAM_SINENOISE )) - { noiseIndex = 0; - } brightness = 1.0f; if( FBitSet( flags, FBEAM_SHADEIN )) - { brightness = 0; - } // Choose two vectors that are perpendicular to the beam R_BeamComputePerpendicular( delta, perp1 ); diff --git a/engine/client/gl_image.c b/engine/client/gl_image.c index 0999ca78..387202ad 100644 --- a/engine/client/gl_image.c +++ b/engine/client/gl_image.c @@ -173,7 +173,7 @@ void GL_ApplyTextureParams( gltexture_t *tex ) } // set texture anisotropy if available - if( GL_Support( GL_ANISOTROPY_EXT ) && ( tex->numMips > 1 )) + if( GL_Support( GL_ANISOTROPY_EXT ) && ( tex->numMips > 1 ) && !FBitSet( tex->flags, TF_ALPHACONTRAST )) pglTexParameterf( tex->target, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_anisotropy->value ); // set texture LOD bias if available @@ -256,7 +256,7 @@ static void GL_UpdateTextureParams( int iTexture ) GL_Bind( GL_TEXTURE0, iTexture ); // set texture anisotropy if available - if( GL_Support( GL_ANISOTROPY_EXT ) && ( tex->numMips > 1 ) && !FBitSet( tex->flags, TF_DEPTHMAP )) + if( GL_Support( GL_ANISOTROPY_EXT ) && ( tex->numMips > 1 ) && !FBitSet( tex->flags, TF_DEPTHMAP|TF_ALPHACONTRAST )) pglTexParameterf( tex->target, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_anisotropy->value ); // set texture LOD bias if available @@ -709,7 +709,11 @@ static void GL_SetTextureFormat( gltexture_t *tex, pixformat_t format, int chann switch( GL_CalcTextureSamples( channelMask )) { - case 1: tex->format = GL_LUMINANCE8; break; + case 1: + if( FBitSet( tex->flags, TF_ALPHACONTRAST )) + tex->format = GL_INTENSITY8; + else tex->format = GL_LUMINANCE8; + break; case 2: tex->format = GL_LUMINANCE8_ALPHA8; break; case 3: switch( bits ) @@ -883,7 +887,7 @@ byte *GL_ApplyFilter( const byte *source, int width, int height ) byte *out = (byte *)source; int i; - if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE )) + if( FBitSet( host.features, ENGINE_QUAKE_COMPATIBLE ) || glConfig.max_multisamples > 1 ) return in; for( i = 0; source && i < width * height; i++, in += 4 ) @@ -927,7 +931,7 @@ GL_BuildMipMap Operates in place, quartering the size of the texture ================= */ -static void GL_BuildMipMap( byte *in, int srcWidth, int srcHeight, int srcDepth, qboolean isNormalMap ) +static void GL_BuildMipMap( byte *in, int srcWidth, int srcHeight, int srcDepth, int flags ) { byte *out = in; int instride = ALIGN( srcWidth * 4, 1 ); @@ -937,15 +941,21 @@ static void GL_BuildMipMap( byte *in, int srcWidth, int srcHeight, int srcDepth, if( !in ) return; - mipWidth = max( 1, ( srcWidth >> 1 )); - mipHeight = max( 1, ( srcHeight >> 1 )); + mipWidth = Q_max( 1, ( srcWidth >> 1 )); + mipHeight = Q_max( 1, ( srcHeight >> 1 )); outpadding = ALIGN( mipWidth * 4, 1 ) - mipWidth * 4; row = srcWidth << 2; + if( FBitSet( flags, TF_ALPHACONTRAST )) + { + memset( in, mipWidth, mipWidth * mipHeight * 4 ); + return; + } + // move through all layers for( z = 0; z < srcDepth; z++ ) { - if( isNormalMap ) + if( FBitSet( flags, TF_NORMALMAP )) { for( y = 0; y < mipHeight; y++, in += instride * 2, out += outpadding ) { @@ -1234,7 +1244,7 @@ static qboolean GL_UploadTexture( gltexture_t *tex, rgbdata_t *pic ) size = GL_CalcImageSize( pic->type, width, height, tex->depth ); GL_TextureImageRAW( tex, i, j, width, height, tex->depth, pic->type, data ); if( mipCount > 1 ) - GL_BuildMipMap( data, width, height, tex->depth, normalMap ); + GL_BuildMipMap( data, width, height, tex->depth, tex->flags ); tex->size += texsize; tex->numMips++; @@ -1678,6 +1688,9 @@ int GL_CreateTexture( const char *name, int width, int height, const void *buffe r_empty.flags = IMAGE_HAS_COLOR | (( flags & TF_HAS_ALPHA ) ? IMAGE_HAS_ALPHA : 0 ); r_empty.buffer = (byte *)buffer; + if( FBitSet( flags, TF_ALPHACONTRAST )) + ClearBits( r_empty.flags, IMAGE_HAS_COLOR ); + if( FBitSet( flags, TF_TEXTURE_1D )) { r_empty.height = 1; diff --git a/engine/client/gl_local.h b/engine/client/gl_local.h index 8cf45b3f..9f3e8796 100644 --- a/engine/client/gl_local.h +++ b/engine/client/gl_local.h @@ -38,6 +38,7 @@ extern byte *r_temppool; #define SHADEDOT_QUANT 16 // precalculated dot products for quantized angles #define SHADE_LAMBERT 1.495f +#define DEFAULT_ALPHATEST 0.0f // refparams #define RP_NONE 0 @@ -417,6 +418,7 @@ float CL_GetStudioEstimatedFrame( cl_entity_t *ent ); int R_GetEntityRenderMode( cl_entity_t *ent ); void R_DrawStudioModel( cl_entity_t *e ); player_info_t *pfnPlayerInfo( int index ); +void R_GatherPlayerLight( void ); // // gl_alias.c @@ -520,7 +522,6 @@ enum GL_ARB_DEPTH_FLOAT_EXT, GL_ARB_SEAMLESS_CUBEMAP, GL_EXT_GPU_SHADER4, // shaders only - GL_ARB_TEXTURE_RG, GL_DEPTH_TEXTURE, GL_DEBUG_OUTPUT, GL_EXTCOUNT, // must be last @@ -638,6 +639,7 @@ extern convar_t *gl_finish; extern convar_t *gl_nosort; extern convar_t *gl_clear; extern convar_t *gl_test; // cvar to testify new effects +extern convar_t *gl_msaa; extern convar_t *r_speeds; extern convar_t *r_fullbright; diff --git a/engine/client/gl_rlight.c b/engine/client/gl_rlight.c index 2e8fe8c3..1c5233e0 100644 --- a/engine/client/gl_rlight.c +++ b/engine/client/gl_rlight.c @@ -49,7 +49,7 @@ void CL_RunLightStyles( void ) // 'm' is normal light, 'a' is no light, 'z' is double bright for( i = 0, ls = cl.lightstyles; i < MAX_LIGHTSTYLES; i++, ls++ ) { - if( r_fullbright->value || !cl.worldmodel->lightdata ) + if( !cl.worldmodel->lightdata ) { tr.lightstylevalue[i] = 256 * 256; continue; diff --git a/engine/client/gl_rmain.c b/engine/client/gl_rmain.c index d2656ecf..b92c15be 100644 --- a/engine/client/gl_rmain.c +++ b/engine/client/gl_rmain.c @@ -24,8 +24,6 @@ GNU General Public License for more details. #define IsLiquidContents( cnt ) ( cnt == CONTENTS_WATER || cnt == CONTENTS_SLIME || cnt == CONTENTS_LAVA ) -msurface_t *r_debug_surface; -const char *r_debug_hitbox; float gldepthmin, gldepthmax; ref_instance_t RI; @@ -242,10 +240,10 @@ qboolean R_AddEntity( struct cl_entity_s *clent, int type ) if( !clent || !clent->model ) return false; // if set to invisible, skip - if( clent->curstate.effects & EF_NODRAW ) + if( FBitSet( clent->curstate.effects, EF_NODRAW )) return false; // done - if( clent->curstate.rendermode != kRenderNormal && CL_FxBlend( clent ) <= 0 ) + if( !R_ModelOpaque( clent->curstate.rendermode ) && CL_FxBlend( clent ) <= 0 ) return true; // invisible if( type == ET_FRAGMENTED ) @@ -541,7 +539,7 @@ void R_SetupGL( qboolean set_gl_state ) pglMatrixMode( GL_MODELVIEW ); GL_LoadMatrix( RI.worldviewMatrix ); - if( RI.params & RP_CLIPPLANE ) + if( FBitSet( RI.params, RP_CLIPPLANE )) { GLdouble clip[4]; mplane_t *p = &RI.clipPlane; @@ -1084,8 +1082,22 @@ void R_RenderFrame( const ref_viewpass_t *rvp ) if( gl_finish->value && RI.drawWorld ) pglFinish(); - if( glConfig.max_multisamples > 1 ) - pglEnable( GL_MULTISAMPLE_ARB ); + if( glConfig.max_multisamples > 1 && FBitSet( gl_msaa->flags, FCVAR_CHANGED )) + { + if( CVAR_TO_BOOL( gl_msaa )) + { + pglEnable( GL_MULTISAMPLE_ARB ); + if( gl_msaa->value > 1.0f ) + pglEnable( GL_SAMPLE_ALPHA_TO_COVERAGE_ARB ); + else pglDisable( GL_SAMPLE_ALPHA_TO_COVERAGE_ARB ); + } + else + { + pglDisable( GL_SAMPLE_ALPHA_TO_COVERAGE_ARB ); + pglDisable( GL_MULTISAMPLE_ARB ); + } + ClearBits( gl_msaa->flags, FCVAR_CHANGED ); + } // completely override rendering if( clgame.drawFuncs.GL_RenderFrame != NULL ) @@ -1094,6 +1106,7 @@ void R_RenderFrame( const ref_viewpass_t *rvp ) if( clgame.drawFuncs.GL_RenderFrame( rvp )) { + R_GatherPlayerLight(); tr.realframecount++; tr.fResetVis = true; return; diff --git a/engine/client/gl_rsurf.c b/engine/client/gl_rsurf.c index a341246c..7737576a 100644 --- a/engine/client/gl_rsurf.c +++ b/engine/client/gl_rsurf.c @@ -1294,7 +1294,7 @@ void R_DrawAlphaTextureChains( void ) GL_ResetFogColor(); R_BlendLightmaps(); RI.currententity->curstate.rendermode = kRenderNormal; // restore world rendermode - pglAlphaFunc( GL_GREATER, 0.0f ); + pglAlphaFunc( GL_GREATER, DEFAULT_ALPHATEST ); } /* @@ -1564,7 +1564,7 @@ void R_DrawBrushModel( cl_entity_t *e ) e->curstate.rendermode = old_rendermode; pglDisable( GL_ALPHA_TEST ); - pglAlphaFunc( GL_GREATER, 0.0f ); + pglAlphaFunc( GL_GREATER, DEFAULT_ALPHATEST ); pglDisable( GL_BLEND ); pglDepthMask( GL_TRUE ); R_LoadIdentity(); // restore worldmatrix diff --git a/engine/client/gl_sprite.c b/engine/client/gl_sprite.c index c4732bbb..1a8881a3 100644 --- a/engine/client/gl_sprite.c +++ b/engine/client/gl_sprite.c @@ -979,7 +979,7 @@ void R_DrawSpriteModel( cl_entity_t *e ) color2[1] = (float)lightColor.g * ( 1.0f / 255.0f ); color2[2] = (float)lightColor.b * ( 1.0f / 255.0f ); // NOTE: sprites with 'lightmap' looks ugly when alpha func is GL_GREATER 0.0 - pglAlphaFunc( GL_GREATER, 0.25f ); + pglAlphaFunc( GL_GREATER, 0.5f ); } if( R_SpriteAllowLerping( e, psprite )) @@ -1073,7 +1073,7 @@ void R_DrawSpriteModel( cl_entity_t *e ) pglColor4f( color2[0], color2[1], color2[2], tr.blend ); GL_Bind( GL_TEXTURE0, tr.whiteTexture ); R_DrawSpriteQuad( frame, origin, v_right, v_up, scale ); - pglAlphaFunc( GL_GREATER, 0.0f ); + pglAlphaFunc( GL_GREATER, DEFAULT_ALPHATEST ); pglDepthFunc( GL_LEQUAL ); } diff --git a/engine/client/gl_studio.c b/engine/client/gl_studio.c index 5a2bae9c..294be9dd 100644 --- a/engine/client/gl_studio.c +++ b/engine/client/gl_studio.c @@ -139,7 +139,7 @@ void R_StudioInit( void ) Matrix3x4_LoadIdentity( g_studio.rotationmatrix ); Cvar_RegisterVariable( &r_glowshellfreq ); -// g-cont. especially not registered + // g-cont. cvar disabled by Valve // Cvar_RegisterVariable( &r_shadows ); g_studio.interpolate = true; @@ -2427,7 +2427,7 @@ static void R_StudioDrawPoints( void ) if( FBitSet( g_nFaceFlags, STUDIO_NF_MASKED )) { - pglAlphaFunc( GL_GREATER, 0.0f ); + pglAlphaFunc( GL_GREATER, DEFAULT_ALPHATEST ); pglDisable( GL_ALPHA_TEST ); } else if( FBitSet( g_nFaceFlags, STUDIO_NF_ADDITIVE ) && R_ModelOpaque( RI.currententity->curstate.rendermode )) @@ -3631,10 +3631,10 @@ void R_RunViewmodelEvents( void ) /* ================= -R_DrawViewModel +R_GatherPlayerLight ================= */ -void R_DrawViewModel( void ) +void R_GatherPlayerLight( void ) { cl_entity_t *view = &clgame.viewent; colorVec c; @@ -3643,6 +3643,18 @@ void R_DrawViewModel( void ) c = R_LightPoint( view->origin ); tr.ignore_lightgamma = false; cl.local.light_level = (c.r + c.g + c.b) / 3; +} + +/* +================= +R_DrawViewModel +================= +*/ +void R_DrawViewModel( void ) +{ + cl_entity_t *view = &clgame.viewent; + + R_GatherPlayerLight(); if( r_drawviewmodel->value == 0 ) return; @@ -3674,6 +3686,10 @@ void R_DrawViewModel( void ) pglFrontFace( GL_CW ); } + // FIXME: viewmodel is invisible when alpha to coverage is enabled + if( glConfig.max_multisamples > 1 && gl_msaa->value > 1.0f ) + pglDisable( GL_SAMPLE_ALPHA_TO_COVERAGE_ARB ); + switch( RI.currententity->model->type ) { case mod_alias: @@ -3685,6 +3701,9 @@ void R_DrawViewModel( void ) break; } + if( glConfig.max_multisamples > 1 && gl_msaa->value > 1.0f ) + pglEnable( GL_SAMPLE_ALPHA_TO_COVERAGE_ARB ); + // restore depth range pglDepthRange( gldepthmin, gldepthmax ); diff --git a/engine/client/gl_vidnt.c b/engine/client/gl_vidnt.c index 57af78c2..ffbb870b 100644 --- a/engine/client/gl_vidnt.c +++ b/engine/client/gl_vidnt.c @@ -32,11 +32,11 @@ convar_t *gl_texture_anisotropy; convar_t *gl_texture_lodbias; convar_t *gl_texture_nearest; convar_t *gl_lightmap_nearest; +convar_t *gl_wgl_msaa_samples; convar_t *gl_keeptjunctions; convar_t *gl_showtextures; convar_t *gl_detailscale; convar_t *gl_check_errors; -convar_t *gl_enable_msaa; convar_t *gl_round_down; convar_t *gl_polyoffset; convar_t *gl_wireframe; @@ -45,6 +45,7 @@ convar_t *gl_nosort; convar_t *gl_vsync; convar_t *gl_clear; convar_t *gl_test; +convar_t *gl_msaa; convar_t *window_xpos; convar_t *window_ypos; @@ -356,8 +357,6 @@ static void CALLBACK GL_DebugOutput( GLuint source, GLuint type, GLuint id, GLui Con_Printf( S_OPENGL_WARN "%s\n", message ); break; case GL_DEBUG_TYPE_PERFORMANCE_ARB: - if( host_developer.value < DEV_EXTENDED ) - return; Con_Printf( S_OPENGL_NOTE "%s\n", message ); break; case GL_DEBUG_TYPE_OTHER_ARB: @@ -531,7 +530,7 @@ static void GL_SetDefaultState( void ) memset( &glState, 0, sizeof( glState )); GL_SetDefaultTexState (); - if( Sys_CheckParm( "-gldebug" ) && host_developer.value ) + if( Sys_CheckParm( "-gldebug" )) debug_context = true; else debug_context = false; @@ -698,9 +697,9 @@ static int VID_ChoosePFD( PIXELFORMATDESCRIPTOR *pfd, int colorBits, int alphaBi attribs[16] = WGL_STENCIL_BITS_ARB; attribs[17] = stencilBits; attribs[18] = WGL_SAMPLE_BUFFERS_ARB; - attribs[19] = 1; + attribs[19] = TRUE; attribs[20] = WGL_SAMPLES_ARB; - attribs[21] = bound( 2, (int)gl_enable_msaa->value, 16 ); + attribs[21] = bound( 1, (int)gl_wgl_msaa_samples->value, 16 ); attribs[22] = 0; attribs[23] = 0; @@ -832,7 +831,7 @@ void VID_CreateFakeWindow( void ) int pixelFormat; // MSAA disabled - if( !gl_enable_msaa->value ) + if( !CVAR_TO_BOOL( gl_wgl_msaa_samples )) return; memset( &wndClass, 0, sizeof( WNDCLASSEX )); @@ -1442,7 +1441,7 @@ qboolean R_Init_OpenGL( void ) if( !opengl_dll.link ) return false; - if( debug_context || gl_enable_msaa->value ) + if( debug_context || CVAR_TO_BOOL( gl_wgl_msaa_samples )) GL_CheckExtension( "OpenGL Internal ProcAddress", wglproc_funcs, NULL, GL_WGL_PROCADDRESS ); return VID_SetMode(); @@ -1499,7 +1498,7 @@ static void GL_SetDefaults( void ) pglDisable( GL_BLEND ); pglDisable( GL_ALPHA_TEST ); pglDisable( GL_POLYGON_OFFSET_FILL ); - pglAlphaFunc( GL_GREATER, 0.0f ); + pglAlphaFunc( GL_GREATER, DEFAULT_ALPHATEST ); pglEnable( GL_TEXTURE_2D ); pglShadeModel( GL_SMOOTH ); pglFrontFace( GL_CCW ); @@ -1590,7 +1589,7 @@ void GL_InitCommands( void ) window_ypos = Cvar_Get( "_window_ypos", "48", FCVAR_RENDERINFO, "window position by vertical" ); gl_extensions = Cvar_Get( "gl_allow_extensions", "1", FCVAR_GLCONFIG, "allow gl_extensions" ); - gl_enable_msaa = Cvar_Get( "gl_enable_msaa", "4", FCVAR_GLCONFIG, "enable multisample anti-aliasing" ); + gl_wgl_msaa_samples = Cvar_Get( "gl_wgl_msaa_samples", "4", FCVAR_GLCONFIG, "enable multisample anti-aliasing" ); gl_texture_nearest = Cvar_Get( "gl_texture_nearest", "0", FCVAR_ARCHIVE, "disable texture filter" ); gl_lightmap_nearest = Cvar_Get( "gl_lightmap_nearest", "0", FCVAR_ARCHIVE, "disable lightmap filter" ); gl_check_errors = Cvar_Get( "gl_check_errors", "1", FCVAR_ARCHIVE, "ignore video engine errors" ); @@ -1606,6 +1605,7 @@ void GL_InitCommands( void ) gl_test = Cvar_Get( "gl_test", "0", 0, "engine developer cvar for quick testing new features" ); gl_wireframe = Cvar_Get( "gl_wireframe", "0", FCVAR_ARCHIVE|FCVAR_SPONLY, "show wireframe overlay" ); gl_round_down = Cvar_Get( "gl_round_down", "2", FCVAR_RENDERINFO, "round texture sizes to nearest POT value" ); + gl_msaa = Cvar_Get( "gl_msaa", "2", FCVAR_ARCHIVE, "enable multi sample anti-aliasing" ); // these cvar not used by engine but some mods requires this gl_polyoffset = Cvar_Get( "gl_polyoffset", "2.0", FCVAR_ARCHIVE, "polygon offset for decals" ); @@ -1680,7 +1680,7 @@ void GL_InitExtensions( void ) else glConfig.hardware_type = GLHW_GENERIC; // initalize until base opengl functions loaded (old-context) - if( !debug_context && !gl_enable_msaa->value ) + if( !debug_context && !CVAR_TO_BOOL( gl_wgl_msaa_samples )) GL_CheckExtension( "OpenGL Internal ProcAddress", wglproc_funcs, NULL, GL_WGL_PROCADDRESS ); // windows-specific extensions @@ -1761,7 +1761,6 @@ void GL_InitExtensions( void ) GL_CheckExtension( "GL_ARB_depth_buffer_float", NULL, "gl_texture_float", GL_ARB_DEPTH_FLOAT_EXT ); GL_CheckExtension( "GL_EXT_gpu_shader4", NULL, NULL, GL_EXT_GPU_SHADER4 ); // don't confuse users GL_CheckExtension( "GL_ARB_shading_language_100", NULL, NULL, GL_SHADER_GLSL100_EXT ); -// GL_CheckExtension( "GL_ARB_texture_rg", NULL, "gl_arb_texture_rg", GL_ARB_TEXTURE_RG ); // this won't work without extended context if( glw_state.extended ) @@ -1779,7 +1778,7 @@ void GL_InitExtensions( void ) pglGetIntegerv( GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &glConfig.max_vertex_uniforms ); pglGetIntegerv( GL_MAX_VERTEX_ATTRIBS_ARB, &glConfig.max_vertex_attribs ); - if( glConfig.hardware_type == GLHW_RADEON ) + if( glConfig.hardware_type == GLHW_RADEON && glConfig.max_vertex_uniforms > 512 ) glConfig.max_vertex_uniforms /= 4; // radeon returns not correct info } else @@ -1814,8 +1813,7 @@ void GL_InitExtensions( void ) pglEnable( GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB ); // enable all the low priority messages - if( host_developer.value >= DEV_EXTENDED ) - pglDebugMessageControlARB( GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, true ); + pglDebugMessageControlARB( GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, true ); } tr.framecount = tr.visframecount = 1; diff --git a/engine/client/vgui/vgui_surf.cpp b/engine/client/vgui/vgui_surf.cpp index 5603d492..8419b1f6 100644 --- a/engine/client/vgui/vgui_surf.cpp +++ b/engine/client/vgui/vgui_surf.cpp @@ -42,7 +42,7 @@ static Font* staticFont = NULL; static FontInfo* staticFontInfo; static Dar staticFontInfoDar; static PaintStack paintStack[MAX_PAINT_STACK]; -static staticPaintStackPos = 0; +static int staticPaintStackPos = 0; CEngineSurface :: CEngineSurface( Panel *embeddedPanel ):SurfaceBase( embeddedPanel ) { diff --git a/engine/common/imagelib/img_utils.c b/engine/common/imagelib/img_utils.c index ca8d20f4..afef2425 100644 --- a/engine/common/imagelib/img_utils.c +++ b/engine/common/imagelib/img_utils.c @@ -284,9 +284,9 @@ int Image_ComparePalette( const byte *pal ) void Image_SetPalette( const byte *pal, uint *d_table ) { - int i; byte rgba[4]; - + int i; + // setup palette switch( image.d_rendermode ) { @@ -309,6 +309,7 @@ void Image_SetPalette( const byte *pal, uint *d_table ) rgba[3] = i; d_table[i] = *(uint *)rgba; } +// d_table[0] = 0x00808080; break; case LUMP_MASKED: for( i = 0; i < 255; i++ ) diff --git a/engine/common/input.h b/engine/common/input.h index 98c91ad9..a23693b2 100644 --- a/engine/common/input.h +++ b/engine/common/input.h @@ -26,8 +26,11 @@ INPUT #include "keydefs.h" -#define WHEEL_DELTA 120 // Default value for rolling one notch +#ifndef WM_MOUSEWHEEL #define WM_MOUSEWHEEL ( WM_MOUSELAST + 1 )// message that will be supported by the OS +#endif + +#define WHEEL_DELTA 120 // Default value for rolling one notch #define MK_XBUTTON1 0x0020 #define MK_XBUTTON2 0x0040 #define MK_XBUTTON3 0x0080 @@ -36,6 +39,7 @@ INPUT #define WM_XBUTTONUP 0x020C #define WM_XBUTTONDOWN 0x020B + // // input.c // diff --git a/engine/common/library.h b/engine/common/library.h index ca380280..1a762992 100644 --- a/engine/common/library.h +++ b/engine/common/library.h @@ -21,6 +21,10 @@ GNU General Public License for more details. #define NUMBER_OF_DIRECTORY_ENTRIES 16 #define MAX_LIBRARY_EXPORTS 4096 +#ifndef IMAGE_SIZEOF_BASE_RELOCATION +#define IMAGE_SIZEOF_BASE_RELOCATION ( sizeof( IMAGE_BASE_RELOCATION )) +#endif + typedef struct { // dos .exe header diff --git a/engine/server/sv_pmove.c b/engine/server/sv_pmove.c index 005a8d9a..136e5724 100644 --- a/engine/server/sv_pmove.c +++ b/engine/server/sv_pmove.c @@ -177,7 +177,7 @@ void SV_GetTrueOrigin( sv_client_t *cl, int edictnum, vec3_t origin ) return; if( svgame.interp[edictnum-1].active && svgame.interp[edictnum-1].moving ) - VectorCopy( svgame.interp[edictnum-1].newpos, origin ); + VectorCopy( svgame.interp[edictnum-1].oldpos, origin ); } void SV_GetTrueMinMax( sv_client_t *cl, int edictnum, vec3_t mins, vec3_t maxs )