From cc12372627f6b8684edc9acb1f86bf990c1c508d Mon Sep 17 00:00:00 2001 From: Bonta <40473493+Bonta0@users.noreply.github.com> Date: Tue, 22 Jun 2021 02:31:52 +0200 Subject: [PATCH] Stats: Track chest turns --- LTTP_RND_GeneralBugfixes.asm | 2 +- events.asm | 5 +++++ stats.asm | 13 ++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index ff6eac4..333ac6a 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -55,7 +55,7 @@ db #$20, #$19, #$08, #$31 ; year/month/day !SRAM_SINK = "$7EF41E" ; <- change this (conflicts with Programmable item 3) ;$7EF418 - Goal Item Counter ;$7EF419 - Service Sequence -;$7EF420 - $7EF466 - Stat Tracking Bank 1 (overlaps with RNG Item Flags) +;$7EF420 - $7EF468 - Stat Tracking Bank 1 (overlaps with RNG Item Flags) ;$7EF450 - $7EF45F - RNG Item (Single) Flags ;$7EF4A0 - $7EF4A7 - Service Request Block !FRESH_FILE_MARKER = "$7EF4F0" ; zero if fresh file diff --git a/events.asm b/events.asm index bf17db1..d4849fc 100644 --- a/events.asm +++ b/events.asm @@ -234,6 +234,11 @@ PostItemAnimation: LDA.b #$00 : STA $7F509F + + LDA.w $02E9 : CMP.b #$01 : BNE + + LDA.b $2F : BEQ + + JSL.l IncrementChestTurnCounter + + + STZ $02E9 : LDA $0C5E, X ; thing we wrote over to get here RTL ;-------------------------------------------------------------------------------- diff --git a/stats.asm b/stats.asm index 0b0f433..4a4fdd3 100644 --- a/stats.asm +++ b/stats.asm @@ -1,7 +1,7 @@ ;================================================================================ ; Stat Tracking ;================================================================================ -; $7EF420 - $7EF466 - Stat Tracking +; $7EF420 - $7EF468 - Stat Tracking ;-------------------------------------------------------------------------------- ; $7EF420 - bonk counter ;-------------------------------------------------------------------------------- @@ -137,6 +137,8 @@ ;-------------------------------------------------------------------------------- ; $7EF466w[2] - mirror timestamp (high) ;-------------------------------------------------------------------------------- +; $7EF468 - chest turn counter +;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- !LOCK_STATS = "$7EF443" @@ -324,6 +326,15 @@ IncrementFairyRevivalCounter: PLA RTL ;-------------------------------------------------------------------------------- +!CHESTTURN_COUNTER = "$7EF468" +IncrementChestTurnCounter: + PHA + LDA !LOCK_STATS : BNE + + LDA !CHESTTURN_COUNTER : INC : STA !CHESTTURN_COUNTER + + + PLA +RTL +;-------------------------------------------------------------------------------- !CHEST_COUNTER = "$7EF442" IncrementChestCounter: LDA.b #$01 : STA $02E9 ; thing we wrote over