27 Nov 2018
This commit is contained in:
parent
0e64ef7095
commit
a47e7d58d6
12
change.log
12
change.log
|
@ -16,6 +16,18 @@ VGUI: - a VGUI implementation code in xash.dll
|
|||
Memory: - a memory manager in xash.dll
|
||||
Physic: - a server physics code in xash.dll
|
||||
|
||||
build 4312
|
||||
|
||||
Client: demos moved from folder that called "demos" into the root of gamefolder
|
||||
Client: demoshots are removed
|
||||
Client: automatically detection of demo type (Quake or Xash3D)
|
||||
Render: a new debug visualization of world bsp-tree (cvar r_showtree 0\1)
|
||||
Render: do a some corrections for Quake fog settings
|
||||
Client: fix bug playing AVI with compressed soundtracks
|
||||
Input: ignore to suspend display while game window is foreground
|
||||
Server: development command that called "nextmap". change the maps with alphabethical order
|
||||
GameUI: fully support for steam background splashes (with BackgroundLayout.txt script)
|
||||
|
||||
build 4281
|
||||
|
||||
GameUI: new gameinfo setting "noskills" 0/1 that disables sub-menu for skill selection
|
||||
|
|
|
@ -384,6 +384,7 @@ void V_PostRender( void )
|
|||
CL_DrawDemoRecording();
|
||||
CL_DrawHUD( CL_CHANGELEVEL );
|
||||
R_ShowTextures();
|
||||
R_ShowTree();
|
||||
Con_DrawConsole();
|
||||
UI_UpdateMenu( host.realtime );
|
||||
Con_DrawVersion();
|
||||
|
|
|
@ -654,7 +654,7 @@ void R_ShowTextures( void )
|
|||
static qboolean showHelp = true;
|
||||
string shortname;
|
||||
|
||||
if( !gl_showtextures->value )
|
||||
if( !CVAR_TO_BOOL( gl_showtextures ))
|
||||
return;
|
||||
|
||||
if( showHelp )
|
||||
|
@ -746,4 +746,96 @@ rebuild_page:
|
|||
|
||||
CL_DrawCenterPrint ();
|
||||
pglFinish();
|
||||
}
|
||||
|
||||
#define POINT_SIZE 16.0f
|
||||
#define NODE_INTERVAL_X(x) (x * 16.0f)
|
||||
#define NODE_INTERVAL_Y(x) (x * 16.0f)
|
||||
|
||||
void R_DrawLeafNode( float x, float y, float scale )
|
||||
{
|
||||
float downScale = scale * 0.25f;// * POINT_SIZE;
|
||||
|
||||
R_DrawStretchPic( x - downScale * 0.5f, y - downScale * 0.5f, downScale, downScale, 0, 0, 1, 1, tr.particleTexture );
|
||||
}
|
||||
|
||||
void R_DrawNodeConnection( float x, float y, float x2, float y2 )
|
||||
{
|
||||
pglBegin( GL_LINES );
|
||||
pglVertex2f( x, y );
|
||||
pglVertex2f( x2, y2 );
|
||||
pglEnd();
|
||||
}
|
||||
|
||||
void R_ShowTree_r( mnode_t *node, float x, float y, float scale, int shownodes )
|
||||
{
|
||||
float downScale = scale * 0.8f;
|
||||
|
||||
downScale = Q_max( downScale, 1.0f );
|
||||
|
||||
if( !node ) return;
|
||||
|
||||
tr.recursion_level++;
|
||||
|
||||
if( node->contents < 0 )
|
||||
{
|
||||
mleaf_t *leaf = (mleaf_t *)node;
|
||||
|
||||
if( tr.recursion_level > tr.max_recursion )
|
||||
tr.max_recursion = tr.recursion_level;
|
||||
|
||||
if( shownodes == 1 )
|
||||
{
|
||||
if( cl.worldmodel->leafs == leaf )
|
||||
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
else if( RI.viewleaf && RI.viewleaf == leaf )
|
||||
pglColor4f( 1.0f, 0.0f, 0.0f, 1.0f );
|
||||
else pglColor4f( 0.0f, 1.0f, 0.0f, 1.0f );
|
||||
R_DrawLeafNode( x, y, scale );
|
||||
}
|
||||
tr.recursion_level--;
|
||||
return;
|
||||
}
|
||||
|
||||
if( shownodes == 1 )
|
||||
{
|
||||
pglColor4f( 0.0f, 0.0f, 1.0f, 1.0f );
|
||||
R_DrawLeafNode( x, y, scale );
|
||||
}
|
||||
else if( shownodes == 2 )
|
||||
{
|
||||
R_DrawNodeConnection( x, y, x - scale, y + scale );
|
||||
R_DrawNodeConnection( x, y, x + scale, y + scale );
|
||||
}
|
||||
|
||||
R_ShowTree_r( node->children[1], x - scale, y + scale, downScale, shownodes );
|
||||
R_ShowTree_r( node->children[0], x + scale, y + scale, downScale, shownodes );
|
||||
|
||||
tr.recursion_level--;
|
||||
}
|
||||
|
||||
void R_ShowTree( void )
|
||||
{
|
||||
float x = (float)((glState.width - (int)POINT_SIZE) >> 1);
|
||||
float y = NODE_INTERVAL_Y(1.0);
|
||||
|
||||
if( !cl.worldmodel || !CVAR_TO_BOOL( r_showtree ))
|
||||
return;
|
||||
|
||||
tr.recursion_level = 0;
|
||||
|
||||
pglEnable( GL_BLEND );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
|
||||
pglLineWidth( 2.0f );
|
||||
pglColor3f( 1, 0.7f, 0 );
|
||||
pglDisable( GL_TEXTURE_2D );
|
||||
R_ShowTree_r( cl.worldmodel->nodes, x, y, tr.max_recursion * 3.5f, 2 );
|
||||
pglEnable( GL_TEXTURE_2D );
|
||||
pglLineWidth( 1.0f );
|
||||
|
||||
R_ShowTree_r( cl.worldmodel->nodes, x, y, tr.max_recursion * 3.5f, 1 );
|
||||
|
||||
Con_NPrintf( 0, "max recursion %d\n", tr.max_recursion );
|
||||
}
|
|
@ -202,6 +202,10 @@ typedef struct
|
|||
qboolean fResetVis;
|
||||
qboolean fFlipViewModel;
|
||||
|
||||
// tree visualization stuff
|
||||
int recursion_level;
|
||||
int max_recursion;
|
||||
|
||||
byte visbytes[(MAX_MAP_LEAFS+7)/8]; // member custom PVS
|
||||
int lightstylevalue[MAX_LIGHTSTYLES]; // value 0 - 65536
|
||||
int block_size; // lightmap blocksize
|
||||
|
@ -270,6 +274,7 @@ void GL_SetRenderMode( int mode );
|
|||
void GL_TextureTarget( uint target );
|
||||
void GL_Cull( GLenum cull );
|
||||
void R_ShowTextures( void );
|
||||
void R_ShowTree( void );
|
||||
|
||||
//
|
||||
// gl_cull.c
|
||||
|
@ -655,6 +660,7 @@ extern convar_t *gl_msaa;
|
|||
extern convar_t *r_speeds;
|
||||
extern convar_t *r_fullbright;
|
||||
extern convar_t *r_norefresh;
|
||||
extern convar_t *r_showtree; // build graph of visible hull
|
||||
extern convar_t *r_lighting_extended;
|
||||
extern convar_t *r_lighting_modulate;
|
||||
extern convar_t *r_lighting_ambient;
|
||||
|
|
|
@ -179,6 +179,7 @@ void R_NewMap( void )
|
|||
cl.worldmodel->leafs[i+1].efrags = NULL;
|
||||
|
||||
tr.skytexturenum = -1;
|
||||
tr.max_recursion = 0;
|
||||
pglDisable( GL_FOG );
|
||||
|
||||
// clearing texture chains
|
||||
|
|
|
@ -60,6 +60,7 @@ convar_t *r_lighting_ambient;
|
|||
convar_t *r_detailtextures;
|
||||
convar_t *r_drawentities;
|
||||
convar_t *r_adjust_fov;
|
||||
convar_t *r_showtree;
|
||||
convar_t *r_decals;
|
||||
convar_t *r_novis;
|
||||
convar_t *r_nocull;
|
||||
|
@ -1596,6 +1597,7 @@ void GL_InitCommands( void )
|
|||
r_lightmap = Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" );
|
||||
r_drawentities = Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT|FCVAR_ARCHIVE, "render entities" );
|
||||
r_decals = Cvar_Get( "r_decals", "4096", FCVAR_ARCHIVE, "sets the maximum number of decals" );
|
||||
r_showtree = Cvar_Get( "r_showtree", "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" );
|
||||
window_xpos = Cvar_Get( "_window_xpos", "130", FCVAR_RENDERINFO, "window position by horizontal" );
|
||||
window_ypos = Cvar_Get( "_window_ypos", "48", FCVAR_RENDERINFO, "window position by vertical" );
|
||||
|
||||
|
|
|
@ -1579,7 +1579,7 @@ S_RawSamples
|
|||
*/
|
||||
void S_RawSamples( uint samples, uint rate, word width, word channels, const byte *data, int entnum )
|
||||
{
|
||||
int snd_vol;
|
||||
int snd_vol = 128;
|
||||
|
||||
if( entnum < 0 ) snd_vol = 256; // bg track or movie track
|
||||
if( snd_vol < 0 ) snd_vol = 0; // fixup negative values
|
||||
|
|
|
@ -401,8 +401,11 @@ long AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, long offset, long l
|
|||
}
|
||||
else
|
||||
{
|
||||
// we out of soundtrack, just zeroing buffer
|
||||
for( i = 0; i < length; i++ )
|
||||
audiodata[i] = 0;
|
||||
|
||||
return length;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -422,7 +422,7 @@ void MD5Final( byte digest[16], MD5Context_t *ctx )
|
|||
|
||||
MD5Transform( ctx->buf, (uint *)ctx->in );
|
||||
memcpy( digest, ctx->buf, 16 );
|
||||
memset( ctx, 0, sizeof( ctx )); // in case it's sensitive
|
||||
memset( ctx, 0, sizeof( *ctx )); // in case it's sensitive
|
||||
}
|
||||
|
||||
// The four core functions
|
||||
|
|
|
@ -1086,7 +1086,7 @@ static void Mod_SetParent( mnode_t *node, mnode_t *parent )
|
|||
CountClipNodes_r
|
||||
==================
|
||||
*/
|
||||
static void CountClipNodes_r( dclipnode32_t *src, hull_t *hull, int nodenum )
|
||||
static void CountClipNodes_r( mclipnode_t *src, hull_t *hull, int nodenum )
|
||||
{
|
||||
// leaf?
|
||||
if( nodenum < 0 ) return;
|
||||
|
@ -1099,6 +1099,24 @@ static void CountClipNodes_r( dclipnode32_t *src, hull_t *hull, int nodenum )
|
|||
CountClipNodes_r( src, hull, src[nodenum].children[1] );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CountClipNodes32_r
|
||||
==================
|
||||
*/
|
||||
static void CountClipNodes32_r( dclipnode32_t *src, hull_t *hull, int nodenum )
|
||||
{
|
||||
// leaf?
|
||||
if( nodenum < 0 ) return;
|
||||
|
||||
if( hull->lastclipnode == MAX_MAP_CLIPNODES )
|
||||
Host_Error( "MAX_MAP_CLIPNODES limit exceeded\n" );
|
||||
hull->lastclipnode++;
|
||||
|
||||
CountClipNodes32_r( src, hull, src[nodenum].children[0] );
|
||||
CountClipNodes32_r( src, hull, src[nodenum].children[1] );
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
RemapClipNodes_r
|
||||
|
@ -1210,7 +1228,7 @@ static void Mod_SetupHull( dbspmodel_t *bmod, model_t *mod, byte *mempool, int h
|
|||
if( VectorIsNull( hull->clip_mins ) && VectorIsNull( hull->clip_maxs ))
|
||||
return; // no hull specified
|
||||
|
||||
CountClipNodes_r( bmod->clipnodes_out, hull, headnode );
|
||||
CountClipNodes32_r( bmod->clipnodes_out, hull, headnode );
|
||||
count = hull->lastclipnode;
|
||||
|
||||
// fit array to real count
|
||||
|
@ -1358,6 +1376,10 @@ static void Mod_SetupSubmodels( dbspmodel_t *bmod )
|
|||
|
||||
// hull 0 is just shared across all bmodels
|
||||
mod->hulls[0].firstclipnode = bm->headnode[0];
|
||||
mod->hulls[0].lastclipnode = bm->headnode[0]; // need to be real count
|
||||
|
||||
// counting a real number of clipnodes per each submodel
|
||||
CountClipNodes_r( mod->hulls[0].clipnodes, &mod->hulls[0], bm->headnode[0] );
|
||||
|
||||
// but hulls1-3 is build individually for a each given submodel
|
||||
for( j = 1; j < MAX_MAP_HULLS; j++ )
|
||||
|
|
|
@ -341,38 +341,106 @@ void UI_DrawBackground_Callback( void *self )
|
|||
return;
|
||||
}
|
||||
|
||||
int xpos, ypos;
|
||||
float xScale, yScale;
|
||||
|
||||
// work out scaling factors
|
||||
xScale = ScreenWidth / uiStatic.m_flTotalWidth;
|
||||
yScale = ScreenHeight / uiStatic.m_flTotalHeight;
|
||||
if( ScreenWidth * uiStatic.m_flTotalHeight > ScreenHeight * uiStatic.m_flTotalWidth )
|
||||
{
|
||||
xScale = ScreenWidth / uiStatic.m_flTotalWidth;
|
||||
yScale = xScale;
|
||||
}
|
||||
else
|
||||
{
|
||||
yScale = ScreenHeight / uiStatic.m_flTotalHeight;
|
||||
xScale = yScale;
|
||||
}
|
||||
|
||||
// iterate and draw all the background pieces
|
||||
ypos = 0;
|
||||
for (int y = 0; y < BACKGROUND_ROWS; y++)
|
||||
for( int i = 0; i < uiStatic.m_iBackgroundCount; i++ )
|
||||
{
|
||||
xpos = 0;
|
||||
for (int x = 0; x < BACKGROUND_COLUMNS; x++)
|
||||
{
|
||||
bimage_t &bimage = uiStatic.m_SteamBackground[y][x];
|
||||
bimage_t &bimage = uiStatic.m_SteamBackground[i];
|
||||
int dx = (int)ceil( bimage.x * xScale );
|
||||
int dy = (int)ceil( bimage.y * yScale );
|
||||
int dw = (int)ceil( bimage.width * xScale );
|
||||
int dt = (int)ceil( bimage.height * yScale );
|
||||
|
||||
int dx = (int)ceil(xpos * xScale);
|
||||
int dy = (int)ceil(ypos * yScale);
|
||||
int dw = (int)ceil(bimage.width * xScale);
|
||||
int dt = (int)ceil(bimage.height * yScale);
|
||||
|
||||
if (x == 0) dx = 0;
|
||||
if (y == 0) dy = 0;
|
||||
|
||||
PIC_Set( bimage.hImage, 255, 255, 255, 255 );
|
||||
PIC_Draw( dx, dy, dw, dt );
|
||||
xpos += bimage.width;
|
||||
}
|
||||
ypos += uiStatic.m_SteamBackground[y][0].height;
|
||||
PIC_Set( bimage.hImage, 255, 255, 255, 255 );
|
||||
PIC_Draw( dx, dy, dw, dt );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_LoadSteamBackground
|
||||
=================
|
||||
*/
|
||||
bool UI_LoadSteamBackground( void )
|
||||
{
|
||||
char *afile = NULL, *pfile;
|
||||
char token[4096];
|
||||
|
||||
bool loaded = false;
|
||||
|
||||
afile = (char *)LOAD_FILE( "resource/BackgroundLayout.txt", NULL );
|
||||
uiStatic.m_iBackgroundCount = 0;
|
||||
|
||||
if( !afile ) return false;
|
||||
|
||||
pfile = afile;
|
||||
|
||||
pfile = COM_ParseFile( pfile, token );
|
||||
if( !pfile || stricmp( token, "resolution" )) // resolution at first!
|
||||
goto cleanup;
|
||||
|
||||
pfile = COM_ParseFile( pfile, token );
|
||||
if( !pfile ) goto cleanup;
|
||||
|
||||
uiStatic.m_flTotalWidth = atoi( token );
|
||||
|
||||
pfile = COM_ParseFile( pfile, token );
|
||||
if( !pfile ) goto cleanup;
|
||||
|
||||
uiStatic.m_flTotalHeight = atoi( token );
|
||||
|
||||
// Now read all tiled background list
|
||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
||||
{
|
||||
bimage_t img;
|
||||
|
||||
if( !FILE_EXISTS( token ))
|
||||
goto cleanup;
|
||||
|
||||
img.hImage = PIC_Load( token, PIC_NOFLIP_TGA );
|
||||
|
||||
if( !img.hImage ) goto cleanup;
|
||||
|
||||
// ignore "scaled" attribute. What does it mean?
|
||||
pfile = COM_ParseFile( pfile, token );
|
||||
if( !pfile ) goto cleanup;
|
||||
|
||||
pfile = COM_ParseFile( pfile, token );
|
||||
if( !pfile ) goto cleanup;
|
||||
img.x = atoi( token );
|
||||
|
||||
pfile = COM_ParseFile( pfile, token );
|
||||
if( !pfile ) goto cleanup;
|
||||
img.y = atoi( token );
|
||||
|
||||
img.width = PIC_Width( img.hImage );
|
||||
img.height = PIC_Height( img.hImage );
|
||||
|
||||
uiStatic.m_SteamBackground[uiStatic.m_iBackgroundCount] = img;
|
||||
uiStatic.m_iBackgroundCount++;
|
||||
}
|
||||
|
||||
loaded = true;
|
||||
|
||||
cleanup:
|
||||
FREE_FILE( afile );
|
||||
|
||||
return loaded;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
UI_LoadBackgroundImage
|
||||
|
@ -380,44 +448,14 @@ UI_LoadBackgroundImage
|
|||
*/
|
||||
void UI_LoadBackgroundImage( void )
|
||||
{
|
||||
int num_background_images = 0;
|
||||
char filename[512];
|
||||
|
||||
for( int y = 0; y < BACKGROUND_ROWS; y++ )
|
||||
if( UI_LoadSteamBackground( ))
|
||||
{
|
||||
for( int x = 0; x < BACKGROUND_COLUMNS; x++ )
|
||||
{
|
||||
sprintf( filename, "resource/background/800_%d_%c_loading.tga", y + 1, 'a' + x );
|
||||
if (g_engfuncs.pfnFileExists( filename, TRUE ))
|
||||
num_background_images++;
|
||||
}
|
||||
}
|
||||
|
||||
if (num_background_images == (BACKGROUND_COLUMNS * BACKGROUND_ROWS))
|
||||
uiStatic.m_fHaveSteamBackground = TRUE;
|
||||
else uiStatic.m_fHaveSteamBackground = FALSE;
|
||||
|
||||
if (uiStatic.m_fHaveSteamBackground)
|
||||
{
|
||||
uiStatic.m_flTotalWidth = uiStatic.m_flTotalHeight = 0.0f;
|
||||
|
||||
for( int y = 0; y < BACKGROUND_ROWS; y++ )
|
||||
{
|
||||
for( int x = 0; x < BACKGROUND_COLUMNS; x++ )
|
||||
{
|
||||
bimage_t &bimage = uiStatic.m_SteamBackground[y][x];
|
||||
sprintf(filename, "resource/background/800_%d_%c_loading.tga", y + 1, 'a' + x);
|
||||
bimage.hImage = PIC_Load( filename, PIC_NOFLIP_TGA );
|
||||
bimage.width = PIC_Width( bimage.hImage );
|
||||
bimage.height = PIC_Height( bimage.hImage );
|
||||
|
||||
if (y==0) uiStatic.m_flTotalWidth += bimage.width;
|
||||
if (x==0) uiStatic.m_flTotalHeight += bimage.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uiStatic.m_fHaveSteamBackground = FALSE;
|
||||
|
||||
if( g_engfuncs.pfnFileExists( "gfx/shell/splash.bmp", TRUE ))
|
||||
{
|
||||
// if we doesn't have logo.avi in gamedir we don't want to draw it
|
||||
|
|
|
@ -319,12 +319,12 @@ void UI_PicButton_Draw( menuPicButton_s *item );
|
|||
extern cvar_t *ui_precache;
|
||||
extern cvar_t *ui_showmodels;
|
||||
|
||||
#define BACKGROUND_ROWS 3
|
||||
#define BACKGROUND_COLUMNS 4
|
||||
#define MAX_BACKGROUNDS 48 // SC 5.0 have 35 tiled backgrounds!
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HIMAGE hImage;
|
||||
int x, y;
|
||||
int width;
|
||||
int height;
|
||||
} bimage_t;
|
||||
|
@ -346,7 +346,8 @@ typedef struct
|
|||
HIMAGE hFont; // mainfont
|
||||
|
||||
// handle steam background images
|
||||
bimage_t m_SteamBackground[BACKGROUND_ROWS][BACKGROUND_COLUMNS];
|
||||
bimage_t m_SteamBackground[MAX_BACKGROUNDS];
|
||||
int m_iBackgroundCount;
|
||||
float m_flTotalWidth;
|
||||
float m_flTotalHeight;
|
||||
bool m_fHaveSteamBackground;
|
||||
|
|
Reference in New Issue