Battle Tent Port

This is...most of the stuff necessary for the Battle Tent to work. I've faithfully restored most things so far, including doing a few grammar tweaks.

Main issue is that we get a really strange softlock when the Pokemon selection menu comes up. Not sure why, but point is, it can't progress to the next bit for debugging like this. Committing now to ask for assistance.
This commit is contained in:
Llinos Evans 2023-05-13 02:50:31 +01:00
parent cdb00af812
commit ec61a039b8
23 changed files with 1340 additions and 18 deletions

View file

@ -836,6 +836,9 @@ FaintEnemyPokemon:
call SaveScreenTilesToBuffer1
xor a
ld [wBattleResult], a
ld a, [wCurMap]
cp BATTLE_TENT
ret z ; one of Battle Tower's rules
ld b, EXP_ALL
call IsItemInBag
push af
@ -961,6 +964,9 @@ TrainerBattleVictory:
ld c, 40
call DelayFrames
call PrintEndBattleText
ld a, [wCurMap]
cp BATTLE_TENT
ret z ; We will give it later ;)
; win money
ld hl, MoneyForWinningText
call PrintText
@ -2189,13 +2195,16 @@ DisplayBattleMenu::
.throwSafariBallWasSelected
ld a, SAFARI_BALL
ld [wcf91], a
jr UseBagItem
jp UseBagItem
.upperLeftMenuItemWasNotSelected ; a menu item other than the upper left item was selected
cp $2
jp nz, PartyMenuOrRockOrRun
; either the bag (normal battle) or bait (safari battle) was selected
ld a, [wCurMap]
cp BATTLE_TENT
jr z, .battletent
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr nz, .notLinkBattle
@ -2205,6 +2214,11 @@ DisplayBattleMenu::
call PrintText
jp DisplayBattleMenu
.battletent
ld hl, ItemsCantBeUsedHereText
call PrintText
jp DisplayBattleMenu
.notLinkBattle
call SaveScreenTilesToBuffer2
ld a, [wBattleType]
@ -6286,6 +6300,8 @@ LoadEnemyMonData:
ld de, wEnemyMonNick
ld bc, NAME_LENGTH
call CopyData
cp BATTLE_TENT
jr z, .skipSeenFlagAdding ; one of Battle Tower's rules
ld a, [wEnemyMonSpecies2]
ld [wd11e], a
predef IndexToPokedex
@ -6305,6 +6321,14 @@ LoadEnemyMonData:
ld a, $7 ; default stat mod
ld b, NUM_STAT_MODS ; number of stat mods
ld hl, wEnemyMonStatMods
.skipSeenFlagAdding
ld hl, wEnemyMonLevel
ld de, wEnemyMonUnmodifiedLevel
ld bc, $b
call CopyData
ld a, $7 ; default stat mod
ld b, $8 ; number of stat mods
ld hl, wEnemyMonStatMods
.statModLoop
ld [hli], a
dec b

View file

@ -14,7 +14,15 @@ ReadTrainer:
dec a
ld [hl], a
; check if we are in battle tent since we need a random pokemon data
ld a,[wCurMap]
cp BATTLE_TENT
jr nz, .notBT
farcall ReadBattleTentTrainer
jp .FinishUp
; get the pointer to trainer data for this class
.notBT
ld a, [wTrainerClass] ; get trainer class
dec a
add a

View file

@ -286,14 +286,15 @@ INCLUDE "engine/battle/read_trainer_party.asm"
INCLUDE "data/trainers/special_moves.asm"
INCLUDE "data/trainers/parties.asm"
;INCLUDE "data/trainers/scaled_parties.asm"
;INCLUDE "data/trainers/rival_parties.asm"
TrainerAI:
and a
ld a, [wIsInBattle]
dec a
ret z ; if not a trainer, we're done here
ld a, [wCurMap]
cp BATTLE_TENT
ret z ; if we are in battle tent, we are done
ld a, [wLinkState]
cp LINK_STATE_BATTLING
ret z ; if in a link battle, we're done as well