Add swordsman school options (#779)
Some checks failed
generate-builds / generate-2ship-otr (push) Has been cancelled
generate-builds / build-macos (push) Has been cancelled
generate-builds / build-linux (push) Has been cancelled
generate-builds / build-windows (push) Has been cancelled

This commit is contained in:
Garrett Cox 2024-10-26 00:28:08 -05:00 committed by GitHub
parent cbc89b8af4
commit 941b48b802
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 40 additions and 1 deletions

View File

@ -687,6 +687,8 @@ void DrawEnhancementsMenu() {
"-Hug: Get the hugging cutscene\n"
"-Rupee: Get the rupee reward",
.defaultIndex = CREMIA_REWARD_RANDOM });
UIWidgets::CVarSliderInt("Swordsman School Winning Score: %d",
"gEnhancements.Minigames.SwordsmanSchoolScore", 1, 30, 30);
ImGui::EndMenu();
}

View File

@ -1023,6 +1023,11 @@ void AddEnhancements() {
"-Rupee: Get the rupee reward",
WIDGET_CVAR_COMBOBOX,
{ .comboBoxOptions = cremiaRewardOptions } },
{ "Swordsman School Winning Score",
"gEnhancements.Minigames.SwordsmanSchoolScore",
"Sets the score required to win the Swordsman School.",
WIDGET_CVAR_SLIDER_INT,
{ 1, 30, 30 } },
{ "Fast Magic Arrow Equip Animation", "gEnhancements.Equipment.MagicArrowEquipSpeed",
"Removes the animation for equipping Magic Arrows.", WIDGET_CVAR_CHECKBOX },
{ "Instant Fin Boomerangs Recall", "gEnhancements.PlayerActions.InstantRecall",

View File

@ -50,6 +50,7 @@ void InitEnhancements() {
// Minigames
RegisterAlwaysWinDoggyRace();
RegisterCremiaHugs();
RegisterSwordsmanSchool();
// Player
RegisterClimbSpeed();

View File

@ -2,7 +2,7 @@
#define MINIGAMES_H
void RegisterAlwaysWinDoggyRace();
void RegisterCremiaHugs();
void RegisterSwordsmanSchool();
#endif // MINIGAMES_H

View File

@ -0,0 +1,31 @@
#include <libultraship/bridge.h>
#include "2s2h/GameInteractor/GameInteractor.h"
extern "C" {
#include "overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h"
void func_80B274BC(EnKendoJs* thisx, PlayState* play);
}
void RegisterSwordsmanSchool() {
GameInteractor::Instance->RegisterGameHookForID<GameInteractor::ShouldActorUpdate>(
ACTOR_EN_KENDO_JS, [](Actor* actor, bool* should) {
EnKendoJs* kendo = (EnKendoJs*)actor;
if (kendo->actionFunc != func_80B274BC) {
return;
}
// Finishes the game early, as soon as the player reaches the required score
if (gSaveContext.minigameScore >= CVarGetInteger("gEnhancements.Minigames.SwordsmanSchoolScore", 30)) {
kendo->unk_290 = 140;
kendo->unk_284 = 5;
}
// Each time player chops a log, check if they've reached the required score
if (kendo->unk_290 >= 140 && kendo->unk_284 == 5 &&
gSaveContext.minigameScore >= CVarGetInteger("gEnhancements.Minigames.SwordsmanSchoolScore", 30)) {
gSaveContext.minigameScore = 30;
}
});
}