Skip to content

Commit 2cb76a1

Browse files
committed
weirdshot
1 parent 0c5622e commit 2cb76a1

File tree

15 files changed

+68
-3
lines changed

15 files changed

+68
-3
lines changed

soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ DEFINE_HOOK(OnLinkAnimEnd, (SkelAnime* skelAnime));
5151
DEFINE_HOOK(OnQPADamage, (uint32_t* dmgFlags));
5252
DEFINE_HOOK(OnESS, ());
5353
DEFINE_HOOK(OnWaitForPutaway, ());
54+
DEFINE_HOOK(OnAnimationSetLoadFrame, (LinkAnimationHeader* animation, int32_t* frame));
5455

5556
DEFINE_HOOK(OnDialogMessage, ());
5657
DEFINE_HOOK(OnPresentTitleCard, ());

soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ void GameInteractor_ExecuteOnWaitForPutaway() {
113113
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnWaitForPutaway>();
114114
}
115115

116+
void GameInteractor_ExecuteOnAnimationSetLoadFrame(LinkAnimationHeader* animation, int32_t* frame) {
117+
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnAnimationSetLoadFrame>(animation, frame);
118+
}
119+
116120
void GameInteractor_ExecuteOnShopSlotChangeHooks(uint8_t cursorIndex, int16_t price) {
117121
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnShopSlotChange>(cursorIndex, price);
118122
}

soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void GameInteractor_ExecuteOnLinkAnimEnd(SkelAnime* skelAnime);
3232
void GameInteractor_ExecuteOnQPADamage(uint32_t* dmgFlags);
3333
void GameInteractor_ExecuteOnESS();
3434
void GameInteractor_ExecuteOnWaitForPutaway();
35+
void GameInteractor_ExecuteOnAnimationSetLoadFrame(LinkAnimationHeader* animation, int32_t* frame);
3536
void GameInteractor_ExecuteOnActorInit(void* actor);
3637
void GameInteractor_ExecuteOnActorSpawn(void* actor);
3738
void GameInteractor_ExecuteOnActorUpdate(void* actor);

soh/soh/Enhancements/randomizer/3drando/hint_list/hint_list_item.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2197,6 +2197,14 @@ void StaticData::HintTable_Init_Item() {
21972197
}, {
21982198
CustomMessage("a beginner's trick", /*german*/"Ground Jump", /*french*/"Ground Jump")});
21992199
// /*spanish*/Ground Jump
2200+
hintTextTable[RHT_ABILITY_WEIRDSHOT] = HintText(CustomMessage("Weirdshot", /*german*/"Weirdshot", /*french*/"Weirdshot"),
2201+
// /*spanish*/Weirdshot
2202+
{
2203+
CustomMessage("a weird shot", /*german*/"Weirdshot", /*french*/"Weirdshot")
2204+
// /*spanish*/Weirdshot
2205+
}, {
2206+
CustomMessage("a mangled animation", /*german*/"Weirdshot", /*french*/"Weirdshot")});
2207+
// /*spanish*/Weirdshot
22002208

22012209
//What is this used for?
22022210
hintTextTable[RHT_HINT_MYSTERIOUS] = HintText(CustomMessage("something mysterious", /*german*/"etwas Mysteriöses", /*french*/"un sacré mystère"));

soh/soh/Enhancements/randomizer/3drando/item_pool.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,9 @@ void GenerateItemPool() {
615615
if (ctx->GetOption(RSK_SHUFFLE_GROUND_JUMP)) {
616616
AddItemToMainPool(RG_ABILITY_GROUND_JUMP);
617617
}
618+
if (ctx->GetOption(RSK_SHUFFLE_WEIRDSHOT)) {
619+
AddItemToMainPool(RG_ABILITY_WEIRDSHOT);
620+
}
618621

619622
if (ctx->GetOption(RSK_SHUFFLE_BEEHIVES)) {
620623
// 32 total beehive locations

soh/soh/Enhancements/randomizer/hook_handlers.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,6 +2415,24 @@ void RandomizerOnKaleidoMoveCursorFromSpecialPos(PauseContext* pauseCtx, uint16_
24152415
}
24162416
}
24172417

2418+
void RandomizerOnAnimationSetLoadFrame(LinkAnimationHeader* animation, int32_t* frame) {
2419+
if (!Flags_GetRandomizerInf(RAND_INF_CAN_WEIRDSHOT)) {
2420+
std::optional<const char*> animationName;
2421+
2422+
if (ResourceMgr_OTRSigCheck(reinterpret_cast<char*>(animation)) != 0) {
2423+
animationName = reinterpret_cast<const char*>(animation);
2424+
animation = reinterpret_cast<LinkAnimationHeader*>(ResourceMgr_LoadAnimByName(*animationName));
2425+
}
2426+
2427+
const auto playerAnimHeader =
2428+
static_cast<LinkAnimationHeader*>(SEGMENTED_TO_VIRTUAL(static_cast<void*>(animation)));
2429+
2430+
if (*frame < 0 || *frame >= playerAnimHeader->common.frameCount) {
2431+
*frame = 0;
2432+
}
2433+
}
2434+
}
2435+
24182436
void RandomizerRegisterHooks() {
24192437
static uint32_t onFlagSetHook = 0;
24202438
static uint32_t onSceneFlagSetHook = 0;
@@ -2439,6 +2457,7 @@ void RandomizerRegisterHooks() {
24392457
static uint32_t onESSHook = 0;
24402458
static uint32_t onWaitForPutawayHook = 0;
24412459
static uint32_t onKaleidoMoveCursorFromSpecialPosHook = 0;
2460+
static uint32_t onAnimationSetLoadFrameHook = 0;
24422461

24432462
static uint32_t fishsanityOnActorInitHook = 0;
24442463
static uint32_t fishsanityOnActorUpdateHook = 0;
@@ -2476,6 +2495,7 @@ void RandomizerRegisterHooks() {
24762495
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnESS>(onESSHook);
24772496
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnWaitForPutaway>(onWaitForPutawayHook);
24782497
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnKaleidoMoveCursorFromSpecialPos>(onKaleidoMoveCursorFromSpecialPosHook);
2498+
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnAnimationSetLoadFrame>(onAnimationSetLoadFrameHook);
24792499

24802500
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnActorInit>(fishsanityOnActorInitHook);
24812501
GameInteractor::Instance->UnregisterGameHook<GameInteractor::OnActorUpdate>(fishsanityOnActorUpdateHook);
@@ -2566,6 +2586,8 @@ void RandomizerRegisterHooks() {
25662586
onWaitForPutawayHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnWaitForPutaway>(RandomizerOnWaitForPutaway);
25672587
onKaleidoMoveCursorFromSpecialPosHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnKaleidoMoveCursorFromSpecialPos>(
25682588
[](PauseContext* pauseCtx, uint16_t* cursorItem) { RandomizerOnKaleidoMoveCursorFromSpecialPos(pauseCtx, cursorItem); });
2589+
onAnimationSetLoadFrameHook = GameInteractor::Instance->RegisterGameHook<GameInteractor::OnAnimationSetLoadFrame>(
2590+
[](LinkAnimationHeader* animation, int32_t* frame) { RandomizerOnAnimationSetLoadFrame(animation, frame); });
25692591

25702592
COND_VB_SHOULD(VB_SKIP_FORCE_PLAY_OCARINA, true, { RandomizerShouldSkipForcePlayOcarina(should); });
25712593

soh/soh/Enhancements/randomizer/item_list.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,10 @@ void Rando::StaticData::InitItemTable() {
366366
itemTable[RG_ABILITY_HOVER].SetCustomDrawFunc(Randomizer_DrawMysteryItem);
367367
itemTable[RG_ABILITY_EQUIP_SWAP] = Item(RG_ABILITY_EQUIP_SWAP, Text{ "Equip Swap", "Equip Swap", "Equip Swap" }, ITEMTYPE_ITEM, GI_NONE, true, LOGIC_NONE, RHT_ABILITY_EQUIP_SWAP, RG_ABILITY_EQUIP_SWAP, OBJECT_GI_COIN, GID_NCOIN_YELLOW, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_RANDOMIZER);
368368
itemTable[RG_ABILITY_EQUIP_SWAP].SetCustomDrawFunc(Randomizer_DrawMysteryItem);
369-
itemTable[RG_ABILITY_GROUND_JUMP] = Item(RG_ABILITY_GROUND_JUMP, Text{ "Ground Jump", "Ground Jump", "Ground Jump" }, ITEMTYPE_ITEM, GI_NONE, true, LOGIC_NONE, RHT_ABILITY_GROUND_JUMP, RG_ABILITY_GROUND_JUMP, OBJECT_GI_COIN, GID_NCOIN_YELLOW, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_RANDOMIZER);
369+
itemTable[RG_ABILITY_GROUND_JUMP] = Item(RG_ABILITY_GROUND_JUMP, Text{ "Ground Jump", "Ground Jump", "Ground Jump" }, ITEMTYPE_ITEM, GI_NONE, true, LOGIC_NONE, RHT_ABILITY_GROUND_JUMP, RG_ABILITY_GROUND_JUMP, OBJECT_GI_COIN, GID_NCOIN_YELLOW, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_RANDOMIZER);
370370
itemTable[RG_ABILITY_GROUND_JUMP].SetCustomDrawFunc(Randomizer_DrawMysteryItem);
371+
itemTable[RG_ABILITY_WEIRDSHOT] = Item(RG_ABILITY_WEIRDSHOT, Text{ "Weirdshot", "Weirdshot", "Weirdshot" }, ITEMTYPE_ITEM, GI_NONE, true, LOGIC_NONE, RHT_ABILITY_WEIRDSHOT, RG_ABILITY_WEIRDSHOT, OBJECT_GI_COIN, GID_NCOIN_YELLOW, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_RANDOMIZER);
372+
itemTable[RG_ABILITY_WEIRDSHOT].SetCustomDrawFunc(Randomizer_DrawMysteryItem);
371373

372374
itemTable[RG_BOMBCHU_BAG] = Item(RG_BOMBCHU_BAG, Text{ "Bombchu Bag", "Sac de Missiles Teigneux", "Krabbelminentasche" }, ITEMTYPE_ITEM, RG_BOMBCHU_BAG, true, LOGIC_BOMBCHUS, RHT_BOMBCHU_BAG, RG_BOMBCHU_BAG, OBJECT_GI_BOMB_2, GID_BOMBCHU, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_RANDOMIZER);
373375
itemTable[RG_BOMBCHU_BAG].SetCustomDrawFunc(Randomizer_DrawBombchuBag);

soh/soh/Enhancements/randomizer/logic.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,9 @@ void Logic::ApplyItemEffect(Item& item, bool state) {
18271827
case RG_ABILITY_GROUND_JUMP:
18281828
SetRandoInf(RAND_INF_CAN_GROUND_JUMP, state);
18291829
break;
1830+
case RG_ABILITY_WEIRDSHOT:
1831+
SetRandoInf(RAND_INF_CAN_WEIRDSHOT, state);
1832+
break;
18301833
default:
18311834
break;
18321835
}
@@ -2375,6 +2378,9 @@ void Logic::Reset(bool resetSaveContext /*= true*/) {
23752378
if (ctx->GetOption(RSK_SHUFFLE_GROUND_JUMP).Is(false)) {
23762379
SetRandoInf(RAND_INF_CAN_GROUND_JUMP, true);
23772380
}
2381+
if (ctx->GetOption(RSK_SHUFFLE_WEIRDSHOT).Is(false)) {
2382+
SetRandoInf(RAND_INF_CAN_WEIRDSHOT, true);
2383+
}
23782384

23792385
// If we're not shuffling child's wallet, we start with it
23802386
if (ctx->GetOption(RSK_SHUFFLE_CHILD_WALLET).Is(false)) {

soh/soh/Enhancements/randomizer/option_descriptions.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,5 +777,7 @@ void Settings::CreateOptionDescriptions() {
777777
"Shuffles the ability to equip swap into the item pool.";
778778
mOptionDescriptions[RSK_SHUFFLE_GROUND_JUMP] =
779779
"Shuffles the ability to ground jump into the item pool.";
780+
mOptionDescriptions[RSK_SHUFFLE_WEIRDSHOT] =
781+
"Shuffles the ability to weirdshot into the item pool.";
780782
}
781783
} // namespace Rando

soh/soh/Enhancements/randomizer/randomizer.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5394,7 +5394,7 @@ CustomMessage Randomizer::GetGoronMessage(u16 index) {
53945394
void Randomizer::CreateCustomMessages() {
53955395
// RANDTODO: Translate into french and german and replace GIMESSAGE_UNTRANSLATED
53965396
// with GIMESSAGE(getItemID, itemID, english, german, french).
5397-
const std::array<GetItemMessage, 118> getItemMessages = { {
5397+
const std::array<GetItemMessage, 120> getItemMessages = { {
53985398
GIMESSAGE(RG_GREG_RUPEE, ITEM_MASK_GORON, "You found %gGreg%w!", "%gGreg%w! Du hast ihn&wirklich gefunden!",
53995399
"Félicitation! Vous avez trouvé %gGreg%w!"),
54005400
GIMESSAGE(RG_MASTER_SWORD, ITEM_SWORD_MASTER, "You found the %gMaster Sword%w!",
@@ -5740,9 +5740,12 @@ void Randomizer::CreateCustomMessages() {
57405740
GIMESSAGE(RG_ABILITY_EQUIP_SWAP, ITEM_DINS_FIRE, "You got %rEquip Swap%w!",
57415741
"Du hast %rEquip Swap%w&erhalten!",
57425742
"Vous obtenez %rEquip Swap%w!"),
5743-
GIMESSAGE(RG_ABILITY_GROUND_JUMP, ITEM_DINS_FIRE, "You got %rGround Jump%w!",
5743+
GIMESSAGE(RG_ABILITY_GROUND_JUMP, ITEM_SHIELD_HYLIAN, "You got %rGround Jump%w!",
57445744
"Du hast %rGround Jump%w&erhalten!",
57455745
"Vous obtenez %rGround Jump%w!"),
5746+
GIMESSAGE(RG_ABILITY_WEIRDSHOT, ITEM_HOOKSHOT, "You got %rWeirdshot%w!",
5747+
"Du hast %rWeirdshot%w&erhalten!",
5748+
"Vous obtenez %rWeirdshot%w!"),
57465749

57475750
GIMESSAGE(RG_FISHING_POLE, ITEM_FISHING_POLE, "You found a lost %rFishing Pole%w!&Time to hit the pond!",
57485751
"Du hast eine verlorene %rAngelrute%w&gefunden!&Zeit, im Teich&zu angeln!",
@@ -5945,6 +5948,7 @@ std::map<RandomizerGet, RandomizerInf> randomizerGetToRandInf = {
59455948
{ RG_ABILITY_HOVER, RAND_INF_CAN_HOVER },
59465949
{ RG_ABILITY_EQUIP_SWAP, RAND_INF_CAN_EQUIP_SWAP },
59475950
{ RG_ABILITY_GROUND_JUMP, RAND_INF_CAN_GROUND_JUMP },
5951+
{ RG_ABILITY_WEIRDSHOT, RAND_INF_CAN_WEIRDSHOT },
59485952
};
59495953

59505954
extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) {

0 commit comments

Comments
 (0)