From 4762fa80d5f21a2852bbe631e19bd395abf8a846 Mon Sep 17 00:00:00 2001 From: ScriptedSnark <51358194+ScriptedSnark@users.noreply.github.com> Date: Wed, 27 Mar 2024 18:56:34 +0500 Subject: [PATCH] Add "Take 1 HP" effect --- GSChaos/CChaos.cpp | 1 + GSChaos/CFeatureTakeOneHP.cpp | 25 ++++++++++++++++++++++ GSChaos/CFeatureTakeOneHP.h | 37 +++++++++++++++++++++++++++++++++ GSChaos/GSChaos.vcxproj | 2 ++ GSChaos/GSChaos.vcxproj.filters | 6 ++++++ GSChaos/includes.h | 1 + README.md | 1 + 7 files changed, 73 insertions(+) create mode 100644 GSChaos/CFeatureTakeOneHP.cpp create mode 100644 GSChaos/CFeatureTakeOneHP.h diff --git a/GSChaos/CChaos.cpp b/GSChaos/CChaos.cpp index 422a157a..c3777a5e 100644 --- a/GSChaos/CChaos.cpp +++ b/GSChaos/CChaos.cpp @@ -263,6 +263,7 @@ void CChaos::FeatureInit() RegisterChaosFeature(); RegisterChaosFeature(); RegisterChaosFeature(); + RegisterChaosFeature(); RegisterChaosFeature(); // must be last!!! diff --git a/GSChaos/CFeatureTakeOneHP.cpp b/GSChaos/CFeatureTakeOneHP.cpp new file mode 100644 index 00000000..db17ac02 --- /dev/null +++ b/GSChaos/CFeatureTakeOneHP.cpp @@ -0,0 +1,25 @@ +#include "includes.h" + +void CFeatureTakeOneHP::Init() +{ + CChaosFeature::Init(); +} + +void CFeatureTakeOneHP::ActivateFeature() +{ + CChaosFeature::ActivateFeature(); + + UTIL_TakeDamage((*sv_player)->v, 1.0f, DMG_GENERIC); + UTIL_ScreenFade((*sv_player), Vector(192, 0, 0), 0.5f, 0.1f, 128, FFADE_IN); + ma_engine_play_sound(&miniAudio, "valve/sound/player/pl_pain2.wav", NULL); +} + +void CFeatureTakeOneHP::DeactivateFeature() +{ + CChaosFeature::DeactivateFeature(); +} + +const char* CFeatureTakeOneHP::GetFeatureName() +{ + return "Take 1 HP"; +} \ No newline at end of file diff --git a/GSChaos/CFeatureTakeOneHP.h b/GSChaos/CFeatureTakeOneHP.h new file mode 100644 index 00000000..992d6c0a --- /dev/null +++ b/GSChaos/CFeatureTakeOneHP.h @@ -0,0 +1,37 @@ +/** + * Copyright - ScriptedSnark, 2024. + * CFeatureTakeOneHP.h + * + * Project (GSChaos) header file + * Authors: ScriptedSnark. + * Do not delete this comment block. Respect others' work! + */ + +#ifdef CFEATURETAKEONEHP_H_RECURSE_GUARD +#error Recursive header files inclusion detected in CFeatureTakeOneHP.h +#else //CFEATURETAKEONEHP_H_RECURSE_GUARD + +#define CFEATURETAKEONEHP_H_RECURSE_GUARD + +#ifndef CFEATURETAKEONEHP_H_GUARD +#define CFEATURETAKEONEHP_H_GUARD +#pragma once + +#ifdef __cplusplus + +class CFeatureTakeOneHP : public CChaosFeature +{ + void Init() override; + void ActivateFeature() override; + void DeactivateFeature() override; + const char* GetFeatureName() override; +}; + +#else //!__cplusplus +#error C++ compiler required to compile CFeatureTakeOneHP.h +#endif //__cplusplus + +#endif //CFEATURETAKEONEHP_H_GUARD + +#undef CFEATURETAKEONEHP_H_RECURSE_GUARD +#endif //CFEATURETAKEONEHP_H_RECURSE_GUARD \ No newline at end of file diff --git a/GSChaos/GSChaos.vcxproj b/GSChaos/GSChaos.vcxproj index c606c337..987c7fdc 100644 --- a/GSChaos/GSChaos.vcxproj +++ b/GSChaos/GSChaos.vcxproj @@ -179,6 +179,7 @@ + @@ -293,6 +294,7 @@ + diff --git a/GSChaos/GSChaos.vcxproj.filters b/GSChaos/GSChaos.vcxproj.filters index 5a9843f3..6bdb8331 100644 --- a/GSChaos/GSChaos.vcxproj.filters +++ b/GSChaos/GSChaos.vcxproj.filters @@ -251,6 +251,9 @@ Effects + + Effects + @@ -599,6 +602,9 @@ Effects + + Effects + diff --git a/GSChaos/includes.h b/GSChaos/includes.h index ae7555d3..553fba54 100644 --- a/GSChaos/includes.h +++ b/GSChaos/includes.h @@ -156,6 +156,7 @@ extern bool g_bEncrypted; #include "CFeatureSpawnFastrun.h" #include "CFeatureWorldHallucination.h" #include "CFeatureGiveOneHP.h" +#include "CFeatureTakeOneHP.h" #include "CFeatureCombineEffects.h" //======================== diff --git a/README.md b/README.md index 5b5989c1..0ffc9282 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ If you don't want to play with this feature, rename `twitch.ini` to `twitch_DISA > Spawn fastrun.bsp > World Hallucination > Give +1 HP +> Take 1 HP > Combine Effects ( 3 in 1 ) ```