summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2015-10-31 17:45:00 -0400
committerluckytyphlosion <alan.rj.huang@gmail.com>2015-10-31 17:45:00 -0400
commit2ba12f82413470ee8d277d636a4316f900ea24d3 (patch)
tree5c8bf085c69229373b9895a1ad763daaed8f605e
parentedf559611b3f40f293db0619e3ab3cef4155db07 (diff)
Main menu functions, oak_speech.asm, some special warp functions with data, SetDebugTeam
Also change Func_3f0c6 to CopyUncompressedPicToTilemap
-rw-r--r--constants/predef_constants.asm2
-rwxr-xr-xdata/special_warps.asm44
-rw-r--r--engine/bank3d/bank3d_battle.asm4
-rw-r--r--engine/bank3d/link_menu.asm4
-rwxr-xr-xengine/menu/main_menu.asm483
-rwxr-xr-xengine/oak_speech.asm75
-rwxr-xr-xengine/predefs.asm2
-rwxr-xr-xwram.asm7
-rwxr-xr-xyellow/main.asm197
9 files changed, 296 insertions, 522 deletions
diff --git a/constants/predef_constants.asm b/constants/predef_constants.asm
index a17525dc..425c7b67 100644
--- a/constants/predef_constants.asm
+++ b/constants/predef_constants.asm
@@ -1,7 +1,7 @@
const_value = 0
predef_const DrawPlayerHUDAndHPBar
- predef_const Func_3f0c6
+ predef_const CopyUncompressedPicToTilemap
predef_const Func_3f073
predef_const ScaleSpriteByTwo
predef_const LoadMonBackPic
diff --git a/data/special_warps.asm b/data/special_warps.asm
index b8baccfb..e883f3e2 100755
--- a/data/special_warps.asm
+++ b/data/special_warps.asm
@@ -1,7 +1,7 @@
; Format: (size 2 bytes)
; 00: target map ID
; 01: which dungeon warp in the source map was used
-DungeonWarpList: ; 63bf (1:63bf)
+DungeonWarpList: ; 6133 (1:6133)
db SEAFOAM_ISLANDS_2,$01
db SEAFOAM_ISLANDS_2,$02
db SEAFOAM_ISLANDS_3,$01
@@ -16,7 +16,7 @@ DungeonWarpList: ; 63bf (1:63bf)
db MANSION_2,$03
db $FF
-DungeonWarpData: ; 63d8 (1:63d8)
+DungeonWarpData: ; 614c (1:614c)
FLYWARP_DATA SEAFOAM_ISLANDS_2_WIDTH,7,18
FLYWARP_DATA SEAFOAM_ISLANDS_2_WIDTH,7,23
FLYWARP_DATA SEAFOAM_ISLANDS_3_WIDTH,7,19
@@ -34,32 +34,32 @@ DungeonWarpData: ; 63d8 (1:63d8)
; db Map_id
; FLYWARP_DATA [Map Width][Y-pos][X-pos]
; db Tileset_id
-FirstMapSpec: ; 6420 (1:6420)
+FirstMapSpec: ; 6194 (1:6194)
db REDS_HOUSE_2F
FLYWARP_DATA REDS_HOUSE_2F_WIDTH,6,3
db REDS_HOUSE_2
-TradeCenterSpec1: ; 6428 (1:6428)
+TradeCenterSpec1: ; 619a (1:619a)
db TRADE_CENTER
FLYWARP_DATA TRADE_CENTER_WIDTH,4,3
db CLUB
-TradeCenterSpec2: ; 6430 (1:6430)
+TradeCenterSpec2: ; 61a3 (1:61a3)
db TRADE_CENTER
FLYWARP_DATA TRADE_CENTER_WIDTH,4,6
db CLUB
-ColosseumSpec1: ; 6438 (1:6438)
+ColosseumSpec1: ; 61ac (1:61ac)
db COLOSSEUM
FLYWARP_DATA COLOSSEUM_WIDTH,4,3
db CLUB
-ColosseumSpec2: ; 6440 (1:6440)
+ColosseumSpec2: ; 61b3 (1:61b3)
db COLOSSEUM
FLYWARP_DATA COLOSSEUM_WIDTH,4,6
db CLUB
-FlyWarpDataPtr: ; 6448 (1:6448)
+FlyWarpDataPtr: ; 61bc (1:61bc)
db PALLET_TOWN, 0
dw PalletTownFlyWarp
db VIRIDIAN_CITY, 0
@@ -91,29 +91,29 @@ FlyWarpDataPtr: ; 6448 (1:6448)
; [Event Displacement][Y-block][X-block][Y-sub_block][X-sub_block]
; Macro Format:
; FLYWARP_DATA [Map Width][Y-pos][X-pos]
-PalletTownFlyWarp: ; 647c (1:647c)
+PalletTownFlyWarp: ; 61f0 (1:61f0)
FLYWARP_DATA PALLET_TOWN_WIDTH, 6, 5
-ViridianCityFlyWarp: ; 6482 (1:6482)
+ViridianCityFlyWarp: ; 61f6 (1:61f6)
FLYWARP_DATA VIRIDIAN_CITY_WIDTH, 26, 23
-PewterCityFlyWarp: ; 6488 (1:6488)
+PewterCityFlyWarp: ; 61fc (1:61fc)
FLYWARP_DATA PEWTER_CITY_WIDTH, 26, 13
-CeruleanCityFlyWarp: ; 648e (1:648e)
+CeruleanCityFlyWarp: ; 6202 (1:6202)
FLYWARP_DATA CERULEAN_CITY_WIDTH, 18, 19
-LavenderTownFlyWarp: ; 6494 (1:6494)
+LavenderTownFlyWarp: ; 6208 (1:6208)
FLYWARP_DATA LAVENDER_TOWN_WIDTH, 6, 3
-VermilionCityFlyWarp: ; 649a (1:649a)
+VermilionCityFlyWarp: ; 620e (1:620e)
FLYWARP_DATA VERMILION_CITY_WIDTH, 4, 11
-CeladonCityFlyWarp: ; 64a0 (1:64a0)
+CeladonCityFlyWarp: ; 6214 (1:6214)
FLYWARP_DATA CELADON_CITY_WIDTH, 10, 41
-FuchsiaCityFlyWarp: ; 64a6 (1:64a6)
+FuchsiaCityFlyWarp: ; 621a (1:621a)
FLYWARP_DATA FUCHSIA_CITY_WIDTH, 28, 19
-CinnabarIslandFlyWarp: ; 64ac (1:64ac)
+CinnabarIslandFlyWarp: ; 6220 (1:6220)
FLYWARP_DATA CINNABAR_ISLAND_WIDTH, 12, 11
-IndigoPlateauFlyWarp: ; 64b2 (1:64b2)
+IndigoPlateauFlyWarp: ; 6226 (1:6226)
FLYWARP_DATA INDIGO_PLATEAU_WIDTH, 6, 9
-SaffronCityFlyWarp: ; 64b8 (1:64b8)
+SaffronCityFlyWarp: ; 622c (1:622c)
FLYWARP_DATA SAFFRON_CITY_WIDTH, 30, 9
-Route4FlyWarp: ; 64be (1:64be)
+Route4FlyWarp: ; 6232 (1:6232)
FLYWARP_DATA ROUTE_4_WIDTH, 6, 11
-Route10FlyWarp: ; 64c4 (1:64c4)
- FLYWARP_DATA ROUTE_10_WIDTH, 20, 11
+Route10FlyWarp: ; 6238 (1:6238)
+ FLYWARP_DATA ROUTE_10_WIDTH, 20, 11 \ No newline at end of file
diff --git a/engine/bank3d/bank3d_battle.asm b/engine/bank3d/bank3d_battle.asm
index 1f84d314..876737b7 100644
--- a/engine/bank3d/bank3d_battle.asm
+++ b/engine/bank3d/bank3d_battle.asm
@@ -43,7 +43,7 @@ asm_f601d: ; f601d (f:601d)
dec a
ld [wAICount], a
coord hl, 12, 0
- predef Func_3f0c6
+ predef CopyUncompressedPicToTilemap
ld a, $ff
ld [wEnemyMonPartyPos], a
ld a, $2
@@ -103,7 +103,7 @@ InitWildBattle: ; f607c (3d:607c)
ld [W_TRAINERCLASS], a
ld [$ffe1], a
coord hl, 12, 0
- predef Func_3f0c6
+ predef CopyUncompressedPicToTilemap
; common code that executes after init battle code specific to trainer or wild battles
InitBattle_Common: ; f60eb (3d:60eb)
diff --git a/engine/bank3d/link_menu.asm b/engine/bank3d/link_menu.asm
index bd1f664c..0cb2a962 100644
--- a/engine/bank3d/link_menu.asm
+++ b/engine/bank3d/link_menu.asm
@@ -787,9 +787,7 @@ LinkMenu: ; f580c (3d:580c)
inc a ; LINK_STATE_IN_CABLE_CLUB
ld [wLinkState], a
ld [wEnteringCableClub], a
- ld hl,Func_5ce4
- ld b,BANK(Func_5ce4)
- jp Bankswitch
+ jpab SpecialEnterMap
.choseCancel
xor a
ld [wMenuJoypadPollCount], a
diff --git a/engine/menu/main_menu.asm b/engine/menu/main_menu.asm
index 2e88dbcb..9a32ff74 100755
--- a/engine/menu/main_menu.asm
+++ b/engine/menu/main_menu.asm
@@ -1,4 +1,4 @@
-MainMenu: ; 5af2 (1:5af2)
+MainMenu: ; 5ba6 (1:5ba6)
; Check save file
call InitOptions
xor a
@@ -34,8 +34,7 @@ MainMenu: ; 5af2 (1:5af2)
jr z,.noSaveFile
; there's a save file
coord hl, 0, 0
- ld b,6
- ld c,13
+ lb bc, 6, 13
call TextBoxBorder
coord hl, 2, 2
ld de,ContinueText
@@ -43,8 +42,7 @@ MainMenu: ; 5af2 (1:5af2)
jr .next2
.noSaveFile
coord hl, 0, 0
- ld b,4
- ld c,13
+ lb bc, 4, 13
call TextBoxBorder
coord hl, 2, 2
ld de,NewGameText
@@ -129,190 +127,34 @@ InitOptions: ; 5bff (1:5bff)
ld [wLetterPrintingDelayFlags],a
ld a,3 ; medium speed
ld [wOptions],a
+ ld a,64 ; audio?
+ ld [wd498], a
ret
-LinkMenu: ; 5c0a (1:5c0a)
- xor a
- ld [wLetterPrintingDelayFlags], a
- ld hl, wd72e
- set 6, [hl]
- ld hl, TextTerminator_6b20
- call PrintText
- call SaveScreenTilesToBuffer1
- ld hl, WhereWouldYouLikeText
- call PrintText
- coord hl, 5, 5
- ld b, $6
- ld c, $d
- call TextBoxBorder
- call UpdateSprites
- coord hl, 7, 7
- ld de, CableClubOptionsText
- call PlaceString
- xor a
- ld [wUnusedCD37], a
- ld [wd72d], a
- ld hl, wTopMenuItemY
- ld a, $7
- ld [hli], a
- ld a, $6
- ld [hli], a
- xor a
- ld [hli], a
- inc hl
- ld a, $2
- ld [hli], a
- inc a
- ; ld a, A_BUTTON | B_BUTTON
- ld [hli], a ; wMenuWatchedKeys
- xor a
- ld [hl], a
-.waitForInputLoop
- call HandleMenuInput
- and A_BUTTON | B_BUTTON
- add a
- add a
- ld b, a
- ld a, [wCurrentMenuItem]
- add b
- add $d0
- ld [wLinkMenuSelectionSendBuffer], a
- ld [wLinkMenuSelectionSendBuffer + 1], a
-.exchangeMenuSelectionLoop
- call Serial_ExchangeLinkMenuSelection
- ld a, [wLinkMenuSelectionReceiveBuffer]
- ld b, a
- and $f0
- cp $d0
- jr z, .asm_5c7d
- ld a, [wLinkMenuSelectionReceiveBuffer + 1]
- ld b, a
- and $f0
- cp $d0
- jr nz, .exchangeMenuSelectionLoop
-.asm_5c7d
- ld a, b
- and $c ; did the enemy press A or B?
- jr nz, .enemyPressedAOrB
-; the enemy didn't press A or B
- ld a, [wLinkMenuSelectionSendBuffer]
- and $c ; did the player press A or B?
- jr z, .waitForInputLoop ; if neither the player nor the enemy pressed A or B, try again
- jr .doneChoosingMenuSelection ; if the player pressed A or B but the enemy didn't, use the player's selection
-.enemyPressedAOrB
- ld a, [wLinkMenuSelectionSendBuffer]
- and $c ; did the player press A or B?
- jr z, .useEnemyMenuSelection ; if the enemy pressed A or B but the player didn't, use the enemy's selection
-; the enemy and the player both pressed A or B
-; The gameboy that is clocking the connection wins.
- ld a, [hSerialConnectionStatus]
- cp USING_INTERNAL_CLOCK
- jr z, .doneChoosingMenuSelection
-.useEnemyMenuSelection
- ld a, b
- ld [wLinkMenuSelectionSendBuffer], a
- and $3
- ld [wCurrentMenuItem], a
-.doneChoosingMenuSelection
- ld a, [hSerialConnectionStatus]
- cp USING_INTERNAL_CLOCK
- jr nz, .skipStartingTransfer
- call DelayFrame
- call DelayFrame
- ld a, START_TRANSFER_INTERNAL_CLOCK
- ld [rSC], a
-.skipStartingTransfer
- ld b, $7f
- ld c, $7f
- ld d, $ec
- ld a, [wLinkMenuSelectionSendBuffer]
- and (B_BUTTON << 2) ; was B button pressed?
- jr nz, .updateCursorPosition
-; A button was pressed
- ld a, [wCurrentMenuItem]
- cp $2
- jr z, .updateCursorPosition
- ld c, d
- ld d, b
- dec a
- jr z, .updateCursorPosition
- ld b, c
- ld c, d
-.updateCursorPosition
- ld a, b
- Coorda 6, 7
- ld a, c
- Coorda 6, 9
- ld a, d
- Coorda 6, 11
- ld c, 40
- call DelayFrames
- call LoadScreenTilesFromBuffer1
- ld a, [wLinkMenuSelectionSendBuffer]
- and (B_BUTTON << 2) ; was B button pressed?
- jr nz, .choseCancel ; cancel if B pressed
- ld a, [wCurrentMenuItem]
- cp $2
- jr z, .choseCancel
- xor a
- ld [wWalkBikeSurfState], a ; start walking
- ld a, [wCurrentMenuItem]
- and a
- ld a, COLOSSEUM
- jr nz, .next
- ld a, TRADE_CENTER
-.next
- ld [wd72d], a
- ld hl, PleaseWaitText
- call PrintText
- ld c, 50
- call DelayFrames
- ld hl, wd732
- res 1, [hl]
- ld a, [W_ANIMATIONID]
- ld [wDestinationMap], a
- call SpecialWarpIn
- ld c, 20
- call DelayFrames
- xor a
- ld [wMenuJoypadPollCount], a
- ld [wSerialExchangeNybbleSendData], a
- inc a ; LINK_STATE_IN_CABLE_CLUB
- ld [wLinkState], a
- ld [wEnteringCableClub], a
- jr SpecialEnterMap
-.choseCancel
- xor a
- ld [wMenuJoypadPollCount], a
- call Delay3
- call CloseLinkConnection
- ld hl, LinkCanceledText
+Func_5cc1: ; 5cc1 (1:5cc1)
+; unused?
+ ld a, $6d
+ cp $80
+ ret c ; will always be executed
+ ld hl, NotEnoughMemoryText
call PrintText
- ld hl, wd72e
- res 6, [hl]
ret
-
-WhereWouldYouLikeText: ; 5d43 (1:5d43)
- TX_FAR _WhereWouldYouLikeText
- db "@"
-
-PleaseWaitText: ; 5d48 (1:5d48)
- TX_FAR _PleaseWaitText
+
+NotEnoughMemoryText: ; 5ccd (1:5ccd)
+ TX_FAR _NotEnoughMemoryText
db "@"
-
-LinkCanceledText: ; 5d4d (1:5d4d)
- TX_FAR _LinkCanceledText
- db "@"
-
-StartNewGame: ; 5d52 (1:5d52)
+
+StartNewGame: ; 5cd2 (1:5cd2)
ld hl, wd732
res 1, [hl]
call OakSpeech
+ ld a, $8
+ ld [wPlayerMovingDirection], a
ld c, 20
call DelayFrames
; enter map after using a special warp or loading the game from the main menu
-SpecialEnterMap: ; 5d5f (1:5d5f)
+SpecialEnterMap: ; 5ce4 (1:5ce4)
xor a
ld [hJoyPressed], a
ld [hJoyHeld], a
@@ -323,29 +165,24 @@ SpecialEnterMap: ; 5d5f (1:5d5f)
call ResetPlayerSpriteData
ld c, 20
call DelayFrames
+ call Func_5cc1
ld a, [wEnteringCableClub]
and a
ret nz
jp EnterMap
-ContinueText: ; 5d7e (1:5d7e)
+ContinueText: ; 5d06 (1:5d06)
db "CONTINUE", $4e
-NewGameText: ; 5d87 (1:5d87)
+NewGameText: ; 5d0f (1:5d0f)
db "NEW GAME", $4e
db "OPTION@"
-CableClubOptionsText: ; 5d97 (1:5d97)
- db "TRADE CENTER", $4e
- db "COLOSSEUM", $4e
- db "CANCEL@"
-
-DisplayContinueGameInfo: ; 5db5 (1:5db5)
+DisplayContinueGameInfo: ; 5d1f (1:5d1f)
xor a
ld [H_AUTOBGTRANSFERENABLED], a
coord hl, 4, 7
- ld b, 8
- ld c, 14
+ lb bc, 8, 14
call TextBoxBorder
coord hl, 5, 9
ld de, SaveScreenInfoText
@@ -364,12 +201,11 @@ DisplayContinueGameInfo: ; 5db5 (1:5db5)
ld c, 30
jp DelayFrames
-PrintSaveScreenText: ; 5def (1:5def)
+PrintSaveScreenText: ; 5d58 (1:5d58)
xor a
ld [H_AUTOBGTRANSFERENABLED], a
coord hl, 4, 0
- ld b, $8
- ld c, $e
+ lb bc, 8, 14
call TextBoxBorder
call LoadTextBoxTilePatterns
call UpdateSprites
@@ -390,7 +226,7 @@ PrintSaveScreenText: ; 5def (1:5def)
ld c, 30
jp DelayFrames
-PrintNumBadges: ; 5e2f (1:5e2f)
+PrintNumBadges: ; 5d97 (1:5d97)
push hl
ld hl, wObtainedBadges
ld b, $1
@@ -400,7 +236,7 @@ PrintNumBadges: ; 5e2f (1:5e2f)
lb bc, 1, 2
jp PrintNumber
-PrintNumOwnedMons: ; 5e42 (1:5e42)
+PrintNumOwnedMons: ; 5daa (1:5daa)
push hl
ld hl, wPokedexOwned
ld b, wPokedexOwnedEnd - wPokedexOwned
@@ -410,7 +246,7 @@ PrintNumOwnedMons: ; 5e42 (1:5e42)
lb bc, 1, 3
jp PrintNumber
-PrintPlayTime: ; 5e55 (1:5e55)
+PrintPlayTime: ; 5dbd (1:5dbd)
ld de, W_PLAYTIMEHOURS + 1
lb bc, 1, 3
call PrintNumber
@@ -420,268 +256,17 @@ PrintPlayTime: ; 5e55 (1:5e55)
lb bc, LEADING_ZEROES | 1, 2
jp PrintNumber
-SaveScreenInfoText: ; 5e6a (1:5e6a)
+SaveScreenInfoText: ; 5dd2 (1:5dd2)
db "PLAYER"
next "BADGES "
next "#DEX "
next "TIME@"
-DisplayOptionMenu: ; 5e8a (1:5e8a)
- coord hl, 0, 0
- ld b,3
- ld c,18
- call TextBoxBorder
- coord hl, 0, 5
- ld b,3
- ld c,18
- call TextBoxBorder
- coord hl, 0, 10
- ld b,3
- ld c,18
- call TextBoxBorder
- coord hl, 1, 1
- ld de,TextSpeedOptionText
- call PlaceString
- coord hl, 1, 6
- ld de,BattleAnimationOptionText
- call PlaceString
- coord hl, 1, 11
- ld de,BattleStyleOptionText
- call PlaceString
- coord hl, 2, 16
- ld de,OptionMenuCancelText
- call PlaceString
- xor a
- ld [wCurrentMenuItem],a
- ld [wLastMenuItem],a
- inc a
- ld [wLetterPrintingDelayFlags],a
- ld [wUnusedCD40],a
- ld a,3 ; text speed cursor Y coordinate
- ld [wTopMenuItemY],a
- call SetCursorPositionsFromOptions
- ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate
- ld [wTopMenuItemX],a
- ld a,$01
- ld [H_AUTOBGTRANSFERENABLED],a ; enable auto background transfer
- call Delay3
-.loop
- call PlaceMenuCursor
- call SetOptionsFromCursorPositions
-.getJoypadStateLoop
- call JoypadLowSensitivity
- ld a,[hJoy5]
- ld b,a
- and a,A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed?
- jr z,.getJoypadStateLoop
- bit 1,b ; B button pressed?
- jr nz,.exitMenu
- bit 3,b ; Start button pressed?
- jr nz,.exitMenu
- bit 0,b ; A button pressed?
- jr z,.checkDirectionKeys
- ld a,[wTopMenuItemY]
- cp a,16 ; is the cursor on Cancel?
- jr nz,.loop
-.exitMenu
- ld a,SFX_PRESS_AB
- call PlaySound
- ret
-.eraseOldMenuCursor
- ld [wTopMenuItemX],a
- call EraseMenuCursor
- jp .loop
-.checkDirectionKeys
- ld a,[wTopMenuItemY]
- bit 7,b ; Down pressed?
- jr nz,.downPressed
- bit 6,b ; Up pressed?
- jr nz,.upPressed
- cp a,8 ; cursor in Battle Animation section?
- jr z,.cursorInBattleAnimation
- cp a,13 ; cursor in Battle Style section?
- jr z,.cursorInBattleStyle
- cp a,16 ; cursor on Cancel?
- jr z,.loop
-.cursorInTextSpeed
- bit 5,b ; Left pressed?
- jp nz,.pressedLeftInTextSpeed
- jp .pressedRightInTextSpeed
-.downPressed
- cp a,16
- ld b,-13
- ld hl,wOptionsTextSpeedCursorX
- jr z,.updateMenuVariables
- ld b,5
- cp a,3
- inc hl
- jr z,.updateMenuVariables
- cp a,8
- inc hl
- jr z,.updateMenuVariables
- ld b,3
- inc hl
- jr .updateMenuVariables
-.upPressed
- cp a,8
- ld b,-5
- ld hl,wOptionsTextSpeedCursorX
- jr z,.updateMenuVariables
- cp a,13
- inc hl
- jr z,.updateMenuVariables
- cp a,16
- ld b,-3
- inc hl
- jr z,.updateMenuVariables
- ld b,13
- inc hl
-.updateMenuVariables
- add b
- ld [wTopMenuItemY],a
- ld a,[hl]
- ld [wTopMenuItemX],a
- call PlaceUnfilledArrowMenuCursor
- jp .loop
-.cursorInBattleAnimation
- ld a,[wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate
- xor a,$0b ; toggle between 1 and 10
- ld [wOptionsBattleAnimCursorX],a
- jp .eraseOldMenuCursor
-.cursorInBattleStyle
- ld a,[wOptionsBattleStyleCursorX] ; battle style cursor X coordinate
- xor a,$0b ; toggle between 1 and 10
- ld [wOptionsBattleStyleCursorX],a
- jp .eraseOldMenuCursor
-.pressedLeftInTextSpeed
- ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate
- cp a,1
- jr z,.updateTextSpeedXCoord
- cp a,7
- jr nz,.fromSlowToMedium
- sub a,6
- jr .updateTextSpeedXCoord
-.fromSlowToMedium
- sub a,7
- jr .updateTextSpeedXCoord
-.pressedRightInTextSpeed
- ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate
- cp a,14
- jr z,.updateTextSpeedXCoord
- cp a,7
- jr nz,.fromFastToMedium
- add a,7
- jr .updateTextSpeedXCoord
-.fromFastToMedium
- add a,6
-.updateTextSpeedXCoord
- ld [wOptionsTextSpeedCursorX],a ; text speed cursor X coordinate
- jp .eraseOldMenuCursor
-
-TextSpeedOptionText: ; 5fc0 (1:5fc0)
- db "TEXT SPEED"
- next " FAST MEDIUM SLOW@"
-
-BattleAnimationOptionText: ; 5fde (1:5fde)
- db "BATTLE ANIMATION"
- next " ON OFF@"
-
-BattleStyleOptionText: ; 5ffd (1:5ffd)
- db "BATTLE STYLE"
- next " SHIFT SET@"
-
-OptionMenuCancelText: ; 6018 (1:6018)
- db "CANCEL@"
-
-; sets the options variable according to the current placement of the menu cursors in the options menu
-SetOptionsFromCursorPositions: ; 601f (1:601f)
- ld hl,TextSpeedOptionData
- ld a,[wOptionsTextSpeedCursorX] ; text speed cursor X coordinate
- ld c,a
-.loop
- ld a,[hli]
- cp c
- jr z,.textSpeedMatchFound
- inc hl
- jr .loop
-.textSpeedMatchFound
- ld a,[hl]
- ld d,a
- ld a,[wOptionsBattleAnimCursorX] ; battle animation cursor X coordinate
- dec a
- jr z,.battleAnimationOn
-.battleAnimationOff
- set 7,d
- jr .checkBattleStyle
-.battleAnimationOn
- res 7,d
-.checkBattleStyle
- ld a,[wOptionsBattleStyleCursorX] ; battle style cursor X coordinate
- dec a
- jr z,.battleStyleShift
-.battleStyleSet
- set 6,d
- jr .storeOptions
-.battleStyleShift
- res 6,d
-.storeOptions
- ld a,d
- ld [wOptions],a
+DisplayOptionMenu: ; 5df2 (1:5df2)
+ callab DisplayOptionMenu_ ; 10:5c70
ret
-; reads the options variable and places menu cursors in the correct positions within the options menu
-SetCursorPositionsFromOptions: ; 604c (1:604c)
- ld hl,TextSpeedOptionData + 1
- ld a,[wOptions]
- ld c,a
- and a,$3f
- push bc
- ld de,2
- call IsInArray
- pop bc
- dec hl
- ld a,[hl]
- ld [wOptionsTextSpeedCursorX],a ; text speed cursor X coordinate
- coord hl, 0, 3
- call .placeUnfilledRightArrow
- sla c
- ld a,1 ; On
- jr nc,.storeBattleAnimationCursorX
- ld a,10 ; Off
-.storeBattleAnimationCursorX
- ld [wOptionsBattleAnimCursorX],a ; battle animation cursor X coordinate
- coord hl, 0, 8
- call .placeUnfilledRightArrow
- sla c
- ld a,1
- jr nc,.storeBattleStyleCursorX
- ld a,10
-.storeBattleStyleCursorX
- ld [wOptionsBattleStyleCursorX],a ; battle style cursor X coordinate
- coord hl, 0, 13
- call .placeUnfilledRightArrow
-; cursor in front of Cancel
- coord hl, 0, 16
- ld a,1
-.placeUnfilledRightArrow
- ld e,a
- ld d,0
- add hl,de
- ld [hl],$ec ; unfilled right arrow menu cursor
- ret
-
-; table that indicates how the 3 text speed options affect frame delays
-; Format:
-; 00: X coordinate of menu cursor
-; 01: delay after printing a letter (in frames)
-TextSpeedOptionData: ; 6096 (1:6096)
- db 14,5 ; Slow
- db 7,3 ; Medium
- db 1,1 ; Fast
- db 7 ; default X coordinate (Medium)
- db $ff ; terminator
-
-CheckForPlayerNameInSRAM: ; 609e (1:609e)
+CheckForPlayerNameInSRAM: ; 5dfb (1:5dfb)
; Check if the player name data in SRAM has a string terminator character
; (indicating that a name may have been saved there) and return whether it does
; in carry.
@@ -709,4 +294,4 @@ CheckForPlayerNameInSRAM: ; 609e (1:609e)
ld [MBC1SRamEnable], a
ld [MBC1SRamBankingMode], a
scf
- ret
+ ret \ No newline at end of file
diff --git a/engine/oak_speech.asm b/engine/oak_speech.asm
index 2e28afc6..5a36fe1f 100755
--- a/engine/oak_speech.asm
+++ b/engine/oak_speech.asm
@@ -1,18 +1,26 @@
-SetDefaultNames: ; 60ca (1:60ca)
+SetDefaultNames: ; 5e27 (1:5e27)
ld a, [wLetterPrintingDelayFlags]
push af
ld a, [wOptions]
push af
ld a, [wd732]
push af
+ ld a, [wd498]
+ push af
ld hl, wPlayerName
- ld bc, $d8a
+ ld bc, wBoxDataEnd - wPlayerName
xor a
call FillMemory
ld hl, wSpriteStateData1
ld bc, $200
xor a
call FillMemory
+ xor a
+ ld [wd495], a
+ ld [wd496], a
+ ld [wd497], a
+ pop af
+ ld [wd498], a
pop af
ld [wd732], a
pop af
@@ -29,11 +37,11 @@ SetDefaultNames: ; 60ca (1:60ca)
ld hl, SonyText
ld de, W_RIVALNAME
ld bc, NAME_LENGTH
- jp CopyData
-
-OakSpeech: ; 6115 (1:6115)
- ld a,$FF
- call PlaySound ; stop music
+ call CopyData ; rip optimizations
+ ret
+
+OakSpeech: ; 5e85 (1:5e85)
+ call StopAllMusic ; stop music
ld a, BANK(Music_Routes2)
ld c,a
ld a, MUSIC_ROUTES2
@@ -64,7 +72,7 @@ OakSpeech: ; 6115 (1:6115)
call PrintText
call GBFadeOutToWhite
call ClearScreen
- ld a,NIDORINO
+ ld a,PIKACHU
ld [wd0b5],a
ld [wcf91],a
call GetMonHeader
@@ -109,13 +117,13 @@ OakSpeech: ; 6115 (1:6115)
ld a,SFX_SHRINK
call PlaySound
pop af
- ld [H_LOADEDROMBANK],a
- ld [MBC1RomBank],a
+ call BankswitchCommon
ld c,4
call DelayFrames
- ld de,RedSprite
ld hl,vSprites
- lb bc, BANK(RedSprite), $0C
+ ld de,RedSprite
+ ld b, BANK(RedSprite)
+ ld c, $0C
call CopyVideoData
ld de,ShrinkPic1
lb bc, BANK(ShrinkPic1), $00
@@ -133,17 +141,13 @@ OakSpeech: ; 6115 (1:6115)
ld [wAudioSavedROMBank],a
ld a, 10
ld [wAudioFadeOutControl],a
- ld a,$FF
- ld [wNewSoundID],a
- call PlaySound ; stop music
+ call StopAllMusic ; stop music
pop af
- ld [H_LOADEDROMBANK],a
- ld [MBC1RomBank],a
+ call BankswitchCommon
ld c,20
call DelayFrames
coord hl, 6, 5
- ld b,7
- ld c,7
+ lb bc, 7, 7
call ClearScreenArea
call LoadTextBoxTilePatterns
ld a,1
@@ -151,38 +155,41 @@ OakSpeech: ; 6115 (1:6115)
ld c,50
call DelayFrames
call GBFadeOutToWhite
- jp ClearScreen
-OakSpeechText1: ; 6253 (1:6253)
+ call ClearScreen ; rip more tail-end optimizations
+ ret
+
+OakSpeechText1: ; 5fb9 (1:5fb9)
TX_FAR _OakSpeechText1
db "@"
-OakSpeechText2: ; 6258 (1:6258)
+OakSpeechText2: ; 5fbe (1:5fbe)
TX_FAR _OakSpeechText2A
db $14 ; play NIDORINA cry from TextCommandSounds
TX_FAR _OakSpeechText2B
db "@"
-IntroducePlayerText: ; 6262 (1:6262)
+IntroducePlayerText: ; 5fc8 (1:5fc8)
TX_FAR _IntroducePlayerText
db "@"
-IntroduceRivalText: ; 6267 (1:6267)
+IntroduceRivalText: ; 5fcd (1:5fcd)
TX_FAR _IntroduceRivalText
db "@"
-OakSpeechText3: ; 626c (1:626c)
+OakSpeechText3: ; 5fd2 (1:5fd2)
TX_FAR _OakSpeechText3
db "@"
-FadeInIntroPic: ; 6271 (1:6271)
+FadeInIntroPic: ; 5fd7 (1:5fd7)
ld hl,IntroFadePalettes
ld b,6
.next
ld a,[hli]
ld [rBGP],a
+ call UpdateGBCPal_BGP
ld c,10
call DelayFrames
dec b
jr nz,.next
ret
-IntroFadePalettes: ; 6282 (1:6282)
+IntroFadePalettes: ; 5feb (1:5feb)
db %01010100
db %10101000
db %11111100
@@ -190,13 +197,14 @@ IntroFadePalettes: ; 6282 (1:6282)
db %11110100
db %11100100
-MovePicLeft: ; 6288 (1:6288)
+MovePicLeft: ; 5ff1 (1:5ff1)
ld a,119
ld [rWX],a
call DelayFrame
- ld a,$E4
+ ld a,%11100100
ld [rBGP],a
+ call UpdateGBCPal_BGP
.next
call DelayFrame
ld a,[rWX]
@@ -206,19 +214,22 @@ MovePicLeft: ; 6288 (1:6288)
ld [rWX],a
jr .next
-DisplayPicCenteredOrUpperRight: ; 62a1 (1:62a1)
+DisplayPicCenteredOrUpperRight: ; 600d (1:600d)
call GetPredefRegisters
-IntroDisplayPicCenteredOrUpperRight: ; 62a4 (1:62a4)
+IntroDisplayPicCenteredOrUpperRight: ; 6010 (1:6010)
; b = bank
; de = address of compressed pic
; c: 0 = centred, non-zero = upper-right
push bc
ld a,b
call UncompressSpriteFromDE
+ ld a, $0
+ call SwitchSRAMBankAndLatchClockData
ld hl,S_SPRITEBUFFER1
ld de,S_SPRITEBUFFER0
ld bc,$310
call CopyData
+ call PrepareRTCDataAndDisableSRAM
ld de,vFrontPic
call InterlaceMergeSpriteBuffers
pop bc
@@ -230,4 +241,4 @@ IntroDisplayPicCenteredOrUpperRight: ; 62a4 (1:62a4)
.next
xor a
ld [hStartTileID],a
- predef_jump CopyUncompressedPicToTilemap
+ predef_jump CopyUncompressedPicToTilemap \ No newline at end of file
diff --git a/engine/predefs.asm b/engine/predefs.asm
index ed588d9a..4a04b45d 100755
--- a/engine/predefs.asm
+++ b/engine/predefs.asm
@@ -54,7 +54,7 @@ PredefPointers:: ; f681d (3d:681d)
; they appear to be used in overworld map scripts.
dr $f681d,$f7000
;add_predef DrawPlayerHUDAndHPBar
- ;add_predef Func_3f0c6
+ ;add_predef CopyUncompressedPicToTilemap
;add_predef Func_3f073
;add_predef ScaleSpriteByTwo
;add_predef LoadMonBackPic
diff --git a/wram.asm b/wram.asm
index 84af03e7..5ceb135d 100755
--- a/wram.asm
+++ b/wram.asm
@@ -2533,7 +2533,12 @@ wd47a:: ds 1
wd493:: ds 1
- ds 5
+ ds 1
+
+wd495:: ds 1
+wd496:: ds 1
+wd497:: ds 1
+wd498:: ds 1
wUnknownSerialFlag_d499:: ds 1 ; d498
wUnknownSerialFlag_d49a:: ds 1 ; d499
diff --git a/yellow/main.asm b/yellow/main.asm
index c4064a03..c302e7e8 100755
--- a/yellow/main.asm
+++ b/yellow/main.asm
@@ -539,14 +539,189 @@ LoadTrainerInfoTextBoxTiles: ; 5b9a (1:5b9a)
lb bc, BANK(TrainerInfoTextBoxTileGraphics), (TrainerInfoTextBoxTileGraphicsEnd - TrainerInfoTextBoxTileGraphics) / $10
jp CopyVideoData
-MainMenu: ; 5ba6 (1:5ba6)
- dr $5ba6,$5ce4
-Func_5ce4: ; 5ce4 (1:5ce4)
- dr $5ce4,$5d58
-PrintSaveScreenText: ; 5d58 (1:5d58)
- dr $5d58,$6042
+INCLUDE "engine/menu/main_menu.asm"
+
+INCLUDE "engine/oak_speech.asm"
+
SpecialWarpIn: ; 6042 (1:6042)
- dr $6042,$68a6
+ call LoadSpecialWarpData
+ predef LoadTilesetHeader
+ ld hl,wd732
+ bit 2,[hl] ; dungeon warp or fly warp?
+ res 2,[hl]
+ jr z,.next
+; if dungeon warp or fly warp
+ ld a,[wDestinationMap]
+ jr .next2
+.next
+ bit 1,[hl]
+ jr z,.next3
+ call EmptyFunc
+.next3
+ ld a,0
+.next2
+ ld b,a
+ ld a,[wd72d]
+ and a
+ jr nz,.next4
+ ld a,b
+.next4
+ ld hl,wd732
+ bit 4,[hl] ; dungeon warp?
+ ret nz
+; if not dungeon warp
+ ld [wLastMap],a
+ ret
+
+; gets the map ID, tile block map view pointer, tileset, and coordinates
+LoadSpecialWarpData: ; 6073 (1:6073)
+ ld a, [wd72d]
+ cp TRADE_CENTER
+ jr nz, .notTradeCenter
+ ld hl, TradeCenterSpec1
+ ld a, [hSerialConnectionStatus]
+ cp USING_INTERNAL_CLOCK ; which gameboy is clocking determines who is on the left and who is on the right
+ jr z, .copyWarpData
+ ld hl, TradeCenterSpec2
+ jr .copyWarpData
+.notTradeCenter
+ cp COLOSSEUM
+ jr nz, .notColosseum
+ ld hl, ColosseumSpec1
+ ld a, [hSerialConnectionStatus]
+ cp USING_INTERNAL_CLOCK
+ jr z, .copyWarpData
+ ld hl, ColosseumSpec2
+ jr .copyWarpData
+.notColosseum
+ ld a, [wd732]
+ bit 1, a
+ jr nz, .notFirstMap
+ bit 2, a
+ jr nz, .notFirstMap
+ ld hl, FirstMapSpec
+.copyWarpData
+ ld de, wCurMap
+ ld c, $7
+.copyWarpDataLoop
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec c
+ jr nz, .copyWarpDataLoop
+ ld a, [hli]
+ ld [wCurMapTileset], a
+ xor a
+ jr .done
+.notFirstMap
+ ld a, [wLastMap]
+ ld hl, wd732
+ bit 4, [hl] ; used dungeon warp (jumped down hole/waterfall)?
+ jr nz, .usedDunegonWarp
+ bit 6, [hl] ; return to last pokemon center (or player's house)?
+ res 6, [hl]
+ jr z, .otherDestination
+; return to last pokemon center or player's house
+ ld a, [wLastBlackoutMap]
+ jr .usedFlyWarp
+.usedDunegonWarp
+ ld hl, wd72d
+ res 4, [hl]
+ ld a, [wDungeonWarpDestinationMap]
+ ld b, a
+ ld [wCurMap], a
+ ld a, [wWhichDungeonWarp]
+ ld c, a
+ ld hl, DungeonWarpList
+ ld de, 0
+ ld a, 6
+ ld [wDungeonWarpDataEntrySize], a
+.dungeonWarpListLoop
+ ld a, [hli]
+ cp b
+ jr z, .matchedDungeonWarpDestinationMap
+ inc hl
+ jr .nextDungeonWarp
+.matchedDungeonWarpDestinationMap
+ ld a, [hli]
+ cp c
+ jr z, .matchedDungeonWarpID
+.nextDungeonWarp
+ ld a, [wDungeonWarpDataEntrySize]
+ add e
+ ld e, a
+ jr .dungeonWarpListLoop
+.matchedDungeonWarpID
+ ld hl, DungeonWarpData
+ add hl, de
+ jr .copyWarpData2
+.otherDestination
+ ld a, [wDestinationMap]
+.usedFlyWarp
+ ld b, a
+ ld [wCurMap], a
+ ld hl, FlyWarpDataPtr
+.flyWarpDataPtrLoop
+ ld a, [hli]
+ inc hl
+ cp b
+ jr z, .foundFlyWarpMatch
+ inc hl
+ inc hl
+ jr .flyWarpDataPtrLoop
+.foundFlyWarpMatch
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+.copyWarpData2
+ ld de, wCurrentTileBlockMapViewPointer
+ ld c, $6
+.copyWarpDataLoop2
+ ld a, [hli]
+ ld [de], a
+ inc de
+ dec c
+ jr nz, .copyWarpDataLoop2
+ xor a ; OVERWORLD
+ ld [wCurMapTileset], a
+.done
+ ld [wYOffsetSinceLastSpecialWarp], a
+ ld [wXOffsetSinceLastSpecialWarp], a
+ ld a, $ff ; the player's coordinates have already been updated using a special warp, so don't use any of the normal warps
+ ld [wDestinationWarpID], a
+ ret
+
+INCLUDE "data/special_warps.asm"
+; not IshiharaTeam
+SetDebugTeam: ; 623e (1:623e)
+ ld de, DebugTeam
+.loop
+ ld a, [de]
+ cp $ff
+ ret z
+ ld [wcf91], a
+ inc de
+ ld a, [de]
+ ld [wCurEnemyLVL], a
+ inc de
+ call AddPartyMon
+ jr .loop
+
+DebugTeam: ; 6253 (1:6253)
+ db SNORLAX,80
+ db PERSIAN,80
+ db JIGGLYPUFF,15
+ db PIKACHU,5
+ db $FF
+
+EmptyFunc: ; 64ea (1:64ea)
+ ret
+
+ dr $625d,$66db
+ChoosePlayerName: ; 66db (1:66db)
+ dr $66db,$6722
+ChooseRivalName: ; 6722 (1:6722)
+ dr $6722,$68a6
SubtractAmountPaidFromMoney_: ; 68a6 (1:68a6)
dr $68a6,$68c9
HandleItemListSwapping: ; 68c9 (1:68c9)
@@ -2902,9 +3077,7 @@ ShrinkPic2: INCBIN "pic/trainer/shrink2.pic"
StartMenu_Pokedex: ; 11c22 (4:5c22)
dr $11c22,$11c36
StartMenu_Pokemon: ; 11c36 (4:5c36)
- dr $11c36,$11ce4
-SpecialEnterMap: ; 11ce4 (4:5ce4)
- dr $11ce4,$11e98
+ dr $11c36,$11e98
ErasePartyMenuCursors: ; 11e98 (4:5e98)
dr $11e98,$11ead
StartMenu_Item: ; 11ead (4:5ead)
@@ -3512,7 +3685,9 @@ SECTION "bank10",ROMX,BANK[$10]
dr $40000,$4050b
Pointer_4050b: ; 4050b (10:450b)
- dr $4050b,$44000
+ dr $4050b,$41c70
+DisplayOptionMenu_: ; 41c70 (10:57c0)
+ dr $41c70,$44000
SECTION "bank11",ROMX,BANK[$11]