27 Nov 2009

This commit is contained in:
g-cont 2009-11-27 00:00:00 +03:00 committed by Alibek Omarov
parent 3c895daa62
commit 6e12452e18
32 changed files with 1313 additions and 390 deletions

16
baserc/baserc.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: baserc - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
baserc.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

66
client/client.plg Normal file
View File

@ -0,0 +1,66 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: client - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP5ABA.tmp" with contents
[
/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../common" /I "global" /I "hud" /I "../pm_shared" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\client\!debug/" /Fo"..\temp\client\!debug/" /Fd"..\temp\client\!debug/" /FD /c
"D:\Xash3D\src_main\client\global\view.cpp"
]
Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP5ABA.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP5ABB.tmp" with contents
[
msvcrtd.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\temp\client\!debug/client.pdb" /debug /machine:I386 /nodefaultlib:"libc.lib" /def:".\client.def" /out:"..\temp\client\!debug/client.dll" /implib:"..\temp\client\!debug/client.lib" /pdbtype:sept /libpath:"..\common\libs"
"\Xash3D\src_main\temp\client\!debug\dll_int.obj"
"\Xash3D\src_main\temp\client\!debug\hud.obj"
"\Xash3D\src_main\temp\client\!debug\hud_ammo.obj"
"\Xash3D\src_main\temp\client\!debug\hud_ammohistory.obj"
"\Xash3D\src_main\temp\client\!debug\hud_battery.obj"
"\Xash3D\src_main\temp\client\!debug\hud_death.obj"
"\Xash3D\src_main\temp\client\!debug\hud_flashlight.obj"
"\Xash3D\src_main\temp\client\!debug\hud_geiger.obj"
"\Xash3D\src_main\temp\client\!debug\hud_health.obj"
"\Xash3D\src_main\temp\client\!debug\hud_icons.obj"
"\Xash3D\src_main\temp\client\!debug\hud_menu.obj"
"\Xash3D\src_main\temp\client\!debug\hud_message.obj"
"\Xash3D\src_main\temp\client\!debug\hud_motd.obj"
"\Xash3D\src_main\temp\client\!debug\hud_msg.obj"
"\Xash3D\src_main\temp\client\!debug\hud_saytext.obj"
"\Xash3D\src_main\temp\client\!debug\hud_scoreboard.obj"
"\Xash3D\src_main\temp\client\!debug\hud_sound.obj"
"\Xash3D\src_main\temp\client\!debug\hud_statusbar.obj"
"\Xash3D\src_main\temp\client\!debug\hud_text.obj"
"\Xash3D\src_main\temp\client\!debug\hud_train.obj"
"\Xash3D\src_main\temp\client\!debug\hud_warhead.obj"
"\Xash3D\src_main\temp\client\!debug\hud_zoom.obj"
"\Xash3D\src_main\temp\client\!debug\r_particle.obj"
"\Xash3D\src_main\temp\client\!debug\tempents.obj"
"\Xash3D\src_main\temp\client\!debug\triapi.obj"
"\Xash3D\src_main\temp\client\!debug\utils.obj"
"\Xash3D\src_main\temp\client\!debug\view.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP5ABB.tmp""
Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP5ABC.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\client\!debug\client.dll "D:\Xash3D\bin\client.dll"
]
Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP5ABC.bat""
Compiling...
view.cpp
Linking...
<h3>Output Window</h3>
Performing Custom Build Step on \Xash3D\src_main\temp\client\!debug\client.dll
‘ª®¯¨à®¢ ­® ä ©«®¢: 1.
<h3>Results</h3>
client.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -738,7 +738,7 @@ float V_CalcWaterLevel( ref_params_t *pparams )
TraceResult tr;
Vector point;
TRACE_HULL( pparams->simorg, Vector(-16,-16,-24), Vector(16,16,32), pparams->simorg, 1, GetLocalPlayer(), &tr );
TRACE_HULL( pparams->simorg, pparams->simorg, 1, 1, GetLocalPlayer(), &tr );
if( tr.pHit && !stricmp( STRING( tr.pHit->v.classname ), "func_water" ))
waterDist += ( tr.pHit->v.scale * 16 );

16
cms_qf/cms_qf.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: cms_qf - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
cms_qf.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

16
cms_xr/cms_xr.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: cms_xr - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
cms_xr.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -17,6 +17,7 @@ typedef void (*pfnEventHook)( struct event_args_s *args );
#include "trace_def.h"
#include "event_api.h"
#include "pm_shared.h"
#define SCRINFO_VIRTUALSPACE 1
@ -169,7 +170,7 @@ typedef struct cl_enginefuncs_s
int (*pfnPointContents)( const float *rgflVector );
void (*pfnTraceLine)( const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
void (*pfnTraceToss)( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr );
void (*pfnTraceHull)( const float *v1, const float *mins, const float *maxs, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
void (*pfnTraceHull)( const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr );
void (*pfnTraceModel)( const float *v1, const float *v2, edict_t *pent, TraceResult *ptr );
const char *(*pfnTraceTexture)( edict_t *pTextureEntity, const float *v1, const float *v2 );

View File

@ -555,7 +555,7 @@ void CL_FindExplosionPlane( const vec3_t origin, float radius, vec3_t result )
{
VectorMA( origin, radius, planes[i], point );
trace = CL_Trace( origin, vec3_origin, vec3_origin, point, MOVE_WORLDONLY, NULL, MASK_SOLID );
trace = CL_Move( origin, vec3_origin, vec3_origin, point, MOVE_WORLDONLY, NULL );
if( trace.fAllSolid || trace.flFraction == 1.0f )
continue;
@ -739,6 +739,7 @@ CL_AddParticles
*/
void CL_AddParticles( void )
{
edict_t *player;
cparticle_t *p, *next;
cparticle_t *active = NULL, *tail = NULL;
rgba_t modulate;
@ -752,8 +753,9 @@ void CL_AddParticles( void )
if( !cl_particles->integer ) return;
if( EDICT_NUM( cl.frame.ps.number )->pvClientData->current.gravity != 0 )
gravity = EDICT_NUM( cl.frame.ps.number )->pvClientData->current.gravity / clgame.movevars.gravity;
player = CL_GetLocalPlayer();
if( player->v.gravity != 0.0f )
gravity = player->v.gravity / clgame.movevars.gravity;
else gravity = 1.0f;
for( p = cl_active_particles; p; p = next )
@ -847,13 +849,13 @@ void CL_AddParticles( void )
if( p->flags & PARTICLE_BOUNCE )
{
edict_t *clent = EDICT_NUM( cl.frame.ps.number );
edict_t *clent = CL_GetLocalPlayer();
// bouncy particle
VectorSet(mins, -radius, -radius, -radius);
VectorSet(maxs, radius, radius, radius);
trace = CL_Trace( p->oldorigin, mins, maxs, origin, MOVE_NORMAL, clent, MASK_SOLID );
trace = CL_Move( p->oldorigin, mins, maxs, origin, MOVE_NORMAL, clent );
if( trace.flFraction != 0.0f && trace.flFraction != 1.0f )
{
// reflect velocity
@ -1126,11 +1128,12 @@ void CL_TestEntities( void )
{
int i, j;
float f, r;
edict_t ent;
edict_t ent, *pl;
if( !cl_testentities->integer )
return;
pl = CL_GetLocalPlayer();
Mem_Set( &ent, 0, sizeof( edict_t ));
V_ClearScene();
@ -1143,10 +1146,10 @@ void CL_TestEntities( void )
ent.v.origin[j] = cl.refdef.vieworg[j]+cl.refdef.forward[j] * f + cl.refdef.right[j] * r;
ent.v.scale = 1.0f;
ent.serialnumber = cl.frame.ps.number;
ent.serialnumber = pl->serialnumber;
ent.v.controller[0] = ent.v.controller[1] = 90.0f;
ent.v.controller[2] = ent.v.controller[3] = 180.0f;
ent.v.modelindex = cl.frame.ps.modelindex;
ent.v.modelindex = pl->v.modelindex;
re->AddRefEntity( &ent, ED_NORMAL );
}
}
@ -1168,7 +1171,6 @@ void CL_TestLights( void )
{
vec3_t end;
edict_t *ed = CL_GetLocalPlayer();
int cnt = CL_ContentsMask( ed );
static shader_t flashlight_shader = -1;
trace_t trace;
@ -1180,10 +1182,11 @@ void CL_TestLights( void )
VectorScale( cl.refdef.forward, 256, end );
VectorAdd( end, cl.refdef.vieworg, end );
trace = CL_Trace( cl.refdef.vieworg, vec3_origin, vec3_origin, end, 0, ed, cnt );
trace = CL_Move( cl.refdef.vieworg, vec3_origin, vec3_origin, end, MOVE_NORMAL, ed );
VectorSet( dl.color, 1.0f, 1.0f, 1.0f );
dl.intensity = 96;
dl.texture = flashlight_shader;
if( CL_IsValidEdict( trace.pHit )) Msg( "Trace.hit %s\n", CL_ClassName( trace.pHit ));
VectorCopy( trace.vecEndPos, dl.origin );
re->AddDynLight( &dl );

View File

@ -20,6 +20,13 @@ void CL_UpdateEntityFields( edict_t *ent )
clgame.dllFuncs.pfnUpdateEntityVars( ent, &cl.refdef.skyportal, &ent->pvClientData->current, &ent->pvClientData->prev );
if( ent->pvClientData->current.ed_flags & ESF_LINKEDICT )
{
CL_LinkEdict( ent, false );
// to avoids multiple relinks when wait for next packet
ent->pvClientData->current.ed_flags &= ~ESF_LINKEDICT;
}
// always keep an actual (users can't replace this)
ent->serialnumber = ent->pvClientData->current.number;
ent->v.classname = cl.edict_classnames[ent->pvClientData->current.classname];
@ -44,6 +51,8 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
if( unchanged ) *state = *old;
else MSG_ReadDeltaEntity( msg, old, state, newnum );
Com_Assert( newnum == 0 );
if( state->number == MAX_EDICTS )
{
CL_FreeEdict( ent );
@ -253,9 +262,11 @@ void CL_ParseFrame( sizebuf_t *msg )
if(( idx - 1 ) != cl.playernum )
Host_Error( "CL_ParseFrame: invalid playernum (%d should be %d)\n", idx-1, cl.playernum );
#if 0
// now we can reading delta player state
if( cl.oldframe ) cl.frame.ps = MSG_ParseDeltaPlayer( &cl.oldframe->ps, &clent->pvClientData->current );
else cl.frame.ps = MSG_ParseDeltaPlayer( NULL, &clent->pvClientData->current );
#endif
// save the frame off in the backup array for later delta comparisons
cl.frames[cl.frame.serverframe & UPDATE_MASK] = cl.frame;
@ -264,17 +275,20 @@ void CL_ParseFrame( sizebuf_t *msg )
{
if( cls.state != ca_active )
{
edict_t *player;
// client entered the game
cls.state = ca_active;
cl.force_refdef = true;
player = CL_GetLocalPlayer();
SCR_MakeLevelShot(); // make levelshot if needs
cls.drawplaque = true; // allow to drawing plaque
Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar
// getting a valid frame message ends the connection process
VectorCopy( cl.frame.ps.origin, cl.predicted_origin );
VectorCopy( cl.frame.ps.viewangles, cl.predicted_angles );
VectorCopy( player->v.origin, cl.predicted_origin );
VectorCopy( player->v.viewangles, cl.predicted_angles );
}
CL_CheckPredictionError();
}
@ -298,10 +312,10 @@ void CL_AddPacketEntities( frame_t *frame )
edict_t *ent;
int e, ed_type;
for( e = 0; e < clgame.globals->numEntities; e++ )
for( e = 1; e < clgame.globals->numEntities; e++ )
{
ent = EDICT_NUM( e );
if( ent->free ) continue;
ent = CL_GetEdictByIndex( e );
if( !CL_IsValidEdict( ent )) continue;
ed_type = ent->pvClientData->current.ed_type;
CL_UpdateEntityFields( ent );
@ -365,7 +379,7 @@ void CL_GetEntitySoundSpatialization( int entnum, vec3_t origin, vec3_t velocity
}
ent = CL_GetEdictByIndex( entnum );
if( !ent || ent->free ) return; // leave uncahnged
if( !CL_IsValidEdict( ent )) return; // leave uncahnged
// setup origin and velocity
VectorCopy( ent->v.origin, origin );
@ -398,10 +412,10 @@ void CL_AddLoopingSounds( void )
if( cl.refdef.paused ) return;
if(!cl.audio_prepped ) return;
for( e = 0; e < clgame.globals->numEntities; e++ )
for( e = 1; e < clgame.globals->numEntities; e++ )
{
ent = EDICT_NUM( e );
if( ent->free ) continue;
ent = CL_GetEdictByIndex( e );
if( !CL_IsValidEdict( ent )) continue;
switch( ent->pvClientData->current.ed_type )
{

View File

@ -11,6 +11,7 @@
#include "com_library.h"
#include "triangle_api.h"
#include "effects_api.h"
#include "pm_defs.h"
/*
====================
@ -252,43 +253,6 @@ static void CL_InitTitles( const char *filename )
Com_CloseScript( script );
}
static trace_t CL_TraceToss( edict_t *tossent, edict_t *ignore )
{
int i;
float gravity;
vec3_t move, end;
vec3_t original_origin;
vec3_t original_velocity;
vec3_t original_angles;
vec3_t original_avelocity;
trace_t trace;
VectorCopy( tossent->v.origin, original_origin );
VectorCopy( tossent->v.velocity, original_velocity );
VectorCopy( tossent->v.angles, original_angles );
VectorCopy( tossent->v.avelocity, original_avelocity );
gravity = tossent->v.gravity * clgame.movevars.gravity * 0.05;
for( i = 0; i < 200; i++ )
{
// LordHavoc: sanity check; never trace more than 10 seconds
CL_CheckVelocity( tossent );
tossent->v.velocity[2] -= gravity;
VectorMA( tossent->v.angles, 0.05, tossent->v.avelocity, tossent->v.angles );
VectorScale( tossent->v.velocity, 0.05, move );
VectorAdd( tossent->v.origin, move, end );
trace = CL_Trace( tossent->v.origin, tossent->v.mins, tossent->v.maxs, end, MOVE_NORMAL, tossent, CL_ContentsMask( tossent ));
VectorCopy( trace.vecEndPos, tossent->v.origin );
if( trace.flFraction < 1.0f ) break;
}
VectorCopy( original_origin, tossent->v.origin );
VectorCopy( original_velocity, tossent->v.velocity );
VectorCopy( original_angles, tossent->v.angles );
VectorCopy( original_avelocity, tossent->v.avelocity );
return trace;
}
/*
====================
CL_GetLocalPlayer
@ -299,7 +263,11 @@ Render callback for studio models
edict_t *CL_GetLocalPlayer( void )
{
if( cls.state == ca_active )
return EDICT_NUM( cl.playernum + 1 );
{
edict_t *player = EDICT_NUM( cl.playernum + 1 );
if( CL_IsValidEdict( player )) return player;
Host_Error( "CL_GetLocalPlayer: invalid edict\n" );
}
return NULL;
}
@ -495,7 +463,7 @@ void CL_FreeEdict( edict_t *pEdict )
Com_Assert( pEdict->free );
// unlink from world
// CL_UnlinkEdict( pEdict );
CL_UnlinkEdict( pEdict );
if( pEdict->pvClientData ) Mem_Free( pEdict->pvClientData );
if( pEdict->pvPrivateData ) Mem_Free( pEdict->pvPrivateData );
@ -512,7 +480,7 @@ edict_t *CL_AllocEdict( void )
edict_t *pEdict;
int i;
for( i = 0; i < clgame.globals->numEntities; i++ )
for( i = 1; i < clgame.globals->numEntities; i++ )
{
pEdict = EDICT_NUM( i );
// the first couple seconds of client time can involve a lot of
@ -536,25 +504,35 @@ edict_t *CL_AllocEdict( void )
void CL_InitEdicts( void )
{
edict_t *e;
edict_t *ent;
int i;
clgame.globals->maxEntities = com.atoi( cl.configstrings[CS_MAXEDICTS] );
clgame.globals->maxClients = com.atoi( cl.configstrings[CS_MAXCLIENTS] );
clgame.edicts = Mem_Realloc( cls.mempool, clgame.edicts, sizeof( edict_t ) * clgame.globals->maxEntities );
for( i = 0, e = EDICT_NUM( 0 ); i < clgame.globals->maxEntities; i++, e++ )
e->free = true; // mark all edicts as freed
ent = EDICT_NUM( 0 );
if( ent->free ) CL_InitEdict( ent );
ent->v.model = MAKE_STRING( cl.configstrings[CS_MODELS+1] );
ent->v.modelindex = 1; // world model
ent->v.solid = SOLID_BSP;
ent->v.movetype = MOVETYPE_PUSH;
clgame.globals->numEntities = 1;
for( i = 0, ent = EDICT_NUM( 1 ); i < clgame.globals->maxEntities; i++, ent++ )
ent->free = true; // mark all edicts as freed
clgame.globals->mapname = MAKE_STRING( cl.configstrings[CS_NAME] );
clgame.globals->deathmatch = Cvar_VariableInteger( "deathmatch" );
clgame.globals->coop = Cvar_VariableInteger( "coop" );
clgame.globals->teamplay = Cvar_VariableInteger( "teamplay" );
clgame.globals->serverflags = 0; // FIXME: make CS_SERVERFLAGS
clgame.globals->serverflags = com.atoi( cl.configstrings[CS_SERVERFLAGS] );
// clear prevstate
Mem_Set( &clgame.viewent.pvClientData->latched, 0, sizeof( prevframe_t ));
CL_ClearWorld ();
}
void CL_FreeEdicts( void )
@ -564,8 +542,8 @@ void CL_FreeEdicts( void )
for( i = 0; i < clgame.globals->numEntities; i++ )
{
ent = EDICT_NUM( i );
if( ent->free ) continue;
ent = CL_GetEdictByIndex( i );
if( !CL_IsValidEdict( ent )) continue;
CL_FreeEdict( ent );
}
@ -574,6 +552,24 @@ void CL_FreeEdicts( void )
clgame.globals->numEntities = 0;
}
bool CL_IsValidEdict( const edict_t *e )
{
if( !e ) return false;
if( e->free ) return false;
if( e == EDICT_NUM( 0 )) return false; // world is the read-only entity
if( !e->pvServerData ) return false;
// edict without pvPrivateData is valid edict
// server.dll know how allocate it
return true;
}
const char *CL_ClassName( const edict_t *e )
{
if( !e ) return "(null)";
if( e->free ) return "freed";
return STRING( e->v.classname );
}
/*
===============================================================================
CGame Builtin Functions
@ -1190,16 +1186,12 @@ pfnTraceLine
*/
static void pfnTraceLine( const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr )
{
int move;
trace_t result;
move = (fNoMonsters) ? MOVE_NOMONSTERS : MOVE_NORMAL;
if( IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) || IS_NAN(v2[0]) || IS_NAN(v1[2]) || IS_NAN(v2[2] ))
Host_Error( "CL_Trace: NAN errors detected ('%f %f %f', '%f %f %f'\n", v1[0], v1[1], v1[2], v2[0], v2[1], v2[2] );
result = CL_Trace( v1, vec3_origin, vec3_origin, v2, move, pentToSkip, CL_ContentsMask( pentToSkip ));
Mem_Copy( ptr, &result, sizeof( *ptr ));
if( VectorIsNAN( v1 ) || VectorIsNAN( v2 ))
Host_Error( "TraceLine: NAN errors detected '%f %f %f', '%f %f %f'\n", v1[0], v1[1], v1[2], v2[0], v2[1], v2[2] );
result = CL_Move( v1, vec3_origin, vec3_origin, v2, fNoMonsters, pentToSkip );
if( ptr ) Mem_Copy( ptr, &result, sizeof( *ptr ));
}
/*
@ -1212,9 +1204,14 @@ static void pfnTraceToss( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr
{
trace_t result;
if( pent == EDICT_NUM( 0 )) return;
result = CL_TraceToss( pent, pentToIgnore );
Mem_Copy( ptr, &result, sizeof( *ptr ));
if( !CL_IsValidEdict( pent ))
{
MsgDev( D_WARN, "CL_MoveToss: invalid entity %s\n", CL_ClassName( pent ));
return;
}
result = CL_MoveToss( pent, pentToIgnore );
if( ptr ) Mem_Copy( ptr, &result, sizeof( *ptr ));
}
/*
@ -1223,30 +1220,43 @@ pfnTraceHull
=================
*/
static void pfnTraceHull( const float *v1, const float *mins, const float *maxs, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr )
static void pfnTraceHull( const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr )
{
int move;
trace_t result;
float *mins, *maxs;
move = (fNoMonsters) ? MOVE_NOMONSTERS : MOVE_NORMAL;
hullNumber = bound( 0, hullNumber, 3 );
mins = GI->client_mins[hullNumber];
maxs = GI->client_maxs[hullNumber];
if( IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) || IS_NAN(v2[0]) || IS_NAN(v1[2]) || IS_NAN(v2[2] ))
Host_Error( "CL_TraceHull: NAN errors detected ('%f %f %f', '%f %f %f'\n", v1[0], v1[1], v1[2], v2[0], v2[1], v2[2] );
result = CL_Trace( v1, (float *)mins, (float *)mins, v2, move, pentToSkip, CL_ContentsMask( pentToSkip ));
Mem_Copy( ptr, &result, sizeof( *ptr ));
if( VectorIsNAN( v1 ) || VectorIsNAN( v2 ))
Host_Error( "TraceHull: NAN errors detected '%f %f %f', '%f %f %f'\n", v1[0], v1[1], v1[2], v2[0], v2[1], v2[2] );
result = CL_Move( v1, mins, maxs, v2, fNoMonsters, pentToSkip );
if( ptr ) Mem_Copy( ptr, &result, sizeof( *ptr ));
}
static void pfnTraceModel( const float *v1, const float *v2, edict_t *pent, TraceResult *ptr )
{
// FIXME: implement
trace_t result;
if( !CL_IsValidEdict( pent ))
{
MsgDev( D_WARN, "CL_TraceModel: invalid entity %s\n", CL_ClassName( pent ));
return;
}
if( VectorIsNAN( v1 ) || VectorIsNAN( v2 ))
Host_Error( "TraceModel: NAN errors detected '%f %f %f', '%f %f %f'\n", v1[0], v1[1], v1[2], v2[0], v2[1], v2[2] );
result = CL_ClipMoveToEntity( pent, v1, pent->v.mins, pent->v.maxs, v2, MASK_SOLID, 0 );
if( ptr ) Mem_Copy( ptr, &result, sizeof( *ptr ));
}
static const char *pfnTraceTexture( edict_t *pTextureEntity, const float *v1, const float *v2 )
{
if( IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) || IS_NAN(v2[0]) || IS_NAN(v1[2]) || IS_NAN(v2[2] ))
Host_Error( "CL_TraceTexture: NAN errors detected ('%f %f %f', '%f %f %f'\n", v1[0], v1[1], v1[2], v2[0], v2[1], v2[2] );
return CL_Trace( v1, vec3_origin, vec3_origin, v2, MOVE_NOMONSTERS, NULL, CL_ContentsMask( pTextureEntity )).pTexName;
if( VectorIsNAN( v1 ) || VectorIsNAN( v2 ))
Host_Error( "TraceTexture: NAN errors detected '%f %f %f', '%f %f %f'\n", v1[0], v1[1], v1[2], v2[0], v2[1], v2[2] );
if( !pTextureEntity || pTextureEntity->free ) return NULL;
return CL_ClipMoveToEntity( pTextureEntity, v1, vec3_origin, vec3_origin, v2, MASK_SOLID, 0 ).pTexName;
}
/*
@ -1780,6 +1790,7 @@ bool CL_LoadProgs( const char *name )
static CLIENTAPI GetClientAPI;
static cl_globalvars_t gpGlobals;
static tri_state_t gpTriState;
static playermove_t gpMove;
string libpath;
if( clgame.hInstance ) CL_UnloadProgs();
@ -1788,6 +1799,7 @@ bool CL_LoadProgs( const char *name )
clgame.globals = &gpGlobals;
// initialize TriAPI
clgame.pmove = &gpMove;
clgame.pTri = &gpTriState;
clgame.pTri->currentPolygon.fognum = -1;
clgame.pTri->numPolys = 0;

View File

@ -100,7 +100,7 @@ void CL_MouseMove( usercmd_t *cmd )
rate = com.sqrt( mx * mx + my * my ) / (float)frame_msec;
if( cl.frame.ps.health <= 0 ) return;
if( cl.refdef.health <= 0 ) return;
if( cl.data.mouse_sensitivity == 0.0f ) cl.data.mouse_sensitivity = 1.0f;
accel_sensitivity = m_sensitivity->value + rate * cl_mouseaccel->value;
accel_sensitivity *= cl.data.mouse_sensitivity; // scale by fov
@ -121,7 +121,7 @@ void CL_MouseMove( usercmd_t *cmd )
}
else
{
if(( in_strafe.state & 1 ) && cl.frame.ps.movetype == MOVETYPE_NOCLIP )
if(( in_strafe.state & 1 ) && cl.refdef.movetype == MOVETYPE_NOCLIP )
cmd->upmove -= m_forward->value * my;
else cmd->forwardmove -= m_forward->value * my;
}
@ -326,7 +326,7 @@ void CL_AdjustAngles( void )
float speed;
float up, down;
if( cl.frame.ps.health <= 0 ) return;
if( cl.refdef.health <= 0 ) return;
speed = ( in_speed.state & 1 ) ? cls.frametime * cl_anglespeedkey->value : cls.frametime;
@ -532,7 +532,12 @@ void CL_FinishMove( usercmd_t *cmd )
// process commands with user dll's
cl.data.iKeyBits = CL_ButtonBits( 0 );
cl.data.iWeaponBits = cl.frame.ps.weapons;
if( cls.state == ca_active )
{
edict_t *pl = CL_GetLocalPlayer();
cl.data.iWeaponBits = pl->v.weapons;
}
else cl.data.iWeaponBits = 0;
VectorCopy( cl.refdef.cl_viewangles, cmd->viewangles );
VectorCopy( cl.refdef.cl_viewangles, cl.data.angles );

135
engine/client/cl_move.c Normal file
View File

@ -0,0 +1,135 @@
//=======================================================================
// Copyright XashXT Group 2008 ©
// cl_physics.c - client physic and prediction
//=======================================================================
#include "common.h"
#include "client.h"
#include "matrix_lib.h"
#include "const.h"
#include "pm_defs.h"
/*
===================
CL_CheckPredictionError
===================
*/
void CL_CheckPredictionError( void )
{
int frame;
vec3_t delta;
edict_t *player;
if( !cl_predict->integer ) return;
player = CL_GetLocalPlayer();
// calculate the last usercmd_t we sent that the server has processed
frame = cls.netchan.incoming_acknowledged;
frame &= CMD_MASK;
// compare what the server returned with what we had predicted it to be
VectorSubtract( player->v.origin, cl.predicted_origins[frame], delta );
if( player->pvClientData->current.ed_flags & ESF_NO_PREDICTION )
{
// a teleport or something
VectorClear( cl.prediction_error );
}
else
{
if( cl_showmiss->integer && ( delta[0] || delta[1] || delta[2] ))
Msg( "prediction miss on %i: %g\n", cl.frame.serverframe, delta[0] + delta[1] + delta[2]);
VectorCopy( player->v.origin, cl.predicted_origins[frame] );
// save for error itnerpolation
VectorCopy( delta, cl.prediction_error );
}
}
/*
=================
CL_PredictMovement
Sets cl.predicted_origin and cl.predicted_angles
=================
*/
void CL_PredictMovement( void )
{
int ack, current;
int frame;
int oldframe;
usercmd_t *cmd;
edict_t *player, *viewent;
int i;
float step;
float oldz;
if( cls.state != ca_active ) return;
if( cl.refdef.paused ) return;
player = CL_GetLocalPlayer ();
viewent = CL_GetEdictByIndex( cl.refdef.viewentity );
if( cls.demoplayback )
{
// interpolate server values
for( i = 0; viewent && i < 3; i++ )
cl.refdef.cl_viewangles[i] = viewent->v.viewangles[i];
}
// unpredicted pure angled values converted into axis
AngleVectors( cl.refdef.cl_viewangles, cl.refdef.forward, cl.refdef.right, cl.refdef.up );
if( !cl_predict->value || player->pvClientData->current.ed_flags & ESF_NO_PREDICTION )
{
// just set angles
for( i = 0; i < 3; i++ )
cl.predicted_angles[i] = cl.refdef.cl_viewangles[i];
return;
}
ack = cls.netchan.incoming_acknowledged;
current = cls.netchan.outgoing_sequence;
// if we are too far out of date, just freeze
if( current - ack >= CMD_BACKUP )
{
if( cl_showmiss->value )
Msg( "exceeded CMD_BACKUP\n" );
return;
}
frame = 0;
// run frames
while( ++ack < current )
{
frame = ack & CMD_MASK;
cmd = &cl.cmds[frame];
// call pfnPM_Move here
// save for debug checking
VectorCopy( clgame.pmove->origin, cl.predicted_origins[frame] );
}
oldframe = (ack- 2 ) & CMD_MASK;
if( player->v.flags & FL_ONGROUND )
{
oldz = cl.predicted_origins[oldframe][2];
step = clgame.pmove->origin[2] - oldz;
if( step > 63 && step < 160 )
{
cl.predicted_step = step;
cl.predicted_step_time = cls.realtime - cls.frametime * 500;
}
}
// copy results out for rendering
VectorCopy( clgame.pmove->origin, cl.predicted_origin );
VectorCopy( clgame.pmove->angles, cl.predicted_angles );
}

View File

@ -7,66 +7,7 @@
#include "client.h"
#include "matrix_lib.h"
#include "const.h"
/*
===================
CL_CheckPredictionError
===================
*/
void CL_CheckPredictionError( void )
{
int frame;
int delta[3];
int len;
if( !cl_predict->integer ) return;
// calculate the last usercmd_t we sent that the server has processed
frame = cls.netchan.incoming_acknowledged;
frame &= (CMD_BACKUP-1);
// compare what the server returned with what we had predicted it to be
VectorSubtract (cl.frame.ps.origin, cl.predicted_origins[frame], delta);
// save the prediction error for interpolation
len = abs(delta[0]) + abs(delta[1]) + abs(delta[2]);
if( len > 640 ) // 80 world units
{ // a teleport or something
VectorClear (cl.prediction_error);
}
else
{
if (cl_showmiss->value && (delta[0] || delta[1] || delta[2]))
Msg ("prediction miss on %i: %i\n", cl.frame.serverframe, delta[0] + delta[1] + delta[2]);
VectorCopy (cl.frame.ps.origin, cl.predicted_origins[frame]);
// save for error itnerpolation
VectorCopy( delta, cl.prediction_error );
}
}
/*
===============================================================================
LINE TESTING IN HULLS
===============================================================================
*/
int CL_ContentsMask( const edict_t *passedict )
{
if( passedict )
{
if( passedict->v.flags & FL_MONSTER )
return MASK_MONSTERSOLID;
else if( passedict->v.flags & FL_CLIENT )
return MASK_PLAYERSOLID;
else if( passedict->v.solid == SOLID_TRIGGER )
return BASECONT_SOLID|BASECONT_BODY;
return MASK_SOLID;
}
return MASK_SOLID;
}
#include "pm_defs.h"
/*
================
@ -76,32 +17,27 @@ CL_CheckVelocity
void CL_CheckVelocity( edict_t *ent )
{
int i;
float wishspeed;
float maxvel;
maxvel = fabs( clgame.movevars.maxvelocity );
// bound velocity
for( i = 0; i < 3; i++ )
{
if(IS_NAN(ent->v.velocity[i]))
if( IS_NAN( ent->v.velocity[i] ))
{
MsgDev( D_INFO, "Got a NaN velocity on entity #%i (%s)\n", NUM_FOR_EDICT( ent ), STRING( ent->v.classname ));
MsgDev( D_INFO, "Got a NaN velocity on %s\n", STRING( ent->v.classname ));
ent->v.velocity[i] = 0;
}
if (IS_NAN(ent->v.origin[i]))
if( IS_NAN( ent->v.origin[i] ))
{
MsgDev( D_INFO, "Got a NaN origin on entity #%i (%s)\n", NUM_FOR_EDICT( ent ), STRING( ent->v.classname ));
MsgDev( D_INFO, "Got a NaN origin on %s\n", STRING( ent->v.classname ));
ent->v.origin[i] = 0;
}
}
// LordHavoc: max velocity fix, inspired by Maddes's source fixes, but this is faster
wishspeed = DotProduct( ent->v.velocity, ent->v.velocity );
if( wishspeed > ( clgame.movevars.maxvelocity * clgame.movevars.maxvelocity ))
{
wishspeed = clgame.movevars.maxvelocity / com.sqrt( wishspeed );
ent->v.velocity[0] *= wishspeed;
ent->v.velocity[1] *= wishspeed;
ent->v.velocity[2] *= wishspeed;
}
if( VectorLength( ent->v.velocity ) > maxvel )
VectorScale( ent->v.velocity, maxvel / VectorLength( ent->v.velocity ), ent->v.velocity );
}
/*
@ -119,109 +55,38 @@ bool CL_CheckWater( edict_t *ent )
point[2] = ent->v.origin[2] + ent->v.mins[2] + 1;
ent->v.waterlevel = 0;
ent->v.watertype = BASECONT_NONE;
ent->v.watertype = CONTENTS_EMPTY;
cont = CL_PointContents( point );
if( cont & (MASK_WATER))
if( cont <= CONTENTS_WATER )
{
ent->v.watertype = cont;
ent->v.waterlevel = 1;
point[2] = ent->v.origin[2] + (ent->v.mins[2] + ent->v.maxs[2]) * 0.5;
if( CL_PointContents( point ) & MASK_WATER )
point[2] = ent->v.origin[2] + (ent->v.mins[2] + ent->v.maxs[2]) * 0.5f;
if( CL_PointContents( point ) <= CONTENTS_WATER )
{
ent->v.waterlevel = 2;
point[2] = ent->v.origin[2] + ent->v.view_ofs[2];
if( CL_PointContents( point ) & MASK_WATER )
{
if( CL_PointContents( point ) <= CONTENTS_WATER )
ent->v.waterlevel = 3;
}
}
if( cont <= CONTENTS_CURRENT_0 && cont >= CONTENTS_CURRENT_DOWN )
{
static vec3_t current_table[] =
{
{ 1, 0, 0 },
{ 0, 1, 0 },
{-1, 0, 0 },
{ 0, -1, 0 },
{ 0, 0, 1 },
{ 0, 0, -1}
};
float speed = 150.0f * ent->v.waterlevel / 3.0f;
float *dir = current_table[CONTENTS_CURRENT_0 - cont];
VectorMA( ent->v.basevelocity, speed, dir, ent->v.basevelocity );
}
}
return ent->v.waterlevel > 1;
}
/*
=================
CL_PredictMovement
Sets cl.predicted_origin and cl.predicted_angles
=================
*/
void CL_PredictMovement (void)
{
int ack, current;
int frame;
int oldframe;
entity_state_t pmove;
usercmd_t *cmd;
int i;
float step;
float oldz;
if( cls.state != ca_active ) return;
if( cl.refdef.paused ) return;
pmove = EDICT_NUM( cl.playernum + 1 )->pvClientData->current;
if( cls.demoplayback )
{
// interpolate server values
for( i = 0; i < 3; i++ )
cl.refdef.cl_viewangles[i] = EDICT_NUM( cl.refdef.viewentity )->v.viewangles[i];
}
// unpredicted pure angled values converted into axis
AngleVectors( cl.refdef.cl_viewangles, cl.refdef.forward, cl.refdef.right, cl.refdef.up );
if( !cl_predict->value || cl.frame.ps.ed_flags & ESF_NO_PREDICTION )
{
// just set angles
for( i = 0; i < 3; i++ )
cl.predicted_angles[i] = cl.refdef.cl_viewangles[i];
return;
}
ack = cls.netchan.incoming_acknowledged;
current = cls.netchan.outgoing_sequence;
// if we are too far out of date, just freeze
if( current - ack >= CMD_BACKUP )
{
if( cl_showmiss->value )
Msg( "exceeded CMD_BACKUP\n" );
return;
}
// SCR_DebugGraph (current - ack - 1, COLOR_0);
frame = 0;
// run frames
while( ++ack < current )
{
frame = ack & (CMD_BACKUP-1);
cmd = &cl.cmds[frame];
// call PM_PlayerMove here
// save for debug checking
VectorCopy( pmove.origin, cl.predicted_origins[frame] );
}
oldframe = (ack-2) & (CMD_BACKUP-1);
if( pmove.flags & FL_ONGROUND )
{
oldz = cl.predicted_origins[oldframe][2];
step = pmove.origin[2] - oldz;
if( step > 63 && step < 160 )
{
cl.predicted_step = step;
cl.predicted_step_time = cls.realtime - cls.frametime * 500;
}
}
// copy results out for rendering
VectorCopy( pmove.origin, cl.predicted_origin );
VectorCopy( pmove.viewangles, cl.predicted_angles );
}
}

View File

@ -28,9 +28,9 @@ update refdef values each frame
*/
void V_SetupRefDef( void )
{
edict_t *clent;
edict_t *clent;
clent = EDICT_NUM( cl.playernum + 1 );
clent = CL_GetLocalPlayer ();
// UNDONE: temporary place for detect waterlevel
CL_CheckWater( clent );

View File

@ -6,39 +6,598 @@
#include "common.h"
#include "client.h"
#include "const.h"
#include "pm_defs.h"
areanode_t cl_areanodes[AREA_NODES];
int cl_numareanodes;
/*
===============
CL_CreateAreaNode
builds a uniformly subdivided tree for the given world size
===============
*/
areanode_t *CL_CreateAreaNode( int depth, vec3_t mins, vec3_t maxs )
{
areanode_t *anode;
vec3_t size;
vec3_t mins1, maxs1;
vec3_t mins2, maxs2;
anode = &cl_areanodes[cl_numareanodes++];
ClearLink( &anode->trigger_edicts );
ClearLink( &anode->solid_edicts );
if( depth == AREA_DEPTH )
{
anode->axis = -1;
anode->children[0] = anode->children[1] = NULL;
return anode;
}
VectorSubtract( maxs, mins, size );
if( size[0] > size[1] )
anode->axis = 0;
else anode->axis = 1;
anode->dist = 0.5f * (maxs[anode->axis] + mins[anode->axis]);
VectorCopy( mins, mins1 );
VectorCopy( mins, mins2 );
VectorCopy( maxs, maxs1 );
VectorCopy( maxs, maxs2 );
maxs1[anode->axis] = mins2[anode->axis] = anode->dist;
anode->children[0] = CL_CreateAreaNode( depth+1, mins2, maxs2 );
anode->children[1] = CL_CreateAreaNode( depth+1, mins1, maxs1 );
return anode;
}
/*
===============
CL_ClearWorld
===============
*/
void CL_ClearWorld( void )
{
vec3_t mins, maxs;
int worldIndex = 1;
cl_numareanodes = 0;
Mod_GetBounds( worldIndex, mins, maxs );
Mem_Set( cl_areanodes, 0, sizeof( cl_areanodes ));
CL_CreateAreaNode( 0, mins, maxs );
}
/*
=================
CL_ClassifyEdict
sorting edict by type
=================
*/
void CL_ClassifyEdict( edict_t *ent )
{
cl_priv_t *cl_ent;
cl_ent = ent->pvClientData;
if( !cl_ent || cl_ent->current.ed_type != ED_SPAWNED )
return;
cl_ent->current.ed_type = ED_TEMPENTITY; // it's client entity
// display type
// Msg( "%s: <%s>\n", STRING( ent->v.classname ), ed_name[cl_ent->s.ed_type] );
}
/*
===============
CL_UnlinkEdict
===============
*/
void CL_UnlinkEdict( edict_t *ent )
{
// not linked in anywhere
if( !ent->pvClientData->area.prev )
return;
RemoveLink( &ent->pvClientData->area );
ent->pvClientData->area.prev = NULL;
ent->pvClientData->area.next = NULL;
ent->pvClientData->linked = false;
}
void CL_SetAbsBbox( edict_t *ent )
{
if (( ent->v.solid == SOLID_BSP ) && !VectorIsNull( ent->v.angles ))
{
// expand for rotation
float max = 0, v;
int i;
for ( i = 0; i < 3; i++ )
{
v = fabs( ent->v.mins[i] );
if ( v > max ) max = v;
v = fabs( ent->v.maxs[i] );
if ( v > max ) max = v;
}
for ( i = 0; i < 3; i++ )
{
ent->v.absmin[i] = ent->v.origin[i] - max;
ent->v.absmax[i] = ent->v.origin[i] + max;
}
}
else
{
VectorAdd( ent->v.origin, ent->v.mins, ent->v.absmin );
VectorAdd( ent->v.origin, ent->v.maxs, ent->v.absmax );
}
ent->v.absmin[0] -= 1;
ent->v.absmin[1] -= 1;
ent->v.absmin[2] -= 1;
ent->v.absmax[0] += 1;
ent->v.absmax[1] += 1;
ent->v.absmax[2] += 1;
}
/*
===============
CL_LinkEntity
===============
*/
void CL_LinkEdict( edict_t *ent, bool touch_triggers )
{
areanode_t *node;
cl_priv_t *cl_ent;
cl_ent = ent->pvClientData;
if( !cl_ent ) return;
if( cl_ent->area.prev ) CL_UnlinkEdict( ent ); // unlink from old position
if( ent == EDICT_NUM( 0 )) return; // don't add the world
if( ent->free ) return;
// trying to classify unclassified edicts
if( cls.state == ca_active && cl_ent->current.ed_type == ED_SPAWNED )
CL_ClassifyEdict( ent );
// set the abs box
CL_SetAbsBbox( ent );
cl_ent->linked = true;
// ignore not solid bodies
if( ent->v.solid == SOLID_NOT )
return;
// find the first node that the ent's box crosses
node = cl_areanodes;
while( 1 )
{
if( node->axis == -1 ) break;
if( ent->v.absmin[node->axis] > node->dist )
node = node->children[0];
else if( ent->v.absmax[node->axis] < node->dist )
node = node->children[1];
else break; // crosses the node
}
// link it in
if( ent->v.solid == SOLID_TRIGGER )
InsertLinkBefore( &cl_ent->area, &node->trigger_edicts, NUM_FOR_EDICT( ent ));
else InsertLinkBefore (&cl_ent->area, &node->solid_edicts, NUM_FOR_EDICT( ent ));
if( touch_triggers ) Host_Error( "CL_LinkEdict: touch_tiggers\n" );
}
/*
============================================================================
AREA QUERY
Fills in a list of all entities who's absmin / absmax intersects the given
bounds. This does NOT mean that they actually touch in the case of bmodels.
============================================================================
*/
/*
====================
CL_AreaEdicts_r
====================
*/
void CL_AreaEdicts_r( areanode_t *node, area_t *ap )
{
link_t *l, *next, *start;
edict_t *check;
int count = 0;
// touch linked edicts
if( ap->type == AREA_SOLID )
start = &node->solid_edicts;
else start = &node->trigger_edicts;
for( l = start->next; l != start; l = next )
{
next = l->next;
check = EDICT_FROM_AREA( l );
if( check->v.solid == SOLID_NOT ) continue; // deactivated
if( !BoundsIntersect( check->v.absmin, check->v.absmax, ap->mins, ap->maxs ))
continue; // not touching
if( ap->count == ap->maxcount )
{
MsgDev( D_WARN, "CL_AreaEdicts: maxcount hit\n" );
return;
}
ap->list[ap->count] = check;
ap->count++;
}
if( node->axis == -1 ) return; // terminal node
// recurse down both sides
if( ap->maxs[node->axis] > node->dist ) CL_AreaEdicts_r( node->children[0], ap );
if( ap->mins[node->axis] < node->dist ) CL_AreaEdicts_r( node->children[1], ap );
}
/*
================
CL_AreaEdicts
================
*/
int CL_AreaEdicts( const vec3_t mins, const vec3_t maxs, edict_t **list, int maxcount, int areatype )
{
area_t ap;
ap.mins = mins;
ap.maxs = maxs;
ap.list = list;
ap.count = 0;
ap.maxcount = maxcount;
ap.type = areatype;
CL_AreaEdicts_r( cl_areanodes, &ap );
return ap.count;
}
/*
==================
CL_Trace
CL_ClipMoveToEntity
UNDONE: trace worldonly
Handles selection or creation of a clipping hull, and offseting (and
eventually rotation) of the end points
==================
*/
trace_t CL_Trace( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int type, edict_t *e, int mask )
trace_t CL_ClipMoveToEntity( edict_t *ent, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, uint umask, int flags )
{
trace_t trace;
model_t handle;
float *origin, *angles;
// fill in a default trace
Mem_Set( &trace, 0, sizeof( trace_t ));
// if it doesn't have any brushes of a type we
// are looking for, ignore it
if(!( umask & World_ContentsForEdict( ent )))
{
trace.flFraction = 1.0f;
trace.fInOpen = true;
return trace;
}
// might intersect, so do an exact clip
handle = World_HullForEntity( ent );
if( ent->v.solid == SOLID_BSP )
angles = ent->v.angles;
else angles = vec3_origin; // boxes don't rotate
origin = ent->v.origin;
if( ent == clgame.edicts )
CM_BoxTrace( &trace, start, end, mins, maxs, handle, umask, TR_AABB );
else if( !(flags & FTRACE_SIMPLEBOX) && CM_GetModelType( ent->v.modelindex ) == mod_studio )
{
if( CM_HitboxTrace( &trace, ent, start, end )); // continue tracing bbox if hitbox missing
else CM_TransformedBoxTrace( &trace, start, end, mins, maxs, handle, umask, origin, angles, TR_AABB );
}
else CM_TransformedBoxTrace( &trace, start, end, mins, maxs, handle, umask, origin, angles, TR_AABB );
// did we clip the move?
if( trace.flFraction < 1.0f || trace.fStartSolid )
trace.pHit = ent;
return trace;
}
static trace_t CL_CombineTraces( trace_t *cliptrace, trace_t *trace, edict_t *touch, bool is_bmodel )
{
if( trace->fAllSolid )
{
cliptrace->fAllSolid = true;
trace->pHit = touch;
}
else if( trace->fStartSolid )
{
if( is_bmodel )
cliptrace->fStartStuck = true;
cliptrace->fStartSolid = true;
trace->pHit = touch;
}
if( trace->flFraction < cliptrace->flFraction )
{
bool oldStart;
// make sure we keep a startsolid from a previous trace
oldStart = cliptrace->fStartSolid;
trace->pHit = touch;
cliptrace = trace;
cliptrace->fStartSolid |= oldStart;
}
return *cliptrace;
}
/*
====================
CL_ClipToLinks
Mins and maxs enclose the entire area swept by the move
====================
*/
static void CL_ClipToLinks( areanode_t *node, moveclip_t *clip )
{
link_t *l, *next;
edict_t *touch;
trace_t trace;
// touch linked edicts
for( l = node->solid_edicts.next; l != &node->solid_edicts; l = next )
{
next = l->next;
touch = EDICT_FROM_AREA( l );
if( touch->v.solid == SOLID_NOT )
continue;
if( touch == clip->passedict )
continue;
if( touch->v.solid == SOLID_TRIGGER )
Host_Error( "trigger in clipping list\n" );
if( clip->type == MOVE_NOMONSTERS && touch->v.solid != SOLID_BSP )
continue;
if( clip->type == MOVE_WORLDONLY )
{
// accept only real bsp models with FL_WORLDBRUSH set
if( CM_GetModelType( touch->v.modelindex ) == mod_brush && touch->v.flags & FL_WORLDBRUSH );
else continue;
}
if( !BoundsIntersect( clip->boxmins, clip->boxmaxs, touch->v.absmin, touch->v.absmax ))
continue;
if( clip->passedict && !VectorIsNull( clip->passedict->v.size ) && VectorIsNull( touch->v.size ))
continue; // points never interact
if( clip->flags & FTRACE_IGNORE_GLASS && CM_GetModelType( touch->v.modelindex ) == mod_brush )
{
vec3_t point;
// we can ignore brushes with rendermode != kRenderNormal
switch( touch->v.rendermode )
{
case kRenderTransTexture:
case kRenderTransAlpha:
case kRenderTransAdd:
if( touch->v.renderamt < 200 )
continue;
// check for translucent contents
if( VectorIsNull( touch->v.origin ))
VectorAverage( touch->v.absmin, touch->v.absmax, point );
else VectorCopy( touch->v.origin, point );
if( CL_BaseContents( point, NULL ) & BASECONT_TRANSLUCENT )
continue; // glass detected
default: break;
}
}
// might intersect, so do an exact clip
if( clip->trace.fAllSolid ) return;
if( clip->passedict )
{
if( touch->v.owner == clip->passedict )
continue; // don't clip against own missiles
if( clip->passedict->v.owner == touch )
continue; // don't clip against owner
}
if( touch->v.flags & FL_MONSTER )
trace = CL_ClipMoveToEntity( touch, clip->start, clip->mins2, clip->maxs2, clip->end, clip->umask, clip->flags );
else trace = CL_ClipMoveToEntity( touch, clip->start, clip->mins, clip->maxs, clip->end, clip->umask, clip->flags );
clip->trace = CL_CombineTraces( &clip->trace, &trace, touch, touch->v.solid == SOLID_BSP );
}
// recurse down both sides
if( node->axis == -1 ) return;
if( clip->boxmaxs[node->axis] > node->dist )
CL_ClipToLinks( node->children[0], clip );
if( clip->boxmins[node->axis] < node->dist )
CL_ClipToLinks( node->children[1], clip );
}
/*
==================
CL_Move
==================
*/
trace_t CL_Move( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int type, edict_t *e )
{
moveclip_t clip;
int i;
if( !mins ) mins = vec3_origin;
if( !maxs ) maxs = vec3_origin;
Mem_Set( &clip, 0, sizeof( moveclip_t ));
Mem_Set( &clip, 0, sizeof( clip ));
clip.start = start;
clip.end = end;
clip.mins = mins;
clip.maxs = maxs;
clip.type = (type & 0xFF);
clip.flags = (type & 0xFF00);
clip.passedict = e;
clip.umask = World_MaskForEdict( e );
// clip to world
CM_BoxTrace( &clip.trace, start, end, mins, maxs, 0, mask, TR_AABB );
clip.trace.pHit = (clip.trace.flFraction != 1.0f) ? EDICT_NUM( 0 ) : NULL;
clip.trace = CL_ClipMoveToEntity( EDICT_NUM( 0 ), start, mins, maxs, end, clip.umask, 0 );
return clip.trace; // blocked immediately by the world
if( type == MOVE_MISSILE )
{
for( i = 0; i < 3; i++ )
{
clip.mins2[i] = -15;
clip.maxs2[i] = 15;
}
}
else
{
VectorCopy( mins, clip.mins2 );
VectorCopy( maxs, clip.maxs2 );
}
// create the bounding box of the entire move
World_MoveBounds( start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs );
// clip to entities
CL_ClipToLinks( cl_areanodes, &clip );
return clip.trace;
}
/*
==================
CL_MoveToss
==================
*/
trace_t CL_MoveToss( edict_t *tossent, edict_t *ignore )
{
float gravity;
vec3_t move, end;
vec3_t original_origin;
vec3_t original_velocity;
vec3_t original_angles;
vec3_t original_avelocity;
trace_t trace;
int i;
VectorCopy( tossent->v.origin, original_origin );
VectorCopy( tossent->v.velocity, original_velocity );
VectorCopy( tossent->v.angles, original_angles );
VectorCopy( tossent->v.avelocity, original_avelocity );
gravity = tossent->v.gravity * clgame.movevars.gravity * 0.05f;
for( i = 0; i < 200; i++ )
{
CL_CheckVelocity( tossent );
tossent->v.velocity[2] -= gravity;
VectorMA( tossent->v.angles, 0.05f, tossent->v.avelocity, tossent->v.angles );
VectorScale( tossent->v.velocity, 0.05f, move );
VectorAdd( tossent->v.origin, move, end );
trace = CL_Move( tossent->v.origin, tossent->v.mins, tossent->v.maxs, end, MOVE_NORMAL, tossent );
VectorCopy( trace.vecEndPos, tossent->v.origin );
if( trace.flFraction < 1.0f ) break;
}
VectorCopy( original_origin, tossent->v.origin );
VectorCopy( original_velocity, tossent->v.velocity );
VectorCopy( original_angles, tossent->v.angles );
VectorCopy( original_avelocity, tossent->v.avelocity );
return trace;
}
/*
=============
CL_PointContents
UNDONE: contents of worldonly
=============
*/
int CL_BaseContents( const vec3_t p, edict_t *e )
{
model_t handle;
float *angles;
int i, num, contents, c2;
edict_t *touch[MAX_EDICTS];
edict_t *hit;
// sanity check
if( !p ) return 0;
// get base contents from world
contents = CM_PointContents( p, 0 );
// or in contents from all the other entities
num = CL_AreaEdicts( p, p, touch, MAX_EDICTS, AREA_SOLID );
for( i = 0; i < num; i++ )
{
hit = touch[i];
if( hit == e ) continue;
if( hit->v.flags & (FL_CLIENT|FL_FAKECLIENT|FL_MONSTER))
{
// never get contents from alives
if( hit->v.health > 0.0f ) continue;
}
// might intersect, so do an exact clip
handle = World_HullForEntity( hit );
if( hit->v.solid == SOLID_BSP )
angles = hit->v.angles;
else angles = vec3_origin; // boxes don't rotate
c2 = CM_TransformedPointContents( p, handle, hit->v.origin, angles );
c2 |= World_ContentsForEdict( hit ); // user-defined contents
contents |= c2;
}
return contents;
}
int CL_PointContents( const vec3_t p )
{
// get base contents from world
return CM_PointContents( p, 0 );
return World_ConvertContents( CL_BaseContents( p, NULL ));
}
/*
============
CL_TestPlayerPosition
============
*/
edict_t *CL_TestPlayerPosition( const vec3_t origin, edict_t *pass, TraceResult *tr )
{
float *mins, *maxs;
trace_t result;
clgame.pmove->usehull = bound( 0, clgame.pmove->usehull, 3 );
mins = clgame.pmove->player_mins[clgame.pmove->usehull];
maxs = clgame.pmove->player_maxs[clgame.pmove->usehull];
result = CL_Move( origin, mins, maxs, origin, MOVE_NORMAL, pass );
if( tr ) Mem_Copy( tr, &result, sizeof( *tr ));
if(( result.iContents & World_MaskForEdict( pass )) && result.pHit )
return result.pHit;
return NULL;
}

View File

@ -167,6 +167,9 @@ typedef struct
// cl_private_edict_t
struct cl_priv_s
{
link_t area; // linked to a division node or leaf
bool linked;
int serverframe; // if not current, this ent isn't in the frame
entity_state_t current;
@ -264,6 +267,11 @@ typedef struct
char centerPrint[1024];
int centerPrintLines;
// movement values from server
movevars_t movevars;
movevars_t oldmovevars;
playermove_t *pmove; // pmove state
cl_globalvars_t *globals;
user_message_t *msg[MAX_USER_MESSAGES];
@ -278,9 +286,6 @@ typedef struct
int numMessages; // actual count of user messages
int hStringTable; // stringtable handle
// movement values from server
movevars_t movevars;
movevars_t oldmovevars;
} clgame_static_t;
typedef struct
@ -445,7 +450,6 @@ void CL_ClearState (void);
void CL_ReadPackets (void);
int CL_ReadFromServer (void);
void CL_WriteToServer (usercmd_t *cmd);
void CL_BaseMove (usercmd_t *cmd);
void IN_CenterView (void);
//
@ -487,6 +491,8 @@ void CL_FreeEdict( edict_t *pEdict );
string_t CL_AllocString( const char *szValue );
const char *CL_GetString( string_t iString );
void CL_CenterPrint( const char *text, int y, int charWidth );
bool CL_IsValidEdict( const edict_t *e );
const char *CL_ClassName( const edict_t *e );
_inline edict_t *CL_EDICT_NUM( int n, const char *file, const int line )
{
@ -543,8 +549,6 @@ void CL_PredictMove (void);
void CL_CheckPredictionError( void );
void CL_CheckVelocity( edict_t *ent );
bool CL_CheckWater( edict_t *ent );
int CL_ContentsMask( const edict_t *passedict );
trace_t CL_Trace( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int type, edict_t *e, int mask );
//
// cl_frame.c
@ -632,4 +636,19 @@ void SCR_RunCinematic( void );
void SCR_StopCinematic( void );
void CL_PlayVideo_f( void );
//
// cl_world.c
//
void CL_ClearWorld( void );
void CL_UnlinkEdict( edict_t *ent );
void CL_ClassifyEdict( edict_t *ent );
void CL_LinkEdict( edict_t *ent, bool touch_triggers );
int CL_AreaEdicts( const vec3_t mins, const vec3_t maxs, edict_t **list, int maxcount, int areatype );
trace_t CL_ClipMoveToEntity( edict_t *e, const vec3_t p0, vec3_t b0, vec3_t b1, const vec3_t p1, uint mask, int flags );
trace_t CL_Move( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int type, edict_t *e );
edict_t *CL_TestPlayerPosition( const vec3_t origin, edict_t *pass, TraceResult *tr );
trace_t CL_MoveToss( edict_t *tossent, edict_t *ignore );
int CL_BaseContents( const vec3_t p, edict_t *e );
int CL_PointContents( const vec3_t p );
#endif//CLIENT_H

View File

@ -6,6 +6,27 @@
#include "common.h"
#include "com_world.h"
const char *ed_name[] =
{
"unknown",
"world",
"static",
"ambient",
"normal",
"brush",
"player",
"monster",
"tempent",
"beam",
"mover",
"viewmodel",
"physbody",
"trigger",
"portal",
"skyportal",
"error",
};
/*
===============================================================================
@ -130,4 +151,53 @@ uint World_ContentsForEdict( const edict_t *e )
return BASECONT_SOLID;
}
return BASECONT_NONE;
}
/*
================
World_HullForEntity
Returns a headnode that can be used for testing or clipping to a
given entity. If the entity is a bsp model, the headnode will
be returned, otherwise a custom box tree will be constructed.
================
*/
model_t World_HullForEntity( const edict_t *ent )
{
if( ent->v.solid == SOLID_BSP )
{
// explicit hulls in the BSP model
return ent->v.modelindex;
}
if( ent->v.flags & (FL_MONSTER|FL_CLIENT|FL_FAKECLIENT))
{
// create a temp capsule from bounding box sizes
return CM_TempModel( ent->v.mins, ent->v.maxs, true );
}
// create a temp tree from bounding box sizes
return CM_TempModel( ent->v.mins, ent->v.maxs, false );
}
/*
==================
World_MoveBounds
==================
*/
void World_MoveBounds( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, vec3_t boxmins, vec3_t boxmaxs )
{
int i;
for( i = 0; i < 3; i++ )
{
if( end[i] > start[i] )
{
boxmins[i] = start[i] + mins[i] - 1;
boxmaxs[i] = end[i] + maxs[i] + 1;
}
else
{
boxmins[i] = end[i] + mins[i] - 1;
boxmaxs[i] = start[i] + maxs[i] + 1;
}
}
}

View File

@ -25,6 +25,9 @@ ENTITY AREA CHECKING
#define AREA_NODES 64
#define AREA_DEPTH 5
#define AREA_SOLID 1
#define AREA_TRIGGERS 2
// link_t is only used for entity area links now
typedef struct link_s
{
@ -69,11 +72,17 @@ typedef struct moveclip_s
int flags; // trace flags
} moveclip_t;
extern const char *ed_name[];
// linked list
void InsertLinkBefore( link_t *l, link_t *before, int entnum );
void RemoveLink( link_t *l );
void ClearLink( link_t *l );
// trace common
model_t World_HullForEntity( const edict_t *ent );
void World_MoveBounds( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, vec3_t boxmins, vec3_t boxmaxs );
// contents
int World_ConvertContents( int basecontents );
uint World_MaskForEdict( const edict_t *e );

View File

@ -146,6 +146,10 @@ SOURCE=.\client\cl_main.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_move.c
# End Source File
# Begin Source File
SOURCE=.\client\cl_parse.c
# End Source File
# Begin Source File
@ -362,22 +366,6 @@ SOURCE=.\common\net_msg.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_defs.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_materials.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_movevars.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\pm_shared.h
# End Source File
# Begin Source File
SOURCE=.\common\safeproc.h
# End Source File
# Begin Source File
@ -386,16 +374,8 @@ SOURCE=.\server\server.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\trace_def.h
# End Source File
# Begin Source File
SOURCE=.\uimenu\ui_local.h
# End Source File
# Begin Source File
SOURCE=..\pm_shared\user_cmd.h
# End Source File
# End Group
# End Target
# End Project

98
engine/engine.plg Normal file
View File

@ -0,0 +1,98 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: engine - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP5ABE.tmp" with contents
[
/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "common" /I "server" /I "client" /I "uimenu" /I "../public" /I "../common" /I "../pm_shared" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\engine\!debug/" /Fo"..\temp\engine\!debug/" /Fd"..\temp\engine\!debug/" /FD /c
"D:\Xash3D\src_main\engine\client\cl_game.c"
]
Creating command line "cl.exe @"C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP5ABE.tmp""
Creating temporary file "C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP5ABF.tmp" with contents
[
user32.lib msvcrtd.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\temp\engine\!debug/engine.pdb" /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"..\temp\engine\!debug/engine.dll" /implib:"..\temp\engine\!debug/engine.lib" /pdbtype:sept
"\Xash3D\src_main\temp\engine\!debug\cinematic.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_cmds.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_demo.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_effects.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_frame.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_game.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_input.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_main.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_parse.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_phys.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_scrn.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_video.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_view.obj"
"\Xash3D\src_main\temp\engine\!debug\cl_world.obj"
"\Xash3D\src_main\temp\engine\!debug\com_library.obj"
"\Xash3D\src_main\temp\engine\!debug\com_world.obj"
"\Xash3D\src_main\temp\engine\!debug\con_keys.obj"
"\Xash3D\src_main\temp\engine\!debug\con_main.obj"
"\Xash3D\src_main\temp\engine\!debug\con_utils.obj"
"\Xash3D\src_main\temp\engine\!debug\engfuncs.obj"
"\Xash3D\src_main\temp\engine\!debug\host.obj"
"\Xash3D\src_main\temp\engine\!debug\infostring.obj"
"\Xash3D\src_main\temp\engine\!debug\input.obj"
"\Xash3D\src_main\temp\engine\!debug\net_chan.obj"
"\Xash3D\src_main\temp\engine\!debug\net_huff.obj"
"\Xash3D\src_main\temp\engine\!debug\net_msg.obj"
"\Xash3D\src_main\temp\engine\!debug\sv_client.obj"
"\Xash3D\src_main\temp\engine\!debug\sv_cmds.obj"
"\Xash3D\src_main\temp\engine\!debug\sv_frame.obj"
"\Xash3D\src_main\temp\engine\!debug\sv_game.obj"
"\Xash3D\src_main\temp\engine\!debug\sv_init.obj"
"\Xash3D\src_main\temp\engine\!debug\sv_main.obj"
"\Xash3D\src_main\temp\engine\!debug\sv_move.obj"
"\Xash3D\src_main\temp\engine\!debug\sv_phys.obj"
"\Xash3D\src_main\temp\engine\!debug\sv_save.obj"
"\Xash3D\src_main\temp\engine\!debug\sv_world.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_advanced.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_audio.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_controls.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_credits.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_defaults.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_demos.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_gameoptions.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_gotosite.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_loadgame.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_main.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_menu.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_mods.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_multiplayer.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_network.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_newgame.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_options.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_performance.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_playersetup.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_qmenu.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_savegame.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_saveload.obj"
"\Xash3D\src_main\temp\engine\!debug\ui_video.obj"
]
Creating command line "link.exe @"C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP5ABF.tmp""
Creating temporary file "C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP5AC0.bat" with contents
[
@echo off
copy \Xash3D\src_main\temp\engine\!debug\engine.dll "D:\Xash3D\bin\engine.dll"
]
Creating command line ""C:\DOCUME~1\ĚČŘŔ\LOCALS~1\Temp\RSP5AC0.bat""
Compiling...
cl_game.c
d:\xash3d\src_main\engine\client\cl_game.c(1245) : warning C4013: 'SV_ClipMoveToEntity' undefined; assuming extern returning int
d:\xash3d\src_main\engine\client\cl_game.c(1245) : error C2224: left of '.pTexName' must have struct/union type
d:\xash3d\src_main\engine\client\cl_game.c(1245) : warning C4033: 'pfnTraceTexture' must return a value
Error executing cl.exe.
<h3>Output Window</h3>
<h3>Results</h3>
engine.dll - 1 error(s), 2 warning(s)
</pre>
</body>
</html>

View File

@ -11,9 +11,6 @@
#include "com_world.h"
//=============================================================================
#define AREA_SOLID 1
#define AREA_TRIGGERS 2
#define MAX_MASTERS 8 // max recipients for heartbeat packets
#define LATENCY_COUNTS 16
#define MAX_ENT_CLUSTERS 16
@ -247,8 +244,7 @@ typedef struct
//=============================================================================
extern netadr_t master_adr[MAX_MASTERS]; // address of the master server
extern const char *ed_name[];
extern netadr_t master_adr[MAX_MASTERS]; // address of the master server
extern server_static_t svs; // persistant server info
extern server_t sv; // local server
extern svgame_static_t svgame; // persistant game info

View File

@ -239,7 +239,7 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_
if( fullvis ) continue; // portal ents will be added anywhere, ignore recursion
// if its a portal entity, add everything visible from its camera position
if( ent->pvServerData->s.ed_type == ED_PORTAL || ent->pvServerData->s.ed_type == ED_SKYPORTAL )
if( !portal && (ent->pvServerData->s.ed_type == ED_PORTAL || ent->pvServerData->s.ed_type == ED_SKYPORTAL))
SV_AddEntitiesToPacket( ent, NULL, frame, ents, true );
}
}

View File

@ -3116,7 +3116,7 @@ int pfnCheckVisibility( const edict_t *entity, byte *pset )
// check overflow clusters that coudln't be stored
if( i == entity->pvServerData->num_clusters )
{
if( entity->pvServerData->lastcluster )
if( entity->pvServerData->lastcluster != -1 )
{
for( ; l <= entity->pvServerData->lastcluster; l++ )
{

View File

@ -109,7 +109,7 @@ void SV_CheckVelocity( edict_t *ent )
int i;
float maxvel;
maxvel = fabs( sv_maxvelocity->value );
maxvel = fabs( svgame.movevars.maxvelocity );
// bound velocity
for( i = 0; i < 3; i++ )

View File

@ -8,27 +8,6 @@
#include "const.h"
#include "pm_defs.h"
const char *ed_name[] =
{
"unknown",
"world",
"static",
"ambient",
"normal",
"brush",
"player",
"monster",
"tempent",
"beam",
"mover",
"viewmodel",
"physbody",
"trigger",
"portal",
"skyportal",
"error",
};
areanode_t sv_areanodes[AREA_NODES];
int sv_numareanodes;
@ -93,31 +72,6 @@ void SV_ClearWorld( void )
SV_CreateAreaNode( 0, mins, maxs );
}
/*
================
SV_HullForEntity
Returns a headnode that can be used for testing or clipping to a
given entity. If the entity is a bsp model, the headnode will
be returned, otherwise a custom box tree will be constructed.
================
*/
model_t SV_HullForEntity( const edict_t *ent )
{
if( ent->v.solid == SOLID_BSP )
{
// explicit hulls in the BSP model
return ent->v.modelindex;
}
if( ent->v.flags & (FL_MONSTER|FL_CLIENT|FL_FAKECLIENT))
{
// create a temp capsule from bounding box sizes
return CM_TempModel( ent->v.mins, ent->v.maxs, true );
}
// create a temp tree from bounding box sizes
return CM_TempModel( ent->v.mins, ent->v.maxs, false );
}
/*
=================
SV_ClassifyEdict
@ -200,6 +154,7 @@ void SV_UnlinkEdict( edict_t *ent )
RemoveLink( &ent->pvServerData->area );
ent->pvServerData->area.prev = NULL;
ent->pvServerData->area.next = NULL;
ent->pvServerData->linked = false;
}
/*
@ -419,7 +374,7 @@ trace_t SV_ClipMoveToEntity( edict_t *ent, const vec3_t start, vec3_t mins, vec3
}
// might intersect, so do an exact clip
handle = SV_HullForEntity( ent );
handle = World_HullForEntity( ent );
if( ent->v.solid == SOLID_BSP )
angles = ent->v.angles;
@ -441,7 +396,7 @@ trace_t SV_ClipMoveToEntity( edict_t *ent, const vec3_t start, vec3_t mins, vec3
return trace;
}
trace_t SV_CombineTraces( trace_t *cliptrace, trace_t *trace, edict_t *touch, bool is_bmodel )
static trace_t SV_CombineTraces( trace_t *cliptrace, trace_t *trace, edict_t *touch, bool is_bmodel )
{
if( trace->fAllSolid )
{
@ -477,7 +432,7 @@ SV_ClipToLinks
Mins and maxs enclose the entire area swept by the move
====================
*/
void SV_ClipToLinks( areanode_t *node, moveclip_t *clip )
static void SV_ClipToLinks( areanode_t *node, moveclip_t *clip )
{
link_t *l, *next;
edict_t *touch;
@ -561,30 +516,6 @@ void SV_ClipToLinks( areanode_t *node, moveclip_t *clip )
SV_ClipToLinks( node->children[1], clip );
}
/*
==================
SV_MoveBounds
==================
*/
void SV_MoveBounds( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, vec3_t boxmins, vec3_t boxmaxs )
{
int i;
for( i = 0; i < 3; i++ )
{
if( end[i] > start[i] )
{
boxmins[i] = start[i] + mins[i] - 1;
boxmaxs[i] = end[i] + maxs[i] + 1;
}
else
{
boxmins[i] = end[i] + mins[i] - 1;
boxmaxs[i] = start[i] + maxs[i] + 1;
}
}
}
/*
==================
SV_Move
@ -624,7 +555,7 @@ trace_t SV_Move( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end,
}
// create the bounding box of the entire move
SV_MoveBounds( start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs );
World_MoveBounds( start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs );
// clip to entities
SV_ClipToLinks( sv_areanodes, &clip );
@ -652,7 +583,7 @@ trace_t SV_MoveToss( edict_t *tossent, edict_t *ignore )
VectorCopy( tossent->v.velocity, original_velocity );
VectorCopy( tossent->v.angles, original_angles );
VectorCopy( tossent->v.avelocity, original_avelocity );
gravity = tossent->v.gravity * sv_gravity->value * 0.05f;
gravity = tossent->v.gravity * svgame.movevars.gravity * 0.05f;
for( i = 0; i < 200; i++ )
{
@ -709,7 +640,7 @@ int SV_BaseContents( const vec3_t p, edict_t *e )
}
// might intersect, so do an exact clip
handle = SV_HullForEntity( hit );
handle = World_HullForEntity( hit );
if( hit->v.solid == SOLID_BSP )
angles = hit->v.angles;
else angles = vec3_origin; // boxes don't rotate

16
launch/launch.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: launch - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
launch.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

16
server/server.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: server - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
server.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

16
snd_al/snd_al.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: snd_al - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
snd_al.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

16
snd_dx/snd_dx.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: snd_dx - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
snd_dx.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

16
vid_gl/vid_gl.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: vid_gl - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
vid_gl.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

16
vprogs/vprogs.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: vprogs - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
vprogs.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

16
xtools/xtools.plg Normal file
View File

@ -0,0 +1,16 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: xtools - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
xtools.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>