Restoration: RBA Values (#2672)

* Restore RBA Values

Matches all rba scenarios achievable in game to their original outcomes. This only ends up affecting certain trade items.

* tooltip rewrite

* rba cases generalised

* re-add to menu bar

* better byteswap and checks for endianness

* remove leftover defines
This commit is contained in:
inspectredc 2023-10-17 15:25:09 +01:00 committed by GitHub
parent da92ac6a37
commit cff2e37287
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View File

@ -167,6 +167,7 @@ const std::vector<const char*> enhancementsCvars = {
"gBombchusOOB",
"gQuickPutaway",
"gGsCutscene",
"gRestoreRBAValues",
"gSkipSaveConfirmation",
"gAutosave",
"gDisableCritWiggle",

View File

@ -1067,6 +1067,8 @@ void DrawEnhancementsMenu() {
UIWidgets::PaddedEnhancementCheckbox("Restore old Gold Skulltula cutscene", "gGsCutscene", true, false);
UIWidgets::PaddedEnhancementCheckbox("Quick Bongo Kill", "gQuickBongoKill", true, false);
UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows bypassing Bongo Bongo's intro cutscene to quickly kill him");
UIWidgets::PaddedEnhancementCheckbox("Original RBA Values", "gRestoreRBAValues", true, false);
UIWidgets::Tooltip("Restores the original outcomes when performing Reverse Bottle Adventure.");
ImGui::EndMenu();
}

View File

@ -2782,6 +2782,13 @@ s32 Inventory_HasSpecificBottle(u8 bottleItem) {
}
}
void byteSwapInventory() {
gSaveContext.inventory.equipment = BE16SWAP(gSaveContext.inventory.equipment);
gSaveContext.inventory.upgrades = BE32SWAP(gSaveContext.inventory.upgrades);
gSaveContext.inventory.questItems = BE32SWAP(gSaveContext.inventory.questItems);
gSaveContext.inventory.gsTokens = BE16SWAP(gSaveContext.inventory.gsTokens);
}
void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 button) {
osSyncPrintf("item_no=%x, c_no=%x, Pt=%x Item_Register=%x\n", item, button,
gSaveContext.equips.cButtonSlots[button - 1],
@ -2793,7 +2800,14 @@ void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 button) {
item = ITEM_MILK_HALF;
}
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[button - 1]] = item;
if (CVarGetInteger("gRestoreRBAValues",0)) {
byteSwapInventory();
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[button - 1]] = item;
byteSwapInventory();
} else {
gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[button - 1]] = item;
}
gSaveContext.equips.buttonItems[button] = item;
Interface_LoadItemIcon1(play, button);