Add door frame data for the multi-entrance caves. This will support

mixing single and multi-entrance caves.

I also added the alternate door frame table, which is needed for having
single entrance caves at
Sanctuary and Hyrule castle. (Added as a table rather than hard coding
the ids in order to be more friendly to level editors).

Updated the comments and function name to be clear that we are tracking
the overworld door
id, not the entrance id.

Remove the code that attempts to clear the entrance because the code is
broken (it lacked a needed ".w" suffix, so xkas miscompiled it) meaning
the value was never cleared, which has not caused any issues. Also
having the entrance ID around is generally useful.
This commit is contained in:
Kevin Cathcart
2018-01-21 14:48:16 -05:00
parent 7e8be73077
commit b3d8c23d89
3 changed files with 42 additions and 20 deletions

View File

@@ -3,17 +3,12 @@
;================================================================================
;--------------------------------------------------------------------------------
; StoreLastEntranceID
; StoreLastOverworldDoorID
;--------------------------------------------------------------------------------
StoreLastEntranceID:
CPX #$003a : BCC .noStore
TXA : SBC #$3a
BRA .done
.noStore
LDA #$00
.done
STA $7F5099
LDA $1BBB73, X : STA $010E
StoreLastOverworldDoorID:
TXA : INC
STA $7F5099
LDA $1BBB73, X : STA $010E
RTL
;--------------------------------------------------------------------------------
@@ -24,13 +19,12 @@ CacheDoorFrameData:
LDA $7F5099 : BEQ .originalBehaviour
DEC : ASL : TAX
LDA EntranceDoorFrameTable, X : STA $0696
LDA EntranceAltDoorFrameTable, X : STA $0698
BRA .done
.originalBehaviour
LDA $D724, X : STA $0696
.done
STZ $0698
LDA #$00
STA $7F5099
.done
RTL
;--------------------------------------------------------------------------------
@@ -39,6 +33,7 @@ RTL
;--------------------------------------------------------------------------------
WalkDownIntoTavern:
LDA $7F5099
CMP #$08
; tavern door has index 0x42 (saved off value is incremented by one)
CMP #$43
RTL
;--------------------------------------------------------------------------------

View File

@@ -1926,12 +1926,12 @@ JSL.l SetOverlayIfLamp
; Overworld Door Frame Overlay Fix
;
; When entering an overworld entrance, if it is an entrance to a simple cave, we
; store the entrance id, then use that (instead of the cave id) to determine the
; store the overworld door id, then use that (instead of the cave id) to determine the
; overlay to draw when leaving the cave again. We also use this value to
; identify the tavern entrance to determine whether link should walk up or down.
;--------------------------------------------------------------------------------
org $1BBD5F ; <- Bank1b.asm:296 (LDA $1BBB73, X : STA $010E)
JSL.l StoreLastEntranceID
JSL.l StoreLastOverworldDoorID
NOP #3
;--------------------------------------------------------------------------------
org $02D754 ; <- Bank02.asm:10847 (LDA $D724, X : STA $0696 : STZ $0698)
@@ -1979,4 +1979,3 @@ org $00DF62 ; <- Bank00.asm:4672 (LDX.w #$0000 : LDY.w #$0040)
org $00DF6E ; <- A few instructions later, right after JSR Do3To4High16Bit
ReloadingFloorsCancel:
;================================================================================

View File

@@ -1288,7 +1288,7 @@ dw #9999 ; Rupee Limit
; $7F5096 - Dialog Offset Pointer Return (Low)
; $7F5097 - Dialog Offset Pointer Return (High)
; $7F5098 - Water Entry Index
; $7F5099 - Last Entered Entrance
; $7F5099 - Last Entered Overworld Door ID
; $7F50A0 - Event Parameter 1
@@ -1331,8 +1331,18 @@ db $83, $21, $EB, $6E, $0A, $71, $B0, $11, $85, $C7, $A1, $FD, $E5, $16, $48, $F
db $F2, $23, $2F, $28, $9B, $AA, $AB, $D0, $6A, $9D, $C6, $2D, $00, $FE, $E1, $3F
db $A0, $4A, $B8, $4E, $74, $1F, $8E, $A9, $F5, $CD, $60, $91, $DB, $D8, $52, $E2
;================================================================================
org $30A100 ; PC 0x182100 - 0x18218C
org $30A100 ; PC 0x182100 - 0x182304
EntranceDoorFrameTable:
; data for multi-entrance caves
dw $0816, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $05cc, $05d4, $0bb6, $0b86
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000
; simple caves:
dw $0000, $0000, $0DE8, $0B98, $14CE, $0000, $1C50, $FFFF
dw $1466, $0000, $1AB6, $0B98, $1AB6, $040E, $9C0C, $1530
dw $0A98, $0000, $0000, $0000, $0000, $0000, $0000, $0816
@@ -1342,6 +1352,24 @@ dw $041A, $0000, $091E, $09AC, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0AA8, $07AA, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000
EntranceAltDoorFrameTable:
dw $0000, $01aa, $8124, $87be, $8158, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $82be, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000,
dw $0000
;===============================================================================
org $30B000 ; PC 0x183000 - 0x183054
StartingEquipment:
@@ -1371,4 +1399,4 @@ db $FF, $AF, $50, $00
db $FF, $27, $0A, $00
db $FF, $12, $F4, $01
db $FF, $FF, $FF, $FF
;================================================================================
;================================================================================