WIP Battle Tent Fix

This commit is contained in:
Thorn Avery 2023-12-18 17:11:30 +11:00
parent e76cb8c9e8
commit 2a6c2604bd

View file

@ -249,12 +249,17 @@ BattleTent_InitPhase:
call DisplayTextID call DisplayTextID
ld a, $ff ld a, $ff
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld a, [wBTStreakCnt] ld a, [wBTStreakCnt] ; 0 = continue, 1 = lost, 2 = exit, FF = initial
cp 11 cp 0 ; continue
jr z, .cont
cp $FF ; initial
jr z, .cont
ld a, 8
jr .done
.cont
ld a, 4 ld a, 4
jr nz, .skip jr .done
ld a, 8 ; TEH URN! .done
.skip
ld [wBattleTentCurScript], a ld [wBattleTentCurScript], a
ret ret
@ -324,6 +329,19 @@ BattleTent_AfterBattle:
ld [$ff8c], a ld [$ff8c], a
ld de, BattleTentMovement_3 ld de, BattleTentMovement_3
call MoveSprite 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 a, 7
ld [wBattleTentCurScript], a ld [wBattleTentCurScript], a
ret ret
@ -332,22 +350,12 @@ BattleTent_Heal:
ld a, [wNPCNumScriptedSteps] ld a, [wNPCNumScriptedSteps]
and a and a
ret nz ret nz
ld a, [wBattleResult] ld a, [wBTStreakCnt]
cp 1 cp 1 ; lost, dont show healing dialogue
jr nz, .stillTehUrn jr z, .skip
; rip
ld a, 8
ld [wBattleTentCurScript], a
ret
.stillTehUrn
ld hl, wBTStreakCnt
inc [hl]
ld a, 2 ld a, 2
ld [wPlayerMovingDirection], a ld [wPlayerMovingDirection], a
call Delay3 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 predef HealParty
ld a, $fc ld a, $fc
ld [wJoyIgnore], a ld [wJoyIgnore], a
@ -560,6 +568,8 @@ BattleTentGuy:
call BattleTent_LoadTeam call BattleTent_LoadTeam
ld hl, BattleTentLetsGo ld hl, BattleTentLetsGo
call PrintText call PrintText
ld a, $FF ; first battle
ld [wBTStreakCnt], a
ld a, 1 ld a, 1
ld [wBattleTentCurScript], a ld [wBattleTentCurScript], a
jp TextScriptEnd jp TextScriptEnd
@ -570,7 +580,7 @@ BTReward:
BattleTentGuy_After: BattleTentGuy_After:
db $8 db $8
ld a, [wBTStreakCnt] ld a, [wBTStreakCnt]
cp 11 cp 2 ; voluntarily exited
ld hl, BattleTentLost ld hl, BattleTentLost
jr nz, .skip ; Not Teh Urn BibleThump jr nz, .skip ; Not Teh Urn BibleThump
ld a, $03 ; NO REVERTING THIS CODE PIGU IM SICK OF YOU BREAKING IT! ld a, $03 ; NO REVERTING THIS CODE PIGU IM SICK OF YOU BREAKING IT!
@ -606,22 +616,9 @@ BattleTentGuy_After:
BattleTentGuy2: BattleTentGuy2:
db $8 db $8
ld a, [wBTStreakCnt] ; The streak counter is still used for message continuity. ld a, [wBTStreakCnt] ; The streak counter is still used for message continuity.
and a cp $FF ; very first initial battle
jr z, .init
; 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
ld hl, BattleTentGuy2_Streak ; The message has been changed appropriately down below. 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. xor a ; The D-Pad is locked at this point, so blank out wJoyIgnore to allow manual option selection.
ld [wJoyIgnore], a ld [wJoyIgnore], a
ld hl, BattleTentGuy2_Continue ; Continue prompt. ld hl, BattleTentGuy2_Continue ; Continue prompt.
@ -630,18 +627,15 @@ BattleTentGuy2:
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
and a and a
jr nz, .refused ; If 0, move to refused. jr nz, .refused ; If 0, move to refused.
.cont .init
ld hl, BattleTentGuy2_Init ; Load the next battle. ld hl, BattleTentGuy2_Init ; Load the next battle.
; fallthrough
.skip2 ; This handles BattleTentGuy2_Streak and BattleTentGuy2_Init at once.
call PrintText call PrintText
jr .done jr .done
.refused .refused
ld hl, BattleTentGuy2_Win ld hl, BattleTentGuy2_Win
call PrintText call PrintText
ld a, 9 ; Load BattleTent_PlayerWalkBack, which takes it from here. ld a, 2 ; 2 = quit
ld [wBattleTentCurScript], a ; For some reason, this isn't working properly, even if jp'd. ld [wBTStreakCnt], a
; fallthrough
.done .done
jp TextScriptEnd jp TextScriptEnd