Apply 4511 update

This commit is contained in:
Alibek Omarov 2019-06-17 07:05:36 +03:00
parent c215b89923
commit b16529cc65
20 changed files with 162 additions and 71 deletions

View File

@ -61,6 +61,8 @@ GNU General Public License for more details.
#define PARM_STENCIL_ACTIVE 36 #define PARM_STENCIL_ACTIVE 36
#define PARM_WATER_ALPHA 37 #define PARM_WATER_ALPHA 37
#define PARM_TEX_MEMORY 38 // returns total memory of uploaded texture in bytes #define PARM_TEX_MEMORY 38 // returns total memory of uploaded texture in bytes
#define PARM_DELUXEDATA 39 // nasty hack, convert int to pointer
#define PARM_SHADOWDATA 40 // nasty hack, convert int to pointer
// skybox ordering // skybox ordering
enum enum
@ -94,7 +96,7 @@ typedef enum
TF_NORMALMAP = (1<<15), // is a normalmap TF_NORMALMAP = (1<<15), // is a normalmap
TF_HAS_ALPHA = (1<<16), // image has alpha (used only for GL_CreateTexture) TF_HAS_ALPHA = (1<<16), // image has alpha (used only for GL_CreateTexture)
TF_FORCE_COLOR = (1<<17), // force upload monochrome textures as RGB (detail textures) TF_FORCE_COLOR = (1<<17), // force upload monochrome textures as RGB (detail textures)
// reserved TF_UPDATE = (1<<18), // allow to update already loaded texture
TF_BORDER = (1<<19), // zero clamp for projected textures TF_BORDER = (1<<19), // zero clamp for projected textures
TF_TEXTURE_3D = (1<<20), // this is GL_TEXTURE_3D TF_TEXTURE_3D = (1<<20), // this is GL_TEXTURE_3D
TF_ATLAS_PAGE = (1<<21), // bit who indicate lightmap page or deluxemap page TF_ATLAS_PAGE = (1<<21), // bit who indicate lightmap page or deluxemap page
@ -217,8 +219,8 @@ typedef struct render_api_s
struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e ); struct mstudiotex_s *( *StudioGetTexture )( struct cl_entity_s *e );
const struct ref_overview_s *( *GetOverviewParms )( void ); const struct ref_overview_s *( *GetOverviewParms )( void );
const char *( *GetFileByIndex )( int fileindex ); const char *( *GetFileByIndex )( int fileindex );
void (*R_Reserved0)( void ); // for potential interface expansion without broken compatibility int (*pfnSaveFile)( const char *filename, const void *data, long len );
void (*R_Reserved1)( void ); void (*R_Reserved0)( void );
// static allocations // static allocations
void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ); void *(*pfnMemAlloc)( size_t cb, const char *filename, const int fileline );
@ -263,6 +265,8 @@ typedef struct render_interface_s
void (*R_NewMap)( void ); void (*R_NewMap)( void );
// clear the render entities before each frame // clear the render entities before each frame
void (*R_ClearScene)( void ); void (*R_ClearScene)( void );
// shuffle previous & next states for lerping
void (*CL_UpdateLatchedVars)( struct cl_entity_s *e, qboolean reset );
} render_interface_t; } render_interface_t;
#endif//RENDER_API_H #endif//RENDER_API_H

View File

@ -224,6 +224,10 @@ void CL_UpdateLatchedVars( cl_entity_t *ent )
memcpy( ent->latched.prevcontroller, ent->prevstate.controller, sizeof( ent->latched.prevcontroller )); memcpy( ent->latched.prevcontroller, ent->prevstate.controller, sizeof( ent->latched.prevcontroller ));
memcpy( ent->latched.prevblending, ent->prevstate.blending, sizeof( ent->latched.prevblending )); memcpy( ent->latched.prevblending, ent->prevstate.blending, sizeof( ent->latched.prevblending ));
// update custom latched vars
if( clgame.drawFuncs.CL_UpdateLatchedVars != NULL )
clgame.drawFuncs.CL_UpdateLatchedVars( ent, false );
} }
/* /*
@ -254,6 +258,10 @@ void CL_ResetLatchedVars( cl_entity_t *ent, qboolean full_reset )
VectorCopy( ent->curstate.origin, ent->latched.prevorigin ); VectorCopy( ent->curstate.origin, ent->latched.prevorigin );
VectorCopy( ent->curstate.angles, ent->latched.prevangles ); VectorCopy( ent->curstate.angles, ent->latched.prevangles );
ent->latched.prevsequence = ent->curstate.sequence; ent->latched.prevsequence = ent->curstate.sequence;
// update custom latched vars
if( clgame.drawFuncs.CL_UpdateLatchedVars != NULL )
clgame.drawFuncs.CL_UpdateLatchedVars( ent, true );
} }
/* /*

View File

@ -309,8 +309,12 @@ SCR_BeginLoadingPlaque
*/ */
void SCR_BeginLoadingPlaque( qboolean is_background ) void SCR_BeginLoadingPlaque( qboolean is_background )
{ {
float oldclear;
S_StopAllSounds( true ); S_StopAllSounds( true );
cl.audio_prepped = false; // don't play ambients cl.audio_prepped = false; // don't play ambients
cl.video_prepped = false;
oldclear = gl_clear->value;
if( CL_IsInMenu( ) && !cls.changedemo && !is_background ) if( CL_IsInMenu( ) && !cls.changedemo && !is_background )
{ {
@ -325,12 +329,14 @@ void SCR_BeginLoadingPlaque( qboolean is_background )
if( cls.key_dest == key_console ) if( cls.key_dest == key_console )
return; return;
gl_clear->value = 0.0f;
if( is_background ) IN_MouseSavePos( ); if( is_background ) IN_MouseSavePos( );
cls.draw_changelevel = !is_background; cls.draw_changelevel = !is_background;
SCR_UpdateScreen(); SCR_UpdateScreen();
cls.disable_screen = host.realtime; cls.disable_screen = host.realtime;
cls.disable_servercount = cl.servercount; cls.disable_servercount = cl.servercount;
cl.background = is_background; // set right state before svc_serverdata is came cl.background = is_background; // set right state before svc_serverdata is came
gl_clear->value = oldclear;
// SNDDMA_LockSound(); // SNDDMA_LockSound();
} }

View File

@ -2938,14 +2938,16 @@ if cl_testlights is set, create 32 lights models
*/ */
void CL_TestLights( void ) void CL_TestLights( void )
{ {
int i, j; int i, j, numLights;
vec3_t forward, right;
float f, r; float f, r;
int numLights;
dlight_t *dl; dlight_t *dl;
if( !cl_testlights->value ) return; if( !CVAR_TO_BOOL( cl_testlights ))
return;
numLights = bound( 1, cl_testlights->value, MAX_DLIGHTS ); numLights = bound( 1, cl_testlights->value, MAX_DLIGHTS );
AngleVectors( cl.viewangles, forward, right, NULL );
for( i = 0; i < numLights; i++ ) for( i = 0; i < numLights; i++ )
{ {
@ -2955,7 +2957,7 @@ void CL_TestLights( void )
f = 64 * ( i / 4) + 128; f = 64 * ( i / 4) + 128;
for( j = 0; j < 3; j++ ) for( j = 0; j < 3; j++ )
dl->origin[j] = RI.vieworg[j] + RI.vforward[j] * f + RI.vright[j] * r; dl->origin[j] = cl.simorg[j] + forward[j] * f + right[j] * r;
dl->color.r = ((((i % 6) + 1) & 1)>>0) * 255; dl->color.r = ((((i % 6) + 1) & 1)>>0) * 255;
dl->color.g = ((((i % 6) + 1) & 2)>>1) * 255; dl->color.g = ((((i % 6) + 1) & 2)>>1) * 255;

View File

@ -293,7 +293,7 @@ qboolean V_PreRender( void )
return false; return false;
} }
R_BeginFrame( !cl.paused ); R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
return true; return true;
} }

View File

@ -570,9 +570,6 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
if( size > glState.width || size > glState.height ) if( size > glState.width || size > glState.height )
return false; return false;
// setup refdef
RI.params |= RP_ENVVIEW; // do not render non-bmodel entities
// alloc space // alloc space
temp = Mem_Malloc( r_temppool, size * size * 3 ); temp = Mem_Malloc( r_temppool, size * size * 3 );
buffer = Mem_Malloc( r_temppool, size * size * 3 * 6 ); buffer = Mem_Malloc( r_temppool, size * size * 3 * 6 );
@ -582,6 +579,8 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
// use client vieworg // use client vieworg
if( !vieworg ) vieworg = RI.vieworg; if( !vieworg ) vieworg = RI.vieworg;
R_CheckGamma();
for( i = 0; i < 6; i++ ) for( i = 0; i < 6; i++ )
{ {
// go into 3d mode // go into 3d mode
@ -609,8 +608,6 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
memcpy( buffer + (size * size * 3 * i), r_side->buffer, size * size * 3 ); memcpy( buffer + (size * size * 3 * i), r_side->buffer, size * size * 3 );
} }
RI.params &= ~RP_ENVVIEW;
r_shot->flags = IMAGE_HAS_COLOR; r_shot->flags = IMAGE_HAS_COLOR;
r_shot->flags |= (skyshot) ? IMAGE_SKYBOX : IMAGE_CUBEMAP; r_shot->flags |= (skyshot) ? IMAGE_SKYBOX : IMAGE_CUBEMAP;
r_shot->width = size; r_shot->width = size;

View File

@ -72,12 +72,13 @@ void GL_Bind( GLint tmu, GLenum texnum )
gl_texture_t *texture; gl_texture_t *texture;
GLuint glTarget; GLuint glTarget;
Assert( texnum >= 0 && texnum < MAX_TEXTURES );
// missed or invalid texture? // missed or invalid texture?
if( texnum <= 0 || texnum >= MAX_TEXTURES ) if( texnum <= 0 || texnum >= MAX_TEXTURES )
{
if( texnum != 0 )
Con_DPrintf( S_ERROR "GL_Bind: invalid texturenum %d\n", texnum );
texnum = tr.defaultTexture; texnum = tr.defaultTexture;
}
if( tmu != GL_KEEP_UNIT ) if( tmu != GL_KEEP_UNIT )
GL_SelectTexture( tmu ); GL_SelectTexture( tmu );
else tmu = glState.activeTMU; else tmu = glState.activeTMU;
@ -1679,6 +1680,7 @@ creates texture from buffer
*/ */
int GL_CreateTexture( const char *name, int width, int height, const void *buffer, texFlags_t flags ) int GL_CreateTexture( const char *name, int width, int height, const void *buffer, texFlags_t flags )
{ {
qboolean update = FBitSet( flags, TF_UPDATE ) ? true : false;
int datasize = 1; int datasize = 1;
rgbdata_t r_empty; rgbdata_t r_empty;
@ -1687,6 +1689,7 @@ int GL_CreateTexture( const char *name, int width, int height, const void *buffe
else if( FBitSet( flags, TF_ARB_FLOAT )) else if( FBitSet( flags, TF_ARB_FLOAT ))
datasize = 4; datasize = 4;
ClearBits( flags, TF_UPDATE );
memset( &r_empty, 0, sizeof( r_empty )); memset( &r_empty, 0, sizeof( r_empty ));
r_empty.width = width; r_empty.width = width;
r_empty.height = height; r_empty.height = height;
@ -1712,7 +1715,7 @@ int GL_CreateTexture( const char *name, int width, int height, const void *buffe
r_empty.size *= 6; r_empty.size *= 6;
} }
return GL_LoadTextureInternal( name, &r_empty, flags ); return GL_LoadTextureFromBuffer( name, &r_empty, flags, update );
} }
/* /*

View File

@ -365,6 +365,7 @@ qboolean R_InitRenderAPI( void );
void R_AllowFog( int allowed ); void R_AllowFog( int allowed );
void R_SetupFrustum( void ); void R_SetupFrustum( void );
void R_FindViewLeaf( void ); void R_FindViewLeaf( void );
void R_CheckGamma( void );
void R_PushScene( void ); void R_PushScene( void );
void R_PopScene( void ); void R_PopScene( void );
void R_DrawFog( void ); void R_DrawFog( void );
@ -597,6 +598,7 @@ typedef struct
gles_wrapper_t wrapper; gles_wrapper_t wrapper;
qboolean softwareGammaUpdate; qboolean softwareGammaUpdate;
qboolean fCustomRenderer;
int prev_mode; int prev_mode;
} glconfig_t; } glconfig_t;

View File

@ -985,30 +985,41 @@ some type of screenshots
*/ */
qboolean R_DoResetGamma( void ) qboolean R_DoResetGamma( void )
{ {
// FIXME: this looks ugly. apply the backward gamma changes to the output image
return false;
switch( cls.scrshot_action ) switch( cls.scrshot_action )
{ {
case scrshot_normal:
if( CL_IsDevOverviewMode( ))
return true;
return false;
case scrshot_snapshot:
if( CL_IsDevOverviewMode( ))
return true;
return false;
case scrshot_plaque:
case scrshot_savegame:
case scrshot_envshot: case scrshot_envshot:
case scrshot_skyshot: case scrshot_skyshot:
case scrshot_mapshot:
return true; return true;
default: default:
return false; return false;
} }
} }
/*
===============
R_CheckGamma
===============
*/
void R_CheckGamma( void )
{
if( R_DoResetGamma( ))
{
// paranoia cubemaps uses this
BuildGammaTable( 1.8f, 0.0f );
// paranoia cubemap rendering
if( clgame.drawFuncs.GL_BuildLightmaps )
clgame.drawFuncs.GL_BuildLightmaps( );
}
else if( FBitSet( vid_gamma->flags, FCVAR_CHANGED ) || FBitSet( vid_brightness->flags, FCVAR_CHANGED ))
{
BuildGammaTable( vid_gamma->value, vid_brightness->value );
glConfig.softwareGammaUpdate = true;
GL_RebuildLightmaps();
glConfig.softwareGammaUpdate = false;
}
}
/* /*
=============== ===============
R_BeginFrame R_BeginFrame
@ -1023,24 +1034,7 @@ void R_BeginFrame( qboolean clearScene )
pglClear( GL_COLOR_BUFFER_BIT ); pglClear( GL_COLOR_BUFFER_BIT );
} }
if( R_DoResetGamma( )) R_CheckGamma();
{
BuildGammaTable( 1.8f, 0.0f );
glConfig.softwareGammaUpdate = true;
GL_RebuildLightmaps();
glConfig.softwareGammaUpdate = false;
// next frame will be restored gamma
SetBits( vid_brightness->flags, FCVAR_CHANGED );
SetBits( vid_gamma->flags, FCVAR_CHANGED );
}
else if( FBitSet( vid_gamma->flags, FCVAR_CHANGED ) || FBitSet( vid_brightness->flags, FCVAR_CHANGED ))
{
BuildGammaTable( vid_gamma->value, vid_brightness->value );
glConfig.softwareGammaUpdate = true;
GL_RebuildLightmaps();
glConfig.softwareGammaUpdate = false;
}
R_Set2DMode( true ); R_Set2DMode( true );
@ -1072,8 +1066,14 @@ void R_SetupRefParams( const ref_viewpass_t *rvp )
RI.farClip = 0; RI.farClip = 0;
if( !FBitSet( rvp->flags, RF_DRAW_CUBEMAP )) if( !FBitSet( rvp->flags, RF_DRAW_CUBEMAP ))
{
RI.drawOrtho = FBitSet( rvp->flags, RF_DRAW_OVERVIEW ); RI.drawOrtho = FBitSet( rvp->flags, RF_DRAW_OVERVIEW );
else RI.drawOrtho = false; }
else
{
SetBits( RI.params, RP_ENVVIEW );
RI.drawOrtho = false;
}
// setup viewport // setup viewport
RI.viewport[0] = rvp->viewport[0]; RI.viewport[0] = rvp->viewport[0];
@ -1276,6 +1276,10 @@ static int GL_RenderGetParm( int parm, int arg )
return FBitSet( world.flags, FWORLD_WATERALPHA ); return FBitSet( world.flags, FWORLD_WATERALPHA );
case PARM_TEX_MEMORY: case PARM_TEX_MEMORY:
return GL_TexMemory(); return GL_TexMemory();
case PARM_DELUXEDATA:
return *(int *)&world.deluxedata;
case PARM_SHADOWDATA:
return *(int *)&world.shadowdata;
} }
return 0; return 0;
} }
@ -1514,7 +1518,7 @@ static render_api_t gRenderAPI =
R_StudioGetTexture, R_StudioGetTexture,
GL_GetOverviewParms, GL_GetOverviewParms,
CL_GenericHandle, CL_GenericHandle,
NULL, COM_SaveFile,
NULL, NULL,
R_Mem_Alloc, R_Mem_Alloc,
R_Mem_Free, R_Mem_Free,
@ -1540,12 +1544,14 @@ qboolean R_InitRenderAPI( void )
{ {
// make sure what render functions is cleared // make sure what render functions is cleared
memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs )); memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs ));
glConfig.fCustomRenderer = false;
if( clgame.dllFuncs.pfnGetRenderInterface ) if( clgame.dllFuncs.pfnGetRenderInterface )
{ {
if( clgame.dllFuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &clgame.drawFuncs )) if( clgame.dllFuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &clgame.drawFuncs ))
{ {
Con_Reportf( "CL_LoadProgs: ^2initailized extended RenderAPI ^7ver. %i\n", CL_RENDER_INTERFACE_VERSION ); Con_Reportf( "CL_LoadProgs: ^2initailized extended RenderAPI ^7ver. %i\n", CL_RENDER_INTERFACE_VERSION );
glConfig.fCustomRenderer = true;
return true; return true;
} }

View File

@ -58,6 +58,7 @@ public:
virtual void GetMousePos( int &x, int &y ) { } virtual void GetMousePos( int &x, int &y ) { }
#endif #endif
virtual bool hasFocus( void ) { return true; } virtual bool hasFocus( void ) { return true; }
virtual void flushBuffer( void );
protected: protected:
virtual int createNewTextureID( void ); virtual int createNewTextureID( void );
virtual void drawSetColor( int r, int g, int b, int a ); virtual void drawSetColor( int r, int g, int b, int a );
@ -83,7 +84,6 @@ protected:
virtual void setAsTopMost( bool state ) { } virtual void setAsTopMost( bool state ) { }
virtual void applyChanges( void ) { } virtual void applyChanges( void ) { }
virtual void swapBuffers( void ) { } virtual void swapBuffers( void ) { }
virtual void flushBuffer( void );
protected: protected:
int _drawTextPos[2]; int _drawTextPos[2];
int _drawColor[4]; int _drawColor[4];

View File

@ -23,7 +23,7 @@ static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int Q_buildnum( void ) int Q_buildnum( void )
{ {
// do not touch this! Only author of Xash3D can increase buildnumbers! // do not touch this! Only author of Xash3D can increase buildnumbers!
#if 1 #if 0
int m = 0, d = 0, y = 0; int m = 0, d = 0, y = 0;
static int b = 0; static int b = 0;
@ -48,6 +48,6 @@ int Q_buildnum( void )
return b; return b;
#else #else
return 4260; return 4511;
#endif #endif
} }

View File

@ -21,6 +21,7 @@ GNU General Public License for more details.
#include "gl_local.h" #include "gl_local.h"
#include "qfont.h" #include "qfont.h"
#include "wadfile.h" #include "wadfile.h"
#include "input.h"
convar_t *con_notifytime; convar_t *con_notifytime;
convar_t *scr_conspeed; convar_t *scr_conspeed;
@ -128,6 +129,9 @@ typedef struct
char *completionBuffer; char *completionBuffer;
char *cmds[CON_MAXCMDS]; char *cmds[CON_MAXCMDS];
int matchCount; int matchCount;
// console update
double lastupdate;
} console_t; } console_t;
static console_t con; static console_t con;
@ -429,7 +433,7 @@ Con_AddLine
Appends a given string as a new line to the console. Appends a given string as a new line to the console.
================ ================
*/ */
void Con_AddLine( const char *line, int length ) void Con_AddLine( const char *line, int length, qboolean newline )
{ {
byte *putpos; byte *putpos;
con_lineinfo_t *p; con_lineinfo_t *p;
@ -445,14 +449,27 @@ void Con_AddLine( const char *line, int length )
while( !( putpos = Con_BytesLeft( length )) || con.lines_count >= con.maxlines ) while( !( putpos = Con_BytesLeft( length )) || con.lines_count >= con.maxlines )
Con_DeleteLine(); Con_DeleteLine();
memcpy( putpos, line, length ); if( newline )
putpos[length - 1] = '\0'; {
con.lines_count++; memcpy( putpos, line, length );
putpos[length - 1] = '\0';
con.lines_count++;
p = &CON_LINES_LAST(); p = &CON_LINES_LAST();
p->start = putpos; p->start = putpos;
p->length = length; p->length = length;
p->addtime = cl.time; p->addtime = cl.time;
}
else
{
p = &CON_LINES_LAST();
putpos = p->start + Q_strlen( p->start );
memcpy( putpos, line, length - 1 );
p->length = Q_strlen( p->start );
putpos[p->length] = '\0';
p->addtime = cl.time;
p->length++;
}
} }
/* /*
@ -1017,6 +1034,8 @@ 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];
qboolean norefresh = false;
static int lastlength = 0;
static qboolean inupdate; static qboolean inupdate;
static int bufpos = 0; static int bufpos = 0;
int c, mask = 0; int c, mask = 0;
@ -1033,6 +1052,12 @@ void Con_Print( const char *txt )
txt++; txt++;
} }
if( txt[0] == 3 )
{
norefresh = true;
txt++;
}
for( ; *txt; txt++ ) for( ; *txt; txt++ )
{ {
if( cr_pending ) if( cr_pending )
@ -1048,27 +1073,47 @@ void Con_Print( const char *txt )
case '\0': case '\0':
break; break;
case '\r': case '\r':
Con_AddLine( buf, bufpos ); Con_AddLine( buf, bufpos, true );
lastlength = CON_LINES_LAST().length;
cr_pending = 1; cr_pending = 1;
bufpos = 0; bufpos = 0;
break; break;
case '\n': case '\n':
Con_AddLine( buf, bufpos ); Con_AddLine( buf, bufpos, true );
lastlength = CON_LINES_LAST().length;
bufpos = 0; bufpos = 0;
break; break;
default: default:
buf[bufpos++] = c | mask; 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, true );
lastlength = CON_LINES_LAST().length;
bufpos = 0; bufpos = 0;
} }
break; break;
} }
} }
if( cls.state != ca_disconnected && cls.state < ca_active && !cl.video_prepped && !cls.disable_screen ) if( norefresh ) return;
// custom renderer cause problems while updates screen on-loading
if( SV_Active() && cls.state < ca_active && !cl.video_prepped && !cls.disable_screen )
{ {
if( bufpos != 0 )
{
Con_AddLine( buf, bufpos, lastlength != 0 );
lastlength = 0;
bufpos = 0;
}
// pump messages to avoid window hanging
if( con.lastupdate < Sys_DoubleTime( ))
{
con.lastupdate = Sys_DoubleTime() + 1.0;
Host_InputFrame();
}
if( !inupdate ) if( !inupdate )
{ {
inupdate = true; inupdate = true;
@ -2035,7 +2080,7 @@ int Con_DrawConsoleLine( int y, int lineno )
{ {
con_lineinfo_t *li = &CON_LINES( lineno ); con_lineinfo_t *li = &CON_LINES( lineno );
if( *li->start == '\1' ) if( !li || !li->start || *li->start == '\1' )
return 0; // this string will be shown only at notify return 0; // this string will be shown only at notify
if( y >= con.curFont->charHeight ) if( y >= con.curFont->charHeight )

View File

@ -1380,6 +1380,9 @@ static void Image_ApplyFilter( rgbdata_t *pic, float factor )
uint *fin, *fout; uint *fin, *fout;
size_t size; size_t size;
// don't waste time
if( factor <= 0.0f ) return;
// first expand the image into 32-bit buffer // first expand the image into 32-bit buffer
pic = Image_DecompressInternal( pic ); pic = Image_DecompressInternal( pic );
factor = bound( 0.0f, factor, 1.0f ); factor = bound( 0.0f, factor, 1.0f );

View File

@ -2802,6 +2802,8 @@ qboolean Mod_LoadBmodelLumps( const byte *mod_base, qboolean isworld )
{ {
loadmodel = mod; // restore pointer to world loadmodel = mod; // restore pointer to world
Mod_InitDebugHulls(); // FIXME: build hulls for separate bmodels (shells, medkits etc) Mod_InitDebugHulls(); // FIXME: build hulls for separate bmodels (shells, medkits etc)
world.deluxedata = bmod->deluxedata_out; // deluxemap data pointer
world.shadowdata = bmod->shadowdata_out; // occlusion data pointer
} }
for( i = 0; i < bmod->wadlist.count; i++ ) for( i = 0; i < bmod->wadlist.count; i++ )
@ -2922,6 +2924,13 @@ void Mod_UnloadBrushModel( model_t *mod )
if( mod->type != mod_brush ) if( mod->type != mod_brush )
return; // not a bmodel return; // not a bmodel
// invalidate pointers
if( FBitSet( mod->flags, MODEL_WORLD ))
{
world.deluxedata = NULL;
world.shadowdata = NULL;
}
if( mod->name[0] != '*' ) if( mod->name[0] != '*' )
{ {
for( i = 0; i < mod->numtextures; i++ ) for( i = 0; i < mod->numtextures; i++ )

View File

@ -139,6 +139,10 @@ typedef struct
hull_model_t *hull_models; hull_model_t *hull_models;
int num_hull_models; int num_hull_models;
// out pointers to light data
color24 *deluxedata; // deluxemap data pointer
byte *shadowdata; // occlusion data pointer
// visibility info // visibility info
size_t visbytes; // cluster size size_t visbytes; // cluster size
size_t fatbytes; // fatpvs size size_t fatbytes; // fatpvs size

View File

@ -879,7 +879,7 @@ int Delta_ClampIntegerField( delta_t *pField, int iValue, qboolean bSigned, int
{ {
#ifdef _DEBUG #ifdef _DEBUG
if( numbits < 32 && abs( iValue ) >= (uint)BIT( numbits )) if( numbits < 32 && abs( iValue ) >= (uint)BIT( numbits ))
Msg( "%s %d overflow %d\n", pField->name, abs( iValue ), (uint)BIT( numbits )); Con_Reportf( "%s %d overflow %d\n", pField->name, abs( iValue ), (uint)BIT( numbits ));
#endif #endif
if( numbits < 32 ) if( numbits < 32 )
{ {

View File

@ -254,7 +254,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, size_t filesize )
if( sound.samples <= 0 ) if( sound.samples <= 0 )
{ {
Con_DPrintf( S_ERROR "Sound_LoadWAV: file with %i samples (%s)\n", sound.samples, name ); Con_Reportf( S_ERROR "Sound_LoadWAV: file with %i samples (%s)\n", sound.samples, name );
return false; return false;
} }

View File

@ -535,6 +535,6 @@ void Sys_CloseLog( void )
void Sys_PrintLog( const char *pMsg ) void Sys_PrintLog( const char *pMsg )
{ {
if( !s_wcd.logfile ) return; if( !s_wcd.logfile ) return;
fprintf( s_wcd.logfile, pMsg ); fprintf( s_wcd.logfile, "%s", pMsg );
fflush( s_wcd.logfile ); fflush( s_wcd.logfile );
} }

View File

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

View File

@ -285,6 +285,8 @@ void SV_NextMap_f( void )
search_t *t; search_t *t;
t = FS_Search( "maps\\*.bsp", true, CVAR_TO_BOOL( con_gamemaps )); // only in gamedir t = FS_Search( "maps\\*.bsp", true, CVAR_TO_BOOL( con_gamemaps )); // only in gamedir
if( !t ) t = FS_Search( "maps/*.bsp", true, CVAR_TO_BOOL( con_gamemaps )); // only in gamedir
if( !t ) if( !t )
{ {
Con_Printf( "next map can't be found\n" ); Con_Printf( "next map can't be found\n" );