mystery gift, credits

This commit is contained in:
PikalaxALT 2015-12-14 20:06:41 -05:00
parent c635e30777
commit 6e257bc7cd
17 changed files with 528 additions and 486 deletions

View File

@ -1,5 +1,8 @@
INCLUDE "includes.asm" INCLUDE "includes.asm"
wCreditsBorderFrame EQU $cf64
wCreditsBorderMon EQU $cf65
wCreditsLYOverride EQU $cf66
SECTION "Credits", ROMX, BANK[CREDITS] SECTION "Credits", ROMX, BANK[CREDITS]
@ -119,11 +122,11 @@ const_value SET -7
Credits:: ; 109847 Credits:: ; 109847
bit 6, b bit 6, b ; Hall Of Fame
ld a, $0 ld a, $0
jr z, .asm_10984f jr z, .okay
ld a, $40 ld a, $40
.asm_10984f .okay
ld [wJumptableIndex], a ld [wJumptableIndex], a
ld a, [rSVBK] ld a, [rSVBK]
@ -135,17 +138,17 @@ Credits:: ; 109847
call ClearTileMap call ClearTileMap
call ClearSprites call ClearSprites
ld hl, wca00 ld hl, wCreditsFaux2bpp
ld c, $80 ld c, $80
ld de, $ff00 ld de, $ff00
.asm_10986a .load_loop
ld a, e ld a, e
ld [hli], a ld [hli], a
ld a, d ld a, d
ld [hli], a ld [hli], a
dec c dec c
jr nz, .asm_10986a jr nz, .load_loop
ld de, CreditsBorderGFX ld de, CreditsBorderGFX
ld hl, VTiles2 tile $20 ld hl, VTiles2 tile $20
@ -163,20 +166,20 @@ Credits:: ; 109847
call Request2bpp call Request2bpp
ld a, $ff ld a, $ff
ld [wcf64], a ld [wCreditsBorderFrame], a
xor a xor a
ld [wcf65], a ld [wCreditsBorderMon], a
call Function109bca call Credits_LoadBorderGFX
ld e, l ld e, l
ld d, h ld d, h
ld hl, VTiles2 ld hl, VTiles2
lb bc, BANK(CreditsMonsGFX), $10 lb bc, BANK(CreditsMonsGFX), 16
call Request2bpp call Request2bpp
call Function109a95 call ConstructCreditsTilemap
xor a xor a
ld [wcf66], a ld [wCreditsLYOverride], a
ld hl, LYOverrides ld hl, LYOverrides
ld bc, $100 ld bc, $100
@ -200,16 +203,16 @@ Credits:: ; 109847
ld [wcd21], a ld [wcd21], a
ld [CreditsTimer], a ld [CreditsTimer], a
.asm_1098de .execution_loop
call Function109908 call Credits_HandleBButton
call Function1098fd call Credits_HandleAButton
jr nz, .asm_1098ee jr nz, .exit_credits
call Function109926 call Credits_Jumptable
call DelayFrame call DelayFrame
jr .asm_1098de jr .execution_loop
.asm_1098ee .exit_credits
call ClearBGPalettes call ClearBGPalettes
xor a xor a
ld [hLCDStatCustom], a ld [hLCDStatCustom], a
@ -221,18 +224,18 @@ Credits:: ; 109847
ret ret
; 1098fd ; 1098fd
Function1098fd: ; 1098fd Credits_HandleAButton: ; 1098fd
ld a, [hJoypadDown] ld a, [hJoypadDown]
and $1 and A_BUTTON
ret z ret z
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
bit 7, a bit 7, a
ret ret
; 109908 ; 109908
Function109908: ; 109908 Credits_HandleBButton: ; 109908
ld a, [hJoypadDown] ld a, [hJoypadDown]
and $2 and B_BUTTON
ret z ret z
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
bit 6, a bit 6, a
@ -240,12 +243,11 @@ Function109908: ; 109908
ld hl, CreditsPos ld hl, CreditsPos
ld a, [hli] ld a, [hli]
cp $d cp $d
jr nc, .asm_10991e jr nc, .okay
ld a, [hli] ld a, [hli]
and a and a
ret z ret z
.okay
.asm_10991e
ld hl, CreditsTimer ld hl, CreditsTimer
ld a, [hl] ld a, [hl]
and a and a
@ -254,12 +256,12 @@ Function109908: ; 109908
ret ret
; 109926 ; 109926
Function109926: ; 109926 Credits_Jumptable: ; 109926
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
and $f and $f
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, Jumptable_109937 ld hl, .Jumptable
rept 2 rept 2
add hl, de add hl, de
endr endr
@ -270,79 +272,80 @@ endr
; 109937 ; 109937
Jumptable_109937: ; 109937 (42:5937) .Jumptable: ; 109937 (42:5937)
dw ParseCredits jumptable_start
dw Function109951 jumptable ParseCredits
dw Function109951 jumptable Credits_Next
dw Function10995e jumptable Credits_Next
dw Function109964 jumptable Credits_PrepBGMapUpdate
dw Function10997b jumptable Credits_UpdateGFXRequestPath
dw Function109986 jumptable Credits_RequestGFX
dw Function109951 jumptable Credits_LYOverride
dw Function109951 jumptable Credits_Next
dw Function109951 jumptable Credits_Next
dw Function109964 jumptable Credits_Next
dw Function10997b jumptable Credits_UpdateGFXRequestPath
dw Function109956 jumptable Credits_RequestGFX
jumptable Credits_LoopBack
Function109951: ; 109951 (42:5951) Credits_Next: ; 109951 (42:5951)
ld hl, wJumptableIndex ld hl, wJumptableIndex
inc [hl] inc [hl]
ret ret
Function109956: ; 109956 (42:5956) Credits_LoopBack: ; 109956 (42:5956)
ld hl, wJumptableIndex ld hl, wJumptableIndex
ld a, [hl] ld a, [hl]
and $f0 and $f0
ld [hl], a ld [hl], a
ret ret
Function10995e: ; 10995e (42:595e) Credits_PrepBGMapUpdate: ; 10995e (42:595e)
xor a xor a
ld [hBGMapMode], a ld [hBGMapMode], a
jp Function109951 jp Credits_Next
Function109964: ; 109964 (42:5964) Credits_UpdateGFXRequestPath: ; 109964 (42:5964)
call Function109bca call Credits_LoadBorderGFX
ld a, l ld a, l
ld [Requested2bppSource], a ld [Requested2bppSource], a
ld a, h ld a, h
ld [Requested2bppSource + 1], a ld [Requested2bppSource + 1], a
ld a, $0 ld a, VTiles2 % $100
ld [Requested2bppDest], a ld [Requested2bppDest], a
ld a, $90 ld a, VTiles2 / $100
ld [Requested2bppDest + 1], a ld [Requested2bppDest + 1], a
jr Function10997b jr Credits_RequestGFX
Function10997b: ; 10997b (42:597b) Credits_RequestGFX: ; 10997b (42:597b)
xor a xor a
ld [hBGMapMode], a ld [hBGMapMode], a
ld a, $8 ld a, $8
ld [Requested2bpp], a ld [Requested2bpp], a
jp Function109951 jp Credits_Next
Function109986: ; 109986 (42:5986) Credits_LYOverride: ; 109986 (42:5986)
ld a, [rLY] ld a, [rLY]
cp $30 cp $30
jr c, Function109986 jr c, Credits_LYOverride
ld a, [wcf66] ld a, [wCreditsLYOverride]
rept 2 rept 2
dec a dec a
endr endr
ld [wcf66], a ld [wCreditsLYOverride], a
ld hl, LYOverrides + $1f ld hl, LYOverrides + $1f
call Function1099a3 call .Fill
ld hl, LYOverrides + $87 ld hl, LYOverrides + $87
call Function1099a3 call .Fill
jp Function109951 jp Credits_Next
Function1099a3: ; 1099a3 (42:59a3) .Fill: ; 1099a3 (42:59a3)
ld c, $8 ld c, $8
.asm_1099a5 .loop
ld [hli], a ld [hli], a
dec c dec c
jr nz, .asm_1099a5 jr nz, .loop
ret ret
; 1099aa ; 1099aa
@ -437,15 +440,15 @@ endr
.theend .theend
; Display "The End" graphic. ; Display "The End" graphic.
call Function109c11 call Credits_TheEnd
jr .loop jr .loop
.scene .scene
; Update the scene number and corresponding palette. ; Update the scene number and corresponding palette.
call .get call .get
ld [wcf65], a ; scene ld [wCreditsBorderMon], a ; scene
xor a xor a
ld [wcf64], a ; frame ld [wCreditsBorderFrame], a ; frame
call GetCreditsPalette call GetCreditsPalette
call SetPalettes ; update hw pal registers call SetPalettes ; update hw pal registers
jr .loop jr .loop
@ -453,7 +456,7 @@ endr
.clear .clear
; Clear the banner. ; Clear the banner.
ld a, $ff ld a, $ff
ld [wcf64], a ; frame ld [wCreditsBorderFrame], a ; frame
jr .loop jr .loop
.music .music
@ -484,13 +487,13 @@ endr
ld [hBGMapMode], a ld [hBGMapMode], a
.done .done
jp Function109951 jp Credits_Next
.end .end
; Stop execution. ; Stop execution.
ld hl, wJumptableIndex ld hl, wJumptableIndex
set 7, [hl] set 7, [hl]
ld a, $20 ld a, 32
ld [MusicFade], a ld [MusicFade], a
ld a, MUSIC_POST_CREDITS % $100 ld a, MUSIC_POST_CREDITS % $100
ld [MusicFadeID], a ld [MusicFadeID], a
@ -521,91 +524,96 @@ endr
; 109a95 ; 109a95
Function109a95: ; 109a95 (42:5a95) ConstructCreditsTilemap: ; 109a95 (42:5a95)
xor a xor a
ld [hBGMapMode], a ld [hBGMapMode], a
ld a, $c ld a, $c
ld [hBGMapAddress], a ld [hBGMapAddress], a
ld a, $28 ld a, $28
hlcoord 0, 0 hlcoord 0, 0
ld bc, $168 ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
call ByteFill call ByteFill
ld a, $7f ld a, $7f
hlcoord 0, 4 hlcoord 0, 4
ld bc, $118 ld bc, (SCREEN_HEIGHT - 4) * SCREEN_WIDTH
call ByteFill call ByteFill
hlcoord 0, 4 hlcoord 0, 4
ld a, $24 ld a, $24
call Function109b1d call DrawCreditsBorder
hlcoord 0, 17 hlcoord 0, 17
ld a, $20 ld a, $20
call Function109b1d call DrawCreditsBorder
hlcoord 0, 0, AttrMap hlcoord 0, 0, AttrMap
ld bc, $50 ld bc, 4 * SCREEN_WIDTH
xor a xor a
call ByteFill call ByteFill
hlcoord 0, 4, AttrMap hlcoord 0, 4, AttrMap
ld bc, $14 ld bc, SCREEN_WIDTH
ld a, $1 ld a, $1
call ByteFill call ByteFill
hlcoord 0, 5, AttrMap hlcoord 0, 5, AttrMap
ld bc, $f0 ld bc, 12 * SCREEN_WIDTH
ld a, $2 ld a, $2
call ByteFill call ByteFill
hlcoord 0, 17, AttrMap hlcoord 0, 17, AttrMap
ld bc, $14 ld bc, SCREEN_WIDTH
ld a, $1 ld a, $1
call ByteFill call ByteFill
call WaitBGMap2 call WaitBGMap2
xor a xor a
ld [hBGMapMode], a ld [hBGMapMode], a
ld [hBGMapAddress], a ld [hBGMapAddress], a
hlcoord 0, 0 hlcoord 0, 0
call Function109aff call .InitTopPortion
call WaitBGMap2 call WaitBGMap2
ret ret
Function109aff: ; 109aff (42:5aff) .InitTopPortion: ; 109aff (42:5aff)
ld b, $5 ld b, 5
.asm_109b01 .outer_loop
push hl push hl
ld de, $11 ld de, SCREEN_WIDTH - 3
ld c, $4 ld c, 4
xor a xor a
.asm_109b08 .inner_loop
ld [hli], a rept 3
inc a
ld [hli], a
inc a
ld [hli], a ld [hli], a
inc a inc a
endr
ld [hl], a ld [hl], a
inc a inc a
add hl, de add hl, de
dec c dec c
jr nz, .asm_109b08 jr nz, .inner_loop
pop hl pop hl
rept 4 rept 4
inc hl inc hl
endr endr
dec b dec b
jr nz, .asm_109b01 jr nz, .outer_loop
ret ret
Function109b1d: ; 109b1d (42:5b1d) DrawCreditsBorder: ; 109b1d (42:5b1d)
ld c, $5 ld c, SCREEN_WIDTH / 4
.asm_109b1f .loop
push af push af
rept 3
ld [hli], a ld [hli], a
inc a inc a
ld [hli], a endr
inc a
ld [hli], a
inc a
ld [hli], a ld [hli], a
pop af pop af
dec c dec c
jr nz, .asm_109b1f jr nz, .loop
ret ret
GetCreditsPalette: ; 109b2c GetCreditsPalette: ; 109b2c
@ -619,7 +627,7 @@ GetCreditsPalette: ; 109b2c
.GetPalAddress .GetPalAddress
; Each set of palette data is 24 bytes long. ; Each set of palette data is 24 bytes long.
ld a, [wcf65] ; scene ld a, [wCreditsBorderMon] ; scene
and 3 and 3
add a add a
add a ; * 8 add a ; * 8
@ -724,18 +732,18 @@ CreditsPalettes:
RGB 31, 31, 31 RGB 31, 31, 31
; 109bca ; 109bca
Function109bca: ; 109bca (42:5bca) Credits_LoadBorderGFX: ; 109bca (42:5bca)
ld hl, wcf64 ld hl, wCreditsBorderFrame
ld a, [hl] ld a, [hl]
cp $ff cp $ff
jr z, .asm_109bed jr z, .init
and 3 and 3
ld e, a ld e, a
inc a inc a
and 3 and 3
ld [hl], a ld [hl], a
ld a, [wcf65] ld a, [wCreditsBorderMon]
and 3 and 3
rept 2 rept 2
add a add a
@ -744,50 +752,49 @@ endr
add a add a
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, CreditsMonsFrames ld hl, .Frames
add hl, de add hl, de
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ret ret
.asm_109bed .init
ld hl, wca00 ld hl, wCreditsFaux2bpp
ret ret
; 109bf1 (42:5bf1) ; 109bf1 (42:5bf1)
CreditsMonsFrames: ; 109bf1 .Frames: ; 109bf1
dw CreditsPichuGFX dw CreditsPichuGFX
dw CreditsPichuGFX + $100 dw CreditsPichuGFX + 16 tiles
dw CreditsPichuGFX + $200 dw CreditsPichuGFX + 32 tiles
dw CreditsPichuGFX + $300 dw CreditsPichuGFX + 48 tiles
dw CreditsSmoochumGFX dw CreditsSmoochumGFX
dw CreditsSmoochumGFX + $100 dw CreditsSmoochumGFX + 16 tiles
dw CreditsSmoochumGFX + $200 dw CreditsSmoochumGFX + 32 tiles
dw CreditsSmoochumGFX + $300 dw CreditsSmoochumGFX + 48 tiles
dw CreditsDittoGFX dw CreditsDittoGFX
dw CreditsDittoGFX + $100 dw CreditsDittoGFX + 16 tiles
dw CreditsDittoGFX + $200 dw CreditsDittoGFX + 32 tiles
dw CreditsDittoGFX + $300 dw CreditsDittoGFX + 48 tiles
dw CreditsIgglybuffGFX dw CreditsIgglybuffGFX
dw CreditsIgglybuffGFX + $100 dw CreditsIgglybuffGFX + 16 tiles
dw CreditsIgglybuffGFX + $200 dw CreditsIgglybuffGFX + 32 tiles
dw CreditsIgglybuffGFX + $300 dw CreditsIgglybuffGFX + 48 tiles
; 109c11 ; 109c11
Function109c11: ; 109c11 (42:5c11) Credits_TheEnd: ; 109c11 (42:5c11)
ld a, $40 ld a, $40
hlcoord 6, 9 hlcoord 6, 9
call Function109c1c call .Load
hlcoord 6, 10 hlcoord 6, 10
.Load: ; 109c1c (42:5c1c)
Function109c1c: ; 109c1c (42:5c1c) ld c, 8
ld c, $8 .loop
.asm_109c1e
ld [hli], a ld [hli], a
inc a inc a
dec c dec c
jr nz, .asm_109c1e jr nz, .loop
ret ret
; 109c24 (42:5c24) ; 109c24 (42:5c24)

View File

@ -9,7 +9,7 @@ EvolutionAnimation: ; 4e5e1
ld a, [BaseDexNo] ld a, [BaseDexNo]
push af push af
call _EvolutionAnimation call .EvolutionAnimation
pop af pop af
ld [BaseDexNo], a ld [BaseDexNo], a
@ -29,7 +29,7 @@ EvolutionAnimation: ; 4e5e1
ret ret
; 4e607 ; 4e607
_EvolutionAnimation: ; 4e607 .EvolutionAnimation: ; 4e607
ld a, $e4 ld a, $e4
ld [rOBP0], a ld [rOBP0], a
@ -38,9 +38,9 @@ _EvolutionAnimation: ; 4e607
callba ClearSpriteAnims callba ClearSpriteAnims
ld de, EvolutionGFX ld de, .GFX
ld hl, VTiles0 ld hl, VTiles0
lb bc, BANK(EvolutionGFX), 8 lb bc, BANK(.GFX), 8
call Request2bpp call Request2bpp
xor a xor a
@ -76,7 +76,7 @@ _EvolutionAnimation: ; 4e607
ld a, $1 ld a, $1
ld [hBGMapMode], a ld [hBGMapMode], a
call Function4e794 call .check_statused
jr c, .skip_cry jr c, .skip_cry
ld a, [Buffer1] ld a, [Buffer1]
@ -106,10 +106,10 @@ _EvolutionAnimation: ; 4e607
ld c, $0 ld c, $0
call .GetSGBLayout call .GetSGBLayout
call Function4e7a6 call .PlayEvolvedSFX
callba ClearSpriteAnims callba ClearSpriteAnims
call Function4e794 call .check_statused
jr c, .asm_4e6de jr c, .no_anim
ld a, [wc2c6] ld a, [wc2c6]
push af push af
@ -131,7 +131,7 @@ _EvolutionAnimation: ; 4e607
ld [wc2c6], a ld [wc2c6], a
ret ret
.asm_4e6de .no_anim
ret ret
.cancel_evo .cancel_evo
@ -143,9 +143,9 @@ _EvolutionAnimation: ; 4e607
ld c, $0 ld c, $0
call .GetSGBLayout call .GetSGBLayout
call Function4e7a6 call .PlayEvolvedSFX
callba ClearSpriteAnims callba ClearSpriteAnims
call Function4e794 call .check_statused
ret c ret c
ld a, [PlayerHPPal] ld a, [PlayerHPPal]
@ -259,7 +259,7 @@ endr
ret ret
; 4e794 ; 4e794
Function4e794: ; 4e794 .check_statused: ; 4e794
ld a, [CurPartyMon] ld a, [CurPartyMon]
ld hl, PartyMon1Species ld hl, PartyMon1Species
call GetPartyLocation call GetPartyLocation
@ -269,7 +269,7 @@ Function4e794: ; 4e794
ret ret
; 4e7a6 ; 4e7a6
Function4e7a6: ; 4e7a6 .PlayEvolvedSFX: ; 4e7a6
ld a, [Buffer4] ld a, [Buffer4]
and a and a
ret nz ret nz
@ -279,24 +279,24 @@ Function4e7a6: ; 4e7a6
ld a, [hl] ld a, [hl]
push af push af
ld [hl], $0 ld [hl], $0
.loop .loop4
call Function4e7cf call .balls_of_light
jr nc, .done jr nc, .done
call Function4e80c call .AnimateBallsOfLight
jr .loop jr .loop4
.done .done
ld c, 32 ld c, 32
.loop2 .loop5
call Function4e80c call .AnimateBallsOfLight
dec c dec c
jr nz, .loop2 jr nz, .loop5
pop af pop af
ld [wJumptableIndex], a ld [wJumptableIndex], a
ret ret
; 4e7cf ; 4e7cf
Function4e7cf: ; 4e7cf .balls_of_light: ; 4e7cf
ld hl, wJumptableIndex ld hl, wJumptableIndex
ld a, [hl] ld a, [hl]
cp 32 cp 32
@ -304,45 +304,45 @@ Function4e7cf: ; 4e7cf
ld d, a ld d, a
inc [hl] inc [hl]
and $1 and $1
jr nz, .asm_4e7e6 jr nz, .done_balls
ld e, $0 ld e, $0
call Function4e7e8 call .GenerateBallOfLight
ld e, $10 ld e, $10
call Function4e7e8 call .GenerateBallOfLight
.asm_4e7e6 .done_balls
scf scf
ret ret
; 4e7e8 ; 4e7e8
Function4e7e8: ; 4e7e8 .GenerateBallOfLight: ; 4e7e8
push de push de
depixel 9, 11 depixel 9, 11
ld a, SPRITE_ANIM_INDEX_13 ld a, SPRITE_ANIM_INDEX_13
call _InitSpriteAnimStruct call _InitSpriteAnimStruct
ld hl, $b ld hl, SPRITEANIMSTRUCT_0B
add hl, bc add hl, bc
ld a, [wJumptableIndex] ld a, [wJumptableIndex]
and $e and %1110
sla a sla a
pop de pop de
add e add e
ld [hl], a ld [hl], a
ld hl, $3 ld hl, SPRITEANIMSTRUCT_TILE_ID
add hl, bc add hl, bc
ld [hl], $0 ld [hl], $0
ld hl, $c ld hl, SPRITEANIMSTRUCT_0C
add hl, bc add hl, bc
ld [hl], $10 ld [hl], $10
ret ret
; 4e80c ; 4e80c
Function4e80c: ; 4e80c .AnimateBallsOfLight: ; 4e80c
push bc push bc
callab PlaySpriteAnimations callab PlaySpriteAnimations
; a = (([hVBlankCounter] + 4) / 2) % NUM_PALETTES ; a = (([hVBlankCounter] + 4) / 2) % NUM_PALETTES
ld a, [hVBlankCounter] ld a, [hVBlankCounter]
and $e and %1110
srl a srl a
rept 2 rept 2
inc a inc a
@ -351,7 +351,7 @@ endr
ld b, a ld b, a
ld hl, Sprites + 3 ; attributes ld hl, Sprites + 3 ; attributes
ld c, 40 ld c, 40
.loop .loop6
ld a, [hl] ld a, [hl]
or b or b
ld [hli], a ld [hli], a
@ -359,13 +359,13 @@ rept 3
inc hl inc hl
endr endr
dec c dec c
jr nz, .loop jr nz, .loop6
pop bc pop bc
call DelayFrame call DelayFrame
ret ret
; 4e831 ; 4e831
EvolutionGFX: .GFX:
INCBIN "gfx/evo/bubble_large.2bpp" INCBIN "gfx/evo/bubble_large.2bpp"
INCBIN "gfx/evo/bubble.2bpp" INCBIN "gfx/evo/bubble.2bpp"

115
engine/init_gender.asm Executable file
View File

@ -0,0 +1,115 @@
InitCrystalData: ; 48000
ld a, $1
ld [wd474], a
xor a
ld [wd473], a
ld [PlayerGender], a
ld [wd475], a
ld [wd476], a
ld [wd477], a
ld [wd478], a
ld [wd002], a
ld [wd003], a
; could have done "ld a, [wd479] \ and %11111100", saved four operations
ld a, [wd479]
res 0, a
ld [wd479], a
ld a, [wd479]
res 1, a
ld [wd479], a
ret
; 4802f
INCLUDE "misc/mobile_12.asm"
InitGender: ; 48dcb (12:4dcb)
call InitGenderScreen
call LoadGenderScreenPal
call LoadGenderScreenLightBlueTile
call WaitBGMap2
call SetPalettes
ld hl, TextJump_AreYouABoyOrAreYouAGirl
call PrintText
ld hl, .MenuDataHeader
call LoadMenuDataHeader
call WaitBGMap2
call InterpretMenu2
call WriteBackup
ld a, [MenuSelection2]
dec a
ld [PlayerGender], a
ld c, 10
call DelayFrames
ret
; 48dfc (12:4dfc)
.MenuDataHeader: ; 0x48dfc
db $40 ; flags
db 04, 06 ; start coords
db 09, 12 ; end coords
dw .MenuData2
db 1 ; default option
; 0x48e04
.MenuData2: ; 0x48e04
db $a1 ; flags
db 2 ; items
db "Boy@"
db "Girl@"
; 0x48e0f
TextJump_AreYouABoyOrAreYouAGirl: ; 0x48e0f
; Are you a boy? Or are you a girl?
text_jump Text_AreYouABoyOrAreYouAGirl
db "@"
; 0x48e14
InitGenderScreen: ; 48e14 (12:4e14)
ld a, $10
ld [MusicFade], a
ld a, $0
ld [MusicFadeIDLo], a
ld a, $0
ld [MusicFadeIDHi], a
ld c, 8
call DelayFrames
call ClearBGPalettes
call InitCrystalData
call LoadFontsExtra
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, $0
call ByteFill
hlcoord 0, 0, AttrMap
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
xor a
call ByteFill
ret
LoadGenderScreenPal: ; 48e47 (12:4e47)
ld hl, .Palette
ld de, UnknBGPals
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
callba Function96a4
ret
; 48e5c (12:4e5c)
.Palette: ; 48e5c
RGB 31, 31, 31
RGB 09, 30, 31
RGB 01, 11, 31
RGB 00, 00, 00
; 48e64
LoadGenderScreenLightBlueTile: ; 48e64 (12:4e64)
ld de, .LightBlueTile
ld hl, VTiles2 tile $00
lb bc, BANK(.LightBlueTile), 1
call Get2bpp
ret
; 48e71 (12:4e71)
.LightBlueTile: ; 48e71
INCBIN "gfx/intro/gender_screen.2bpp"

View File

@ -353,7 +353,7 @@ LoadOrRegenerateLuckyIDNumber: ; 5d33
Continue: ; 5d65 Continue: ; 5d65
callba TryLoadSaveFile callba TryLoadSaveFile
jr c, .FailToLoad jr c, .FailToLoad
callba Function150b9 callba _LoadData
call LoadStandardMenuDataHeader call LoadStandardMenuDataHeader
call DisplaySaveInfoOnContinue call DisplaySaveInfoOnContinue
ld a, $1 ld a, $1

View File

@ -556,7 +556,7 @@ Function4a0c2: ; 4a0c2 (12:60c2)
ld bc, $6 ld bc, $6
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
callba Function150b9 callba _LoadData
ld c, 2 ld c, 2
call DelayFrames call DelayFrames
ld c, $1 ld c, $1

View File

@ -15,7 +15,9 @@ DoMysteryGift: ; 1048ba (41:48ba)
ld [wca02], a ld [wca02], a
ld a, [rIE] ld a, [rIE]
push af push af
call Function104a95 call Function104a95
ld d, a ld d, a
xor a xor a
ld [rIF], a ld [rIF], a
@ -37,7 +39,7 @@ DoMysteryGift: ; 1048ba (41:48ba)
cp $6c cp $6c
jp nz, .CommunicationError jp nz, .CommunicationError
ld a, [wc900] ld a, [wc900]
cp $3 cp 3
jr z, .skip_checks jr z, .skip_checks
call .CheckAlreadyGotFiveGiftsToday call .CheckAlreadyGotFiveGiftsToday
ld hl, .Text_MaxFiveGifts ; Only 5 gifts a day ld hl, .Text_MaxFiveGifts ; Only 5 gifts a day
@ -46,28 +48,28 @@ DoMysteryGift: ; 1048ba (41:48ba)
ld hl, .Text_MaxOneGiftPerPerson ; Only one gift a day per person ld hl, .Text_MaxOneGiftPerPerson ; Only one gift a day per person
jp c, .PrintTextAndExit jp c, .PrintTextAndExit
.skip_checks .skip_checks
ld a, [wc962] ld a, [wMysteryGiftPlayerBackupItem]
and a and a
jp nz, .GiftWaiting jp nz, .GiftWaiting
ld a, [wc912] ld a, [wc912]
and a and a
jp nz, .FriendNotReady jp nz, .FriendNotReady
ld a, [wc900] ld a, [wc900]
cp $3 cp 3
jr z, .skip_append_save jr z, .skip_append_save
call .AddMysteryGiftPartnerID call .AddMysteryGiftPartnerID
ld a, [wc900] ld a, [wc900]
cp $4 cp 4
jr z, .skip_append_save jr z, .skip_append_save
call .SaveMysteryGiftTrainerName call .SaveMysteryGiftTrainerName
callba RestoreMobileEventIndex callba RestoreMobileEventIndex
callba MobileFn_1060a9 callba MobileFn_1060a9
callba BackupMobileEventIndex callba BackupMobileEventIndex
.skip_append_save .skip_append_save
ld a, [wc90f] ld a, [wMysteryGiftPartnerSentDeco]
and a and a
jr z, .item jr z, .item
ld a, [wc911] ld a, [wMysteryGiftPartnerWhichDeco]
ld c, a ld c, a
callba MysteryGiftGetDecoration callba MysteryGiftGetDecoration
push bc push bc
@ -85,7 +87,7 @@ DoMysteryGift: ; 1048ba (41:48ba)
.item .item
call GetMysteryGiftBank call GetMysteryGiftBank
ld a, [wc910] ld a, [wMysteryGiftPartnerWhichItem]
ld c, a ld c, a
callba MysteryGiftGetItemHeldEffect callba MysteryGiftGetItemHeldEffect
ld a, c ld a, c
@ -249,7 +251,7 @@ Function104a95: ; 104a95 (41:4a95)
ld a, [hPrintNum9] ld a, [hPrintNum9]
cp $2 cp $2
jr z, Function104b22 jr z, Function104b22
ld hl, $ffb3 ld hl, hPrintNum1
ld b, $1 ld b, $1
call Function104d56 call Function104d56
jr nz, .ly_loop jr nz, .ly_loop
@ -323,7 +325,7 @@ Function104b22: ; 104b22 (41:4b22)
jp Function104bd0 jp Function104bd0
Function104b40: ; 104b40 (41:4b40) Function104b40: ; 104b40 (41:4b40)
ld hl, $ffb3 ld hl, hPrintNum1
ld b, $1 ld b, $1
call Function104d56 call Function104d56
ret nz ret nz
@ -333,14 +335,14 @@ Function104b49: ; 104b49 (41:4b49)
ld a, [hPrintNum10] ld a, [hPrintNum10]
cp $6c cp $6c
ret nz ret nz
ld a, [$ffb3] ld a, [hPrintNum1]
cp $96 cp $96
jp nz, Function104d32 jp nz, Function104d32
ld a, $90 ld a, $90
ld [$ffb3], a ld [hPrintNum1], a
call Function104d38 call Function104d38
ret nz ret nz
ld hl, $ffb3 ld hl, hPrintNum1
ld b, $1 ld b, $1
call Function104d4e call Function104d4e
ret nz ret nz
@ -362,8 +364,8 @@ Function104b49: ; 104b49 (41:4b49)
Function104b88: ; 104b88 (41:4b88) Function104b88: ; 104b88 (41:4b88)
ld a, $96 ld a, $96
ld [$ffb3], a ld [hPrintNum1], a
ld hl, $ffb3 ld hl, hPrintNum1
ld b, $1 ld b, $1
call Function104d4e call Function104d4e
ret nz ret nz
@ -373,7 +375,7 @@ Function104b88: ; 104b88 (41:4b88)
ret nz ret nz
call Function104d43 call Function104d43
ret nz ret nz
ld hl, $ffb3 ld hl, hPrintNum1
ld b, $1 ld b, $1
call Function104d56 call Function104d56
ret nz ret nz
@ -381,7 +383,7 @@ Function104b88: ; 104b88 (41:4b88)
ld a, [hPrintNum10] ld a, [hPrintNum10]
cp $6c cp $6c
ret nz ret nz
ld a, [$ffb3] ld a, [hPrintNum1]
cp $90 cp $90
jp nz, Function104d32 jp nz, Function104d32
call Function104d38 call Function104d38
@ -407,13 +409,13 @@ Function104bd0: ; 104bd0 (41:4bd0)
dec [hl] dec [hl]
jr z, .asm_104c18 jr z, .asm_104c18
ld hl, wMysteryGiftTrainerData ld hl, wMysteryGiftTrainerData
ld de, wc900 ld de, wMysteryGiftPartnerData
ld bc, $14 ld bc, wMysteryGiftPartnerDataEnd - wMysteryGiftPartnerData
call CopyBytes call CopyBytes
ld a, [wMysteryGiftTrainerData] ld a, [wMysteryGiftTrainerData]
cp $3 cp $3
jr nc, .asm_104c18 jr nc, .asm_104c18
callba Function10510b callba StagePartyDataForMysteryGift
call Function1050fb call Function1050fb
ld a, $26 ld a, $26
ld [wca02], a ld [wca02], a
@ -479,7 +481,7 @@ Function104c2d: ; 104c2d (41:4c2d)
jp Function104d1c jp Function104d1c
Function104c8a: ; 104c8a (41:4c8a) Function104c8a: ; 104c8a (41:4c8a)
ld hl, $ffb3 ld hl, hPrintNum1
ld b, $1 ld b, $1
call Function104d56 call Function104d56
ret nz ret nz
@ -487,14 +489,14 @@ Function104c8a: ; 104c8a (41:4c8a)
ld a, [hPrintNum10] ld a, [hPrintNum10]
cp $6c cp $6c
ret nz ret nz
ld a, [$ffb3] ld a, [hPrintNum1]
cp $3c cp $3c
jp nz, Function104d32 jp nz, Function104d32
swap a swap a
ld [$ffb3], a ld [hPrintNum1], a
call Function104d38 call Function104d38
ret nz ret nz
ld hl, $ffb3 ld hl, hPrintNum1
ld b, $1 ld b, $1
call Function104d4e call Function104d4e
ret nz ret nz
@ -516,8 +518,8 @@ Function104c8a: ; 104c8a (41:4c8a)
Function104cd2: ; 104cd2 (41:4cd2) Function104cd2: ; 104cd2 (41:4cd2)
ld a, $3c ld a, $3c
ld [$ffb3], a ld [hPrintNum1], a
ld hl, $ffb3 ld hl, hPrintNum1
ld b, $1 ld b, $1
call Function104d4e call Function104d4e
ret nz ret nz
@ -527,7 +529,7 @@ Function104cd2: ; 104cd2 (41:4cd2)
ret nz ret nz
call Function104d43 call Function104d43
ret nz ret nz
ld hl, $ffb3 ld hl, hPrintNum1
ld b, $1 ld b, $1
call Function104d56 call Function104d56
ret nz ret nz
@ -535,7 +537,7 @@ Function104cd2: ; 104cd2 (41:4cd2)
ld a, [hPrintNum10] ld a, [hPrintNum10]
cp $6c cp $6c
ret nz ret nz
ld a, [$ffb3] ld a, [hPrintNum1]
swap a swap a
cp $3c cp $3c
jp nz, Function104d32 jp nz, Function104d32
@ -1196,29 +1198,35 @@ GetMysteryGiftBank: ; 105106
; 10510b ; 10510b
Function10510b: ; 10510b (41:510b) StagePartyDataForMysteryGift: ; 10510b (41:510b)
; You will be sending this data to your mystery gift partner.
; Structure is the same as a trainer with species and moves
; defined.
ld a, BANK(sPokemonData) ld a, BANK(sPokemonData)
call GetSRAMBank call GetSRAMBank
ld de, OverworldMap ld de, wMysteryGiftStaging
ld bc, sPokemonData + PartyMons - wPokemonData ld bc, sPokemonData + PartyMons - wPokemonData
ld hl, sPokemonData + PartySpecies - wPokemonData ld hl, sPokemonData + PartySpecies - wPokemonData
.asm_105119 .loop
ld a, [hli] ld a, [hli]
cp $ff cp -1
jr z, .asm_105148 jr z, .party_end
cp EGG cp EGG
jr z, .asm_10513e jr z, .next
push hl push hl
; copy level
ld hl, MON_LEVEL ld hl, MON_LEVEL
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld [de], a ld [de], a
inc de inc de
; copy species
ld hl, MON_SPECIES ld hl, MON_SPECIES
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld [de], a ld [de], a
inc de inc de
; copy moves
ld hl, MON_MOVES ld hl, MON_MOVES
add hl, bc add hl, bc
push bc push bc
@ -1226,16 +1234,16 @@ Function10510b: ; 10510b (41:510b)
call CopyBytes call CopyBytes
pop bc pop bc
pop hl pop hl
.asm_10513e .next
push hl push hl
ld hl, PARTYMON_STRUCT_LENGTH ld hl, PARTYMON_STRUCT_LENGTH
add hl, bc add hl, bc
ld b, h ld b, h
ld c, l ld c, l
pop hl pop hl
jr .asm_105119 jr .loop
.asm_105148 .party_end
ld a, $ff ld a, -1
ld [de], a ld [de], a
ld a, $26 ld a, $26
ld [wca00], a ld [wca00], a
@ -1247,7 +1255,7 @@ Function105153: ; 105153 (41:5153)
ld hl, MysteryGiftGFX ld hl, MysteryGiftGFX
ld de, VTiles2 tile $00 ld de, VTiles2 tile $00
ld a, BANK(MysteryGiftGFX) ld a, BANK(MysteryGiftGFX)
ld bc, Function105688 - MysteryGiftGFX ld bc, MysteryGiftGFXEnd - MysteryGiftGFX
call FarCopyBytes call FarCopyBytes
hlcoord 0, 0 hlcoord 0, 0
ld a, $42 ld a, $42
@ -1268,13 +1276,13 @@ Function105153: ; 105153 (41:5153)
ld [hl], a ld [hl], a
hlcoord 7, 1 hlcoord 7, 1
ld a, $12 ld a, $12
call Function10522e call .Load5GFX
hlcoord 2, 2 hlcoord 2, 2
ld a, $17 ld a, $17
call Function105236 call .Load16GFX
hlcoord 2, 3 hlcoord 2, 3
ld a, $27 ld a, $27
call Function105236 call .Load16GFX
hlcoord 9, 4 hlcoord 9, 4
ld a, $37 ld a, $37
ld [hli], a ld [hli], a
@ -1284,19 +1292,19 @@ Function105153: ; 105153 (41:5153)
ld [hl], $4 ld [hl], $4
hlcoord 1, 3 hlcoord 1, 3
ld a, $5 ld a, $5
call Function105246 call .Load14Column
ld a, $9 ld a, $9
hlcoord 18, 5 hlcoord 18, 5
call Function105242 call .Load11Column
hlcoord 2, 5 hlcoord 2, 5
ld a, $b ld a, $b
call Function105251 call .Load16Row
hlcoord 2, 16 hlcoord 2, 16
ld a, $7 ld a, $7
call Function105251 call .Load16Row
hlcoord 2, 5 hlcoord 2, 5
ld a, $d ld a, $d
call Function10522e call .Load5GFX
hlcoord 7, 5 hlcoord 7, 5
ld [hl], $c ld [hl], $c
hlcoord 18, 5 hlcoord 18, 5
@ -1307,16 +1315,16 @@ Function105153: ; 105153 (41:5153)
ld [hl], $6 ld [hl], $6
hlcoord 2, 6 hlcoord 2, 6
ld a, $3a ld a, $3a
call Function105251 call .Load16Row
hlcoord 2, 15 hlcoord 2, 15
ld a, $40 ld a, $40
call Function105251 call .Load16Row
hlcoord 2, 6 hlcoord 2, 6
ld a, $3c ld a, $3c
call Function10523e call .Load9Column
hlcoord 17, 6 hlcoord 17, 6
ld a, $3e ld a, $3e
call Function10523e call .Load9Column
hlcoord 2, 6 hlcoord 2, 6
ld [hl], $39 ld [hl], $39
hlcoord 17, 6 hlcoord 17, 6
@ -1332,55 +1340,55 @@ Function105153: ; 105153 (41:5153)
call SetPalettes call SetPalettes
ret ret
Function10522e: ; 10522e (41:522e) .Load5GFX: ; 10522e (41:522e)
ld b, $5 ld b, 5
jr asm_105238 jr .gfx_loop
; 105232 (41:5232) ; 105232 (41:5232)
Function105232: ; unreferenced .Load6GFX: ; unreferenced
ld b, 6 ld b, 6
jr asm_105238 jr .gfx_loop
Function105236: ; 105236 (41:5236) .Load16GFX: ; 105236 (41:5236)
ld b, $10 ld b, 16
asm_105238: ; 105238 (41:5238) .gfx_loop: ; 105238 (41:5238)
ld [hli], a ld [hli], a
inc a inc a
dec b dec b
jr nz, asm_105238 jr nz, .gfx_loop
ret ret
Function10523e: ; 10523e (41:523e) .Load9Column: ; 10523e (41:523e)
ld b, $9 ld b, 9
jr asm_105248 jr .col_loop
Function105242: ; 105242 (41:5242) .Load11Column: ; 105242 (41:5242)
ld b, $b ld b, 11
jr asm_105248 jr .col_loop
Function105246: ; 105246 (41:5246) .Load14Column: ; 105246 (41:5246)
ld b, $e ld b, 14
asm_105248: ; 105248 (41:5248) .col_loop: ; 105248 (41:5248)
ld [hl], a ld [hl], a
ld de, $14 ld de, SCREEN_WIDTH
add hl, de add hl, de
dec b dec b
jr nz, asm_105248 jr nz, .col_loop
ret ret
Function105251: ; 105251 (41:5251) .Load16Row: ; 105251 (41:5251)
ld b, $10 ld b, 16
.asm_105253 .row_loop
ld [hli], a ld [hli], a
dec b dec b
jr nz, .asm_105253 jr nz, .row_loop
ret ret
MysteryGiftGFX: ; 105258 MysteryGiftGFX: ; 105258
INCBIN "gfx/misc/mystery_gift.2bpp" INCBIN "gfx/misc/mystery_gift.2bpp"
MysteryGiftGFXEnd:
Function105688: ; 105688 (41:5688) Function105688: ; 105688 (41:5688)
call ClearTileMap call ClearTileMap
@ -1412,15 +1420,15 @@ Function105688: ; 105688 (41:5688)
ld c, 60 ld c, 60
call DelayFrames call DelayFrames
call Function105777 call Function105777
ld hl, Text_10575e ld hl, Text_ReceivedCard
call PrintText call PrintText
ld de, wMysteryGiftTrainerData ld de, wMysteryGiftTrainerData
callba Function8ac70 callba Function8ac70
ld a, c ld a, c
ld [wd265], a ld [wd265], a
ld hl, Text_105768 ld hl, Text_CardNotRegistered
jr c, asm_105726 jr c, asm_105726
ld hl, Text_105763 ld hl, Text_ListedCardAsNumber
jr asm_105726 jr asm_105726
Function1056eb: ; 1056eb (41:56eb) Function1056eb: ; 1056eb (41:56eb)
@ -1454,12 +1462,12 @@ endr
Function105712: ; 105712 (41:5712) Function105712: ; 105712 (41:5712)
call Function105777 call Function105777
ld hl, Text_10576d ld hl, Text_MGLinkCanceled
jr asm_105726 jr asm_105726
Function10571a: ; 10571a (41:571a) Function10571a: ; 10571a (41:571a)
call Function105777 call Function105777
ld hl, Text_105772 ld hl, Text_MGCommError
call PrintText call PrintText
jp Function105688 jp Function105688
@ -1472,30 +1480,30 @@ asm_105726: ; 105726 (41:5726)
String_10572e: ; 10572e String_10572e: ; 10572e
db "エーボタン¯おすと" db "エーボタン¯おすと"
next "つうしん", $4a, "おこなわれるよ!" next "つうしん<PKMN>おこなわれるよ!"
next "ビーボタン¯おすと" next "ビーボタン¯おすと"
next "つうしん¯ちゅうし します" next "つうしん¯ちゅうし します"
db "@" db "@"
; 10575e ; 10575e
Text_10575e: ; 10575e Text_ReceivedCard: ; 10575e
text_jump UnknownText_0x1c051a text_jump UnknownText_0x1c051a
db "@" db "@"
Text_105763: ; 105763 Text_ListedCardAsNumber: ; 105763
text_jump UnknownText_0x1c0531 text_jump UnknownText_0x1c0531
db "@" db "@"
Text_105768: ; 105768 Text_CardNotRegistered: ; 105768
text_jump UnknownText_0x1c0555 text_jump UnknownText_0x1c0555
db "@" db "@"
Text_10576d: ; 10576d Text_MGLinkCanceled: ; 10576d
text_jump UnknownText_0x1c0573 text_jump UnknownText_0x1c0573
db "@" db "@"
Text_105772: ; 105772 Text_MGCommError: ; 105772
text_jump UnknownText_0x1c0591 text_jump UnknownText_0x1c0591
db "@" db "@"
; 105777 ; 105777
@ -1572,30 +1580,30 @@ Function1057d7: ; 1057d7 (41:57d7)
ld [hl], a ld [hl], a
hlcoord 4, 2 hlcoord 4, 2
ld a, $13 ld a, $13
call Function1058ca call .Load11Row
hlcoord 4, 3 hlcoord 4, 3
ld a, $1e ld a, $1e
call Function1058ce call .Load12Row
hlcoord 4, 4 hlcoord 4, 4
ld a, $2a ld a, $2a
call Function1058ce call .Load12Row
hlcoord 1, 2 hlcoord 1, 2
ld [hl], $4 ld [hl], $4
hlcoord 1, 3 hlcoord 1, 3
ld a, $5 ld a, $5
call Function1058de call .Load14Column
ld a, $9 ld a, $9
hlcoord 18, 5 hlcoord 18, 5
call Function1058da call .Load11Column
hlcoord 2, 5 hlcoord 2, 5
ld a, $b ld a, $b
call Function1058e9 call .Load16Row
hlcoord 2, 16 hlcoord 2, 16
ld a, $7 ld a, $7
call Function1058e9 call .Load16Row
hlcoord 2, 5 hlcoord 2, 5
ld a, $d ld a, $d
call Function1058c6 call .Load6Row
hlcoord 8, 5 hlcoord 8, 5
ld [hl], $c ld [hl], $c
hlcoord 18, 5 hlcoord 18, 5
@ -1606,16 +1614,16 @@ Function1057d7: ; 1057d7 (41:57d7)
ld [hl], $6 ld [hl], $6
hlcoord 2, 6 hlcoord 2, 6
ld a, $37 ld a, $37
call Function1058e9 call .Load16Row
hlcoord 2, 15 hlcoord 2, 15
ld a, $3d ld a, $3d
call Function1058e9 call .Load16Row
hlcoord 2, 6 hlcoord 2, 6
ld a, $39 ld a, $39
call Function1058d6 call .Load9Column
hlcoord 17, 6 hlcoord 17, 6
ld a, $3b ld a, $3b
call Function1058d6 call .Load9Column
hlcoord 2, 6 hlcoord 2, 6
ld [hl], $36 ld [hl], $36
hlcoord 17, 6 hlcoord 17, 6
@ -1625,7 +1633,7 @@ Function1057d7: ; 1057d7 (41:57d7)
hlcoord 17, 15 hlcoord 17, 15
ld [hl], $3e ld [hl], $3e
ld de, Sprites ld de, Sprites
ld hl, OAM_1058f0 ld hl, .OAM_data
ld bc, $40 ld bc, $40
call CopyBytes call CopyBytes
call EnableLCD call EnableLCD
@ -1634,69 +1642,69 @@ Function1057d7: ; 1057d7 (41:57d7)
callba Function4930f callba Function4930f
jp SetPalettes jp SetPalettes
Function1058c6: ; 1058c6 (41:58c6) .Load6Row: ; 1058c6 (41:58c6)
ld b, $6 ld b, 6
jr asm_1058d0 jr .row_loop
Function1058ca: ; 1058ca (41:58ca) .Load11Row: ; 1058ca (41:58ca)
ld b, $b ld b, 11
jr asm_1058d0 jr .row_loop
Function1058ce: ; 1058ce (41:58ce) .Load12Row: ; 1058ce (41:58ce)
ld b, $c ld b, 12
asm_1058d0: ; 1058d0 (41:58d0) .row_loop: ; 1058d0 (41:58d0)
ld [hli], a ld [hli], a
inc a inc a
dec b dec b
jr nz, asm_1058d0 jr nz, .row_loop
ret ret
Function1058d6: ; 1058d6 (41:58d6) .Load9Column: ; 1058d6 (41:58d6)
ld b, $9 ld b, 9
jr asm_1058e0 jr .column_loop
Function1058da: ; 1058da (41:58da) .Load11Column: ; 1058da (41:58da)
ld b, $b ld b, 11
jr asm_1058e0 jr .column_loop
Function1058de: ; 1058de (41:58de) .Load14Column: ; 1058de (41:58de)
ld b, $e ld b, 14
asm_1058e0: ; 1058e0 (41:58e0) .column_loop: ; 1058e0 (41:58e0)
ld [hl], a ld [hl], a
ld de, SCREEN_WIDTH ld de, SCREEN_WIDTH
add hl, de add hl, de
dec b dec b
jr nz, asm_1058e0 jr nz, .column_loop
ret ret
Function1058e9: ; 1058e9 (41:58e9) .Load16Row: ; 1058e9 (41:58e9)
ld b, $10 ld b, 16
.asm_1058eb .row_loop_no_inc
ld [hli], a ld [hli], a
dec b dec b
jr nz, .asm_1058eb jr nz, .row_loop_no_inc
ret ret
; 1058f0 (41:58f0) ; 1058f0 (41:58f0)
OAM_1058f0: ; 1058f0 .OAM_data: ; 1058f0
db $11, $34, $00, $00 dsprite 2, 1, 6, 4, $00, $00
db $11, $3c, $01, $00 dsprite 2, 1, 7, 4, $01, $00
db $11, $44, $02, $00 dsprite 2, 1, 8, 4, $02, $00
db $11, $4c, $03, $00 dsprite 2, 1, 9, 4, $03, $00
db $19, $34, $04, $00 dsprite 3, 1, 6, 4, $04, $00
db $19, $3c, $05, $00 dsprite 3, 1, 7, 4, $05, $00
db $19, $44, $06, $00 dsprite 3, 1, 8, 4, $06, $00
db $19, $4c, $07, $00 dsprite 3, 1, 9, 4, $07, $00
db $01, $5c, $00, $00 dsprite 0, 1, 11, 4, $00, $00
db $01, $64, $01, $00 dsprite 0, 1, 12, 4, $01, $00
db $01, $6c, $02, $00 dsprite 0, 1, 13, 4, $02, $00
db $01, $74, $03, $00 dsprite 0, 1, 14, 4, $03, $00
db $09, $5c, $04, $00 dsprite 1, 1, 11, 4, $04, $00
db $09, $64, $05, $00 dsprite 1, 1, 12, 4, $05, $00
db $09, $6c, $06, $00 dsprite 1, 1, 13, 4, $06, $00
db $09, $74, $07, $00 dsprite 1, 1, 14, 4, $07, $00
; japanese mystery gift gfx ; japanese mystery gift gfx
MysteryGiftJP_GFX: ; 105930 MysteryGiftJP_GFX: ; 105930

View File

@ -1,8 +1,8 @@
Function2c642: ; 2c642 (b:4642) Function2c642: ; 2c642 (b:4642)
ld de, wc800 ld de, wMysteryGiftStaging
ld a, $1 ld a, $1
ld [de], a ld [de], a
inc de inc de ; wc801
ld a, BANK(sGameData) ld a, BANK(sGameData)
call GetSRAMBank call GetSRAMBank
ld hl, sPlayerData + PlayerID - wPlayerData ld hl, sPlayerData + PlayerID - wPlayerData
@ -13,34 +13,34 @@ Function2c642: ; 2c642 (b:4642)
ld a, [hl] ld a, [hl]
ld [de], a ld [de], a
ld c, a ld c, a
inc de inc de ; wc803
push bc push bc
ld hl, sPlayerData + PlayerName - wPlayerData ld hl, sPlayerData + PlayerName - wPlayerData
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
call CopyBytes call CopyBytes
push de push de ; wc80e
ld hl, sPokemonData + PokedexCaught - wPokemonData ld hl, sPokemonData + PokedexCaught - wPokemonData
ld b, (NUM_POKEMON + 7) / 8 ld b, EndPokedexCaught - PokedexCaught
call CountSetBits call CountSetBits
pop de pop de
pop bc pop bc
ld a, [wd265] ld a, [wd265]
ld [de], a ld [de], a
inc de inc de ; wc80f
call CloseSRAM call CloseSRAM
call Random call Random
and $1 and $1
ld [de], a ld [de], a
inc de inc de ; wc810
call Function2c6ac call .RandomSample
ld [de], a ld [de], a
inc de inc de ; wc811
ld a, c ld a, c
ld c, b ld c, b
ld b, a ld b, a
call Function2c6ac call .RandomSample
ld [de], a ld [de], a
inc de inc de ; wc812
ld a, BANK(sBackupMysteryGiftItem) ld a, BANK(sBackupMysteryGiftItem)
call GetSRAMBank call GetSRAMBank
ld a, [sBackupMysteryGiftItem] ld a, [sBackupMysteryGiftItem]
@ -51,12 +51,12 @@ Function2c642: ; 2c642 (b:4642)
ld a, $14 ld a, $14
ld [wca00], a ld [wca00], a
call CloseSRAM call CloseSRAM
ld hl, wc800 ld hl, wMysteryGiftStaging
ld de, wc950 ld de, wMysteryGiftPlayerData
ld bc, $14 ld bc, wMysteryGiftPlayerDataEnd - wMysteryGiftPlayerData
jp CopyBytes jp CopyBytes
Function2c6ac: ; 2c6ac (b:46ac) .RandomSample: ; 2c6ac (b:46ac)
push de push de
call Random call Random
cp $19 ; 10 percent cp $19 ; 10 percent
@ -124,8 +124,8 @@ Function2c6ac: ; 2c6ac (b:46ac)
MysteryGiftGetItemHeldEffect: ; 2c708 (b:4708) MysteryGiftGetItemHeldEffect: ; 2c708 (b:4708)
ld a, c ld a, c
cp $25 ; 37 cp $25 ; 37
jr nc, Function2c722 jr nc, MysteryGiftFallbackItem
ld hl, Unknown_2c725 ld hl, MysteryGiftItems
ld b, 0 ld b, 0
add hl, bc add hl, bc
ld c, [hl] ld c, [hl]
@ -134,20 +134,19 @@ MysteryGiftGetItemHeldEffect: ; 2c708 (b:4708)
MysteryGiftGetDecoration: ; 2c715 (b:4715) MysteryGiftGetDecoration: ; 2c715 (b:4715)
ld a, c ld a, c
cp $25 ; 37 cp $25 ; 37
jr nc, Function2c722 jr nc, MysteryGiftFallbackItem
ld hl, Unknown_2c74a ld hl, MysteryGiftDecos
ld b, 0 ld b, 0
add hl, bc add hl, bc
ld c, [hl] ld c, [hl]
ret ret
Function2c722: ; 2c722 (b:4722) MysteryGiftFallbackItem: ; 2c722 (b:4722)
ld c, DECO_POLKADOT_BED ; GREAT_BALL ld c, DECO_POLKADOT_BED ; GREAT_BALL
ret ret
; 2c725 (b:4725) ; 2c725 (b:4725)
Unknown_2c725: ; 2c725 MysteryGiftItems: ; 2c725
; May or may not be items.
db BERRY db BERRY
db PRZCUREBERRY db PRZCUREBERRY
db MINT_BERRY db MINT_BERRY
@ -187,8 +186,7 @@ Unknown_2c725: ; 2c725
db MIRAGE_MAIL db MIRAGE_MAIL
; 2c74a ; 2c74a
Unknown_2c74a: ; 2c74a MysteryGiftDecos: ; 2c74a
; May or may not be items.
db DECO_SNES db DECO_SNES
db DECO_BIG_SNORLAX_DOLL db DECO_BIG_SNORLAX_DOLL
db DECO_BIG_ONIX_DOLL db DECO_BIG_ONIX_DOLL

View File

@ -892,7 +892,7 @@ _SaveData: ; 1509a
jp CloseSRAM jp CloseSRAM
Function150b9: ; 150b9 _LoadData: ; 150b9
ld a, BANK(sCrystalData) ld a, BANK(sCrystalData)
call GetSRAMBank call GetSRAMBank
ld hl, sCrystalData ld hl, sCrystalData
@ -938,8 +938,11 @@ endr
; 150f9 ; 150f9
SaveBoxAddress: ; 150f9 SaveBoxAddress: ; 150f9
; Save box via wMisc.
; We do this in three steps because the size of wMisc is less than
; the size of sBox.
push hl push hl
; Load the first part of the active box.
push af push af
push de push de
ld a, BANK(sBox) ld a, BANK(sBox)
@ -951,7 +954,7 @@ SaveBoxAddress: ; 150f9
call CloseSRAM call CloseSRAM
pop de pop de
pop af pop af
; Save it to the target box.
push af push af
push de push de
call GetSRAMBank call GetSRAMBank
@ -959,6 +962,8 @@ SaveBoxAddress: ; 150f9
ld bc, (wMiscEnd - wMisc) ld bc, (wMiscEnd - wMisc)
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
; Load the second part of the active box.
ld a, BANK(sBox) ld a, BANK(sBox)
call GetSRAMBank call GetSRAMBank
ld hl, sBox + (wMiscEnd - wMisc) ld hl, sBox + (wMiscEnd - wMisc)
@ -973,7 +978,7 @@ SaveBoxAddress: ; 150f9
add hl, de add hl, de
ld e, l ld e, l
ld d, h ld d, h
; Save it to the next part of the target box.
push af push af
push de push de
call GetSRAMBank call GetSRAMBank
@ -981,6 +986,8 @@ SaveBoxAddress: ; 150f9
ld bc, (wMiscEnd - wMisc) ld bc, (wMiscEnd - wMisc)
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
; Load the third and final part of the active box.
ld a, BANK(sBox) ld a, BANK(sBox)
call GetSRAMBank call GetSRAMBank
ld hl, sBox + (wMiscEnd - wMisc) * 2 ld hl, sBox + (wMiscEnd - wMisc) * 2
@ -995,7 +1002,7 @@ SaveBoxAddress: ; 150f9
add hl, de add hl, de
ld e, l ld e, l
ld d, h ld d, h
; Save it to the final part of the target box.
call GetSRAMBank call GetSRAMBank
ld hl, wMisc ld hl, wMisc
ld bc, sBoxEnd - (sBox + (wMiscEnd - wMisc) * 2) ; $8e ld bc, sBoxEnd - (sBox + (wMiscEnd - wMisc) * 2) ; $8e
@ -1008,10 +1015,13 @@ SaveBoxAddress: ; 150f9
LoadBoxAddress: ; 1517d (5:517d) LoadBoxAddress: ; 1517d (5:517d)
; Load box via wMisc.
; We do this in three steps because the size of wMisc is less than
; the size of sBox.
push hl push hl
ld l, e ld l, e
ld h, d ld h, d
; Load part 1
push af push af
push hl push hl
call GetSRAMBank call GetSRAMBank
@ -1031,7 +1041,7 @@ LoadBoxAddress: ; 1517d (5:517d)
ld de, (wMiscEnd - wMisc) ld de, (wMiscEnd - wMisc)
add hl, de add hl, de
; Load part 2
push af push af
push hl push hl
call GetSRAMBank call GetSRAMBank
@ -1048,7 +1058,7 @@ LoadBoxAddress: ; 1517d (5:517d)
call CloseSRAM call CloseSRAM
pop hl pop hl
pop af pop af
; Load part 3
ld de, (wMiscEnd - wMisc) ld de, (wMiscEnd - wMisc)
add hl, de add hl, de
call GetSRAMBank call GetSRAMBank

View File

@ -3211,14 +3211,14 @@ Script_halloffame: ; 97bd5
callba HallOfFame callba HallOfFame
ld hl, GameTimerPause ld hl, GameTimerPause
set 0, [hl] set 0, [hl]
jr DisplayCredits jr ReturnFromCredits
; 97bf3 ; 97bf3
Script_credits: ; 97bf3 Script_credits: ; 97bf3
; script command 0xa2 ; script command 0xa2
callba RedCredits callba RedCredits
DisplayCredits: ReturnFromCredits:
call Script_end_all call Script_end_all
ld a, $3 ld a, $3
call LoadMapStatus call LoadMapStatus

View File

@ -125,7 +125,7 @@ FadeInPalettes:: ; 8c079
; 8c084 ; 8c084
FadeOutPalettes:: ; 8c084 FadeOutPalettes:: ; 8c084
call Function8c0c1 call FillWhiteBGColor
ld c, $9 ld c, $9
call GetTimePalFade call GetTimePalFade
ld b, $4 ld b, $4
@ -134,7 +134,7 @@ FadeOutPalettes:: ; 8c084
; 8c092 ; 8c092
Special_BattleTowerFade: ; 8c092 Special_BattleTowerFade: ; 8c092
call Function8c0c1 call FillWhiteBGColor
ld c, $9 ld c, $9
call GetTimePalFade call GetTimePalFade
ld b, $4 ld b, $4
@ -167,19 +167,20 @@ Special_FadeBlackQuickly: ; 8c0b6
; 8c0c1 ; 8c0c1
Function8c0c1: ; 8c0c1 FillWhiteBGColor: ; 8c0c1
ld a, [rSVBK] ld a, [rSVBK]
push af push af
ld a, $5 ld a, $5
ld [rSVBK], a ld [rSVBK], a
ld hl, UnknBGPals ld hl, UnknBGPals
ld a, [hli] ld a, [hli]
ld e, a ld e, a
ld a, [hli] ld a, [hli]
ld d, a ld d, a
ld hl, UnknBGPals + 8 ld hl, UnknBGPals + 1 palettes
ld c, $6 ld c, 6
.asm_8c0d4 .loop
ld a, e ld a, e
ld [hli], a ld [hli], a
ld a, d ld a, d
@ -188,7 +189,8 @@ rept 6
inc hl inc hl
endr endr
dec c dec c
jr nz, .asm_8c0d4 jr nz, .loop
pop af pop af
ld [rSVBK], a ld [rSVBK], a
ret ret
@ -200,7 +202,7 @@ ENDM
ReplaceTimeOfDayPals: ; 8c0e5 ReplaceTimeOfDayPals: ; 8c0e5
ld hl, .BrightnessLevels ld hl, .BrightnessLevels
ld a, [wc2d0] ld a, [wMapTimeOfDay]
cp $4 ; Dark cave, needs Flash cp $4 ; Dark cave, needs Flash
jr z, .DarkCave jr z, .DarkCave
and $7 and $7
@ -306,7 +308,7 @@ ConvertTimePalsIncHL: ; 8c15e
rept 3 rept 3
inc hl inc hl
endr endr
ld c, $2 ld c, 2
call DelayFrames call DelayFrames
dec b dec b
jr nz, .loop jr nz, .loop
@ -319,7 +321,7 @@ ConvertTimePalsDecHL: ; 8c16d
rept 3 rept 3
dec hl dec hl
endr endr
ld c, $2 ld c, 2
call DelayFrames call DelayFrames
dec b dec b
jr nz, .loop jr nz, .loop

View File

@ -7,13 +7,12 @@ RunCallback_05_03: ; 1045b0
call ResetBikeFlags call ResetBikeFlags
ld a, $5 ld a, $5
call RunMapCallback call RunMapCallback
RunCallback_03: ; 1045c4 RunCallback_03: ; 1045c4
callba ClearCmdQueue callba ClearCmdQueue
ld a, $3 ld a, $3
call RunMapCallback call RunMapCallback
call GetMapHeaderTimeOfDayNybble call GetMapHeaderTimeOfDayNybble
ld [wc2d0], a ld [wMapTimeOfDay], a
ret ret

125
main.asm
View File

@ -10788,123 +10788,9 @@ INCLUDE "data/pokedex/entry_pointers.asm"
INCLUDE "engine/mail.asm" INCLUDE "engine/mail.asm"
SECTION "bank12", ROMX, BANK[$12] SECTION "Crystal Unique", ROMX, BANK[$12]
Function48000: ; 48000 INCLUDE "engine/init_gender.asm"
ld a, $1
ld [wd474], a
xor a
ld [wd473], a
ld [PlayerGender], a
ld [wd475], a
ld [wd476], a
ld [wd477], a
ld [wd478], a
ld [wd002], a
ld [wd003], a
; could have done "ld a, [wd479] \ and %11111100", saved four operations
ld a, [wd479]
res 0, a
ld [wd479], a
ld a, [wd479]
res 1, a
ld [wd479], a
ret
; 4802f
INCLUDE "misc/mobile_12.asm"
InitGender: ; 48dcb (12:4dcb)
call Function48e14
call Function48e47
call Function48e64
call WaitBGMap2
call SetPalettes
ld hl, TextJump_AreYouABoyOrAreYouAGirl
call PrintText
ld hl, .MenuDataHeader
call LoadMenuDataHeader
call WaitBGMap2
call InterpretMenu2
call WriteBackup
ld a, [MenuSelection2]
dec a
ld [PlayerGender], a
ld c, 10
call DelayFrames
ret
; 48dfc (12:4dfc)
.MenuDataHeader: ; 0x48dfc
db $40 ; flags
db 04, 06 ; start coords
db 09, 12 ; end coords
dw .MenuData2
db 1 ; default option
; 0x48e04
.MenuData2: ; 0x48e04
db $a1 ; flags
db 2 ; items
db "Boy@"
db "Girl@"
; 0x48e0f
TextJump_AreYouABoyOrAreYouAGirl: ; 0x48e0f
; Are you a boy? Or are you a girl?
text_jump Text_AreYouABoyOrAreYouAGirl
db "@"
; 0x48e14
Function48e14: ; 48e14 (12:4e14)
ld a, $10
ld [MusicFade], a
ld a, $0
ld [MusicFadeIDLo], a
ld a, $0
ld [MusicFadeIDHi], a
ld c, 8
call DelayFrames
call ClearBGPalettes
call Function48000
call LoadFontsExtra
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, $0
call ByteFill
hlcoord 0, 0, AttrMap
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
xor a
call ByteFill
ret
Function48e47: ; 48e47 (12:4e47)
ld hl, Palette_48e5c
ld de, UnknBGPals
ld bc, $8
ld a, $5
call FarCopyWRAM
callba Function96a4
ret
; 48e5c (12:4e5c)
Palette_48e5c: ; 48e5c
RGB 31, 31, 31
RGB 09, 30, 31
RGB 01, 11, 31
RGB 00, 00, 00
; 48e64
Function48e64: ; 48e64 (12:4e64)
ld de, GFX_48e71
ld hl, VTiles2 tile $00
lb bc, BANK(GFX_48e71), 1
call Get2bpp
ret
; 48e71 (12:4e71)
GFX_48e71: ; 48e71
INCBIN "gfx/unknown/048e71.2bpp"
DrawKrisPackGFX: ; 48e81 DrawKrisPackGFX: ; 48e81
ld hl, PackFGFXPointers ld hl, PackFGFXPointers
@ -11064,9 +10950,10 @@ Function4930f: ; 4930f (mobile)
; 49330 (12:5330) ; 49330 (12:5330)
.jumptable: ; 49330 .jumptable: ; 49330
dw Function4936e jumptable_start
dw Function4942f jumptable Function4936e
dw Function49706 jumptable Function4942f
jumptable Function49706
; 49336 ; 49336
Function49336: ; 49336 Function49336: ; 49336

View File

@ -6,7 +6,7 @@ InitMobileProfile: ; 4802f (12:402f)
set 0, [hl] set 0, [hl]
ld a, c ld a, c
and a and a
call z, Function48000 call z, InitCrystalData
call ClearBGPalettes call ClearBGPalettes
call Function48d3d call Function48d3d
ld a, [wd479] ld a, [wd479]

View File

@ -214,7 +214,7 @@ Function89240: ; 89240
Function89245: ; 89245 (22:5245) Function89245: ; 89245 (22:5245)
callba TryLoadSaveFile callba TryLoadSaveFile
ret c ret c
callba Function150b9 callba _LoadData
and a and a
ret ret

View File

@ -294,7 +294,7 @@ UnknownText_0x1c04fa: ; 1c04fa
text_from_ram StringBuffer1 text_from_ram StringBuffer1
text "" text ""
cont "to @" cont "to @"
text_from_ram wc950 + 3 text_from_ram wMysteryGiftPlayerName
text "'s home." text "'s home."
prompt prompt
; 1c051a ; 1c051a

View File

@ -334,7 +334,8 @@ wc2cc:: ds 1
wc2cd:: ds 1 wc2cd:: ds 1
wSpriteUpdatesEnabled:: ds 1 wSpriteUpdatesEnabled:: ds 1
wc2cf:: ds 1 wc2cf:: ds 1
wc2d0:: ds 4 wMapTimeOfDay:: ds 1
ds 3
wc2d4:: ds 1 wc2d4:: ds 1
wc2d5:: ds 1 wc2d5:: ds 1
wLastDexEntry:: ds 1 wLastDexEntry:: ds 1
@ -1128,18 +1129,18 @@ OverworldMap:: ; c800
OverworldMapEnd:: OverworldMapEnd::
ds OverworldMap - @ ds OverworldMap - @
wMysteryGiftPartyTemp:: ; ds PARTY_LENGTH * (1 + 1 + NUM_MOVES)
wMysteryGiftStaging::
wc800:: ds 1 wc800:: ds 1
wMysteryGiftPlayerID::
wc801:: ds 1 wc801:: ds 1
wc802:: ds 1 wc802:: ds 1
wMysteryGiftPlayerName::
wc803:: ds 4 wc803:: ds 4
wc807:: ds 7 wc807:: ds 7
wMysteryGiftPlayerDexCaught:: ds 1 wc80e:: ds 1
wc80f:: ds 1 wc80f:: ds 1
wc810:: ds 1 wc810:: ds 1
wc811:: ds 1 wc811:: ds 1
wMysteryGiftPlayerBackupItem::
wc812:: ds 1 wc812:: ds 1
wc813:: ds 1 wc813:: ds 1
wc814:: ds 4 wc814:: ds 4
@ -1162,20 +1163,33 @@ wc8c0:: ds 16
wc8d0:: ds 16 wc8d0:: ds 16
wc8e0:: ds 16 wc8e0:: ds 16
wc8f0:: ds 16 wc8f0:: ds 16
wMysteryGiftPartnerData::
wc900:: ds 1 wc900:: ds 1
wMysteryGiftPartnerID:: ds 2 wMysteryGiftPartnerID:: ds 2
wMysteryGiftPartnerName:: ds NAME_LENGTH wMysteryGiftPartnerName:: ds NAME_LENGTH
wc90e:: ds 1 wMysteryGiftPartnerDexCaught:: ds 1
wc90f:: ds 1 wc90f::
wc910:: ds 1 wMysteryGiftPartnerSentDeco:: ds 1
wc911:: ds 1 wMysteryGiftPartnerWhichItem:: ds 1
wc912:: ds 14 wMysteryGiftPartnerWhichDeco:: ds 1
wc912:: ds 2
wMysteryGiftPartnerDataEnd::
ds 12
wc920:: ds 16 wc920:: ds 16
wc930:: ds 16 wc930:: ds 16
wc940:: ds 16 wc940:: ds 16
wc950:: ds 16 wMysteryGiftPlayerData::
wc960:: ds 2 wc950:: ds 1
wc962:: ds 2 wMysteryGiftPlayerID:: ds 2
wMysteryGiftPlayerName:: ds NAME_LENGTH
wMysteryGiftPlayerDexCaught:: ds 1
wMysteryGiftPlayerSentDeco:: ds 1
wMysteryGiftPlayerWhichItem:: ds 1
wMysteryGiftPlayerWhichDeco:: ds 1
wMysteryGiftPlayerBackupItem:: ds 2
wMysteryGiftPlayerDataEnd::
wc964:: ds 12 wc964:: ds 12
wc970:: ds 16 wc970:: ds 16
wc980:: ds 16 wc980:: ds 16
@ -1188,6 +1202,8 @@ wc9e0:: ds 16
wc9f0:: ds 4 wc9f0:: ds 4
wc9f4:: ds 5 wc9f4:: ds 5
wc9f9:: ds 7 wc9f9:: ds 7
wCreditsFaux2bpp::
wca00:: ds 1 wca00:: ds 1
wca01:: ds 1 wca01:: ds 1
wca02:: ds 14 wca02:: ds 14