summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--constants.asm36
-rw-r--r--extras/analyze_incbins.py14
-rw-r--r--extras/insert_texts.py2
-rw-r--r--extras/make_map_size_constants.py4
-rw-r--r--extras/replace_dimensions.py2
-rw-r--r--extras/romvisualizer.py6
-rw-r--r--main.asm (renamed from common.asm)1415
-rw-r--r--pokeblue.asm2
-rw-r--r--pokered.asm2
10 files changed, 1251 insertions, 238 deletions
diff --git a/Makefile b/Makefile
index c4bc6ce7..63787251 100644
--- a/Makefile
+++ b/Makefile
@@ -8,10 +8,10 @@ TEXTFILES = text/oakspeech.tx text/pokedex.tx text/mapRedsHouse1F.tx \
all: pokered.gbc
-pokered.o: pokered.asm common.tx constants.asm ${TEXTFILES}
+pokered.o: pokered.asm main.tx constants.asm ${TEXTFILES}
rgbasm -o pokered.o pokered.asm
-pokeblue.o: pokeblue.asm common.tx constants.asm ${TEXTFILES}
+pokeblue.o: pokeblue.asm main.tx constants.asm ${TEXTFILES}
rgbasm -o pokeblue.o pokeblue.asm
redrle: extras/redrle.c
@@ -30,6 +30,6 @@ pokeblue.gbc: pokeblue.o
rgbfix -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON BLUE" $@
clean:
- rm -f common.tx pokered.o pokered.gbc pokeblue.o pokeblue.gbc redrle ${TEXTFILES}
+ rm -f main.tx pokered.o pokered.gbc pokeblue.o pokeblue.gbc redrle ${TEXTFILES}
more: pokered.gbc pokeblue.gbc
diff --git a/constants.asm b/constants.asm
index 4f1df3d0..8fab2fb9 100644
--- a/constants.asm
+++ b/constants.asm
@@ -89,9 +89,36 @@ TX_RAM: MACRO
; wram locations
+; coordinates of the position of the cursor for the top menu item (id 0)
+W_TOPMENUITEMY EQU $CC24
+W_TOPMENUITEMX EQU $CC25
+
+; the id of the currently selected menu item
+; the top item has id 0, the one below that has id 1, etc.
+W_CURMENUITEMID EQU $CC26
+
+; the tile that was behind the menu cursor's current location
+W_TILEBEHINDCURSOR EQU $CC27
+
+W_MAXMENUITEMID EQU $CC28 ; id of the bottom menu item
+
+W_MENUWATCHEDKEYS EQU $CC29 ; bit mask of keys that the menu will respond to
+
+W_OLDMENUITEMID EQU $CC2A ; id of previously selected menu item
+
+; how many times should HandleMenuInput poll the joypad state before it returns?
+W_MENUJOYPADPOLLCOUNT EQU $CC34
+
W_PLAYERMOVELISTINDEX EQU $CC2E
W_PLAYERMONNUMBER EQU $CC2F
+; the address of the menu cursor's current location within C3A0-C507
+W_MENUCURSORLOCATION EQU $CC30 ; 2 bytes
+
+; set to 1 if you can go from the bottom to the top or top to bottom of a menu
+; set to 0 if you can't go past the top or bottom of the menu
+W_MENUWRAPPINGENABLED EQU $CC4A
+
; current HP of player and enemy substitutes
W_PLAYERSUBSITUTEHP EQU $CCD7
W_ENEMYSUBSITUTEHP EQU $CCD8
@@ -699,6 +726,10 @@ W_BOXITEM50QTY EQU $D59E
W_SAFARITIMER1 EQU $D70D ; use 01 for maximum
W_SAFARITIMER2 EQU $D70E ; use F4 for maximum
+; counters for blinking down arrow
+H_DOWNARROWBLINKCNT1 EQU $FF8B
+H_DOWNARROWBLINKCNT2 EQU $FF8C
+
; Note: the following multiplication and division addresses are used for multiple purposes
; and so they overlap with each other
@@ -717,10 +748,15 @@ H_RAND2 EQU $FFD4
H_WHOSETURN EQU $FFF3 ; 0 on player’s turn, 1 on enemy’s turn
; hardware registers, from the pandocs http://nocash.emubase.de/pandocs.htm
+rJOYP EQU $FF00
rDIV EQU $FF04
+rLCDC EQU $FF40
rBGP EQU $FF47
rOBP0 EQU $FF48
rOBP1 EQU $FF49
+rWX EQU $FF4A
+rWY EQU $FF4B
+rIE EQU $FFFF
; pokemon name constants
diff --git a/extras/analyze_incbins.py b/extras/analyze_incbins.py
index ef5405ef..3f0f9093 100644
--- a/extras/analyze_incbins.py
+++ b/extras/analyze_incbins.py
@@ -27,7 +27,7 @@ def offset_to_pointer(offset):
if type(offset) == str: offset = int(offset, base)
return int(offset) % 0x4000 + 0x4000
-def load_asm(filename="../common.asm"):
+def load_asm(filename="../main.asm"):
"loads the asm source code into memory"
global asm
asm = open(filename, "r").read().split("\n")
@@ -86,7 +86,7 @@ def process_incbins():
def find_incbin_to_replace_for(address):
"""returns a line number for which incbin to edit
- if you were to insert bytes into common.asm"""
+ if you were to insert bytes into main.asm"""
if type(address) == str: address = int(address, 16)
for incbin_key in processed_incbins.keys():
@@ -155,7 +155,7 @@ def generate_diff_insert(line_number, newline):
newfile_fh.close()
try:
- diffcontent = subprocess.check_output("diff -u ../common.asm " + newfile_filename, shell=True)
+ diffcontent = subprocess.check_output("diff -u ../main.asm " + newfile_filename, shell=True)
except AttributeError, exc:
raise exc
except Exception, exc:
@@ -195,7 +195,7 @@ def insert_map_header_asm(map_id):
fh.close()
#apply the patch
- os.system("patch ../common.asm temp.patch")
+ os.system("patch ../main.asm temp.patch")
#remove the patch
os.system("rm temp.patch")
@@ -230,8 +230,8 @@ def apply_diff(diff, try_fixing=True):
fh.close()
#apply the patch
- os.system("cp ../common.asm ../common1.asm")
- os.system("patch ../common.asm temp.patch")
+ os.system("cp ../main.asm ../main1.asm")
+ os.system("patch ../main.asm temp.patch")
#remove the patch
os.system("rm temp.patch")
@@ -242,7 +242,7 @@ def apply_diff(diff, try_fixing=True):
return True
except Exception, exc:
if try_fixing:
- os.system("mv ../common1.asm ../common.asm")
+ os.system("mv ../main1.asm ../main.asm")
return False
def index(seq, f):
diff --git a/extras/insert_texts.py b/extras/insert_texts.py
index 30163b4d..c3133bf8 100644
--- a/extras/insert_texts.py
+++ b/extras/insert_texts.py
@@ -610,7 +610,7 @@ def scan_for_map_scripts_pointer():
def scan_rom_for_tx_fars_and_insert():
"""calls analyze_texts.scan_rom_for_tx_fars()
- looks through INCBIN'd addresses from common.asm,
+ looks through INCBIN'd addresses from main.asm,
finds TX_FARs that aren't included yet.
"""
x = 0
diff --git a/extras/make_map_size_constants.py b/extras/make_map_size_constants.py
index c40a4514..c4b13da7 100644
--- a/extras/make_map_size_constants.py
+++ b/extras/make_map_size_constants.py
@@ -23,8 +23,8 @@ def get_map_size_constants(do_sed=False):
output += constant_name + "_WIDTH EQU $%.2x\n" % (width)
output += "\n"
- sed_lines += "sed -i 's/" + base_name + "Height/" + constant_name + "_HEIGHT" + "/g' common.asm" + "\n"
- sed_lines += "sed -i 's/" + base_name + "Width/" + constant_name + "_WIDTH" + "/g' common.asm" + "\n"
+ sed_lines += "sed -i 's/" + base_name + "Height/" + constant_name + "_HEIGHT" + "/g' main.asm" + "\n"
+ sed_lines += "sed -i 's/" + base_name + "Width/" + constant_name + "_WIDTH" + "/g' main.asm" + "\n"
if do_sed:
return sed_lines
diff --git a/extras/replace_dimensions.py b/extras/replace_dimensions.py
index 9d4df895..cdd72906 100644
--- a/extras/replace_dimensions.py
+++ b/extras/replace_dimensions.py
@@ -39,7 +39,7 @@ asm = None
asm_lines = None
def load_asm():
global asm, asm_lines
- asm = open("../common.asm", "r").read()
+ asm = open("../main.asm", "r").read()
asm_lines = asm.split("\n")
def get_xy_movement_of_connection_strip(map_id, connection_id):
diff --git a/extras/romvisualizer.py b/extras/romvisualizer.py
index 7e80f786..b3fd7cd5 100644
--- a/extras/romvisualizer.py
+++ b/extras/romvisualizer.py
@@ -6,12 +6,12 @@ import os
changeset_numbers = range(266, 635)
def take_snapshot_image(changeset_number):
- "turn common.asm into an image at a certain version"
+ "turn main.asm into an image at a certain version"
- print "reverting common.asm to r" + str(changeset_number)
+ print "reverting main.asm to r" + str(changeset_number)
#revert the file
- os.system("hg revert ../common.asm -r" + str(changeset_number))
+ os.system("hg revert ../main.asm -r" + str(changeset_number))
print "generating the image.."
diff --git a/common.asm b/main.asm
index 446e1670..427c6b24 100644
--- a/common.asm
+++ b/main.asm
@@ -108,8 +108,79 @@ jp Start
Section "start",HOME[$150]
Start: ; 0x150
+ cp $11 ; value that indicates Gameboy Color
+ jr z,.gbcDetected\@
+ xor a
+ jr .storeValue\@
+.gbcDetected\@
+ ld a,$00
+.storeValue\@
+ ld [$cf1a],a ; same value ($00) either way
+ jp InitGame
+
+; this function directly reads the joypad I/O register
+; it reads many times in order to give the joypad a chance to stabilize
+; it saves a result in [$fff8] in the following format
+; (set bit indicates pressed button)
+; bit 0 - A button
+; bit 1 - B button
+; bit 2 - Select button
+; bit 3 - Start button
+; bit 4 - Right
+; bit 5 - Left
+; bit 6 - Up
+; bit 7 - Down
+ReadJoypadRegister: ; 15F
+ ld a,%00100000 ; select direction keys
+ ld c,$00
+ ld [rJOYP],a
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ cpl ; complement the result so that a set bit indicates a pressed key
+ and a,%00001111
+ swap a ; put direction keys in upper nibble
+ ld b,a
+ ld a,%00010000 ; select button keys
+ ld [rJOYP],a
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ ld a,[rJOYP]
+ cpl ; complement the result so that a set bit indicates a pressed key
+ and a,%00001111
+ or b ; put button keys in lower nibble
+ ld [$fff8],a ; save joypad state
+ ld a,%00110000 ; unselect all keys
+ ld [rJOYP],a
+ ret
+
+; function to update the joypad state variables
+; output:
+; [$ffb2] = keys released since last time
+; [$ffb3] = keys pressed since last time
+; [$ffb4] = currently pressed keys
+GetJoypadState: ; 19A
+ ld a, [$ffb8]
+ push af
+ ld a,$3
+ ld [$ffb8],a
+ ld [$2000],a
+ call $4000
+ pop af
+ ld [$ff00+$b8],a
+ ld [$2000],a
+ ret
-INCBIN "baserom.gbc",$150,$1AE - $150
; see also MapHeaderBanks
MapHeaderPointers: ; $01AE
dw PalletTown_h
@@ -419,7 +490,7 @@ OverworldLoopLessDelay: ; 402
ld a,[$d736]
bit 6,a ; jumping down a ledge?
call nz, HandleMidJump
- ld a,[$cfc5] ; walking animation counter
+ ld a,[W_WALKCOUNTER]
and a
jp nz,.moveAhead\@ ; if the player sprite has not yet completed the walking animation
call GetJoypadStateOverworld ; get joypad state (which is possibly simulated)
@@ -622,7 +693,7 @@ OverworldLoopLessDelay: ; 402
jp c,OverworldLoop
.noCollision\@
ld a,$08
- ld [$cfc5],a ; walking animation counter
+ ld [W_WALKCOUNTER],a
jr .moveAhead2\@
.moveAhead\@
ld a,[$d736]
@@ -645,7 +716,7 @@ OverworldLoopLessDelay: ; 402
call BikeSpeedup ; if riding a bike and not jumping a ledge
.normalPlayerSpriteAdvancement\@
call AdvancePlayerSprite
- ld a,[$cfc5] ; walking animation counter
+ ld a,[W_WALKCOUNTER]
and a
jp nz,CheckMapConnections ; it seems like this check will never succeed (the other place where CheckMapConnections is run works)
; walking animation finished
@@ -799,7 +870,7 @@ CheckWarpsNoCollisionLoop: ; 6CC
jr nz,WarpFound1
push de
push bc
- call $019a ; update joypad state
+ call GetJoypadState
pop bc
pop de
ld a,[$ffb4] ; current joypad state
@@ -1823,7 +1894,7 @@ AdvancePlayerSprite: ; D27
ld b,a
ld a,[$c105] ; delta X
ld c,a
- ld hl,$cfc5 ; walking animation counter
+ ld hl,W_WALKCOUNTER ; walking animation counter
dec [hl]
jr nz,.afterUpdateMapCoords\@
; if it's the end of the animation, update the player's map coordinates
@@ -1834,7 +1905,7 @@ AdvancePlayerSprite: ; D27
add c
ld [W_XCOORD],a
.afterUpdateMapCoords\@
- ld a,[$cfc5] ; walking animation counter
+ ld a,[W_WALKCOUNTER] ; walking animation counter
cp a,$07
jp nz,.scrollBackgroundAndSprites\@
; if this is the first iteration of the animation
@@ -2205,7 +2276,7 @@ GetJoypadStateOverworld: ; F4D
ld [$c103],a
ld [$c105],a
call RunMapScript
- call $019a ; update joypad state
+ call GetJoypadState
ld a,[$d733]
bit 3,a ; check if a trainer wants a challenge
jr nz,.notForcedDownwards\@
@@ -2698,7 +2769,7 @@ LoadMapData: ; 1241
ld [$d526],a
ld [$ffaf],a
ld [$ffae],a
- ld [$cfc5],a
+ ld [W_WALKCOUNTER],a
ld [$d119],a
ld [$d11a],a
ld [$d3a8],a
@@ -3456,7 +3527,7 @@ TextCommand09: ; 1BFF
; (no arguments)
TextCommand0A: ; 1C1D
push bc
- call $019a ; update joypad state
+ call GetJoypadState
ld a,[$ffb4]
and a,%00000011 ; A and B buttons
jr nz,.skipDelay\@
@@ -3533,7 +3604,7 @@ TextCommand0C: ; 1C78
ld a,$75 ; ellipsis
ld [hli],a
push de
- call $019a ; update joypad state
+ call GetJoypadState
pop de
ld a,[$ffb4] ; joypad state
and a,%00000011 ; is A or B button pressed?
@@ -3617,7 +3688,128 @@ GetRowColAddressBgMap: ; 1CDD
ld h,a
ret
-INCBIN "baserom.gbc",$1CF0,$20AF - $1CF0
+; clears a VRAM background map with blank space tiles
+; INPUT: h - high byte of background tile map address in VRAM
+ClearBgMap: ; 1CF0
+ ld a,$7f ; blank space
+ jr .next\@
+ ld a,l ; XXX does anything call this?
+.next\@
+ ld de,$400 ; size of VRAM background map
+ ld l,e
+.loop\@
+ ld [hli],a
+ dec e
+ jr nz,.loop\@
+ dec d
+ jr nz,.loop\@
+ ret
+
+INCBIN "baserom.gbc",$1D01,$1F54 - $1D01
+
+; initialization code
+; explanation for %11100011 (value stored in rLCDC)
+; * LCD enabled
+; * Window tile map at $9C00
+; * Window display enabled
+; * BG and window tile data at $8800
+; * BG tile map at $9800
+; * 8x8 OBJ size
+; * OBJ display enabled
+; * BG display enabled
+InitGame: ; 1F54
+ di
+; zero I/O registers
+ xor a
+ ld [$ff0f],a
+ ld [$ffff],a
+ ld [$ff43],a
+ ld [$ff42],a
+ ld [$ff01],a
+ ld [$ff02],a
+ ld [$ff4b],a
+ ld [$ff4a],a
+ ld [$ff06],a
+ ld [$ff07],a
+ ld [$ff47],a
+ ld [$ff48],a
+ ld [$ff49],a
+ ld a,%10000000 ; enable LCD
+ ld [rLCDC],a
+ call DisableLCD ; why enable then disable?
+ ld sp,$dfff ; initialize stack pointer
+ ld hl,$c000 ; start of WRAM
+ ld bc,$2000 ; size of WRAM
+.zeroWramLoop\@
+ ld [hl],0
+ inc hl
+ dec bc
+ ld a,b
+ or c
+ jr nz,.zeroWramLoop\@
+ call ZeroVram
+ ld hl,$ff80
+ ld bc,$007f
+ call $36e0 ; zero HRAM
+ call CleanLCD_OAM ; this is unnecessary since it was already cleared above
+ ld a,$01
+ ld [$ffb8],a
+ ld [$2000],a
+ call $4bed ; copy DMA code to HRAM
+ xor a
+ ld [$ffd7],a
+ ld [$ff41],a
+ ld [$ffae],a
+ ld [$ffaf],a
+ ld [$ff0f],a
+ ld a,%00001101 ; enable V-blank, timer, and serial interrupts
+ ld [rIE],a
+ ld a,$90 ; put the window off the screen
+ ld [$ffb0],a
+ ld [rWX],a
+ ld a,$07
+ ld [rWY],a
+ ld a,$ff
+ ld [$ffaa],a
+ ld h,$98
+ call ClearBgMap ; fill $9800-$9BFF (BG tile map) with $7F tiles
+ ld h,$9c
+ call ClearBgMap ; fill $9C00-$9FFF (Window tile map) with $7F tiles
+ ld a,%11100011
+ ld [rLCDC],a ; enabled LCD
+ ld a,$10
+ ld [$ff8a],a
+ call $200e
+ ei
+ ld a,$40
+ call Predef ; SGB border
+ ld a,$1f
+ ld [$c0ef],a
+ ld [$c0f0],a
+ ld a,$9c
+ ld [$ffbd],a
+ xor a
+ ld [$ffbc],a
+ dec a
+ ld [$cfcb],a
+ ld a,$32
+ call Predef ; display the copyrights, GameFreak logo, and battle animation
+ call DisableLCD
+ call ZeroVram
+ call $3ddc
+ call CleanLCD_OAM
+ ld a,%11100011
+ ld [rLCDC],a ; enable LCD
+ jp $42b7
+
+; zeroes all VRAM
+ZeroVram: ; 2004
+ ld hl,$8000
+ ld bc,$2000
+ xor a
+ jp $36e0
+
+INCBIN "baserom.gbc",$200E,$20AF - $200E
DelayFrame: ; 20AF
; delay for one frame
@@ -4101,7 +4293,7 @@ DisplayTextID: ; 2920
call $3865 ; wait for a button press after displaying all the text
; loop to hold the dialogue box open as long as the player keeps holding down the A button
.holdBoxOpen\@
- call $019a ; update joypad state
+ call GetJoypadState
ld a,[$ffb4]
bit 0,a ; is the A button being pressed?
jr nz,.holdBoxOpen\@
@@ -4573,7 +4765,63 @@ GetName: ; 376B
ld [$2000],a
ret
-INCBIN "baserom.gbc",$37df,$3927 - $37df
+INCBIN "baserom.gbc",$37df,$3831 - $37df
+
+; this function is used when lower button sensitivity is wanted (e.g. menus)
+; OUTPUT: [$ffb5] = pressed buttons in usual format
+; there are two flags that control its functionality, [$ffb6] and [$ffb7]
+; there are esentially three modes of operation
+; 1. Get newly pressed buttons only
+; ([$ffb7] == 0, [$ffb6] == any)
+; Just copies [$ffb3] to [$ffb5].
+; 2. Get currently pressed buttons at low sample rate with delay
+; ([$ffb7] == 0, [$ffb6] != 0)
+; If the user holds down buttons for more than half a second,
+; report buttons as being pressed up to 12 times per second thereafter.
+; If the user holds down buttons for less than half a second,
+; report only one button press.
+; 3. Same as 2, but report no buttons as pressed if A or B is held down.
+; ([$ffb7] == 0, [$ffb6] == 0)
+GetJoypadStateLowSensitivity: ; 3831
+ call GetJoypadState
+ ld a,[$ffb7] ; flag
+ and a ; get all currently pressed buttons or only newly pressed buttons?
+ ld a,[$ffb3] ; newly pressed buttons
+ jr z,.storeButtonState\@
+ ld a,[$ffb4] ; all currently pressed buttons
+.storeButtonState\@
+ ld [$ffb5],a
+ ld a,[$ffb3] ; newly pressed buttons
+ and a ; have any buttons been newly pressed since last check?
+ jr z,.noNewlyPressedButtons\@
+.newlyPressedButtons\@
+ ld a,30 ; half a second delay
+ ld [$ffd5],a ; frame counter
+ ret
+.noNewlyPressedButtons\@
+ ld a,[$ffd5] ; frame counter
+ and a ; is the delay over?
+ jr z,.delayOver\@
+.delayNotOver\@
+ xor a
+ ld [$ffb5],a ; report no buttons as pressed
+ ret
+.delayOver\@
+; if [$ffb6] = 0 and A or B is pressed, report no buttons as pressed
+ ld a,[$ffb4]
+ and a,%00000011 ; A and B buttons
+ jr z,.setShortDelay\@
+ ld a,[$ffb6] ; flag
+ and a
+ jr nz,.setShortDelay\@
+ xor a
+ ld [$ffb5],a
+.setShortDelay\@
+ ld a,5 ; 1/12 of a second delay
+ ld [$ffd5],a ; frame counter
+ ret
+
+INCBIN "baserom.gbc",$3865,$3927 - $3865
AddPokemonToParty: ; 0x3927
push hl
@@ -4599,7 +4847,338 @@ AddNTimes: ; 3A87
jr nz,.loop\@
ret
-INCBIN "baserom.gbc",$3A8E,$3C49 - $3A8E
+; Compare strings, c bytes in length, at de and hl.
+; Often used to compare big endian numbers in battle calculations.
+StringCmp: ; 3A8E
+ ld a,[de]
+ cp [hl]
+ ret nz
+ inc de
+ inc hl
+ dec c
+ jr nz,StringCmp
+ ret
+
+; INPUT:
+; a = oam block index (each block is 4 oam entries)
+; b = Y coordinate of upper left corner of sprite
+; c = X coordinate of upper left corner of sprite
+; de = base address of 4 tile number and attribute pairs
+WriteOAMBlock: ; 3A97
+ ld h,$c3
+ swap a ; multiply by 16
+ ld l,a
+ call .writeOneEntry\@ ; upper left
+ push bc
+ ld a,8
+ add c
+ ld c,a
+ call .writeOneEntry\@ ; upper right
+ pop bc
+ ld a,8
+ add b
+ ld b,a
+ call .writeOneEntry\@ ; lower left
+ ld a,8
+ add c
+ ld c,a
+ ; lower right
+.writeOneEntry\@
+ ld [hl],b ; Y coordinate
+ inc hl
+ ld [hl],c ; X coordinate
+ inc hl
+ ld a,[de] ; tile number
+ inc de
+ ld [hli],a
+ ld a,[de] ; attribute
+ inc de
+ ld [hli],a
+ ret
+
+HandleMenuInput: ; 3ABE
+ xor a
+ ld [$d09b],a
+
+HandleMenuInputPokemonSelection: ; 3AC2
+ ld a,[H_DOWNARROWBLINKCNT1]
+ push af
+ ld a,[H_DOWNARROWBLINKCNT2]
+ push af ; save existing values on stack
+ xor a
+ ld [H_DOWNARROWBLINKCNT1],a ; blinking down arrow timing value 1
+ ld a,$06
+ ld [H_DOWNARROWBLINKCNT2],a ; blinking down arrow timing value 2
+.loop1\@
+ xor a
+ ld [$d08b],a ; counter for pokemon shaking animation
+ call PlaceMenuCursor
+ call Delay3
+.loop2\@
+ push hl
+ ld a,[$d09b]
+ and a ; is it a pokemon selection menu?
+ jr z,.getJoypadState\@
+ ld b,$1c
+ ld hl,$56ff ; shake mini sprite of selected pokemon
+ call Bankswitch
+.getJoypadState\@
+ pop hl
+ call GetJoypadStateLowSensitivity
+ ld a,[$ffb5]
+ and a ; was a key pressed?
+ jr nz,.keyPressed\@
+ push hl
+ FuncCoord 18,11 ; coordinates of blinking down arrow in some menus
+ ld hl,Coord
+ call $3c04 ; blink down arrow (if any)
+ pop hl
+ ld a,[W_MENUJOYPADPOLLCOUNT]
+ dec a
+ jr z,.giveUpWaiting\@
+ jr .loop2\@
+.giveUpWaiting\@
+; if a key wasn't pressed within the specified number of checks
+ pop af
+ ld [H_DOWNARROWBLINKCNT2],a
+ pop af
+ ld [H_DOWNARROWBLINKCNT1],a ; restore previous values
+ xor a
+ ld [W_MENUWRAPPINGENABLED],a ; disable menu wrapping
+ ret
+.keyPressed\@
+ xor a
+ ld [$cc4b],a
+ ld a,[$ffb5]
+ ld b,a
+ bit 6,a ; pressed Up key?
+ jr z,.checkIfDownPressed\@
+.upPressed\@
+ ld a,[W_CURMENUITEMID] ; selected menu item
+ and a ; already at the top of the menu?
+ jr z,.alreadyAtTop\@
+.notAtTop\@
+ dec a
+ ld [W_CURMENUITEMID],a ; move selected menu item up one space
+ jr .checkOtherKeys\@
+.alreadyAtTop\@
+ ld a,[W_MENUWRAPPINGENABLED]
+ and a ; is wrapping around enabled?
+ jr z,.noWrappingAround\@
+ ld a,[W_MAXMENUITEMID]
+ ld [W_CURMENUITEMID],a ; wrap to the bottom of the menu
+ jr .checkOtherKeys\@
+.checkIfDownPressed\@
+ bit 7,a
+ jr z,.checkOtherKeys\@
+.downPressed\@
+ ld a,[W_CURMENUITEMID]
+ inc a
+ ld c,a
+ ld a,[W_MAXMENUITEMID]
+ cp c
+ jr nc,.notAtBottom\@
+.alreadyAtBottom\@
+ ld a,[W_MENUWRAPPINGENABLED]
+ and a ; is wrapping around enabled?
+ jr z,.noWrappingAround\@
+ ld c,$00 ; wrap from bottom to top
+.notAtBottom\@
+ ld a,c
+ ld [W_CURMENUITEMID],a
+.checkOtherKeys\@
+ ld a,[W_MENUWATCHEDKEYS]
+ and b ; does the menu care about any of the pressed keys?
+ jp z,.loop1\@
+.checkIfAButtonOrBButtonPressed\@
+ ld a,[$ffb5]
+ and a,%00000011 ; pressed A button or B button?
+ jr z,.skipPlayingSound\@
+.AButtonOrBButtonPressed\@
+ push hl
+ ld hl,$cd60
+ bit 5,[hl]
+ pop hl
+ jr nz,.skipPlayingSound\@
+ ld a,$90
+ call $23b1 ; play sound
+.skipPlayingSound\@
+ pop af
+ ld [H_DOWNARROWBLINKCNT2],a
+ pop af
+ ld [H_DOWNARROWBLINKCNT1],a ; restore previous values
+ xor a
+ ld [W_MENUWRAPPINGENABLED],a ; disable menu wrapping
+ ld a,[$ffb5]
+ ret
+.noWrappingAround\@
+ ld a,[$cc37]
+ and a ; should we return if the user tried to go past the top or bottom?
+ jr z,.checkOtherKeys\@
+ jr .checkIfAButtonOrBButtonPressed\@
+
+PlaceMenuCursor: ; 3B7C
+ ld a,[W_TOPMENUITEMY]
+ and a ; is the y coordinate 0?
+ jr z,.adjustForXCoord\@
+ ld hl,$c3a0
+ ld bc,20 ; screen width
+.topMenuItemLoop\@
+ add hl,bc
+ dec a
+ jr nz,.topMenuItemLoop\@
+.adjustForXCoord\@
+ ld a,[W_TOPMENUITEMX]
+ ld b,$00
+ ld c,a
+ add hl,bc
+ push hl
+ ld a,[W_OLDMENUITEMID]
+ and a ; was the previous menu id 0?
+ jr z,.checkForArrow1\@
+ push af
+ ld a,[$fff6]
+ bit 1,a ; is the menu double spaced?
+ jr z,.doubleSpaced1\@
+ ld bc,20
+ jr .getOldMenuItemScreenPosition\@
+.doubleSpaced1\@
+ ld bc,40
+.getOldMenuItemScreenPosition\@
+ pop af
+.oldMenuItemLoop\@
+ add hl,bc
+ dec a
+ jr nz,.oldMenuItemLoop\@
+.checkForArrow1\@
+ ld a,[hl]
+ cp a,$ed ; was an arrow next to the previously selected menu item?
+ jr nz,.skipClearingArrow\@
+.clearArrow\@
+ ld a,[W_TILEBEHINDCURSOR]
+ ld [hl],a
+.skipClearingArrow\@
+ pop hl
+ ld a,[W_CURMENUITEMID]
+ and a
+ jr z,.checkForArrow2\@
+ push af
+ ld a,[$fff6]
+ bit 1,a ; is the menu double spaced?
+ jr z,.doubleSpaced2\@
+ ld bc,20
+ jr .getCurrentMenuItemScreenPosition\@
+.doubleSpaced2\@
+ ld bc,40
+.getCurrentMenuItemScreenPosition\@
+ pop af
+.currentMenuItemLoop\@
+ add hl,bc
+ dec a
+ jr nz,.currentMenuItemLoop\@
+.checkForArrow2\@
+ ld a,[hl]
+ cp a,$ed ; has the right arrow already been placed?
+ jr z,.skipSavingTile\@ ; if so, don't lose the saved tile
+ ld [W_TILEBEHINDCURSOR],a ; save tile before overwriting with right arrow
+.skipSavingTile\@
+ ld a,$ed ; place right arrow
+ ld [hl],a
+ ld a,l
+ ld [W_MENUCURSORLOCATION],a
+ ld a,h
+ ld [W_MENUCURSORLOCATION + 1],a
+ ld a,[W_CURMENUITEMID]
+ ld [W_OLDMENUITEMID],a
+ ret
+
+; Used when swapping positions of items in a list menu.
+; The item that the user selects first is marked with an outline of a right arrow
+; to distinguish it from the arrow being used to select the second item.
+PlaceUnfilledArrowMenuCursor: ; 3BEC
+ ld b,a
+ ld a,[W_MENUCURSORLOCATION]
+ ld l,a
+ ld a,[W_MENUCURSORLOCATION + 1]
+ ld h,a
+ ld [hl],$ec ; outline of right arrow
+ ld a,b
+ ret
+
+; Replaces the menu cursor with a blank space.
+EraseMenuCursor: ; 3BF9
+ ld a,[W_MENUCURSORLOCATION]
+ ld l,a
+ ld a,[W_MENUCURSORLOCATION + 1]
+ ld h,a
+ ld [hl],$7f ; blank space
+ ret
+
+; This toggles a blinking down arrow at hl on and off after a delay has passed.
+; This is often called even when no blinking is occurring.
+; The reason is that most functions that call this initialize H_DOWNARROWBLINKCNT1 to 0.
+; The effect is that if the tile at hl is initialized with a down arrow,
+; this function will toggle that down arrow on and off, but if the tile isn't
+; initliazed with a down arrow, this function does nothing.
+; That allows this to be called without worrying about if a down arrow should
+; be blinking.
+HandleDownArrowBlinkTiming: ; 3C04
+ ld a,[hl]
+ ld b,a
+ ld a,$ee ; down arrow
+ cp b
+ jr nz,.downArrowOff\@
+.downArrowOn\@
+ ld a,[H_DOWNARROWBLINKCNT1]
+ dec a
+ ld [H_DOWNARROWBLINKCNT1],a
+ ret nz
+ ld a,[H_DOWNARROWBLINKCNT2]
+ dec a
+ ld [H_DOWNARROWBLINKCNT2],a
+ ret nz
+ ld a,$7f ; blank space
+ ld [hl],a
+ ld a,$ff
+ ld [H_DOWNARROWBLINKCNT1],a
+ ld a,$06
+ ld [H_DOWNARROWBLINKCNT2],a
+ ret
+.downArrowOff\@
+ ld a,[H_DOWNARROWBLINKCNT1]
+ and a
+ ret z
+ dec a
+ ld [H_DOWNARROWBLINKCNT1],a
+ ret nz
+ dec a
+ ld [H_DOWNARROWBLINKCNT1],a
+ ld a,[H_DOWNARROWBLINKCNT2]
+ dec a
+ ld [H_DOWNARROWBLINKCNT2],a
+ ret nz
+ ld a,$06
+ ld [H_DOWNARROWBLINKCNT2],a
+ ld a,$ee ; down arrow
+ ld [hl],a
+ ret
+
+; The following code either enables or disables the automatic drawing of
+; text boxes by DisplayTextID. Both functions cause DisplayTextID to wait
+; for a button press after displaying text (unless [$cc47] is set).
+
+EnableAutoTextBoxDrawing: ; 3C3C
+ xor a
+ jr AutoTextBoxDrawingCommon
+
+DisableAutoTextBoxDrawing: ; 3C3F
+ ld a,$01
+
+AutoTextBoxDrawingCommon: ; 3C41
+ ld [$cf0c],a ; control text box drawing
+ xor a
+ ld [$cc3c],a ; make DisplayTextID wait for button press
+ ret
PrintText: ; 3C49
; given a pointer in hl, print the text there
@@ -5208,7 +5787,7 @@ MainMenu: ; 0x5af2
ld [$FFB3],a
ld [$FFB2],a
ld [$FFB4],a
- call $19A
+ call GetJoypadState
ld a,[$FFB4]
bit 0,a
jr nz,.next5\@
@@ -5226,7 +5805,7 @@ MainMenu: ; 0x5af2
and a
jp z,$5D5F
ld a,[W_CURMAP] ; map ID
- cp a,$76 ; Hall of Fame
+ cp a,HALL_OF_FAME
jp nz,$5D5F
xor a
ld [$D71A],a
@@ -13871,15 +14450,15 @@ CeruleanCityText2: ; 0x1967c
ld bc, $e401
call GiveItem
jr c, .asm_8bbbd ; 0x196b9 $8
- ld hl, UnnamedText_196e9
+ ld hl, TM28NoRoomText
call PrintText
jr .asm_e4e6f ; 0x196c1 $13
.asm_8bbbd ; 0x196c3
ld a, $1
ld [$cc3c], a
- ld hl, UnnamedText_196de
+ ld hl, ReceivedTM28Text
call PrintText
- ld b, $1d
+ ld b, BANK(Unnamed_ASM_74872)
ld hl, Unnamed_ASM_74872
call Bankswitch
.asm_e4e6f ; 0x196d6
@@ -13891,15 +14470,15 @@ UnnamedText_196d9: ; 0x196d9
db $50
; 0x196d9 + 5 bytes
-UnnamedText_196de: ; 0x196de
- TX_FAR ReceivedTM28Text ; 0xa4f82
+ReceivedTM28Text: ; 0x196de
+ TX_FAR _ReceivedTM28Text ; 0xa4f82
db $0B
- TX_FAR UnnamedText_a4f96 ; 0xa4f96
+ TX_FAR _ReceivedTM28Text2 ; 0xa4f96
db $0D, $50
; 0x196e9
-UnnamedText_196e9: ; 0x196e9
- TX_FAR _UnnamedText_196e9
+TM28NoRoomText: ; 0x196e9
+ TX_FAR _TM28NoRoomText
db $50
; 0x196e9 + 5 bytes
@@ -14045,12 +14624,13 @@ VermilionCityScript: ; 0x197a1
pop hl
bit 5, [hl]
res 5, [hl]
- call nz, $57c0
+ call nz, VermilionCityScript_Unknown197c0
ld hl, VermilionCityScripts
ld a, [$d62a]
jp $3d97
; 0x197c0
+VermilionCityScript_Unknown197c0: ; 0x197c0
INCBIN "baserom.gbc",$197c0,$197dc - $197c0
VermilionCityScripts: ; 0x197dc
@@ -14147,11 +14727,11 @@ VermilionCityText3: ; 0x198b1
call $34bf
jr nc, .asm_57b73 ; 0x198c6
.asm_07af3 ; 0x198c8
- ld hl, UnnamedText_19904
+ ld hl, SSAnneWelcomeText4
call PrintText
jr .asm_79bd1 ; 0x198ce
.asm_57b73 ; 0x198d0
- ld hl, UnnamedText_19909
+ ld hl, SSAnneWelcomeText9
call PrintText
ld b, $3f
ld a, $1c
@@ -14159,45 +14739,45 @@ VermilionCityText3: ; 0x198b1
ld a, b
and a
jr nz, .asm_0419b ; 0x198df
- ld hl, UnnamedText_19913
+ ld hl, SSAnneNoTicketText
call PrintText
jr .asm_79bd1 ; 0x198e7
.asm_0419b ; 0x198e9
- ld hl, UnnamedText_1990e
+ ld hl, SSAnneFlashedTicketText
call PrintText
ld a, $4
ld [$d62a], a
jr .asm_79bd1 ; 0x198f4
.asm_3e0e9 ; 0x198f6
- ld hl, UnnamedText_19918
+ ld hl, SSAnneNotHereText
call PrintText
.asm_79bd1 ; 0x198fc
jp TextScriptEnd
INCBIN "baserom.gbc",$198ff,$19904 - $198ff
-UnnamedText_19904: ; 0x19904
- TX_FAR _UnnamedText_19904
+SSAnneWelcomeText4: ; 0x19904
+ TX_FAR _SSAnneWelcomeText4
db $50
; 0x19904 + 5 bytes
-UnnamedText_19909: ; 0x19909
- TX_FAR _UnnamedText_19909
+SSAnneWelcomeText9: ; 0x19909
+ TX_FAR _SSAnneWelcomeText9
db $50
; 0x19909 + 5 bytes
-UnnamedText_1990e: ; 0x1990e
- TX_FAR _UnnamedText_1990e
+SSAnneFlashedTicketText: ; 0x1990e
+ TX_FAR _SSAnneFlashedTicketText
db $50
; 0x1990e + 5 bytes
-UnnamedText_19913: ; 0x19913
- TX_FAR _UnnamedText_19913
+SSAnneNoTicketText: ; 0x19913
+ TX_FAR _SSAnneNoTicketText
db $50
; 0x19913 + 5 bytes
-UnnamedText_19918: ; 0x19918
- TX_FAR _UnnamedText_19918
+SSAnneNotHereText: ; 0x19918
+ TX_FAR _SSAnneNotHereText
db $50
; 0x19918 + 5 bytes
@@ -14276,43 +14856,43 @@ CeladonCityText5: ; 0x1999e
ld a, [$d777]
bit 0, a
jr nz, .asm_7053f ; 0x199a4
- ld hl, UnnamedText_199d2
+ ld hl, TM41PreText
call PrintText
ld bc, (TM_41 << 8) | 1
call GiveItem
jr c, .asm_890ec ; 0x199b2
- ld hl, UnnamedText_199e2
+ ld hl, TM41NoRoomText
call PrintText
jr .asm_c765a ; 0x199ba
.asm_890ec ; 0x199bc
- ld hl, UnnamedText_199d7
+ ld hl, ReceivedTM41Text
call PrintText
ld hl, $d777
set 0, [hl]
jr .asm_c765a ; 0x199c7
.asm_7053f ; 0x199c9
- ld hl, UnnamedText_199dd
+ ld hl, TM41ExplanationText
call PrintText
.asm_c765a ; 0x199cf
jp TextScriptEnd
-UnnamedText_199d2: ; 0x199d2
- TX_FAR _UnnamedText_199d2
+TM41PreText: ; 0x199d2
+ TX_FAR _TM41PreText
db $50
; 0x199d2 + 5 bytes
-UnnamedText_199d7: ; 0x199d7
- TX_FAR _UnnamedText_199d7 ; 0xa5b5a
+ReceivedTM41Text: ; 0x199d7
+ TX_FAR _ReceivedTM41Text ; 0xa5b5a
db $0B, $50
; 0x199d7 + 6 bytes = 0x199dd
-UnnamedText_199dd: ; 0x199dd
- TX_FAR _UnnamedText_199dd
+TM41ExplanationText: ; 0x199dd
+ TX_FAR _TM41ExplanationText
db $50
; 0x199dd + 5 bytes
-UnnamedText_199e2: ; 0x199e2
- TX_FAR _UnnamedText_199e2
+TM41NoRoomText: ; 0x199e2
+ TX_FAR _TM41NoRoomText
db $50
; 0x199e2 + 5 bytes
@@ -14422,66 +15002,66 @@ FuchsiaCityText18: ; 0x19a8b
FuchsiaCityText19: ; 0x19a90
db $08 ; asm
- ld hl, UnnamedText_19a9f
+ ld hl, FuchsiaCityChanseyText
call PrintText
ld a, $28
call $349b
jp TextScriptEnd
-UnnamedText_19a9f: ; 0x19a9f
- TX_FAR _UnnamedText_19a9f
+FuchsiaCityChanseyText: ; 0x19a9f
+ TX_FAR _FuchsiaCityChanseyText
db $50
; 0x19a9f + 5 bytes
FuchsiaCityText20: ; 0x19aa4
db $08 ; asm
- ld hl, UnnamedText_19ab3
+ ld hl, FuchsiaCityVoltorbText
call PrintText
ld a, $6
call $349b
jp TextScriptEnd
-UnnamedText_19ab3: ; 0x19ab3
- TX_FAR _UnnamedText_19ab3
+FuchsiaCityVoltorbText: ; 0x19ab3
+ TX_FAR _FuchsiaCityVoltorbText
db $50
; 0x19ab3 + 5 bytes
FuchsiaCityText21: ; 0x19ab8
db $08 ; asm
- ld hl, UnnamedText_19ac7
+ ld hl, FuchsiaCityKangaskhanText
call PrintText
ld a, $2
call $349b
jp TextScriptEnd
-UnnamedText_19ac7: ; 0x19ac7
- TX_FAR _UnnamedText_19ac7
+FuchsiaCityKangaskhanText: ; 0x19ac7
+ TX_FAR _FuchsiaCityKangaskhanText
db $50
; 0x19ac7 + 5 bytes
FuchsiaCityText22: ; 0x19acc
db $08 ; asm
- ld hl, UnnamedText_19adb
+ ld hl, FuchsiaCitySlowpokeText
call PrintText
ld a, $25
call $349b
jp TextScriptEnd
-UnnamedText_19adb: ; 0x19adb
- TX_FAR _UnnamedText_19adb
+FuchsiaCitySlowpokeText: ; 0x19adb
+ TX_FAR _FuchsiaCitySlowpokeText
db $50
; 0x19adb + 5 bytes
FuchsiaCityText23: ; 0x19ae0
db $08 ; asm
- ld hl, UnnamedText_19aef
+ ld hl, FuchsiaCityLaprasText
call PrintText
ld a, $13
call $349b
jp TextScriptEnd
-UnnamedText_19aef: ; 0x19aef
- TX_FAR _UnnamedText_19aef
+FuchsiaCityLaprasText: ; 0x19aef
+ TX_FAR _FuchsiaCityLaprasText
db $50
; 0x19aef + 5 bytes
@@ -14496,12 +15076,12 @@ FuchsiaCityText24: ; 0x19af4
call PrintText
jr .asm_4343f ; 0x19b06
.asm_3b4e8 ; 0x19b08
- ld hl, UnnamedText_19b20
+ ld hl, FuchsiaCityOmanyteText
call PrintText
ld a, $62
jr .asm_81556 ; 0x19b10
.asm_667d5 ; 0x19b12
- ld hl, UnnamedText_19b25
+ ld hl, FuchsiaCityKabutoText
call PrintText
ld a, $5a
.asm_81556 ; 0x19b1a
@@ -14509,13 +15089,13 @@ FuchsiaCityText24: ; 0x19af4
.asm_4343f ; 0x19b1d
jp TextScriptEnd
-UnnamedText_19b20: ; 0x19b20
- TX_FAR _UnnamedText_19b20
+FuchsiaCityOmanyteText: ; 0x19b20
+ TX_FAR _FuchsiaCityOmanyteText
db $50
; 0x19b20 + 5 bytes
-UnnamedText_19b25: ; 0x19b25
- TX_FAR _UnnamedText_19b25
+FuchsiaCityKabutoText: ; 0x19b25
+ TX_FAR _FuchsiaCityKabutoText
db $50
; 0x19b25 + 5 bytes
@@ -14768,9 +15348,9 @@ SilphCo4_h: ; 0x19cff to 0x19d0b (12 bytes) (bank=6) (id=209)
dw SilphCo4Object ; objects
SilphCo4Script: ; 0x19d0b
- call $5d21
+ call SilphCo4Script_Unknown19d21
call $3c3c
- ld hl, $5dae
+ ld hl, SilphCo4TrainerHeaders
ld de, $5d9a
ld a, [$d645]
call $3160
@@ -14778,6 +15358,7 @@ SilphCo4Script: ; 0x19d0b
ret
; 0x19d21
+SilphCo4Script_Unknown19d21: ; 0x19d21
INCBIN "baserom.gbc",$19d21,$7f
SilphCo4Texts: ; 0x19da0
@@ -14942,7 +15523,7 @@ SilphCo5_h: ; 0x19f2b to 0x19f37 (12 bytes) (bank=6) (id=210)
SilphCo5Script: ; 0x19f37
call Unnamed_19f4d
call $3c3c
- ld hl, $5fd2
+ ld hl, SilphCo5TrainerHeaders
ld de, $5fb6
ld a, [$d646]
call $3160
@@ -15162,7 +15743,7 @@ SilphCo6_h: ; 0x1a19d to 0x1a1a9 (12 bytes) (bank=6) (id=211)
SilphCo6Script: ; 0x1a1a9
call Unnamed_1a1bf
call $3c3c
- ld hl, $620a
+ ld hl, SilphCo6TrainerHeaders
ld de, $61f0
ld a, [$d647]
call $3160
@@ -15176,6 +15757,7 @@ INCBIN "baserom.gbc",$1a1bf,$37
SilphCo6Texts: ; 0x1a1f6
dw SilphCo6Text1, SilphCo6Text2, SilphCo6Text3, SilphCo6Text4, SilphCo6Text5, SilphCo6Text6, SilphCo6Text7, SilphCo6Text8, SilphCo6Text9, SilphCo6Text10
+SilphCo6TrainerHeaders:
TrainerHeader_1a20a: ; 0x1a20a
db $6 ; flag's bit
db ($2 << 4) ; trainer's view range
@@ -17123,13 +17705,14 @@ ViridianMart_h: ; 0x1d462 to 0x1d46e (12 bytes) (bank=7) (id=42)
dw ViridianMartObject ; objects
ViridianMartScript: ; 0x1d46e
- call $547d
+ call ViridianMartScript_Unknown1d47d
call $3c3c
ld hl, $5495
ld a, [$d60d]
jp $3d97
; 0x1d47d
+ViridianMartScript_Unknown1d47d: ; 0x1d47d
INCBIN "baserom.gbc",$1d47d,$1e
ViridianMartScript0: ; 0x1d49b
@@ -18890,13 +19473,14 @@ PowerPlant_h: ; 0x1e2ba to 0x1e2c6 (12 bytes) (bank=7) (id=83)
PowerPlantScript: ; 0x1e2c6
call $3c3c
ld hl, $62fb
- ld de, $62d9
+ ld de, PowerPlantScript_Unknown1e2d9
ld a, [$d663]
call $3160
ld [$d663], a
ret
; 0x1e2d9
+PowerPlantScript_Unknown1e2d9: ; 0x1e2d9
INCBIN "baserom.gbc",$1e2d9,$6
PowerPlantTexts: ; 0x1e2df
@@ -18955,13 +19539,15 @@ PowerPlantText9: ; 0x1e3a4
db $8 ; asm
ld hl, $635b
jr asm_234cc ; 0x1e3a8 $be
- rla ; probably a TX_FAR
- ld [$ff00+c], a
- ld b, l
- inc hl
- ld d, b
- rla
- ld [$2345], a
+; 0x1e3aa
+
+UnnamedText_1e3aa: ; 0x1e3aa
+ TX_FAR _UnnamedText_1e3aa ; 0x8c5e2
+ db $50
+; 0x1e3af
+
+UnnamedText_1e3af: ; 0x1e3af
+ TX_FAR _UnnamedText_1e3af ; 0x8c5ea
db $8
ld a, $4b
call $13d0
@@ -28351,7 +28937,7 @@ Mansion1_h: ; 0x442a3 to 0x442af (12 bytes) (bank=11) (id=165)
Mansion1Script:
call Mansion1Subscript1
call $3c3c
- ld hl, $4334
+ ld hl, Mansion1TrainerHeaders
ld de, $4326
ld a, [$d63a]
call $3160
@@ -28389,8 +28975,9 @@ Mansion1Subscript1: ; 0x442c5
INCBIN "baserom.gbc",$44304,$4432c - $44304
Mansion1Texts: ; 0x4432c
-INCBIN "baserom.gbc",$4432c,$44334 - $4432c
+ dw Mansion1Text1, Mansion1Text2, Mansion1Text3, Mansion1Text4
+Mansion1TrainerHeaders:
TrainerHeader_44334: ; 0x44334
db $1 ; flag's bit
db ($3 << 4) ; trainer's view range
@@ -28424,9 +29011,9 @@ UnnamedText_44355: ; 0x44355
db $50
; 0x44355 + 5 bytes
-UnnamedText_4435a: ; 0x4435a
+Mansion1Text4: ; 0x4435a
db $8
- ld hl, $4395
+ ld hl, UnnamedText_44395
call PrintText
call $35ec
ld a, [$cc26]
@@ -28436,7 +29023,7 @@ UnnamedText_4435a: ; 0x4435a
ld [$cc3c], a
ld hl, $d126
set 5, [hl]
- ld hl, $439a
+ ld hl, UnnamedText_4439a
call PrintText
ld a, $ad
call $23b1
@@ -28447,7 +29034,7 @@ UnnamedText_4435a: ; 0x4435a
res 0, [hl]
jr .asm_44392 ; 0x4438a $6
.asm_4438c
- ld hl, $439f
+ ld hl, UnnamedText_4439f
call PrintText
.asm_44392
jp TextScriptEnd
@@ -28728,7 +29315,7 @@ SeafoamIslands1Script: ; 0x447e9
bit 7, [hl]
res 7, [hl]
jr z, .asm_4483b ; 0x447f8 $41
- ld hl, $4846
+ ld hl, SeafoamIslands1Script_Unknown44846
call $34e4
ret nc
ld hl, $d7e8
@@ -28759,10 +29346,11 @@ SeafoamIslands1Script: ; 0x447e9
.asm_4483b
ld a, $9f
ld [$d71d], a
- ld hl, $4846
+ ld hl, SeafoamIslands1Script_Unknown44846
jp $6981
; 0x44846
+SeafoamIslands1Script_Unknown44846: ; 0x44846
INCBIN "baserom.gbc",$44846,$5
SeafoamIslands1Texts: ; 0x4484b
@@ -28847,9 +29435,9 @@ VictoryRoad3_h: ; 0x44974 to 0x44980 (12 bytes) (bank=11) (id=198)
dw VictoryRoad3Object ; objects
VictoryRoad3Script: ; 0x44980
- call $4996
+ call VictoryRoad3Script_Unknown44996
call $3c3c
- ld hl, $4a38
+ ld hl, VictoryRoad3TrainerHeaders
ld de, $49b1
ld a, [$d640]
call $3160
@@ -28857,6 +29445,7 @@ VictoryRoad3Script: ; 0x44980
ret
; 0x44996
+VictoryRoad3Script_Unknown44996: ; 0x44996
INCBIN "baserom.gbc",$44996,$8e
VictoryRoad3Texts: ; 0x44a24
@@ -29032,7 +29621,7 @@ RocketHideout1_h: ; 0x44bbe to 0x44bca (12 bytes) (bank=11) (id=199)
RocketHideout1Script: ; 0x44bca
call Unknown_44be0
call $3c3c
- ld hl, $4c22
+ ld hl, RocketHideout1TrainerHeaders
ld de, $4c0e
ld a, [$d631]
call $3160
@@ -29253,14 +29842,15 @@ RocketHideout2_h: ; 0x44e1b to 0x44e27 (12 bytes) (bank=11) (id=200)
RocketHideout2Script: ; 0x44e27
call $3c3c
- ld hl, $50d1
- ld de, $4e3a
+ ld hl, RocketHideout2TrainerHeaders
+ ld de, RocketHideout2_Unknown44e3a
ld a, [$d632]
call $3160
ld [$d632], a
ret
; 0x44e3a
+RocketHideout2_Unknown44e3a: ; 0x44ea
INCBIN "baserom.gbc",$44e3a,$28d
RocketHideout2Texts: ; 0x450c7
@@ -29339,14 +29929,15 @@ RocketHideout3_h: ; 0x45219 to 0x45225 (12 bytes) (bank=11) (id=201)
RocketHideout3Script: ; 0x45225
call $3c3c
- ld hl, $5302
- ld de, $5238
+ ld hl, RocketHideout3TrainerHeaders
+ ld de, RocketHideout3Script_Unknown45238
ld a, [$d633]
call $3160
ld [$d633], a
ret
; 0x45238
+RocketHideout3Script_Unknown45238: ; 0x45238
INCBIN "baserom.gbc",$45238,$c2
RocketHideout3Texts: ; 0x452fa
@@ -29661,7 +30252,7 @@ RocketHideoutElevatorScript: ; 0x45710
bit 5, [hl]
res 5, [hl]
push hl
- call nz, $572c
+ call nz, RocketHideoutElevatorScript_Unknown4572c
pop hl
bit 7, [hl]
res 7, [hl]
@@ -29673,6 +30264,7 @@ RocketHideoutElevatorScript: ; 0x45710
ret
; 0x4572c
+RocketHideoutElevatorScript_Unknown4572c: ; 0x4572c
INCBIN "baserom.gbc",$4572c,$3f
RocketHideoutElevatorTexts: ; 0x4576b
@@ -29730,7 +30322,7 @@ SilphCoElevatorScript: ; 0x457c0
bit 5, [hl]
res 5, [hl]
push hl
- call nz, $57dc
+ call nz, SilphCoElevatorScript_Unknown457dc
pop hl
bit 7, [hl]
res 7, [hl]
@@ -29742,6 +30334,7 @@ SilphCoElevatorScript: ; 0x457c0
ret
; 0x457dc
+SilphCoElevatorScript_Unknown457dc: ; 0x457dc
INCBIN "baserom.gbc",$457dc,$57
SilphCoElevatorTexts: ; 0x45833
@@ -30196,14 +30789,15 @@ UnknownDungeon3_h: ; 0x45ee4 to 0x45ef0 (12 bytes) (bank=11) (id=227)
UnknownDungeon3Script: ; 0x45ef0
call $3c3c
- ld hl, $5f0f
- ld de, $5f03
+ ld hl, UnknownDungeon3TrainerHeaders
+ ld de, UnknownDungeon3Script_Unknown45f03
ld a, [$d650]
call $3160
ld [$d650], a
ret
; 0x45f03
+UnknownDungeon3Script_Unknown45f03: ; 0x45f03
INCBIN "baserom.gbc",$45f03,$6
UnknownDungeon3Texts: ; 0x45f09
@@ -30266,14 +30860,15 @@ RockTunnel2_h: ; 0x45fdf to 0x45feb (12 bytes) (bank=11) (id=232)
RockTunnel2Script: ; 0x45feb
call $3c3c
- ld hl, $6014
- ld de, $5ffe
+ ld hl, RockTunnel2TrainerHeaders
+ ld de, RockTunnel2Script_Unknown45ffe
ld a, [$d620]
call $3160
ld [$d620], a
ret
; 0x45ffe
+RockTunnel2Script_Unknown45ffe: ; 0x45ffe
INCBIN "baserom.gbc",$45ffe,$6
RockTunnel2Texts: ; 0x46004
@@ -30574,7 +31169,7 @@ SeafoamIslands2Script: ; 0x46315
bit 7, [hl]
res 7, [hl]
jr z, .asm_46362 ; 0x4631f $41
- ld hl, $636d
+ ld hl, SeafoamIslands2Script_Unknown4636d
call $34e4
ret nc
ld hl, $d87f
@@ -30605,10 +31200,11 @@ SeafoamIslands2Script: ; 0x46315
.asm_46362
ld a, $a0
ld [$d71d], a
- ld hl, $636d
+ ld hl, SeafoamIslands2Script_Unknown4636d
jp $6981
; 0x4636d
+SeafoamIslands2Script_Unknown4636d: ; 0x4636d
INCBIN "baserom.gbc",$4636d,$5
SeafoamIslands2Texts: ; 0x46372
@@ -30658,7 +31254,7 @@ SeafoamIslands3Script: ; 0x46451
bit 7, [hl]
res 7, [hl]
jr z, .asm_4649e ; 0x4645b $41
- ld hl, $64a9
+ ld hl, SeafoamIslands3Script_Unknown464a9
call $34e4
ret nc
ld hl, $d880
@@ -30689,10 +31285,11 @@ SeafoamIslands3Script: ; 0x46451
.asm_4649e
ld a, $a1
ld [$d71d], a
- ld hl, $64a9
+ ld hl, SeafoamIslands3Script_Unknown464a9
jp $6981
; 0x464a9
+SeafoamIslands3Script_Unknown464a9: ; 0x464a9
INCBIN "baserom.gbc",$464a9,$5
SeafoamIslands3Texts: ; 0x464ae
@@ -30742,7 +31339,7 @@ SeafoamIslands4Script: ; 0x4658d
bit 7, [hl]
res 7, [hl]
jr z, .asm_465dc ; 0x46597 $43
- ld hl, $65f6
+ ld hl, SeafoamIslands4Script_Unknown465f6
call $34e4
ret nc
ld hl, $d881
@@ -30774,7 +31371,7 @@ SeafoamIslands4Script: ; 0x4658d
.asm_465dc
ld a, $a2
ld [$d71d], a
- ld hl, $65f6
+ ld hl, SeafoamIslands4Script_Unknown465f6
call $6981
ld a, [$d732]
bit 4, a
@@ -30785,6 +31382,7 @@ SeafoamIslands4Script: ; 0x4658d
jp $3d97
; 0x465f6
+SeafoamIslands4Script_Unknown465f6: ; 0x465f6
INCBIN "baserom.gbc",$465f6,$465fb - $465f6
SeafoamIslands4Scripts: ; 0x465fb
@@ -30804,7 +31402,7 @@ SeafoamIslands4Script0: ; 0x46603
cp $f
ret nz
ld hl, $ccd3
- ld de, $6632
+ ld de, SeafoamIslands4Script0_Unknown46632
call $350c
dec a
ld [$cd38], a
@@ -30816,6 +31414,7 @@ SeafoamIslands4Script0: ; 0x46603
ret
; 0x46632
+SeafoamIslands4Script0_Unknown46632: ; 0x46632
INCBIN "baserom.gbc",$46632,$46639 - $46632
SeafoamIslands4Script1: ; 0x46639
@@ -31077,7 +31676,8 @@ Route7Script: ; 0x48152
jp $3c3c
; 0x48155
-INCBIN "baserom.gbc",$48155,$2
+; XXX
+db $57, $41
Route7Text1: ; 0x48157
TX_FAR _Route7Text1
@@ -31486,7 +32086,7 @@ CeladonMartElevatorScript: ; 0x48600
bit 5, [hl]
res 5, [hl]
push hl
- call nz, $461c
+ call nz, CeladonMartElevatorScript_Unknown4861c
pop hl
bit 7, [hl]
res 7, [hl]
@@ -31498,6 +32098,7 @@ CeladonMartElevatorScript: ; 0x48600
ret
; 0x4861c
+CeladonMartElevatorScript_Unknown4861c: ; 0x4861c
INCBIN "baserom.gbc",$4861c,$40
CeladonMartElevatorTexts: ; 0x4865c
@@ -31857,9 +32458,9 @@ CeladonGymScript: ; 0x4890a
ld hl, $d126
bit 6, [hl]
res 6, [hl]
- call nz, $4927
+ call nz, CeladonGymScript_Unknown48927
call $3c3c
- ld hl, $49bc
+ ld hl, CeladonGymTrainerHeaders
ld de, $494e
ld a, [$d5ff]
call $3160
@@ -31867,6 +32468,7 @@ CeladonGymScript: ; 0x4890a
ret
; 0x48927
+CeladonGymScript_Unknown48927: ; 0x48927
INCBIN "baserom.gbc",$48927,$7f
CeladonGymTexts: ; 0x489a6
@@ -36741,13 +37343,13 @@ VictoryRoad2Script: ; 0x5179d
ld hl, $d126
bit 6, [hl]
res 6, [hl]
- call nz, $57c4
+ call nz, VictoryRoad2Script_Unknown517c4
ld hl, $d126
bit 5, [hl]
res 5, [hl]
call nz, $57c9
call $3c3c
- ld hl, $5835
+ ld hl, VictoryRoad2TrainerHeaders
ld de, $57eb
ld a, [$d63f]
call $3160
@@ -36755,11 +37357,13 @@ VictoryRoad2Script: ; 0x5179d
ret
; 0x517c4
+VictoryRoad2Script_Unknown517c4: ; 0x517c4
INCBIN "baserom.gbc",$517c4,$57
VictoryRoad2Texts: ; 0x5181b
dw VictoryRoad2Text1, VictoryRoad2Text2, VictoryRoad2Text3, VictoryRoad2Text4, VictoryRoad2Text5, VictoryRoad2Text6, VictoryRoad2Text7, VictoryRoad2Text8, VictoryRoad2Text9, VictoryRoad2Text10, VictoryRoad2Text11, VictoryRoad2Text12, VictoryRoad2Text13
+VictoryRoad2TrainerHeaders:
TrainerHeader_51835: ; 0x51835
db $1 ; flag's bit
db ($4 << 4) ; trainer's view range
@@ -37043,9 +37647,9 @@ SilphCo7_h: ; 0x51b55 to 0x51b61 (12 bytes) (id=212)
dw SilphCo7Object ; objects
SilphCo7Script: ; 0x51b61
- call $5b77
+ call SilphCo7Script_Unknown51b77
call $3c3c
- ld hl, $5d5d
+ ld hl, SilphCo7TrainerHeaders
ld de, $5c17
ld a, [$d648]
call $3160
@@ -37053,11 +37657,13 @@ SilphCo7Script: ; 0x51b61
ret
; 0x51b77
+SilphCo7Script_Unknown51b77: ; 0x5177
INCBIN "baserom.gbc",$51b77,$1c8
SilphCo7Texts: ; 0x51d3f
dw SilphCo7Text1, SilphCo7Text2, SilphCo7Text3, SilphCo7Text4, SilphCo7Text5, SilphCo7Text6, SilphCo7Text7, SilphCo7Text8, SilphCo7Text9, SilphCo7Text10, SilphCo7Text11, SilphCo7Text12, SilphCo7Text13, SilphCo7Text14, SilphCo7Text15
+SilphCo7TrainerHeaders:
TrainerHeader_51d5d: ; 0x51d5d
db $5 ; flag's bit
db ($2 << 4) ; trainer's view range
@@ -37386,9 +37992,9 @@ Mansion2_h: ; 0x51fcc to 0x51fd8 (12 bytes) (id=214)
dw Mansion2Object ; objects
Mansion2Script:
- call $5fee
+ call Mansion2Script_Unknown51fee
call $3c3c
- ld hl, $6057
+ ld hl, Mansion2TrainerHeaders
ld de, $6047
ld a, [$d63c]
call $3160
@@ -37396,6 +38002,7 @@ Mansion2Script:
ret
; 0x51fee
+Mansion2Script_Unknown51fee: ; 0x51fee
INCBIN "baserom.gbc",$51fee,$5204d - $51fee
Mansion2Texts: ; 0x5204d
@@ -39122,7 +39729,7 @@ Route5Text1: ; 0x556b7
Route9Script: ; 0x556bc
call $3c3c
- ld hl, $56eb
+ ld hl, Route9TrainerHeaders
ld de, Unknown_556cf
ld a, [$d604]
call $3160
@@ -39418,19 +40025,21 @@ Route9Text11: ; 0x55819
Route13Script: ; 0x5581e
call $3c3c
- ld hl, $5851
- ld de, $5831
+ ld hl, Route13TrainerHeaders
+ ld de, Route13Script_Unknown55831
ld a, [$d61a]
call $3160
ld [$d61a], a
ret
; 0x55831
+Route13Script_Unknown55831: ; 0x55831
INCBIN "baserom.gbc",$55831,$6
Route13Texts: ; 0x55837
dw Route13Text1, Route13Text2, Route13Text3, Route13Text4, Route13Text5, Route13Text6, Route13Text7, Route13Text8, Route13Text9, Route13Text10, Route13Text11, Route13Text12, Route13Text13
+Route13TrainerHeaders:
TrainerHeader_55851: ; 0x55851
db $1 ; flag's bit
db ($2 << 4) ; trainer's view range
@@ -43016,7 +43625,7 @@ Route10Text10: ; 0x59447
Route11Script: ; 0x5944c
call $3c3c
- ld hl, $547b
+ ld hl, Route11TrainerHeaders
ld de, Route11_Unknown5945f
ld a, [$d623]
call $3160
@@ -44494,7 +45103,7 @@ SilphCo2_h: ; 0x59ce5 to 0x59cf1 (12 bytes) (id=207)
dw SilphCo2Object ; objects
SilphCo2Script: ; 0x59cf1
- call $5d07
+ call SilphCo2_Unknown59d07
call $3c3c
ld hl, SilphCo2TrainerHeaders
ld de, $5d80
@@ -44504,6 +45113,7 @@ SilphCo2Script: ; 0x59cf1
ret
; 0x59d07
+SilphCo2_Unknown59d07: ; 0x59d07
INCBIN "baserom.gbc",$59d07,$7f
SilphCo2Texts: ; 0x59d86
@@ -45683,7 +46293,7 @@ PewterGymScript: ; 0x5c387
ld hl, $d126
bit 6, [hl]
res 6, [hl]
- call nz, $43a4
+ call nz, PewterGymScript_Unknown5c3a4
call $3c3c
ld hl, PewterGymTrainerHeaders
ld de, $43ca
@@ -45693,6 +46303,7 @@ PewterGymScript: ; 0x5c387
ret
; 0x5c3a4
+PewterGymScript_Unknown5c3a4: ; 0x5c3a4
INCBIN "baserom.gbc",$5c3a4,$91
PewterGymTexts: ; 0x5c435
@@ -46133,7 +46744,7 @@ CeruleanGymText5: ; 0x5c7c8
; 0x5c7c8 + 5 bytes
CeruleanGymText6: ; 0x5c7cd
-ReceivedTM11Text: ; 05c7cd
+ReceivedTM11Text: ; 0x5c7cd
TX_FAR _ReceivedTM11Text ; 0x98b7d
db $0B, $50
; 0x5c7cd + 6 bytes = 0x5c7d3
@@ -46865,7 +47476,7 @@ FightingDojo_h: ; 0x5cd51 to 0x5cd5d (12 bytes) (id=177)
FightingDojoScript: ; 0x5cd5d
call $3c3c
- ld hl, FightingDojoTrainerHeader1
+ ld hl, FightingDojoTrainerHeaders
ld de, $4d7b
ld a, [$d642]
call $3160
@@ -50384,10 +50995,11 @@ SSAnne7_h: ; 0x61889 to 0x61895 (12 bytes) (id=101)
dw SSAnne7Object ; objects
SSAnne7Script: ; 0x61895
- call $589b
+ call SSAnne7Script_Unknown6189b
jp $3c3c
; 0x6189b
+SSAnne7Script_Unknown6189b: ; 0x6189b
INCBIN "baserom.gbc",$6189b,$c
SSAnne7Texts: ; 0x618a7
@@ -50507,42 +51119,84 @@ SSAnne8_h: ; 0x6196a to 0x61976 (12 bytes) (id=102)
SSAnne8Script: ; 0x61976
call $3c3c
- ld hl, $59a5
- ld de, $5989
+ ld hl, SSAnne8TrainerHeaders
+ ld de, SSAnne8Script_Unknown61989
ld a, [$d608]
call $3160
ld [$d608], a
ret
; 0x61989
+SSAnne8Script_Unknown61989: ; 0x61989
INCBIN "baserom.gbc",$61989,$6
SSAnne8Texts: ; 0x6198f
dw SSAnne8Text1, SSAnne8Text2, SSAnne8Text3, SSAnne8Text4, SSAnne8Text5, SSAnne8Text6, SSAnne8Text7, SSAnne8Text8, SSAnne8Text9, SSAnne8Text10, SSAnne8Text11
-INCBIN "baserom.gbc",$619a5,$31
+SSAnne8TrainerHeaders:
+SSAnne8TrainerHeader1: ; 0x619a5
+ db $1 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d805 ; flag's byte
+ dw UnnamedText_61a0b ; 0x5a0b TextBeforeBattle
+ dw UnnamedText_61a15 ; 0x5a15 TextAfterBattle
+ dw UnnamedText_61a10 ; 0x5a10 TextEndBattle
+ dw UnnamedText_61a10 ; 0x5a10 TextEndBattle
+; 0x619b1
+
+TrainerHeader_619b1: ; 0x619b1
+ db $2 ; flag's bit
+ db ($3 << 4) ; trainer's view range
+ dw $d805 ; flag's byte
+ dw UnnamedText_61a1a ; 0x5a1a TextBeforeBattle
+ dw UnnamedText_5a24 ; 0x5a24 TextAfterBattle
+ dw UnnamedText_61a1f ; 0x5a1f TextEndBattle
+ dw UnnamedText_61a1f ; 0x5a1f TextEndBattle
+; 0x619bd
+
+TrainerHeader_619bd: ; 0x619bd
+ db $3 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d805 ; flag's byte
+ dw UnnamedText_61a29 ; 0x5a29 TextBeforeBattle
+ dw UnnamedText_61a33 ; 0x5a33 TextAfterBattle
+ dw UnnamedText_61a2e ; 0x5a2e TextEndBattle
+ dw UnnamedText_61a2e ; 0x5a2e TextEndBattle
+; 0x619c9
+
+TrainerHeader_619c9: ; 0x619c9
+ db $4 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d805 ; flag's byte
+ dw UnnamedText_61a38 ; 0x5a38 TextBeforeBattle
+ dw UnnamedText_61a42 ; 0x5a42 TextAfterBattle
+ dw UnnamedText_61a3d ; 0x5a3d TextEndBattle
+ dw UnnamedText_61a3d ; 0x5a3d TextEndBattle
+; 0x619d5
+
+db $ff
SSAnne8Text1: ; 0x619d6
db $08 ; asm
- ld hl, $59a5
+ ld hl, SSAnne8TrainerHeader1
call LoadTrainerHeader
jp TextScriptEnd
SSAnne8Text2: ; 0x619e0
db $08 ; asm
- ld hl, $59b1
+ ld hl, TrainerHeader_619b1
call LoadTrainerHeader
jp TextScriptEnd
SSAnne8Text3: ; 0x619ea
db $08 ; asm
- ld hl, $59bd
+ ld hl, TrainerHeader_619bd
call LoadTrainerHeader
jp TextScriptEnd
SSAnne8Text4: ; 0x619f4
db $08 ; asm
- ld hl, $59c9
+ ld hl, TrainerHeader_619c9
call LoadTrainerHeader
jp TextScriptEnd
@@ -50683,42 +51337,85 @@ SSAnne9Script: ; 0x61b4b
ld [$cf0c], a
xor a
ld [$cc3c], a
- ld hl, $5b84
- ld de, $5b64
+ ld hl, SSAnne9TrainerHeaders
+ ld de, SSAnne9Script_Unknown61b64
ld a, [$d609]
call $3160
ld [$d609], a
ret
; 0x61b64
+SSAnne9Script_Unknown61b64: ; 0x61b64
INCBIN "baserom.gbc",$61b64,$6
SSAnne9Texts: ; 0x61b6a
dw SSAnne9Text1, SSAnne9Text2, SSAnne9Text3, SSAnne9Text4, SSAnne9Text5, SSAnne9Text6, SSAnne9Text7, SSAnne9Text8, SSAnne9Text9, SSAnne9Text10, SSAnne9Text11, SSAnne9Text12, SSAnne9Text13
-INCBIN "baserom.gbc",$61b84,$31
+SSAnne9TrainerHeaders:
+SSAnne9TrainerHeader1: ; 0x61b84
+ db $1 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d807 ; flag's byte
+ dw UnnamedText_61c51 ; 0x5c51 TextBeforeBattle
+ dw UnnamedText_61c5b ; 0x5c5b TextAfterBattle
+ dw UnnamedText_61c56 ; 0x5c56 TextEndBattle
+ dw UnnamedText_61c56 ; 0x5c56 TextEndBattle
+; 0x61b90
+
+TrainerHeader_61b90: ; 0x61b90
+ db $2 ; flag's bit
+ db ($3 << 4) ; trainer's view range
+ dw $d807 ; flag's byte
+ dw UnnamedText_61c60 ; 0x5c60 TextBeforeBattle
+ dw UnnamedText_61c6a ; 0x5c6a TextAfterBattle
+ dw UnnamedText_61c65 ; 0x5c65 TextEndBattle
+ dw UnnamedText_61c65 ; 0x5c65 TextEndBattle
+; 0x61b9c
+
+TrainerHeader_61b9c: ; 0x61b9c
+ db $3 ; flag's bit
+ db ($3 << 4) ; trainer's view range
+ dw $d807 ; flag's byte
+ dw UnnamedText_61c6f ; 0x5c6f TextBeforeBattle
+ dw UnnamedText_61c79 ; 0x5c79 TextAfterBattle
+ dw UnnamedText_61c74 ; 0x5c74 TextEndBattle
+ dw UnnamedText_61c74 ; 0x5c74 TextEndBattle
+; 0x61ba8
+
+TrainerHeader_61ba8: ; 0x61ba8
+ db $4 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d807 ; flag's byte
+ dw UnnamedText_61c7e ; 0x5c7e TextBeforeBattle
+ dw UnnamedText_61c88 ; 0x5c88 TextAfterBattle
+ dw UnnamedText_61c83 ; 0x5c83 TextEndBattle
+ dw UnnamedText_61c83 ; 0x5c83 TextEndBattle
+; 0x61bb4
+
+
+db $ff
SSAnne9Text1: ; 0x61bb5
db $08 ; asm
- ld hl, $5b84
+ ld hl, SSAnne9TrainerHeader1
call LoadTrainerHeader
jp TextScriptEnd
SSAnne9Text2: ; 0x61bbf
db $08 ; asm
- ld hl, $5b90
+ ld hl, TrainerHeader_61b90
call LoadTrainerHeader
jp TextScriptEnd
SSAnne9Text3: ; 0x61bc9
db $08 ; asm
- ld hl, $5b9c
+ ld hl, TrainerHeader_61b9c
call LoadTrainerHeader
jp TextScriptEnd
SSAnne9Text4: ; 0x61bd3
db $08 ; asm
- ld hl, $5ba8
+ ld hl, TrainerHeader_61ba8
call LoadTrainerHeader
jp TextScriptEnd
@@ -50921,54 +51618,116 @@ SSAnne10_h: ; 0x61d49 to 0x61d55 (12 bytes) (id=104)
SSAnne10Script: ; 0x61d55
call $3c3c
- ld hl, $5d84
- ld de, $5d68
+ ld hl, SSAnne10TrainerHeaders
+ ld de, SSAnne10Script_Unknown61d68
ld a, [$d629]
call $3160
ld [$d629], a
ret
; 0x61d68
+SSAnne10Script_Unknown61d68: ; 0x61d68
INCBIN "baserom.gbc",$61d68,$6
SSAnne10Texts: ; 0x61d6e
dw SSAnne10Text1, SSAnne10Text2, SSAnne10Text3, SSAnne10Text4, SSAnne10Text5, SSAnne10Text6, SSAnne10Text7, SSAnne10Text8, SSAnne10Text9, SSAnne10Text10, SSAnne10Text11
-INCBIN "baserom.gbc",$61d84,$49
+SSAnne10TrainerHeaders:
+SSAnne10TrainerHeader1: ; 0x61d84
+ db $1 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d809 ; flag's byte
+ dw UnnamedText_61e16 ; 0x5e16 TextBeforeBattle
+ dw UnnamedText_61e20 ; 0x5e20 TextAfterBattle
+ dw UnnamedText_61e1b ; 0x5e1b TextEndBattle
+ dw UnnamedText_61e1b ; 0x5e1b TextEndBattle
+; 0x61d90
+
+TrainerHeader_61d90: ; 0x61d90
+ db $2 ; flag's bit
+ db ($3 << 4) ; trainer's view range
+ dw $d809 ; flag's byte
+ dw UnnamedText_61e25 ; 0x5e25 TextBeforeBattle
+ dw UnnamedText_61e2f ; 0x5e2f TextAfterBattle
+ dw UnnamedText_61e2a ; 0x5e2a TextEndBattle
+ dw UnnamedText_61e2a ; 0x5e2a TextEndBattle
+; 0x61d9c
+
+TrainerHeader_61d9c: ; 0x61d9c
+ db $3 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d809 ; flag's byte
+ dw UnnamedText_61e34 ; 0x5e34 TextBeforeBattle
+ dw UnnamedText_61e3e ; 0x5e3e TextAfterBattle
+ dw UnnamedText_61e39 ; 0x5e39 TextEndBattle
+ dw UnnamedText_61e39 ; 0x5e39 TextEndBattle
+; 0x61da8
+
+TrainerHeader_61da8: ; 0x61da8
+ db $4 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d809 ; flag's byte
+ dw UnnamedText_61e43 ; 0x5e43 TextBeforeBattle
+ dw UnnamedText_61e4d ; 0x5e4d TextAfterBattle
+ dw UnnamedText_61e48 ; 0x5e48 TextEndBattle
+ dw UnnamedText_61e48 ; 0x5e48 TextEndBattle
+; 0x61db4
+
+TrainerHeader_61db4: ; 0x61db4
+ db $5 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d809 ; flag's byte
+ dw UnnamedText_61e52 ; 0x5e52 TextBeforeBattle
+ dw UnnamedText_61e5c ; 0x5e5c TextAfterBattle
+ dw UnnamedText_61e57 ; 0x5e57 TextEndBattle
+ dw UnnamedText_61e57 ; 0x5e57 TextEndBattle
+; 0x61dc0
+
+TrainerHeader_61dc0: ; 0x61dc0
+ db $6 ; flag's bit
+ db ($3 << 4) ; trainer's view range
+ dw $d809 ; flag's byte
+ dw UnnamedText_61e61 ; 0x5e61 TextBeforeBattle
+ dw UnnamedText_61e6b ; 0x5e6b TextAfterBattle
+ dw UnnamedText_61e66 ; 0x5e66 TextEndBattle
+ dw UnnamedText_61e66 ; 0x5e66 TextEndBattle
+; 0x61dcc
+
+db $ff
SSAnne10Text1: ; 0x61dcd
db $08 ; asm
- ld hl, $5d84
+ ld hl, SSAnne10TrainerHeader1
call LoadTrainerHeader
jp TextScriptEnd
SSAnne10Text2: ; 0x61dd7
db $08 ; asm
- ld hl, $5d90
+ ld hl, TrainerHeader_61d90
call LoadTrainerHeader
jp TextScriptEnd
SSAnne10Text3: ; 0x61de1
db $08 ; asm
- ld hl, $5d9c
+ ld hl, TrainerHeader_61d9c
call LoadTrainerHeader
jp TextScriptEnd
SSAnne10Text4: ; 0x61deb
db $08 ; asm
- ld hl, $5da8
+ ld hl, TrainerHeader_61da8
call LoadTrainerHeader
jp TextScriptEnd
SSAnne10Text5: ; 0x61df5
db $08 ; asm
- ld hl, $5db4
+ ld hl, TrainerHeader_61db4
call LoadTrainerHeader
jp TextScriptEnd
SSAnne10Text6: ; 0x61dff
db $08 ; asm
- ld hl, $5dc0
+ ld hl, TrainerHeader_61dc0
call LoadTrainerHeader
jp TextScriptEnd
@@ -51128,8 +51887,7 @@ UndergroundPathNSScript: ; 0x61f26
; 0x61f29
UndergroundPathNSTexts:
-
-INCBIN "baserom.gbc",$61f29,$1
+ db $50
UndergroundPathNSObject: ; 0x61f2a (size=20)
db $1 ; border tile
@@ -51218,9 +51976,9 @@ SilphCo11_h: ; 0x620ee to 0x620fa (12 bytes) (id=235)
dw SilphCo11Object ; objects
SilphCo11Script: ; 0x620fa
- call $6110
+ call SilphCo11Script_Unknown62110
call $3c3c
- ld hl, $62c3
+ ld hl, SilphCo11TrainerHeaders
ld de, $61cf
ld a, [$d659]
call $3160
@@ -51228,12 +51986,34 @@ SilphCo11Script: ; 0x620fa
ret
; 0x62110
+SilphCo11Script_Unknown62110: ; 0x62110
INCBIN "baserom.gbc",$62110,$1a7
SilphCo11Texts: ; 0x622b7
dw SilphCo11Text1, SilphCo11Text2, SilphCo11Text3, SilphCo11Text4, SilphCo11Text5, SilphCo11Text6
-INCBIN "baserom.gbc",$622c3,$19
+SilphCo11TrainerHeaders:
+SilphCo11TrainerHeader1: ; 0x622c3
+ db $4 ; flag's bit
+ db ($4 << 4) ; trainer's view range
+ dw $d837 ; flag's byte
+ dw UnnamedText_62344 ; 0x6344 TextBeforeBattle
+ dw UnnamedText_6234e ; 0x634e TextAfterBattle
+ dw UnnamedText_62349 ; 0x6349 TextEndBattle
+ dw UnnamedText_62349 ; 0x6349 TextEndBattle
+; 0x622cf
+
+TrainerHeader_622cf: ; 0x622cf
+ db $5 ; flag's bit
+ db ($3 << 4) ; trainer's view range
+ dw $d837 ; flag's byte
+ dw UnnamedText_6235d ; 0x635d TextBeforeBattle
+ dw UnnamedText_62367 ; 0x6367 TextAfterBattle
+ dw UnnamedText_62362 ; 0x6362 TextEndBattle
+ dw UnnamedText_62362 ; 0x6362 TextEndBattle
+; 0x622db
+
+db $ff
SilphCo11Text1: ; 0x622dc
db $08 ; asm
@@ -51300,7 +52080,7 @@ SilphCo11Text6: ; 0x62335
SilphCo11Text4: ; 0x6233a
db $08 ; asm
- ld hl, $62c3
+ ld hl, SilphCo11TrainerHeader1
call LoadTrainerHeader
jp TextScriptEnd
@@ -51321,7 +52101,7 @@ UnnamedText_6234e: ; 0x6234e
SilphCo11Text5: ; 0x62353
db $08 ; asm
- ld hl, $62cf
+ ld hl, TrainerHeader_622cf
call LoadTrainerHeader
jp TextScriptEnd
@@ -51340,7 +52120,14 @@ UnnamedText_62367: ; 0x62367
db $50
; 0x62367 + 5 bytes
-INCBIN "baserom.gbc",$6236c,$6237b - $6236c
+UnknownText_6236c: ; 0x6236c
+ db $8
+ ld hl, UnnamedText_6237b
+ call PrintText
+ ld a, $aa
+ call $349b
+ jp TextScriptEnd
+; 0x6237b
UnnamedText_6237b: ; 0x6237b
TX_FAR _UnnamedText_6237b
@@ -51453,7 +52240,17 @@ UnnamedText_624df: ; 0x624df
db $50
; 0x624df + 5 bytes
-INCBIN "baserom.gbc",$624e4,$624f8 - $624e4
+UnnamedText_624e4: ; 0x624e4
+ db $8
+ ld a, [$d838]
+ bit 7, a
+ ld hl, UnnamedText_624fd
+ jr nz, .asm_624f2 ; 0x624ed $3
+ ld hl, UnnamedText_624f8
+.asm_624f2
+ call PrintText
+ jp TextScriptEnd
+; 0x624f8
UnnamedText_624f8: ; 0x624f8
TX_FAR _UnnamedText_624f8
@@ -52882,7 +53679,7 @@ ViridianGymScript: ; 0x748a3
ld de, Gym8LeaderName
call $317f
call $3c3c
- ld hl, $4a08
+ ld hl, ViridianGymTrainerHeaders
ld de, $48e1
ld a, [$d5fb]
call $3160
@@ -52900,7 +53697,88 @@ INCBIN "baserom.gbc",$748D6,$116
ViridianGymTexts: ; 0x749ec
dw ViridianGymText1, ViridianGymText2, ViridianGymText3, ViridianGymText4, ViridianGymText5, ViridianGymText6, ViridianGymText7, ViridianGymText8, ViridianGymText9, ViridianGymText10, ViridianGymText11, ViridianGymText12, ViridianGymText13, ViridianGymText14
-INCBIN "baserom.gbc",$74a08,$61
+ViridianGymTrainerHeaders:
+ViridianGymTrainerHeader1: ; 0x74a08
+ db $2 ; flag's bit
+ db ($4 << 4) ; trainer's view range
+ dw $d751 ; flag's byte
+ dw UnnamedText_74afd ; 0x4afd TextBeforeBattle
+ dw UnnamedText_74b07 ; 0x4b07 TextAfterBattle
+ dw UnnamedText_74b02 ; 0x4b02 TextEndBattle
+ dw UnnamedText_74b02 ; 0x4b02 TextEndBattle
+; 0x74a14
+
+TrainerHeader_74a14: ; 0x74a14
+ db $3 ; flag's bit
+ db ($4 << 4) ; trainer's view range
+ dw $d751 ; flag's byte
+ dw UnnamedText_74b16 ; 0x4b16 TextBeforeBattle
+ dw UnnamedText_74b20 ; 0x4b20 TextAfterBattle
+ dw UnnamedText_74b1b ; 0x4b1b TextEndBattle
+ dw UnnamedText_74b1b ; 0x4b1b TextEndBattle
+; 0x74a20
+
+TrainerHeader_74a20: ; 0x74a20
+ db $4 ; flag's bit
+ db ($4 << 4) ; trainer's view range
+ dw $d751 ; flag's byte
+ dw UnnamedText_74b2f ; 0x4b2f TextBeforeBattle
+ dw UnnamedText_74b39 ; 0x4b39 TextAfterBattle
+ dw UnnamedText_74b34 ; 0x4b34 TextEndBattle
+ dw UnnamedText_74b34 ; 0x4b34 TextEndBattle
+; 0x74a2c
+
+TrainerHeader_74a2c: ; 0x74a2c
+ db $5 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d751 ; flag's byte
+ dw UnnamedText_74b48 ; 0x4b48 TextBeforeBattle
+ dw UnnamedText_74b52 ; 0x4b52 TextAfterBattle
+ dw UnnamedText_74b4d ; 0x4b4d TextEndBattle
+ dw UnnamedText_74b4d ; 0x4b4d TextEndBattle
+; 0x74a38
+
+TrainerHeader_74a38: ; 0x74a38
+ db $6 ; flag's bit
+ db ($3 << 4) ; trainer's view range
+ dw $d751 ; flag's byte
+ dw UnnamedText_74b61 ; 0x4b61 TextBeforeBattle
+ dw UnnamedText_74b6b ; 0x4b6b TextAfterBattle
+ dw UnnamedText_74b66 ; 0x4b66 TextEndBattle
+ dw UnnamedText_74b66 ; 0x4b66 TextEndBattle
+; 0x74a44
+
+TrainerHeader_74a44: ; 0x74a44
+ db $7 ; flag's bit
+ db ($4 << 4) ; trainer's view range
+ dw $d751 ; flag's byte
+ dw UnnamedText_74b7a ; 0x4b7a TextBeforeBattle
+ dw UnnamedText_74b84 ; 0x4b84 TextAfterBattle
+ dw UnnamedText_74b7f ; 0x4b7f TextEndBattle
+ dw UnnamedText_74b7f ; 0x4b7f TextEndBattle
+; 0x74a50
+
+TrainerHeader_74a50: ; 0x74a50
+ db $8 ; flag's bit
+ db ($3 << 4) ; trainer's view range
+ dw $d751 ; flag's byte
+ dw UnnamedText_74b93 ; 0x4b93 TextBeforeBattle
+ dw UnnamedText_74b9d ; 0x4b9d TextAfterBattle
+ dw UnnamedText_74b98 ; 0x4b98 TextEndBattle
+ dw UnnamedText_74b98 ; 0x4b98 TextEndBattle
+; 0x74a5c
+
+TrainerHeader_74a5c: ; 0x74a5c
+ db $9 ; flag's bit
+ db ($4 << 4) ; trainer's view range
+ dw $d751 ; flag's byte
+ dw UnnamedText_74bac ; 0x4bac TextBeforeBattle
+ dw UnnamedText_74bb6 ; 0x4bb6 TextAfterBattle
+ dw UnnamedText_74bb1 ; 0x4bb1 TextEndBattle
+ dw UnnamedText_74bb1 ; 0x4bb1 TextEndBattle
+; 0x74a68
+
+db $ff
ViridianGymText1: ; 0x74a69
db $08 ; asm
@@ -52981,7 +53859,7 @@ ViridianGymText14: ; 0x74aee
ViridianGymText2: ; 0x74af3
db $08 ; asm
- ld hl, $4a08
+ ld hl, ViridianGymTrainerHeader1
call LoadTrainerHeader
jp TextScriptEnd
@@ -53002,7 +53880,7 @@ UnnamedText_74b07: ; 0x74b07
ViridianGymText3: ; 0x74b0c
db $08 ; asm
- ld hl, $4a14
+ ld hl, TrainerHeader_74a14
call LoadTrainerHeader
jp TextScriptEnd
@@ -53023,7 +53901,7 @@ UnnamedText_74b20: ; 0x74b20
ViridianGymText4: ; 0x74b25
db $08 ; asm
- ld hl, $4a20
+ ld hl, TrainerHeader_74a20
call LoadTrainerHeader
jp TextScriptEnd
@@ -53044,7 +53922,7 @@ UnnamedText_74b39: ; 0x74b39
ViridianGymText5: ; 0x74b3e
db $08 ; asm
- ld hl, $4a2c
+ ld hl, TrainerHeader_74a2c
call LoadTrainerHeader
jp TextScriptEnd
@@ -53065,7 +53943,7 @@ UnnamedText_74b52: ; 0x74b52
ViridianGymText6: ; 0x74b57
db $08 ; asm
- ld hl, $4a38
+ ld hl, TrainerHeader_74a38
call LoadTrainerHeader
jp TextScriptEnd
@@ -53086,7 +53964,7 @@ UnnamedText_74b6b: ; 0x74b6b
ViridianGymText7: ; 0x74b70
db $08 ; asm
- ld hl, $4a44
+ ld hl, TrainerHeader_74a44
call LoadTrainerHeader
jp TextScriptEnd
@@ -53107,7 +53985,7 @@ UnnamedText_74b84: ; 0x74b84
ViridianGymText8: ; 0x74b89
db $08 ; asm
- ld hl, $4a50
+ ld hl, TrainerHeader_74a50
call LoadTrainerHeader
jp TextScriptEnd
@@ -53128,7 +54006,7 @@ UnnamedText_74b9d: ; 0x74b9d
ViridianGymText9: ; 0x74ba2
db $08 ; asm
- ld hl, $4a5c
+ ld hl, TrainerHeader_74a5c
call LoadTrainerHeader
jp TextScriptEnd
@@ -54094,9 +54972,9 @@ FuchsiaGym_h: ; 0x75431 to 0x7543d (12 bytes) (id=157)
dw FuchsiaGymObject ; objects
FuchsiaGymScript: ; 0x7543d
- call $5453
+ call FuchsiaGymScript_Unknown75453
call $3c3c
- ld hl, $54eb
+ ld hl, FuchsiaGymTrainerHeaders
ld de, $5482
ld a, [$d65b]
call $3160
@@ -54104,6 +54982,7 @@ FuchsiaGymScript: ; 0x7543d
ret
; 0x75453
+FuchsiaGymScript_Unknown75453: ; 0x75453
INCBIN "baserom.gbc",$75453,$12
Gym5CityName: ; 0x75465
@@ -54116,7 +54995,68 @@ INCBIN "baserom.gbc",$75477,$5E
FuchsiaGymTexts: ; 0x754d5
dw FuchsiaGymText1, FuchsiaGymText2, FuchsiaGymText3, FuchsiaGymText4, FuchsiaGymText5, FuchsiaGymText6, FuchsiaGymText7, FuchsiaGymText8, FuchsiaGymText9, FuchsiaGymText10, FuchsiaGymText11
-INCBIN "baserom.gbc",$754eb,$49
+FuchsiaGymTrainerHeaders:
+FuchsiaGymTrainerHeader1: ; 0x754eb
+ db $2 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d792 ; flag's byte
+ dw UnnamedText_755ae ; 0x55ae TextBeforeBattle
+ dw UnnamedText_755b8 ; 0x55b8 TextAfterBattle
+ dw UnnamedText_755b3 ; 0x55b3 TextEndBattle
+ dw UnnamedText_755b3 ; 0x55b3 TextEndBattle
+; 0x754f7
+
+TrainerHeader_754f7: ; 0x754f7
+ db $3 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d792 ; flag's byte
+ dw UnnamedText_755c7 ; 0x55c7 TextBeforeBattle
+ dw UnnamedText_755d1 ; 0x55d1 TextAfterBattle
+ dw UnnamedText_755cc ; 0x55cc TextEndBattle
+ dw UnnamedText_755cc ; 0x55cc TextEndBattle
+; 0x75503
+
+TrainerHeader_75503: ; 0x75503
+ db $4 ; flag's bit
+ db ($4 << 4) ; trainer's view range
+ dw $d792 ; flag's byte
+ dw UnnamedText_755e0 ; 0x55e0 TextBeforeBattle
+ dw UnnamedText_755ea ; 0x55ea TextAfterBattle
+ dw UnnamedText_755e5 ; 0x55e5 TextEndBattle
+ dw UnnamedText_755e5 ; 0x55e5 TextEndBattle
+; 0x7550f
+
+TrainerHeader_7550f: ; 0x7550f
+ db $5 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d792 ; flag's byte
+ dw UnnamedText_755f9 ; 0x55f9 TextBeforeBattle
+ dw UnnamedText_75603 ; 0x5603 TextAfterBattle
+ dw UnnamedText_755fe ; 0x55fe TextEndBattle
+ dw UnnamedText_755fe ; 0x55fe TextEndBattle
+; 0x7551b
+
+TrainerHeader_7551b: ; 0x7551b
+ db $6 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d792 ; flag's byte
+ dw UnnamedText_75612 ; 0x5612 TextBeforeBattle
+ dw UnnamedText_7561c ; 0x561c TextAfterBattle
+ dw UnnamedText_75617 ; 0x5617 TextEndBattle
+ dw UnnamedText_75617 ; 0x5617 TextEndBattle
+; 0x75527
+
+TrainerHeader_75527: ; 0x75527
+ db $7 ; flag's bit
+ db ($2 << 4) ; trainer's view range
+ dw $d792 ; flag's byte
+ dw UnnamedText_7562b ; 0x562b TextBeforeBattle
+ dw UnnamedText_75635 ; 0x5635 TextAfterBattle
+ dw UnnamedText_75630 ; 0x5630 TextEndBattle
+ dw UnnamedText_75630 ; 0x5630 TextEndBattle
+; 0x75533
+
+db $ff
FuchsiaGymText1: ; 0x75534
db $08 ; asm
@@ -54190,7 +55130,7 @@ FuchsiaGymText11: ; 0x7559f
FuchsiaGymText2: ; 0x755a4
db $08 ; asm
- ld hl, $54eb
+ ld hl, FuchsiaGymTrainerHeader1
call LoadTrainerHeader
jp TextScriptEnd
@@ -54211,7 +55151,7 @@ UnnamedText_755b8: ; 0x755b8
FuchsiaGymText3: ; 0x755bd
db $08 ; asm
- ld hl, $54f7
+ ld hl, TrainerHeader_754f7
call LoadTrainerHeader
jp TextScriptEnd
@@ -54232,7 +55172,7 @@ UnnamedText_755d1: ; 0x755d1
FuchsiaGymText4: ; 0x755d6
db $08 ; asm
- ld hl, $5503
+ ld hl, TrainerHeader_75503
call LoadTrainerHeader
jp TextScriptEnd
@@ -54253,7 +55193,7 @@ UnnamedText_755ea: ; 0x755ea
FuchsiaGymText5: ; 0x755ef
db $08 ; asm
- ld hl, $550f
+ ld hl, TrainerHeader_7550f
call LoadTrainerHeader
jp TextScriptEnd
@@ -54274,7 +55214,7 @@ UnnamedText_75603: ; 0x75603
FuchsiaGymText6: ; 0x75608
db $08 ; asm
- ld hl, $551b
+ ld hl, TrainerHeader_7551b
call LoadTrainerHeader
jp TextScriptEnd
@@ -54295,7 +55235,7 @@ UnnamedText_7561c: ; 0x7561c
FuchsiaGymText7: ; 0x75621
db $08 ; asm
- ld hl, $5527
+ ld hl, TrainerHeader_75527
call LoadTrainerHeader
jp TextScriptEnd
@@ -54419,13 +55359,14 @@ CinnabarGym_h: ; 0x7573e to 0x7574a (12 bytes) (id=166)
dw CinnabarGymObject ; objects
CinnabarGymScript: ; 0x7574a
- call $5759
+ call CinnabarGymScript_Unknown75759
call $3c3c
ld hl, CinnabarGymScripts
ld a, [$d65e]
jp $3d97
; 0x75759
+CinnabarGymScript_Unknown75759: ; 0x75759
INCBIN "baserom.gbc",$75759,$7577B - $75759
Gym7CityName: ; 0x7577B
@@ -55555,9 +56496,9 @@ Lorelei_h: ; 0x7616f to 0x7617b (12 bytes) (id=245)
dw LoreleiObject ; objects
LoreleiScript: ; 0x7617b
- call $6191
+ call LoreleiScript_Unknown76191
call $3c3c
- ld hl, $6255
+ ld hl, LoreleiTrainerHeaders
ld de, $61bb
ld a, [$d64d]
call $3160
@@ -55565,16 +56506,28 @@ LoreleiScript: ; 0x7617b
ret
; 0x76191
+LoreleiScript_Unknown76191: ; 0x76191
INCBIN "baserom.gbc",$76191,$c0
LoreleiTexts: ; 0x76251
dw LoreleiText1, LoreleiText2
-INCBIN "baserom.gbc",$76255,$d
+LoreleiTrainerHeaders:
+LoreleiTrainerHeader1: ; 0x76255
+ db $1 ; flag's bit
+ db ($0 << 4) ; trainer's view range
+ dw $d863 ; flag's byte
+ dw UnnamedText_7626c ; 0x626c TextBeforeBattle
+ dw UnnamedText_76276 ; 0x6276 TextAfterBattle
+ dw UnnamedText_76271 ; 0x6271 TextEndBattle
+ dw UnnamedText_76271 ; 0x6271 TextEndBattle
+; 0x76261
+
+db $ff
LoreleiText1: ; 0x76262
db $08 ; asm
- ld hl, $6255
+ ld hl, LoreleiTrainerHeader1
call LoadTrainerHeader
jp TextScriptEnd
@@ -55630,9 +56583,9 @@ Bruno_h: ; 0x762ca to 0x762d6 (12 bytes) (id=246)
dw BrunoObject ; objects
BrunoScript: ; 0x762d6
- call $62ec
+ call BrunoScript_Unknown762ec
call $3c3c
- ld hl, $63ac
+ ld hl, BrunoTrainerHeaders
ld de, $6312
ld a, [$d64e]
call $3160
@@ -55640,16 +56593,28 @@ BrunoScript: ; 0x762d6
ret
; 0x762ec
+BrunoScript_Unknown762ec: ; 0x762ec
INCBIN "baserom.gbc",$762ec,$bc
BrunoTexts: ; 0x763a8
dw BrunoText1, BrunoText2
-INCBIN "baserom.gbc",$763ac,$d
+BrunoTrainerHeaders:
+BrunoTrainerHeader1: ; 0x763ac
+ db $1 ; flag's bit
+ db ($0 << 4) ; trainer's view range
+ dw $d864 ; flag's byte
+ dw UnnamedText_763c3 ; 0x63c3 TextBeforeBattle
+ dw UnnamedText_763cd ; 0x63cd TextAfterBattle
+ dw UnnamedText_763c8 ; 0x63c8 TextEndBattle
+ dw UnnamedText_763c8 ; 0x63c8 TextEndBattle
+; 0x763b8
+
+db $ff
BrunoText1: ; 0x763b9
db $08 ; asm
- ld hl, $63ac
+ ld hl, BrunoTrainerHeader1
call LoadTrainerHeader
jp TextScriptEnd
@@ -55705,9 +56670,9 @@ Agatha_h: ; 0x76421 to 0x7642d (12 bytes) (id=247)
dw AgathaObject ; objects
AgathaScript: ; 0x7642d
- call $6443
+ call AgathaScript_Unknown76443
call $3c3c
- ld hl, $6509
+ ld hl, AgathaTrainerHeaders
ld de, $6469
ld a, [$d64f]
call $3160
@@ -55715,16 +56680,28 @@ AgathaScript: ; 0x7642d
ret
; 0x76443
+AgathaScript_Unknown76443: ; 0x76443
INCBIN "baserom.gbc",$76443,$c2
AgathaTexts: ; 0x76505
dw AgathaText1, AgathaText2
-INCBIN "baserom.gbc",$76509,$d
+AgathaTrainerHeaders:
+AgathaTrainerHeader1: ; 0x76509
+ db $1 ; flag's bit
+ db ($0 << 4) ; trainer's view range
+ dw $d865 ; flag's byte
+ dw UnnamedText_76520 ; 0x6520 TextBeforeBattle
+ dw UnnamedText_7652a ; 0x652a TextAfterBattle
+ dw UnnamedText_76525 ; 0x6525 TextEndBattle
+ dw UnnamedText_76525 ; 0x6525 TextEndBattle
+; 0x76515
+
+db $ff
AgathaText1: ; 0x76516
db $08 ; asm
- ld hl, $6509
+ ld hl, AgathaTrainerHeader1
call LoadTrainerHeader
jp TextScriptEnd
@@ -61600,11 +62577,11 @@ _RockTunnel1Text8: ; 0x8c5b7
db "CERULEAN CITY -", $55
db "LAVENDER TOWN", $57
-UnknownText_8c5e2: ; 0x8c5e2
+_UnnamedText_1e3aa: ; 0x8c5e2
db $0, "Bzzzt!", $57
; 0x8c5e2 + 8 bytes
-UnknownText_8c5ea: ; 0x8c5ea
+_UnnamedText_1e3af: ; 0x8c5ea
db $0, "Gyaoo!@@"
; 0x8c5ea + 9 bytes
@@ -70691,18 +71668,18 @@ _UnnamedText_196d9: ; 0xa4f27
db "you believe me?", $57
; 0xa4f27 + 91 bytes
-ReceivedTM28Text: ; 0xa4f82
+_ReceivedTM28Text: ; 0xa4f82
db $0, $52, " recovered", $4f
db "TM28!@@"
; 0xa4f96
-UnnamedText_a4f96: ; 0xa4f96
+_ReceivedTM28Text2: ; 0xa4f96
db $0, $51
db "I better get", $4f
db "moving! Bye!@@"
; 0xa4fb3
-_UnnamedText_196e9: ; 0xa4fb3
+_TM28NoRoomText: ; 0xa4fb3
db $0, "Make room for", $4f
db "this!", $51
db "I can't run until", $4f
@@ -70910,26 +71887,26 @@ _UnnamedText_198ac: ; 0xa56e2
db "about a year.", $57
; 0xa56e2 + 59 bytes
-_UnnamedText_19904: ; 0xa571d
+_SSAnneWelcomeText4: ; 0xa571d
db $0, "Welcome to S.S.", $4f
db "ANNE!", $57
; 0xa571d + 23 bytes
-_UnnamedText_19909: ; 0xa5734
+_SSAnneWelcomeText9: ; 0xa5734
db $0, "Welcome to S.S.", $4f
db "ANNE!", $51
db "Excuse me, do you", $4f
db "have a ticket?", $58
; 0xa5734 + 56 bytes
-_UnnamedText_1990e: ; 0xa576c
+_SSAnneFlashedTicketText: ; 0xa576c
db $0, $52, " flashed", $4f
db "the S.S.TICKET!", $51
db "Great! Welcome to", $4f
db "S.S.ANNE!", $57
; 0xa576c + 55 bytes
-_UnnamedText_19913: ; 0xa57a3
+_SSAnneNoTicketText: ; 0xa57a3
db $0, $52, " doesn't", $4f
db "have the needed", $55
db "S.S.TICKET.", $51
@@ -70938,7 +71915,7 @@ _UnnamedText_19913: ; 0xa57a3
db "to get aboard.", $57
; 0xa57a3 + 78 bytes
-_UnnamedText_19918: ; 0xa57f1
+_SSAnneNotHereText: ; 0xa57f1
db $0, "The ship set sail.", $57
; 0xa57f1 + 20 bytes
@@ -71020,7 +71997,7 @@ _CeladonCityText4: ; 0xa5aa6
db "have cashed in my", $55
db "coins for prizes!", $57
-_UnnamedText_199d2: ; 0xa5afd
+_TM41PreText: ; 0xa5afd
db $0, "Hello, there!", $51
db "I've seen you,", $4f
db "but I never had a", $55
@@ -71029,14 +72006,14 @@ _UnnamedText_199d2: ; 0xa5afd
db "dropping by!", $58
; 0xa5afd + 93 bytes
-_UnnamedText_199d7: ; 0xa5b5a
+_ReceivedTM41Text: ; 0xa5b5a
db $0, $52, " received", $4f
db "@"
TX_RAM $cf4b
db $0, "!@@"
; 0xa5b6e
-_UnnamedText_199dd: ; 0xa5b6e
+_TM41ExplanationText: ; 0xa5b6e
db $0, "TM41 teaches", $4f
db "SOFTBOILED!", $51
db "Only one #MON", $4f
@@ -71045,7 +72022,7 @@ _UnnamedText_199dd: ; 0xa5b6e
db "CHANSEY!", $57
; 0xa5b6e + 74 bytes
-_UnnamedText_199e2: ; 0xa5bb8
+_TM41NoRoomText: ; 0xa5bb8
db $0, "Oh, your pack is", $4f
db "full of items!", $57
; 0xa5bb8 + 33 bytes
@@ -71173,19 +72150,19 @@ _FuchsiaCityText18: ; 0xa6011
db "The Poisonous", $4f
db "Ninja Master", $57
-_UnnamedText_19a9f: ; 0xa6050
+_FuchsiaCityChanseyText: ; 0xa6050
db $0, "Name: CHANSEY", $51
db "Catching one is", $4f
db "all up to chance.", $58
; 0xa6050 + 49 bytes
-_UnnamedText_19ab3: ; 0xa6081
+_FuchsiaCityVoltorbText: ; 0xa6081
db $0, "Name: VOLTORB", $51
db "The very image of", $4f
db "a # BALL.", $58
; 0xa6081 + 43 bytes
-_UnnamedText_19ac7: ; 0xa60ac
+_FuchsiaCityKangaskhanText: ; 0xa60ac
db $0, "Name: KANGASKHAN", $51
db "A maternal #MON", $4f
db "that raises its", $55
@@ -71193,26 +72170,26 @@ _UnnamedText_19ac7: ; 0xa60ac
db "on its belly.", $58
; 0xa60ac + 81 bytes
-_UnnamedText_19adb: ; 0xa60fd
+_FuchsiaCitySlowpokeText: ; 0xa60fd
db $0, "Name: SLOWPOKE", $51
db "Friendly and very", $4f
db "slow moving.", $58
; 0xa60fd + 47 bytes
-_UnnamedText_19aef: ; 0xa612c
+_FuchsiaCityLaprasText: ; 0xa612c
db $0, "Name: LAPRAS", $51
db "A.K.A. the king", $4f
db "of the seas.", $58
; 0xa612c + 43 bytes
-_UnnamedText_19b20: ; 0xa6157
+_FuchsiaCityOmanyteText: ; 0xa6157
db $0, "Name: OMANYTE", $51
db "A #MON that", $4f
db "was resurrected", $55
db "from a fossil.", $58
; 0xa6157 + 58 bytes
-_UnnamedText_19b25: ; 0xa6191
+_FuchsiaCityKabutoText: ; 0xa6191
db $0, "Name: KABUTO", $51
db "A #MON that", $4f
db "was resurrected", $55
diff --git a/pokeblue.asm b/pokeblue.asm
index 8e241791..78f8cd48 100644
--- a/pokeblue.asm
+++ b/pokeblue.asm
@@ -1,3 +1,3 @@
_RED EQU 0
_BLUE EQU 1
-INCLUDE "common.tx"
+INCLUDE "main.tx"
diff --git a/pokered.asm b/pokered.asm
index 0fb863a4..a6e1f6c8 100644
--- a/pokered.asm
+++ b/pokered.asm
@@ -1,3 +1,3 @@
_RED EQU 1
_BLUE EQU 0
-INCLUDE "common.tx"
+INCLUDE "main.tx"