Fixed up the anti-soft lock in swamp

Combined flags and fixed a couple of bugs
This commit is contained in:
aerinon
2022-01-21 16:07:03 -07:00
parent 50dd0c7be4
commit 3c9b04f30a
4 changed files with 71 additions and 67 deletions

View File

@@ -248,8 +248,8 @@ incsrc stats/main.asm
incsrc menu/overworldmap.asm ; overwrites some code in bank 0A
incsrc doorrando.asm ; bank 27 likely A7 in the future
;bank 28/A8 for keydropshuffle
incsrc keydrop/potsanity.asm
;bank 28/A8 for keydropshuffle / standing items
incsrc keydrop/standing_items.asm
incsrc enemizer/main.asm ; this is originally in bank 36, but is currently in migratory status in bank 37
org $308000 ; bank #$30
@@ -363,7 +363,7 @@ warnpc $B08000
;$23 Stats & Credits
;$24 Code Bank
;$27 DR Code Bank
;$28 Keydrop Code bank
;$28 Keydrop / Standing Items Code bank
;$29 External hooks (rest of bank not used)
;$2E Reserved for Tournament Use
;$2F Static RNG (rest is reserved for tournament use)

View File

@@ -12,15 +12,18 @@ FloodGateReset:
+
FloodGateResetInner:
LDA.l Bugfix_SwampWaterLevel : BEQ .done
LDA $279004 : BEQ .check_room_53 ; Only do the check for room 55 if on door rando
LDA $7EF06F : AND.b #$04 : BEQ .drain_room_55 ; Check if key in room 55 has been collected.
LDA $7EF356 : AND.b #$01 : BNE .check_room_53 ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset.
.drain_room_55
LDA $7EF06E : AND.b #$7F : STA $7EF06E ; clear water room 55 - outer room you shouldn't be able to softlock except in major glitches
.check_room_53
LDA $7EF06B : AND.b #$04 : BNE .done ; Check if key in room 53 has been collected.
LDA $279004 : BEQ .check_room_35; Only do the check for room 37 if on door rando
LDA.l SwampDrain1HasItem : BEQ .flipper_check
LDA $7F666F : AND.b #$80 : BEQ .drain_room_37 ; Check if key in room 37 has been collected.
.flipper_check
LDA $7EF356 : AND.b #$01 : BNE .check_room_35 ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset.
.drain_room_37
LDA $7EF06E : AND.b #$7F : STA $7EF06E ; clear water room 37 - outer room you shouldn't be able to softlock except in major glitches
.check_room_35
LDA.l SwampDrain2HasItem : BEQ .done
LDA $7F666B : AND.b #$80 : BNE .done ; Check if key in room 35 has been collected.
; no need to check for flippers on the inner room, as you can't get to the west door no matter what, without flippers.
LDA $7EF06A : AND.b #$7F : STA $7EF06A ; clear water room 53 - inner room with the easy key flood softlock
LDA $7EF06A : AND.b #$7F : STA $7EF06A ; clear water room 35 - inner room with the easy key flood softlock
.done
RTL
;================================================================================

View File

@@ -9,7 +9,7 @@ org $09C2BB
org $09C327
JSL LoadSpriteData
org $06EF7A
org $06F976
JSL RevealSpriteDrop : NOP
org $06926e ; <- 3126e - sprite_prep.asm : 2664 (LDA $0B9B : STA $0CBA, X)
@@ -103,12 +103,14 @@ PotMultiWorldTable:
; Reserved $250 296 * 2
org $A8AA50
ShuffleKeyDrops: ; 142A50 # todo : combine these flags?
db 0
StandingItemsOn: ; 142A51
db 0
MultiClientFlags: ; 142A52 -> stored in SRAM at 7ef33d
StandingItemsOn: ; 142A50
db 0
MultiClientFlags: ; 142A51-2 -> stored in SRAM at 7ef33d (for now)
dw 0
SwampDrain1HasItem: ; 142A53
db 1
SwampDrain2HasItem: ; 142A54
db 1
RevealPotItem:
@@ -220,14 +222,18 @@ RevealSpriteDrop:
LDA #$02 : STA.l SpawnedItemFlag
STX SpawnedItemIndex
LDA.l SprItemReceipt, X : STA SpawnedItemID
LDA.b #$01 : STA $0CBA, X ; trigger the small key routines
LDA.b #$09 : STA $0DD0, X : RTL ; unstun if stunned
LDA.l SprItemMWPlayer, X : STA SpawnedItemMWPlayer
LDY.b #$01 ; trigger the small key routines
LDA SpawnedItemID : CMP #$32 : BNE +
LDA.l StandingItemsOn : BNE +
INY ; big key routine
+ RTL ; unstun if stunned
.normal
LDA.w $0CBA, X : BNE .no_forced_drop
LDY.w $0CBA, X : BEQ .no_forced_drop
RTL
.no_forced_drop
PLY : PLY ; remove the JSL return lower 16 bits
PEA.w $06EF9A-1 ; change return address to .no_forced_drop of (Sprite_ApplyCalculatedDamage)
PLA : PLA ; remove the JSL reswamturn lower 16 bits
PEA.w $06F996-1 ; change return address to .no_forced_drop of (Sprite_DoTheDeath)
RTL
BitFieldMasks:
@@ -239,7 +245,6 @@ db $40, $20
; Runs during Sprite_E4_SmallKey and duning Sprite_E5_BigKey spawns
ShouldSpawnItem:
LDA.l StandingItemsOn : BEQ .normal
; checking our sram table
PHX : PHY
REP #$30
@@ -256,26 +261,21 @@ ShouldSpawnItem:
SEP #$30 : PLY : PLX : LDA #$01 : RTL ; already obtained
.notObtained
SEP #$30 : PLY : PLX
LDA #$00 : RTL
.normal
LDA.w $0403
AND.w KeyRoomFlagMasks,Y
LDA #$00
RTL
MarkSRAMForItem:
LDA.l StandingItemsOn : BEQ .normal
PHX : PHY : REP #$30
LDA.b $A0 : ASL : TAY
LDA.l SpawnedItemIndex : ASL
TAX : LDA.l BitFieldMasks, X : STA $00
TYX
LDA.w SpawnedItemFlag : CMP #$01 : BEQ +
LDA SpriteItemSRAM, X : ORA $00 : STA SpriteItemSRAM, X
LDA.w SpawnedItemFlag : CMP #$0001 : BEQ +
LDA SpriteItemSRAM, X : ORA $00 : STA SpriteItemSRAM, X : BRA .end
+ LDA PotItemSRAM, X : ORA $00 : STA PotItemSRAM, X
.end
SEP #$30 : PLY : PLX
LDA.w $0403 : RTL
.normal
LDA.w $0403 : ORA.w KeyRoomFlagMasks,Y
LDA.w $0403
RTL
SpriteKeyPrep:
@@ -319,10 +319,11 @@ SpriteKeyDrawGFX:
KeyGet:
LDA $7EF36F ; what we wrote over
PHA
LDY $0E80, X
LDA.l StandingItemsOn : BNE +
PLA : RTL
+ LDY $0E80, X
LDA SprItemIndex, X : STA SpawnedItemIndex
LDA SprItemFlags, X : STA SpawnedItemFlag
; todo: may need to check if we are in a dungeon or not $FF
LDA $A0 : CMP #$87 : BNE + ;check for hera cage
LDA SpawnedItemFlag : BNE + ; if it came from a pot, it's fine
JSR ShouldKeyBeCountedForDungeon : BCC ++
@@ -331,7 +332,6 @@ KeyGet:
+ STY $00
LDA SprItemMWPlayer, X : STA !MULTIWORLD_ITEM_PLAYER_ID : BNE .receive
PHX
; todo: may need to check if we are in a dungeon or not $FF
LDA $040C : LSR : TAX
LDA $00 : CMP.l KeyTable, X : BNE +
- JSL.l FullInventoryExternal : JSL CountChestKeyLong : PLX : PLA : RTL
@@ -366,7 +366,8 @@ BigKeyGet:
+ SEC : RTL
LoadProperties_PreserveCertainProps:
LDA.l StandingItemsOn : BNE +
LDA $0E20, X : CMP #$E4 : BEQ +
CMP #$E5 : BEQ +
JML Sprite_LoadProperties
+ LDA $0F50, X : PHA
LDA $0E80, X : PHA

View File

@@ -245,7 +245,7 @@ IncrementSmallKeysNoPrimary:
LDA $048E : CMP.w #$0087 : BNE ++ ; check for hera basement cage
LDA $A8 : AND #$0003 : CMP #$0002 : BNE ++ ; must be quadrant 2
PLP : PHY : LDY.b #$24 : JSL.l FullInventoryExternal
LDA ShuffleKeyDrops : BNE +++
LDA StandingItemsOn : BNE +++
JSR CountChestKey
+++ PLY : BRA +
++