From 2a6c2604bd8dda1f6a087931ff511f209d1f16bb Mon Sep 17 00:00:00 2001 From: Thorn Avery Date: Mon, 18 Dec 2023 17:11:30 +1100 Subject: [PATCH 01/10] WIP Battle Tent Fix --- scripts/BattleTent.asm | 74 +++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 40 deletions(-) diff --git a/scripts/BattleTent.asm b/scripts/BattleTent.asm index a3bc4649..4104077e 100644 --- a/scripts/BattleTent.asm +++ b/scripts/BattleTent.asm @@ -249,12 +249,17 @@ BattleTent_InitPhase: call DisplayTextID ld a, $ff ld [wJoyIgnore], a - ld a, [wBTStreakCnt] - cp 11 + ld a, [wBTStreakCnt] ; 0 = continue, 1 = lost, 2 = exit, FF = initial + cp 0 ; continue + jr z, .cont + cp $FF ; initial + jr z, .cont + ld a, 8 + jr .done +.cont ld a, 4 - jr nz, .skip - ld a, 8 ; TEH URN! -.skip + jr .done +.done ld [wBattleTentCurScript], a ret @@ -324,6 +329,19 @@ BattleTent_AfterBattle: ld [$ff8c], a ld de, BattleTentMovement_3 call MoveSprite + ld a, [wBattleResult] + and a + jp nz, .skip ; if not zero, we lost / drew + xor a ; continue battle tent + ld [wBTStreakCnt], a + jr .skip2 +.skip + ld a, 1 ; lost last match + ld [wBTStreakCnt], a + ld a, 8 + ld [wBattleTentCurScript], a + ret +.skip2 ld a, 7 ld [wBattleTentCurScript], a ret @@ -332,22 +350,12 @@ BattleTent_Heal: ld a, [wNPCNumScriptedSteps] and a ret nz - ld a, [wBattleResult] - cp 1 - jr nz, .stillTehUrn - ; rip - ld a, 8 - ld [wBattleTentCurScript], a - ret -.stillTehUrn - ld hl, wBTStreakCnt - inc [hl] + ld a, [wBTStreakCnt] + cp 1 ; lost, dont show healing dialogue + jr z, .skip ld a, 2 ld [wPlayerMovingDirection], a call Delay3 - ld a, [hl] - cp 11 - jr z, .skip ; No need to heal the party, let's just say that the player wins predef HealParty ld a, $fc ld [wJoyIgnore], a @@ -560,6 +568,8 @@ BattleTentGuy: call BattleTent_LoadTeam ld hl, BattleTentLetsGo call PrintText + ld a, $FF ; first battle + ld [wBTStreakCnt], a ld a, 1 ld [wBattleTentCurScript], a jp TextScriptEnd @@ -570,7 +580,7 @@ BTReward: BattleTentGuy_After: db $8 ld a, [wBTStreakCnt] - cp 11 + cp 2 ; voluntarily exited ld hl, BattleTentLost jr nz, .skip ; Not Teh Urn BibleThump ld a, $03 ; NO REVERTING THIS CODE PIGU IM SICK OF YOU BREAKING IT! @@ -606,22 +616,9 @@ BattleTentGuy_After: BattleTentGuy2: db $8 ld a, [wBTStreakCnt] ; The streak counter is still used for message continuity. - and a - - ; Old System -; ld hl, BattleTentGuy2_Streak -; jr nz, .skip -; inc a -; ld [wBTStreakCnt], a -; ld hl, BattleTentGuy2_Init -; jr .skip2 -;.skip -; cp 11 -; jr nz, .skip2 - - ; New System + cp $FF ; very first initial battle + jr z, .init ld hl, BattleTentGuy2_Streak ; The message has been changed appropriately down below. - jr z, .skip2 xor a ; The D-Pad is locked at this point, so blank out wJoyIgnore to allow manual option selection. ld [wJoyIgnore], a ld hl, BattleTentGuy2_Continue ; Continue prompt. @@ -630,18 +627,15 @@ BattleTentGuy2: ld a, [wCurrentMenuItem] and a jr nz, .refused ; If 0, move to refused. -.cont +.init ld hl, BattleTentGuy2_Init ; Load the next battle. - ; fallthrough -.skip2 ; This handles BattleTentGuy2_Streak and BattleTentGuy2_Init at once. call PrintText jr .done .refused ld hl, BattleTentGuy2_Win call PrintText - ld a, 9 ; Load BattleTent_PlayerWalkBack, which takes it from here. - ld [wBattleTentCurScript], a ; For some reason, this isn't working properly, even if jp'd. - ; fallthrough + ld a, 2 ; 2 = quit + ld [wBTStreakCnt], a .done jp TextScriptEnd From ce2d9ec06c003061b1710574fc4c6685f597c045 Mon Sep 17 00:00:00 2001 From: Thorn Avery Date: Mon, 18 Dec 2023 19:04:33 +1100 Subject: [PATCH 02/10] WIP Battle Tent: win counter --- ram/wram.asm | 5 +++-- scripts/BattleTent.asm | 22 +++++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ram/wram.asm b/ram/wram.asm index 74cce97a..748ad659 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -2125,7 +2125,7 @@ UNION ; Surely this position will not cause any issues at all. ;battle tent data wBTOrder:: dw -wBTStreakCnt:: db +wBTCont:: db wBTClass:: db wBTDataEnd:: wStringBuffer1:: ; cf5f @@ -2140,6 +2140,7 @@ NEXTU wChannel7:: channel_struct wChannel7 wChannel8:: channel_struct wChannel8 ENDU +wBTStreakCnt:: db wObtainedHiddenItemsFlags:: flag_array 112 @@ -2448,4 +2449,4 @@ SECTION "Stack", WRAM0 ; the stack grows downward ds $99 - 1 -wStack:: db \ No newline at end of file +wStack:: db diff --git a/scripts/BattleTent.asm b/scripts/BattleTent.asm index 4104077e..f764251a 100644 --- a/scripts/BattleTent.asm +++ b/scripts/BattleTent.asm @@ -249,7 +249,7 @@ BattleTent_InitPhase: call DisplayTextID ld a, $ff ld [wJoyIgnore], a - ld a, [wBTStreakCnt] ; 0 = continue, 1 = lost, 2 = exit, FF = initial + ld a, [wBTCont] ; 0 = continue, 1 = lost, 2 = exit, FF = initial cp 0 ; continue jr z, .cont cp $FF ; initial @@ -333,11 +333,17 @@ BattleTent_AfterBattle: and a jp nz, .skip ; if not zero, we lost / drew xor a ; continue battle tent - ld [wBTStreakCnt], a + ld [wBTCont], a + ld a, [wBTStreakCnt] + cp $FF + jr z, .max ; cap out at 255 wins + inc a +.max + ld [wBTStreakCnt], a ; increment win counter jr .skip2 .skip ld a, 1 ; lost last match - ld [wBTStreakCnt], a + ld [wBTCont], a ld a, 8 ld [wBattleTentCurScript], a ret @@ -350,7 +356,7 @@ BattleTent_Heal: ld a, [wNPCNumScriptedSteps] and a ret nz - ld a, [wBTStreakCnt] + ld a, [wBTCont] cp 1 ; lost, dont show healing dialogue jr z, .skip ld a, 2 @@ -569,6 +575,8 @@ BattleTentGuy: ld hl, BattleTentLetsGo call PrintText ld a, $FF ; first battle + ld [wBTCont], a + xor a ; initialise counter ld [wBTStreakCnt], a ld a, 1 ld [wBattleTentCurScript], a @@ -579,7 +587,7 @@ BTReward: BattleTentGuy_After: db $8 - ld a, [wBTStreakCnt] + ld a, [wBTCont] cp 2 ; voluntarily exited ld hl, BattleTentLost jr nz, .skip ; Not Teh Urn BibleThump @@ -615,7 +623,7 @@ BattleTentGuy_After: ; Arguably a better system, but I do wish the counter incremented... BattleTentGuy2: db $8 - ld a, [wBTStreakCnt] ; The streak counter is still used for message continuity. + ld a, [wBTCont] ; The streak counter is still used for message continuity. cp $FF ; very first initial battle jr z, .init ld hl, BattleTentGuy2_Streak ; The message has been changed appropriately down below. @@ -635,7 +643,7 @@ BattleTentGuy2: ld hl, BattleTentGuy2_Win call PrintText ld a, 2 ; 2 = quit - ld [wBTStreakCnt], a + ld [wBTCont], a .done jp TextScriptEnd From 86ede20d971e1118f907a0fbf4848db67b51a8b6 Mon Sep 17 00:00:00 2001 From: Thorn Avery Date: Mon, 18 Dec 2023 19:45:24 +1100 Subject: [PATCH 03/10] WIP Battle Tent: win counter displayed text --- scripts/BattleTent.asm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/BattleTent.asm b/scripts/BattleTent.asm index f764251a..f90f91cd 100644 --- a/scripts/BattleTent.asm +++ b/scripts/BattleTent.asm @@ -835,8 +835,10 @@ BattleTentGuy2_Win: ;text "Congratulations!" text "Well done!" - ;para "You have defeated" - ;line "all 10 opponents!" + para "You have defeated" + line "@" + text_decimal wBTStreakCnt, 1, 3 + text " opponents!" para "Please go back to" line "the counter to" From 12b5fb8f8ea4a91a8e00f9cb99b83f6878fb911a Mon Sep 17 00:00:00 2001 From: Thorn Avery Date: Mon, 18 Dec 2023 20:01:57 +1100 Subject: [PATCH 04/10] WIP Battle Tent: win counter on each battle --- scripts/BattleTent.asm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/BattleTent.asm b/scripts/BattleTent.asm index f90f91cd..de140d0c 100644 --- a/scripts/BattleTent.asm +++ b/scripts/BattleTent.asm @@ -626,7 +626,6 @@ BattleTentGuy2: ld a, [wBTCont] ; The streak counter is still used for message continuity. cp $FF ; very first initial battle jr z, .init - ld hl, BattleTentGuy2_Streak ; The message has been changed appropriately down below. xor a ; The D-Pad is locked at this point, so blank out wJoyIgnore to allow manual option selection. ld [wJoyIgnore], a ld hl, BattleTentGuy2_Continue ; Continue prompt. @@ -635,6 +634,8 @@ BattleTentGuy2: ld a, [wCurrentMenuItem] and a jr nz, .refused ; If 0, move to refused. + ld hl, BattleTentGuy2_Streak ; The message has been changed appropriately down below. + jr .done .init ld hl, BattleTentGuy2_Init ; Load the next battle. call PrintText @@ -815,7 +816,7 @@ BattleTentGuy2_Init: ; Cut in favour of a different system. BattleTentGuy2_Streak: ; text "Opponent No.@" ; could be a №? -; text_decimal wBTStreakCnt, 1, 2 +; text_decimal wBTStreakCnt, 1, 3 ; text_start ; line "is up next." ; para "Good luck!" @@ -826,6 +827,11 @@ BattleTentGuy2_Streak: BattleTentGuy2_Continue: text "Congratulations!" + + para "You're at" + line "@" + text_decimal wBTStreakCnt, 1, 3 + text " win(s)!" para "Do you want to" line "continue?" @@ -835,10 +841,10 @@ BattleTentGuy2_Win: ;text "Congratulations!" text "Well done!" - para "You have defeated" + para "You defeated" line "@" text_decimal wBTStreakCnt, 1, 3 - text " opponents!" + text " opponent(s)!" para "Please go back to" line "the counter to" From 1b0b7a281c5c271cc470819b3467c3194eae2b3b Mon Sep 17 00:00:00 2001 From: Thorn Avery Date: Wed, 20 Dec 2023 16:58:51 +1100 Subject: [PATCH 05/10] WIP Battle Tent: winnings based on streak --- ram/wram.asm | 1 + scripts/BattleTent.asm | 60 +++++++++++++++++++++++++++++++++++------- 2 files changed, 51 insertions(+), 10 deletions(-) diff --git a/ram/wram.asm b/ram/wram.asm index 748ad659..de3f443f 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -2141,6 +2141,7 @@ wChannel7:: channel_struct wChannel7 wChannel8:: channel_struct wChannel8 ENDU wBTStreakCnt:: db +wBTWinnings:: dw wObtainedHiddenItemsFlags:: flag_array 112 diff --git a/scripts/BattleTent.asm b/scripts/BattleTent.asm index de140d0c..74c485ac 100644 --- a/scripts/BattleTent.asm +++ b/scripts/BattleTent.asm @@ -578,26 +578,63 @@ BattleTentGuy: ld [wBTCont], a xor a ; initialise counter ld [wBTStreakCnt], a + ld [wBTWinnings], a + ld [wBTWinnings+1], a + ld [wBTWinnings+2], a ld a, 1 ld [wBattleTentCurScript], a jp TextScriptEnd -BTReward: - db $03,$00,$00 - BattleTentGuy_After: db $8 ld a, [wBTCont] cp 2 ; voluntarily exited ld hl, BattleTentLost - jr nz, .skip ; Not Teh Urn BibleThump - ld a, $03 ; NO REVERTING THIS CODE PIGU IM SICK OF YOU BREAKING IT! - ldh [$9f], a + jr nz, .skip + + ; multiply streak by 2000 + ld a, [wBTStreakCnt] + ldh [hMultiplier], a + ld a, $07 + ldh [hMultiplicand], a + ld a, $D0 + ldh [hMultiplicand+1], a + call Multiply + ldh a, [hProduct] + ld [wBTWinnings], a + ldh a, [hProduct+1] + ld [wBTWinnings+1], a + ldh a, [hProduct+2] + ld [wBTWinnings+2], a + + ; Max out at 2000 * 255 = 510000 + ; 07 C8 30 = 2000 * 255 + ; (this shouldnt ever matter im just paranoid) + ld a, [wBTWinnings] + cp $07 + jr c, .done + ld a, $07 + ld [wBTWinnings], a + ld a, [wBTWinnings+1] + cp $C8 + jr c, .done + ld a, $C8 + ld [wBTWinnings+1], a + ld a, [wBTWinnings+2] + cp $30 + jr c, .done + ld a, $30 + ld [wBTWinnings+2], a +.done + + ; todo: convert wBTWinnings to BCD ld a, $00 - ldh [$a1], a + ldh [hMoney], a ld a, $00 - ldh [$a0], a - ld hl, $ffa1 + ldh [hMoney+1], a + ld a, $00 + ldh [hMoney+2], a + ld hl, hMoney + 2 ld de, wPlayerMoney + 2 ld c, $3 predef AddBCDPredef @@ -635,6 +672,7 @@ BattleTentGuy2: and a jr nz, .refused ; If 0, move to refused. ld hl, BattleTentGuy2_Streak ; The message has been changed appropriately down below. + call PrintText jr .done .init ld hl, BattleTentGuy2_Init ; Load the next battle. @@ -793,7 +831,9 @@ BattleTentWon: line "reward!" para $52, " received" - line "¥30000!" + line "¥@" + text_decimal wBTWinnings, 3, 6 + text "!" prompt BattleTentLost: From 27f898e58391bac2f45115a2a56b23616891e7f6 Mon Sep 17 00:00:00 2001 From: Thorn Avery Date: Wed, 20 Dec 2023 17:29:21 +1100 Subject: [PATCH 06/10] WIP Battle Tent: winnings based on streak --- scripts/BattleTent.asm | 75 +++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 34 deletions(-) diff --git a/scripts/BattleTent.asm b/scripts/BattleTent.asm index 74c485ac..b0dea111 100644 --- a/scripts/BattleTent.asm +++ b/scripts/BattleTent.asm @@ -321,6 +321,9 @@ BattleTent_InitBattle: ld a, 6 ld [wBattleTentCurScript], a ret + +BTBattleReward: + db $00, $00, $00 BattleTent_AfterBattle: ld a, $ff @@ -338,8 +341,12 @@ BattleTent_AfterBattle: cp $FF jr z, .max ; cap out at 255 wins inc a -.max ld [wBTStreakCnt], a ; increment win counter + ld hl, BTBattleReward + 2 + ld de, wBTWinnings + 2 + ld c, $3 + predef AddBCDPredef ; for some reason this is maxing out the counter +.max jr .skip2 .skip ld a, 1 ; lost last match @@ -593,46 +600,46 @@ BattleTentGuy_After: jr nz, .skip ; multiply streak by 2000 - ld a, [wBTStreakCnt] - ldh [hMultiplier], a - ld a, $07 - ldh [hMultiplicand], a - ld a, $D0 - ldh [hMultiplicand+1], a - call Multiply - ldh a, [hProduct] - ld [wBTWinnings], a - ldh a, [hProduct+1] - ld [wBTWinnings+1], a - ldh a, [hProduct+2] - ld [wBTWinnings+2], a + ;ld a, [wBTStreakCnt] + ;ldh [hMultiplier], a + ;ld a, $07 + ;ldh [hMultiplicand], a + ;ld a, $D0 + ;ldh [hMultiplicand+1], a + ;call Multiply + ;ldh a, [hProduct] + ;ld [wBTWinnings], a + ;ldh a, [hProduct+1] + ;ld [wBTWinnings+1], a + ;ldh a, [hProduct+2] + ;ld [wBTWinnings+2], a ; Max out at 2000 * 255 = 510000 ; 07 C8 30 = 2000 * 255 ; (this shouldnt ever matter im just paranoid) - ld a, [wBTWinnings] - cp $07 - jr c, .done - ld a, $07 - ld [wBTWinnings], a - ld a, [wBTWinnings+1] - cp $C8 - jr c, .done - ld a, $C8 - ld [wBTWinnings+1], a - ld a, [wBTWinnings+2] - cp $30 - jr c, .done - ld a, $30 - ld [wBTWinnings+2], a -.done + ;ld a, [wBTWinnings] + ;cp $07 + ;jr c, .done + ;ld a, $07 + ;ld [wBTWinnings], a + ;ld a, [wBTWinnings+1] + ;cp $C8 + ;jr c, .done + ;ld a, $C8 + ;ld [wBTWinnings+1], a + ;ld a, [wBTWinnings+2] + ;cp $30 + ;jr c, .done + ;ld a, $30 + ;ld [wBTWinnings+2], a +;.done ; todo: convert wBTWinnings to BCD - ld a, $00 + ld a, [wBTWinnings] ldh [hMoney], a - ld a, $00 + ld a, [wBTWinnings+1] ldh [hMoney+1], a - ld a, $00 + ld a, [wBTWinnings+2] ldh [hMoney+2], a ld hl, hMoney + 2 ld de, wPlayerMoney + 2 @@ -832,7 +839,7 @@ BattleTentWon: para $52, " received" line "¥@" - text_decimal wBTWinnings, 3, 6 + text_bcd wBTWinnings, 3, 6 text "!" prompt From 8e03534fc6b6a553269401f8ee1f9b996144560a Mon Sep 17 00:00:00 2001 From: Thorn Avery Date: Wed, 20 Dec 2023 18:18:16 +1100 Subject: [PATCH 07/10] WIP Battle Tent: BCD Add not working :( --- ram/wram.asm | 7 +++++-- scripts/BattleTent.asm | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ram/wram.asm b/ram/wram.asm index de3f443f..39325ee3 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -2026,9 +2026,13 @@ wCelesteHillCaveCurScript:: db wBrunswickGladeCurScript:: db ds 2 wSSAnneBowCurScript:: db +UNION wViridianForestCurScript:: db wMuseum1FCurScript:: db wRoute13CurScript:: db +NEXTU +wBTWinnings:: ds 3 +ENDU wRoute14CurScript:: db wRoute17CurScript:: db wRoute19CurScript:: db @@ -2135,13 +2139,12 @@ wStringBuffer2:: ; cf70 wStringBuffer3:: ; cf81 ds 9 + 1 ;end BT wram - ds 79 + ds 76 NEXTU wChannel7:: channel_struct wChannel7 wChannel8:: channel_struct wChannel8 ENDU wBTStreakCnt:: db -wBTWinnings:: dw wObtainedHiddenItemsFlags:: flag_array 112 diff --git a/scripts/BattleTent.asm b/scripts/BattleTent.asm index b0dea111..a959afa6 100644 --- a/scripts/BattleTent.asm +++ b/scripts/BattleTent.asm @@ -323,7 +323,7 @@ BattleTent_InitBattle: ret BTBattleReward: - db $00, $00, $00 + db $00, $20, $00 BattleTent_AfterBattle: ld a, $ff @@ -634,7 +634,6 @@ BattleTentGuy_After: ;ld [wBTWinnings+2], a ;.done - ; todo: convert wBTWinnings to BCD ld a, [wBTWinnings] ldh [hMoney], a ld a, [wBTWinnings+1] From f126a262439df30c4a4081f9495a64c544da2166 Mon Sep 17 00:00:00 2001 From: Thorn Avery Date: Wed, 20 Dec 2023 18:49:51 +1100 Subject: [PATCH 08/10] Battle Tent: working! (assuming union is ok) --- ram/wram.asm | 7 ++++--- scripts/BattleTent.asm | 8 +++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ram/wram.asm b/ram/wram.asm index 39325ee3..a6db5305 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -2030,12 +2030,13 @@ UNION wViridianForestCurScript:: db wMuseum1FCurScript:: db wRoute13CurScript:: db -NEXTU -wBTWinnings:: ds 3 -ENDU wRoute14CurScript:: db wRoute17CurScript:: db wRoute19CurScript:: db +NEXTU +wBTWinnings:: ds 3 +wBTBattleReward:: ds 3 +ENDU wRoute21CurScript:: db wSafariZoneGateCurScript:: db wRockTunnelB1FCurScript:: db diff --git a/scripts/BattleTent.asm b/scripts/BattleTent.asm index a959afa6..a1b8e207 100644 --- a/scripts/BattleTent.asm +++ b/scripts/BattleTent.asm @@ -342,7 +342,7 @@ BattleTent_AfterBattle: jr z, .max ; cap out at 255 wins inc a ld [wBTStreakCnt], a ; increment win counter - ld hl, BTBattleReward + 2 + ld hl, wBTBattleReward + 2 ld de, wBTWinnings + 2 ld c, $3 predef AddBCDPredef ; for some reason this is maxing out the counter @@ -588,6 +588,12 @@ BattleTentGuy: ld [wBTWinnings], a ld [wBTWinnings+1], a ld [wBTWinnings+2], a + ld a, [BTBattleReward] + ld [wBTBattleReward], a + ld a, [BTBattleReward+1] + ld [wBTBattleReward+1], a + ld a, [BTBattleReward+2] + ld [wBTBattleReward+2], a ld a, 1 ld [wBattleTentCurScript], a jp TextScriptEnd From 163b1b060ce1417bcdba0fe1f7871f6f0d612a98 Mon Sep 17 00:00:00 2001 From: Thorn Avery Date: Thu, 21 Dec 2023 15:11:21 +1100 Subject: [PATCH 09/10] Battle Tent: working! (for real this time!!) --- ram/wram.asm | 6 +- scripts/BattleTent.asm | 144 ++++++++++++++++++++--------------------- 2 files changed, 73 insertions(+), 77 deletions(-) diff --git a/ram/wram.asm b/ram/wram.asm index a6db5305..4f318d20 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -2026,17 +2026,12 @@ wCelesteHillCaveCurScript:: db wBrunswickGladeCurScript:: db ds 2 wSSAnneBowCurScript:: db -UNION wViridianForestCurScript:: db wMuseum1FCurScript:: db wRoute13CurScript:: db wRoute14CurScript:: db wRoute17CurScript:: db wRoute19CurScript:: db -NEXTU -wBTWinnings:: ds 3 -wBTBattleReward:: ds 3 -ENDU wRoute21CurScript:: db wSafariZoneGateCurScript:: db wRockTunnelB1FCurScript:: db @@ -2146,6 +2141,7 @@ wChannel7:: channel_struct wChannel7 wChannel8:: channel_struct wChannel8 ENDU wBTStreakCnt:: db +wBTRewards:: db wObtainedHiddenItemsFlags:: flag_array 112 diff --git a/scripts/BattleTent.asm b/scripts/BattleTent.asm index a1b8e207..a67bdca5 100644 --- a/scripts/BattleTent.asm +++ b/scripts/BattleTent.asm @@ -342,10 +342,6 @@ BattleTent_AfterBattle: jr z, .max ; cap out at 255 wins inc a ld [wBTStreakCnt], a ; increment win counter - ld hl, wBTBattleReward + 2 - ld de, wBTWinnings + 2 - ld c, $3 - predef AddBCDPredef ; for some reason this is maxing out the counter .max jr .skip2 .skip @@ -585,15 +581,6 @@ BattleTentGuy: ld [wBTCont], a xor a ; initialise counter ld [wBTStreakCnt], a - ld [wBTWinnings], a - ld [wBTWinnings+1], a - ld [wBTWinnings+2], a - ld a, [BTBattleReward] - ld [wBTBattleReward], a - ld a, [BTBattleReward+1] - ld [wBTBattleReward+1], a - ld a, [BTBattleReward+2] - ld [wBTBattleReward+2], a ld a, 1 ld [wBattleTentCurScript], a jp TextScriptEnd @@ -604,55 +591,50 @@ BattleTentGuy_After: cp 2 ; voluntarily exited ld hl, BattleTentLost jr nz, .skip - - ; multiply streak by 2000 - ;ld a, [wBTStreakCnt] - ;ldh [hMultiplier], a - ;ld a, $07 - ;ldh [hMultiplicand], a - ;ld a, $D0 - ;ldh [hMultiplicand+1], a - ;call Multiply - ;ldh a, [hProduct] - ;ld [wBTWinnings], a - ;ldh a, [hProduct+1] - ;ld [wBTWinnings+1], a - ;ldh a, [hProduct+2] - ;ld [wBTWinnings+2], a - - ; Max out at 2000 * 255 = 510000 - ; 07 C8 30 = 2000 * 255 - ; (this shouldnt ever matter im just paranoid) - ;ld a, [wBTWinnings] - ;cp $07 - ;jr c, .done - ;ld a, $07 - ;ld [wBTWinnings], a - ;ld a, [wBTWinnings+1] - ;cp $C8 - ;jr c, .done - ;ld a, $C8 - ;ld [wBTWinnings+1], a - ;ld a, [wBTWinnings+2] - ;cp $30 - ;jr c, .done - ;ld a, $30 - ;ld [wBTWinnings+2], a -;.done - - ld a, [wBTWinnings] - ldh [hMoney], a - ld a, [wBTWinnings+1] - ldh [hMoney+1], a - ld a, [wBTWinnings+2] - ldh [hMoney+2], a - ld hl, hMoney + 2 - ld de, wPlayerMoney + 2 - ld c, $3 - predef AddBCDPredef - ld hl, BattleTentWon -.skip + ld hl, BattleTentWon call PrintText + ; give reward + ; every ten battles gives a bottle cap + ; every five gives a rare candy + ld a, [wBTStreakCnt] + ld c, 0 ; fives count +.findFive: + cp 5 + jr nc, .hasFive + jr .done +.hasFive: + sub 5 + inc c + jr .findFive +.done: + ld a, c + and a + jr z, .skip ; skip if no rewards + ld [wBTRewards], a + ld hl, ReceivedRewardPreamble + call PrintText + ld a, [wBTRewards] + ld b, RARE_CANDY + call GiveItem + jr nc, .bag_full ; could use money instead here + ld hl, ReceivedRewardText + call PrintText + ld a, [wBTRewards] + srl a + and a + jr z, .skip + ld [wBTRewards], a + ;ld b, POWER_FEED + ld b, BOTTLE_CAP + call GiveItem + jr nc, .bag_full + ld hl, ReceivedRewardText + call PrintText + jr .skip +.bag_full: + ld hl, RewardNoRoomText + call PrintText +.skip: ld hl, BattleTentPleaseWait call PrintText call BattleTent_RestoreTeam @@ -839,13 +821,10 @@ BattleTentWon: text "Wow! You finally" line "did it!" - para "Here is the" - line "reward!" - - para $52, " received" - line "¥@" - text_bcd wBTWinnings, 3, 6 - text "!" + para "You beat" + line "@" + text_decimal wBTStreakCnt, 1, 3 + text " oppenont(s)!" prompt BattleTentLost: @@ -893,10 +872,10 @@ BattleTentGuy2_Win: ;text "Congratulations!" text "Well done!" - para "You defeated" - line "@" - text_decimal wBTStreakCnt, 1, 3 - text " opponent(s)!" + ;para "You defeated" + ;line "@" + ;text_decimal wBTStreakCnt, 1, 3 + ;text " opponent(s)!" para "Please go back to" line "the counter to" @@ -909,6 +888,27 @@ BattleTentGuy2_Heal: cont "full health." done +ReceivedRewardPreamble: + text "Take these" + line "on the house!" + prompt + text_end + +ReceivedRewardText: + text " received" + line "@" + text_decimal wBTRewards, 1, 2 + text "x @" + text_ram wStringBuffer + text "!" + prompt + text_end + +RewardNoRoomText: + text "You have no room!" + prompt + text_end + ; Battle Tent BattleTentMart:: script_mart FULL_RESTORE, MAX_REVIVE, FULL_HEAL, BOTTLE_CAP, POKE_DOLL, X_ATTACK, X_DEFEND, X_SPEED, X_SPECIAL, GUARD_SPEC From c2a46acf850d155758372f08b756dd4e60ccbaed Mon Sep 17 00:00:00 2001 From: Thorn Avery Date: Thu, 21 Dec 2023 15:12:58 +1100 Subject: [PATCH 10/10] oops naughty thorn messing with ram layout --- ram/wram.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ram/wram.asm b/ram/wram.asm index 4f318d20..48c81e70 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -2135,7 +2135,7 @@ wStringBuffer2:: ; cf70 wStringBuffer3:: ; cf81 ds 9 + 1 ;end BT wram - ds 76 + ds 79 NEXTU wChannel7:: channel_struct wChannel7 wChannel8:: channel_struct wChannel8