diff --git a/baserc/baserc.plg b/baserc/baserc.plg new file mode 100644 index 00000000..190a3969 --- /dev/null +++ b/baserc/baserc.plg @@ -0,0 +1,16 @@ + + +
+

Build Log

+

+--------------------Configuration: baserc - Win32 Release-------------------- +

+

Command Lines

+ + + +

Results

+baserc.dll - 0 error(s), 0 warning(s) +
+ + diff --git a/bshift/bshift.plg b/bshift/bshift.plg new file mode 100644 index 00000000..2bedf617 --- /dev/null +++ b/bshift/bshift.plg @@ -0,0 +1,16 @@ + + +
+

Build Log

+

+--------------------Configuration: bshift - Win32 Release-------------------- +

+

Command Lines

+ + + +

Results

+server.dll - 0 error(s), 0 warning(s) +
+ + diff --git a/client/client.plg b/client/client.plg new file mode 100644 index 00000000..63aa6500 --- /dev/null +++ b/client/client.plg @@ -0,0 +1,16 @@ + + +
+

Build Log

+

+--------------------Configuration: client - Win32 Release-------------------- +

+

Command Lines

+ + + +

Results

+client.dll - 0 error(s), 0 warning(s) +
+ + diff --git a/cms_xr/cm_trace.c b/cms_xr/cm_trace.c index 780496e4..e09ba67f 100644 --- a/cms_xr/cm_trace.c +++ b/cms_xr/cm_trace.c @@ -1168,7 +1168,7 @@ void CM_TraceThroughSphere( traceWork_t *tw, vec3_t origin, float radius, vec3_t VectorSubtract( end, start, dir ); VectorMA( start, fraction, dir, intersection ); VectorSubtract( intersection, origin, dir ); - scale = 1 / ( radius + RADIUS_EPSILON ); + scale = 1.0f / ( radius + RADIUS_EPSILON ); VectorScale( dir, scale, dir ); VectorCopy( dir, tw->trace.vecPlaneNormal ); VectorAdd( tw->modelOrigin, intersection, intersection ); @@ -1759,7 +1759,7 @@ void CM_TransformedBoxTrace( trace_t *tr, const vec3_t start, const vec3_t end, // bmodels for( i = 0; i < 3; i++ ) { - offset[i] = (mins[i] + maxs[i]) * 0.5; + offset[i] = (mins[i] + maxs[i]) * 0.5f; symetricSize[0][i] = mins[i] - offset[i]; symetricSize[1][i] = maxs[i] - offset[i]; start_l[i] = start[i] + offset[i]; @@ -1786,16 +1786,15 @@ void CM_TransformedBoxTrace( trace_t *tr, const vec3_t start, const vec3_t end, // the bounding box or the bmodel because that would make all the brush // bevels invalid. // However this is correct for capsules since a capsule itself is rotated too. + Matrix4x4_CreateFromEntity( rotation, 0.0f, 0.0f, 0.0f, angles[PITCH], angles[YAW], angles[ROLL], 1.0f ); Matrix4x4_Copy( transform, rotation ); Matrix4x4_SetOrigin( transform, origin[0], origin[1], origin[2] ); - Matrix4x4_Invert_Simple( inverse, rotation ); + Matrix4x4_Invert_Simple( inverse, transform ); // transform trace line into the clipModel's space - VectorCopy( start_l, startRotated ); - VectorCopy( end_l, endRotated ); - Matrix4x4_TransformPoint( inverse, startRotated ); - Matrix4x4_TransformPoint( inverse, endRotated ); + Matrix4x4_VectorTransform( inverse, start_l, startRotated ); + Matrix4x4_VectorTransform( inverse, end_l, endRotated ); // extract up vector from the rotation matrix as rotated sphere offset for capsule #ifdef OPENGL_STYLE @@ -1821,9 +1820,13 @@ void CM_TransformedBoxTrace( trace_t *tr, const vec3_t start, const vec3_t end, // if the bmodel was rotated and there was a collision if( rotated && trace.flFraction != 1.0f ) { + vec3_t normal; // untransformed normal + + VectorCopy( trace.vecPlaneNormal, normal ); + // Tr3B: we rotated our trace into the space of the clipModel // so we have to rotate the trace plane normal back to world space - Matrix4x4_TransformNormal( rotation, trace.vecPlaneNormal ); + Matrix4x4_VectorRotate( rotation, normal, trace.vecPlaneNormal ); } // re-calculate the end position of the trace because the trace.vecEndPos diff --git a/engine/common/net_msg.h b/engine/common/net_msg.h index 2b6e2b1d..2700d000 100644 --- a/engine/common/net_msg.h +++ b/engine/common/net_msg.h @@ -177,7 +177,7 @@ void _MSG_WriteDeltaUsercmd( sizebuf_t *sb, usercmd_t *from, usercmd_t *cmd, con bool _MSG_WriteDeltaMovevars( sizebuf_t *sb, movevars_t *from, movevars_t *cmd, const char *filename, const int fileline ); void _MSG_WriteDeltaEvent( sizebuf_t *msg, event_args_t *from, event_args_t *to, const char *filename, const int fileline ); void _MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *msg, bool force, bool newentity, const char *file, int line ); -void _MSG_Send( int dest, const vec3_t origin, const edict_t *ent, bool direct, const char *filename, int fileline ); +bool _MSG_Send( int dest, const vec3_t origin, const edict_t *ent, bool direct, const char *filename, int fileline ); #define MSG_Begin( x ) _MSG_Begin( x, __FILE__, __LINE__) #define MSG_WriteChar(x,y) _MSG_WriteBits (x, y, NWDesc[NET_CHAR].name, NET_CHAR, __FILE__, __LINE__) diff --git a/engine/engine.plg b/engine/engine.plg new file mode 100644 index 00000000..14da1c85 --- /dev/null +++ b/engine/engine.plg @@ -0,0 +1,102 @@ + + +
+

Build Log

+

+--------------------Configuration: engine - Win32 Release-------------------- +

+

Command Lines

+Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP26FF.tmp" with contents +[ +/nologo /MD /W3 /GX /O2 /I "./" /I "common" /I "server" /I "client" /I "uimenu" /I "../public" /I "../common" /I "../game_shared" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /Fo"..\temp\engine\!release/" /Fd"..\temp\engine\!release/" /FD /c +"D:\Xash3D\src_main\engine\server\sv_game.c" +] +Creating command line "cl.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP26FF.tmp"" +Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2700.tmp" with contents +[ +user32.lib msvcrt.lib /nologo /subsystem:windows /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /out:"..\temp\engine\!release/engine.dll" /implib:"..\temp\engine\!release/engine.lib" /opt:nowin98 +"\Xash3D\src_main\temp\engine\!release\build.obj" +"\Xash3D\src_main\temp\engine\!release\cinematic.obj" +"\Xash3D\src_main\temp\engine\!release\cl_cmds.obj" +"\Xash3D\src_main\temp\engine\!release\cl_demo.obj" +"\Xash3D\src_main\temp\engine\!release\cl_effects.obj" +"\Xash3D\src_main\temp\engine\!release\cl_frame.obj" +"\Xash3D\src_main\temp\engine\!release\cl_game.obj" +"\Xash3D\src_main\temp\engine\!release\cl_main.obj" +"\Xash3D\src_main\temp\engine\!release\cl_move.obj" +"\Xash3D\src_main\temp\engine\!release\cl_parse.obj" +"\Xash3D\src_main\temp\engine\!release\cl_phys.obj" +"\Xash3D\src_main\temp\engine\!release\cl_scrn.obj" +"\Xash3D\src_main\temp\engine\!release\cl_tent.obj" +"\Xash3D\src_main\temp\engine\!release\cl_video.obj" +"\Xash3D\src_main\temp\engine\!release\cl_view.obj" +"\Xash3D\src_main\temp\engine\!release\cl_world.obj" +"\Xash3D\src_main\temp\engine\!release\com_keys.obj" +"\Xash3D\src_main\temp\engine\!release\com_world.obj" +"\Xash3D\src_main\temp\engine\!release\con_main.obj" +"\Xash3D\src_main\temp\engine\!release\con_utils.obj" +"\Xash3D\src_main\temp\engine\!release\engfuncs.obj" +"\Xash3D\src_main\temp\engine\!release\host.obj" +"\Xash3D\src_main\temp\engine\!release\infostring.obj" +"\Xash3D\src_main\temp\engine\!release\input.obj" +"\Xash3D\src_main\temp\engine\!release\net_chan.obj" +"\Xash3D\src_main\temp\engine\!release\net_huff.obj" +"\Xash3D\src_main\temp\engine\!release\net_msg.obj" +"\Xash3D\src_main\temp\engine\!release\sv_client.obj" +"\Xash3D\src_main\temp\engine\!release\sv_cmds.obj" +"\Xash3D\src_main\temp\engine\!release\sv_frame.obj" +"\Xash3D\src_main\temp\engine\!release\sv_game.obj" +"\Xash3D\src_main\temp\engine\!release\sv_init.obj" +"\Xash3D\src_main\temp\engine\!release\sv_main.obj" +"\Xash3D\src_main\temp\engine\!release\sv_move.obj" +"\Xash3D\src_main\temp\engine\!release\sv_phys.obj" +"\Xash3D\src_main\temp\engine\!release\sv_save.obj" +"\Xash3D\src_main\temp\engine\!release\sv_world.obj" +"\Xash3D\src_main\temp\engine\!release\titles.obj" +"\Xash3D\src_main\temp\engine\!release\ui_advcontrols.obj" +"\Xash3D\src_main\temp\engine\!release\ui_audio.obj" +"\Xash3D\src_main\temp\engine\!release\ui_configuration.obj" +"\Xash3D\src_main\temp\engine\!release\ui_controls.obj" +"\Xash3D\src_main\temp\engine\!release\ui_creategame.obj" +"\Xash3D\src_main\temp\engine\!release\ui_credits.obj" +"\Xash3D\src_main\temp\engine\!release\ui_customgame.obj" +"\Xash3D\src_main\temp\engine\!release\ui_gameoptions.obj" +"\Xash3D\src_main\temp\engine\!release\ui_langame.obj" +"\Xash3D\src_main\temp\engine\!release\ui_loadgame.obj" +"\Xash3D\src_main\temp\engine\!release\ui_main.obj" +"\Xash3D\src_main\temp\engine\!release\ui_menu.obj" +"\Xash3D\src_main\temp\engine\!release\ui_multiplayer.obj" +"\Xash3D\src_main\temp\engine\!release\ui_newgame.obj" +"\Xash3D\src_main\temp\engine\!release\ui_playdemo.obj" +"\Xash3D\src_main\temp\engine\!release\ui_playersetup.obj" +"\Xash3D\src_main\temp\engine\!release\ui_playrec.obj" +"\Xash3D\src_main\temp\engine\!release\ui_qmenu.obj" +"\Xash3D\src_main\temp\engine\!release\ui_recdemo.obj" +"\Xash3D\src_main\temp\engine\!release\ui_savegame.obj" +"\Xash3D\src_main\temp\engine\!release\ui_saveload.obj" +"\Xash3D\src_main\temp\engine\!release\ui_video.obj" +"\Xash3D\src_main\temp\engine\!release\ui_vidmodes.obj" +"\Xash3D\src_main\temp\engine\!release\ui_vidoptions.obj" +] +Creating command line "link.exe @"C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2700.tmp"" +Creating temporary file "C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2701.bat" with contents +[ +@echo off +copy \Xash3D\src_main\temp\engine\!release\engine.dll "D:\Xash3D\bin\engine.dll" +] +Creating command line ""C:\DOCUME~1\ÌÈØÀ\LOCALS~1\Temp\RSP2701.bat"" +Compiling... +sv_game.c +Linking... + Creating library ..\temp\engine\!release/engine.lib and object ..\temp\engine\!release/engine.exp +

Output Window

+Performing Custom Build Step on \Xash3D\src_main\temp\engine\!release\engine.dll +‘ª®¯¨à®¢ ­® ä ©«®¢: 1. + + + +

Results

+engine.dll - 0 error(s), 0 warning(s) +
+ + diff --git a/engine/server/sv_client.c b/engine/server/sv_client.c index 1925075f..55097ec8 100644 --- a/engine/server/sv_client.c +++ b/engine/server/sv_client.c @@ -1159,11 +1159,11 @@ MULTICAST_PVS send to clients potentially visible from org MULTICAST_PHS send to clients potentially hearable from org ================= */ -void _MSG_Send( int dest, const vec3_t origin, const edict_t *ent, bool direct, const char *filename, int fileline ) +bool _MSG_Send( int dest, const vec3_t origin, const edict_t *ent, bool direct, const char *filename, int fileline ) { byte *mask = NULL; int leafnum = 0, cluster = 0; - int area1 = 0, area2 = 0; + int numsends = 0, area1 = 0, area2 = 0; int j, numclients = sv_maxclients->integer; sv_client_t *cl, *current = svs.clients; bool reliable = false; @@ -1177,7 +1177,7 @@ void _MSG_Send( int dest, const vec3_t origin, const edict_t *ent, bool direct, // copy signon buffer MSG_WriteData( &sv.signon, sv.multicast.data, sv.multicast.cursize ); MSG_Clear( &sv.multicast ); - return; + return true; } // intentional fallthrough (in-game MSG_INIT it's a MSG_ALL reliable) case MSG_ALL: @@ -1190,7 +1190,7 @@ void _MSG_Send( int dest, const vec3_t origin, const edict_t *ent, bool direct, reliable = true; // intentional fallthrough case MSG_PAS: - if( origin == NULL ) return; + if( origin == NULL ) return false; leafnum = CM_PointLeafnum( origin ); cluster = CM_LeafCluster( leafnum ); mask = CM_ClusterPHS( cluster ); @@ -1200,7 +1200,7 @@ void _MSG_Send( int dest, const vec3_t origin, const edict_t *ent, bool direct, reliable = true; // intentional fallthrough case MSG_PVS: - if( origin == NULL ) return; + if( origin == NULL ) return false; leafnum = CM_PointLeafnum( origin ); cluster = CM_LeafCluster( leafnum ); mask = CM_ClusterPVS( cluster ); @@ -1210,9 +1210,9 @@ void _MSG_Send( int dest, const vec3_t origin, const edict_t *ent, bool direct, reliable = true; // intentional fallthrough case MSG_ONE_UNRELIABLE: - if( ent == NULL ) return; + if( ent == NULL ) return false; j = NUM_FOR_EDICT( ent ); - if( j < 1 || j > numclients ) return; + if( j < 1 || j > numclients ) return false; current = svs.clients + (j - 1); numclients = 1; // send to one break; @@ -1221,7 +1221,7 @@ void _MSG_Send( int dest, const vec3_t origin, const edict_t *ent, bool direct, break; default: Host_Error( "MSG_Send: bad dest: %i (called at %s:%i)\n", dest, filename, fileline ); - return; + return false; } // send the data to all relevent clients (or once only) @@ -1243,8 +1243,8 @@ void _MSG_Send( int dest, const vec3_t origin, const edict_t *ent, bool direct, leafnum = CM_PointLeafnum( cl->edict->v.origin ); cluster = CM_LeafCluster( leafnum ); area2 = CM_LeafArea( leafnum ); - if(!CM_AreasConnected( area1, area2 )) continue; - if( mask && (!(mask[cluster>>3] & (1<<(cluster & 7))))) + if( !CM_AreasConnected( area1, area2 )) continue; + if( mask && (!(mask[cluster>>3] & (1<<( cluster & 7 ))))) continue; } @@ -1254,6 +1254,7 @@ void _MSG_Send( int dest, const vec3_t origin, const edict_t *ent, bool direct, else MSG_WriteData( &cl->reliable, sv.multicast.data, sv.multicast.cursize ); } else MSG_WriteData( &cl->datagram, sv.multicast.data, sv.multicast.cursize ); + numsends++; } MSG_Clear( &sv.multicast ); @@ -1267,6 +1268,7 @@ void _MSG_Send( int dest, const vec3_t origin, const edict_t *ent, bool direct, MSG_Send( MSG_ALL, vec3_origin, NULL ); sv.write_bad_message = false; } + return numsends; // debug } /* diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index 16c53b94..7ab37f0e 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -19,8 +19,14 @@ void SV_SetMinMaxSize( edict_t *e, const float *min, const float *max ) return; for( i = 0; i < 3; i++ ) + { if( min[i] > max[i] ) - Host_Error( "SV_SetMinMaxSize: backwards mins/maxs\n" ); + { + MsgDev( D_ERROR, "SV_SetMinMaxSize: %s backwards mins/maxs\n", SV_ClassName( e )); + SV_LinkEdict( e, false ); // just relink edict and exit + return; + } + } VectorCopy( min, e->v.mins ); VectorCopy( max, e->v.maxs ); @@ -120,9 +126,19 @@ static bool SV_OriginIn( int mode, const vec3_t v1, const vec3_t v2 ) leafnum = CM_PointLeafnum( v1 ); cluster = CM_LeafCluster( leafnum ); area1 = CM_LeafArea( leafnum ); - if( mode == DVIS_PHS ) mask = CM_ClusterPHS( cluster ); - else if( mode == DVIS_PVS ) mask = CM_ClusterPVS( cluster ); - else Host_Error( "SV_OriginIn ?\n" ); + + switch( mode ) + { + case DVIS_PVS: + mask = CM_ClusterPVS( cluster ); + break; + case DVIS_PHS: + mask = CM_ClusterPHS( cluster ); + break; + default: + mask = NULL; // force to check areas only + break; + } leafnum = CM_PointLeafnum( v2 ); cluster = CM_LeafCluster( leafnum ); @@ -135,28 +151,16 @@ static bool SV_OriginIn( int mode, const vec3_t v1, const vec3_t v2 ) return true; } -static bool SV_BBoxIn( int mode, const vec3_t org1, const vec3_t absmin, const vec3_t absmax ) +/* +============== +SV_BoxInPVS + +check brush boxes in fat pvs +============== +*/ +static bool SV_BoxInPVS( const vec3_t org1, const vec3_t absmin, const vec3_t absmax ) { - int leafnum, cluster; - int area1, area2; - byte *mask; - vec3_t org2; - - leafnum = CM_PointLeafnum( org1 ); - cluster = CM_LeafCluster( leafnum ); - area1 = CM_LeafArea( leafnum ); - if( mode == DVIS_PHS ) mask = CM_ClusterPHS( cluster ); - else if( mode == DVIS_PVS ) mask = CM_ClusterPVS( cluster ); - else Host_Error( "SV_BBoxIn ?\n" ); - - VectorAverage( absmin, absmax, org2 ); - leafnum = CM_PointLeafnum( org2 ); - cluster = CM_LeafCluster( leafnum ); - area2 = CM_LeafArea( leafnum ); - - if( pe && mask && !pe->BoxVisible( absmin, absmax, mask )) - return false; - else if( !CM_AreasConnected( area1, area2 )) + if( pe && !pe->BoxVisible( absmin, absmax, CM_FatPVS( org1, false ))) return false; return true; } @@ -392,8 +396,8 @@ edict_t *SV_AllocEdict( void ) } } - if( i == svgame.globals->maxEntities ) - Host_Error( "SV_AllocEdict: no free edicts\n" ); + if( i >= svgame.globals->maxEntities ) + Host_Error( "ED_AllocEdict: no free edicts\n" ); svgame.globals->numEntities++; pEdict = EDICT_NUM( i ); @@ -416,7 +420,7 @@ edict_t *SV_CopyEdict( const edict_t *in ) out = SV_AllocPrivateData( NULL, in->v.classname ); entnum = out->serialnumber; // keep serialnumber an actual - if( out == NULL ) Host_Error( "SV_CopyEdict: no free edicts\n" ); + if( out == NULL ) Host_Error( "ED_CopyEdict: no free edicts\n" ); if( in->pvServerData ) { @@ -1152,7 +1156,7 @@ edict_t *pfnEntitiesInPVS( edict_t *pplayer ) if( !SV_IsValidEdict( pEdict )) continue; if( CM_GetModelType( pEdict->v.modelindex ) == mod_brush ) - result = SV_BBoxIn( DVIS_PVS, pplayer->v.origin, pEdict->v.absmin, pEdict->v.absmax ); + result = SV_BoxInPVS( pplayer->v.origin, pEdict->v.absmin, pEdict->v.absmax ); else result = SV_OriginIn( DVIS_PVS, pplayer->v.origin, pEdict->v.origin ); if( result ) @@ -1173,7 +1177,8 @@ pfnEntitiesInPHS edict_t *pfnEntitiesInPHS( edict_t *pplayer ) { edict_t *pEdict, *chain; - int i, result; + vec3_t checkPos; + int i; if( !SV_IsValidEdict( pplayer )) return NULL; @@ -1185,10 +1190,10 @@ edict_t *pfnEntitiesInPHS( edict_t *pplayer ) if( !SV_IsValidEdict( pEdict )) continue; if( CM_GetModelType( pEdict->v.modelindex ) == mod_brush ) - result = SV_BBoxIn( DVIS_PHS, pplayer->v.origin, pEdict->v.absmin, pEdict->v.absmax ); - else result = SV_OriginIn( DVIS_PHS, pplayer->v.origin, pEdict->v.origin ); + VectorAverage( pEdict->v.absmin, pEdict->v.absmax, checkPos ); + else VectorCopy( pEdict->v.origin, checkPos ); - if( result ) + if( SV_OriginIn( DVIS_PHS, pplayer->v.origin, checkPos )) { pEdict->v.chain = chain; chain = pEdict; @@ -1417,7 +1422,7 @@ SV_StartSound */ void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch ) { - int i, sound_idx; + int sound_idx; int msg_dest = MSG_PAS_R; vec3_t origin; @@ -1447,8 +1452,7 @@ void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float // ultimate method for detect bsp models with invalid solidity (e.g. func_pushable) if( CM_GetModelType( ent->v.modelindex ) == mod_brush ) { - for( i = 0; i < 3; i++ ) - origin[i] = ent->v.origin[i] + 0.5f * ( ent->v.mins[i] + ent->v.maxs[i] ); + VectorAverage( ent->v.absmin, ent->v.absmax, origin ); if( flags & SND_SPAWNING ) msg_dest = MSG_INIT; @@ -1456,12 +1460,12 @@ void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float } else { - for( i = 0; i < 3; i++ ) - origin[i] = ent->v.origin[i]; + VectorAverage( ent->v.mins, ent->v.maxs, origin ); + VectorAdd( origin, ent->v.origin, origin ); if( flags & SND_SPAWNING ) msg_dest = MSG_INIT; - else msg_dest = MSG_PAS; + else msg_dest = MSG_PAS_R; } // always sending stop sound command @@ -1496,7 +1500,7 @@ pfnEmitAmbientSound */ void pfnEmitAmbientSound( edict_t *ent, float *pos, const char *samp, float vol, float attn, int flags, int pitch ) { - int i, number, sound_idx; + int number, sound_idx; int msg_dest = MSG_PAS_R; vec3_t origin; @@ -1520,8 +1524,7 @@ void pfnEmitAmbientSound( edict_t *ent, float *pos, const char *samp, float vol, // ultimate method for detect bsp models with invalid solidity (e.g. func_pushable) if( SV_IsValidEdict( ent ) && CM_GetModelType( ent->v.modelindex ) == mod_brush ) { - for( i = 0; i < 3; i++ ) - origin[i] = ent->v.origin[i] + 0.5f * ( ent->v.mins[i] + ent->v.maxs[i] ); + VectorAverage( ent->v.absmin, ent->v.absmax, origin ); if( flags & SND_SPAWNING ) msg_dest = MSG_INIT; @@ -1530,8 +1533,8 @@ void pfnEmitAmbientSound( edict_t *ent, float *pos, const char *samp, float vol, } else { - for( i = 0; i < 3; i++ ) - origin[i] = pos[i]; + VectorAverage( ent->v.mins, ent->v.maxs, origin ); + VectorAdd( origin, ent->v.origin, origin ); if( flags & SND_SPAWNING ) msg_dest = MSG_INIT; @@ -1979,8 +1982,7 @@ void pfnMessageEnd( void ) float *org = NULL; if( svgame.msg_name ) name = svgame.msg_name; - if( !svgame.msg_started ) - Host_Error( "MessageEnd: called with no active message\n" ); + if( !svgame.msg_started ) Host_Error( "MessageEnd: called with no active message\n" ); svgame.msg_started = false; if( svgame.msg_sizes[svgame.msg_index] != -1 ) @@ -2128,9 +2130,8 @@ pfnWriteEntity */ void pfnWriteEntity( int iValue ) { - // edict -1 it's a viewmodel entity - if( iValue < -1 || iValue > svgame.globals->numEntities ) - Host_Error( "MSG_WriteEntity: invalid entnumber %d\n", iValue ); + if( iValue <= NULLENT_INDEX || iValue >= svgame.globals->numEntities ) + Host_Error( "MSG_WriteEntity: invalid entnumber %i\n", iValue ); MSG_WriteShort( &sv.multicast, iValue ); svgame.msg_realsize += 2; } @@ -3502,7 +3503,7 @@ bool SV_ParseEdict( script_t *script, edict_t *ent ) // parse key if( !Com_ReadToken( script, SC_ALLOW_NEWLINES, &token )) - Host_Error( "SV_ParseEdict: EOF without closing brace\n" ); + Host_Error( "ED_ParseEdict: EOF without closing brace\n" ); if( token.string[0] == '}' ) break; // end of desc // anglehack is to allow QuakeEd to write single scalar angles @@ -3518,10 +3519,10 @@ bool SV_ParseEdict( script_t *script, edict_t *ent ) // parse value if( !Com_ReadToken( script, SC_ALLOW_PATHNAMES2, &token )) - Host_Error( "SV_ParseEdict: EOF without closing brace\n" ); + Host_Error( "ED_ParseEdict: EOF without closing brace\n" ); if( token.string[0] == '}' ) - Host_Error( "SV_ParseEdict: closing brace without data\n" ); + Host_Error( "ED_ParseEdict: closing brace without data\n" ); // ignore attempts to set key "" if( !keyname[0] ) continue; @@ -3601,7 +3602,7 @@ void SV_LoadFromFile( script_t *entities ) while( Com_ReadToken( entities, SC_ALLOW_NEWLINES, &token )) { if( token.string[0] != '{' ) - Host_Error( "SV_LoadFromFile: found %s when expecting {\n", token.string ); + Host_Error( "ED_LoadFromFile: found %s when expecting {\n", token.string ); if( create_world ) { diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 6d8ead00..06b5a102 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -49,7 +49,7 @@ bool SV_TestEntityPosition( edict_t *ent, const vec3_t offset ) VectorAdd( ent->v.origin, offset, org ); - if( ent->v.flags & FL_CLIENT ) + if( ent->v.flags & ( FL_CLIENT|FL_FAKECLIENT )) { // player can crouch, noclip etc if( SV_TestPlayerPosition( org, ent, NULL )) @@ -82,6 +82,7 @@ void SV_CheckAllEnts( void ) for( i = svgame.globals->maxClients + 1; i < svgame.globals->numEntities; i++ ) { e = EDICT_NUM( i ); + if( !SV_IsValidEdict( e )) continue; switch( e->v.movetype ) @@ -91,11 +92,12 @@ void SV_CheckAllEnts( void ) case MOVETYPE_FOLLOW: case MOVETYPE_NOCLIP: continue; - default: break; + default: + if( e->pvServerData->stuck ) + break; + else continue; } - - if( e->pvServerData->stuck ) - SV_UnstickEntity( e ); + SV_UnstickEntity( e ); } } @@ -171,7 +173,6 @@ Returns false if the entity removed itself. */ bool SV_RunThink( edict_t *ent ) { -#if 1 float thinktime; thinktime = ent->v.nextthink; @@ -185,33 +186,7 @@ bool SV_RunThink( edict_t *ent ) ent->v.nextthink = 0; svgame.globals->time = thinktime; svgame.dllFuncs.pfnThink( ent ); -#else - int i; - float newtime; - newtime = (sv.time * 0.001f) + (sv.frametime * 0.001f); - - // don't let things stay in the past. - // it is possible to start that way by a trigger with a local time. - if( ent->v.nextthink <= 0.0f || ent->v.nextthink > newtime ) - return true; - - for( i = 0; i < SV_UPDATE_BACKUP && !ent->free; i++ ) - { - svgame.globals->time = max(( sv.time * 0.001f ), ent->v.nextthink ); - ent->v.nextthink = 0.0f; - - svgame.dllFuncs.pfnThink( ent ); - - newtime = (sv.time * 0.001f) + (sv.frametime * 0.001f); - - // mods often set nextthink to time to cause a think every frame, - // we don't want to loop in that case, so exit if the new nextthink is - // <= the time the qc was told, also exit if it is past the end of the frame - if( ent->v.nextthink <= svgame.globals->time || ent->v.nextthink > newtime || !sv_synchthink->integer ) - break; - } -#endif return !ent->free; } @@ -227,6 +202,10 @@ bool SV_Impact( edict_t *e1, trace_t *trace ) edict_t *e2 = trace->pHit; vec3_t org; + // custom user filter + if( !svgame.dllFuncs.pfnShouldCollide( e1, e2 )) + return false; + SV_CopyTraceToGlobal( trace ); VectorCopy( e1->v.origin, org ); svgame.globals->time = (sv.time * 0.001f); @@ -238,10 +217,12 @@ bool SV_Impact( edict_t *e1, trace_t *trace ) if( !e1->free && !e2->free && e2->v.solid != SOLID_NOT ) { + // inverse plane and normal for second contacted edict VectorCopy( e2->v.origin, svgame.globals->trace_endpos ); VectorNegate( trace->vecPlaneNormal, svgame.globals->trace_plane_normal ); svgame.globals->trace_plane_dist = -trace->flPlaneDist; svgame.globals->trace_ent = e1; + svgame.dllFuncs.pfnTouch( e2, e1 ); } return VectorCompare( e1->v.origin, org ); @@ -336,14 +317,12 @@ void SV_AngularMove( edict_t *ent, float frametime, float friction ) if( ent->v.avelocity[i] > 0.0f ) { ent->v.avelocity[i] -= adjustment; - if( ent->v.avelocity[i] < 0.0f ) - ent->v.avelocity[i] = 0.0f; + if( ent->v.avelocity[i] < 0.0f ) ent->v.avelocity[i] = 0.0f; } else { ent->v.avelocity[i] += adjustment; - if( ent->v.avelocity[i] > 0.0f ) - ent->v.avelocity[i] = 0.0f; + if( ent->v.avelocity[i] > 0.0f ) ent->v.avelocity[i] = 0.0f; } } } @@ -369,14 +348,12 @@ void SV_LinearMove( edict_t *ent, float frametime, float friction ) if( ent->v.velocity[i] > 0.0f ) { ent->v.velocity[i] -= adjustment; - if( ent->v.velocity[i] < 0.0f ) - ent->v.velocity[i] = 0.0f; + if( ent->v.velocity[i] < 0.0f ) ent->v.velocity[i] = 0.0f; } else { ent->v.velocity[i] += adjustment; - if( ent->v.velocity[i] > 0.0f ) - ent->v.velocity[i] = 0.0f; + if( ent->v.velocity[i] > 0.0f ) ent->v.velocity[i] = 0.0f; } } } @@ -457,9 +434,9 @@ be accurate for client side prediction */ void SV_ClampOrigin( vec3_t origin ) { - origin[0] -= 32.0f * floor( origin[0] * (1.0f / 32.0f)); - origin[1] -= 32.0f * floor( origin[1] * (1.0f / 32.0f)); - origin[2] -= 32.0f * floor( origin[2] * (1.0f / 32.0f)); + origin[0] -= 32.0f * floor( origin[0] * ( 1.0f / 32.0f )); + origin[1] -= 32.0f * floor( origin[1] * ( 1.0f / 32.0f )); + origin[2] -= 32.0f * floor( origin[2] * ( 1.0f / 32.0f )); } /* @@ -1397,44 +1374,52 @@ void _SV_Physics_Pusher( edict_t *ent ) SV_Physics_Follow Entities that are "stuck" to another entity +assume oldorigin as originoffset and oldangles as angle difference ============= */ void SV_Physics_Follow( edict_t *ent ) { vec3_t vf, vr, vu, angles, v; - edict_t *e; + edict_t *parent; // regular thinking - if( !SV_RunThink( ent )) - return; + if( !SV_RunThink( ent )) return; - e = ent->v.aiment; - if( !e || e->free ) return; + // force to hold current values as offsets + if( ent->v.flags & EF_NOINTERP ) + { + VectorCopy( ent->v.origin, ent->v.oldorigin ); + VectorCopy( ent->v.angles, ent->v.oldangles ); + } - if( VectorCompare( e->v.angles, ent->v.punchangle )) + parent = ent->v.aiment; + if( !SV_IsValidEdict( parent )) return; + + if( VectorCompare( parent->v.angles, ent->v.oldangles )) { // quick case for no rotation - VectorAdd( e->v.origin, ent->v.view_ofs, ent->v.origin ); + VectorAdd( parent->v.origin, ent->v.oldorigin, ent->v.origin ); } else { - angles[0] = -ent->v.punchangle[0]; - angles[1] = ent->v.punchangle[1]; - angles[2] = ent->v.punchangle[2]; + angles[0] = -ent->v.oldangles[0]; + angles[1] = ent->v.oldangles[1]; + angles[2] = ent->v.oldangles[2]; AngleVectors( angles, vf, vr, vu ); - v[0] = ent->v.view_ofs[0] * vf[0] + ent->v.view_ofs[1] * vr[0] + ent->v.view_ofs[2] * vu[0]; - v[1] = ent->v.view_ofs[0] * vf[1] + ent->v.view_ofs[1] * vr[1] + ent->v.view_ofs[2] * vu[1]; - v[2] = ent->v.view_ofs[0] * vf[2] + ent->v.view_ofs[1] * vr[2] + ent->v.view_ofs[2] * vu[2]; - angles[0] = -e->v.angles[0]; - angles[1] = e->v.angles[1]; - angles[2] = e->v.angles[2]; + v[0] = ent->v.oldorigin[0] * vf[0] + ent->v.oldorigin[1] * vr[0] + ent->v.oldorigin[2] * vu[0]; + v[1] = ent->v.oldorigin[0] * vf[1] + ent->v.oldorigin[1] * vr[1] + ent->v.oldorigin[2] * vu[1]; + v[2] = ent->v.oldorigin[0] * vf[2] + ent->v.oldorigin[1] * vr[2] + ent->v.oldorigin[2] * vu[2]; + + angles[0] = -parent->v.angles[0]; + angles[1] = parent->v.angles[1]; + angles[2] = parent->v.angles[2]; AngleVectors( angles, vf, vr, vu ); - ent->v.origin[0] = v[0] * vf[0] + v[1] * vf[1] + v[2] * vf[2] + e->v.origin[0]; - ent->v.origin[1] = v[0] * vr[0] + v[1] * vr[1] + v[2] * vr[2] + e->v.origin[1]; - ent->v.origin[2] = v[0] * vu[0] + v[1] * vu[1] + v[2] * vu[2] + e->v.origin[2]; + ent->v.origin[0] = v[0] * vf[0] + v[1] * vf[1] + v[2] * vf[2] + parent->v.origin[0]; + ent->v.origin[1] = v[0] * vr[0] + v[1] * vr[1] + v[2] * vr[2] + parent->v.origin[1]; + ent->v.origin[2] = v[0] * vu[0] + v[1] * vu[1] + v[2] * vu[2] + parent->v.origin[2]; } - VectorAdd( e->v.angles, ent->v.viewangles, ent->v.angles ); + VectorAdd( parent->v.angles, ent->v.oldangles, ent->v.angles ); SV_LinkEdict( ent, false ); } @@ -1451,9 +1436,15 @@ void SV_Physics_Noclip( edict_t *ent ) if( !SV_RunThink( ent )) return; SV_CheckWater( ent ); - VectorMA( ent->v.angles, svgame.globals->frametime, ent->v.avelocity, ent->v.angles ); - VectorMA( ent->v.origin, svgame.globals->frametime, ent->v.velocity, ent->v.origin ); + // let apply friction for noclip objects +#ifdef IGNORE_FRICTION + VectorMA( pusher->v.origin, movetime, pusher->v.velocity, pusher->v.origin ); + VectorMA( pusher->v.angles, movetime, pusher->v.avelocity, pusher->v.angles ); +#else + SV_LinearMove( ent, svgame.globals->frametime, ent->v.friction ); + SV_AngularMove( ent, svgame.globals->frametime, ent->v.friction ); +#endif SV_LinkEdict( ent, false ); // nocip ents never touch triggers } @@ -2035,11 +2026,7 @@ Non moving objects can only think */ void SV_Physics_None( edict_t *ent ) { - float newtime; - - newtime = (sv.time * 0.001f) + svgame.globals->frametime; - if( ent->v.nextthink > 0.0f && ent->v.nextthink <= newtime ) - SV_RunThink( ent ); + SV_RunThink( ent ); } @@ -2057,24 +2044,21 @@ static void SV_Physics_Entity( edict_t *ent ) } ent->v.flags &= ~FL_BASEVELOCITY; - // user dll has override movement type + // user dll can override movement type if( svgame.dllFuncs.pfnPhysicsEntity( ent )) return; switch( ent->v.movetype ) { - case MOVETYPE_PUSH: - SV_Physics_Pusher( ent ); - break; case MOVETYPE_NONE: SV_Physics_None( ent ); break; - case MOVETYPE_FOLLOW: - SV_Physics_Follow( ent ); - break; case MOVETYPE_NOCLIP: SV_Physics_Noclip( ent ); break; + case MOVETYPE_FOLLOW: + SV_Physics_Follow( ent ); + break; case MOVETYPE_STEP: case MOVETYPE_PUSHSTEP: SV_Physics_Step( ent ); @@ -2086,6 +2070,9 @@ static void SV_Physics_Entity( edict_t *ent ) case MOVETYPE_BOUNCEMISSILE: SV_Physics_Toss( ent ); break; + case MOVETYPE_PUSH: + SV_Physics_Pusher( ent ); + break; case MOVETYPE_CONVEYOR: SV_Physics_Conveyor( ent ); break; @@ -2137,9 +2124,10 @@ void SV_Physics( void ) for( i = 1; ( svgame.globals->force_retouch > 0 ) && i < svgame.globals->numEntities; i++ ) { ent = EDICT_NUM( i ); - if( ent->free ) continue; + if( !SV_IsValidEdict( ent )) continue; - SV_LinkEdict( ent, true ); // force retouch even for stationary + // force retouch even for stationary + SV_LinkEdict( ent, true ); } // treat each object in turn @@ -2148,7 +2136,8 @@ void SV_Physics( void ) for( i = svgame.globals->maxClients + 1; i < svgame.globals->numEntities; i++ ) { ent = EDICT_NUM( i ); - if( ent->free ) continue; + if( !SV_IsValidEdict( ent )) continue; + SV_Physics_Entity( ent ); } } diff --git a/snd_dx/s_main.c b/snd_dx/s_main.c index e414c94b..c41a7626 100644 --- a/snd_dx/s_main.c +++ b/snd_dx/s_main.c @@ -220,7 +220,6 @@ int S_AlterChannel( int entnum, int chan, sfx_t *sfx, int vol, int pitch, int fl { if( ch->entnum == entnum && ch->entchannel == chan && ch->sfx ) { - Msg( "S_StartSound: vol %i, pitch %i\n", vol, pitch ); if( flags & SND_CHANGE_PITCH ) ch->basePitch = pitch; @@ -438,10 +437,7 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv if( flags & (SND_STOP|SND_CHANGE_VOL|SND_CHANGE_PITCH)) { if( S_AlterChannel( ent, chan, sfx, vol, pitch, flags )) - { - Msg( "S_AlterChannel( %s, %i, %i )\n", sfx->name, ent, chan ); return; - } if( flags & SND_STOP ) return; // fall through - if we're not trying to stop the sound, diff --git a/todo.log b/todo.log index 7ee274d9..614a0ba2 100644 --- a/todo.log +++ b/todo.log @@ -32,4 +32,7 @@ Xash 0.71 Beta 05.05.10 8. tune UPDATE_BACKUP value for singleplayer OK 9. fix monsters interpolation OK 10.revision MOVETYPE_PUSH physic -11.rewrite EntitiesInPVS check \ No newline at end of file +11.rewrite EntitiesInPVS check OK +12.reworking snd_dx.dll +13. revision MOVETYPE_BOUNCE physic +14. revision MOVETYPE_FOLLOW physic \ No newline at end of file