Fix bonk dupe and bonk despawn issues

This commit is contained in:
codemann8
2023-05-05 22:13:38 -05:00
parent 9500800c3c
commit bae7457961
2 changed files with 12 additions and 3 deletions

View File

@@ -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

View File

@@ -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