move entrances to overworld dir

This commit is contained in:
scawful
2024-06-18 10:58:19 -04:00
parent dcc61db456
commit 739aa21a51
4 changed files with 145 additions and 215 deletions

View File

@@ -35,8 +35,7 @@ incsrc "Collision/GlobalCollisionTables.asm"
pullpc ; Bank 0x33 pullpc ; Bank 0x33
incsrc "Dungeons/entrances.asm"
print "End of entrances.asm ", pc
incsrc "Dungeons/house_walls.asm" incsrc "Dungeons/house_walls.asm"

View File

@@ -13,6 +13,7 @@ org $1BBBF4
RTL RTL
pullpc pullpc
Overworld_UseEntranceEntry: Overworld_UseEntranceEntry:
{ {
PHB : PHK : PLB PHB : PHK : PLB
@@ -22,75 +23,44 @@ Overworld_UseEntranceEntry:
} }
Overworld_UseEntrance: Overworld_UseEntrance:
{
REP #$31 REP #$31
LDA.b $20 LDA.b $20 : CLC : ADC.w #$0007 : STA.b $00
CLC SEC : SBC.w $0708 : AND.w $070A
ADC.w #$0007 ASL #3
STA.b $00
SEC
SBC.w $0708
AND.w $070A
ASL A
ASL A
ASL A
STA.b $06 STA.b $06
LDA.b $22 LDA.b $22 : LSR #3 : STA.b $02
LSR A SEC : SBC.w $070C : AND.w $070E
LSR A CLC : ADC.b $06
LSR A
STA.b $02
SEC
SBC.w $070C
AND.w $070E
CLC
ADC.b $06
TAY TAY
TAX TAX
LDA.l $7E2000, X LDA.l $7E2000, X
ASL A ASL #3
ASL A
ASL A
TAX TAX
LDA.b $2F LDA.b $2F : AND.w #$00FF : BNE .not_facing_up
AND.w #$00FF
BNE .not_facing_up
LDA.l Map16Definitions+2, X LDA.l Map16Definitions+2, X
AND.w #$41FF AND.w #$41FF : CMP.w #$00E9 : BEQ .open_door
CMP.w #$00E9 CMP.w #$0149 : BEQ .left_side_castle_door
BEQ .open_door CMP.w #$0169 : BEQ .left_side_castle_door
CMP.w #$0149
BEQ .left_side_castle_door
CMP.w #$0169
BEQ .left_side_castle_door
TYX TYX
LDA.l $7E2002, X LDA.l $7E2002, X
ASL A ASL #3
ASL A
ASL A
TAX TAX
LDA.l Map16Definitions+0, X LDA.l Map16Definitions+0, X
AND.w #$41FF AND.w #$41FF : CMP.w #$4149 : BEQ .right_side_castle_door
CMP.w #$4149
BEQ .right_side_castle_door
CMP.w #$4169 CMP.w #$4169 : BEQ .right_side_castle_door
BEQ .right_side_castle_door
CMP.w #$40E9 CMP.w #$40E9 : BNE .check_door_type
BNE .check_door_type
DEY DEY
DEY DEY
@@ -98,27 +68,22 @@ DEY
.open_door .open_door
TYX TYX
LDA.w #$0DA4 LDA.w #$0DA4 : JSL Overworld_DrawMap16_Persist
JSL Overworld_DrawMap16_Persist
LDA.w #$0DA6 LDA.w #$0DA6 : STA.l $7E2002, X
STA.l $7E2002,X
LDY.w #$0002 LDY.w #$0002
JSL Overworld_DrawMap16_Anywhere JSL Overworld_DrawMap16_Anywhere
SEP #$30 SEP #$30
LDA.b #$15 ; SFX3.15 ; SFX3.15
STA.w $012F LDA.b #$15 : STA.w $012F
LDA.b #$01 LDA.b #$01 : STA.b $14
STA.b $14
RTL RTL
.not_facing_up .not_facing_up
BRA .check_door_type BRA .check_door_type
@@ -127,62 +92,36 @@ DEY
DEY DEY
.left_side_castle_door .left_side_castle_door
STZ.w $0692 STZ.w $0692 : AND.w #$03FF : CMP.w #$0169 : BNE .open_this_castle_door
LDA.l $7EF3C5 : AND.w #$000F : CMP.w #$0002 : BCS .check_door_type
AND.w #$03FF LDA.w #$0018 : STA.w $0692
CMP.w #$0169
BNE .open_this_castle_door
LDA.l $7EF3C5
AND.w #$000F
CMP.w #$0003
BCS .check_door_type
LDA.w #$0018
STA.w $0692
.open_this_castle_door .open_this_castle_door
TYA TYA : SEC : SBC.w #$0080 : STA.w $0698
SEC
SBC.w #$0080
STA.w $0698
SEP #$20 SEP #$20
LDA.b #$15 ; SFX3.15 ; SFX3.15
STA.w $012F LDA.b #$15 : STA.w $012F
STZ.b $B0 STZ.b $B0
STZ.w $0690 STZ.w $0690
LDA.b #$0C LDA.b #$0C : STA.b $11
STA.b $11
SEP #$30 SEP #$30
RTL RTL
.check_door_type .check_door_type
LDA.l Map16Definitions+4,X LDA.l Map16Definitions+4, X : AND.w #$01FF : STA.b $00
AND.w #$01FF LDA.l Map16Definitions+6, X : AND.w #$01FF : STA.b $02
STA.b $00
LDA.l Map16Definitions+6,X
AND.w #$01FF
STA.b $02
; Size of ValidDoorTypes
LDX.w #$0058 LDX.w #$0058
.check_next .check_next
LDA.b $00 LDA.b $00 : CMP.l ValidDoorTypesExpanded_low, X : BNE .low_byte_fail
CMP.l ValidDoorTypesExpanded_low,X LDA.b $02 : CMP.l ValidDoorTypesExpanded_high, X : BEQ FindEntrance
BNE .low_byte_fail
LDA.b $02
CMP.l ValidDoorTypesExpanded_high,X
BEQ FindEntrance
.low_byte_fail .low_byte_fail
DEX DEX
@@ -195,23 +134,24 @@ STZ.w $04B8
SEP #$30 SEP #$30
RTL RTL
}
#Overworld_ForbidEntry: #Overworld_ForbidEntry:
LDA.w $04B8 {
BNE .message_received LDA.w $04B8 : BNE .message_received
INC.w $04B8 INC.w $04B8
LDA.w #$0005 ; MESSAGE 0005 ; MESSAGE 0005
STA.w $1CF0 LDA.w #$0005 : STA.w $1CF0
SEP #$30 SEP #$30
JML Interface_PrepAndDisplayMessage JML Interface_PrepAndDisplayMessage
}
FindEntrance: FindEntrance:
{
TYA TYA
STA.b $00 STA.b $00
@@ -225,48 +165,34 @@ DEX
DEX DEX
BMI .no_entrance_found BMI .no_entrance_found
CMP.l Overworld_EntranceTileIndex,X CMP.l Overworld_EntranceTileIndex, X : BNE .tile_fail
BNE .tile_fail
LDA.w $040A LDA.w $040A : CMP.l Overworld_EntranceScreens, X : BNE .next_check
CMP.l Overworld_EntranceScreens,X
BNE .next_check
LDA.l $7EF3D3 LDA.l $7EF3D3 : AND.w #$00FF : BNE .entry_allowed
AND.w #$00FF
BNE .entry_allowed
LDA.w $02DA LDA.w $02DA : AND.w #$00FF : CMP.w #$0001 : BEQ Overworld_ForbidEntry
AND.w #$00FF
CMP.w #$0001
BEQ Overworld_ForbidEntry
LDA.l $7EF3CC : AND.w #$00FF : BEQ .entry_allowed
; FOLLOWER 05
CMP.w #$05 : BEQ .entry_allowed
LDA.l $7EF3CC ; FOLLOWER 0E
AND.w #$00FF CMP.w #$0E : BEQ .entry_allowed
BEQ .entry_allowed
CMP.w #$05 ; FOLLOWER 05 ; FOLLOWER 01
BEQ .entry_allowed CMP.w #$01 : BEQ .entry_allowed
CMP.w #$0E ; FOLLOWER 0E ; FOLLOWER 07
BEQ .entry_allowed CMP.w #$07 : BEQ .check_single_entrance
CMP.w #$01 ; FOLLOWER 01
BEQ .entry_allowed
CMP.w #$07 ; FOLLOWER 07
BEQ .check_single_entrance
CMP.w #$08 ; FOLLOWER 08 CMP.w #$08 ; FOLLOWER 08
BNE Overworld_ForbidEntry BNE Overworld_ForbidEntry
.check_single_entrance .check_single_entrance
CPX.w #$0076 CPX.w #$0076 : BCC Overworld_ForbidEntry
BCC Overworld_ForbidEntry
.entry_allowed .entry_allowed
@@ -279,25 +205,24 @@ SEP #$20
LDA.l Overworld_Entrance_ID,X LDA.l Overworld_Entrance_ID,X
STA.w $010E STA.w $010E
STZ.b $4D STZ.b $4D : STZ.b $46
STZ.b $46
LDA.b #$0F LDA.b #$0F : STA.b $10
STA.b $10
LDA.b #$06 LDA.b #$06 : STA.w $010C
STA.w $010C
STZ.b $11 STZ.b $11 : STZ.b $B0
STZ.b $B0
.no_entrance_found .no_entrance_found
print pc
SEP #$30 SEP #$30
RTL RTL
}
; $DB8BF-$DB916 - chr types indicating door entrances ; $DB8BF-$DB916 - chr types indicating door entrances
org $1BB8BF
ValidDoorTypesExpanded_low: ValidDoorTypesExpanded_low:
dw $00FE, $00C5, $00FE, $0114 ; 00: ???, House Door, ???, ??? dw $00FE, $00C5, $00FE, $0114 ; 00: ???, House Door, ???, ???
dw $0115, $0175, $0156, $00F5 ; 01: dw $0115, $0175, $0156, $00F5 ; 01:
@@ -311,6 +236,7 @@ ValidDoorTypesExpanded_low:
dw $0131, $0112, $016D, $0163 ; 09: dw $0131, $0112, $016D, $0163 ; 09:
dw $0173, $00FE, $0113, $0177 ; 10: dw $0173, $00FE, $0113, $0177 ; 10:
ValidDoorTypesExpanded_high: ValidDoorTypesExpanded_high:
dw $014A, $00C4, $014F, $0115 ; ???, House Door, ???, ??? dw $014A, $00C4, $014F, $0115 ; ???, House Door, ???, ???
dw $0114, $0174, $0155, $00F5 ; 01: dw $0114, $0174, $0155, $00F5 ; 01:
@@ -324,6 +250,7 @@ ValidDoorTypesExpanded_high:
dw $0131, $0112, $017A, $0163 ; 09: dw $0131, $0112, $017A, $0163 ; 09:
dw $0172, $01BD, $0152, $0167 ; 10: dw $0172, $01BD, $0152, $0167 ; 10:
pushpc
; $DB8BF (0x2C entries, 2 bytes each) - valid map8 (CHR) values for entrances (left side) ; $DB8BF (0x2C entries, 2 bytes each) - valid map8 (CHR) values for entrances (left side)
; $DB917 (0x2C entries, 2 bytes each) - valid map8 (CHR) values for entrances (right side) ; $DB917 (0x2C entries, 2 bytes each) - valid map8 (CHR) values for entrances (right side)

View File

@@ -1023,4 +1023,3 @@ TailPalace_EntranceAnimation:
} }
} }
pushpc

View File

@@ -44,6 +44,11 @@ print "End of Overworld/time_system.asm ", pc
incsrc "Overworld/overlays.asm" incsrc "Overworld/overlays.asm"
print "End of Overworld/overlays.asm ", pc print "End of Overworld/overlays.asm ", pc
pushpc
pullpc
incsrc "Overworld/entrances.asm"
print "End of Overworld/entrances.asm ", pc
pullpc pullpc