-
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.
Glow smoke grenade projectile only until smoke effect begins
- Loading branch information
1 parent
9a2b3b4
commit 543678a
Showing
17 changed files
with
158 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
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
29 changes: 29 additions & 0 deletions
29
.../Visuals/OutlineGlow/GrenadeProjectileOutlineGlow/GrenadeProjectileOutlineGlowCondition.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,29 @@ | ||
#pragma once | ||
|
||
#include <utility> | ||
|
||
#include <FeatureHelpers/EntityClassifier.h> | ||
#include <GameClasses/SmokeGrenadeProjectile.h> | ||
|
||
template <typename Context> | ||
class GrenadeProjectileOutlineGlowCondition { | ||
public: | ||
template <typename... Args> | ||
explicit GrenadeProjectileOutlineGlowCondition(Args&&... args) noexcept | ||
: context{std::forward<Args>(args)...} | ||
{ | ||
} | ||
|
||
[[nodiscard]] bool shouldRun() const noexcept | ||
{ | ||
return context.state().enabled; | ||
} | ||
|
||
[[nodiscard]] bool shouldGlowGrenadeProjectile(EntityTypeInfo entityTypeInfo, auto&& grenadeProjectile) const noexcept | ||
{ | ||
return !entityTypeInfo.is<cs2::C_SmokeGrenadeProjectile>() || !grenadeProjectile.template as<SmokeGrenadeProjectile>().didSmokeEffect().valueOr(false); | ||
} | ||
|
||
private: | ||
Context context; | ||
}; |
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
11 changes: 11 additions & 0 deletions
11
Source/GameClasses/OffsetTypes/SmokeGrenadeProjectileOffset.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,11 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
|
||
#include <CS2/Classes/Entities/GrenadeProjectiles.h> | ||
#include <Utils/FieldOffset.h> | ||
|
||
template <typename FieldType, typename OffsetType> | ||
using SmokeGrenadeProjectileOffset = FieldOffset<cs2::C_SmokeGrenadeProjectile, FieldType, OffsetType>; | ||
|
||
using OffsetToDidSmokeEffect = SmokeGrenadeProjectileOffset<cs2::C_SmokeGrenadeProjectile::m_bDidSmokeEffect, std::int32_t>; |
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,24 @@ | ||
#pragma once | ||
|
||
#include <CS2/Classes/Entities/GrenadeProjectiles.h> | ||
|
||
template <typename HookContext> | ||
class SmokeGrenadeProjectile { | ||
public: | ||
SmokeGrenadeProjectile(HookContext& hookContext, cs2::C_SmokeGrenadeProjectile* smokeGrenadeProjectile) noexcept | ||
: hookContext{hookContext} | ||
, smokeGrenadeProjectile{smokeGrenadeProjectile} | ||
{ | ||
} | ||
|
||
using RawType = cs2::C_SmokeGrenadeProjectile; | ||
|
||
[[nodiscard]] auto didSmokeEffect() const noexcept | ||
{ | ||
return hookContext.gameDependencies().smokeGrenadeProjectileDeps.offsetToDidSmokeEffect.of(smokeGrenadeProjectile).toOptional(); | ||
} | ||
|
||
private: | ||
HookContext& hookContext; | ||
cs2::C_SmokeGrenadeProjectile* smokeGrenadeProjectile; | ||
}; |
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,13 @@ | ||
#pragma once | ||
|
||
#include <GameClasses/OffsetTypes/SmokeGrenadeProjectileOffset.h> | ||
|
||
struct SmokeGrenadeProjectileDeps { | ||
template <typename SmokeGrenadeProjectilePatterns> | ||
explicit SmokeGrenadeProjectileDeps(const SmokeGrenadeProjectilePatterns& smokeGrenadeProjectilePatterns) noexcept | ||
: offsetToDidSmokeEffect{smokeGrenadeProjectilePatterns.offsetToDidSmokeEffect()} | ||
{ | ||
} | ||
|
||
OffsetToDidSmokeEffect offsetToDidSmokeEffect; | ||
}; |
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
14 changes: 14 additions & 0 deletions
14
Source/MemoryPatterns/Linux/SmokeGrenadeProjectilePatternsLinux.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,14 @@ | ||
#pragma once | ||
|
||
#include <GameClasses/OffsetTypes/SmokeGrenadeProjectileOffset.h> | ||
#include <MemorySearch/BytePatternLiteral.h> | ||
|
||
template <typename PatternFinders> | ||
struct SmokeGrenadeProjectilePatterns { | ||
const PatternFinders& patternFinders; | ||
|
||
[[nodiscard]] OffsetToDidSmokeEffect offsetToDidSmokeEffect() const noexcept | ||
{ | ||
return patternFinders.clientPatternFinder("85 F6 75 ? 80 BF ? ? ? ?"_pat).add(6).template readOffset<OffsetToDidSmokeEffect>(); | ||
} | ||
}; |
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
14 changes: 14 additions & 0 deletions
14
Source/MemoryPatterns/Windows/SmokeGrenadeProjectilePatternsWindows.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,14 @@ | ||
#pragma once | ||
|
||
#include <GameClasses/OffsetTypes/SmokeGrenadeProjectileOffset.h> | ||
#include <MemorySearch/BytePatternLiteral.h> | ||
|
||
template <typename PatternFinders> | ||
struct SmokeGrenadeProjectilePatterns { | ||
const PatternFinders& patternFinders; | ||
|
||
[[nodiscard]] OffsetToDidSmokeEffect offsetToDidSmokeEffect() const noexcept | ||
{ | ||
return patternFinders.clientPatternFinder("85 D2 75 ? 38 91 ? ? ? ?"_pat).add(6).template readOffset<OffsetToDidSmokeEffect>(); | ||
} | ||
}; |
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