New fix for pot drops when at sprite limit

This commit is contained in:
codemann8
2025-10-14 02:50:07 -05:00
parent a8b1fc989e
commit dfc182a2d5
4 changed files with 66 additions and 3 deletions

View File

@@ -2,7 +2,11 @@
; New bush mob randomization
;--------------------------------------------------------------------------------
org $868279
NOP #$0A
BRA +
MaybeSkipTerrainDebris:
JSL MaybeSkipTerrainDebris_long : RTS ; sticking this here, no other free space in bank 06
NOP #3
+
JSL sprite_bush_spawn
NOP ; we keep the branch
;--------------------------------------------------------------------------------

View File

@@ -1,4 +1,7 @@
; hooks
org $81DB19
JSL MaybeSkipSmashTerrain : BCS $81DB11
org $81E6B0
JSL RevealPotItem
RTS
@@ -39,6 +42,9 @@ org $86d180
org $86d18d ; <- 3518D - sprite_absorbable.asm : 274 (LDA $7EF36F : INC A : STA $7EF36F)
JSL KeyGet
org $86E24A
JSR MaybeSkipTerrainDebris
org $86f9f3 ; bank06.asm : 6732 (JSL SpritePrep_LoadProperties)
JSL LoadProperties_PreserveCertainProps
@@ -46,6 +52,11 @@ org $86828A
Sprite_SpawnSecret_SpriteSpawnDynamically:
JSL CheckSprite_Spawn
org $87B114
JSL MaybeUnableToLiftPotSfx
NOP #4
db $30 ; BMI
org $87B169
JSL PreventPotSpawn : NOP
@@ -773,7 +784,6 @@ CheckSprite_Spawn:
RTL
.check
LDA.b Scrap0D : CMP.b #$08 : BNE +
LDA.w LinkDashing : BNE .error
LDX.b #$0F
; loop looking for a Sprite with state 0A (carried by the player)
@@ -784,7 +794,9 @@ RTL
LDA.b #$00 : STZ.w SpriteAITable, X
LDA.b #$E4 : JSL Sprite_SpawnDynamically
BMI .error
LDA.b #$40 : TSB.w AButtonAct : RTL
LDA.w UseY1 : AND.b #$02 : BNE ++
LDA.b #$40 : TSB.w AButtonAct
++ RTL
.error
LDA.b #$3C ; SFX2_3C - error beep
@@ -803,6 +815,44 @@ PreventPotSpawn2:
LDA.b #$01 : TSB.b LinkStrafe ; what we wrote over
+ RTL
MaybeSkipTerrainDebris_long:
STZ.w SecretId ; what we wrote over
LDA.w SpriteTypeTable, X : CMP.b #$EC
BEQ .return
PLA : PLA : PLA : PLA : PLA
LDA.b #Sprite_ScheduleForBreakage_exit>>16 : PHA
PEA.w Sprite_ScheduleForBreakage_exit-1
.return
RTL
MaybeSkipSmashTerrain:
STY.w ManipIndex : LDA.w ManipTileMapX, Y ; what we wrote over
PHA
SEP #$30
LDX.b #$0F
- LDA.w SpriteAITable, X : BEQ .continue
DEX
BPL -
.skip
PLA : PLA
LDA.b #$3C : STA.w SFX2 ; error beep
SEC
RTL
.continue
REP #$30
PLA
CLC
RTL
MaybeUnableToLiftPotSfx:
- LDA.w SpriteAITable,X : BEQ .return
DEX
BPL -
LDA.b #$3C : STA.w SFX2 ; error beep
LDA.b #$FF
.return
RTL
CheckIfPotIsSpecial:
TXA ; give index to A so we can do a CMP.l
CMP.l $018550 ; see if our current index is that of object 230

View File

@@ -272,6 +272,8 @@ DungeonID = $7E040C ; High byte mostly unused but sometimes read.
;
TransitionDirection = $7E0418 ; OW: 0=N 1=S 2=W 3=E UW: 0=S 1=N 2=E 3=W
;
ManipIndex = $7E042C ; Index of manipulable tile. Word length.
;
TrapDoorFlag = $7E0468 ; Flag that is set when trap doors are down. 2 bytes
;
LayerAdjustment = $7E047A ; Flags layer adjustments. Arms EG.
@@ -285,6 +287,8 @@ OWEntranceCutscene = $7E04C6 ;
;
HeartBeepTimer = $7E04CA ;
;
ManipTileMapX = $7E0540 ; Tilemap X position of manipulable tile. $10 x 2 bytes
;
CameraTargetN = $7E0610 ; Camera scroll target for directions NSEW
CameraTargetS = $7E0612 ;
CameraTargetW = $7E0614 ;
@@ -367,6 +371,7 @@ EnemyStunTimer = $7E0B58 ; Auto-decrementing timer for stunned enemies.
;
BowDryFire = $7E0B9A ; If set, arrows are deleted immediately
;
SecretId = $7E0B9C ; Controls the secret spawned from bushes, pots, rocks, etc.
SaveFileIndex = $7E0B9D ;
;
SpriteAncillaInteract = $7E0BA0 ; If nonzero, ancillae do not interact with the sprite. $10 bytes.
@@ -871,6 +876,7 @@ endmacro
%assertRAM(OverworldIndexMirror, $7E040A)
%assertRAM(DungeonID, $7E040C)
%assertRAM(TransitionDirection, $7E0418)
%assertRAM(ManipIndex, $7E042C)
%assertRAM(TrapDoorFlag, $7E0468)
%assertRAM(LayerAdjustment, $7E047A)
%assertRAM(RoomIndexMirror, $7E048E)
@@ -878,6 +884,7 @@ endmacro
%assertRAM(Map16ChangeIndex, $7E04AC)
%assertRAM(OWEntranceCutscene, $7E04C6)
%assertRAM(HeartBeepTimer, $7E04CA)
%assertRAM(ManipTileMapX, $7E0540)
%assertRAM(CameraTargetN, $7E0610)
%assertRAM(CameraTargetS, $7E0612)
%assertRAM(CameraTargetW, $7E0614)
@@ -928,6 +935,7 @@ endmacro
%assertRAM(OverlordYHigh, $7E0B20)
%assertRAM(EnemyStunTimer, $7E0B58)
%assertRAM(BowDryFire, $7E0B9A)
%assertRAM(SecretId, $7E0B9C)
%assertRAM(SaveFileIndex, $7E0B9D)
%assertRAM(SpriteAncillaInteract, $7E0BA0)
%assertRAM(AncillaVelocityY, $7E0C22)

View File

@@ -201,6 +201,7 @@ Sprite_BagOfPowder = $85F644
MagicShopAssistant_Main = $85F893
Sprite_SpawnSecret_SetCoords = $8682A5
Chicken_SpawnAvengerChicken = $86A7DB
Sprite_ScheduleForBreakage_exit = $86E273
Link_PerformRead = $87B4DB
Link_PerformOpenChest_no_replacement = $87B59F
Link_CheckNewAPress = $87B5A9