Big ROM changes

- New Item GFX code
- Fixed Bonk Dupe issue
- Fixed Bonk Despawn issue
This commit is contained in:
codemann8
2023-05-07 20:19:18 -05:00
parent 608e01c906
commit 73fc85df3b
3 changed files with 30 additions and 18 deletions

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
+
@@ -495,33 +497,37 @@ 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 #$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
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
@@ -533,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
@@ -618,13 +626,17 @@ 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
+ PHA
LDA.b #$01 : STA !REDRAW
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
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 +649,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 +968,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