-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2df0eef
commit a1a411d
Showing
7 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include "includes.h" | ||
|
||
extern float* sys_timescale; | ||
|
||
void CFeatureSuperhot::Init() | ||
{ | ||
CChaosFeature::Init(); | ||
} | ||
|
||
void CFeatureSuperhot::ActivateFeature() | ||
{ | ||
CChaosFeature::ActivateFeature(); | ||
} | ||
|
||
void CFeatureSuperhot::DeactivateFeature() | ||
{ | ||
CChaosFeature::DeactivateFeature(); | ||
*sys_timescale = 1.0f; | ||
} | ||
|
||
void CFeatureSuperhot::OnFrame(double time) | ||
{ | ||
if (!IsActive()) | ||
return; | ||
|
||
static cvar_t* sv_maxspeed; | ||
if (!sv_maxspeed) | ||
sv_maxspeed = pEngfuncs->pfnGetCvarPointer("sv_maxspeed"); | ||
|
||
float flMaxSpeed = sv_maxspeed ? sv_maxspeed->value : 320.0f; | ||
|
||
if (flMaxSpeed == 0) | ||
flMaxSpeed = 270.0f; | ||
|
||
float flVelocity = (*sv_player)->v.velocity.Length() / flMaxSpeed; | ||
*sys_timescale = std::clamp(flVelocity, 0.1f, 2.0f); | ||
} | ||
|
||
const char* CFeatureSuperhot::GetFeatureName() | ||
{ | ||
return "SUPERHOT"; | ||
} | ||
|
||
double CFeatureSuperhot::GetDuration() | ||
{ | ||
return gChaos.GetChaosTime() * 1.06; | ||
} | ||
|
||
bool CFeatureSuperhot::UseCustomDuration() | ||
{ | ||
return true; | ||
} | ||
|
||
bool CFeatureSuperhot::CanBeInfinite() | ||
{ | ||
return true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* Copyright - ScriptedSnark, 2024. | ||
* CFeatureSuperhot.h | ||
* | ||
* Project (GSChaos) header file | ||
* Authors: ScriptedSnark. | ||
* Do not delete this comment block. Respect others' work! | ||
*/ | ||
|
||
#ifdef CFEATURESUPERHOT_H_RECURSE_GUARD | ||
#error Recursive header files inclusion detected in CFeatureSuperhot.h | ||
#else //CFEATURESUPERHOT_H_RECURSE_GUARD | ||
|
||
#define CFEATURESUPERHOT_H_RECURSE_GUARD | ||
|
||
#ifndef CFEATURESUPERHOT_H_GUARD | ||
#define CFEATURESUPERHOT_H_GUARD | ||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
|
||
class CFeatureSuperhot : public CChaosFeature | ||
{ | ||
void Init() override; | ||
void ActivateFeature() override; | ||
void DeactivateFeature() override; | ||
void OnFrame(double time) override; | ||
const char* GetFeatureName() override; | ||
double GetDuration() override; | ||
bool UseCustomDuration() override; | ||
bool CanBeInfinite() override; | ||
}; | ||
|
||
#else //!__cplusplus | ||
#error C++ compiler required to compile CFeatureSuperhot.h | ||
#endif //__cplusplus | ||
|
||
#endif //CFEATURESUPERHOT_H_GUARD | ||
|
||
#undef CFEATURESUPERHOT_H_RECURSE_GUARD | ||
#endif //CFEATURESUPERHOT_H_RECURSE_GUARD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters