Browse Source

Merge branch 'master' into poke646_vendetta

poke646_vendetta
Andrey Akhmichin 4 years ago
parent
commit
72f5619ead
  1. 8
      cl_dll/hl/hl_weapons.cpp
  2. 23
      cl_dll/hud_spectator.cpp
  3. 4
      cl_dll/view.cpp
  4. 5
      dlls/bigmomma.cpp
  5. 5
      dlls/cbase.cpp
  6. 2
      dlls/cbase.h
  7. 2
      dlls/crowbar.cpp
  8. 2
      dlls/monsterstate.cpp
  9. 3
      dlls/turret.cpp
  10. 6
      dlls/weapons.cpp
  11. 14
      pm_shared/pm_shared.c
  12. 12
      waf
  13. 41
      wscript

8
cl_dll/hl/hl_weapons.cpp

@ -310,9 +310,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;

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()

4
cl_dll/view.cpp

@ -737,6 +737,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
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?

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

@ -322,7 +322,7 @@ void CCrowbar::Swing()
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.1f; pev->nextthink = gpGlobals->time + 0.1f;
#endif #endif
} }
#ifdef CROWBAR_IDLE_ANIM #ifdef CROWBAR_IDLE_ANIM

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();
} }

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()

6
dlls/weapons.cpp

@ -566,7 +566,7 @@ 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;
} }
} }
@ -1064,13 +1064,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;

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

12
waf vendored

File diff suppressed because one or more lines are too long

41
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]
@ -105,16 +115,7 @@ def configure(conf):
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