Browse Source

Merge branch 'master' into caseclosed

caseclosed
Andrey Akhmichin 4 years ago
parent
commit
78217fbf1d
  1. 25
      cl_dll/ev_hldm.cpp
  2. 10
      cl_dll/hl/hl_weapons.cpp
  3. 23
      cl_dll/hud_spectator.cpp
  4. 6
      cl_dll/input.cpp
  5. 4
      cl_dll/scoreboard.cpp
  6. 4
      cl_dll/view.cpp
  7. 5
      cmake/LibraryNaming.cmake
  8. 5
      dlls/bigmomma.cpp
  9. 2
      dlls/buttons.cpp
  10. 5
      dlls/cbase.cpp
  11. 2
      dlls/cbase.h
  12. 2
      dlls/crowbar.cpp
  13. 2
      dlls/game.cpp
  14. 36
      dlls/gauss.cpp
  15. 1
      dlls/houndeye.cpp
  16. 2
      dlls/monsterstate.cpp
  17. 6
      dlls/mp5.cpp
  18. 16
      dlls/multiplay_gamerules.cpp
  19. 33
      dlls/player.cpp
  20. 3
      dlls/scientist.cpp
  21. 4
      dlls/shotgun.cpp
  22. 7
      dlls/squadmonster.cpp
  23. 4
      dlls/triggers.cpp
  24. 3
      dlls/turret.cpp
  25. 40
      dlls/weapons.cpp
  26. 6
      dlls/weapons.h
  27. 14
      pm_shared/pm_shared.c
  28. 4
      public/build.h
  29. 3
      scripts/waifulib/library_naming.py
  30. 12
      waf
  31. 43
      wscript

25
cl_dll/ev_hldm.cpp

@ -948,13 +948,13 @@ void EV_FireGauss( event_args_t *args )
0.1f, 0.1f,
m_fPrimaryFire ? 1.0f : 2.5f, m_fPrimaryFire ? 1.0f : 2.5f,
0.0f, 0.0f,
m_fPrimaryFire ? 128.0f : flDamage, (m_fPrimaryFire ? 128.0f : flDamage) / 255.0f,
0, 0,
0, 0,
0, 0,
m_fPrimaryFire ? 255 : 255, (m_fPrimaryFire ? 255 : 255) / 255.0f,
m_fPrimaryFire ? 128 : 255, (m_fPrimaryFire ? 128 : 255) / 255.0f,
m_fPrimaryFire ? 0 : 255 (m_fPrimaryFire ? 0 : 255) / 255.0f
); );
} }
else else
@ -965,13 +965,13 @@ void EV_FireGauss( event_args_t *args )
0.1f, 0.1f,
m_fPrimaryFire ? 1.0f : 2.5f, m_fPrimaryFire ? 1.0f : 2.5f,
0.0f, 0.0f,
m_fPrimaryFire ? 128.0f : flDamage, (m_fPrimaryFire ? 128.0f : flDamage) / 255.0f,
0, 0,
0, 0,
0, 0,
m_fPrimaryFire ? 255 : 255, (m_fPrimaryFire ? 255 : 255) / 255.0f,
m_fPrimaryFire ? 128 : 255, (m_fPrimaryFire ? 128 : 255) / 255.0f,
m_fPrimaryFire ? 0 : 255 (m_fPrimaryFire ? 0 : 255) / 255.0f
); );
} }
@ -1373,7 +1373,7 @@ void EV_FireRpg( event_args_t *args )
//====================== //======================
//====================== //======================
// EGON END // EGON START
//====================== //======================
enum egon_e enum egon_e
{ {
@ -1502,10 +1502,11 @@ void EV_EgonFire( event_args_t *args )
float g = 50.0f; float g = 50.0f;
float b = 125.0f; float b = 125.0f;
if( IEngineStudio.IsHardware() ) // if( IEngineStudio.IsHardware() )
{ {
r /= 100.0f; r /= 255.0f;
g /= 100.0f; g /= 255.0f;
b /= 255.0f;
} }
pBeam = gEngfuncs.pEfxAPI->R_BeamEntPoint( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 3.5, 0.2, 0.7, 55, 0, 0, r, g, b ); pBeam = gEngfuncs.pEfxAPI->R_BeamEntPoint( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 3.5, 0.2, 0.7, 55, 0, 0, r, g, b );

10
cl_dll/hl/hl_weapons.cpp

@ -325,9 +325,13 @@ void CBasePlayerWeapon::ItemPostFrame( void )
{ {
if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= 0.0f ) ) if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= 0.0f ) )
{ {
#if 0 // FIXME, need ammo on client to make this work right #if 1
// complete the reload. // complete the reload.
int j = min( iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] ); ItemInfo itemInfo;
memset( &itemInfo, 0, sizeof( itemInfo ) );
GetItemInfo( &itemInfo );
int j = Q_min( itemInfo.iMaxClip - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] );
// Add them to the clip // Add them to the clip
m_iClip += j; m_iClip += j;
@ -368,7 +372,7 @@ void CBasePlayerWeapon::ItemPostFrame( void )
m_fFireOnEmpty = FALSE; m_fFireOnEmpty = FALSE;
// weapon is useable. Reload if empty and weapon has waited as long as it has to after firing // weapon is useable. Reload if empty and weapon has waited as long as it has to after firing
if( m_iClip == 0 && !( iFlags() & ITEM_FLAG_NOAUTORELOAD ) && m_flNextPrimaryAttack < 0.0f ) if( m_iClip == 0 && !( iFlags() & ITEM_FLAG_NOAUTORELOAD ) && m_flNextPrimaryAttack <= 0.0f )
{ {
Reload(); Reload();
return; return;

23
cl_dll/hud_spectator.cpp

@ -824,6 +824,7 @@ bool CHudSpectator::ParseOverviewFile()
char levelname[256] = { 0 }; char levelname[256] = { 0 };
char token[1024] = { 0 }; char token[1024] = { 0 };
float height; float height;
bool ret = false;
char *afile = NULL, *pfile = NULL; char *afile = NULL, *pfile = NULL;
@ -843,7 +844,7 @@ bool CHudSpectator::ParseOverviewFile()
strcpy( m_OverviewData.map, gEngfuncs.pfnGetLevelName() ); strcpy( m_OverviewData.map, gEngfuncs.pfnGetLevelName() );
if( m_OverviewData.map[0] == '\0' ) if( m_OverviewData.map[0] == '\0' )
return false; // not active yet return ret; // not active yet
strcpy( levelname, m_OverviewData.map + 5 ); strcpy( levelname, m_OverviewData.map + 5 );
levelname[strlen( levelname ) - 4] = 0; levelname[strlen( levelname ) - 4] = 0;
@ -855,7 +856,7 @@ bool CHudSpectator::ParseOverviewFile()
if( !pfile ) if( !pfile )
{ {
gEngfuncs.Con_DPrintf( "Couldn't open file %s. Using default values for overiew mode.\n", filename ); gEngfuncs.Con_DPrintf( "Couldn't open file %s. Using default values for overiew mode.\n", filename );
return false; return ret;
} }
while( true ) while( true )
@ -872,7 +873,7 @@ bool CHudSpectator::ParseOverviewFile()
if( stricmp( token, "{" ) ) if( stricmp( token, "{" ) )
{ {
gEngfuncs.Con_Printf( "Error parsing overview file %s. (expected { )\n", filename ); gEngfuncs.Con_Printf( "Error parsing overview file %s. (expected { )\n", filename );
return false; goto end;
} }
pfile = gEngfuncs.COM_ParseFile( pfile, token ); pfile = gEngfuncs.COM_ParseFile( pfile, token );
@ -912,7 +913,7 @@ bool CHudSpectator::ParseOverviewFile()
else else
{ {
gEngfuncs.Con_Printf( "Error parsing overview file %s. (%s unkown)\n", filename, token ); gEngfuncs.Con_Printf( "Error parsing overview file %s. (%s unkown)\n", filename, token );
return false; goto end;
} }
pfile = gEngfuncs.COM_ParseFile( pfile, token ); // parse next token pfile = gEngfuncs.COM_ParseFile( pfile, token ); // parse next token
@ -924,7 +925,7 @@ bool CHudSpectator::ParseOverviewFile()
if( m_OverviewData.layers == OVERVIEW_MAX_LAYERS ) if( m_OverviewData.layers == OVERVIEW_MAX_LAYERS )
{ {
gEngfuncs.Con_Printf( "Error parsing overview file %s. ( too many layers )\n", filename ); gEngfuncs.Con_Printf( "Error parsing overview file %s. ( too many layers )\n", filename );
return false; goto end;
} }
pfile = gEngfuncs.COM_ParseFile( pfile, token ); pfile = gEngfuncs.COM_ParseFile( pfile, token );
@ -932,7 +933,7 @@ bool CHudSpectator::ParseOverviewFile()
if( stricmp( token, "{" ) ) if( stricmp( token, "{" ) )
{ {
gEngfuncs.Con_Printf( "Error parsing overview file %s. (expected { )\n", filename ); gEngfuncs.Con_Printf( "Error parsing overview file %s. (expected { )\n", filename );
return false; goto end;
} }
pfile = gEngfuncs.COM_ParseFile( pfile, token ); pfile = gEngfuncs.COM_ParseFile( pfile, token );
@ -953,7 +954,7 @@ bool CHudSpectator::ParseOverviewFile()
else else
{ {
gEngfuncs.Con_Printf( "Error parsing overview file %s. (%s unkown)\n", filename, token ); gEngfuncs.Con_Printf( "Error parsing overview file %s. (%s unkown)\n", filename, token );
return false; goto end;
} }
pfile = gEngfuncs.COM_ParseFile( pfile, token ); // parse next token pfile = gEngfuncs.COM_ParseFile( pfile, token ); // parse next token
@ -963,12 +964,14 @@ bool CHudSpectator::ParseOverviewFile()
} }
} }
gEngfuncs.COM_FreeFile( afile );
m_mapZoom = m_OverviewData.zoom; m_mapZoom = m_OverviewData.zoom;
m_mapOrigin = m_OverviewData.origin; m_mapOrigin = m_OverviewData.origin;
return true; ret = true;
end:
gEngfuncs.COM_FreeFile( afile );
return ret;
} }
void CHudSpectator::LoadMapSprites() void CHudSpectator::LoadMapSprites()

6
cl_dll/input.cpp

@ -645,11 +645,13 @@ void IN_Impulse( void )
void IN_ScoreDown( void ) void IN_ScoreDown( void )
{ {
KeyDown( &in_score ); KeyDown( &in_score );
gHUD.m_Scoreboard.UserCmd_ShowScores();
} }
void IN_ScoreUp( void ) void IN_ScoreUp( void )
{ {
KeyUp( &in_score ); KeyUp( &in_score );
gHUD.m_Scoreboard.UserCmd_HideScores();
} }
void IN_MLookUp( void ) void IN_MLookUp( void )
@ -1082,6 +1084,10 @@ void InitInput( void )
gEngfuncs.pfnAddCommand( "-reload", IN_ReloadUp ); gEngfuncs.pfnAddCommand( "-reload", IN_ReloadUp );
gEngfuncs.pfnAddCommand( "+alt1", IN_Alt1Down ); gEngfuncs.pfnAddCommand( "+alt1", IN_Alt1Down );
gEngfuncs.pfnAddCommand( "-alt1", IN_Alt1Up ); gEngfuncs.pfnAddCommand( "-alt1", IN_Alt1Up );
gEngfuncs.pfnAddCommand( "+score", IN_ScoreDown );
gEngfuncs.pfnAddCommand( "-score", IN_ScoreUp );
gEngfuncs.pfnAddCommand( "+showscores", IN_ScoreDown );
gEngfuncs.pfnAddCommand( "-showscores", IN_ScoreUp );
gEngfuncs.pfnAddCommand( "+graph", IN_GraphDown ); gEngfuncs.pfnAddCommand( "+graph", IN_GraphDown );
gEngfuncs.pfnAddCommand( "-graph", IN_GraphUp ); gEngfuncs.pfnAddCommand( "-graph", IN_GraphUp );
gEngfuncs.pfnAddCommand( "+break", IN_BreakDown ); gEngfuncs.pfnAddCommand( "+break", IN_BreakDown );

4
cl_dll/scoreboard.cpp

@ -51,8 +51,8 @@ int CHudScoreboard::Init( void )
gHUD.AddHudElem( this ); gHUD.AddHudElem( this );
// Hook messages & commands here // Hook messages & commands here
HOOK_COMMAND( "+showscores", ShowScores ); // HOOK_COMMAND( "+showscores", ShowScores );
HOOK_COMMAND( "-showscores", HideScores ); // HOOK_COMMAND( "-showscores", HideScores );
HOOK_MESSAGE( ScoreInfo ); HOOK_MESSAGE( ScoreInfo );
HOOK_MESSAGE( TeamScore ); HOOK_MESSAGE( TeamScore );

4
cl_dll/view.cpp

@ -736,6 +736,10 @@ void V_CalcNormalRefdef( struct ref_params_s *pparams )
if( CL_IsThirdPerson() ) if( CL_IsThirdPerson() )
{ {
VectorCopy( camAngles, pparams->viewangles ); VectorCopy( camAngles, pparams->viewangles );
}
// Apply this at all times
{
float pitch = camAngles[0]; float pitch = camAngles[0];
// Normalize angles // Normalize angles

5
cmake/LibraryNaming.cmake

@ -29,6 +29,7 @@ check_symbol_exists(XASH_MOBILE_PLATFORM "build.h" XASH_MOBILE_PLATFORM)
check_symbol_exists(XASH_MSVC "build.h" XASH_MSVC) check_symbol_exists(XASH_MSVC "build.h" XASH_MSVC)
check_symbol_exists(XASH_NETBSD "build.h" XASH_NETBSD) check_symbol_exists(XASH_NETBSD "build.h" XASH_NETBSD)
check_symbol_exists(XASH_OPENBSD "build.h" XASH_OPENBSD) check_symbol_exists(XASH_OPENBSD "build.h" XASH_OPENBSD)
check_symbol_exists(XASH_HAIKU "build.h" XASH_HAIKU)
check_symbol_exists(XASH_WIN32 "build.h" XASH_WIN32) check_symbol_exists(XASH_WIN32 "build.h" XASH_WIN32)
check_symbol_exists(XASH_WIN64 "build.h" XASH_WIN64) check_symbol_exists(XASH_WIN64 "build.h" XASH_WIN64)
check_symbol_exists(XASH_X86 "build.h" XASH_X86) check_symbol_exists(XASH_X86 "build.h" XASH_X86)
@ -45,6 +46,8 @@ elseif(XASH_NETBSD)
set(BUILDOS "netbsd") set(BUILDOS "netbsd")
elseif(XASH_OPENBSD) elseif(XASH_OPENBSD)
set(BUILDOS "openbsd") set(BUILDOS "openbsd")
elseif(XASH_HAIKU)
set(BUILDOS "haiku")
elseif(XASH_EMSCRIPTEN) elseif(XASH_EMSCRIPTEN)
set(BUILDOS "emscripten") set(BUILDOS "emscripten")
else() else()
@ -92,7 +95,7 @@ endif()
if(BUILDOS STREQUAL "android") if(BUILDOS STREQUAL "android")
set(POSTFIX "") # force disable for Android, as Android ports aren't distributed in normal way and doesn't follow library naming set(POSTFIX "") # force disable for Android, as Android ports aren't distributed in normal way and doesn't follow library naming
elif(BUILDOS AND BUILDARCH) elseif(BUILDOS AND BUILDARCH)
set(POSTFIX "_${BUILDOS}_${BUILDARCH}") set(POSTFIX "_${BUILDOS}_${BUILDARCH}")
elseif(BUILDARCH) elseif(BUILDARCH)
set(POSTFIX "_${BUILDARCH}") set(POSTFIX "_${BUILDARCH}")

5
dlls/bigmomma.cpp

@ -1034,7 +1034,7 @@ Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot
Vector vecScale; Vector vecScale;
Vector vecGrenadeVel; Vector vecGrenadeVel;
Vector vecTemp; Vector vecTemp;
float flGravity = g_psv_gravity->value; float flGravity = Q_max( g_psv_gravity->value, 0.1f );
// calculate the midpoint and apex of the 'triangle' // calculate the midpoint and apex of the 'triangle'
vecMidPoint = vecSpot1 + ( vecSpot2 - vecSpot1 ) * 0.5f; vecMidPoint = vecSpot1 + ( vecSpot2 - vecSpot1 ) * 0.5f;
@ -1050,6 +1050,9 @@ Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot
// Don't worry about actually hitting the target, this won't hurt us! // Don't worry about actually hitting the target, this won't hurt us!
// TODO: Need another way to calculate height because current calculation is completely wrong
// and there posible crash.
// How high should the grenade travel (subtract 15 so the grenade doesn't hit the ceiling)? // How high should the grenade travel (subtract 15 so the grenade doesn't hit the ceiling)?
float height = vecApex.z - vecSpot1.z - 15.0f; float height = vecApex.z - vecSpot1.z - 15.0f;
// How fast does the grenade need to travel to reach that height given gravity? // How fast does the grenade need to travel to reach that height given gravity?

2
dlls/buttons.cpp

@ -637,7 +637,7 @@ void DoSpark( entvars_t *pev, const Vector &location )
void CBaseButton::ButtonSpark( void ) void CBaseButton::ButtonSpark( void )
{ {
SetThink( &CBaseButton::ButtonSpark ); SetThink( &CBaseButton::ButtonSpark );
pev->nextthink = gpGlobals->time + 0.1f + RANDOM_FLOAT( 0.0f, 1.5f );// spark again at random interval pev->nextthink = pev->ltime + 0.1f + RANDOM_FLOAT( 0.0f, 1.5f );// spark again at random interval
DoSpark( pev, pev->mins ); DoSpark( pev, pev->mins );
} }

5
dlls/cbase.cpp

@ -255,6 +255,8 @@ void DispatchSave( edict_t *pent, SAVERESTOREDATA *pSaveData )
{ {
ENTITYTABLE *pTable = &pSaveData->pTable[pSaveData->currentIndex]; ENTITYTABLE *pTable = &pSaveData->pTable[pSaveData->currentIndex];
gpGlobals->time = pSaveData->time;
if( pTable->pent != pent ) if( pTable->pent != pent )
ALERT( at_error, "ENTITY TABLE OR INDEX IS WRONG!!!!\n" ); ALERT( at_error, "ENTITY TABLE OR INDEX IS WRONG!!!!\n" );
@ -307,6 +309,9 @@ int DispatchRestore( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity
Vector oldOffset; Vector oldOffset;
CRestore restoreHelper( pSaveData ); CRestore restoreHelper( pSaveData );
gpGlobals->time = pSaveData->time;
if( globalEntity ) if( globalEntity )
{ {
CRestore tmpRestore( pSaveData ); CRestore tmpRestore( pSaveData );

2
dlls/cbase.h

@ -193,7 +193,7 @@ public:
virtual BOOL IsAlive( void ) { return (pev->deadflag == DEAD_NO) && pev->health > 0; } virtual BOOL IsAlive( void ) { return (pev->deadflag == DEAD_NO) && pev->health > 0; }
virtual BOOL IsBSPModel( void ) { return pev->solid == SOLID_BSP || pev->movetype == MOVETYPE_PUSHSTEP; } virtual BOOL IsBSPModel( void ) { return pev->solid == SOLID_BSP || pev->movetype == MOVETYPE_PUSHSTEP; }
virtual BOOL ReflectGauss( void ) { return ( IsBSPModel() && !pev->takedamage ); } virtual BOOL ReflectGauss( void ) { return ( IsBSPModel() && !pev->takedamage ); }
virtual BOOL HasTarget( string_t targetname ) { return FStrEq(STRING(targetname), STRING(pev->targetname) ); } virtual BOOL HasTarget( string_t targetname ) { return FStrEq(STRING(targetname), STRING(pev->target) ); }
virtual BOOL IsInWorld( void ); virtual BOOL IsInWorld( void );
virtual BOOL IsPlayer( void ) { return FALSE; } virtual BOOL IsPlayer( void ) { return FALSE; }
virtual BOOL IsNetClient( void ) { return FALSE; } virtual BOOL IsNetClient( void ) { return FALSE; }

2
dlls/crowbar.cpp

@ -335,7 +335,7 @@ int CCrowbar::Swing( int fFirst )
m_pPlayer->m_iWeaponVolume = (int)( flVol * CROWBAR_WALLHIT_VOLUME ); m_pPlayer->m_iWeaponVolume = (int)( flVol * CROWBAR_WALLHIT_VOLUME );
SetThink( &CCrowbar::Smack ); SetThink( &CCrowbar::Smack );
pev->nextthink = UTIL_WeaponTimeBase() + 0.2f; pev->nextthink = gpGlobals->time + 0.2f;
#endif #endif
#if CROWBAR_DELAY_FIX #if CROWBAR_DELAY_FIX
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25f; m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.25f;

2
dlls/game.cpp

@ -35,7 +35,7 @@ cvar_t weaponstay = { "mp_weaponstay","0", FCVAR_SERVER };
cvar_t selfgauss = { "selfgauss", "1", FCVAR_SERVER }; cvar_t selfgauss = { "selfgauss", "1", FCVAR_SERVER };
cvar_t chargerfix = { "chargerfix", "0", FCVAR_SERVER }; cvar_t chargerfix = { "chargerfix", "0", FCVAR_SERVER };
cvar_t satchelfix = { "satchelfix", "0", FCVAR_SERVER }; cvar_t satchelfix = { "satchelfix", "0", FCVAR_SERVER };
cvar_t monsteryawspeedfix = { "monsteryawspeedfix", "0", FCVAR_SERVER }; cvar_t monsteryawspeedfix = { "monsteryawspeedfix", "1", FCVAR_SERVER };
cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER }; cvar_t forcerespawn = { "mp_forcerespawn","1", FCVAR_SERVER };
cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER }; cvar_t flashlight = { "mp_flashlight","0", FCVAR_SERVER };
cvar_t aimcrosshair = { "mp_autocrosshair","1", FCVAR_SERVER }; cvar_t aimcrosshair = { "mp_autocrosshair","1", FCVAR_SERVER };

36
dlls/gauss.cpp

@ -124,12 +124,6 @@ int CGauss::GetItemInfo( ItemInfo *p )
return 1; return 1;
} }
BOOL CGauss::IsUseable()
{
// Currently charging, allow the player to fire it first. - Solokiller
return CBasePlayerWeapon::IsUseable() || m_fInAttack != 0;
}
BOOL CGauss::Deploy() BOOL CGauss::Deploy()
{ {
m_pPlayer->m_flPlayAftershock = 0.0; m_pPlayer->m_flPlayAftershock = 0.0;
@ -231,22 +225,6 @@ void CGauss::SecondaryAttack()
} }
else else
{ {
// Moved to before the ammo burn.
// Because we drained 1 when m_InAttack == 0, then 1 again now before checking if we're out of ammo,
// this resuled in the player having -1 ammo, which in turn caused CanDeploy to think it could be deployed.
// This will need to be fixed further down the line by preventing negative ammo unless explicitly required (infinite ammo?),
// But this check will prevent the problem for now. - Solokiller
// TODO: investigate further.
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
{
// out of ammo! force the gun to fire
StartFire();
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
return;
}
// during the charging process, eat one bit of ammo every once in a while // during the charging process, eat one bit of ammo every once in a while
if( UTIL_WeaponTimeBase() >= m_pPlayer->m_flNextAmmoBurn && m_pPlayer->m_flNextAmmoBurn != 1000 ) if( UTIL_WeaponTimeBase() >= m_pPlayer->m_flNextAmmoBurn && m_pPlayer->m_flNextAmmoBurn != 1000 )
{ {
@ -266,6 +244,16 @@ void CGauss::SecondaryAttack()
} }
} }
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
{
// out of ammo! force the gun to fire
StartFire();
m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.0f;
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 1;
return;
}
if( UTIL_WeaponTimeBase() >= m_pPlayer->m_flAmmoStartCharge ) if( UTIL_WeaponTimeBase() >= m_pPlayer->m_flAmmoStartCharge )
{ {
// don't eat any more ammo after gun is fully charged. // don't eat any more ammo after gun is fully charged.
@ -583,10 +571,6 @@ void CGauss::WeaponIdle( void )
StartFire(); StartFire();
m_fInAttack = 0; m_fInAttack = 0;
m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f; m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 2.0f;
// Need to set m_flNextPrimaryAttack so the weapon gets a chance to complete its secondary fire animation. - Solokiller
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0 )
m_flNextPrimaryAttack = UTIL_WeaponTimeBase() + 0.5f;
} }
else else
{ {

1
dlls/houndeye.cpp

@ -514,6 +514,7 @@ void CHoundeye::WriteBeamColor( void )
bBlue = 255; bBlue = 255;
break; break;
case 4: case 4:
case 5:
bRed = 62; bRed = 62;
bGreen = 33; bGreen = 33;
bBlue = 211; bBlue = 211;

2
dlls/monsterstate.cpp

@ -66,7 +66,7 @@ void CBaseMonster::RunAI( void )
// IDLE sound permitted in ALERT state is because monsters were silent in ALERT state. Only play IDLE sound in IDLE state // IDLE sound permitted in ALERT state is because monsters were silent in ALERT state. Only play IDLE sound in IDLE state
// once we have sounds for that state. // once we have sounds for that state.
if( ( m_MonsterState == MONSTERSTATE_IDLE || m_MonsterState == MONSTERSTATE_ALERT ) && RANDOM_LONG( 0, 99 ) == 0 && !( pev->flags & SF_MONSTER_GAG ) ) if( ( m_MonsterState == MONSTERSTATE_IDLE || m_MonsterState == MONSTERSTATE_ALERT ) && RANDOM_LONG( 0, 99 ) == 0 && !( pev->spawnflags & SF_MONSTER_GAG ) )
{ {
IdleSound(); IdleSound();
} }

6
dlls/mp5.cpp

@ -270,12 +270,6 @@ void CMP5::WeaponIdle( void )
m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); // how long till we do this again. m_flTimeWeaponIdle = UTIL_SharedRandomFloat( m_pPlayer->random_seed, 10, 15 ); // how long till we do this again.
} }
BOOL CMP5::IsUseable()
{
//Can be used if the player has AR grenades. - Solokiller
return CBasePlayerWeapon::IsUseable() || m_pPlayer->m_rgAmmo[m_iSecondaryAmmoType] > 0;
}
class CMP5AmmoClip : public CBasePlayerAmmo class CMP5AmmoClip : public CBasePlayerAmmo
{ {
void Spawn( void ) void Spawn( void )

16
dlls/multiplay_gamerules.cpp

@ -709,12 +709,12 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller,
const char *tau = "tau_cannon"; const char *tau = "tau_cannon";
const char *gluon = "gluon gun"; const char *gluon = "gluon gun";
if( pKiller->flags & FL_CLIENT ) if( pevInflictor )
{ {
killer_index = ENTINDEX( ENT( pKiller ) ); if( pKiller->flags & FL_CLIENT )
if( pevInflictor )
{ {
killer_index = ENTINDEX( ENT( pKiller ) );
if( pevInflictor == pKiller ) if( pevInflictor == pKiller )
{ {
// If the inflictor is the killer, then it must be their current weapon doing the damage // If the inflictor is the killer, then it must be their current weapon doing the damage
@ -730,10 +730,10 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller,
killer_weapon_name = STRING( pevInflictor->classname ); // it's just that easy killer_weapon_name = STRING( pevInflictor->classname ); // it's just that easy
} }
} }
} else
else {
{ killer_weapon_name = STRING( pevInflictor->classname );
killer_weapon_name = STRING( pevInflictor->classname ); }
} }
// strip the monster_* or weapon_* from the inflictor's classname // strip the monster_* or weapon_* from the inflictor's classname

33
dlls/player.cpp

@ -1198,23 +1198,26 @@ void CBasePlayer::WaterMove()
} }
// make bubbles // make bubbles
air = (int)( pev->air_finished - gpGlobals->time ); if( pev->waterlevel == 3 )
if( !RANDOM_LONG( 0, 0x1f ) && RANDOM_LONG( 0, AIRTIME - 1 ) >= air )
{ {
switch( RANDOM_LONG( 0, 3 ) ) air = (int)( pev->air_finished - gpGlobals->time );
if( !RANDOM_LONG( 0, 0x1f ) && RANDOM_LONG( 0, AIRTIME - 1 ) >= air )
{ {
case 0: switch( RANDOM_LONG( 0, 3 ) )
EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim1.wav", 0.8, ATTN_NORM ); {
break; case 0:
case 1: EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim1.wav", 0.8, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim2.wav", 0.8, ATTN_NORM ); break;
break; case 1:
case 2: EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim2.wav", 0.8, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim3.wav", 0.8, ATTN_NORM ); break;
break; case 2:
case 3: EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim3.wav", 0.8, ATTN_NORM );
EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim4.wav", 0.8, ATTN_NORM ); break;
break; case 3:
EMIT_SOUND( ENT( pev ), CHAN_BODY, "player/pl_swim4.wav", 0.8, ATTN_NORM );
break;
}
} }
} }

3
dlls/scientist.cpp

@ -761,6 +761,9 @@ int CScientist::ISoundMask( void )
{ {
return bits_SOUND_WORLD | return bits_SOUND_WORLD |
bits_SOUND_COMBAT | bits_SOUND_COMBAT |
bits_SOUND_CARCASS |
bits_SOUND_MEAT |
bits_SOUND_GARBAGE |
bits_SOUND_DANGER | bits_SOUND_DANGER |
bits_SOUND_PLAYER; bits_SOUND_PLAYER;
} }

4
dlls/shotgun.cpp

@ -302,7 +302,7 @@ void CShotgun::Reload( void )
} }
} }
void CShotgun::WeaponTick() void CShotgun::ItemPostFrame( void )
{ {
if( m_flPumpTime && m_flPumpTime < gpGlobals->time ) if( m_flPumpTime && m_flPumpTime < gpGlobals->time )
{ {
@ -310,6 +310,8 @@ void CShotgun::WeaponTick()
EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/scock1.wav", 1, ATTN_NORM, 0, 95 + RANDOM_LONG( 0, 0x1f ) ); EMIT_SOUND_DYN( ENT( m_pPlayer->pev ), CHAN_ITEM, "weapons/scock1.wav", 1, ATTN_NORM, 0, 95 + RANDOM_LONG( 0, 0x1f ) );
m_flPumpTime = 0; m_flPumpTime = 0;
} }
CBasePlayerWeapon::ItemPostFrame();
} }
void CShotgun::WeaponIdle( void ) void CShotgun::WeaponIdle( void )

7
dlls/squadmonster.cpp

@ -167,7 +167,7 @@ void CSquadMonster::SquadRemove( CSquadMonster *pRemove )
{ {
for( int i = 0; i < MAX_SQUAD_MEMBERS - 1; i++ ) for( int i = 0; i < MAX_SQUAD_MEMBERS - 1; i++ )
{ {
if( pSquadLeader->m_hSquadMember[i] == this ) if( pSquadLeader->m_hSquadMember[i] == pRemove )
{ {
pSquadLeader->m_hSquadMember[i] = NULL; pSquadLeader->m_hSquadMember[i] = NULL;
break; break;
@ -256,7 +256,10 @@ void CSquadMonster::SquadMakeEnemy( CBaseEntity *pEnemy )
if( pMember ) if( pMember )
{ {
// reset members who aren't activly engaged in fighting // reset members who aren't activly engaged in fighting
if( pMember->m_hEnemy != pEnemy && !pMember->HasConditions( bits_COND_SEE_ENEMY ) ) if( pMember->m_hEnemy != pEnemy && !pMember->HasConditions( bits_COND_SEE_ENEMY )
&& ( pMember->m_pSchedule && (pMember->m_pSchedule->iInterruptMask & bits_COND_NEW_ENEMY) )
// My enemy might be not an enemy for member of my squad, e.g. if I was provoked by player.
&& pMember->IRelationship(pEnemy) >= R_DL )
{ {
if( pMember->m_hEnemy != 0 ) if( pMember->m_hEnemy != 0 )
{ {

4
dlls/triggers.cpp

@ -2318,8 +2318,8 @@ void CTriggerCamera::FollowTarget()
if( dy > 180 ) if( dy > 180 )
dy = dy - 360; dy = dy - 360;
pev->avelocity.x = dx * 40 * gpGlobals->frametime; pev->avelocity.x = dx * 40 * 0.01f;
pev->avelocity.y = dy * 40 * gpGlobals->frametime; pev->avelocity.y = dy * 40 * 0.01f;
if( !( FBitSet( pev->spawnflags, SF_CAMERA_PLAYER_TAKECONTROL ) ) ) if( !( FBitSet( pev->spawnflags, SF_CAMERA_PLAYER_TAKECONTROL ) ) )
{ {

3
dlls/turret.cpp

@ -1150,6 +1150,9 @@ void CSentry::Precache()
{ {
CBaseTurret::Precache(); CBaseTurret::Precache();
PRECACHE_MODEL( "models/sentry.mdl" ); PRECACHE_MODEL( "models/sentry.mdl" );
PRECACHE_SOUND( "weapons/hks1.wav" );
PRECACHE_SOUND( "weapons/hks2.wav" );
PRECACHE_SOUND( "weapons/hks3.wav" );
} }
void CSentry::Spawn() void CSentry::Spawn()

40
dlls/weapons.cpp

@ -596,14 +596,12 @@ BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted )
} }
else else
{ {
return ( attack_time <= 0.0f ) ? TRUE : FALSE; return ( (static_cast<int>(::floor(attack_time * 1000.0f)) * 1000.0f) <= 0.0f) ? TRUE : FALSE;
} }
} }
void CBasePlayerWeapon::ItemPostFrame( void ) void CBasePlayerWeapon::ItemPostFrame( void )
{ {
WeaponTick();
if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= UTIL_WeaponTimeBase() ) ) if( ( m_fInReload ) && ( m_pPlayer->m_flNextAttack <= UTIL_WeaponTimeBase() ) )
{ {
// complete the reload. // complete the reload.
@ -899,16 +897,38 @@ BOOL CBasePlayerWeapon::AddSecondaryAmmo( int iCount, char *szName, int iMax )
//========================================================= //=========================================================
BOOL CBasePlayerWeapon::IsUseable( void ) BOOL CBasePlayerWeapon::IsUseable( void )
{ {
if( m_iClip <= 0 ) if( m_iClip > 0 )
{
return TRUE;
}
// Player has unlimited ammo for this weapon or does not use magazines
if( iMaxAmmo1() == WEAPON_NOCLIP )
{ {
if( m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] <= 0 && iMaxAmmo1() != -1 ) return TRUE;
}
if( m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] > 0 )
{
return TRUE;
}
if( pszAmmo2() )
{
// Player has unlimited ammo for this weapon or does not use magazines
if( iMaxAmmo2() == WEAPON_NOCLIP )
{ {
// clip is empty (or nonexistant) and the player has no more ammo of this type. return TRUE;
return FALSE; }
if( m_pPlayer->m_rgAmmo[SecondaryAmmoIndex()] > 0 )
{
return TRUE;
} }
} }
return TRUE; // clip is empty (or nonexistant) and the player has no more ammo of this type.
return FALSE;
} }
BOOL CBasePlayerWeapon::CanDeploy( void ) BOOL CBasePlayerWeapon::CanDeploy( void )
@ -1099,13 +1119,13 @@ int CBasePlayerWeapon::ExtractAmmo( CBasePlayerWeapon *pWeapon )
{ {
// blindly call with m_iDefaultAmmo. It's either going to be a value or zero. If it is zero, // blindly call with m_iDefaultAmmo. It's either going to be a value or zero. If it is zero,
// we only get the ammo in the weapon's clip, which is what we want. // we only get the ammo in the weapon's clip, which is what we want.
iReturn = pWeapon->AddPrimaryAmmo( m_iDefaultAmmo, (char *)pszAmmo1(), iMaxClip(), iMaxAmmo1() ); iReturn |= pWeapon->AddPrimaryAmmo( m_iDefaultAmmo, (char *)pszAmmo1(), iMaxClip(), iMaxAmmo1() );
m_iDefaultAmmo = 0; m_iDefaultAmmo = 0;
} }
if( pszAmmo2() != NULL ) if( pszAmmo2() != NULL )
{ {
iReturn = pWeapon->AddSecondaryAmmo( 0, (char *)pszAmmo2(), iMaxAmmo2() ); iReturn |= pWeapon->AddSecondaryAmmo( 0, (char *)pszAmmo2(), iMaxAmmo2() );
} }
return iReturn; return iReturn;

6
dlls/weapons.h

@ -319,7 +319,6 @@ public:
virtual void PrimaryAttack( void ) { return; } // do "+ATTACK" virtual void PrimaryAttack( void ) { return; } // do "+ATTACK"
virtual void SecondaryAttack( void ) { return; } // do "+ATTACK2" virtual void SecondaryAttack( void ) { return; } // do "+ATTACK2"
virtual void Reload( void ) { return; } // do "+RELOAD" virtual void Reload( void ) { return; } // do "+RELOAD"
virtual void WeaponTick() {} // Always called at beginning of ItemPostFrame. - Solokiller
virtual void WeaponIdle( void ) { return; } // called when no buttons pressed virtual void WeaponIdle( void ) { return; } // called when no buttons pressed
virtual int UpdateClientData( CBasePlayer *pPlayer ); // sends hud info to client dll, if things have changed virtual int UpdateClientData( CBasePlayer *pPlayer ); // sends hud info to client dll, if things have changed
virtual void RetireWeapon( void ); virtual void RetireWeapon( void );
@ -569,7 +568,6 @@ public:
BOOL Deploy( void ); BOOL Deploy( void );
void Reload( void ); void Reload( void );
void WeaponIdle( void ); void WeaponIdle( void );
BOOL IsUseable();
float m_flNextAnimTime; float m_flNextAnimTime;
int m_iShell; int m_iShell;
@ -639,8 +637,8 @@ public:
void SecondaryAttack( void ); void SecondaryAttack( void );
BOOL Deploy( ); BOOL Deploy( );
void Reload( void ); void Reload( void );
void WeaponTick();
void WeaponIdle( void ); void WeaponIdle( void );
void ItemPostFrame( void );
int m_fInReload; int m_fInReload;
float m_flNextReload; float m_flNextReload;
int m_iShell; int m_iShell;
@ -747,7 +745,7 @@ public:
int iItemSlot( void ) { return 4; } int iItemSlot( void ) { return 4; }
int GetItemInfo(ItemInfo *p); int GetItemInfo(ItemInfo *p);
int AddToPlayer( CBasePlayer *pPlayer ); int AddToPlayer( CBasePlayer *pPlayer );
BOOL IsUseable();
BOOL Deploy( void ); BOOL Deploy( void );
void Holster( int skiplocal = 0 ); void Holster( int skiplocal = 0 );

14
pm_shared/pm_shared.c

@ -63,19 +63,7 @@ playermove_t *pmove = NULL;
#define STOP_EPSILON 0.1f #define STOP_EPSILON 0.1f
#define CTEXTURESMAX 512 // max number of textures loaded #define CTEXTURESMAX 512 // max number of textures loaded
#define CBTEXTURENAMEMAX 13 // only load first n chars of name #include "pm_materials.h"
#define CHAR_TEX_CONCRETE 'C' // texture types
#define CHAR_TEX_METAL 'M'
#define CHAR_TEX_DIRT 'D'
#define CHAR_TEX_VENT 'V'
#define CHAR_TEX_GRATE 'G'
#define CHAR_TEX_TILE 'T'
#define CHAR_TEX_SLOSH 'S'
#define CHAR_TEX_WOOD 'W'
#define CHAR_TEX_COMPUTER 'P'
#define CHAR_TEX_GLASS 'Y'
#define CHAR_TEX_FLESH 'F'
#define STEP_CONCRETE 0 // default step sound #define STEP_CONCRETE 0 // default step sound
#define STEP_METAL 1 // metal floor #define STEP_METAL 1 // metal floor

4
public/build.h

@ -67,6 +67,7 @@ For more information, please refer to <http://unlicense.org/>
#undef XASH_MSVC #undef XASH_MSVC
#undef XASH_NETBSD #undef XASH_NETBSD
#undef XASH_OPENBSD #undef XASH_OPENBSD
#undef XASH_HAIKU
#undef XASH_WIN32 #undef XASH_WIN32
#undef XASH_WIN64 #undef XASH_WIN64
#undef XASH_X86 #undef XASH_X86
@ -115,6 +116,9 @@ For more information, please refer to <http://unlicense.org/>
#elif defined __WATCOMC__ && defined __DOS__ #elif defined __WATCOMC__ && defined __DOS__
#define XASH_DOS4GW 1 #define XASH_DOS4GW 1
#define XASH_LITTLE_ENDIAN #define XASH_LITTLE_ENDIAN
#elif defined __HAIKU__
#define XASH_HAIKU 1
#define XASH_POSIX 1
#else #else
#error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug" #error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
#endif #endif

3
scripts/waifulib/library_naming.py

@ -47,6 +47,7 @@ DEFINES = [
'XASH_MSVC', 'XASH_MSVC',
'XASH_NETBSD', 'XASH_NETBSD',
'XASH_OPENBSD', 'XASH_OPENBSD',
'XASH_HAIKU',
'XASH_WIN32', 'XASH_WIN32',
'XASH_WIN64', 'XASH_WIN64',
'XASH_X86', 'XASH_X86',
@ -79,6 +80,8 @@ def configure(conf):
buildos = "emscripten" buildos = "emscripten"
elif conf.env.XASH_DOS4GW: elif conf.env.XASH_DOS4GW:
buildos = "dos4gw" # unused, just in case buildos = "dos4gw" # unused, just in case
elif conf.env.XASH_HAIKU:
buildos = "haiku"
else: else:
conf.fatal("Place your operating system name in build.h and library_naming.py!\n" conf.fatal("Place your operating system name in build.h and library_naming.py!\n"
"If this is a mistake, try to fix conditions above and report a bug") "If this is a mistake, try to fix conditions above and report a bug")

12
waf vendored

File diff suppressed because one or more lines are too long

43
wscript

@ -46,13 +46,14 @@ def options(opt):
grp.add_option('--enable-simple-mod-hacks', action = 'store_true', dest = 'ENABLE_MOD_HACKS', default = False, grp.add_option('--enable-simple-mod-hacks', action = 'store_true', dest = 'ENABLE_MOD_HACKS', default = False,
help = 'enable hacks for simple mods that mostly compatible with Half-Life but has little changes. Enforced for Android. [default: %default]') help = 'enable hacks for simple mods that mostly compatible with Half-Life but has little changes. Enforced for Android. [default: %default]')
opt.load('xcompile compiler_cxx compiler_c clang_compilation_database strip_on_install') opt.load('subproject')
if sys.platform == 'win32': opt.add_subproject(['cl_dll', 'dlls'])
opt.load('msvc msdev msvs')
opt.load('reconfigure subproject') opt.load('xcompile compiler_cxx compiler_c clang_compilation_database strip_on_install msdev msvs')
opt.add_subproject(["cl_dll", "dlls"]) if sys.platform == 'win32':
opt.load('msvc')
opt.load('reconfigure')
def configure(conf): def configure(conf):
# Configuration # Configuration
@ -62,7 +63,7 @@ def configure(conf):
conf.env.SERVER_NAME = 'hl' conf.env.SERVER_NAME = 'hl'
conf.env.PREFIX = '' conf.env.PREFIX = ''
conf.load('fwgslib reconfigure') conf.load('fwgslib reconfigure enforce_pic')
enforce_pic = True # modern defaults enforce_pic = True # modern defaults
valid_build_types = ['fastnative', 'fast', 'release', 'debug', 'nooptimize', 'sanitize', 'none'] valid_build_types = ['fastnative', 'fast', 'release', 'debug', 'nooptimize', 'sanitize', 'none']
@ -87,10 +88,19 @@ def configure(conf):
# subsystem=bld.env.MSVC_SUBSYSTEM # subsystem=bld.env.MSVC_SUBSYSTEM
# TODO: wrapper around bld.stlib, bld.shlib and so on? # TODO: wrapper around bld.stlib, bld.shlib and so on?
conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01' conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01'
conf.env.MSVC_TARGETS = ['x86'] # explicitly request x86 target for MSVC conf.env.MSVC_TARGETS = ['x86' if not conf.options.ALLOW64 else 'x64']
if sys.platform == 'win32':
conf.load('msvc msdev') # Load compilers early
conf.load('xcompile compiler_c compiler_cxx strip_on_install') conf.load('xcompile compiler_c compiler_cxx')
# HACKHACK: override msvc DEST_CPU value by something that we understand
if conf.env.DEST_CPU == 'amd64':
conf.env.DEST_CPU = 'x86_64'
if conf.env.COMPILER_CC == 'msvc':
conf.load('msvc_pdb')
conf.load('msvs msdev strip_on_install')
try: try:
conf.env.CC_VERSION[0] conf.env.CC_VERSION[0]
@ -104,17 +114,8 @@ def configure(conf):
conf.env.MAGX = conf.options.MAGX conf.env.MAGX = conf.options.MAGX
if conf.options.MAGX: if conf.options.MAGX:
enforce_pic = False enforce_pic = False
if enforce_pic: conf.check_pic(enforce_pic)
# Every static library must have fPIC
if conf.env.DEST_OS != 'win32' and '-fPIC' in conf.env.CFLAGS_cshlib:
conf.env.append_unique('CFLAGS_cstlib', '-fPIC')
conf.env.append_unique('CXXFLAGS_cxxstlib', '-fPIC')
else:
conf.env.CFLAGS_cshlib.remove('-fPIC')
conf.env.CXXFLAGS_cxxshlib.remove('-fPIC')
conf.env.CFLAGS_MACBUNDLE.remove('-fPIC')
conf.env.CXXFLAGS_MACBUNDLE.remove('-fPIC')
# We restrict 64-bit builds ONLY for Win/Linux/OSX running on Intel architecture # We restrict 64-bit builds ONLY for Win/Linux/OSX running on Intel architecture
# Because compatibility with original GoldSrc # Because compatibility with original GoldSrc

Loading…
Cancel
Save