pokecrystal/predef/cgb.asm

1122 lines
17 KiB
NASM
Raw Normal View History

; Replaces the functionality of sgb.asm to work with CGB hardware.
CheckCGB: ; 8d55
ld a, [hCGB]
and a
ret
; 8d59
2015-07-22 20:36:28 +00:00
Predef_LoadSGBLayoutCGB: ; 8d59
ld a, b
2015-11-20 20:15:32 +00:00
cp SCGB_RAM
jr nz, .not_ram
ld a, [SGBPredef]
2015-11-20 20:15:32 +00:00
.not_ram
2015-12-23 03:19:33 +00:00
cp SCGB_PARTY_MENU_HP_PALS
jp z, CGB_ApplyPartyMenuHPPals
call Function9673
ld l, a
ld h, 0
add hl, hl
2015-12-27 02:59:03 +00:00
ld de, .dw
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
ld de, .ReturnFromJumpTable
push de
jp [hl]
; 8d79
.ReturnFromJumpTable: ; 8d79
ret
; 8d7a
2015-12-27 02:59:03 +00:00
.dw: ; 8d7a
2015-12-28 15:57:04 +00:00
dw _CGB_BattleGrayscale
dw _CGB_BattleColors
dw _CGB_PokegearPals
dw _CGB_StatsScreenHPPals
2015-11-13 05:49:27 +00:00
dw _CGB04
2015-12-28 15:57:04 +00:00
dw _CGB_SlotMachine
2015-11-13 05:49:27 +00:00
dw _CGB06
dw _CGB07
dw _CGB08
2015-12-28 15:57:04 +00:00
dw _CGB_MapPals
2015-11-13 05:49:27 +00:00
dw _CGB0a
dw _CGB0b
dw _CGB0c
dw _CGB0d
dw _CGB0e
dw _CGB0f
dw _CGB10
dw _CGB11
dw _CGB12
dw _CGB13
2015-12-28 15:57:04 +00:00
dw _CGB_PackPals
dw _CGB_TrainerCard
2015-11-13 05:49:27 +00:00
dw _CGB16
dw _CGB17
dw _CGB18
dw _CGB19
dw _CGB1a
dw _CGB1b
dw _CGB_FrontpicPals
2015-11-13 05:49:27 +00:00
dw _CGB1d
dw _CGB1e
; 8db8
2015-12-28 15:57:04 +00:00
_CGB_BattleGrayscale: ; 8db8
ld hl, PalPacket_9c66 + 1
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld c, $4
call CopyPalettes
ld hl, PalPacket_9c66 + 1
2015-12-28 15:57:04 +00:00
ld de, UnknBGPals + 4 palettes
ld c, $4
call CopyPalettes
ld hl, PalPacket_9c66 + 1
2015-11-20 20:15:32 +00:00
ld de, UnknOBPals
ld c, $2
call CopyPalettes
2015-12-28 15:57:04 +00:00
jr _CGB_FinishBattleScreenLayout
2015-12-28 15:57:04 +00:00
_CGB_BattleColors: ; 8ddb
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
2015-12-17 02:57:42 +00:00
call GetBattlemonBackpicPalettePointer
push hl
2015-12-17 02:57:42 +00:00
call LoadPalette_White_Col1_Col2_Black
call GetEnemyFrontpicPalettePointer
push hl
2015-12-17 02:57:42 +00:00
call LoadPalette_White_Col1_Col2_Black
ld a, [EnemyHPPal]
ld l, a
ld h, $0
add hl, hl
2015-12-27 02:59:03 +00:00
add hl, hl
ld bc, Palettes_a8be
add hl, bc
2015-12-17 02:57:42 +00:00
call LoadPalette_White_Col1_Col2_Black
ld a, [PlayerHPPal]
ld l, a
ld h, $0
add hl, hl
2015-12-27 02:59:03 +00:00
add hl, hl
ld bc, Palettes_a8be
add hl, bc
2015-12-17 02:57:42 +00:00
call LoadPalette_White_Col1_Col2_Black
ld hl, Palettes_a8ca
2015-12-17 02:57:42 +00:00
call LoadPalette_White_Col1_Col2_Black
2015-11-20 20:15:32 +00:00
ld de, UnknOBPals
pop hl
2015-12-17 02:57:42 +00:00
call LoadPalette_White_Col1_Col2_Black
pop hl
2015-12-17 02:57:42 +00:00
call LoadPalette_White_Col1_Col2_Black
2015-12-28 15:57:04 +00:00
ld a, SCGB_BATTLE_COLORS
ld [SGBPredef], a
2015-12-17 02:57:42 +00:00
call ApplyPals
2015-12-28 15:57:04 +00:00
_CGB_FinishBattleScreenLayout: ; 8e23
call InitPartyMenuBGPal7
hlcoord 0, 0, AttrMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, $2
call ByteFill
hlcoord 0, 4, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 8, 10
ld a, $0
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 10, 0, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 7, 10
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 0, 0, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 4, 10
ld a, $2
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 10, 7, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 5, 10
ld a, $3
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 10, 11, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 1, 9
ld a, $4
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 0, 12, AttrMap
2015-11-16 21:01:45 +00:00
ld bc, 6 * SCREEN_WIDTH
ld a, $7
call ByteFill
ld hl, Palettes_979c
2015-12-28 15:57:04 +00:00
ld de, UnknOBPals + 2 palettes
ld bc, 6 palettes
ld a, $5
call FarCopyWRAM
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
ret
; 8e85
2015-12-28 15:57:04 +00:00
InitPartyMenuBGPal7: ; 8e85
2013-10-02 00:47:54 +00:00
callba Function100dc0
2015-12-28 15:57:04 +00:00
Mobile_InitPartyMenuBGPal7: ; 8e8b
2014-03-02 06:22:33 +00:00
ld hl, Palette_b311
jr nc, .not_mobile
2014-03-02 06:22:33 +00:00
ld hl, Palette_b309
.not_mobile
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals + 8 * 7
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
ret
; 8e9f
2015-12-28 15:57:04 +00:00
InitPartyMenuBGPal0: ; 8e9f
callba Function100dc0
2014-03-02 06:22:33 +00:00
ld hl, Palette_b311
jr nc, .not_mobile
2014-03-02 06:22:33 +00:00
ld hl, Palette_b309
.not_mobile
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
ret
; 8eb9
2015-12-28 15:57:04 +00:00
_CGB_PokegearPals: ; 8eb9
ld a, [PlayerGender]
bit 0, a
2015-12-28 15:57:04 +00:00
jr z, .male
ld hl, FemalePokegearPals
jr .got_pals
2015-12-28 15:57:04 +00:00
.male
ld hl, MalePokegearPals
.got_pals
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
2015-12-17 02:57:42 +00:00
ld bc, 6 palettes
ld a, $5
call FarCopyWRAM
2015-12-17 02:57:42 +00:00
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 8edb
2015-12-28 15:57:04 +00:00
_CGB_StatsScreenHPPals: ; 8edb
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld a, [wcda1]
ld l, a
ld h, $0
add hl, hl
2015-12-27 02:59:03 +00:00
add hl, hl
ld bc, Palettes_a8be
add hl, bc
2015-12-17 02:57:42 +00:00
call LoadPalette_White_Col1_Col2_Black
ld a, [CurPartySpecies]
ld bc, TempMonDVs
2015-12-17 02:57:42 +00:00
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld hl, Palettes_a8ca
2015-12-17 02:57:42 +00:00
call LoadPalette_White_Col1_Col2_Black
ld hl, Palette8f52
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals + 8 * 3
2015-12-17 02:57:42 +00:00
ld bc, 3 palettes
ld a, $5
call FarCopyWRAM
2015-12-17 02:57:42 +00:00
call WipeAttrMap
hlcoord 0, 0, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 8, SCREEN_WIDTH
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-17 02:57:42 +00:00
hlcoord 10, 16, AttrMap
2015-12-17 02:57:42 +00:00
ld bc, 10
ld a, $2
call ByteFill
2015-12-17 02:57:42 +00:00
hlcoord 13, 5, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 2
ld a, $3
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-17 02:57:42 +00:00
hlcoord 15, 5, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 2
ld a, $4
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-17 02:57:42 +00:00
hlcoord 17, 5, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 2
ld a, $5
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 8f52
Palette8f52: ; 8f52
RGB 31, 31, 31
RGB 31, 19, 31
RGB 31, 15, 31
RGB 00, 00, 00
RGB 31, 31, 31
RGB 21, 31, 14
RGB 17, 31, 00
RGB 00, 00, 00
RGB 31, 31, 31
RGB 17, 31, 31
RGB 17, 31, 31
RGB 00, 00, 00
; 8f6a
2015-12-23 03:19:33 +00:00
StatsScreenPals: ; 8f6a
RGB 31, 19, 31
RGB 21, 31, 14
RGB 17, 31, 31
; 8f70
2015-11-13 05:49:27 +00:00
_CGB04: ; 8f70
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld a, $1d
call GetPredefPal
call LoadHLPaletteIntoDE
ld a, [CurPartySpecies]
cp $ff
2015-12-28 15:57:04 +00:00
jr nz, .is_pokemon
ld hl, Palette8fba
call LoadHLPaletteIntoDE
2015-12-28 15:57:04 +00:00
jr .got_palette
2015-12-28 15:57:04 +00:00
.is_pokemon
2015-12-17 02:57:42 +00:00
call GetMonPalettePointer_
call LoadPalette_White_Col1_Col2_Black
2015-12-28 15:57:04 +00:00
.got_palette
2015-12-17 02:57:42 +00:00
call WipeAttrMap
hlcoord 1, 1, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 7, 7
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-28 15:57:04 +00:00
call InitPartyMenuOBPals
ld hl, Palette8fc2
2015-12-28 15:57:04 +00:00
ld de, UnknOBPals + 7 palettes
2015-12-17 02:57:42 +00:00
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 8fba
Palette8fba: ; 8fba
RGB 11, 23, 00
RGB 07, 17, 00
RGB 06, 16, 03
RGB 05, 12, 01
Palette8fc2: ; 8fc2
RGB 00, 00, 00
RGB 11, 23, 00
RGB 07, 17, 00
RGB 00, 00, 00
; 8fca
2015-11-13 05:49:27 +00:00
_CGB17: ; 8fca
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld a, $1d
call GetPredefPal
call LoadHLPaletteIntoDE
ld a, [CurPartySpecies]
cp $ff
2015-12-17 02:57:42 +00:00
jr nz, .GetMonPalette
ld hl, Palette9036
call LoadHLPaletteIntoDE
2015-12-17 02:57:42 +00:00
jr .Resume
2015-12-17 02:57:42 +00:00
.GetMonPalette
ld bc, TempMonDVs
2015-12-17 02:57:42 +00:00
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
.Resume
call WipeAttrMap
hlcoord 1, 4, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 7, 7
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-28 15:57:04 +00:00
call InitPartyMenuOBPals
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9009
Function9009: ; 9009
ld hl, Palette9036
call LoadHLPaletteIntoDE
jr .asm_901a
2015-12-17 02:57:42 +00:00
.unused
ld bc, TempMonDVs
2015-12-17 02:57:42 +00:00
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
.asm_901a
2015-12-17 02:57:42 +00:00
call WipeAttrMap
hlcoord 1, 1, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 7, 7
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-28 15:57:04 +00:00
call InitPartyMenuOBPals
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9036
Palette9036: ; 9036
RGB 31, 15, 00
RGB 23, 12, 00
RGB 15, 07, 00
RGB 00, 00, 00
; 903e
2015-11-13 05:49:27 +00:00
_CGB16: ; 903e
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld a, $1d
call GetPredefPal
call LoadHLPaletteIntoDE
ld a, [CurPartySpecies]
2015-12-17 02:57:42 +00:00
call GetMonPalettePointer_
call LoadPalette_White_Col1_Col2_Black
call WipeAttrMap
hlcoord 7, 5, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 7, 7
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-28 15:57:04 +00:00
call InitPartyMenuOBPals
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 906e
2015-12-28 15:57:04 +00:00
_CGB_SlotMachine: ; 906e
2014-03-02 06:22:33 +00:00
ld hl, Palettes_b7a9
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
2015-12-17 02:57:42 +00:00
ld bc, $80
ld a, $5
call FarCopyWRAM
2015-12-17 02:57:42 +00:00
call WipeAttrMap
hlcoord 0, 2, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 10, 3
ld a, $2
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 17, 2, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 10, 3
ld a, $2
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 0, 4, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 6, 3
ld a, $3
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 17, 4, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 6, 3
ld a, $3
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 0, 6, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 3
ld a, $4
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 17, 6, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 3
ld a, $4
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 4, 2, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 12
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 3, 2, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 10, 1
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 16, 2, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 10, 1
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 0, 12, AttrMap
2015-12-17 02:57:42 +00:00
ld bc, $78
ld a, $7
call ByteFill
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 90f8
2015-11-13 05:49:27 +00:00
_CGB06: ; 90f8
ld hl, PalPacket_9ca6 + 1
call CopyFourPalettes
2015-12-17 02:57:42 +00:00
call WipeAttrMap
2015-11-20 20:15:32 +00:00
ld de, UnknOBPals
ld a, $3c
call GetPredefPal
call LoadHLPaletteIntoDE
hlcoord 0, 6, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 12, SCREEN_WIDTH
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9122
2015-11-13 05:49:27 +00:00
_CGB07: ; 9122
ld b, 0
ld hl, Jumptable_912d
add hl, bc
2015-12-27 02:59:03 +00:00
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 912d
Jumptable_912d: ; 912d
dw Function9133
dw Function9166
dw Function9180
; 9133
Function9133: ; 9133
ld hl, Palette_914e
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
call LoadHLPaletteIntoDE
ld hl, Palette_9156
2015-11-20 20:15:32 +00:00
ld de, UnknOBPals
2015-12-17 02:57:42 +00:00
ld bc, 2 palettes
ld a, $5
call FarCopyWRAM
2015-12-17 02:57:42 +00:00
call WipeAttrMap
ret
; 914e
Palette_914e: ; 914e
RGB 19, 31, 19
RGB 18, 23, 31
RGB 11, 21, 28
RGB 04, 16, 24
Palette_9156: ; 9156
RGB 29, 29, 29
RGB 20, 19, 20
RGB 19, 06, 04
RGB 03, 04, 06
RGB 31, 31, 31
RGB 31, 31, 31
RGB 31, 00, 00
RGB 03, 04, 06
; 9166
Function9166: ; 9166
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld a, $38
call GetPredefPal
call LoadHLPaletteIntoDE
2015-12-17 02:57:42 +00:00
2015-11-20 20:15:32 +00:00
ld de, UnknOBPals
ld a, $39
call GetPredefPal
call LoadHLPaletteIntoDE
2015-12-17 02:57:42 +00:00
call WipeAttrMap
ret
; 9180
Function9180: ; 9180
ld hl, PalPacket_9c36 + 1
call CopyFourPalettes
2015-11-20 20:15:32 +00:00
ld de, UnknOBPals
ld a, $3a
call GetPredefPal
call LoadHLPaletteIntoDE
2015-12-17 02:57:42 +00:00
call WipeAttrMap
ret
; 9195
2015-11-13 05:49:27 +00:00
_CGB11: ; 9195
2014-03-02 06:22:33 +00:00
ld hl, Palettes_b789
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
2015-12-17 02:57:42 +00:00
ld bc, 5 palettes
ld a, $5
call FarCopyWRAM
2015-12-17 02:57:42 +00:00
call ApplyPals
call WipeAttrMap
call ApplyAttrMap
ret
; 91ad
2015-11-13 05:49:27 +00:00
_CGB08: ; 91ad
ld hl, Palettes_b641
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
2015-12-17 02:57:42 +00:00
ld bc, 16 palettes
ld a, $5
call FarCopyWRAM
2015-12-28 15:57:04 +00:00
ld hl, PalPacket_9cb6 + 1
call CopyFourPalettes
2015-12-17 02:57:42 +00:00
call WipeAttrMap
call ApplyAttrMap
ret
; 91c8
2015-12-28 15:57:04 +00:00
_CGB_MapPals: ; 91c8
call LoadMapPals
ld a, SCGB_MAPPALS
ld [SGBPredef], a
ret
; 91d1
2015-11-13 05:49:27 +00:00
_CGB0a: ; 91d1
ld hl, PalPacket_9c56 + 1
call CopyFourPalettes
2015-12-28 15:57:04 +00:00
call InitPartyMenuBGPal0
call InitPartyMenuBGPal7
call InitPartyMenuOBPals
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
ret
; 91e4
2015-11-13 05:49:27 +00:00
_CGB0b: ; 91e4
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld a, c
and a
2015-12-17 02:57:42 +00:00
jr z, .pokemon
ld a, $1a
call GetPredefPal
call LoadHLPaletteIntoDE
2015-12-09 23:25:44 +00:00
jr .got_palette
2015-12-17 02:57:42 +00:00
.pokemon
ld hl, PartyMon1DVs
ld bc, PARTYMON_STRUCT_LENGTH
ld a, [CurPartyMon]
call AddNTimes
ld c, l
ld b, h
ld a, [PlayerHPPal]
2015-12-17 02:57:42 +00:00
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld hl, Palettes_979c
2015-12-09 23:25:44 +00:00
ld de, UnknOBPals + 2 palettes
ld bc, 6 palettes
ld a, $5
call FarCopyWRAM
2015-12-09 23:25:44 +00:00
.got_palette
2015-12-17 02:57:42 +00:00
call WipeAttrMap
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9228
2015-11-13 05:49:27 +00:00
_CGB0c: ; 9228
ld hl, Palettes_b6f1
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
2015-12-17 02:57:42 +00:00
ld bc, 5 palettes
ld a, $5
call FarCopyWRAM
ld hl, Palettes_b719
2015-11-20 20:15:32 +00:00
ld de, UnknOBPals
2015-12-17 02:57:42 +00:00
ld bc, 2 palettes
ld a, $5
call FarCopyWRAM
2015-11-20 20:15:32 +00:00
ld a, SCGB_08
ld [SGBPredef], a
2015-12-17 02:57:42 +00:00
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9251
2015-11-13 05:49:27 +00:00
_CGB0d: ; 9251
ld hl, PalPacket_9cb6 + 1
call CopyFourPalettes
2015-12-17 02:57:42 +00:00
call WipeAttrMap
call ApplyAttrMap
ret
; 925e
2015-11-13 05:49:27 +00:00
_CGB18: ; 925e
ld hl, PalPacket_9bc6 + 1
call CopyFourPalettes
2015-11-20 20:15:32 +00:00
ld de, UnknOBPals
ld a, $4c
call GetPredefPal
call LoadHLPaletteIntoDE
ld a, [rSVBK]
push af
ld a, $5
ld [rSVBK], a
2015-11-20 20:15:32 +00:00
ld hl, UnknOBPals
ld a, $1f
ld [hli], a
ld a, $0
ld [hl], a
pop af
ld [rSVBK], a
2015-12-17 02:57:42 +00:00
call WipeAttrMap
call ApplyAttrMap
ret
; 9289
2015-12-28 15:57:04 +00:00
_CGB_TrainerCard: ; 9289
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
xor a
2015-12-17 02:57:42 +00:00
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, $1
2015-12-17 02:57:42 +00:00
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, $3
2015-12-17 02:57:42 +00:00
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, $2
2015-12-17 02:57:42 +00:00
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, $4
2015-12-17 02:57:42 +00:00
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, $7
2015-12-17 02:57:42 +00:00
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, $6
2015-12-17 02:57:42 +00:00
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, $5
2015-12-17 02:57:42 +00:00
call GetTrainerPalettePointer
call LoadPalette_White_Col1_Col2_Black
ld a, $24
call GetPredefPal
call LoadHLPaletteIntoDE
2015-12-17 02:57:42 +00:00
hlcoord 0, 0, AttrMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, [PlayerGender]
and a
ld a, $1
2015-12-17 02:57:42 +00:00
jr z, .got_gender
ld a, $0
2015-12-17 02:57:42 +00:00
.got_gender
call ByteFill
hlcoord 14, 1, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 7, 5
ld a, [PlayerGender]
and a
ld a, $0
2015-12-17 02:57:42 +00:00
jr z, .got_gender2
ld a, $1
2015-12-17 02:57:42 +00:00
.got_gender2
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 18, 1, AttrMap
ld [hl], $1
hlcoord 2, 11, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 4
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 6, 11, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 4
ld a, $2
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 10, 11, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 4
ld a, $3
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 14, 11, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 4
ld a, $4
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 2, 14, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 4
ld a, $5
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 6, 14, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 4
ld a, $6
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 10, 14, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 4
ld a, $7
2015-11-13 05:49:27 +00:00
call FillBoxCGB
ld a, [PlayerGender]
and a
push af
2015-12-17 02:57:42 +00:00
jr z, .got_gender3
hlcoord 14, 14, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 4
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-17 02:57:42 +00:00
.got_gender3
pop af
ld c, $0
2015-12-17 02:57:42 +00:00
jr nz, .got_gender4
inc c
2015-12-17 02:57:42 +00:00
.got_gender4
ld a, c
hlcoord 18, 1, AttrMap
ld [hl], a
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9373
2015-11-13 05:49:27 +00:00
_CGB0e: ; 9373
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld a, $10
call GetPredefPal
call LoadHLPaletteIntoDE
ld a, [PlayerHPPal]
ld l, a
ld h, 0
add hl, hl
2015-12-27 02:59:03 +00:00
add hl, hl
ld bc, Palettes_a8be
add hl, bc
2015-12-17 02:57:42 +00:00
call LoadPalette_White_Col1_Col2_Black
call WipeAttrMap
hlcoord 11, 1, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 2, 9
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 93a6
2015-11-13 05:49:27 +00:00
_CGB0f: ; 93a6
ld hl, PalPacket_9c46 + 1
call CopyFourPalettes
2015-12-17 02:57:42 +00:00
call WipeAttrMap
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 93ba
2015-11-13 05:49:27 +00:00
_CGB10: ; 93ba
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld a, $1d
call GetPredefPal
call LoadHLPaletteIntoDE
2015-12-17 02:57:42 +00:00
call WipeAttrMap
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 93d3
2015-12-28 15:57:04 +00:00
_CGB_PackPals: ; 93d3
2015-12-17 02:57:42 +00:00
; pack pals
ld a, [BattleType]
cp BATTLETYPE_TUTORIAL
2015-12-17 02:57:42 +00:00
jr z, .tutorial_male
ld a, [PlayerGender]
bit 0, a
2015-12-17 02:57:42 +00:00
jr z, .tutorial_male
ld hl, .KrisPackPals
2015-12-17 02:57:42 +00:00
jr .got_gender
2015-12-17 02:57:42 +00:00
.tutorial_male
ld hl, .ChrisPackPals
2015-12-17 02:57:42 +00:00
.got_gender
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
2015-12-17 02:57:42 +00:00
ld bc, 8 palettes ; 6 palettes?
ld a, $5
call FarCopyWRAM
2015-12-17 02:57:42 +00:00
call WipeAttrMap
hlcoord 0, 0, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 1, 10
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 10, 0, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 1, 10
ld a, $2
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 7, 2, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 9, 1
ld a, $3
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 0, 7, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 3, 5
ld a, $4
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 0, 3, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 3, 5
ld a, $5
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 9439
.ChrisPackPals: ; 9439
RGB 31, 31, 31
RGB 15, 15, 31
RGB 00, 00, 31
RGB 00, 00, 00
2015-12-17 02:57:42 +00:00
RGB 31, 31, 31
RGB 15, 15, 31
RGB 00, 00, 31
RGB 00, 00, 00
2015-12-17 02:57:42 +00:00
RGB 31, 11, 31
RGB 15, 15, 31
RGB 00, 00, 31
RGB 00, 00, 00
2015-12-17 02:57:42 +00:00
RGB 31, 31, 31
RGB 15, 15, 31
RGB 00, 00, 31
RGB 31, 00, 00
2015-12-17 02:57:42 +00:00
RGB 31, 31, 31
RGB 15, 15, 31
RGB 31, 00, 00
RGB 00, 00, 00
2015-12-17 02:57:42 +00:00
RGB 31, 31, 31
RGB 07, 19, 07
RGB 07, 19, 07
RGB 00, 00, 00
; 9469
.KrisPackPals: ; 9469
RGB 31, 31, 31
RGB 31, 14, 31
RGB 31, 07, 31
RGB 00, 00, 00
2015-12-17 02:57:42 +00:00
RGB 31, 31, 31
RGB 31, 14, 31
RGB 31, 07, 31
RGB 00, 00, 00
2015-12-17 02:57:42 +00:00
RGB 15, 15, 31
RGB 31, 14, 31
RGB 31, 07, 31
RGB 00, 00, 00
2015-12-17 02:57:42 +00:00
RGB 31, 31, 31
RGB 31, 14, 31
RGB 31, 07, 31
RGB 31, 00, 00
2015-12-17 02:57:42 +00:00
RGB 31, 31, 31
RGB 31, 14, 31
RGB 31, 00, 00
RGB 00, 00, 00
2015-12-17 02:57:42 +00:00
RGB 31, 31, 31
RGB 07, 19, 07
RGB 07, 19, 07
RGB 00, 00, 00
; 9499
2015-11-13 05:49:27 +00:00
_CGB12: ; 9499
2015-12-28 15:57:04 +00:00
call _CGB_MapPals
2015-12-17 02:57:42 +00:00
ld de, SCREEN_WIDTH
hlcoord 0, 0, AttrMap
2015-10-24 14:34:19 +00:00
ld a, [wMenuBorderTopCoord]
2015-12-17 02:57:42 +00:00
.loop
and a
2015-12-17 02:57:42 +00:00
jr z, .found_top
dec a
add hl, de
2015-12-17 02:57:42 +00:00
jr .loop
2015-12-17 02:57:42 +00:00
.found_top
2015-10-24 14:34:19 +00:00
ld a, [wMenuBorderLeftCoord]
ld e, a
ld d, $0
add hl, de
2015-10-24 14:34:19 +00:00
ld a, [wMenuBorderTopCoord]
ld b, a
2015-10-24 14:34:19 +00:00
ld a, [wMenuBorderBottomCoord]
inc a
sub b
ld b, a
2015-10-24 14:34:19 +00:00
ld a, [wMenuBorderLeftCoord]
ld c, a
2015-10-24 14:34:19 +00:00
ld a, [wMenuBorderRightCoord]
sub c
inc a
ld c, a
ld a, $0
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
ret
; 94d0
2015-11-13 05:49:27 +00:00
_CGB13: ; 94d0
ld hl, PalPacket_9ba6 + 1
call CopyFourPalettes
2015-12-17 02:57:42 +00:00
call WipeAttrMap
hlcoord 0, 4, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 10, SCREEN_WIDTH
ld a, $2
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 0, 6, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 6, SCREEN_WIDTH
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 94fa
2015-11-13 05:49:27 +00:00
_CGB19: ; 94fa
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld a, $4e
call GetPredefPal
call LoadHLPaletteIntoDE
ld hl, .Palette
2015-11-20 20:15:32 +00:00
ld de, UnknOBPals
call LoadHLPaletteIntoDE
ld hl, .Palette
ld de, UnknOBPals + 1 palettes
call LoadHLPaletteIntoDE
2015-12-17 02:57:42 +00:00
call WipeAttrMap
call ApplyAttrMap
call ApplyPals
ret
; 9521
.Palette: ; 9521
RGB 31, 31, 31
RGB 13, 11, 00
RGB 23, 12, 28
RGB 00, 00, 00
; 9529
2015-11-13 05:49:27 +00:00
_CGB1a: ; 9529
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld a, [CurPartySpecies]
ld bc, TempMonDVs
2015-12-17 02:57:42 +00:00
call GetPlayerOrMonPalettePointer
call LoadPalette_White_Col1_Col2_Black
call WipeAttrMap
call ApplyAttrMap
call ApplyPals
ret
; 9542
2015-11-13 05:49:27 +00:00
_CGB1e: ; 9542
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld a, [CurPartySpecies]
2015-12-17 02:57:42 +00:00
call GetMonPalettePointer_
call LoadPalette_White_Col1_Col2_Black
call WipeAttrMap
call ApplyAttrMap
ret
; 9555
2015-11-13 05:49:27 +00:00
_CGB1b: ; 9555
ld hl, PalPacket_9cc6 + 1
call CopyFourPalettes
ld hl, Palettes_b681
2015-11-20 20:15:32 +00:00
ld de, UnknOBPals
ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
ld de, UnknOBPals + 7 palettes
ld a, $1c
call GetPredefPal
call LoadHLPaletteIntoDE
2015-12-17 02:57:42 +00:00
call WipeAttrMap
ret
; 9578
_CGB_FrontpicPals: ; 9578
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld a, [CurPartySpecies]
ld bc, TempMonDVs
2015-12-17 02:57:42 +00:00
call GetFrontpicPalettePointer
call LoadPalette_White_Col1_Col2_Black
call WipeAttrMap
call ApplyAttrMap
call ApplyPals
ret
; 9591
2015-11-13 05:49:27 +00:00
_CGB1d: ; 9591
ld hl, .Palettes
2015-11-20 20:15:32 +00:00
ld de, UnknBGPals
ld bc, 2 palettes
ld a, $5
call FarCopyWRAM
2015-12-17 02:57:42 +00:00
call ApplyPals
call WipeAttrMap
hlcoord 3, 7, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 8, 14
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 1, 5, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 1, 18
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 1, 16, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 1, 18
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 0, 0, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 17, 2
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
hlcoord 18, 5, AttrMap
2015-11-13 05:49:27 +00:00
lb bc, 12, 1
ld a, $1
2015-11-13 05:49:27 +00:00
call FillBoxCGB
2015-12-17 02:57:42 +00:00
call ApplyAttrMap
ret
; 95e0
.Palettes: ; 95e0
RGB 31, 31, 31
RGB 16, 31, 14
RGB 05, 14, 21
RGB 05, 13, 10
RGB 31, 31, 31
RGB 11, 21, 25
RGB 05, 14, 21
RGB 00, 03, 19
; 95f0