summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAECX <aecx@aecx.cc>2020-02-19 21:11:48 +0100
committerAECX <aecx@aecx.cc>2020-02-19 21:11:48 +0100
commitf055ceaf373fc832d89dc38b64feb63b7c8264b9 (patch)
tree16cea1fbd3be24b54ba52f2a8e452e3a66327cc2
parent16df3664b000b5b32feac5adb74566202c9150e8 (diff)
0.1b - flag based loading instead of item based
m---------Externals/libtp0
-rw-r--r--include/main.h52
-rw-r--r--source/main.cpp71
3 files changed, 43 insertions, 80 deletions
diff --git a/Externals/libtp b/Externals/libtp
-Subproject 187164dc5dbe9bd7c4499a4887472a1c16470b7
+Subproject 0d6a0ecaa1acccc088cdeea9de65421be9672b1
diff --git a/include/main.h b/include/main.h
index a72e484..bcb3adc 100644
--- a/include/main.h
+++ b/include/main.h
@@ -24,24 +24,12 @@ namespace mod
void armogohma();
void arealfos();
void argarok();
+ void phantomZant();
void zant();
void ganon();
void (*onFrameDraw_Return)() = nullptr;
bool (*onGanonFinish_Return)(void* d_a_alink) = nullptr;
- s32 (*createItemForPresentDemo_Return)(const float pos[3],
- s32 item,
- u8 unk3,
- s32 unk4,
- s32 unk5,
- const float unk6[3],
- const float unk7[3]) = nullptr;
- s32 (*createItemForTrBoxDemo_Return)(const float pos[3],
- s32 item,
- s32 unk3,
- s32 unk4,
- const float unk5[3],
- const float unk6[3]) = nullptr;
struct bossFightInfo
{
@@ -49,29 +37,31 @@ namespace mod
u8 room;
u8 state;
u8 spawnpoint;
- u8 expectedItemID;
+ u8 flagOffset;
+ u8 flagVar;
void (*preHook)();
};
libtp::display::Console* console;
- bossFightInfo bossFights[16] = {
- {"D_MN05B", 51, 0xFF, 0x00, 0x40, ook}, // -Ook
- {"D_MN05A", 50, 0xFF, 0x01, 0x22, diababa}, // Diababa
- {"D_MN04B", 51, 0xFF, 0x03, 0x43, dangoro}, // -Dangoro
- {"D_MN04A", 50, 0xFF, 0x01, 0x22, fyrus}, // Fyrus
- {"D_MN01B", 51, 0xFF, 0x00, 0x44, dekutoad}, // -Deku Toad
- {"D_MN01A", 50, 0xFF, 0x02, 0x22, morpheel}, // Morpheel
- {"D_MN10B", 51, 0xFF, 0x01, 0x41, deathsword}, // -Death Sword
- {"D_MN10A", 50, 0xFF, 0x01, 0x22, stallord}, // Stallord
- {"D_MN11B", 51, 0xFF, 0x00, 0x42, darkhammer}, // -Dark Hammer
- {"D_MN11A", 50, 0xFF, 0x00, 0x22, blizetta}, // Blizetta
- {"D_MN06B", 51, 0xFF, 0x00, 0x46, darknut}, // -Darknut
- {"D_MN06A", 50, 0xFF, 0x01, 0x22, armogohma}, // Armogohma
- {"D_MN07B", 51, 0xFF, 0x02, 0x47, arealfos}, // -Arealfos
- {"D_MN07A", 50, 0xFF, 0x00, 0x22, argarok}, // Argarok
- {"D_MN08D", 53, 0xFF, 0x00, 0x22, zant}, // Zant
- {"D_MN09A", 50, 0xFF, 0x00, 0x00, ganon} // Ganon
+ bossFightInfo bossFights[17] = {
+ {"D_MN05B", 51, 0xFF, 0x00, 0x1D, 128, ook}, // -Ook
+ {"D_MN05A", 50, 0xFF, 0x01, 0x13, 2, diababa}, // Diababa
+ {"D_MN04B", 51, 0xFF, 0x03, 0x1D, 128, dangoro}, // -Dangoro
+ {"D_MN04A", 50, 0xFF, 0x01, 0x1D, 64, fyrus}, // Fyrus
+ {"D_MN01B", 51, 0xFF, 0x00, 0x1D, 128, dekutoad}, // -Deku Toad
+ {"D_MN01A", 50, 0xFF, 0x02, 0x1D, 64, morpheel}, // Morpheel
+ {"D_MN10B", 51, 0xFF, 0x01, 0x02, 8, deathsword}, // -Death Sword
+ {"D_MN10A", 50, 0xFF, 0x01, 0x1D, 64, stallord}, // Stallord
+ {"D_MN11B", 51, 0xFF, 0x00, 0x1D, 128, darkhammer}, // -Dark Hammer
+ {"D_MN11A", 50, 0xFF, 0x00, 0x1D, 64, blizetta}, // Blizetta
+ {"D_MN06B", 51, 0xFF, 0x00, 0x1D, 128, darknut}, // -Darknut
+ {"D_MN06A", 50, 0xFF, 0x01, 0x1D, 64, armogohma}, // Armogohma
+ {"D_MN07B", 51, 0xFF, 0x02, 0x03, 1, arealfos}, // -Arealfos
+ {"D_MN07A", 50, 0xFF, 0x00, 0x1D, 64, argarok}, // Argarok
+ {"D_MN08B", 51, 0xFF, 0x02, 0x17, 16, phantomZant}, // Phantom Zant
+ {"D_MN08D", 53, 0xFF, 0x00, 0x1D, 64, zant}, // Zant
+ {"D_MN09A", 50, 0xFF, 0x00, 0x00, 0x00, ganon} // Ganon
};
// TODO: Create a class for this
diff --git a/source/main.cpp b/source/main.cpp
index 0155224..6879804 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -19,49 +19,14 @@ namespace mod
{
void main()
{
- // TEST
- sprintf(libtp::display::print(15, ""), "AreaNodeAddr: %04x", (u32)&libtp::tp::d_com_inf_game::dComIfG_gameInfo.unk_958);
-
- // END TEST
-
console = new libtp::display::Console("AECX", "Boss Rush", "Fast paced fighting action, beat boss after boss",
"as quickly as possible. At the end of each fight",
- "you'll be teleported to the next one...", "Version: 0.2a");
+ "you'll be teleported to the next one...", "Version: 0.1b");
// Hook to a suitable function
// This one runs every frame
onFrameDraw_Return = libtp::patch::hookFunction(libtp::tp::f_ap_game::fapGm_Execute, onFrameDraw);
- createItemForPresentDemo_Return = libtp::patch::hookFunction(
- libtp::tp::f_op_actor_mng::createItemForPresentDemo,
- [](const float pos[3], s32 item, u8 unk3, s32 unk4, s32 unk5, const float unk6[3], const float unk7[3]) {
- if (item == bossFights[currentBossFight].expectedItemID)
- {
- currentBossFight++;
- bossFights[currentBossFight].preHook();
- // Go to next boss fight
- libtp::tools::triggerSaveLoad(bossFights[currentBossFight].stage, bossFights[currentBossFight].room,
- bossFights[currentBossFight].spawnpoint, bossFights[currentBossFight].state);
- }
-
- return createItemForPresentDemo_Return(pos, item, unk3, unk4, unk5, unk6, unk7);
- });
-
- createItemForTrBoxDemo_Return = libtp::patch::hookFunction(
- libtp::tp::f_op_actor_mng::createItemForTrBoxDemo,
- [](const float pos[3], s32 item, s32 unk3, s32 unk4, const float unk5[3], const float unk6[3]) {
- if (item == bossFights[currentBossFight].expectedItemID)
- {
- currentBossFight++;
- bossFights[currentBossFight].preHook();
- // Go to next boss fight
- libtp::tools::triggerSaveLoad(bossFights[currentBossFight].stage, bossFights[currentBossFight].room,
- bossFights[currentBossFight].spawnpoint, bossFights[currentBossFight].state);
- }
-
- return createItemForTrBoxDemo_Return(pos, item, unk3, unk4, unk5, unk6);
- });
-
onGanonFinish_Return = libtp::patch::hookFunction(libtp::tp::d_a_alink::procGanonFinish, onFinish);
HUDbuttonCombo = libtp::tp::m_do_controller_pad::Button_R | libtp::tp::m_do_controller_pad::Button_Z;
@@ -147,6 +112,19 @@ namespace mod
if (gameActive)
{
+ // Check for events
+ bossFightInfo* boss = &bossFights[currentBossFight];
+ if ((libtp::tp::d_com_inf_game::dComIfG_gameInfo.localAreaNodes[boss->flagOffset] & boss->flagVar) ==
+ boss->flagVar)
+ {
+ // Desired flag has been reached, load next one
+ currentBossFight++;
+ boss = &bossFights[currentBossFight];
+
+ boss->preHook();
+ libtp::tools::triggerSaveLoad(boss->stage, boss->room, boss->spawnpoint, boss->state);
+ }
+
frameTimer++;
totalFrames++;
// Update every second to save some processing power
@@ -184,25 +162,19 @@ namespace mod
// Prehooks
void ook()
{
- // Give bottles
+ // Give bottles 2 * fairy tear
libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.wQuestLogData[0xA7] = 115;
libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.wQuestLogData[0xA8] = 115;
- libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.wQuestLogData[0xA9] = 115;
- libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.wQuestLogData[0xAA] = 115;
// Item wheel bottles
libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.wQuestLogData[0xB4 + itemWheelPos] = 11;
itemWheelPos++;
libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.wQuestLogData[0xB4 + itemWheelPos] = 12;
itemWheelPos++;
- libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.wQuestLogData[0xB4 + itemWheelPos] = 13;
- itemWheelPos++;
- libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.wQuestLogData[0xB4 + itemWheelPos] = 14;
- itemWheelPos++;
- // Give ending blow
- libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.eventBits[0x29] = 0xFF;
- libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.eventBits[0x2A] = 0xFF;
+ // Give ending blow only
+ libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.eventBits[0x29] = 0x24;
+ libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.eventBits[0x2A] = 0x00;
}
void diababa()
{
@@ -240,9 +212,6 @@ namespace mod
void morpheel()
{
- // Zora Armor inventory flag
- libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.wQuestLogData[0x0D1] |= 0x2;
-
// Add clawshot
libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.wQuestLogData[0xA5] = 0x44;
libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.wQuestLogData[0xB4 + itemWheelPos] = 0x9;
@@ -316,6 +285,10 @@ namespace mod
libtp::tp::d_com_inf_game::dComIfG_gameInfo.scratchPad.wQuestLogData[0xB4 + itemWheelPos] = 10;
itemWheelPos++;
}
+ void phantomZant()
+ {
+ // Nothing I think
+ }
void zant()
{
// Light sword