Decompiled and labelled the remainder of Bank $0e

This commit is contained in:
DrippingYellow 2025-09-16 12:26:06 -05:00
parent d7eb11cf06
commit 9743fff41b
20 changed files with 2943 additions and 99 deletions

View File

@ -42,7 +42,7 @@ DEF EFFECTIVENESS_MASK EQU %01111111
const SP_DEFENSE
const ACCURACY
const EVASION
const ABILITY ; used for BattleCommand_Curse
const_skip ; The ABILITY text doesn't exist yet, nor does the effect that would use it.
DEF NUM_LEVEL_STATS EQU const_value
; move struct members (see data/moves/moves.asm)

View File

@ -267,9 +267,21 @@ DEF NUM_HMS = const_value - ITEM_HM01
DEF NUM_TM_HM = NUM_TMS + NUM_HMS
; leftovers from pokered
DEF ITEM_X_ATTACK_RED EQU $41
DEF ITEM_ETHER_RED EQU $50
DEF ITEM_MAX_ETHER_RED EQU $51
DEF ITEM_ELIXER_RED EQU $52
DEF ITEM_HM01_RED EQU $c4
DEF ITEM_TM01_RED EQU $c9
DEF ITEM_FULL_RESTORE_RED EQU $10
DEF ITEM_MAX_POTION_RED EQU $11
DEF ITEM_HYPER_POTION_RED EQU $12
DEF ITEM_SUPER_POTION_RED EQU $13
DEF ITEM_POTION_RED EQU $14
DEF ITEM_X_ACCURACY_RED EQU $2E
DEF ITEM_FULL_HEAL_RED EQU $34
DEF ITEM_GUARD_SPEC_RED EQU $37
DEF ITEM_DIRE_HIT_RED EQU $3a
DEF ITEM_X_ATTACK_RED EQU $41
DEF ITEM_X_DEFEND_RED EQU $42
DEF ITEM_X_SPEED_RED EQU $43
DEF ITEM_X_SPECIAL_RED EQU $44
DEF ITEM_ETHER_RED EQU $50
DEF ITEM_MAX_ETHER_RED EQU $51
DEF ITEM_ELIXER_RED EQU $52
DEF ITEM_HM01_RED EQU $c4
DEF ITEM_TM01_RED EQU $c9

View File

@ -6,7 +6,7 @@ DEF MON_NAME_LENGTH EQU 6
DEF TYPE_NAME_LENGTH EQU 5
DEF MOVE_NAME_LENGTH EQU 8
DEF ITEM_NAME_LENGTH EQU 11
DEF TRAINER_CLASS_NAME_LENGTH EQU 13 ; English
DEF TRAINER_CLASS_NAME_LENGTH EQU 11
; GetName types (see home/names.asm)
const_def 1

View File

@ -87,9 +87,9 @@ ENDM
trainerclass TRAINER_FISHER ; 25
trainerclass TRAINER_SWIMMER_F ; 26
trainerclass TRAINER_SWIMMER_M ; 26
trainerclass TRAINER_SWIMMER_M ; 27
trainerclass TRAINER_SWIMMER_F ; 27
trainerclass TRAINER_SAILOR ; 28

View File

@ -1,12 +1,12 @@
; TrainerClassAttributes struct members (see data/trainers/attributes.asm)
const_def
const TRNATTR_ITEM1 ; 0
const TRNATTR_ITEM2 ; 1
const TRNATTR_SPRITEPOINTER1 ; 0
const TRNATTR_SPRITEPOINTER2 ; 1
const TRNATTR_BASEMONEY ; 2
const TRNATTR_AI_MOVE_WEIGHTS ; 3
const TRNATTR_AI2 ; 4
const TRNATTR_AI_ITEM_SWITCH ; 5
const TRNATTR_AI4 ; 6
const TRNATTR_AI3 ; 5
const TRNATTR_UNKNOWN ; 6
DEF NUM_TRAINER_ATTRIBUTES EQU const_value
; TRNATTR_AI_MOVE_WEIGHTS bit flags (wEnemyTrainerAIFlags)
@ -22,29 +22,8 @@ DEF const_value = 0
shift_const AI_OPPORTUNIST
shift_const AI_AGGRESSIVE
shift_const AI_CAUTIOUS
shift_const AI_STATUS
shift_const AI_RISKY
shift_const AI_10
shift_const AI_11
shift_const AI_12
shift_const AI_13
shift_const AI_14
shift_const AI_15
; TRNATTR_AI_ITEM_SWITCH bit flags
DEF CONTEXT_USE_F EQU 6
DEF UNKNOWN_USE_F EQU 5
DEF ALWAYS_USE_F EQU 4
DEF SWITCH_SOMETIMES_F EQU 2
DEF SWITCH_RARELY_F EQU 1
DEF SWITCH_OFTEN_F EQU 0
DEF CONTEXT_USE EQU 1 << CONTEXT_USE_F
DEF UNKNOWN_USE EQU 1 << UNKNOWN_USE_F
DEF ALWAYS_USE EQU 1 << ALWAYS_USE_F
DEF SWITCH_SOMETIMES EQU 1 << SWITCH_SOMETIMES_F
DEF SWITCH_RARELY EQU 1 << SWITCH_RARELY_F
DEF SWITCH_OFTEN EQU 1 << SWITCH_OFTEN_F
DEF VALID_TRAINER_AI EQU const_value
DEF MAX_TRAINER_AI EQU 24
; TrainerTypes indexes (see engine/battle/read_trainer_party.asm)
const_def

View File

@ -0,0 +1,38 @@
; AI_SMART encourages these moves with Encore.
; BUG: Includes mostly status moves, but has a few attacking moves that seem
; to have been included in lieu of another status move by mistake.
; Also, the list cuts off rather early, not including most of the new status moves.
; None of these issues were fixed for the final game.
EncoreMoves:
db MOVE_SWORDS_DANCE
db MOVE_WHIRLWIND
db MOVE_LEER
db MOVE_ROAR
db MOVE_DISABLE
db MOVE_MIST
db MOVE_LEECH_SEED
db MOVE_GROWTH
db MOVE_POISONPOWDER
db MOVE_STRING_SHOT
db MOVE_MEDITATE
db MOVE_AGILITY
db MOVE_TELEPORT
db MOVE_SCREECH
db MOVE_HAZE
db MOVE_FOCUS_ENERGY
db MOVE_DREAM_EATER
db MOVE_POISON_GAS
db MOVE_SPLASH
db MOVE_SHARPEN
db MOVE_CONVERSION
db MOVE_SUPER_FANG
db MOVE_SUBSTITUTE
db MOVE_TRIPLE_KICK ; Likely intended to be Sketch
db MOVE_SPIDER_WEB
db MOVE_MIND_READER
db MOVE_FLAME_WHEEL ; Likely intended to be Nightmare
db MOVE_COIN_HURL ; Most likely intended to be Conversion2
db MOVE_COTTON_SPORE
db MOVE_POWDER_SNOW ; Likely intended to be either Spite or Protect
db -1 ; end

View File

@ -0,0 +1,9 @@
; AI_AGGRESSIVE does not discourage these moves
; even if a stronger one is available.
RecklessMoves:
db EFFECT_SELFDESTRUCT
db EFFECT_RAMPAGE
db EFFECT_MULTI_HIT
db EFFECT_DOUBLE_HIT
db -1 ; end

View File

@ -0,0 +1,17 @@
; AI_CAUTIOUS discourages these moves after the first turn.
ResidualMoves:
db MOVE_MIST
db MOVE_LEECH_SEED
db MOVE_POISONPOWDER
db MOVE_STUN_SPORE
db MOVE_THUNDER_WAVE
db MOVE_MIMIC ; Not present in the final game
db MOVE_FOCUS_ENERGY
db MOVE_BIDE
db MOVE_POISON_GAS
db MOVE_TRANSFORM
db MOVE_CONVERSION
db MOVE_SUBSTITUTE
; MOVE_SPIKES is not present in the proto.
db -1 ; end

View File

@ -0,0 +1,41 @@
; AI_OPPORTUNIST discourages these moves
; when the player's HP is low.
; BUG: Contains Flame Wheel, ostensibly an attacking move.
; It was presumably intended to be Nightmare, the move occupying the previous slot.
; Also, the list does not include any other new moves, despite the addition of more stall-enabling
; moves such as Protect and Encore. Both oddities still exist in the final game.
StallMoves:
db MOVE_SWORDS_DANCE
db MOVE_TAIL_WHIP
db MOVE_LEER
db MOVE_GROWL
db MOVE_DISABLE
db MOVE_MIST
db MOVE_COUNTER
db MOVE_LEECH_SEED
db MOVE_GROWTH
db MOVE_STRING_SHOT
db MOVE_MEDITATE
db MOVE_AGILITY
db MOVE_RAGE
db MOVE_MIMIC
db MOVE_SCREECH
db MOVE_HARDEN
db MOVE_WITHDRAW
db MOVE_DEFENSE_CURL
db MOVE_BARRIER
db MOVE_LIGHT_SCREEN
db MOVE_HAZE
db MOVE_REFLECT
db MOVE_FOCUS_ENERGY
db MOVE_BIDE
db MOVE_AMNESIA
db MOVE_TRANSFORM
db MOVE_SPLASH
db MOVE_ACID_ARMOR
db MOVE_SHARPEN
db MOVE_CONVERSION
db MOVE_SUBSTITUTE
db MOVE_FLAME_WHEEL
db -1 ; end

View File

@ -0,0 +1,23 @@
; AI_SMART knows these moves are usable all-around.
; Note the lack of Gen II moves... this was not changed for the final game.
UsefulMoves:
db MOVE_DOUBLE_EDGE
db MOVE_SING
db MOVE_FLAMETHROWER
db MOVE_HYDRO_PUMP
db MOVE_SURF
db MOVE_ICE_BEAM
db MOVE_BLIZZARD
db MOVE_HYPER_BEAM
db MOVE_SLEEP_POWDER
db MOVE_THUNDERBOLT
db MOVE_THUNDER
db MOVE_EARTHQUAKE
db MOVE_TOXIC
db MOVE_PSYCHIC
db MOVE_HYPNOSIS
db MOVE_RECOVER
db MOVE_FIRE_BLAST
db MOVE_SOFTBOILED
db MOVE_SUPER_FANG
db -1

View File

@ -805,6 +805,7 @@ GerugeMemberFGroup::
SECTION "data/trainers/parties.asm@Trainer Parties 48 TEMPORARY", ROMX
SportsmanGroup::
; TODO: This guy clearly ain't named "Shigeki", he's "Tetsuji". Add a trainer constant accordingly
; SPORTSMAN_SHIGEKI
db "てつじ@", TRAINERTYPE_ITEM_MOVES
db 9, DEX_DONPHAN, ITEM_NONE, MOVE_TACKLE, MOVE_DEFENSE_CURL, MOVE_NONE, MOVE_NONE

View File

@ -43,7 +43,7 @@ DoEnemyTurn:
and a
ret nz
ld hl, wcaba
ld hl, wEnemyTurnsTaken
inc [hl]
call UpdateMoveData

File diff suppressed because it is too large Load Diff

View File

@ -328,7 +328,7 @@ asm_3c285:
ld [wCurPlayerSelectedMove], a
asm_3c2bb:
callfar Function38220
callfar AI_Switch
ld a, 1
ldh [hBattleTurn], a
call SpikesDamage
@ -469,7 +469,7 @@ sub_3c3b8:
asm_3c3c7:
ld a, 1
ldh [hBattleTurn], a
callfar Function38000
callfar AI_SwitchOrTryItem
jr c, asm_3c3eb
callfar DoEnemyTurn
call sub_3c473
@ -511,7 +511,7 @@ asm_3c41d:
call DrawHUDsAndHPBars
ld a, 1
ldh [hBattleTurn], a
callfar Function38000
callfar AI_SwitchOrTryItem
jr c, asm_3c460
callfar DoEnemyTurn
call sub_3c473
@ -1315,7 +1315,7 @@ sub_3c9c2:
ld hl, wEnemyHPPal
ld e, $30
call UpdateHPPal
callfar Function3834e
callfar EnemySwitch_TrainerHud
ld a, [wLinkMode]
and a
jr z, asm_3c9e4
@ -1334,7 +1334,7 @@ asm_3c9e4:
xor a
ld [wEnemyMoveStruct], a
ld [wFieldMoveSucceeded], a
ld [wcaba], a
ld [wEnemyTurnsTaken], a
inc a
ret
@ -1347,7 +1347,7 @@ asm_3c9fd:
ld b, $b
asm_3ca0a:
ld a, [wca22]
ld a, [wTrainerClass]
cp $2b
jr nz, asm_3ca18
ld b, 0
@ -1420,7 +1420,7 @@ GotMoneyForWinningText:
prompt
BattleText_EnemyWasDefeated:
text_from_ram wca2b
text_from_ram wOTClassName
text "の @"
text_from_ram wStringBuffer1
text ""
@ -1653,7 +1653,7 @@ OutOfUsableMonsText:
prompt
Data3ccdd:
text_from_ram wca2b
text_from_ram wOTClassName
text "との"
line "しょうぶに まけた!"
prompt
@ -2151,7 +2151,7 @@ EnemySendOutFirstMon:
; This makes the game halt the script early and throw up an error handler,
; due to reading the start of the following 'text' line as a <NULL> character.
TrainerAboutToUseText:
text_from_ram wca2b
text_from_ram wOTClassName
text "の @"
text_from_ram wStringBuffer1
text "は<LINE>"
@ -2163,7 +2163,7 @@ TrainerAboutToUseText:
done
TrainerSentOutText:
text_from_ram wca2b
text_from_ram wOTClassName
text "の @"
text_from_ram wStringBuffer1
text "は"
@ -4136,8 +4136,8 @@ asm_3df26:
dec a
jr z, asm_3df3f
ld a, 1
ld [wca22], a
callfar Function384d4
ld [wTrainerClass], a
callfar AIChooseMove
jr asm_3df6b
asm_3df3f:
@ -6102,10 +6102,10 @@ _InitBattleCommon:
ret
sub_3ef9a:
ld [wca22], a
callfar LoadTrainerClass
callfar Function38f45
ld a, [wca22]
ld [wTrainerClass], a
callfar GetTrainerAttributes
callfar ReadTrainerParty
ld a, [wTrainerClass]
cp 9
jr nz, asm_3efb8
xor a
@ -6136,7 +6136,7 @@ sub_3efdb:
ld de, vFrontPic
call LoadMonFrontSprite
xor a
ld [wca22], a
ld [wTrainerClass], a
ldh [hGraphicStartTile], a
ld hl, $c2ac
ld bc, $0707
@ -6144,9 +6144,9 @@ sub_3efdb:
ret
sub_3f003:
ld a, [wca23]
ld a, [wEnemyTrainerGraphicsPointer]
ld e, a
ld a, [wca24]
ld a, [wEnemyTrainerGraphicsPointer + 1]
ld d, a
ld a, $12
call UncompressSpriteFromDE
@ -6325,7 +6325,7 @@ InitBattleVariables:
ld [wCurBattleMon], a
ld [wBattleResult], a
ld [wTimeOfDayPal], a
ld [wcaba], a
ld [wEnemyTurnsTaken], a
ld hl, wPlayerHPPal
ld [hli], a
ld [hl], a
@ -6702,7 +6702,7 @@ BattleStartMessage:
.PlaceBattleStartText:
push hl
callfar Function38340
callfar BattleStart_TrainerHuds
pop hl
call PrintText
ret
@ -6722,7 +6722,7 @@ HookedPokemonAttackedText:
prompt
WantsToBattleText:
text_from_ram wca2b
text_from_ram wOTClassName
text "の @"
text_from_ram wStringBuffer1
text "が"
@ -6759,7 +6759,7 @@ sub_3f60c:
ld de, wPlayerName
call PlaceString
ld hl, $c36c
ld de, wd8fe
ld de, wOTPlayerName
call PlaceString
ld hl, $c349
ld a, $69

View File

@ -157,7 +157,7 @@ GetTrainerClassName_Old::
; Seemingly unreferenced.
; Loads a name to wStringBuffer1 from a partial list of Trainer classes leftover from Red/Green.
ld hl, .name_table
ld a, [wca22]
ld a, [wTrainerClass]
dec a
ld c, a
ld b, 0
@ -176,18 +176,18 @@ GetTrainerClassName_Old::
ret
.name_table:
dw .youngster, .bug_catcher, .lass, wca2b
dw .youngster, .bug_catcher, .lass, wOTClassName
dw .jr_trainer_male, .jr_trainer_female, .pokemaniac, .super_nerd
dw wca2b, wca2b, .burglar, .engineer
dw .jack, wca2b, .swimmer, wca2b
dw wca2b, .beauty, wca2b, .rocker
dw .juggler, wca2b, wca2b, .blackbelt
dw wca2b, .prof_oak, .chief, .scientist
dw wca2b, .rocket, .cooltrainer_male, .cooltrainer_female
dw wca2b, wca2b, wca2b, wca2b
dw wca2b, wca2b, wca2b, wca2b
dw wca2b, wca2b, wca2b, wca2b
dw wca2b, wca2b, wca2b
dw wOTClassName, wOTClassName, .burglar, .engineer
dw .jack, wOTClassName, .swimmer, wOTClassName
dw wOTClassName, .beauty, wOTClassName, .rocker
dw .juggler, wOTClassName, wOTClassName, .blackbelt
dw wOTClassName, .prof_oak, .chief, .scientist
dw wOTClassName, .rocket, .cooltrainer_male, .cooltrainer_female
dw wOTClassName, wOTClassName, wOTClassName, wOTClassName
dw wOTClassName, wOTClassName, wOTClassName, wOTClassName
dw wOTClassName, wOTClassName, wOTClassName, wOTClassName
dw wOTClassName, wOTClassName, wOTClassName
.youngster

View File

@ -268,10 +268,6 @@ SECTION "gfx.asm@Bank C Tilesets Common", ROMX
CommonExteriorTilesGFX:
INCBIN "gfx/tilesets/common.2bpp"
SECTION "gfx.asm@PokeBalls GFX", ROMX
PokeBallsGFX:: INCBIN "gfx/misc/poke_balls.2bpp"
SECTION "gfx.asm@Pokedex GFX", ROMX
PokedexButtonsGFX::
INCBIN "gfx/pokedex/buttons.2bpp"

View File

@ -271,12 +271,10 @@ ROMX $0d
ROMX $0e
org $4000
org $4391
"engine/dumps/bank0e.asm"
org $4494
"gfx.asm@PokeBalls GFX"
org $4d90
"data/trainers/class_names.asm"
"engine/dumps/bank0e.asm@ReadTrainerParty"
org $5110
"data/trainers/parties.asm@Trainer Parties"

View File

@ -95,6 +95,10 @@ MACRO dd ; four-byte (big-endian)
dx 4, \1
ENDM
MACRO littledt ; three-byte (little-endian)
db low(\1), high(\1), low((\1) >> 16)
ENDM
MACRO bigdw ; big-endian word
dx 2, \1
ENDM

View File

@ -495,12 +495,12 @@ wIntroFrameCounter2:: ds 1
wIntroSpriteStateFlag:: ds 1
ENDU
wca22:: ds 1
wca23:: ds 1
wca24:: ds 1
ds 6
wca2b:: ds 1
ds 10
wTrainerClass:: db
wEnemyTrainerGraphicsPointer:: dw
ds 2
wEnemyTrainerBaseReward:: db
ds 3
wOTClassName:: ds TRAINER_CLASS_NAME_LENGTH
wCurOTMon:: db
wBattleParticipantsNotFainted::
@ -624,7 +624,9 @@ wEnemyEvaLevel:: db
ds 1
wForceEvolution:: db
wcaba:: ds 1
wAILayer2Encouragement::
wEnemyTurnsTaken:: ds 1
ds 1
@ -636,6 +638,8 @@ wPlayerDebugSelectedMove:: ds 1
wMoveSelectionMenuType:: ds 1
; TODO: Replace these with just wCurPlayer/EnemyMove
; and replace the original wCurPlayerMove/wCurEnemyMove with wLastPlayer/EnemyCounterMove
wCurPlayerSelectedMove:: db
wCurEnemySelectedMove:: db
@ -1240,7 +1244,7 @@ wcdc6:: db
wcdc7:: db
wcdc8:: db
ds 1
wcdca:: db
wEnemyItemUsed:: db
NEXTU
; battle HUD
@ -1251,6 +1255,10 @@ NEXTU
wFinalCatchRate:: db
wThrownBallWobbleCount:: db
NEXTU
; move AI
wEnemyAIMoveScores:: ds NUM_MOVES
NEXTU
; evolution data
wEvolutionOldSpecies:: db
@ -1817,10 +1825,11 @@ wBreedMon2:: box_struct wBreedMon2
; Uses the last two bits to keep track of your breeder mons' genders.
; Bit clear = male, bit set = female
wBreedMonGenders:: db
wd8fe:: ds 1
wOTPlayerName:: ds PLAYER_NAME_LENGTH
SECTION "D913", WRAM0[$D913]
wOTPartyData::
wOTPartyCount:: db
wOTPartySpecies:: ds PARTY_LENGTH
wOTPartySpeciesEnd:: db

View File

@ -33,21 +33,29 @@
0A:5A1F Function29a1f ; prints text
0A:5ABF Function29abf ; prints text
0E:4B78 LoadTrainerClassName
;0E:4BA0 LoadTrainerClassName.got_name
0E:4BA9 LoadTrainerClass
;0E:4B78 GetTrainerAttributesName
;0E:4BA0 GetTrainerAttributesName.got_name
;0E:4BA9 GetTrainerAttributes
;0E:4BD0 TrainerClassAttributes
0E:4000 Function38000
0E:4220 Function38220
0E:4340 Function38340
0E:434E Function3834e
;0E:4000 TrainerAI
;0E:4220 AI_Switch
;0E:4340 BattleStart_TrainerHuds
;0E:434E EnemySwitch_TrainerHud
;0E:43CD DrawPlayerHUDBorder
;0E:43FD DrawEnemyHUDBorder
;0E:4415 PlaceHUDBorderTiles
;0E:4431 LinkBattle_TrainerHuds
0E:44D4 Function384d4
0E:4F45 Function38f45
0E:50E9 Battle_GetTrainerName
;0E:4594 AIScoringPointers
;0e:49b4 AICompareSpeed
;0e:49c7 AICheckPlayerHalfHP
;0e:49da AICheckEnemyHalfHP
;0e:49ed AICheckEnemyQuarterHP
;0e:4a1f UsefulMoves
;0e:4b5f AIGetEnemyMove
;0E:44D4 Function384d4
;0E:4F45 ReadTrainerParty
;0E:50E9 Battle_GetTrainerName
23:4940 Function8c940
23:49C6 Function8c9c6
@ -71,5 +79,6 @@
; Filler. TODO: Determine the position of all filler and preferably extract it to binary files.
0B:786F Bank0b_FillerStart
0e:59bc Bank0e_FillerStart
14:7274 Bank14_FillerStart