2020-06-18 07:11:12 -07:00
|
|
|
Option:
|
|
|
|
farcall _Option
|
2015-11-20 08:47:52 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
NewGame:
|
2015-11-20 08:47:52 -08:00
|
|
|
xor a
|
2018-09-15 17:15:55 -07:00
|
|
|
ld [wDebugFlags], a
|
2015-11-20 08:47:52 -08:00
|
|
|
call ResetWRAM
|
2023-09-30 15:10:44 -07:00
|
|
|
xor a
|
|
|
|
ldh [hMapAnims], a
|
|
|
|
call ClearTilemap
|
|
|
|
call LoadFrame
|
|
|
|
call LoadStandardFont
|
|
|
|
call ClearMenuAndWindowData
|
2023-07-27 15:07:07 -07:00
|
|
|
call InitTime ; set wStartDay through wStartSecond to $00
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall InitGender
|
2023-10-02 04:22:54 -07:00
|
|
|
ld b, NAME_PLAYER
|
|
|
|
ld de, wPlayerName
|
|
|
|
farcall NamingScreen
|
2023-10-23 08:04:59 -07:00
|
|
|
if DEF(_DEBUG)
|
|
|
|
ld a, MEW
|
|
|
|
ld [wCurPartySpecies], a
|
|
|
|
ld a, 100
|
|
|
|
ld [wCurPartyLevel], a
|
|
|
|
predef TryAddMonToParty
|
2024-01-18 05:06:10 -08:00
|
|
|
ld a, -1
|
|
|
|
ld [wUnlockedLevels], a ; debug
|
2023-10-23 08:04:59 -07:00
|
|
|
endc
|
2023-09-30 15:10:44 -07:00
|
|
|
farcall AutoSaveGameOutsideOverworld
|
|
|
|
jp GameMenu
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ResetWRAM:
|
2015-11-20 08:47:52 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2015-11-20 08:47:52 -08:00
|
|
|
call _ResetWRAM
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
_ResetWRAM:
|
2022-07-09 14:18:22 -07:00
|
|
|
ld hl, wShadowOAM
|
|
|
|
ld bc, wOptions - wShadowOAM
|
2015-11-20 08:47:52 -08:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
|
2024-01-03 07:58:53 -08:00
|
|
|
ld hl, STARTOF(WRAMX)
|
|
|
|
ld bc, wGameData - STARTOF(WRAMX)
|
2015-11-20 08:47:52 -08:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
|
|
|
|
ld hl, wGameData
|
|
|
|
ld bc, wGameDataEnd - wGameData
|
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
|
|
|
|
call DelayFrame
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hRandomSub]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wPlayerID], a
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
call DelayFrame
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hRandomAdd]
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wPlayerID + 1], a
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
call Random
|
|
|
|
ld [wSecretID], a
|
|
|
|
call DelayFrame
|
|
|
|
call Random
|
|
|
|
ld [wSecretID + 1], a
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyCount
|
2016-06-13 19:53:33 -07:00
|
|
|
call .InitList
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
xor a
|
|
|
|
ld [wCurBox], a
|
|
|
|
ld [wSavedAtLeastOnce], a
|
|
|
|
|
|
|
|
call SetDefaultBoxNames
|
|
|
|
|
|
|
|
ld a, BANK(sBoxCount)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2015-11-20 08:47:52 -08:00
|
|
|
ld hl, sBoxCount
|
2016-06-13 19:53:33 -07:00
|
|
|
call .InitList
|
2015-11-20 08:47:52 -08:00
|
|
|
call CloseSRAM
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wNumItems
|
2016-06-13 19:53:33 -07:00
|
|
|
call .InitList
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wNumKeyItems
|
2016-06-13 19:53:33 -07:00
|
|
|
call .InitList
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wNumBalls
|
2016-06-13 19:53:33 -07:00
|
|
|
call .InitList
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2019-03-18 08:43:58 -07:00
|
|
|
ld hl, wNumPCItems
|
2016-06-13 19:53:33 -07:00
|
|
|
call .InitList
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
xor a
|
|
|
|
ld [wRoamMon1Species], a
|
|
|
|
ld [wRoamMon2Species], a
|
|
|
|
ld [wRoamMon3Species], a
|
|
|
|
ld a, -1
|
|
|
|
ld [wRoamMon1MapGroup], a
|
|
|
|
ld [wRoamMon2MapGroup], a
|
|
|
|
ld [wRoamMon3MapGroup], a
|
|
|
|
ld [wRoamMon1MapNumber], a
|
|
|
|
ld [wRoamMon2MapNumber], a
|
|
|
|
ld [wRoamMon3MapNumber], a
|
|
|
|
|
|
|
|
call LoadOrRegenerateLuckyIDNumber
|
|
|
|
call InitializeMagikarpHouse
|
|
|
|
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2017-12-28 04:15:46 -08:00
|
|
|
ld [wJohtoBadges], a
|
|
|
|
ld [wKantoBadges], a
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2023-09-02 09:23:25 -07:00
|
|
|
ld [wChips], a
|
|
|
|
ld [wChips + 1], a
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2023-09-02 14:16:35 -07:00
|
|
|
if START_COINS >= $10000
|
|
|
|
ld a, HIGH(START_COINS >> 8)
|
2017-12-28 18:22:35 -08:00
|
|
|
endc
|
2023-09-02 14:16:35 -07:00
|
|
|
ld [wCoins], a
|
|
|
|
ld a, HIGH(START_COINS) ; mid
|
|
|
|
ld [wCoins + 1], a
|
|
|
|
ld a, LOW(START_COINS)
|
|
|
|
ld [wCoins + 2], a
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
xor a
|
2015-12-26 15:11:55 -08:00
|
|
|
ld [wWhichMomItem], a
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wMomItemTriggerBalance
|
2023-09-02 14:16:35 -07:00
|
|
|
ld [hl], HIGH(MOM_COINS >> 8)
|
2015-11-20 08:47:52 -08:00
|
|
|
inc hl
|
2023-09-02 14:16:35 -07:00
|
|
|
ld [hl], HIGH(MOM_COINS) ; mid
|
2015-11-20 08:47:52 -08:00
|
|
|
inc hl
|
2023-09-02 14:16:35 -07:00
|
|
|
ld [hl], LOW(MOM_COINS)
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
call InitializeNPCNames
|
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall InitDecorations
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall DeletePartyMonMail
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
call ResetGameTime
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.InitList:
|
2015-11-20 08:47:52 -08:00
|
|
|
; Loads 0 in the count and -1 in the first item or mon slot.
|
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
dec a
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
SetDefaultBoxNames:
|
2015-11-20 08:47:52 -08:00
|
|
|
ld hl, wBoxNames
|
|
|
|
ld c, 0
|
|
|
|
.loop
|
|
|
|
push hl
|
|
|
|
ld de, .Box
|
|
|
|
call CopyName2
|
|
|
|
dec hl
|
|
|
|
ld a, c
|
|
|
|
inc a
|
|
|
|
cp 10
|
|
|
|
jr c, .less
|
|
|
|
sub 10
|
|
|
|
ld [hl], "1"
|
|
|
|
inc hl
|
|
|
|
|
|
|
|
.less
|
|
|
|
add "0"
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], "@"
|
|
|
|
pop hl
|
|
|
|
ld de, 9
|
|
|
|
add hl, de
|
|
|
|
inc c
|
|
|
|
ld a, c
|
|
|
|
cp NUM_BOXES
|
|
|
|
jr c, .loop
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Box:
|
2015-11-20 08:47:52 -08:00
|
|
|
db "BOX@"
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
InitializeMagikarpHouse:
|
2015-11-20 08:47:52 -08:00
|
|
|
ld hl, wBestMagikarpLengthFeet
|
|
|
|
ld a, $3
|
|
|
|
ld [hli], a
|
|
|
|
ld a, $6
|
|
|
|
ld [hli], a
|
|
|
|
ld de, .Ralph
|
|
|
|
call CopyName2
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.Ralph:
|
2015-11-20 08:47:52 -08:00
|
|
|
db "RALPH@"
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
InitializeNPCNames:
|
2015-11-20 08:47:52 -08:00
|
|
|
ld hl, .Rival
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wRivalName
|
2015-11-20 08:47:52 -08:00
|
|
|
call .Copy
|
|
|
|
|
|
|
|
ld hl, .Mom
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wMomsName
|
2015-11-20 08:47:52 -08:00
|
|
|
call .Copy
|
|
|
|
|
|
|
|
ld hl, .Red
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wRedsName
|
2015-11-20 08:47:52 -08:00
|
|
|
call .Copy
|
|
|
|
|
|
|
|
ld hl, .Green
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wGreensName
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Copy:
|
2015-11-20 08:47:52 -08:00
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Rival: db "???@"
|
|
|
|
.Red: db "RED@"
|
|
|
|
.Green: db "GREEN@"
|
|
|
|
.Mom: db "MOM@"
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
LoadOrRegenerateLuckyIDNumber:
|
2015-11-20 08:47:52 -08:00
|
|
|
ld a, BANK(sLuckyIDNumber)
|
2020-06-17 14:03:38 -07:00
|
|
|
call OpenSRAM
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurDay]
|
2015-11-20 08:47:52 -08:00
|
|
|
inc a
|
|
|
|
ld b, a
|
|
|
|
ld a, [sLuckyNumberDay]
|
|
|
|
cp b
|
|
|
|
ld a, [sLuckyIDNumber + 1]
|
|
|
|
ld c, a
|
|
|
|
ld a, [sLuckyIDNumber]
|
|
|
|
jr z, .skip
|
|
|
|
ld a, b
|
|
|
|
ld [sLuckyNumberDay], a
|
|
|
|
call Random
|
|
|
|
ld c, a
|
|
|
|
call Random
|
|
|
|
|
|
|
|
.skip
|
|
|
|
ld [wLuckyIDNumber], a
|
|
|
|
ld [sLuckyIDNumber], a
|
|
|
|
ld a, c
|
|
|
|
ld [wLuckyIDNumber + 1], a
|
|
|
|
ld [sLuckyIDNumber + 1], a
|
|
|
|
jp CloseSRAM
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Continue:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall TryLoadSaveFile
|
2015-11-20 08:47:52 -08:00
|
|
|
jr c, .FailToLoad
|
2023-09-30 15:10:44 -07:00
|
|
|
jp GameMenu_KeepMusic
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.FailToLoad:
|
2015-11-20 08:47:52 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DisplaySaveInfoOnContinue:
|
2015-11-20 08:47:52 -08:00
|
|
|
lb de, 4, 8
|
|
|
|
call DisplayNormalContinueData
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DisplaySaveInfoOnSave:
|
2015-11-20 08:47:52 -08:00
|
|
|
lb de, 4, 0
|
|
|
|
jr DisplayNormalContinueData
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
DisplayNormalContinueData:
|
2015-11-20 08:47:52 -08:00
|
|
|
call Continue_LoadMenuHeader
|
|
|
|
call Continue_DisplayBadgesDexPlayerName
|
|
|
|
call Continue_PrintGameTime
|
2023-08-02 10:52:51 -07:00
|
|
|
call LoadFrame
|
2015-11-20 08:47:52 -08:00
|
|
|
call UpdateSprites
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Continue_LoadMenuHeader:
|
2015-11-20 08:47:52 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2018-01-23 13:08:43 -08:00
|
|
|
ld hl, .MenuHeader_Dex
|
2017-12-28 04:15:46 -08:00
|
|
|
ld a, [wStatusFlags]
|
2018-01-22 12:40:43 -08:00
|
|
|
bit STATUSFLAGS_POKEDEX_F, a
|
2018-01-16 19:57:19 -08:00
|
|
|
jr nz, .show_menu
|
2018-01-23 13:08:43 -08:00
|
|
|
ld hl, .MenuHeader_NoDex
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-01-16 19:57:19 -08:00
|
|
|
.show_menu
|
2018-01-23 13:08:43 -08:00
|
|
|
call _OffsetMenuHeader
|
2015-11-20 08:47:52 -08:00
|
|
|
call MenuBox
|
2015-12-15 15:59:49 -08:00
|
|
|
call PlaceVerticalMenuItems
|
2015-11-20 08:47:52 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.MenuHeader_Dex:
|
2018-01-14 02:59:56 -08:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 13:38:14 -08:00
|
|
|
menu_coords 0, 0, 15, 9
|
2018-01-23 13:08:43 -08:00
|
|
|
dw .MenuData_Dex
|
2015-11-20 08:47:52 -08:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.MenuData_Dex:
|
2018-01-14 02:59:56 -08:00
|
|
|
db 0 ; flags
|
2015-11-20 08:47:52 -08:00
|
|
|
db 4 ; items
|
|
|
|
db "PLAYER@"
|
|
|
|
db "BADGES@"
|
|
|
|
db "#DEX@"
|
|
|
|
db "TIME@"
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.MenuHeader_NoDex:
|
2018-01-14 02:59:56 -08:00
|
|
|
db MENU_BACKUP_TILES ; flags
|
2018-01-13 13:38:14 -08:00
|
|
|
menu_coords 0, 0, 15, 9
|
2018-01-23 13:08:43 -08:00
|
|
|
dw .MenuData_NoDex
|
2015-11-20 08:47:52 -08:00
|
|
|
db 1 ; default option
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.MenuData_NoDex:
|
2018-01-14 02:59:56 -08:00
|
|
|
db 0 ; flags
|
2015-11-20 08:47:52 -08:00
|
|
|
db 4 ; items
|
|
|
|
db "PLAYER <PLAYER>@"
|
|
|
|
db "BADGES@"
|
|
|
|
db " @"
|
|
|
|
db "TIME@"
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Continue_DisplayBadgesDexPlayerName:
|
2015-11-20 08:47:52 -08:00
|
|
|
call MenuBoxCoord2Tile
|
|
|
|
push hl
|
|
|
|
decoord 13, 4, 0
|
|
|
|
add hl, de
|
|
|
|
call Continue_DisplayBadgeCount
|
|
|
|
pop hl
|
|
|
|
push hl
|
|
|
|
decoord 12, 6, 0
|
|
|
|
add hl, de
|
|
|
|
call Continue_DisplayPokedexNumCaught
|
|
|
|
pop hl
|
|
|
|
push hl
|
|
|
|
decoord 8, 2, 0
|
|
|
|
add hl, de
|
|
|
|
ld de, .Player
|
|
|
|
call PlaceString
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Player:
|
2015-11-20 08:47:52 -08:00
|
|
|
db "<PLAYER>@"
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Continue_PrintGameTime:
|
2015-11-20 08:47:52 -08:00
|
|
|
decoord 9, 8, 0
|
|
|
|
add hl, de
|
|
|
|
call Continue_DisplayGameTime
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Continue_DisplayBadgeCount:
|
2015-11-20 08:47:52 -08:00
|
|
|
push hl
|
2017-12-28 04:15:46 -08:00
|
|
|
ld hl, wJohtoBadges
|
2015-11-20 08:47:52 -08:00
|
|
|
ld b, 2
|
|
|
|
call CountSetBits
|
|
|
|
pop hl
|
2018-07-28 16:27:34 -07:00
|
|
|
ld de, wNumSetBits
|
2015-11-20 08:47:52 -08:00
|
|
|
lb bc, 1, 2
|
|
|
|
jp PrintNum
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Continue_DisplayPokedexNumCaught:
|
2017-12-28 04:15:46 -08:00
|
|
|
ld a, [wStatusFlags]
|
2018-01-22 12:40:43 -08:00
|
|
|
bit STATUSFLAGS_POKEDEX_F, a
|
2015-11-20 08:47:52 -08:00
|
|
|
ret z
|
|
|
|
push hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPokedexCaught
|
2017-12-28 18:22:35 -08:00
|
|
|
if NUM_POKEMON % 8
|
2015-11-20 08:47:52 -08:00
|
|
|
ld b, NUM_POKEMON / 8 + 1
|
2017-12-28 18:22:35 -08:00
|
|
|
else
|
2015-11-20 08:47:52 -08:00
|
|
|
ld b, NUM_POKEMON / 8
|
2017-12-28 18:22:35 -08:00
|
|
|
endc
|
2015-11-20 08:47:52 -08:00
|
|
|
call CountSetBits
|
|
|
|
pop hl
|
2018-07-28 16:27:34 -07:00
|
|
|
ld de, wNumSetBits
|
2015-11-20 08:47:52 -08:00
|
|
|
lb bc, 1, 3
|
|
|
|
jp PrintNum
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Continue_DisplayGameTime:
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wGameTimeHours
|
2015-11-20 08:47:52 -08:00
|
|
|
lb bc, 2, 3
|
|
|
|
call PrintNum
|
2023-08-02 09:21:34 -07:00
|
|
|
ld [hl], ":"
|
2015-11-20 08:47:52 -08:00
|
|
|
inc hl
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wGameTimeMinutes
|
2015-11-20 08:47:52 -08:00
|
|
|
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
|
|
|
|
jp PrintNum
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
OakSpeech:
|
2015-11-20 08:47:52 -08:00
|
|
|
call RotateFourPalettesLeft
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
ld de, MUSIC_ROUTE_30
|
|
|
|
call PlayMusic
|
|
|
|
|
|
|
|
call RotateFourPalettesRight
|
|
|
|
call RotateThreePalettesRight
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-20 08:47:52 -08:00
|
|
|
ld a, POKEMON_PROF
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTrainerClass], a
|
2015-11-20 08:47:52 -08:00
|
|
|
call Intro_PrepTrainerPic
|
|
|
|
|
2023-07-26 08:01:20 -07:00
|
|
|
ld b, CGB_TRAINER_OR_MON_FRONTPIC_PALS
|
|
|
|
call GetCGBLayout
|
2015-11-20 08:47:52 -08:00
|
|
|
call Intro_RotatePalettesLeftFrontpic
|
|
|
|
|
|
|
|
ld hl, OakText1
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2015-11-20 08:47:52 -08:00
|
|
|
call RotateThreePalettesRight
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
ld a, WOOPER
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurSpecies], a
|
|
|
|
ld [wCurPartySpecies], a
|
2015-11-20 08:47:52 -08:00
|
|
|
call GetBaseData
|
|
|
|
|
|
|
|
hlcoord 6, 4
|
|
|
|
call PrepMonFrontpic
|
|
|
|
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTempMonDVs], a
|
|
|
|
ld [wTempMonDVs + 1], a
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2023-07-26 08:01:20 -07:00
|
|
|
ld b, CGB_TRAINER_OR_MON_FRONTPIC_PALS
|
|
|
|
call GetCGBLayout
|
2015-11-20 08:47:52 -08:00
|
|
|
call Intro_WipeInFrontpic
|
|
|
|
|
|
|
|
ld hl, OakText2
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2015-11-20 08:47:52 -08:00
|
|
|
ld hl, OakText4
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2015-11-20 08:47:52 -08:00
|
|
|
call RotateThreePalettesRight
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2015-11-20 08:47:52 -08:00
|
|
|
ld a, POKEMON_PROF
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wTrainerClass], a
|
2015-11-20 08:47:52 -08:00
|
|
|
call Intro_PrepTrainerPic
|
|
|
|
|
2023-07-26 08:01:20 -07:00
|
|
|
ld b, CGB_TRAINER_OR_MON_FRONTPIC_PALS
|
|
|
|
call GetCGBLayout
|
2015-11-20 08:47:52 -08:00
|
|
|
call Intro_RotatePalettesLeftFrontpic
|
|
|
|
|
|
|
|
ld hl, OakText5
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2015-11-20 08:47:52 -08:00
|
|
|
call RotateThreePalettesRight
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall DrawIntroPlayerPic
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2023-07-26 08:01:20 -07:00
|
|
|
ld b, CGB_TRAINER_OR_MON_FRONTPIC_PALS
|
|
|
|
call GetCGBLayout
|
2015-11-20 08:47:52 -08:00
|
|
|
call Intro_RotatePalettesLeftFrontpic
|
|
|
|
|
|
|
|
ld hl, OakText6
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2015-11-20 08:47:52 -08:00
|
|
|
call NamePlayer
|
|
|
|
ld hl, OakText7
|
2023-08-11 03:28:14 -07:00
|
|
|
call PrintText1bpp
|
2015-11-20 08:47:52 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
OakText1:
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far _OakText1
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
OakText2:
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far _OakText2
|
2018-11-17 10:33:03 -08:00
|
|
|
text_asm
|
2015-11-20 08:47:52 -08:00
|
|
|
ld a, WOOPER
|
2018-01-16 20:47:45 -08:00
|
|
|
call PlayMonCry
|
2015-11-20 08:47:52 -08:00
|
|
|
call WaitSFX
|
|
|
|
ld hl, OakText3
|
|
|
|
ret
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
OakText3:
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far _OakText3
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
OakText4:
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far _OakText4
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
OakText5:
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far _OakText5
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
OakText6:
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far _OakText6
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
OakText7:
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far _OakText7
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
NamePlayer:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall MovePlayerPicRight
|
|
|
|
farcall ShowPlayerNamingChoices
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-20 08:47:52 -08:00
|
|
|
dec a
|
|
|
|
jr z, .NewName
|
|
|
|
call StorePlayerName
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall ApplyMonOrTrainerPals
|
|
|
|
farcall MovePlayerPicLeft
|
2015-11-20 08:47:52 -08:00
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.NewName:
|
2018-09-16 13:02:58 -07:00
|
|
|
ld b, NAME_PLAYER
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wPlayerName
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall NamingScreen
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
call RotateThreePalettesRight
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2023-08-02 10:52:51 -07:00
|
|
|
call LoadFrame
|
2015-11-20 08:47:52 -08:00
|
|
|
call WaitBGMap
|
|
|
|
|
|
|
|
xor a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurPartySpecies], a
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall DrawIntroPlayerPic
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2023-07-26 08:01:20 -07:00
|
|
|
ld b, CGB_TRAINER_OR_MON_FRONTPIC_PALS
|
|
|
|
call GetCGBLayout
|
2015-11-20 08:47:52 -08:00
|
|
|
call RotateThreePalettesLeft
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPlayerName
|
2015-11-20 08:47:52 -08:00
|
|
|
ld de, .Chris
|
2017-12-28 04:15:46 -08:00
|
|
|
ld a, [wPlayerGender]
|
2018-01-22 11:34:55 -08:00
|
|
|
bit PLAYERGENDER_FEMALE_F, a
|
2015-11-20 08:47:52 -08:00
|
|
|
jr z, .Male
|
|
|
|
ld de, .Kris
|
2016-04-10 11:42:14 -07:00
|
|
|
.Male:
|
2015-11-20 08:47:52 -08:00
|
|
|
call InitName
|
|
|
|
ret
|
|
|
|
|
2016-04-10 11:42:14 -07:00
|
|
|
.Chris:
|
2015-11-20 08:47:52 -08:00
|
|
|
db "CHRIS@@@@@@"
|
2016-04-10 11:42:14 -07:00
|
|
|
.Kris:
|
2015-11-20 08:47:52 -08:00
|
|
|
db "KRIS@@@@@@@"
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
StorePlayerName:
|
2015-11-20 08:47:52 -08:00
|
|
|
ld a, "@"
|
|
|
|
ld bc, NAME_LENGTH
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPlayerName
|
2015-11-20 08:47:52 -08:00
|
|
|
call ByteFill
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPlayerName
|
|
|
|
ld de, wStringBuffer2
|
2015-11-20 08:47:52 -08:00
|
|
|
call CopyName2
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ShrinkPlayer:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hROMBank]
|
2015-11-20 08:47:52 -08:00
|
|
|
push af
|
|
|
|
|
2018-01-09 14:20:47 -08:00
|
|
|
ld a, 32 ; fade time
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMusicFade], a
|
2015-11-20 08:47:52 -08:00
|
|
|
ld de, MUSIC_NONE
|
|
|
|
ld a, e
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMusicFadeID], a
|
2015-11-20 08:47:52 -08:00
|
|
|
ld a, d
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMusicFadeID + 1], a
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
ld de, SFX_ESCAPE_ROPE
|
|
|
|
call PlaySFX
|
|
|
|
pop af
|
|
|
|
rst Bankswitch
|
|
|
|
|
|
|
|
ld c, 8
|
|
|
|
call DelayFrames
|
|
|
|
|
|
|
|
ld hl, Shrink1Pic
|
|
|
|
ld b, BANK(Shrink1Pic)
|
|
|
|
call ShrinkFrame
|
|
|
|
|
|
|
|
ld c, 8
|
|
|
|
call DelayFrames
|
|
|
|
|
|
|
|
ld hl, Shrink2Pic
|
|
|
|
ld b, BANK(Shrink2Pic)
|
|
|
|
call ShrinkFrame
|
|
|
|
|
|
|
|
ld c, 8
|
|
|
|
call DelayFrames
|
|
|
|
|
|
|
|
hlcoord 6, 5
|
|
|
|
ld b, 7
|
|
|
|
ld c, 7
|
|
|
|
call ClearBox
|
|
|
|
|
|
|
|
ld c, 3
|
|
|
|
call DelayFrames
|
|
|
|
|
|
|
|
call Intro_PlacePlayerSprite
|
2023-08-02 10:52:51 -07:00
|
|
|
call LoadFrame
|
2015-11-20 08:47:52 -08:00
|
|
|
|
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
|
|
|
|
call RotateThreePalettesRight
|
2020-02-13 09:30:13 -08:00
|
|
|
call ClearTilemap
|
2015-11-20 08:47:52 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Intro_RotatePalettesLeftFrontpic:
|
2015-11-20 08:47:52 -08:00
|
|
|
ld hl, IntroFadePalettes
|
2018-01-22 10:00:35 -08:00
|
|
|
ld b, IntroFadePalettes.End - IntroFadePalettes
|
2015-11-20 08:47:52 -08:00
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
|
|
|
call DmgToCgbBGPals
|
|
|
|
ld c, 10
|
|
|
|
call DelayFrames
|
|
|
|
dec b
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
IntroFadePalettes:
|
2018-09-09 15:15:54 -07:00
|
|
|
dc 1, 1, 1, 0
|
|
|
|
dc 2, 2, 2, 0
|
|
|
|
dc 3, 3, 3, 0
|
|
|
|
dc 3, 3, 2, 0
|
|
|
|
dc 3, 3, 1, 0
|
|
|
|
dc 3, 2, 1, 0
|
2018-01-22 10:00:35 -08:00
|
|
|
.End
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Intro_WipeInFrontpic:
|
2015-11-20 08:47:52 -08:00
|
|
|
ld a, $77
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hWX], a
|
2015-11-20 08:47:52 -08:00
|
|
|
call DelayFrame
|
|
|
|
ld a, %11100100
|
|
|
|
call DmgToCgbBGPals
|
|
|
|
.loop
|
|
|
|
call DelayFrame
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hWX]
|
2015-11-20 08:47:52 -08:00
|
|
|
sub $8
|
|
|
|
cp -1
|
|
|
|
ret z
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hWX], a
|
2015-11-20 08:47:52 -08:00
|
|
|
jr .loop
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Intro_PrepTrainerPic:
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles2
|
2018-01-16 11:30:10 -08:00
|
|
|
farcall GetTrainerPic
|
2015-11-20 08:47:52 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hGraphicStartTile], a
|
2015-11-20 08:47:52 -08:00
|
|
|
hlcoord 6, 4
|
|
|
|
lb bc, 7, 7
|
2018-01-16 11:30:10 -08:00
|
|
|
predef PlaceGraphic
|
2015-11-20 08:47:52 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
ShrinkFrame:
|
2017-12-28 04:32:33 -08:00
|
|
|
ld de, vTiles2
|
2018-01-16 11:30:10 -08:00
|
|
|
ld c, 7 * 7
|
|
|
|
predef DecompressGet2bpp
|
2015-11-20 08:47:52 -08:00
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hGraphicStartTile], a
|
2015-11-20 08:47:52 -08:00
|
|
|
hlcoord 6, 4
|
|
|
|
lb bc, 7, 7
|
2018-01-16 11:30:10 -08:00
|
|
|
predef PlaceGraphic
|
2015-11-20 08:47:52 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
Intro_PlacePlayerSprite:
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall GetPlayerIcon
|
2020-06-18 07:11:12 -07:00
|
|
|
ld c, 12
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles0
|
2015-11-20 08:47:52 -08:00
|
|
|
call Request2bpp
|
|
|
|
|
2022-07-09 14:18:22 -07:00
|
|
|
ld hl, wShadowOAMSprite00
|
2015-11-20 08:47:52 -08:00
|
|
|
ld de, .sprites
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
|
|
|
|
ld c, a
|
|
|
|
.loop
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [hli], a ; y
|
2015-11-20 08:47:52 -08:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [hli], a ; x
|
2015-11-20 08:47:52 -08:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
2018-01-10 10:47:57 -08:00
|
|
|
ld [hli], a ; tile id
|
2015-11-20 08:47:52 -08:00
|
|
|
|
2018-01-10 10:47:57 -08:00
|
|
|
ld b, PAL_OW_RED
|
2017-12-28 04:15:46 -08:00
|
|
|
ld a, [wPlayerGender]
|
2018-01-22 11:34:55 -08:00
|
|
|
bit PLAYERGENDER_FEMALE_F, a
|
2015-11-20 08:47:52 -08:00
|
|
|
jr z, .male
|
2018-01-10 10:47:57 -08:00
|
|
|
ld b, PAL_OW_BLUE
|
2015-11-20 08:47:52 -08:00
|
|
|
.male
|
|
|
|
ld a, b
|
|
|
|
|
2020-06-18 07:11:12 -07:00
|
|
|
ld [hli], a ; attributes
|
2015-11-20 08:47:52 -08:00
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.sprites
|
2015-11-20 08:47:52 -08:00
|
|
|
db 4
|
2018-01-10 10:47:57 -08:00
|
|
|
; y pxl, x pxl, tile offset
|
2023-07-26 17:50:16 -07:00
|
|
|
db 9 * TILE_WIDTH + 4, 9 * TILE_WIDTH, 0
|
|
|
|
db 9 * TILE_WIDTH + 4, 10 * TILE_WIDTH, 1
|
|
|
|
db 10 * TILE_WIDTH + 4, 9 * TILE_WIDTH, 2
|
|
|
|
db 10 * TILE_WIDTH + 4, 10 * TILE_WIDTH, 3
|