mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-23 02:15:55 +01:00
Merge 4511 update
This commit is contained in:
commit
f2c927906f
@ -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
|
||||||
@ -220,8 +222,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 );
|
||||||
@ -267,6 +269,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
|
||||||
|
@ -223,6 +223,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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -280,6 +284,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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -162,6 +162,10 @@ int CL_RenderGetParm( const int parm, const int arg, const qboolean checkRef )
|
|||||||
return (host.type == HOST_DEDICATED);
|
return (host.type == HOST_DEDICATED);
|
||||||
case PARM_WATER_ALPHA:
|
case PARM_WATER_ALPHA:
|
||||||
return FBitSet( world.flags, FWORLD_WATERALPHA );
|
return FBitSet( world.flags, FWORLD_WATERALPHA );
|
||||||
|
case PARM_DELUXEDATA:
|
||||||
|
return *(int *)&world.deluxedata;
|
||||||
|
case PARM_SHADOWDATA:
|
||||||
|
return *(int *)&world.shadowdata;
|
||||||
default:
|
default:
|
||||||
// indicates call from client.dll
|
// indicates call from client.dll
|
||||||
if( checkRef )
|
if( checkRef )
|
||||||
@ -261,7 +265,7 @@ static render_api_t gRenderAPI =
|
|||||||
NULL, // R_StudioGetTexture,
|
NULL, // 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,
|
||||||
|
@ -341,8 +341,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 )
|
||||||
{
|
{
|
||||||
@ -357,12 +361,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2835,14 +2835,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++ )
|
||||||
{
|
{
|
||||||
@ -2851,8 +2853,8 @@ void CL_TestLights( void )
|
|||||||
r = 64 * ((i % 4) - 1.5f );
|
r = 64 * ((i % 4) - 1.5f );
|
||||||
f = 64 * ( i / 4) + 128;
|
f = 64 * ( i / 4) + 128;
|
||||||
|
|
||||||
VectorMAM( f, refState.vforward, r, refState.vright, dl->origin );
|
for( j = 0; j < 3; j++ )
|
||||||
VectorAdd( dl->origin, refState.vieworg, dl->origin );
|
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;
|
||||||
|
@ -293,7 +293,7 @@ qboolean V_PreRender( void )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ref.dllFuncs.R_BeginFrame( !cl.paused );
|
ref.dllFuncs.R_BeginFrame( !cl.paused && ( cls.state == ca_active ));
|
||||||
|
|
||||||
GL_UpdateSwapInterval( );
|
GL_UpdateSwapInterval( );
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ GNU General Public License for more details.
|
|||||||
#include "con_nprint.h"
|
#include "con_nprint.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;
|
||||||
@ -117,6 +118,9 @@ typedef struct
|
|||||||
|
|
||||||
notify_t notify[MAX_DBG_NOTIFY]; // for Con_NXPrintf
|
notify_t notify[MAX_DBG_NOTIFY]; // for Con_NXPrintf
|
||||||
qboolean draw_notify; // true if we have NXPrint message
|
qboolean draw_notify; // true if we have NXPrint message
|
||||||
|
|
||||||
|
// console update
|
||||||
|
double lastupdate;
|
||||||
} console_t;
|
} console_t;
|
||||||
|
|
||||||
static console_t con;
|
static console_t con;
|
||||||
@ -401,7 +405,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;
|
||||||
@ -417,14 +421,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++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1211,6 +1228,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;
|
||||||
@ -1227,6 +1246,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 )
|
||||||
@ -1242,27 +1267,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;
|
||||||
@ -1976,7 +2021,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 )
|
||||||
|
@ -197,6 +197,25 @@ static screenfade_t *pfnRefGetScreenFade( void )
|
|||||||
return &clgame.fade;
|
return &clgame.fade;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
===============
|
||||||
|
R_DoResetGamma
|
||||||
|
gamma will be reset for
|
||||||
|
some type of screenshots
|
||||||
|
===============
|
||||||
|
*/
|
||||||
|
static qboolean R_DoResetGamma( void )
|
||||||
|
{
|
||||||
|
switch( cls.scrshot_action )
|
||||||
|
{
|
||||||
|
case scrshot_envshot:
|
||||||
|
case scrshot_skyshot:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static ref_api_t gEngfuncs =
|
static ref_api_t gEngfuncs =
|
||||||
{
|
{
|
||||||
pfnEngineGetParm,
|
pfnEngineGetParm,
|
||||||
@ -319,6 +338,7 @@ static ref_api_t gEngfuncs =
|
|||||||
|
|
||||||
BuildGammaTable,
|
BuildGammaTable,
|
||||||
LightToTexGamma,
|
LightToTexGamma,
|
||||||
|
R_DoResetGamma,
|
||||||
|
|
||||||
CL_GetLightStyle,
|
CL_GetLightStyle,
|
||||||
CL_GetDynamicLight,
|
CL_GetDynamicLight,
|
||||||
|
@ -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,7 +48,7 @@ int Q_buildnum( void )
|
|||||||
|
|
||||||
return b;
|
return b;
|
||||||
#else
|
#else
|
||||||
return 4260;
|
return 4511;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1379,6 +1379,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 );
|
||||||
|
@ -2822,6 +2822,8 @@ qboolean Mod_LoadBmodelLumps( const byte *mod_base, qboolean isworld )
|
|||||||
loadmodel = mod; // restore pointer to world
|
loadmodel = mod; // restore pointer to world
|
||||||
#ifndef XASH_DEDICATED
|
#ifndef XASH_DEDICATED
|
||||||
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
|
||||||
#endif // XASH_DEDICATED
|
#endif // XASH_DEDICATED
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2926,6 +2928,47 @@ void Mod_LoadBrushModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||||||
if( loaded ) *loaded = true; // all done
|
if( loaded ) *loaded = true; // all done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Mod_UnloadBrushModel
|
||||||
|
|
||||||
|
Release all uploaded textures
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
void Mod_UnloadBrushModel( model_t *mod )
|
||||||
|
{
|
||||||
|
texture_t *tx;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
Assert( mod != NULL );
|
||||||
|
|
||||||
|
if( mod->type != mod_brush )
|
||||||
|
return; // not a bmodel
|
||||||
|
|
||||||
|
// invalidate pointers
|
||||||
|
if( FBitSet( mod->flags, MODEL_WORLD ))
|
||||||
|
{
|
||||||
|
world.deluxedata = NULL;
|
||||||
|
world.shadowdata = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( mod->name[0] != '*' )
|
||||||
|
{
|
||||||
|
for( i = 0; i < mod->numtextures; i++ )
|
||||||
|
{
|
||||||
|
tx = mod->textures[i];
|
||||||
|
if( !tx || tx->gl_texturenum == tr.defaultTexture )
|
||||||
|
continue; // free slot
|
||||||
|
|
||||||
|
GL_FreeTexture( tx->gl_texturenum ); // main texture
|
||||||
|
GL_FreeTexture( tx->fb_texturenum ); // luma texture
|
||||||
|
}
|
||||||
|
Mem_FreePool( &mod->mempool );
|
||||||
|
}
|
||||||
|
|
||||||
|
memset( mod, 0, sizeof( *mod ));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
Mod_CheckLump
|
Mod_CheckLump
|
||||||
|
@ -96,6 +96,10 @@ typedef struct world_static_s
|
|||||||
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
|
||||||
|
@ -896,7 +896,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 )
|
||||||
{
|
{
|
||||||
|
@ -254,7 +254,7 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi
|
|||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,10 +552,10 @@ 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++;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -395,6 +395,7 @@ typedef struct ref_api_s
|
|||||||
// gamma
|
// gamma
|
||||||
void (*BuildGammaTable)( float lightgamma, float brightness );
|
void (*BuildGammaTable)( float lightgamma, float brightness );
|
||||||
byte (*LightToTexGamma)( byte color ); // software gamma support
|
byte (*LightToTexGamma)( byte color ); // software gamma support
|
||||||
|
qboolean (*R_DoResetGamma)( void );
|
||||||
|
|
||||||
// renderapi
|
// renderapi
|
||||||
lightstyle_t* (*GetLightStyle)( int number );
|
lightstyle_t* (*GetLightStyle)( int number );
|
||||||
|
@ -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" );
|
||||||
|
@ -539,9 +539,6 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
|
|||||||
if( size > gpGlobals->width || size > gpGlobals->height )
|
if( size > gpGlobals->width || size > gpGlobals->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 );
|
||||||
@ -551,6 +548,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
|
||||||
@ -578,8 +577,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;
|
||||||
|
@ -71,12 +71,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;
|
||||||
@ -1680,6 +1681,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;
|
||||||
|
|
||||||
@ -1688,6 +1690,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;
|
||||||
@ -1713,7 +1716,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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -388,6 +388,7 @@ void R_SetupGL( qboolean set_gl_state );
|
|||||||
void R_AllowFog( qboolean allowed );
|
void R_AllowFog( qboolean 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 );
|
||||||
@ -668,6 +669,7 @@ typedef struct
|
|||||||
gles_wrapper_t wrapper;
|
gles_wrapper_t wrapper;
|
||||||
|
|
||||||
qboolean softwareGammaUpdate;
|
qboolean softwareGammaUpdate;
|
||||||
|
qboolean fCustomRenderer;
|
||||||
int prev_width;
|
int prev_width;
|
||||||
int prev_height;
|
int prev_height;
|
||||||
} glconfig_t;
|
} glconfig_t;
|
||||||
|
@ -986,37 +986,27 @@ void R_RenderScene( void )
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
R_DoResetGamma
|
R_CheckGamma
|
||||||
|
|
||||||
gamma will be reset for
|
|
||||||
some type of screenshots
|
|
||||||
===============
|
===============
|
||||||
*/
|
*/
|
||||||
qboolean R_DoResetGamma( void )
|
void R_CheckGamma( void )
|
||||||
{
|
{
|
||||||
// FIXME: this looks ugly. apply the backward gamma changes to the output image
|
if( gEngfuncs.R_DoResetGamma( ))
|
||||||
return false;
|
|
||||||
#if 0
|
|
||||||
switch( cls.scrshot_action )
|
|
||||||
{
|
{
|
||||||
case scrshot_normal:
|
// paranoia cubemaps uses this
|
||||||
if( CL_IsDevOverviewMode( ))
|
BuildGammaTable( 1.8f, 0.0f );
|
||||||
return true;
|
|
||||||
return false;
|
// paranoia cubemap rendering
|
||||||
case scrshot_snapshot:
|
if( clgame.drawFuncs.GL_BuildLightmaps )
|
||||||
if( CL_IsDevOverviewMode( ))
|
clgame.drawFuncs.GL_BuildLightmaps( );
|
||||||
return true;
|
}
|
||||||
return false;
|
else if( FBitSet( vid_gamma->flags, FCVAR_CHANGED ) || FBitSet( vid_brightness->flags, FCVAR_CHANGED ))
|
||||||
case scrshot_plaque:
|
{
|
||||||
case scrshot_savegame:
|
BuildGammaTable( vid_gamma->value, vid_brightness->value );
|
||||||
case scrshot_envshot:
|
glConfig.softwareGammaUpdate = true;
|
||||||
case scrshot_skyshot:
|
GL_RebuildLightmaps();
|
||||||
case scrshot_mapshot:
|
glConfig.softwareGammaUpdate = false;
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1034,24 +1024,7 @@ void R_BeginFrame( qboolean clearScene )
|
|||||||
pglClear( GL_COLOR_BUFFER_BIT );
|
pglClear( GL_COLOR_BUFFER_BIT );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( R_DoResetGamma( ))
|
R_CheckGamma();
|
||||||
{
|
|
||||||
gEngfuncs.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 ))
|
|
||||||
{
|
|
||||||
gEngfuncs.BuildGammaTable( vid_gamma->value, vid_brightness->value );
|
|
||||||
glConfig.softwareGammaUpdate = true;
|
|
||||||
GL_RebuildLightmaps();
|
|
||||||
glConfig.softwareGammaUpdate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
R_Set2DMode( true );
|
R_Set2DMode( true );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user