From 7143afc2844a334a53e099d036d69bfafd94f530 Mon Sep 17 00:00:00 2001 From: g-cont Date: Mon, 27 Dec 2010 00:00:00 +0300 Subject: [PATCH] 27 Dec 2010 --- engine/client/cl_main.c | 2 +- engine/client/gl_rmath.c | 2 +- engine/server/sv_client.c | 4 +- engine/server/sv_cmds.c | 2 + engine/server/sv_game.c | 6 +++ engine/server/sv_phys.c | 99 ++++++++++++++++++++++++++++++++++++++- launch/library.c | 13 +++-- vid_gl/r_math.c | 2 +- 8 files changed, 122 insertions(+), 8 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 17acd3b1..a59d4552 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -1595,7 +1595,7 @@ void CL_Init( void ) S_Init(); // init sound if( !CL_LoadProgs( va( "%s/client.dll", GI->dll_path ))) - Host_Error( "CL_InitGame: can't initialize client.dll\n" ); + Host_Error( "can't initialize client.dll\n" ); cls.initialized = true; diff --git a/engine/client/gl_rmath.c b/engine/client/gl_rmath.c index 31cc74c4..a3a087b1 100644 --- a/engine/client/gl_rmath.c +++ b/engine/client/gl_rmath.c @@ -77,7 +77,7 @@ float V_CalcFov( float *fov_x, float width, float height ) { float x, half_fov_y; - if( *fov_x < 1 || *fov_x > 179 ) + if( *fov_x < 1 || *fov_x > 170 ) { MsgDev( D_ERROR, "V_CalcFov: bad fov %g!\n", *fov_x ); *fov_x = 90; diff --git a/engine/server/sv_client.c b/engine/server/sv_client.c index eabd5f07..006dd21f 100644 --- a/engine/server/sv_client.c +++ b/engine/server/sv_client.c @@ -1653,6 +1653,8 @@ ucmd_t ucmds[] = { "download", SV_BeginDownload_f }, { "userinfo", SV_UpdateUserinfo_f }, { "lightstyles", SV_WriteLightstyles_f }, +{ "lightgamma", NULL }, // FIXME: make cvars +{ "direct", NULL }, { NULL, NULL } }; @@ -1671,7 +1673,7 @@ void SV_ExecuteClientCommand( sv_client_t *cl, char *s ) if( !com.strcmp( Cmd_Argv( 0 ), u->name )) { MsgDev( D_NOTE, "ucmd->%s()\n", u->name ); - u->func( cl ); + if( u->func ) u->func( cl ); break; } } diff --git a/engine/server/sv_cmds.c b/engine/server/sv_cmds.c index e1a2bf95..3860f18f 100644 --- a/engine/server/sv_cmds.c +++ b/engine/server/sv_cmds.c @@ -493,7 +493,9 @@ SV_Kill_f */ void SV_Kill_f( void ) { + if( !Cvar_VariableInteger( "sv_cheats" )) return; if( !SV_SetPlayer()) return; + if( sv_client->edict->v.health <= 0.0f ) { SV_ClientPrintf( sv_client, PRINT_HIGH, "Can't suicide -- allready dead!\n"); diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index b691e2e9..2b33736f 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -1480,7 +1480,13 @@ int pfnDropToFloor( edict_t* e ) VectorCopy( e->v.origin, end ); end[2] -= 256; +#if 1 + if( e->v.solid == SOLID_TRIGGER || e->v.solid == SOLID_NOT ) + trace = SV_Move( e->v.origin, vec3_origin, vec3_origin, end, MOVE_NOMONSTERS, e ); + else trace = SV_Move( e->v.origin, e->v.mins, e->v.maxs, end, MOVE_NORMAL, e ); +#else trace = SV_Move( e->v.origin, e->v.mins, e->v.maxs, end, MOVE_NORMAL, e ); +#endif if( trace.allsolid ) return -1; diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 2217d680..4a8ec757 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -562,7 +562,11 @@ trace_t SV_PushEntity( edict_t *ent, const vec3_t lpush, const vec3_t apush, int type = MOVE_NOMONSTERS; // only clip against bmodels else type = MOVE_NORMAL; - trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, end, type, ent ); + // prevent items and ammo to stuck at spawnpoint + if( ent->v.solid == SOLID_TRIGGER || ent->v.solid == SOLID_NOT ) + 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 ); + if( !trace.allsolid && !trace.startsolid ) { VectorCopy( trace.endpos, ent->v.origin ); @@ -620,6 +624,99 @@ static qboolean SV_CanBlock( edict_t *ent ) return true; } +static qboolean SV_AllowToPush( edict_t *check, edict_t *pusher, const vec3_t mins, const vec3_t maxs ) +{ + int oldsolid, block; + + if( !SV_IsValidEdict( check ) || check->v.flags & FL_KILLME ) + return false; + + // filter movetypes to collide with + if( !SV_CanPushed( check )) + return false; + + oldsolid = pusher->v.solid; + pusher->v.solid = SOLID_NOT; + block = SV_TestEntityPosition( check ); + pusher->v.solid = oldsolid; + if( block ) return false; + + // if the entity is standing on the pusher, it will definately be moved + if( !(( check->v.flags & FL_ONGROUND ) && check->v.groundentity == pusher )) + { + if( check->v.absmin[0] >= maxs[0] + || check->v.absmin[1] >= maxs[1] + || check->v.absmin[2] >= maxs[2] + || check->v.absmax[0] <= mins[0] + || check->v.absmax[1] <= mins[1] + || check->v.absmax[2] <= mins[2] ) + return false; + + // see if the ent's bbox is inside the pusher's final position + if( !SV_TestEntityPosition( check )) + return false; + } + + // all tests are passed + return true; +} + +/* +============ +SV_BuildPushList + +build the list of all entities which contacted with pusher +============ +*/ +sv_pushed_t *SV_BuildPushList( edict_t *pusher, int *numpushed, const vec3_t mins, const vec3_t maxs ) +{ + sv_pushed_t *pushed_p; + edict_t *check; + int e; + + // first entry always reseved by pusher + pushed_p = svgame.pushed + 1; + + // now add all non-player entities + for( e = svgame.globals->maxClients + 1; e < svgame.numEntities; e++ ) + { + check = EDICT_NUM( e ); + + if( !SV_AllowToPush( check, pusher, mins, maxs )) + continue; + + // remove the onground flag for non-players + if( check->v.movetype != MOVETYPE_WALK ) + check->v.flags &= ~FL_ONGROUND; + + // save original position of contacted entity + pushed_p->ent = check; + VectorCopy( check->v.origin, pushed_p->origin ); + VectorCopy( check->v.angles, pushed_p->angles ); + pushed_p++; + } + + // add all player entities (must be last) + // now add all non-player entities + for( e = 1; e < svgame.globals->maxClients + 1; e++ ) + { + check = EDICT_NUM( e ); + + if( !SV_AllowToPush( check, pusher, mins, maxs )) + continue; + + // save original position of contacted entity + pushed_p->ent = check; + VectorCopy( check->v.origin, pushed_p->origin ); + VectorCopy( check->v.angles, pushed_p->angles ); + pushed_p++; + } + + if( numpushed ) *numpushed = pushed_p - svgame.pushed; + + return svgame.pushed; +} + /* ============ SV_PushMove diff --git a/launch/library.c b/launch/library.c index 8ed95faa..1d512978 100644 --- a/launch/library.c +++ b/launch/library.c @@ -619,16 +619,23 @@ static void *DecryptImage( byte *data, size_t size ) void *MemoryLoadLibrary( const char *name, qboolean encrypted ) { - MEMORYMODULE *result; PIMAGE_DOS_HEADER dos_header; PIMAGE_NT_HEADERS old_header; + MEMORYMODULE *result = NULL; byte *code, *headers; DWORD locationDelta; DllEntryProc DllEntry; string errorstring; qboolean successfull; void *data = NULL; - size_t size; + size_t size = 0; + + if( encrypted ) + { + // encypted dll support is disabled for now (doesn't working properly) + com.sprintf( errorstring, "couldn't load encrypted library %s", name ); + goto library_error; + } data = FS_LoadFile( name, &size ); if( !data ) @@ -732,7 +739,7 @@ library_error: // cleanup if( data ) Mem_Free( data ); MemoryFreeLibrary( result ); - MsgDev( D_ERROR, "LoadLibrary: %s\n", errorstring ); + MsgDev( D_ERROR, "%s\n", errorstring ); return NULL; } diff --git a/vid_gl/r_math.c b/vid_gl/r_math.c index c77ac239..4c4725e3 100644 --- a/vid_gl/r_math.c +++ b/vid_gl/r_math.c @@ -33,7 +33,7 @@ float CalcFov( float fov_x, float width, float height ) { float x, half_fov_y; - if( fov_x < 1 || fov_x > 179 ) + if( fov_x < 1 || fov_x > 170 ) { MsgDev( D_ERROR, "CalcFov: bad fov %g!\n", fov_x ); fov_x = 90;