Fix for mirror portal in inverted

Yet another fix for blocked doors in Standard ER, minor alteration for the swamp entrance fix to work when blocked as well.
This commit is contained in:
aerinon
2023-03-08 08:26:34 -07:00
parent 5c213477bc
commit 380f917e60
2 changed files with 42 additions and 22 deletions

View File

@@ -12,9 +12,17 @@
; 2) Draw over what vanilla just drew ; 2) Draw over what vanilla just drew
; 3) Hijack the door tile type routine ; 3) Hijack the door tile type routine
; and replace the vanilla value with that of solid collision ; and replace the vanilla value with that of solid collision
; For door dection free RAM at $19EE-$19FF has been co-opted to door each drawn doors position and type bytes
; 19EE is for the "current" door for the IdentifyBlockedEntrance routine
; The array at 19F0 is for the collision routine to retrieve that information as it is no longer
; available by that point
;=================================================================================================== ;===================================================================================================
pushpc pushpc
org $01B0E6
JSL StoreDoorInfo
org $01892F org $01892F
DoorDrawJankMove: DoorDrawJankMove:
JML PrepDoorDraw JML PrepDoorDraw
@@ -36,6 +44,11 @@ org $01C132 ; ADC.w #$0040 : TAX : LDA.b $00
pullpc pullpc
;=================================================================================================== ;===================================================================================================
StoreDoorInfo:
STA.w $1980,X
LDA.b $00 : STA.w $19F0,X
TXA
RTL
PrepDoorDraw: PrepDoorDraw:
; first off, we need this routine to return to our jank hook ; first off, we need this routine to return to our jank hook
@@ -46,6 +59,8 @@ PrepDoorDraw:
; Much easier to just tell you to look at $01890D in the disassembly ; Much easier to just tell you to look at $01890D in the disassembly
; and you should understand the vanilla program flow we need to reject ; and you should understand the vanilla program flow we need to reject
PEA.w DoorDrawJankMove_return-1 PEA.w DoorDrawJankMove_return-1
LDA.b $00
STA.w $19EE ; for current routine
; copy vanilla code (but fast rom) ; copy vanilla code (but fast rom)
LDA.l $8186F0,X LDA.l $8186F0,X
@@ -106,6 +121,9 @@ AdjustEscapeDoorGraphics:
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X STA.l $7E2000+$104,X
JSR IdentifySwampEntrance
BCS .fix_swamp_entrance_alternate
; the state of the A, X, and Y registers is irrelevant when we exit ; the state of the A, X, and Y registers is irrelevant when we exit
; they're all subsequently loaded with new values ; they're all subsequently loaded with new values
RTL RTL
@@ -142,24 +160,12 @@ AdjustEscapeDoorGraphics:
LDY.w $0460 ; get door index LDY.w $0460 ; get door index
LDX.w $19A0-2,Y ; get tilemap index LDX.w $19A0-2,Y ; get tilemap index
; row 0 ; row 1 - outer section
LDA.w #$9DfC
STA.l $7E2000+$000,X
STA.l $7E2000+$002,X
STA.l $7E2000+$004,X
STA.l $7E2000+$006,X
; row 1
LDA.w #$0908 LDA.w #$0908
STA.l $7E2000+$080,X STA.l $7E2000+$080,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$086,X STA.l $7E2000+$086,X
LDA.w #$14E8
STA.l $7E2000+$082,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X
; row 2 ; row 2
LDA.w #$0918 LDA.w #$0918
STA.l $7E2000+$100,X STA.l $7E2000+$100,X
@@ -171,6 +177,20 @@ AdjustEscapeDoorGraphics:
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X STA.l $7E2000+$104,X
.fix_swamp_entrance_alternate
; row 0
LDA.w #$9DFC
STA.l $7E2000+$000,X
STA.l $7E2000+$002,X
STA.l $7E2000+$004,X
STA.l $7E2000+$006,X
; row 1 - mid section
LDA.w #$14E8
STA.l $7E2000+$082,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X
; row 3 ; row 3
LDA.w #$A82C LDA.w #$A82C
STA.l $7E2000+$180,X STA.l $7E2000+$180,X
@@ -221,9 +241,8 @@ AdjustEscapeDoorCollisionShared:
; Y is the same as what we entered with ; Y is the same as what we entered with
; X has A>>1, for whatever A entered with ; X has A>>1, for whatever A entered with
PHA PHA
LDA.w $1980, Y ; grab door info (type) LDA.w $19F0, Y ; grab door info (type, position)
AND.w #$00FF STA.w $19EE ; store in temporary variable
STA.b $0A ; store in temporary variable
JSR IdentifyBlockedEntrance JSR IdentifyBlockedEntrance
PLX ; this is a TAX in vanilla, just have X pull A instead PLX ; this is a TAX in vanilla, just have X pull A instead
@@ -247,8 +266,7 @@ AdjustEscapeDoorCollision_LowEntrance:
;=================================================================================================== ;===================================================================================================
; Enter with: ; Enter with:
; $0A containing the door information: position and type bytes ; $19EE containing the door information: position and type bytes
; which should be from $1980, Y or [$B7], Y depending on where in the door process we are
; Exit with: ; Exit with:
; carry clear - leave door alone ; carry clear - leave door alone
; carry set - block door ; carry set - block door
@@ -271,9 +289,8 @@ IdentifyBlockedEntrance:
- INX #2 - INX #2
LDA.l RemoveRainDoorsRoom, X : CMP.w #$FFFF : BEQ .leave_alone LDA.l RemoveRainDoorsRoom, X : CMP.w #$FFFF : BEQ .leave_alone
CMP $A0 : BNE - CMP $A0 : BNE -
LDA.b $0A LDA.l RainDoorMatch, X
CMP.w #$000A : BCC .continue CMP.w $19EE : BNE .leave_alone
CMP.w #$0014 : BCS .continue
BRA .block_door BRA .block_door
.continue .continue
BRA - BRA -

View File

@@ -130,7 +130,10 @@ BigKeyDoorCheck:
FixOvalFadeOutMirror: FixOvalFadeOutMirror:
LDA.b $10 : CMP.b #$0F : BEQ .skip_activation LDA.b $10 : CMP.b #$0F : BEQ .skip_activation
LDA.l CurrentWorld : BNE .skip_activation LDA.l InvertedMode : BNE +
LDA.l CurrentWorld : BNE .skip_activation
RTL
+ LDA.l CurrentWorld : BEQ .skip_activation
RTL RTL
.skip_activation .skip_activation
PLA : PLA : PLA : JML Sprite_6C_MirrorPortal_missing_mirror PLA : PLA : PLA : JML Sprite_6C_MirrorPortal_missing_mirror