01 Mar 2013
This commit is contained in:
parent
cae4942779
commit
8b4db8dd87
|
@ -41,6 +41,9 @@ typedef struct
|
|||
char size[64]; // displayed mod size
|
||||
|
||||
int gamemode;
|
||||
int nomodels; // can't select playermodel
|
||||
|
||||
int reserved[8]; // for potential expansions with backward compatibility
|
||||
} GAMEINFO;
|
||||
|
||||
#endif//GAMEINFO_H
|
|
@ -169,13 +169,6 @@ typedef struct render_api_s
|
|||
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 26
|
||||
void (*R_EntityRemoveDecals)( struct model_s *mod ); // remove all the decals from specified entity (BSP only)
|
||||
float *(*R_DecalSetupVerts)( struct decal_s *pDecal, struct msurface_s *surf, int texture, int *outCount );
|
||||
|
||||
// find in files
|
||||
char **(*GetFilesList)( const char *pattern, int *numFiles, int gamedironly );
|
||||
|
||||
// engine memory manager (permanent safe pool)
|
||||
void* (*MemAlloc)( size_t cb, const char *filename, const int fileline );
|
||||
void (*MemFree)( void *mem, const char *filename, const int fileline );
|
||||
} render_api_t;
|
||||
|
||||
// render callbacks
|
||||
|
|
|
@ -66,6 +66,7 @@ static dllfunc_t cdll_exports[] =
|
|||
{ "Demo_ReadBuffer", (void **)&clgame.dllFuncs.pfnDemo_ReadBuffer },
|
||||
{ "CAM_Think", (void **)&clgame.dllFuncs.CAM_Think },
|
||||
{ "CL_IsThirdPerson", (void **)&clgame.dllFuncs.CL_IsThirdPerson },
|
||||
{ "CL_CameraOffset", (void **)&clgame.dllFuncs.CL_CameraOffset },
|
||||
{ "CL_CreateMove", (void **)&clgame.dllFuncs.CL_CreateMove },
|
||||
{ "IN_ActivateMouse", (void **)&clgame.dllFuncs.IN_ActivateMouse },
|
||||
{ "IN_DeactivateMouse", (void **)&clgame.dllFuncs.IN_DeactivateMouse },
|
||||
|
|
|
@ -233,6 +233,7 @@ static void UI_ConvertGameInfo( GAMEINFO *out, gameinfo_t *in )
|
|||
Q_strncpy( out->date, in->date, sizeof( out->date ));
|
||||
|
||||
out->gamemode = in->gamemode;
|
||||
out->nomodels = in->nomodels;
|
||||
}
|
||||
|
||||
static qboolean PIC_Scissor( float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 )
|
||||
|
|
|
@ -342,6 +342,7 @@ typedef struct
|
|||
void *(*KB_Find)( const char *name );
|
||||
void (*CAM_Think)( void ); // camera stuff
|
||||
int (*CL_IsThirdPerson)( void );
|
||||
void (*CL_CameraOffset)( float *ofs );
|
||||
void (*CL_CreateMove)( float frametime, usercmd_t *cmd, int active );
|
||||
void (*IN_ActivateMouse)( void );
|
||||
void (*IN_DeactivateMouse)( void );
|
||||
|
|
|
@ -332,7 +332,7 @@ void R_LightForPoint( const vec3_t point, color24 *ambientLight, qboolean invLig
|
|||
model_t *pmodel;
|
||||
mnode_t *pnodes;
|
||||
|
||||
if( !RI.refdef.movevars )
|
||||
if( !cl.refdef.movevars )
|
||||
{
|
||||
ambientLight->r = 255;
|
||||
ambientLight->g = 255;
|
||||
|
@ -343,9 +343,9 @@ void R_LightForPoint( const vec3_t point, color24 *ambientLight, qboolean invLig
|
|||
// set to full bright if no light data
|
||||
if( !cl.worldmodel || !cl.worldmodel->lightdata )
|
||||
{
|
||||
ambientLight->r = TextureToTexGamma( RI.refdef.movevars->skycolor_r );
|
||||
ambientLight->g = TextureToTexGamma( RI.refdef.movevars->skycolor_g );
|
||||
ambientLight->b = TextureToTexGamma( RI.refdef.movevars->skycolor_b );
|
||||
ambientLight->r = TextureToTexGamma( cl.refdef.movevars->skycolor_r );
|
||||
ambientLight->g = TextureToTexGamma( cl.refdef.movevars->skycolor_g );
|
||||
ambientLight->b = TextureToTexGamma( cl.refdef.movevars->skycolor_b );
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -414,8 +414,11 @@ qboolean R_AddEntity( struct cl_entity_s *clent, int entityType )
|
|||
if( clent->curstate.effects & EF_NODRAW )
|
||||
return false; // done
|
||||
|
||||
if( clent->curstate.rendermode != kRenderNormal && clent->curstate.renderamt <= 0.0f )
|
||||
return true; // done
|
||||
if( clent->curstate.rendermode != kRenderNormal && clent->curstate.rendermode != kRenderTransAlpha )
|
||||
{
|
||||
if( clent->curstate.renderamt <= 0.0f )
|
||||
return true; // invisible
|
||||
}
|
||||
|
||||
clent->curstate.entityType = entityType;
|
||||
|
||||
|
@ -516,7 +519,7 @@ R_GetFarClip
|
|||
static float R_GetFarClip( void )
|
||||
{
|
||||
if( cl.worldmodel && RI.drawWorld )
|
||||
return RI.refdef.movevars->zmax * 1.5f;
|
||||
return cl.refdef.movevars->zmax * 1.5f;
|
||||
return 2048.0f;
|
||||
}
|
||||
|
||||
|
@ -780,12 +783,33 @@ R_SetupFrame
|
|||
*/
|
||||
static void R_SetupFrame( void )
|
||||
{
|
||||
vec3_t viewOrg, viewAng;
|
||||
|
||||
if( RP_NORMALPASS() && cl.thirdperson )
|
||||
{
|
||||
vec3_t cam_ofs, vpn;
|
||||
|
||||
clgame.dllFuncs.CL_CameraOffset( cam_ofs );
|
||||
|
||||
viewAng[PITCH] = cam_ofs[PITCH];
|
||||
viewAng[YAW] = cam_ofs[YAW];
|
||||
viewAng[ROLL] = 0;
|
||||
|
||||
AngleVectors( viewAng, vpn, NULL, NULL );
|
||||
VectorMA( RI.refdef.vieworg, -cam_ofs[ROLL], vpn, viewOrg );
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorCopy( RI.refdef.vieworg, viewOrg );
|
||||
VectorCopy( RI.refdef.viewangles, viewAng );
|
||||
}
|
||||
|
||||
// build the transformation matrix for the given view angles
|
||||
VectorCopy( RI.refdef.vieworg, RI.vieworg );
|
||||
AngleVectors( RI.refdef.viewangles, RI.vforward, RI.vright, RI.vup );
|
||||
VectorCopy( viewOrg, RI.vieworg );
|
||||
AngleVectors( viewAng, RI.vforward, RI.vright, RI.vup );
|
||||
|
||||
// setup viewplane dist
|
||||
RI.viewplanedist = DotProduct( RI.refdef.vieworg, RI.vforward );
|
||||
RI.viewplanedist = DotProduct( RI.vieworg, RI.vforward );
|
||||
|
||||
if( !r_lockcull->integer )
|
||||
{
|
||||
|
@ -809,7 +833,7 @@ static void R_SetupFrame( void )
|
|||
// current viewleaf
|
||||
if( RI.drawWorld )
|
||||
{
|
||||
RI.waveHeight = RI.refdef.movevars->waveHeight * 2.0f; // set global waveheight
|
||||
RI.waveHeight = cl.refdef.movevars->waveHeight * 2.0f; // set global waveheight
|
||||
RI.isSkyVisible = false; // unknown at this moment
|
||||
|
||||
if(!( RI.params & RP_OLDVIEWLEAF ))
|
||||
|
@ -1543,56 +1567,6 @@ static int GL_LoadTextureNoFilter( const char *name, const byte *buf, size_t siz
|
|||
return GL_LoadTexture( name, buf, size, flags, NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
R_GetFilesList
|
||||
|
||||
release prev search on a next call
|
||||
=========
|
||||
*/
|
||||
static char **R_GetFilesList( const char *pattern, int *numFiles, int gamedironly )
|
||||
{
|
||||
static search_t *t = NULL;
|
||||
|
||||
if( t ) Mem_Free( t ); // release prev search
|
||||
|
||||
t = FS_Search( pattern, true, gamedironly );
|
||||
|
||||
if( !t )
|
||||
{
|
||||
if( numFiles )
|
||||
*numFiles = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if( numFiles )
|
||||
*numFiles = t->numfilenames;
|
||||
|
||||
return t->filenames;
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
R_MemAlloc
|
||||
|
||||
=========
|
||||
*/
|
||||
static void *R_MemAlloc( size_t cb, const char *filename, const int fileline )
|
||||
{
|
||||
return _Mem_Alloc( cls.mempool, cb, filename, fileline );
|
||||
}
|
||||
|
||||
/*
|
||||
=========
|
||||
R_MemFree
|
||||
|
||||
=========
|
||||
*/
|
||||
static void R_MemFree( void *mem, const char *filename, const int fileline )
|
||||
{
|
||||
_Mem_Free( mem, filename, fileline );
|
||||
}
|
||||
|
||||
static render_api_t gRenderAPI =
|
||||
{
|
||||
GL_RenderGetParm,
|
||||
|
@ -1635,9 +1609,6 @@ static render_api_t gRenderAPI =
|
|||
GL_TexGen,
|
||||
R_EntityRemoveDecals,
|
||||
R_DecalSetupVerts,
|
||||
R_GetFilesList,
|
||||
R_MemAlloc,
|
||||
R_MemFree,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1649,6 +1620,9 @@ Initialize client external rendering
|
|||
*/
|
||||
qboolean R_InitRenderAPI( void )
|
||||
{
|
||||
// make sure what render functions is cleared
|
||||
Q_memset( &clgame.drawFuncs, 0, sizeof( clgame.drawFuncs ));
|
||||
|
||||
if( clgame.dllFuncs.pfnGetRenderInterface )
|
||||
{
|
||||
if( clgame.dllFuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &clgame.drawFuncs ))
|
||||
|
|
|
@ -1268,7 +1268,7 @@ void R_DrawTextureChains( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
if(( s->flags & SURF_DRAWTURB ) && RI.refdef.movevars->wateralpha < 1.0f )
|
||||
if(( s->flags & SURF_DRAWTURB ) && cl.refdef.movevars->wateralpha < 1.0f )
|
||||
continue; // draw translucent water later
|
||||
|
||||
for( ; s != NULL; s = s->texturechain )
|
||||
|
@ -1295,7 +1295,7 @@ void R_DrawWaterSurfaces( void )
|
|||
return;
|
||||
|
||||
// non-transparent water is already drawed
|
||||
if( RI.refdef.movevars->wateralpha >= 1.0f )
|
||||
if( cl.refdef.movevars->wateralpha >= 1.0f )
|
||||
return;
|
||||
|
||||
// go back to the world matrix
|
||||
|
@ -1306,7 +1306,7 @@ void R_DrawWaterSurfaces( void )
|
|||
pglDisable( GL_ALPHA_TEST );
|
||||
pglBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
|
||||
pglTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||
pglColor4f( 1.0f, 1.0f, 1.0f, RI.refdef.movevars->wateralpha );
|
||||
pglColor4f( 1.0f, 1.0f, 1.0f, cl.refdef.movevars->wateralpha );
|
||||
|
||||
for( i = 0; i < cl.worldmodel->numtextures; i++ )
|
||||
{
|
||||
|
|
|
@ -939,7 +939,6 @@ void R_DrawSpriteModel( cl_entity_t *e )
|
|||
|
||||
if( R_SpriteOccluded( e, origin, &alpha, &scale ))
|
||||
return; // sprite culled
|
||||
|
||||
r_stats.c_sprite_models_drawn++;
|
||||
|
||||
if( psprite->texFormat == SPR_ALPHTEST && e->curstate.rendermode != kRenderTransAdd )
|
||||
|
|
|
@ -1408,10 +1408,10 @@ void R_StudioGetShadowImpactAndDir( void )
|
|||
float angle;
|
||||
vec3_t skyAngles, origin, end;
|
||||
|
||||
if( !RI.refdef.movevars ) return; // e.g. in menu
|
||||
if( !cl.refdef.movevars ) return; // e.g. in menu
|
||||
|
||||
// convert skyvec into angles then back into vector to avoid 0 0 0 direction
|
||||
VectorAngles( (float *)&RI.refdef.movevars->skyvec_x, skyAngles );
|
||||
VectorAngles( (float *)&cl.refdef.movevars->skyvec_x, skyAngles );
|
||||
angle = skyAngles[YAW] / 180 * M_PI;
|
||||
|
||||
Matrix3x4_OriginFromMatrix( g_bonestransform[0], origin );
|
||||
|
@ -1460,12 +1460,12 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *lightinfo )
|
|||
else Matrix3x4_OriginFromMatrix( g_rotationmatrix, origin );
|
||||
|
||||
// setup light dir
|
||||
if( RI.refdef.movevars )
|
||||
if( cl.refdef.movevars )
|
||||
{
|
||||
// pre-defined light vector
|
||||
plight->lightvec[0] = RI.refdef.movevars->skyvec_x;
|
||||
plight->lightvec[1] = RI.refdef.movevars->skyvec_y;
|
||||
plight->lightvec[2] = RI.refdef.movevars->skyvec_z;
|
||||
plight->lightvec[0] = cl.refdef.movevars->skyvec_x;
|
||||
plight->lightvec[1] = cl.refdef.movevars->skyvec_y;
|
||||
plight->lightvec[2] = cl.refdef.movevars->skyvec_z;
|
||||
}
|
||||
else VectorSet( plight->lightvec, 0.0f, 0.0f, -1.0f );
|
||||
|
||||
|
@ -2384,9 +2384,21 @@ static model_t *R_StudioSetupPlayerModel( int index )
|
|||
info = &cl.players[index];
|
||||
}
|
||||
|
||||
// set to invisible, skip
|
||||
if( !info->model[0] ) return NULL;
|
||||
if( !Q_stricmp( info->model, "player" )) Q_strncpy( modelpath, "models/player.mdl", sizeof( modelpath ));
|
||||
else Q_snprintf( modelpath, sizeof( modelpath ), "models/player/%s/%s.mdl", info->model, info->model );
|
||||
|
||||
if( GI->nomodels || !Q_stricmp( info->model, "player" ))
|
||||
{
|
||||
Q_strncpy( modelpath, "models/player.mdl", sizeof( modelpath ));
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_snprintf( modelpath, sizeof( modelpath ), "models/player/%s/%s.mdl", info->model, info->model );
|
||||
|
||||
// replace with default if missed
|
||||
if( !FS_FileExists( modelpath, false ))
|
||||
Q_strncpy( modelpath, "models/player.mdl", sizeof( modelpath ));
|
||||
}
|
||||
|
||||
if( !FS_FileExists( modelpath, false ))
|
||||
return NULL;
|
||||
|
|
|
@ -179,6 +179,7 @@ typedef struct gameinfo_s
|
|||
|
||||
int gamemode;
|
||||
qboolean secure; // prevent to console acess
|
||||
qboolean nomodels; // don't let player to choose model (use player.mdl always)
|
||||
|
||||
char sp_entity[32]; // e.g. info_player_start
|
||||
char mp_entity[32]; // e.g. info_player_deathmatch
|
||||
|
|
|
@ -1036,6 +1036,9 @@ static qboolean FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
|
|||
if( GameInfo->secure )
|
||||
FS_Printf( f, "secure\t\t\"%i\"\n", GameInfo->secure );
|
||||
|
||||
if( GameInfo->nomodels )
|
||||
FS_Printf( f, "nomodels\t\t\"%i\"\n", GameInfo->nomodels );
|
||||
|
||||
for( i = 0; i < 4; i++ )
|
||||
{
|
||||
float *min, *max;
|
||||
|
@ -1226,6 +1229,11 @@ static qboolean FS_ParseLiblistGam( const char *filename, const char *gamedir, g
|
|||
pfile = COM_ParseFile( pfile, token );
|
||||
GameInfo->secure = Q_atoi( token );
|
||||
}
|
||||
else if( !Q_stricmp( token, "nomodels" ))
|
||||
{
|
||||
pfile = COM_ParseFile( pfile, token );
|
||||
GameInfo->nomodels = Q_atoi( token );
|
||||
}
|
||||
}
|
||||
|
||||
if( !FS_SysFolderExists( va( "%s\\%s", host.rootdir, GameInfo->gamedir )))
|
||||
|
@ -1426,6 +1434,11 @@ static qboolean FS_ParseGameInfo( const char *gamedir, gameinfo_t *GameInfo )
|
|||
pfile = COM_ParseFile( pfile, token );
|
||||
GameInfo->secure = Q_atoi( token );
|
||||
}
|
||||
else if( !Q_stricmp( token, "nomodels" ))
|
||||
{
|
||||
pfile = COM_ParseFile( pfile, token );
|
||||
GameInfo->nomodels = Q_atoi( token );
|
||||
}
|
||||
else if( !Q_strnicmp( token, "hull", 4 ))
|
||||
{
|
||||
int hullNum = Q_atoi( token + 4 );
|
||||
|
|
|
@ -2844,6 +2844,7 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
|
|||
byte *buf;
|
||||
char tempname[64];
|
||||
qboolean loaded;
|
||||
int i, j;
|
||||
|
||||
if( !mod )
|
||||
{
|
||||
|
@ -2856,9 +2857,25 @@ model_t *Mod_LoadModel( model_t *mod, qboolean crash )
|
|||
if( mod->mempool || mod->name[0] == '*' )
|
||||
return mod;
|
||||
|
||||
// store modelname to show error
|
||||
Q_strncpy( tempname, mod->name, sizeof( tempname ));
|
||||
COM_FixSlashes( tempname );
|
||||
// fix slashes and kill whitespaces
|
||||
for( i = j = 0; i < sizeof( tempname ); i++ )
|
||||
{
|
||||
if( mod->name[i] == '\\' )
|
||||
{
|
||||
// convert slashes
|
||||
tempname[j++] = '/';
|
||||
}
|
||||
else if( mod->name[i] > ' ' )
|
||||
{
|
||||
// kill whitespaces (Zion WarCry issues)
|
||||
tempname[j++] = mod->name[i];
|
||||
}
|
||||
else if( mod->name[i] == '\0' )
|
||||
{
|
||||
tempname[j] = '\0';
|
||||
break; // end of string
|
||||
}
|
||||
}
|
||||
|
||||
buf = FS_LoadFile( tempname, NULL, false );
|
||||
|
||||
|
|
|
@ -1788,12 +1788,16 @@ void SV_UserinfoChanged( sv_client_t *cl, const char *userinfo )
|
|||
const char *model = Info_ValueForKey( cl->userinfo, "model" );
|
||||
|
||||
// apply custom playermodel
|
||||
if( Q_strlen( model ) && Q_stricmp( model, "player" ))
|
||||
if( !GI->nomodels && Q_strlen( model ) && Q_stricmp( model, "player" ))
|
||||
{
|
||||
const char *path = va( "models/player/%s/%s.mdl", model, model );
|
||||
Mod_RegisterModel( path, SV_ModelIndex( path )); // register model
|
||||
SV_SetModel( ent, path );
|
||||
cl->modelindex = ent->v.modelindex;
|
||||
if( FS_FileExists( path, false ))
|
||||
{
|
||||
Mod_RegisterModel( path, SV_ModelIndex( path )); // register model
|
||||
SV_SetModel( ent, path );
|
||||
cl->modelindex = ent->v.modelindex;
|
||||
}
|
||||
else cl->modelindex = 0;
|
||||
}
|
||||
else cl->modelindex = 0;
|
||||
}
|
||||
|
|
|
@ -472,6 +472,29 @@ qboolean SV_CheckWater( edict_t *ent )
|
|||
return (ent->v.waterlevel > 1);
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
SV_CheckMover
|
||||
|
||||
test thing (applies the friction to pushables while standing on moving platform)
|
||||
=============
|
||||
*/
|
||||
qboolean SV_CheckMover( edict_t *ent )
|
||||
{
|
||||
edict_t *gnd = ent->v.groundentity;
|
||||
|
||||
if( !SV_IsValidEdict( gnd ))
|
||||
return false;
|
||||
|
||||
if( gnd->v.movetype != MOVETYPE_PUSH )
|
||||
return false;
|
||||
|
||||
if( VectorIsNull( gnd->v.velocity ) && VectorIsNull( gnd->v.avelocity ))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_ClipVelocity
|
||||
|
@ -841,7 +864,7 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime )
|
|||
sv_pushed_t *p, *pushed_p;
|
||||
edict_t *check;
|
||||
|
||||
if( sv.state == ss_loading || VectorIsNull( pusher->v.velocity ))
|
||||
if( svgame.globals->changelevel || VectorIsNull( pusher->v.velocity ))
|
||||
{
|
||||
pusher->v.ltime += movetime;
|
||||
return NULL;
|
||||
|
@ -959,7 +982,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
|
|||
vec3_t org, org2, temp;
|
||||
edict_t *check;
|
||||
|
||||
if( sv.state == ss_loading || VectorIsNull( pusher->v.avelocity ))
|
||||
if( svgame.globals->changelevel || VectorIsNull( pusher->v.avelocity ))
|
||||
{
|
||||
pusher->v.ltime += movetime;
|
||||
return NULL;
|
||||
|
@ -1032,7 +1055,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
|
|||
pushed_p++;
|
||||
|
||||
// calculate destination position
|
||||
if( check->v.movetype == MOVETYPE_PUSHSTEP )
|
||||
if( check->v.movetype == MOVETYPE_PUSHSTEP || check->v.movetype == MOVETYPE_STEP )
|
||||
VectorAverage( check->v.absmin, check->v.absmax, org );
|
||||
else VectorCopy( check->v.origin, org );
|
||||
|
||||
|
@ -1040,18 +1063,22 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
|
|||
Matrix4x4_VectorTransform( end_l, temp, org2 );
|
||||
VectorSubtract( org2, org, lmove );
|
||||
|
||||
if( check->v.movetype == MOVETYPE_PUSHSTEP && lmove[2] < 0.0f )
|
||||
// i can't clear FL_ONGROUND in all cases because many bad things may be happen
|
||||
if( check->v.movetype != MOVETYPE_WALK )
|
||||
{
|
||||
// pushable sliding
|
||||
check->v.flags &= ~FL_ONGROUND;
|
||||
lmove[2] = 0.0f;
|
||||
}
|
||||
if( lmove[2] != 0.0f ) check->v.flags &= ~FL_ONGROUND;
|
||||
if( lmove[2] < 0.0f ) lmove[2] = 0.0f; // let's the free falling
|
||||
}
|
||||
|
||||
// try moving the contacted entity
|
||||
pusher->v.solid = SOLID_NOT;
|
||||
SV_PushEntity( check, lmove, amove, &block );
|
||||
pusher->v.solid = oldsolid;
|
||||
|
||||
// pushed entity blocked by wall
|
||||
if( block && check->v.movetype != MOVETYPE_WALK )
|
||||
check->v.flags &= ~FL_ONGROUND;
|
||||
|
||||
// if it is still inside the pusher, block
|
||||
if( SV_TestEntityPosition( check, NULL ) && block )
|
||||
{
|
||||
|
@ -1087,7 +1114,6 @@ void SV_Physics_Pusher( edict_t *ent )
|
|||
{
|
||||
float oldtime, oldtime2;
|
||||
float thinktime, movetime;
|
||||
vec3_t last_origin;
|
||||
edict_t *pBlocker;
|
||||
|
||||
pBlocker = NULL;
|
||||
|
@ -1103,9 +1129,9 @@ void SV_Physics_Pusher( edict_t *ent )
|
|||
|
||||
if( movetime )
|
||||
{
|
||||
if( VectorLength2( ent->v.avelocity ) > STOP_EPSILON )
|
||||
if( !VectorIsNull( ent->v.avelocity ))
|
||||
{
|
||||
if( VectorLength2( ent->v.velocity ) > STOP_EPSILON )
|
||||
if( !VectorIsNull( ent->v.velocity ))
|
||||
{
|
||||
pBlocker = SV_PushRotate( ent, movetime );
|
||||
|
||||
|
@ -1137,23 +1163,10 @@ void SV_Physics_Pusher( edict_t *ent )
|
|||
|
||||
if( thinktime > oldtime && (( ent->v.flags & FL_ALWAYSTHINK ) || thinktime <= ent->v.ltime ))
|
||||
{
|
||||
float diff;
|
||||
|
||||
VectorCopy( ent->v.origin, last_origin );
|
||||
ent->v.nextthink = 0.0f;
|
||||
svgame.globals->time = sv.time;
|
||||
svgame.dllFuncs.pfnThink( ent );
|
||||
if( ent->free ) return;
|
||||
|
||||
diff = fabs( ent->v.origin[2] - last_origin[2] );
|
||||
|
||||
// TESTTEST: remove time glitches to prevent stuck in the trains
|
||||
if( diff > 0.0f && diff <= 0.5f )
|
||||
{
|
||||
Msg( "restore valid origin from %g to %g( %s )\n", ent->v.origin[2], last_origin[2], SV_ClassName( ent ));
|
||||
VectorCopy( last_origin, ent->v.origin );
|
||||
SV_LinkEdict( ent, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1523,6 +1536,7 @@ void SV_Physics_Step( edict_t *ent )
|
|||
{
|
||||
qboolean inwater;
|
||||
qboolean wasonground;
|
||||
qboolean wasonmover;
|
||||
vec3_t mins, maxs;
|
||||
vec3_t point;
|
||||
trace_t trace;
|
||||
|
@ -1532,6 +1546,7 @@ void SV_Physics_Step( edict_t *ent )
|
|||
SV_CheckVelocity( ent );
|
||||
|
||||
wasonground = (ent->v.flags & FL_ONGROUND);
|
||||
wasonmover = SV_CheckMover( ent );
|
||||
inwater = SV_CheckWater( ent );
|
||||
|
||||
if( ent->v.flags & FL_FLOAT && ent->v.waterlevel > 0 )
|
||||
|
@ -1552,7 +1567,7 @@ void SV_Physics_Step( edict_t *ent )
|
|||
{
|
||||
ent->v.flags &= ~FL_ONGROUND;
|
||||
|
||||
if( wasonground && ( ent->v.health > 0 || SV_CheckBottom( ent, MOVE_NORMAL )))
|
||||
if(( wasonground || wasonmover ) && ( ent->v.health > 0 || SV_CheckBottom( ent, MOVE_NORMAL )))
|
||||
{
|
||||
float *vel = ent->v.velocity;
|
||||
float control, speed, newspeed;
|
||||
|
@ -1564,6 +1579,7 @@ void SV_Physics_Step( edict_t *ent )
|
|||
{
|
||||
friction = sv_friction->value * ent->v.friction; // factor
|
||||
ent->v.friction = 1.0f; // g-cont. ???
|
||||
if( wasonmover ) friction *= 0.5f; // add a little friction
|
||||
|
||||
control = (speed < sv_stopspeed->value) ? sv_stopspeed->value : speed;
|
||||
newspeed = speed - (host.frametime * control * friction);
|
||||
|
|
|
@ -147,6 +147,9 @@ static void UI_PlayerSetup_GetConfig( void )
|
|||
}
|
||||
}
|
||||
|
||||
if( gMenu.m_gameinfo.nomodels )
|
||||
uiPlayerSetup.model.curValue = 0.0f; // force to default
|
||||
|
||||
strcpy( uiPlayerSetup.currentModel, uiPlayerSetup.models[(int)uiPlayerSetup.model.curValue] );
|
||||
uiPlayerSetup.model.maxValue = (float)(uiPlayerSetup.num_models - 1);
|
||||
|
||||
|
@ -227,7 +230,6 @@ static void UI_PlayerSetup_UpdateConfig( void )
|
|||
if( lastImage[0] && playerImage )
|
||||
{
|
||||
// release old image
|
||||
// Con_NPrintf( 1, "release %s\n", lastImage );
|
||||
PIC_Free( lastImage );
|
||||
lastImage[0] = '\0';
|
||||
playerImage = 0;
|
||||
|
@ -237,11 +239,9 @@ static void UI_PlayerSetup_UpdateConfig( void )
|
|||
{
|
||||
sprintf( lastImage, "models/player/%s/%s.bmp", name, name );
|
||||
playerImage = PIC_Load( lastImage, PIC_KEEP_8BIT ); // if present of course
|
||||
// Con_NPrintf( 2, "loading %s[%i]\n", lastImage, playerImage );
|
||||
}
|
||||
else if( lastImage[0] && playerImage )
|
||||
{
|
||||
// Con_NPrintf( 1, "release %s\n", lastImage );
|
||||
// release old image
|
||||
PIC_Free( lastImage );
|
||||
lastImage[0] = '\0';
|
||||
|
@ -338,6 +338,7 @@ UI_PlayerSetup_Init
|
|||
static void UI_PlayerSetup_Init( void )
|
||||
{
|
||||
bool game_hlRally = FALSE;
|
||||
int addFlags = 0;
|
||||
|
||||
memset( &uiPlayerSetup, 0, sizeof( uiPlayerSetup_t ));
|
||||
|
||||
|
@ -345,6 +346,9 @@ static void UI_PlayerSetup_Init( void )
|
|||
if( !stricmp( gMenu.m_gameinfo.gamefolder, "hlrally" ))
|
||||
game_hlRally = TRUE;
|
||||
|
||||
if( gMenu.m_gameinfo.nomodels )
|
||||
addFlags |= QMF_INACTIVE;
|
||||
|
||||
uiPlayerSetup.menu.vidInitFunc = UI_PlayerSetup_Init;
|
||||
|
||||
uiPlayerSetup.background.generic.id = ID_BACKGROUND;
|
||||
|
@ -409,7 +413,7 @@ static void UI_PlayerSetup_Init( void )
|
|||
|
||||
uiPlayerSetup.model.generic.id = ID_MODEL;
|
||||
uiPlayerSetup.model.generic.type = QMTYPE_SPINCONTROL;
|
||||
uiPlayerSetup.model.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW;
|
||||
uiPlayerSetup.model.generic.flags = QMF_CENTER_JUSTIFY|QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|addFlags;
|
||||
uiPlayerSetup.model.generic.x = game_hlRally ? 320 : 702;
|
||||
uiPlayerSetup.model.generic.y = game_hlRally ? 320 : 590;
|
||||
uiPlayerSetup.model.generic.width = game_hlRally ? 256 : 176;
|
||||
|
@ -422,7 +426,7 @@ static void UI_PlayerSetup_Init( void )
|
|||
|
||||
uiPlayerSetup.topColor.generic.id = ID_TOPCOLOR;
|
||||
uiPlayerSetup.topColor.generic.type = QMTYPE_SLIDER;
|
||||
uiPlayerSetup.topColor.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
|
||||
uiPlayerSetup.topColor.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW|addFlags;
|
||||
uiPlayerSetup.topColor.generic.name = "Top color";
|
||||
uiPlayerSetup.topColor.generic.x = 250;
|
||||
uiPlayerSetup.topColor.generic.y = 550;
|
||||
|
@ -435,7 +439,7 @@ static void UI_PlayerSetup_Init( void )
|
|||
|
||||
uiPlayerSetup.bottomColor.generic.id = ID_BOTTOMCOLOR;
|
||||
uiPlayerSetup.bottomColor.generic.type = QMTYPE_SLIDER;
|
||||
uiPlayerSetup.bottomColor.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW;
|
||||
uiPlayerSetup.bottomColor.generic.flags = QMF_PULSEIFFOCUS|QMF_DROPSHADOW|addFlags;
|
||||
uiPlayerSetup.bottomColor.generic.name = "Bottom color";
|
||||
uiPlayerSetup.bottomColor.generic.x = 250;
|
||||
uiPlayerSetup.bottomColor.generic.y = 620;
|
||||
|
@ -448,7 +452,7 @@ static void UI_PlayerSetup_Init( void )
|
|||
|
||||
uiPlayerSetup.showModels.generic.id = ID_SHOWMODELS;
|
||||
uiPlayerSetup.showModels.generic.type = QMTYPE_CHECKBOX;
|
||||
uiPlayerSetup.showModels.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
|
||||
uiPlayerSetup.showModels.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW|addFlags;
|
||||
uiPlayerSetup.showModels.generic.name = "Show Player Models";
|
||||
uiPlayerSetup.showModels.generic.x = 72;
|
||||
uiPlayerSetup.showModels.generic.y = 380;
|
||||
|
@ -457,7 +461,7 @@ static void UI_PlayerSetup_Init( void )
|
|||
|
||||
uiPlayerSetup.hiModels.generic.id = ID_HIMODELS;
|
||||
uiPlayerSetup.hiModels.generic.type = QMTYPE_CHECKBOX;
|
||||
uiPlayerSetup.hiModels.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW;
|
||||
uiPlayerSetup.hiModels.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_ACT_ONRELEASE|QMF_MOUSEONLY|QMF_DROPSHADOW|addFlags;
|
||||
uiPlayerSetup.hiModels.generic.name = "High quality models";
|
||||
uiPlayerSetup.hiModels.generic.x = 72;
|
||||
uiPlayerSetup.hiModels.generic.y = 430;
|
||||
|
@ -474,12 +478,15 @@ static void UI_PlayerSetup_Init( void )
|
|||
if( game_hlRally == FALSE )
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.view );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.name );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.model );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.topColor );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.bottomColor );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.showModels );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.hiModels );
|
||||
|
||||
if( !gMenu.m_gameinfo.nomodels )
|
||||
{
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.model );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.topColor );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.bottomColor );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.showModels );
|
||||
UI_AddItem( &uiPlayerSetup.menu, (void *)&uiPlayerSetup.hiModels );
|
||||
}
|
||||
// setup render and actor
|
||||
uiPlayerSetup.refdef.fov_x = 40;
|
||||
|
||||
|
|
|
@ -63,5 +63,12 @@ int GetMenuAPI( UI_FUNCTIONS *pFunctionTable, ui_enginefuncs_t* pEngfuncsFromEng
|
|||
|
||||
gpGlobals = pGlobals;
|
||||
|
||||
if( (int)CVAR_GET_FLOAT( "build" ) < 2213 )
|
||||
{
|
||||
Con_Printf( "^1Error:^7 using too old engine version. menu.dll will not loaded.\n" );
|
||||
Con_Printf( "^1Error:^7 you need at least engine build 2213 or above.\n" );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
Reference in New Issue