Skip to content

Commit

Permalink
FixFallingItemsSpeed: Fix the fix. Not sure when I broke this, but I …
Browse files Browse the repository at this point in the history
…must admit it was pretty funny watching items "fall" upwards
  • Loading branch information
nipkownix committed Jul 16, 2022
1 parent 32131b5 commit ca23af0
Showing 1 changed file with 30 additions and 16 deletions.
46 changes: 30 additions & 16 deletions dllmain/60fpsFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,41 @@ void Init_60fpsFixes()
{
// Fix the speed of falling items
{
struct TreasureAmmoSpeed
// Treasure
{
void operator()(injector::reg_pack& regs)
auto pattern = hook::pattern("DC 25 ? ? ? ? 6A ? 83 EC ? 8D BE ? ? ? ? D9 9E ? ? ? ? B9");
struct TreasureSpeed
{
float vanillaMulti = 10.0;
float newMulti = GlobalPtr()->deltaTime_70 * vanillaMulti;

if (pConfig->bFixFallingItemsSpeed)
_asm {fsub newMulti}
else
_asm {fsub vanillaMulti}
}
};
void operator()(injector::reg_pack& regs)
{
float vanillaMulti = 10.0f;
float newMulti = GlobalPtr()->deltaTime_70 * vanillaMulti;

// Treasure items
auto pattern = hook::pattern("DC 25 ? ? ? ? 6A ? 83 EC ? 8D BE ? ? ? ? D9 9E ? ? ? ? B9");
injector::MakeInline<TreasureAmmoSpeed>(pattern.count(1).get(0).get<uint32_t>(0), pattern.count(1).get(0).get<uint32_t>(6));
if (pConfig->bFixFallingItemsSpeed)
_asm {fsub newMulti}
else
_asm {fsub vanillaMulti}
}
}; injector::MakeInline<TreasureSpeed>(pattern.count(1).get(0).get<uint32_t>(0), pattern.count(1).get(0).get<uint32_t>(6));
}

// Ammo boxes
pattern = hook::pattern("DC 0D ? ? ? ? D8 83 ? ? ? ? D9 9B ? ? ? ? D9 83");
injector::MakeInline<TreasureAmmoSpeed>(pattern.count(2).get(1).get<uint32_t>(0), pattern.count(2).get(1).get<uint32_t>(6));
{
auto pattern = hook::pattern("DC 0D ? ? ? ? D8 83 ? ? ? ? D9 9B ? ? ? ? D9 83");
struct AmmoBoxSpeed
{
void operator()(injector::reg_pack& regs)
{
float vanillaMulti = 10.0f;
float newMulti = GlobalPtr()->deltaTime_70 * vanillaMulti;

if (pConfig->bFixFallingItemsSpeed)
_asm {fmul newMulti}
else
_asm {fmul vanillaMulti}
}
}; injector::MakeInline<AmmoBoxSpeed>(pattern.count(2).get(1).get<uint32_t>(0), pattern.count(2).get(1).get<uint32_t>(6));
}
}

// Fix character backwards turning speed
Expand Down

0 comments on commit ca23af0

Please sign in to comment.