Merge branch 'master' into opfor

This commit is contained in:
Andrey Akhmichin 2021-06-05 16:35:16 +05:00
commit 959e220368
21 changed files with 108 additions and 81 deletions

View File

@ -980,13 +980,13 @@ void EV_FireGauss( event_args_t *args )
0.1f,
m_fPrimaryFire ? 1.0f : 2.5f,
0.0f,
m_fPrimaryFire ? 128.0f : flDamage,
(m_fPrimaryFire ? 128.0f : flDamage) / 255.0f,
0,
0,
0,
m_fPrimaryFire ? 255 : 255,
m_fPrimaryFire ? 128 : 255,
m_fPrimaryFire ? 0 : 255
(m_fPrimaryFire ? 255 : 255) / 255.0f,
(m_fPrimaryFire ? 128 : 255) / 255.0f,
(m_fPrimaryFire ? 0 : 255) / 255.0f
);
}
else
@ -997,13 +997,13 @@ void EV_FireGauss( event_args_t *args )
0.1f,
m_fPrimaryFire ? 1.0f : 2.5f,
0.0f,
m_fPrimaryFire ? 128.0f : flDamage,
(m_fPrimaryFire ? 128.0f : flDamage) / 255.0f,
0,
0,
0,
m_fPrimaryFire ? 255 : 255,
m_fPrimaryFire ? 128 : 255,
m_fPrimaryFire ? 0 : 255
(m_fPrimaryFire ? 255 : 255) / 255.0f,
(m_fPrimaryFire ? 128 : 255) / 255.0f,
(m_fPrimaryFire ? 0 : 255) / 255.0f
);
}

View File

@ -335,9 +335,13 @@ void CBasePlayerWeapon::ItemPostFrame( void )
{
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.
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
m_iClip += j;

View File

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

View File

@ -645,11 +645,13 @@ void IN_Impulse( void )
void IN_ScoreDown( void )
{
KeyDown( &in_score );
gHUD.m_Scoreboard.UserCmd_ShowScores();
}
void IN_ScoreUp( void )
{
KeyUp( &in_score );
gHUD.m_Scoreboard.UserCmd_HideScores();
}
void IN_MLookUp( void )
@ -1082,6 +1084,10 @@ void InitInput( void )
gEngfuncs.pfnAddCommand( "-reload", IN_ReloadUp );
gEngfuncs.pfnAddCommand( "+alt1", IN_Alt1Down );
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_GraphUp );
gEngfuncs.pfnAddCommand( "+break", IN_BreakDown );

View File

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

View File

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

View File

@ -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_NETBSD "build.h" XASH_NETBSD)
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_WIN64 "build.h" XASH_WIN64)
check_symbol_exists(XASH_X86 "build.h" XASH_X86)
@ -45,6 +46,8 @@ elseif(XASH_NETBSD)
set(BUILDOS "netbsd")
elseif(XASH_OPENBSD)
set(BUILDOS "openbsd")
elseif(XASH_HAIKU)
set(BUILDOS "haiku")
elseif(XASH_EMSCRIPTEN)
set(BUILDOS "emscripten")
else()
@ -92,7 +95,7 @@ endif()
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
elif(BUILDOS AND BUILDARCH)
elseif(BUILDOS AND BUILDARCH)
set(POSTFIX "_${BUILDOS}_${BUILDARCH}")
elseif(BUILDARCH)
set(POSTFIX "_${BUILDARCH}")

View File

@ -1036,7 +1036,7 @@ Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot
Vector vecScale;
Vector vecGrenadeVel;
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'
vecMidPoint = vecSpot1 + ( vecSpot2 - vecSpot1 ) * 0.5f;
@ -1052,6 +1052,9 @@ Vector VecCheckSplatToss( entvars_t *pev, const Vector &vecSpot1, Vector vecSpot
// 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)?
float height = vecApex.z - vecSpot1.z - 15.0f;
// How fast does the grenade need to travel to reach that height given gravity?

View File

@ -255,6 +255,8 @@ void DispatchSave( edict_t *pent, SAVERESTOREDATA *pSaveData )
{
ENTITYTABLE *pTable = &pSaveData->pTable[pSaveData->currentIndex];
gpGlobals->time = pSaveData->time;
if( pTable->pent != pent )
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;
CRestore restoreHelper( pSaveData );
gpGlobals->time = pSaveData->time;
if( globalEntity )
{
CRestore tmpRestore( pSaveData );

View File

@ -205,7 +205,7 @@ public:
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 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 IsPlayer( void ) { return FALSE; }
virtual BOOL IsNetClient( void ) { return FALSE; }

View File

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

View File

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

View File

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

View File

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

View File

@ -640,7 +640,7 @@ BOOL CanAttack( float attack_time, float curtime, BOOL isPredicted )
}
else
{
return ( attack_time <= 0.0f ) ? TRUE : FALSE;
return ( (static_cast<int>(::floor(attack_time * 1000.0f)) * 1000.0f) <= 0.0f) ? TRUE : FALSE;
}
}
@ -1143,13 +1143,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,
// 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;
}
if( pszAmmo2() != NULL )
{
iReturn = pWeapon->AddSecondaryAmmo( 0, (char *)pszAmmo2(), iMaxAmmo2() );
iReturn |= pWeapon->AddSecondaryAmmo( 0, (char *)pszAmmo2(), iMaxAmmo2() );
}
return iReturn;

View File

@ -30,4 +30,5 @@
#define CHAR_TEX_GLASS 'Y'
#define CHAR_TEX_FLESH 'F'
#define CHAR_TEX_SNOW 'N'
#define CHAR_TEX_SNOW_OPFOR 'O'
#endif//PM_MATERIALS_H

View File

@ -63,20 +63,7 @@ playermove_t *pmove = NULL;
#define STOP_EPSILON 0.1f
#define CTEXTURESMAX 512 // max number of textures loaded
#define CBTEXTURENAMEMAX 13 // only load first n chars of name
#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 CHAR_TEX_SNOW 'O'
#include "pm_materials.h"
#define STEP_CONCRETE 0 // default step sound
#define STEP_METAL 1 // metal floor
@ -533,7 +520,7 @@ int PM_MapTextureTypeStepType( char chTextureType )
return STEP_TILE;
case CHAR_TEX_SLOSH:
return STEP_SLOSH;
case CHAR_TEX_SNOW:
case CHAR_TEX_SNOW_OPFOR:
return STEP_SNOW;
}
}
@ -674,7 +661,7 @@ void PM_UpdateStepSound( void )
pmove->flTimeStepSound = fWalking ? 400 : 300;
break;
case CHAR_TEX_DIRT:
case CHAR_TEX_SNOW:
case CHAR_TEX_SNOW_OPFOR:
fvol = fWalking ? 0.25f : 0.55f;
pmove->flTimeStepSound = fWalking ? 400 : 300;
break;

View File

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

View File

@ -47,6 +47,7 @@ DEFINES = [
'XASH_MSVC',
'XASH_NETBSD',
'XASH_OPENBSD',
'XASH_HAIKU',
'XASH_WIN32',
'XASH_WIN64',
'XASH_X86',
@ -79,6 +80,8 @@ def configure(conf):
buildos = "emscripten"
elif conf.env.XASH_DOS4GW:
buildos = "dos4gw" # unused, just in case
elif conf.env.XASH_HAIKU:
buildos = "haiku"
else:
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")

12
waf vendored

File diff suppressed because one or more lines are too long

43
wscript
View File

@ -46,13 +46,14 @@ def options(opt):
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]')
opt.load('xcompile compiler_cxx compiler_c clang_compilation_database strip_on_install')
opt.load('subproject')
opt.add_subproject(['cl_dll', 'dlls'])
opt.load('xcompile compiler_cxx compiler_c clang_compilation_database strip_on_install msdev msvs')
if sys.platform == 'win32':
opt.load('msvc msdev msvs')
opt.load('reconfigure subproject')
opt.add_subproject(["cl_dll", "dlls"])
opt.load('msvc')
opt.load('reconfigure')
def configure(conf):
# Configuration
@ -62,7 +63,7 @@ def configure(conf):
conf.env.SERVER_NAME = 'opfor'
conf.env.PREFIX = ''
conf.load('fwgslib reconfigure')
conf.load('fwgslib reconfigure enforce_pic')
enforce_pic = True # modern defaults
valid_build_types = ['fastnative', 'fast', 'release', 'debug', 'nooptimize', 'sanitize', 'none']
@ -87,10 +88,19 @@ def configure(conf):
# subsystem=bld.env.MSVC_SUBSYSTEM
# TODO: wrapper around bld.stlib, bld.shlib and so on?
conf.env.MSVC_SUBSYSTEM = 'WINDOWS,5.01'
conf.env.MSVC_TARGETS = ['x86'] # explicitly request x86 target for MSVC
if sys.platform == 'win32':
conf.load('msvc msdev')
conf.load('xcompile compiler_c compiler_cxx strip_on_install')
conf.env.MSVC_TARGETS = ['x86' if not conf.options.ALLOW64 else 'x64']
# Load compilers early
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:
conf.env.CC_VERSION[0]
@ -104,17 +114,8 @@ def configure(conf):
conf.env.MAGX = conf.options.MAGX
if conf.options.MAGX:
enforce_pic = False
if 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')
conf.check_pic(enforce_pic)
# We restrict 64-bit builds ONLY for Win/Linux/OSX running on Intel architecture
# Because compatibility with original GoldSrc