Skip to content

Commit

Permalink
fix: Ingame Tracker Updates (#100)
Browse files Browse the repository at this point in the history
* TrackerUpdates1

Adds new location for "Inside Clock Tower"
Attempts to add randomizer version

* Include commit ID in menu, reduce the amount of text allowable in the commitId.

* Update gfx.cpp

add swamp skulltulas to dungeon item screen & fix keys

* TrackerUpdates2

- Adds attempt at icon creation
- Adds new row for Stray Fairies per dungeon
- Adjusts spacing to accommidate double digit values in skulltula tokens
- Adjusts placement of skulltula token counters to align with stray fairy counter
- Adds Stray Fairy and Skulltula Icon to legend page

* Update gfx.cpp

update %02d to %02u

* Update colouring and texture of sprites.

* Include model destruction in attempt to hopefully resolve crashes.

Attempting to reach parity of code to oot3dr.

* Finally fix the boathouse override not working when defeating the Woodfall Temple.

This will fix pictograph item gets from here on in.

* Update spoiler log and bits being set for scenes.

This should fix the spoiler log revealing for temples.

---------

Co-authored-by: Tacoman369 <[email protected]>
  • Loading branch information
PhlexPlexico and Tacoman369 authored Jan 17, 2025
1 parent 5063201 commit 98a8c38
Show file tree
Hide file tree
Showing 13 changed files with 181 additions and 53 deletions.
2 changes: 1 addition & 1 deletion code/include/game/common_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ namespace game {
SkulltulaRegister skulltulas_collected;
int anonymous_60;
u8 gap1210[4];
u8 defeated_bosses[4]; // like a history log of deafeated bosses or seen giants
int defeated_bosses; // like a history log of deafeated bosses or seen giants
int previous_defeated_boss; // or last viewed giant cutscene, values 4 and greater makes
// woodfall giant repeat for all temples.
// u8 gap1221[3];
Expand Down
4 changes: 3 additions & 1 deletion code/include/rnd/draw.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ typedef enum {
ICON_BUTTON_FACEH,
ICON_BUTTON_FACEV,
ICON_BUTTON_JOYSTICK,
ICONS_COUNT
ICON_SKULLTULA,
ICON_FAIRY,
ICON_COUNT
} Draw_IconType;

void Draw_Lock(void);
Expand Down
2 changes: 1 addition & 1 deletion code/include/rnd/gfx.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ namespace rnd {
} GfxPage;

void Gfx_Init(void);
static u8 openingButton();
extern "C" void Gfx_Update();
extern "C" void Gfx_SleepQueryCallback();
extern "C" void Gfx_AwakeCallback();
void* getExpHeapPtr();

} // namespace rnd

Expand Down
22 changes: 22 additions & 0 deletions code/include/rnd/icons.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,5 +285,27 @@ static const unsigned char rIcons[][ICON_HEIGHT] = {{
0x44, /* 01000100 */
0x38, /* 00111000 */
0x00, /* 00000000 */
},
{
/* Gold Skulltula Token */
0x00, /* 00000000 */
0x38, /* 00111000 */
0x44, /* 01000100 */
0x6c, /* 01101100 */
0x54, /* 01010100 */
0x28, /* 00101000 */
0x00, /* 00000000 */
0x00, /* 00000000 */
},
{
/* Stray Fairy */
0x00, /* 00000000 */
0x44, /* 01000100 */
0x28, /* 00101000 */
0x38, /* 00111000 */
0x38, /* 00111000 */
0x10, /* 00010000 */
0x2c, /* 00101100 */
0x00, /* 00000000 */
}};
#endif
1 change: 1 addition & 0 deletions code/include/rnd/models.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef _RND_MODELS_H_
#define _RND_MODELS_H_
#include "game/actor.h"
#include "rnd/gfx.h"
#include "rnd/item_table.h"
#include "rnd/objects.h"
#include "z3d/z3DVec.h"
Expand Down
2 changes: 2 additions & 0 deletions code/include/rnd/spoiler_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ namespace rnd {
// Location groups for checks, used to group the checks by logical location
typedef enum {
GROUP_NO_GROUP,
GROUP_INSIDE_CLOCKTOWER,
GROUP_S_CLOCK_TOWN,
GROUP_LAUNDRY_POOL,
GROUP_E_CLOCK_TOWN,
Expand Down Expand Up @@ -111,6 +112,7 @@ namespace rnd {
char StringData[SPOILER_STRING_DATA_SIZE];
u16 GroupItemCounts[SPOILER_COLLECTION_GROUP_COUNT];
u16 GroupOffsets[SPOILER_COLLECTION_GROUP_COUNT];
char randoVersion[14];
} SpoilerData;

typedef struct {
Expand Down
4 changes: 2 additions & 2 deletions code/mm.ld
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,9 @@ SECTIONS{
*(.patch_HandleOcarinaHooks)
}

/* .patch_RemoveWoodfallClearConditionFromBoatHouse 0x6737E8 : {
.patch_RemoveWoodfallClearConditionFromBoatHouse 0x39655C : {
*(.patch_RemoveWoodfallClearConditionFromBoatHouse)
} */
}

. = 0x61CD8C;
/* Addr already 4 byte aligned! */
Expand Down
8 changes: 8 additions & 0 deletions code/source/asm/hooks.s
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,14 @@ hook_CheckMoTSetting:
bl SettingsMaskOfTruthCheck
b 0x35C42C

.global hook_RemoveWoodfallClearConditionFromBoatHouse
hook_RemoveWoodfallClearConditionFromBoatHouse:
push {r0-r12, lr}
bl RemoveBoathouseRestriction
pop {r0-r12,lr}
cmp r0,#0x2
bx lr

.section .loader
.global hook_into_loader
hook_into_loader:
Expand Down
8 changes: 4 additions & 4 deletions code/source/asm/patches.s
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ RemoveJimWhenExitingHideout_patch:
@ and should always evaluate to false.
@ https://github.com/zeldaret/mm/blob/6541532abb5c03088ad67748bbb23965c654127e/src/overlays/actors/ovl_En_Dnh/z_en_dnh.c#L21
@ https://github.com/zeldaret/mm/blob/main/include/z64msgevent.h#L354
@ .section .patch_RemoveWoodfallClearConditionFromBoatHouse
@ .global patch_RemoveWoodfallClearConditionFromBoatHouse
@ patch_RemoveWoodfallClearConditionFromBoatHouse:
@ .byte 0x0C
.section .patch_RemoveWoodfallClearConditionFromBoatHouse
.global patch_RemoveWoodfallClearConditionFromBoatHouse
patch_RemoveWoodfallClearConditionFromBoatHouse:
bl hook_RemoveWoodfallClearConditionFromBoatHouse

.section .patch_loader
.global loader_patch
Expand Down
135 changes: 103 additions & 32 deletions code/source/rnd/gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ namespace rnd {
u32 pressed;
bool handledInput;
const char* spoilerCollectionGroupNames[] = {
"All Item Locations", "South Clock Town", "Laundry Pool", "East Clock Town", "StockPotInn",
"West Clock Town", "North Clock Town", "Termina Field", "Southern Swamp", "Deku Palace",
"Woodfall", "Snowhead", "Mountain Village", "Twin Islands", "Goron Village",
"Milk Road", "Romani Ranch", "Great Bay Coast", "Pinnacle Rock", "Zora Cape",
"Zora Hall", "Ikana Canyon", "Ikana Graveyard", "Stone Tower", "Woodfall Temple",
"Snowhead Temple", "Great Bay Temple", "Stone Tower Temple", "Pirate Fortress", "Beneath the Well",
"Ikana Castle", "Secret Shrine", "The Moon", "Swamp Skulltula House", "Ocean Skulltula House",
"All Item Locations", "Inside Clock Tower", "South Clock Town", "Laundry Pool",
"East Clock Town", "StockPotInn", "West Clock Town", "North Clock Town",
"Termina Field", "Southern Swamp", "Deku Palace", "Woodfall",
"Snowhead", "Mountain Village", "Twin Islands", "Goron Village",
"Milk Road", "Romani Ranch", "Great Bay Coast", "Pinnacle Rock",
"Zora Cape", "Zora Hall", "Ikana Canyon", "Ikana Graveyard",
"Stone Tower", "Woodfall Temple", "Snowhead Temple", "Great Bay Temple",
"Stone Tower Temple", "Pirate Fortress", "Beneath the Well", "Ikana Castle",
"Secret Shrine", "The Moon", "Swamp Skulltula House", "Ocean Skulltula House",
};

static s8 spoilerGroupDungeonIds[] = {
Expand Down Expand Up @@ -54,43 +56,49 @@ namespace rnd {
-1,
-1,
-1,
GROUP_DUNGEON_WOODFALL_TEMPLE,
GROUP_DUNGEON_SNOWHEAD_TEMPLE,
GROUP_DUNGEON_GREAT_BAY,
GROUP_DUNGEON_STONE_TOWER,
GROUP_DUNGEON_PIRATE_FORTRESS,
GROUP_DUNGEON_BENEATH_THE_WELL,
GROUP_DUNGEON_IKANA_CASTLE,
GROUP_DUNGEON_SECRET_SHRINE,
GROUP_DUNGEON_THE_MOON,
GROUP_SWAMP_SKULLTULA_HOUSE,
GROUP_OCEAN_SKULLTULA_HOUSE,
-1,
DUNGEON_WOODFALL,
DUNGEON_SNOWHEAD,
DUNGEON_GREAT_BAY,
DUNGEON_STONE_TOWER,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
};

static bool IsDungeonDiscovered(s8 dungeonId) {
game::SaveData& saveData = game::GetCommonData().save;
u8 sceneId = 0x0;
bool hasMap = 0;
if (dungeonId == DUNGEON_THE_MOON) {
return false;
}

u8 idToModeKnown[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
if (idToModeKnown[dungeonId]) {
return true;
}

// A dungeon is considered discovered if we've visited the dungeon, have the map,
// Or known bc of settings
bool hasMap = 0;
if (dungeonId == 0) {
// A dungeon is considered discovered if we've visited the dungeon or have the map,
// Check for Woodfall Temple Map
if (dungeonId == DUNGEON_WOODFALL) {
hasMap = saveData.inventory.woodfall_dungeon_items.map.Value();
} else if (dungeonId == 1) {
sceneId = 0x1B;
}
// Check for Snowhead Temple Map
else if (dungeonId == DUNGEON_SNOWHEAD) {
hasMap = saveData.inventory.snowhead_dungeon_items.map.Value();
} else if (dungeonId == 2) {
sceneId = 0x21;
}
// Check for Great Bay Temple Map
else if (dungeonId == DUNGEON_GREAT_BAY) {
hasMap = saveData.inventory.great_bay_dungeon_items.map.Value();
} else if (dungeonId == 3) {
sceneId = 0x49;
}
// Check for Stone Tower Temple Map
else if (dungeonId == DUNGEON_STONE_TOWER) {
hasMap = saveData.inventory.stone_tower_dungeon_items.map.Value();
sceneId = 0x16;
}
return (hasMap = 1); // to-do: check overworld map for GB & Ikana areas for other dungeons. & scene check.
return hasMap == 1 || SaveFile_GetIsSceneDiscovered(sceneId);
}

static bool CanShowSpoilerGroup(SpoilerCollectionCheckGroup group) {
Expand Down Expand Up @@ -203,6 +211,12 @@ namespace rnd {

static void Gfx_DrawSeedHash(void) {
u8 offsetY = 0;

Draw_DrawString(10, 16 + (SPACING_Y * offsetY++), COLOR_TITLE, "Randomizer Version:");
Draw_DrawFormattedString(10 + (SPACING_X * 4), 16 + (SPACING_Y * offsetY++), COLOR_WHITE, "%s",
gSpoilerData.randoVersion);
offsetY++;

Draw_DrawFormattedString(10, 16 + (SPACING_Y * offsetY++), COLOR_TITLE, "Seed Hash:");
for (u32 hashIndex = 0; hashIndex < ARR_SIZE(gSettingsContext.hashIndexes); ++hashIndex) {
Draw_DrawFormattedString(10 + (SPACING_X * 4), 16 + (SPACING_Y * offsetY++), COLOR_WHITE, "%s",
Expand All @@ -227,6 +241,8 @@ namespace rnd {

Draw_DrawString(10, 16 + (spacingY * offsetY++), COLOR_TITLE, "Dungeon Items Legend");
offsetY++;
Draw_DrawIcon(10, 16 + (spacingY * offsetY), COLOR_PINK, ICON_FAIRY);
Draw_DrawString(24, 16 + (spacingY * offsetY++), COLOR_WHITE, "Stray Fairies: Have / Total");
Draw_DrawIcon(10, 16 + (spacingY * offsetY), COLOR_WHITE, ICON_SMALL_KEY);
Draw_DrawString(24, 16 + (spacingY * offsetY++), COLOR_WHITE, "Small Keys: Have / Found");
Draw_DrawIcon(10, 16 + (spacingY * offsetY), COLOR_ICON_BOSS_KEY, ICON_BOSS_KEY);
Expand All @@ -242,10 +258,14 @@ namespace rnd {
Draw_DrawString(24, 16 + (spacingY * offsetY++), COLOR_WHITE, "Barren Location");
Draw_DrawString(10, 16 + (spacingY * offsetY), COLOR_WHITE, "-");
Draw_DrawString(24, 16 + (spacingY * offsetY++), COLOR_WHITE, "Non-WotH / Non-Barren Location");
offsetY++;
Draw_DrawIcon(10, 16 + (spacingY * offsetY), COLOR_YELLOW, ICON_SKULLTULA);
Draw_DrawString(24, 16 + (spacingY * offsetY++), COLOR_WHITE, "Skulltula Token(s)");
return;
}
Draw_DrawString(10, 16, COLOR_TITLE, "Dungeon Items");
// Draw header icons
Draw_DrawIcon(182, 16, COLOR_PINK, ICON_FAIRY);
Draw_DrawIcon(214, 16, COLOR_WHITE, ICON_SMALL_KEY);
Draw_DrawIcon(240, 16, COLOR_WHITE, ICON_BOSS_KEY);
Draw_DrawIcon(260, 16, COLOR_WHITE, ICON_MAP);
Expand Down Expand Up @@ -298,6 +318,38 @@ namespace rnd {

Draw_DrawString(24, yPos, COLOR_WHITE, DungeonNames[dungeonId]);

// Stray Fairies
if (dungeonId <= DUNGEON_STONE_TOWER) {
u8 straysHave = 0;
if ((dungeonId == DUNGEON_WOODFALL)) {
straysHave = saveData.inventory.woodfall_fairies == 255 ? 0 : saveData.inventory.woodfall_fairies;
}
if ((dungeonId == DUNGEON_SNOWHEAD)) {
straysHave = saveData.inventory.snowhead_fairies == 255 ? 0 : saveData.inventory.snowhead_fairies;
}
if ((dungeonId == DUNGEON_GREAT_BAY)) {
straysHave = saveData.inventory.great_bay_fairies == 255 ? 0 : saveData.inventory.great_bay_fairies;
}
if ((dungeonId == DUNGEON_STONE_TOWER)) {
straysHave = saveData.inventory.stone_tower_fairies == 255 ? 0 : saveData.inventory.stone_tower_fairies;
}
Draw_DrawFormattedString(170, yPos, straysHave > 0 ? COLOR_WHITE : COLOR_DARK_GRAY, "%02u", straysHave);
Draw_DrawString(182, yPos, COLOR_WHITE, "/");

// u8 fairiesFound = Dungeon_FoundSmallKeys(dungeonId);
// if ((gSettingsContext.keysanity == u8(rnd::KeysanitySetting::KEYSANITY_START_WITH)) &&
// (dungeonId <= DUNGEON_STONE_TOWER)) {
// keysFound += Dungeon_KeyAmount(dungeonId);
// } Todo : Stray Fairies - Start With
u32 straysTotalColor = COLOR_WHITE;
if ((straysHave >= 15) && IsDungeonDiscovered(dungeonId)) {
straysTotalColor = COLOR_GREEN;
} else if (straysHave == 0) {
straysTotalColor = COLOR_DARK_GRAY;
}
Draw_DrawFormattedString(188, yPos, straysTotalColor, "15");
}

// Small Keys
if (dungeonId <= DUNGEON_STONE_TOWER) {
u8 keysHave = 0;
Expand Down Expand Up @@ -358,6 +410,21 @@ namespace rnd {

yPos += spacingY;
}

// Skulltulas
u8 swampTokensHave = saveData.skulltulas_collected.swamp_count;
u8 oceanTokensHave = saveData.skulltulas_collected.ocean_count;
yPos += spacingY;
Draw_DrawString(10, yPos, COLOR_TITLE, "Skulltula Tokens");
Draw_DrawIcon(182, yPos, COLOR_YELLOW, ICON_SKULLTULA);
yPos += spacingY;
Draw_DrawString(24, yPos, COLOR_WHITE, "Swamp Skulltula Tokens");
Draw_DrawFormattedString(170, yPos, swampTokensHave > 0 ? COLOR_WHITE : COLOR_DARK_GRAY, "%02u", swampTokensHave);
Draw_DrawString(182, yPos, COLOR_WHITE, "/30");
yPos += spacingY;
Draw_DrawString(24, yPos, COLOR_WHITE, "Ocean Skulltula Tokens");
Draw_DrawFormattedString(170, yPos, oceanTokensHave > 0 ? COLOR_WHITE : COLOR_DARK_GRAY, "%02u", oceanTokensHave);
Draw_DrawString(182, yPos, COLOR_WHITE, "/30");
}

static void Gfx_DrawSpoilerData(void) {
Expand Down Expand Up @@ -782,4 +849,8 @@ namespace rnd {
}
}

void* getExpHeapPtr() {
return util::GetPointer<void*()>(0x1F1BF8)();
}

} // namespace rnd
4 changes: 2 additions & 2 deletions code/source/rnd/item_override.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ namespace rnd {
rItemOverrides[0].value.looksLikeItemId = 0x56;
rItemOverrides[1].key.scene = 0x6F;
rItemOverrides[1].key.type = ItemOverride_Type::OVR_COLLECTABLE;
rItemOverrides[1].value.getItemId = 0x46;
rItemOverrides[1].value.looksLikeItemId = 0x46;
rItemOverrides[1].value.getItemId = 0x44;
rItemOverrides[1].value.looksLikeItemId = 0x44;
rItemOverrides[2].key.scene = 0x12;
rItemOverrides[2].key.type = ItemOverride_Type::OVR_COLLECTABLE;
rItemOverrides[2].value.getItemId = 0x37;
Expand Down
Loading

0 comments on commit 98a8c38

Please sign in to comment.