From ccf0357a513ee2ae9fd3f93113f0efb38c47b183 Mon Sep 17 00:00:00 2001 From: SanyaSho Date: Thu, 4 Aug 2022 16:27:21 +0300 Subject: [PATCH] game: restore dropship ability to shoot with rotsting gun --- game/server/hl2/npc_combinedropship.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/game/server/hl2/npc_combinedropship.cpp b/game/server/hl2/npc_combinedropship.cpp index ffe1befdc4..37f2ea75ec 100644 --- a/game/server/hl2/npc_combinedropship.cpp +++ b/game/server/hl2/npc_combinedropship.cpp @@ -343,6 +343,8 @@ private: int m_iMachineGunRefAttachment; int m_iAttachmentTroopDeploy; int m_iAttachmentDeployStart; + int m_poseWeapon_Pitch; + int m_poseWeapon_Yaw; // Sounds CSoundPatch *m_pCannonSound; @@ -363,8 +365,7 @@ protected: // Should the dropship end up having inheritors, their activate may // stomp these numbers, in which case you should make these ordinary members // again. - static int m_poseBody_Accel, m_poseBody_Sway, m_poseCargo_Body_Accel, m_poseCargo_Body_Sway, - m_poseWeapon_Pitch, m_poseWeapon_Yaw; + static int m_poseBody_Accel, m_poseBody_Sway, m_poseCargo_Body_Accel, m_poseCargo_Body_Sway; static bool m_sbStaticPoseParamsLoaded; virtual void PopulatePoseParameters( void ); }; @@ -375,13 +376,11 @@ int CNPC_CombineDropship::m_poseBody_Accel = 0; int CNPC_CombineDropship::m_poseBody_Sway = 0; int CNPC_CombineDropship::m_poseCargo_Body_Accel = 0; int CNPC_CombineDropship::m_poseCargo_Body_Sway = 0; -int CNPC_CombineDropship::m_poseWeapon_Pitch = 0; -int CNPC_CombineDropship::m_poseWeapon_Yaw = 0; //----------------------------------------------------------------------------- // Purpose: Cache whatever pose parameters we intend to use //----------------------------------------------------------------------------- -void CNPC_CombineDropship::PopulatePoseParameters( void ) +void CNPC_CombineDropship::PopulatePoseParameters( void ) { if (!m_sbStaticPoseParamsLoaded) { @@ -389,12 +388,16 @@ void CNPC_CombineDropship::PopulatePoseParameters( void ) m_poseBody_Sway = LookupPoseParameter( "body_sway" ); m_poseCargo_Body_Accel = LookupPoseParameter( "cargo_body_accel" ); m_poseCargo_Body_Sway = LookupPoseParameter( "cargo_body_sway" ); - m_poseWeapon_Pitch = LookupPoseParameter( "weapon_pitch" ); - m_poseWeapon_Yaw = LookupPoseParameter( "weapon_yaw" ); m_sbStaticPoseParamsLoaded = true; } + if( m_hContainer ) + { + m_poseWeapon_Pitch = m_hContainer->LookupPoseParameter( "weapon_pitch" ); + m_poseWeapon_Yaw = m_hContainer->LookupPoseParameter( "weapon_yaw" ); + } + BaseClass::PopulatePoseParameters(); } @@ -861,6 +864,8 @@ void CNPC_CombineDropship::Spawn( void ) m_iMachineGunRefAttachment = -1; m_iAttachmentTroopDeploy = -1; m_iAttachmentDeployStart = -1; + m_poseWeapon_Pitch = -1; + m_poseWeapon_Yaw = -1; // create the correct bin for the ship to carry switch ( m_iCrateType ) @@ -896,6 +901,9 @@ void CNPC_CombineDropship::Spawn( void ) m_iMachineGunBaseAttachment = m_hContainer->LookupAttachment( "gun_base" ); // NOTE: gun_ref must have the same position as gun_base, but rotates with the gun m_iMachineGunRefAttachment = m_hContainer->LookupAttachment( "gun_ref" ); + + m_poseWeapon_Pitch = m_hContainer->LookupPoseParameter( "weapon_pitch" ); + m_poseWeapon_Yaw = m_hContainer->LookupPoseParameter( "weapon_yaw" ); } break;