mirror of
https://github.com/HarbourMasters/2ship2harkinian.git
synced 2024-11-23 05:59:40 +00:00
Add swordsman school options (#779)
This commit is contained in:
parent
cbc89b8af4
commit
941b48b802
@ -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();
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -50,6 +50,7 @@ void InitEnhancements() {
|
||||
// Minigames
|
||||
RegisterAlwaysWinDoggyRace();
|
||||
RegisterCremiaHugs();
|
||||
RegisterSwordsmanSchool();
|
||||
|
||||
// Player
|
||||
RegisterClimbSpeed();
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define MINIGAMES_H
|
||||
|
||||
void RegisterAlwaysWinDoggyRace();
|
||||
|
||||
void RegisterCremiaHugs();
|
||||
void RegisterSwordsmanSchool();
|
||||
|
||||
#endif // MINIGAMES_H
|
||||
|
31
mm/2s2h/Enhancements/Minigames/SwordsmanSchool.cpp
Normal file
31
mm/2s2h/Enhancements/Minigames/SwordsmanSchool.cpp
Normal 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;
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user