2020-10-30 14:45:31 +00:00
|
|
|
GetCrystalCGBLayout:
|
2015-12-17 02:57:42 +00:00
|
|
|
ld a, b
|
2020-07-04 20:18:16 +00:00
|
|
|
cp SCGB_DEFAULT
|
2020-10-30 14:45:31 +00:00
|
|
|
jr nz, .not_default
|
2020-07-04 20:18:16 +00:00
|
|
|
ld a, [wDefaultSGBLayout]
|
2020-10-30 14:45:31 +00:00
|
|
|
.not_default
|
2015-12-17 02:57:42 +00:00
|
|
|
push af
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ResetBGPals
|
2015-12-17 02:57:42 +00:00
|
|
|
pop af
|
|
|
|
ld l, a
|
|
|
|
ld h, 0
|
|
|
|
add hl, hl
|
2020-10-30 14:45:31 +00:00
|
|
|
ld de, .Jumptable
|
2015-12-17 02:57:42 +00:00
|
|
|
add hl, de
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld de, .done
|
|
|
|
push de
|
2017-06-09 21:01:10 +00:00
|
|
|
jp hl
|
2020-10-30 14:45:31 +00:00
|
|
|
.done:
|
2015-12-17 02:57:42 +00:00
|
|
|
ret
|
|
|
|
|
2020-10-30 14:45:31 +00:00
|
|
|
.Jumptable:
|
|
|
|
dw _CrystalCGB_MobileLayout0
|
|
|
|
dw _CrystalCGB_MobileLayout1
|
|
|
|
dw _CrystalCGB_NameCard
|
2015-12-17 02:57:42 +00:00
|
|
|
|
2020-10-30 14:45:31 +00:00
|
|
|
Crystal_FillBoxCGB:
|
|
|
|
; This is a copy of FillBoxCGB.
|
2015-12-17 02:57:42 +00:00
|
|
|
.row
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
.col
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
|
|
|
jr nz, .col
|
|
|
|
pop hl
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
|
|
|
jr nz, .row
|
|
|
|
ret
|
|
|
|
|
2020-10-30 14:45:31 +00:00
|
|
|
Crystal_WipeAttrmap:
|
|
|
|
; This is a copy of WipeAttrmap.
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
|
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
MG_Mobile_Layout_LoadPals:
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wBGPals1
|
2018-03-03 00:39:16 +00:00
|
|
|
ld hl, Palette_MysteryGiftMobile
|
2015-12-17 02:57:42 +00:00
|
|
|
ld bc, 5 palettes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2015-12-17 02:57:42 +00:00
|
|
|
call FarCopyWRAM
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wBGPals1 palette PAL_BG_TEXT
|
2015-12-17 02:57:42 +00:00
|
|
|
ld hl, Palette_TextBG7
|
|
|
|
ld bc, 1 palettes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2015-12-17 02:57:42 +00:00
|
|
|
call FarCopyWRAM
|
|
|
|
ret
|
|
|
|
|
2020-10-30 14:45:31 +00:00
|
|
|
_CrystalCGB_MobileLayout0:
|
2015-12-17 02:57:42 +00:00
|
|
|
call MG_Mobile_Layout_LoadPals
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_WipeAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
call MG_Mobile_Layout_CreatePalBoxes
|
2020-02-13 17:30:13 +00:00
|
|
|
farcall ApplyAttrmap
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ApplyPals
|
2015-12-17 02:57:42 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
MG_Mobile_Layout_CreatePalBoxes:
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 4, 1
|
|
|
|
ld a, $1
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 2, 1
|
|
|
|
ld a, $2
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 6, 1
|
|
|
|
ld a, $3
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 1, 0, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
ld a, $1
|
|
|
|
lb bc, 3, 18
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 2, 18
|
|
|
|
ld a, $2
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 12, 18
|
|
|
|
ld a, $3
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 19, 0, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 4, 1
|
|
|
|
ld a, $1
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 2, 1
|
|
|
|
ld a, $2
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 6, 1
|
|
|
|
ld a, $3
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 12, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
ld bc, 6 * SCREEN_WIDTH
|
|
|
|
ld a, $7
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Palette_MysteryGiftMobile:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/mystery_gift/mg_mobile.pal"
|
2015-12-17 02:57:42 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
LoadOW_BGPal7::
|
2015-12-17 02:57:42 +00:00
|
|
|
ld hl, Palette_TextBG7
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wBGPals1 palette PAL_BG_TEXT
|
2017-12-16 03:36:33 +00:00
|
|
|
ld bc, 1 palettes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2015-12-17 02:57:42 +00:00
|
|
|
call FarCopyWRAM
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Palette_TextBG7:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/font/bg_text.pal"
|
2015-12-17 02:57:42 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function49420::
|
2018-01-12 19:41:42 +00:00
|
|
|
ld hl, MansionPalette1 + 8 palettes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wBGPals1 palette PAL_BG_ROOF
|
2017-12-16 03:36:33 +00:00
|
|
|
ld bc, 1 palettes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2015-12-17 02:57:42 +00:00
|
|
|
call FarCopyWRAM
|
|
|
|
ret
|
|
|
|
|
2020-10-30 14:45:31 +00:00
|
|
|
_CrystalCGB_MobileLayout1:
|
2015-12-17 02:57:42 +00:00
|
|
|
call MG_Mobile_Layout_LoadPals
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wBGPals1 palette PAL_BG_TEXT
|
2020-10-28 17:35:39 +00:00
|
|
|
ld hl, .TextPalette
|
2017-12-16 03:36:33 +00:00
|
|
|
ld bc, 1 palettes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2015-12-17 02:57:42 +00:00
|
|
|
call FarCopyWRAM
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_WipeAttrmap
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
|
|
|
|
xor a
|
|
|
|
call ByteFill
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 14, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
ld bc, 4 * SCREEN_WIDTH
|
|
|
|
ld a, $7
|
|
|
|
call ByteFill
|
|
|
|
ld a, [wd002]
|
|
|
|
bit 6, a
|
|
|
|
jr z, .asm_49464
|
|
|
|
call Function49480
|
2020-10-28 17:35:39 +00:00
|
|
|
jr .done
|
2015-12-17 02:57:42 +00:00
|
|
|
|
|
|
|
.asm_49464
|
|
|
|
call Function49496
|
2020-10-28 17:35:39 +00:00
|
|
|
.done
|
2020-02-13 17:30:13 +00:00
|
|
|
farcall ApplyAttrmap
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ApplyPals
|
2020-08-03 21:41:01 +00:00
|
|
|
ld a, TRUE
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hCGBPalUpdate], a
|
2015-12-17 02:57:42 +00:00
|
|
|
ret
|
|
|
|
|
2020-10-28 17:35:39 +00:00
|
|
|
.TextPalette:
|
2015-12-17 02:57:42 +00:00
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 26, 31, 00
|
|
|
|
RGB 20, 16, 03
|
|
|
|
RGB 00, 00, 00
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function49480:
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 4, SCREEN_WIDTH
|
|
|
|
ld a, $7
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 2, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
ld a, $4
|
|
|
|
ld [hl], a
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 19, 2, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function49496:
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 2, SCREEN_WIDTH
|
|
|
|
ld a, $7
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 1, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
ld a, $4
|
|
|
|
ld [hl], a
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 19, 1, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
|
2018-03-25 14:18:33 +00:00
|
|
|
INCLUDE "engine/tilesets/tileset_palettes.asm"
|
2015-12-17 02:57:42 +00:00
|
|
|
|
2020-10-30 14:45:31 +00:00
|
|
|
_CrystalCGB_NameCard:
|
2020-10-28 17:35:39 +00:00
|
|
|
ld hl, .BGPalette
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wBGPals1
|
2015-12-17 02:57:42 +00:00
|
|
|
ld bc, 1 palettes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2015-12-17 02:57:42 +00:00
|
|
|
call FarCopyWRAM
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ApplyPals
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_WipeAttrmap
|
2020-02-13 17:30:13 +00:00
|
|
|
farcall ApplyAttrmap
|
2020-10-28 17:35:39 +00:00
|
|
|
ld hl, .OBPalette
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wOBPals1
|
2015-12-17 02:57:42 +00:00
|
|
|
ld bc, 1 palettes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld a, BANK(wOBPals1)
|
2015-12-17 02:57:42 +00:00
|
|
|
call FarCopyWRAM
|
|
|
|
ret
|
|
|
|
|
2020-10-28 17:35:39 +00:00
|
|
|
.BGPalette:
|
2015-12-17 02:57:42 +00:00
|
|
|
RGB 31, 31, 31
|
|
|
|
RGB 23, 16, 07
|
|
|
|
RGB 23, 07, 07
|
|
|
|
RGB 03, 07, 20
|
|
|
|
|
2020-10-28 17:35:39 +00:00
|
|
|
.OBPalette:
|
2015-12-17 02:57:42 +00:00
|
|
|
RGB 00, 00, 00
|
|
|
|
RGB 07, 05, 31
|
|
|
|
RGB 14, 18, 31
|
|
|
|
RGB 31, 31, 31
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
Function49742:
|
2020-02-27 19:33:30 +00:00
|
|
|
ld hl, .MobileBorderPalettes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wBGPals1
|
2017-12-25 17:41:31 +00:00
|
|
|
ld bc, 8 palettes
|
2018-01-04 19:53:50 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2015-12-17 02:57:42 +00:00
|
|
|
call FarCopyWRAM
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ApplyPals
|
2015-12-17 02:57:42 +00:00
|
|
|
ret
|
|
|
|
|
2020-02-27 19:33:30 +00:00
|
|
|
.MobileBorderPalettes:
|
|
|
|
INCLUDE "gfx/trade/mobile_border.pal"
|
2015-12-17 02:57:42 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
_InitMG_Mobile_LinkTradePalMap:
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 16, 2
|
|
|
|
ld a, $4
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2015-12-17 02:57:42 +00:00
|
|
|
ld a, $3
|
2020-02-13 17:30:13 +00:00
|
|
|
ldcoord_a 0, 1, wAttrmap
|
|
|
|
ldcoord_a 0, 14, wAttrmap
|
|
|
|
hlcoord 2, 0, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 8, 18
|
|
|
|
ld a, $5
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 2, 8, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 8, 18
|
|
|
|
ld a, $6
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 16, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
lb bc, 2, SCREEN_WIDTH
|
|
|
|
ld a, $4
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2015-12-17 02:57:42 +00:00
|
|
|
ld a, $3
|
|
|
|
lb bc, 6, 1
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 6, 1, wAttrmap
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2015-12-17 02:57:42 +00:00
|
|
|
ld a, $3
|
|
|
|
lb bc, 6, 1
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 17, 1, wAttrmap
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2015-12-17 02:57:42 +00:00
|
|
|
ld a, $3
|
|
|
|
lb bc, 6, 1
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 6, 9, wAttrmap
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2015-12-17 02:57:42 +00:00
|
|
|
ld a, $3
|
|
|
|
lb bc, 6, 1
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 17, 9, wAttrmap
|
2020-10-30 14:45:31 +00:00
|
|
|
call Crystal_FillBoxCGB
|
2015-12-17 02:57:42 +00:00
|
|
|
ld a, $2
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 2, 16, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
ld [hli], a
|
|
|
|
ld a, $7
|
|
|
|
ld [hli], a
|
2016-05-10 16:31:49 +00:00
|
|
|
ld [hli], a
|
|
|
|
ld [hli], a
|
2015-12-17 02:57:42 +00:00
|
|
|
ld a, $2
|
|
|
|
ld [hl], a
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 2, 17, wAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
ld a, $3
|
|
|
|
ld bc, 6
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
|
2018-07-23 04:13:43 +00:00
|
|
|
_LoadTradeRoomBGPals:
|
2017-12-16 03:36:33 +00:00
|
|
|
ld hl, TradeRoomPalette
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wBGPals1 palette PAL_BG_GREEN
|
2017-12-16 03:36:33 +00:00
|
|
|
ld bc, 6 palettes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2015-12-17 02:57:42 +00:00
|
|
|
call FarCopyWRAM
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall ApplyPals
|
2015-12-17 02:57:42 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
TradeRoomPalette:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/trade/border.pal"
|
2015-12-17 02:57:42 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
InitMG_Mobile_LinkTradePalMap:
|
2015-12-21 19:10:16 +00:00
|
|
|
call _InitMG_Mobile_LinkTradePalMap
|
2015-12-17 02:57:42 +00:00
|
|
|
ret
|