-
Notifications
You must be signed in to change notification settings - Fork 961
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement outline glow for ticking bomb
- Loading branch information
1 parent
9598a6e
commit 19ed3bf
Showing
18 changed files
with
187 additions
and
7 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
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
32 changes: 32 additions & 0 deletions
32
Source/Features/Visuals/OutlineGlow/TickingBombOutlineGlow/TickingBombOutlineGlow.h
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,32 @@ | ||
#pragma once | ||
|
||
#include <utility> | ||
|
||
#include "TickingBombOutlineGlowContext.h" | ||
#include "TickingBombOutlineGlowParams.h" | ||
|
||
template <typename Context> | ||
class TickingBombOutlineGlow { | ||
public: | ||
template <typename... Args> | ||
TickingBombOutlineGlow(Args&&... args) noexcept | ||
: context{std::forward<Args>(args)...} | ||
{ | ||
} | ||
|
||
void applyGlowToPlantedBomb(auto&& plantedBomb) const noexcept | ||
{ | ||
auto&& condition = context.condition(); | ||
if (!condition.shouldRun() || !condition.shouldGlowPlantedBomb(plantedBomb)) | ||
return; | ||
|
||
using namespace ticking_bomb_outline_glow_params; | ||
plantedBomb.baseEntity().applyGlowRecursively(kColor); | ||
} | ||
|
||
private: | ||
Context context; | ||
}; | ||
|
||
template <typename HookContext> | ||
TickingBombOutlineGlow(HookContext&) -> TickingBombOutlineGlow<TickingBombOutlineGlowContext<HookContext>>; |
26 changes: 26 additions & 0 deletions
26
Source/Features/Visuals/OutlineGlow/TickingBombOutlineGlow/TickingBombOutlineGlowCondition.h
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,26 @@ | ||
#pragma once | ||
|
||
#include <utility> | ||
|
||
template <typename Context> | ||
class TickingBombOutlineGlowCondition { | ||
public: | ||
template <typename... Args> | ||
TickingBombOutlineGlowCondition(Args&&... args) noexcept | ||
: context{std::forward<Args>(args)...} | ||
{ | ||
} | ||
|
||
[[nodiscard]] bool shouldRun() const noexcept | ||
{ | ||
return context.state().enabled; | ||
} | ||
|
||
[[nodiscard]] bool shouldGlowPlantedBomb(auto&& plantedBomb) const noexcept | ||
{ | ||
return plantedBomb.isTicking().valueOr(true); | ||
} | ||
|
||
private: | ||
Context context; | ||
}; |
25 changes: 25 additions & 0 deletions
25
Source/Features/Visuals/OutlineGlow/TickingBombOutlineGlow/TickingBombOutlineGlowContext.h
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,25 @@ | ||
#pragma once | ||
|
||
#include "TickingBombOutlineGlowCondition.h" | ||
|
||
template <typename HookContext> | ||
class TickingBombOutlineGlowContext { | ||
public: | ||
explicit TickingBombOutlineGlowContext(HookContext& hookContext) noexcept | ||
: hookContext{hookContext} | ||
{ | ||
} | ||
|
||
[[nodiscard]] auto& state() const noexcept | ||
{ | ||
return hookContext.featuresStates().visualFeaturesStates.tickingBombOutlineGlowState; | ||
} | ||
|
||
[[nodiscard]] decltype(auto) condition() const noexcept | ||
{ | ||
return hookContext.template make<TickingBombOutlineGlowCondition<TickingBombOutlineGlowContext>>(); | ||
} | ||
|
||
private: | ||
HookContext& hookContext; | ||
}; |
8 changes: 8 additions & 0 deletions
8
Source/Features/Visuals/OutlineGlow/TickingBombOutlineGlow/TickingBombOutlineGlowParams.h
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,8 @@ | ||
#pragma once | ||
|
||
#include <CS2/Classes/Color.h> | ||
|
||
namespace ticking_bomb_outline_glow_params | ||
{ | ||
constexpr cs2::Color kColor{255, 128, 128, 102}; | ||
} |
5 changes: 5 additions & 0 deletions
5
Source/Features/Visuals/OutlineGlow/TickingBombOutlineGlow/TickingBombOutlineGlowState.h
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,5 @@ | ||
#pragma once | ||
|
||
struct TickingBombOutlineGlowState { | ||
bool enabled{true}; | ||
}; |
27 changes: 27 additions & 0 deletions
27
Source/Features/Visuals/OutlineGlow/TickingBombOutlineGlow/TickingBombOutlineGlowToggle.h
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,27 @@ | ||
#pragma once | ||
|
||
#include <utility> | ||
|
||
#include <FeatureHelpers/FeatureToggle.h> | ||
#include "TickingBombOutlineGlowContext.h" | ||
|
||
template <typename Context> | ||
class TickingBombOutlineGlowToggle : public FeatureToggle<TickingBombOutlineGlowToggle<Context>> { | ||
public: | ||
template <typename... Args> | ||
TickingBombOutlineGlowToggle(Args&&... args) noexcept | ||
: context{std::forward<Args>(args)...} | ||
{ | ||
} | ||
|
||
[[nodiscard]] auto& enabledVariable(typename TickingBombOutlineGlowToggle::ToggleMethod) const noexcept | ||
{ | ||
return context.state().enabled; | ||
} | ||
|
||
private: | ||
Context context; | ||
}; | ||
|
||
template <typename HookContext> | ||
TickingBombOutlineGlowToggle(HookContext&) -> TickingBombOutlineGlowToggle<TickingBombOutlineGlowContext<HookContext>>; |
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
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