diff --git a/doorrando/entrance_fixes.asm b/doorrando/entrance_fixes.asm index ea5223a..1f540e9 100644 --- a/doorrando/entrance_fixes.asm +++ b/doorrando/entrance_fixes.asm @@ -12,9 +12,17 @@ ; 2) Draw over what vanilla just drew ; 3) Hijack the door tile type routine ; 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 +org $01B0E6 + JSL StoreDoorInfo + org $01892F DoorDrawJankMove: JML PrepDoorDraw @@ -36,6 +44,11 @@ org $01C132 ; ADC.w #$0040 : TAX : LDA.b $00 pullpc ;=================================================================================================== +StoreDoorInfo: + STA.w $1980,X + LDA.b $00 : STA.w $19F0,X + TXA +RTL PrepDoorDraw: ; 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 ; and you should understand the vanilla program flow we need to reject PEA.w DoorDrawJankMove_return-1 + LDA.b $00 + STA.w $19EE ; for current routine ; copy vanilla code (but fast rom) LDA.l $8186F0,X @@ -106,6 +121,9 @@ AdjustEscapeDoorGraphics: ORA.w #$4000 ; horizontally flip 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 ; they're all subsequently loaded with new values RTL @@ -142,24 +160,12 @@ AdjustEscapeDoorGraphics: LDY.w $0460 ; get door index LDX.w $19A0-2,Y ; get tilemap index - ; 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 + ; row 1 - outer section LDA.w #$0908 STA.l $7E2000+$080,X ORA.w #$4000 ; horizontally flip 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 LDA.w #$0918 STA.l $7E2000+$100,X @@ -171,6 +177,20 @@ AdjustEscapeDoorGraphics: ORA.w #$4000 ; horizontally flip 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 LDA.w #$A82C STA.l $7E2000+$180,X @@ -221,9 +241,8 @@ AdjustEscapeDoorCollisionShared: ; Y is the same as what we entered with ; X has A>>1, for whatever A entered with PHA - LDA.w $1980, Y ; grab door info (type) - AND.w #$00FF - STA.b $0A ; store in temporary variable + LDA.w $19F0, Y ; grab door info (type, position) + STA.w $19EE ; store in temporary variable JSR IdentifyBlockedEntrance PLX ; this is a TAX in vanilla, just have X pull A instead @@ -247,8 +266,7 @@ AdjustEscapeDoorCollision_LowEntrance: ;=================================================================================================== ; Enter with: -; $0A 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 +; $19EE containing the door information: position and type bytes ; Exit with: ; carry clear - leave door alone ; carry set - block door @@ -271,9 +289,8 @@ IdentifyBlockedEntrance: - INX #2 LDA.l RemoveRainDoorsRoom, X : CMP.w #$FFFF : BEQ .leave_alone CMP $A0 : BNE - - LDA.b $0A - CMP.w #$000A : BCC .continue - CMP.w #$0014 : BCS .continue + LDA.l RainDoorMatch, X + CMP.w $19EE : BNE .leave_alone BRA .block_door .continue BRA - diff --git a/doorrando/overrides.asm b/doorrando/overrides.asm index 7b70488..d955e0a 100644 --- a/doorrando/overrides.asm +++ b/doorrando/overrides.asm @@ -131,7 +131,10 @@ BigKeyDoorCheck: ; FixOvalFadeOutMirror: ; 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 ; .skip_activation -; PLA : PLA : PLA : JML Sprite_6C_MirrorPortal_missing_mirror \ No newline at end of file +; PLA : PLA : PLA : JML Sprite_6C_MirrorPortal_missing_mirror