20 Apr 2011

This commit is contained in:
g-cont 2011-04-20 00:00:00 +04:00 committed by Alibek Omarov
parent 8713320797
commit eca966c620
15 changed files with 131 additions and 79 deletions

View File

@ -1371,6 +1371,7 @@ static qboolean CL_LoadHudSprite( const char *szSpriteName, model_t *m_pSprite,
if( !buf ) return false; if( !buf ) return false;
Q_strncpy( m_pSprite->name, szSpriteName, sizeof( m_pSprite->name )); Q_strncpy( m_pSprite->name, szSpriteName, sizeof( m_pSprite->name ));
m_pSprite->flags = 256; // it's hud sprite, make difference names to prevent free shared textures
if( mapSprite ) Mod_LoadMapSprite( m_pSprite, buf, size ); if( mapSprite ) Mod_LoadMapSprite( m_pSprite, buf, size );
else Mod_LoadSpriteModel( m_pSprite, buf ); else Mod_LoadSpriteModel( m_pSprite, buf );
@ -2864,6 +2865,58 @@ TriApi implementation
================= =================
*/ */
/*
=============
TriRenderMode
set rendermode
=============
*/
void TriRenderMode( int mode )
{
switch( mode )
{
case kRenderNormal:
default:
pglDisable( GL_BLEND );
pglDisable( GL_ALPHA_TEST );
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
break;
case kRenderTransColor:
pglEnable( GL_BLEND );
pglDisable( GL_ALPHA_TEST );
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
break;
case kRenderTransAlpha:
case kRenderTransTexture:
// NOTE: TriAPI doesn't have 'solid' mode
pglEnable( GL_BLEND );
pglDisable( GL_ALPHA_TEST );
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
break;
case kRenderGlow:
pglEnable( GL_BLEND );
pglDisable( GL_ALPHA_TEST );
pglBlendFunc( GL_SRC_ALPHA, GL_ONE );
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
break;
case kRenderTransAdd:
pglEnable( GL_BLEND );
pglDisable( GL_ALPHA_TEST );
pglBlendFunc( GL_SRC_ALPHA, GL_ONE );
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
break;
case kRenderTransInverse:
pglEnable( GL_BLEND );
pglDisable( GL_ALPHA_TEST );
pglBlendFunc( GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA );
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
break;
}
}
/* /*
============= =============
TriBegin TriBegin
@ -3025,10 +3078,18 @@ bind current texture
int TriSpriteTexture( model_t *pSpriteModel, int frame ) int TriSpriteTexture( model_t *pSpriteModel, int frame )
{ {
int gl_texturenum; int gl_texturenum;
msprite_t *psprite;
if(( gl_texturenum = R_GetSpriteTexture( pSpriteModel, frame )) == 0 ) if(( gl_texturenum = R_GetSpriteTexture( pSpriteModel, frame )) == 0 )
return 0; return 0;
psprite = pSpriteModel->cache.data;
if( psprite->texFormat == SPR_ALPHTEST )
{
pglEnable( GL_ALPHA_TEST );
pglAlphaFunc( GL_GREATER, 0.0f );
}
GL_Bind( GL_TEXTURE0, gl_texturenum ); GL_Bind( GL_TEXTURE0, gl_texturenum );
return 1; return 1;
@ -3345,7 +3406,7 @@ float Voice_GetControlFloat( VoiceTweakControl iControl )
static triangleapi_t gTriApi = static triangleapi_t gTriApi =
{ {
TRI_API_VERSION, TRI_API_VERSION,
GL_SetRenderMode, TriRenderMode,
TriBegin, TriBegin,
TriEnd, TriEnd,
TriColor4f, TriColor4f,

View File

@ -271,9 +271,6 @@ GL_Cull
*/ */
void GL_Cull( GLenum cull ) void GL_Cull( GLenum cull )
{ {
if( glState.faceCull == cull )
return;
if( !cull ) if( !cull )
{ {
pglDisable( GL_CULL_FACE ); pglDisable( GL_CULL_FACE );
@ -281,7 +278,6 @@ void GL_Cull( GLenum cull )
return; return;
} }
if( !glState.faceCull )
pglEnable( GL_CULL_FACE ); pglEnable( GL_CULL_FACE );
pglCullFace( cull ); pglCullFace( cull );
glState.faceCull = cull; glState.faceCull = cull;

View File

@ -19,7 +19,7 @@ extern byte *r_temppool;
#define BLOCK_HEIGHT 128 // lightmap block height #define BLOCK_HEIGHT 128 // lightmap block height
#define MAX_TEXTURES 4096 #define MAX_TEXTURES 4096
#define MAX_LIGHTMAPS 64 #define MAX_LIGHTMAPS 128
#define SUBDIVIDE_SIZE 64 #define SUBDIVIDE_SIZE 64
//#define MIRROR_TEST //#define MIRROR_TEST
@ -76,7 +76,7 @@ typedef enum
typedef struct gltexture_s typedef struct gltexture_s
{ {
char name[64]; // game path, including extension char name[128]; // game path, including extension
word srcWidth; // keep unscaled sizes word srcWidth; // keep unscaled sizes
word srcHeight; word srcHeight;
word width; // upload width\height word width; // upload width\height
@ -595,7 +595,6 @@ extern convar_t *r_lockcull;
extern convar_t *r_wateralpha; extern convar_t *r_wateralpha;
extern convar_t *r_dynamic; extern convar_t *r_dynamic;
extern convar_t *r_lightmap; extern convar_t *r_lightmap;
extern convar_t *r_shadows;
extern convar_t *r_fastsky; extern convar_t *r_fastsky;
extern convar_t *vid_displayfrequency; extern convar_t *vid_displayfrequency;

View File

@ -99,9 +99,9 @@ static int R_TransEntityCompare( const cl_entity_t **a, const cl_entity_t **b )
// now sort by rendermode // now sort by rendermode
if( R_RankForRenderMode( ent1 ) > R_RankForRenderMode( ent2 )) if( R_RankForRenderMode( ent1 ) > R_RankForRenderMode( ent2 ))
return -1;
if( R_RankForRenderMode( ent1 ) < R_RankForRenderMode( ent2 ))
return 1; return 1;
if( R_RankForRenderMode( ent1 ) < R_RankForRenderMode( ent2 ))
return -1;
// then by distance // then by distance
if( ent1->model->type == mod_brush ) if( ent1->model->type == mod_brush )
@ -369,7 +369,7 @@ static void R_Clear( int bitMask )
if( RI.drawWorld && r_fastsky->integer ) if( RI.drawWorld && r_fastsky->integer )
bits |= GL_COLOR_BUFFER_BIT; bits |= GL_COLOR_BUFFER_BIT;
if( glState.stencilEnabled && r_shadows->integer ) if( glState.stencilEnabled )
bits |= GL_STENCIL_BUFFER_BIT; bits |= GL_STENCIL_BUFFER_BIT;
bits &= bitMask; bits &= bitMask;

View File

@ -1207,7 +1207,6 @@ void R_DrawBrushModel( cl_entity_t *e )
pglColor4ub( 255, 255, 255, e->curstate.renderamt ); pglColor4ub( 255, 255, 255, e->curstate.renderamt );
break; break;
case kRenderTransColor: case kRenderTransColor:
pglDisable( GL_TEXTURE_2D );
pglColor4ub( e->curstate.rendercolor.r, e->curstate.rendercolor.g, pglColor4ub( e->curstate.rendercolor.r, e->curstate.rendercolor.g,
e->curstate.rendercolor.b, e->curstate.renderamt ); e->curstate.rendercolor.b, e->curstate.renderamt );
break; break;
@ -1259,9 +1258,6 @@ void R_DrawBrushModel( cl_entity_t *e )
for( i = 0; i < num_sorted; i++ ) for( i = 0; i < num_sorted; i++ )
R_RenderBrushPoly( world.draw_surfaces[i] ); R_RenderBrushPoly( world.draw_surfaces[i] );
if( e->curstate.rendermode == kRenderTransColor )
pglEnable( GL_TEXTURE_2D );
R_BlendLightmaps(); R_BlendLightmaps();
R_RenderFullbrights(); R_RenderFullbrights();
R_LoadIdentity(); // restore worldmatrix R_LoadIdentity(); // restore worldmatrix

View File

@ -16,7 +16,6 @@
#define MAPSPRITE_SIZE 128 #define MAPSPRITE_SIZE 128
convar_t *r_sprite_lerping; convar_t *r_sprite_lerping;
char sprite_name[64];
char group_suffix[8]; char group_suffix[8];
static vec3_t sprite_mins, sprite_maxs; static vec3_t sprite_mins, sprite_maxs;
static float sprite_radius; static float sprite_radius;
@ -43,11 +42,12 @@ static dframetype_t *R_SpriteLoadFrame( model_t *mod, void *pin, mspriteframe_t
{ {
dspriteframe_t *pinframe; dspriteframe_t *pinframe;
mspriteframe_t *pspriteframe; mspriteframe_t *pspriteframe;
char texname[64]; char texname[128];
// build uinque frame name // build uinque frame name
if( !sprite_name[0] ) FS_FileBase( mod->name, sprite_name ); if( mod->flags & 256 ) // it's a HUD sprite
Q_snprintf( texname, sizeof( texname ), "#%s_%s_%i%i.spr", sprite_name, group_suffix, num / 10, num % 10 ); Q_snprintf( texname, sizeof( texname ), "#HUD/%s_%s_%i%i.spr", mod->name, group_suffix, num / 10, num % 10 );
else Q_snprintf( texname, sizeof( texname ), "#%s_%s_%i%i.spr", mod->name, group_suffix, num / 10, num % 10 );
pinframe = (dspriteframe_t *)pin; pinframe = (dspriteframe_t *)pin;
@ -209,9 +209,6 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer )
return; return;
} }
// reset the sprite name
sprite_name[0] = '\0';
for( i = 0; i < pin->numframes; i++ ) for( i = 0; i < pin->numframes; i++ )
{ {
frametype_t frametype = pframetype->type; frametype_t frametype = pframetype->type;
@ -250,7 +247,7 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size )
{ {
byte *src, *dst; byte *src, *dst;
rgbdata_t *pix, temp; rgbdata_t *pix, temp;
char texname[64]; char texname[128];
int i, j, x, y, w, h; int i, j, x, y, w, h;
int xl, yl, xh, yh; int xl, yl, xh, yh;
int linedelta, numframes; int linedelta, numframes;
@ -306,9 +303,6 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size )
temp.buffer = Mem_Alloc( r_temppool, temp.size ); temp.buffer = Mem_Alloc( r_temppool, temp.size );
temp.palette = NULL; temp.palette = NULL;
// reset the sprite name
sprite_name[0] = '\0';
// chop the image and upload into video memory // chop the image and upload into video memory
for( i = xl = yl = 0; i < numframes; i++ ) for( i = xl = yl = 0; i < numframes; i++ )
{ {
@ -329,8 +323,7 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size )
} }
// build uinque frame name // build uinque frame name
if( !sprite_name[0] ) FS_FileBase( mod->name, sprite_name ); Q_snprintf( texname, sizeof( texname ), "#MAP/%s_%i%i.spr", mod->name, i / 10, i % 10 );
Q_snprintf( texname, sizeof( texname ), "#%s_%i%i.spr", sprite_name, i / 10, i % 10 );
psprite->frames[i].frameptr = Mem_Alloc( mod->mempool, sizeof( mspriteframe_t )); psprite->frames[i].frameptr = Mem_Alloc( mod->mempool, sizeof( mspriteframe_t ));
pspriteframe = psprite->frames[i].frameptr; pspriteframe = psprite->frames[i].frameptr;
@ -851,8 +844,6 @@ void R_DrawSpriteModel( cl_entity_t *e )
model = e->model; model = e->model;
psprite = (msprite_t * )model->cache.data; psprite = (msprite_t * )model->cache.data;
VectorSet( color, 255.0f, 255.0f, 255.0f );
VectorCopy( e->origin, origin ); // set render origin VectorCopy( e->origin, origin ); // set render origin
// do movewith // do movewith
@ -909,7 +900,12 @@ void R_DrawSpriteModel( cl_entity_t *e )
break; break;
case kRenderNormal: case kRenderNormal:
default: default:
pglDisable( GL_BLEND ); if( psprite->texFormat == SPR_INDEXALPHA )
{
pglEnable( GL_BLEND );
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
}
else pglDisable( GL_BLEND );
break; break;
} }

View File

@ -50,7 +50,7 @@ convar_t *r_studio_lambert;
convar_t *r_drawviewmodel; convar_t *r_drawviewmodel;
convar_t *r_customdraw_playermodel; convar_t *r_customdraw_playermodel;
convar_t *cl_himodels; convar_t *cl_himodels;
char model_name[64]; cvar_t r_shadows = { "r_shadows", "0", 0, 0 };
static r_studio_interface_t *pStudioDraw; static r_studio_interface_t *pStudioDraw;
static float aliasXscale, aliasYscale; // software renderer scale static float aliasXscale, aliasYscale; // software renderer scale
static matrix3x4 g_aliastransform; // software renderer transform static matrix3x4 g_aliastransform; // software renderer transform
@ -1352,7 +1352,7 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *lightinfo )
plight = &g_studiolight; plight = &g_studiolight;
plight->numdlights = 0; // clear previous dlights plight->numdlights = 0; // clear previous dlights
if( r_lighting_extended->integer ) if( r_lighting_extended->integer == 2 )
Matrix3x4_OriginFromMatrix( g_lighttransform[0], origin ); Matrix3x4_OriginFromMatrix( g_lighttransform[0], origin );
else Matrix3x4_OriginFromMatrix( g_rotationmatrix, origin ); else Matrix3x4_OriginFromMatrix( g_rotationmatrix, origin );
@ -1441,7 +1441,7 @@ void R_StudioEntityLight( alight_t *lightinfo )
plight = &g_studiolight; plight = &g_studiolight;
plight->numelights = 0; // clear previous elights plight->numelights = 0; // clear previous elights
if( r_lighting_extended->integer ) if( r_lighting_extended->integer == 2 )
Matrix3x4_OriginFromMatrix( g_lighttransform[0], origin ); Matrix3x4_OriginFromMatrix( g_lighttransform[0], origin );
else Matrix3x4_OriginFromMatrix( g_rotationmatrix, origin ); else Matrix3x4_OriginFromMatrix( g_rotationmatrix, origin );
@ -2205,6 +2205,7 @@ static void R_StudioSetupRenderer( int rendermode )
{ {
g_iRenderMode = bound( 0, rendermode, kRenderTransInverse ); g_iRenderMode = bound( 0, rendermode, kRenderTransInverse );
pglShadeModel( GL_SMOOTH ); // enable gouraud shading pglShadeModel( GL_SMOOTH ); // enable gouraud shading
GL_Cull( GL_FRONT );
} }
/* /*
@ -2246,6 +2247,14 @@ static int pfnIsHardware( void )
return true; return true;
} }
static void StudioDrawShadow( studiohdr_t *pstudiohdr, matrix3x4 transform[MAXSTUDIOBONES] )
{
// in GoldSrc shadow call is dsiabled with 'return' at start of the function
// some mods used a hack with calling DrawShadow ahead of 'return'
// this code is for HL compatibility.
MsgDev( D_INFO, "GL_StudioDrawShadow()\n" ); // just a debug
}
/* /*
=============== ===============
GL_StudioDrawShadow GL_StudioDrawShadow
@ -2254,12 +2263,10 @@ GL_StudioDrawShadow
*/ */
static void GL_StudioDrawShadow( void ) static void GL_StudioDrawShadow( void )
{ {
// in GoldSrc shadow call is dsiabled with 'return' at start of the function if( r_shadows.value )
// some mods used a hack with calling DrawShadow ahead of 'return' {
// this code is for HL compatibility. StudioDrawShadow( m_pStudioHeader, g_bonestransform );
return; }
MsgDev( D_INFO, "GL_StudioDrawShadow()\n" ); // just a debug
} }
/* /*
@ -2836,7 +2843,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
{ {
size_t size; size_t size;
int flags = 0; int flags = 0;
char texname[64], name[64]; char texname[128], name[128];
if( ptexture->flags & STUDIO_NF_TRANSPARENT ) if( ptexture->flags & STUDIO_NF_TRANSPARENT )
flags |= (TF_CLAMP|TF_NOMIPMAP); flags |= (TF_CLAMP|TF_NOMIPMAP);
@ -2847,11 +2854,10 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
// NOTE: replace index with pointer to start of imagebuffer, ImageLib expected it // NOTE: replace index with pointer to start of imagebuffer, ImageLib expected it
ptexture->index = (int)((byte *)phdr) + ptexture->index; ptexture->index = (int)((byte *)phdr) + ptexture->index;
size = sizeof( mstudiotexture_t ) + ptexture->width * ptexture->height + 768; size = sizeof( mstudiotexture_t ) + ptexture->width * ptexture->height + 768;
if( !model_name[0] ) FS_FileBase( mod->name, model_name );
FS_FileBase( ptexture->name, name ); FS_FileBase( ptexture->name, name );
// build the texname // build the texname
Q_snprintf( texname, sizeof( texname ), "%s/%s.mdl", model_name, name ); Q_snprintf( texname, sizeof( texname ), "#%s/%s.mdl", mod->name, name );
ptexture->index = GL_LoadTexture( texname, (byte *)ptexture, size, flags ); ptexture->index = GL_LoadTexture( texname, (byte *)ptexture, size, flags );
if( !ptexture->index ) if( !ptexture->index )
@ -2889,8 +2895,6 @@ studiohdr_t *R_StudioLoadHeader( model_t *mod, const void *buffer )
return NULL; return NULL;
} }
model_name[0] = '\0';
if( host.type != HOST_DEDICATED ) if( host.type != HOST_DEDICATED )
{ {
ptexture = (mstudiotexture_t *)(((byte *)phdr) + phdr->textureindex); ptexture = (mstudiotexture_t *)(((byte *)phdr) + phdr->textureindex);

View File

@ -63,7 +63,6 @@ convar_t *r_lockcull;
convar_t *r_wateralpha; convar_t *r_wateralpha;
convar_t *r_dynamic; convar_t *r_dynamic;
convar_t *r_lightmap; convar_t *r_lightmap;
convar_t *r_shadows;
convar_t *r_fastsky; convar_t *r_fastsky;
convar_t *vid_displayfrequency; convar_t *vid_displayfrequency;
@ -1408,7 +1407,6 @@ void GL_InitCommands( void )
r_wateralpha = Cvar_Get( "r_wateralpha", "1", CVAR_ARCHIVE, "world water transparency factor" ); r_wateralpha = Cvar_Get( "r_wateralpha", "1", CVAR_ARCHIVE, "world water transparency factor" );
r_dynamic = Cvar_Get( "r_dynamic", "1", CVAR_ARCHIVE, "allow dynamic lighting (dlights, lightstyles)" ); r_dynamic = Cvar_Get( "r_dynamic", "1", CVAR_ARCHIVE, "allow dynamic lighting (dlights, lightstyles)" );
r_lightmap = Cvar_Get( "r_lightmap", "0", CVAR_CHEAT, "lightmap debugging tool" ); r_lightmap = Cvar_Get( "r_lightmap", "0", CVAR_CHEAT, "lightmap debugging tool" );
r_shadows = Cvar_Get( "r_shadows", "0", CVAR_ARCHIVE, "enable model shadows" );
r_fastsky = Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE, "enable algorhytm fo fast sky rendering (for old machines)" ); r_fastsky = Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE, "enable algorhytm fo fast sky rendering (for old machines)" );
r_drawentities = Cvar_Get( "r_drawentities", "1", CVAR_CHEAT|CVAR_ARCHIVE, "render entities" ); r_drawentities = Cvar_Get( "r_drawentities", "1", CVAR_CHEAT|CVAR_ARCHIVE, "render entities" );
r_flaresize = Cvar_Get( "r_flaresize", "200", CVAR_ARCHIVE, "set flares size" ); r_flaresize = Cvar_Get( "r_flaresize", "200", CVAR_ARCHIVE, "set flares size" );

View File

@ -732,8 +732,6 @@ int EXPORT Host_Main( const char *progname, int bChangeGame, pfnChangeGame func
host.errorframe = 0; host.errorframe = 0;
Cbuf_Execute(); Cbuf_Execute();
SCR_CheckStartupVids(); // must be last
// post initializations // post initializations
switch( host.type ) switch( host.type )
{ {
@ -750,6 +748,8 @@ int EXPORT Host_Main( const char *progname, int bChangeGame, pfnChangeGame func
break; break;
} }
SCR_CheckStartupVids(); // must be last
host.change_game = false; // done host.change_game = false; // done
Cmd_RemoveCommand( "setr" ); // remove potentially backdoor for change render settings Cmd_RemoveCommand( "setr" ); // remove potentially backdoor for change render settings
Cmd_RemoveCommand( "setgl" ); Cmd_RemoveCommand( "setgl" );

View File

@ -408,6 +408,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
} }
Image_GetPaletteLMP( pal, rendermode ); Image_GetPaletteLMP( pal, rendermode );
image.d_currentpal[255] &= 0xFFFFFF;
} }
else if( image.hint != IL_HINT_HL && filesize >= (int)sizeof(mip) + ((pixels * 85)>>6)) else if( image.hint != IL_HINT_HL && filesize >= (int)sizeof(mip) + ((pixels * 85)>>6))
{ {

View File

@ -544,6 +544,9 @@ static void Mod_LoadTextures( const dlump_t *l )
tx->gl_texturenum = GL_LoadTexture( texname, NULL, 0, 0 ); tx->gl_texturenum = GL_LoadTexture( texname, NULL, 0, 0 );
} }
// set the emo-texture for missed
if( !tx->gl_texturenum ) tx->gl_texturenum = tr.defaultTexture;
// check for luma texture // check for luma texture
if( R_GetTexture( tx->gl_texturenum )->flags & TF_HAS_LUMA ) if( R_GetTexture( tx->gl_texturenum )->flags & TF_HAS_LUMA )
{ {
@ -564,10 +567,13 @@ static void Mod_LoadTextures( const dlump_t *l )
} }
} }
if( tx->gl_texturenum != tr.defaultTexture )
{
// apply texture type (just for debug) // apply texture type (just for debug)
GL_SetTextureType( tx->gl_texturenum, TEX_BRUSH ); GL_SetTextureType( tx->gl_texturenum, TEX_BRUSH );
GL_SetTextureType( tx->fb_texturenum, TEX_BRUSH ); GL_SetTextureType( tx->fb_texturenum, TEX_BRUSH );
} }
}
// sequence the animations // sequence the animations
for( i = 0; i < loadmodel->numtextures; i++ ) for( i = 0; i < loadmodel->numtextures; i++ )

View File

@ -945,47 +945,43 @@ prevent data to out of range
*/ */
int Delta_ClampIntegerField( int iValue, qboolean bSigned, int bits ) int Delta_ClampIntegerField( int iValue, qboolean bSigned, int bits )
{ {
uint uValue;
uValue = (uint)iValue;
switch( bits ) switch( bits )
{ {
case 8: case 8:
if( bSigned ) iValue = bound( -127, iValue, 128 ); if( bSigned ) iValue = bound( -127, (short)iValue, 128 );
else iValue = bound( 0, uValue, 255 ); else iValue = bound( 0, (word)iValue, 255 );
break; break;
case 9: case 9:
if( bSigned ) iValue = bound( -255, iValue, 256 ); if( bSigned ) iValue = bound( -255, (short)iValue, 256 );
else iValue = bound( 0, uValue, 511 ); else iValue = bound( 0, (word)iValue, 511 );
break; break;
case 10: case 10:
if( bSigned ) iValue = bound( -511, iValue, 511 ); if( bSigned ) iValue = bound( -511, (short)iValue, 511 );
else iValue = bound( 0, uValue, 1023 ); else iValue = bound( 0, (word)iValue, 1023 );
break; break;
case 11: case 11:
if( bSigned ) iValue = bound( -1023, iValue, 1023 ); if( bSigned ) iValue = bound( -1023, (short)iValue, 1023 );
else iValue = bound( 0, uValue, 2047 ); else iValue = bound( 0, (word)iValue, 2047 );
break; break;
case 12: case 12:
if( bSigned ) iValue = bound( -2047, iValue, 2047 ); if( bSigned ) iValue = bound( -2047, (short)iValue, 2047 );
else iValue = bound( 0, uValue, 4095 ); else iValue = bound( 0, (word)iValue, 4095 );
break; break;
case 13: case 13:
if( bSigned ) iValue = bound( -4095, iValue, 4095 ); if( bSigned ) iValue = bound( -4095, (short)iValue, 4095 );
else iValue = bound( 0, uValue, 8191 ); else iValue = bound( 0, (word)iValue, 8191 );
break; break;
case 14: case 14:
if( bSigned ) iValue = bound( -8191, iValue, 8191 ); if( bSigned ) iValue = bound( -8191, (short)iValue, 8191 );
else iValue = bound( 0, uValue, 16383 ); else iValue = bound( 0, (word)iValue, 16383 );
break; break;
case 15: case 15:
if( bSigned ) iValue = bound( -16383, iValue, 16383 ); if( bSigned ) iValue = bound( -16383, (short)iValue, 16383 );
else iValue = bound( 0, uValue, 32767 ); else iValue = bound( 0, (word)iValue, 32767 );
break; break;
case 16: case 16:
if( bSigned ) iValue = bound( -32767, iValue, 32767 ); if( bSigned ) iValue = bound( -32767, (short)iValue, 32767 );
else iValue = bound( 0, uValue, 65535 ); else iValue = bound( 0, (word)iValue, 65535 );
break; break;
} }
return iValue; // clamped; return iValue; // clamped;

View File

@ -486,6 +486,9 @@ pmtrace_t PM_PlayerTrace( playermove_t *pmove, vec3_t start, vec3_t end, int fla
total.ent = i; total.ent = i;
} }
if( total.startsolid )
total.fraction = 0.0f;
if( i == 0 && ( flags & PM_WORLD_ONLY )) if( i == 0 && ( flags & PM_WORLD_ONLY ))
break; // done break; // done

View File

@ -572,10 +572,8 @@ SV_Kill_f
*/ */
void SV_Kill_f( void ) void SV_Kill_f( void )
{ {
if( !Cvar_VariableInteger( "sv_cheats" )) return;
if( !SV_SetPlayer() || sv.background ) return; if( !SV_SetPlayer() || sv.background ) return;
// NOTE: the CS 1.5 want to kill local player. i'm don't know why :(
if( !svs.currentPlayer || !SV_IsValidEdict( svs.currentPlayer->edict )) if( !svs.currentPlayer || !SV_IsValidEdict( svs.currentPlayer->edict ))
return; return;

View File

@ -37,7 +37,6 @@ convar_t *sv_accelerate;
convar_t *sv_friction; convar_t *sv_friction;
convar_t *sv_edgefriction; convar_t *sv_edgefriction;
convar_t *sv_waterfriction; convar_t *sv_waterfriction;
convar_t *sv_synchthink;
convar_t *sv_stopspeed; convar_t *sv_stopspeed;
convar_t *hostname; convar_t *hostname;
convar_t *sv_fix_pushents; convar_t *sv_fix_pushents;
@ -669,7 +668,6 @@ void SV_Init( void )
sv_stopspeed = Cvar_Get( "sv_stopspeed", "100", CVAR_PHYSICINFO, "how fast you come to a complete stop" ); sv_stopspeed = Cvar_Get( "sv_stopspeed", "100", CVAR_PHYSICINFO, "how fast you come to a complete stop" );
sv_maxclients = Cvar_Get( "maxplayers", "1", CVAR_LATCH|CVAR_SERVERNOTIFY, "server clients limit" ); sv_maxclients = Cvar_Get( "maxplayers", "1", CVAR_LATCH|CVAR_SERVERNOTIFY, "server clients limit" );
sv_check_errors = Cvar_Get( "sv_check_errors", "0", CVAR_ARCHIVE, "check edicts for errors" ); sv_check_errors = Cvar_Get( "sv_check_errors", "0", CVAR_ARCHIVE, "check edicts for errors" );
sv_synchthink = Cvar_Get( "sv_fast_think", "0", CVAR_ARCHIVE, "allows entities to think more often than the server framerate" );
physinfo = Cvar_Get( "@physinfo", "0", CVAR_READ_ONLY, "" ); // use ->modified value only physinfo = Cvar_Get( "@physinfo", "0", CVAR_READ_ONLY, "" ); // use ->modified value only
serverinfo = Cvar_Get( "@serverinfo", "0", CVAR_READ_ONLY, "" ); // use ->modified value only serverinfo = Cvar_Get( "@serverinfo", "0", CVAR_READ_ONLY, "" ); // use ->modified value only
public_server = Cvar_Get ("public", "0", 0, "change server type from private to public" ); public_server = Cvar_Get ("public", "0", 0, "change server type from private to public" );