Skip to content

Commit

Permalink
Merge branch 'Dev' into dev-fenhl
Browse files Browse the repository at this point in the history
# Conflicts:
#	ASM/build/asm_symbols.txt
#	ASM/build/bundle.o
#	ASM/build/c_symbols.txt
#	ASM/c/item_upgrades.c
#	data/generated/rom_patch.txt
#	data/generated/symbols.json
  • Loading branch information
fenhl committed Oct 2, 2024
2 parents fabef2d + 251b716 commit bb584cf
Show file tree
Hide file tree
Showing 18 changed files with 36,169 additions and 35,879 deletions.
1,497 changes: 754 additions & 743 deletions ASM/build/asm_symbols.txt

Large diffs are not rendered by default.

Binary file modified ASM/build/bundle.o
Binary file not shown.
896 changes: 450 additions & 446 deletions ASM/build/c_symbols.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ASM/c/item_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ item_row_t item_table[GI_RANDO_MAX] = {
[GI_BOTTLE_BLUE_FIRE] = ITEM_ROW(0x53, GILDED_CHEST, 0x1C, -1, 0x005D, 0x0173, 0x67, no_upgrade, no_effect, -1, -1, NULL), // Blue Fire (Refill)
[GI_BOTTLE_POE] = ITEM_ROW(0x53, GILDED_CHEST, 0x20, -1, 0x0097, 0x0176, 0x6A, no_upgrade, no_effect, -1, -1, NULL), // Poe (Refill)
[GI_BOTTLE_BIG_POE] = ITEM_ROW(0x53, GILDED_CHEST, 0x1E, -1, 0x00F9, 0x0176, 0x70, no_upgrade, no_effect, -1, -1, NULL), // Big Poe (Refill)
[GI_DOOR_KEY] = ITEM_ROW(0x53, SILVER_CHEST, 0x41, -1, 0x00F3, 0x00AA, 0x02, no_upgrade, give_small_key, TCG_ID, -1, resolve_text_small_keys_cmg), // Small Key (Chest Game)
[GI_DOOR_KEY] = ITEM_ROW(0x53, SILVER_CHEST, 0x41, -1, 0x00F3, 0x00AA, 0x02, tcg_key_to_rupee, give_small_key, TCG_ID, -1, resolve_text_small_keys_cmg), // Small Key (Chest Game)
[GI_RUPEE_GREEN_LOSE] = ITEM_ROW(0x4D, BROWN_CHEST, 0x84, -1, 0x00F4, 0x017F, 0x6D, no_upgrade, no_effect, -1, -1, NULL), // Green Rupee (Chest Game)
[GI_RUPEE_BLUE_LOSE] = ITEM_ROW(0x4D, BROWN_CHEST, 0x85, -1, 0x00F5, 0x017F, 0x6E, no_upgrade, no_effect, -1, -1, NULL), // Blue Rupee (Chest Game)
[GI_RUPEE_RED_LOSE] = ITEM_ROW(0x4D, BROWN_CHEST, 0x86, -1, 0x00F6, 0x017F, 0x6F, no_upgrade, no_effect, -1, -1, NULL), // Red Rupee (Chest Game)
Expand Down
18 changes: 17 additions & 1 deletion ASM/c/item_upgrades.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#include "z64.h"

extern uint32_t FREE_BOMBCHU_DROPS;

extern uint8_t SHUFFLE_CHEST_GAME;
extern uint8_t TCG_REQUIRES_LENS;

// Co-op state
extern uint8_t PLAYER_ID;
Expand Down Expand Up @@ -160,3 +161,18 @@ uint16_t bombchus_to_bag(z64_file_t* save, override_t override) {
return override.value.base.item_id;
}
}

uint16_t tcg_key_to_rupee(z64_file_t* save, override_t override) {
uint16_t item_id = override.value.base.item_id;
// Force treasure chest game loss if the setting to require Lens of Truth
// is enabled. Room index is checked to avoid overriding the salesman's item.
if (item_id == GI_DOOR_KEY && !SHUFFLE_CHEST_GAME && TCG_REQUIRES_LENS
&& override.value.base.player == PLAYER_ID
&& save->items[Z64_SLOT_LENS] != Z64_ITEM_LENS
&& z64_game.room_index != 0
) {
return GI_RUPEE_GREEN_LOSE; // Green Rupee (Chest Game)
} else {
return item_id;
}
}
1 change: 1 addition & 0 deletions ASM/c/item_upgrades.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ uint16_t seeds_to_rupee(z64_file_t* save, override_t override);
uint16_t letter_to_bottle(z64_file_t* save, override_t override);
uint16_t health_upgrade_cap(z64_file_t* save, override_t override);
uint16_t bombchus_to_bag(z64_file_t* save, override_t override);
uint16_t tcg_key_to_rupee(z64_file_t* save, override_t override);

// The layout of this struct is part of the definition of the co-op context.
// If you change it, bump the co-op context version in coop_state.asm and update Notes/coop-ctx.md
Expand Down
26 changes: 21 additions & 5 deletions ASM/c/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,28 @@ void shooting_gallery_message() {
shooting_gallery_show_message = 1;
}

uint8_t treasure_chest_game_show_message = 0;
// Displays a warning message if the player attempted the Treasure Chest Game without
// Lens of Truth when settings require it.
void treasure_chest_game_message() {
if (z64_file.items[Z64_SLOT_LENS] != Z64_ITEM_LENS) {
treasure_chest_game_show_message = 1;
}
}

// Function to display custom textboxes ingame.
void display_misc_messages() {
if (shooting_gallery_show_message == 1 &&
z64_MessageGetState(((uint8_t *)(&z64_game)) + 0x20D8) == 0) {
z64_DisplayTextbox(&z64_game, 0x045C, 0);
// To avoid displaying the message several times if the player just wants to farm the 50 rupees.
shooting_gallery_show_message = -1;
if (z64_MessageGetState(((uint8_t *)(&z64_game)) + 0x20D8) == 0) {
// Each minigame warning message can only be triggered in their respective
// scenes. Order doesn't matter.
if (shooting_gallery_show_message == 1) {
z64_DisplayTextbox(&z64_game, 0x045C, 0);
// To avoid displaying the message several times if the player just wants to farm the 50 rupees.
shooting_gallery_show_message = -1;
} else if (treasure_chest_game_show_message) {
z64_DisplayTextbox(&z64_game, 0x045D, 0);
// No reason not to repeat the message on a reattempt in case the player forgot.
treasure_chest_game_show_message = 0;
}
}
}
76 changes: 76 additions & 0 deletions ASM/src/chest_game.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
SHUFFLE_CHEST_GAME:
.byte 0x00
TCG_REQUIRES_LENS:
.byte 0x00
.align 4

chestgame_buy_item_hook:
Expand Down Expand Up @@ -88,3 +90,77 @@ chestgame_delayed_chest_open:
@@return:
jr ra
lw a0, 0x004C($sp) ; displaced code

; Show a key in the unopened chest regardless of chest
; contents if the tcg_requires_lens setting is enabled
chestgame_force_game_loss_left:
; displaced code
lwc1 $f0, 0x0024($v1)
lwc1 $f2, 0x0028($v1)
; check setting
lb $t7, TCG_REQUIRES_LENS
beqz $t7, @@return
nop
; safety check to prevent simulated loss if keys are shuffled
lb $t7, SHUFFLE_CHEST_GAME
bnez $t7, @@return
nop
; check if player has lens of truth
lui $t1, hi(SAVE_CONTEXT + 0x81)
lb $t2, lo(SAVE_CONTEXT + 0x81)($t1) ; lens item slot
li $t3, 15 ; lens item ID
beq $t2, $t3, @@return
nop
; simulate lost game
addiu $t0, $zero, 0x0071
j chestgame_warn_player_of_rigged_game
nop

@@return:
jr $ra
nop

chestgame_force_game_loss_right:
; displaced code
lwc1 $f0, 0x0024($v0)
lwc1 $f2, 0x0028($v0)
; check setting
lb $t7, TCG_REQUIRES_LENS
beqz $t7, @@return
nop
; safety check to prevent simulated loss if keys are shuffled
lb $t7, SHUFFLE_CHEST_GAME
bnez $t7, @@return
nop
; check if player has lens of truth
lui $t1, hi(SAVE_CONTEXT + 0x81)
lb $t2, lo(SAVE_CONTEXT + 0x81)($t1) ; lens item slot
li $t3, 15 ; lens item ID
beq $t2, $t3, @@return
nop
; simulate lost game
addiu $v1, $zero, 0x0071
j chestgame_warn_player_of_rigged_game
nop

@@return:
jr $ra
nop

; Add a helper message if the tcg_requires_lens
; setting is enabled and the player still attempts
; the game.
chestgame_warn_player_of_rigged_game:
addiu $sp, $sp, -0x20
sw $ra, 0x14($sp)
sw $v0, 0x18($sp)
sw $v1, 0x1C($sp)

jal treasure_chest_game_message
nop

lw $ra, 0x14($sp)
lw $v0, 0x18($sp)
lw $v1, 0x1C($sp)
jr $ra
addiu $sp, $sp, 0x20
18 changes: 18 additions & 0 deletions ASM/src/hacks.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3732,6 +3732,24 @@ DemoEffect_DrawJewel_AfterHook:
jal chestgame_delayed_chest_open
nop

; Show a key in the unopened chest regardless of chest
; contents if the tcg_requires_lens setting is enabled.
; Left/right do the same check for the get item ID,
; but use different registers for the actor spawn branch
; and chest actor references for coordinates.
; Replaces:
; lwc1 $f0, 0x0024(v1)
; lwc1 $f2, 0x0028(v1)
.orga 0xE43964
jal chestgame_force_game_loss_left
nop
; Replaces:
; lwc1 $f0, 0x0024(v0)
; lwc1 $f2, 0x0028(v0)
.orga 0xE43A0C
jal chestgame_force_game_loss_right
nop

;==================================================================================================
; Bombchu Ticking Color
;==================================================================================================
Expand Down
1 change: 1 addition & 0 deletions Messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@
(0x045A, ("\x12\x68\x7AMweep\x07\x04\x5B", 0x23)),
(0x045B, ("\x12\x68\x7AMweep", 0x23)),
(0x045C, ("Come back when you have\x01your own bow and you'll get the\x01\x05\x41real prize\x05\x40!\x0E\x78", 0x00)),
(0x045D, ("\x12\x68\x5F\x05\x44This game seems shady. Maybe\x01the \x05\x41eye of truth\x05\x44 will show the\x01way forward?\x0E\x78", 0x00)),
(0x6013, ("Hey, newcomer!\x04Want me to throw you in jail?\x01\x01\x1B\x05\x42No\x01Yes\x05\x40", 0x00)),
]

Expand Down
3 changes: 3 additions & 0 deletions Patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -1987,6 +1987,9 @@ def update_scrub_text(message: bytearray, text_replacement: list[str], default_p
update_message_by_id(messages, 0x6E, "Wait, that room was off limits!\x02")
update_message_by_id(messages, 0x704C, "I hope you like it!\x02")

if world.settings.tcg_requires_lens:
rom.write_byte(rom.sym('TCG_REQUIRES_LENS'), 0x01)

if world.settings.shuffle_pots != 'off': # Update the first BK door in ganon's castle to use a separate flag so it can be unlocked to get to the pots
patch_ganons_tower_bk_door(rom, 0x15) # Using flag 0x15 for the door. GBK doors normally use 0x14.
locked_doors = get_doors_to_unlock(rom, world)
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ Differences between `dev-fenhl` and [`Dev-R`](https://github.com/Roman971/OoT-Ra
* “SDG Bingo Tournament 3” is a variant of “Bingo” used for an ongoing tournament. Note that the tournament itself is being played on version 8.0 of the randomizer, not this branch. See [the official document](https://docs.google.com/document/d/1fpDPSBGH9YQeC9W3P1SMDE7FhoikVgbFTJapqKnMmL4/edit) for details.
* Other changes:
* The cutscene that plays when defeating Morpha is shorter ([#2270](https://github.com/OoTRandomizer/OoT-Randomizer/pull/2270))
* Biggoron's dialog after turning in eyedrops is less misleading ([#2180](https://github.com/OoTRandomizer/OoT-Randomizer/pull/2180))
* On Wii Virtual Console, additional information is displayed while the game is loading and when it crashes ([#2153](https://github.com/OoTRandomizer/OoT-Randomizer/pull/2153))
* Plandos can specify different settings for each world ([#2055](https://github.com/OoTRandomizer/OoT-Randomizer/pull/2055))
* The text box no longer shows the player's own gold skulltula token count when finding a token for another player (part of [#2055](https://github.com/OoTRandomizer/OoT-Randomizer/pull/2055))
Expand Down Expand Up @@ -201,14 +200,19 @@ issue. You should always Hard Reset to avoid this issue entirely.

### Dev

#### New Settings and Options
* New options `Custom (count)` and `Custom (%)` for the `Ice Traps` setting.
* New hidden `plandomized_locations` setting to allow presets to place specific items at specific locations.
* New setting to speed up the boat ride in the Shadow Temple.
* New `Require Lens of Truth for Treasure Chest Game` setting.

#### Other Changes
* Now supports custom music written for the Majora's Mask Randomizer.
* New Magic Meter item model to allow magic drops to be shuffled in the future.
* New hidden `plandomized_locations` setting to allow presets to place specific items at specific locations.
* The first text box from each carpenter in the Thieves' Hideout is skipped.
* New setting to speed up the boat ride in the Shadow Temple.
* Seeds rolled on ootrandomizer.com display their ID in the top left corner of the file select screen.
* The `Other` tab of the generator has been rearranged for better grouping of settings, and the `One Major Item per Dungeon` setting has been moved there since it was causing frequent failures with `Randomize Main Rule Settings`.
* Biggoron's text after turning in the Eyedrops has been changed to avoid potential confusion.

### 8.2

Expand Down
15 changes: 15 additions & 0 deletions SettingsList.py
Original file line number Diff line number Diff line change
Expand Up @@ -3209,6 +3209,9 @@ class SettingInfos:
'Anywhere': Treasure Chest Game keys can appear anywhere
in the world.
''',
disable = {
'!vanilla': {'settings': ['tcg_requires_lens']}
},
shared = True,
gui_params = {
'randomize_key': 'randomize_settings',
Expand Down Expand Up @@ -4485,6 +4488,18 @@ class SettingInfos:
shared = True,
)

tcg_requires_lens = Checkbutton(
gui_text = 'Require Lens of Truth for Treasure Chest Game',
gui_tooltip = '''\
Force the player to always lose the
treasure chest game in the first room
unless they have the Lens of Truth.
Does not function if Treasure Chest Game
small keys are shuffled.
''',
shared = True,
)

no_collectible_hearts = Checkbutton(
gui_text = 'Hero Mode',
gui_tooltip = '''\
Expand Down
Loading

0 comments on commit bb584cf

Please sign in to comment.