-
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
1634608
commit 6543e2b
Showing
6 changed files
with
98 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,46 @@ | ||
#include "includes.h" | ||
|
||
void CFeatureIceSkating::Init() | ||
{ | ||
CChaosFeature::Init(); | ||
} | ||
|
||
void CFeatureIceSkating::ActivateFeature() | ||
{ | ||
CChaosFeature::ActivateFeature(); | ||
|
||
sv_friction = g_engfuncs->pfnCVarGetPointer("sv_friction"); | ||
|
||
if (!sv_friction) | ||
return; | ||
|
||
m_flOldFrictionValue = sv_friction->value; | ||
m_bActivated = true; | ||
} | ||
|
||
void CFeatureIceSkating::DeactivateFeature() | ||
{ | ||
CChaosFeature::DeactivateFeature(); | ||
m_bActivated = false; | ||
|
||
if (!sv_friction) | ||
{ | ||
SERVER_COMMAND("sv_friction 4\n"); | ||
return; | ||
} | ||
|
||
sv_friction->value = m_flOldFrictionValue; | ||
} | ||
|
||
void CFeatureIceSkating::OnFrame(double time) | ||
{ | ||
if (!m_bActivated || !sv_friction) | ||
return; | ||
|
||
sv_friction->value = 0.0f; | ||
} | ||
|
||
const char* CFeatureIceSkating::GetFeatureName() | ||
{ | ||
return "Ice skating"; | ||
} |
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,42 @@ | ||
/** | ||
* Copyright - ScriptedSnark, 2024. | ||
* CFeatureIceSkating.h | ||
* | ||
* Project (GSChaos) header file | ||
* Authors: ScriptedSnark. | ||
* Do not delete this comment block. Respect others' work! | ||
*/ | ||
|
||
#ifdef CFEATUREICESKATING_H_RECURSE_GUARD | ||
#error Recursive header files inclusion detected in CFeatureIceSkating.h | ||
#else //CFEATUREICESKATING_H_RECURSE_GUARD | ||
|
||
#define CFEATUREICESKATING_H_RECURSE_GUARD | ||
|
||
#ifndef CFEATUREICESKATING_H_GUARD | ||
#define CFEATUREICESKATING_H_GUARD | ||
#pragma once | ||
|
||
#ifdef __cplusplus | ||
|
||
class CFeatureIceSkating : public CChaosFeature | ||
{ | ||
void Init() override; | ||
void ActivateFeature() override; | ||
void DeactivateFeature() override; | ||
void OnFrame(double time) override; | ||
const char* GetFeatureName() override; | ||
private: | ||
bool m_bActivated; | ||
cvar_t* sv_friction; | ||
float m_flOldFrictionValue; | ||
}; | ||
|
||
#else //!__cplusplus | ||
#error C++ compiler required to compile CFeatureIceSkating.h | ||
#endif //__cplusplus | ||
|
||
#endif //CFEATUREICESKATING_H_GUARD | ||
|
||
#undef CFEATUREICESKATING_H_RECURSE_GUARD | ||
#endif //CFEATUREICESKATING_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