diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base.vcxproj b/Andromeda-CS2-Base/Andromeda-CS2-Base.vcxproj index 3605c36..9d4d18e 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base.vcxproj +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base.vcxproj @@ -141,7 +141,8 @@ - + + @@ -262,6 +263,7 @@ + diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base.vcxproj.filters b/Andromeda-CS2-Base/Andromeda-CS2-Base.vcxproj.filters index 904b47c..3c716c8 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base.vcxproj.filters +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base.vcxproj.filters @@ -127,6 +127,9 @@ {8c1b7cf4-69bc-41fb-8a38-52d85347e1a2} + + {3d9e5f80-2b7a-4c46-a2f1-9e8b54d1c0b3} + @@ -477,6 +480,9 @@ Andromeda-CS2-Base\AndromedaClient\Features\CVisual + + Andromeda-CS2-Base\AndromedaClient\Features\CMisc + Andromeda-CS2-Base\CS2\Hook @@ -1130,6 +1136,9 @@ Andromeda-CS2-Base\AndromedaClient\Features\CVisual + + Andromeda-CS2-Base\AndromedaClient\Features\CMisc + Andromeda-CS2-Base\CS2\Hook diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/CAndromedaClient.cpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/CAndromedaClient.cpp index 74b7743..f584f8c 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/CAndromedaClient.cpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/CAndromedaClient.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include @@ -25,11 +26,13 @@ auto CAndromedaClient::OnInit() -> void auto CAndromedaClient::OnFrameStageNotify( int FrameStage ) -> void { GetInventoryChanger()->OnFrameStageNotify( FrameStage ); + GetMisc()->OnFrameStageNotify( FrameStage ); } auto CAndromedaClient::OnFireEventClientSide( IGameEvent* pGameEvent ) -> void { GetInventoryChanger()->OnFireEventClientSide( pGameEvent ); + GetMisc()->OnFireEventClientSide( pGameEvent ); } auto CAndromedaClient::OnAddEntity( CEntityInstance* pInst , CHandle handle ) -> void @@ -48,7 +51,7 @@ auto CAndromedaClient::OnRender() -> void GetAndromedaMenu()->OnRenderMenu(); GetFontManager()->FirstInitFonts(); - GetFontManager()->m_VerdanaFont.DrawString( 1 , 1 , ImColor( 255 , 255 , 0 ) , FW1_LEFT , XorStr( CHEAT_NAME ) ); + GetMisc()->OnRender(); if ( SDK::Interfaces::EngineToClient()->IsInGame() ) { @@ -61,12 +64,14 @@ auto CAndromedaClient::OnClientOutput() -> void if ( SDK::Interfaces::EngineToClient()->IsInGame() ) { GetVisual()->OnClientOutput(); + GetMisc()->OnClientOutput(); } } auto CAndromedaClient::OnCreateMove( CCSGOInput* pInput , CUserCmd* pUserCmd ) -> void { GetVisual()->OnCreateMove(); + GetMisc()->OnCreateMove( pInput , pUserCmd ); } auto GetAndromedaClient() -> CAndromedaClient* diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Features/CMisc/CMisc.cpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Features/CMisc/CMisc.cpp new file mode 100644 index 0000000..b04da16 --- /dev/null +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Features/CMisc/CMisc.cpp @@ -0,0 +1,227 @@ +#include "CMisc.hpp" + +#include +#include +#include + +#pragma comment( lib , "winmm.lib" ) + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +static CMisc g_CMisc{}; + +auto CMisc::OnRender() -> void +{ + if ( !Settings::Misc::Watermark ) + return; + + const auto t = std::time( nullptr ); + std::tm tm{}; + localtime_s( &tm , &t ); + + char szBuffer[ 128 ]; + + std::snprintf( szBuffer , sizeof szBuffer , XorStr( "Evicted | FPS: %.0f | %02d:%02d:%02d" ) , ImGui::GetIO().Framerate , tm.tm_hour , tm.tm_min , tm.tm_sec ); + + GetFontManager()->m_VerdanaFont.DrawString( 8 , 8 , ImColor( 255 , 255 , 0 ) , FW1_LEFT , "%s" , szBuffer ); +} + +auto CMisc::OnClientOutput() -> void +{ + if ( !SDK::Interfaces::EngineToClient()->IsInGame() ) + return; + + if ( Settings::Misc::SpectatorList ) + { + auto* pLocalController = GetCL_Players()->GetLocalPlayerController(); + + auto* pFont = &GetFontManager()->m_VerdanaFont; + + if ( pLocalController && pFont ) + { + const CHandle LocalPawnHandle = pLocalController->m_hPawn(); + + const auto DisplaySize = ImGui::GetIO().DisplaySize; + + const float ListX = DisplaySize.x - 8.f; + float ListY = pFont->GetFontSize() + 12.f; + + const auto& CachedVec = GetEntityCache()->GetCachedEntity(); + + std::scoped_lock Lock( GetEntityCache()->GetLock() ); + + for ( const auto& CachedEntity : *CachedVec ) + { + if ( CachedEntity.m_Type != CachedEntity_t::PLAYER_CONTROLLER ) + continue; + + auto* pEntity = CachedEntity.m_Handle.Get(); + + if ( !pEntity ) + continue; + + auto* pController = reinterpret_cast( pEntity ); + + if ( pController == pLocalController ) + continue; + + auto* pPawn = pController->m_hPawn().Get(); + + if ( !pPawn || !pPawn->IsPlayerPawn() ) + continue; + + auto* pObserverServices = pPawn->m_pObserverServices(); + + if ( !pObserverServices ) + continue; + + const auto ObserverMode = pObserverServices->m_iObserverMode(); + + if ( ObserverMode != 4 && ObserverMode != 5 ) + continue; + + if ( pObserverServices->m_hObserverTarget() != LocalPawnHandle ) + continue; + + const char* szName = pController->m_sSanitizedPlayerName(); + + if ( !szName || !szName[ 0 ] ) + continue; + + GetRenderStackSystem()->DrawString( pFont , ImVec2( ListX , ListY ) , FW1_RIGHT | FW1_TOP , ImColor( 255 , 255 , 255 ) , "%s" , szName ); + + ListY += pFont->GetFontSize() + 2.f; + } + } + } + + if ( Settings::Misc::Hitmarker ) + { + if ( m_HitTime.time_since_epoch().count() > 0 ) + { + const auto Elapsed = std::chrono::duration( std::chrono::steady_clock::now() - m_HitTime ).count(); + + if ( Elapsed <= 0.25f ) + { + const auto DisplaySize = ImGui::GetIO().DisplaySize; + + const ImVec2 Center( DisplaySize.x * 0.5f , DisplaySize.y * 0.5f ); + + const float Size = 6.f; + + GetRenderStackSystem()->DrawLine( ImVec2( Center.x - Size , Center.y - Size ) , ImVec2( Center.x - 2.f , Center.y - 2.f ) , ImColor( 255 , 255 , 255 ) , 1.5f ); + GetRenderStackSystem()->DrawLine( ImVec2( Center.x + Size , Center.y - Size ) , ImVec2( Center.x + 2.f , Center.y - 2.f ) , ImColor( 255 , 255 , 255 ) , 1.5f ); + GetRenderStackSystem()->DrawLine( ImVec2( Center.x - Size , Center.y + Size ) , ImVec2( Center.x - 2.f , Center.y + 2.f ) , ImColor( 255 , 255 , 255 ) , 1.5f ); + GetRenderStackSystem()->DrawLine( ImVec2( Center.x + Size , Center.y + Size ) , ImVec2( Center.x + 2.f , Center.y + 2.f ) , ImColor( 255 , 255 , 255 ) , 1.5f ); + } + } + } +} + +auto CMisc::OnCreateMove( CCSGOInput* pInput , CUserCmd* pUserCmd ) -> void +{ + if ( !pUserCmd ) + return; + + if ( Settings::Misc::Bunnyhop ) + { + auto* pLocalPawn = GetCL_Players()->GetLocalPlayerPawn(); + + if ( pLocalPawn && pLocalPawn->IsAlive() ) + { + constexpr auto FL_ONGROUND = 1u; + + const bool bOnGround = ( pLocalPawn->m_fFlags() & FL_ONGROUND ) != 0; + const bool bHoldingJump = ( pUserCmd->button_states.buttonstate1 & IN_JUMP ) != 0; + + if ( bHoldingJump ) + { + if ( bOnGround ) + pUserCmd->button_states.buttonstate1 |= IN_JUMP; + else + pUserCmd->button_states.buttonstate1 &= ~IN_JUMP; + } + } + } + + if ( Settings::Misc::FOVChanger ) + { + auto* pLocalPawn = GetCL_Players()->GetLocalPlayerPawn(); + + if ( pLocalPawn ) + { + if ( auto* pCameraServices = pLocalPawn->m_pCameraServices(); pCameraServices ) + pCameraServices->m_iFOV() = static_cast( Settings::Misc::FOV ); + } + } +} + +auto CMisc::OnFrameStageNotify( int FrameStage ) -> void +{ + if ( FrameStage != 6 ) + return; + + if ( !Settings::Misc::NoFlash ) + return; + + auto* pLocalPawn = GetCL_Players()->GetLocalPlayerPawn(); + + if ( !pLocalPawn ) + return; + + pLocalPawn->m_flFlashDuration() = 0.f; + pLocalPawn->m_flFlashMaxAlpha() = 0.f; +} + +auto CMisc::OnFireEventClientSide( IGameEvent* pGameEvent ) -> void +{ + if ( !pGameEvent ) + return; + + if ( _strcmpi( pGameEvent->GetName() , XorStr( "player_hurt" ) ) != 0 ) + return; + + auto* pLocalController = GetCL_Players()->GetLocalPlayerController(); + + if ( !pLocalController ) + return; + + auto* pAttackerController = pGameEvent->GetPlayerController( XorStr( "attacker" ) ); + + if ( pAttackerController != pLocalController ) + return; + + const auto Now = std::chrono::steady_clock::now(); + + if ( Settings::Misc::Hitmarker ) + m_HitTime = Now; + + if ( Settings::Misc::HitSound ) + { + if ( ( Now - m_HitSoundTime ) > std::chrono::milliseconds( 50 ) ) + { + m_HitSoundTime = Now; + + PlaySoundW( L"SystemHand" , nullptr , SND_ALIAS | SND_ASYNC | SND_NODEFAULT ); + } + } +} + +auto GetMisc() -> CMisc* +{ + return &g_CMisc; +} diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Features/CMisc/CMisc.hpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Features/CMisc/CMisc.hpp new file mode 100644 index 0000000..3396fd2 --- /dev/null +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Features/CMisc/CMisc.hpp @@ -0,0 +1,35 @@ +#pragma once + +#include + +#include + +class CCSGOInput; +class CUserCmd; +class IGameEvent; + +class IMisc +{ +public: + virtual void OnRender() = 0; + virtual void OnClientOutput() = 0; + virtual void OnCreateMove( CCSGOInput* pInput , CUserCmd* pUserCmd ) = 0; + virtual void OnFrameStageNotify( int FrameStage ) = 0; + virtual void OnFireEventClientSide( IGameEvent* pGameEvent ) = 0; +}; + +class CMisc final : public IMisc +{ +public: + virtual void OnRender() override; + virtual void OnClientOutput() override; + virtual void OnCreateMove( CCSGOInput* pInput , CUserCmd* pUserCmd ) override; + virtual void OnFrameStageNotify( int FrameStage ) override; + virtual void OnFireEventClientSide( IGameEvent* pGameEvent ) override; + +private: + std::chrono::steady_clock::time_point m_HitTime{}; + std::chrono::steady_clock::time_point m_HitSoundTime{}; +}; + +auto GetMisc() -> CMisc*; diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Features/CVisual/CVisual.cpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Features/CVisual/CVisual.cpp index 9750f03..24b4ba7 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Features/CVisual/CVisual.cpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Features/CVisual/CVisual.cpp @@ -265,7 +265,7 @@ auto CVisual::GetPlayerWeaponName( C_CSPlayerPawn* pPawn ) -> const char* const int iDefIdx = pWeapon->m_AttributeManager()->m_Item()->m_iItemDefinitionIndex(); - return GetWeaponDescFromDefinitionIndex( iDefIdx ); + return GetWeaponNameFromDefinitionIndex( iDefIdx ); } auto CVisual::HasBomb( C_CSPlayerPawn* pPawn ) -> bool diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/GUI/CAndromedaMenu.cpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/GUI/CAndromedaMenu.cpp index 097dcf7..45ced8e 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/GUI/CAndromedaMenu.cpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/GUI/CAndromedaMenu.cpp @@ -72,6 +72,12 @@ auto CAndromedaMenu::OnRenderMenu() -> void ImGui::EndTabItem(); } + if ( ImGui::BeginTabItem( "Misc" ) ) + { + RenderMiscPanel(); + ImGui::EndTabItem(); + } + if ( ImGui::BeginTabItem( "Config" ) ) { RenderConfigPanel(); @@ -321,6 +327,31 @@ auto CAndromedaMenu::RenderMusicPanel() -> void ImGui::EndChild(); } +auto CAndromedaMenu::RenderMiscPanel() -> void +{ + ImGui::SeparatorText( "Movement" ); + + Checkbox( "Bunnyhop" , Settings::Misc::Bunnyhop ); + Checkbox( "No Flash" , Settings::Misc::NoFlash ); + + ImGui::SeparatorText( "Camera" ); + + Checkbox( "FOV Changer" , Settings::Misc::FOVChanger ); + + if ( Settings::Misc::FOVChanger ) + SliderInt( "FOV" , Settings::Misc::FOV , 70 , 120 ); + + ImGui::SeparatorText( "Overlays" ); + + Checkbox( "Watermark" , Settings::Misc::Watermark ); + Checkbox( "Spectator List" , Settings::Misc::SpectatorList ); + + ImGui::SeparatorText( "Combat Feedback" ); + + Checkbox( "Hitmarker" , Settings::Misc::Hitmarker ); + Checkbox( "Hit Sound" , Settings::Misc::HitSound ); +} + auto CAndromedaMenu::RenderConfigPanel() -> void { ImGui::SeparatorText( "Menu" ); diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/GUI/CAndromedaMenu.hpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/GUI/CAndromedaMenu.hpp index 4214b95..727bc23 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/GUI/CAndromedaMenu.hpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/GUI/CAndromedaMenu.hpp @@ -15,6 +15,7 @@ private: auto RenderSkinPanel() -> void; auto RenderMusicPanel() -> void; auto RenderConfigPanel() -> void; + auto RenderMiscPanel() -> void; private: auto Checkbox( const char* szLabel , bool& bValue ) -> bool; diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Settings/Settings.hpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Settings/Settings.hpp index 19442b5..52d658d 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Settings/Settings.hpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/AndromedaClient/Settings/Settings.hpp @@ -41,6 +41,17 @@ namespace Settings inline auto MenuAlpha = 200; inline auto MenuStyle = 0; } + namespace Misc + { + inline auto Bunnyhop = false; + inline auto NoFlash = false; + inline auto FOVChanger = false; + inline auto FOV = 90; + inline auto SpectatorList = false; + inline auto Watermark = true; + inline auto Hitmarker = true; + inline auto HitSound = true; + } namespace Colors { namespace Visual diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/GameClient/CL_ItemDefinition.cpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/GameClient/CL_ItemDefinition.cpp index f9e157b..1bcaad5 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/GameClient/CL_ItemDefinition.cpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/GameClient/CL_ItemDefinition.cpp @@ -114,6 +114,29 @@ auto GetWeaponDescFromDefinitionIndex( int DefinitionIndex ) -> const char* return ""; } +auto GetWeaponNameFromDefinitionIndex( int DefinitionIndex ) -> const char* +{ + for ( size_t i = 0; i < g_WeaponsNames.size(); i++ ) + { + if ( g_WeaponsNames[i].m_WeaponDefinitionIndex == DefinitionIndex ) + return g_WeaponsNames[i].m_pszName; + } + + for ( size_t i = 0; i < g_KnifesNames.size(); i++ ) + { + if ( g_KnifesNames[i].m_WeaponDefinitionIndex == DefinitionIndex ) + return g_KnifesNames[i].m_pszName; + } + + for ( size_t i = 0; i < g_GrenadeNames.size(); i++ ) + { + if ( g_GrenadeNames[i].m_WeaponDefinitionIndex == DefinitionIndex ) + return g_GrenadeNames[i].m_pszName; + } + + return ""; +} + auto GetGloveDescFromDefinitionIndex( int DefinitionIndex ) -> const char* { for ( size_t i = 0; i < g_GlovesNames.size(); i++ ) diff --git a/Andromeda-CS2-Base/Andromeda-CS2-Base/GameClient/CL_ItemDefinition.hpp b/Andromeda-CS2-Base/Andromeda-CS2-Base/GameClient/CL_ItemDefinition.hpp index afb0830..579b91d 100644 --- a/Andromeda-CS2-Base/Andromeda-CS2-Base/GameClient/CL_ItemDefinition.hpp +++ b/Andromeda-CS2-Base/Andromeda-CS2-Base/GameClient/CL_ItemDefinition.hpp @@ -144,6 +144,7 @@ extern std::vector g_GrenadeNames; // Weapon Info auto GetWeaponDescFromDefinitionIndex( int DefinitionIndex ) -> const char*; +auto GetWeaponNameFromDefinitionIndex( int DefinitionIndex ) -> const char*; auto GetGloveDescFromDefinitionIndex( int DefinitionIndex ) -> const char*; auto GetKnifeDescFromDefinitionIndex( int DefinitionIndex ) -> const char*; auto GetKnifeIconNameFromDefinitionIndex( int DefinitionIndex ) -> const char*;