From a950d65d7be919ced96b8e1eaf78b3878ee16313 Mon Sep 17 00:00:00 2001 From: Alchav <59858495+Alchav@users.noreply.github.com> Date: Sun, 17 Sep 2023 18:54:18 -0400 Subject: [PATCH 1/5] Do not allow bombs to increment when max bombs at 0 --- capacityupgrades.asm | 2 ++ inventory.asm | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/capacityupgrades.asm b/capacityupgrades.asm index 59e46939..d12a4a03 100644 --- a/capacityupgrades.asm +++ b/capacityupgrades.asm @@ -8,6 +8,8 @@ IncrementBombs: LDA !BOMB_UPGRADES ; get bomb upgrades !ADD.l StartingMaxBombs : DEC + CMP.b #$FF : BEQ + ; if max bombs is 0, it underflows to $FF. Don't add bombs + CMP !BOMB_CURRENT !BLT + diff --git a/inventory.asm b/inventory.asm index 28368ef7..1bf7cfb7 100644 --- a/inventory.asm +++ b/inventory.asm @@ -756,6 +756,10 @@ RTS ; Link_ReceiveItem_HUDRefresh: ;-------------------------------------------------------------------------------- Link_ReceiveItem_HUDRefresh: + LDA $7EF370 ; get bomb upgrades + !ADD.l StartingMaxBombs + CMP.b #0 : BEQ + ; do not add bombs if you can't carry any + LDA $7EF343 : BNE + ; skip if we have bombs LDA $7EF375 : BEQ + ; skip if we are filling no bombs DEC : STA $7EF375 ; decrease bomb fill count @@ -773,6 +777,11 @@ RTL HandleBombAbsorbtion: STA $7EF375 ; thing we wrote over LDA $0303 : BNE + ; skip if we already have some item selected + + LDA $7EF370 ; get bomb upgrades + !ADD.l StartingMaxBombs + CMP.b #0 : BEQ + ; do not switch to bombs if you can't carry any + LDA.b #$04 : STA $0202 ; set selected item to bombs LDA.b #$01 : STA $0303 ; set selected item to bombs JSL.l HUD_RebuildLong From 880b647fd279812d6dc51c06f30f87849bb1b358 Mon Sep 17 00:00:00 2001 From: Alchav <59858495+Alchav@users.noreply.github.com> Date: Sun, 29 Oct 2023 10:48:09 -0400 Subject: [PATCH 2/5] Do not allow spending your last heart --- shopkeeper.asm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/shopkeeper.asm b/shopkeeper.asm index 2c6b81c2..03fb7b70 100644 --- a/shopkeeper.asm +++ b/shopkeeper.asm @@ -682,8 +682,10 @@ Shopkeeper_BuyItem: LDA !SHOP_TYPE : AND.b #$80 : BEQ + : BRL .buy : + ; don't charge if this is a take-any .custom_price - LDA !SHOP_INVENTORY+2, X : AND.b #$80 : BEQ .price_is_rupees ; i honestly can't think of a better way to do this block because i haven't done asm in like 8 months - LDA !SHOP_INVENTORY+2, X : AND.b #$7F : CMP.b #$09 : BNE + ; 09 specifically is item + LDA !SHOP_INVENTORY+2, X : AND.b #$80 : BNE .price_is_not_rupees ; i honestly can't think of a better way to do this block because i haven't done asm in like 8 months + JMP .price_is_rupees + .price_is_not_rupees + LDA !SHOP_INVENTORY+2, X : AND.b #$7F : CMP.b #$09 : BNE + ; 09 specifically is item LDA !SHOP_INVENTORY+1, X : CMP.b $0303 : BNE .gotItem BRL .cant_afford .gotItem ; hand it over?? not logic friendly @@ -699,13 +701,16 @@ Shopkeeper_BuyItem: ; store shop index, get resource offset (X), load val, pop shop index, cmp val to shop_price... PHX : TAX : LDA ResourceOffset, X : TAX : TAY : LDA $7EF300, X ; fumble around with our resource value and price, sub value then put back into RAM PLX : CMP !SHOP_INVENTORY+1,X : BMI + ; if resource is less than value, skip + ; If hearts, ensure hearts are greater than the price + BNE .notEqual : CPY #$6D : BEQ .cant_afford + .notEqual ; subtract and store, store (x), store val back to address ; if X is heart containers, set ordinary hearts - !SUB !SHOP_INVENTORY+1,X : PHX : TYX : STA $7EF300, X + !SUB !SHOP_INVENTORY+1,X : PHX : TYX : STA $7EF300, X CPX #$6C : BNE .notHeartContainers CMP $7EF36D : !BGE .notHeartContainers : STA $7EF36D .notHeartContainers - PLX : BRL .buy_real + PLX : BRL .buy_real + BRL .cant_afford .price_is_rupees From 69f4b2bbb71881811aeb7e6c84b2585828c44d8e Mon Sep 17 00:00:00 2001 From: Alchav Date: Tue, 20 Feb 2024 14:09:21 -0500 Subject: [PATCH 3/5] Master Keys --- stats.asm | 4 +++- tables.asm | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/stats.asm b/stats.asm index e839b763..d149b392 100644 --- a/stats.asm +++ b/stats.asm @@ -253,7 +253,9 @@ IncrementSmallKeysNoPrimary: RTL ;-------------------------------------------------------------------------------- DecrementSmallKeys: - STA $7EF36F ; thing we wrote over, write small key count + LDA.b $30EFFE : BNE + ; if reusable small keys, do not decrement + STA $7EF36F ; thing we wrote over, write small key count + + JSL.l UpdateKeys RTL ;-------------------------------------------------------------------------------- diff --git a/tables.asm b/tables.asm index e03de986..d9978afe 100644 --- a/tables.asm +++ b/tables.asm @@ -1918,8 +1918,11 @@ db #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, db #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00, #$00 ;-------------------------------------------------------------------------------- -; 0x186380 - 187FFF (unused) +; 0x186380 - 187FFD (unused) ;-------------------------------------------------------------------------------- +org $30EFFE ; PC 0x186FFE +ReusableSmallKeys: +db #$00 org $30EFFF ; PC 0x186FFF BallNChainDungeon: From 3680058a7c9d23cc57f8a24c16a73c848a455c49 Mon Sep 17 00:00:00 2001 From: Alchav Date: Wed, 20 Mar 2024 03:00:15 -0400 Subject: [PATCH 4/5] Fix Master Keys --- stats.asm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/stats.asm b/stats.asm index d149b392..9aa27c2e 100644 --- a/stats.asm +++ b/stats.asm @@ -253,9 +253,15 @@ IncrementSmallKeysNoPrimary: RTL ;-------------------------------------------------------------------------------- DecrementSmallKeys: - LDA.b $30EFFE : BNE + ; if reusable small keys, do not decrement - STA $7EF36F ; thing we wrote over, write small key count + PHA : PHP + SEP #$20 + LDA ReusableSmallKeys : BNE + ; if reusable small keys, do not decrement + PLP : PLA + STA $7EF36F ; write small key count + BRA ++ + + PLP : PLA + ++ JSL.l UpdateKeys RTL ;-------------------------------------------------------------------------------- From 097cb0d9b000b4701a32ae0870849db4fcc830d5 Mon Sep 17 00:00:00 2001 From: Alchav Date: Sat, 6 Apr 2024 12:21:17 -0400 Subject: [PATCH 5/5] Check Carry flag instead of Minus flag for custom resource spending --- shopkeeper.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shopkeeper.asm b/shopkeeper.asm index 03fb7b70..680235d9 100644 --- a/shopkeeper.asm +++ b/shopkeeper.asm @@ -700,7 +700,7 @@ Shopkeeper_BuyItem: LDA !SHOP_INVENTORY+2, X : AND.b #$07 ; if bit 80, it's custom, if numbers 0-7, custom resource ; store shop index, get resource offset (X), load val, pop shop index, cmp val to shop_price... PHX : TAX : LDA ResourceOffset, X : TAX : TAY : LDA $7EF300, X ; fumble around with our resource value and price, sub value then put back into RAM - PLX : CMP !SHOP_INVENTORY+1,X : BMI + ; if resource is less than value, skip + PLX : CMP !SHOP_INVENTORY+1,X : BCC + ; if resource is less than value, skip ; If hearts, ensure hearts are greater than the price BNE .notEqual : CPY #$6D : BEQ .cant_afford .notEqual