From b9c8984d6da7769c81b430e63e28444497d8b679 Mon Sep 17 00:00:00 2001 From: aerinon Date: Wed, 1 Mar 2023 15:41:36 -0700 Subject: [PATCH 01/68] Fix for door overruns Minor graphical fix for sanc door --- doorrando/drhooks.asm | 6 ++---- doorrando/edges.asm | 20 -------------------- doorrando/entrance_fixes.asm | 1 + doorrando/normal.asm | 7 +++---- 4 files changed, 6 insertions(+), 28 deletions(-) diff --git a/doorrando/drhooks.asm b/doorrando/drhooks.asm index b74c8a3..e280ef5 100644 --- a/doorrando/drhooks.asm +++ b/doorrando/drhooks.asm @@ -44,6 +44,8 @@ org $8293d1 ; <- 113d1 - Bank02.asm : 3683 (ADD $20 : STA $20 BRANCH_IOTA) jsl StraightStairsFix : nop org $829396 ; <- 11396 - Bank02.asm : 3641 (LDA $01C322, X) jsl StraightStairLayerFix +org $82c06d ; <- Bank02.asm : 9874 (LDX $0418, CMP.b #$02) +jsl DoorToStraight : nop org $82c092 ; STA $0020, Y : LDX #$00 jsl DoorToInroom : nop org $82c0f8 ; CMP $02C034, X @@ -212,9 +214,5 @@ bcs .normal rts .normal -; fixes an issue with edges -> normal doors (bombable, dashable, keydoor) -org $82C06A -JSL TransitionCalculateLanding_Fix : NOP #2 - org $82C157 JSL AlwaysPushThroughFDoors diff --git a/doorrando/edges.asm b/doorrando/edges.asm index b7d11f1..62290ac 100644 --- a/doorrando/edges.asm +++ b/doorrando/edges.asm @@ -1,9 +1,7 @@ ; defines ; Ram usage -EdgeToNormalFlag = $7E1200 HorzEdge: - LDA.b #$00 : STA.l EdgeToNormalFlag cpy #$ff : beq + jsr DetectWestEdge : ldy #$02 : bra ++ + jsr DetectEastEdge @@ -18,7 +16,6 @@ HorzEdge: + clc : rts VertEdge: - LDA.b #$00 : STA.l EdgeToNormalFlag cpy #$ff : beq + jsr DetectNorthEdge : bra ++ + jsr DetectSouthEdge @@ -62,7 +59,6 @@ LoadEdgeRoomVert: lda $04 : and #$80 : bne .edge lda $04 : sta $01 ; load up flags in $01 and #$03 : cmp #$03 : beq .inroom - LDA.b #$01 : STA.l EdgeToNormalFlag ldy #$01 : jsr ShiftVariablesMainDir jsr PrepScrollToNormal bra .scroll @@ -302,22 +298,6 @@ DetectEastEdge: ldx #$08 .end txa : rts - -TransitionCalculateLanding_Fix: - LDA.l EdgeToNormalFlag : BEQ + - LDX.w $0418 : CPX.b #$01 : BNE + - LDA.b $20 : SBC #$08 : STA.b $20 - + PHK : PEA.w .jslrtsreturn-1 - PEA.w $02802C - JML CalculateTransitionLanding - .jslrtsreturn - LDX.w $0418 : CPX.b #$01 : BNE .zero ; the LDX is vanilla and needs to always run - LDA.l EdgeToNormalFlag : BEQ + - LDA.b $20 : ADC #$08 : STA.b $20 - .zero LDA.b #$00 : STA.l EdgeToNormalFlag - + JSL DoorToStraight -RTL - AlwaysPushThroughFDoors: PHA : AND.b #$F0 : CMP.b #$F0 : BNE + PLA : RTL diff --git a/doorrando/entrance_fixes.asm b/doorrando/entrance_fixes.asm index 7052972..faf42f6 100644 --- a/doorrando/entrance_fixes.asm +++ b/doorrando/entrance_fixes.asm @@ -133,6 +133,7 @@ AdjustEscapeDoorGraphics: STA.l $7E2000+$102,X ORA.w #$4000 ; horizontally flip STA.l $7E2000+$104,X + RTL .fix_swamp_entrance LDY.w $0460 ; get door index diff --git a/doorrando/normal.asm b/doorrando/normal.asm index c7626a4..3c482b3 100644 --- a/doorrando/normal.asm +++ b/doorrando/normal.asm @@ -364,8 +364,7 @@ DoorToStraight: lda $a0 : cmp #$51 : bne .skip lda #$04 : sta $4e .skip pla - ; the ldx $0418 is now taken care of by TransitionCalculateLanding_Fix - .end cmp #$02 ;what we wrote over + .end LDX.w $0418 : CMP.b #$02 ; what we wrote over rtl } @@ -434,8 +433,8 @@ HandleSpecialDoorLanding: { .noDoor PLA - CMP #$34 : bne + ; inroom stairs - PHA : LDA #$26 : STA $045E : PLA + CMP.b #$34 : BNE + ; inroom stairs + PHA : LDA.b #$26 : STA.w $045E : PLA + RTL } From 13879317fe5278768e90260760bc9ffb7a89cb79 Mon Sep 17 00:00:00 2001 From: aerinon Date: Wed, 1 Mar 2023 15:41:54 -0700 Subject: [PATCH 02/68] Mirror Portal + Entrance Fix --- doorrando/drhooks.asm | 7 +++++++ doorrando/overrides.asm | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/doorrando/drhooks.asm b/doorrando/drhooks.asm index e280ef5..8904c29 100644 --- a/doorrando/drhooks.asm +++ b/doorrando/drhooks.asm @@ -216,3 +216,10 @@ rts org $82C157 JSL AlwaysPushThroughFDoors + +; Modified from OWR - will need to remove once merged +org $85AF75 +Sprite_6C_MirrorPortal: +JSL FixOvalFadeOutMirror : NOP #2 ; LDA $7EF3CA : BNE $05AFDF +org $85AFDF +Sprite_6C_MirrorPortal_missing_mirror: diff --git a/doorrando/overrides.asm b/doorrando/overrides.asm index 234d614..75f9113 100644 --- a/doorrando/overrides.asm +++ b/doorrando/overrides.asm @@ -122,9 +122,15 @@ BlindZeldaDespawnFix: PLA : PLA : PEA.w SpritePrep_BlindMaiden_despawn_follower-1 : RTL + PLA : PLA : PEA.w SpritePrep_BlindMaiden_kill_the_girl-1 : RTL - BigKeyDoorCheck: CPY.w #$001E : BNE + ; skip if it isn't a BK door LDA.l DRFlags : AND #$0400 : BNE + ; skip if the flag is set - bk doors can be double-sided PLA : PEA.w RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door-1 + LDA.w #$0000 : RTL + +FixOvalFadeOutMirror: + LDA.b $10 : CMP.b #$0F : BEQ .skip_activation + LDA.l CurrentWorld : BNE .skip_activation + RTL + .skip_activation + PLA : PLA : PLA : JML Sprite_6C_MirrorPortal_missing_mirror \ No newline at end of file From 72e8d73277d03be4ef99335f11288223e841004e Mon Sep 17 00:00:00 2001 From: aerinon Date: Thu, 2 Mar 2023 16:21:02 -0700 Subject: [PATCH 03/68] Fix for lower layer blocked doors in standard --- doorrando/entrance_fixes.asm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doorrando/entrance_fixes.asm b/doorrando/entrance_fixes.asm index faf42f6..ea5223a 100644 --- a/doorrando/entrance_fixes.asm +++ b/doorrando/entrance_fixes.asm @@ -30,6 +30,9 @@ warnpc $018939 org $01BF43 JSL AdjustEscapeDoorCollision +org $01C132 ; ADC.w #$0040 : TAX : LDA.b $00 + JSL AdjustEscapeDoorCollision_LowEntrance : NOP #2 + pullpc ;=================================================================================================== @@ -211,6 +214,7 @@ BlockedEntrance: AdjustEscapeDoorCollision: LSR ; vanilla shift +AdjustEscapeDoorCollisionShared: ; save our parameters ; but one or both of these may not be necessary depending on how you detect these doors ; all that matters is that after identifying blockage, we have: @@ -236,6 +240,10 @@ AdjustEscapeDoorCollision: RTL +AdjustEscapeDoorCollision_LowEntrance: + ADC.w #$0040 ; vanilla add + JMP AdjustEscapeDoorCollisionShared + ;=================================================================================================== ; Enter with: From 5c213477bccd66e4e916c8881b77fbec33108605 Mon Sep 17 00:00:00 2001 From: aerinon Date: Mon, 6 Mar 2023 16:10:41 -0700 Subject: [PATCH 04/68] Cave state fixes --- doorrando/normal.asm | 16 ++++++++++++---- doorrando/spiral.asm | 12 ++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/doorrando/normal.asm b/doorrando/normal.asm index 3c482b3..e1fc8ee 100644 --- a/doorrando/normal.asm +++ b/doorrando/normal.asm @@ -1,6 +1,6 @@ WarpLeft: lda.l DRMode : beq .end - lda $040c : cmp.b #$ff : beq .end + JSR CheckIfCave : BCS .end lda $20 : ldx $aa jsr CalcIndex !add #$06 : ldy #$01 ; offsets in A, Y @@ -11,7 +11,7 @@ WarpLeft: WarpRight: lda.l DRMode : beq .end - lda $040c : cmp.b #$ff : beq .end + JSR CheckIfCave : BCS .end lda $20 : ldx $aa jsr CalcIndex !add #$12 : ldy #$ff ; offsets in A, Y @@ -22,7 +22,7 @@ WarpRight: WarpUp: lda.l DRMode : beq .end - lda $040c : cmp.b #$ff : beq .end + JSR CheckIfCave : BCS .end lda $22 : ldx $a9 jsr CalcIndex ldy #$02 ; offsets in A, Y @@ -40,7 +40,7 @@ endmacro WarpDown: lda.l DRMode : beq .end - lda $040c : cmp.b #$ff : beq .end + JSR CheckIfCave : BCS .end lda $22 : ldx $a9 jsr CalcIndex !add #$0c : ldy #$ff ; offsets in A, Y @@ -79,6 +79,14 @@ Cleanup: lda $ef rts +; carry set if cave, clear otherwise +CheckIfCave: + REP #$30 + LDA.b $A2 : CMP.w #$00E1 : BCS .invalid + SEP #$30 : CLC : RTS + .invalid + SEP #$30 : SEC : RTS + ;A needs be to the low coordinate, x needs to be either 0 for left,upper or non-zero for right,down ; This sets A (00,02,04) and stores half that at $04 for later use, (src door) CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 -> A, DoorOffset -> $04 (vert/horz agnostic) diff --git a/doorrando/spiral.asm b/doorrando/spiral.asm index 4ce37e2..81f8533 100644 --- a/doorrando/spiral.asm +++ b/doorrando/spiral.asm @@ -1,24 +1,28 @@ RecordStairType: { pha lda.l DRMode : beq .norm - lda $040c : cmp #$ff : beq .norm + REP #$30 : LDA.b $A2 : CMP.w #$00E1 : BCS .norm + CMP #$00DF : BEQ .norm + SEP #$30 lda $0e cmp #$25 : bcc ++ ; don't record straight staircases sta $045e ++ pla : bra + - .norm pla : sta $a0 + .norm SEP #$30 : pla : sta $a0 + lda $063d, x rtl } SpiralWarp: { lda.l DRMode : beq .abort ; abort if not DR - lda $040c : cmp.b #$ff : beq .abort ; abort if not in dungeon + REP #$30 : LDA.b $A2 : CMP.w #$00E1 : BCS .abort + CMP #$00DF : BEQ .abort + SEP #$30 lda $045e : cmp #$5e : beq .gtg ; abort if not spiral - intended room is in A! cmp #$5f : beq .gtg cmp #$26 : beq .inroom .abort - stz $045e : lda $a2 : and #$0f : rtl ; clear,run hijacked code and get out + SEP #$30 : stz $045e : lda $a2 : and.b #$0f : rtl ; clear,run hijacked code and get out .inroom jsr InroomStairsWarp lda $a2 : and #$0f ; this is the code we are hijacking From 380f917e6007c4a3cb022ebbc7a1c29637ef88d6 Mon Sep 17 00:00:00 2001 From: aerinon Date: Wed, 8 Mar 2023 08:26:34 -0700 Subject: [PATCH 05/68] 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. --- doorrando/entrance_fixes.asm | 59 +++++++++++++++++++++++------------- doorrando/overrides.asm | 5 ++- 2 files changed, 42 insertions(+), 22 deletions(-) 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 75f9113..37c8913 100644 --- a/doorrando/overrides.asm +++ b/doorrando/overrides.asm @@ -130,7 +130,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 From f8602a74cba3a96fe6c1f06dc453db21486f13e3 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Wed, 8 Mar 2023 20:38:34 -0600 Subject: [PATCH 06/68] Remove 5 Arrow Item --- newitems.asm | 20 ++++++++------------ owrando.asm | 2 -- utilities.asm | 4 ++-- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/newitems.asm b/newitems.asm index 8992ae9..e6aef4e 100755 --- a/newitems.asm +++ b/newitems.asm @@ -44,7 +44,6 @@ ; #$B2 - Fairy ; #$B3 - Chicken ; #$B4 - Big Magic -; #$B5 - 5 Arrows ; #$B6/B7 - Reserved for Kara ; #$FE - Server Request (Asychronous Chest) ; #$FF - Null Chest @@ -436,9 +435,6 @@ AddReceivedItemExpandedGetItem: + CMP.b #$B4 : BNE + ; Big Magic LDA.b #$80 : STA MagicFiller ; fill magic BRA .done - + CMP.b #$B5 : BNE + ; 5 Arrows - LDA.b #$05 : STA ArrowsFiller ; add 5 arrows - BRA .done + .done PLX @@ -636,7 +632,7 @@ org $A08A00 db -4 ; Fairy db -4 ; Chicken db -4 ; Big Magic - db -4 ; 5 Arrows + db -4 ; Unused db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused @@ -682,7 +678,7 @@ org $A08A00 db 0 ; Fairy db 0 ; Chicken db 4 ; Big Magic - db 0 ; 5 Arrows + db 0 ; Unused db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused @@ -733,7 +729,7 @@ org $A08A00 db $47 ; Fairy db $47 ; Chicken db $3B ; Big Magic - db $02 ; 5 Arrows + db $49 ; Unused db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused @@ -778,7 +774,7 @@ org $A08A00 db $02 ; Fairy db $02 ; Chicken db $00 ; Big Magic - db $02 ; 5 Arrows + db $02 ; Unused db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Unused db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Unused @@ -825,7 +821,7 @@ org $A08A00 db 1 ; Fairy db 1 ; Chicken db 4 ; Big Magic - db 2 ; 5 Arrows + db 4 ; Unused db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused @@ -872,7 +868,7 @@ org $A08A00 dw $F36A ; Fairy dw $F36A ; Chicken dw $F373 ; Big Magic - dw $F376 ; 5 Arrows + dw $F36A ; Unused dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused @@ -921,7 +917,7 @@ org $A08A00 db $FF ; Fairy db $FF ; Chicken db $80 ; Big Magic - db $05 ; 5 Arrows + db $FF ; Unused db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused @@ -1012,7 +1008,7 @@ Link_ReceiveItemAlternatesExpanded: db -1 ; Fairy db -1 ; Chicken db -1 ; Big Magic - db -1 ; 5 Arrows + db -1 ; Unused db -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ; Unused db -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ; Unused db -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ; Unused diff --git a/owrando.asm b/owrando.asm index 09fe010..ab7041a 100644 --- a/owrando.asm +++ b/owrando.asm @@ -452,8 +452,6 @@ OWBonkDrops: LDA.b #$DF : CLC : BRA .sprite_transform ; transform to small magic + CMP.b #$B4 : BNE + LDA.b #$E0 : CLC : BRA .sprite_transform ; transform to big magic - + CMP.b #$B5 : BNE + - LDA.b #$E1 : CLC : BRA .sprite_transform ; transform to 5 arrows + CMP.b #$44 : BNE + LDA.b #$E2 : CLC : BRA .sprite_transform ; transform to 10 arrows + CMP.b #$B1 : BNE + diff --git a/utilities.asm b/utilities.asm index 1a110d2..1d615de 100644 --- a/utilities.asm +++ b/utilities.asm @@ -159,7 +159,7 @@ RTL db $4A ; Fairy db $4A ; Chicken db $3B ; Big Magic - db $02 ; 5 Arrows + db $49 ; Unused db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused @@ -295,7 +295,7 @@ RTL db $08 ; Fairy db $08 ; Chicken db $08 ; Big Magic - db $04 ; 5 Arrows + db $08 ; Unused db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused From a1fb6ea1af957516a4d61bd798d1860fe5cc9736 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Wed, 8 Mar 2023 21:26:25 -0600 Subject: [PATCH 07/68] Add new Good Bee item --- LTTP_RND_GeneralBugfixes.asm | 3 +++ newitems.asm | 29 +++++++++++++++++++---------- utilities.asm | 4 ++-- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 4915e54..2b99967 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -813,6 +813,9 @@ DiggingGameGuy_AttemptPrizeSpawn: org $1EDE28 Sprite_GetEmptyBottleIndex: ; this is totally in sprite_bees.asm +org $1EDE8A +GoldBee_SpawnSelf: + org $1EF4E7 Sprite_PlayerCantPassThrough: ;================================================================================ diff --git a/newitems.asm b/newitems.asm index e6aef4e..bdf6cd2 100755 --- a/newitems.asm +++ b/newitems.asm @@ -44,6 +44,7 @@ ; #$B2 - Fairy ; #$B3 - Chicken ; #$B4 - Big Magic +; #$B5 - Good Bee ; #$B6/B7 - Reserved for Kara ; #$FE - Server Request (Asychronous Chest) ; #$FF - Null Chest @@ -416,14 +417,14 @@ AddReceivedItemExpandedGetItem: LDA.b #$FF : STA.w $0B58,Y ; allows them to expire ++ JMP .done + CMP.b #$B2 : BNE + ; Fairy - LDA.b #$E3 : JSL Sprite_SpawnDynamically : BMI .done + LDA.b #$E3 : JSL Sprite_SpawnDynamically : BMI ++ LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y LDA $23 : ADC.b #$00 : STA $0D30,Y ; round X to nearest 8 LDA.b $20 : SEC : SBC.b #$10 : STA.w $0D00,Y LDA.b $21 : SBC.b #$00 : STA.w $0D20,Y ; move up 16 pixels LDA.b $EE : STA.w $0F20,Y ; spawns on same layer as link LDA.b #$FF : STA.w $0B58,Y ; allows them to expire - BRA .done + ++ BRA .done + CMP.b #$B3 : BNE + ; Chicken LDA.b #$0B : JSL Sprite_SpawnDynamically : BMI .done LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y @@ -435,6 +436,14 @@ AddReceivedItemExpandedGetItem: + CMP.b #$B4 : BNE + ; Big Magic LDA.b #$80 : STA MagicFiller ; fill magic BRA .done + + CMP.b #$B5 : BNE + ; Good Bee + LDA.b #$79 : JSL Sprite_SpawnDynamically : BMI .done + LDA $22 : CLC : ADC.b #$03 : AND.b #$F8 : STA $0D10,Y + LDA $23 : ADC.b #$00 : STA $0D30,Y ; round X to nearest 8 + LDA $20 : STA $0D00, Y : LDA $21 : STA $0D20, Y + LDA.b $EE : STA.w $0F20,Y ; spawns on same layer as link + JSL GoldBee_SpawnSelf_SetProperties + BRA .done + .done PLX @@ -632,7 +641,7 @@ org $A08A00 db -4 ; Fairy db -4 ; Chicken db -4 ; Big Magic - db -4 ; Unused + db -4 ; Good Bee db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused db -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4 ; Unused @@ -678,7 +687,7 @@ org $A08A00 db 0 ; Fairy db 0 ; Chicken db 4 ; Big Magic - db 0 ; Unused + db 0 ; Good Bee db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; Unused @@ -729,7 +738,7 @@ org $A08A00 db $47 ; Fairy db $47 ; Chicken db $3B ; Big Magic - db $49 ; Unused + db $47 ; Good Bee db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused @@ -774,7 +783,7 @@ org $A08A00 db $02 ; Fairy db $02 ; Chicken db $00 ; Big Magic - db $02 ; Unused + db $02 ; Good Bee db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Unused db $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02, $02 ; Unused @@ -821,7 +830,7 @@ org $A08A00 db 1 ; Fairy db 1 ; Chicken db 4 ; Big Magic - db 4 ; Unused + db 1 ; Good Bee db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused db 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 ; Unused @@ -868,7 +877,7 @@ org $A08A00 dw $F36A ; Fairy dw $F36A ; Chicken dw $F373 ; Big Magic - dw $F36A ; Unused + dw $F36A ; Good Bee dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused dw $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A, $F36A ; Unused @@ -917,7 +926,7 @@ org $A08A00 db $FF ; Fairy db $FF ; Chicken db $80 ; Big Magic - db $FF ; Unused + db $FF ; Good Bee db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; Unused @@ -1008,7 +1017,7 @@ Link_ReceiveItemAlternatesExpanded: db -1 ; Fairy db -1 ; Chicken db -1 ; Big Magic - db -1 ; Unused + db -1 ; Good Bee db -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ; Unused db -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ; Unused db -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ; Unused diff --git a/utilities.asm b/utilities.asm index 1d615de..f229bd0 100644 --- a/utilities.asm +++ b/utilities.asm @@ -159,7 +159,7 @@ RTL db $4A ; Fairy db $4A ; Chicken db $3B ; Big Magic - db $49 ; Unused + db $4A ; Good Bee db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused @@ -295,7 +295,7 @@ RTL db $08 ; Fairy db $08 ; Chicken db $08 ; Big Magic - db $08 ; Unused + db $08 ; Good Bee db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused From 8102b75b0ca0cbd9bca71d2536e8703425307799 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Thu, 9 Mar 2023 20:28:18 -0600 Subject: [PATCH 08/68] Added Cold Fairy Statue to bonkable locations --- owrando.asm | 148 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 136 insertions(+), 12 deletions(-) diff --git a/owrando.asm b/owrando.asm index ab7041a..65aa214 100644 --- a/owrando.asm +++ b/owrando.asm @@ -157,6 +157,14 @@ and #$7f : eor #$40 : nop #2 org $06AD4C jsl.l OWBonkDrops : nop #4 +org $1EDE6F +jsl.l OWBonkGoodBeeDrop : bra + +GoldBee_SpawnSelf_SetProperties: +phb : lda.b #$1E : pha : plb ; switch to bank 1E + jsr GoldBee_SpawnSelf+12 +plb : rtl +nop #3 ++ ;Code org $aa8800 @@ -395,6 +403,112 @@ LoadMapDarkOrMixed: dw $0400+$0210 ; bottom right } +OWBonkGoodBeeDrop: +{ + LDA.l OWFlags+1 : AND.b #$02 : BNE .shuffled + .vanilla ; what we wrote over + STZ.w $0DD0,X + LDA.l BottleContentsOne : ORA.l BottleContentsTwo + ORA.l BottleContentsThree : ORA.l BottleContentsFour + RTL + .shuffled + PHY : TXY + LDA.l RoomDataWRAM[$0120].high : AND.b #$02 : PHA : BNE + ; check if collected + LDA.b #$1B : STA $12F ; JSL Sound_SetSfx3PanLong ; seems that when you bonk, there is a pending bonk sfx, so we clear that out and replace with reveal secret sfx + + + LDA.l OWBonkPrizeData+(42*6+4) : BEQ + ; multiworld item + LDA.l OWBonkPrizeData+(42*6+3) + JMP .spawn_item + + + + .determine_type ; S = Collected, FlagBitmask, X (row + 2) + LDA.l OWBonkPrizeData+(42*6+3) ; A = item id + CMP.b #$B0 : BNE + + LDA.b #$79 : JMP .sprite_transform ; transform to bees + + CMP.b #$42 : BNE + + JSL.l Sprite_TransmuteToBomb ; transform a heart to bomb, vanilla behavior + JMP .mark_collected + + CMP.b #$34 : BNE + + LDA.b #$D9 : JMP .sprite_transform ; transform to single rupee + + CMP.b #$35 : BNE + + LDA.b #$DA : JMP .sprite_transform ; transform to blue rupee + + CMP.b #$36 : BNE + + LDA.b #$DB : BRA .sprite_transform ; transform to red rupee + + CMP.b #$27 : BNE + + LDA.b #$DC : BRA .sprite_transform ; transform to 1 bomb + + CMP.b #$28 : BNE + + LDA.b #$DD : BRA .sprite_transform ; transform to 4 bombs + + CMP.b #$31 : BNE + + LDA.b #$DE : BRA .sprite_transform ; transform to 8 bombs + + CMP.b #$45 : BNE + + LDA.b #$DF : BRA .sprite_transform ; transform to small magic + + CMP.b #$B4 : BNE + + LDA.b #$E0 : BRA .sprite_transform ; transform to big magic + + CMP.b #$B5 : BNE + + LDA.b #$79 : JSL.l OWBonkSpritePrep + JSL.l GoldBee_SpawnSelf_SetProperties ; transform to good bee + BRA .mark_collected + + CMP.b #$44 : BNE + + LDA.b #$E2 : BRA .sprite_transform ; transform to 10 arrows + + CMP.b #$B1 : BNE + + LDA.b #$AC : BRA .sprite_transform ; transform to apples + + CMP.b #$B2 : BNE + + LDA.b #$E3 : BRA .sprite_transform ; transform to fairy + + CMP.b #$B3 : BNE .spawn_item + INX : INX : LDA.l OWBonkPrizeData+(42*6+5) + CLC : ADC.b #$08 : PHA + LDA.w $0D00,Y : SEC : SBC.b 1,S : STA.w $0D00,Y + LDA.w $0D20,Y : SBC.b #$00 : STA.w $0D20,Y : PLX + LDA.b #$0B : SEC ; BRA .sprite_transform ; transform to chicken + + .sprite_transform + JSL.l OWBonkSpritePrep + + .mark_collected ; S = Collected + PLA : BNE .return + LDA.l RoomDataWRAM[$0120].high : ORA.b #$02 : STA.l RoomDataWRAM[$0120].high + + REP #$20 + LDA.l TotalItemCounter : INC : STA.l TotalItemCounter + SEP #$20 + BRA .return + + ; spawn itemget item + .spawn_item ; A = item id ; Y = bonk sprite slot ; S = Collected + PLX : BEQ + : LDA.b #$00 : STA.w $0DD0,Y : BRA .return + + LDA.l OWBonkPrizeData+(42*6+4) : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID + + LDA.b #$01 : STA !REDRAW + + LDA.b #$EB : STA.l $7FFE00 + JSL Sprite_SpawnDynamically+15 ; +15 to skip finding a new slot, use existing sprite + + ; affects the rate the item moves in the Y/X direction + LDA.b #$00 : STA.w $0D40,Y + LDA.b #$0A : STA.w $0D50,Y + + LDA.b #$20 : STA.w $0F80,Y ; amount of force (gives height to the arch) + LDA.b #$FF : STA.w $0B58,Y ; stun timer + LDA.b #$30 : STA.w $0F10,Y ; aux delay timer 4 ?? dunno what that means + + LDA.b #$00 : STA.w $0F20,Y ; layer the sprite is on + + ; sets OW event bitmask flag, uses free RAM + LDA.l OWBonkPrizeData+(42*6+2) : STA.w $0ED0,Y + + ; determines the initial spawn point of item + LDA.w $0D00,Y : SEC : SBC.l OWBonkPrizeData+(42*6+5) : STA.w $0D00,Y + LDA.w $0D20,Y : SBC #$00 : STA.w $0D20,Y + + LDA.b #$01 : STA !REDRAW : STA !FORCE_HEART_SPAWN + + .return + PLY + LDA #$08 ; makes original good bee not spawn + RTL + nop #20 +} + ; Y = sprite slot index of bonk sprite OWBonkDrops: { @@ -439,7 +553,7 @@ OWBonkDrops: + CMP.b #$34 : BNE + LDA.b #$D9 : CLC : JMP .sprite_transform ; transform to single rupee + CMP.b #$35 : BNE + - LDA.b #$DA : CLC : BRA .sprite_transform ; transform to blue rupee + LDA.b #$DA : CLC : JMP .sprite_transform ; transform to blue rupee + CMP.b #$36 : BNE + LDA.b #$DB : CLC : BRA .sprite_transform ; transform to red rupee + CMP.b #$27 : BNE + @@ -452,6 +566,10 @@ OWBonkDrops: LDA.b #$DF : CLC : BRA .sprite_transform ; transform to small magic + CMP.b #$B4 : BNE + LDA.b #$E0 : CLC : BRA .sprite_transform ; transform to big magic + + CMP.b #$B5 : BNE + + LDA.b #$79 : JSL.l OWBonkSpritePrep + JSL.l GoldBee_SpawnSelf_SetProperties ; transform to good bee + BRA .mark_collected + CMP.b #$44 : BNE + LDA.b #$E2 : CLC : BRA .sprite_transform ; transform to 10 arrows + CMP.b #$B1 : BNE + @@ -466,21 +584,14 @@ OWBonkDrops: LDA.b #$0B : SEC ; BRA .sprite_transform ; transform to chicken .sprite_transform - STA.w $0E20,Y - TYX : JSL.l Sprite_LoadProperties - BEQ + - ; these are sprite properties that make it fall out of the tree to the east - LDA #$30 : STA $0F80,Y ; amount of force (related to speed) - LDA #$10 : STA $0D50,Y ; eastward rate of speed - LDA #$FF : STA $0B58,Y ; expiration timer - + + JSL.l OWBonkSpritePrep .mark_collected ; S = Collected, FlagBitmask, X (row + 2) PLA : BNE + ; S = FlagBitmask, X (row + 2) LDX.b $8A : LDA.l OverworldEventDataWRAM,X : ORA 1,S : STA.l OverworldEventDataWRAM,X REP #$20 - LDA.l TotalItemCounter : INC : STA.l TotalItemCounter + LDA.l TotalItemCounter : INC : STA.l TotalItemCounter SEP #$20 + JMP .return @@ -493,8 +604,7 @@ OWBonkDrops: LDA.b #$01 : STA !REDRAW - LDA.b #$EB - STA.l $7FFE00 + LDA.b #$EB : STA.l $7FFE00 JSL Sprite_SpawnDynamically+15 ; +15 to skip finding a new slot, use existing sprite ; affects the rate the item moves in the Y/X direction @@ -523,6 +633,19 @@ OWBonkDrops: PLA : PLA : PLB : RTL } +; A = SpriteID, Y = Sprite Slot Index, X = free/overwritten +OWBonkSpritePrep: +{ + STA.w $0E20,Y + TYX : JSL.l Sprite_LoadProperties + BEQ + + ; these are sprite properties that make it fall out of the tree to the east + LDA #$30 : STA $0F80,Y ; amount of force (related to speed) + LDA #$10 : STA $0D50,Y ; eastward rate of speed + LDA #$FF : STA $0B58,Y ; expiration timer + + RTL +} + org $aa9000 OWDetectEdgeTransition: { @@ -1537,6 +1660,7 @@ db $6e, $8c, $10, $35, $00, $10 db $6e, $90, $08, $b0, $00, $10 db $6e, $a4, $04, $b1, $00, $10 db $74, $4e, $10, $b1, $00, $1c +db $ff, $00, $02, $b5, $00, $08 ; temporary fix - murahdahla replaces one of the bonk tree prizes ; so we copy the sprite table here and update the pointer From 8e8c195fa979b9d8f9c1bdecd3ce0ef9dd1c88ad Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sun, 12 Mar 2023 20:21:16 -0500 Subject: [PATCH 09/68] Minor label reference change for Good Bee Bonk Location --- owrando.asm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/owrando.asm b/owrando.asm index 65aa214..41cf06a 100644 --- a/owrando.asm +++ b/owrando.asm @@ -416,13 +416,13 @@ OWBonkGoodBeeDrop: LDA.l RoomDataWRAM[$0120].high : AND.b #$02 : PHA : BNE + ; check if collected LDA.b #$1B : STA $12F ; JSL Sound_SetSfx3PanLong ; seems that when you bonk, there is a pending bonk sfx, so we clear that out and replace with reveal secret sfx + - LDA.l OWBonkPrizeData+(42*6+4) : BEQ + ; multiworld item - LDA.l OWBonkPrizeData+(42*6+3) + LDA.l OWBonkPrizeTable[42].mw_player : BEQ + ; multiworld item + LDA.l OWBonkPrizeTable[42].loot JMP .spawn_item + .determine_type ; S = Collected, FlagBitmask, X (row + 2) - LDA.l OWBonkPrizeData+(42*6+3) ; A = item id + LDA.l OWBonkPrizeTable[42].loot ; A = item id CMP.b #$B0 : BNE + LDA.b #$79 : JMP .sprite_transform ; transform to bees + CMP.b #$42 : BNE + @@ -455,7 +455,7 @@ OWBonkGoodBeeDrop: + CMP.b #$B2 : BNE + LDA.b #$E3 : BRA .sprite_transform ; transform to fairy + CMP.b #$B3 : BNE .spawn_item - INX : INX : LDA.l OWBonkPrizeData+(42*6+5) + INX : INX : LDA.l OWBonkPrizeTable[42].vert_offset CLC : ADC.b #$08 : PHA LDA.w $0D00,Y : SEC : SBC.b 1,S : STA.w $0D00,Y LDA.w $0D20,Y : SBC.b #$00 : STA.w $0D20,Y : PLX @@ -476,7 +476,7 @@ OWBonkGoodBeeDrop: ; spawn itemget item .spawn_item ; A = item id ; Y = bonk sprite slot ; S = Collected PLX : BEQ + : LDA.b #$00 : STA.w $0DD0,Y : BRA .return - + LDA.l OWBonkPrizeData+(42*6+4) : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID + + LDA.l OWBonkPrizeTable[42].mw_player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.b #$01 : STA !REDRAW @@ -494,10 +494,10 @@ OWBonkGoodBeeDrop: LDA.b #$00 : STA.w $0F20,Y ; layer the sprite is on ; sets OW event bitmask flag, uses free RAM - LDA.l OWBonkPrizeData+(42*6+2) : STA.w $0ED0,Y + LDA.l OWBonkPrizeTable[42].flag : STA.w $0ED0,Y ; determines the initial spawn point of item - LDA.w $0D00,Y : SEC : SBC.l OWBonkPrizeData+(42*6+5) : STA.w $0D00,Y + LDA.w $0D00,Y : SEC : SBC.l OWBonkPrizeTable[42].vert_offset : STA.w $0D00,Y LDA.w $0D20,Y : SBC #$00 : STA.w $0D20,Y LDA.b #$01 : STA !REDRAW : STA !FORCE_HEART_SPAWN From eeebe58819d404ecfabd279ff6903bf8e314f4a2 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sun, 12 Mar 2023 21:45:16 -0500 Subject: [PATCH 10/68] Fixing issue with forced HP on Good Bee Bonk Location --- heartpieces.asm | 3 +++ owrando.asm | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/heartpieces.asm b/heartpieces.asm index 123e1ff..c7403c8 100644 --- a/heartpieces.asm +++ b/heartpieces.asm @@ -266,6 +266,9 @@ LoadIndoorValue: ++ %GetPossiblyEncryptedItem(HeartPiece_Graveyard_Warp, HeartPieceIndoorValues) JMP .done + + CMP.w #288 : BNE + + LDA.l OWBonkPrizeTable[42].loot + JMP .done + CMP.w #294 : BNE + %GetPossiblyEncryptedItem(HeartPiece_Mire_Warp, HeartPieceIndoorValues) JMP .done diff --git a/owrando.asm b/owrando.asm index 41cf06a..c65ca10 100644 --- a/owrando.asm +++ b/owrando.asm @@ -506,7 +506,6 @@ OWBonkGoodBeeDrop: PLY LDA #$08 ; makes original good bee not spawn RTL - nop #20 } ; Y = sprite slot index of bonk sprite From 04aabc8bd8de73bf755751befad7e16c93772777 Mon Sep 17 00:00:00 2001 From: aerinon Date: Mon, 13 Mar 2023 15:54:19 -0600 Subject: [PATCH 11/68] Clear standing item data on transition to overworld Standard+retro no arrow filler unless you have the bow --- darkworldspawn.asm | 14 ++++++++++---- keydrop/standing_items.asm | 9 +++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/darkworldspawn.asm b/darkworldspawn.asm index 31bc730..84ae763 100644 --- a/darkworldspawn.asm +++ b/darkworldspawn.asm @@ -114,17 +114,23 @@ RefreshRainAmmo: + CMP.b #$03 : BNE + ; Uncle %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Uncle) %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Uncle) - %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Uncle) - BRA .done + LDA.l ArrowMode : BEQ ++ + LDA.l BowEquipment : BEQ +++ + ++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Uncle) + +++ BRA .done + CMP.b #$02 : BNE + ; Cell %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Cell) %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Cell) - %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Cell) + LDA.l ArrowMode : BEQ ++ + LDA.l BowEquipment : BEQ .done + ++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Cell) BRA .done + CMP.b #$04 : BNE + ; Mantle %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Mantle) %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Mantle) - %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Mantle) + LDA.l ArrowMode : BEQ ++ + LDA.l BowEquipment : BEQ .done + ++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Mantle) + .done RTL diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index 99349a3..c2c9023 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -9,6 +9,10 @@ org $829C25 org $89C2BB JSL ClearSpriteData +; underworld -> overworld transition +org $8282D1 + JSL ClearSpriteData2 + org $89C327 JSL LoadSpriteData @@ -303,6 +307,7 @@ RTS ClearSpriteData: STZ.b $02 : STZ.b $03 ; what we overrode +ClearSpriteData_Shared: PHX LDA #$00 : LDX #$00 .loop @@ -312,6 +317,10 @@ ClearSpriteData: PLX RTL +ClearSpriteData2: + LDA.b #$82 : STA.b $99 + JMP ClearSpriteData_Shared + ; Runs during sprite load of the room LoadSpriteData: INY : INY From fb1f7ad907a81bc40cbe2cbd40ce1e929a20ca15 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Mon, 13 Mar 2023 21:53:36 -0500 Subject: [PATCH 12/68] Fixed Desert Pass WS edge coordinates --- owrando.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/owrando.asm b/owrando.asm index c65ca10..c687828 100644 --- a/owrando.asm +++ b/owrando.asm @@ -1407,7 +1407,7 @@ dw $0c78, $0ce3, $006b, $0cad, $3434, $0000, $0000, $001b dw $0ce4, $0d33, $004f, $0d0b, $3434, $0000, $0001, $001c dw $0d34, $0db8, $0084, $0d76, $3434, $0000, $0000, $001d dw $0ea8, $0f20, $0078, $0ee4, $3a3a, $0000, $0000, $001e -dw $0f70, $0fa8, $0038, $0f8c, $3a3a, $0000, $0000, $001f +dw $0f78, $0fa8, $0030, $0f90, $3a3a, $0000, $0000, $001f dw $0f18, $0f18, $0000, $0f18, $3b3b, $0000, $0000, $0020 dw $0fc8, $0fc8, $0000, $0fc8, $3b3b, $0000, $0000, $0021 dw $0e28, $0fb8, $0190, $0ef0, $3c3c, $0000, $0000, $0022 @@ -1482,7 +1482,7 @@ dw $0c78, $0ce3, $006b, $0cad, $3333, $0000, $0000, $001c dw $0ce4, $0d33, $004f, $0d0b, $3333, $0000, $0001, $001d dw $0d34, $0db8, $0084, $0d76, $3333, $0000, $0000, $001e dw $0ea8, $0f20, $0078, $0ee4, $3039, $0000, $0000, $001f -dw $0f70, $0fa8, $0038, $0f8c, $3039, $0000, $0000, $0020 +dw $0f78, $0fa8, $0030, $0f90, $3039, $0000, $0000, $0020 dw $0f18, $0f18, $0000, $0f18, $3a3a, $0000, $0000, $0021 dw $0fc8, $0fc8, $0000, $0fc8, $3a3a, $0000, $0000, $0022 dw $0e28, $0fb8, $0190, $0ef0, $3b3b, $0000, $0000, $0023 From 11e815bd96a0419d687cd935ce1c7fd5f23b63e0 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Tue, 14 Mar 2023 06:20:04 -0500 Subject: [PATCH 13/68] Fixed item duping issue on OW --- owrando.asm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/owrando.asm b/owrando.asm index c687828..9704605 100644 --- a/owrando.asm +++ b/owrando.asm @@ -238,6 +238,19 @@ OWWhirlpoolEnd: RTL } +OWDestroyItemSprites: +{ + PHX : LDX.b #$0F + .nextSprite + LDA.w $0E20,X + CMP.b #$D8 : BCC .continue + CMP.b #$EC : BCS .continue + .killSprite ; need to kill sprites from D8 to EB on screen transition + STZ.w $0DD0,X + .continue + DEX : BPL .nextSprite + PLX : RTL +} OWMirrorSpriteOnMap: { lda.w $1ac0,x : bit.b #$f0 : beq .continue @@ -648,6 +661,7 @@ OWBonkSpritePrep: org $aa9000 OWDetectEdgeTransition: { + JSL OWDestroyItemSprites STZ.w $06FC LDA.l OWMode : ORA.l OWMode+1 : BEQ .vanilla JSR OWShuffle From 69a6e7f9189ab21b0c7c6910bb6cbcdf84bf9091 Mon Sep 17 00:00:00 2001 From: aerinon Date: Tue, 14 Mar 2023 16:06:32 -0600 Subject: [PATCH 14/68] Version area reservation --- doorrando/doorrando.asm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doorrando/doorrando.asm b/doorrando/doorrando.asm index 2a2ff56..6511dd2 100644 --- a/doorrando/doorrando.asm +++ b/doorrando/doorrando.asm @@ -41,6 +41,11 @@ DRScroll: db 0 OffsetTable: dw -8, 8 +org $A78010 +DRVersionInfo: +dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 + +org $A78020 incsrc normal.asm incsrc scroll.asm From 49c486a2cc414e27e9bcf9dd918a8d267f3b37ee Mon Sep 17 00:00:00 2001 From: codemann8 Date: Tue, 14 Mar 2023 17:25:37 -0500 Subject: [PATCH 15/68] Merged in DR v.1.2.0.13 --- keydrop/standing_items.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index b0c92ed..81494a3 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -307,7 +307,7 @@ RTS ClearSpriteData: STZ.b $02 : STZ.b $03 ; what we overrode -ClearSpriteData_Shared: + .shared PHX LDA #$00 : LDX #$00 .loop @@ -319,7 +319,7 @@ ClearSpriteData_Shared: ClearSpriteData2: LDA.b #$82 : STA.b $99 - JMP ClearSpriteData_Shared + JMP ClearSpriteData_shared ; Runs during sprite load of the room LoadSpriteData: From b10dff8a30382233da39095353bfbc85fa2d376b Mon Sep 17 00:00:00 2001 From: aerinon Date: Tue, 14 Mar 2023 16:33:02 -0600 Subject: [PATCH 16/68] Minor clean up --- keydrop/standing_items.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index c2c9023..f6c88c3 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -307,7 +307,7 @@ RTS ClearSpriteData: STZ.b $02 : STZ.b $03 ; what we overrode -ClearSpriteData_Shared: + .shared: PHX LDA #$00 : LDX #$00 .loop @@ -319,7 +319,7 @@ ClearSpriteData_Shared: ClearSpriteData2: LDA.b #$82 : STA.b $99 - JMP ClearSpriteData_Shared + JMP ClearSpriteData_shared ; Runs during sprite load of the room LoadSpriteData: From 1316477771596c8defc9e02f38177c8722caf6f3 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Tue, 14 Mar 2023 17:34:42 -0500 Subject: [PATCH 17/68] Reserving space for OWR Version --- owrando.asm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/owrando.asm b/owrando.asm index 9704605..7b51e69 100644 --- a/owrando.asm +++ b/owrando.asm @@ -11,9 +11,11 @@ OWMode: dw 0 OWFlags: dw 0 -org $aa8010 OWReserved: dw 0 +org $aa8010 +OWVersionInfo: +dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000 ;Hooks org $02a929 From 92e04bde55c4b0388f67eb7d4940a92e084b2fe8 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Wed, 15 Mar 2023 05:43:39 -0500 Subject: [PATCH 18/68] Adjusting Bonk Sprite landing position and water ripple --- heartpieces.asm | 1 + owrando.asm | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/heartpieces.asm b/heartpieces.asm index c7403c8..2399ca8 100644 --- a/heartpieces.asm +++ b/heartpieces.asm @@ -221,6 +221,7 @@ MaybeMarkDigSpotCollected: RTL ;-------------------------------------------------------------------------------- HeartPieceSpawnDelayFix: + JSL Sprite_DrawRippleIfInWater ; Fix the delay when spawning a HeartPiece sprite JSL.l Sprite_CheckIfPlayerPreoccupied : BCS + ; what we moved from $05F037 JSL.l Sprite_CheckDamageToPlayerSameLayerLong : RTL ; what we wrote over diff --git a/owrando.asm b/owrando.asm index 7b51e69..614fffd 100644 --- a/owrando.asm +++ b/owrando.asm @@ -436,7 +436,7 @@ OWBonkGoodBeeDrop: JMP .spawn_item + - .determine_type ; S = Collected, FlagBitmask, X (row + 2) + .determine_type ; S = Collected LDA.l OWBonkPrizeTable[42].loot ; A = item id CMP.b #$B0 : BNE + LDA.b #$79 : JMP .sprite_transform ; transform to bees @@ -480,13 +480,13 @@ OWBonkGoodBeeDrop: JSL.l OWBonkSpritePrep .mark_collected ; S = Collected - PLA : BNE .return + PLA : BNE + LDA.l RoomDataWRAM[$0120].high : ORA.b #$02 : STA.l RoomDataWRAM[$0120].high REP #$20 LDA.l TotalItemCounter : INC : STA.l TotalItemCounter SEP #$20 - BRA .return + + BRA .return ; spawn itemget item .spawn_item ; A = item id ; Y = bonk sprite slot ; S = Collected @@ -498,15 +498,18 @@ OWBonkGoodBeeDrop: LDA.b #$EB : STA.l $7FFE00 JSL Sprite_SpawnDynamically+15 ; +15 to skip finding a new slot, use existing sprite + TYX : STZ.w $0F20,X ; layer the sprite is on + ; affects the rate the item moves in the Y/X direction - LDA.b #$00 : STA.w $0D40,Y + STZ.w $0D40,X LDA.b #$0A : STA.w $0D50,Y - LDA.b #$20 : STA.w $0F80,Y ; amount of force (gives height to the arch) + LDA.b #$1A : STA.w $0F80,Y ; amount of force (gives height to the arch) LDA.b #$FF : STA.w $0B58,Y ; stun timer LDA.b #$30 : STA.w $0F10,Y ; aux delay timer 4 ?? dunno what that means - LDA.b #$00 : STA.w $0F20,Y ; layer the sprite is on + ; sets the tile type that is underneath the sprite, water + LDA.b #$09 : STA.l $7FF9C2,X ; TODO: Figure out how to get the game to set this ; sets OW event bitmask flag, uses free RAM LDA.l OWBonkPrizeTable[42].flag : STA.w $0ED0,Y @@ -625,7 +628,7 @@ OWBonkDrops: LDA.b #$00 : STA.w $0D40,Y LDA.b #$0A : STA.w $0D50,Y - LDA.b #$20 : STA.w $0F80,Y ; amount of force (gives height to the arch) + LDA.b #$1A : STA.w $0F80,Y ; amount of force (gives height to the arch) LDA.b #$FF : STA.w $0B58,Y ; stun timer LDA.b #$30 : STA.w $0F10,Y ; aux delay timer 4 ?? dunno what that means From 8d3e084c1d1260d66143122840b29cee8c137660 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Thu, 16 Mar 2023 06:30:41 -0500 Subject: [PATCH 19/68] Load correct Link/Bunny palette on transition --- LTTP_RND_GeneralBugfixes.asm | 3 +++ owrando.asm | 32 ++++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 2b99967..a45188f 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -538,6 +538,9 @@ Underworld_LoadSpawnEntrance: org $02E99D FluteMenu_LoadTransport: +org $02FD6D +LoadGearPalettes_link: + org $02FD8A ; 17D8A - Bank0E.asm: 3732 Note: Different bank LoadGearPalettes_bunny: diff --git a/owrando.asm b/owrando.asm index 614fffd..25eb1fc 100644 --- a/owrando.asm +++ b/owrando.asm @@ -985,17 +985,17 @@ OWWorldTerrainUpdate: ; x = owid of destination screen, y = 1 for land to water, lda #$38 : sta $012f ; play sfx - #$3b is an alternative ; toggle bunny mode - lda MoonPearlEquipment : bne .nobunny - lda.l InvertedMode : bne .inverted + lda MoonPearlEquipment : beq + : jmp .nobunny + + lda.l InvertedMode : bne .inverted lda CurrentWorld : bra + .inverted lda CurrentWorld : eor #$40 + and #$40 : beq .nobunny - LDA.w $0703 : BEQ + ; check if forced transition - CPY.b #$03 : BEQ .end_forced_whirlpool - LDA.b #$17 : STA.b $5D - LDA.b #$01 : STA.w $02E0 : STA.b $56 - LDA.w $0703 : BRA .end_forced_edge + CPY.b #$03 : BEQ ++ + LDA.b #$17 : STA.b $5D + LDA.b #$01 : STA.w $02E0 : STA.b $56 + LDA.w $0703 : JSR OWLoadGearPalettes : BRA .end_forced_edge + ++ JSR OWLoadGearPalettes : BRA .end_forced_whirlpool + CPY.b #$01 : BEQ .auto ; check if going from land to water CPY.b #$02 : BEQ .to_bunny_reset_swim ; bunny state if swimming to land @@ -1014,8 +1014,8 @@ OWWorldTerrainUpdate: ; x = owid of destination screen, y = 1 for land to water, STZ.b $5D PLX BRA .to_pseudo_bunny - .whirlpool - PLX : RTS + .whirlpool + PLX : JMP OWLoadGearPalettes .to_bunny_reset_swim LDA.b $5D : CMP.b #$04 : BNE .to_bunny ; check if swimming JSL Link_ResetSwimmingState @@ -1024,7 +1024,7 @@ OWWorldTerrainUpdate: ; x = owid of destination screen, y = 1 for land to water, LDA.b #$17 : STA.b $5D .to_pseudo_bunny LDA.b #$01 : STA.w $02E0 : STA.b $56 - RTS + JMP OWLoadGearPalettes .nobunny lda $5d : cmp #$17 : bne + ; retain current state unless bunny @@ -1073,6 +1073,18 @@ OWWorldTerrainUpdate: ; x = owid of destination screen, y = 1 for land to water, .return RTS } +OWLoadGearPalettes: +{ + PHX : PHY : LDA $00 : PHA + LDA.w $02E0 : BEQ + + JSL LoadGearPalettes_bunny + BRA .return + + + JSL LoadGearPalettes_link + .return + PLA : STA $00 : PLY : PLX + RTS +} OWAdjustExitPosition: { LDA.w $06FC : CMP.b #$60 : BEQ .stone_bridge From ee4fce4010498204a04a4f0ffec845f5076615d8 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 17 Mar 2023 20:06:56 -0500 Subject: [PATCH 20/68] Moving some hijacked DR code to new location --- LTTP_RND_GeneralBugfixes.asm | 3 +++ doorrando/drhooks.asm | 7 +++---- doorrando/normal.asm | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index a45188f..0fd3206 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -514,6 +514,9 @@ Module_PreDungeon: org $028296 .setAmbientSfx +org $828AD9 +Underworld_SetBossOrSancMusicUponEntry: + org $02A0A8 Dungeon_SaveRoomData: diff --git a/doorrando/drhooks.asm b/doorrando/drhooks.asm index dc910e3..0a8d5a9 100644 --- a/doorrando/drhooks.asm +++ b/doorrando/drhooks.asm @@ -192,10 +192,9 @@ JSL.l Underworld_DoorDown_Entry : CPX #$FF BEQ + : db $80, $1C ; BRA $028B04 NOP #6 : + -org $82C3F2 ; <- Bank02.asm:10521 Unused call -Underworld_DoorDown_Call: -org $82C3F3 -dw $8AD9 ; address of Bank02.asm:2085 +org $82FD00 ; unreachable code +Underworld_SetBossOrSancMusicUponEntry_long: +JSR Underworld_SetBossOrSancMusicUponEntry : RTL org $81AA90 JSL BigKeyDoorCheck : NOP diff --git a/doorrando/normal.asm b/doorrando/normal.asm index 5a07bba..9352837 100644 --- a/doorrando/normal.asm +++ b/doorrando/normal.asm @@ -412,7 +412,7 @@ StraightStairsTrapDoor: .animateTraps lda #$05 : sta $11 inc $0468 : stz $068e : stz $0690 - ++ JSL Underworld_DoorDown_Call : rtl + ++ JML Underworld_SetBossOrSancMusicUponEntry_long + JML Dungeon_ApproachFixedColor ; what we wrote over } From 8522968c1b721f4c7b9957d2db836ad8e1b33665 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sat, 18 Mar 2023 05:46:34 -0500 Subject: [PATCH 21/68] Correcting OW screen palette on transition --- LTTP_RND_GeneralBugfixes.asm | 3 +++ owrando.asm | 42 +++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 0fd3206..1262569 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -535,6 +535,9 @@ CalculateTransitionLanding: org $02C176 Overworld_FinalizeEntryOntoScreen_Data: +org $82C3F2 +OverworldLoadScreensPaletteSet_long: + org $02D9B9 Underworld_LoadSpawnEntrance: diff --git a/owrando.asm b/owrando.asm index 25eb1fc..8818a35 100644 --- a/owrando.asm +++ b/owrando.asm @@ -47,6 +47,9 @@ Overworld_LoadSpecialOverworld_RoomId: org $04E8B4 Overworld_LoadSpecialOverworld: +org $02A9DA +JSL OWSkipMosiac + org $07982A Link_ResetSwimmingState: @@ -945,7 +948,20 @@ OWNewDestination: ; crossed OW shuffle and terrain ldx $05 : ldy $08 : jsr OWWorldTerrainUpdate - lda $05 : sta $8a + lda $8a : JSR OWDetermineScreensPaletteSet : STX $04 + lda $05 : sta $8a : JSR OWDetermineScreensPaletteSet + + ;PLA : AND.b #$3F : BEQ .leaving_woods + ;LDA $8A : AND.b #$3F : BEQ .entering_woods + CPX $04 : BEQ .skip_palette ; check if next screen's palette is different + LDA $00 : PHA + JSL OverworldLoadScreensPaletteSet_long ; loading correct OW palette + PLA : STA $00 + ;.leaving_woods + ;.entering_woods + .skip_palette + lda $8a + rep #$30 : rts } OWLoadSpecialArea: @@ -1085,6 +1101,30 @@ OWLoadGearPalettes: PLA : STA $00 : PLY : PLX RTS } +OWDetermineScreensPaletteSet: ; A = OWID to check +{ + LDX.b #$02 + PHA : AND.b #$3F + CMP.b #$03 : BEQ .death_mountain + CMP.b #$05 : BEQ .death_mountain + CMP.b #$07 : BEQ .death_mountain + LDX.b #$00 + .death_mountain + PLA : PHX : TAX : LDA.l OWTileWorldAssoc,x : BEQ + + PLX : INX : RTS + + PLX : RTS +} +OWSkipMosiac: +{ + LDA.l OWMode : ORA.l OWMode+1 : BEQ .vanilla + PLA : PLA : PEA $A9F2 + RTL + .vanilla + LDA.b $8A : AND.b #$3F : BNE + ; what we wrote over, kinda + PLA : PLA : PEA $A9E3 + + + RTL +} OWAdjustExitPosition: { LDA.w $06FC : CMP.b #$60 : BEQ .stone_bridge From 84b3c1ad508aa96c4d77e0ea2f2f292ac194f38d Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sat, 18 Mar 2023 19:13:04 -0500 Subject: [PATCH 22/68] Correcting OW screen palette on transition --- LTTP_RND_GeneralBugfixes.asm | 3 +++ owrando.asm | 41 +++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 0fd3206..1262569 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -535,6 +535,9 @@ CalculateTransitionLanding: org $02C176 Overworld_FinalizeEntryOntoScreen_Data: +org $82C3F2 +OverworldLoadScreensPaletteSet_long: + org $02D9B9 Underworld_LoadSpawnEntrance: diff --git a/owrando.asm b/owrando.asm index 25eb1fc..f5d6dfc 100644 --- a/owrando.asm +++ b/owrando.asm @@ -47,6 +47,9 @@ Overworld_LoadSpecialOverworld_RoomId: org $04E8B4 Overworld_LoadSpecialOverworld: +org $02A9DA +JSL OWSkipMosiac + org $07982A Link_ResetSwimmingState: @@ -945,7 +948,19 @@ OWNewDestination: ; crossed OW shuffle and terrain ldx $05 : ldy $08 : jsr OWWorldTerrainUpdate - lda $05 : sta $8a + lda $05 : sta $8a : JSR OWDetermineScreensPaletteSet + + ;PLA : AND.b #$3F : BEQ .leaving_woods + ;LDA $8A : AND.b #$3F : BEQ .entering_woods + CPX.w $0AB3 : BEQ .skip_palette ; check if next screen's palette is different + LDA $00 : PHA + JSL OverworldLoadScreensPaletteSet_long ; loading correct OW palette + PLA : STA $00 + ;.leaving_woods + ;.entering_woods + .skip_palette + lda $8a + rep #$30 : rts } OWLoadSpecialArea: @@ -1085,6 +1100,30 @@ OWLoadGearPalettes: PLA : STA $00 : PLY : PLX RTS } +OWDetermineScreensPaletteSet: ; A = OWID to check +{ + LDX.b #$02 + PHA : AND.b #$3F + CMP.b #$03 : BEQ .death_mountain + CMP.b #$05 : BEQ .death_mountain + CMP.b #$07 : BEQ .death_mountain + LDX.b #$00 + .death_mountain + PLA : PHX : TAX : LDA.l OWTileWorldAssoc,x : BEQ + + PLX : INX : RTS + + PLX : RTS +} +OWSkipMosiac: +{ + LDA.l OWMode : ORA.l OWMode+1 : BEQ .vanilla + PLA : PLA : PEA $A9F2 + RTL + .vanilla + LDA.b $8A : AND.b #$3F : BNE + ; what we wrote over, kinda + PLA : PLA : PEA $A9E3 + + + RTL +} OWAdjustExitPosition: { LDA.w $06FC : CMP.b #$60 : BEQ .stone_bridge From d4e792a71f583f6710345016e18123d176d97ca7 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sun, 19 Mar 2023 11:00:22 -0500 Subject: [PATCH 23/68] Fixed issue with MW Player ID on Bonk Locations --- heartpieces.asm | 35 +++++++++++++++++++---------------- owrando.asm | 8 ++------ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/heartpieces.asm b/heartpieces.asm index 2399ca8..71e6da7 100644 --- a/heartpieces.asm +++ b/heartpieces.asm @@ -643,6 +643,9 @@ HeartPieceGetPlayer: ++ LDA HeartPiece_Graveyard_Warp_Player BRL .done + + CMP.w #288 : BNE + + LDA.l OWBonkPrizeTable[$2A].mw_player + BRL .done + CMP.w #294 : BNE + LDA HeartPiece_Mire_Warp_Player BRL .done @@ -667,21 +670,21 @@ HeartPieceGetPlayer: LDA EtherItem_Player BRL .done + CMP.w #$05 : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$01].mw_player BRL .done ++ LDA HeartPiece_Mountain_Warp_Player BRL .done + CMP.w #$0A : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$02].mw_player BRL .done ++ LDA.l OWBonkPrizeTable[$03].mw_player BRL .done + CMP.w #$10 : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$04].mw_player BRL .done ++ @@ -694,28 +697,28 @@ HeartPieceGetPlayer: LDA.l OWBonkPrizeTable[$07].mw_player BRL .done + CMP.w #$13 : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$08].mw_player BRL .done ++ LDA.l OWBonkPrizeTable[$09].mw_player BRL .done + CMP.w #$15 : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$0A].mw_player BRL .done ++ LDA.l OWBonkPrizeTable[$0B].mw_player BRL .done + CMP.w #$18 : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$0C].mw_player BRL .done ++ LDA.l OWBonkPrizeTable[$0D].mw_player BRL .done + CMP.w #$1A : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$0E].mw_player BRL .done ++ @@ -734,7 +737,7 @@ HeartPieceGetPlayer: LDA HeartPiece_Maze_Player BRL .done + CMP.w #$2A : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$14].mw_player BRL .done ++ CMP.w #$0008 : BNE ++ @@ -747,7 +750,7 @@ HeartPieceGetPlayer: LDA.l OWBonkPrizeTable[$16].mw_player BRL .done + CMP.w #$2E : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$17].mw_player BRL .done ++ @@ -761,7 +764,7 @@ HeartPieceGetPlayer: LDA BombosItem_Player BRL .done + CMP.w #$32 : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$19].mw_player BRL .done ++ @@ -774,7 +777,7 @@ HeartPieceGetPlayer: LDA HeartPiece_Swamp_Player BRL .done + CMP.w #$42 : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$1B].mw_player BRL .done ++ @@ -784,14 +787,14 @@ HeartPieceGetPlayer: LDA HeartPiece_Cliffside_Player BRL .done + CMP.w #$51 : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$1C].mw_player BRL .done ++ LDA.l OWBonkPrizeTable[$1D].mw_player BRL .done + CMP.w #$54 : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$1E].mw_player BRL .done ++ CMP.w #$0008 : BNE ++ @@ -801,7 +804,7 @@ HeartPieceGetPlayer: LDA.l OWBonkPrizeTable[$20].mw_player BRL .done + CMP.w #$55 : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$21].mw_player BRL .done ++ @@ -811,7 +814,7 @@ HeartPieceGetPlayer: LDA.l OWBonkPrizeTable[$23].mw_player BRL .done + CMP.w #$5B : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$24].mw_player BRL .done ++ @@ -824,7 +827,7 @@ HeartPieceGetPlayer: LDA HeartPiece_Digging_Player BRL .done + CMP.w #$6E : BNE + - LDA.w $0ED0,X : CMP.w #$0010 : BNE ++ + LDA.w $0ED0,X : AND.w #$00FF : CMP.w #$0010 : BNE ++ LDA.l OWBonkPrizeTable[$26].mw_player BRL .done ++ CMP.w #$0008 : BNE ++ diff --git a/owrando.asm b/owrando.asm index f5d6dfc..4730478 100644 --- a/owrando.asm +++ b/owrando.asm @@ -494,9 +494,7 @@ OWBonkGoodBeeDrop: ; spawn itemget item .spawn_item ; A = item id ; Y = bonk sprite slot ; S = Collected PLX : BEQ + : LDA.b #$00 : STA.w $0DD0,Y : BRA .return - + LDA.l OWBonkPrizeTable[42].mw_player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID - - LDA.b #$01 : STA !REDRAW + + LDA.b #$01 : STA !REDRAW LDA.b #$EB : STA.l $7FFE00 JSL Sprite_SpawnDynamically+15 ; +15 to skip finding a new slot, use existing sprite @@ -618,9 +616,7 @@ OWBonkDrops: ; spawn itemget item .spawn_item ; A = item id ; Y = tree sprite slot ; S = Collected, FlagBitmask, X (row + 2) PLX : BEQ + : LDA.b #$00 : STA.w $0DD0,Y : JMP .return ; S = FlagBitmask, X (row + 2) - + LDA 2,S : TAX : INX : INX - LDA.w OWBonkPrizeData,X : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID - DEX + + LDA 2,S : TAX : INX LDA.b #$01 : STA !REDRAW From 1bdcbf5b628c565d558d01f5ba5c6dead5808d84 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sun, 19 Mar 2023 12:21:22 -0500 Subject: [PATCH 24/68] Fixed issue with no Woods mosiac on exit in vanilla OW --- owrando.asm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/owrando.asm b/owrando.asm index 4730478..6bafb68 100644 --- a/owrando.asm +++ b/owrando.asm @@ -1111,11 +1111,12 @@ OWDetermineScreensPaletteSet: ; A = OWID to check } OWSkipMosiac: { + PHA LDA.l OWMode : ORA.l OWMode+1 : BEQ .vanilla - PLA : PLA : PEA $A9F2 + PLA : PLA : PLA : PEA $A9F2 RTL .vanilla - LDA.b $8A : AND.b #$3F : BNE + ; what we wrote over, kinda + PLA : AND.b #$3F : BNE + ; what we wrote over, kinda PLA : PLA : PEA $A9E3 + RTL From d97f5fd23eafa9e054c4934f6ced4ebbdcf66f6d Mon Sep 17 00:00:00 2001 From: codemann8 Date: Wed, 22 Mar 2023 16:06:47 -0500 Subject: [PATCH 25/68] Set up code structure for future OW palette changes and return to safer changes --- LTTP_RND_GeneralBugfixes.asm | 3 ++ owrando.asm | 66 +++++++++++++++++++++++------------- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 1262569..a23bbb9 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -526,6 +526,9 @@ Dungeon_SaveRoomData_justKeys: org $02A4E3 Overworld_ActualScreenID: +org $02A9F3 +OverworldHandleTransitions_change_palettes: + org $02B861 Dungeon_SaveRoomQuadrantData: diff --git a/owrando.asm b/owrando.asm index 6bafb68..a308a9f 100644 --- a/owrando.asm +++ b/owrando.asm @@ -48,7 +48,8 @@ org $04E8B4 Overworld_LoadSpecialOverworld: org $02A9DA -JSL OWSkipMosiac +JSL OWSkipPalettes +BCC OverworldHandleTransitions_change_palettes : NOP #4 org $07982A Link_ResetSwimmingState: @@ -943,20 +944,12 @@ OWNewDestination: ; crossed OW shuffle and terrain ldx $05 : ldy $08 : jsr OWWorldTerrainUpdate - - lda $05 : sta $8a : JSR OWDetermineScreensPaletteSet - - ;PLA : AND.b #$3F : BEQ .leaving_woods - ;LDA $8A : AND.b #$3F : BEQ .entering_woods - CPX.w $0AB3 : BEQ .skip_palette ; check if next screen's palette is different - LDA $00 : PHA - JSL OverworldLoadScreensPaletteSet_long ; loading correct OW palette - PLA : STA $00 - ;.leaving_woods - ;.entering_woods - .skip_palette - lda $8a + ldx $8a : lda $05 : sta $8a : stx $05 ; $05 is prev screen id, $8a is dest screen + + jsr OWGfxUpdate + + lda $8a rep #$30 : rts } OWLoadSpecialArea: @@ -1084,6 +1077,23 @@ OWWorldTerrainUpdate: ; x = owid of destination screen, y = 1 for land to water, .return RTS } +OWGfxUpdate: +{ + REP #$20 : LDA.l OWMode : AND.w #$0207 : BEQ .is_only_mixed : SEP #$20 + ;;;;PLA : AND.b #$3F : BEQ .leaving_woods + LDA.b $8A : AND.b #$3F : BEQ .entering_woods + ;LDA.b $05 : JSL OWSkipPalettes : BCS .skip_palettes + LDA.b $8A : JSR OWDetermineScreensPaletteSet + CPX.w $0AB3 : BEQ .skip_palettes ; check if next screen's palette is different + LDA $00 : PHA + JSL OverworldLoadScreensPaletteSet_long ; loading correct OW palette + PLA : STA $00 + .leaving_woods + .entering_woods + .is_only_mixed + .skip_palettes + SEP #$20 +} OWLoadGearPalettes: { PHX : PHY : LDA $00 : PHA @@ -1105,21 +1115,29 @@ OWDetermineScreensPaletteSet: ; A = OWID to check CMP.b #$07 : BEQ .death_mountain LDX.b #$00 .death_mountain - PLA : PHX : TAX : LDA.l OWTileWorldAssoc,x : BEQ + + PLA : PHX : TAX : LDA.l OWTileWorldAssoc,X : BEQ + PLX : INX : RTS + PLX : RTS } -OWSkipMosiac: +OWSkipPalettes: { - PHA - LDA.l OWMode : ORA.l OWMode+1 : BEQ .vanilla - PLA : PLA : PLA : PEA $A9F2 - RTL + STA.b $05 ; A = previous screen, also stored in $05 + ; only skip mosaic if OWR Layout or Crossed + PHP : REP #$20 : LDA.l OWMode : AND.w #$0207 : BEQ .vanilla : PLP + ; checks to see if going to from any DM screens + ;LDA.b $05 : JSR OWDetermineScreensPaletteSet : TXA : AND.b #$FE : STA $04 + ;LDA.b $8A : JSR OWDetermineScreensPaletteSet : TXA : AND.b #$FE + ;CMP.b $04 : BNE .skip_palettes + BRA .vanilla+1 + .vanilla - PLA : AND.b #$3F : BNE + ; what we wrote over, kinda - PLA : PLA : PEA $A9E3 - + - RTL + PLP + LDA.b $05 : AND.b #$3F : BEQ .skip_palettes ; what we + LDA.b $8A : AND.b #$BF : BNE .change_palettes ; wrote over, kinda + .skip_palettes + SEC : RTL ; mosaic transition occurs + .change_palettes + CLC : RTL } OWAdjustExitPosition: { From bd2432d2cef52fe73bd2d91f1bac2466434d898d Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 17 Mar 2023 20:06:56 -0500 Subject: [PATCH 26/68] Moving some hijacked DR code to new location --- LTTP_RND_GeneralBugfixes.asm | 3 +++ doorrando/drhooks.asm | 7 +++---- doorrando/normal.asm | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 8ebfb5e..5da2f9a 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -510,6 +510,9 @@ Module_PreDungeon: org $028296 .setAmbientSfx +org $828AD9 +Underworld_SetBossOrSancMusicUponEntry: + org $02A0A8 Dungeon_SaveRoomData: diff --git a/doorrando/drhooks.asm b/doorrando/drhooks.asm index 8904c29..8f7816a 100644 --- a/doorrando/drhooks.asm +++ b/doorrando/drhooks.asm @@ -192,10 +192,9 @@ JSL.l Underworld_DoorDown_Entry : CPX #$FF BEQ + : db $80, $1C ; BRA $028B04 NOP #6 : + -org $82C3F2 ; <- Bank02.asm:10521 Unused call -Underworld_DoorDown_Call: -org $82C3F3 -dw $8AD9 ; address of Bank02.asm:2085 +org $82FD00 ; unreachable code +Underworld_SetBossOrSancMusicUponEntry_long: +JSR Underworld_SetBossOrSancMusicUponEntry : RTL org $81AA90 JSL BigKeyDoorCheck : NOP diff --git a/doorrando/normal.asm b/doorrando/normal.asm index e1fc8ee..2f45420 100644 --- a/doorrando/normal.asm +++ b/doorrando/normal.asm @@ -412,7 +412,7 @@ StraightStairsTrapDoor: .animateTraps lda #$05 : sta $11 inc $0468 : stz $068e : stz $0690 - ++ JSL Underworld_DoorDown_Call : rtl + ++ JML Underworld_SetBossOrSancMusicUponEntry_long + JML Dungeon_ApproachFixedColor ; what we wrote over } From 25dc4217c6d55f91ed6c7c21d34bf697b2b0d15e Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sun, 2 Apr 2023 07:39:02 -0500 Subject: [PATCH 27/68] Fixed Old Man Death causing fake world in glitched --- darkworldspawn.asm | 20 +++++++++++++------- doorrando/doortables.asm | 4 +++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/darkworldspawn.asm b/darkworldspawn.asm index 9911032..bef527f 100644 --- a/darkworldspawn.asm +++ b/darkworldspawn.asm @@ -10,12 +10,14 @@ DoWorldFix: LDA InvertedMode : BEQ + JMP DoWorldFix_Inverted + - LDA FollowerIndicator : CMP #$04 : BEQ .aga1Alive ; if old man following, skip mirror/aga check LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check - LDA MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror + LDA FollowerIndicator : CMP #$04 : BNE + ; if old man following, skip mirror/aga check + LDA.l OldManRetrievalWorld + BRA .noMirror + + LDA MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror .skip_mirror_check ; alt entrance point LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive - .aga1Alive + .setLightWorld LDA #$00 .noMirror STA CurrentWorld ; set flag to light world @@ -54,14 +56,18 @@ JMP DoWorldFix_skip_mirror_check RTL ;================================================================================ DoWorldFix_Inverted: - LDA FollowerIndicator : CMP #$04 : BEQ .aga1Alive ; if old man following, skip mirror/aga check LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check - LDA.l MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror + LDA FollowerIndicator : CMP #$04 : BNE + ; if old man following, skip mirror/aga check + LDA.l OldManRetrievalWorld + BRA .setWorld + + LDA.l MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror .skip_mirror_check ; alt entrance point LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive .noMirror - .aga1Alive - LDA #$40 : STA CurrentWorld ; set flag to dark world + .setDarkWorld + LDA #$40 + .setWorld + STA CurrentWorld ; set flag to dark world LDA.l SmithDeleteOnSave : BEQ .transform LDA FollowerIndicator CMP #$07 : BEQ .clear ; clear frog diff --git a/doorrando/doortables.asm b/doorrando/doortables.asm index abdd13e..1ae843a 100644 --- a/doorrando/doortables.asm +++ b/doorrando/doortables.asm @@ -693,4 +693,6 @@ dw $ffff SanctuaryDarkWorld: dw $ffff OldManDarkWorld: -dw $ffff \ No newline at end of file +dw $ffff +OldManRetrievalWorld: +dw $0000 \ No newline at end of file From dd29578c0a3a4959a969664ea6030a0a7eb64ca1 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Mon, 3 Apr 2023 08:21:16 -0500 Subject: [PATCH 28/68] Temporary fix for avoiding VRAM issues in non-layout OWR modes --- owrando.asm | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/owrando.asm b/owrando.asm index a308a9f..c4f512b 100644 --- a/owrando.asm +++ b/owrando.asm @@ -860,31 +860,33 @@ OWNewDestination: { tya : sta $4202 : lda #16 : sta $4203 ;wait 8 cycles rep #$20 : txa : nop : !add $4216 : tax ;a = offset to dest record - lda.w $0006,x : sta $06 ;set coord lda.w $0008,x : sta $04 ;save dest OW slot/ID - lda.w $000a,x : sta $84 ;VRAM - + ldy $20 : lda $418 : dec #2 : bpl + : ldy $22 : + sty $06 + ;;22 e0 e2 61c 61e - X ;;20 e6 e8 618 61a - Y ;keep current position if within incoming gap lda.w $0000,x : and #$01ff : pha : lda.w $0002,x : and #$01ff : pha - ldy $20 : lda $418 : dec #2 : bpl + : ldy $22 - + tya : and #$01ff : cmp 3,s : !blt .adjustMainAxis - dec : cmp 1,s : !bge .adjustMainAxis - inc : pha : lda $06 : and #$fe00 : !add 1,s : sta $06 : pla + LDA.l OWMode : AND.w #$0007 : BEQ .noLayoutShuffle ;temporary fix until VRAM issues are solved + lda.w $0006,x : sta $06 ;set coord + lda.w $000a,x : sta $84 ;VRAM + tya : and #$01ff : cmp 3,s : !blt .adjustMainAxis + dec : cmp 1,s : !bge .adjustMainAxis + inc : pha : lda $06 : and #$fe00 : !add 1,s : sta $06 : pla - ; adjust and set other VRAM addresses - lda.w $0006,x : pha : lda $06 : !sub 1,s - jsl DivideByTwoPreserveSign : jsl DivideByTwoPreserveSign : jsl DivideByTwoPreserveSign : jsl DivideByTwoPreserveSign : pha ; number of tiles - lda $418 : dec #2 : bmi + - pla : pea $0000 : bra ++ ;pla : asl #7 : pha : bra ++ ; y-axis shifts VRAM by increments of 0x80 (disabled for now) - + pla : asl : pha ; x-axis shifts VRAM by increments of 0x02 - ++ lda $84 : !add 1,s : sta $84 : pla : pla + ; adjust and set other VRAM addresses + lda.w $0006,x : pha : lda $06 : !sub 1,s + jsl DivideByTwoPreserveSign : jsl DivideByTwoPreserveSign : jsl DivideByTwoPreserveSign : jsl DivideByTwoPreserveSign : pha ; number of tiles + lda $418 : dec #2 : bmi + + pla : pea $0000 : bra ++ ;pla : asl #7 : pha : bra ++ ; y-axis shifts VRAM by increments of 0x80 (disabled for now) + + pla : asl : pha ; x-axis shifts VRAM by increments of 0x02 + ++ lda $84 : !add 1,s : sta $84 : pla : pla - .adjustMainAxis - LDA $84 : SEC : SBC #$0400 : AND #$0F00 : ASL : XBA : STA $88 ; vram - LDA $84 : SEC : SBC #$0010 : AND #$003E : LSR : STA $86 + .adjustMainAxis + LDA $84 : SEC : SBC #$0400 : AND #$0F00 : ASL : XBA : STA $88 ; vram + LDA $84 : SEC : SBC #$0010 : AND #$003E : LSR : STA $86 + .noLayoutShuffle LDA.w $000F,X : AND.w #$00FF : STA.w $06FC ; position to walk to after transition (if non-zero) LDY.w #$0000 From f89802a74e092a5c197bd5329bbecb611b4334a9 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Wed, 5 Apr 2023 08:31:30 -0500 Subject: [PATCH 29/68] Symmetrical GTCutscene Crystals --- LTTP_RND_GeneralBugfixes.asm | 11 ++++-- goalitem.asm | 72 +++++++++++++++++++++++++++--------- hooks.asm | 17 ++++++--- 3 files changed, 72 insertions(+), 28 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index a23bbb9..f6d3ba5 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -652,14 +652,17 @@ Ancilla_ReceiveItem: org $08C505 Ancilla_ReceiveItem_objectFinished: -org $08CE93 -Ancilla_BreakTowerSeal_draw_single_crystal: +org $08CE2E +GTCutscene_AnimateCrystals_NoRotate: + +org $08CEB6 +GTCutscene_DrawSingleCrystal_SkipCrystal: org $08CEC3 -Ancilla_BreakTowerSeal_stop_spawning_sparkles: +GTCutscene_DrawSingleCrystal_SkipSparkle: org $08CF59 -BreakTowerSeal_ExecuteSparkles: +GTCutscene_SparkleALot: org $08F710 Ancilla_SetOam_XY_Long: diff --git a/goalitem.asm b/goalitem.asm index aeb9f05..f047ed2 100644 --- a/goalitem.asm +++ b/goalitem.asm @@ -110,28 +110,64 @@ BRA .all_dungeons ;-------------------------------------------------------------------------------- -GetRequiredCrystalsForTower: - BEQ + : JSL.l BreakTowerSeal_ExecuteSparkles : + ; thing we wrote over - LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$00 : BNE + : JML.l Ancilla_BreakTowerSeal_stop_spawning_sparkles : + - LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$01 : BNE + : JML.l Ancilla_BreakTowerSeal_draw_single_crystal : + - LDA.l NumberOfCrystalsRequiredForTower : DEC #2 : TAX -JML.l GetRequiredCrystalsForTower_continue +GTCutscene_CrystalMasks: +db %00000000 ; 0 crystals +db %10000000 ; BIT INDEX DIAGRAM +db %00010010 ; 0 +db %00010101 ; 5 1 +db %10010101 ; 7 +db %10110110 ; 4 2 +db %00111111 ; 3 +db %10111111 ; 7 crystals ;-------------------------------------------------------------------------------- -GetRequiredCrystalsInX: - LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$00 : BNE + - TAX - RTL - + +GTCutscene_ConditionalAnimateCrystals: + PHX : PHX + LDA.l NumberOfCrystalsRequiredForTower : TAX : LDA.l GTCutscene_CrystalMasks,X + PLX + - LSR : DEX : BPL - + PLX : BCC .skip_crystal - TXA +.draw_crystal + LDA.b $11 : BEQ + : JML.l GTCutscene_AnimateCrystals_NoRotate ; what we wrote over + + JML.l GTCutscene_AnimateCrystals_NextCrystal+4 -- CMP.l NumberOfCrystalsRequiredForTower : BCC + - SBC.l NumberOfCrystalsRequiredForTower ; carry guaranteed set - BRA - +.skip_crystal + JML.l GTCutscene_DrawSingleCrystal-3 +;-------------------------------------------------------------------------------- +GTCutscene_ConditionalDrawSingleCrystal: + LDA.w $06FA : BEQ .draw_crystal : STZ.w $06FA + LDA.l NumberOfCrystalsRequiredForTower : TAX + LDA.l GTCutscene_CrystalMasks,X : AND.b #$80 : BEQ .skip_crystal +.draw_crystal + LDX.w $0FA0 : PHY ; what we wrote over + JML.l GTCutscene_DrawSingleCrystal+4 +.skip_crystal + JML.l GTCutscene_DrawSingleCrystal_SkipCrystal +;-------------------------------------------------------------------------------- +GTCutscene_AnimateCrystals_Prep: + BEQ + : JSL.l GTCutscene_SparkleALot : + ; thing we wrote over + LDA.l NumberOfCrystalsRequiredForTower : BNE + + JML.l GTCutscene_DrawSingleCrystal_SkipSparkle + + CMP.b #$01 : BNE + + JML.l GTCutscene_DrawSingleCrystal + + INC.w $06FA ; some free ram OWR also uses + JML.l GTCutscene_AnimateCrystals_NextCrystal-2 +;-------------------------------------------------------------------------------- +GTCutscene_ActivateSparkle_SelectCrystal: + LDA.l NumberOfCrystalsRequiredForTower : BNE + + TAX : RTL + + TXA - + INC : CMP.l NumberOfCrystalsRequiredForTower : BNE + - LDA.b #$08 - + : DEC : TAX + - CMP.l NumberOfCrystalsRequiredForTower : BCC + + SBC.l NumberOfCrystalsRequiredForTower : BRA - ; carry guaranteed set + + + PHY : TAY + LDA.l NumberOfCrystalsRequiredForTower : TAX : LDA.l GTCutscene_CrystalMasks,X + LDX.b #$FF + - LSR : INX : BCC + + DEY + + BPL - + PLY RTL ;-------------------------------------------------------------------------------- CheckEnoughCrystalsForGanon: diff --git a/hooks.asm b/hooks.asm index 13a92f3..9cd3bcb 100755 --- a/hooks.asm +++ b/hooks.asm @@ -502,16 +502,21 @@ JSL.l CheckEnoughCrystalsForTower NOP #4 db #$90 ; BCC ;-------------------------------------------------------------------------------- -org $08CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR BreakTowerSeal_ExecuteSparkles : LDX.b #$06) -JML.l GetRequiredCrystalsForTower -NOP #3 -GetRequiredCrystalsForTower_continue: +org $08CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR GTCutscene_SparkleALot : LDX.b #$06) +JML.l GTCutscene_AnimateCrystals_Prep : NOP +LDX.b #$05 +GTCutscene_AnimateCrystals_NextCrystal: +JML.l GTCutscene_ConditionalAnimateCrystals +;-------------------------------------------------------------------------------- +org $08CE93 +GTCutscene_DrawSingleCrystal: +JML.l GTCutscene_ConditionalDrawSingleCrystal ;-------------------------------------------------------------------------------- org $08CF19 ; <- 44F19 - ancilla_break_tower_seal.asm : 336 (TXA : AND.b #$07 : TAX) -JSL.l GetRequiredCrystalsInX +JSL.l GTCutscene_ActivateSparkle_SelectCrystal ;-------------------------------------------------------------------------------- org $08CFC9 ; <- 44FC9 - ancilla_break_tower_seal.asm : 414 (RTS) -db #$6B +RTL ;-------------------------------------------------------------------------------- ;================================================================================ From 511cc1af5169eabb0727941f3dea5384c2cd1c3c Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 7 Apr 2023 11:48:53 -0500 Subject: [PATCH 30/68] Fix for Hera music silence --- doorrando/spiral.asm | 5 +++++ msu.asm | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/doorrando/spiral.asm b/doorrando/spiral.asm index 81f8533..a0c0ae7 100644 --- a/doorrando/spiral.asm +++ b/doorrando/spiral.asm @@ -101,6 +101,11 @@ StairCleanup: { rts } +LookupSpiralOffset_long: + PHB : PHK : PLB + JSR LookupSpiralOffset + PLB : RTL + ;Sets the offset in A LookupSpiralOffset: { ;where link currently is in $a2: quad in a8 & #$03 diff --git a/msu.asm b/msu.asm index 7048d1d..f6bfbe0 100644 --- a/msu.asm +++ b/msu.asm @@ -376,8 +376,15 @@ CheckMusicLoadRequest: ; Fade out music if we're changing tracks on a stair transition ;-------------------------------------------------------------------------------- SpiralStairsPreCheck: - REP #$20 ; thing we wrote over - LDA.l DRMode : BNE .done ; exit if door rando enabled + LDA.l DRMode : BEQ + ; if door rando enabled + JSL LookupSpiralOffset_long + REP #$30 : AND.w #$00FF : ASL #2 : TAX + LDA.l SpiralTable,X + SEP #$10 : TAX : CPX.b #$07 : BNE .done ; check if hera boss + JSL CheckHeraBossDefeated : BCS .done + LDX.b #$F1 : STX !REG_MUSIC_CONTROL_REQUEST + BRA .done + + REP #$20 ; thing we wrote over LDA $A0 CMP.w #$000C : BNE + LDA !REG_CURRENT_MSU_TRACK : AND.w #$00FF : CMP.w #59 : BNE .done @@ -407,8 +414,11 @@ SpiralStairsPreCheck: ; Change music on stair transition (ToH/GT) ;-------------------------------------------------------------------------------- SpiralStairsPostCheck: - LDA.l DRMode : BNE .done ; exit if door rando enabled - LDA $A0 + LDA.l DRMode : BEQ + ; if door rando enabled + LDA.b $A2 : CMP.w #$0007 : BNE .done + LDX.b #$16 : STX !REG_MUSIC_CONTROL_REQUEST + BRA .done + + LDA $A0 CMP.w #$000C : BNE + ; Ganon's tower entrance LDX $0130 : CPX.b #$F1 : BNE .done ; Check that we were fading out From 12691a0c4a9e081353a8e0cfcb4648928053299d Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sun, 9 Apr 2023 11:07:39 -0500 Subject: [PATCH 31/68] Fixed issue with bonk drops causing other duplicate spawns --- owrando.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/owrando.asm b/owrando.asm index c4f512b..6651be8 100644 --- a/owrando.asm +++ b/owrando.asm @@ -520,7 +520,7 @@ OWBonkGoodBeeDrop: LDA.w $0D00,Y : SEC : SBC.l OWBonkPrizeTable[42].vert_offset : STA.w $0D00,Y LDA.w $0D20,Y : SBC #$00 : STA.w $0D20,Y - LDA.b #$01 : STA !REDRAW : STA !FORCE_HEART_SPAWN + LDA.b #$01 : STA !REDRAW .return PLY @@ -642,7 +642,7 @@ OWBonkDrops: LDA.w $0D00,Y : SEC : SBC.w OWBonkPrizeData,X : STA.w $0D00,Y LDA.w $0D20,Y : SBC #$00 : STA.w $0D20,Y - LDA.b #$01 : STA !REDRAW : STA !FORCE_HEART_SPAWN + LDA.b #$01 : STA !REDRAW PLB : RTL From 7da838d1fc0da620ab53c2a601f9b442ed4c5cb6 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Thu, 13 Apr 2023 15:00:57 -0500 Subject: [PATCH 32/68] Changed bonk drops to not set flag if sprite is off screen --- owrando.asm | 1 + 1 file changed, 1 insertion(+) diff --git a/owrando.asm b/owrando.asm index 6651be8..55420da 100644 --- a/owrando.asm +++ b/owrando.asm @@ -607,6 +607,7 @@ OWBonkDrops: .mark_collected ; S = Collected, FlagBitmask, X (row + 2) PLA : BNE + ; S = FlagBitmask, X (row + 2) + TYX : JSL Sprite_IsOnscreen : BCC + LDX.b $8A : LDA.l OverworldEventDataWRAM,X : ORA 1,S : STA.l OverworldEventDataWRAM,X REP #$20 From 08c178a97478074aa7ddfb2246b07c05bdd2d7c1 Mon Sep 17 00:00:00 2001 From: aerinon Date: Mon, 10 Apr 2023 12:18:52 -0600 Subject: [PATCH 33/68] Fix Kholdstare shell collision at Lanmo 2 or other tiles where the shell could limit movement. --- .../bugfix/kholdstare_shell_collision.asm | 51 +++++++++++++++++++ doorrando/doorrando.asm | 1 + 2 files changed, 52 insertions(+) create mode 100644 doorrando/bugfix/kholdstare_shell_collision.asm diff --git a/doorrando/bugfix/kholdstare_shell_collision.asm b/doorrando/bugfix/kholdstare_shell_collision.asm new file mode 100644 index 0000000..cfbf7a4 --- /dev/null +++ b/doorrando/bugfix/kholdstare_shell_collision.asm @@ -0,0 +1,51 @@ +pushpc + +org $9E9463 +JSL CheckKholdShellCoordinates +BCC Sprite_A3_KholdstareShell_link_not_close +BRA Sprite_A3_KholdstareShell_link_close +NOP #13 + +Sprite_A3_KholdstareShell_link_close = $9E9478 +Sprite_A3_KholdstareShell_link_not_close = $9E9480 + +pullpc + +CheckKholdShellCoordinates: + +LDA.w $0D30, X +XBA +LDA.w $0D10, X ; full 16 bit X coordinate of sprite + +REP #$21 +SBC.w #$0020 +CMP.b $22 +BCS .not_colliding + +ADC.w #$0040 +CMP.b $22 +BCC .not_colliding + +SEP #$20 +LDA.w $0D20, X +XBA +LDA.w $0D00, X ; full 16 bit Y coordinate of sprite + +REP #$21 +SBC.w #$001F ; could go to 27 and let link squeeze in at Lanmo 2 (please adjust the following one) +CMP.b $20 +BCS .not_colliding + +ADC.w #$0037 +CMP.b $20 +BCC .not_colliding + +SEP #$20 ; collision detected +SEC +RTL + +.not_colliding +SEP #$30 +CLC +RTL + diff --git a/doorrando/doorrando.asm b/doorrando/doorrando.asm index 6511dd2..08bdccd 100644 --- a/doorrando/doorrando.asm +++ b/doorrando/doorrando.asm @@ -58,6 +58,7 @@ incsrc math.asm incsrc hudadditions.asm incsrc dr_lobby.asm incsrc entrance_fixes.asm +incsrc bugfix/kholdstare_shell_collision.asm warnpc $A79C00 incsrc doortables.asm From 8a9b138d55b6447fea637db5a3d12cd4a278470f Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sat, 15 Apr 2023 01:09:38 -0500 Subject: [PATCH 34/68] Animate standing rupees instead of drawing new OAM slot --- utilities.asm | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/utilities.asm b/utilities.asm index f229bd0..3158132 100644 --- a/utilities.asm +++ b/utilities.asm @@ -411,9 +411,11 @@ PrepDynamicTile: + TXA JSR.w LoadDynamicTileOAMTable - JSL.l GetSpriteID ; convert loot id to sprite id - JSL.l GetAnimatedSpriteTile_variable - LDA.b #$00 : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID + CMP.b #$34 : BCC + + CMP.b #$37 : BCS + : BRA ++ ; if rupees, don't draw to OAM + + JSL.l GetSpriteID ; convert loot id to sprite id + JSL.l GetAnimatedSpriteTile_variable + ++ LDA.b #$00 : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID PLY : PLX : PLA RTL ;-------------------------------------------------------------------------------- @@ -433,7 +435,11 @@ LoadDynamicTileOAMTable: STA.l !SPRITE_OAM+2 LDA.w #$0200 : STA.l !SPRITE_OAM+6 SEP #$20 ; set 8-bit accumulator - LDA.b #$24 : STA.l !SPRITE_OAM+4 + LDA $01,s : CMP.b #$34 : BCC + + CMP.b #$37 : BCS + ; if rupees, use animated gfx already in OAM + LDA.b #$0B : BRA ++ + + LDA.b #$24 + ++ STA.l !SPRITE_OAM+4 LDA $01,s @@ -445,11 +451,14 @@ LoadDynamicTileOAMTable: BRA .done .narrow - REP #$20 ; set 16-bit accumulator + LDA $02,s : CMP.b #$34 : BCC + + CMP.b #$37 : REP #$20 : BCS + ; if rupees, use animated gfx already in OAM + LDA.w #$1B00 : BRA ++ + + LDA.w #$3400 + ++ STA.l !SPRITE_OAM+11 LDA.w #$0000 : STA.l !SPRITE_OAM+7 STA.l !SPRITE_OAM+14 LDA.w #$0800 : STA.l !SPRITE_OAM+9 - LDA.w #$3400 : STA.l !SPRITE_OAM+11 .done PLP : PLA From bd2ebd782718f54595e53a7c02be4b3c4513ae56 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sat, 15 Apr 2023 05:17:22 -0500 Subject: [PATCH 35/68] Animate standing rupees for enemy drops --- keydrop/dynamic_si_vram.asm | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 56edbce..3702c49 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -5,6 +5,7 @@ DynamicDropGFX = $7EF500 ; we're expecting 5 items max per room, and order is irrelevant ; we just need to keep track of where they go DynamicDropGFXIndex = $7E1E70 +!DynamicDropGFXSlotCount = (FreeUWGraphics_end-FreeUWGraphics)>>1 ; this will keep track of the above for each item SprItemGFX = $7E0780 @@ -17,13 +18,17 @@ DynamicDropQueue = $7E1E72 ; A = item receipt ID ; X = slot RequestStandingItemVRAMSlot: - STA.w DynamicDropQueue + CMP.b #$34 : BCC + + CMP.b #$37 : BCS + ; if rupees, use animated rupee OAM slot + LDA.b #!DynamicDropGFXSlotCount : STA.w SprItemGFX,X + RTL + + STA.w DynamicDropQueue LDA.b #$01 STA.w DynamicDropRequest LDA.w DynamicDropGFXIndex INC - CMP.b #$05 : BCC .fine + CMP.b #!DynamicDropGFXSlotCount : BCC .fine LDA.b #$00 @@ -31,7 +36,6 @@ RequestStandingItemVRAMSlot: STA.w DynamicDropGFXIndex STA.w SprItemGFX,X - ; decompress graphics PHX LDX.w DynamicDropQueue @@ -50,7 +54,6 @@ RequestStandingItemVRAMSlot: RTL - ;=================================================================================================== TransferPotGFX: @@ -94,16 +97,11 @@ FreeUWGraphics: dw $8800>>1 dw $8840>>1 dw $8980>>1 - dw $9CA0>>1 - dw $9DC0>>1 - -; dw $8800>>1 -; dw $8840>>1 -; dw $8980>>1 ; dw $9960>>1 # Arghuss Splash apparently ; dw $9C00>>1 -; dw $9CA0>>1 -; dw $9DC0>>1 + dw $9CA0>>1 + dw $9DC0>>1 +.end ;=================================================================================================== @@ -163,6 +161,11 @@ DynamicOAMTile_thin: dw 0, 0 : db $EE, $00, $20, $00 dw 0, 8 : db $FE, $00, $20, $00 + ; add new slots above this line + + dw 0, 0 : db $0B, $00, $20, $00 ; animated rupees slot + dw 0, 8 : db $1B, $00, $20, $00 + DynamicOAMTile_full: dw -4, -1 : db $40, $00, $20, $02 dd 0, 0 From 3d9b76eda0059f06758315f271776df9ee4b1137 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sun, 16 Apr 2023 04:34:55 -0500 Subject: [PATCH 36/68] Fix pottery to retain gfx during map check --- LTTP_RND_GeneralBugfixes.asm | 3 +++ doorrando/drhooks.asm | 4 ++++ keydrop/standing_items.asm | 8 ++++++++ 3 files changed, 15 insertions(+) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index f6d3ba5..69de78c 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -500,6 +500,9 @@ Attract_DecompressStoryGfx: org $00E529 LoadSelectScreenGfx: +org $00E784 +LoadCommonSprites_in_file_select: + org $00F945 PrepDungeonExit: diff --git a/doorrando/drhooks.asm b/doorrando/drhooks.asm index 0a8d5a9..ac189a5 100644 --- a/doorrando/drhooks.asm +++ b/doorrando/drhooks.asm @@ -222,3 +222,7 @@ JSL AlwaysPushThroughFDoors ; JSL FixOvalFadeOutMirror : NOP #2 ; LDA $7EF3CA : BNE $05AFDF ; org $85AFDF ; Sprite_6C_MirrorPortal_missing_mirror: + +org $80E766 +JML ConditionalLoadCommonSprites_Do3To4Low : NOP #2 +LoadCommonSprites_Prep3To4Low: diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index 1434574..971f2b6 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -618,6 +618,14 @@ SetTheSceneFix: JSL LoadCommonSprites_long RTL +ConditionalLoadCommonSprites_Do3To4Low: + LDA.b $10 : CMP.b #$01 : BEQ + ; what we wrote over + CMP.b #$0E : BEQ ++ + JML LoadCommonSprites_Prep3To4Low + + JML LoadCommonSprites_in_file_select +++ LDA.b #$50 : STA.w $2117 ; skip over some DMA bytes +JML Sound_LoadLightWorldSongBank-1 ; just some RTS in Bank 00 + incsrc dynamic_si_vram.asm ;=================================================================================================== From 40d301b3e0a48c45182c71d111d8d8b1721dc46b Mon Sep 17 00:00:00 2001 From: codemann8 Date: Thu, 20 Apr 2023 20:32:18 -0500 Subject: [PATCH 37/68] Animate standing rupees instead of drawing new OAM slot --- utilities.asm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/utilities.asm b/utilities.asm index 3158132..a4aa35f 100644 --- a/utilities.asm +++ b/utilities.asm @@ -412,7 +412,7 @@ PrepDynamicTile: TXA JSR.w LoadDynamicTileOAMTable CMP.b #$34 : BCC + - CMP.b #$37 : BCS + : BRA ++ ; if rupees, don't draw to OAM + CMP.b #$36+1 : BCS + : BRA ++ ; if rupees, don't draw to OAM + JSL.l GetSpriteID ; convert loot id to sprite id JSL.l GetAnimatedSpriteTile_variable ++ LDA.b #$00 : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID @@ -436,7 +436,7 @@ LoadDynamicTileOAMTable: LDA.w #$0200 : STA.l !SPRITE_OAM+6 SEP #$20 ; set 8-bit accumulator LDA $01,s : CMP.b #$34 : BCC + - CMP.b #$37 : BCS + ; if rupees, use animated gfx already in OAM + CMP.b #$36+1 : BCS + ; if rupees, use animated gfx already in OAM LDA.b #$0B : BRA ++ + LDA.b #$24 ++ STA.l !SPRITE_OAM+4 @@ -452,9 +452,11 @@ LoadDynamicTileOAMTable: .narrow LDA $02,s : CMP.b #$34 : BCC + - CMP.b #$37 : REP #$20 : BCS + ; if rupees, use animated gfx already in OAM + CMP.b #$36+1 : BCS + ; if rupees, use animated gfx already in OAM + REP #$20 LDA.w #$1B00 : BRA ++ - + LDA.w #$3400 + + REP #$20 + LDA.w #$3400 ++ STA.l !SPRITE_OAM+11 LDA.w #$0000 : STA.l !SPRITE_OAM+7 STA.l !SPRITE_OAM+14 @@ -566,7 +568,7 @@ LoadModifiedTileBufferAddress: PHA LDA !TILE_UPLOAD_OFFSET_OVERRIDE : BEQ + TAX - LDY.w #$0002 + LDY.w #$0002 LDA.w #$0000 : STA !TILE_UPLOAD_OFFSET_OVERRIDE BRA .done + From 90396136d36ea06343d944c8fce3d9ffecd86f66 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Mon, 24 Apr 2023 00:08:54 -0500 Subject: [PATCH 38/68] Fixed issue with Bonk Drops not spawning due to OW flags --- heartpieces.asm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/heartpieces.asm b/heartpieces.asm index 71e6da7..fbb8759 100644 --- a/heartpieces.asm +++ b/heartpieces.asm @@ -129,12 +129,18 @@ RTL RTL ;-------------------------------------------------------------------------------- HeartUpgradeSpawnDecision: ; this should return #$00 to make the hp spawn - LDA !FORCE_HEART_SPAWN : BEQ .normal_behavior + LDA !FORCE_HEART_SPAWN : BEQ .bonk_prize_check DEC : STA !FORCE_HEART_SPAWN LDA #$00 RTL - + .bonk_prize_check + PHX + LDA 2,S : TAX : LDA.w $0ED0, X : BEQ .normal_behavior-1 + PLX + LDA.b #$00 +RTL + PLX .normal_behavior LDA OverworldEventDataWRAM, X RTL From 20f8ef457e8887191e2c92bb8b7ebf6da244e061 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 5 May 2023 00:13:05 -0500 Subject: [PATCH 39/68] Converting item GFX drawing to use pottery draw method --- LTTP_RND_GeneralBugfixes.asm | 5 +- bookofmudora.asm | 22 ++- bugfixes.asm | 21 +++ catfish.asm | 12 +- flute.asm | 5 +- heartpieces.asm | 83 ++++++----- hooks.asm | 11 +- init.asm | 1 + inventory.asm | 47 +++---- keydrop/dynamic_si_vram.asm | 259 ++++++++++++++++++++++++++++------- keydrop/standing_items.asm | 48 ++++--- owrando.asm | 34 +++-- shopkeeper.asm | 11 -- stats.asm | 2 - tables.asm | 3 +- tablets.asm | 3 +- utilities.asm | 14 +- zoraking.asm | 12 +- 18 files changed, 399 insertions(+), 194 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 69de78c..7ece3aa 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -44,7 +44,10 @@ dw !ROM_VERSION_HIGH !MS_GOT = "$7F5031" -!REDRAW = "$7F5000" +;!REDRAW = "$7F5000" +!SPRITE_REDRAW = "$7E0790" ; 16 bytes +!SPRITE_OAM = "$7EC025" ; 16 bytes +!SPRITE_DYNAMIC_OAM = "$7EC035" ; 16 bytes !GANON_WARP_CHAIN = "$7F5032"; !TILE_UPLOAD_BUFFER = "$7EA180"; diff --git a/bookofmudora.asm b/bookofmudora.asm index 0e2f335..412b9b7 100644 --- a/bookofmudora.asm +++ b/bookofmudora.asm @@ -5,13 +5,12 @@ LoadLibraryItemGFX: LDA.l LibraryItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID %GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues) STA $0E80, X ; Store item type - JSL.l PrepDynamicTile -RTL + JML RequestSlottedTile ;-------------------------------------------------------------------------------- DrawLibraryItemGFX: PHA LDA $0E80, X ; Retrieve stored item type - JSL.l DrawDynamicTile + JSL.l DrawSlottedTile PLA RTL ;-------------------------------------------------------------------------------- @@ -25,27 +24,22 @@ RTL ;================================================================================ ; Randomize Bonk Keys ;-------------------------------------------------------------------------------- -!REDRAW = "$7F5000" -;-------------------------------------------------------------------------------- LoadBonkItemGFX: LDA.b #$08 : STA $0F50, X ; thing we wrote over LoadBonkItemGFX_inner: - LDA.b #$00 : STA !REDRAW JSR LoadBonkItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID JSR LoadBonkItem - JSL.l PrepDynamicTile -RTL + JML RequestSlottedTile ;-------------------------------------------------------------------------------- DrawBonkItemGFX: PHA - LDA !REDRAW : BEQ .skipInit ; skip init if already ready - JSL.l LoadBonkItemGFX_inner - BRA .done ; don't draw on the init frame + LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready + JSL.l LoadBonkItemGFX_inner + BRA .done ; don't draw on the init frame .skipInit - - JSR LoadBonkItem - JSL.l DrawDynamicTileNoShadow + JSR LoadBonkItem + JSL DrawSlottedTile .done PLA diff --git a/bugfixes.asm b/bugfixes.asm index 8555c5e..32764e2 100644 --- a/bugfixes.asm +++ b/bugfixes.asm @@ -200,6 +200,27 @@ LDA $1B : BNE + + RTL +;-------------------------------------------------------------------------------- +; Fix losing VRAM gfx when using quake +PostNMIUpdateBGCharHalf: + STA.w $420B : SEP #$10 ; what we wrote over + LDA.w $0116 : CMP.b #$46 : BNE .return ; checks to see if this is the last VRAM write + LDA.b $5D : CMP.b #$08 : BCC + : CMP.b #$0A+1 : BCS + ; skip if we're mid-medallion + RTL + + JSL HeartPieceSetRedraw ; set redraw flag for items +.return +RTL + +; Force redraws of items following map checks +PostOverworldGfxLoad: + INC.b $11 : STZ.b $13 ; what we wrote over + JSL HeartPieceSetRedraw +RTL +PostUnderworldMap: + JSL HeartPieceSetRedraw + LDA.l $7EC229 ; what we wrote over +RTL + ;-------------------------------------------------------------------------------- FixJingleGlitch: LDA.b $11 diff --git a/catfish.asm b/catfish.asm index ee55c48..30351fb 100644 --- a/catfish.asm +++ b/catfish.asm @@ -1,25 +1,23 @@ ;================================================================================ ; Randomize Catfish ;-------------------------------------------------------------------------------- -!HEART_REDRAW = "$7F5000" LoadCatfishItemGFX: LDA.l CatfishItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID - LDA.l $1DE185 ; location randomizer writes catfish item to - JML PrepDynamicTile + LDA.l $1DE185 ; location randomizer writes catfish item to + JML RequestSlottedTile ;-------------------------------------------------------------------------------- DrawThrownItem: LDA $8A : CMP.b #$81 : BNE .catfish .zora - LDA.b #$01 : STA !HEART_REDRAW - LDA.l $1DE1C3 ; location randomizer writes zora item to + LDA.l $1DE1C3 ; location randomizer writes zora item to BRA .draw .catfish - LDA.l $1DE185 ; location randomizer writes catfish item to + LDA.l $1DE185 ; location randomizer writes catfish item to .draw - JML DrawDynamicTile + JML DrawSlottedTile ;-------------------------------------------------------------------------------- MarkThrownItem: PHA diff --git a/flute.asm b/flute.asm index 7128602..33f9985 100644 --- a/flute.asm +++ b/flute.asm @@ -7,12 +7,13 @@ SpawnHauntedGroveItem: LDA.l HauntedGroveItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID %GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues) - JSL.l PrepDynamicTile - + LDA.b #$EB STA $7FFE00 JSL Sprite_SpawnDynamically + LDA.b #$01 : STA.w !SPRITE_REDRAW, Y + LDX.b #$00 LDA $2F : CMP.b #$04 : BEQ + : INX : + diff --git a/heartpieces.asm b/heartpieces.asm index fbb8759..1996177 100644 --- a/heartpieces.asm +++ b/heartpieces.asm @@ -49,28 +49,26 @@ HeartContainerGet: BRA HeartPieceGet_skipLoad ;-------------------------------------------------------------------------------- -!REDRAW = "$7F5000" DrawHeartPieceGFX: PHP JSL.l Sprite_IsOnscreen : BCC .offscreen PHA : PHY - LDA !REDRAW : BEQ .skipInit ; skip init if already ready - JSL.l HeartPieceSpritePrep - JMP .done ; don't draw on the init frame + LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready + JSL.l HeartPieceSpritePrep + BRA .done ; don't draw on the init frame .skipInit LDA $0E80, X ; Retrieve stored item type - + .skipLoad - - JSL.l DrawDynamicTile - - CMP #$03 : BNE + - PHA : LDA $0E60, X : ORA.b #$20 : STA $0E60, X : PLA - + - - JSL.l Sprite_DrawShadowLong + JSL DrawSlottedTile : BCS .done + ; draw shadow + CMP #$03 : BNE + + INC.b $00 : INC.b $00 : INC.b $00 : INC.b $00 ; move narrow sprite shadow over 4 pixels + PHA : LDA $0E60, X : ORA.b #$20 : STA $0E60, X : PLA + + + JSL.l Sprite_DrawShadowLong .done PLY : PLA @@ -78,20 +76,17 @@ DrawHeartPieceGFX: PLP RTL ;-------------------------------------------------------------------------------- -!REDRAW = "$7F5000" DrawHeartContainerGFX: PHP JSL.l Sprite_IsOnscreen : BCC DrawHeartPieceGFX_offscreen PHA : PHY - LDA !REDRAW : BEQ .skipInit ; skip init if already ready - JSL.l HeartContainerSpritePrep - BRA DrawHeartPieceGFX_done ; don't draw on the init frame + LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready + JSL.l HeartContainerSpritePrep + BRA DrawHeartPieceGFX_done ; don't draw on the init frame .skipInit - LDA $0E80, X ; Retrieve stored item type - - BRA DrawHeartPieceGFX_skipLoad + BRA DrawHeartPieceGFX_skipInit ;-------------------------------------------------------------------------------- HeartContainerSound: LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE + @@ -160,34 +155,28 @@ RTL LDA OverworldEventDataWRAM, X : ORA.b #$40 : STA OverworldEventDataWRAM, X RTL ;-------------------------------------------------------------------------------- -!REDRAW = "$7F5000" HeartPieceSpritePrep: PHA LDA ServerRequestMode : BEQ + : : + - LDA #$01 : STA !REDRAW - LDA $5D : CMP #$14 : BEQ .skip ; skip if we're mid-mirror - - LDA #$00 : STA !REDRAW + LDA.b #$01 : STA.w !SPRITE_REDRAW, X JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID JSL.l LoadHeartPieceRoomValue ; load item type STA $0E80, X ; Store item type - JSL.l PrepDynamicTile + JSL.l RequestSlottedTile .skip PLA RTL ;-------------------------------------------------------------------------------- -!REDRAW = "$7F5000" HeartContainerSpritePrep: PHA - LDA #$00 : STA !REDRAW JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID JSL.l LoadHeartContainerRoomValue ; load item type STA $0E80, X ; Store item type - JSL.l PrepDynamicTile + JSL.l RequestSlottedTile PLA RTL @@ -202,7 +191,6 @@ LoadHeartPieceRoomValue: .done RTL ;-------------------------------------------------------------------------------- -!REDRAW = "$7F5000" HPItemReset: PHA LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE .skip @@ -212,7 +200,6 @@ HPItemReset: .skip PLA .done - PHA : LDA #$01 : STA !REDRAW : PLA RTL ;-------------------------------------------------------------------------------- MaybeMarkDigSpotCollected: @@ -857,3 +844,37 @@ HeartPieceGetPlayer: PLY RTL } +;-------------------------------------------------------------------------------- +HeartPieceSetRedraw: + PHY + LDY.b #$0F + .next + LDA.w $0DD0,Y : BEQ ++ + LDA.w $0E20,Y : CMP.b #$EB : BEQ + ; heart piece + CMP.b #$E4 : BEQ + ; enemy key drop + CMP.b #$3B : BEQ + ; bonk item (book/key) + CMP.b #$E5 : BEQ + ; enemy big key drop + CMP.b #$E7 : BEQ + ; mushroom item + CMP.b #$E9 : BEQ + ; powder item + BRA ++ + + LDA.b #$01 : STA.w !SPRITE_REDRAW,Y + ++ DEY : BPL .next + PLY +RTL +HeartPieceGetRedraw: + PHY + LDY.b #$0F + .next + LDA.w $0DD0,Y : BEQ ++ + LDA.w $0E20,Y : CMP.b #$EB : BEQ + ; heart piece + CMP.b #$E4 : BEQ + ; enemy key drop + CMP.b #$3B : BEQ + ; bonk item (book/key) + CMP.b #$E5 : BEQ + ; enemy big key drop + CMP.b #$E7 : BEQ + ; mushroom item + CMP.b #$E9 : BEQ + ; powder item + BRA ++ + + LDA.w !SPRITE_REDRAW,Y : BEQ ++ + PLY : SEC : RTL + ++ DEY : BPL .next + PLY +CLC : RTL diff --git a/hooks.asm b/hooks.asm index 9cd3bcb..ad32f79 100755 --- a/hooks.asm +++ b/hooks.asm @@ -36,6 +36,9 @@ org $00821B ; <- 21B - Bank00.asm : 329 (LDA $13 : STA $2100) JML.l PostNMIHookAction : NOP PostNMIHookReturn: ;-------------------------------------------------------------------------------- +org $008F6C +JSL PostNMIUpdateBGCharHalf : NOP +;-------------------------------------------------------------------------------- ;================================================================================ ; Anti-ZSNES Hook @@ -1069,6 +1072,10 @@ JSL HandleBombAbsorbtion ;org $09873F ; <- 04873F - ancilla_init.asm : 960 (ADC [$00] : STA [$00] ) ;JSL.l AddToStock ;-------------------------------------------------------------------------------- +org $02EB18 +JSL PostOverworldGfxLoad +org $18BD55 +JSL PostUnderworldMap ;================================================================================ ; Kholdstare Shell Fix @@ -1324,7 +1331,7 @@ NOP #5 ;-------------------------------------------------------------------------------- org $05EE5F ; <- 2EE5F - sprite_mushroom.asm : 30 JSL.l LoadMushroom -NOP +BRA + : NOP #7 : + ;-------------------------------------------------------------------------------- org $05EE78 ; <- 2EE78 - sprite_mushroom.asm : 58 JSL.l DrawMushroom @@ -1371,6 +1378,8 @@ org $07A303 ; 3A303 - Bank07.asm : 5622 org $07A3A2 ; 3A3A2 - Bank07.asm : 5720 - JSL DiggingGameGuy_AttemptPrizeSpawn JSL.l SpawnShovelItem BRA _Bank07_5726 +org $1DFDAC +JSL.l SpawnShovelGamePrize org $07A3AB ; 3A3AB - Bank07.asm : 5726 - LDA.b #$12 : JSR Player_DoSfx2 _Bank07_5726: ;org $07A381 ; 3A381 - Bank07.asm : 5693 - ORA $035B diff --git a/init.asm b/init.asm index 36bb4b5..888986f 100644 --- a/init.asm +++ b/init.asm @@ -10,6 +10,7 @@ Init_Primary: LDX #$00 ; initalize our ram - STA $7EC025, X + STA $7EC035, X STA $7F5000, X INX CPX #$10 : !BLT - diff --git a/inventory.asm b/inventory.asm index 82ec1de..0b60e6e 100644 --- a/inventory.asm +++ b/inventory.asm @@ -952,8 +952,7 @@ LoadPowder: LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID %GetPossiblyEncryptedItem(WitchItem, SpriteItemValues) STA $0DA0, Y ; Store item type - JSL.l PrepDynamicTile - STA $7F505E + LDA.b #$01 : STA.w !SPRITE_REDRAW, Y LDA #$00 STA $7F505F STA $7F5060 @@ -977,21 +976,16 @@ RTL ;-------------------------------------------------------------------------------- ; DrawPowder: ;-------------------------------------------------------------------------------- -!REDRAW = "$7F5000" -;-------------------------------------------------------------------------------- DrawPowder: LDA $02DA : BNE .defer ; defer if link is buying a potion - LDA.l !REDRAW : BEQ + + LDA.w !SPRITE_REDRAW, X : BEQ + LDA.l WitchItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA $0DA0, X ; Retrieve stored item type - JSL.l PrepDynamicTile - LDA #$00 : STA.l !REDRAW ; reset redraw flag - BRA .defer + JML RequestSlottedTile + ; this fights with the shopkeep code, so had to move the powder draw there when potion shop is custom - LDA !SHOP_TYPE : CMP.b #$FF : BNE .defer - LDA $0DA0, X ; Retrieve stored item type - JSL.l DrawDynamicTile + LDA $0DA0, X ; Retrieve stored item type + JML DrawSlottedTile .defer RTL ;-------------------------------------------------------------------------------- @@ -1002,19 +996,12 @@ RTL LoadMushroom: LDA.b #$00 : STA $0DC0, X ; thing we wrote over .justGFX - ;LDA MushroomItem - ;JSL.l PrepDynamicTile - PHA - LDA #$01 : STA !REDRAW - LDA $5D : CMP #$14 : BEQ .skip ; skip if we're mid-mirror - - LDA #$00 : STA !REDRAW LDA.l MushroomItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID %GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) STA $0E80, X ; Store item type - JSL.l PrepDynamicTile + JSL.l RequestSlottedTile .skip PLA @@ -1024,19 +1011,17 @@ RTL ;-------------------------------------------------------------------------------- ; DrawMushroom: ;-------------------------------------------------------------------------------- -!REDRAW = "$7F5000" -;-------------------------------------------------------------------------------- DrawMushroom: PHA : PHY - LDA !REDRAW : BEQ .skipInit ; skip init if already ready - JSL.l LoadMushroom_justGFX - BRA .done ; don't draw on the init frame + LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready + JSL.l LoadMushroom_justGFX + BRA .done ; don't draw on the init frame .skipInit LDA $0E80, X ; Retrieve stored item type - JSL.l DrawDynamicTile + JSL.l DrawSlottedTile - .done + .done PLY : PLA RTL ;-------------------------------------------------------------------------------- @@ -1130,11 +1115,13 @@ RTL ;-------------------------------------------------------------------------------- ; SpawnShovelItem: ;-------------------------------------------------------------------------------- -!REDRAW = "$7F5000" +SpawnShovelGamePrize: + JSL Sprite_SpawnDynamically ; thing we wrote over + LDA.b #$01 : STA.w !SPRITE_REDRAW, Y +RTL +;-------------------------------------------------------------------------------- SpawnShovelItem: - LDA.b #$01 : STA !REDRAW - - LDA $03FC : BEQ + + LDA $03FC : BEQ + JSL DiggingGameGuy_AttemptPrizeSpawn JMP .skip + diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 3702c49..775c156 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -1,57 +1,117 @@ ; where we shove the decompressed graphics to send to WRAM -DynamicDropGFX = $7EF500 +DynamicDropGFX = $7ECC00 ; this will just count from 0 to 4 to determine which slot we're using ; we're expecting 5 items max per room, and order is irrelevant ; we just need to keep track of where they go DynamicDropGFXIndex = $7E1E70 -!DynamicDropGFXSlotCount = (FreeUWGraphics_end-FreeUWGraphics)>>1 +!DynamicDropGFXSlotCount_UW = (FreeUWGraphics_end-FreeUWGraphics)>>1 +!DynamicDropGFXSlotCount_OW = (FreeOWGraphics_end-FreeOWGraphics)>>1 ; this will keep track of the above for each item SprItemGFX = $7E0780 -; this is the item requested and a flag -DynamicDropRequest = $7E1E71 -DynamicDropQueue = $7E1E72 +; this is the item requested and a flag (we anticipate no more than 3 requests to be active, but built to support 8) +DynamicDropRequest = $7E1E71 ; bitfield indicating which request slot to process +DynamicDropQueue = $7E1E72 ; 0x08 bytes, occupies 1 byte for each slot in the request queue (loot id at first, but stores GFX index) ; Come in with ; A = item receipt ID ; X = slot -RequestStandingItemVRAMSlot: - CMP.b #$34 : BCC + - CMP.b #$37 : BCS + ; if rupees, use animated rupee OAM slot - LDA.b #!DynamicDropGFXSlotCount : STA.w SprItemGFX,X - RTL - + STA.w DynamicDropQueue - LDA.b #$01 - STA.w DynamicDropRequest +RequestSlottedTile: + PHX : PHY + + PHA + ; skip sending the request if busy with other + LDA.b $11 : CMP.b #$21 : BCS ++ ; skip if OW is loading Map16 GFX ; TODO: Figure out how to allow submodule 22, check DMA status instead + LDA.b $5D : CMP.b #$14 : BEQ ++ ; skip if we're mid-mirror + LDA.b $1B : BEQ + ; OW current doesn't occupy any slots that medallion gfx do + CMP.b #$08 : BCC + : CMP.b #$0A+1 : BCS + ; skip if we're mid-medallion + ++ PLA : JMP .return + + + + LDA.w $0E20, X : CMP.b #$C0 : BNE + ; if catfish + TYX + + CMP.b #$52 : BNE + ; if zora + TYX + + + + LDA 1,S : JSL.l GetSpritePalette : STA $0F50, X ; setup the palette + PLA + + ; gfx that are already present, use that instead of a new slot + CMP.b #$34 : BCC + : CMP.b #$36+1 : BCS + ; if rupees, use animated rupee OAM slot + LDA.b $1B : BEQ ++ + LDA.b #!DynamicDropGFXSlotCount_UW + BRA +++ + ++ LDA.b #!DynamicDropGFXSlotCount_OW + +++ STA.w SprItemGFX,X + JMP .success + + CMP.b #$A0 : BCC + : CMP.b #$AF+1 : BCS + ; if key, use key OAM slot + LDA.b $1B : BEQ ++ + LDA.b #!DynamicDropGFXSlotCount_UW + BRA +++ + ++ LDA.b #!DynamicDropGFXSlotCount_OW + +++ INC : STA.w SprItemGFX,X + JMP .success + + + + PHA : PHX + LDY.b #$00 + LDA.w DynamicDropRequest + - LSR : INY : BCS - + CPY.b #$08 : BCC + + ; all request slots occupied, exit without drawing + PLX : PLA + LDY.b #$FE ; indicate failure + BRA .return + + TYX + LDA.b #$00 : SEC + - ROL : DEX : BNE - + DEY ; y = slot index, a = new request bit flag + ORA.w DynamicDropRequest + STA.w DynamicDropRequest + PLX : PLA + STA.w DynamicDropQueue,Y LDA.w DynamicDropGFXIndex INC - CMP.b #!DynamicDropGFXSlotCount : BCC .fine + PHX + LDX.b $1B : BEQ + + CMP.b #!DynamicDropGFXSlotCount_UW : BCC .fine + BRA ++ + + CMP.b #!DynamicDropGFXSlotCount_OW : BCC .fine - LDA.b #$00 + ++ LDA.b #$00 .fine + PLX STA.w DynamicDropGFXIndex STA.w SprItemGFX,X ; decompress graphics - PHX - LDX.w DynamicDropQueue + PHX : PHY REP #$20 LDA.w #DynamicDropGFX-$7E9000 - STA.l !TILE_UPLOAD_OFFSET_OVERRIDE + TYX : BEQ + + - CLC : ADC.w #$0080 : DEX : BNE - + + STA.l !TILE_UPLOAD_OFFSET_OVERRIDE SEP #$20 - LDA.w DynamicDropQueue + LDA.w DynamicDropQueue,Y JSL.l GetSpriteID JSL.l GetAnimatedSpriteTile_variable SEP #$30 - PLX + PLY : PLX + LDA.w DynamicDropGFXIndex : STA.w DynamicDropQueue,Y + LDA.w DynamicDropQueue,Y ; we want A to return the loot id + .success + STZ.w !SPRITE_REDRAW, X + .return + PLY : PLX RTL ;=================================================================================================== @@ -59,22 +119,38 @@ RequestStandingItemVRAMSlot: TransferPotGFX: SEP #$10 REP #$20 - LDX.w DynamicDropRequest + LDA.w DynamicDropRequest : AND.w #$00FF BEQ .no - STZ.w DynamicDropRequest + .next + LDY.b #$00 + - INY : LSR : BCC - - LDA.w DynamicDropGFXIndex + PHY + LDA.w #$0000 + - ROL : DEY : BNE - + PLY + DEY ; y = slot index, a = request bit flag + + EOR.w DynamicDropRequest : STA.w DynamicDropRequest + + LDA.w DynamicDropQueue,Y ASL TAX - LDA.l FreeUWGraphics,X - STA.w $2116 + LDA.b $1B : AND.w #$00FF : BEQ + + LDA.l FreeUWGraphics,X + BRA ++ + + LDA.l FreeOWGraphics,X + ++ STA.w $2116 ; calculate bottom row now CLC : ADC.w #$0200>>1 : PHA LDX.b #$7E : STX.w $4314 - LDA.w #DynamicDropGFX : STA.w $4302 + LDA.w #DynamicDropGFX + CPY.b #$00 : BEQ + + - CLC : ADC.w #$0080 : DEY : BNE - + + STA.w $4302 LDX.b #$80 : STX.w $2115 LDA.w #$1801 : STA.w $4300 @@ -89,6 +165,9 @@ TransferPotGFX: STA.w $2116 STY.w $420B + LDA.w DynamicDropRequest : AND.w #$00FF + BNE .next + .no RTL @@ -97,55 +176,99 @@ FreeUWGraphics: dw $8800>>1 dw $8840>>1 dw $8980>>1 -; dw $9960>>1 # Arghuss Splash apparently +; dw $9960>>1 ; Arghuss Splash apparently ; dw $9C00>>1 dw $9CA0>>1 dw $9DC0>>1 .end -;=================================================================================================== +FreeOWGraphics: + ;dw $8800>>1 ; Shovel Dirt + dw $9960>>1 ; Arghuss/Zora Splash + dw $9C00>>1 ; Heart Piece + dw $9CA0>>1 ; Apple + ;dw $9DC0>>1 ; Whirlpool +.end -DrawPotItem: +;=================================================================================================== +; Come in with +; A = item receipt ID +; X = sprite slot +; Returns with Carry flag set if gfx drawing was skipped +DrawSlottedTile: + PHA + ; TODO: allow drawing if gfx are not using a VRAM slot that changes during medallion + LDA.b $5D : CMP.b #$08 : BCC + : CMP.b #$0A+1 : BCS + ; skip if we're mid-medallion + PLA : SEC : RTL + + + PLA JSL.l IsNarrowSprite : BCS .narrow + ; TODO: Instead of loading the whole fixed 16 bytes from DynamicOAMTile**_** into !SPRITE_DYNAMIC_OAM + ; Do something more like how DrawDynamicTile does it + ; Then we won't need all the separate DynamicOAMTile**_** tables .full LDA.b #$01 : STA $06 LDA #$0C : JSL.l OAM_AllocateFromRegionC LDA #$02 : PHA REP #$20 - LDA.w #DynamicOAMTile_full - BRA .draw + LDA.b $1B : AND.w #$00FF : BEQ + + LDA.w #DynamicOAMTileUW_full + BRA .transfer + + LDA.w #DynamicOAMTileOW_full + BRA .transfer .narrow LDA.b #$02 : STA $06 LDA #$10 : JSL.l OAM_AllocateFromRegionC LDA #$03 : PHA - REP #$20 - LDA.w #DynamicOAMTile_thin - .draw - PHB : PHK : PLB - + REP #$20 + LDA.b $1B : AND.w #$00FF : BEQ + + LDA.w #DynamicOAMTileUW_thin + BRA .transfer + + LDA.w #DynamicOAMTileOW_thin + .transfer STA.b $08 LDA.w SprItemGFX,X AND.w #$00FF ASL : ASL : ASL : ASL ADC.b $08 STA.b $08 - SEP #$20 - STZ.b $07 + PHK : PLY : STY.b $0A + LDY #$7E : PHB : PHY : PLB - LDA.b #$00 : STA.l !SKIP_EOR - JSL Sprite_DrawMultiple_quantity_preset + ; transfer fixed table data into WRAM + LDY.b #$0E + - LDA.b [$08],Y : STA.w !SPRITE_DYNAMIC_OAM,Y + DEY : DEY : BPL - - LDA.b $90 : CLC : ADC.b #$08 : STA.b $90 - INC.b $92 - INC.b $92 + LDA.w SprItemFlags, X : AND.w #$00FF : BNE .draw + LDA.b $06 : LSR : BCC + + ; full + LDA.w #$0000 + STA.w !SPRITE_DYNAMIC_OAM : STA.w !SPRITE_DYNAMIC_OAM+2 + BRA .draw + + ; narrow + LDA.w $0E20, X : AND.w #$00FF : CMP.w #$003B : BEQ .draw ; bonk item + LDA.w #$0004 + STA.w !SPRITE_DYNAMIC_OAM : STA.w !SPRITE_DYNAMIC_OAM+8 + .draw + LDA.w #!SPRITE_DYNAMIC_OAM : STA.b $08 + SEP #$20 + STZ.b $07 + LDA.b #$00 : STA.l !SKIP_EOR + JSL Sprite_DrawMultiple_quantity_preset PLB + + LDA.b $90 : CLC : ADC.b #$08 : STA.b $90 + INC.b $92 : INC.b $92 + PLA + CLC RTL -DynamicOAMTile_thin: +DynamicOAMTileUW_thin: dw 0, 0 : db $40, $00, $20, $00 dw 0, 8 : db $50, $00, $20, $00 @@ -166,7 +289,10 @@ DynamicOAMTile_thin: dw 0, 0 : db $0B, $00, $20, $00 ; animated rupees slot dw 0, 8 : db $1B, $00, $20, $00 -DynamicOAMTile_full: + dw 0, 0 : db $6B, $00, $20, $00 ; key + dw 0, 8 : db $7B, $00, $20, $00 + +DynamicOAMTileUW_full: dw -4, -1 : db $40, $00, $20, $02 dd 0, 0 @@ -180,4 +306,45 @@ DynamicOAMTile_full: dd 0, 0 dw -4, -1 : db $EE, $00, $20, $02 - dd 0, 0 \ No newline at end of file + dd 0, 0 + +DynamicOAMTileOW_thin: + ; dw 0, 0 : db $40, $00, $20, $00 + ; dw 0, 8 : db $50, $00, $20, $00 + + dw 0, 0 : db $CB, $00, $20, $00 + dw 0, 8 : db $DB, $00, $20, $00 + + dw 0, 0 : db $E0, $00, $20, $00 + dw 0, 8 : db $F0, $00, $20, $00 + + dw 0, 0 : db $E5, $00, $20, $00 + dw 0, 8 : db $F5, $00, $20, $00 + + ;dw 0, 0 : db $EE, $00, $20, $00 + ;dw 0, 8 : db $FE, $00, $20, $00 + + ; add new slots above this line + + dw 0, 0 : db $0B, $00, $20, $00 ; animated rupees slot + dw 0, 8 : db $1B, $00, $20, $00 + + dw 0, 0 : db $6B, $00, $20, $00 ; key + dw 0, 8 : db $7B, $00, $20, $00 + +DynamicOAMTileOW_full: + ; dw 0, 0 : db $40, $00, $20, $02 + ; dd 0, 0 + + dw 0, 0 : db $CB, $00, $20, $02 + dd 0, 0 + + dw 0, 0 : db $E0, $00, $20, $02 + dd 0, 0 + + dw 0, 0 : db $E5, $00, $20, $02 + dd 0, 0 + + ;dw 0, 0 : db $EE, $00, $20, $02 + ;dd 0, 0 + diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index 971f2b6..2d5c02a 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -436,36 +436,40 @@ SpriteKeyPrep: LDA.w SpawnedItemMWPlayer : STA SprItemMWPlayer, X LDA.w SpawnedItemFlag : STA SprItemFlags, X : BEQ + LDA.l SpawnedItemID : STA $0E80, X - PHA - JSL.l GetSpritePalette : STA $0F50, X ; setup the palette - PLA CMP #$24 : BNE ++ ; LDA $A0 : CMP.b #$80 : BNE + LDA SpawnedItemFlag : BNE + LDA #$24 ; it's the big key drop? - ++ JSL RequestStandingItemVRAMSlot + ++ JSL RequestSlottedTile + PLA RTL SpriteKeyDrawGFX: - JSL Sprite_DrawRippleIfInWater - PHA - LDA $0E80, X - CMP.b #$24 : BNE + - LDA $A0 : CMP #$80 : BNE ++ - LDA SpawnedItemFlag : BNE ++ - LDA #$24 : BRA + - ++ PLA - PHK : PEA.w .jslrtsreturn-1 - PEA.w $068014 ; an rtl address - 1 in Bank06 - JML Sprite_DrawAbsorbable - .jslrtsreturn - RTL - + JSL DrawPotItem - CMP #$03 : BNE + - PHA : LDA $0E60, X : ORA.b #$20 : STA $0E60, X : PLA - + JSL.l Sprite_DrawShadowLong - PLA : RTL + JSL Sprite_DrawRippleIfInWater + PHA + LDA.w !SPRITE_REDRAW, X : BEQ + + LDA $0E80, X + JSL RequestSlottedTile + BRA .skipDraw + + LDA $0E80, X + CMP.b #$24 : BNE + + LDA $A0 : CMP #$80 : BNE ++ + LDA SpawnedItemFlag : BNE ++ + LDA #$24 : BRA + + ++ PLA + PHK : PEA.w .jslrtsreturn-1 + PEA.w $068014 ; an rtl address - 1 in Bank06 + JML Sprite_DrawAbsorbable + .jslrtsreturn + RTL + + JSL DrawSlottedTile : BCS .skipDraw + ; draw shadow + CMP #$03 : BNE + + PHA : LDA $0E60, X : ORA.b #$20 : STA $0E60, X : PLA + + JSL.l Sprite_DrawShadowLong + .skipDraw + PLA + RTL KeyGet: LDA CurrentSmallKeys ; what we wrote over diff --git a/owrando.asm b/owrando.asm index 55420da..ba37b0f 100644 --- a/owrando.asm +++ b/owrando.asm @@ -495,33 +495,35 @@ OWBonkGoodBeeDrop: ; spawn itemget item .spawn_item ; A = item id ; Y = bonk sprite slot ; S = Collected PLX : BEQ + : LDA.b #$00 : STA.w $0DD0,Y : BRA .return - + LDA.b #$01 : STA !REDRAW + + PHA LDA.b #$EB : STA.l $7FFE00 JSL Sprite_SpawnDynamically+15 ; +15 to skip finding a new slot, use existing sprite - TYX : STZ.w $0F20,X ; layer the sprite is on - + LDA.b #$01 : STA.w !SPRITE_REDRAW,Y + + PLA : STA.w $0E80,Y + ; affects the rate the item moves in the Y/X direction - STZ.w $0D40,X + LDA.b #$00 : STA.w $0D40,Y LDA.b #$0A : STA.w $0D50,Y LDA.b #$1A : STA.w $0F80,Y ; amount of force (gives height to the arch) LDA.b #$FF : STA.w $0B58,Y ; stun timer LDA.b #$30 : STA.w $0F10,Y ; aux delay timer 4 ?? dunno what that means + LDA.b #$00 : STA.w $0F20,Y ; layer the sprite is on + ; sets the tile type that is underneath the sprite, water - LDA.b #$09 : STA.l $7FF9C2,X ; TODO: Figure out how to get the game to set this + TYX : LDA.b #$09 : STA.l $7FF9C2,X ; TODO: Figure out how to get the game to set this ; sets OW event bitmask flag, uses free RAM LDA.l OWBonkPrizeTable[42].flag : STA.w $0ED0,Y - + ; determines the initial spawn point of item LDA.w $0D00,Y : SEC : SBC.l OWBonkPrizeTable[42].vert_offset : STA.w $0D00,Y LDA.w $0D20,Y : SBC #$00 : STA.w $0D20,Y - LDA.b #$01 : STA !REDRAW - .return PLY LDA #$08 ; makes original good bee not spawn @@ -618,13 +620,15 @@ OWBonkDrops: ; spawn itemget item .spawn_item ; A = item id ; Y = tree sprite slot ; S = Collected, FlagBitmask, X (row + 2) PLX : BEQ + : LDA.b #$00 : STA.w $0DD0,Y : JMP .return ; S = FlagBitmask, X (row + 2) - + LDA 2,S : TAX : INX - - LDA.b #$01 : STA !REDRAW + + PHA LDA.b #$EB : STA.l $7FFE00 JSL Sprite_SpawnDynamically+15 ; +15 to skip finding a new slot, use existing sprite + LDA.b #$01 : STA.w !SPRITE_REDRAW,Y + + PLA : STA.w $0E80,Y + ; affects the rate the item moves in the Y/X direction LDA.b #$00 : STA.w $0D40,Y LDA.b #$0A : STA.w $0D50,Y @@ -637,14 +641,12 @@ OWBonkDrops: ; sets OW event bitmask flag, uses free RAM PLA : STA.w $0ED0,Y ; S = X (row + 2) - + ; determines the initial spawn point of item PLX : INX : INX : INX LDA.w $0D00,Y : SEC : SBC.w OWBonkPrizeData,X : STA.w $0D00,Y LDA.w $0D20,Y : SBC #$00 : STA.w $0D20,Y - LDA.b #$01 : STA !REDRAW - PLB : RTL .return @@ -958,7 +960,9 @@ OWNewDestination: OWLoadSpecialArea: { LDA.l Overworld_LoadSpecialOverworld_RoomId,X : STA.b $A0 - JSL Overworld_LoadSpecialOverworld ; sets M and X flags + CMP.w #$0182 : BNE + + JSL ZoraSplashGfxFix + + JSL Overworld_LoadSpecialOverworld ; sets M and X flags TYX LDY.b #$00 CPX.b #$01 : BNE + ; check if going to water transition diff --git a/shopkeeper.asm b/shopkeeper.asm index e87c788..3dfb41a 100644 --- a/shopkeeper.asm +++ b/shopkeeper.asm @@ -4,7 +4,6 @@ ;-------------------------------------------------------------------------------- !BIGRAM = "$7EC900"; ;-------------------------------------------------------------------------------- -!SPRITE_OAM = "$7EC025" ; A = Tile ID macro UploadOAM(dest) PHA : PHP @@ -770,8 +769,6 @@ RTS ;-------------------------------------------------------------------------------- ;!SHOP_TYPE = "$7F5051" ;!SHOP_INVENTORY = "$7F5052" -!SPRITE_OAM = "$7EC025" -!REDRAW = "$7F5000" Shopkeeper_DrawItems: PHB : PHK : PLB PHX : PHY @@ -787,14 +784,6 @@ Shopkeeper_DrawItems: + CMP.b #$01 : BNE + : ++ JSR.w Shopkeeper_DrawNextItem + - LDA $A0 : CMP.b #$09 : BNE + ; render powder slot if potion shop - LDA !REDRAW : BNE + ; if not redrawing - LDA $02DA : BNE + ; if not buying item - LDA $7F505E : BEQ + ; if potion slot filled - LDA $0ABF : BEQ + ; haven't left the room - LDA NpcFlags+1 : AND.b #$20 : BNE + - LDX.b #$0C : LDY.b #$03 : JSR.w Shopkeeper_DrawNextItem - + PLY : PLX PLB RTS diff --git a/stats.asm b/stats.asm index db89a99..4b8f776 100644 --- a/stats.asm +++ b/stats.asm @@ -318,9 +318,7 @@ RTL IndoorTileTransitionCounter: JMP StatTransitionCounter ;-------------------------------------------------------------------------------- -!REDRAW = "$7F5000" IndoorSubtileTransitionCounter: - LDA.b #$01 : STA !REDRAW ; set redraw flag for items STZ $0646 ; stuff we wrote over STZ $0642 JMP StatTransitionCounter diff --git a/tables.asm b/tables.asm index 0ad13f9..360732e 100644 --- a/tables.asm +++ b/tables.asm @@ -1470,8 +1470,9 @@ dw #9999 ; Rupee Limit ; $2F8000 - $2F83FF - RNG Block ;================================================================================ ; $7EC025 - $7EC034 - Item OAM Table +; $7EC035 - $7EC044 - Dynamic Item OAM Table ;================================================================================ -; $7F5000 - Redraw Flag +; $7F5000 - FREE (Old Global Redraw Flag) ; $7F5001 - Flipper Softlock Possible ; $7F5002 - L/R Rotate ; $7F5003 - HexToDec 1st Digit diff --git a/tablets.asm b/tablets.asm index 3d49304..5c7929e 100644 --- a/tablets.asm +++ b/tablets.asm @@ -34,7 +34,6 @@ SpawnTabletItem: JSL.l HeartPieceGetPlayer : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID JSL.l LoadOutdoorValue PHA - JSL.l PrepDynamicTile LDA.b #$01 : STA !FORCE_HEART_SPAWN : STA !SKIP_HEART_SAVE JSL.l SetTabletItem @@ -42,6 +41,8 @@ SpawnTabletItem: LDA.b #$EB STA $7FFE00 JSL Sprite_SpawnDynamically + + LDA.b #$01 : STA.w !SPRITE_REDRAW, Y PLA : STA $0E80, Y ; Store item type LDA $22 : STA $0D10, Y diff --git a/utilities.asm b/utilities.asm index a4aa35f..c1eaa80 100644 --- a/utilities.asm +++ b/utilities.asm @@ -411,8 +411,7 @@ PrepDynamicTile: + TXA JSR.w LoadDynamicTileOAMTable - CMP.b #$34 : BCC + - CMP.b #$36+1 : BCS + : BRA ++ ; if rupees, don't draw to OAM + CMP.b #$34 : BCC + : CMP.b #$36+1 : BCS + : BRA ++ ; if rupees, don't draw to OAM + JSL.l GetSpriteID ; convert loot id to sprite id JSL.l GetAnimatedSpriteTile_variable ++ LDA.b #$00 : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID @@ -424,8 +423,6 @@ RTL ; LoadDynamicTileOAMTable ; in: A - Loot ID ;-------------------------------------------------------------------------------- 20/847B -!SPRITE_OAM = "$7EC025" -;-------------------------------------------------------------------------------- LoadDynamicTileOAMTable: PHA : PHP @@ -435,8 +432,8 @@ LoadDynamicTileOAMTable: STA.l !SPRITE_OAM+2 LDA.w #$0200 : STA.l !SPRITE_OAM+6 SEP #$20 ; set 8-bit accumulator - LDA $01,s : CMP.b #$34 : BCC + - CMP.b #$36+1 : BCS + ; if rupees, use animated gfx already in OAM + LDA $01,s + CMP.b #$34 : BCC + : CMP.b #$36+1 : BCS + ; if rupees, use animated gfx already in OAM LDA.b #$0B : BRA ++ + LDA.b #$24 ++ STA.l !SPRITE_OAM+4 @@ -451,8 +448,8 @@ LoadDynamicTileOAMTable: BRA .done .narrow - LDA $02,s : CMP.b #$34 : BCC + - CMP.b #$36+1 : BCS + ; if rupees, use animated gfx already in OAM + LDA $02,s + CMP.b #$34 : BCC + : CMP.b #$36+1 : BCS + ; if rupees, use animated gfx already in OAM REP #$20 LDA.w #$1B00 : BRA ++ + REP #$20 @@ -474,7 +471,6 @@ RTS ;-------------------------------------------------------------------------------- ; This wastes two OAM slots if you don't want a shadow - fix later - I wrote "fix later" over a year ago and it's still not fixed (Aug 6, 2017) - lol (May 25th, 2019) ;-------------------------------------------------------------------------------- 2084B8 -!SPRITE_OAM = "$7EC025" !SKIP_EOR = "$7F5008" ;-------------------------------------------------------------------------------- DrawDynamicTile: diff --git a/zoraking.asm b/zoraking.asm index 020d805..db39a42 100644 --- a/zoraking.asm +++ b/zoraking.asm @@ -4,7 +4,17 @@ LoadZoraKingItemGFX: LDA.l ZoraItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.l $1DE1C3 ; location randomizer writes zora item to - JML.l PrepDynamicTile + JML RequestSlottedTile +;-------------------------------------------------------------------------------- +ZoraSplashGfxFix: + PHA : PHX : PHY : SEP #$30 + ; below should be set to the index used for Arrghus/Zora Splash + ; FreeOWGraphics in dynamic_si_vram.asm, whatever index is $9960 + ; this makes it so the first gfx that is loading is AFTER the splash + LDA.b #$00 : STA.w DynamicDropGFXIndex + JSL LoadCommonSprites_long + REP #$30 : PLY : PLX : PLA + RTL ;-------------------------------------------------------------------------------- JumpToSplashItemTarget: LDA $0D90, X From 48b22381090bd0482e9457a60cb676a329f09acc Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 5 May 2023 22:09:37 -0500 Subject: [PATCH 40/68] Animate rupee items in shops --- shopkeeper.asm | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/shopkeeper.asm b/shopkeeper.asm index 3dfb41a..843957e 100644 --- a/shopkeeper.asm +++ b/shopkeeper.asm @@ -815,8 +815,13 @@ Shopkeeper_DrawNextItem: CMP.b #$2E : BNE + : BRA .potion + CMP.b #$2F : BNE + : BRA .potion + CMP.b #$30 : BEQ .potion + + CMP.b #$34 : BCC .normal : CMP.b #$36+1 : BCS .normal + BRA .rupee .normal LDA.w .tile_indices, Y : BRA + ; get item gfx index + .rupee + LDA.b #$0B ; rupee is #$0B because it's already there in VRAM + BRA .vramLoc .potion LDA.b #$C0 ; potion is #$C0 because it's already there in VRAM + @@ -828,18 +833,23 @@ Shopkeeper_DrawNextItem: XBA AND #$FE + .vramLoc STA.l !SPRITE_OAM+4 + PHA - PHX : LDA #0 : XBA : TXA : LSR #2 : TAX : LDA.l !SHOP_INVENTORY_DISGUISE, X : PLX : CMP #$0 : BNE ++ - LDA.l !SHOP_INVENTORY, X ; get item palette - ++ - JSL.l GetSpritePalette : STA.l !SPRITE_OAM+5 + PHX : LDA #0 : XBA : TXA : LSR #2 : TAX : LDA.l !SHOP_INVENTORY_DISGUISE, X : PLX : CMP #$0 : BNE ++ + LDA.l !SHOP_INVENTORY, X ; get item palette + ++ + JSL.l GetSpritePalette : STA.l !SPRITE_OAM+5 - LDA.w .tile_indices, Y : AND.b #$01 : BEQ +; get tile index sheet + PLA + AND.b #$01 : BNE .oam1 ; special case for rupee item + LDA.w .tile_indices, Y : AND.b #$01 : BEQ ++ ; get tile index sheet + .oam1 LDA.l !SPRITE_OAM+5 ORA.b #$1 STA.l !SPRITE_OAM+5 - + + ++ LDA.b #$00 : STA.l !SPRITE_OAM+6 From 9500800c3ceb30df8090a3e6abb5c4686199625b Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 5 May 2023 22:11:19 -0500 Subject: [PATCH 41/68] Minor formatting and small optimization --- bookofmudora.asm | 4 ++-- catfish.asm | 4 ++-- doorrando/hudadditions.asm | 2 +- doorrando/normal.asm | 2 +- keydrop/standing_items.asm | 36 ++++++++++++++++++------------------ 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/bookofmudora.asm b/bookofmudora.asm index 412b9b7..d413984 100644 --- a/bookofmudora.asm +++ b/bookofmudora.asm @@ -63,7 +63,7 @@ RTL LoadBonkItem: LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte CMP #115 : BNE + ; Desert Bonk Key - LDA.l BonkKey_Desert + LDA.l BonkKey_Desert BRA ++ + : CMP #140 : BNE + ; GTower Bonk Key LDA.l BonkKey_GTower @@ -79,7 +79,7 @@ LoadBonkItem_Player: LDA.l BonkKey_Desert_Player BRA ++ + : CMP #140 : BNE + ; GTower Bonk Key - LDA.l BonkKey_GTower_Player + LDA.l BonkKey_GTower_Player BRA ++ + LDA.b #$00 diff --git a/catfish.asm b/catfish.asm index 30351fb..7429cb7 100644 --- a/catfish.asm +++ b/catfish.asm @@ -25,12 +25,12 @@ MarkThrownItem: LDA $8A : CMP.b #$81 : BNE .catfish .zora - JSL.l ItemSet_ZoraKing + JSL.l ItemSet_ZoraKing LDA ZoraItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID BRA .done .catfish - JSL.l ItemSet_Catfish + JSL.l ItemSet_Catfish LDA CatfishItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID .done diff --git a/doorrando/hudadditions.asm b/doorrando/hudadditions.asm index c77f411..362b389 100644 --- a/doorrando/hudadditions.asm +++ b/doorrando/hudadditions.asm @@ -16,7 +16,7 @@ HudAdditions: + JSL HexToDec_fast .skip LDA #$207F : STA !GOAL_DRAW_ADDRESS+2 : STA !GOAL_DRAW_ADDRESS+4 - PLA : PHA : CMP.w #100 : !BLT + + LDA.b 1,S : CMP.w #100 : !BLT + LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit + PLA : CMP.w #10 : !BLT + LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit diff --git a/doorrando/normal.asm b/doorrando/normal.asm index 9352837..6fcb7e5 100644 --- a/doorrando/normal.asm +++ b/doorrando/normal.asm @@ -433,7 +433,7 @@ HandleSpecialDoorLanding: { HandleIncomingDoorState: PHA LDA.l DRMode : BEQ .noDoor - PLA : PHA : AND.b #$FA : CMP.b #$80 : bne .noDoor + LDA.b 1,S : AND.b #$FA : CMP.b #$80 : bne .noDoor .setDoorState LDA.w $0418 : AND.b #$02 : BNE + : INC diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index 2d5c02a..12ac19b 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -472,21 +472,21 @@ SpriteKeyDrawGFX: RTL KeyGet: - LDA CurrentSmallKeys ; what we wrote over - PHA - LDA.l StandingItemsOn : BNE + - PLA : RTL - + LDY $0E80, X - LDA SprItemIndex, X : STA SpawnedItemIndex - LDA SprItemFlags, X : STA SpawnedItemFlag - LDA $A0 : CMP #$87 : BNE + ;check for hera cage - LDA SpawnedItemFlag : BNE + ; if it came from a pot, it's fine - JSR ShouldKeyBeCountedForDungeon : BCC ++ + LDA CurrentSmallKeys ; what we wrote over + PHA + LDA.l StandingItemsOn : BNE + + PLA : RTL + + LDY $0E80, X + LDA SprItemIndex, X : STA SpawnedItemIndex + LDA SprItemFlags, X : STA SpawnedItemFlag + LDA $A0 : CMP #$87 : BNE + ;check for hera cage + LDA SpawnedItemFlag : BNE + ; if it came from a pot, it's fine + JSR ShouldKeyBeCountedForDungeon : BCC ++ JSL CountChestKeyLong - ++ PLA : RTL - + STY $00 - LDA SprItemMWPlayer, X : STA !MULTIWORLD_ITEM_PLAYER_ID : BNE .receive - PHX + ++ PLA : RTL + + STY $00 + LDA SprItemMWPlayer, X : STA !MULTIWORLD_ITEM_PLAYER_ID : BNE .receive + PHX LDA $040C : CMP #$FF : BNE + LDA $00 : CMP.b #$AF : BNE .skip LDA CurrentGenericKeys : INC : STA CurrentGenericKeys @@ -499,10 +499,10 @@ KeyGet: ++ PLX : PLA : RTL + CMP.b #$AF : beq .countIt ; universal key CMP.b #$24 : beq .countIt ; small key for this dungeon - .skip PLX - .receive - JSL $0791b3 ; Player_HaltDashAttackLong - JSL.l Link_ReceiveItem + .skip PLX + .receive + JSL $0791b3 ; Player_HaltDashAttackLong + JSL.l Link_ReceiveItem PLA : DEC : RTL KeyTable: From bae7457961332a9dedd72f8c10d2ec31a1b8f62b Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 5 May 2023 22:13:38 -0500 Subject: [PATCH 42/68] Fix bonk dupe and bonk despawn issues --- LTTP_RND_GeneralBugfixes.asm | 1 + owrando.asm | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 7ece3aa..3fc4202 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -100,6 +100,7 @@ function hexto555(h) = ((((h&$FF)/8)<<10)|(((h>>8&$FF)/8)<<5)|(((h>>16&$FF)/8)<< !FLAG_OW_MIXED = $04 !FLAG_OW_CROSSED = $02 +!FLAG_OW_BONKDROP = $02 incsrc hooks.asm incsrc treekid.asm diff --git a/owrando.asm b/owrando.asm index ba37b0f..166aa1e 100644 --- a/owrando.asm +++ b/owrando.asm @@ -424,14 +424,16 @@ LoadMapDarkOrMixed: OWBonkGoodBeeDrop: { - LDA.l OWFlags+1 : AND.b #$02 : BNE .shuffled + LDA.l OWFlags+1 : AND.b #!FLAG_OW_BONKDROP : BNE .shuffled .vanilla ; what we wrote over STZ.w $0DD0,X LDA.l BottleContentsOne : ORA.l BottleContentsTwo ORA.l BottleContentsThree : ORA.l BottleContentsFour RTL .shuffled - PHY : TXY + LDA.w $0DD0,X : BNE + + JMP .return+1 + + PHY : TXY LDA.l RoomDataWRAM[$0120].high : AND.b #$02 : PHA : BNE + ; check if collected LDA.b #$1B : STA $12F ; JSL Sound_SetSfx3PanLong ; seems that when you bonk, there is a pending bonk sfx, so we clear that out and replace with reveal secret sfx + @@ -497,6 +499,8 @@ OWBonkGoodBeeDrop: PLX : BEQ + : LDA.b #$00 : STA.w $0DD0,Y : BRA .return + PHA + LDA.b #$01 : STA !FORCE_HEART_SPAWN + LDA.b #$EB : STA.l $7FFE00 JSL Sprite_SpawnDynamically+15 ; +15 to skip finding a new slot, use existing sprite @@ -535,8 +539,10 @@ OWBonkDrops: { CMP.b #$D8 : BEQ + RTL - + LDA.l OWFlags+1 : AND.b #!FLAG_OW_CROSSED : BNE + + + LDA.l OWFlags+1 : AND.b #!FLAG_OW_BONKDROP : BNE + JSL.l Sprite_TransmuteToBomb : RTL + + LDA.w $0DD0,Y : BNE + + RTL + ; loop thru rando bonk table to find match @@ -622,6 +628,8 @@ OWBonkDrops: PLX : BEQ + : LDA.b #$00 : STA.w $0DD0,Y : JMP .return ; S = FlagBitmask, X (row + 2) + PHA + LDA.b #$01 : STA !FORCE_HEART_SPAWN + LDA.b #$EB : STA.l $7FFE00 JSL Sprite_SpawnDynamically+15 ; +15 to skip finding a new slot, use existing sprite From 09d93ae5f2a42a65c30fdd1b3f4f3289f3ed7a10 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Mon, 8 May 2023 05:01:44 -0500 Subject: [PATCH 43/68] Apples and Bee Traps now spawn automatically under pots --- keydrop/standing_items.asm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index 12ac19b..6d64aa9 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -258,6 +258,10 @@ SaveMajorItemDrop: LDA.w #$0018 : BRA .substitute + CPY.w #$0031 : BNE + ; 10 pack bombs LDA.w #$0019 : BRA .substitute + + CPY.w #$00B1 : BNE + ; Apples + LDA.w #$001A : BRA .substitute + + CPY.w #$00B0 : BNE + ; Bee Trap + LDA.w #$001B : BRA .substitute + STA $0B9C ; indicates we should use the key routines or a substitute RTL .substitute @@ -553,7 +557,9 @@ SubstitionTable: db $DB ; RED RUPEE - 0x16 db $E2 ; ARROW REFILL 10 - 0x17 db $DD ; BOMB REFILL 4 - 0x18 - db $DE ; BOMB REFILL 8 - 0x19 + db $DE ; BOMB REFILL 8 - 0x19 + db $AC ; APPLES - 0x1A + db $79 ; BEE TRAP - 0x1B SubstituteSpriteId: From 9651f9fb1d0c44cb506ac22f4df92391df7996d3 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Mon, 8 May 2023 07:48:48 -0500 Subject: [PATCH 44/68] Added better GFX for fairy and good bee --- keydrop/dynamic_si_vram.asm | 48 +++++++++++++++++++++++++++++ shopkeeper.asm | 61 +++++++++++++++++++++++++++++-------- utilities.asm | 7 +++-- 3 files changed, 101 insertions(+), 15 deletions(-) diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 775c156..1c1d8a8 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -54,6 +54,20 @@ RequestSlottedTile: ++ LDA.b #!DynamicDropGFXSlotCount_OW +++ INC : STA.w SprItemGFX,X JMP .success + + CMP.b #$B5 : BNE + ; if good bee, use bee OAM slot + LDA.b $1B : BEQ ++ + LDA.b #!DynamicDropGFXSlotCount_UW + BRA +++ + ++ LDA.b #!DynamicDropGFXSlotCount_OW + +++ INC : INC : STA.w SprItemGFX,X + JMP .success + + CMP.b #$B2 : BNE + ; if fairy, use fairy OAM slot + LDA.b $1B : BEQ ++ + LDA.b #!DynamicDropGFXSlotCount_UW + BRA +++ + ++ LDA.b #!DynamicDropGFXSlotCount_OW + +++ STA.w SprItemGFX,X + JMP .success + PHA : PHX @@ -202,6 +216,7 @@ DrawSlottedTile: PLA : SEC : RTL + PLA + STA.b $BD ; store loot ID temporarily, will get overwritten in Sprite_DrawMultiple_quantity_preset call JSL.l IsNarrowSprite : BCS .narrow ; TODO: Instead of loading the whole fixed 16 bytes from DynamicOAMTile**_** into !SPRITE_DYNAMIC_OAM @@ -254,6 +269,23 @@ DrawSlottedTile: STA.w !SPRITE_DYNAMIC_OAM : STA.w !SPRITE_DYNAMIC_OAM+8 .draw + ; special handling + LDY.b $BD : CPY.b #$B2 : BNE + ; fairy + LDA.b $1A : AND.w #$0020 : BEQ ++ ; alternate every 32 frames + LDA.w !SPRITE_DYNAMIC_OAM+4 : CLC : ADC.w #$02 ; use other fairy GFX + STA.w !SPRITE_DYNAMIC_OAM+4 + ++ LDA.b $1A : SEC : SBC.w #$10 : AND.w #$0020 : BEQ + ; alternate every 32 frames + LDA.w !SPRITE_DYNAMIC_OAM+2 : SEC : SBC.w #$02 ; move fairy up 2 pixels + STA.w !SPRITE_DYNAMIC_OAM+2 + + CPY.b #$B5 : BNE + ; good bee + LDA.b $1A : AND.w #$0020 : BEQ ++ ; alternate every 32 frames + LDA.w !SPRITE_DYNAMIC_OAM+12 : SEC : SBC.w #$10 ; use other fairy GFX + STA.w !SPRITE_DYNAMIC_OAM+12 + ++ LDA.b $1A : SEC : SBC.w #$10 : AND.w #$0020 : BEQ + ; alternate every 32 frames + LDA.w !SPRITE_DYNAMIC_OAM+10 : SEC : SBC.w #$02 ; move fairy up 2 pixels + STA.w !SPRITE_DYNAMIC_OAM+10 + + + LDA.w #!SPRITE_DYNAMIC_OAM : STA.b $08 SEP #$20 STZ.b $07 @@ -292,6 +324,9 @@ DynamicOAMTileUW_thin: dw 0, 0 : db $6B, $00, $20, $00 ; key dw 0, 8 : db $7B, $00, $20, $00 + dw 0, 0 : db $7C, $00, $20, $00 ; good bee + dw 0, 8 : db $F4, $00, $20, $00 + DynamicOAMTileUW_full: dw -4, -1 : db $40, $00, $20, $02 dd 0, 0 @@ -308,6 +343,11 @@ DynamicOAMTileUW_full: dw -4, -1 : db $EE, $00, $20, $02 dd 0, 0 + ; add new slots above this line + + dw -4, -1 : db $EA, $00, $20, $02 ; fairy + dd 0, 0 + DynamicOAMTileOW_thin: ; dw 0, 0 : db $40, $00, $20, $00 ; dw 0, 8 : db $50, $00, $20, $00 @@ -332,6 +372,9 @@ DynamicOAMTileOW_thin: dw 0, 0 : db $6B, $00, $20, $00 ; key dw 0, 8 : db $7B, $00, $20, $00 + dw 0, 0 : db $7C, $00, $20, $00 ; good bee + dw 0, 8 : db $F4, $00, $20, $00 + DynamicOAMTileOW_full: ; dw 0, 0 : db $40, $00, $20, $02 ; dd 0, 0 @@ -348,3 +391,8 @@ DynamicOAMTileOW_full: ;dw 0, 0 : db $EE, $00, $20, $02 ;dd 0, 0 + ; add new slots above this line + + dw 0, 0 : db $EA, $00, $20, $02 ; fairy + dd 0, 0 + diff --git a/shopkeeper.asm b/shopkeeper.asm index 843957e..84f514d 100644 --- a/shopkeeper.asm +++ b/shopkeeper.asm @@ -809,18 +809,53 @@ Shopkeeper_DrawNextItem: SEP #$20 ; set 8-bit accumulator PLY + STZ $0E ; $0E will be used temporarily to store a non-zero value if VRAM slot is in OAM1 PHX : LDA #0 : XBA : TXA : LSR #2 : TAX : LDA.l !SHOP_INVENTORY_DISGUISE, X : PLX : CMP #$0 : BNE ++ - LDA.l !SHOP_INVENTORY, X ; get item palette + LDA.l !SHOP_INVENTORY, X ++ - CMP.b #$2E : BNE + : BRA .potion - + CMP.b #$2F : BNE + : BRA .potion - + CMP.b #$30 : BEQ .potion - + CMP.b #$34 : BCC .normal : CMP.b #$36+1 : BCS .normal + CMP.b #$2E : BNE + : JMP .potion + + CMP.b #$2F : BNE + : JMP .potion + + CMP.b #$30 : BNE + : JMP .potion + + CMP.b #$B2 : BNE + : BRA .fairy + + CMP.b #$B5 : BNE + : BRA .goodbee + + CMP.b #$34 : BCC + : CMP.b #$36+1 : BCS + BRA .rupee + + .normal LDA.w .tile_indices, Y : BRA + ; get item gfx index .rupee LDA.b #$0B ; rupee is #$0B because it's already there in VRAM + STA.b $0E + BRA .vramLoc + .fairy + REP #$20 + LDA.b $1A : SEC : SBC.w #$10 : AND.w #$0020 : BEQ ++ ; alternate every 32 frames + LDA.l !SPRITE_OAM+2 : SEC : SBC.w #$02 ; move fairy up 2 pixels + STA.l !SPRITE_OAM+2 + ++ + SEP #$20 + LDA.b $1A : AND.b #$20 : BEQ ++ ; alternate every 32 frames + LDA.b #$EC ; use other fairy GFX + STA.b $0E + BRA .vramLoc + ++ + LDA.b #$EA ; fairy is #$EA/EC because it's already there in VRAM + STA.b $0E + BRA .vramLoc + .goodbee + REP #$20 + LDA.b $1A : SEC : SBC.w #$10 : AND.w #$0020 : BEQ ++ ; alternate every 32 frames + LDA.l !SPRITE_OAM+2 : SEC : SBC.w #$02 ; move bee up 2 pixels + STA.l !SPRITE_OAM+2 + ++ + SEP #$20 + LDA.b $1A : AND.b #$20 : BEQ ++ ; alternate every 32 frames + LDA.b #$D4 ; use other bee GFX + STA.b $0E + BRA .vramLoc + ++ + LDA.b #$E4 ; good bee is #$E4/D4 because it's already there in VRAM + STA.b $0E BRA .vramLoc .potion LDA.b #$C0 ; potion is #$C0 because it's already there in VRAM @@ -835,15 +870,13 @@ Shopkeeper_DrawNextItem: AND #$FE .vramLoc STA.l !SPRITE_OAM+4 - PHA - PHX : LDA #0 : XBA : TXA : LSR #2 : TAX : LDA.l !SHOP_INVENTORY_DISGUISE, X : PLX : CMP #$0 : BNE ++ - LDA.l !SHOP_INVENTORY, X ; get item palette - ++ - JSL.l GetSpritePalette : STA.l !SPRITE_OAM+5 + PHX : LDA #0 : XBA : TXA : LSR #2 : TAX : LDA.l !SHOP_INVENTORY_DISGUISE, X : PLX : CMP #$0 : BNE ++ + LDA.l !SHOP_INVENTORY, X ; get item palette + ++ + JSL.l GetSpritePalette : STA.l !SPRITE_OAM+5 - PLA - AND.b #$01 : BNE .oam1 ; special case for rupee item + LDA.b $0E : BNE .oam1 ; item uses VRAM in OAM1 LDA.w .tile_indices, Y : AND.b #$01 : BEQ ++ ; get tile index sheet .oam1 LDA.l !SPRITE_OAM+5 @@ -866,6 +899,10 @@ Shopkeeper_DrawNextItem: LDA.b #$00 STA.l !SPRITE_OAM+7 JSR.w PrepNarrowLower + LDA.b $0E : AND.b #$0F : CMP.b #$04 : BNE + + ; special exception for bee gfx, need top tile to be blank + LDA.b #$7C : STA.l !SPRITE_OAM+4 + + LDA.b #$02 ++ PHX : PHA : LDA !SCRATCH_TEMP_X : TAX : PLA : JSR.w RequestItemOAM : PLX diff --git a/utilities.asm b/utilities.asm index c1eaa80..2495987 100644 --- a/utilities.asm +++ b/utilities.asm @@ -295,7 +295,7 @@ RTL db $08 ; Fairy db $08 ; Chicken db $08 ; Big Magic - db $08 ; Good Bee + db $04 ; Good Bee db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused @@ -364,7 +364,7 @@ IsNarrowSprite: LDX.b #$00 ; set index counter to 0 ;---- - - CPX.b #$24 : !BGE .false ; finish if we've done the whole list + CPX.b #(.smallSprites_end-.smallSprites) : !BGE .false ; finish if we've done the whole list CMP.l .smallSprites, X : BNE + ; skip to next if we don't match ;-- SEC ; set true state @@ -387,7 +387,8 @@ RTL db $15, $18, $24, $2A, $34, $35, $36, $42 db $43, $45, $59, $A0, $A1, $A2, $A3, $A4 db $A5, $A6, $A7, $A8, $A9, $AA, $AB, $AC - db $AD, $AE, $AF, $B4, $FF, $FF, $FF, $FF + db $AD, $AE, $AF, $B4, $B5 + .smallSprites_end } ;-------------------------------------------------------------------------------- From c002b974f9dee8748ca1a1d2ab51a5a2af810314 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Tue, 9 May 2023 00:09:16 -0500 Subject: [PATCH 45/68] Fixed issue with key gfx not drawing correctly during tablet animation --- keydrop/dynamic_si_vram.asm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 1c1d8a8..a7e2162 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -48,6 +48,9 @@ RequestSlottedTile: +++ STA.w SprItemGFX,X JMP .success + CMP.b #$A0 : BCC + : CMP.b #$AF+1 : BCS + ; if key, use key OAM slot + LDY.b $5D : CPY.b #$19 : BCC ++ : CPY.b #$1A+1 : BCS ++ ; if getting tablet item, don't use key slot + BRA + + ++ LDA.b $1B : BEQ ++ LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ From 5c640a05f1b1182372543e52022aab91e1a5c7ca Mon Sep 17 00:00:00 2001 From: codemann8 Date: Tue, 9 May 2023 00:10:07 -0500 Subject: [PATCH 46/68] Fixed issue with menu not allowing DPad input during menus if standing item is visible --- keydrop/dynamic_si_vram.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index a7e2162..f4893db 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -219,7 +219,7 @@ DrawSlottedTile: PLA : SEC : RTL + PLA - STA.b $BD ; store loot ID temporarily, will get overwritten in Sprite_DrawMultiple_quantity_preset call + STA.b $07 ; store loot ID temporarily, will get overwritten in Sprite_DrawMultiple_quantity_preset call JSL.l IsNarrowSprite : BCS .narrow ; TODO: Instead of loading the whole fixed 16 bytes from DynamicOAMTile**_** into !SPRITE_DYNAMIC_OAM @@ -273,7 +273,7 @@ DrawSlottedTile: .draw ; special handling - LDY.b $BD : CPY.b #$B2 : BNE + ; fairy + LDY.b $07 : CPY.b #$B2 : BNE + ; fairy LDA.b $1A : AND.w #$0020 : BEQ ++ ; alternate every 32 frames LDA.w !SPRITE_DYNAMIC_OAM+4 : CLC : ADC.w #$02 ; use other fairy GFX STA.w !SPRITE_DYNAMIC_OAM+4 From 8e48df8c12453bddda3450c835bac7467519abb5 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Tue, 9 May 2023 02:53:08 -0500 Subject: [PATCH 47/68] Good Bees now spawn automatically under pots --- keydrop/standing_items.asm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index 6d64aa9..a24b960 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -75,6 +75,8 @@ org $868283 Sprite_SpawnSecret_NotRandomBush: org $86828A Sprite_SpawnSecret_SpriteSpawnDynamically: +org $8682A5 +Sprite_SpawnSecret_SetCoords: org $86d23a Sprite_DrawAbsorbable: org $9eff81 @@ -262,6 +264,8 @@ SaveMajorItemDrop: LDA.w #$001A : BRA .substitute + CPY.w #$00B0 : BNE + ; Bee Trap LDA.w #$001B : BRA .substitute + + CPY.w #$00B5 : BNE + ; Good Bee + LDA.w #$001C : BRA .substitute + STA $0B9C ; indicates we should use the key routines or a substitute RTL .substitute @@ -560,6 +564,7 @@ SubstitionTable: db $DE ; BOMB REFILL 8 - 0x19 db $AC ; APPLES - 0x1A db $79 ; BEE TRAP - 0x1B + db $79 ; GOOD BEE - 0x1C SubstituteSpriteId: @@ -577,6 +582,22 @@ RTS CheckSprite_Spawn: JSR SubstituteSpriteId + CPY.b #$1C : BNE + ; good bee handling + JSL Sprite_SpawnDynamically + BMI .check + PHX + TYX : JSL.l Sprite_LoadProperties + PLX + JSL.l GoldBee_SpawnSelf_SetProperties + PLA : PLA : PLA ; pop the return address + PHX : LDX.b #$03 + JML Sprite_SpawnSecret_SetCoords + + CPY.b #$1A : BCC + ; all other non-normal pot sprite spawns + JSL Sprite_SpawnDynamically + BMI .check + LDA.b #$10 : STA.b $0D ; lets the outside code treat this sprite like a Stal (most normal table values) + RTL + + JSL Sprite_SpawnDynamically BMI .check RTL From 06d22255ef11631e4e003517ae4788c198197202 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Tue, 9 May 2023 16:33:14 -0500 Subject: [PATCH 48/68] Added Chicken GFX to GFX tables --- newitems.asm | 4 ++++ utilities.asm | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/newitems.asm b/newitems.asm index bdf6cd2..64687bb 100755 --- a/newitems.asm +++ b/newitems.asm @@ -84,6 +84,9 @@ GetAnimatedSpriteGfxFile: CMP.b #$48 : BNE + LDY.b #$60 : JML GetAnimatedSpriteGfxFile_return + + CMP.b #$4B : BNE + + LDY.b #$50 : JML GetAnimatedSpriteGfxFile_return + + CMP.b #$24 : !BGE + LDY.b #$5B : JML GetAnimatedSpriteGfxFile_return @@ -123,6 +126,7 @@ dw $09F0 ; Null-Item dw $09C0 ; Clock dw $0A20 ; Triforce dw $0A50 ; Power Star +dw $09F0 ; Chicken GetAnimatedSpriteBufferPointer: ;PHB : PHK : PLB diff --git a/utilities.asm b/utilities.asm index 2495987..450030c 100644 --- a/utilities.asm +++ b/utilities.asm @@ -157,7 +157,7 @@ RTL db $2C ; Bee Trap db $4A ; Apples db $4A ; Fairy - db $4A ; Chicken + db $4B ; Chicken db $3B ; Big Magic db $4A ; Good Bee db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused @@ -293,7 +293,7 @@ RTL db $04 ; Bee Trap db $08 ; Apples db $08 ; Fairy - db $08 ; Chicken + db $02 ; Chicken db $08 ; Big Magic db $04 ; Good Bee db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused From 1b564d99fcf73cf2acfe37340eac9f1efc257e26 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Tue, 9 May 2023 21:22:31 -0500 Subject: [PATCH 49/68] Fixed Apple GFX by using other VRAM slots in the rotation --- hooks.asm | 3 +++ keydrop/dynamic_si_vram.asm | 49 +++++++++++++++++++++++++++++-------- newitems.asm | 5 ++++ shopkeeper.asm | 5 ++++ utilities.asm | 6 ++--- zoraking.asm | 2 +- 6 files changed, 56 insertions(+), 14 deletions(-) diff --git a/hooks.asm b/hooks.asm index ad32f79..438cdb4 100755 --- a/hooks.asm +++ b/hooks.asm @@ -982,6 +982,9 @@ JSL.l ChestPrep NOP #3 db $90 ; !BCC .cantOpen ;-------------------------------------------------------------------------------- +org $008A9D +JSL ConditionalPushBlockTransfer : NOP + org $00D531 ; 5531 - Bank00.asm:3451 (LDY.b #$5D) JML.l GetAnimatedSpriteGfxFile diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index f4893db..0f4ceb8 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -71,6 +71,13 @@ RequestSlottedTile: ++ LDA.b #!DynamicDropGFXSlotCount_OW +++ STA.w SprItemGFX,X JMP .success + + CMP.b #$B1 : BNE + ; if apple, use apple OAM slot + LDA.b $1B : BEQ ++ + LDA.b #!DynamicDropGFXSlotCount_UW + BRA +++ + ++ LDA.b #!DynamicDropGFXSlotCount_OW + +++ INC : STA.w SprItemGFX,X + JMP .success + PHA : PHX @@ -194,16 +201,17 @@ FreeUWGraphics: dw $8840>>1 dw $8980>>1 ; dw $9960>>1 ; Arghuss Splash apparently -; dw $9C00>>1 - dw $9CA0>>1 + dw $9C00>>1 +; dw $9CA0>>1 dw $9DC0>>1 .end FreeOWGraphics: + dw $8180>>1 ; Push Block ;dw $8800>>1 ; Shovel Dirt dw $9960>>1 ; Arghuss/Zora Splash dw $9C00>>1 ; Heart Piece - dw $9CA0>>1 ; Apple + ;dw $9CA0>>1 ; Apple ;dw $9DC0>>1 ; Whirlpool .end @@ -313,8 +321,8 @@ DynamicOAMTileUW_thin: dw 0, 0 : db $4C, $00, $20, $00 dw 0, 8 : db $5C, $00, $20, $00 - dw 0, 0 : db $E5, $00, $20, $00 - dw 0, 8 : db $F5, $00, $20, $00 + dw 0, 0 : db $E0, $00, $20, $00 + dw 0, 8 : db $F0, $00, $20, $00 dw 0, 0 : db $EE, $00, $20, $00 dw 0, 8 : db $FE, $00, $20, $00 @@ -340,7 +348,7 @@ DynamicOAMTileUW_full: dw -4, -1 : db $4C, $00, $20, $02 dd 0, 0 - dw -4, -1 : db $E5, $00, $20, $02 + dw -4, -1 : db $E0, $00, $20, $02 dd 0, 0 dw -4, -1 : db $EE, $00, $20, $02 @@ -351,7 +359,13 @@ DynamicOAMTileUW_full: dw -4, -1 : db $EA, $00, $20, $02 ; fairy dd 0, 0 + dw -4, -1 : db $E5, $00, $20, $02 ; apple + dd 0, 0 + DynamicOAMTileOW_thin: + dw 0, 0 : db $0C, $00, $20, $00 + dw 0, 8 : db $1C, $00, $20, $00 + ; dw 0, 0 : db $40, $00, $20, $00 ; dw 0, 8 : db $50, $00, $20, $00 @@ -361,8 +375,8 @@ DynamicOAMTileOW_thin: dw 0, 0 : db $E0, $00, $20, $00 dw 0, 8 : db $F0, $00, $20, $00 - dw 0, 0 : db $E5, $00, $20, $00 - dw 0, 8 : db $F5, $00, $20, $00 + ;dw 0, 0 : db $E5, $00, $20, $00 + ;dw 0, 8 : db $F5, $00, $20, $00 ;dw 0, 0 : db $EE, $00, $20, $00 ;dw 0, 8 : db $FE, $00, $20, $00 @@ -379,6 +393,9 @@ DynamicOAMTileOW_thin: dw 0, 8 : db $F4, $00, $20, $00 DynamicOAMTileOW_full: + dw 0, 0 : db $0C, $00, $20, $02 + dd 0, 0 + ; dw 0, 0 : db $40, $00, $20, $02 ; dd 0, 0 @@ -388,8 +405,8 @@ DynamicOAMTileOW_full: dw 0, 0 : db $E0, $00, $20, $02 dd 0, 0 - dw 0, 0 : db $E5, $00, $20, $02 - dd 0, 0 + ;dw 0, 0 : db $E5, $00, $20, $02 + ;dd 0, 0 ;dw 0, 0 : db $EE, $00, $20, $02 ;dd 0, 0 @@ -399,3 +416,15 @@ DynamicOAMTileOW_full: dw 0, 0 : db $EA, $00, $20, $02 ; fairy dd 0, 0 + dw 0, 0 : db $E5, $00, $20, $02 ; apple + dd 0, 0 + +ConditionalPushBlockTransfer: + LDA.b $1B : BNE + + LDA.b #$0F ; don't transfer push block when on the OW + BRA .return-3 + + + LDA.b #$1F : STA.w $420B ; what we wrote over + .return +RTL + diff --git a/newitems.asm b/newitems.asm index 64687bb..0b29d9d 100755 --- a/newitems.asm +++ b/newitems.asm @@ -87,6 +87,9 @@ GetAnimatedSpriteGfxFile: CMP.b #$4B : BNE + LDY.b #$50 : JML GetAnimatedSpriteGfxFile_return + + CMP.b #$4C : BNE + + LDY.b #$5E : JML GetAnimatedSpriteGfxFile_return + + CMP.b #$24 : !BGE + LDY.b #$5B : JML GetAnimatedSpriteGfxFile_return @@ -127,6 +130,8 @@ dw $09C0 ; Clock dw $0A20 ; Triforce dw $0A50 ; Power Star dw $09F0 ; Chicken +dw $09C0 ; Fairy ($09F0 if using uncompressed version) +dw $0988 ; Apple GetAnimatedSpriteBufferPointer: ;PHB : PHK : PLB diff --git a/shopkeeper.asm b/shopkeeper.asm index 84f514d..89491d5 100644 --- a/shopkeeper.asm +++ b/shopkeeper.asm @@ -816,6 +816,7 @@ Shopkeeper_DrawNextItem: CMP.b #$2E : BNE + : JMP .potion + CMP.b #$2F : BNE + : JMP .potion + CMP.b #$30 : BNE + : JMP .potion + + CMP.b #$B1 : BNE + : BRA .apple + CMP.b #$B2 : BNE + : BRA .fairy + CMP.b #$B5 : BNE + : BRA .goodbee + CMP.b #$34 : BCC + : CMP.b #$36+1 : BCS + @@ -857,6 +858,10 @@ Shopkeeper_DrawNextItem: LDA.b #$E4 ; good bee is #$E4/D4 because it's already there in VRAM STA.b $0E BRA .vramLoc + .apple + LDA.b #$E5 ; apple is #$E5 because it's already there in VRAM + STA.b $0E + BRA .vramLoc .potion LDA.b #$C0 ; potion is #$C0 because it's already there in VRAM + diff --git a/utilities.asm b/utilities.asm index 450030c..815f7df 100644 --- a/utilities.asm +++ b/utilities.asm @@ -155,8 +155,8 @@ RTL ;Bx db $2C ; Bee Trap - db $4A ; Apples - db $4A ; Fairy + db $4D ; Apples + db $4C ; Fairy db $4B ; Chicken db $3B ; Big Magic db $4A ; Good Bee @@ -291,7 +291,7 @@ RTL db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Free Big Key db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Free Small Key db $04 ; Bee Trap - db $08 ; Apples + db $02 ; Apples db $08 ; Fairy db $02 ; Chicken db $08 ; Big Magic diff --git a/zoraking.asm b/zoraking.asm index db39a42..4ebb0d9 100644 --- a/zoraking.asm +++ b/zoraking.asm @@ -11,7 +11,7 @@ ZoraSplashGfxFix: ; below should be set to the index used for Arrghus/Zora Splash ; FreeOWGraphics in dynamic_si_vram.asm, whatever index is $9960 ; this makes it so the first gfx that is loading is AFTER the splash - LDA.b #$00 : STA.w DynamicDropGFXIndex + LDA.b #$01 : STA.w DynamicDropGFXIndex JSL LoadCommonSprites_long REP #$30 : PLY : PLX : PLA RTL From 38fa9c39029c4d089190875cfbdb568ec8584754 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Wed, 10 May 2023 23:12:42 -0500 Subject: [PATCH 50/68] Fix for avoiding Arrghus/Zora splash GFX issues --- keydrop/dynamic_si_vram.asm | 14 +++++++++++++- keydrop/standing_items.asm | 6 +++--- owrando.asm | 4 +--- zoraking.asm | 10 ---------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 0f4ceb8..dd22ce4 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -200,7 +200,7 @@ FreeUWGraphics: dw $8800>>1 dw $8840>>1 dw $8980>>1 -; dw $9960>>1 ; Arghuss Splash apparently + dw $9960>>1 ; Arghuss Splash apparently dw $9C00>>1 ; dw $9CA0>>1 dw $9DC0>>1 @@ -321,6 +321,9 @@ DynamicOAMTileUW_thin: dw 0, 0 : db $4C, $00, $20, $00 dw 0, 8 : db $5C, $00, $20, $00 + dw 0, 0 : db $CB, $00, $20, $00 + dw 0, 8 : db $DB, $00, $20, $00 + dw 0, 0 : db $E0, $00, $20, $00 dw 0, 8 : db $F0, $00, $20, $00 @@ -348,6 +351,9 @@ DynamicOAMTileUW_full: dw -4, -1 : db $4C, $00, $20, $02 dd 0, 0 + dw -4, -1 : db $CB, $00, $20, $02 + dd 0, 0 + dw -4, -1 : db $E0, $00, $20, $02 dd 0, 0 @@ -428,3 +434,9 @@ ConditionalPushBlockTransfer: .return RTL +pushpc +; fix Arghuss/Zora splash graphics +org $068595 + db $E7, $E7, $E7, $E7, $E7, $C0, $C0 +pullpc + diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index a24b960..f949109 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -370,7 +370,7 @@ RevealSpriteDrop: LDY.w $0CBA, X : BEQ .no_forced_drop RTL .no_forced_drop - PLA : PLA ; remove the JSL reswamturn lower 16 bits + PLA : PLA ; remove the JSL return lower 16 bits PEA.w $06F996-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath) RTL @@ -381,7 +381,7 @@ RevealSpriteDrop2: LDY.w $0CBA, X : BEQ .no_forced_drop RTL .no_forced_drop - PLA : PLA ; remove the JSL reswamturn lower 16 bits + PLA : PLA ; remove the JSL return lower 16 bits PEA.w $06E3CE-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath) RTL @@ -389,7 +389,7 @@ BitFieldMasks: dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100 dw $0080, $0040, $0020, $0010, $0008, $0004, $0002, $0001 -; Runs during Sprite_E4_SmallKey and duning Sprite_E5_BigKey spawns +; Runs during Sprite_E4_SmallKey and during Sprite_E5_BigKey spawns ShouldSpawnItem: LDA $048E : CMP.b #$87 : BNE + ; check for hera basement cage LDA $A8 : AND.b #$03 : CMP.b #$02 : BNE + ; we're not in that quadrant diff --git a/owrando.asm b/owrando.asm index 166aa1e..d74718d 100644 --- a/owrando.asm +++ b/owrando.asm @@ -968,9 +968,7 @@ OWNewDestination: OWLoadSpecialArea: { LDA.l Overworld_LoadSpecialOverworld_RoomId,X : STA.b $A0 - CMP.w #$0182 : BNE + - JSL ZoraSplashGfxFix - + JSL Overworld_LoadSpecialOverworld ; sets M and X flags + JSL Overworld_LoadSpecialOverworld ; sets M and X flags TYX LDY.b #$00 CPX.b #$01 : BNE + ; check if going to water transition diff --git a/zoraking.asm b/zoraking.asm index 4ebb0d9..d8517a8 100644 --- a/zoraking.asm +++ b/zoraking.asm @@ -6,16 +6,6 @@ LoadZoraKingItemGFX: LDA.l $1DE1C3 ; location randomizer writes zora item to JML RequestSlottedTile ;-------------------------------------------------------------------------------- -ZoraSplashGfxFix: - PHA : PHX : PHY : SEP #$30 - ; below should be set to the index used for Arrghus/Zora Splash - ; FreeOWGraphics in dynamic_si_vram.asm, whatever index is $9960 - ; this makes it so the first gfx that is loading is AFTER the splash - LDA.b #$01 : STA.w DynamicDropGFXIndex - JSL LoadCommonSprites_long - REP #$30 : PLY : PLX : PLA - RTL -;-------------------------------------------------------------------------------- JumpToSplashItemTarget: LDA $0D90, X CMP.b #$FF : BNE + : JML.l SplashItem_SpawnSplash : + From 0803e6e29006998b7932208c50f9ff9d5889074d Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 12 May 2023 20:08:15 -0500 Subject: [PATCH 51/68] Allow Murahdahla to act like Murah at Pyramid in rainstate --- elder.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elder.asm b/elder.asm index 5c4a6a6..f9a644a 100644 --- a/elder.asm +++ b/elder.asm @@ -1,6 +1,6 @@ NewElderCode: { -LDA $8A : CMP #$1B : BEQ .newCodeContinue +LDA $8A : AND.b #$3F : CMP #$1B : BEQ .newCodeContinue ;Restore Jump we can keep the RTL so JML JML $05F0CD .newCodeContinue From 0933392e6d81c09e805c30513568d8982a81b812 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 12 May 2023 20:14:02 -0500 Subject: [PATCH 52/68] Rearranged new rotating slotted GFX code to allow drawing to specific slots --- keydrop/dynamic_si_vram.asm | 96 +++++++++++++++++++++++-------------- 1 file changed, 60 insertions(+), 36 deletions(-) diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index dd22ce4..46d1be4 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -17,7 +17,7 @@ DynamicDropQueue = $7E1E72 ; 0x08 bytes, occupies 1 byte for each slot in the re ; Come in with ; A = item receipt ID -; X = slot +; X = sprite slot RequestSlottedTile: PHX : PHY @@ -36,7 +36,7 @@ RequestSlottedTile: TYX + - LDA 1,S : JSL.l GetSpritePalette : STA $0F50, X ; setup the palette + LDA.b 1,S : JSL.l GetSpritePalette : STA.w $0F50, X ; setup the palette PLA ; gfx that are already present, use that instead of a new slot @@ -79,40 +79,43 @@ RequestSlottedTile: +++ INC : STA.w SprItemGFX,X JMP .success + + + PHA + LDA.w DynamicDropGFXIndex + INC + PHX + LDX.b $1B : BEQ + + CMP.b #!DynamicDropGFXSlotCount_UW : BCC .setIndex + BRA ++ + + CMP.b #!DynamicDropGFXSlotCount_OW : BCC .setIndex + ++ LDA.b #$00 + + .setIndex + PLX + STA.w DynamicDropGFXIndex + STA.w SprItemGFX,X - PHA : PHX - LDY.b #$00 - LDA.w DynamicDropRequest - - LSR : INY : BCS - - CPY.b #$08 : BCC + - ; all request slots occupied, exit without drawing - PLX : PLA - LDY.b #$FE ; indicate failure - BRA .return - + TYX - LDA.b #$00 : SEC - - ROL : DEX : BNE - - DEY ; y = slot index, a = new request bit flag - ORA.w DynamicDropRequest - STA.w DynamicDropRequest - PLX : PLA + + .initRequest + PHX + LDY.b #$00 + LDA.w DynamicDropRequest + - LSR : INY : BCS - + CPY.b #$08 : BCC + + ; all request slots occupied, exit without drawing + PLX : PLA + LDY.b #$FE ; indicate failure + BRA .return + + TYX + LDA.b #$00 : SEC + - ROL : DEX : BNE - + DEY ; y = slot index, a = new request bit flag + ORA.w DynamicDropRequest + STA.w DynamicDropRequest + PLX + PLA STA.w DynamicDropQueue,Y - LDA.w DynamicDropGFXIndex - INC - PHX - LDX.b $1B : BEQ + - CMP.b #!DynamicDropGFXSlotCount_UW : BCC .fine - BRA ++ - + CMP.b #!DynamicDropGFXSlotCount_OW : BCC .fine - - ++ LDA.b #$00 - -.fine - PLX - STA.w DynamicDropGFXIndex - STA.w SprItemGFX,X - ; decompress graphics PHX : PHY @@ -129,8 +132,9 @@ RequestSlottedTile: SEP #$30 PLY : PLX - LDA.w DynamicDropGFXIndex : STA.w DynamicDropQueue,Y - LDA.w DynamicDropQueue,Y ; we want A to return the loot id + LDA.w DynamicDropQueue,Y : PHA ; we want A to return the loot id + LDA.w SprItemGFX,X : STA.w DynamicDropQueue,Y + PLA .success STZ.w !SPRITE_REDRAW, X @@ -204,7 +208,9 @@ FreeUWGraphics: dw $9C00>>1 ; dw $9CA0>>1 dw $9DC0>>1 + ; add new slots above this line .end + ; above this line, add slots that we want to draw to specific slots FreeOWGraphics: dw $8180>>1 ; Push Block @@ -213,7 +219,9 @@ FreeOWGraphics: dw $9C00>>1 ; Heart Piece ;dw $9CA0>>1 ; Apple ;dw $9DC0>>1 ; Whirlpool + ; add new slots above this line .end + ; above this line, add slots that we want to draw to specific slots ;=================================================================================================== ; Come in with @@ -332,6 +340,10 @@ DynamicOAMTileUW_thin: ; add new slots above this line + ; + + ; above this line, add slots that we want to draw to specific slots + dw 0, 0 : db $0B, $00, $20, $00 ; animated rupees slot dw 0, 8 : db $1B, $00, $20, $00 @@ -360,7 +372,11 @@ DynamicOAMTileUW_full: dw -4, -1 : db $EE, $00, $20, $02 dd 0, 0 - ; add new slots above this line + ; add new rotating slots above this line + + ; + + ; above this line, add slots that we want to draw to specific slots dw -4, -1 : db $EA, $00, $20, $02 ; fairy dd 0, 0 @@ -389,6 +405,10 @@ DynamicOAMTileOW_thin: ; add new slots above this line + ; + + ; above this line, add slots that we want to draw to specific slots + dw 0, 0 : db $0B, $00, $20, $00 ; animated rupees slot dw 0, 8 : db $1B, $00, $20, $00 @@ -419,6 +439,10 @@ DynamicOAMTileOW_full: ; add new slots above this line + ; + + ; above this line, add slots that we want to draw to specific slots + dw 0, 0 : db $EA, $00, $20, $02 ; fairy dd 0, 0 From 81a3fcf7730510fe6d13e712d3bdf382f7cf832e Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 12 May 2023 20:14:36 -0500 Subject: [PATCH 53/68] Fixed 99 bonk limit in stats counters --- stats.asm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stats.asm b/stats.asm index 4b8f776..42a479a 100644 --- a/stats.asm +++ b/stats.asm @@ -7,8 +7,7 @@ ;-------------------------------------------------------------------------------- IncrementBonkCounter: LDA StatsLocked : BNE + - LDA BonkCounter : INC - CMP.b #100 : BEQ + ; decimal 100 + LDA BonkCounter : INC : BEQ + ; overflow STA BonkCounter + RTL From 71916fb3200442e56b8b338538ea091f72c70480 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 12 May 2023 20:37:33 -0500 Subject: [PATCH 54/68] Fixed Hera boss music playing after boss defeated --- hooks.asm | 2 +- music.asm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hooks.asm b/hooks.asm index 438cdb4..1e112b2 100755 --- a/hooks.asm +++ b/hooks.asm @@ -2338,7 +2338,7 @@ JSL.l HeartPieceSpawnDelayFix org $05F08A ; <- 2F08A - sprite_heart_upgrades.asm : 324 - (LDA $7EF36B : INC A : AND.b #$03 : STA $7EF36B : BNE .got_4_piecese) item determination JSL.l HeartPieceGet BCS $18 ; reinsert the near branch that appears midway through what we overrode -NOP #22 +BRA + : NOP #20 : + ;-------------------------------------------------------------------------------- org $06C0B0 ; <- 340B0 - sprite prep JSL.l HeartPieceSpritePrep diff --git a/music.asm b/music.asm index a7b6e9b..71adc06 100644 --- a/music.asm +++ b/music.asm @@ -210,6 +210,6 @@ Underworld_DoorDown_Entry: ; ; A=16bit XY=8bit CheckHeraBossDefeated: -LDA RoomDataWRAM[$08].high : AND.w #$00FF : BEQ + +LDA RoomDataWRAM[$07].high : AND.w #$00FF : BEQ + SEC : RTL + CLC : RTL From 3497bd65149edc05ad7920b7ec80761aee6c4bf7 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 12 May 2023 23:57:13 -0500 Subject: [PATCH 55/68] Fixed issue with enemy key drops using wrong palette/GFX sheet --- keydrop/standing_items.asm | 1 + 1 file changed, 1 insertion(+) diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index f949109..d24246b 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -445,6 +445,7 @@ SpriteKeyPrep: LDA.w SpawnedItemFlag : STA SprItemFlags, X : BEQ + LDA.l SpawnedItemID : STA $0E80, X CMP #$24 : BNE ++ ; + JSL.l GetSpritePalette : STA.w $0F50, X ; setup the palette LDA $A0 : CMP.b #$80 : BNE + LDA SpawnedItemFlag : BNE + LDA #$24 ; it's the big key drop? From 9c08588d92cd06d8872334f0a82068bdd053aac0 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sat, 13 May 2023 02:07:40 -0500 Subject: [PATCH 56/68] Added a TF Cutscene when getting the TF item --- LTTP_RND_GeneralBugfixes.asm | 3 + doorrando/gfx.asm | 11 ++- elder.asm | 150 ++++++++++++++++++++++++++++++++++- hooks.asm | 6 ++ keydrop/dynamic_si_vram.asm | 20 ++++- multiworld.asm | 5 +- newitems.asm | 30 +++++-- 7 files changed, 211 insertions(+), 14 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 3fc4202..523a3e2 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -623,6 +623,9 @@ Sprite_PrepAndDrawSingleLargeLong: org $06DC00 Sprite_PrepAndDrawSingleSmallLong: +org $06E41C +Sprite_PrepOAMCoordLong: + org $06EA18 Sprite_ApplySpeedTowardsPlayerLong: diff --git a/doorrando/gfx.asm b/doorrando/gfx.asm index 94cb884..08ae228 100644 --- a/doorrando/gfx.asm +++ b/doorrando/gfx.asm @@ -92,4 +92,13 @@ OverridePaletteHeader: lda.l PaletteTable, x iny : rtl + rep #$20 : iny : lda [$0D], Y ; what we wrote over -rtl \ No newline at end of file +rtl + +Sprite_ConditionalPrepOAMCoord: + LDA.w $0E20,X : CMP.b #$62 : BNE .notMasterSword + LDA.w $0D90,X : BNE .specialCutscene + .notMasterSword + JML Sprite_PrepOAMCoordLong ; what we wrote over + .specialCutscene + SEC ; this prevents MasterSword sprite from drawing if it is a special cutscene +RTL \ No newline at end of file diff --git a/elder.asm b/elder.asm index f9a644a..4ab0111 100644 --- a/elder.asm +++ b/elder.asm @@ -12,7 +12,7 @@ JSR Elder_Code PLB RTL - +} Elder_Draw: { @@ -60,7 +60,7 @@ RTL LDA.l GoalCounter CMP.l GoalItemRequirement : !BLT + SEP #$20 - JSL.l ActivateGoal + JSL ActivateTriforceCutscene + .dont_show @@ -69,3 +69,149 @@ RTL LDA.b $1A : LSR #5 : AND.b #$01 : STA.w $0DC0, X RTS } + +;-------------------------------------------------------------------------------- +; Triforce (Pedestal) Cutscene +;-------------------------------------------------------------------------------- +ActivateTriforceCutscene: + ; despawn other sprites + LDY.b #$0F + - LDA.w $0E20,Y : CMP.b #$16 : BNE + + CPY.b #$00 : BEQ .next + ; move Murahdahla to slot 0 for draw priority reasons + LDA.w $0E20,Y : STA.w $0E20 + LDA.w $0D00,Y : STA.w $0D00 + LDA.w $0D10,Y : STA.w $0D10 + LDA.w $0D20,Y : STA.w $0D20 + LDA.w $0D30,Y : STA.w $0D30 + LDA.w $0D40,Y : STA.w $0D40 + LDA.w $0F50,Y : STA.w $0F50 + LDA.w $0E40,Y : STA.w $0E40 + LDA.w $0E60,Y : STA.w $0E60 + LDA.w $0DD0,Y : STA.w $0DD0 + LDA.b #$02 : STA.w $0F20 + + LDA.b #$00 : STA.w $0DD0,Y + .next + DEY : BPL - + + LDA.b #$62 ; MasterSword Sprite + JSL Sprite_SpawnDynamically + + ; set up coords + LDA.b $22 : STA.w $0D10,Y + LDA.b $23 : STA.w $0D30,Y + LDA.b $20 : CLC : ADC.b #$08 : STA.w $0D00,Y + LDA.b $21 : ADC.b #$00 : STA.w $0D20,Y + + LDA.b #$01 : STA.w $0D90,Y ; our indicator this is a special cutscene sprite + INC : STA.b $2F ; makes Link face downward + + ; reset modules + LDA.b $1B : BEQ + + LDA.b #$07 + BRA ++ + + LDA.b #$09 + ++ STA.b $10 + STZ.b $11 : STZ.b $B0 +RTL + +pushpc + org $058928 + MasterSword_InPedestal_DoCutscene: + org $0589B1 + MasterSword_ConditionalHandleReceipt_DoReceipt: + + org $05890E + JSL MasterSword_ConditionalActivateCutscene + org $05895F + JSL MasterSword_ConditionalGrabPose : NOP + org $058994 + JSL MasterSword_ConditionalGrabPose : NOP + org $058D1C + JML MasterSword_SpawnPendantProp_ChangePalette + MasterSword_SpawnPendantProp_ChangePalette_return: + org $0589A3 + JSL MasterSword_ConditionalHandleReceipt : NOP #2 +pullpc + +MasterSword_ConditionalActivateCutscene: + LDA.w $0D90,X : BNE .specialCutscene + JML Sprite_CheckDamageToPlayerSameLayerLong ; what we wrote over + .specialCutscene + LDA.b #$02 : STA.w $02DA ; Link's 2-hands-up pose + STA.b $EE ; draw Link on top + LDA.b #$6A : JSL RequestSlottedTile ; draw Triforce piece in VRAM + PLA : PLA : PLA : JML MasterSword_InPedestal_DoCutscene ; do cutscene + +MasterSword_ConditionalGrabPose: + PHA + LDA.w $0D90,X : BNE .specialCutscene + PLA + STA.w $0377 : LDA.b #$01 ; what we wrote over + RTL + .specialCutscene + PLA + LDA.b #$01 +RTL + +MasterSword_SpawnPendantProp_ChangePalette: + STA.w $0D40,Y : PLX ; what we wrote over + LDA.w $0D90,X : BNE .specialCutscene + BRA .done + .specialCutscene + LDA.b #$08 : STA.w $0F50,Y ; change palette + LDA.b #$02 : STA.w $0F20,Y ; change layer +.done +JML MasterSword_SpawnPendantProp_ChangePalette_return + +MasterSword_ConditionalHandleReceipt: + LDA.w $0D90,X : BNE .specialCutscene + LDX.b $8A : LDA.l $7EF280,X ; what we wrote over + RTL + .specialCutscene + PLA : PLA : PEA.w MasterSword_ConditionalHandleReceipt_DoReceipt-1 + LDA.b 4,S : TAX + LDY.b #$6A + RTL + +pushpc + org $058AB6 + MasterSword_SpawnLightWell: + org $058AD0 + MasterSword_SpawnLightFountain: + org $058B62 + MasterSword_SpawnLightBeam: + + org $058941 + JSL MasterSword_ConditionalSpawnLightWell : NOP #2 + MasterSword_SpawnLightWell_return: + org $058952 + JSL MasterSword_ConditionalSpawnLightFountain : NOP #2 + MasterSword_SpawnLightFountain_return: + org $058B64 + JSL MasterSword_ConditionalSpawnLightBeam : NOP #2 +pullpc + +MasterSword_ConditionalSpawnLightWell: + INC.w $0D80,X ; part of what we wrote over + LDA.w $0D90,X : BNE .specialCutscene + PLA : PLA : PLA : PEA.w MasterSword_SpawnLightWell_return-1 + JML MasterSword_SpawnLightWell ; part of what we wrote over + .specialCutscene + RTL + +MasterSword_ConditionalSpawnLightFountain: + INC.w $0D80,X ; part of what we wrote over + LDA.w $0D90,X : BNE .specialCutscene + PLA : PLA : PLA : PEA.w MasterSword_SpawnLightFountain_return-1 + JML MasterSword_SpawnLightFountain ; part of what we wrote over + .specialCutscene + RTL + +MasterSword_ConditionalSpawnLightBeam: + LDA.w $0D90,X : BNE .specialCutscene + LDA.b #$62 : JSL Sprite_SpawnDynamically ; what we wrote over + RTL + .specialCutscene + LDY.b #$FF + RTL diff --git a/hooks.asm b/hooks.asm index 1e112b2..5222ecd 100755 --- a/hooks.asm +++ b/hooks.asm @@ -995,9 +995,15 @@ org $00D557 ; 5557 - Bank00.asm:3486 (LDA $00 : ADC $D469, X) JSL.l GetAnimatedSpriteBufferPointer NOP +org $05FA50 +JSL Sprite_ConditionalPrepOAMCoord + org $0799F7 ; 399F7 - Bank07.asm:4107 (JSL AddReceivedItem) JSL.l AddReceivedItemExpanded +org $08C505 +JSL Ancilla22_ItemReceipt_ContinueB : NOP #2 + org $098605 ; 48605 - ancilla_init.asm:709 (TYA : STA $02E4 : PHX) JML.l Multiworld_AddReceivedItem_notCrystal NOP diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 46d1be4..0ade337 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -69,15 +69,23 @@ RequestSlottedTile: LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ STA.w SprItemGFX,X + +++ INC : STA.w SprItemGFX,X JMP .success + CMP.b #$B1 : BNE + ; if apple, use apple OAM slot LDA.b $1B : BEQ ++ LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ INC : STA.w SprItemGFX,X + +++ INC : INC : STA.w SprItemGFX,X JMP .success + + CMP.b #$6A : BNE + ; if triforce, use cutscene OAM slot + PHA + LDA.b $1B : BEQ ++ + LDA.b #!DynamicDropGFXSlotCount_UW + BRA +++ + ++ LDA.b #!DynamicDropGFXSlotCount_OW + +++ STA.w SprItemGFX,X + JMP .initRequest ; don't jump to end, we need the TF GFX to draw at $E7 + PHA @@ -210,6 +218,7 @@ FreeUWGraphics: dw $9DC0>>1 ; add new slots above this line .end + dw $9CE0>>1 ; above this line, add slots that we want to draw to specific slots FreeOWGraphics: @@ -221,6 +230,7 @@ FreeOWGraphics: ;dw $9DC0>>1 ; Whirlpool ; add new slots above this line .end + dw $9CE0>>1 ; above this line, add slots that we want to draw to specific slots ;=================================================================================================== @@ -374,7 +384,8 @@ DynamicOAMTileUW_full: ; add new rotating slots above this line - ; + dw -4, -1 : db $E7, $00, $20, $02 ; triforce + dd 0, 0 ; above this line, add slots that we want to draw to specific slots @@ -439,7 +450,8 @@ DynamicOAMTileOW_full: ; add new slots above this line - ; + dw 0, 0 : db $E7, $00, $20, $02 ; triforce + dd 0, 0 ; above this line, add slots that we want to draw to specific slots diff --git a/multiworld.asm b/multiworld.asm index aeb3d65..ba82d71 100644 --- a/multiworld.asm +++ b/multiworld.asm @@ -240,7 +240,10 @@ Multiworld_MasterSword_GrantToPlayer: LDA PedestalSword_Player : STA !MULTIWORLD_ITEM_PLAYER_ID PLP : PLA - JSL Link_ReceiveItem ; thing we wrote over + CPY.b #$6A : BEQ + + JSL Link_ReceiveItem ; thing we wrote over + RTL + + JSL ActivateGoal RTL } diff --git a/newitems.asm b/newitems.asm index 0b29d9d..eddae26 100755 --- a/newitems.asm +++ b/newitems.asm @@ -181,14 +181,18 @@ ProcessEventItems: LDA RNGItem : INC : STA RNGItem SEP #$10 ; set 8-bit index registers - REP #$20 ; set 16-bit accumulator + REP #$20 ; set 16-bit accumulator LDA GoalItemRequirement : BEQ ++ LDA GoalCounter : INC : STA GoalCounter CMP GoalItemRequirement : !BLT ++ LDA TurnInGoalItems : AND.w #$00FF : BNE ++ - JSL.l ActivateGoal + SEP #$20 ; set 8-bit accumulator + LDA.b $8A : CMP.b #$80 : BNE +++ + LDA.b $23 : BNE +++ + JSL.l ActivateGoal + +++ ++ - SEP #$20 ; set 8-bit accumulator + SEP #$20 ; set 8-bit accumulator LDX.b #$01 : BRA .done + LDX.b #$00 @@ -330,20 +334,27 @@ AddReceivedItemExpandedGetItem: + CMP.b #$65 : BNE + ; Progressive Bow JMP .done + CMP.b #$6A : BNE + ; Goal Collectable (Single/Triforce) - JSL.l ActivateGoal + LDA.b $8A : CMP.b #$80 : BNE ++ + LDA.b $23 : BNE ++ + JSL.l ActivateGoal + ++ JMP .done + CMP.b #$6B : BNE + ; Goal Collectable (Multi/Power Star) BRA .multi_collect + CMP.b #$6C : BNE + ; Goal Collectable (Multi/Power Star) Alternate Graphic .multi_collect - REP #$20 ; set 16-bit accumulator + REP #$20 ; set 16-bit accumulator LDA.l GoalItemRequirement : BEQ ++ LDA.l GoalCounter : INC : STA.l GoalCounter CMP.w GoalItemRequirement : !BLT ++ LDA.l TurnInGoalItems : AND.w #$00FF : BNE ++ + SEP #$20 ; set 8-bit accumulator + LDA.b $8A : CMP.b #$80 : BNE +++ + LDA.b $23 : BNE +++ JSL.l ActivateGoal + +++ ++ - SEP #$20 ; set 8-bit accumulator + SEP #$20 ; set 8-bit accumulator JMP .done + CMP.b #$6D : BNE + ; Server Request F0 JSL.l ItemGetServiceRequest_F0 @@ -1263,6 +1274,13 @@ ChestPrep: SEC RTL ;-------------------------------------------------------------------------------- +Ancilla22_ItemReceipt_ContinueB: + CMP.b #$6A : BNE .return + JSL ActivateTriforceCutscene + .return + STZ.w $0C4A,X : STZ.w $0FC1 ; what we wrote over +RTL +;-------------------------------------------------------------------------------- ; Set a flag in SRAM if we pick up a compass in its own dungeon with HUD compass ; counts on MaybeFlagCompassTotalPickup: From b170620285526330b74bbc4cc74a2a4e5d4071e6 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sun, 14 May 2023 17:55:14 -0500 Subject: [PATCH 57/68] Fixed issue where bonk drops were drawing narrow sprites 4 pixels to the right --- keydrop/dynamic_si_vram.asm | 1 + 1 file changed, 1 insertion(+) diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 0ade337..21c9a3e 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -294,6 +294,7 @@ DrawSlottedTile: BRA .draw + ; narrow LDA.w $0E20, X : AND.w #$00FF : CMP.w #$003B : BEQ .draw ; bonk item + LDA.w $0ED0, X : AND.w #$00FF : BNE .draw ; bonk drop check LDA.w #$0004 STA.w !SPRITE_DYNAMIC_OAM : STA.w !SPRITE_DYNAMIC_OAM+8 From c5d7f3291a59ee2612b5b345e5a31bf9dc970716 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Tue, 16 May 2023 04:31:44 -0500 Subject: [PATCH 58/68] Minor change to Inverted map terrain of Mimic Cave Ledge --- invertedmaps.asm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/invertedmaps.asm b/invertedmaps.asm index e99ed36..348e228 100644 --- a/invertedmaps.asm +++ b/invertedmaps.asm @@ -153,17 +153,19 @@ LDA.l WarningFlags : AND #$0020 : BEQ + : JMP .spiral_mimic_ledge .spiral_mimic_ledge LDA #$00E3 : STA $2BDC : STA $2BDE : STA $2BE0 : STA $2BE2 STA $2BE4 : STA $2BE6 : STA $2BE8 : STA $2BEA -LDA #$014E : STA $2C5C : STA $2C5E : STA $2C64 -LDA #$0139 : STA $2C60 : STA $2C66 -LDA #$014B : STA $2C68 : STA $2C62 -LDA #$014E : STA $2C6A -LDA #$0152 : STA $2CDC : STA $2CDE : STA $2CE4 : STA $2CEA -LDA #$016B : STA $2CE0 : STA $2CE6 -LDA #$0182 : STA $2CE2 : STA $2CE8 +LDA #$014E : STA $2C5C : STA $2C5E : STA $2C64 : STA $2C66 + STA $2C68 : STA $2C6A +LDA #$0139 : STA $2C60 +LDA #$014B : STA $2C62 +LDA #$0152 : STA $2CDC : STA $2CDE : STA $2CE4 : STA $2CE6 + STA $2CE8 : STA $2CEA +LDA #$016B : STA $2CE0 +LDA #$0182 : STA $2CE2 LDA #$022E : STA $2D5C : STA $2D5E : STA $2D60 : STA $2D62 STA $2D64 : STA $2D66 : STA $2D68 : STA $2D6A -LDA #$0230 : STA $2DDC : STA $2DDE : STA $2DE0 : STA $2DE2 - STA $2DE4 : STA $2DE6 : STA $2DE8 : STA $2DEA +LDA #$0230 : STA $2DDC : STA $2DDE : STA $2DE0 : STA $2DE6 + STA $2DE8 : STA $2DEA +LDA #$02A6 : STA $2DE2 : STA $2DE4 ; remove portal LDA #$0034 : STA $3D4A From 6dab19d38f2723a53f2a8700a99596944eb079fa Mon Sep 17 00:00:00 2001 From: codemann8 Date: Sun, 4 Jun 2023 03:38:58 -0500 Subject: [PATCH 59/68] Reversed earlier change and targeting Good Bee bonk item instead Change reversed: Fixed issue where bonk drops were drawing narrow sprites 4 pixels to the --- keydrop/dynamic_si_vram.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 21c9a3e..6f72f34 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -294,7 +294,7 @@ DrawSlottedTile: BRA .draw + ; narrow LDA.w $0E20, X : AND.w #$00FF : CMP.w #$003B : BEQ .draw ; bonk item - LDA.w $0ED0, X : AND.w #$00FF : BNE .draw ; bonk drop check + LDA.b $A0 : CMP.w #$0120 : BEQ .draw ; good bee statue LDA.w #$0004 STA.w !SPRITE_DYNAMIC_OAM : STA.w !SPRITE_DYNAMIC_OAM+8 From 1235357531a576821e562ef0e2ddf7e5ea99530b Mon Sep 17 00:00:00 2001 From: codemann8 Date: Thu, 15 Jun 2023 11:12:40 -0500 Subject: [PATCH 60/68] Using new overflow GFX slot and redraw after item get --- bookofmudora.asm | 1 + heartpieces.asm | 11 +++++++ inventory.asm | 1 + keydrop/dynamic_si_vram.asm | 60 +++++++++++++++++++++++++++---------- keydrop/standing_items.asm | 1 + 5 files changed, 58 insertions(+), 16 deletions(-) diff --git a/bookofmudora.asm b/bookofmudora.asm index d413984..b120b56 100644 --- a/bookofmudora.asm +++ b/bookofmudora.asm @@ -35,6 +35,7 @@ DrawBonkItemGFX: PHA LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready JSL.l LoadBonkItemGFX_inner + LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ .skipInit BRA .done ; don't draw on the init frame .skipInit diff --git a/heartpieces.asm b/heartpieces.asm index 1996177..5faae3a 100644 --- a/heartpieces.asm +++ b/heartpieces.asm @@ -56,6 +56,7 @@ DrawHeartPieceGFX: PHA : PHY LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready JSL.l HeartPieceSpritePrep + LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ .skipInit BRA .done ; don't draw on the init frame .skipInit @@ -191,6 +192,8 @@ LoadHeartPieceRoomValue: .done RTL ;-------------------------------------------------------------------------------- +!DynamicDropGFXSlotCount_UW = (FreeUWGraphics_end-FreeUWGraphics)>>1 +!DynamicDropGFXSlotCount_OW = (FreeOWGraphics_end-FreeOWGraphics)>>1 HPItemReset: PHA LDA !MULTIWORLD_ITEM_PLAYER_ID : BNE .skip @@ -200,6 +203,14 @@ HPItemReset: .skip PLA .done + PHA : PHY + LDY.b #$0F + - LDA.w $0DD0,Y : BEQ + + LDA.w !SPRITE_REDRAW, Y : CMP.b #$02 : BNE + + ; attempt redraw of any sprite using the overflow slot + LDA.b #$01 : STA.w !SPRITE_REDRAW, Y + + DEY : BPL - + PLY : PLA RTL ;-------------------------------------------------------------------------------- MaybeMarkDigSpotCollected: diff --git a/inventory.asm b/inventory.asm index 0b60e6e..fff30c6 100644 --- a/inventory.asm +++ b/inventory.asm @@ -1015,6 +1015,7 @@ DrawMushroom: PHA : PHY LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready JSL.l LoadMushroom_justGFX + LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ .skipInit BRA .done ; don't draw on the init frame .skipInit diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 6f72f34..61a2829 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -22,7 +22,8 @@ RequestSlottedTile: PHX : PHY PHA - ; skip sending the request if busy with other + JSL Sprite_IsOnscreen : BCC ++ + ; skip sending the request if busy with other things LDA.b $11 : CMP.b #$21 : BCS ++ ; skip if OW is loading Map16 GFX ; TODO: Figure out how to allow submodule 22, check DMA status instead LDA.b $5D : CMP.b #$14 : BEQ ++ ; skip if we're mid-mirror LDA.b $1B : BEQ + ; OW current doesn't occupy any slots that medallion gfx do @@ -45,7 +46,7 @@ RequestSlottedTile: LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ STA.w SprItemGFX,X + +++ INC : STA.w SprItemGFX,X JMP .success + CMP.b #$A0 : BCC + : CMP.b #$AF+1 : BCS + ; if key, use key OAM slot LDY.b $5D : CPY.b #$19 : BCC ++ : CPY.b #$1A+1 : BCS ++ ; if getting tablet item, don't use key slot @@ -55,28 +56,28 @@ RequestSlottedTile: LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ INC : STA.w SprItemGFX,X + +++ INC : INC : STA.w SprItemGFX,X JMP .success + CMP.b #$B5 : BNE + ; if good bee, use bee OAM slot LDA.b $1B : BEQ ++ LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ INC : INC : STA.w SprItemGFX,X + +++ INC : INC : INC : STA.w SprItemGFX,X JMP .success + CMP.b #$B2 : BNE + ; if fairy, use fairy OAM slot LDA.b $1B : BEQ ++ LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ INC : STA.w SprItemGFX,X + +++ INC : INC : STA.w SprItemGFX,X JMP .success + CMP.b #$B1 : BNE + ; if apple, use apple OAM slot LDA.b $1B : BEQ ++ LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ INC : INC : STA.w SprItemGFX,X + +++ INC : INC : INC : STA.w SprItemGFX,X JMP .success + CMP.b #$6A : BNE + ; if triforce, use cutscene OAM slot PHA @@ -84,7 +85,7 @@ RequestSlottedTile: LDA.b #!DynamicDropGFXSlotCount_UW BRA +++ ++ LDA.b #!DynamicDropGFXSlotCount_OW - +++ STA.w SprItemGFX,X + +++ INC : STA.w SprItemGFX,X JMP .initRequest ; don't jump to end, we need the TF GFX to draw at $E7 + @@ -102,7 +103,26 @@ RequestSlottedTile: PLX STA.w DynamicDropGFXIndex STA.w SprItemGFX,X - + PHX + ; loop thru other sprites, check if any use the same gfx slot + LDY.b #$0F + - TYA : CMP 1,S : BEQ + ; don't check self + LDA.w $0DD0,Y : BEQ + + LDA.w !SPRITE_REDRAW, Y : BNE + + LDA.w SprItemGFX,Y : CMP.w DynamicDropGFXIndex : BNE + + LDA.w $0E20,Y : CMP.b #$EB : BEQ ++ : CMP.b #$E4 : BEQ ++ + BRA + + ++ + ; slot already in use, use overflow slot + LDA.b #$02 : STA.w !SPRITE_REDRAW, X + LDA.b $1B : BEQ ++ + LDA.b #!DynamicDropGFXSlotCount_UW + BRA +++ + ++ LDA.b #!DynamicDropGFXSlotCount_OW + +++ STA.w SprItemGFX,X + PLX : PLA : BRA .return + + DEY : BPL - + PLX .initRequest PHX @@ -351,7 +371,8 @@ DynamicOAMTileUW_thin: ; add new slots above this line - ; + dw 0, 0 : db $E3, $00, $20, $00 ; overflow slot + dw 0, 8 : db $F3, $00, $20, $00 ; above this line, add slots that we want to draw to specific slots @@ -385,6 +406,9 @@ DynamicOAMTileUW_full: ; add new rotating slots above this line + dw -4, -1 : db $A0, $00, $20, $02 ; overflow slot + dd 0, 0 + dw -4, -1 : db $E7, $00, $20, $02 ; triforce dd 0, 0 @@ -417,7 +441,8 @@ DynamicOAMTileOW_thin: ; add new slots above this line - ; + dw 0, 0 : db $E3, $00, $20, $00 ; overflow slot + dw 0, 8 : db $F3, $00, $20, $00 ; above this line, add slots that we want to draw to specific slots @@ -451,6 +476,9 @@ DynamicOAMTileOW_full: ; add new slots above this line + dw 0, 0 : db $A0, $00, $20, $02 ; overflow slot + dd 0, 0 + dw 0, 0 : db $E7, $00, $20, $02 ; triforce dd 0, 0 @@ -463,12 +491,12 @@ DynamicOAMTileOW_full: dd 0, 0 ConditionalPushBlockTransfer: - LDA.b $1B : BNE + - LDA.b #$0F ; don't transfer push block when on the OW - BRA .return-3 - + - LDA.b #$1F : STA.w $420B ; what we wrote over - .return + LDA.b $1B : BNE + + LDA.b #$0F ; don't transfer push block when on the OW + BRA .return-3 + + + LDA.b #$1F : STA.w $420B ; what we wrote over + .return RTL pushpc diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index d24246b..ea07642 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -459,6 +459,7 @@ SpriteKeyDrawGFX: LDA.w !SPRITE_REDRAW, X : BEQ + LDA $0E80, X JSL RequestSlottedTile + LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ + BRA .skipDraw + LDA $0E80, X CMP.b #$24 : BNE + From e8a0697829aa8706d3f3f51cf810a58fd7a408e7 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 16 Jun 2023 20:40:01 -0500 Subject: [PATCH 61/68] Fixed issue where items spawning off screen might not redraw --- keydrop/dynamic_si_vram.asm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 61a2829..085a0fa 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -22,6 +22,7 @@ RequestSlottedTile: PHX : PHY PHA + LDA.b #$01 : STA.w !SPRITE_REDRAW, X JSL Sprite_IsOnscreen : BCC ++ ; skip sending the request if busy with other things LDA.b $11 : CMP.b #$21 : BCS ++ ; skip if OW is loading Map16 GFX ; TODO: Figure out how to allow submodule 22, check DMA status instead @@ -110,8 +111,12 @@ RequestSlottedTile: LDA.w $0DD0,Y : BEQ + LDA.w !SPRITE_REDRAW, Y : BNE + LDA.w SprItemGFX,Y : CMP.w DynamicDropGFXIndex : BNE + - LDA.w $0E20,Y : CMP.b #$EB : BEQ ++ : CMP.b #$E4 : BEQ ++ - BRA + + LDA.w $0E20,Y ; don't need E5 enemy big key drop and E9 powder item + CMP.b #$EB : BEQ ++ ; heart piece + CMP.b #$E4 : BEQ ++ ; enemy drop + CMP.b #$3B : BEQ ++ ; bonk item + CMP.b #$E7 : BEQ ++ ; mushroom + BRA + ++ ; slot already in use, use overflow slot LDA.b #$02 : STA.w !SPRITE_REDRAW, X From cac3ecf4ef801a33ed8ede1420d1080ed4300355 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Thu, 29 Jun 2023 19:26:36 -0500 Subject: [PATCH 62/68] Using new overflow GFX slot and redraw after item get --- keydrop/dynamic_si_vram.asm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index 085a0fa..c0857f1 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -243,7 +243,8 @@ FreeUWGraphics: dw $9DC0>>1 ; add new slots above this line .end - dw $9CE0>>1 + dw $0000 ; overflow slot, intentionally blank + dw $9CE0>>1 ; Triforce ; above this line, add slots that we want to draw to specific slots FreeOWGraphics: @@ -255,7 +256,8 @@ FreeOWGraphics: ;dw $9DC0>>1 ; Whirlpool ; add new slots above this line .end - dw $9CE0>>1 + dw $0000 ; overflow slot, intentionally blank + dw $9CE0>>1 ; Triforce ; above this line, add slots that we want to draw to specific slots ;=================================================================================================== From 144817fe90d78fd4d95f1ff17c355bf4c05a53e9 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Thu, 29 Jun 2023 19:28:49 -0500 Subject: [PATCH 63/68] Fixed issue where Aga Door flag prevented TF Cutscene --- elder.asm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/elder.asm b/elder.asm index 4ab0111..43b6a1e 100644 --- a/elder.asm +++ b/elder.asm @@ -121,6 +121,9 @@ pushpc org $0589B1 MasterSword_ConditionalHandleReceipt_DoReceipt: + org $0588DF + JSL MasterSword_CheckIfPulled : PLX : NOP #2 + db $90 ; BCC instead of BEQ org $05890E JSL MasterSword_ConditionalActivateCutscene org $05895F @@ -134,6 +137,12 @@ pushpc JSL MasterSword_ConditionalHandleReceipt : NOP #2 pullpc +MasterSword_CheckIfPulled: + CPX.b #$80 : BEQ + + - CLC : RTL ; not on pedestal screen, continue with cutscene + + LDA.l $7EF280,X : AND.b #$40 ; what we wrote over + BEQ - : SEC : RTL + MasterSword_ConditionalActivateCutscene: LDA.w $0D90,X : BNE .specialCutscene JML Sprite_CheckDamageToPlayerSameLayerLong ; what we wrote over From f51df3e6eb47a9da1c3bfe6a0d54deba91cb12ec Mon Sep 17 00:00:00 2001 From: codemann8 Date: Mon, 3 Jul 2023 15:54:59 -0500 Subject: [PATCH 64/68] Fixed issue with Kakariko music playing when killing Aggro Guards in enemizer --- hooks.asm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hooks.asm b/hooks.asm index 5222ecd..3a78b60 100755 --- a/hooks.asm +++ b/hooks.asm @@ -2557,6 +2557,10 @@ JSL Overworld_MosaicDarkWorldChecks : NOP org $05CC58 ; <- Bank05.asm:1307 (LDA $040A : CMP.b #$18) JSL PsychoSolder_MusicCheck NOP #1 +; +org $06F96A +JSL PsychoSolder_MusicCheck +NOP #1 ;-------------------------------------------------------------------------------- org $02B13A ; <- Bank02.asm:7647 dl Overworld_FinishMirrorWarp From c424cf431146642e5ecccd1c704e679249e005b1 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Wed, 5 Apr 2023 08:31:30 -0500 Subject: [PATCH 65/68] Symmetrical GTCutscene Crystals --- LTTP_RND_GeneralBugfixes.asm | 11 ++++-- goalitem.asm | 72 +++++++++++++++++++++++++++--------- hooks.asm | 17 ++++++--- 3 files changed, 72 insertions(+), 28 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 5da2f9a..555bca0 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -612,14 +612,17 @@ Ancilla_ReceiveItem: org $08C505 Ancilla_ReceiveItem_objectFinished: -org $08CE93 -Ancilla_BreakTowerSeal_draw_single_crystal: +org $08CE2E +GTCutscene_AnimateCrystals_NoRotate: + +org $08CEB6 +GTCutscene_DrawSingleCrystal_SkipCrystal: org $08CEC3 -Ancilla_BreakTowerSeal_stop_spawning_sparkles: +GTCutscene_DrawSingleCrystal_SkipSparkle: org $08CF59 -BreakTowerSeal_ExecuteSparkles: +GTCutscene_SparkleALot: org $08F710 Ancilla_SetOam_XY_Long: diff --git a/goalitem.asm b/goalitem.asm index d4a003f..a2ffc98 100644 --- a/goalitem.asm +++ b/goalitem.asm @@ -110,28 +110,64 @@ BRA .all_dungeons ;-------------------------------------------------------------------------------- -GetRequiredCrystalsForTower: - BEQ + : JSL.l BreakTowerSeal_ExecuteSparkles : + ; thing we wrote over - LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$00 : BNE + : JML.l Ancilla_BreakTowerSeal_stop_spawning_sparkles : + - LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$01 : BNE + : JML.l Ancilla_BreakTowerSeal_draw_single_crystal : + - LDA.l NumberOfCrystalsRequiredForTower : DEC #2 : TAX -JML.l GetRequiredCrystalsForTower_continue +GTCutscene_CrystalMasks: +db %00000000 ; 0 crystals +db %10000000 ; BIT INDEX DIAGRAM +db %00010010 ; 0 +db %00010101 ; 5 1 +db %10010101 ; 7 +db %10110110 ; 4 2 +db %00111111 ; 3 +db %10111111 ; 7 crystals ;-------------------------------------------------------------------------------- -GetRequiredCrystalsInX: - LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$00 : BNE + - TAX - RTL - + +GTCutscene_ConditionalAnimateCrystals: + PHX : PHX + LDA.l NumberOfCrystalsRequiredForTower : TAX : LDA.l GTCutscene_CrystalMasks,X + PLX + - LSR : DEX : BPL - + PLX : BCC .skip_crystal - TXA +.draw_crystal + LDA.b $11 : BEQ + : JML.l GTCutscene_AnimateCrystals_NoRotate ; what we wrote over + + JML.l GTCutscene_AnimateCrystals_NextCrystal+4 -- CMP.l NumberOfCrystalsRequiredForTower : BCC + - SBC.l NumberOfCrystalsRequiredForTower ; carry guaranteed set - BRA - +.skip_crystal + JML.l GTCutscene_DrawSingleCrystal-3 +;-------------------------------------------------------------------------------- +GTCutscene_ConditionalDrawSingleCrystal: + LDA.w $06FA : BEQ .draw_crystal : STZ.w $06FA + LDA.l NumberOfCrystalsRequiredForTower : TAX + LDA.l GTCutscene_CrystalMasks,X : AND.b #$80 : BEQ .skip_crystal +.draw_crystal + LDX.w $0FA0 : PHY ; what we wrote over + JML.l GTCutscene_DrawSingleCrystal+4 +.skip_crystal + JML.l GTCutscene_DrawSingleCrystal_SkipCrystal +;-------------------------------------------------------------------------------- +GTCutscene_AnimateCrystals_Prep: + BEQ + : JSL.l GTCutscene_SparkleALot : + ; thing we wrote over + LDA.l NumberOfCrystalsRequiredForTower : BNE + + JML.l GTCutscene_DrawSingleCrystal_SkipSparkle + + CMP.b #$01 : BNE + + JML.l GTCutscene_DrawSingleCrystal + + INC.w $06FA ; some free ram OWR also uses + JML.l GTCutscene_AnimateCrystals_NextCrystal-2 +;-------------------------------------------------------------------------------- +GTCutscene_ActivateSparkle_SelectCrystal: + LDA.l NumberOfCrystalsRequiredForTower : BNE + + TAX : RTL + + TXA - + INC : CMP.l NumberOfCrystalsRequiredForTower : BNE + - LDA.b #$08 - + : DEC : TAX + - CMP.l NumberOfCrystalsRequiredForTower : BCC + + SBC.l NumberOfCrystalsRequiredForTower : BRA - ; carry guaranteed set + + + PHY : TAY + LDA.l NumberOfCrystalsRequiredForTower : TAX : LDA.l GTCutscene_CrystalMasks,X + LDX.b #$FF + - LSR : INX : BCC + + DEY + + BPL - + PLY RTL ;-------------------------------------------------------------------------------- CheckEnoughCrystalsForGanon: diff --git a/hooks.asm b/hooks.asm index 974eca7..d8c268c 100755 --- a/hooks.asm +++ b/hooks.asm @@ -498,16 +498,21 @@ JSL.l CheckEnoughCrystalsForTower NOP #4 db #$90 ; BCC ;-------------------------------------------------------------------------------- -org $08CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR BreakTowerSeal_ExecuteSparkles : LDX.b #$06) -JML.l GetRequiredCrystalsForTower -NOP #3 -GetRequiredCrystalsForTower_continue: +org $08CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR GTCutscene_SparkleALot : LDX.b #$06) +JML.l GTCutscene_AnimateCrystals_Prep : NOP +LDX.b #$05 +GTCutscene_AnimateCrystals_NextCrystal: +JML.l GTCutscene_ConditionalAnimateCrystals +;-------------------------------------------------------------------------------- +org $08CE93 +GTCutscene_DrawSingleCrystal: +JML.l GTCutscene_ConditionalDrawSingleCrystal ;-------------------------------------------------------------------------------- org $08CF19 ; <- 44F19 - ancilla_break_tower_seal.asm : 336 (TXA : AND.b #$07 : TAX) -JSL.l GetRequiredCrystalsInX +JSL.l GTCutscene_ActivateSparkle_SelectCrystal ;-------------------------------------------------------------------------------- org $08CFC9 ; <- 44FC9 - ancilla_break_tower_seal.asm : 414 (RTS) -db #$6B +RTL ;-------------------------------------------------------------------------------- ;================================================================================ From 653f66e57a6a1fe19eae667a4892de702166d747 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 7 Apr 2023 11:48:53 -0500 Subject: [PATCH 66/68] Fix for Hera music silence --- doorrando/spiral.asm | 5 +++++ msu.asm | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/doorrando/spiral.asm b/doorrando/spiral.asm index 81f8533..a0c0ae7 100644 --- a/doorrando/spiral.asm +++ b/doorrando/spiral.asm @@ -101,6 +101,11 @@ StairCleanup: { rts } +LookupSpiralOffset_long: + PHB : PHK : PLB + JSR LookupSpiralOffset + PLB : RTL + ;Sets the offset in A LookupSpiralOffset: { ;where link currently is in $a2: quad in a8 & #$03 diff --git a/msu.asm b/msu.asm index 5fd40b2..62322e1 100644 --- a/msu.asm +++ b/msu.asm @@ -370,8 +370,15 @@ CheckMusicLoadRequest: ; Fade out music if we're changing tracks on a stair transition ;-------------------------------------------------------------------------------- SpiralStairsPreCheck: - REP #$20 ; thing we wrote over - LDA.l DRMode : BNE .done ; exit if door rando enabled + LDA.l DRMode : BEQ + ; if door rando enabled + JSL LookupSpiralOffset_long + REP #$30 : AND.w #$00FF : ASL #2 : TAX + LDA.l SpiralTable,X + SEP #$10 : TAX : CPX.b #$07 : BNE .done ; check if hera boss + JSL CheckHeraBossDefeated : BCS .done + LDX.b #$F1 : STX !REG_MUSIC_CONTROL_REQUEST + BRA .done + + REP #$20 ; thing we wrote over LDA $A0 CMP.w #$000C : BNE + LDA !REG_CURRENT_MSU_TRACK : AND.w #$00FF : CMP.w #59 : BNE .done @@ -401,8 +408,11 @@ SpiralStairsPreCheck: ; Change music on stair transition (ToH/GT) ;-------------------------------------------------------------------------------- SpiralStairsPostCheck: - LDA.l DRMode : BNE .done ; exit if door rando enabled - LDA $A0 + LDA.l DRMode : BEQ + ; if door rando enabled + LDA.b $A2 : CMP.w #$0007 : BNE .done + LDX.b #$16 : STX !REG_MUSIC_CONTROL_REQUEST + BRA .done + + LDA $A0 CMP.w #$000C : BNE + ; Ganon's tower entrance LDX $0130 : CPX.b #$F1 : BNE .done ; Check that we were fading out From ffe7985139e7917587e4c31c2fecd3da2b46a7f8 Mon Sep 17 00:00:00 2001 From: codemann8 Date: Fri, 7 Jul 2023 01:31:18 -0500 Subject: [PATCH 67/68] Adjusting bottle vendor fish prizes to be centered and display key GFX correctly --- keydrop/dynamic_si_vram.asm | 8 +++++++- keydrop/standing_items.asm | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index c0857f1..f84309c 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -321,7 +321,13 @@ DrawSlottedTile: BRA .draw + ; narrow LDA.w $0E20, X : AND.w #$00FF : CMP.w #$003B : BEQ .draw ; bonk item - LDA.b $A0 : CMP.w #$0120 : BEQ .draw ; good bee statue + LDA.b $A0 : CMP.w #$0120 : BNE + + LDA.b $1B : BNE .draw ; good bee statue + + + ; TODO: Figure out how to target bottle vendor fish item better than this + LDA.b $8A : AND.w #$00FF : CMP.w #$0018 : BNE + + LDA.b $1B : BEQ .draw ; bottle vendor key + + LDA.w #$0004 STA.w !SPRITE_DYNAMIC_OAM : STA.w !SPRITE_DYNAMIC_OAM+8 diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index ea07642..f32f9b9 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -651,6 +651,24 @@ SetTheSceneFix: JSL LoadCommonSprites_long RTL +pushpc +org $868072 +JSL SetBottleVendorKey : NOP #4 +pullpc +SetBottleVendorKey: + LDA.w $0E20,Y : CMP.b #$E4 : BNE + + ; small key from bottle vendor + LDA.b #$AF : STA.w $0E80,Y + LDA.b #$01 : STA.w !SPRITE_REDRAW, Y + BRA .shift + + CMP.b #$DE : BEQ .return + CMP.b #$E2 : BEQ .return + ; shift narrow sprite to left by 4 + .shift + LDA.b $00 : CLC : ADC.b #$04 : STA.w $0D10,Y ; what we wrote over +.return +RTL + ConditionalLoadCommonSprites_Do3To4Low: LDA.b $10 : CMP.b #$01 : BEQ + ; what we wrote over CMP.b #$0E : BEQ ++ From bdf8c7bd6ed50a64f5d80161ae696c868b2055fe Mon Sep 17 00:00:00 2001 From: aerinon Date: Mon, 7 Aug 2023 10:26:47 -0600 Subject: [PATCH 68/68] Ignore more of the bitfield nibble of the CompassMode --- newhud.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newhud.asm b/newhud.asm index 924fd5e..cf059f9 100644 --- a/newhud.asm +++ b/newhud.asm @@ -89,7 +89,7 @@ NewDrawHud: ;================================================================================ ; Draw Dungeon Compass Counts ;================================================================================ - LDA.l CompassMode : AND #$003F : BEQ + ; skip if CompassMode is 0. + LDA.l CompassMode : AND #$000F : BEQ + ; skip if CompassMode is 0. JSL.l DrawDungeonCompassCounts ; compasses.asm +