From e772b4a93169eff7e096c09b71fc5ee6f4666047 Mon Sep 17 00:00:00 2001 From: aerinon Date: Fri, 8 Sep 2023 13:42:22 -0600 Subject: [PATCH] Progressive Shields fix Fix for collection rate overflow Fix for progressive shield standing item (narrow version) Fix for double key counts Multiworld item substitution Made map key coutner not depend on new flag for now --- LTTP_RND_GeneralBugfixes.asm | 4 ++-- events.asm | 2 +- inventory.asm | 14 ++++++------- keydrop/dynamic_si_vram.asm | 5 ++++- keydrop/standing_items.asm | 12 +++++------ newitems.asm | 40 ++++++++++-------------------------- ram.asm | 2 +- 7 files changed, 32 insertions(+), 47 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 7ce4a5c..b179437 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -34,7 +34,7 @@ db $20, $19, $08, $31 ; year/month/day ;================================================================================ !ROM_VERSION_LOW ?= 1 ; ROM version (two 16-bit integers) -!ROM_VERSION_HIGH ?= 4 ; +!ROM_VERSION_HIGH ?= 5 ; org $80FFE0 ; Unused hardware vector RomVersion: @@ -78,7 +78,7 @@ incsrc ram.asm incsrc sram.asm incsrc registers.asm incsrc vanillalabels.asm -incsrc overworldmap.asm ; Overwrites some code in bank $8A +incsrc menu/overworldmap.asm ; Overwrites some code in bank $8A org $A08000 ; bank $20 incsrc itemdowngrade.asm diff --git a/events.asm b/events.asm index 0d3b997..b48819f 100644 --- a/events.asm +++ b/events.asm @@ -249,7 +249,7 @@ PreItemGet: RTL ;-------------------------------------------------------------------------------- PostItemGet: - STZ.w ShopPurchaseFlag + STZ.w ProgressiveFlag LDA.w ItemReceiptMethod : CMP.b #$01 : BEQ + LDX.w CurrentSpriteSlot STZ.w SpriteMetaData,X diff --git a/inventory.asm b/inventory.asm index fe3d84b..9f7e3a0 100644 --- a/inventory.asm +++ b/inventory.asm @@ -163,21 +163,21 @@ AddInventory: JSR.w IncrementYAItems .totalCount LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .done - REP #$20 + REP #$30 LDA.l TotalItemCounter : INC : TAY - LDA.l BootsEquipment : BNE + + LDA.l BootsEquipment : AND.w #$00FF : BNE + TYA : STA.l PreBootsLocations + - LDA.l MirrorEquipment : BNE + + LDA.l MirrorEquipment : AND.w #$00FF : BNE + TYA : STA.l PreMirrorLocations + - LDA.l FluteEquipment : BNE + + LDA.l FluteEquipment : AND.w #$00FF : BNE + TYA : STA.l PreFluteLocations + TYA STA.l TotalItemCounter - .done - SEP #$30 + .done + SEP #$30 PLB : PLP : PLY : PLX : PLA RTL @@ -229,7 +229,7 @@ DungeonIncrement: + CMP.b #$00 : BNE + INC #2 - TAX : REP #$20 : LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X : SEP #$20 + + TAX : REP #$20 : LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X : SEP #$20 CPX.b #$0D : BNE + LDA.l BigKeyField : BIT.b #$04 : BNE ++ LDA.l PreGTBKLocations : INC : STA.l PreGTBKLocations diff --git a/keydrop/dynamic_si_vram.asm b/keydrop/dynamic_si_vram.asm index fc72af6..858c1a0 100644 --- a/keydrop/dynamic_si_vram.asm +++ b/keydrop/dynamic_si_vram.asm @@ -55,7 +55,10 @@ FreeUWGraphics: ;=================================================================================================== DrawPotItem: - PHX : TAX + PHX + JSL.l AttemptItemSubstitution + JSL.l ResolveLootIDLong + TAX LDA.l SpriteProperties_standing_width,X : BEQ .narrow .full diff --git a/keydrop/standing_items.asm b/keydrop/standing_items.asm index 5813a85..6eb1a17 100644 --- a/keydrop/standing_items.asm +++ b/keydrop/standing_items.asm @@ -228,7 +228,7 @@ RevealPotItem: ++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X ; Could increment GT Tower Pre Big Key but we aren't showing that stat right now + REP #$10 - LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total + LDA.l TotalItemCounter : INC : STA.l TotalItemCounter ; Increment Item Total INC.w UpdateHUD .obtained PLY : PLX @@ -279,7 +279,7 @@ SaveMajorItemDrop: LDA.w #$0018 : BRA .substitute + CPY.w #$0031 : BNE + ; 10 pack bombs LDA.w #$0019 : BRA .substitute - + STA $0B9C ; indicates we should use the key routines or a substitute + + STA.w $0B9C ; indicates we should use the key routines or a substitute RTL .substitute PHA @@ -321,7 +321,7 @@ IncrementCountsForSubstitute: ++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X ; Could increment GT Tower Pre Big Key but we aren't showing that stat right now + - LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total + LDA.l TotalItemCounter : INC : STA.l TotalItemCounter ; Increment Item Total INC.w UpdateHUD .obtained SEP #$30 : PLX @@ -521,8 +521,8 @@ IncrementCountForMinor: INX #2 ; treat sewers as HC ++ LDA.l DungeonLocationsChecked, X : INC : STA.l DungeonLocationsChecked, X ; Could increment GT Tower Pre Big Key but we aren't showing that stat right now - + REP #$10 - LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total + + + LDA.l TotalItemCounter : INC : STA.l TotalItemCounter ; Increment Item Total INC.w UpdateHUD .obtained SEP #$30 : PLX @@ -647,7 +647,7 @@ KeyGet: LDA $00 : CMP.l KeyTable, X : BNE + .countIt LDA.l StandingItemCounterMask : AND SpawnedItemFlag : BEQ ++ - JSL.l AddInventory : JSL CountChestKeyLong + JSL.l AddInventory ++ PLX : PLA : RTL + CMP.b #$AF : beq .countIt ; universal key CMP.b #$24 : beq .countIt ; small key for this dungeon diff --git a/newitems.asm b/newitems.asm index 456a72d..79c832f 100644 --- a/newitems.asm +++ b/newitems.asm @@ -214,34 +214,14 @@ ItemBehavior: JSR .increment_sword RTS - .fighter_shield - SEP #$10 - LDA.w ShopPurchaseFlag : BNE ..shop_shield - - - LDX.b #$01 - JSR .increment_shield - RTS - ..shop_shield - LDA.l InventoryTable_properties,X : BIT.b #$02 : BNE - - RTS - + .fighter_shield .red_shield - SEP #$10 - LDA.w ShopPurchaseFlag : BNE ..shop_shield - - - LDX.b #$02 - JSR .increment_shield - RTS - ..shop_shield - LDA.l InventoryTable_properties,X : BIT.b #$02 : BNE - - RTS - .mirror_shield SEP #$10 - LDX.b #$03 - JSR .increment_shield - REP #$10 - RTS + LDA.l ProgressiveFlag : BEQ + + LDA.l HighestShield : INC : TAX + JSR .increment_shield + + RTS .blue_mail SEP #$10 @@ -273,8 +253,8 @@ ItemBehavior: .prog_shield SEP #$10 - LDA.l ShieldEquipment : INC : TAX - JSR .increment_shield + LDA.l HighestShield : INC : TAX + JSR .increment_shield REP #$10 RTS @@ -793,6 +773,7 @@ ResolveLootID: .shields SEP #$20 LDA !MULTIWORLD_SPRITEITEM_PLAYER_ID : BNE ++ + LDA.b #$01 : STA.l ProgressiveFlag LDA.l HighestShield CMP.l ProgressiveShieldLimit : BCC + LDA.l ProgressiveShieldReplacement @@ -1095,6 +1076,7 @@ RTS ;-------------------------------------------------------------------------------- AttemptItemSubstitution: PHX : PHA + LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .exit LDX.b #$00 - LDA.l ItemSubstitutionRules, X @@ -1159,7 +1141,7 @@ MaybeFlagCompassTotalPickup: RTL MaybeFlagMapTotalPickup: - LDA.l MapHUDMode : AND.b #$0F : BEQ .done +; LDA.l MapHUDMode : AND.b #$0F : BEQ .done LDA.w DungeonID : BMI .done LDA.w ItemReceiptID : CMP.b #$33 : BEQ .set_flag REP #$20 @@ -1181,7 +1163,7 @@ MaybeFlagDungeonTotalsEntrance: LDA.l CompassMode : AND.w #$000F : BEQ .maps ; Skip if we're not showing compass counts JSR.w FlagCompassCount .maps - LDA.l MapHUDMode : AND.w #$000F : BEQ .done +; LDA.l MapHUDMode : AND.w #$000F : BEQ .done LDX.w DungeonID JSR.w FlagMapCount .done diff --git a/ram.asm b/ram.asm index 9ad412e..31e94ca 100644 --- a/ram.asm +++ b/ram.asm @@ -188,7 +188,7 @@ RaceGameFlag = $7E021B ; ; MessageJunk = $7E0223 ; Zeroed but never used (?) ; -ShopPurchaseFlag = $7E0224 ; $01 = Shop purchase item receipt. +ProgressiveFlag = $7E0224 ; unused ;CoolScratch = $7E0224 ; 0x5C bytes of free ram ItemStackPtr = $7E0226 ; Pointer into Item GFX and VRAM target queues. Word length. ; If not zero, pointer should always be left pointing at the