Skip to content

Commit

Permalink
Add "Boost" effect
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedSnark committed Mar 29, 2024
1 parent 3d12065 commit 09ebae7
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 1 deletion.
1 change: 1 addition & 0 deletions GSChaos/CChaos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ void CChaos::FeatureInit()
RegisterChaosFeature<CFeatureNegativeAccelerate>();
RegisterChaosFeature<CFeatureSqueakShephard>();
RegisterChaosFeature<CFeatureSqueakShephards>();
RegisterChaosFeature<CFeatureBoost>();
RegisterChaosFeature<CFeatureNice>();

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

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

void CFeatureBoost::ActivateFeature()
{
CChaosFeature::ActivateFeature();

(*sv_player)->v.velocity *= 3.0f;
}

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

const char* CFeatureBoost::GetFeatureName()
{
return "Boost";
}
37 changes: 37 additions & 0 deletions GSChaos/CFeatureBoost.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright - ScriptedSnark, 2024.
* CFeatureBoost.h
*
* Project (GSChaos) header file
* Authors: ScriptedSnark.
* Do not delete this comment block. Respect others' work!
*/

#ifdef CFEATUREBOOST_H_RECURSE_GUARD
#error Recursive header files inclusion detected in CFeatureBoost.h
#else //CFEATUREBOOST_H_RECURSE_GUARD

#define CFEATUREBOOST_H_RECURSE_GUARD

#ifndef CFEATUREBOOST_H_GUARD
#define CFEATUREBOOST_H_GUARD
#pragma once

#ifdef __cplusplus

class CFeatureBoost : public CChaosFeature
{
void Init() override;
void ActivateFeature() override;
void DeactivateFeature() override;
const char* GetFeatureName() override;
};

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

#endif //CFEATUREBOOST_H_GUARD

#undef CFEATUREBOOST_H_RECURSE_GUARD
#endif //CFEATUREBOOST_H_RECURSE_GUARD
2 changes: 2 additions & 0 deletions GSChaos/GSChaos.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<ClCompile Include="CFeature20FPS.cpp" />
<ClCompile Include="CFeatureAmIDead.cpp" />
<ClCompile Include="CFeatureAudioCorrupt.cpp" />
<ClCompile Include="CFeatureBoost.cpp" />
<ClCompile Include="CFeatureCombineEffects.cpp" />
<ClCompile Include="CFeatureDarkness.cpp" />
<ClCompile Include="CFeatureDeleteRandomEntity.cpp" />
Expand Down Expand Up @@ -252,6 +253,7 @@
<ClInclude Include="CFeature20FPS.h" />
<ClInclude Include="CFeatureAmIDead.h" />
<ClInclude Include="CFeatureAudioCorrupt.h" />
<ClInclude Include="CFeatureBoost.h" />
<ClInclude Include="CFeatureCombineEffects.h" />
<ClInclude Include="CFeatureDarkness.h" />
<ClInclude Include="CFeatureDeleteRandomEntity.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 @@ -278,6 +278,9 @@
<ClCompile Include="CFeatureSqueakShephards.cpp">
<Filter>Effects</Filter>
</ClCompile>
<ClCompile Include="CFeatureBoost.cpp">
<Filter>Effects</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="includes.h" />
Expand Down Expand Up @@ -653,6 +656,9 @@
<ClInclude Include="CFeatureSqueakShephards.h">
<Filter>Effects</Filter>
</ClInclude>
<ClInclude Include="CFeatureBoost.h">
<Filter>Effects</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Hooking">
Expand Down
35 changes: 35 additions & 0 deletions GSChaos/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,41 @@

inline int ENTINDEX(edict_t* pEdict) { return (*g_engfuncs->pfnIndexOfEdict)(pEdict); }

void _AngleVectors(const Vector angles, Vector forward, Vector right, Vector up)
{
float angle;
float sr, sp, sy, cr, cp, cy;

angle = angles[0] * (M_PI * 2 / 360);
sy = sin(angle);
cy = cos(angle);
angle = angles[1] * (M_PI * 2 / 360);
sp = sin(angle);
cp = cos(angle);
angle = angles[2] * (M_PI * 2 / 360);
sr = sin(angle);
cr = cos(angle);

if (forward)
{
forward[0] = cp * cy;
forward[1] = cp * sy;
forward[2] = -sp;
}
if (right)
{
right[0] = (-1 * sr * sp * cy + -1 * cr * -sy);
right[1] = (-1 * sr * sp * sy + -1 * cr * cy);
right[2] = -1 * sr * cp;
}
if (up)
{
up[0] = (cr * sp * cy + -sr * -sy);
up[1] = (cr * sp * sy + -sr * cy);
up[2] = cr * cp;
}
}

void Draw_FillRGBA(int x, int y, int w, int h, int r, int g, int b, int a)
{
glDisable(GL_TEXTURE_2D);
Expand Down
1 change: 1 addition & 0 deletions GSChaos/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ typedef struct
unsigned short frequency; // FIXED 8.8 noise frequency (low frequency is a jerk,high frequency is a rumble)
} ScreenShake;

void _AngleVectors(const Vector angles, Vector forward, Vector right, Vector up);
void Draw_FillRGBA(int x, int y, int w, int h, int r, int g, int b, int a);
char* UTIL_VarArgs(char* format, ...);
edict_t* UTIL_FindEntityInSphere(edict_t* pStartEntity, const Vector& vecCenter, float flRadius);
Expand Down
1 change: 1 addition & 0 deletions GSChaos/includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ extern bool g_bEncrypted;
#include "CFeatureNice.h"
#include "CFeatureSqueakShephard.h"
#include "CFeatureSqueakShephards.h"
#include "CFeatureBoost.h"

#include "CFeatureCombineEffects.h"
//========================
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ If you don't want to play with this feature, rename `twitch.ini` to `twitch_DISA
> Quake Pro
> Negative Accelerate
> Spawn Squeak Shephard
> Spawn Squeak Shephards
> Squeak Shephard Ambush
> Boost
> Nice
> Combine Effects ( 3 in 1 )
```

Expand Down

0 comments on commit 09ebae7

Please sign in to comment.