Skip to content

Commit

Permalink
Update Medigun beam effects in real time, Adjusted backpack expander …
Browse files Browse the repository at this point in the history
…limit

Thanks to Mad?
This closes #8
  • Loading branch information
Viceroyy committed Aug 16, 2024
1 parent c6bb529 commit 8040b08
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
22 changes: 22 additions & 0 deletions Fusion/src/Hooks/BaseClientDLL_FrameStageNotify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
#include "../Features/Simulation/MovementSimulation/MovementSimulation.h"
#include "../Features/Visuals/Visuals.h"

MAKE_SIGNATURE(CWeaponMedigun__UpdateEffects, "client.dll", "40 57 48 81 EC ? ? ? ? 8B 91 ? ? ? ? 48 8B F9 85 D2 0F 84 ? ? ? ? 48 89 B4 24", 0x0)
MAKE_SIGNATURE(CWeaponMedigun__StopChargeEffect, "client.dll", "40 53 48 83 EC ? 44 0F B6 C2", 0x0)
MAKE_SIGNATURE(CWeaponMedigun__ManageChargeEffect, "client.dll", "48 89 5C 24 ? 48 89 74 24 ? 57 48 81 EC ? ? ? ? 48 8B F1 E8 ? ? ? ? 48 8B D8", 0x0)

MAKE_HOOK(BaseClientDLL_FrameStageNotify, U::Memory.GetVFunc(I::BaseClientDLL, 35), void, __fastcall,
void* ecx, ClientFrameStage_t curStage)
{
Expand Down Expand Up @@ -84,6 +88,24 @@ MAKE_HOOK(BaseClientDLL_FrameStageNotify, U::Memory.GetVFunc(I::BaseClientDLL, 3
break;
F::Visuals.SkyboxChanger();
F::Visuals.Modulate();

// Credits to Mad?, idek if this is the right frame for this, it works though
static int OldMedigunEffect = 0;
static int OldMedigunChargeEffect = 0;
if (OldMedigunEffect != Vars::Visuals::Particle::MedigunBeamEffect.Value || OldMedigunChargeEffect != Vars::Visuals::Particle::MedigunChargeEffect.Value)
{
if (H::Entities.GetLocal() && H::Entities.GetWeapon() && H::Entities.GetWeapon()->m_iWeaponID() == TF_WEAPON_MEDIGUN)
{
// update all effects
reinterpret_cast<void(__fastcall*)(void*)>(S::CWeaponMedigun__UpdateEffects())(H::Entities.GetWeapon());

reinterpret_cast<void(__fastcall*)(void*)>(S::CWeaponMedigun__StopChargeEffect())(H::Entities.GetWeapon());
reinterpret_cast<void(__fastcall*)(void*, bool)>(S::CWeaponMedigun__ManageChargeEffect())(H::Entities.GetWeapon(), false);
}

OldMedigunEffect = Vars::Visuals::Particle::MedigunBeamEffect.Value;
OldMedigunChargeEffect = Vars::Visuals::Particle::MedigunChargeEffect.Value;
}
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Fusion/src/Hooks/CTFPlayerInventory_GetMaxItemCount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ MAKE_SIGNATURE(CTFPlayerInventory_GetMaxItemCount, "client.dll", "40 53 48 83 EC
MAKE_HOOK(CTFPlayerInventory_GetMaxItemCount, S::CTFPlayerInventory_GetMaxItemCount(), int, __fastcall,
void* ecx)
{
return !Vars::Misc::Automation::BackpackExpander.Value ? CALL_ORIGINAL(ecx) : 3000;
return !Vars::Misc::Automation::BackpackExpander.Value ? CALL_ORIGINAL(ecx) : 4000;
}
10 changes: 9 additions & 1 deletion Fusion/src/SDK/Definitions/Interfaces/IVEngineClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,21 @@ struct SkyBoxMaterials_t

enum ClientFrameStage_t
{
FRAME_UNDEFINED = -1,
FRAME_UNDEFINED = -1, // (haven't run any frames yet)
FRAME_START,

// A network packet is being recieved
FRAME_NET_UPDATE_START,
// Data has been received and we're going to start calling PostDataUpdate
FRAME_NET_UPDATE_POSTDATAUPDATE_START,
// Data has been received and we've called PostDataUpdate on all data recipients
FRAME_NET_UPDATE_POSTDATAUPDATE_END,
// We've received all packets, we can now do interpolation, prediction, etc..
FRAME_NET_UPDATE_END,

// We're about to start rendering the scene
FRAME_RENDER_START,
// We've finished rendering the scene.
FRAME_RENDER_END
};

Expand Down

0 comments on commit 8040b08

Please sign in to comment.