Add weak glove and rewind clocks

This commit is contained in:
2024-11-21 20:53:42 -06:00
parent 86f641b710
commit 87249343ed
9 changed files with 418 additions and 11 deletions

View File

@@ -157,6 +157,8 @@ incsrc msu.asm
incsrc dungeonmap.asm
incsrc hextodec.asm
incsrc textrenderer.asm
incsrc rewind.asm
incsrc lift.asm
warnpc $A58000
org $A28000

Binary file not shown.

View File

@@ -123,6 +123,12 @@ OnFileCreation:
MVN CartridgeSRAM>>16, InitSRAMTable>>16
PLB
; initialize rewind table
LDA.w #$0000
STA.l RewindTrigger
LDA.w #$FFFF
STA.l RewindRoomId
; Resolve instant post-aga if standard
SEP #$20
LDA.l InitProgressIndicator : BIT #$80 : BEQ +
@@ -290,6 +296,16 @@ PostItemAnimation:
INC.b NMICGRAM
SEP #$20
LDA.l RewindTrigger
BEQ +
LDA.b #$19
STA.b $11
STZ.b $B0
LDA.b #$33
STA.w $012E
+
STZ.w ItemReceiptMethod : LDA.w AncillaGet, X ; thing we wrote over to get here
PLB
RTL

View File

@@ -1487,8 +1487,9 @@ JSL SpiralStairsPreCheck
org $829069 ; <- A21C A5A0 - Bank02.asm:3081 (LDX.b #$1C : LDA $A0)
JSL SpiralStairsPostCheck
org $82D6E8 ; <- 9C0A01 - Bank02.asm:10811 (STZ $010A)
NOP #3
; this is covered by a hook in rewind.asm
; org $82D6E8 ; <- 9C0A01 - Bank02.asm:10811 (STZ $010A)
; NOP #3
org $88C421 ; <- AD4021 F005 - ancilla_receive_item.asm:108 (LDA $2140 : BEQ .wait_for_music)
JML PendantFanfareWait : NOP

View File

@@ -163,8 +163,8 @@ endmacro
%ReceiptProps($18, -4, 4, $07, $F351, $01, skip, skip) ; 18 - Byrna
%ReceiptProps($19, -4, 0, $15, $F352, $01, skip, skip) ; 19 - Cape
%ReceiptProps($1A, -4, 0, $12, $F353, $02, skip, skip) ; 1A - Mirror
%ReceiptProps($1B, -4, 0, $0D, $F354, $01, skip, skip) ; 1B - Glove
%ReceiptProps($1C, -4, 0, $0D, $F354, $02, skip, skip) ; 1C - Mitts
%ReceiptProps($1B, -4, 0, $0D, $F354, $02, skip, skip) ; 1B - Glove
%ReceiptProps($1C, -4, 0, $0D, $F354, $03, skip, skip) ; 1C - Mitts
%ReceiptProps($1D, -4, 0, $0E, $F34E, $01, skip, skip) ; 1D - Book
%ReceiptProps($1E, -4, 0, $11, $F356, $01, skip, skip) ; 1E - Flippers
%ReceiptProps($1F, -4, 0, $17, $F357, $01, skip, skip) ; 1F - Pearl
@@ -238,7 +238,7 @@ endmacro
%ReceiptProps($63, -4, 0, $FF, $F36A, $FF, skip, rng_multi) ; 63 - RNG pool item (multi)
%ReceiptProps($64, -4, 0, $FF, $F340, $FF, skip, progressive_bow) ; 64 - Progressive bow
%ReceiptProps($65, -4, 0, $FF, $F340, $FF, skip, progressive_bow_2) ; 65 - Progressive bow
%ReceiptProps($66, -4, 0, $FF, $F36A, $FF, skip, skip) ; 66 -
%ReceiptProps($66, -4, 0, $51, $F354, $01, skip, skip) ; 66 - Weak Glove
%ReceiptProps($67, -4, 0, $FF, $F36A, $FF, skip, skip) ; 67 -
%ReceiptProps($68, -4, 0, $FF, $F36A, $FF, skip, skip) ; 68 -
%ReceiptProps($69, -4, 0, $FF, $F36A, $FF, skip, skip) ; 69 -
@@ -517,7 +517,7 @@ endmacro
%SpriteProps($63, 2, 2, $FF, $FF, $0000) ; 63 - RNG pool item (multi)
%SpriteProps($64, 2, 2, $FF, $FF, $0000) ; 64 - Progressive bow
%SpriteProps($65, 2, 2, $FF, $FF, $0000) ; 65 - Progressive bow
%SpriteProps($66, 2, 2, $00, $00, $0000) ; 66 -
%SpriteProps($66, 2, 2, $01, $01, PalettesVanilla_red_melon+$0E) ; 66 - Weak Glove
%SpriteProps($67, 2, 2, $00, $00, $0000) ; 67 -
%SpriteProps($68, 2, 2, $00, $00, $0000) ; 68 -
%SpriteProps($69, 2, 2, $00, $00, $0000) ; 69 -
@@ -793,7 +793,7 @@ endmacro
%InventoryItem($63, $0001, $0000, $0000) ; 63 - RNG pool item (multi)
%InventoryItem($64, $00A5, $0000, $0000) ; 64 - Progressive bow
%InventoryItem($65, $00A5, $0000, $0000) ; 65 - Progressive bow
%InventoryItem($66, $0001, $0000, $0000) ; 66 -
%InventoryItem($66, $0089, $0000, $0000) ; 66 - Weak Glove
%InventoryItem($67, $0001, $0000, $0000) ; 67 -
%InventoryItem($68, $0001, $0000, $0000) ; 68 -
%InventoryItem($69, $0001, $0000, $0000) ; 69 -
@@ -1053,7 +1053,7 @@ ItemReceiptGraphicsOffsets:
dw $0 ; 63 - RNG pool item (multi)
dw $0 ; 64 - Progressive bow
dw $0 ; 65 - Progressive bow
dw $0 ; 66 -
dw $0C60 ; 66 - Weak Glove
dw $0 ; 67 -
dw $0 ; 68 -
dw $0 ; 69 -
@@ -1323,7 +1323,7 @@ StandingItemGraphicsOffsets:
dw $0 ; 63 - RNG pool item (multi)
dw $0 ; 64 - Progressive bow
dw $0 ; 65 - Progressive bow
dw $0 ; 66 -
dw $0C60 ; 66 - Weak Glove
dw $0 ; 67 -
dw $0 ; 68 -
dw $0 ; 69 -

45
lift.asm Normal file
View File

@@ -0,0 +1,45 @@
pushpc
org $87D35E
db $01, $02, $01, $01, $03, $02, $03
org $8DF809
MenuEquipmentIcons:
.gloves
dw $20F5, $20F5, $20F5, $20F5 ; No glove
dw $3CDA, $3CDB, $3CEA, $3CEB ; Weak glove
dw $2130, $2131, $2140, $2141 ; Power glove
dw $28DA, $28DB, $28EA, $28EB ; Titan's mitt
.boots
dw $20F5, $20F5, $20F5, $20F5 ; No boots
dw $3429, $342A, $342B, $342C ; Pegasus boots
.flippers
dw $20F5, $20F5, $20F5, $20F5 ; No flippers
dw $2C9A, $2C9B, $2C9D, $2C9E ; Flippers
.pearl
dw $20F5, $20F5, $20F5, $20F5 ; No pearl
dw $2433, $2434, $2435, $2436 ; Moon pearl
org $8DE7C7
LDA.w #MenuEquipmentIcons_gloves
org $8DE7DD
LDA.w #MenuEquipmentIcons_boots
org $8DE7F3
LDA.w #MenuEquipmentIcons_flippers
org $8DECF9
LDA.w #MenuEquipmentIcons_pearl
org $8DFADB
dw MenuEquipmentIcons_gloves
dw MenuEquipmentIcons_boots
dw MenuEquipmentIcons_flippers
dw MenuEquipmentIcons_pearl
pullpc

View File

@@ -442,6 +442,22 @@ ItemBehavior:
.red_clock
REP #$20 ; set 16-bit accumulator
LDA.l RewindRoomId
CMP.w #$FFFF
BEQ +
; restore
SEP #$20
LDA.b #$01
STA.l RewindTrigger
RTS
; save
+
JSL.l SaveRewind
SEP #$20
RTS
LDA.l ChallengeTimer : !ADD.l RedClockAmount : STA.l ChallengeTimer
LDA.l ChallengeTimer+2 : ADC.l RedClockAmount+2 : STA.l ChallengeTimer+2
SEP #$20 ; set 8-bit accumulator
@@ -760,12 +776,13 @@ ResolveLootID:
.gloves
print ".gloves ", pc
SEP #$20
LDA.l GloveEquipment : TAX
LDA.w .gloves_ids,X
JMP.w .have_item
..ids
db $1B, $1C, $1C
db $66, $1B, $1C, $1C
.progressive_bow
; For non-chest progressive bows we assign the tracking bits to SpriteMetaData,X

298
rewind.asm Normal file
View File

@@ -0,0 +1,298 @@
pushpc
org $82D6E2
JSL CheckLoadRewind
BCC +
JMP.w $D83F
+
pullpc
; pushpc
; org $87A46E
; JSL CheckBookTriggerSave
; pullpc
CheckBookTriggerSave:
LDA.b $10
CMP.b #$07
BNE +
JSL SaveRewind
; what we wrote over
+ LDA.b $3A
AND.b #$BF
RTL
CheckLoadRewind:
; what we wrote over
STZ.w $011A
STZ.w $011C
; STZ.w $010A ; removed for MSU patch anyway
LDA.l RewindTrigger
AND.w #$00FF
BEQ .no_state
JSR.w LoadRewind
SEC
RTL
.no_state
LDA.l $7EF3CC ; rest of what we wrote over
CLC
RTL
LoadRewind:
LDA.l RewindDungeonEntrance
STA.w $010E
LDA.l RewindRoomId
STA.b $A0
STA.w $048E
LDA.l RewindVerticalScroll
STA.b $E8
STA.b $E6
STA.w $0122
STA.w $0124
LDA.l RewindHorizontalScroll
STA.b $E2
STA.b $E0
STA.w $011E
STA.w $0120
LDA.l RewindYCoordinate
STA.b $20
LDA.l RewindXCoordinate
STA.b $22
LDA.l RewindCameraTriggerY
STA.w $0618
INC A
INC A
STA.w $061A
LDA.l RewindCameraTriggerX
STA.w $061C
INC A
INC A
STA.w $061E
LDA.w #$01F8
STA.b $EC
LDA.l RewindOverworldDoorTilemap
STA.w $0696
STZ.w $0698
LDA.w #$0000
STA.w $0610
LDA.w #$0110
STA.w $0612
LDA.w #$0000
STA.w $0614
LDA.w #$0100
STA.w $0616
SEP #$20
LDA.l RewindCameraScrollBoundaries
STA.w $0601
LDA.l RewindCameraScrollBoundaries+1
STA.w $0603
LDA.l RewindCameraScrollBoundaries+2
STA.w $0605
LDA.l RewindCameraScrollBoundaries+3
STA.w $0607
LDA.l RewindCameraScrollBoundaries+4
STA.w $0609
LDA.l RewindCameraScrollBoundaries+5
STA.w $060B
LDA.l RewindCameraScrollBoundaries+6
STA.w $060D
LDA.l RewindCameraScrollBoundaries+7
STA.w $060F
STZ.w $0600
STZ.w $0602
LDA.b #$10
STA.w $0604
STA.w $0606
STZ.w $0608
STZ.w $060A
STZ.w $060C
STZ.w $060E
LDA.l RewindLinkFacing
STA.b $2F
LDA.l RewindMainGFX
STA.w $0AA1
LDA.l RewindSong
STA.w $0132
LDA.l RewindFloor
STA.b $A4
LDA.l RewindDungeonId
STA.w $040C
LDA.l Rewind_6C
STA.b $6C
LDA.l Rewind_EE
STA.b $EE
LDA.l Rewind_0476
STA.w $0476
LDA.l Rewind_A6
STA.b $A6
LDA.l Rewind_A7
STA.b $A7
LDA.l Rewind_A9
STA.b $A9
LDA.l Rewind_AA
STA.b $AA
STZ.w $02E4
PHP
REP #$30
LDA.w #$0000
STA.l RewindTrigger
LDA.w #$FFFF
STA.l RewindRoomId
PHB
LDX.w #RewindSRAM
LDY.w #SaveDataWRAM
LDA.w #$4FF
MVN SaveDataWRAM>>16, RewindSRAM>>16
PLB
PLP
RTS
SaveRewind:
PHP
REP #$20
LDA.w $010E
STA.l RewindDungeonEntrance
LDA.b $A0
STA.l RewindRoomId
LDA.b $E8
STA.l RewindVerticalScroll
LDA.b $E2
STA.l RewindHorizontalScroll
LDA.b $20
STA.l RewindYCoordinate
LDA.b $22
STA.l RewindXCoordinate
LDA.w $0618
STA.l RewindCameraTriggerY
LDA.w $061C
STA.l RewindCameraTriggerX
LDA.w $0696
STA.l RewindOverworldDoorTilemap
SEP #$20
LDA.w $0601
STA.l RewindCameraScrollBoundaries
LDA.w $0603
STA.l RewindCameraScrollBoundaries+1
LDA.w $0605
STA.l RewindCameraScrollBoundaries+2
LDA.w $0607
STA.l RewindCameraScrollBoundaries+3
LDA.w $0609
STA.l RewindCameraScrollBoundaries+4
LDA.w $060B
STA.l RewindCameraScrollBoundaries+5
LDA.w $060D
STA.l RewindCameraScrollBoundaries+6
LDA.w $060F
STA.l RewindCameraScrollBoundaries+7
LDA.b $2F
STA.l RewindLinkFacing
LDA.w $0AA1
STA.l RewindMainGFX
LDA.w $0132
STA.l RewindSong
LDA.b $A4
STA.l RewindFloor
LDA.w $040C
STA.l RewindDungeonId
LDA.b $6C
STA.l Rewind_6C
LDA.b $EE
STA.l Rewind_EE
LDA.w $0476
STA.l Rewind_0476
LDA.b $A6
STA.l Rewind_A6
LDA.b $A7
STA.l Rewind_A7
LDA.b $A9
STA.l Rewind_A9
LDA.b $AA
STA.l Rewind_AA
PHB
REP #$30
LDX #SaveDataWRAM
LDY #RewindSRAM
LDA #$4FF
MVN RewindSRAM>>16, SaveDataWRAM>>16
PLB
PLP
RTL

View File

@@ -426,7 +426,35 @@ RomVersionSRAM: skip 4 ; ALTTPR ROM version. Low byte is the version, h
RomNameSRAM: skip 21 ; ROM name from $FFC0, burned in during init (21 bytes)
; If value in the ROM doesn't match SRAM, save is cleared.
PasswordSRAM: skip 16 ; Password value (16 bytes)
skip 8155 ;
RewindTrigger: skip 1
RewindDungeonEntrance: skip 2
RewindRoomId: skip 2
RewindVerticalScroll: skip 2
RewindHorizontalScroll: skip 2
RewindYCoordinate: skip 2
RewindXCoordinate: skip 2
RewindCameraTriggerY: skip 2
RewindCameraTriggerX: skip 2
RewindOverworldDoorTilemap: skip 2
RewindCameraScrollBoundaries: skip 8
RewindLinkFacing: skip 1
RewindMainGFX: skip 1
RewindSong: skip 1
RewindFloor: skip 1
RewindDungeonId: skip 1
Rewind_6C: skip 1
Rewind_EE: skip 1
Rewind_0476: skip 1
Rewind_A6: skip 1
Rewind_A7: skip 1
Rewind_A9: skip 1
Rewind_AA: skip 1
skip $B4
RewindSRAM: skip $1500
skip $A00 ;
SaveBackupSRAM: ; Backup copy of save ram. Game will attempt to use this if
; checksum on file select screen load fails.
base off