Skip to content

Commit

Permalink
Merge 'Check for magic meter in �Require Lens of Truth for Treasure C…
Browse files Browse the repository at this point in the history
…hest Game�' (#2376)
  • Loading branch information
fenhl committed Feb 20, 2025
2 parents 3a2f706 + 09bc165 commit b24bfec
Show file tree
Hide file tree
Showing 11 changed files with 36,232 additions and 36,204 deletions.
1,474 changes: 738 additions & 736 deletions ASM/build/asm_symbols.txt

Large diffs are not rendered by default.

Binary file modified ASM/build/bundle.o
Binary file not shown.
910 changes: 455 additions & 455 deletions ASM/build/c_symbols.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ASM/c/item_upgrades.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ uint16_t upgrade_key_model(z64_file_t* save, override_t override) {
// 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
&& (save->items[Z64_SLOT_LENS] != Z64_ITEM_LENS || !save->magic_acquired)
&& z64_game.room_index != 0
) {
return GI_RUPEE_GREEN_LOSE; // Green Rupee (Chest Game)
Expand Down
2 changes: 1 addition & 1 deletion ASM/c/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ 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) {
if (z64_file.items[Z64_SLOT_LENS] != Z64_ITEM_LENS || !z64_file.magic_acquired) {
treasure_chest_game_show_message = 1;
}
}
Expand Down
30 changes: 20 additions & 10 deletions ASM/src/chest_game.asm
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,22 @@ chestgame_force_game_loss_left:
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
bne $t2, $t3, @@force_loss
nop
; simulate lost game
addiu $t0, $zero, 0x0071
j chestgame_warn_player_of_rigged_game
; check if player has magic
lb $t2, SAVE_CONTEXT + 0x3A ; magic_acquired
beqz $t2, @@force_loss
nop

@@return:
jr $ra
nop

@@force_loss:
; simulate lost game
addiu $t0, $zero, 0x0071
j chestgame_warn_player_of_rigged_game
nop

chestgame_force_game_loss_right:
; displaced code
lwc1 $f0, 0x0024($v0)
Expand All @@ -113,17 +118,22 @@ chestgame_force_game_loss_right:
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
bne $t2, $t3, @@force_loss
nop
; simulate lost game
addiu $v1, $zero, 0x0071
j chestgame_warn_player_of_rigged_game
; check if player has magic
lb $t2, SAVE_CONTEXT + 0x3A ; magic_acquired
beqz $t2, @@force_loss
nop

@@return:
jr $ra
nop

@@force_loss:
; simulate lost game
addiu $v1, $zero, 0x0071
j chestgame_warn_player_of_rigged_game
nop

; Add a helper message if the tcg_requires_lens
; setting is enabled and the player still attempts
; the game.
Expand Down
3 changes: 2 additions & 1 deletion SettingsList.py
Original file line number Diff line number Diff line change
Expand Up @@ -3911,7 +3911,8 @@ class SettingInfos:
gui_tooltip = '''\
Force the player to always lose the
treasure chest game in the first room
unless they have the Lens of Truth.
unless they have the Lens of Truth and
a Magic Meter.
Does not function if Treasure Chest Game
small keys are shuffled.
''',
Expand Down
2 changes: 1 addition & 1 deletion data/generated/patch_symbols.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b24bfec

Please sign in to comment.