-
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 dropped bomb
- Loading branch information
1 parent
543678a
commit c16b7f1
Showing
16 changed files
with
181 additions
and
4 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
32 changes: 32 additions & 0 deletions
32
Source/Features/Visuals/OutlineGlow/DroppedBombOutlineGlow/DroppedBombOutlineGlow.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 "DroppedBombOutlineGlowContext.h" | ||
#include "DroppedBombOutlineGlowParams.h" | ||
|
||
template <typename Context> | ||
class DroppedBombOutlineGlow { | ||
public: | ||
template <typename... Args> | ||
DroppedBombOutlineGlow(Args&&... args) noexcept | ||
: context{std::forward<Args>(args)...} | ||
{ | ||
} | ||
|
||
void applyGlowToBomb(auto&& bomb) const noexcept | ||
{ | ||
auto&& condition = context.condition(); | ||
if (!condition.shouldRun() || !condition.shouldGlowBomb(bomb)) | ||
return; | ||
|
||
using namespace dropped_bomb_outline_glow_params; | ||
bomb.applyGlowRecursively(kColor); | ||
} | ||
|
||
private: | ||
Context context; | ||
}; | ||
|
||
template <typename HookContext> | ||
DroppedBombOutlineGlow(HookContext&) -> DroppedBombOutlineGlow<DroppedBombOutlineGlowContext<HookContext>>; |
26 changes: 26 additions & 0 deletions
26
Source/Features/Visuals/OutlineGlow/DroppedBombOutlineGlow/DroppedBombOutlineGlowCondition.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 DroppedBombOutlineGlowCondition { | ||
public: | ||
template <typename... Args> | ||
DroppedBombOutlineGlowCondition(Args&&... args) noexcept | ||
: context{std::forward<Args>(args)...} | ||
{ | ||
} | ||
|
||
[[nodiscard]] bool shouldRun() const noexcept | ||
{ | ||
return context.state().enabled; | ||
} | ||
|
||
[[nodiscard]] bool shouldGlowBomb(auto&& bomb) const noexcept | ||
{ | ||
return !bomb.hasOwner().valueOr(true); | ||
} | ||
|
||
private: | ||
Context context; | ||
}; |
25 changes: 25 additions & 0 deletions
25
Source/Features/Visuals/OutlineGlow/DroppedBombOutlineGlow/DroppedBombOutlineGlowContext.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 "DroppedBombOutlineGlowCondition.h" | ||
|
||
template <typename HookContext> | ||
class DroppedBombOutlineGlowContext { | ||
public: | ||
explicit DroppedBombOutlineGlowContext(HookContext& hookContext) noexcept | ||
: hookContext{hookContext} | ||
{ | ||
} | ||
|
||
[[nodiscard]] auto& state() const noexcept | ||
{ | ||
return hookContext.featuresStates().visualFeaturesStates.droppedBombOutlineGlowState; | ||
} | ||
|
||
[[nodiscard]] decltype(auto) condition() const noexcept | ||
{ | ||
return hookContext.template make<DroppedBombOutlineGlowCondition<DroppedBombOutlineGlowContext>>(); | ||
} | ||
|
||
private: | ||
HookContext& hookContext; | ||
}; |
8 changes: 8 additions & 0 deletions
8
Source/Features/Visuals/OutlineGlow/DroppedBombOutlineGlow/DroppedBombOutlineGlowParams.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 dropped_bomb_outline_glow_params | ||
{ | ||
constexpr cs2::Color kColor{255, 255, 128, 102}; | ||
} |
5 changes: 5 additions & 0 deletions
5
Source/Features/Visuals/OutlineGlow/DroppedBombOutlineGlow/DroppedBombOutlineGlowState.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 DroppedBombOutlineGlowState { | ||
bool enabled{true}; | ||
}; |
27 changes: 27 additions & 0 deletions
27
Source/Features/Visuals/OutlineGlow/DroppedBombOutlineGlow/DroppedBombOutlineGlowToggle.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 "DroppedBombOutlineGlowContext.h" | ||
|
||
template <typename Context> | ||
class DroppedBombOutlineGlowToggle : public FeatureToggle<DroppedBombOutlineGlowToggle<Context>> { | ||
public: | ||
template <typename... Args> | ||
DroppedBombOutlineGlowToggle(Args&&... args) noexcept | ||
: context{std::forward<Args>(args)...} | ||
{ | ||
} | ||
|
||
[[nodiscard]] auto& enabledVariable(typename DroppedBombOutlineGlowToggle::ToggleMethod) const noexcept | ||
{ | ||
return context.state().enabled; | ||
} | ||
|
||
private: | ||
Context context; | ||
}; | ||
|
||
template <typename HookContext> | ||
DroppedBombOutlineGlowToggle(HookContext&) -> DroppedBombOutlineGlowToggle<DroppedBombOutlineGlowContext<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
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