27 Dec 2010

This commit is contained in:
g-cont 2010-12-27 00:00:00 +03:00 committed by Alibek Omarov
parent 0a5a5bb302
commit 7143afc284
8 changed files with 122 additions and 8 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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");

View File

@ -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;

View File

@ -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

View File

@ -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;
}

View File

@ -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;