Skip to content

Commit

Permalink
Fix Koume Pictograph Items
Browse files Browse the repository at this point in the history
Adjust Maps and Compasses settings.

Include collected type for spoiler data.

Update spoiler colours on item collection.

Remove debug statements.

Implement spoiler data checks. Spoiler menu should now be fully functional!
  • Loading branch information
PhlexPlexico committed Jan 5, 2024
1 parent 716f4c1 commit d1dabe2
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 31 deletions.
2 changes: 2 additions & 0 deletions code/include/game/actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ namespace game::act {
NpcGreatFairy = 0x00D2,
// [4] Kafei
NpcKafei = 0x00F4,
// Koume (Boat Lady)
EnTru = 0x0102,
// Banker
EnGinkoMan = 0x010F,
// Deku Butler
Expand Down
2 changes: 1 addition & 1 deletion code/include/rnd/savefile.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace rnd {
BitField<17, 1, u32> enInGivenItem;
BitField<18, 1, u32> kafeiGivenItem;
BitField<19, 1, u32> enHgoGivenItem;
BitField<20, 1, u32> enTrtGivenItem;
BitField<20, 1, u32> enTruGivenItem;
BitField<21, 1, u32> enHsGivenItem;
BitField<22, 1, u32> enMaYtoGivenItem;
BitField<23, 1, u32> enOskGivenItem;
Expand Down
3 changes: 1 addition & 2 deletions code/include/rnd/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ namespace rnd {
};

enum class MapsAndCompassesSetting : u8 {
MAPSANDCOMPASSES_START_WITH,
MAPSANDCOMPASSES_VANILLA,
MAPSANDCOMPASSES_START_WITH,
MAPSANDCOMPASSES_OWN_DUNGEON,
MAPSANDCOMPASSES_ANY_DUNGEON,
MAPSANDCOMPASSES_OVERWORLD,
Expand Down Expand Up @@ -156,7 +156,6 @@ namespace rnd {

enum class IceTrapSetting : u8 {
ICETRAPS_OFF,
ICETRAPS_NORMAL,
ICETRAPS_EXTRA,
ICETRAPS_MAYHEM,
ICETRAPS_ONSLAUGHT,
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 @@ -94,6 +94,7 @@ namespace rnd {
SpoilerItemCollectType CollectType;
SpoilerItemRevealType RevealType;
ItemOverride_Type OverrideType;
bool Collected;
} SpoilerItemLocation;

typedef struct {
Expand Down Expand Up @@ -121,6 +122,7 @@ namespace rnd {

SpoilerItemLocation* SpoilerData_ItemLoc(u16 itemIndex);
char* SpoilerData_StringData(u16 itemIndex);
SpoilerItemCollectType SpoilerData_CollectType(u16 itemIndex);

char* SpoilerData_GetItemLocationString(u16 itemIndex);
char* SpoilerData_GetItemNameString(u16 itemIndex);
Expand Down
34 changes: 21 additions & 13 deletions code/source/rnd/gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,15 @@ namespace rnd {
u16 itemIndex = gSpoilerData.SphereItemLocations[sphereItemLocOffset + locIndex];
u32 color = COLOR_WHITE;
if (SpoilerData_GetIsItemLocationCollected(itemIndex)) {
color = COLOR_GREEN;
} else if (SpoilerData_ItemLoc(itemIndex)->CollectType == COLLECTTYPE_REPEATABLE) {
color = COLOR_BLUE;
} else if (SpoilerData_ItemLoc(itemIndex)->CollectType == COLLECTTYPE_NEVER) {
color = COLOR_ORANGE;
if (SpoilerData_CollectType(itemIndex) == COLLECTTYPE_REPEATABLE) {
color = COLOR_BLUE;
}
else if (SpoilerData_CollectType(itemIndex) == COLLECTTYPE_NEVER) {
color = COLOR_ORANGE;
}
else {
color = COLOR_GREEN;
}
}
Draw_DrawString_Small(10, locPosY, color, SpoilerData_GetItemLocationString(itemIndex));
Draw_DrawString_Small(10 + (SPACING_SMALL_X * 2), itemPosY, color, SpoilerData_GetItemNameString(itemIndex));
Expand Down Expand Up @@ -479,16 +483,20 @@ namespace rnd {
bool canShowGroup = isCollected || CanShowSpoilerGroup(SpoilerCollectionCheckGroup(itemGroupIndex));

u32 color = COLOR_WHITE;

if (isCollected) {
color = COLOR_GREEN;
} else if (canShowGroup) {
if (SpoilerData_ItemLoc(locIndex)->CollectType == COLLECTTYPE_REPEATABLE &&
SpoilerData_GetIsItemLocationRevealed(locIndex)) {
color = COLOR_BLUE;
} else if (SpoilerData_ItemLoc(locIndex)->CollectType == COLLECTTYPE_NEVER) {
color = COLOR_ORANGE;
}
if (SpoilerData_CollectType(locIndex) == COLLECTTYPE_REPEATABLE) {
color = COLOR_BLUE;
}
else if (SpoilerData_CollectType(locIndex) == COLLECTTYPE_NEVER) {
color = COLOR_ORANGE;
}
else {
color = COLOR_GREEN;
}
}


bool itemRevealed = canShowGroup && (isCollected || SpoilerData_GetIsItemLocationRevealed(locIndex));

if (canShowGroup) {
Expand Down
9 changes: 8 additions & 1 deletion code/source/rnd/item_override.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ namespace rnd {
SetExtData();
ItemOverride_AfterKeyReceived(key);
SpoilerLog_UpdateIngameLog(key.type, key.scene, key.flag);
//#if ENABLE_DEBUG || DEBUG_PRINT
//rnd::util::Print(
// "%s: Our key values:\nKey Type %#04x\nKey Scene: %#04x\nKey Flag: %#06x\n",
// key.type, key.scene, key.flag);
//#endif
ItemOverride_Clear();
}

Expand Down Expand Up @@ -439,6 +444,8 @@ namespace rnd {
gExtSaveData.givenItemChecks.enHsGivenItem = 1;
} else if (storedActorId == game::act::Id::EnHgo) {
gExtSaveData.givenItemChecks.enHgoGivenItem = 1;
} else if (storedActorId == game::act::Id::EnTru) {
gExtSaveData.givenItemChecks.enTruGivenItem = 1;
}
}

Expand Down Expand Up @@ -704,7 +711,7 @@ namespace rnd {
return (int)0xFF;
} else if (currentItem == game::ItemId::GaroMask && gExtSaveData.givenItemChecks.enInGivenItem == 0) {
return (int)0xFF;
} else if (currentItem == game::ItemId::PictographBox && gExtSaveData.givenItemChecks.enTrtGivenItem == 0) {
} else if (currentItem == game::ItemId::PictographBox && gExtSaveData.givenItemChecks.enTruGivenItem == 0) {
return (int)0xFF;
} else if (currentItem == game::ItemId::BunnyHood && gExtSaveData.givenItemChecks.enHsGivenItem == 0) {
return (int)0xFF;
Expand Down
38 changes: 24 additions & 14 deletions code/source/rnd/spoiler_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ namespace rnd {
SpoilerItemLocation* SpoilerData_ItemLoc(u16 itemIndex) {
return &gSpoilerDataLocs[itemIndex / SPOILER_ITEMS_MAX].ItemLocations[itemIndex % SPOILER_ITEMS_MAX];
}

SpoilerItemCollectType SpoilerData_CollectType(u16 itemIndex) {
return gSpoilerData.ItemLocations[itemIndex].CollectType;
}

char* SpoilerData_StringData(u16 itemIndex) {
return gSpoilerDataLocs[itemIndex / SPOILER_ITEMS_MAX].StringData;
Expand All @@ -36,22 +40,10 @@ namespace rnd {
u8 SpoilerLog_UpdateIngameLog(ItemOverride_Type type, u8 scene, u8 flag) {
// SpoilerData currentCheck = {0};
for (int i = 0; i < gSpoilerData.ItemLocationsCount; i++) {
if (gSpoilerData.ItemLocations[i].LocationScene == scene) {
if (gSpoilerData.ItemLocations[i].OverrideType == type) {
if (gSpoilerData.ItemLocations[i].LocationFlag == flag) {
// reveal the check
return -1;
}
}
if (gSpoilerData.ItemLocations[i].LocationScene == scene && gSpoilerData.ItemLocations[i].OverrideType == type && gSpoilerData.ItemLocations[i].LocationFlag == flag) {
gSpoilerData.ItemLocations[i].Collected = true;
}
}
/*
for (gSpoilerData.ItemLocations->OverrideType == type && gSpoilerData.ItemLocations->LocationScene == scene &&
gSpoilerData.ItemLocations->LocationFlag == flag)
{
//maybe do it this way?
return -1;
}*/
return -1;
}

Expand Down Expand Up @@ -127,6 +119,19 @@ namespace rnd {
}

SpoilerItemLocation itemLoc = gSpoilerData.ItemLocations[itemIndex];
if (itemLoc.Collected == true){
return 1;
}
if (itemLoc.CollectionCheckType == SPOILER_CHK_ALWAYS_COLLECTED)
{
return 1;
}
if (itemLoc.CollectionCheckType == SPOILER_CHK_NONE)
{
return 0;
}
return 0;
/*
// game::SaveData &gSaveContext = game::GetCommonData().save;
switch (itemLoc.CollectionCheckType) {
case SPOILER_CHK_NONE: { // Not ever 'collectable' (Ganon, or any item that didn't have a type
Expand All @@ -151,6 +156,10 @@ namespace rnd {
// gSaveContext.skulltulas_collected.ocean_count
return -1;
}
case SPOILER_CHK_STRAY_FAIRY: {
// gSaveContext.strayfairies_collected
return -1;
}
case SPOILER_CHK_ITEM_GET_INF: { // Check a flag set in item_get_inf
return SpoilerData_ItemGetInfCheck(itemLoc.LocationFlag);
}
Expand Down Expand Up @@ -183,6 +192,7 @@ namespace rnd {
}
}
return 0;
*/
}

u8 SpoilerData_GetIsItemLocationRevealed(u16 itemIndex) {
Expand Down

0 comments on commit d1dabe2

Please sign in to comment.