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

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 deleted file mode 100644 index 2bedf617..00000000 --- a/bshift/bshift.plg +++ /dev/null @@ -1,16 +0,0 @@ - - -
-

Build Log

-

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

-

Command Lines

- - - -

Results

-server.dll - 0 error(s), 0 warning(s) -
- - diff --git a/bshift/effects.cpp b/bshift/effects.cpp index d11278c4..9194d396 100644 --- a/bshift/effects.cpp +++ b/bshift/effects.cpp @@ -875,7 +875,6 @@ void CLightning::BeamUpdateVars( void ) pev->skin = 0; pev->sequence = 0; pev->rendermode = 0; - pev->flags |= FL_CUSTOMENTITY; pev->model = m_iszSpriteName; SetTexture( m_spriteTexture ); @@ -949,7 +948,6 @@ void CLaser::Spawn( void ) Precache( ); SetThink( StrikeThink ); - pev->flags |= FL_CUSTOMENTITY; PointsInit( pev->origin, pev->origin ); diff --git a/bshift/glock.cpp b/bshift/glock.cpp index 03e49926..43cc9c23 100644 --- a/bshift/glock.cpp +++ b/bshift/glock.cpp @@ -48,7 +48,8 @@ public: BOOL Deploy( void ); void Reload( void ); void WeaponIdle( void ); - int m_iShell; +private: + unsigned short m_usFireGlock; }; LINK_ENTITY_TO_CLASS( weapon_glock, CGlock ); LINK_ENTITY_TO_CLASS( weapon_9mmhandgun, CGlock ); @@ -73,7 +74,7 @@ void CGlock::Precache( void ) PRECACHE_MODEL("models/w_9mmhandgun.mdl"); PRECACHE_MODEL("models/p_9mmhandgun.mdl"); - m_iShell = PRECACHE_MODEL ("models/shell.mdl");// brass shell + int m_iShell = PRECACHE_MODEL ("models/shell.mdl");// brass shell PRECACHE_SOUND("items/9mmclip1.wav"); PRECACHE_SOUND("items/9mmclip2.wav"); @@ -81,6 +82,8 @@ void CGlock::Precache( void ) PRECACHE_SOUND ("weapons/pl_gun1.wav");//silenced handgun PRECACHE_SOUND ("weapons/pl_gun2.wav");//silenced handgun PRECACHE_SOUND ("weapons/pl_gun3.wav");//handgun + + m_usFireGlock = PRECACHE_EVENT( 1, "evGlock1" ); } int CGlock::GetItemInfo(ItemInfo *p) @@ -141,36 +144,17 @@ void CGlock::GlockFire( float flSpread , float flCycleTime, BOOL fUseAutoAim ) // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); - UTIL_MakeVectors( m_pPlayer->pev->viewangles + m_pPlayer->pev->punchangle ); - - Vector vecShellVelocity = m_pPlayer->pev->velocity - + gpGlobals->v_right * RANDOM_FLOAT(50,70) - + gpGlobals->v_up * RANDOM_FLOAT(100,150) - + gpGlobals->v_forward * 25; - EjectBrass ( pev->origin + m_pPlayer->pev->view_ofs + gpGlobals->v_up * -12 + gpGlobals->v_forward * 32 + gpGlobals->v_right * 6 , vecShellVelocity, pev->angles.y, m_iShell, TE_BOUNCE_SHELL ); - // silenced if (pev->body == 1) { m_pPlayer->m_iWeaponVolume = QUIET_GUN_VOLUME; m_pPlayer->m_iWeaponFlash = DIM_GUN_FLASH; - - switch(RANDOM_LONG(0,1)) - { - case 0: - EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/pl_gun1.wav", RANDOM_FLOAT(0.9, 1.0), ATTN_NORM); - break; - case 1: - EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/pl_gun2.wav", RANDOM_FLOAT(0.9, 1.0), ATTN_NORM); - break; - } } else { // non-silenced m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; m_pPlayer->m_iWeaponFlash = NORMAL_GUN_FLASH; - EMIT_SOUND_DYN(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/pl_gun3.wav", RANDOM_FLOAT(0.92, 1.0), ATTN_NORM, 0, 98 + RANDOM_LONG(0,3)); } Vector vecSrc = m_pPlayer->GetGunPosition( ); @@ -185,7 +169,13 @@ void CGlock::GlockFire( float flSpread , float flCycleTime, BOOL fUseAutoAim ) vecAiming = gpGlobals->v_forward; } - m_pPlayer->FireBullets( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_9MM, 0 ); + Vector vecDir; + vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( flSpread, flSpread, flSpread ), 8192, BULLET_PLAYER_9MM, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); + + int iAnim = ( m_iClip == 0 ) ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT; + + PLAYBACK_EVENT_FULL( 0, m_pPlayer->edict(), m_usFireGlock, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, pev->body, iAnim, 0, pev->body ); + m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + flCycleTime; if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) @@ -193,8 +183,6 @@ void CGlock::GlockFire( float flSpread , float flCycleTime, BOOL fUseAutoAim ) m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT ( 10, 15 ); - - m_pPlayer->pev->punchangle.x -= 2; } diff --git a/bshift/squeakgrenade.cpp b/bshift/squeakgrenade.cpp index 86c42e60..273ef2ee 100644 --- a/bshift/squeakgrenade.cpp +++ b/bshift/squeakgrenade.cpp @@ -421,6 +421,8 @@ public: void Holster( int skiplocal = 0 ); void WeaponIdle( void ); int m_fJustThrown; +private: + unsigned short m_usSnarkFire; }; LINK_ENTITY_TO_CLASS( weapon_snark, CSqueak ); @@ -449,6 +451,8 @@ void CSqueak::Precache( void ) PRECACHE_SOUND("squeek/sqk_hunt2.wav"); PRECACHE_SOUND("squeek/sqk_hunt3.wav"); UTIL_PrecacheOther("monster_snark"); + + m_usSnarkFire = PRECACHE_EVENT ( 1, "evSnarkFire" ); } @@ -522,11 +526,10 @@ void CSqueak::PrimaryAttack() // find place to toss monster UTIL_TraceLine( trace_origin + gpGlobals->v_forward * 20, trace_origin + gpGlobals->v_forward * 64, dont_ignore_monsters, NULL, &tr ); + PLAYBACK_EVENT_FULL( 0, m_pPlayer->edict(), m_usSnarkFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, pev->body, 0, 0, 0 ); if (tr.fAllSolid == 0 && tr.fStartSolid == 0 && tr.flFraction > 0.25) { - SendWeaponAnim( SQUEAK_THROW ); - // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); diff --git a/client/client.plg b/client/client.plg deleted file mode 100644 index 63aa6500..00000000 --- a/client/client.plg +++ /dev/null @@ -1,16 +0,0 @@ - - -
-

Build Log

-

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

-

Command Lines

- - - -

Results

-client.dll - 0 error(s), 0 warning(s) -
- - diff --git a/client/global/ev_hldm.cpp b/client/global/ev_hldm.cpp index 14f821d7..05113521 100644 --- a/client/global/ev_hldm.cpp +++ b/client/global/ev_hldm.cpp @@ -672,7 +672,6 @@ void EV_FireGlock1( event_args_t *args ) Vector origin = args->origin; Vector angles = args->angles; Vector velocity = args->velocity; - int empty; Vector ShellVelocity; Vector ShellOrigin; @@ -682,7 +681,6 @@ void EV_FireGlock1( event_args_t *args ) idx = args->entindex; - empty = args->bparam1; AngleVectors( angles, forward, right, up ); shell = g_engfuncs.pEventAPI->EV_FindModelIndex ( "models/shell.mdl" ); // brass shell @@ -690,7 +688,7 @@ void EV_FireGlock1( event_args_t *args ) if ( EV_IsLocal( idx ) ) { edict_t *view = GetViewModel(); - g_engfuncs.pEventAPI->EV_WeaponAnim( empty ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT, args->iparam1, 1.0f ); + g_engfuncs.pEventAPI->EV_WeaponAnim( args->iparam2, args->iparam1, 1.0f ); EV_MuzzleFlash(); @@ -1641,7 +1639,7 @@ void EV_SnarkFire( event_args_t *args ) vecSrc = vecSrc - ( VEC_HULL_MIN - VEC_DUCK_HULL_MIN ); // store off the old count - UTIL_TraceLine( vecSrc + forward * 20, vecSrc + forward * 64, dont_ignore_monsters, GetEntityByIndex( idx ), &tr ); + UTIL_TraceLine( vecSrc + forward * 20, vecSrc + forward * 64, dont_ignore_monsters, NULL, &tr ); // find space to drop the thing. if ( tr.fAllSolid == 0 && tr.fStartSolid == 0 && tr.flFraction > 0.25f ) diff --git a/client/global/r_beams.cpp b/client/global/r_beams.cpp index 35ecf1f1..ae9d924c 100644 --- a/client/global/r_beams.cpp +++ b/client/global/r_beams.cpp @@ -2221,11 +2221,11 @@ void DrawRing( int noise_divisions, float *prgNoise, void (*pfnNoise)( float *no point[2] = xaxis[2] * x + yaxis[2] * y + center[2]; // Distort using noise - factor = prgNoise[(noiseIndex>>16) & 0x7F] * scale; + factor = prgNoise[(noiseIndex>>16) & NOISE_MASK] * scale; point = point + (gpViewParams->up * factor); // Rotate the noise along the perpendicluar axis a bit to keep the bolt from looking diagonal - factor = prgNoise[(noiseIndex>>16) & 0x7F] * scale * cos(fraction * M_PI * 3 * 8 + freq); + factor = prgNoise[(noiseIndex>>16) & NOISE_MASK] * scale * cos(fraction * M_PI * 3 * 8 + freq); point = point + (gpViewParams->right * factor); // Transform point into screen space diff --git a/client/global/r_beams.h b/client/global/r_beams.h index a0640fd1..7068831a 100644 --- a/client/global/r_beams.h +++ b/client/global/r_beams.h @@ -9,7 +9,8 @@ #include "beam_def.h" #include "te_shared.h" -#define NOISE_DIVISIONS 128 +#define NOISE_DIVISIONS 64 // don't touch - many tripmines cause the crash when it equal 128 +#define NOISE_MASK (NOISE_DIVISIONS-1) #define MAX_BEAM_ENTS 2 // start & end entity #define MAX_BEAMS 128 // Max simultaneous beams #define MAX_BEAMTRAILS 2048 // default max # of particles at one time diff --git a/cms_qf/cm_local.h b/cms_qf/cm_local.h index 091e5fcf..74e261c0 100644 --- a/cms_qf/cm_local.h +++ b/cms_qf/cm_local.h @@ -84,7 +84,7 @@ typedef struct // shared modelinfo modtype_t type; // model type - vec3_t mins, maxs; // model boundbox + vec3_t mins, maxs; // bounding box at angles '0 0 0' byte *extradata; // studiomodels extradata void *submodels; // animations ptr int numframes; // sprite framecount diff --git a/cms_xr/cm_local.h b/cms_xr/cm_local.h index 3b92de28..80c239fb 100644 --- a/cms_xr/cm_local.h +++ b/cms_xr/cm_local.h @@ -358,7 +358,7 @@ void CM_ModelFrames( model_t handle, int *numFrames ); modtype_t CM_ModelType( model_t handle ); cmodel_t *CM_ClipHandleToModel( model_t handle ); model_t CM_TempBoxModel( const vec3_t mins, const vec3_t maxs, bool capsule ); -void CM_BeginRegistration ( const char *name, bool clientload, uint *checksum ); +void CM_BeginRegistration( const char *name, bool clientload, uint *checksum ); bool CM_RegisterModel( const char *name, int sv_index ); void *CM_Extradata( model_t handle ); void CM_EndRegistration ( void ); diff --git a/common/const.h b/common/const.h index a22eac36..c33d9582 100644 --- a/common/const.h +++ b/common/const.h @@ -122,9 +122,9 @@ #define FL_DUCKING (1<<14) // monster (or player) is ducked #define FL_FLOAT (1<<15) // Apply floating force to this entity when in water #define FL_GRAPHED (1<<16) // worldgraph has this ent listed as something that blocks a connection -#define FL_PROJECTILE (1<<17) // this is rocket entity (was FL_IMMUNE_WATER) -#define FL_TANK (1<<18) // this is func tank entity (was FL_IMMUNE_SLIME) -#define FL_POINTENTITY (1<<19) // this is point entity (was FL_IMMUNE_LAVA) +#define FL_IMMUNE_WATER (1<<17) // not used +#define FL_IMMUNE_SLIME (1<<18) // not used +#define FL_IMMUNE_LAVA (1<<19) // not used #define FL_PROXY (1<<20) // This is a spectator proxy #define FL_ALWAYSTHINK (1<<21) // Brush model flag -- call think every frame regardless of nextthink - ltime (for constantly changing velocity/path) #define FL_BASEVELOCITY (1<<22) // Base velocity has been applied this frame (used to convert base velocity into momentum) @@ -133,7 +133,8 @@ #define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something) #define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc. #define FL_PHS_FILTER (1<<27) // This entity requested phs bitvector in AddToFullPack calls -#define FL_CUSTOMENTITY (1<<29) // This is a custom entity +#define FL_PROJECTILE (1<<28) // This is a projectile entity +#define FL_TEAMSLAVE (1<<29) // Not first on the team ( engine 'moves with' spec) #define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time #define FL_DORMANT (1<<31) // Entity is dormant, no updates to client @@ -141,6 +142,7 @@ #define SF_START_ON (1<<0) // classic quake flags (must be not collide with any dll spawnflags - engine uses this) +// please include string "allow_inhibited_entities" into your gameinfo.txt if you want to enable this feature #define SF_NOT_EASY (1<<8) #define SF_NOT_MEDIUM (1<<9) #define SF_NOT_HARD (1<<10) @@ -236,8 +238,8 @@ typedef enum typedef enum { MOVETYPE_NONE = 0, // never moves - MOVETYPE_CONVEYOR, // simulate conveyor belt, push all stuff - MOVETYPE_STOP, // toggled between PUSHSTEP and STOP + MOVETYPE_CONVEYOR, // Xash3D: simulate conveyor belt, push all stuff + MOVETYPE_COMPOUND, // Xash3D: compound two entities MOVETYPE_WALK, // Player only - moving on the ground MOVETYPE_STEP, // gravity, special edge handling MOVETYPE_FLY, // No gravity, but still collides with stuff @@ -247,7 +249,7 @@ typedef enum MOVETYPE_FLYMISSILE,// extra size to monsters MOVETYPE_BOUNCE, // Just like Toss, but reflect velocity when contacting surfaces MOVETYPE_BOUNCEMISSILE,// bounce w/o gravity - MOVETYPE_FOLLOW, // attached models + MOVETYPE_FOLLOW, // studio attached models MOVETYPE_PUSHSTEP, // BSP model that needs physics/world collisions MOVETYPE_PHYSIC, // phys simulation } movetype_t; diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index d012276c..64d22a56 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -2022,15 +2022,7 @@ pfnGetModBounds */ void pfnGetModBounds( model_t modelIndex, float *mins, float *maxs ) { - if( pe ) - { - pe->Mod_GetBounds( modelIndex, mins, maxs ); - } - else - { - if( mins ) VectorClear( mins ); - if( maxs ) VectorClear( maxs ); - } + Mod_GetBounds( modelIndex, mins, maxs ); } /* diff --git a/engine/common/com_export.h b/engine/common/com_export.h index ee2c81eb..3e999453 100644 --- a/engine/common/com_export.h +++ b/engine/common/com_export.h @@ -32,7 +32,11 @@ _inline void CM_BeginRegistration( const char *name, bool clientload, uint *chec _inline void Mod_GetBounds( model_t handle, vec3_t mins, vec3_t maxs ) { if( pe ) pe->Mod_GetBounds( handle, mins, maxs ); - else mins[0] = mins[1] = mins[2] = maxs[0] = maxs[1] = maxs[2] = 0.0f; + else + { + if( mins ) mins[0] = mins[1] = mins[2] = 0.0f; + if( maxs ) maxs[0] = maxs[1] = maxs[2] = 0.0f; + } } _inline void Mod_GetFrames( model_t handle, int *numFrames ) diff --git a/engine/engine.plg b/engine/engine.plg deleted file mode 100644 index 14da1c85..00000000 --- a/engine/engine.plg +++ /dev/null @@ -1,102 +0,0 @@ - - -
-

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/host.c b/engine/host.c index 42cda0b8..36dd458d 100644 --- a/engine/host.c +++ b/engine/host.c @@ -865,6 +865,12 @@ void Host_Init( const int argc, const char **argv ) s = va( "^1Xash %g ^3%s", GI->version, buildstring ); Cvar_Get( "version", s, CVAR_INIT, "engine current version" ); + // content control + Cvar_Get( "violence_hgibs", "1", CVAR_SYSTEMINFO, "content control disables human gibs" ); + Cvar_Get( "violence_agibs", "1", CVAR_SYSTEMINFO, "content control disables alien gibs" ); + Cvar_Get( "violence_hblood", "1", CVAR_SYSTEMINFO, "content control disables human blood" ); + Cvar_Get( "violence_ablood", "1", CVAR_SYSTEMINFO, "content control disables alien blood" ); + NET_Init(); Netchan_Init(); diff --git a/engine/server/server.h b/engine/server/server.h index c4bd42b4..629ac806 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -159,22 +159,14 @@ struct sv_priv_s link_t area; // linked to a division node or leaf sv_client_t *client; // filled for player ents int lastcluster; // unused if num_clusters != -1 - int linkcount; int num_clusters; // if -1, use headnode instead int clusternums[MAX_ENT_CLUSTERS]; int framenum; // update framenumber int areanum, areanum2; bool linked; // passed through SV_LinkEdict - bool stuck; // entity stucked in brush - - // cached position to avoid redundant SV_CheckWaterTransition calls on monsters - bool forceupdate; // force an update on this entity - // (set by SV_PushMove code for moving water entities) - vec3_t water_origin; // updates whenever this changes - - vec3_t moved_origin; // used by PushMove to keep track of where objects were before - vec3_t moved_angles; // they were moved, in case they need to be moved back + vec3_t moved_origin; + vec3_t moved_angles; size_t pvdata_size; // member size of alloceed pvPrivateData // (used by SV_CopyEdict) @@ -338,7 +330,6 @@ void SV_Physics( void ); void SV_CheckVelocity( edict_t *ent ); bool SV_CheckWater( edict_t *ent ); bool SV_RunThink( edict_t *ent ); -bool SV_UnstickEntity( edict_t *ent ); void SV_FreeOldEntities( void ); bool SV_TestEntityPosition( edict_t *ent, const vec3_t offset ); // for EntityInSolid checks diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index 7ab37f0e..d6f7e795 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -1315,7 +1315,6 @@ int pfnDropToFloor( edict_t* e ) return false; } - SV_UnstickEntity( e ); VectorCopy( e->v.origin, end ); end[2] -= 256; @@ -1333,7 +1332,6 @@ int pfnDropToFloor( edict_t* e ) if( trace.fStartSolid ) { MsgDev( D_NOTE, "SV_DropToFloor: startsolid at %g %g %g\n", e->v.origin[0], e->v.origin[1], e->v.origin[2] ); - SV_UnstickEntity( e ); SV_LinkEdict( e, true ); e->v.flags |= FL_ONGROUND; e->v.groundentity = NULL; @@ -1343,7 +1341,6 @@ int pfnDropToFloor( edict_t* e ) { MsgDev( D_NOTE, "SV_DropToFloor: moved to %g %g %g\n", e->v.origin[0], e->v.origin[1], e->v.origin[2] ); VectorCopy( trace.vecEndPos, e->v.origin ); - SV_UnstickEntity( e ); SV_LinkEdict( e, true ); e->v.flags |= FL_ONGROUND; e->v.groundentity = trace.pHit; diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index bd515b3b..97c449ec 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -225,10 +225,11 @@ void SV_DeactivateServer( void ) { int i; - if( !svs.initialized || sv.state == ss_dead ) - return; + if( !svs.initialized ) return; SV_FreeEdicts (); + + if( sv.state == ss_dead ) return; sv.state = ss_dead; if( sys_sharedstrings->integer ) diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 58b5ca36..74da05c4 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -371,7 +371,7 @@ void SV_PrepWorldFrame( void ) ent->v.effects &= ~EF_MUZZLEFLASH; // clear NOINTERP flag automatically only for alive creatures - if( ent->v.flags & ( FL_MONSTER|FL_CLIENT|FL_FAKECLIENT ) && ent->v.health > 0.0f ) + if( ent->v.flags & ( FL_MONSTER|FL_CLIENT|FL_FAKECLIENT ) && ent->v.deadflag != DEAD_DEAD ) ent->v.effects &= ~EF_NOINTERP; } } diff --git a/engine/server/sv_move.c b/engine/server/sv_move.c index 55db27d4..2aba7789 100644 --- a/engine/server/sv_move.c +++ b/engine/server/sv_move.c @@ -591,9 +591,8 @@ SV_RunCmd void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd ) { edict_t *clent; - int i, oldmsec; - static usercmd_t cmd; vec3_t oldvel; + int i; cl->commandMsec -= ucmd->msec; @@ -604,20 +603,7 @@ void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd ) } clent = cl->edict; - cmd = *ucmd; - if( !clent || clent->free ) return; - - // chop up very long commands - if( cmd.msec > 50 ) - { - oldmsec = ucmd->msec; - cmd.msec = oldmsec / 2; - SV_RunCmd( cl, &cmd ); - cmd.msec = oldmsec / 2; - cmd.impulse = 0; - SV_RunCmd( cl, &cmd ); - return; - } + if( !SV_IsValidEdict( clent )) return; PM_CheckMovingGround( clent, ucmd->msec * 0.001f ); @@ -631,7 +617,7 @@ void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd ) // angles // show 1/3 the pitch angle and all the roll angle - if( clent->v.health > 0.0f ) + if( clent->v.deadflag != DEAD_DEAD ) { if( !clent->v.fixangle ) { @@ -640,12 +626,12 @@ void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd ) } } + svgame.globals->time = (sv.time * 0.001f); + svgame.globals->frametime = (sv.frametime * 0.001f); + if(!( clent->v.flags & FL_SPECTATOR )) { - svgame.globals->time = sv.time * 0.001f; - svgame.globals->frametime = ucmd->msec * 0.001f; svgame.dllFuncs.pfnPlayerPreThink( clent ); - SV_RunThink( clent ); // clients cannot be deleted from map // If conveyor, or think, set basevelocity, then send to client asap too. @@ -653,9 +639,12 @@ void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd ) VectorCopy( clent->v.basevelocity, clent->v.clbasevelocity ); } - if(( sv_maxclients->integer <= 1 ) && !CL_IsInGame( )) + if(( sv_maxclients->integer <= 1 ) && !CL_IsInGame( ) || ( clent->v.flags & FL_FROZEN )) ucmd->msec = 0; // pause + svgame.globals->time = (sv.time * 0.001f); + svgame.globals->frametime = (ucmd->msec * 0.001f); + // setup playermove state PM_SetupMove( svgame.pmove, clent, ucmd, cl->physinfo ); @@ -708,8 +697,6 @@ void SV_PostRunCmd( sv_client_t *cl ) if( !clent || clent->free ) return; svgame.pmove->runfuncs = false; // all next calls ignore footstep sounds - svgame.globals->frametime = 0.0f; // PlayerPostThink uses it - svgame.globals->time = sv.time * 0.001f; // run post-think if( clent->v.flags & FL_SPECTATOR ) diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 06b5a102..94252da7 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -28,6 +28,15 @@ solid_edge items only clip against bsp models. #define MOVE_EPSILON 0.01 #define MAX_CLIP_PLANES 5 +typedef struct +{ + edict_t *ent; + vec3_t origin; + vec3_t angles; +} pushed_t; + +pushed_t sv_pushed[MAX_EDICTS]; + /* =============================================================================== @@ -93,11 +102,11 @@ void SV_CheckAllEnts( void ) case MOVETYPE_NOCLIP: continue; default: - if( e->pvServerData->stuck ) - break; - else continue; + break; } - SV_UnstickEntity( e ); + + if( SV_TestEntityPosition( e, vec3_origin )) + MsgDev( D_INFO, "Stuck entity %s\n", SV_ClassName( e )); } } @@ -179,7 +188,7 @@ bool SV_RunThink( edict_t *ent ) if( thinktime <= 0.0f || thinktime > ( sv.time * 0.001f ) + ( sv.frametime * 0.001f )) return true; - if( thinktime < svgame.globals->time ) + if( thinktime < ( sv.time * 0.001f )) thinktime = ( sv.time * 0.001f ); // don't let things stay in the past. // it is possible to start that way // by a trigger with a local time. @@ -476,110 +485,6 @@ void SV_ClipVelocity( vec3_t in, vec3_t normal, vec3_t out, float overbounce ) } } -/* -=============================================================================== - - UNSTICK ENTITY CODE (not used by players, see pm_shared.c) - -=============================================================================== -*/ -typedef enum -{ - UNSTICK_STUCK = 0, - UNSTICK_GOOD = 1, - UNSTICK_UNSTUCK = 2 -} unstickresult_t; - -static const float unstickoffsets[] = -{ - // poutting -/+z changes first as they are least weird - 0.0f, 0.0f, -1.0f, - 0.0f, 0.0f, 1.0f, - - // x or y changes - -1.0f, 0.0f, 0.0f, - 1.0f, 0.0f, 0.0f, - 0.0f, -1.0f, 0.0f, - 0.0f, 1.0f, 0.0f, - - // x and y changes - -1.0f, -1.0f, 0.0f, - 1.0f, -1.0f, 0.0f, - -1.0f, 1.0f, 0.0f, - 1.0f, 1.0f, 0.0f, -}; - -unstickresult_t SV_UnstickEntityReturnOffset( edict_t *ent, vec3_t offset ) -{ - int i, maxunstick; - - // if not stuck in a bmodel, just return - if( !SV_TestEntityPosition( ent, vec3_origin )) - return UNSTICK_GOOD; - - for( i = 0; i < (int)(sizeof( unstickoffsets ) / sizeof( unstickoffsets[0] )); i += 3 ) - { - if( !SV_TestEntityPosition( ent, unstickoffsets + i )) - { - VectorCopy( unstickoffsets + i, offset ); - SV_LinkEdict( ent, false ); - ent->pvServerData->stuck = false; - - return UNSTICK_UNSTUCK; - } - } - - // magic number 0.36 allows unsticking by up to 17 units with the largest supported bbox - maxunstick = (int)(( ent->v.maxs[2] - ent->v.mins[2]) * 0.36f ); - - for( i = 2; i <= maxunstick; ++i ) - { - VectorClear( offset ); - offset[2] = -i; - - if( !SV_TestEntityPosition( ent, offset )) - { - SV_LinkEdict( ent, false ); - ent->pvServerData->stuck = false; - - return UNSTICK_UNSTUCK; - } - - offset[2] = i; - if( !SV_TestEntityPosition( ent, offset )) - { - SV_LinkEdict( ent, false ); - ent->pvServerData->stuck = false; - - return UNSTICK_UNSTUCK; - } - } - - // can't unstick - ent->pvServerData->stuck = true; - return UNSTICK_STUCK; -} - -bool SV_UnstickEntity( edict_t *ent ) -{ - vec3_t offset; - - switch( SV_UnstickEntityReturnOffset( ent, offset )) - { - case UNSTICK_GOOD: - return true; - case UNSTICK_UNSTUCK: - if( sv_check_errors->integer ) - MsgDev( D_INFO, "Unstuck entity \"%s\" with offset %f %f %f.\n", SV_ClassName( ent ), offset[0], offset[1], offset[2] ); - return true; - case UNSTICK_STUCK: - if( sv_check_errors->integer ) - MsgDev( D_INFO, "Stuck entity \"%s\".\n", SV_ClassName( ent )); - return false; - default: return false; - } -} - /* =============================================================================== @@ -728,7 +633,7 @@ int SV_TryMove( edict_t *ent, float time, trace_t *steptrace ) } } - if ( allFraction == 0 ) + if( allFraction == 0 ) VectorClear( ent->v.velocity ); return blocked; @@ -742,13 +647,6 @@ SV_AddGravity */ void SV_AddGravity( edict_t *ent ) { - if( ent->pvServerData->stuck ) - { - // stuck - VectorClear( ent->v.velocity ); - return; - } - if( ent->v.gravity ) // gravity modifier ent->v.velocity[2] -= sv_gravity->value * ent->v.gravity * svgame.globals->frametime; else ent->v.velocity[2] -= sv_gravity->value * svgame.globals->frametime; @@ -758,13 +656,6 @@ void SV_AddHalfGravity( edict_t *ent, float timestep ) { float ent_gravity; - if( ent->pvServerData->stuck ) - { - // stuck - VectorClear( ent->v.velocity ); - return; - } - if( ent->v.gravity ) ent_gravity = ent->v.gravity; else ent_gravity = 1.0f; @@ -787,17 +678,19 @@ PUSHMOVE */ /* ============ -SV_PushEntity +PM_PushEntity Does not change the entities velocity at all ============ */ -static bool SV_PushEntity( trace_t *trace, edict_t *ent, vec3_t push, bool failOnStartStuck, bool dolink ) +trace_t SV_PushEntity( edict_t *ent, const vec3_t lpush, const vec3_t apush, int *blocked ) { - int type; - vec3_t end; + trace_t trace; + sv_client_t *cl; + int type; + vec3_t end; - VectorAdd( ent->v.origin, push, end ); + VectorAdd( ent->v.origin, lpush, end ); if( ent->v.movetype == MOVETYPE_FLYMISSILE ) type = MOVE_MISSILE; @@ -805,276 +698,34 @@ static bool SV_PushEntity( trace_t *trace, edict_t *ent, vec3_t push, bool failO type = MOVE_NOMONSTERS; // only clip against bmodels else type = MOVE_NORMAL; - *trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, end, type|FTRACE_SIMPLEBOX, ent ); + trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, end, type|FTRACE_SIMPLEBOX, ent ); + VectorCopy( trace.vecEndPos, ent->v.origin ); + SV_LinkEdict( ent, true ); - if( trace->fStartStuck && failOnStartStuck ) - return true; + if( apush[YAW] && ent->v.flags & FL_CLIENT && ( cl = SV_ClientFromEdict( ent, true )) != NULL ) + { + // Because we can run multiple ticks per server frame, + // accumulate a total offset here instead of straight + // setting it. The engine will reset anglechange to 0 + // when the message is actually sent to the client + cl->anglechangetotal += apush[1]; + cl->anglechangefinal = apush[1]; + ent->v.fixangle = 2; + } - VectorCopy( trace->vecEndPos, ent->v.origin ); - SV_LinkEdict( ent, dolink ); + ent->v.angles[YAW] += trace.flFraction * apush[YAW]; - if(( ent->v.solid >= SOLID_TRIGGER && trace->pHit && (!(ent->v.flags & FL_ONGROUND) || ent->v.groundentity != trace->pHit ))) - return SV_Impact( ent, trace ); - return true; + if( blocked ) *blocked = !VectorCompare( ent->v.origin, end ); // can't move full distance + + // so we can run impact function afterwards. + if( trace.pHit && ( !(ent->v.flags & FL_ONGROUND) || ent->v.groundentity != trace.pHit )) + { + SV_Impact( ent, &trace ); + } + + return trace; } -/* -============ -SV_PushMove - -============ -*/ -void SV_PushMove( edict_t *pusher, float movetime ) -{ - int i, e, savesolid, index; - int checkcontents; - edict_t *pusherowner; - float movetime2, pushltime; - vec3_t mins, maxs, move, move1, moveangle; - vec3_t pushorg, pushang, a, forward, left, up, org; - int num_moved, numcheckentities; - static edict_t *checkentities[MAX_EDICTS]; - trace_t trace, trace2; - word moved_edicts[MAX_EDICTS]; - bool rotated; - - if( VectorIsNull( pusher->v.velocity ) && VectorIsNull( pusher->v.avelocity )) - { - pusher->v.ltime += movetime; - return; - } - - switch( pusher->v.solid ) - { - case SOLID_BSP: - case SOLID_BBOX: - case SOLID_SLIDEBOX: - break; - case SOLID_NOT: - case SOLID_TRIGGER: - // no collisions - VectorMA( pusher->v.origin, movetime, pusher->v.velocity, pusher->v.origin ); - VectorMA( pusher->v.angles, movetime, pusher->v.avelocity, pusher->v.angles ); - SV_ClampAngles( pusher->v.angles ); - SV_LinkEdict( pusher, false ); - return; - default: - MsgDev( D_ERROR, "SV_PushMove: entity %s, unrecognized solid type %i\n", SV_ClassName( pusher ), pusher->v.solid ); - return; - } - - index = pusher->v.modelindex; - if( index < 1 || index >= MAX_MODELS ) - { - MsgDev( D_ERROR, "SV_PushMove: entity %s has an invalid modelindex %\n", SV_ClassName( pusher ), pusher->v.modelindex ); - return; - } - - pusherowner = pusher->v.owner; - rotated = VectorLength2( pusher->v.angles ) + VectorLength2( pusher->v.avelocity ) > 0.0f; - - movetime2 = movetime; - VectorScale( pusher->v.velocity, movetime2, move1 ); - VectorScale( pusher->v.avelocity, movetime2, moveangle ); - - VectorNegate( moveangle, a ); - AngleVectorsFLU( a, forward, left, up ); - - VectorCopy( pusher->v.origin, pushorg ); - VectorCopy( pusher->v.angles, pushang ); - pushltime = pusher->v.ltime; - - // move the pusher to its final position -#if 1 - SV_LinearMove( pusher, movetime, pusher->v.friction ); - SV_AngularMove( pusher, movetime, pusher->v.friction ); -#else - VectorMA( pusher->v.origin, movetime, pusher->v.velocity, pusher->v.origin ); - VectorMA( pusher->v.angles, movetime, pusher->v.avelocity, pusher->v.angles ); -#endif - pusher->v.ltime += movetime; - SV_LinkEdict( pusher, false ); - savesolid = pusher->v.solid; - - // getting real bbox size - SV_TransformedBBox( pusher, mins, maxs ); - - // see if any solid entities are inside the final position - num_moved = 0; - numcheckentities = SV_AreaEdicts( mins, maxs, checkentities, svgame.globals->maxEntities, AREA_SOLID ); - - for( e = 0; e < numcheckentities; e++ ) - { - edict_t *check = checkentities[e]; - - // filter movetypes to collide with - switch( check->v.movetype ) - { - case MOVETYPE_NONE: - case MOVETYPE_PUSH: - case MOVETYPE_FOLLOW: - case MOVETYPE_NOCLIP: - continue; - default: break; - } - - if( check->v.owner == pusher ) - continue; - if( pusherowner == check ) - continue; - - // MsgDev( D_INFO, "%i %s ", check->serialnumber, SV_ClassName( check )); - - // tell any MOVETYPE_STEP entity that it may need to check for water transitions - check->pvServerData->forceupdate = true; - - checkcontents = World_MaskForEdict( check ); - - // if the entity is standing on the pusher, it will definitely be moved - // if the entity is not standing on the pusher, but is in the pusher's - // final position, move it - if(!( check->v.flags & FL_ONGROUND ) || check->v.groundentity != pusher ) - { - trace = SV_ClipMoveToEntity( pusher, check->v.origin, check->v.mins, check->v.maxs, check->v.origin, checkcontents, FTRACE_SIMPLEBOX ); - - if( !trace.fStartSolid ) - { - // MsgDev( D_INFO, "- not in solid\n" ); - continue; - } - } - - if( rotated ) - { - vec3_t org2; - - VectorSubtract( check->v.origin, pusher->v.origin, org ); - org2[0] = DotProduct( org, forward ); - org2[1] = DotProduct( org, left ); - org2[2] = DotProduct( org, up ); - VectorSubtract( org2, org, move ); - VectorAdd( move, move1, move ); - } - else VectorCopy( move1, move ); - - // MsgDev( D_INFO, "- pushing %f %f %f\n", move[0], move[1], move[2] ); - - VectorCopy( check->v.origin, check->pvServerData->moved_origin ); - VectorCopy( check->v.angles, check->pvServerData->moved_angles ); - moved_edicts[num_moved++] = NUM_FOR_EDICT( check ); - - // try moving the contacted entity - pusher->v.solid = SOLID_NOT; - if(!SV_PushEntity( &trace, check, move, true, true )) - { - // entity "check" got teleported - check->v.angles[1] += trace.flFraction * moveangle[1]; - pusher->v.solid = savesolid; // was SOLID_BSP - continue; // pushed enough - } - - // FIXME: turn players specially - check->v.angles[1] += trace.flFraction * moveangle[1]; - pusher->v.solid = savesolid; // was SOLID_BSP - - // this trace.flFraction < 1 check causes items to fall off of pushers - // if they pass under or through a wall - // the groundentity check causes items to fall off of ledges - if( check->v.movetype != MOVETYPE_WALK && ( trace.flFraction < 1.0f || check->v.groundentity != pusher )) - check->v.flags &= ~FL_ONGROUND; - - // if it is still inside the pusher, block - trace = SV_ClipMoveToEntity( pusher, check->v.origin, check->v.mins, check->v.maxs, check->v.origin, checkcontents, FTRACE_SIMPLEBOX ); - - if( trace.fStartSolid ) - { - // try moving the contacted entity a tiny bit further to account for precision errors - vec3_t move2; - - pusher->v.solid = SOLID_NOT; - VectorScale( move, 1.1f, move2 ); - VectorCopy( check->pvServerData->moved_origin, check->v.origin ); - VectorCopy( check->pvServerData->moved_angles, check->v.angles ); - - if( !SV_PushEntity( &trace2, check, move2, true, true )) - { - // entity "check" got teleported - continue; - } - - pusher->v.solid = savesolid; - trace = SV_ClipMoveToEntity( pusher, check->v.origin, check->v.mins, check->v.maxs, check->v.origin, checkcontents, FTRACE_SIMPLEBOX ); - - if( trace.fStartSolid ) - { - // try moving the contacted entity a tiny bit less to account for precision errors - pusher->v.solid = SOLID_NOT; - VectorScale( move, 0.9f, move2 ); - VectorCopy( check->pvServerData->moved_origin, check->v.origin ); - VectorCopy( check->pvServerData->moved_angles, check->v.angles ); - - if(!SV_PushEntity( &trace2, check, move2, true, true )) - { - // entity "check" got teleported - continue; - } - - pusher->v.solid = savesolid; - trace = SV_ClipMoveToEntity( pusher, check->v.origin, check->v.mins, check->v.maxs, check->v.origin, checkcontents, FTRACE_SIMPLEBOX ); - - if( trace.fStartSolid ) - { - // still inside pusher, so it's really blocked - - // fail the move - if( check->v.mins[0] == check->v.maxs[0] ) - continue; - - if( check->v.solid == SOLID_NOT || check->v.solid == SOLID_TRIGGER ) - { - // corpse - check->v.mins[0] = check->v.mins[1] = 0; - VectorCopy( check->v.mins, check->v.maxs ); - continue; - } - - VectorCopy( pushorg, pusher->v.origin ); - VectorCopy( pushang, pusher->v.angles ); - - pusher->v.ltime = pushltime; - SV_LinkEdict( pusher, false ); - - // move back any entities we already moved - for( i = 0; i < num_moved; i++ ) - { - edict_t *ed = EDICT_NUM( moved_edicts[i] ); - - VectorCopy( ed->pvServerData->moved_origin, ed->v.origin ); - VectorCopy( ed->pvServerData->moved_angles, ed->v.angles ); - SV_LinkEdict( ed, false ); - } - - // if the pusher has a "blocked" function, call it - // otherwise, just stay in place until the obstacle is gone - svgame.globals->time = (sv.time * 0.001f); - svgame.dllFuncs.pfnBlocked( pusher, check ); - break; - } - } - } - } - - SV_ClampAngles( pusher->v.angles ); -} - -typedef struct -{ - edict_t *ent; - vec3_t origin; - vec3_t angles; -} pushed_t; -pushed_t pushed[MAX_EDICTS], *pushed_p; - /* ============ SV_Push @@ -1083,16 +734,31 @@ Objects need to be moved back on a failed push, otherwise riders would continue to slide. ============ */ -bool SV_PushAngles( edict_t *pusher, vec3_t move, vec3_t amove ) +void SV_PushAngles( edict_t *pusher, float movetime ) { - int e, block; + int i, e, block; edict_t *check; - vec3_t mins, maxs; + vec3_t mins, maxs, move, amove; float oldsolid; - pushed_t *p; + pushed_t *p, *pushed_p; vec3_t org, org2, move2, forward, right, up; - pushed_p = pushed; + if( VectorIsNull( pusher->v.velocity ) && VectorIsNull( pusher->v.avelocity )) + { + // advances ltime when stop too for thinking + pusher->v.ltime += movetime; + return; + } + + for( i = 0; i < 3; i++ ) + { + move[i] = pusher->v.velocity[i] * movetime; + amove[i] = pusher->v.avelocity[i] * movetime; + mins[i] = pusher->v.absmin[i] + move[i]; + maxs[i] = pusher->v.absmax[i] + move[i]; + } + + pushed_p = sv_pushed; // getting real bbox size SV_TransformedBBox( pusher, mins, maxs ); @@ -1110,6 +776,7 @@ bool SV_PushAngles( edict_t *pusher, vec3_t move, vec3_t amove ) // move the pusher to it's final position VectorAdd( pusher->v.origin, move, pusher->v.origin ); VectorAdd( pusher->v.angles, amove, pusher->v.angles ); + pusher->v.ltime += movetime; SV_LinkEdict( pusher, false ); // see if any solid entities are inside the final position @@ -1125,6 +792,7 @@ bool SV_PushAngles( edict_t *pusher, vec3_t move, vec3_t amove ) case MOVETYPE_PUSH: case MOVETYPE_FOLLOW: case MOVETYPE_NOCLIP: + case MOVETYPE_COMPOUND: continue; default: break; } @@ -1224,21 +892,19 @@ bool SV_PushAngles( edict_t *pusher, vec3_t move, vec3_t amove ) // move back any entities we already moved // go backwards, so if the same entity was pushed // twice, it goes back to the original position - for( p = pushed_p - 1; p >= pushed; p-- ) + for( p = pushed_p - 1; p >= sv_pushed; p-- ) { VectorCopy( p->origin, p->ent->v.origin ); VectorCopy( p->angles, p->ent->v.angles ); SV_LinkEdict( p->ent, false ); } - return false; + return; } // FIXME: is there a better way to handle this? // see if anything we moved has touched a trigger - for( p = pushed_p - 1; p >= pushed; p-- ) + for( p = pushed_p - 1; p >= sv_pushed; p-- ) SV_TouchLinks( p->ent, sv_areanodes ); - - return true; } /* @@ -1247,26 +913,185 @@ SV_PushMove ============ */ -void SVHL_PushMove( edict_t *pusher, float movetime ) +void SV_PushMove( edict_t *pusher, float movetime ) { - int i; - vec3_t move; - vec3_t amove; + int i, e, oldsolid, num_moved; + vec3_t a, lmove, amove, org, org2, move2; + vec3_t forward, right, up, pushorg, pushang; + edict_t *check, *pusherowner, *moved_edict[MAX_EDICTS]; + bool rotated, blocked; + vec3_t mins, maxs; + float pushltime; + trace_t trace; + + switch( pusher->v.solid ) + { + case SOLID_BSP: + case SOLID_BBOX: + case SOLID_SLIDEBOX: + break; + case SOLID_NOT: + case SOLID_TRIGGER: + SV_LinearMove( pusher, movetime, pusher->v.friction ); + SV_AngularMove( pusher, movetime, pusher->v.friction ); + pusher->v.ltime += movetime; + SV_LinkEdict( pusher, false ); + return; + default: + Host_Error( "SV_PushMove: invalid solid type %i\n", pusher->v.solid ); + } if( VectorIsNull( pusher->v.velocity ) && VectorIsNull( pusher->v.avelocity )) { + // advances ltime when stop too for thinking pusher->v.ltime += movetime; return; } for( i = 0; i < 3; i++ ) { - move[i] = pusher->v.velocity[i] * movetime; + lmove[i] = pusher->v.velocity[i] * movetime; amove[i] = pusher->v.avelocity[i] * movetime; + mins[i] = pusher->v.absmin[i] + lmove[i]; + maxs[i] = pusher->v.absmax[i] + lmove[i]; } - if( SV_PushAngles( pusher, move, amove )) - pusher->v.ltime += movetime; + pusherowner = pusher->v.owner; + rotated = !VectorIsNull( amove ); + + VectorNegate( amove, a ); + AngleVectors( a, forward, right, up ); + + // save pusher parms + VectorCopy( pusher->v.origin, pushorg ); + VectorCopy( pusher->v.angles, pushang ); + pushltime = pusher->v.ltime; + + // getting real bbox size + SV_TransformedBBox( pusher, mins, maxs ); + + // move the pusher to it's final position + SV_LinearMove( pusher, movetime, pusher->v.friction ); + SV_AngularMove( pusher, movetime, pusher->v.friction ); + pusher->v.ltime += movetime; + SV_LinkEdict( pusher, false ); + + num_moved = 0; + oldsolid = pusher->v.solid; + + // see if any solid entities are inside the final position + for( e = 1; e < svgame.globals->numEntities; e++ ) + { + check = EDICT_NUM( e ); + if( !SV_IsValidEdict( check )) continue; + + // filter movetypes to collide with + switch( check->v.movetype ) + { + case MOVETYPE_NONE: + case MOVETYPE_PUSH: + case MOVETYPE_FOLLOW: + case MOVETYPE_NOCLIP: + case MOVETYPE_COMPOUND: + continue; + default: break; + } + + if( check->v.owner == pusher ) + continue; + if( pusherowner == check ) + continue; + + // if the entity is standing on the pusher, it will definitely be moved + if( !(( check->v.flags & FL_ONGROUND ) && check->v.groundentity == pusher )) + { + // see if the ent needs to be tested + if( check->v.absmin[0] >= maxs[0] + || check->v.absmin[1] >= maxs[1] + || check->v.absmin[2] >= maxs[2] + || check->v.absmax[0] <= mins[0] + || check->v.absmax[1] <= mins[1] + || check->v.absmax[2] <= mins[2] ) + continue; + + pusher->v.solid = SOLID_NOT; + trace = SV_ClipMoveToEntity( pusher, check->v.origin, check->v.mins, check->v.maxs, check->v.origin, MASK_SOLID, FTRACE_SIMPLEBOX ); + pusher->v.solid = oldsolid; // was SOLID_BSP + if( !trace.fStartSolid ) continue; // not touched + } + + VectorCopy( check->v.origin, check->pvServerData->moved_origin ); + VectorCopy( check->v.angles, check->pvServerData->moved_angles ); + moved_edict[num_moved++] = check; + + // try moving the contacted entity + pusher->v.solid = SOLID_NOT; + trace = SV_PushEntity( check, lmove, amove, &blocked ); + pusher->v.solid = oldsolid; // was SOLID_BSP + + if( check->v.groundentity == pusher ) + { + blocked = false; // probably groundents can't block pusher + check->v.flags |= FL_ONGROUND; + } + + if( rotated ) + { + // figure movement due to the pusher's amove + VectorSubtract( check->v.origin, pusher->v.origin, org ); + org2[0] = DotProduct( org, forward ); + org2[1] = -DotProduct( org, right ); + org2[2] = DotProduct( org, up ); + VectorSubtract( org2, org, move2 ); + + pusher->v.solid = SOLID_NOT; + trace = SV_PushEntity( check, move2, vec3_origin, &blocked ); + pusher->v.solid = oldsolid; // was SOLID_BSP + } + + // remove the onground flag for non-players + if( check->v.movetype != MOVETYPE_WALK && ( trace.flFraction < 1.0f || check->v.groundentity != pusher )) + check->v.flags &= ~FL_ONGROUND; + + // if it is still inside the pusher, block + if( blocked || SV_TestEntityPosition( check, vec3_origin )) + { + // fail the move + if( check->v.mins[0] == check->v.maxs[0] ) + continue; + + if( check->v.solid == SOLID_NOT || check->v.solid == SOLID_TRIGGER || check->v.deadflag == DEAD_DEAD ) + { + // corpse + check->v.mins[0] = check->v.mins[1] = 0; + VectorCopy( check->v.mins, check->v.maxs ); + continue; + } + + // restore oldpos + VectorCopy( pushorg, pusher->v.origin ); + VectorCopy( pushang, pusher->v.angles ); + pusher->v.ltime = pushltime; + SV_LinkEdict( pusher, false ); + + // move back any entities we already moved + for( i = 0; i < num_moved; i++ ) + { + edict_t *ed = moved_edict[i]; + + VectorCopy( ed->pvServerData->moved_origin, ed->v.origin ); + VectorCopy( ed->pvServerData->moved_angles, ed->v.angles ); + SV_LinkEdict( ed, false ); + } + + // call the pusher "blocked" function + svgame.globals->time = (sv.time * 0.001f); + Msg( "%s is blocked by %s\n", SV_ClassName( pusher ), SV_ClassName( check )); + svgame.dllFuncs.pfnBlocked( pusher, check ); + return; + } + + } } /* @@ -1280,9 +1105,6 @@ void SV_Physics_Pusher( edict_t *ent ) float thinktime; float oldltime; float movetime; - vec3_t oldorg, lmove; - vec3_t oldang, amove; - float l; oldltime = ent->v.ltime; thinktime = ent->v.nextthink; @@ -1292,72 +1114,19 @@ void SV_Physics_Pusher( edict_t *ent ) movetime = thinktime - ent->v.ltime; if( movetime < 0.0f ) movetime = 0.0f; } - else movetime = sv.frametime * 0.001f; + else movetime = (sv.frametime * 0.001f); if( movetime ) { - SVHL_PushMove( ent, movetime ); // advances ent->v.ltime if not blocked + SV_PushMove( ent, movetime ); // advances ent->v.ltime if not blocked } if( thinktime > oldltime && thinktime <= ent->v.ltime ) { - VectorCopy( ent->v.origin, oldorg ); - VectorCopy( ent->v.angles, oldang ); - - ent->v.nextthink = 0; + ent->v.nextthink = 0.0f; svgame.globals->time = (sv.time * 0.001f); svgame.dllFuncs.pfnThink( ent ); if( ent->free ) return; - - VectorSubtract( ent->v.origin, oldorg, lmove ); - VectorSubtract( ent->v.angles, oldang, amove); - - l = VectorLength( lmove ) + VectorLength( amove ); - if( l > ( 1.0f / 64 )) - { - VectorCopy( oldorg, ent->v.origin ); - VectorCopy( oldang, ent->v.angles ); - SV_PushAngles( ent, lmove, amove ); - } - - } - else if( ent->v.flags & FL_ALWAYSTHINK ) - { - ent->v.nextthink = 0; - svgame.globals->time = (sv.time * 0.001f); - svgame.dllFuncs.pfnThink( ent ); - } - SV_LinkEdict( ent, false ); -} - -/* -================ -SV_Physics_Pusher - -================ -*/ -void _SV_Physics_Pusher( edict_t *ent ) -{ - float movetime, thinktime, oldltime; - - oldltime = ent->v.ltime; - thinktime = ent->v.nextthink; - - if( thinktime < ent->v.ltime + svgame.globals->frametime ) - { - movetime = thinktime - ent->v.ltime; - if( movetime < 0 ) movetime = 0; - } - else movetime = svgame.globals->frametime; - - // advances ent->v.ltime if not blocked - if( movetime ) SV_PushMove( ent, movetime ); - - if( thinktime > oldltime && thinktime <= ent->v.ltime ) - { - ent->v.nextthink = 0; - svgame.globals->time = (sv.time * 0.001f); - svgame.dllFuncs.pfnThink( ent ); } else if( ent->v.flags & FL_ALWAYSTHINK ) { @@ -1371,30 +1140,31 @@ void _SV_Physics_Pusher( edict_t *ent ) /* ============= -SV_Physics_Follow +SV_Physics_Compound Entities that are "stuck" to another entity assume oldorigin as originoffset and oldangles as angle difference ============= */ -void SV_Physics_Follow( edict_t *ent ) +void SV_Physics_Compound( edict_t *ent ) { - vec3_t vf, vr, vu, angles, v; + vec3_t vf, vr, vu, angles; edict_t *parent; // regular thinking if( !SV_RunThink( ent )) 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 ); - } - parent = ent->v.aiment; if( !SV_IsValidEdict( parent )) return; + // force to hold current values as offsets + if( ent->v.effects & EF_NOINTERP ) + { + VectorSubtract( ent->v.origin, parent->v.origin, ent->v.oldorigin ); + VectorSubtract( ent->v.angles, parent->v.angles, ent->v.oldangles ); + ent->v.effects &= ~EF_NOINTERP; // done + } + if( VectorCompare( parent->v.angles, ent->v.oldangles )) { // quick case for no rotation @@ -1402,27 +1172,47 @@ void SV_Physics_Follow( edict_t *ent ) } else { - 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.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]; + vec3_t org, org2, move; - angles[0] = -parent->v.angles[0]; - angles[1] = parent->v.angles[1]; - angles[2] = parent->v.angles[2]; + VectorAdd( parent->v.origin, ent->v.oldorigin, ent->v.origin ); + + VectorSubtract( ent->v.origin, parent->v.origin, org ); + VectorNegate( parent->v.angles, angles ); AngleVectors( angles, vf, vr, vu ); - 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]; + org2[0] = DotProduct( ent->v.oldorigin, vf ); + org2[1] = -DotProduct( ent->v.oldorigin, vr ); + org2[2] = DotProduct( ent->v.oldorigin, vu ); + VectorSubtract( org2, ent->v.oldorigin, move ); + VectorAdd( ent->v.origin, move, ent->v.origin ); } VectorAdd( parent->v.angles, ent->v.oldangles, ent->v.angles ); SV_LinkEdict( ent, false ); } +/* +============= +SV_Physics_Follow + +just copy angles and origin of parent +============= +*/ +void SV_Physics_Follow( edict_t *ent ) +{ + edict_t *parent; + + // regular thinking + if( !SV_RunThink( ent )) return; + + parent = ent->v.aiment; + if( !SV_IsValidEdict( parent )) return; + + VectorCopy( parent->v.origin, ent->v.origin ); + VectorCopy( parent->v.angles, ent->v.angles ); + + SV_LinkEdict( ent, false ); // nocip ents never touch triggers +} + /* ============= SV_PhysicsNoclip @@ -1437,14 +1227,9 @@ void SV_Physics_Noclip( edict_t *ent ) SV_CheckWater( ent ); - // 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 + VectorMA( ent->v.origin, svgame.globals->frametime, ent->v.velocity, ent->v.origin ); + VectorMA( ent->v.angles, svgame.globals->frametime, ent->v.avelocity, ent->v.angles ); + SV_LinkEdict( ent, false ); // nocip ents never touch triggers } @@ -1455,7 +1240,6 @@ TOSS / BOUNCE ============================================================================== */ - /* ============= SV_CheckWaterTransition @@ -1487,128 +1271,6 @@ void SV_CheckWaterTransition( edict_t *ent ) } } -/* -============= -SV_Physics_Bounce - -Toss, bounce, and fly movement. When onground, do nothing. -============= -*/ -void SV_Physics_Bounce( edict_t *ent ) -{ - trace_t trace; - vec3_t move; - float movetime; - int bump; - - // check for in water - SV_CheckWater( ent ); - - // regular thinking - if( !SV_RunThink( ent )) return; - - // if onground, return without moving - if( ent->v.flags & FL_ONGROUND ) - { - if( ent->v.velocity[2] >= DIST_EPSILON ) - { - // don't stick to ground if onground and moving upward - ent->v.flags &= ~FL_ONGROUND; - } - else return; - } - - SV_CheckVelocity( ent ); - - // add gravity - switch( ent->v.movetype ) - { - case MOVETYPE_FLY: - case MOVETYPE_FLYMISSILE: - case MOVETYPE_BOUNCEMISSILE: - break; - default: - SV_AddGravity( ent ); - break; - } - - // move angles - VectorMA( ent->v.angles, svgame.globals->frametime, ent->v.avelocity, ent->v.angles ); - - movetime = svgame.globals->frametime; - for( bump = 0; bump < MAX_CLIP_PLANES && movetime > 0; bump++ ) - { - // move origin - VectorScale( ent->v.velocity, movetime, move ); - - if( !SV_PushEntity( &trace, ent, move, true, true )) - return; // teleported - if( ent->free ) return; - - if( trace.fStartStuck ) - { - // try to unstick the entity - SV_UnstickEntity( ent ); - if( !SV_PushEntity( &trace, ent, move, false, true )) - return; // teleported - if( ent->free ) return; - } - - if( trace.flFraction == 1.0f ) - break; - - movetime *= 1 - min( 1, trace.flFraction ); - - if( ent->v.movetype == MOVETYPE_BOUNCEMISSILE ) - { - SV_ClipVelocity( ent->v.velocity, trace.vecPlaneNormal, ent->v.velocity, 2.0f ); - ent->v.flags &= ~FL_ONGROUND; - } - else if( ent->v.movetype == MOVETYPE_BOUNCE ) - { - float d, ent_gravity; - float bouncefactor = 0.5f; - float bouncestop = 60.0f / 800.0f; - - if( ent->v.friction != 0.0f ) - bouncefactor = ent->v.friction; - - SV_ClipVelocity( ent->v.velocity, trace.vecPlaneNormal, ent->v.velocity, 1.0f + bouncefactor ); - - if( ent->v.gravity != 0.0f ) - ent_gravity = ent->v.gravity; - else ent_gravity = 1.0; - - d = fabs( DotProduct( trace.vecPlaneNormal, ent->v.velocity )); - if( trace.vecPlaneNormal[2] > 0.7f && d < sv_gravity->value * bouncestop * ent_gravity ) - { - ent->v.flags |= FL_ONGROUND; - ent->v.groundentity = trace.pHit; - VectorClear( ent->v.velocity ); - VectorClear( ent->v.avelocity ); - } - else ent->v.flags &= ~FL_ONGROUND; - } - else - { - SV_ClipVelocity( ent->v.velocity, trace.vecPlaneNormal, ent->v.velocity, 1.0f ); - if( trace.vecPlaneNormal[2] > 0.7f ) - { - ent->v.flags |= FL_ONGROUND; - ent->v.groundentity = trace.pHit; - VectorClear( ent->v.velocity ); - VectorClear( ent->v.avelocity ); - } - else ent->v.flags &= ~FL_ONGROUND; - } - if(( ent->v.movetype != MOVETYPE_BOUNCE && ent->v.movetype == MOVETYPE_BOUNCEMISSILE ) || ( ent->v.flags & FL_ONGROUND )) - break; - } - - // check for in water - SV_CheckWaterTransition( ent ); -} - /* ============= SV_Physics_Toss @@ -1622,15 +1284,11 @@ void SV_Physics_Toss( edict_t *ent ) vec3_t move; float backoff; - SV_CheckWaterTransition( ent ); - SV_CheckWater( ent ); - // regular thinking if( !SV_RunThink( ent )) return; - // if onground, return without moving - if( ent->v.flags & FL_ONGROUND ) - return; + SV_CheckWaterTransition( ent ); + SV_CheckWater( ent ); if( ent->v.velocity[2] > DIST_EPSILON ) { @@ -1638,8 +1296,8 @@ void SV_Physics_Toss( edict_t *ent ) ent->v.groundentity = NULL; } - // If on ground and not moving, return. - if( SV_IsValidEdict( ent->v.groundentity )) + // if on ground and not moving, return. + if( ent->v.flags & FL_ONGROUND && SV_IsValidEdict( ent->v.groundentity )) { if( VectorIsNull( ent->v.basevelocity ) && VectorIsNull( ent->v.velocity )) return; @@ -1651,8 +1309,8 @@ void SV_Physics_Toss( edict_t *ent ) switch( ent->v.movetype ) { case MOVETYPE_FLY: - case MOVETYPE_BOUNCEMISSILE: case MOVETYPE_FLYMISSILE: + case MOVETYPE_BOUNCEMISSILE: break; default: SV_AddGravity( ent ); @@ -1670,6 +1328,7 @@ void SV_Physics_Toss( edict_t *ent ) SV_AngularMove( ent, svgame.globals->frametime, 0.0f ); break; } + // move origin // Base velocity is not properly accounted for since this entity will move again // after the bounce without taking it into account @@ -1679,20 +1338,9 @@ void SV_Physics_Toss( edict_t *ent ) VectorScale( ent->v.velocity, svgame.globals->frametime, move ); VectorSubtract( ent->v.velocity, ent->v.basevelocity, ent->v.velocity ); - if( !SV_PushEntity( &trace, ent, move, false, true )) - return; // teleported - + trace = SV_PushEntity( ent, move, vec3_origin, NULL ); if( ent->free ) return; - if( trace.fStartStuck ) - { - // try to unstick the entity - SV_UnstickEntity( ent ); - if( !SV_PushEntity( &trace, ent, move, false, true )) - return; // teleported - if( ent->free ) return; - } - SV_CheckVelocity( ent ); if( trace.fAllSolid ) @@ -1700,14 +1348,13 @@ void SV_Physics_Toss( edict_t *ent ) // entity is trapped in another solid ent->v.flags |= FL_ONGROUND; ent->v.groundentity = trace.pHit; - ent->pvServerData->stuck = true; VectorClear( ent->v.velocity ); return; } if( trace.flFraction == 1.0f ) { - SV_CheckWaterTransition( ent ); + SV_CheckWater( ent ); return; } @@ -1728,8 +1375,8 @@ void SV_Physics_Toss( edict_t *ent ) { // we're rolling on the ground, add static friction. ent->v.groundentity = trace.pHit; - ent->v.velocity[2] = 0.0f; ent->v.flags |= FL_ONGROUND; + ent->v.velocity[2] = 0.0f; } vel = DotProduct( ent->v.velocity, ent->v.velocity ); @@ -1738,14 +1385,12 @@ void SV_Physics_Toss( edict_t *ent ) { ent->v.flags |= FL_ONGROUND; ent->v.groundentity = trace.pHit; - VectorClear( ent->v.velocity ); - VectorClear( ent->v.avelocity ); + VectorClear( ent->v.velocity ); // avelocity clearing in server.dll } else { VectorScale( ent->v.velocity, (1.0f - trace.flFraction) * svgame.globals->frametime * 0.9f, move ); - if( !SV_PushEntity( &trace, ent, move, false, true )) - return; // teleported + trace = SV_PushEntity( ent, move, vec3_origin, NULL ); if( ent->free ) return; } } @@ -1761,31 +1406,6 @@ STEPPING MOVEMENT =============================================================================== */ -void SV_AddRotationalFriction( edict_t *ent ) -{ - int i; - float adjustment; - - VectorMA( ent->v.angles, svgame.globals->frametime, ent->v.avelocity, ent->v.angles ); - adjustment = svgame.globals->frametime * sv_stopspeed->value * sv_friction->value; - - for( i = 0; i < 3; i++ ) - { - 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; - } - else - { - ent->v.avelocity[i] += adjustment; - if( ent->v.avelocity[i] > 0.0f ) - ent->v.avelocity[i] = 0.0f; - } - } -} - /* ============= SV_Physics_Step @@ -1797,7 +1417,7 @@ This is also used for objects that have become still on the ground, but will fall if the floor is pulled out from under them. ============= */ -void SV_Physics_Step_RunTimestep( edict_t *ent, float timestep ) +void SV_Physics_Step( edict_t *ent ) { bool wasonground; bool inwater; @@ -1827,7 +1447,7 @@ void SV_Physics_Step_RunTimestep( edict_t *ent, float timestep ) if( !inwater ) { - SV_AddHalfGravity( ent, timestep ); + SV_AddHalfGravity( ent, svgame.globals->frametime ); isfalling = true; } } @@ -1836,13 +1456,13 @@ void SV_Physics_Step_RunTimestep( edict_t *ent, float timestep ) if( ent->v.waterlevel > 1 ) { VectorScale( ent->v.velocity, 0.9f, ent->v.velocity ); - ent->v.velocity[2] += (ent->v.skin * timestep); + ent->v.velocity[2] += (ent->v.skin * svgame.globals->frametime); } else if( ent->v.waterlevel == 1 ) { if( ent->v.velocity[2] > 0.0f ) - ent->v.velocity[2] = timestep; - ent->v.velocity[2] -= (ent->v.skin * timestep); + ent->v.velocity[2] = svgame.globals->frametime; + ent->v.velocity[2] -= (ent->v.skin * svgame.globals->frametime); } } } @@ -1871,7 +1491,7 @@ void SV_Physics_Step_RunTimestep( edict_t *ent, float timestep ) if( speed ) { control = speed < sv_stopspeed->value ? sv_stopspeed->value : speed; - newspeed = speed - timestep * control * friction; + newspeed = speed - svgame.globals->frametime * control * friction; if( newspeed < 0.0f ) newspeed = 0.0f; @@ -1884,10 +1504,10 @@ void SV_Physics_Step_RunTimestep( edict_t *ent, float timestep ) VectorAdd( ent->v.velocity, ent->v.basevelocity, ent->v.velocity ); - SV_AngularMove( ent, timestep, friction ); + SV_AngularMove( ent, svgame.globals->frametime, friction ); SV_CheckVelocity( ent ); - SV_TryMove( ent, timestep, NULL ); + SV_TryMove( ent, svgame.globals->frametime, NULL ); SV_CheckVelocity( ent ); VectorSubtract( ent->v.velocity, ent->v.basevelocity, ent->v.velocity ); @@ -1924,45 +1544,14 @@ void SV_Physics_Step_RunTimestep( edict_t *ent, float timestep ) if(!( ent->v.flags & FL_ONGROUND) && isfalling ) { - SV_AddHalfGravity( ent, timestep ); + SV_AddHalfGravity( ent, svgame.globals->frametime ); } -} -void SV_Physics_Step( edict_t *ent ) -{ - SV_Physics_Step_RunTimestep( ent, svgame.globals->frametime ); if( !SV_RunThink( ent )) return; + SV_CheckWaterTransition( ent ); } -/* -============ -SV_WallFriction - -============ -*/ -void SV_WallFriction( edict_t *ent, trace_t *trace ) -{ - vec3_t forward; - vec3_t into, side; - float d, i; - - AngleVectors( ent->v.viewangles, forward, NULL, NULL ); - d = DotProduct( trace->vecPlaneNormal, forward ); - - d += 0.5f; - if( d >= 0.0f || IS_NAN( d )) - return; - - // cut the tangential velocity - i = DotProduct( trace->vecPlaneNormal, ent->v.velocity ); - VectorScale( trace->vecPlaneNormal, i, into ); - VectorSubtract( ent->v.velocity, into, side ); - - ent->v.velocity[0] = side[0] * (1 + d); - ent->v.velocity[1] = side[1] * (1 + d); -} - /* ==================== SV_Physics_Conveyor @@ -2059,6 +1648,9 @@ static void SV_Physics_Entity( edict_t *ent ) case MOVETYPE_FOLLOW: SV_Physics_Follow( ent ); break; + case MOVETYPE_COMPOUND: + SV_Physics_Compound( ent ); + break; case MOVETYPE_STEP: case MOVETYPE_PUSHSTEP: SV_Physics_Step( ent ); diff --git a/engine/server/sv_world.c b/engine/server/sv_world.c index ea8f3781..eb29d4bf 100644 --- a/engine/server/sv_world.c +++ b/engine/server/sv_world.c @@ -215,7 +215,6 @@ void SV_LinkEdict( edict_t *ent, bool touch_triggers ) } } - ent->pvServerData->linkcount++; ent->pvServerData->s.ed_flags |= ESF_LINKEDICT; // change edict state on a client too... sv_ent->linked = true; diff --git a/game_shared/pm_shared.cpp b/game_shared/pm_shared.cpp index 0d157d5a..1737e87b 100644 --- a/game_shared/pm_shared.cpp +++ b/game_shared/pm_shared.cpp @@ -1593,7 +1593,7 @@ int PM_CheckStuck( void ) if ( !pmove->server ) { // World or BSP model - if ( hitent == ENTINDEX( 0 ) || ( hitent && Mod_GetType( hitent->v.modelindex ) == mod_brush )) + if ( hitent == ENTINDEX( 0 ) || ( hitent && Mod_GetType( hitent->v.modelindex ) == mod_world )) { int nReps = 0; @@ -1644,6 +1644,7 @@ int PM_CheckStuck( void ) return 0; } + /* // If player is flailing while stuck in another player ( should never happen ), then see // if we can't "unstick" them forceably. if( pmove->cmd.buttons & (IN_JUMP|IN_DUCK|IN_ATTACK) && ( hitent && hitent->v.flags & FL_CLIENT )) @@ -1674,9 +1675,7 @@ int PM_CheckStuck( void ) } } } - - // pmove->origin = base; - + */ return 1; } diff --git a/server/ents/baseentity.cpp b/server/ents/baseentity.cpp index 63cd0d2c..38499e01 100644 --- a/server/ents/baseentity.cpp +++ b/server/ents/baseentity.cpp @@ -167,7 +167,7 @@ void CBaseEntity :: SetParent( CBaseEntity* pParent, int m_iAttachment ) if( m_iAttachment ) { - if( pev->flags & FL_POINTENTITY || pev->flags & FL_MONSTER ) + if( pFlags & PF_POINTENTITY || pev->flags & FL_MONSTER ) { pev->colormap = ((pev->colormap & 0xFF00)>>8) | m_iAttachment; pev->aiment = m_pParent->edict(); @@ -209,7 +209,7 @@ void CBaseEntity :: SetParent( CBaseEntity* pParent, int m_iAttachment ) OffsetOrigin = pev->origin - pParentOrigin; OffsetAngles = pev->angles - pParentAngles; - if((m_pParent->pFlags & PF_ANGULAR && OffsetOrigin != g_vecZero) || m_pParent->pev->flags & FL_POINTENTITY) + if((m_pParent->pFlags & PF_ANGULAR && OffsetOrigin != g_vecZero) || m_pParent->pFlags & PF_POINTENTITY) { SetBits (pFlags, PF_POSTORG);//magic stuff //GetPInfo( this ); diff --git a/server/ents/basefx.cpp b/server/ents/basefx.cpp index 89b476af..d79bcfdf 100644 --- a/server/ents/basefx.cpp +++ b/server/ents/basefx.cpp @@ -688,7 +688,7 @@ void CSprite::Spawn( void ) pev->solid = SOLID_NOT; pev->movetype = MOVETYPE_NOCLIP; pev->frame = 0; - SetBits( pev->flags, FL_POINTENTITY ); + SetBits( pFlags, PF_POINTENTITY ); pev->angles.x = -pev->angles.x; pev->angles.y = 180 - pev->angles.y; diff --git a/server/ents/baseinfo.cpp b/server/ents/baseinfo.cpp index 3b526b52..843f048e 100644 --- a/server/ents/baseinfo.cpp +++ b/server/ents/baseinfo.cpp @@ -22,7 +22,7 @@ public: pev->solid = SOLID_NOT; UTIL_SetModel(ENT(pev),"models/common/null.mdl"); UTIL_SetSize(pev, g_vecZero, g_vecZero); - SetBits( pev->flags, FL_POINTENTITY ); + SetBits( pFlags, PF_POINTENTITY ); } }; @@ -72,7 +72,7 @@ public: pev->soundindex = pev->impulse; UTIL_SetModel( ENT( pev ), "models/props/torch1.mdl" ); UTIL_SetSize(pev, g_vecZero, g_vecZero); - SetBits( pev->flags, FL_POINTENTITY ); + SetBits( pFlags, PF_POINTENTITY ); pev->animtime = gpGlobals->time + 0.2; // enable animation pev->framerate = 0.5f; } @@ -327,7 +327,7 @@ void CInfoPath :: Spawn( void ) m_iState = STATE_ON; m_index = 0; - SetBits( pev->flags, FL_POINTENTITY ); + SetBits( pFlags, PF_POINTENTITY ); UTIL_SetModel( ENT( pev ), "blabla.mdl"); pev->scale = 0.1f; } diff --git a/server/ents/baseinfo.h b/server/ents/baseinfo.h index 3a9b995a..f14aac7b 100644 --- a/server/ents/baseinfo.h +++ b/server/ents/baseinfo.h @@ -8,7 +8,7 @@ class CPointEntity : public CBaseEntity { public: - void Spawn( void ){ SetBits( pev->flags, FL_POINTENTITY ); pev->solid = SOLID_NOT; } + void Spawn( void ){ SetBits( pFlags, PF_POINTENTITY ); pev->solid = SOLID_NOT; } virtual int ObjectCaps( void ) { return CBaseEntity :: ObjectCaps() & ~FCAP_ACROSS_TRANSITION; } }; diff --git a/server/ents/basetank.cpp b/server/ents/basetank.cpp index b0d0f502..38544647 100644 --- a/server/ents/basetank.cpp +++ b/server/ents/basetank.cpp @@ -172,7 +172,6 @@ void CFuncTank :: Spawn( void ) if ( m_spread > MAX_FIRING_SPREADS ) m_spread = 0; pev->oldorigin = pev->origin; - pev->flags |= FL_TANK;//this is tank entity } void CFuncTank::PostSpawn( void ) @@ -1072,18 +1071,18 @@ BOOL CFuncTankControls :: OnControls( entvars_t *pevTest ) return FALSE; } -void CFuncTankControls :: HandleTank ( CBaseEntity *pActivator, CBaseEntity *m_pTank, BOOL activate ) +void CFuncTankControls :: HandleTank ( CBaseEntity *pActivator, CBaseEntity *pTank, BOOL activate ) { - if(m_pTank->pev->flags & FL_TANK)//it's tank entity + if( !strncmp( STRING( pTank->pev->classname ), "func_tank", 9 )) { - if(activate) + if( activate ) { - if (((CFuncTank*)m_pTank)->StartControl((CBasePlayer*)pActivator, this)) + if( (( CFuncTank *)pTank)->StartControl(( CBasePlayer *)pActivator, this )) { m_iState = STATE_ON; //we have active tank! } } - else ((CFuncTank*)m_pTank)->StopControl(this); + else (( CFuncTank *)pTank)->StopControl( this ); } } diff --git a/server/ents/basetrigger.cpp b/server/ents/basetrigger.cpp index d25c9c0f..bdb99843 100644 --- a/server/ents/basetrigger.cpp +++ b/server/ents/basetrigger.cpp @@ -314,7 +314,7 @@ class CTriggerPush : public CBaseTrigger pOwner = UTIL_FindEntityByTargetname( NULL, STRING( pev->target )); if( !pOwner ) return; // dir set with angles - if( pOwner->pev->flags & FL_POINTENTITY ) + if( pOwner->pFlags & PF_POINTENTITY ) { // xash allows to precache from random place UTIL_PrecacheSound( "world/jumppad.wav" ); @@ -795,7 +795,7 @@ void CTriggerCamera :: Spawn (void ) UTIL_SetModel( ENT( pev ), "models/common/null.mdl" ); UTIL_SetSize( pev, g_vecZero, g_vecZero ); - SetBits( pev->flags, FL_POINTENTITY ); + SetBits( pFlags, PF_POINTENTITY ); } void CTriggerCamera::PostSpawn( void ) diff --git a/server/global/utils.h b/server/global/utils.h index f77f46d5..f5ab6099 100644 --- a/server/global/utils.h +++ b/server/global/utils.h @@ -778,6 +778,7 @@ void COM_FreeFile (char *buffer); #define PF_PARENTMOVE (1<<10) //parent give me velocity or avelocity #define PF_ANGULAR (1<<11) //parent has angular moving #define PF_POSTORG (1<<12) //this entity MUST changed origin only +#define PF_POINTENTITY (1<<13) #define PF_LINKCHILD (PF_AFFECT|PF_DESIRED|PF_MERGEPOS|PF_POSTORG) BOOL FClassnameIs(CBaseEntity *pEnt, const char* szClassname); diff --git a/server/quake.cpp b/server/quake.cpp index 260d9ddd..8e25a306 100644 --- a/server/quake.cpp +++ b/server/quake.cpp @@ -26,7 +26,7 @@ public: pev->soundindex = pev->impulse; UTIL_SetModel( ENT( pev ), "models/props/torch1.mdl" ); UTIL_SetSize(pev, g_vecZero, g_vecZero); - SetBits( pev->flags, FL_POINTENTITY ); + SetBits( pFlags, PF_POINTENTITY ); pev->animtime = gpGlobals->time + 0.2; // enable animation pev->framerate = 0.5f; } diff --git a/spirit/crossbow.cpp b/spirit/crossbow.cpp index 03b662cf..b73da7ac 100644 --- a/spirit/crossbow.cpp +++ b/spirit/crossbow.cpp @@ -147,7 +147,12 @@ void CCrossbowBolt::BoltTouch( CBaseEntity *pOther ) if( pOther->IsBSPModel()) { - SetParent( pOther );//glue bolt with parent system + // TEST compound + pev->movetype = MOVETYPE_COMPOUND; + pev->aiment = pOther->edict(); + pev->effects |= EF_NOINTERP; + +// SetParent( pOther );//glue bolt with parent system } if (UTIL_PointContents(pev->origin) != CONTENTS_WATER) diff --git a/spirit/effects.cpp b/spirit/effects.cpp index 2798031c..cd6c315d 100644 --- a/spirit/effects.cpp +++ b/spirit/effects.cpp @@ -1031,7 +1031,6 @@ void CLightning::BeamUpdateVars( void ) pev->skin = 0; pev->sequence = 0; pev->rendermode = 0; - pev->flags |= FL_CUSTOMENTITY; pev->model = m_iszSpriteName; SetTexture( m_spriteTexture ); @@ -1079,7 +1078,6 @@ void CLaser::Spawn( void ) Precache( ); SetThink(&CLaser:: StrikeThink ); - pev->flags |= FL_CUSTOMENTITY; } void CLaser::PostSpawn( void ) diff --git a/spirit/glock.cpp b/spirit/glock.cpp index 418fa01c..ef737fe5 100644 --- a/spirit/glock.cpp +++ b/spirit/glock.cpp @@ -161,7 +161,9 @@ void CGlock::PrimaryAttack( void ) Vector vecDir; vecDir = m_pPlayer->FireBulletsPlayer( 1, vecSrc, vecAiming, Vector( 0.02, 0.02, 0.02 ), 8192, BULLET_PLAYER_9MM, 0, 0, m_pPlayer->pev, m_pPlayer->random_seed ); - PLAYBACK_EVENT_FULL( 0, m_pPlayer->edict(), m_usFireGlock, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, pev->body, 0, ( m_iClip == 0 ) ? 1 : 0, m_iBody ); + int iAnim = ( m_iClip == 0 ) ? GLOCK_SHOOT_EMPTY : GLOCK_SHOOT; + + PLAYBACK_EVENT_FULL( 0, m_pPlayer->edict(), m_usFireGlock, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, pev->body, iAnim, 0, m_iBody ); m_flNextPrimaryAttack = m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.35; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + RANDOM_FLOAT ( 10, 15 ); diff --git a/spirit/squeakgrenade.cpp b/spirit/squeakgrenade.cpp index c2408a4f..7b3de885 100644 --- a/spirit/squeakgrenade.cpp +++ b/spirit/squeakgrenade.cpp @@ -462,11 +462,13 @@ void CSqueak::PrimaryAttack() // Move origin up if crouched and start trace a bit outside of body ( 20 units instead of 16 ) trace_origin = m_pPlayer->pev->origin; if ( m_pPlayer->pev->flags & FL_DUCKING ) + { trace_origin = trace_origin - ( VEC_HULL_MIN - VEC_DUCK_HULL_MIN ); + } // find place to toss monster UTIL_TraceLine( trace_origin + gpGlobals->v_forward * 20, trace_origin + gpGlobals->v_forward * 64, dont_ignore_monsters, NULL, &tr ); - PLAYBACK_EVENT_FULL( 0, m_pPlayer->edict(), m_usSnarkFire, 0.0, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, pev->body, 0, 0, 0 ); + PLAYBACK_EVENT_FULL( 0, m_pPlayer->edict(), m_usSnarkFire, 0.0, g_vecZero, g_vecZero, 0.0, 0.0, pev->body, 0, 0, 0 ); if ( tr.fAllSolid == 0 && tr.fStartSolid == 0 && tr.flFraction > 0.25 ) { diff --git a/todo.log b/todo.log index 614a0ba2..9feb8590 100644 --- a/todo.log +++ b/todo.log @@ -34,5 +34,5 @@ Xash 0.71 Beta 05.05.10 10.revision MOVETYPE_PUSH physic 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 +13. revision MOVETYPE_BOUNCE physic OK +14. revision MOVETYPE_COMPOUND physic \ No newline at end of file diff --git a/vid_gl/r_draw.c b/vid_gl/r_draw.c index d51cbb14..77aa6e8a 100644 --- a/vid_gl/r_draw.c +++ b/vid_gl/r_draw.c @@ -249,7 +249,7 @@ static void Tri_DrawPolygon( void ) tri_mesh.colorsArray[0] = tri_colors; tri_mesh.elems = tri_elems; - if( tri_mbuffer.shaderkey != (int)shader->sortkey || -tri_mbuffer.infokey-1+4 > MAX_ARRAY_VERTS ) + if( tri_mbuffer.shaderkey != (int)shader->sortkey || -tri_mbuffer.infokey-1+32 > MAX_ARRAY_VERTS ) { if( tri_mbuffer.shaderkey ) { diff --git a/vid_gl/r_main.c b/vid_gl/r_main.c index fba62e7b..d78773d1 100644 --- a/vid_gl/r_main.c +++ b/vid_gl/r_main.c @@ -2108,8 +2108,14 @@ int R_ComputeFxBlend( ref_entity_t *e ) } // store value back into client entity, some effects requires this - if( m_pEntity ) m_pEntity->v.renderamt = renderAmt; + if( m_pEntity ) + { + m_pEntity->v.renderamt = renderAmt; + // NOTE: never pass sprites with rendercolor '0 0 0' it's a stupid Valve Hammer Editor bug + if(( !e->rendercolor[0] && !e->rendercolor[1] && !e->rendercolor[2] )) + VectorSet( e->rendercolor, 255, 255, 255 ); + } blend = bound( 0, blend, 255 ); return blend;