Skip to content

Commit

Permalink
Add "Take 1 HP" effect
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedSnark committed Mar 27, 2024
1 parent fb7b304 commit 4762fa8
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 0 deletions.
1 change: 1 addition & 0 deletions GSChaos/CChaos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ void CChaos::FeatureInit()
RegisterChaosFeature<CFeatureSpawnFastrun>();
RegisterChaosFeature<CFeatureWorldHallucination>();
RegisterChaosFeature<CFeatureGiveOneHP>();
RegisterChaosFeature<CFeatureTakeOneHP>();

RegisterChaosFeature<CFeatureCombineEffects>(); // must be last!!!

Expand Down
25 changes: 25 additions & 0 deletions GSChaos/CFeatureTakeOneHP.cpp
Original file line number Diff line number Diff line change
@@ -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";
}
37 changes: 37 additions & 0 deletions GSChaos/CFeatureTakeOneHP.h
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions GSChaos/GSChaos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
<ClCompile Include="CFeatureSpawnFastrun.cpp" />
<ClCompile Include="CFeatureSpawnRandomEntity.cpp" />
<ClCompile Include="CFeatureStop.cpp" />
<ClCompile Include="CFeatureTakeOneHP.cpp" />
<ClCompile Include="CFeatureTotem.cpp" />
<ClCompile Include="CFeatureUpsideDown.cpp" />
<ClCompile Include="CFeatureBikiniBottom.cpp" />
Expand Down Expand Up @@ -293,6 +294,7 @@
<ClInclude Include="CFeatureSpawnFastrun.h" />
<ClInclude Include="CFeatureSpawnRandomEntity.h" />
<ClInclude Include="CFeatureStop.h" />
<ClInclude Include="CFeatureTakeOneHP.h" />
<ClInclude Include="CFeatureTotem.h" />
<ClInclude Include="CFeatureUpsideDown.h" />
<ClInclude Include="CFeatureBikiniBottom.h" />
Expand Down
6 changes: 6 additions & 0 deletions GSChaos/GSChaos.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@
<ClCompile Include="CFeatureGiveOneHP.cpp">
<Filter>Effects</Filter>
</ClCompile>
<ClCompile Include="CFeatureTakeOneHP.cpp">
<Filter>Effects</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="includes.h" />
Expand Down Expand Up @@ -599,6 +602,9 @@
<ClInclude Include="CFeatureGiveOneHP.h">
<Filter>Effects</Filter>
</ClInclude>
<ClInclude Include="CFeatureTakeOneHP.h">
<Filter>Effects</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Hooking">
Expand Down
1 change: 1 addition & 0 deletions GSChaos/includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ extern bool g_bEncrypted;
#include "CFeatureSpawnFastrun.h"
#include "CFeatureWorldHallucination.h"
#include "CFeatureGiveOneHP.h"
#include "CFeatureTakeOneHP.h"

#include "CFeatureCombineEffects.h"
//========================
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
```

Expand Down

0 comments on commit 4762fa8

Please sign in to comment.