Skip to content

Commit

Permalink
Add "No Attacking" effect
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedSnark committed Nov 12, 2024
1 parent 65129ec commit 08f6183
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 13 deletions.
1 change: 1 addition & 0 deletions GSChaos/CChaos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ void CChaos::FeatureInit()
RegisterChaosFeature<CFeatureVoidclip>();
RegisterChaosFeature<CFeatureLowDrawDistance>();
RegisterChaosFeature<CFeatureSuperhot>();
RegisterChaosFeature<CFeatureNoAttacking>();

// must be last
RegisterChaosFeature<CFeatureCheatCodeVoting>();
Expand Down
46 changes: 46 additions & 0 deletions GSChaos/CFeatureNoAttacking.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include "includes.h"

void CFeatureNoAttacking::Init()
{
CChaosFeature::Init();
}

void CFeatureNoAttacking::ActivateFeature()
{
CChaosFeature::ActivateFeature();
}

void CFeatureNoAttacking::DeactivateFeature()
{
CChaosFeature::DeactivateFeature();
}

void CFeatureNoAttacking::CL_CreateMove(float frametime, struct usercmd_s* cmd, int active)
{
if (!IsActive())
return;

cmd->buttons &= ~IN_ATTACK;
cmd->buttons &= ~IN_ATTACK2;
cmd->buttons &= ~IN_ALT1;
}

const char* CFeatureNoAttacking::GetFeatureName()
{
return "No Attacking";
}

double CFeatureNoAttacking::GetDuration()
{
return gChaos.GetChaosTime() * 0.9;
}

bool CFeatureNoAttacking::UseCustomDuration()
{
return true;
}

bool CFeatureNoAttacking::CanBeInfinite()
{
return true;
}
41 changes: 41 additions & 0 deletions GSChaos/CFeatureNoAttacking.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright - ScriptedSnark, 2024.
* CFeatureNoAttacking.h
*
* Project (GSChaos) header file
* Authors: ScriptedSnark.
* Do not delete this comment block. Respect others' work!
*/

#ifdef CFEATURENOATTACKING_H_RECURSE_GUARD
#error Recursive header files inclusion detected in CFeatureNoAttacking.h
#else //CFEATURENOATTACKING_H_RECURSE_GUARD

#define CFEATURENOATTACKING_H_RECURSE_GUARD

#ifndef CFEATURENOATTACKING_H_GUARD
#define CFEATURENOATTACKING_H_GUARD
#pragma once

#ifdef __cplusplus

class CFeatureNoAttacking : public CChaosFeature
{
void Init() override;
void ActivateFeature() override;
void DeactivateFeature() override;
void CL_CreateMove(float frametime, struct usercmd_s* cmd, int active) override;
const char* GetFeatureName() override;
double GetDuration() override;
bool UseCustomDuration() override;
bool CanBeInfinite() override;
};

#else //!__cplusplus
#error C++ compiler required to compile CFeatureNoAttacking.h
#endif //__cplusplus

#endif //CFEATURENOATTACKING_H_GUARD

#undef CFEATURENOATTACKING_H_RECURSE_GUARD
#endif //CFEATURENOATTACKING_H_RECURSE_GUARD
15 changes: 2 additions & 13 deletions GSChaos/GSChaos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,18 +710,7 @@ void HookEngine()
DEBUG_PRINT("[hw dll] Found gpGlobals at 0x%p.\n", gpGlobals);

break;
case 1: // HL-8684
DEBUG_PRINT("Searching g_engfuncs in HL-8684 pattern...\n");
g_engfuncs = *reinterpret_cast<enginefuncs_t**>(reinterpret_cast<uintptr_t>(LoadThisDll) + 0x5F);
gpGlobals = *reinterpret_cast<globalvars_t**>(reinterpret_cast<uintptr_t>(LoadThisDll) + 0x5A);

if (g_engfuncs)
DEBUG_PRINT("[hw dll] Found g_engfuncs at 0x%p.\n", g_engfuncs);

if (gpGlobals)
DEBUG_PRINT("[hw dll] Found gpGlobals at 0x%p.\n", gpGlobals);
break;
case 2: // HL-4554
case 1: // HL-4554
DEBUG_PRINT("Searching g_engfuncs in HL-4554 pattern...\n");
g_engfuncs = *reinterpret_cast<enginefuncs_t**>(reinterpret_cast<uintptr_t>(LoadThisDll) + 91);
gpGlobals = *reinterpret_cast<globalvars_t**>(reinterpret_cast<uintptr_t>(LoadThisDll) + 86);
Expand All @@ -733,7 +722,7 @@ void HookEngine()
DEBUG_PRINT("[hw dll] Found gpGlobals at 0x%p.\n", gpGlobals);
break;

case 3: // CoF-5936
case 2: // CoF-5936
DEBUG_PRINT("Searching g_engfuncs in CoF-5936 pattern...\n");
g_engfuncs = *reinterpret_cast<enginefuncs_t**>(reinterpret_cast<uintptr_t>(LoadThisDll) + 118);
gpGlobals = *reinterpret_cast<globalvars_t**>(reinterpret_cast<uintptr_t>(LoadThisDll) + 113);
Expand Down
2 changes: 2 additions & 0 deletions GSChaos/GSChaos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
<ClCompile Include="CFeatureNegativeAccelerate.cpp" />
<ClCompile Include="CFeatureNice.cpp" />
<ClCompile Include="CFeatureNightvision.cpp" />
<ClCompile Include="CFeatureNoAttacking.cpp" />
<ClCompile Include="CFeatureNoclip.cpp" />
<ClCompile Include="CFeatureNodeGraphRebuilding.cpp" />
<ClCompile Include="CFeatureNoHUD.cpp" />
Expand Down Expand Up @@ -436,6 +437,7 @@
<ClInclude Include="CFeatureNegativeAccelerate.h" />
<ClInclude Include="CFeatureNice.h" />
<ClInclude Include="CFeatureNightvision.h" />
<ClInclude Include="CFeatureNoAttacking.h" />
<ClInclude Include="CFeatureNoclip.h" />
<ClInclude Include="CFeatureNodeGraphRebuilding.h" />
<ClInclude Include="CFeatureNoHUD.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 @@ -636,6 +636,9 @@
<ClCompile Include="CFeatureSuperhot.cpp">
<Filter>Effects</Filter>
</ClCompile>
<ClCompile Include="CFeatureNoAttacking.cpp">
<Filter>Effects</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="includes.h" />
Expand Down Expand Up @@ -1252,6 +1255,9 @@
<ClInclude Include="CFeatureSuperhot.h">
<Filter>Effects</Filter>
</ClInclude>
<ClInclude Include="CFeatureNoAttacking.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 @@ -238,6 +238,7 @@ extern bool g_bEncrypted;
#include "CFeatureVoidclip.h"
#include "CFeatureLowDrawDistance.h"
#include "CFeatureSuperhot.h"
#include "CFeatureNoAttacking.h"

#include "CFeatureCheatCodeVoting.h"
#include "CFeatureCombineEffects.h"
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ If you don't want to play with this feature, rename `twitch.ini` to `twitch_DISA
> Voidclip
> Low Draw Distance
> SUPERHOT
> No Attacking
> Cheat Code Voting !!!(available with Twitch voting)!!!
> 3 Effects in 1
> Let's make it more chaotic
Expand Down Expand Up @@ -314,6 +315,7 @@ If you don't want to play with this feature, rename `twitch.ini` to `twitch_DISA
> Nightvision
> Voidclip
> SUPERHOT
> No Attacking
> Cheat Code Voting !!!(available with Twitch voting)!!!
> 3 Effects in 1
> Let's make it more chaotic
Expand Down

0 comments on commit 08f6183

Please sign in to comment.