Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove formation scaling #76

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -94,6 +94,8 @@ These don't matter except for other assembly patches
- hooks/LuaMessages.cpp

## Gameplay
- Remove formation scaling based on footprint
- hooks/FixFormationScaling.cpp
- Change tick intel update interval from every 30 ticks to every 1 tick
- hooks/IntelUpdate.cpp
- Removing CTRL formations
Expand Down
46 changes: 46 additions & 0 deletions hooks/FixFormationScaling.cpp
@@ -0,0 +1,46 @@

asm(R"(

one = 0xDFEC20
two = 0xDFEB0C

#Moho::CAiFormationInstance::CAiFormationInstance at 0x05694B0
.section h1; .set h1,0x05696B3 #Moho::CAiFormationInstance::CAiFormationInstance+0x203
# Slide up everything up and over the setting of the useless function position
# variable to `6` to make room for setting the max size to `1`
# (which takes 4 more bytes than to set it to `esi`, which holds `0`)
mov ecx, [eax]
movss xmm0, dword ptr [one]
mov dword ptr [edi+0x310], ecx
mov edx, [eax+4]
movss dword ptr [edi+0x318], xmm0
mov dword ptr [edi+0x320], 1 # Set maximum footprint size to 1
nop


#Moho::CAiFormationInstance::UpdateFormation at 0x0568CA0
orientXDir = -0x4C
orientYDir = -0x44
.section h2; .set h2,0x0568DC6 #Moho::CAiFormationInstance::UpdateFormation+0x126
# remove the blueprint checks for size, which begins interlacing in the
# orientation averaging code here
mulss xmm0, xmm1
mulss xmm3, xmm2
movaps xmm4, xmm2
mulss xmm4, xmm2
movaps xmm2, xmm1
mulss xmm2, xmm1
movss xmm1, dword ptr [one]
addss xmm0, xmm3
movss xmm3, dword ptr [two]
addss xmm4, xmm2
mulss xmm4, xmm3
mulss xmm0, xmm3
addss xmm0, [esp+0x68+orientXDir]
subss xmm1, xmm4
addss xmm1, [esp+0x68+orientYDir]
movss [esp+0x68+orientXDir], xmm0
movss [esp+0x68+orientYDir], xmm1
jmp 0x0568E8F

)");