diff --git a/game/server/hl1/hl1_npc_hgrunt.cpp b/game/server/hl1/hl1_npc_hgrunt.cpp index 5ee5b456..6e200791 100644 --- a/game/server/hl1/hl1_npc_hgrunt.cpp +++ b/game/server/hl1/hl1_npc_hgrunt.cpp @@ -299,8 +299,25 @@ void CNPC_HGrunt::Spawn() BaseClass::Spawn(); NPCInit(); + CreateVPhysics(); } +bool CNPC_HGrunt::CreateVPhysics(void) +{ + VPhysicsDestroyObject(); + + CPhysCollide* pModel = PhysCreateBbox(NAI_Hull::Mins(HULL_HUMAN), NAI_Hull::Maxs(HULL_HUMAN)); + IPhysicsObject* pPhysics = PhysModelCreateCustom(this, pModel, GetAbsOrigin(), GetAbsAngles(), "barney_hull", false); + + VPhysicsSetObject(pPhysics); + if (pPhysics) + { + pPhysics->SetCallbackFlags(CALLBACK_GLOBAL_COLLISION | CALLBACK_SHADOW_COLLISION); + } + PhysAddShadow(this); + + return true; +} int CNPC_HGrunt::IRelationPriority( CBaseEntity *pTarget ) { //I hate alien grunts more than anything. @@ -425,10 +442,13 @@ void CNPC_HGrunt::PrescheduleThink ( void ) } else { - if ( gpGlobals->curtime - pSquadLeader->m_flLastEnemySightTime > 5 ) + if ( gpGlobals->curtime - pSquadLeader->m_flLastEnemySightTime > 5.0f ) { // been a while since we've seen the enemy - pSquadLeader->GetEnemies()->MarkAsEluded( GetEnemy() ); + if(GetEnemy() != NULL && GetEnemies() != NULL){ + pSquadLeader->GetEnemies()->MarkAsEluded( GetEnemy() ); + } + } } } @@ -1640,6 +1660,7 @@ int CNPC_HGrunt::SelectSchedule( void ) // little time and give the player a chance to turn. if ( pSquadLeader && pSquadLeader->EnemyHasEludedMe() && !HasCondition ( COND_ENEMY_FACING_ME ) ) { + pSquadLeader->EnemyHasEludedMe(); // try to fix bug in chapter we`re all hostiles return SCHED_GRUNT_FOUND_ENEMY; } } diff --git a/game/server/hl1/hl1_npc_hgrunt.h b/game/server/hl1/hl1_npc_hgrunt.h index af82ebd3..f7f514d3 100644 --- a/game/server/hl1/hl1_npc_hgrunt.h +++ b/game/server/hl1/hl1_npc_hgrunt.h @@ -24,6 +24,7 @@ public: void PrescheduleThink ( void ); bool FOkToSpeak( void ); + bool CreateVPhysics( void ); Class_T Classify ( void ); int RangeAttack1Conditions ( float flDot, float flDist ); diff --git a/game/server/hl1/hl1_weapon_crowbar.cpp b/game/server/hl1/hl1_weapon_crowbar.cpp index 8e02fac0..c857e667 100644 --- a/game/server/hl1/hl1_weapon_crowbar.cpp +++ b/game/server/hl1/hl1_weapon_crowbar.cpp @@ -26,27 +26,6 @@ extern ConVar sk_plr_dmg_crowbar; -//Crowbar Sounds -extern ConVar hl1_crowbar_sound; -extern ConVar hl1_crowbar_concrete; -extern ConVar hl1_crowbar_metal; -extern ConVar hl1_crowbar_dirt; -extern ConVar hl1_crowbar_vent; -extern ConVar hl1_crowbar_grate; -extern ConVar hl1_crowbar_tile; -extern ConVar hl1_crowbar_wood; -extern ConVar hl1_crowbar_glass; -extern ConVar hl1_crowbar_computer; - -extern ConVar hl1_crowbar_concrete_vol; -extern ConVar hl1_crowbar_metal_vol; -extern ConVar hl1_crowbar_dirt_vol; -extern ConVar hl1_crowbar_vent_vol; -extern ConVar hl1_crowbar_grate_vol; -extern ConVar hl1_crowbar_wood_vol; -extern ConVar hl1_crowbar_glass_vol; -extern ConVar hl1_crowbar_computer_vol; - #define CROWBAR_RANGE 64.0f #define CROWBAR_REFIRE_MISS 0.5f #define CROWBAR_REFIRE_HIT 0.25f diff --git a/gameui/OptionsSubModification.cpp b/gameui/OptionsSubModification.cpp index d0709121..133becfc 100644 --- a/gameui/OptionsSubModification.cpp +++ b/gameui/OptionsSubModification.cpp @@ -26,7 +26,7 @@ using namespace vgui; COptionsSubModification::COptionsSubModification(vgui::Panel *parent) : PropertyPage(parent, nullptr) { -#ifndef ANDROID // TODO: Android +// TODO: Android // Create the slider for aspect ratio adjustments m_pAspectRatioSlider = new CCvarSlider( this, @@ -39,14 +39,20 @@ COptionsSubModification::COptionsSubModification(vgui::Panel *parent) : Property m_aspectRatioLabel = new TextEntry(this, "AspectRatioLabel"); m_aspectRatioLabel->AddActionSignalTarget(this); -#endif + m_pChangeCheatFlag = new CCvarToggleCheckButton( this , "ChangeCheatFlag" , "Change Cheat Flag" , "sv_cheats" ); + m_giveWeaponButton = new Button(this, "GiveWeapon", "Give Weapon"); // Load settings from the associated resource file LoadControlSettings("Resource\\OptionsSubModification.res"); + m_giveWeaponButton->SetCommand("GiveWeapon"); + m_giveWeaponButton->AddActionSignalTarget(this); + UpdateLabel(m_pAspectRatioSlider, m_aspectRatioLabel); + + m_giveWeaponButton->SetEnabled(true); } COptionsSubModification::~COptionsSubModification() = default; @@ -115,4 +121,16 @@ void COptionsSubModification::UpdateLabel(CCvarSlider *slider, vgui::TextEntry * char buf[64]; Q_snprintf(buf, sizeof(buf), "%.2f", slider->GetSliderValue()); label->SetText(buf); -} \ No newline at end of file +} +void COptionsSubModification::OnCommand(const char *command) +{ + if (!stricmp(command, "GiveWeapon")) + { + engine->ExecuteClientCmd("impulse 101"); + Msg("GiveWeapon command triggered\n"); // Debug message + } + else + { + BaseClass::OnCommand(command); // Make sure to call the base class for any other commands + } +} diff --git a/gameui/OptionsSubModification.h b/gameui/OptionsSubModification.h index 4ae85272..00394165 100644 --- a/gameui/OptionsSubModification.h +++ b/gameui/OptionsSubModification.h @@ -7,6 +7,7 @@ #ifndef OPTIONS_SUB_MODIFICATION_H #define OPTIONS_SUB_MODIFICATION_H +#include "vgui_controls/Button.h" #ifdef _WIN32 #pragma once #endif @@ -18,11 +19,13 @@ class CKeyToggleCheckButton; class CCvarToggleCheckButton; class CCvarSlider; + namespace vgui { class Label; class Panel; } +class VControlsListPanel; //----------------------------------------------------------------------------- // Purpose: Touch Details, Part of OptionsDialog @@ -37,6 +40,7 @@ public: virtual void OnResetData(); virtual void OnApplyChanges(); + virtual void OnCommand(const char *command); protected: virtual void ApplySchemeSettings(vgui::IScheme *pScheme); @@ -51,32 +55,9 @@ protected: void UpdateLabel(CCvarSlider *slider, vgui::TextEntry *label); private: - // Get from OptionsSubTouchSettings.cpp - /* CCvarToggleCheckButton *m_pReverseTouchCheckBox; - CCvarToggleCheckButton *m_pTouchFilterCheckBox; - CCvarToggleCheckButton *m_pTouchRawCheckBox; - CCvarToggleCheckButton *m_pTouchAccelerationCheckBox; - - CCvarToggleCheckButton *m_pTouchCheckBox; - CCvarToggleCheckButton *m_pTouchSouthpawCheckBox; - CCvarToggleCheckButton *m_pQuickInfoCheckBox; - CCvarToggleCheckButton *m_pTouchEnableCheckBox; - CCvarToggleCheckButton *m_pTouchDrawCheckBox; - - CCvarSlider *m_pTouchSensitivitySlider; - vgui::TextEntry *m_pTouchSensitivityLabel; - - CCvarSlider *m_pTouchAccelExponentSlider; - vgui::TextEntry *m_pTouchAccelExponentLabel; - - CCvarSlider *m_pTouchYawSensitivitySlider; - vgui::Label *m_pTouchYawSensitivityPreLabel; - CCvarSlider *m_pTouchPitchSensitivitySlider; - vgui::Label *m_pTouchPitchSensitivityPreLabel; - vgui::TextEntry *m_pTouchYawSensitivityLabel; - vgui::TextEntry *m_pTouchPitchSensitivityLabel; */ - vgui::TextEntry *m_aspectRatioLabel; + vgui::Button *m_giveWeaponButton; + CCvarToggleCheckButton *m_pChangeCheatFlag; CCvarSlider *m_pAspectRatioSlider; }; diff --git a/gameui/OptionsSubVideo.cpp b/gameui/OptionsSubVideo.cpp index 1e1e912a..3a0469bf 100644 --- a/gameui/OptionsSubVideo.cpp +++ b/gameui/OptionsSubVideo.cpp @@ -1544,6 +1544,7 @@ void COptionsSubVideo::OnApplyChanges() bConfigChanged = true; } + #if defined( USE_SDL ) if ( !windowed ) {