07 Jan 2011

This commit is contained in:
g-cont 2011-01-07 00:00:00 +03:00 committed by Alibek Omarov
parent 5eb8b0932a
commit e24679f749
12 changed files with 76 additions and 1586 deletions

View File

@ -1,3 +1,7 @@
build 1430
Engine: fix crash with invalid room_type set (more than 60)
Engine: fix stuck on elevators or tracktrains for clients
build 1428 build 1428
Engine: fix trigger_camera serialization bug Engine: fix trigger_camera serialization bug

View File

@ -705,6 +705,9 @@ void R_DrawEntitiesOnList( void )
// don't fogging translucent surfaces // don't fogging translucent surfaces
pglDisable( GL_FOG ); pglDisable( GL_FOG );
CL_DrawBeams( true );
CL_DrawParticles();
// then draw translicent entities // then draw translicent entities
for( i = 0; i < tr.num_trans_entities; i++ ) for( i = 0; i < tr.num_trans_entities; i++ )
{ {
@ -733,9 +736,6 @@ void R_DrawEntitiesOnList( void )
} }
} }
CL_DrawBeams( true );
CL_DrawParticles();
clgame.dllFuncs.pfnDrawTransparentTriangles (); clgame.dllFuncs.pfnDrawTransparentTriangles ();
// FIXME: allow to brush and sprite viewmodel ? // FIXME: allow to brush and sprite viewmodel ?

View File

@ -1099,7 +1099,7 @@ void CL_BulletImpactParticles( const vec3_t org )
CL_SparkleTracer( pos, dir ); CL_SparkleTracer( pos, dir );
} }
for( i = 0; i < 25; i++ ) for( i = 0; i < 12; i++ )
{ {
p = CL_AllocParticle( NULL ); p = CL_AllocParticle( NULL );
if( !p ) return; if( !p ) return;
@ -1107,14 +1107,11 @@ void CL_BulletImpactParticles( const vec3_t org )
p->die += 2.0f; p->die += 2.0f;
p->color = 0; // black p->color = 0; // black
if( i & 1 ) p->type = pt_grav;
for( j = 0; j < 3; j++ )
{ {
p->type = pt_grav; p->org[j] = org[j] + Com_RandomFloat( -2.0f, 3.0f );
for( j = 0; j < 3; j++ ) p->vel[j] = Com_RandomFloat( -70.0f, 70.0f );
{
p->org[j] = org[j] + Com_RandomFloat( -2.0f, 3.0f );
p->vel[j] = Com_RandomFloat( -70.0f, 70.0f );
}
} }
} }
} }

View File

@ -0,0 +1,7 @@
void DSP_InitAll( void ); // initalize
void DSP_FreeAll( void ); // shutdown
void DSP_ClearState( void ); // same as VidInit
int DSP_Alloc( int ipset, float xfade, int cchan ); // alloc
void DSP_SetPreset( int idsp, int ipsetnew ); // set preset
void DSP_Process( int idsp, portable_samplepair_t *pbfront, int sampleCount ); // process
void DSP_Free( int idsp ); // free

View File

@ -711,8 +711,8 @@ void FLT_Design_Cheb( int Nmax, float cutoff, float ftype, float qwidth, int *pM
Wstop = tan( M_PI * fstop / fs ); Wstop = tan( M_PI * fstop / fs );
Wstop = pow( Wstop, s ); Wstop = pow( Wstop, s );
epass = com.sqrt( pow( 10, Apass/10 ) - 1 ); epass = com.sqrt( pow( (float)10.0f, (float)Apass/10.0f ) - 1 );
estop = com.sqrt( pow( 10, Astop/10 ) - 1 ); estop = com.sqrt( pow( (float)10.0f, (float)Astop/10.0f ) - 1 );
// calculate filter order N // calculate filter order N
@ -4361,7 +4361,7 @@ pset_t psettemplates[] =
// number of presets currently defined above // number of presets currently defined above
#define CPSETTEMPLATES (sizeof( psets ) / sizeof( pset_t )) #define CPSETTEMPLATES 60 //(sizeof( psets ) / sizeof( pset_t ))
// init a preset - just clear state array // init a preset - just clear state array
void PSET_Init( pset_t *ppset ) void PSET_Init( pset_t *ppset )
@ -4892,11 +4892,6 @@ void DSP_InitAll( void )
for( idsp = 0; idsp < CDSPS; idsp++ ) for( idsp = 0; idsp < CDSPS; idsp++ )
DSP_Init( idsp ); DSP_Init( idsp );
// initialize DSP cvars
dsp_room = Cvar_Get( "dsp_room", "0", 0, "room dsp preset - sounds more distant from player (1ch)" );
dsp_room_type = Cvar_Get( "room_type", "0", 0, "duplicate for dsp_room cvar for backward compatibility" );
dsp_stereo = Cvar_Get( "dsp_stereo", "0", 0, "set to 1 for true stereo processing. 2x perf hits" );
} }
// free all resources associated with dsp - called once, during engine shutdown // free all resources associated with dsp - called once, during engine shutdown
@ -5392,6 +5387,11 @@ qboolean AllocDsps( void )
idsp_room = -1.0; idsp_room = -1.0;
// initialize DSP cvars
dsp_room = Cvar_Get( "dsp_room", "0", 0, "room dsp preset - sounds more distant from player (1ch)" );
dsp_room_type = Cvar_Get( "room_type", "0", 0, "duplicate for dsp_room cvar for backward compatibility" );
dsp_stereo = Cvar_Get( "dsp_stereo", "0", 0, "set to 1 for true stereo processing. 2x perf hits" );
// alloc dsp room channel (mono, stereo if dsp_stereo is 1) // alloc dsp room channel (mono, stereo if dsp_stereo is 1)
// dsp room is mono, 300ms fade time // dsp room is mono, 300ms fade time

View File

@ -93,8 +93,7 @@ void World_MoveBounds( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_
trace_t World_CombineTraces( trace_t *cliptrace, trace_t *trace, edict_t *touch ) trace_t World_CombineTraces( trace_t *cliptrace, trace_t *trace, edict_t *touch )
{ {
// g-cont. needs for global test!!! if( trace->allsolid || trace->fraction < cliptrace->fraction )
if( trace->allsolid || /*trace->startsolid ||*/ trace->fraction < cliptrace->fraction )
{ {
trace->ent = touch; trace->ent = touch;

View File

@ -34,6 +34,7 @@ extern int SV_UPDATE_BACKUP;
#define MAP_IS_EXIST BIT( 0 ) #define MAP_IS_EXIST BIT( 0 )
#define MAP_HAS_SPAWNPOINT BIT( 1 ) #define MAP_HAS_SPAWNPOINT BIT( 1 )
#define MAP_HAS_LANDMARK BIT( 2 ) #define MAP_HAS_LANDMARK BIT( 2 )
#define MAP_INVALID_VERSION BIT( 3 )
#define EDICT_FROM_AREA( l ) STRUCT_FROM_LINK( l, edict_t, area ) #define EDICT_FROM_AREA( l ) STRUCT_FROM_LINK( l, edict_t, area )
#define NUM_FOR_EDICT(e) ((int)((edict_t *)(e) - svgame.edicts)) #define NUM_FOR_EDICT(e) ((int)((edict_t *)(e) - svgame.edicts))

View File

@ -219,6 +219,12 @@ void SV_Map_f( void )
flags = SV_MapIsValid( mapname, spawn_entity, NULL ); flags = SV_MapIsValid( mapname, spawn_entity, NULL );
if( flags & MAP_INVALID_VERSION )
{
Msg( "SV_NewMap: map %s is invalid or not supported\n", mapname );
return;
}
if(!( flags & MAP_IS_EXIST )) if(!( flags & MAP_IS_EXIST ))
{ {
Msg( "SV_NewMap: map %s doesn't exist\n", mapname ); Msg( "SV_NewMap: map %s doesn't exist\n", mapname );
@ -380,6 +386,12 @@ void SV_ChangeLevel_f( void )
flags = SV_MapIsValid( mapname, spawn_entity, Cmd_Argv( 2 )); flags = SV_MapIsValid( mapname, spawn_entity, Cmd_Argv( 2 ));
if( flags & MAP_INVALID_VERSION )
{
Msg( "SV_ChangeLevel: map %s is invalid or not supported\n", mapname );
return;
}
if(!( flags & MAP_IS_EXIST )) if(!( flags & MAP_IS_EXIST ))
{ {
Msg( "SV_ChangeLevel: map %s doesn't exist\n", mapname ); Msg( "SV_ChangeLevel: map %s doesn't exist\n", mapname );

View File

@ -481,7 +481,7 @@ void SV_WriteEntityPatch( const char *filename )
FS_Close( f ); FS_Close( f );
} }
script_t *SV_GetEntityScript( const char *filename ) script_t *SV_GetEntityScript( const char *filename, int *flags )
{ {
file_t *f; file_t *f;
dheader_t *header; dheader_t *header;
@ -490,10 +490,14 @@ script_t *SV_GetEntityScript( const char *filename )
int ver = -1, lumpofs = 0, lumplen = 0; int ver = -1, lumpofs = 0, lumplen = 0;
byte buf[MAX_SYSPATH]; // 1 kb byte buf[MAX_SYSPATH]; // 1 kb
qboolean result = false; qboolean result = false;
ASSERT( flags != NULL );
f = FS_Open( va( "maps/%s.bsp", filename ), "rb" ); f = FS_Open( va( "maps/%s.bsp", filename ), "rb" );
if( !f ) return NULL; if( !f ) return NULL;
*flags |= MAP_IS_EXIST;
Mem_Set( buf, 0, MAX_SYSPATH ); Mem_Set( buf, 0, MAX_SYSPATH );
FS_Read( f, buf, MAX_SYSPATH ); FS_Read( f, buf, MAX_SYSPATH );
ver = *(uint *)buf; ver = *(uint *)buf;
@ -515,6 +519,7 @@ script_t *SV_GetEntityScript( const char *filename )
} }
break; break;
default: default:
*flags |= MAP_INVALID_VERSION;
FS_Close( f ); FS_Close( f );
return NULL; return NULL;
} }
@ -543,7 +548,7 @@ int SV_MapIsValid( const char *filename, const char *spawn_entity, const char *l
script_t *ents = NULL; script_t *ents = NULL;
int flags = 0; int flags = 0;
ents = SV_GetEntityScript( filename ); ents = SV_GetEntityScript( filename, &flags );
if( ents ) if( ents )
{ {
@ -559,11 +564,9 @@ int SV_MapIsValid( const char *filename, const char *spawn_entity, const char *l
Com_CloseScript( ents ); Com_CloseScript( ents );
// skip spawnpoint checks in devmode // skip spawnpoint checks in devmode
return (MAP_IS_EXIST|MAP_HAS_SPAWNPOINT); return (flags|MAP_HAS_SPAWNPOINT);
} }
flags |= MAP_IS_EXIST; // map is exist
while( Com_ReadToken( ents, SC_ALLOW_NEWLINES|SC_ALLOW_PATHNAMES2, &token )) while( Com_ReadToken( ents, SC_ALLOW_NEWLINES|SC_ALLOW_PATHNAMES2, &token ))
{ {
if( !com.strcmp( token.string, "classname" )) if( !com.strcmp( token.string, "classname" ))

View File

@ -511,6 +511,12 @@ void SV_AddGravity( edict_t *ent )
SV_CheckVelocity( ent ); SV_CheckVelocity( ent );
} }
/*
============
SV_AddHalfGravity
============
*/
void SV_AddHalfGravity( edict_t *ent, float timestep ) void SV_AddHalfGravity( edict_t *ent, float timestep )
{ {
float ent_gravity; float ent_gravity;
@ -562,8 +568,7 @@ trace_t SV_PushEntity( edict_t *ent, const vec3_t lpush, const vec3_t apush, int
trace = SV_Move( ent->v.origin, vec3_origin, vec3_origin, end, type, ent ); trace = SV_Move( ent->v.origin, vec3_origin, vec3_origin, end, type, ent );
else trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, end, type, ent ); else trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, end, type, ent );
// g-cont. needs for global test!!! if( !trace.allsolid )
if( !trace.allsolid )//&& !trace.startsolid )
{ {
VectorCopy( trace.endpos, ent->v.origin ); VectorCopy( trace.endpos, ent->v.origin );
SV_LinkEdict( ent, true ); SV_LinkEdict( ent, true );
@ -805,10 +810,8 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime )
pusher->v.solid = oldsolid; pusher->v.solid = oldsolid;
// if it is still inside the pusher, block // if it is still inside the pusher, block
if( SV_TestEntityPosition( check )) if( SV_TestEntityPosition( check ) && block )
{ {
if( !block ) continue;
if( !SV_CanBlock( check )) if( !SV_CanBlock( check ))
continue; continue;
@ -829,7 +832,6 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime )
{ {
if( check->v.movetype == MOVETYPE_WALK && lmove[2] < 0.0f ) if( check->v.movetype == MOVETYPE_WALK && lmove[2] < 0.0f )
check->v.groundentity = NULL; check->v.groundentity = NULL;
pushed_p--;
continue; continue;
} }
} }
@ -923,8 +925,17 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
// calculate destination position // calculate destination position
VectorCopy( check->v.origin, org ); VectorCopy( check->v.origin, org );
Matrix4x4_VectorTransform( start_l, org, temp );
Matrix4x4_VectorTransform( end_l, temp, org2 ); if( check->v.movetype == MOVETYPE_PUSHSTEP )
{
Matrix4x4_VectorITransform( start_l, org, temp );
Matrix4x4_VectorITransform( end_l, temp, org2 );
}
else
{
Matrix4x4_VectorTransform( start_l, org, temp );
Matrix4x4_VectorTransform( end_l, temp, org2 );
}
VectorSubtract( org2, org, lmove ); VectorSubtract( org2, org, lmove );
// try moving the contacted entity // try moving the contacted entity
@ -933,10 +944,8 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
pusher->v.solid = oldsolid; pusher->v.solid = oldsolid;
// if it is still inside the pusher, block // if it is still inside the pusher, block
if( SV_TestEntityPosition( check )) if( SV_TestEntityPosition( check ) && block )
{ {
if( !block ) continue;
if( !SV_CanBlock( check )) if( !SV_CanBlock( check ))
continue; continue;
@ -957,7 +966,6 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
else else
{ {
SV_AngularMove( check, movetime, pusher->v.friction ); SV_AngularMove( check, movetime, pusher->v.friction );
pushed_p--; // moved ok
} }
} }
return NULL; return NULL;
@ -1018,11 +1026,7 @@ void SV_Physics_Pusher( edict_t *ent )
// if the pusher has a "blocked" function, call it // if the pusher has a "blocked" function, call it
// otherwise, just stay in place until the obstacle is gone // otherwise, just stay in place until the obstacle is gone
if( pBlocker ) if( pBlocker ) svgame.dllFuncs.pfnBlocked( ent, pBlocker );
{
MsgDev( D_INFO, "%s is blocked by %s\n", SV_ClassName( ent ), SV_ClassName( pBlocker ));
svgame.dllFuncs.pfnBlocked( ent, pBlocker );
}
if( thinktime > oldtime && thinktime <= ent->v.ltime || ( ent->v.flags & FL_ALWAYSTHINK )) if( thinktime > oldtime && thinktime <= ent->v.ltime || ( ent->v.flags & FL_ALWAYSTHINK ))
{ {
@ -1206,7 +1210,7 @@ void SV_Physics_Toss( edict_t *ent )
SV_CheckWaterTransition( ent ); SV_CheckWaterTransition( ent );
SV_CheckWater( ent ); SV_CheckWater( ent );
if( ent->v.velocity[2] > DIST_EPSILON ) if( ent->v.velocity[2] > DIST_EPSILON || svgame.globals->changelevel )
{ {
ent->v.flags &= ~FL_ONGROUND; ent->v.flags &= ~FL_ONGROUND;
ent->v.groundentity = NULL; ent->v.groundentity = NULL;
@ -1260,6 +1264,7 @@ void SV_Physics_Toss( edict_t *ent )
SV_CheckVelocity( ent ); SV_CheckVelocity( ent );
// make sure what we don't collide with like entity (e.g. gib with gib) // make sure what we don't collide with like entity (e.g. gib with gib)
#if 0
if( trace.allsolid && SV_IsValidEdict( trace.ent ) && trace.ent->v.movetype != ent->v.movetype ) if( trace.allsolid && SV_IsValidEdict( trace.ent ) && trace.ent->v.movetype != ent->v.movetype )
{ {
if( trace.ent->v.flags & (FL_CLIENT|FL_FAKECLIENT)) if( trace.ent->v.flags & (FL_CLIENT|FL_FAKECLIENT))
@ -1279,7 +1284,7 @@ void SV_Physics_Toss( edict_t *ent )
return; return;
} }
} }
#endif
if( trace.fraction == 1.0f ) if( trace.fraction == 1.0f )
{ {
SV_CheckWater( ent ); SV_CheckWater( ent );
@ -1370,9 +1375,7 @@ void SV_Physics_Step( edict_t *ent )
if( ent->v.movetype == MOVETYPE_PUSHSTEP ) if( ent->v.movetype == MOVETYPE_PUSHSTEP )
{ {
if( wasinwater && !inwater ) if( wasinwater && !inwater )
{
ent->v.velocity[2] = 0.0f; ent->v.velocity[2] = 0.0f;
}
if( inwater && ( ent->v.flags & FL_FLOAT )) if( inwater && ( ent->v.flags & FL_FLOAT ))
{ {
@ -1526,7 +1529,6 @@ void SV_Physics_None( edict_t *ent )
SV_RunThink( ent ); SV_RunThink( ent );
} }
//============================================================================ //============================================================================
static void SV_Physics_Client( edict_t *ent ) static void SV_Physics_Client( edict_t *ent )
{ {
@ -1645,11 +1647,11 @@ void SV_Physics( void )
edict_t *ent; edict_t *ent;
int i; int i;
SV_CheckAllEnts ();
// let the progs know that a new frame has started // let the progs know that a new frame has started
svgame.dllFuncs.pfnStartFrame(); svgame.dllFuncs.pfnStartFrame();
SV_CheckAllEnts ();
// treat each object in turn // treat each object in turn
if( !( sv.hostflags & SVF_PLAYERSONLY )) if( !( sv.hostflags & SVF_PLAYERSONLY ))
{ {

View File

@ -256,7 +256,7 @@ hull_t *SV_HullForBsp( edict_t *ent, const vec3_t mins, const vec3_t maxs, float
// calculate an offset value to center the origin // calculate an offset value to center the origin
// NOTE: never get offset of drawing hull // NOTE: never get offset of drawing hull
if( !hullNumber ) VectorCopy( hull->clip_mins, offset ); if( !hullNumber ) VectorCopy( hull->clip_mins, offset );
else VectorSubtract( hull->clip_mins, mins, offset ); else VectorSubtract( hull->clip_mins, mins, offset );
#else #else
if( size[0] <= 8.0f ) if( size[0] <= 8.0f )
{ {

File diff suppressed because it is too large Load Diff