Skip to content

Commit 6d55e1b

Browse files
committed
Fixed pyramid signs and backported ALTTPR fixes.
1 parent ec584d2 commit 6d55e1b

12 files changed

+740
-67
lines changed

src/sm/items.asm

+4-4
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ item_graphics:
109109
dw $000C : db $00, $00, $00, $00, $00, $00, $00, $00 ; Super Missile
110110
dw $000E : db $00, $00, $00, $00, $00, $00, $00, $00 ; Power Bomb
111111

112-
dw $0000 : db $00, $00, $00, $00, $00, $00, $00, $00 ; C5 - Unused
113-
dw $0000 : db $00, $00, $00, $00, $00, $00, $00, $00 ; C6 - Unused
114-
dw $0000 : db $00, $00, $00, $00, $00, $00, $00, $00 ; C7 - Unused
115-
dw $0000 : db $00, $00, $00, $00, $00, $00, $00, $00 ; C8 - Unused
112+
dw $0000 : db $00, $00, $00, $00, $00, $00, $00, $00 ; C5 - Kraid Boss Token
113+
dw $0000 : db $00, $00, $00, $00, $00, $00, $00, $00 ; C6 - Phantoon Boss Token
114+
dw $0000 : db $00, $00, $00, $00, $00, $00, $00, $00 ; C7 - Draygon Boss Token
115+
dw $0000 : db $00, $00, $00, $00, $00, $00, $00, $00 ; C8 - Ridley Boss Token
116116
dw $0000 : db $00, $00, $00, $00, $00, $00, $00, $00 ; C9 - Unused
117117
dw $0000 : db $00, $00, $00, $00, $00, $00, $00, $00 ; CA - Unused
118118
dw $0000 : db $00, $00, $00, $00, $00, $00, $00, $00 ; CB - Unused

src/sm/minorfixes.asm

+30-30
Original file line numberDiff line numberDiff line change
@@ -70,35 +70,35 @@ org $c39a7a
7070
dw NewLNRefillRoom
7171

7272

73-
; During horizontal door transitions, the "ready for NMI" flag is set by IRQ at the bottom of the door as an optimisation,
74-
; but the PLM drawing routine hasn't necessarily finished processing yet.
75-
; The Kraid quick kill vomit happens because NMI actually interrupts the PLM drawing routine for the PLM that clears the spike floor,
76-
; *whilst* it's in the middle of writing entries to the $D0 table, which the NMI processes.
77-
78-
; This fix simply clears this NMI-ready flag for the duration of the PLM drawinging routine.
79-
; Squeeze this into the freespace before the free space used by items.asm
80-
org $c4efd3
81-
base $84efd3
82-
83-
drawPlmSafe:
84-
{
85-
stz.w $05B4 ; Not ready for NMI
86-
jsr $8DAA ; Draw PLM
87-
inc.w $05B4 ; Ready for NMI
88-
rts
89-
90-
warnpc $84efe0
91-
}
92-
93-
; Patch calls to draw PLM
94-
org $c4861a ; End of PLM processing. Probably the only particularly important one to patch
95-
base $84861a
96-
jsr drawPlmSafe
97-
98-
; org $c48b50 ; End of block respawn instruction. Shouldn't need patching
99-
; base $848b50
73+
; ; During horizontal door transitions, the "ready for NMI" flag is set by IRQ at the bottom of the door as an optimisation,
74+
; ; but the PLM drawing routine hasn't necessarily finished processing yet.
75+
; ; The Kraid quick kill vomit happens because NMI actually interrupts the PLM drawing routine for the PLM that clears the spike floor,
76+
; ; *whilst* it's in the middle of writing entries to the $D0 table, which the NMI processes.
77+
78+
; ; This fix simply clears this NMI-ready flag for the duration of the PLM drawinging routine.
79+
; ; Squeeze this into the freespace before the free space used by items.asm
80+
; org $c4efd3
81+
; base $84efd3
82+
83+
; drawPlmSafe:
84+
; {
85+
; stz.w $05B4 ; Not ready for NMI
86+
; jsr $8DAA ; Draw PLM
87+
; inc.w $05B4 ; Ready for NMI
88+
; rts
89+
90+
; warnpc $84efe0
91+
; }
92+
93+
; ; Patch calls to draw PLM
94+
; org $c4861a ; End of PLM processing. Probably the only particularly important one to patch
95+
; base $84861a
10096
; jsr drawPlmSafe
10197

102-
org $c4e094 ; End of animated PLM drawing instruction. Could theoretically happen...
103-
base $84e094
104-
jsr drawPlmSafe
98+
; ; org $c48b50 ; End of block respawn instruction. Shouldn't need patching
99+
; ; base $848b50
100+
; ; jsr drawPlmSafe
101+
102+
; org $c4e094 ; End of animated PLM drawing instruction. Could theoretically happen...
103+
; base $84e094
104+
; jsr drawPlmSafe

src/z3/randomizer/bugfixes.asm

+89
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,92 @@ FixFrogSmith:
115115
.done
116116
RTS
117117
;--------------------------------------------------------------------------------
118+
119+
;--------------------------------------------------------------------------------
120+
; Fix for SQ jumping causing accidental Exploration Glitch
121+
SQEGFix:
122+
LDA.l Bugfix_PodEG : BEQ ++
123+
STZ.w $047A ; disarm exploration glitch
124+
++ RTL
125+
126+
;--------------------------------------------------------------------------------
127+
; Fix crystal not spawning when using somaria vs boss
128+
TryToSpawnCrystalUntilSuccess:
129+
STX $02D8 ; what we overwrote
130+
JSL AddAncillaLong : BCS .failed ; a clear carry flag indicates success
131+
.spawned
132+
STZ $AE ; the "trying to spawn crystal" flag
133+
STZ $AF ; the "trying to spawn pendant" flag
134+
.failed
135+
RTL
136+
137+
;--------------------------------------------------------------------------------
138+
; Fix crystal not spawning when using somaria vs boss
139+
WallmasterCameraFix:
140+
STZ $A7 ; disable vertical camera scrolling for current room
141+
REP #$20
142+
STZ $0618 ; something about scrolling, setting these to 0 tricks the game
143+
STZ $061A ; into thinking we're at the edge of the room so it doesn't scroll.
144+
SEP #$20
145+
JML Sound_SetSfx3PanLong ; what we wrote over, also this will RTL
146+
147+
;--------------------------------------------------------------------------------
148+
; Fix losing glove colors
149+
LoadActualGearPalettesWithGloves:
150+
REP #$20
151+
LDA $7EF359 : STA $0C
152+
LDA $7EF35B : AND.w #$00FF
153+
JSL LoadGearPalettes_variable
154+
JSL SpriteSwap_Palette_ArmorAndGloves_part_two
155+
RTL
156+
157+
;--------------------------------------------------------------------------------
158+
; Fix Bunny Palette Map Bug
159+
LoadGearPalette_safe_for_bunny:
160+
LDA $10
161+
CMP.w #$030E : BEQ .new ; opening dungeon map
162+
CMP.w #$070E : BEQ .new ; opening overworld map
163+
.original
164+
-
165+
LDA [$00]
166+
STA $7EC300, X
167+
STA $7EC500, X
168+
INC $00 : INC $00
169+
INX #2
170+
DEY
171+
BPL -
172+
RTL
173+
.new
174+
-
175+
LDA [$00]
176+
STA $7EC500, X
177+
INC $00 : INC $00
178+
INX #2
179+
DEY
180+
BPL -
181+
RTL
182+
183+
;--------------------------------------------------------------------------------
184+
; Fix pedestal pull overlay
185+
PedestalPullOverlayFix:
186+
LDA.b #$09 : STA $039F, X ; the thing we wrote over
187+
LDA $1B : BNE +
188+
LDA $8A : CMP.b #$80 : BNE +
189+
LDA $8C : CMP.b #$97
190+
+
191+
RTL
192+
193+
;--------------------------------------------------------------------------------
194+
FixJingleGlitch:
195+
LDA.b $11
196+
BEQ .set_doors
197+
198+
LDA.l AllowAccidentalMajorGlitch
199+
BEQ .exit
200+
201+
.set_doors
202+
LDA.b #$05
203+
STA.b $11
204+
205+
.exit
206+
RTL

src/z3/randomizer/dialog.asm

+112
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,118 @@ RTL
447447
; %LoadDialogAddress(BombShopGuyText)
448448
; JSL.l Sprite_ShowMessageUnconditional
449449
; RTL
450+
451+
452+
DialogGanon1:
453+
JSL.l CheckGanonVulnerability
454+
REP #$20
455+
LDA.w #$018C
456+
BCC +
457+
LDA.w #$016D
458+
+ STA $1CF0
459+
SEP #$20
460+
JSL.l Sprite_ShowMessageMinimal_Alt
461+
RTL
462+
463+
DialogGanon2:
464+
JSL.l CheckGanonVulnerability
465+
466+
REP #$20
467+
BCS +
468+
LDA.w #$018D : BRA ++
469+
+
470+
LDA.l $7EF38E
471+
472+
BIT.w #$0080 : BNE + ; branch if bow
473+
LDA.w #$0192 : BRA ++
474+
+
475+
BIT.w #$0040 : BEQ + ; branch if no silvers
476+
LDA.w #$0195 : BRA ++
477+
+
478+
BIT.w #$0020 : BNE + ; branch if p bow
479+
LDA.w #$0194 : BRA ++
480+
+
481+
BIT.w #$0080 : BEQ + ; branch if no bow
482+
LDA.w #$0193 : BRA ++
483+
+
484+
LDA.w #$016E
485+
++
486+
STA $1CF0
487+
SEP #$20
488+
JSL.l Sprite_ShowMessageMinimal_Alt
489+
RTL
490+
491+
Main_ShowTextMessage_Alt:
492+
; Are we in text mode? If so then end the routine.
493+
LDA $10 : CMP.b #$0E : BEQ .already_in_text_mode
494+
Sprite_ShowMessageMinimal_Alt:
495+
STZ $11
496+
497+
PHX : PHY
498+
PEI ($00)
499+
LDA.b $02 : PHA
500+
501+
LDA.b #$1C : STA.b $02
502+
REP #$30
503+
LDA.w $1CF0 : ASL : TAX
504+
LDA.l $7F71C0, X
505+
STA.b $00
506+
SEP #$30
507+
508+
LDY.b #$00
509+
LDA [$00], Y : CMP.b #$FE : BNE +
510+
INY : LDA [$00], Y : CMP.b #$6E : BNE +
511+
INY : LDA [$00], Y : : BNE +
512+
INY : LDA [$00], Y : CMP.b #$FE : BNE +
513+
INY : LDA [$00], Y : CMP.b #$6B : BNE +
514+
INY : LDA [$00], Y : CMP.b #$04 : BNE +
515+
STZ $1CE8
516+
JMP .end
517+
+
518+
519+
STZ $0223 ; Otherwise set it so we are in text mode.
520+
STZ $1CD8 ; Initialize the step in the submodule
521+
522+
; Go to text display mode (as opposed to maps, etc)
523+
LDA.b #$02 : STA $11
524+
525+
; Store the current module in the temporary location.
526+
LDA $10 : STA $010C
527+
528+
; Switch the main module ($10) to text mode.
529+
LDA.b #$0E : STA $10
530+
.end
531+
PLA : STA.b $02
532+
PLA : STA.b $01
533+
PLA : STA.b $00
534+
PLY : PLX
535+
536+
Main_ShowTextMessage_Alt_already_in_text_mode:
537+
RTL
538+
539+
CalculateSignIndex:
540+
; for the big 1024x1024 screens we are calculating link's effective
541+
; screen area, as though the screen was 4 different 512x512 screens.
542+
; And we do this in a way that will likely give the right value even
543+
; with major glitches.
544+
545+
LDA $8A : ASL A : TAY ;what we wrote over
546+
547+
LDA $0712 : BEQ .done ; If a small map, we can skip these calculations.
548+
549+
LDA $21 : AND.w #$0002 : ASL #2 : EOR $8A : AND.w #$0008 : BEQ +
550+
TYA : !ADD.w #$0010 : TAY ;add 16 if we are in lower half of big screen.
551+
+
552+
553+
LDA $23 : AND.w #$0002 : LSR : EOR $8A : AND.w #$0001 : BEQ +
554+
TYA : INC #2 : TAY ;add 16 if we are in lower half of big screen.
555+
+
556+
; ensure even if things go horribly wrong, we don't read the sign out of bounds and crash:
557+
TYA : AND.w #$00FF : TAY
558+
559+
.done
560+
RTL
561+
450562
;--------------------------------------------------------------------------------
451563
; A0 - A9 - 0 - 9
452564
; AA - C3 - A - Z

0 commit comments

Comments
 (0)