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

Include option to enable restoration twinmold. #51

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion code/include/rnd/boss.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ extern "C" {

namespace rnd {
void FixBosses();
} // namespace rnd
extern "C" {
u8 IsTwinmoldSetToRestoration();
}
} // namespace rnd

#endif
1 change: 1 addition & 0 deletions code/include/rnd/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ namespace rnd {
u8 enableFastMaskTransform;
u8 enableFastOcarina;
u8 enableFastArrowSwap;
u8 twinmoldRestoration;

// Cutscene Skips
u8 skipHMSCutscenes;
Expand Down
13 changes: 13 additions & 0 deletions code/source/asm/boss_hooks.s
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,17 @@ hook_PostActorCalc:
bl PostActorCalc @ found in main.cpp
pop {r0-r12,lr}
add r3,r5,#0x10
bx lr

.global hook_TwinmoldConsistentDamage
hook_TwinmoldConsistentDamage:
push {r0-r12, lr}
bl IsTwinmoldSetToRestoration
cmp r0,#0x1
beq restorationTwinmold
pop {r0-r12,lr}
sub r0,r2,r0
bx lr
restorationTwinmold:
pop {r0-r12,lr}
bx lr
9 changes: 8 additions & 1 deletion code/source/asm/boss_patches.s
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
.arm


.section .patch_PostActorCalc
.global patch_PostActorCalc
patch_PostActorCalc:
bl hook_PostActorCalc
bl hook_PostActorCalc

@ Remove call from twinmold->life -= twinmold_min_damage.
.section .patch_TwinmoldConsistentDamage
.global patch_TwinmoldConsistentDamage
patch_TwinmoldConsistentDamage:
bl hook_TwinmoldConsistentDamage
6 changes: 0 additions & 6 deletions code/source/asm/patches.s
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,6 @@ patch_ItemCloseOnSelect:
patch_HandleOcarinaHooks:
b hook_HandleOcarina

@ Remove call from twinmold->life -= twinmold_min_damage.
.section .patch_TwinmoldConsistentDamage
.global patch_TwinmoldConsistentDamage
patch_TwinmoldConsistentDamage:
nop

.section .patch_FasterBlockMovement
.global patch_FasterBlockMovement
patch_FasterBlockMovement:
Expand Down
9 changes: 8 additions & 1 deletion code/source/rnd/boss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ namespace rnd {
state->red_prev_hit_counter = red_twinmold->hit_counter;
}
void FixBosses() {
FixTwinmold();
if (IsTwinmoldSetToRestoration())
FixTwinmold();
}

extern "C" {
u8 IsTwinmoldSetToRestoration() {
return gSettingsContext.twinmoldRestoration;
}
}
} // namespace rnd
Loading