20 Sep 2011

This commit is contained in:
g-cont 2011-09-20 00:00:00 +04:00 committed by Alibek Omarov
parent de17869a55
commit 0717b2b7de
41 changed files with 612 additions and 197 deletions

View File

@ -1,3 +1,26 @@
build ????
Client: add command "on"-"off" for virtual CD-player
Client: add command "snapshot" that save screenshots into root folder
Client: add studiomodel missed flags like in Quake (EF_ROTATE, EF_ROCKET, EF_GIB etc)
Sound: clear LOOP flag for engine funcs PlaySoundByIndex and PlaySoundAtLocation
Render: fix r_wateralpha, move cvar to server and allow save-restore it
Render: fix old bug with surface->flags
Render: fix crash when studiomodel isn't loaded but trying to draw
Render: remove cvar gl_texturebits
Render: allow 16-bit color mode when decktop has same
Render: rename "vid_gamma" to "gamma", make backward compatibility with GoldSource config
Sound: get support for automatic ambient sounds like in Quake
Sound: add cvar "s_combine" that trying to combine mutilpe channels with same sounds into one
Engine: add "secure" option for both liblist.gam and gameinfo.txt
Engine: fix bug determine current directory
Server: fix bug when some sound messages can't be sended to client (e.g. not vised map)
Render: allow to load hi-res quake sky (two layers called as sky_solid and sky_alpha)
Physic: fix trace bug when bbox mins are 0 0 0 and bbox maxs are positive values (like quake boxes)
GameUI: add checkbox "allow materials" in menu Video Options.
Client: implement "viewsize" cvar
build 1662
Client: implement StudioRemapColors function

View File

@ -64,6 +64,13 @@ typedef struct
unsigned int cachededgeoffset;
} medge_t;
// g-cont. for future expansions
typedef struct
{
int planenum;
int children[2]; // negative numbers are contents
} mclipnode_t;
typedef struct texture_s
{
char name[16];

View File

@ -6,13 +6,13 @@
--------------------Configuration: hl - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1931.tmp" with contents
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1A5.tmp" with contents
[
/nologo /G5 /MT /W3 /O2 /I "..\dlls" /I "..\engine" /I "..\common" /I "..\pm_shared" /I "..\game_shared" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "QUIVER" /D "VOXEL" /D "QUAKE2" /D "VALVE_DLL" /D "CLIENT_WEAPONS" /Fr"..\temp\dlls\!release/" /Fp"..\temp\dlls\!release/hl.pch" /YX /Fo"..\temp\dlls\!release/" /Fd"..\temp\dlls\!release/" /FD /c
"D:\Xash3D\src_main\dlls\nodes.cpp"
"D:\Xash3D\src_main\dlls\triggers.cpp"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1931.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1932.tmp" with contents
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1A5.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1A6.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /incremental:no /pdb:"..\temp\dlls\!release/hl.pdb" /debug /machine:I386 /def:".\hl.def" /out:"..\temp\dlls\!release/hl.dll" /implib:"..\temp\dlls\!release/hl.lib"
"\Xash3D\src_main\temp\dlls\!release\aflock.obj"
@ -117,15 +117,15 @@ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32
"\Xash3D\src_main\temp\dlls\!release\xen.obj"
"\Xash3D\src_main\temp\dlls\!release\zombie.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1932.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1933.bat" with contents
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1A6.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1A7.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\dlls\!release\hl.dll "D:\Xash3D\valve\dlls\hl.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1933.bat""
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP1A7.bat""
Compiling...
nodes.cpp
triggers.cpp
Linking...
Creating library ..\temp\dlls\!release/hl.lib and object ..\temp\dlls\!release/hl.exp
<h3>Output Window</h3>

View File

@ -277,7 +277,11 @@ qboolean CL_AddVisibleEntity( cl_entity_t *ent, int entityType )
dl->color.r = 255;
dl->color.g = 255;
dl->color.b = 255;
dl->radius = 200;
// HACKHACK: get radius from head entity
if( ent->curstate.rendermode != kRenderNormal )
dl->radius = max( 0, ent->curstate.renderamt - 55 );
else dl->radius = 200;
dl->die = cl.time + 0.01;
CL_RocketTrail (ent->prevstate.origin, ent->curstate.origin, 0);

View File

@ -30,6 +30,7 @@ GNU General Public License for more details.
#include "gl_local.h"
#include "library.h"
#include "vgui_draw.h"
#include "sound.h" // SND_STOP_LOOPING
#define MAX_TEXTCHANNELS 8 // must be power of two (GoldSrc uses 4 channel)
#define TEXT_MSGNAME "TextMessage%i"
@ -1807,7 +1808,7 @@ pfnPlaySoundByName
static void pfnPlaySoundByName( const char *szSound, float volume )
{
int hSound = S_RegisterSound( szSound );
S_StartSound( NULL, cl.refdef.viewentity, CHAN_AUTO, hSound, volume, ATTN_NORM, PITCH_NORM, 0 );
S_StartSound( NULL, cl.refdef.viewentity, CHAN_ITEM, hSound, volume, ATTN_NORM, PITCH_NORM, SND_STOP_LOOPING );
}
/*
@ -1829,7 +1830,7 @@ static void pfnPlaySoundByIndex( int iSound, float volume )
MsgDev( D_ERROR, "CL_PlaySoundByIndex: invalid sound handle %i\n", iSound );
return;
}
S_StartSound( NULL, cl.refdef.viewentity, CHAN_AUTO, hSound, volume, ATTN_NORM, PITCH_NORM, 0 );
S_StartSound( NULL, cl.refdef.viewentity, CHAN_ITEM, hSound, volume, ATTN_NORM, PITCH_NORM, SND_STOP_LOOPING );
}
/*

View File

@ -259,7 +259,7 @@ usercmd_t CL_CreateCmd( void )
if( ++cl.movemessages <= 10 )
return cmd;
active = ( cls.state == ca_active && !cl.refdef.paused && !cl.refdef.intermission );
active = ( cls.state == ca_active && !cl.refdef.paused );
clgame.dllFuncs.CL_CreateMove( cl.time - cl.oldtime, &cmd, active );
R_LightForPoint( cl.frame.local.client.origin, &color, false, false, 128.0f );
@ -271,7 +271,7 @@ usercmd_t CL_CreateCmd( void )
V_ProcessOverviewCmds( &cmd );
if( cl.background || cl.refdef.intermission || cls.demoplayback || gl_overview->integer )
if( cl.background || cls.demoplayback || gl_overview->integer )
{
VectorCopy( angles, cl.refdef.cl_viewangles );
VectorCopy( angles, cmd.viewangles );
@ -1524,7 +1524,6 @@ void CL_InitLocal( void )
Cmd_AddCommand ("fullupdate", NULL, "re-init HUD on start demo recording" );
Cmd_AddCommand ("give", NULL, "give specified item or weapon" );
Cmd_AddCommand ("drop", NULL, "drop current/specified item or weapon" );
Cmd_AddCommand ("intermission", NULL, "go to intermission" );
Cmd_AddCommand ("gametitle", NULL, "show game logo" );
Cmd_AddCommand ("god", NULL, "enable godmode" );
Cmd_AddCommand ("fov", NULL, "set client field of view" );
@ -1692,8 +1691,8 @@ CL_Shutdown
void CL_Shutdown( void )
{
// already freed
if( host.state == HOST_ERROR ) return;
if( !cls.initialized ) return;
cls.initialized = false;
MsgDev( D_INFO, "CL_Shutdown()\n" );
@ -1706,6 +1705,4 @@ void CL_Shutdown( void )
S_Shutdown ();
R_Shutdown ();
cls.initialized = false;
}

View File

@ -31,6 +31,12 @@ convar_t *cl_levelshot_name;
convar_t *cl_envshot_size;
convar_t *scr_dark;
typedef struct
{
int x1, y1, x2, y2;
} dirty_t;
static dirty_t scr_dirty, scr_old_dirty[2];
static qboolean scr_init = false;
/*
@ -51,9 +57,16 @@ void SCR_DrawFPS( void )
if( cls.state != ca_active ) return;
if( !cl_showfps->integer || cl.background ) return;
if( cls.scrshot_action != scrshot_inactive )
return;
switch( cls.scrshot_action )
{
case scrshot_normal:
case scrshot_snapshot:
case scrshot_inactive:
break;
default: return;
}
newtime = Sys_DoubleTime();
if( newtime >= nexttime )
{
@ -286,6 +299,111 @@ void SCR_EndLoadingPlaque( void )
Con_ClearNotify();
}
/*
=================
SCR_AddDirtyPoint
=================
*/
void SCR_AddDirtyPoint( int x, int y )
{
if (x < scr_dirty.x1)
scr_dirty.x1 = x;
if (x > scr_dirty.x2)
scr_dirty.x2 = x;
if (y < scr_dirty.y1)
scr_dirty.y1 = y;
if (y > scr_dirty.y2)
scr_dirty.y2 = y;
}
/*
================
SCR_DirtyScreen
================
*/
void SCR_DirtyScreen( void )
{
SCR_AddDirtyPoint( 0, 0 );
SCR_AddDirtyPoint( scr_width->integer - 1, scr_height->integer - 1 );
}
/*
================
SCR_TileClear
================
*/
void SCR_TileClear( void )
{
int i, top, bottom, left, right;
dirty_t clear;
if( scr_viewsize->integer >= 120 )
return; // full screen rendering
// erase rect will be the union of the past three frames
// so tripple buffering works properly
clear = scr_dirty;
for( i = 0; i < 2; i++ )
{
if( scr_old_dirty[i].x1 < clear.x1 )
clear.x1 = scr_old_dirty[i].x1;
if( scr_old_dirty[i].x2 > clear.x2 )
clear.x2 = scr_old_dirty[i].x2;
if( scr_old_dirty[i].y1 < clear.y1 )
clear.y1 = scr_old_dirty[i].y1;
if( scr_old_dirty[i].y2 > clear.y2 )
clear.y2 = scr_old_dirty[i].y2;
}
scr_old_dirty[1] = scr_old_dirty[0];
scr_old_dirty[0] = scr_dirty;
scr_dirty.x1 = 9999;
scr_dirty.x2 = -9999;
scr_dirty.y1 = 9999;
scr_dirty.y2 = -9999;
if( clear.y2 <= clear.y1 )
return; // nothing disturbed
top = cl.refdef.viewport[1];
bottom = top + cl.refdef.viewport[3] - 1;
left = cl.refdef.viewport[0];
right = left + cl.refdef.viewport[2] - 1;
if( clear.y1 < top )
{
// clear above view screen
i = clear.y2 < top-1 ? clear.y2 : top - 1;
R_DrawTileClear( clear.x1, clear.y1, clear.x2 - clear.x1 + 1, i - clear.y1 + 1 );
clear.y1 = top;
}
if( clear.y2 > bottom )
{
// clear below view screen
i = clear.y1 > bottom + 1 ? clear.y1 : bottom + 1;
R_DrawTileClear( clear.x1, i, clear.x2 - clear.x1 + 1, clear.y2 - i + 1 );
clear.y2 = bottom;
}
if( clear.x1 < left )
{
// clear left of view screen
i = clear.x2 < left - 1 ? clear.x2 : left - 1;
R_DrawTileClear( clear.x1, clear.y1, i - clear.x1 + 1, clear.y2 - clear.y1 + 1 );
clear.x1 = left;
}
if( clear.x2 > right )
{
// clear left of view screen
i = clear.x1 > right + 1 ? clear.x1 : right + 1;
R_DrawTileClear( i, clear.y1, clear.x2 - i + 1, clear.y2 - clear.y1 + 1 );
clear.x2 = right;
}
}
/*
==================
SCR_UpdateScreen
@ -403,11 +521,37 @@ void SCR_RegisterShaders( void )
else cls.loadingBar = GL_LoadTexture( "gfx.wad/lambda.lmp", NULL, 0, TF_IMAGE );
cls.creditsFont.hFontTexture = GL_LoadTexture( "gfx.wad/creditsfont.fnt", NULL, 0, TF_IMAGE );
cls.hChromeSprite = pfnSPR_Load( "sprites/shellchrome.spr" );
cls.tileImage = GL_LoadTexture( "gfx.wad/backtile.lmp", NULL, 0, TF_UNCOMPRESSED|TF_NOPICMIP|TF_NOMIPMAP );
SCR_LoadCreditsFont ();
SCR_InstallParticlePalette ();
}
/*
=================
SCR_SizeUp_f
Keybinding command
=================
*/
void SCR_SizeUp_f( void )
{
Cvar_SetFloat( "viewsize", min( scr_viewsize->value + 10, 120 ));
}
/*
=================
SCR_SizeDown_f
Keybinding command
=================
*/
void SCR_SizeDown_f( void )
{
Cvar_SetFloat( "viewsize", max( scr_viewsize->value - 10, 30 ));
}
/*
==================
SCR_VidInit
@ -460,6 +604,8 @@ void SCR_Init( void )
Cmd_AddCommand( "timerefresh", SCR_TimeRefresh_f, "turn quickly and print rendering statistcs" );
Cmd_AddCommand( "skyname", CL_SetSky_f, "set new skybox by basename" );
Cmd_AddCommand( "viewpos", SCR_Viewpos_f, "prints current player origin" );
Cmd_AddCommand( "sizeup", SCR_SizeUp_f, "screen size up to 10 points" );
Cmd_AddCommand( "sizedown", SCR_SizeDown_f, "screen size down to 10 points" );
if( host.state != HOST_RESTART && !UI_LoadProgs( ))
{

View File

@ -30,6 +30,8 @@ update refdef values each frame
void V_SetupRefDef( void )
{
cl_entity_t *clent;
int size;
int sb_lines;
clent = CL_GetLocalPlayer ();
@ -51,17 +53,37 @@ void V_SetupRefDef( void )
cl.refdef.frametime = cl.time - cl.oldtime;
cl.refdef.demoplayback = cls.demoplayback;
cl.refdef.smoothing = cl_smooth->integer;
cl.refdef.viewsize = scr_viewsize->integer;
cl.refdef.waterlevel = cl.frame.local.client.waterlevel;
cl.refdef.onlyClientDraw = 0; // reset clientdraw
cl.refdef.viewsize = scr_viewsize->integer;
cl.refdef.hardware = true; // always true
cl.refdef.spectator = cl.spectator;
cl.refdef.nextView = 0;
// setup default viewport
cl.refdef.viewport[0] = cl.refdef.viewport[1] = 0;
cl.refdef.viewport[2] = scr_width->integer;
cl.refdef.viewport[3] = scr_height->integer;
SCR_AddDirtyPoint( 0, 0 );
SCR_AddDirtyPoint( scr_width->integer - 1, scr_height->integer - 1 );
if( cl.refdef.viewsize >= 120 )
sb_lines = 0; // no status bar at all
else if( cl.refdef.viewsize >= 110 )
sb_lines = 24; // no inventory
else sb_lines = 48;
size = min( scr_viewsize->integer, 100 );
cl.refdef.viewport[2] = scr_width->integer * size / 100;
cl.refdef.viewport[3] = scr_height->integer * size / 100;
if( cl.refdef.viewport[3] > scr_height->integer - sb_lines )
cl.refdef.viewport[3] = scr_height->integer - sb_lines;
if( cl.refdef.viewport[3] > scr_height->integer )
cl.refdef.viewport[3] = scr_height->integer;
cl.refdef.viewport[2] &= ~7;
cl.refdef.viewport[3] &= ~1;
cl.refdef.viewport[0] = (scr_width->integer - cl.refdef.viewport[2]) / 2;
cl.refdef.viewport[1] = (scr_height->integer - sb_lines - cl.refdef.viewport[3]) / 2;
// calc FOV
cl.refdef.fov_x = cl.data.fov; // this is a final fov value
@ -257,7 +279,8 @@ void V_CalcRefDef( void )
cl.refdef.onlyClientDraw = false;
} while( cl.refdef.nextView );
SCR_AddDirtyPoint( cl.refdef.viewport[0], cl.refdef.viewport[1] );
SCR_AddDirtyPoint( cl.refdef.viewport[0] + cl.refdef.viewport[2] - 1, cl.refdef.viewport[1] + cl.refdef.viewport[3] - 1 );
}
//============================================================================
@ -333,6 +356,7 @@ void V_PostRender( void )
if( cls.state == ca_active )
{
SCR_TileClear();
CL_DrawHUD( CL_ACTIVE );
VGui_Paint();
}

View File

@ -160,14 +160,6 @@ typedef enum
ca_cinematic, // playing a cinematic, not connected to a server
} connstate_t;
typedef enum
{
key_console = 0,
key_game,
key_menu,
key_message
} keydest_t;
typedef enum
{
scrshot_inactive,
@ -462,6 +454,7 @@ typedef struct
int pauseIcon; // draw 'paused' when game in-pause
int loadingBar; // 'loading' progress bar
int glowShell; // for renderFxGlowShell
int tileImage; // for draw any areas not covered by the refresh
HSPRITE hChromeSprite; // this is a really HudSprite handle, not texnum!
cl_font_t creditsFont; // shared creditsfont
@ -632,6 +625,8 @@ qboolean CL_DispatchUserMessage( const char *pszName, int iSize, void *pbuf );
// cl_scrn.c
//
void SCR_VidInit( void );
void SCR_TileClear( void );
void SCR_AddDirtyPoint( int x, int y );
void SCR_EndLoadingPlaque( void );
void SCR_RebuildGammaTable( void );
void SCR_RegisterShaders( void );

View File

@ -83,6 +83,39 @@ void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, f
pglEnd();
}
/*
=============
Draw_TileClear
This repeats a 64*64 tile graphic to fill the screen around a sized down
refresh window.
=============
*/
void R_DrawTileClear( int x, int y, int w, int h )
{
float tw, th;
gltexture_t *glt;
GL_SetRenderMode( kRenderNormal );
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
GL_Bind( GL_TEXTURE0, cls.tileImage );
glt = R_GetTexture( cls.tileImage );
tw = glt->srcWidth;
th = glt->srcHeight;
pglBegin( GL_QUADS );
pglTexCoord2f( x / tw, y / th );
pglVertex2f( x, y );
pglTexCoord2f((x + w) / tw, y / th );
pglVertex2f( x + w, y );
pglTexCoord2f((x + w) / tw, (y + h) / th );
pglVertex2f( x + w, y + h );
pglTexCoord2f( x / tw, (y + h) / th );
pglVertex2f( x, y + h );
pglEnd ();
}
/*
=============
R_DrawStretchRaw

View File

@ -1089,19 +1089,12 @@ void ( APIENTRY * pglSelectTextureSGIS) ( GLenum );
void ( APIENTRY * pglMTexCoord2fSGIS) ( GLenum, GLfloat, GLfloat );
void ( APIENTRY * pglSwapInterval) ( int interval );
extern void *pglGetProcAddress( const GLubyte * );
const char *(*pglGetGLWExtensionsString)( void );
const char * ( WINAPI * pwglGetExtensionsStringEXT )( void );
int ( WINAPI * pwglChoosePixelFormat )(HDC, CONST PIXELFORMATDESCRIPTOR *);
int ( WINAPI * pwglDescribePixelFormat) (HDC, int, UINT, LPPIXELFORMATDESCRIPTOR);
int ( WINAPI * pwglGetPixelFormat)(HDC);
BOOL ( WINAPI * pwglSetPixelFormat)(HDC, int, CONST PIXELFORMATDESCRIPTOR *);
BOOL ( WINAPI * pwglSwapBuffers)(HDC);
BOOL ( WINAPI * pwglCopyContext)(HGLRC, HGLRC, UINT);
HGLRC ( WINAPI * pwglCreateContext)(HDC);
HGLRC ( WINAPI * pwglCreateLayerContext)(HDC, int);
BOOL ( WINAPI * pwglDeleteContext)(HGLRC);
HGLRC ( WINAPI * pwglGetCurrentContext)(VOID);
HDC ( WINAPI * pwglGetCurrentDC)(VOID);
PROC ( WINAPI * pwglGetProcAddress)(LPCSTR);
BOOL ( WINAPI * pwglMakeCurrent)(HDC, HGLRC);
BOOL ( WINAPI * pwglShareLists)(HGLRC, HGLRC);
@ -1113,9 +1106,5 @@ int ( WINAPI * pwglGetLayerPaletteEntries)(HDC, int, int, int, COLORREF *);
BOOL ( WINAPI * pwglRealizeLayerPalette)(HDC, int, BOOL);
BOOL ( WINAPI * pwglSwapLayerBuffers)(HDC, UINT);
BOOL ( WINAPI * pwglSwapIntervalEXT)( int interval );
BOOL ( WINAPI * pwglGetDeviceGammaRampEXT ) ( unsigned char *pRed, unsigned char *pGreen, unsigned char *pBlue );
BOOL ( WINAPI * pwglSetDeviceGammaRampEXT ) ( const unsigned char *pRed, const unsigned char *pGreen, const unsigned char *pBlue );
BOOL ( WINAPI * pwglGetDeviceGammaRamp3DFX )( HDC, WORD* );
BOOL ( WINAPI * pwglSetDeviceGammaRamp3DFX )( HDC, WORD* );
#endif//GL_EXPORT_H

View File

@ -530,7 +530,7 @@ static GLenum GL_TextureFormat( gltexture_t *tex, int *samples )
}
else
{
int bits = gl_texturebits->integer;
int bits = glw_state.desktopBitsPixel;
switch( *samples )
{

View File

@ -295,6 +295,7 @@ void R_ClearDecals( void );
// gl_draw.c
//
void R_Set2DMode( qboolean enable );
void R_DrawTileClear( int x, int y, int w, int h );
//
// gl_image.c
@ -477,7 +478,6 @@ enum
GL_OCCLUSION_QUERIES_EXT,
GL_TEXTURE_COMPRESSION_EXT,
GL_SHADER_GLSL100_EXT,
GL_WGL_3DFX_GAMMA_CONTROL,
GL_SGIS_MIPMAPS_EXT,
GL_DRAW_RANGEELEMENTS_EXT,
GL_LOCKARRAYS_EXT,
@ -575,7 +575,6 @@ typedef struct
qboolean software; // OpenGL software emulation
qboolean initialized; // OpenGL subsystem started
qboolean minidriver; // 3dfx driver
} glwstate_t;
extern glconfig_t glConfig;
@ -589,7 +588,6 @@ extern convar_t *gl_allow_software;
extern convar_t *gl_texture_anisotropy;
extern convar_t *gl_extensions;
extern convar_t *gl_stencilbits;
extern convar_t *gl_texturebits;
extern convar_t *gl_ignorehwgamma;
extern convar_t *gl_swapInterval;
extern convar_t *gl_check_errors;

View File

@ -478,7 +478,7 @@ void CL_UpdateParticle( particle_t *p, float ft )
p->vel[2] -= grav * 20;
break;
case pt_slowgrav:
p->vel[2] = grav;
p->vel[2] -= grav;
break;
case pt_vox_grav:
p->vel[2] -= grav * 8;
@ -775,13 +775,13 @@ void CL_RunParticleEffect( const vec3_t org, const vec3_t dir, int color, int co
p = CL_AllocParticle( NULL );
if( !p ) return;
p->die += Com_RandomFloat( 0.1f, 0.5f );
p->die += Com_RandomFloat( 0.0f, 0.5f );
p->color = ( color & ~7 ) + Com_RandomLong( 0, 8 );
p->type = pt_slowgrav;
for( j = 0; j < 3; j++ )
{
p->org[j] = org[j] + Com_RandomFloat( -16, 16 );
p->org[j] = org[j] + Com_RandomFloat( -8, 8 );
p->vel[j] = dir[j] * 15;
}
}
@ -810,7 +810,7 @@ void CL_Blood( const vec3_t org, const vec3_t dir, int pcolor, int speed )
for( j = 0; j < 3; j++ )
{
p->org[j] = org[j] + Com_RandomFloat( -16.0f, 16.0f );
p->org[j] = org[j] + Com_RandomFloat( -8.0f, 8.0f );
p->vel[j] = dir[j] * speed;
}
}

View File

@ -883,6 +883,9 @@ void R_RenderFullbrights( void )
if( !draw_fullbrights )
return;
if( !RI.fogCustom )
pglDisable( GL_FOG );
pglEnable( GL_BLEND );
pglDepthMask( GL_FALSE );
pglDisable( GL_ALPHA_TEST );
@ -911,6 +914,10 @@ void R_RenderFullbrights( void )
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
draw_fullbrights = false;
// restore for here
if( RI.fogEnabled && !RI.refdef.onlyClientDraw )
pglEnable( GL_FOG );
}
/*

View File

@ -29,7 +29,7 @@ GNU General Public License for more details.
#define STUDIO_MERGE_TEXTURES
#define EVENT_CLIENT 5000 // less than this value it's a server-side studio events
#define MAXARRAYVERTS 6144 // used for draw shadows
#define MAXARRAYVERTS 8192 // used for draw shadows
static vec3_t hullcolor[8] =
{
@ -70,6 +70,7 @@ static r_studio_interface_t *pStudioDraw;
static float aliasXscale, aliasYscale; // software renderer scale
static matrix3x4 g_aliastransform; // software renderer transform
static matrix3x4 g_rotationmatrix;
static vec3_t g_chrome_origin;
static vec2_t g_chrome[MAXSTUDIOVERTS]; // texture coords for surface normals
static matrix3x4 g_bonestransform[MAXSTUDIOBONES];
static matrix3x4 g_lighttransform[MAXSTUDIOBONES];
@ -1247,7 +1248,7 @@ void R_StudioSetupChrome( float *pchrome, int bone, vec3_t normal )
vec3_t chromerightvec; // g_chrome s vector in world reference frame
vec3_t tmp, v_left; // vector pointing at bone in world reference frame
VectorScale( cl.refdef.vieworg, -1.0f, tmp );
VectorCopy( g_chrome_origin, tmp );
tmp[0] += g_bonestransform[bone][0][3];
tmp[1] += g_bonestransform[bone][1][3];
tmp[2] += g_bonestransform[bone][2][3];
@ -2336,6 +2337,8 @@ pfnStudioSetHeader
void R_StudioSetHeader( studiohdr_t *pheader )
{
m_pStudioHeader = pheader;
VectorClear( g_chrome_origin );
m_fDoRemap = false;
}
@ -2391,14 +2394,14 @@ R_StudioSetChromeOrigin
*/
void R_StudioSetChromeOrigin( void )
{
// TODO: implement
VectorNegate( cl.refdef.vieworg, g_chrome_origin );
}
/*
===============
pfnIsHardware
Xash3D is always works in hadrware mode
Xash3D is always works in hardware mode
===============
*/
static int pfnIsHardware( void )
@ -2981,6 +2984,9 @@ void R_DrawStudioModelInternal( cl_entity_t *e, qboolean follow_entity )
if( RI.params & RP_ENVVIEW )
return;
if( !Mod_Extradata( e->model ))
return;
ASSERT( pStudioDraw != NULL );
if( e == &clgame.viewent )
@ -3046,6 +3052,9 @@ void R_RunViewmodelEvents( void )
if( cl.refdef.nextView || cl.thirdperson || RI.params & RP_ENVVIEW )
return;
if( !Mod_Extradata( clgame.viewent.model ))
return;
RI.currententity = &clgame.viewent;
RI.currentmodel = RI.currententity->model;
if( !RI.currentmodel ) return;
@ -3073,6 +3082,9 @@ void R_DrawViewModel( void )
if( RI.params & RP_ENVVIEW )
return;
if( !Mod_Extradata( clgame.viewent.model ))
return;
RI.currententity = &clgame.viewent;
RI.currentmodel = RI.currententity->model;
if( !RI.currentmodel ) return;

View File

@ -23,7 +23,6 @@ GNU General Public License for more details.
#define num_vidmodes ((int)(sizeof(vidmode) / sizeof(vidmode[0])) - 1)
#define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_SYSMENU|WS_CAPTION|WS_VISIBLE)
#define WINDOW_EX_STYLE (0)
#define GL_DRIVER_OPENGL "OpenGL32"
#define WINDOW_NAME "Xash Window" // Half-Life
convar_t *renderinfo;
@ -31,7 +30,6 @@ convar_t *gl_allow_software;
convar_t *gl_extensions;
convar_t *gl_alphabits;
convar_t *gl_stencilbits;
convar_t *gl_texturebits;
convar_t *gl_ignorehwgamma;
convar_t *gl_texture_anisotropy;
convar_t *gl_compress_textures;
@ -429,15 +427,11 @@ static dllfunc_t texturecompressionfuncs[] =
static dllfunc_t wgl_funcs[] =
{
{ "wglChoosePixelFormat" , (void **)&pwglChoosePixelFormat },
{ "wglDescribePixelFormat" , (void **)&pwglDescribePixelFormat },
{ "wglSetPixelFormat" , (void **)&pwglSetPixelFormat },
{ "wglSwapBuffers" , (void **)&pwglSwapBuffers },
{ "wglCreateContext" , (void **)&pwglCreateContext },
{ "wglDeleteContext" , (void **)&pwglDeleteContext },
{ "wglMakeCurrent" , (void **)&pwglMakeCurrent },
{ "wglGetCurrentContext" , (void **)&pwglGetCurrentContext },
{ "wglGetCurrentDC" , (void **)&pwglGetCurrentDC },
{ NULL, NULL }
};
@ -453,13 +447,6 @@ static dllfunc_t wglswapintervalfuncs[] =
{ NULL, NULL }
};
static dllfunc_t wgl3DFXgammacontrolfuncs[] =
{
{ "wglGetDeviceGammaRamp3DFX" , (void **)&pwglGetDeviceGammaRamp3DFX },
{ "wglSetDeviceGammaRamp3DFX" , (void **)&pwglSetDeviceGammaRamp3DFX },
{ NULL, NULL }
};
dll_info_t opengl_dll = { "opengl32.dll", wgl_funcs, true };
/*
@ -588,9 +575,7 @@ void GL_UpdateGammaRamp( void )
GL_BuildGammaTable();
if( pwglGetDeviceGammaRamp3DFX )
pwglSetDeviceGammaRamp3DFX( glw_state.hDC, glState.gammaRamp );
else SetDeviceGammaRamp( glw_state.hDC, glState.gammaRamp );
SetDeviceGammaRamp( glw_state.hDC, glState.gammaRamp );
}
/*
@ -736,9 +721,7 @@ static int VID_ChoosePFD( PIXELFORMATDESCRIPTOR *pfd, int colorBits, int alphaBi
pfd->dwDamageMask = 0;
// count PFDs
if( glw_state.minidriver )
pixelFormat = pwglChoosePixelFormat( glw_state.hDC, pfd );
else pixelFormat = ChoosePixelFormat( glw_state.hDC, pfd );
pixelFormat = ChoosePixelFormat( glw_state.hDC, pfd );
if( !pixelFormat )
{
@ -757,9 +740,7 @@ void VID_StartupGamma( void )
// init gamma ramp
Q_memset( glState.stateRamp, 0, sizeof( glState.stateRamp ));
if( pwglGetDeviceGammaRamp3DFX )
glConfig.deviceSupportsGamma = pwglGetDeviceGammaRamp3DFX( glw_state.hDC, glState.stateRamp );
else glConfig.deviceSupportsGamma = GetDeviceGammaRamp( glw_state.hDC, glState.stateRamp );
glConfig.deviceSupportsGamma = GetDeviceGammaRamp( glw_state.hDC, glState.stateRamp );
// share this extension so engine can grab them
GL_SetExtension( GL_HARDWARE_GAMMA_CONTROL, glConfig.deviceSupportsGamma );
@ -846,28 +827,26 @@ qboolean GL_SetPixelformat( void )
int stencilBits;
int pixelFormat;
if( glw_state.minidriver )
{
if(( glw_state.hDC = pwglGetCurrentDC()) == NULL )
return false;
}
else
{
if(( glw_state.hDC = GetDC( host.hWnd )) == NULL )
return false;
}
if(( glw_state.hDC = GetDC( host.hWnd )) == NULL )
return false;
// set alpha/stencil
alphaBits = bound( 0, gl_alphabits->integer, 8 );
stencilBits = bound( 0, gl_stencilbits->integer, 8 );
if( glw_state.desktopBitsPixel < 32 )
{
// clear alphabits in case we in 16-bit mode
alphaBits = 0;
}
// choose a pixel format
pixelFormat = VID_ChoosePFD( &PFD, 32, alphaBits, 24, stencilBits );
pixelFormat = VID_ChoosePFD( &PFD, 24, alphaBits, 32, stencilBits );
if( !pixelFormat )
{
// try again with default color/depth/stencil
pixelFormat = VID_ChoosePFD( &PFD, 32, 0, 24, 0 );
pixelFormat = VID_ChoosePFD( &PFD, 24, 0, 32, 0 );
if( !pixelFormat )
{
@ -877,26 +856,13 @@ qboolean GL_SetPixelformat( void )
}
// set the pixel format
if( glw_state.minidriver )
if( !SetPixelFormat( glw_state.hDC, pixelFormat, &PFD ))
{
if( !pwglSetPixelFormat( glw_state.hDC, pixelFormat, &PFD ))
{
MsgDev( D_ERROR, "GL_SetPixelformat: failed\n" );
return false;
}
pwglDescribePixelFormat( glw_state.hDC, pixelFormat, sizeof( PIXELFORMATDESCRIPTOR ), &PFD );
MsgDev( D_ERROR, "GL_SetPixelformat: failed\n" );
return false;
}
else
{
if( !SetPixelFormat( glw_state.hDC, pixelFormat, &PFD ))
{
MsgDev( D_ERROR, "GL_SetPixelformat: failed\n" );
return false;
}
DescribePixelFormat( glw_state.hDC, pixelFormat, sizeof( PIXELFORMATDESCRIPTOR ), &PFD );
}
DescribePixelFormat( glw_state.hDC, pixelFormat, sizeof( PIXELFORMATDESCRIPTOR ), &PFD );
if( PFD.dwFlags & PFD_GENERIC_FORMAT )
{
@ -976,6 +942,7 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
int stylebits = WINDOW_STYLE;
int exstyle = WINDOW_EX_STYLE;
static string wndname;
HWND window;
Q_strncpy( wndname, GI->title, sizeof( wndname ) - 1 );
@ -1048,7 +1015,13 @@ qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
}
}
CreateWindowEx( exstyle, WINDOW_NAME, wndname, stylebits, x, y, w, h, NULL, NULL, host.hInst, NULL );
window = CreateWindowEx( exstyle, WINDOW_NAME, wndname, stylebits, x, y, w, h, NULL, NULL, host.hInst, NULL );
if( host.hWnd != window )
{
// probably never happens
MsgDev( D_WARN, "VID_CreateWindow: bad hWnd for '%s'\n", wndname );
}
// host.hWnd must be filled in IN_WndProc
if( !host.hWnd )
@ -1283,10 +1256,9 @@ R_Init_OpenGL
qboolean R_Init_OpenGL( void )
{
Sys_LoadLibrary( &opengl_dll ); // load opengl32.dll
if( !opengl_dll.link ) return false;
// TODO: allow 3dfx drivers too
glw_state.minidriver = false;
if( !opengl_dll.link )
return false;
return VID_SetMode();
}
@ -1446,7 +1418,6 @@ void GL_InitCommands( void )
gl_allow_software = Cvar_Get( "gl_allow_software", "0", CVAR_ARCHIVE, "allow OpenGL software emulation" );
gl_alphabits = Cvar_Get( "gl_alphabits", "8", CVAR_GLCONFIG, "pixelformat alpha bits (0 - auto)" );
gl_texturemode = Cvar_Get( "gl_texturemode", "GL_LINEAR_MIPMAP_LINEAR", CVAR_ARCHIVE, "texture filter" );
gl_texturebits = Cvar_Get( "gl_texturebits", "0", CVAR_GLCONFIG, "set texture upload format (0 - auto)" );
gl_round_down = Cvar_Get( "gl_round_down", "0", CVAR_GLCONFIG, "down size non-power of two textures" );
gl_max_size = Cvar_Get( "gl_max_size", "512", CVAR_ARCHIVE, "no effect in Xash3D just a legacy" );
gl_stencilbits = Cvar_Get( "gl_stencilbits", "8", CVAR_GLCONFIG, "pixelformat stencil bits (0 - auto)" );
@ -1471,7 +1442,7 @@ void GL_InitCommands( void )
// make sure r_swapinterval is checked after vid_restart
gl_swapInterval->modified = true;
vid_gamma = Cvar_Get( "vid_gamma", "1.0", CVAR_ARCHIVE, "gamma amount" );
vid_gamma = Cvar_Get( "gamma", "1.0", CVAR_ARCHIVE, "gamma amount" );
vid_mode = Cvar_Get( "vid_mode", VID_DEFAULTMODE, CVAR_RENDERINFO, "display resolution mode" );
vid_fullscreen = Cvar_Get( "fullscreen", "0", CVAR_RENDERINFO, "set in 1 to enable fullscreen mode" );
vid_displayfrequency = Cvar_Get ( "vid_displayfrequency", "0", CVAR_RENDERINFO, "fullscreen refresh rate" );
@ -1500,8 +1471,6 @@ void GL_InitExtensions( void )
// initalize until base opengl functions loaded
GL_CheckExtension( "OpenGL Internal ProcAddress", wglproc_funcs, NULL, GL_WGL_PROCADDRESS );
GL_CheckExtension( "WGL_3DFX_gamma_control", wgl3DFXgammacontrolfuncs, NULL, GL_WGL_3DFX_GAMMA_CONTROL );
GL_CheckExtension( "WGL_EXT_swap_control", wglswapintervalfuncs, NULL, GL_WGL_SWAPCONTROL );
GL_CheckExtension( "glDrawRangeElements", drawrangeelementsfuncs, "gl_drawrangeelments", GL_DRAW_RANGEELEMENTS_EXT );

View File

@ -59,6 +59,17 @@ void Cbuf_Init( void )
cmd_text.cursize = 0;
}
/*
============
Cbuf_Clear
============
*/
void Cbuf_Clear( void )
{
Q_memset( cmd_text.data, 0, sizeof( cmd_text_buf ));
cmd_text.cursize = 0;
}
/*
============
Cbuf_GetSpace

View File

@ -76,7 +76,7 @@ typedef enum
#include "com_model.h"
#include "crtlib.h"
#define XASH_VERSION 0.89f // engine current version
#define XASH_VERSION 0.9f // engine current version
// PERFORMANCE INFO
#define MIN_FPS 15.0 // host minimum fps value for maxfps.
@ -167,6 +167,7 @@ typedef struct gameinfo_s
size_t size;
int gamemode;
qboolean secure; // prevent to console acess
char sp_entity[32]; // e.g. info_player_start
char mp_entity[32]; // e.g. info_player_deathmatch
@ -195,7 +196,6 @@ typedef enum
HOST_INIT = 0, // initalize operations
HOST_FRAME, // host running
HOST_SHUTDOWN, // shutdown operations
HOST_ERROR, // host stopped by error
HOST_ERR_FATAL, // sys error
HOST_SLEEP, // sleeped by different reason, e.g. minimize window
HOST_NOFOCUS, // same as HOST_FRAME, but disable mouse
@ -203,6 +203,14 @@ typedef enum
HOST_CRASHED // an exception handler called
} host_state;
typedef enum
{
key_console = 0,
key_game,
key_menu,
key_message
} keydest_t;
// MD5 Hash
typedef struct
{
@ -749,6 +757,7 @@ float Com_RandomFloat( float fMin, float fMax );
void TrimSpace( const char *source, char *dest );
void GL_FreeImage( const char *name );
void VID_RestoreGamma( void );
void UI_SetActiveMenu( qboolean fActive );
typedef struct autocomplete_list_s
{

View File

@ -87,7 +87,7 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
case Q1BSP_VERSION:
case HLBSP_VERSION:
header = (dheader_t *)buf;
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 )
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 && !(header->lumps[LUMP_ENTITIES].filelen % sizeof(dplane_t)))
{
lumpofs = header->lumps[LUMP_PLANES].fileofs;
lumplen = header->lumps[LUMP_PLANES].filelen;
@ -781,6 +781,7 @@ autocomplete_list_t cmd_list[] =
{ "changelevel", Cmd_GetMapList },
{ "playdemo", Cmd_GetDemoList, },
{ "hpkval", Cmd_GetCustomList },
{ "entpatch", Cmd_GetMapList },
{ "music", Cmd_GetMusicList, },
{ "movie", Cmd_GetMovieList },
{ "exec", Cmd_GetConfigList },
@ -866,7 +867,7 @@ void Host_WriteConfig( void )
kbutton_t *mlook, *jlook;
file_t *f;
if( !cls.initialized ) return;
if( !clgame.hInstance ) return;
MsgDev( D_NOTE, "Host_WriteConfig()\n" );
f = FS_Open( "config.cfg", "w", false );

View File

@ -1827,7 +1827,7 @@ void Con_DrawVersion( void )
Con_DrawStringLen( curbuild, &stringLen, &charH );
start = scr_width->integer - stringLen * 1.05f;
stringLen = Con_StringLength( curbuild );
height -= charH * 1.5f;
height -= charH * 1.05f;
for( i = 0; i < stringLen; i++ )
width += Con_DrawCharacter( start + width, height, curbuild[i], color );

View File

@ -270,7 +270,7 @@ qboolean CRC32_MapFile( dword *crcvalue, const char *filename )
CRC32_Init( crcvalue );
// check for Blue-Shift maps
if( header.lumps[LUMP_ENTITIES].fileofs <= 1024 )
if( header.lumps[LUMP_ENTITIES].fileofs <= 1024 && (header.lumps[LUMP_ENTITIES].filelen % sizeof( dplane_t )) == 0 )
blue_shift = true;
for( i = 0; i < HEADER_LUMPS; i++ )

View File

@ -114,6 +114,7 @@ void Cvar_Unlink( void );
// cmd.c
//
void Cbuf_Init( void );
void Cbuf_Clear( void );
void Cbuf_AddText( const char *text );
void Cbuf_InsertText( const char *text );
void Cbuf_Execute (void);

View File

@ -1006,6 +1006,9 @@ static qboolean FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
if( Q_strlen( GameInfo->mp_entity ))
FS_Printf( f, "mp_entity\t\t\"%s\"\n", GameInfo->mp_entity );
if( GameInfo->secure )
FS_Printf( f, "secure\t\t\"%i\"\n", GameInfo->secure );
for( i = 0; i < 4; i++ )
{
float *min, *max;
@ -1183,6 +1186,11 @@ static qboolean FS_ParseLiblistGam( const char *filename, const char *gamedir, g
{
pfile = COM_ParseFile( pfile, GameInfo->mp_entity );
}
else if( !Q_stricmp( token, "secure" ))
{
pfile = COM_ParseFile( pfile, token );
GameInfo->secure = Q_atoi( token );
}
}
Mem_Free( afile );
@ -1365,6 +1373,11 @@ static qboolean FS_ParseGameInfo( const char *gamedir, gameinfo_t *GameInfo )
else if( !Q_stricmp( token, "multiplayer_only" ))
GameInfo->gamemode = 2;
}
else if( !Q_stricmp( token, "secure" ))
{
pfile = COM_ParseFile( pfile, token );
GameInfo->secure = Q_atoi( token );
}
else if( !Q_strnicmp( token, "hull", 4 ))
{
int hullNum = Q_atoi( token + 4 );

View File

@ -109,6 +109,9 @@ void Host_EndGame( const char *message, ... )
if( CL_NextDemo( ));
else CL_Disconnect();
// release all models
Mod_ClearAll();
Host_AbortCurrentFrame ();
}
@ -447,9 +450,9 @@ void Host_Error( const char *error, ... )
static qboolean recursive = false;
va_list argptr;
if( host.mouse_visible )
if( host.mouse_visible && !CL_IsInMenu( ))
{
// hide mouse
// hide VGUI mouse
while( ShowCursor( false ) >= 0 );
host.mouse_visible = false;
}
@ -471,7 +474,13 @@ void Host_Error( const char *error, ... )
}
else
{
Msg( "Host_Error: %s", hosterror1 );
if( host.developer > 0 )
{
UI_SetActiveMenu( false );
Key_SetKeyDest( key_console );
Msg( "Host_Error: %s", hosterror1 );
}
else MSGBOX2( hosterror1 );
}
// host is shutting down. don't invoke infinite loop
@ -489,12 +498,17 @@ void Host_Error( const char *error, ... )
host.errorframe = host.framecount; // to avoid multply calls per frame
Q_sprintf( host.finalmsg, "Server crashed: %s", hosterror1 );
CL_Drop(); // drop clients
// clearing cmd buffer to prevent execute any commands
Cbuf_Clear();
SV_Shutdown( false );
CL_Drop(); // drop clients
// release all models
Mod_ClearAll();
recursive = false;
Host_AbortCurrentFrame();
host.state = HOST_ERROR;
}
void Host_Error_f( void )
@ -534,6 +548,7 @@ void Host_InitCommon( const char *progname, qboolean bChangeGame )
MEMORYSTATUS lpBuffer;
char dev_level[4];
char szTemp[MAX_SYSPATH];
string szRootPath;
lpBuffer.dwLength = sizeof( MEMORYSTATUS );
GlobalMemoryStatus( &lpBuffer );
@ -579,6 +594,13 @@ void Host_InitCommon( const char *progname, qboolean bChangeGame )
if( GetModuleFileName( NULL, szTemp, sizeof( szTemp )) && !host.change_game )
FS_FileBase( szTemp, SI.ModuleName );
FS_ExtractFilePath( szTemp, szRootPath );
if( Q_stricmp( host.rootdir, szRootPath ))
{
Q_strncpy( host.rootdir, szRootPath, sizeof( host.rootdir ));
SetCurrentDirectory( host.rootdir );
}
if( SI.ModuleName[0] == '#' ) host.type = HOST_DEDICATED;
// determine host type
@ -613,18 +635,6 @@ void Host_InitCommon( const char *progname, qboolean bChangeGame )
if( host.developer < D_WARN ) host.con_showalways = false;
}
if( GetModuleFileName( hCurrent, szTemp, sizeof( szTemp )))
FS_FileBase( szTemp, szTemp );
// protect to rename xash.dll
if( Q_stricmp( szTemp, "xash" ) && Com_RandomLong( 0, 1 ))
{
host.type = HOST_CREDITS;
host.con_showalways = true;
Con_CreateConsole();
Sys_Break( show_credits, Q_timestamp( TIME_YEAR_ONLY ));
}
Con_CreateConsole();
// first text message into console or log
@ -647,6 +657,14 @@ void Host_InitCommon( const char *progname, qboolean bChangeGame )
FS_LoadGameInfo( NULL );
Q_strncpy( host.gamefolder, GI->gamefolder, sizeof( host.gamefolder ));
if( GI->secure )
{
// clear all developer levels when game is protected
Cvar_FullSet( "developer", "0", CVAR_INIT );
host.con_showalways = false;
host.developer = 0;
}
HPAK_Init();
IN_Init();
@ -692,7 +710,7 @@ int EXPORT Host_Main( const char *progname, int bChangeGame, pfnChangeGame func
host_gameloaded = Cvar_Get( "host_gameloaded", "0", CVAR_INIT, "inidcates a loaded game.dll" );
host_clientloaded = Cvar_Get( "host_clientloaded", "0", CVAR_INIT, "inidcates a loaded client.dll" );
host_limitlocal = Cvar_Get( "host_limitlocal", "0", 0, "apply cl_cmdrate and rate to loopback connection" );
host_allow_materials = Cvar_Get( "host_allow_materials", "1", CVAR_LATCH|CVAR_ARCHIVE, "allow HD textures" );
host_allow_materials = Cvar_Get( "host_allow_materials", "0", CVAR_LATCH|CVAR_ARCHIVE, "allow HD textures" );
con_gamemaps = Cvar_Get( "con_gamemaps", "1", CVAR_ARCHIVE, "when true show only maps in game folder" );
// content control

View File

@ -457,7 +457,7 @@ static void Mod_LoadSubmodels( const dlump_t *l )
if( VectorIsNull( out->origin ))
{
// NOTE: zero origin after recalculating is indicated included origin brush
// VectorAverage( out->mins, out->maxs, out->origin );
VectorAverage( out->mins, out->maxs, out->origin );
}
if( i == 0 || !world.loading )
@ -1689,7 +1689,7 @@ static void Mod_LoadBrushModel( model_t *mod, const void *buffer, qboolean *load
loadmodel->mempool = Mem_AllocPool( va( "sv: ^2%s^7", loadmodel->name ));
// load into heap
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 )
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 && (header->lumps[LUMP_ENTITIES].filelen % sizeof( dplane_t )) == 0 )
{
// blue-shift swapped lumps
Mod_LoadEntities( &header->lumps[LUMP_PLANES] );
@ -1899,6 +1899,11 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
case HLBSP_VERSION:
Mod_LoadBrushModel( mod, buf, &loaded );
break;
default:
Mem_Free( buf );
if( crash ) Host_Error( "Mod_ForName: %s unknown format\n", tempname );
else MsgDev( D_ERROR, "Mod_ForName: %s unknown format\n", tempname );
return NULL;
}
Mem_Free( buf );
@ -1907,9 +1912,8 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
{
Mod_FreeModel( mod );
// check for loading problems
if( crash ) Host_Error( "Mod_ForName: %s unknown format\n", tempname );
else MsgDev( D_ERROR, "Mod_ForName: %s unknown format\n", tempname );
if( crash ) Host_Error( "Mod_ForName: %s couldn't load\n", tempname );
else MsgDev( D_ERROR, "Mod_ForName: %s couldn't load\n", tempname );
return NULL;
}
return mod;

View File

@ -131,9 +131,9 @@ hull_t *PM_HullForEntity( physent_t *pe, vec3_t mins, vec3_t maxs, vec3_t offset
}
else
{
if( size[0] <= world.hull_sizes[1][0] )
if( size[0] <= 36.0f )
{
if( size[2] <= world.hull_sizes[3][2] )
if( size[2] <= 36.0f )
hull = &pe->model->hulls[3];
else hull = &pe->model->hulls[1];
}

View File

@ -26,6 +26,8 @@ extern "C" {
#include <windows.h>
#define MSGBOX( x ) MessageBox( NULL, x, "Xash Error", MB_OK|MB_SETFOREGROUND|MB_ICONSTOP )
#define MSGBOX2( x ) MessageBox( host.hWnd, x, "Host Error", MB_OK|MB_SETFOREGROUND|MB_ICONSTOP )
#define MSGBOX3( x ) MessageBox( host.hWnd, x, "Host Recursive Error", MB_OK|MB_SETFOREGROUND|MB_ICONSTOP )
// basic typedefs
typedef int sound_t;

View File

@ -61,16 +61,9 @@ TargetDir=\Xash3D\src_main\temp\engine\!release
InputPath=\Xash3D\src_main\temp\engine\!release\xash.dll
SOURCE="$(InputPath)"
BuildCmds= \
copy $(TargetDir)\xash.dll "D:\Xash3D\xash.dll" \
copy $(TargetDir)\xash.dll "D:\Area51\xash.dll" \
"D:\Xash3D\xash.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
copy $(TargetDir)\xash.dll "D:\Xash3D\xash.dll"
"D:\Area51\xash.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "engine - Win32 Debug"
@ -105,16 +98,9 @@ TargetDir=\Xash3D\src_main\temp\engine\!debug
InputPath=\Xash3D\src_main\temp\engine\!debug\xash.dll
SOURCE="$(InputPath)"
BuildCmds= \
copy $(TargetDir)\xash.dll "D:\Xash3D\xash.dll" \
copy $(TargetDir)\xash.dll "D:\Area51\xash.dll" \
"D:\Xash3D\xash.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
copy $(TargetDir)\xash.dll "D:\Xash3D\xash.dll"
"D:\Area51\xash.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ENDIF

View File

@ -41,8 +41,7 @@ void *CustomDecal_Validate( byte *data, int size )
return NULL;
}
int SV_CreateCustomization( customization_t *pListHead, resource_t *pResource, int playernumber, int flags,
customization_t **pCustomization, int *nLumps )
int SV_CreateCustomization( customization_t *pListHead, resource_t *pResource, int playernumber, int flags, customization_t **pCust, int *nLumps )
{
customization_t *pRes;
cachewad_t *pldecal;
@ -52,8 +51,7 @@ int SV_CreateCustomization( customization_t *pListHead, resource_t *pResource, i
ASSERT( pResource != NULL );
if( pCustomization != NULL )
*pCustomization = NULL;
if( pCust != NULL ) *pCust = NULL;
pRes = Z_Malloc( sizeof( customization_t ));
pRes->resource = *pResource;
@ -129,7 +127,7 @@ int SV_CreateCustomization( customization_t *pListHead, resource_t *pResource, i
if( !found_problem )
{
if( pCustomization ) *pCustomization = pRes;
if( pCust ) *pCust = pRes;
pRes->pNext = pListHead->pNext;
pListHead->pNext = pRes;

View File

@ -488,7 +488,7 @@ void SV_WriteEntityPatch( const char *filename )
case Q1BSP_VERSION:
case HLBSP_VERSION:
header = (dheader_t *)buf;
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 )
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 && (header->lumps[LUMP_ENTITIES].filelen % sizeof( dplane_t )) == 0 )
{
// Blue-Shift ordering
lumpofs = header->lumps[LUMP_PLANES].fileofs;
@ -552,7 +552,7 @@ char *SV_ReadEntityScript( const char *filename, int *flags )
case Q1BSP_VERSION:
case HLBSP_VERSION:
header = (dheader_t *)buf;
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 )
if( header->lumps[LUMP_ENTITIES].fileofs <= 1024 && (header->lumps[LUMP_ENTITIES].filelen % sizeof( dplane_t )) == 0 )
{
// Blue-Shift ordering
lumpofs = header->lumps[LUMP_PLANES].fileofs;

View File

@ -764,7 +764,6 @@ before Sys_Quit or Sys_Error
void SV_Shutdown( qboolean reconnect )
{
// already freed
if( host.state == HOST_ERROR ) return;
if( !SV_Active()) return;
if( host.type == HOST_DEDICATED ) MsgDev( D_INFO, "SV_Shutdown: %s\n", host.finalmsg );

View File

@ -177,9 +177,9 @@ hull_t *SV_HullForEntity( edict_t *ent, int hullNumber, vec3_t mins, vec3_t maxs
}
else
{
if( size[0] <= world.hull_sizes[1][0] )
if( size[0] <= 36.0f )
{
if( size[2] <= world.hull_sizes[3][2] )
if( size[2] <= 36.0f )
hull = &model->hulls[3];
else hull = &model->hulls[1];
}
@ -1216,7 +1216,7 @@ trace_t SV_Move( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end,
clip.maxs = maxs;
clip.type = (type & 0xFF);
clip.flags = (type & 0xFF00);
clip.passedict = e;
clip.passedict = (e) ? e : EDICT_NUM( 0 );
clip.hull = -1;
// clip to world
@ -1264,7 +1264,7 @@ trace_t SV_MoveHull( const vec3_t start, int hullNumber, const vec3_t end, int t
clip.end = end;
clip.type = (type & 0xFF);
clip.flags = (type & 0xFF00);
clip.passedict = e;
clip.passedict = (e) ? e : EDICT_NUM( 0 );
clip.hull = bound( 0, hullNumber, 3 );
clip.mins = sv.worldmodel->hulls[clip.hull].clip_mins;
clip.maxs = sv.worldmodel->hulls[clip.hull].clip_maxs;

View File

@ -316,6 +316,97 @@ void UI_DrawMouseCursor( void )
SET_CURSOR( hCursor );
}
/*
=================
UI_DrawBackground_Callback
=================
*/
void UI_DrawBackground_Callback( void *self )
{
if (!uiStatic.m_fHaveSteamBackground)
{
menuCommon_s *item = (menuCommon_s *)self;
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
return;
}
int xpos, ypos;
float xScale, yScale;
// work out scaling factors
xScale = ScreenWidth / uiStatic.m_flTotalWidth;
yScale = ScreenHeight / uiStatic.m_flTotalHeight;
// iterate and draw all the background pieces
ypos = 0;
for (int y = 0; y < BACKGROUND_ROWS; y++)
{
xpos = 0;
for (int x = 0; x < BACKGROUND_COLUMNS; x++)
{
bimage_t &bimage = uiStatic.m_SteamBackground[y][x];
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;
}
}
/*
=================
UI_LoadBackgroundImage
=================
*/
void UI_LoadBackgroundImage( void )
{
int num_background_images = 0;
char filename[512];
for( int y = 0; y < BACKGROUND_ROWS; y++ )
{
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 );
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;
}
}
}
}
/*
=================
UI_StartSound
@ -1198,8 +1289,6 @@ void UI_Precache( void )
if( !ui_precache->value )
return;
PIC_Load( UI_CURSOR_NORMAL );
PIC_Load( UI_CURSOR_TYPING );
PIC_Load( UI_LEFTARROW );
PIC_Load( UI_LEFTARROWFOCUS );
PIC_Load( UI_RIGHTARROW );
@ -1355,6 +1444,7 @@ int UI_VidInit( void )
uiStatic.cursorY = ScreenHeight >> 1;
uiStatic.outlineWidth = 4;
uiStatic.sliderWidth = 6;
uiStatic.space_draw_width = 8;
// all menu buttons have the same view sizes
uiStatic.buttons_draw_width = UI_BUTTONS_WIDTH;
@ -1363,6 +1453,7 @@ int UI_VidInit( void )
UI_ScaleCoords( NULL, NULL, &uiStatic.outlineWidth, NULL );
UI_ScaleCoords( NULL, NULL, &uiStatic.sliderWidth, NULL );
UI_ScaleCoords( NULL, NULL, &uiStatic.buttons_draw_width, &uiStatic.buttons_draw_height );
UI_ScaleCoords( NULL, NULL, &uiStatic.space_draw_width, NULL );
// trying to load colors.lst
UI_ApplyCustomColors ();
@ -1373,6 +1464,7 @@ int UI_VidInit( void )
// register menu font
uiStatic.hFont = PIC_Load( "#XASH_SYSTEMFONT_001", menufont_bmp, sizeof( menufont_bmp ));
UI_LoadBackgroundImage ();
#if 0
FILE *f;

View File

@ -35,8 +35,6 @@ GNU General Public License for more details.
#include "netadr.h"
#define ART_BACKGROUND "gfx/shell/splash"
#define UI_CURSOR_NORMAL "cursor"
#define UI_CURSOR_TYPING "typing"
#define UI_SLIDER_MAIN "gfx/shell/slider"
#define UI_LEFTARROW "gfx/shell/larrowdefault"
#define UI_LEFTARROWFOCUS "gfx/shell/larrowflyover"
@ -92,6 +90,8 @@ GNU General Public License for more details.
#define UI_BUTTONS_HEIGHT 40
#define UI_BUTTON_CHARWIDTH 14 // empirically determined value
#define ID_BACKGROUND 0 // catch warning on change this
// Generic types
typedef enum
{
@ -311,10 +311,17 @@ void UI_PicButton_Draw( menuPicButton_s *item );
// =====================================================================
// Main menu interface
extern cvar_t *ui_mainfont;
extern cvar_t *ui_namefont;
extern cvar_t *ui_precache;
extern cvar_t *ui_sensitivity;
#define BACKGROUND_ROWS 3
#define BACKGROUND_COLUMNS 4
typedef struct
{
HIMAGE hImage;
int width;
int height;
} bimage_t;
typedef struct
{
@ -332,6 +339,12 @@ typedef struct
HIMAGE hFont; // mainfont
// handle steam background images
bimage_t m_SteamBackground[BACKGROUND_ROWS][BACKGROUND_COLUMNS];
float m_flTotalWidth;
float m_flTotalHeight;
bool m_fHaveSteamBackground;
float scaleX;
float scaleY;
int outlineWidth;
@ -356,6 +369,7 @@ typedef struct
int buttons_draw_width; // scaled image what we drawing
int buttons_draw_height;
int space_draw_width; // scaled space width
} uiStatic_t;
extern uiStatic_t uiStatic;
@ -395,6 +409,7 @@ void UI_DrawString( int x, int y, int w, int h, const char *str, const int col,
void UI_StartSound( const char *sound );
void UI_LoadBmpButtons( void );
void UI_DrawBackground_Callback( void *self );
void UI_AddItem ( menuFramework_s *menu, void *item );
void UI_CursorMoved( menuFramework_s *menu );
void UI_SetCursor( menuFramework_s *menu, int cursor );

View File

@ -192,7 +192,7 @@ static void UI_Background_Ownerdraw( void *self )
menuCommon_s *item = (menuCommon_s *)self;
if( !CVAR_GET_FLOAT( "sv_background" ))
UI_DrawPic(item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic);
UI_DrawBackground_Callback( self );
if( uiStatic.realTime > uiInternetGames.refreshTime )
{

View File

@ -192,7 +192,7 @@ static void UI_Background_Ownerdraw( void *self )
menuCommon_s *item = (menuCommon_s *)self;
if( !CVAR_GET_FLOAT( "sv_background" ))
UI_DrawPic(item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic);
UI_DrawBackground_Callback( self );
if( uiStatic.realTime > uiLanGame.refreshTime )
{

View File

@ -103,7 +103,10 @@ static void UI_Background_Ownerdraw( void *self )
// map has background
if( CVAR_GET_FLOAT( "sv_background" )) return;
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
UI_DrawBackground_Callback( self );
if (uiStatic.m_fHaveSteamBackground)
return; // no logos for steam background
if( GetLogoLength() <= 0.1 || GetLogoWidth() <= 32 )
return; // don't draw stub logo (GoldSrc rules)

View File

@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define ID_GAMMA 4
#define ID_GLARE_REDUCTION 5
#define ID_SIMPLE_SKY 6
#define ID_ALLOW_MATERIALS 7
typedef struct
{
@ -49,6 +50,7 @@ typedef struct
menuSlider_s gammaIntensity;
menuSlider_s glareReduction;
menuCheckBox_s fastSky;
menuCheckBox_s hiTextures;
} uiVidOptions_t;
static uiVidOptions_t uiVidOptions;
@ -61,13 +63,16 @@ UI_VidOptions_GetConfig
*/
static void UI_VidOptions_GetConfig( void )
{
uiVidOptions.screenSize.curValue = (CVAR_GET_FLOAT( "viewsize" ) - 20.0f ) / 100.0f;
uiVidOptions.gammaIntensity.curValue = (CVAR_GET_FLOAT( "vid_gamma" ) - 0.5f) / 1.8f;
uiVidOptions.screenSize.curValue = RemapVal( CVAR_GET_FLOAT( "viewsize" ), 30.0f, 120.0f, 0.0f, 1.0f );
uiVidOptions.gammaIntensity.curValue = RemapVal( CVAR_GET_FLOAT( "gamma" ), 0.5f, 2.3f, 0.0f, 1.0f );
uiVidOptions.glareReduction.curValue = (CVAR_GET_FLOAT( "r_flaresize" ) - 100.0f ) / 200.0f;
if( CVAR_GET_FLOAT( "r_fastsky" ))
uiVidOptions.fastSky.enabled = 1;
if( CVAR_GET_FLOAT( "host_allow_materials" ))
uiVidOptions.hiTextures.enabled = 1;
uiVidOptions.outlineWidth = 2;
UI_ScaleCoords( NULL, NULL, &uiVidOptions.outlineWidth, NULL );
}
@ -79,10 +84,11 @@ UI_VidOptions_UpdateConfig
*/
static void UI_VidOptions_UpdateConfig( void )
{
CVAR_SET_FLOAT( "viewsize", (uiVidOptions.screenSize.curValue * 100.0f) + 20.0f );
CVAR_SET_FLOAT( "vid_gamma", (uiVidOptions.gammaIntensity.curValue * 1.8f) + 0.5f );
CVAR_SET_FLOAT( "viewsize", RemapVal( uiVidOptions.screenSize.curValue, 0.0f, 1.0f, 30.0f, 120.0f ));
CVAR_SET_FLOAT( "gamma", RemapVal( uiVidOptions.gammaIntensity.curValue, 0.0f, 1.0f, 0.5f, 2.3f ));
CVAR_SET_FLOAT( "r_flaresize", (uiVidOptions.glareReduction.curValue * 200.0f ) + 100.0f );
CVAR_SET_FLOAT( "r_fastsky", uiVidOptions.fastSky.enabled );
CVAR_SET_FLOAT( "host_allow_materials", uiVidOptions.hiTextures.enabled );
}
/*
@ -94,8 +100,34 @@ static void UI_VidOptions_Ownerdraw( void *self )
{
menuCommon_s *item = (menuCommon_s *)self;
int color = 0xFFFF0000; // 255, 0, 0, 255
int viewport[4];
int viewsize, size, sb_lines;
UI_DrawPic( item->x, item->y, item->width, item->height, uiColorWhite, ((menuBitmap_s *)self)->pic );
viewsize = CVAR_GET_FLOAT( "viewsize" );
if( viewsize >= 120 )
sb_lines = 0; // no status bar at all
else if( viewsize >= 110 )
sb_lines = 24; // no inventory
else sb_lines = 48;
size = min( viewsize, 100 );
viewport[2] = item->width * size / 100;
viewport[3] = item->height * size / 100;
if( viewport[3] > item->height - sb_lines )
viewport[3] = item->height - sb_lines;
if( viewport[3] > item->height )
viewport[3] = item->height;
viewport[2] &= ~7;
viewport[3] &= ~1;
viewport[0] = (item->width - viewport[2]) / 2;
viewport[1] = (item->height - sb_lines - viewport[3]) / 2;
UI_DrawPic( item->x + viewport[0], item->y + viewport[1], viewport[2], viewport[3], uiColorWhite, ((menuBitmap_s *)self)->pic );
UI_DrawRectangleExt( item->x, item->y, item->width, item->height, color, uiVidOptions.outlineWidth );
}
@ -111,6 +143,7 @@ static void UI_VidOptions_Callback( void *self, int event )
switch( item->id )
{
case ID_SIMPLE_SKY:
case ID_ALLOW_MATERIALS:
if( event == QM_PRESSED )
((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_PRESSED;
else ((menuCheckBox_s *)self)->focusPic = UI_CHECKBOX_FOCUS;
@ -168,7 +201,7 @@ static void UI_VidOptions_Init( void )
uiVidOptions.testImage.generic.flags = QMF_INACTIVE;
uiVidOptions.testImage.generic.x = 390;
uiVidOptions.testImage.generic.y = 225;
uiVidOptions.testImage.generic.width = 460;
uiVidOptions.testImage.generic.width = 480;
uiVidOptions.testImage.generic.height = 450;
uiVidOptions.testImage.pic = ART_GAMMA;
uiVidOptions.testImage.generic.ownerdraw = UI_VidOptions_Ownerdraw;
@ -225,10 +258,19 @@ static void UI_VidOptions_Init( void )
uiVidOptions.fastSky.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiVidOptions.fastSky.generic.name = "Draw simple sky";
uiVidOptions.fastSky.generic.x = 72;
uiVidOptions.fastSky.generic.y = 685;
uiVidOptions.fastSky.generic.y = 615;
uiVidOptions.fastSky.generic.callback = UI_VidOptions_Callback;
uiVidOptions.fastSky.generic.statusText = "enable/disable fast sky rendering (for old computers)";
uiVidOptions.hiTextures.generic.id = ID_ALLOW_MATERIALS;
uiVidOptions.hiTextures.generic.type = QMTYPE_CHECKBOX;
uiVidOptions.hiTextures.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
uiVidOptions.hiTextures.generic.name = "Allow materials";
uiVidOptions.hiTextures.generic.x = 72;
uiVidOptions.hiTextures.generic.y = 665;
uiVidOptions.hiTextures.generic.callback = UI_VidOptions_Callback;
uiVidOptions.hiTextures.generic.statusText = "let engine replace 8-bit textures with full color hi-res prototypes (if present)";
UI_VidOptions_GetConfig();
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.background );
@ -238,6 +280,7 @@ static void UI_VidOptions_Init( void )
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.gammaIntensity );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.glareReduction );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.fastSky );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.hiTextures );
UI_AddItem( &uiVidOptions.menu, (void *)&uiVidOptions.testImage );
}

View File

@ -1136,6 +1136,9 @@ void UI_Slider_Draw( menuSlider_s *sl )
if( sl->generic.callback ) sl->generic.callback( sl, QM_CHANGED );
}
// keep value in range
sl->curValue = bound( sl->minValue, sl->curValue, sl->maxValue );
// calc slider position
sliderX = sl->generic.x2 + (sl->drawStep * (sl->curValue * sl->numSteps));
@ -1944,17 +1947,24 @@ UI_Bitmap_Draw
*/
void UI_Bitmap_Draw( menuBitmap_s *b )
{
if( CVAR_GET_FLOAT( "sv_background" ) && b->generic.id == 0 )
return; // has background map disable images
if( b->generic.id == ID_BACKGROUND ) // background is always 0!
{
if( CVAR_GET_FLOAT( "sv_background" ))
return; // has background map disable images
// UGLY HACK for replace all backgrounds
UI_DrawBackground_Callback( b );
return;
}
//CR
if (b->generic.id==1)
if( b->generic.id == 1 )
{
// don't draw banners until transition is done
#ifdef TA_ALT_MODE
if ( UI_GetTitleTransFraction() != 10 ) return;
if( UI_GetTitleTransFraction() != 10 ) return;
#else
if ( UI_GetTitleTransFraction() < 1.0f ) return;
if( UI_GetTitleTransFraction() < 1.0f ) return;
#endif
}

View File

@ -110,6 +110,11 @@ inline int UnpackAlpha( unsigned int ulRGBA )
return ((ulRGBA & 0xFF000000) >> 24);
}
inline float RemapVal( float val, float A, float B, float C, float D)
{
return C + (D - C) * (val - A) / (B - A);
}
extern int ColorStrlen( const char *str ); // returns string length without color symbols
extern const int g_iColorTable[8];
extern void COM_FileBase( const char *in, char *out ); // ripped out from hlsdk 2.3