From b82f524819b71b1bd4b12a20ab008052a6126a03 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Mon, 24 Apr 2023 01:55:43 +0300 Subject: [PATCH 1/8] Fix Human Grunts dropping weapons again if the game is saved and loaded while the grunt is dying Same as https://github.com/SamVanheer/halflife-updated/commit/bc7d6e3c0782f94553dd692351e7659903c0fa05 --- dlls/hgrunt.cpp | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index 7f7e39e5..2f1dffbd 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -849,27 +849,30 @@ void CHGrunt::HandleAnimEvent( MonsterEvent_t *pEvent ) { case HGRUNT_AE_DROP_GUN: { - Vector vecGunPos; - Vector vecGunAngles; - - GetAttachment( 0, vecGunPos, vecGunAngles ); - - // switch to body group with no gun. - SetBodygroup( GUN_GROUP, GUN_NONE ); - - // now spawn a gun. - if( FBitSet( pev->weapons, HGRUNT_SHOTGUN ) ) + if ( GetBodygroup( GUN_GROUP ) != GUN_NONE ) { - DropItem( "weapon_shotgun", vecGunPos, vecGunAngles ); - } - else - { - DropItem( "weapon_9mmAR", vecGunPos, vecGunAngles ); - } + Vector vecGunPos; + Vector vecGunAngles; - if( FBitSet( pev->weapons, HGRUNT_GRENADELAUNCHER ) ) - { - DropItem( "ammo_ARgrenades", BodyTarget( pev->origin ), vecGunAngles ); + GetAttachment( 0, vecGunPos, vecGunAngles ); + + // switch to body group with no gun. + SetBodygroup( GUN_GROUP, GUN_NONE ); + + // now spawn a gun. + if( FBitSet( pev->weapons, HGRUNT_SHOTGUN ) ) + { + DropItem( "weapon_shotgun", vecGunPos, vecGunAngles ); + } + else + { + DropItem( "weapon_9mmAR", vecGunPos, vecGunAngles ); + } + + if( FBitSet( pev->weapons, HGRUNT_GRENADELAUNCHER ) ) + { + DropItem( "ammo_ARgrenades", BodyTarget( pev->origin ), vecGunAngles ); + } } } break; From 00596e94bf4e1197d519b1dc00cebcada1960b2e Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Mon, 24 Apr 2023 01:57:25 +0300 Subject: [PATCH 2/8] Use named constants instead of some magical constants in hgrunt code --- dlls/hgrunt.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index 2f1dffbd..d8d198db 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -278,7 +278,7 @@ void CHGrunt::GibMonster( void ) Vector vecGunPos; Vector vecGunAngles; - if( GetBodygroup( 2 ) != 2 ) + if( GetBodygroup( GUN_GROUP ) != GUN_NONE ) { // throw a gun if the grunt has one GetAttachment( 0, vecGunPos, vecGunAngles ); @@ -604,7 +604,7 @@ void CHGrunt::TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir if( ptr->iHitgroup == 11 ) { // make sure we're wearing one - if( GetBodygroup( 1 ) == HEAD_GRUNT && ( bitsDamageType & (DMG_BULLET | DMG_SLASH | DMG_BLAST | DMG_CLUB ) ) ) + if( GetBodygroup( HEAD_GROUP ) == HEAD_GRUNT && ( bitsDamageType & (DMG_BULLET | DMG_SLASH | DMG_BLAST | DMG_CLUB ) ) ) { // absorb damage flDamage -= 20; From 7d65d9f3bdf5728b323053bb1651ebaab8a8ab5d Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 25 Apr 2023 03:05:56 +0300 Subject: [PATCH 3/8] wscript: set default prefix, do not install without destdir as we don't follow typical unix filesystem hierarchy --- wscript | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wscript b/wscript index 353f9016..71f485f0 100644 --- a/wscript +++ b/wscript @@ -10,6 +10,7 @@ import re VERSION = '2.4' APPNAME = 'hlsdk-portable' top = '.' +default_prefix = '/' Context.Context.line_just = 60 # should fit for everything on 80x26 @@ -21,7 +22,7 @@ def get_taskgen_count(self): def options(opt): opt.load('reconfigure compiler_optimizations xcompile compiler_cxx compiler_c clang_compilation_database strip_on_install msdev msvs msvc subproject') - + grp = opt.add_option_group('Common options') grp.add_option('-8', '--64bits', action = 'store_true', dest = 'ALLOW64', default = False, @@ -238,6 +239,9 @@ def configure(conf): conf.add_subproject('cl_dll') def build(bld): + if bld.is_install and not bld.options.destdir: + bld.fatal('Set the install destination directory using --destdir option') + # don't clean QtCreator files and reconfigure saved options bld.clean_files = bld.bldnode.ant_glob('**', excl='*.user configuration.py .lock* *conf_check_*/** config.log %s/*' % Build.CACHE_DIR, From 8da71ee6757f3c0d17e80c2871a71958331ea5b9 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 25 Apr 2023 03:06:25 +0300 Subject: [PATCH 4/8] server: wscript: remove prop.cpp from excluded files --- dlls/wscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wscript b/dlls/wscript index 2c372154..00781777 100644 --- a/dlls/wscript +++ b/dlls/wscript @@ -20,7 +20,7 @@ def configure(conf): conf.fatal("Could not find hl.def") def build(bld): - excluded_files = ['mpstubb.cpp', 'stats.cpp', 'prop.cpp', 'Wxdebug.cpp'] + excluded_files = ['mpstubb.cpp', 'stats.cpp', 'Wxdebug.cpp'] source = bld.path.ant_glob('**/*.cpp', excl=excluded_files) source += bld.path.parent.ant_glob('pm_shared/*.c') From e13192ee20e1fed1eeb8ae74cd7bd0b719c2751e Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 25 Apr 2023 03:33:23 +0300 Subject: [PATCH 5/8] client: wscript: add missing comma in includes list --- cl_dll/wscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cl_dll/wscript b/cl_dll/wscript index 588f2281..43513a29 100644 --- a/cl_dll/wscript +++ b/cl_dll/wscript @@ -37,7 +37,7 @@ def build(bld): defines = ['CLIENT_DLL'] includes = ['.', '../dlls', - '../dlls/gearbox' + '../dlls/gearbox', '../common', '../engine', '../pm_shared', From fd613ebed70e123bc016d3cf1060b752b2b7b1fd Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Sat, 29 Apr 2023 17:13:56 +0300 Subject: [PATCH 6/8] Fix missing breaks. Fix #370 (#371) --- dlls/gearbox/fgrunt.cpp | 2 +- dlls/gearbox/strooper.cpp | 2 +- dlls/gearbox/voltigore.cpp | 19 +++++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/dlls/gearbox/fgrunt.cpp b/dlls/gearbox/fgrunt.cpp index c4a28fd4..4582f67b 100644 --- a/dlls/gearbox/fgrunt.cpp +++ b/dlls/gearbox/fgrunt.cpp @@ -1946,7 +1946,7 @@ void CHFGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent ) SENTENCEG_PlayRndSz(ENT(pev), SentenceByNumber(FGRUNT_SENT_ALERT), FGRUNT_SENTENCE_VOLUME, ATTN_NORM, 0, m_voicePitch); JustSpoke(); } - + break; } default: diff --git a/dlls/gearbox/strooper.cpp b/dlls/gearbox/strooper.cpp index e06a6b99..e9a0660f 100644 --- a/dlls/gearbox/strooper.cpp +++ b/dlls/gearbox/strooper.cpp @@ -390,7 +390,7 @@ void CStrooper::HandleAnimEvent(MonsterEvent_t *pEvent) SENTENCEG_PlayRndSz(ENT(pev), "ST_ALERT", STROOPER_SENTENCE_VOLUME, STROOPER_ATTN, 0, m_voicePitch); JustSpoke(); } - + break; } default: diff --git a/dlls/gearbox/voltigore.cpp b/dlls/gearbox/voltigore.cpp index b728ea62..fdb12aad 100644 --- a/dlls/gearbox/voltigore.cpp +++ b/dlls/gearbox/voltigore.cpp @@ -1010,16 +1010,19 @@ void CVoltigore::StartTask(Task_t *pTask) } break; case TASK_VOLTIGORE_GET_PATH_TO_ENEMY_CORPSE: - UTIL_MakeVectors( pev->angles ); - if( BuildRoute( m_vecEnemyLKP - gpGlobals->v_forward * 50, bits_MF_TO_LOCATION, NULL ) ) { - TaskComplete(); - } - else - { - ALERT( at_aiconsole, "VoltigoreGetPathToEnemyCorpse failed!!\n" ); - TaskFail(); + UTIL_MakeVectors( pev->angles ); + if( BuildRoute( m_vecEnemyLKP - gpGlobals->v_forward * 50, bits_MF_TO_LOCATION, NULL ) ) + { + TaskComplete(); + } + else + { + ALERT( at_aiconsole, "VoltigoreGetPathToEnemyCorpse failed!!\n" ); + TaskFail(); + } } + break; default: CBaseMonster::StartTask(pTask); break; From 341e2767ad9cdeefd59c3ed6b6d97d10e940c47c Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Sat, 29 Apr 2023 17:14:53 +0300 Subject: [PATCH 7/8] Fix male assassins and opfor grunts dropping weapons again (#372) --- dlls/gearbox/fgrunt.cpp | 7 ++++--- dlls/gearbox/massn.cpp | 36 +++++++++++++++++++----------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/dlls/gearbox/fgrunt.cpp b/dlls/gearbox/fgrunt.cpp index 4582f67b..c7aa5a3c 100644 --- a/dlls/gearbox/fgrunt.cpp +++ b/dlls/gearbox/fgrunt.cpp @@ -1846,7 +1846,8 @@ void CHFGrunt :: HandleAnimEvent( MonsterEvent_t *pEvent ) { case HGRUNT_ALLY_AE_DROP_GUN: { - DropMyItems(FALSE); + if (GetBodygroup(FG_GUN_GROUP) != FG_GUN_NONE) + DropMyItems(FALSE); SetUse( NULL ); } break; @@ -3240,7 +3241,7 @@ void CTorch::HandleAnimEvent(MonsterEvent_t *pEvent) KillGas (); break; case HGRUNT_ALLY_AE_DROP_GUN: - if ( FBitSet( pev->weapons, TORCH_EAGLE ) ) + if ( FBitSet( pev->weapons, TORCH_EAGLE ) && pev->body != TORCH_GUN_NONE ) { DropMyItems(FALSE); } @@ -3771,7 +3772,7 @@ void CMedic::HandleAnimEvent(MonsterEvent_t *pEvent) break; case HGRUNT_ALLY_AE_DROP_GUN: - if ( FBitSet( pev->weapons, MEDIC_EAGLE | MEDIC_HANDGUN ) ) + if ( FBitSet( pev->weapons, MEDIC_EAGLE | MEDIC_HANDGUN ) && GetBodygroup(MEDIC_GUN_GROUP) != MEDIC_GUN_NONE ) { DropMyItems(FALSE); } diff --git a/dlls/gearbox/massn.cpp b/dlls/gearbox/massn.cpp index 4e9d0631..0ca4124e 100644 --- a/dlls/gearbox/massn.cpp +++ b/dlls/gearbox/massn.cpp @@ -155,26 +155,28 @@ void CMassn::HandleAnimEvent(MonsterEvent_t *pEvent) Vector vecGunPos; Vector vecGunAngles; - GetAttachment(0, vecGunPos, vecGunAngles); - - // switch to body group with no gun. - SetBodygroup(GUN_GROUP, GUN_NONE); - - // now spawn a gun. - if (FBitSet(pev->weapons, MASSN_SNIPERRIFLE)) + if(GetBodygroup(GUN_GROUP) != GUN_NONE) { - DropItem("weapon_sniperrifle", vecGunPos, vecGunAngles); - } - else - { - DropItem("weapon_9mmAR", vecGunPos, vecGunAngles); - } + GetAttachment(0, vecGunPos, vecGunAngles); - if (FBitSet(pev->weapons, MASSN_GRENADELAUNCHER)) - { - DropItem("ammo_ARgrenades", BodyTarget(pev->origin), vecGunAngles); - } + // switch to body group with no gun. + SetBodygroup(GUN_GROUP, GUN_NONE); + // now spawn a gun. + if (FBitSet(pev->weapons, MASSN_SNIPERRIFLE)) + { + DropItem("weapon_sniperrifle", vecGunPos, vecGunAngles); + } + else + { + DropItem("weapon_9mmAR", vecGunPos, vecGunAngles); + } + + if (FBitSet(pev->weapons, MASSN_GRENADELAUNCHER)) + { + DropItem("ammo_ARgrenades", BodyTarget(pev->origin), vecGunAngles); + } + } } break; From ef2a745a4fd5f6d82ee74e2156054be4f954b18a Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Sat, 29 Apr 2023 17:15:14 +0300 Subject: [PATCH 8/8] Fix env_spritetrain not moving when needed (#373) --- dlls/plats.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/plats.cpp b/dlls/plats.cpp index b5432719..4be9af85 100644 --- a/dlls/plats.cpp +++ b/dlls/plats.cpp @@ -2330,7 +2330,7 @@ void CSpriteTrain::Activate( void ) if( FStringNull( pev->targetname ) ) { m_nexting = TRUE; - m_nextTime = pev->ltime + 0.1; + pev->nextthink = pev->ltime + 0.1; } else pev->spawnflags |= SF_TRAIN_WAIT_RETRIGGER; @@ -2441,12 +2441,12 @@ void CSpriteTrain::Wait() STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noiseMovement ) ); if( pev->noiseStopMoving ) EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM ); - pev->nextthink = 0; return; } if( m_flWait != 0 ) { + pev->nextthink = pev->ltime + m_flWait; if( pev->noiseMovement ) STOP_SOUND( edict(), CHAN_STATIC, STRING( pev->noiseMovement ) ); if( pev->noiseStopMoving ) @@ -2474,7 +2474,6 @@ void CSpriteTrain::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE // Pop back to last target if it's available if( pev->enemy ) pev->target = pev->enemy->v.targetname; - pev->nextthink = 0; pev->velocity = g_vecZero; if( pev->noiseStopMoving ) EMIT_SOUND( ENT( pev ), CHAN_VOICE, STRING( pev->noiseStopMoving ), m_volume, ATTN_NORM );