17 Apr 2018

This commit is contained in:
g-cont 2018-04-17 00:00:00 +03:00 committed by Alibek Omarov
parent 5696a3fc3c
commit 11b2d7e842
15 changed files with 324 additions and 65 deletions

View File

@ -1758,7 +1758,7 @@ void CL_RegisterResources( sizebuf_t *msg )
}
else
{
MsgDev( D_ERROR, "client world model is NULL\n" );
Con_Printf( S_ERROR "client world model is NULL\n" );
CL_Disconnect();
}
}

View File

@ -806,6 +806,59 @@ typedef float GLmatrix[16];
#define ERROR_INVALID_VERSION_ARB 0x2095
#define ERROR_INVALID_PROFILE_ARB 0x2096
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
#define WGL_ACCELERATION_ARB 0x2003
#define WGL_NEED_PALETTE_ARB 0x2004
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
#define WGL_SWAP_METHOD_ARB 0x2007
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
#define WGL_TRANSPARENT_ARB 0x200A
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
#define WGL_SHARE_DEPTH_ARB 0x200C
#define WGL_SHARE_STENCIL_ARB 0x200D
#define WGL_SHARE_ACCUM_ARB 0x200E
#define WGL_SUPPORT_GDI_ARB 0x200F
#define WGL_SUPPORT_OPENGL_ARB 0x2010
#define WGL_DOUBLE_BUFFER_ARB 0x2011
#define WGL_STEREO_ARB 0x2012
#define WGL_PIXEL_TYPE_ARB 0x2013
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_RED_BITS_ARB 0x2015
#define WGL_RED_SHIFT_ARB 0x2016
#define WGL_GREEN_BITS_ARB 0x2017
#define WGL_GREEN_SHIFT_ARB 0x2018
#define WGL_BLUE_BITS_ARB 0x2019
#define WGL_BLUE_SHIFT_ARB 0x201A
#define WGL_ALPHA_BITS_ARB 0x201B
#define WGL_ALPHA_SHIFT_ARB 0x201C
#define WGL_ACCUM_BITS_ARB 0x201D
#define WGL_ACCUM_RED_BITS_ARB 0x201E
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
#define WGL_DEPTH_BITS_ARB 0x2022
#define WGL_STENCIL_BITS_ARB 0x2023
#define WGL_AUX_BUFFERS_ARB 0x2024
#define WGL_NO_ACCELERATION_ARB 0x2025
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
#define WGL_FULL_ACCELERATION_ARB 0x2027
#define WGL_SWAP_EXCHANGE_ARB 0x2028
#define WGL_SWAP_COPY_ARB 0x2029
#define WGL_SWAP_UNDEFINED_ARB 0x202A
#define WGL_TYPE_RGBA_ARB 0x202B
#define WGL_TYPE_COLORINDEX_ARB 0x202C
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042
// helper opengl functions
GLenum ( APIENTRY *pglGetError )(void);
const GLubyte * ( APIENTRY *pglGetString )(GLenum name);
@ -1297,6 +1350,8 @@ BOOL ( WINAPI * pwglRealizeLayerPalette)(HDC, int, BOOL);
BOOL ( WINAPI * pwglSwapLayerBuffers)(HDC, UINT);
BOOL ( WINAPI * pwglSwapIntervalEXT)( int interval );
HGLRC ( WINAPI * pwglCreateContextAttribsARB)( HDC hDC, HGLRC hShareContext, const int *attribList );
BOOL ( WINAPI *pwglGetPixelFormatAttribiv)( HDC hDC, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttrib, int *piValues );
BOOL ( WINAPI *pwglChoosePixelFormat)( HDC hDC, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFmts, int *piFmts, UINT *nNumFmts );
const char *( WINAPI * pwglGetExtensionsStringEXT)( void );
#endif//GL_EXPORT_H

View File

@ -400,7 +400,13 @@ static size_t GL_CalcTextureSize( GLenum format, int width, int height, int dept
break;
case GL_RGB8:
case GL_RGB:
size = width * height * depth * 4;
size = width * height * depth * 3;
break;
case GL_RGB5:
size = (width * height * depth * 3) / 2;
break;
case GL_RGBA4:
size = (width * height * depth * 4) / 2;
break;
case GL_INTENSITY:
case GL_LUMINANCE:
@ -531,10 +537,27 @@ static void GL_SetTextureDimensions( gltexture_t *tex, int width, int height, in
if( !GL_Support( GL_ARB_TEXTURE_NPOT_EXT ))
{
width = (width + 3) & ~3;
height = (height + 3) & ~3;
int step = (int)gl_round_down->value;
int scaled_width, scaled_height;
for( scaled_width = 1; scaled_width < width; scaled_width <<= 1 );
if( step > 0 && width < scaled_width && ( step == 1 || ( scaled_width - width ) > ( scaled_width >> step )))
scaled_width >>= 1;
for( scaled_height = 1; scaled_height < height; scaled_height <<= 1 );
if( step > 0 && height < scaled_height && ( step == 1 || ( scaled_height - height ) > ( scaled_height >> step )))
scaled_height >>= 1;
width = scaled_width;
height = scaled_height;
}
#if 1 // TESTTEST
width = (width + 3) & ~3;
height = (height + 3) & ~3;
#endif
if( width > maxTextureSize || height > maxTextureSize || depth > maxDepthSize )
{
if( tex->target == GL_TEXTURE_1D )
@ -684,7 +707,7 @@ static void GL_SetTextureFormat( gltexture_t *tex, pixformat_t format, int chann
// NOTE: not all the types will be compressed
int bits = glw_state.desktopBitsPixel;
switch( GL_CalcTextureSamples( channelMask ) )
switch( GL_CalcTextureSamples( channelMask ))
{
case 1: tex->format = GL_LUMINANCE8; break;
case 2: tex->format = GL_LUMINANCE8_ALPHA8; break;
@ -1134,7 +1157,7 @@ static qboolean GL_UploadTexture( gltexture_t *tex, rgbdata_t *pic )
if(( pic->width * pic->height ) & 3 )
{
// will be resampled, just tell me for debug targets
MsgDev( D_NOTE, "GL_UploadTexture: %s s&3 [%d x %d]\n", tex->name, pic->width, pic->height );
Con_Reportf( "GL_UploadTexture: %s s&3 [%d x %d]\n", tex->name, pic->width, pic->height );
}
buf = pic->buffer;

View File

@ -628,6 +628,7 @@ extern convar_t *gl_texture_lodbias;
extern convar_t *gl_texture_nearest;
extern convar_t *gl_lightmap_nearest;
extern convar_t *gl_keeptjunctions;
extern convar_t *gl_round_down;
extern convar_t *gl_detailscale;
extern convar_t *gl_wireframe;
extern convar_t *gl_polyoffset;

View File

@ -216,15 +216,15 @@ int R_CountSurfaceDlights( msurface_t *surf )
=======================================================================
*/
static float g_trace_fraction;
static vec3_t g_trace_lightspot;
static float g_trace_fraction;
/*
=================
R_RecursiveLightPoint
=================
*/
static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f, float p2f, colorVec *cv, const vec3_t start, const vec3_t end, qboolean debug )
static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f, float p2f, colorVec *cv, const vec3_t start, const vec3_t end )
{
float front, back, frac, midf;
int i, map, side, size;
@ -249,7 +249,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
side = front < 0;
if(( back < 0 ) == side )
return R_RecursiveLightPoint( model, node->children[side], p1f, p2f, cv, start, end, debug );
return R_RecursiveLightPoint( model, node->children[side], p1f, p2f, cv, start, end );
frac = front / ( front - back );
@ -257,7 +257,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
midf = p1f + ( p2f - p1f ) * frac;
// co down front side
if( R_RecursiveLightPoint( model, node->children[side], p1f, midf, cv, start, mid, debug ))
if( R_RecursiveLightPoint( model, node->children[side], p1f, midf, cv, start, mid ))
return true; // hit something
if(( back < 0 ) == side )
@ -330,15 +330,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
}
// go down back side
return R_RecursiveLightPoint( model, node->children[!side], midf, p2f, cv, mid, end, debug );
}
int R_LightTraceFilter( physent_t *pe )
{
if( !pe || pe->solid != SOLID_BSP || pe->info == 0 )
return 1;
return 0;
return R_RecursiveLightPoint( model, node->children[!side], midf, p2f, cv, mid, end );
}
/*
@ -354,6 +346,8 @@ colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot )
int i, maxEnts = 1;
colorVec light, cv;
if( lspot ) VectorClear( lspot );
if( cl.worldmodel && cl.worldmodel->lightdata )
{
light.r = light.g = light.b = light.a = 0;
@ -391,7 +385,7 @@ colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot )
VectorClear( g_trace_lightspot );
g_trace_fraction = 1.0f;
if( !R_RecursiveLightPoint( pe->model, pnodes, 0.0f, 1.0f, &cv, start_l, end_l, lspot != NULL ))
if( !R_RecursiveLightPoint( pe->model, pnodes, 0.0f, 1.0f, &cv, start_l, end_l ))
continue; // didn't hit anything
if( g_trace_fraction < last_fraction )

View File

@ -36,6 +36,8 @@ 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;
convar_t *gl_finish;
@ -76,6 +78,10 @@ ref_globals_t tr;
glconfig_t glConfig;
glstate_t glState;
glwstate_t glw_state;
static HWND hWndFake;
static HDC hDCFake;
static HGLRC hGLRCFake;
static qboolean debug_context;
typedef enum
{
@ -522,6 +528,10 @@ static void GL_SetDefaultState( void )
memset( &glState, 0, sizeof( glState ));
GL_SetDefaultTexState ();
if( Sys_CheckParm( "-gldebug" ) && host_developer.value )
debug_context = true;
else debug_context = false;
// init draw stack
tr.draw_list = &tr.draw_stack[0];
tr.draw_stack_pos = 0;
@ -570,12 +580,12 @@ qboolean GL_CreateContext( void )
if(!( pwglMakeCurrent( glw_state.hDC, glw_state.hGLRC )))
return GL_DeleteContext();
if( !Sys_CheckParm( "-gldebug" ) || !host_developer.value ) // debug bit kill the perfomance
if( !debug_context ) // debug bit kill the perfomance
return true;
pwglCreateContextAttribsARB = GL_GetProcAddress( "wglCreateContextAttribsARB" );
if( pwglCreateContextAttribsARB != NULL )
if( debug_context && pwglCreateContextAttribsARB != NULL )
{
int attribs[] =
{
@ -660,11 +670,51 @@ VID_ChoosePFD
*/
static int VID_ChoosePFD( PIXELFORMATDESCRIPTOR *pfd, int colorBits, int alphaBits, int depthBits, int stencilBits )
{
int pixelFormat = 0;
if( pwglChoosePixelFormat != NULL )
{
UINT numPixelFormats;
int pixelFormat = 0;
int attribs[24];
int samples = 0;
MsgDev( D_NOTE, "VID_ChoosePFD( color %i, alpha %i, depth %i, stencil %i )\n", colorBits, alphaBits, depthBits, stencilBits );
attribs[0] = WGL_ACCELERATION_ARB;
attribs[1] = WGL_FULL_ACCELERATION_ARB;
attribs[2] = WGL_DRAW_TO_WINDOW_ARB;
attribs[3] = TRUE;
attribs[4] = WGL_SUPPORT_OPENGL_ARB;
attribs[5] = TRUE;
attribs[6] = WGL_DOUBLE_BUFFER_ARB;
attribs[7] = TRUE;
attribs[8] = WGL_PIXEL_TYPE_ARB;
attribs[9] = WGL_TYPE_RGBA_ARB;
attribs[10] = WGL_COLOR_BITS_ARB;
attribs[11] = colorBits;
attribs[12] = WGL_ALPHA_BITS_ARB;
attribs[13] = alphaBits;
attribs[14] = WGL_DEPTH_BITS_ARB;
attribs[15] = depthBits;
attribs[16] = WGL_STENCIL_BITS_ARB;
attribs[17] = stencilBits;
attribs[18] = WGL_SAMPLE_BUFFERS_ARB;
attribs[19] = 1;
attribs[20] = WGL_SAMPLES_ARB;
attribs[21] = bound( 2, (int)gl_enable_msaa->value, 16 );
attribs[22] = 0;
attribs[23] = 0;
// Fill out the PFD
pwglChoosePixelFormat( glw_state.hDC, attribs, NULL, 1, &pixelFormat, &numPixelFormats );
if( pixelFormat )
{
attribs[0] = WGL_SAMPLES_ARB;
pwglGetPixelFormatAttribiv( glw_state.hDC, pixelFormat, 0, 1, attribs, &samples );
if( samples <= 1 ) Con_DPrintf( S_WARN "MSAA is not allowed\n" );
return pixelFormat;
}
}
// fallback: fill out the PFD
pfd->nSize = sizeof (PIXELFORMATDESCRIPTOR);
pfd->nVersion = 1;
pfd->dwFlags = PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER;
@ -699,15 +749,7 @@ static int VID_ChoosePFD( PIXELFORMATDESCRIPTOR *pfd, int colorBits, int alphaBi
pfd->dwDamageMask = 0;
// count PFDs
pixelFormat = ChoosePixelFormat( glw_state.hDC, pfd );
if( !pixelFormat )
{
Con_Printf( S_ERROR "VID_ChoosePFD failed\n" );
return 0;
}
return pixelFormat;
return ChoosePixelFormat( glw_state.hDC, pfd );
}
/*
@ -748,6 +790,125 @@ const char *VID_GetModeString( int vid_mode )
return NULL; // out of bounds
}
/*
=================
VID_DestroyFakeWindow
=================
*/
void VID_DestroyFakeWindow( void )
{
if( hGLRCFake )
{
pwglMakeCurrent( NULL, NULL );
pwglDeleteContext( hGLRCFake );
hGLRCFake = NULL;
}
if( hDCFake )
{
ReleaseDC( hWndFake, hDCFake );
hDCFake = NULL;
}
if( hWndFake )
{
DestroyWindow( hWndFake );
UnregisterClass( "TestWindow", host.hInst );
hWndFake = NULL;
}
}
/*
=================
VID_CreateFakeWindow
=================
*/
void VID_CreateFakeWindow( void )
{
WNDCLASSEX wndClass;
PIXELFORMATDESCRIPTOR pfd;
int pixelFormat;
// MSAA disabled
if( !gl_enable_msaa->value )
return;
memset( &wndClass, 0, sizeof( WNDCLASSEX ));
hGLRCFake = NULL;
hWndFake = NULL;
hDCFake = NULL;
// register the window class
wndClass.cbSize = sizeof( WNDCLASSEX );
wndClass.lpfnWndProc = DefWindowProc;
wndClass.hInstance = host.hInst;
wndClass.lpszClassName = "TestWindow";
if( !RegisterClassEx( &wndClass ))
return;
// Create the fake window
if(( hWndFake = CreateWindowEx( 0, "TestWindow", "Xash3D", 0, 0, 0, 100, 100, NULL, NULL, wndClass.hInstance, NULL )) == NULL )
{
UnregisterClass( "TestWindow", wndClass.hInstance );
return;
}
// Get a DC for the fake window
if(( hDCFake = GetDC( hWndFake )) == NULL )
{
VID_DestroyFakeWindow();
return;
}
// Choose a pixel format
memset( &pfd, 0, sizeof( PIXELFORMATDESCRIPTOR ));
pfd.nSize = sizeof( PIXELFORMATDESCRIPTOR );
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.iLayerType = PFD_MAIN_PLANE;
pfd.cColorBits = 32;
pfd.cAlphaBits = 8;
pfd.cDepthBits = 24;
pfd.cStencilBits = 8;
if(( pixelFormat = ChoosePixelFormat( hDCFake, &pfd )) == 0 )
{
VID_DestroyFakeWindow();
return;
}
// Set the pixel format
if( !SetPixelFormat( hDCFake, pixelFormat, &pfd ))
{
VID_DestroyFakeWindow();
return;
}
// Create the fake GL context
if(( hGLRCFake = pwglCreateContext( hDCFake )) == NULL )
{
VID_DestroyFakeWindow();
return;
}
// Make the fake GL context current
if( !pwglMakeCurrent( hDCFake, hGLRCFake ))
{
VID_DestroyFakeWindow();
return;
}
// We only need these function pointers if available
pwglGetPixelFormatAttribiv = GL_GetProcAddress( "wglGetPixelFormatAttribivARB" );
pwglChoosePixelFormat = GL_GetProcAddress( "wglChoosePixelFormatARB" );
// destory now it's no longer needed
VID_DestroyFakeWindow();
}
/*
=================
GL_SetPixelformat
@ -756,9 +917,11 @@ GL_SetPixelformat
qboolean GL_SetPixelformat( void )
{
PIXELFORMATDESCRIPTOR PFD;
int colorBits = 32;
int alphaBits = 8;
int stencilBits = 8;
int pixelFormat = 0;
int depthBits = 24;
if(( glw_state.hDC = GetDC( host.hWnd )) == NULL )
return false;
@ -766,16 +929,22 @@ qboolean GL_SetPixelformat( void )
if( glw_state.desktopBitsPixel < 32 )
{
// clear alphabits in case we in 16-bit mode
colorBits = glw_state.desktopBitsPixel;
alphaBits = 0;
}
else
{
// no reason to trying enable MSAA on a highcolor
VID_CreateFakeWindow();
}
// choose a pixel format
pixelFormat = VID_ChoosePFD( &PFD, 24, alphaBits, 32, stencilBits );
pixelFormat = VID_ChoosePFD( &PFD, colorBits, alphaBits, depthBits, stencilBits );
if( !pixelFormat )
{
// try again with default color/depth/stencil
pixelFormat = VID_ChoosePFD( &PFD, 24, 0, 32, 0 );
pixelFormat = VID_ChoosePFD( &PFD, colorBits, 0, depthBits, 0 );
if( !pixelFormat )
{
@ -820,7 +989,7 @@ qboolean GL_SetPixelformat( void )
else glState.stencilEnabled = false;
// print out PFD specifics
MsgDev( D_NOTE, "GL PFD: color( %d-bits ) alpha( %d-bits ) Z( %d-bit )\n", PFD.cColorBits, PFD.cAlphaBits, PFD.cDepthBits );
Con_Reportf( "PixelFormat: color: %d-bit, Z-Buffer: %d-bit, stencil: %d-bit\n", PFD.cColorBits, PFD.cDepthBits, PFD.cStencilBits );
return true;
}
@ -938,7 +1107,6 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
GetWindowRect(WindowHandle, &WindowRect);
WindowHeight = WindowRect.bottom - WindowRect.top;
#endif
if( !fullscreen )
{
x = window_xpos->value;
@ -1272,7 +1440,7 @@ qboolean R_Init_OpenGL( void )
if( !opengl_dll.link )
return false;
if( Sys_CheckParm( "-gldebug" ) && host_developer.value )
if( debug_context || gl_enable_msaa->value )
GL_CheckExtension( "OpenGL Internal ProcAddress", wglproc_funcs, NULL, GL_WGL_PROCADDRESS );
return VID_SetMode();
@ -1420,6 +1588,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_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" );
@ -1434,6 +1603,7 @@ void GL_InitCommands( void )
gl_clear = Cvar_Get( "gl_clear", "0", FCVAR_ARCHIVE, "clearing screen after each frame" );
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" );
// 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" );
@ -1502,7 +1672,7 @@ void GL_InitExtensions( void )
else glConfig.hardware_type = GLHW_GENERIC;
// initalize until base opengl functions loaded (old-context)
if( !Sys_CheckParm( "-gldebug" ) || !host_developer.value )
if( !debug_context && !gl_enable_msaa->value )
GL_CheckExtension( "OpenGL Internal ProcAddress", wglproc_funcs, NULL, GL_WGL_PROCADDRESS );
// windows-specific extensions

View File

@ -1367,12 +1367,12 @@ void FS_Init( void )
if( FS_CheckNastyPath( fs_basedir, true ))
{
// this is completely fatal...
Sys_Error( "FS_Init: invalid base directory \"%s\"\n", fs_basedir );
Sys_Error( "invalid base directory \"%s\"\n", fs_basedir );
}
if( FS_CheckNastyPath( fs_gamedir, true ))
{
MsgDev( D_ERROR, "FS_Init: invalid game directory \"%s\"\n", fs_gamedir );
Con_Printf( S_ERROR "invalid game directory \"%s\"\n", fs_gamedir );
Q_strncpy( fs_gamedir, fs_basedir, sizeof( fs_gamedir )); // default dir
}
@ -1388,7 +1388,7 @@ void FS_Init( void )
if( !hasGameDir )
{
MsgDev( D_ERROR, "FS_Init: game directory \"%s\" not exist\n", fs_gamedir );
Con_Printf( S_ERROR "game directory \"%s\" not exist\n", fs_gamedir );
if( hasBaseDir ) Q_strncpy( fs_gamedir, fs_basedir, sizeof( fs_gamedir ));
}
@ -1410,7 +1410,7 @@ void FS_Init( void )
stringlistfreecontents( &dirs );
}
MsgDev( D_NOTE, "FS_Init: done\n" );
Con_Reportf( "FS_Init: done\n" );
}
void FS_AllowDirectPaths( qboolean enable )

View File

@ -361,7 +361,7 @@ void Host_InitDecals( void )
}
if( t ) Mem_Free( t );
Con_DPrintf( "InitDecals: %i decals\n", num_decals );
Con_Reportf( "InitDecals: %i decals\n", num_decals );
}
/*

View File

@ -786,7 +786,7 @@ void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean d
if( !hInst->hInstance )
{
Con_DPrintf( "LoadLibrary: Loading %s - failed\n", dllname );
Con_Reportf( "LoadLibrary: Loading %s - failed\n", dllname );
COM_FreeLibrary( hInst );
return NULL;
}
@ -796,13 +796,13 @@ void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean d
{
if( !LibraryLoadSymbols( hInst ))
{
Con_DPrintf( "LoadLibrary: Loading %s - failed\n", dllname );
Con_Reportf( "LoadLibrary: Loading %s - failed\n", dllname );
COM_FreeLibrary( hInst );
return NULL;
}
}
Con_DPrintf( "LoadLibrary: Loading %s - ok\n", dllname );
Con_Reportf( "LoadLibrary: Loading %s - ok\n", dllname );
return hInst;
}

View File

@ -151,7 +151,6 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash );
model_t *Mod_ForName( const char *name, qboolean crash, qboolean trackCRC );
qboolean Mod_ValidateCRC( const char *name, CRC32_t crc );
void Mod_NeedCRC( const char *name, qboolean needCRC );
void Mod_PurgeStudioCache( void );
void Mod_FreeUnused( void );
//

View File

@ -23,7 +23,7 @@ GNU General Public License for more details.
#include "gl_local.h"
#include "features.h"
#include "client.h"
#include "server.h" // LUMP_ error codes
#include "server.h"
static model_info_t mod_crcinfo[MAX_MODELS];
static model_t mod_known[MAX_MODELS];
@ -132,7 +132,7 @@ static void Mod_FreeModel( model_t *mod )
/*
===============================================================================
MODEL INITALIZE\SHUTDOWN
MODEL INITIALIZE\SHUTDOWN
===============================================================================
*/
@ -156,11 +156,10 @@ Mod_FreeAll
*/
void Mod_FreeAll( void )
{
model_t *mod;
int i;
for( i = 0, mod = mod_known; i < mod_numknown; i++, mod++ )
Mod_FreeModel( mod );
for( i = 0; i < mod_numknown; i++ )
Mod_FreeModel( &mod_known[i] );
mod_numknown = 0;
}
@ -232,7 +231,7 @@ model_t *Mod_FindName( const char *filename, qboolean trackCRC )
if( i == mod_numknown )
{
if( mod_numknown == MAX_MODELS )
Host_Error( "Mod_ForName: MAX_MODELS limit exceeded\n" );
Host_Error( "MAX_MODELS limit exceeded (%d)\n", MAX_MODELS );
mod_numknown++;
}
@ -255,7 +254,7 @@ Loads a model into the cache
*/
model_t *Mod_LoadModel( model_t *mod, qboolean crash )
{
char tempname[64];
char tempname[MAX_QPATH];
long length = 0;
qboolean loaded;
byte *buf;
@ -364,7 +363,7 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
if( FBitSet( p->flags, FCRC_CHECKSUM_DONE ))
{
if( currentCRC != p->initialCRC )
Host_Error( "Mod_ForName: %s has a bad checksum\n", tempname );
Host_Error( "%s has a bad checksum\n", tempname );
}
else
{
@ -397,7 +396,7 @@ Mod_PurgeStudioCache
free studio cache on change level
==================
*/
void Mod_PurgeStudioCache( void )
static void Mod_PurgeStudioCache( void )
{
int i;

View File

@ -755,7 +755,9 @@ static char *SV_ReadEntityScript( const char *filename, int *flags )
ents = FS_LoadFile( entfilename, NULL, true );
}
if( !ents && lumplen >= 10 )
// at least entities should contain "{ "classname" "worldspawn" }\0"
// for correct spawn the level
if( !ents && lumplen >= 32 )
{
FS_Seek( f, lumpofs, SEEK_SET );
ents = Z_Malloc( lumplen + 1 );

View File

@ -2154,7 +2154,7 @@ qboolean SV_GetSaveComment( const char *savename, char *comment )
{
int i, tag, size, nNumberOfFields, nFieldSize, tokenSize, tokenCount;
char *pData, *pSaveData, *pFieldName, **pTokenList;
string name, description;
string mapName, description;
file_t *f;
if(( f = FS_Open( savename, "rb", true )) == NULL )
@ -2197,7 +2197,7 @@ qboolean SV_GetSaveComment( const char *savename, char *comment )
return 0;
}
name[0] = '\0';
mapName[0] = '\0';
comment[0] = '\0';
FS_Read( f, &size, sizeof( int ));
@ -2276,7 +2276,7 @@ qboolean SV_GetSaveComment( const char *savename, char *comment )
}
else if( !Q_stricmp( pFieldName, "mapName" ))
{
Q_strncpy( name, pData, nFieldSize );
Q_strncpy( mapName, pData, nFieldSize );
}
// move to start of next field.
@ -2289,11 +2289,27 @@ qboolean SV_GetSaveComment( const char *savename, char *comment )
FS_Close( f );
// at least mapname should be filled
if( Q_strlen( name ) > 0 )
if( Q_strlen( mapName ) > 0 )
{
time_t fileTime;
const struct tm *file_tm;
string timestring;
int flags;
// now check for map problems
flags = SV_MapIsValid( mapName, GI->sp_entity, NULL );
if( FBitSet( flags, MAP_INVALID_VERSION ))
{
Q_strncpy( comment, va( "<map %s has invalid format>", mapName ), MAX_STRING );
return 0;
}
if( !FBitSet( flags, MAP_IS_EXIST ))
{
Q_strncpy( comment, va( "<map %s is missed>", mapName ), MAX_STRING );
return 0;
}
fileTime = FS_FileTime( savename, true );
file_tm = localtime( &fileTime );

View File

@ -278,7 +278,7 @@ static void UI_LoadGame_Ownerdraw( void *self )
sprintf( saveshot, "save/%s.bmp", uiLoadGame.saveName[uiLoadGame.savesList.curItem] );
if( !FILE_EXISTS( saveshot ))
if( !g_engfuncs.pfnFileExists( saveshot, TRUE ))
UI_DrawPicAdditive( x, y, w, h, uiColorWhite, "{GRAF001" );
else UI_DrawPic( x, y, w, h, uiColorWhite, saveshot );
}

View File

@ -298,7 +298,7 @@ static void UI_SaveGame_Ownerdraw( void *self )
sprintf( saveshot, "save/%s.bmp", uiSaveGame.saveName[uiSaveGame.savesList.curItem] );
if( !FILE_EXISTS( saveshot ))
if( !g_engfuncs.pfnFileExists( saveshot, TRUE ))
UI_DrawPicAdditive( x, y, w, h, uiColorWhite, "{GRAF001" );
else UI_DrawPic( x, y, w, h, uiColorWhite, saveshot );
}