summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--constants/scgb_constants.asm113
-rw-r--r--constants/sprite_anim_constants.asm1
-rw-r--r--data/maps/environment_colors.asm35
-rw-r--r--data/maps/sgb_roof_pal_inds.asm31
-rw-r--r--data/sgb_ctrl_packets.asm133
-rwxr-xr-xengine/gfx/cgb_layouts.asm977
-rwxr-xr-xengine/gfx/color.asm1677
-rwxr-xr-xengine/gfx/sgb_layouts.asm636
-rw-r--r--engine/menus/naming_screen.asm18
-rw-r--r--engine/movie/title.asm10
-rw-r--r--gfx/battle/exp_bar.pal3
-rw-r--r--gfx/battle/hp_bar.pal9
-rw-r--r--gfx/battle_anims/battle_anims.pal29
-rw-r--r--gfx/beta_poker/beta_poker.pal19
-rw-r--r--gfx/diploma/diploma.pal39
-rw-r--r--gfx/overworld/npc_sprites.pal39
-rw-r--r--gfx/pack/pack.pal29
-rwxr-xr-xgfx/pals/gold_a265.pal394
-rw-r--r--gfx/pals/silver_a265.pal394
-rw-r--r--gfx/pc/orange.pal4
-rw-r--r--gfx/pokedex/cursor.pal4
-rw-r--r--gfx/pokedex/question_mark.pal4
-rw-r--r--gfx/pokegear/pokegear.pal30
-rw-r--r--gfx/sgb/blk_packets.asm98
-rw-r--r--gfx/sgb/pal_packets.asm96
-rw-r--r--gfx/sgb/predef.pal96
-rw-r--r--gfx/slots/slots.pal162
-rw-r--r--gfx/stats/pages.pal15
-rw-r--r--gfx/stats/party_menu_ob.pal69
-rw-r--r--gfx/stats/stats.pal6
-rw-r--r--gfx/tilesets/bg.pal209
-rw-r--r--gfx/tilesets/bg_tiles.pal53
-rw-r--r--gfx/tilesets/ob.pal159
-rw-r--r--gfx/tilesets/roofs.pal (renamed from gfx/tilesets/roof.pal)0
-rw-r--r--gfx/title/title_bg.pal52
-rw-r--r--gfx/title/title_fg.pal10
-rw-r--r--wram.asm75
37 files changed, 2521 insertions, 3207 deletions
diff --git a/constants/scgb_constants.asm b/constants/scgb_constants.asm
index 36cf369c..878e2cf4 100644
--- a/constants/scgb_constants.asm
+++ b/constants/scgb_constants.asm
@@ -31,5 +31,118 @@
const SCGB_MYSTERY_GIFT
const SCGB_1E
+; PredefPals indexes (see gfx/sgb/predef.pal)
+; GetPredefPal arguments (see engine/gfx/color.asm)
+ const_def
+ const PREDEFPAL_ROUTES
+ const PREDEFPAL_PALLET
+ const PREDEFPAL_VIRIDIAN
+ const PREDEFPAL_PEWTER
+ const PREDEFPAL_CERULEAN
+ const PREDEFPAL_LAVENDER
+ const PREDEFPAL_VERMILION
+ const PREDEFPAL_CELADON
+ const PREDEFPAL_FUCHSIA
+ const PREDEFPAL_CINNABAR
+ const PREDEFPAL_SAFFRON
+ const PREDEFPAL_INDIGO
+ const PREDEFPAL_NEW_BARK
+ const PREDEFPAL_CHERRYGROVE
+ const PREDEFPAL_VIOLET
+ const PREDEFPAL_AZALEA
+ const PREDEFPAL_GOLDENROD
+ const PREDEFPAL_ECRUTEAK
+ const PREDEFPAL_OLIVINE
+ const PREDEFPAL_CIANWOOD
+ const PREDEFPAL_MAHOGANY
+ const PREDEFPAL_BLACKTHORN
+ const PREDEFPAL_LAKE_OF_RAGE
+ const PREDEFPAL_SILVER_CAVE
+ const PREDEFPAL_DUNGEONS
+ const PREDEFPAL_NITE
+ const PREDEFPAL_BLACKOUT
+ const PREDEFPAL_DIPLOMA ; RB_MEWMON
+ const PREDEFPAL_TRADE_TUBE ; RB_BLUEMON
+ const PREDEFPAL_POKEDEX ; RB_REDMON
+ const PREDEFPAL_RB_CYANMON
+ const PREDEFPAL_RB_PURPLEMON
+ const PREDEFPAL_RB_BROWNMON
+ const PREDEFPAL_RB_GREENMON
+ const PREDEFPAL_RB_PINKMON
+ const PREDEFPAL_RB_YELLOWMON
+ const PREDEFPAL_CGB_BADGE ; RB_GREYMON
+ const PREDEFPAL_BETA_SHINY_MEWMON
+ const PREDEFPAL_BETA_SHINY_BLUEMON
+ const PREDEFPAL_BETA_SHINY_REDMON
+ const PREDEFPAL_BETA_SHINY_CYANMON
+ const PREDEFPAL_BETA_SHINY_PURPLEMON
+ const PREDEFPAL_BETA_SHINY_BROWNMON
+ const PREDEFPAL_BETA_SHINY_GREENMON
+ const PREDEFPAL_BETA_SHINY_PINKMON
+ const PREDEFPAL_BETA_SHINY_YELLOWMON
+ const PREDEFPAL_PARTY_ICON ; BETA_SHINY_GREYMON
+ const PREDEFPAL_HP_GREEN
+ const PREDEFPAL_HP_YELLOW
+ const PREDEFPAL_HP_RED
+ const PREDEFPAL_POKEGEAR
+ const PREDEFPAL_BETA_LOGO_1
+ const PREDEFPAL_BETA_LOGO_2
+ const PREDEFPAL_GS_INTRO_GAMEFREAK_LOGO
+ const PREDEFPAL_GS_INTRO_SHELLDER_LAPRAS
+ const PREDEFPAL_BETA_INTRO_LAPRAS
+ const PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_BG
+ const PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_OB
+ const PREDEFPAL_GS_INTRO_STARTERS_TRANSITION
+ const PREDEFPAL_BETA_INTRO_VENUSAUR
+ const PREDEFPAL_PACK ; GS_INTRO_CHARIZARD
+ const PREDEFPAL_SLOT_MACHINE_0
+ const PREDEFPAL_SLOT_MACHINE_1
+ const PREDEFPAL_SLOT_MACHINE_2
+ const PREDEFPAL_SLOT_MACHINE_3
+ const PREDEFPAL_BETA_POKER_0
+ const PREDEFPAL_BETA_POKER_1
+ const PREDEFPAL_BETA_POKER_2
+ const PREDEFPAL_BETA_POKER_3
+ const PREDEFPAL_BETA_RADIO
+ const PREDEFPAL_BETA_POKEGEAR
+ const PREDEFPAL_47
+ const PREDEFPAL_GS_TITLE_SCREEN_0
+ const PREDEFPAL_GS_TITLE_SCREEN_1
+ const PREDEFPAL_GS_TITLE_SCREEN_2
+ const PREDEFPAL_GS_TITLE_SCREEN_3
+ const PREDEFPAL_UNOWN_PUZZLE
+ const PREDEFPAL_GAMEFREAK_LOGO_OB
+ const PREDEFPAL_GAMEFREAK_LOGO_BG
+
+; SGB system command codes
+; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_System_Command_Table
+ const_def
+ const SGB_PAL01
+ const SGB_PAL23
+ const SGB_PAL03
+ const SGB_PAL12
+ const SGB_ATTR_BLK
+ const SGB_ATTR_LIN
+ const SGB_ATTR_DIV
+ const SGB_ATTR_CHR
+ const SGB_SOUND
+ const SGB_SOU_TRN
+ const SGB_PAL_SET
+ const SGB_PAL_TRN
+ const SGB_ATRC_EN
+ const SGB_TEST_EN
+ const SGB_ICON_EN
+ const SGB_DATA_SND
+ const SGB_DATA_TRN
+ const SGB_MLT_REG
+ const SGB_JUMP
+ const SGB_CHR_TRN
+ const SGB_PCT_TRN
+ const SGB_ATTR_TRN
+ const SGB_ATTR_SET
+ const SGB_MASK_EN
+ const SGB_OBJ_TRN
+
SCGB_PARTY_MENU_HP_PALS EQU -4
SCGB_RAM EQU -1
+PALPACKET_LENGTH EQU $10
diff --git a/constants/sprite_anim_constants.asm b/constants/sprite_anim_constants.asm
index 72042b7d..82336ea8 100644
--- a/constants/sprite_anim_constants.asm
+++ b/constants/sprite_anim_constants.asm
@@ -34,6 +34,7 @@ SPRITE_ANIM_INDEX_TRADEMON_ICON EQU $23
SPRITE_ANIM_INDEX_TRADEMON_BUBBLE EQU $24
SPRITE_ANIM_INDEX_RADIO_TUNING_KNOB EQU $26
SPRITE_ANIM_INDEX_EGG_CRACK EQU $2b
+SPRITE_ANIM_INDEX_GS_INTRO_HO_OH EQU $2c
SPRITE_ANIM_INDEX_EGG_HATCH EQU $2e
; DoAnimFrame.Jumptable indexes (see engine/gfx/sprite_anims.asm)
diff --git a/data/maps/environment_colors.asm b/data/maps/environment_colors.asm
new file mode 100644
index 00000000..3497b2b9
--- /dev/null
+++ b/data/maps/environment_colors.asm
@@ -0,0 +1,35 @@
+EnvironmentColorsPointers:
+; entries correspond to environment constants (see constants/map_data_constants.asm)
+ dw .OutdoorColors ; unused
+ dw .OutdoorColors ; TOWN
+ dw .OutdoorColors ; ROUTE
+ dw .IndoorColors ; INDOOR
+ dw .DungeonColors ; CAVE
+ dw .Env5Colors ; ENVIRONMENT_5
+ dw .IndoorColors ; GATE
+ dw .DungeonColors ; DUNGEON
+
+; Valid indices: $00 - $29 (see gfx/tilesets/bg_tiles.pal)
+.OutdoorColors:
+ db $00, $01, $02, $28, $04, $05, $06, $07 ; morn
+ db $08, $09, $0a, $28, $0c, $0d, $0e, $0f ; day
+ db $10, $11, $12, $29, $14, $15, $16, $17 ; nite
+ db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
+
+.IndoorColors:
+ db $20, $21, $22, $23, $24, $25, $26, $07 ; morn
+ db $20, $21, $22, $23, $24, $25, $26, $07 ; day
+ db $10, $11, $12, $13, $14, $15, $16, $07 ; nite
+ db $18, $19, $1a, $1b, $1c, $1d, $1e, $07 ; dark
+
+.DungeonColors:
+ db $00, $01, $02, $03, $04, $05, $06, $07 ; morn
+ db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; day
+ db $10, $11, $12, $13, $14, $15, $16, $17 ; nite
+ db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
+
+.Env5Colors:
+ db $00, $01, $02, $03, $04, $05, $06, $07 ; morn
+ db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; day
+ db $10, $11, $12, $13, $14, $15, $16, $17 ; nite
+ db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
diff --git a/data/maps/sgb_roof_pal_inds.asm b/data/maps/sgb_roof_pal_inds.asm
new file mode 100644
index 00000000..a2620e19
--- /dev/null
+++ b/data/maps/sgb_roof_pal_inds.asm
@@ -0,0 +1,31 @@
+; Crystal does not support SGB, so this is unused.
+
+MapGroupRoofSGBPalInds:
+; entries correspond to map groups
+ db PREDEFPAL_ROUTES
+ db PREDEFPAL_OLIVINE
+ db PREDEFPAL_MAHOGANY
+ db PREDEFPAL_DUNGEONS
+ db PREDEFPAL_ECRUTEAK
+ db PREDEFPAL_BLACKTHORN
+ db PREDEFPAL_CINNABAR
+ db PREDEFPAL_CERULEAN
+ db PREDEFPAL_AZALEA
+ db PREDEFPAL_LAKE_OF_RAGE
+ db PREDEFPAL_VIOLET
+ db PREDEFPAL_GOLDENROD
+ db PREDEFPAL_VERMILION
+ db PREDEFPAL_PALLET
+ db PREDEFPAL_PEWTER
+ db PREDEFPAL_VERMILION
+ db PREDEFPAL_INDIGO
+ db PREDEFPAL_FUCHSIA
+ db PREDEFPAL_LAVENDER
+ db PREDEFPAL_SILVER_CAVE
+ db PREDEFPAL_FUCHSIA
+ db PREDEFPAL_CELADON
+ db PREDEFPAL_CIANWOOD
+ db PREDEFPAL_VIRIDIAN
+ db PREDEFPAL_NEW_BARK
+ db PREDEFPAL_SAFFRON
+ db PREDEFPAL_CHERRYGROVE
diff --git a/data/sgb_ctrl_packets.asm b/data/sgb_ctrl_packets.asm
new file mode 100644
index 00000000..b3c2b040
--- /dev/null
+++ b/data/sgb_ctrl_packets.asm
@@ -0,0 +1,133 @@
+; macros taken from pokered's data/sgb_packets.asm
+; names taken from pandocs
+; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_Palette_Commands
+
+sgb_pal_trn: MACRO
+ db (SGB_PAL_TRN << 3) + 1
+ ds 15
+ENDM
+
+sgb_mlt_req: MACRO
+ db (SGB_MLT_REG << 3) + 1
+ db \1 - 1
+ ds 14
+ENDM
+
+sgb_chr_trn: MACRO
+ db (SGB_CHR_TRN << 3) + 1
+ db \1 + (\2 << 1)
+ ds 14
+ENDM
+
+sgb_pct_trn: MACRO
+ db (SGB_PCT_TRN << 3) + 1
+ ds 15
+ENDM
+
+sgb_mask_en: MACRO
+ db (SGB_MASK_EN << 3) + 1
+ db \1
+ ds 14
+ENDM
+
+sgb_data_snd: MACRO
+ db (SGB_DATA_SND << 3) + 1
+ dw \1 ; address
+ db \2 ; bank
+ db \3 ; length (1-11)
+ENDM
+
+; Crystal does not support SGB, so this is unused.
+
+PalTrnPacket: sgb_pal_trn
+MltReq1Packet: sgb_mlt_req 1
+MltReq2Packet: sgb_mlt_req 2
+ChrTrnPacket: sgb_chr_trn 0, 0
+PctTrnPacket: sgb_pct_trn
+
+MaskEnFreezePacket: sgb_mask_en 1
+MaskEnCancelPacket: sgb_mask_en 0
+
+; These are packets containing SNES code.
+; This set of packets is found in several Japanese SGB-compatible titles.
+; It appears to be part of NCL's SGB devkit.
+
+DataSndPacket1:
+ sgb_data_snd $085d, $0, 11
+ db $8c ; cpx #$8c (2)
+ db $d0, $f4 ; bne -$0c
+ db $60 ; rts
+ ds 7
+
+DataSndPacket2:
+ sgb_data_snd $0852, $0, 11
+ db $a9, $e7 ; lda #$e7
+ db $9f, $01, $c0, $7e ; sta $7ec001, x
+ db $e8 ; inx
+ db $e8 ; inx
+ db $e8 ; inx
+ db $e8 ; inx
+ db $e0 ; cpx #$8c (1)
+
+DataSndPacket3:
+ sgb_data_snd $0847, $0, 11
+ db $c4 ; cmp #$c4 (2)
+ db $d0, $16 ; bne +$16
+ db $a5 ; lda dp
+ db $cb ; wai
+ db $c9, $05 ; cmp #$05
+ db $d0, $10 ; bne +$10
+ db $a2, $28 ; ldx #$28
+
+DataSndPacket4:
+ sgb_data_snd $083c, $0, 11
+ db $f0, $12 ; beq +$12
+ db $a5 ; lda dp
+ db $c9, $c9 ; cmp #$c9
+ db $c8 ; iny
+ db $d0, $1c ; bne +$1c
+ db $a5 ; lda dp
+ db $ca ; dex
+ db $c9 ; cmp #$c4 (1)
+
+DataSndPacket5:
+ sgb_data_snd $0831, $0, 11
+ dbw $0c, $caa5 ; tsb $caa5
+ db $c9, $7e ; cmp #$7e
+ db $d0, $06 ; bne +$06
+ db $a5 ; lda dp
+ db $cb ; wai
+ db $c9, $7e ; cmp #$7e
+
+DataSndPacket6:
+ sgb_data_snd $0826, $0, 11
+ db $39 ; bne +$39 (2)
+ dbw $cd, $0c48 ; cmp $0c48
+ db $d0, $34 ; bne +$34
+ db $a5 ; lda dp
+ db $c9, $c9 ; cmp #$c9
+ db $80, $d0 ; bra -$30
+
+DataSndPacket7:
+ sgb_data_snd $081b, $0, 11
+ db $ea ; nop
+ db $ea ; nop
+ db $ea ; nop
+ db $ea ; nop
+ db $ea ; nop
+ ; $0820:
+ db $a9, $01 ; lda #01
+ dbw $cd, $0c4f ; cmp $c4f
+ db $d0 ; bne +$39 (1)
+
+DataSndPacket8:
+ sgb_data_snd $0810, $0, 11
+ dbw $4c, $0820 ; jmp $0820
+ db $ea ; nop
+ db $ea ; nop
+ db $ea ; nop
+ db $ea ; nop
+ db $ea ; nop
+ db $60 ; rts
+ db $ea ; nop
+ db $ea ; nop
diff --git a/engine/gfx/cgb_layouts.asm b/engine/gfx/cgb_layouts.asm
index 297f27b2..34cb2350 100755
--- a/engine/gfx/cgb_layouts.asm
+++ b/engine/gfx/cgb_layouts.asm
@@ -1,443 +1,425 @@
+; Replaces the functionality of sgb.asm to work with CGB hardware.
+
CheckCGB:
ldh a, [hCGB]
and a
ret
-Predef_LoadSGBLayoutCGB:
+LoadSGBLayoutCGB:
ld a, b
cp SCGB_RAM
- jr nz, .asm_931d
- ld a, [wColorLayoutPredefID]
-.asm_931d
+ jr nz, .not_ram
+ ld a, [wSGBPredef]
+.not_ram
cp SCGB_PARTY_MENU_HP_PALS
- jp z, Function9b75
- call Function9b01
+ jp z, CGB_ApplyPartyMenuHPPals
+ call ResetBGPals
ld l, a
- ld h, $0
+ ld h, 0
add hl, hl
- ld de, .Jumptable
+ ld de, .dw
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
- ld de, .return
+ ld de, .ReturnFromJumpTable
push de
jp hl
-.return
- ret
-
-.Jumptable
- dw Function9376
- dw Function9399
- dw Function944a
- dw Function945e
- dw Function94f1
- dw Function9605
- dw Function968d
- dw Function96b7
- dw Function973e
- dw Function9757
- dw Function9760
- dw Function976d
- dw Function97af
- dw Function97d4
- dw Function98be
- dw Function98f1
- dw Function9905
- dw Function9728
- dw Function999f
- dw Function99d9
- dw Function991e
- dw Function9802
- dw Function95d5
- dw Function9561
- dw Function97e1
- dw Function9a03
- dw Function9a2e
- dw Function9a5a
- dw Function9a7b
+.ReturnFromJumpTable:
+ ret
+
+.dw
+ dw _CGB_BattleGrayscale
+ dw _CGB_BattleColors
+ dw _CGB_PokegearPals
+ dw _CGB_StatsScreenHPPals
+ dw _CGB_Pokedex
+ dw _CGB_SlotMachine
+ dw _CGB_BetaTitleScreen
+ dw _CGB_GSIntro
+ dw _CGB_Diploma
+ dw _CGB_MapPals
+ dw _CGB_PartyMenu
+ dw _CGB_Evolution
+ dw _CGB_GSTitleScreen
+ dw _CGB0d
+ dw _CGB_MoveList
+ dw _CGB_BetaPikachuMinigame
+ dw _CGB_PokedexSearchOption
+ dw _CGB_BetaPoker
+ dw _CGB_Pokepic
+ dw _CGB_MagnetTrain
+ dw _CGB_PackPals
+ dw _CGB_TrainerCard
+ dw _CGB_PokedexUnownMode
+ dw _CGB_BillsPC
+ dw _CGB_UnownPuzzle
+ dw _CGB_GamefreakLogo
+ dw _CGB_PlayerOrMonFrontpicPals
+ dw _CGB_TradeTube
+ dw _CGB_TrainerOrMonFrontpicPals
dw Function9a94
- dw Function9a47
- dw Function9502
+ dw _CGB1e
+ dw _CGB_Pokedex_5_5
-Function9376: ; 9376 (2:5376)
- ld hl, PalPacket_a0d5 + 1
+_CGB_BattleGrayscale:
+ ld hl, PalPacket_BattleGrayscale + 1
ld de, wBGPals1
- ld c, $4
- call Function9ab7
- ld hl, PalPacket_a0d5 + 1
- ld de, wBGPals1 palette 4
- ld c, $4
- call Function9ab7
- ld hl, PalPacket_a0d5 + 1
+ ld c, 4
+ call CopyPalettes
+ ld hl, PalPacket_BattleGrayscale + 1
+ ld de, wBGPals1 palette PAL_BATTLE_BG_EXP
+ ld c, 4
+ call CopyPalettes
+ ld hl, PalPacket_BattleGrayscale + 1
ld de, wOBPals1
- ld c, $2
- call Function9ab7
- jr asm_93e1
+ ld c, 2
+ call CopyPalettes
+ jr _CGB_FinishBattleScreenLayout
-Function9399: ; 9399 (2:5399)
+_CGB_BattleColors:
ld de, wBGPals1
- call Function9ba9
+ call GetBattlemonBackpicPalettePointer
push hl
- call Function9adb
- call Function9bba
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_PLAYER
+ call GetEnemyFrontpicPalettePointer
push hl
- call Function9adb
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_ENEMY
ld a, [wEnemyHPPal]
ld l, a
ld h, $0
add hl, hl
add hl, hl
- ld bc, Palettes_ad2d
+ ld bc, HPBarPals
add hl, bc
- call Function9adb
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_ENEMY_HP
ld a, [wPlayerHPPal]
ld l, a
ld h, $0
add hl, hl
add hl, hl
- ld bc, Palettes_ad2d
+ ld bc, HPBarPals
add hl, bc
- call Function9adb
- ld hl, Palettes_ad39
- call Function9adb
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_PLAYER_HP
+ ld hl, ExpBarPalette
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_BG_EXP
ld de, wOBPals1
pop hl
- call Function9adb
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_OB_ENEMY
pop hl
- call Function9adb
- ld a, $1
- ld [wColorLayoutPredefID], a
- call Function9b28
-asm_93e1:
+ call LoadPalette_White_Col1_Col2_Black ; PAL_BATTLE_OB_PLAYER
+ ld a, SCGB_BATTLE_COLORS
+ ld [wSGBPredef], a
+ call ApplyPals
+_CGB_FinishBattleScreenLayout:
ld hl, TilesetBGPalette + 7 * 8
ld de, wBGPals1 palette 7
ld bc, $8
call CopyBytes
hlcoord 0, 0, wAttrmap
- ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
- ld a, $2
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ ld a, PAL_BATTLE_BG_ENEMY_HP
call ByteFill
hlcoord 0, 4, wAttrmap
- lb bc, $8, $a
- ld a, $0
+ lb bc, 8, 10
+ ld a, PAL_BATTLE_BG_PLAYER
call FillBoxCGB
hlcoord 10, 0, wAttrmap
- lb bc, $7, $a
- ld a, $1
+ lb bc, 7, 10
+ ld a, PAL_BATTLE_BG_ENEMY
call FillBoxCGB
hlcoord 0, 0, wAttrmap
- lb bc, $4, $a
- ld a, $2
+ lb bc, 4, 10
+ ld a, PAL_BATTLE_BG_ENEMY_HP
call FillBoxCGB
hlcoord 10, 7, wAttrmap
- lb bc, $5, $a
- ld a, $3
+ lb bc, 5, 10
+ ld a, PAL_BATTLE_BG_PLAYER_HP
call FillBoxCGB
hlcoord 10, 11, wAttrmap
- lb bc, $1, $9
- ld a, $4
+ lb bc, 1, 9
+ ld a, PAL_BATTLE_BG_EXP
call FillBoxCGB
hlcoord 0, 12, wAttrmap
- ld bc, $78
- ld a, $7
+ ld bc, 6 * SCREEN_WIDTH
+ ld a, PAL_BATTLE_BG_TEXT
call ByteFill
- ld hl, Palettes_9c09
- ld de, wOBPals1 palette 2
- ld bc, $30
+ ld hl, BattleObjectPals
+ ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY
+ ld bc, 6 palettes
call CopyBytes
- call Function9b35
+ call ApplyAttrmap
ret
-Function944a: ; 944a (2:544a)
- ld hl, Palettes_bb6e
+_CGB_PokegearPals:
+ ld hl, PokegearPals
ld de, wBGPals1
- ld bc, $30
+ ld bc, 6 palettes
call CopyBytes
- call Function9b28
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Function945e: ; 945e (2:545e)
+_CGB_StatsScreenHPPals:
ld de, wBGPals1
- ld a, [wcca1]
+ ld a, [wCurHPPal]
ld l, a
ld h, $0
add hl, hl
add hl, hl
- ld bc, Palettes_ad2d
+ ld bc, HPBarPals
add hl, bc
- call Function9adb
+ call LoadPalette_White_Col1_Col2_Black ; hp palette
ld a, [wCurPartySpecies]
ld bc, wTempMonDVs
- call Function9bcb
- call Function9adb
- ld hl, Palettes_ad39
- call Function9adb
- ld hl, Palettes_94d3
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black ; mon palette
+ ld hl, ExpBarPalette
+ call LoadPalette_White_Col1_Col2_Black ; exp palette
+ ld hl, StatsScreenPagePals
ld de, wBGPals1 palette 3
- ld bc, $18
+ ld bc, 3 palettes ; pink, green, and blue page palettes
call CopyBytes
- call Function9b1d
+ call WipeAttrmap
+
hlcoord 0, 0, wAttrmap
- lb bc, $8, $14
- ld a, $1
+ lb bc, 8, SCREEN_WIDTH
+ ld a, $1 ; mon palette
call FillBoxCGB
+
hlcoord 10, 16, wAttrmap
- ld bc, $a
- ld a, $2
+ ld bc, 10
+ ld a, $2 ; exp palette
call ByteFill
+
hlcoord 13, 5, wAttrmap
- lb bc, $2, $2
- ld a, $3
+ lb bc, 2, 2
+ ld a, $3 ; pink page palette
call FillBoxCGB
+
hlcoord 15, 5, wAttrmap
- lb bc, $2, $2
- ld a, $4
+ lb bc, 2, 2
+ ld a, $4 ; green page palette
call FillBoxCGB
+
hlcoord 17, 5, wAttrmap
- lb bc, $2, $2
- ld a, $5
+ lb bc, 2, 2
+ ld a, $5 ; blue page palette
call FillBoxCGB
- call Function9b35
- call Function9b28
+
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Palettes_94d3:
- 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
+StatsScreenPagePals:
+INCLUDE "gfx/stats/pages.pal"
StatsScreenPals:
- RGB 31, 19, 31
-
- RGB 21, 31, 14
+INCLUDE "gfx/stats/stats.pal"
- RGB 17, 31, 31
-
-Function94f1: ; 94f1 (2:54f1)
- call Function9513
+_CGB_Pokedex:
+ call _CGB_Pokedex_Init
hlcoord 1, 1, wAttrmap
lb bc, 7, 7
ld a, $1
call FillBoxCGB
- jp Function9537
+ jp _CGB_Pokedex_Resume
-Function9502: ; 9502 (2:5502)
- call Function9513
+_CGB_Pokedex_5_5:
+ call _CGB_Pokedex_Init
hlcoord 1, 1, wAttrmap
lb bc, 5, 5
ld a, $1
call FillBoxCGB
- jp Function9537
+ jp _CGB_Pokedex_Resume
-Function9513: ; 9513 (2:5513)
+_CGB_Pokedex_Init:
ld de, wBGPals1
- ld a, $1d
- call Function9ac7
- call Function9ad2
+ ld a, PREDEFPAL_POKEDEX
+ call GetPredefPal
+ call LoadHLPaletteIntoDE ; dex interface palette
ld a, [wCurPartySpecies]
cp $ff
- jr nz, .asm_952d
- ld hl, Palettes_9559
- call Function9ad2
- jr .asm_9533
-
-.asm_952d
- call Function9be4
- call Function9adb
-.asm_9533
- call Function9b1d
- ret
-
-Function9537: ; 9537 (2:5537)
- call Function9b9c
- ld hl, Palettes_9551
- ld de, wOBPals1 palette 7
- ld bc, $8
+ jr nz, .is_pokemon
+ ld hl, PokedexQuestionMarkPalette
+ call LoadHLPaletteIntoDE ; green question mark palette
+ jr .got_palette
+
+.is_pokemon
+ call GetMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black ; mon palette
+.got_palette
+ call WipeAttrmap
+ ret
+
+_CGB_Pokedex_Resume:
+ call InitPartyMenuOBPals
+ ld hl, PokedexCursorPalette
+ ld de, wOBPals1 palette 7 ; green cursor palette
+ ld bc, 1 palettes
call CopyBytes
- call Function9b35
- call Function9b28
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Palettes_9551:
- RGB 0, 0, 0
- RGB 11, 23, 0
- RGB 7, 17, 0
- RGB 0, 0, 0
+PokedexCursorPalette:
+INCLUDE "gfx/pokedex/cursor.pal"
-Palettes_9559:
- RGB 11, 23, 0
- RGB 7, 17, 0
- RGB 6, 16, 3
- RGB 5, 12, 1
+PokedexQuestionMarkPalette:
+INCLUDE "gfx/pokedex/question_mark.pal"
-Function9561: ; 9561 (2:5561)
+_CGB_BillsPC:
ld de, wBGPals1
- ld a, $1d
- call Function9ac7
- call Function9ad2
+ ld a, PREDEFPAL_POKEDEX
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
ld a, [wCurPartySpecies]
cp $ff
- jr nz, .asm_957b
- ld hl, Palettes_95cd
- call Function9ad2
- jr .asm_9584
+ jr nz, .GetMonPalette
+ ld hl, .BillsPCOrangePalette
+ call LoadHLPaletteIntoDE
+ jr .Resume
-.asm_957b
+.GetMonPalette:
ld bc, wTempMonDVs
- call Function9bcb
- call Function9adb
-.asm_9584
- call Function9b1d
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+.Resume:
+ call WipeAttrmap
hlcoord 1, 4, wAttrmap
lb bc, 7, 7
ld a, $1
call FillBoxCGB
- call Function9b9c
- call Function9b35
- call Function9b28
+ call InitPartyMenuOBPals
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Function95a0:
- ld hl, Palettes_95cd
- call Function9ad2
- jr asm_95b1
+.Function9009:
+ ld hl, .BillsPCOrangePalette
+ call LoadHLPaletteIntoDE
+ jr .asm_95b1
-Function95a8:
+.unused
ld bc, wTempMonDVs
- call Function9bcb
- call Function9adb
-asm_95b1:
- call Function9b1d
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+.asm_95b1
+ call WipeAttrmap
hlcoord 1, 1, wAttrmap
lb bc, 7, 7
ld a, $1
call FillBoxCGB
- call Function9b9c
- call Function9b35
- call Function9b28
+ call InitPartyMenuOBPals
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Palettes_95cd:
- RGB 31, 15, 0
- RGB 23, 12, 0
- RGB 15, 7, 0
- RGB 0, 0, 0
+.BillsPCOrangePalette:
+INCLUDE "gfx/pc/orange.pal"
-Function95d5: ; 95d5 (2:55d5)
+_CGB_PokedexUnownMode:
ld de, wBGPals1
- ld a, $1d
- call Function9ac7
- call Function9ad2
+ ld a, PREDEFPAL_POKEDEX
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
ld a, [wCurPartySpecies]
- call Function9be4
- call Function9adb
- call Function9b1d
+ call GetMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrmap
hlcoord 7, 5, wAttrmap
lb bc, 7, 7
ld a, $1
call FillBoxCGB
- call Function9b9c
- call Function9b35
- call Function9b28
+ call InitPartyMenuOBPals
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Function9605: ; 9605 (2:5605)
- ld hl, Palettes_bbbe
+_CGB_SlotMachine:
+ ld hl, SlotMachinePals
ld de, wBGPals1
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
- call Function9b1d
+ call WipeAttrmap
hlcoord 0, 2, wAttrmap
- lb bc, $a, $3
+ lb bc, 10, 3
ld a, $2
call FillBoxCGB
hlcoord 17, 2, wAttrmap
- lb bc, $a, $3
+ lb bc, 10, 3
ld a, $2
call FillBoxCGB
hlcoord 0, 4, wAttrmap
- lb bc, $6, $3
+ lb bc, 6, 3
ld a, $3
call FillBoxCGB
hlcoord 17, 4, wAttrmap
- lb bc, $6, $3
+ lb bc, 6, 3
ld a, $3
call FillBoxCGB
hlcoord 0, 6, wAttrmap
- lb bc, $2, $3
+ lb bc, 2, 3
ld a, $4
call FillBoxCGB
hlcoord 17, 6, wAttrmap
- lb bc, $2, $3
+ lb bc, 2, 3
ld a, $4
call FillBoxCGB
hlcoord 4, 2, wAttrmap
- lb bc, $2, $c
+ lb bc, 2, 12
ld a, $1
call FillBoxCGB
hlcoord 3, 2, wAttrmap
- lb bc, $a, $1
+ lb bc, 10, 1
ld a, $1
call FillBoxCGB
hlcoord 16, 2, wAttrmap
- lb bc, $a, $1
+ lb bc, 10, 1
ld a, $1
call FillBoxCGB
hlcoord 0, 12, wAttrmap
ld bc, $78
ld a, $7
call ByteFill
- call Function9b35
- call Function9b28
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Function968d: ; 968d (2:568d)
- ld hl, PalPacket_a115 + 1
- call Function9ab2
- call Function9b1d
+_CGB_BetaTitleScreen:
+ ld hl, PalPacket_BetaTitleScreen + 1
+ call CopyFourPalettes
+ call WipeAttrmap
ld de, wOBPals1
- ld a, $3c
- call Function9ac7
- call Function9ad2
+ ld a, PREDEFPAL_PACK
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
hlcoord 0, 6, wAttrmap
- lb bc, $c, $14
+ lb bc, 12, SCREEN_WIDTH
ld a, $1
call FillBoxCGB
- call Function9b35
- call Function9b28
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Function96b7: ; 96b7 (2:56b7)
- ld b, $0
+_CGB_GSIntro:
+ ld b, 0
ld hl, .Jumptable
add hl, bc
add hl, bc
@@ -447,362 +429,339 @@ Function96b7: ; 96b7 (2:56b7)
jp hl
.Jumptable:
- dw Function96c8
- dw Function96f9
- dw Function9713
+ dw .ShellderLaprasScene
+ dw .JigglypuffPikachuScene
+ dw .StartersCharizardScene
-Function96c8:
- ld hl, Palettes_96e1
+.ShellderLaprasScene:
+ ld hl, .ShellderLaprasBGPalette
ld de, wBGPals1
- call Function9ad2
- ld hl, Palettes_96e9
+ call LoadHLPaletteIntoDE
+ ld hl, .ShellderLaprasOBPals
ld de, wOBPals1
- ld bc, $10
+ ld bc, 2 palettes
call CopyBytes
- call Function9b1d
+ call WipeAttrmap
ret
-Palettes_96e1:
+.ShellderLaprasBGPalette:
RGB 19, 31, 19
RGB 18, 23, 31
RGB 11, 21, 28
- RGB 4, 16, 24
+ RGB 04, 16, 24
-Palettes_96e9:
+.ShellderLaprasOBPals:
RGB 29, 29, 29
RGB 20, 19, 20
- RGB 19, 6, 4
- RGB 3, 4, 6
+ RGB 19, 06, 04
+ RGB 03, 04, 06
RGB 31, 31, 31
RGB 31, 31, 31
- RGB 31, 0, 0
- RGB 3, 4, 6
+ RGB 31, 00, 00
+ RGB 03, 04, 06
-Function96f9:
+.JigglypuffPikachuScene:
ld de, wBGPals1
- ld a, $38
- call Function9ac7
- call Function9ad2
+ ld a, PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_BG
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+
ld de, wOBPals1
- ld a, $39
- call Function9ac7
-.asm_970b
- call Function9ad2
- call Function9b1d
+ ld a, PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_OB
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ call WipeAttrmap
ret
-Function9713:
- ld hl, PalPacket_a0a5 + 1
- call Function9ab2
+.StartersCharizardScene:
+ ld hl, PalPacket_Pack + 1
+ call CopyFourPalettes
ld de, wOBPals1
- ld a, $3a
- call Function9ac7
- call Function9ad2
- call Function9b1d
+ ld a, PREDEFPAL_GS_INTRO_STARTERS_TRANSITION
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ call WipeAttrmap
ret
-Function9728: ; 9728 (2:5728)
- ld hl, Palettes_bb9e
+_CGB_BetaPoker:
+ ld hl, BetaPokerPals
ld de, wBGPals1
- ld bc, $28
+ ld bc, 5 palettes
call CopyBytes
- call Function9b28
- call Function9b1d
- call Function9b35
+ call ApplyPals
+ call WipeAttrmap
+ call ApplyAttrmap
ret
-Function973e: ; 973e (2:573e)
- ld hl, Palettes_ba86
+_CGB_Diploma:
+ ld hl, DiplomaPalettes
ld de, wBGPals1
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
- ld hl, PalPacket_a125 + 1
- call Function9ab2
- call Function9b1d
- call Function9b35
+
+ ld hl, PalPacket_Diploma + 1
+ call CopyFourPalettes
+ call WipeAttrmap
+ call ApplyAttrmap
ret
-Function9757: ; 9757 (2:5757)
- call Functionb649
- ld a, $9
- ld [wColorLayoutPredefID], a
+_CGB_MapPals:
+ call LoadMapPals
+ ld a, SCGB_MAPPALS
+ ld [wSGBPredef], a
ret
-Function9760: ; 9760 (2:5760)
- ld hl, PalPacket_a0c5 + 1
- call Function9ab2
- call Function9b9c
- call Function9b35
+_CGB_PartyMenu:
+ ld hl, PalPacket_PartyMenu + 1
+ call CopyFourPalettes
+ call InitPartyMenuOBPals
+ call ApplyAttrmap
ret
-Function976d: ; 976d (2:576d)
+_CGB_Evolution:
ld de, wBGPals1
ld a, c
and a
- jr z, .asm_977e
- ld a, $1a
- call Function9ac7
- call Function9ad2
- jr .asm_97a1
+ jr z, .pokemon
+ ld a, PREDEFPAL_BLACKOUT
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ jr .got_palette
-.asm_977e
+.pokemon
ld hl, wPartyMon1DVs
- ld bc, $30
+ ld bc, PARTYMON_STRUCT_LENGTH
ld a, [wCurPartyMon]
call AddNTimes
ld c, l
ld b, h
ld a, [wPlayerHPPal]
- call Function9bcb
- call Function9adb
- ld hl, Palettes_9c09
- ld de, wOBPals1 palette 2
- ld bc, $30
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld hl, BattleObjectPals
+ ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY
+ ld bc, 6 palettes
call CopyBytes
-.asm_97a1
- call Function9b1d
- call Function9b35
- call Function9b28
+
+.got_palette
+ call WipeAttrmap
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Function97af: ; 97af (2:57af)
- ld hl, Palettes_bb36
+_CGB_GSTitleScreen:
+ ld hl, GSTitleBGPals
ld de, wBGPals1
- ld bc, $28
+ ld bc, 5 palettes
call CopyBytes
- ld hl, Palettes_bb5e
+ ld hl, GSTitleOBPals
ld de, wOBPals1
- ld bc, $10
+ ld bc, 2 palettes
call CopyBytes
- ld a, $8
- ld [wColorLayoutPredefID], a
- call Function9b28
+ ld a, SCGB_DIPLOMA
+ ld [wSGBPredef], a
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Function97d4: ; 97d4 (2:57d4)
- ld hl, PalPacket_a125 + 1
- call Function9ab2
- call Function9b1d
- call Function9b35
+_CGB0d:
+ ld hl, PalPacket_Diploma + 1
+ call CopyFourPalettes
+ call WipeAttrmap
+ call ApplyAttrmap
ret
-Function97e1: ; 97e1 (2:57e1)
- ld hl, PalPacket_a035 + 1
- call Function9ab2
+_CGB_UnownPuzzle:
+ ld hl, PalPacket_UnownPuzzle + 1
+ call CopyFourPalettes
ld de, wOBPals1
- ld a, $4c
- call Function9ac7
- call Function9ad2
+ ld a, PREDEFPAL_UNOWN_PUZZLE
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
ld hl, wOBPals1
- ld a, $1f
+ ld a, LOW(palred 31 + palgreen 0 + palblue 0)
ld [hli], a
- ld a, $0
+ ld a, HIGH(palred 31 + palgreen 0 + palblue 0)
ld [hl], a
- call Function9b1d
- call Function9b35
+ call WipeAttrmap
+ call ApplyAttrmap
ret
-Function9802: ; 9802 (2:5802)
+_CGB_TrainerCard:
ld de, wBGPals1
- xor a
- call Function9bda
- call Function9adb
- ld a, $1
- call Function9bda
- call Function9adb
- ld a, $3
- call Function9bda
- call Function9adb
- ld a, $2
- call Function9bda
- call Function9adb
- ld a, $4
- call Function9bda
- call Function9adb
- ld a, $7
- call Function9bda
- call Function9adb
- ld a, $6
- call Function9bda
- call Function9adb
- ld a, $5
- call Function9bda
- call Function9adb
- ld a, $24
- call Function9ac7
- call Function9ad2
+ xor a ; CHRIS
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, FALKNER
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, BUGSY
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, WHITNEY
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, MORTY
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, CHUCK
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, JASMINE
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, PRYCE
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ ld a, PREDEFPAL_CGB_BADGE
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+
+ ; card border
hlcoord 0, 0, wAttrmap
- ld bc, $168
- ld a, $1
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ ld a, $1 ; FALKNER
call ByteFill
hlcoord 14, 1, wAttrmap
- lb bc, $7, $5
- xor a
+ lb bc, 7, 5
+ xor a ; CHRIS
call FillBoxCGB
+ ; top-right corner still uses the border's palette
hlcoord 18, 1, wAttrmap
ld [hl], $1
hlcoord 2, 11, wAttrmap
- lb bc, $2, $4
- ld a, $1
+ lb bc, 2, 4
+ ld a, $1 ; falkner
call FillBoxCGB
hlcoord 6, 11, wAttrmap
- lb bc, $2, $4
- ld a, $2
+ lb bc, 2, 4
+ ld a, $2 ; bugsy
call FillBoxCGB
hlcoord 10, 11, wAttrmap
- lb bc, $2, $4
- ld a, $3
+ lb bc, 2, 4
+ ld a, $3 ; whitney
call FillBoxCGB
hlcoord 14, 11, wAttrmap
- lb bc, $2, $4
- ld a, $4
+ lb bc, 2, 4
+ ld a, $4 ; morty
call FillBoxCGB
hlcoord 2, 14, wAttrmap
- lb bc, $2, $4
- ld a, $5
+ lb bc, 2, 4
+ ld a, $5 ; chuck
call FillBoxCGB
hlcoord 6, 14, wAttrmap
- lb bc, $2, $4
- ld a, $6
+ lb bc, 2, 4
+ ld a, $6 ; jasmine
call FillBoxCGB
hlcoord 10, 14, wAttrmap
- lb bc, $2, $4
- ld a, $7
+ lb bc, 2, 4
+ ld a, $7 ; pryce
call FillBoxCGB
- call Function9b35
- call Function9b28
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Function98be: ; 98be (2:58be)
+_CGB_MoveList:
ld de, wBGPals1
- ld a, $10
- call Function9ac7
- call Function9ad2
+ ld a, PREDEFPAL_GOLDENROD
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
ld a, [wPlayerHPPal]
ld l, a
- ld h, $0
+ ld h, 0
add hl, hl
add hl, hl
- ld bc, Palettes_ad2d
+ ld bc, HPBarPals
add hl, bc
- call Function9adb
- call Function9b1d
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrmap
hlcoord 11, 1, wAttrmap
- lb bc, $2, $9
+ lb bc, 2, 9
ld a, $1
call FillBoxCGB
- call Function9b35
- call Function9b28
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Function98f1: ; 98f1 (2:58f1)
- ld hl, PalPacket_a0b5 + 1
- call Function9ab2
- call Function9b1d
- call Function9b35
- call Function9b28
+_CGB_BetaPikachuMinigame:
+ ld hl, PalPacket_BetaPikachuMinigame + 1
+ call CopyFourPalettes
+ call WipeAttrmap
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Function9905: ; 9905 (2:5905)
+_CGB_PokedexSearchOption:
ld de, wBGPals1
- ld a, $1d
- call Function9ac7
- call Function9ad2
- call Function9b1d
- call Function9b35
- call Function9b28
+ ld a, PREDEFPAL_POKEDEX
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ call WipeAttrmap
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Function991e: ; 991e (2:591e)
+_CGB_PackPals:
ld de, wBGPals1
- ld hl, Palettes_996f
- ld bc, $40
+ ld hl, .PackPals
+ ld bc, 8 palettes ; 6 palettes?
call CopyBytes
- call Function9b1d
+ call WipeAttrmap
hlcoord 0, 0, wAttrmap
- lb bc, $1, $a
+ lb bc, 1, 10
ld a, $1
call FillBoxCGB
hlcoord 10, 0, wAttrmap
- lb bc, $1, $a
+ lb bc, 1, 10
ld a, $2
call FillBoxCGB
hlcoord 7, 2, wAttrmap
- lb bc, $9, $1
+ lb bc, 9, 1
ld a, $3
call FillBoxCGB
hlcoord 0, 7, wAttrmap
- lb bc, $3, $5
+ lb bc, 3, 5
ld a, $4
call FillBoxCGB
hlcoord 0, 3, wAttrmap
- lb bc, $3, $5
+ lb bc, 3, 5
ld a, $5
call FillBoxCGB
- call Function9b35
- call Function9b28
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Palettes_996f:
- RGB 31, 31, 31
- RGB 15, 15, 31
- RGB 0, 0, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 15, 15, 31
- RGB 0, 0, 31
- RGB 0, 0, 0
-
- RGB 31, 11, 31
- RGB 15, 15, 31
- RGB 0, 0, 31
- RGB 0, 0, 0
+.PackPals:
+INCLUDE "gfx/pack/pack.pal"
- RGB 31, 31, 31
- RGB 15, 15, 31
- RGB 0, 0, 31
- RGB 31, 0, 0
-
- RGB 31, 31, 31
- RGB 15, 15, 31
- RGB 31, 0, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 7, 19, 7
- RGB 7, 19, 7
- RGB 0, 0, 0
-
-Function999f: ; 999f (2:599f)
- call Function9757
+_CGB_Pokepic:
+ call _CGB_MapPals
call SwapTextboxPalettes
- ld de, $14
+ ld de, SCREEN_WIDTH
hlcoord 0, 0, wAttrmap
ld a, [wMenuBorderTopCoord]
-.asm_99ae
+.loop
and a
- jr z, .asm_99b5
+ jr z, .found_top
dec a
add hl, de
- jr .asm_99ae
+ jr .loop
-.asm_99b5
+.found_top
ld a, [wMenuBorderLeftCoord]
ld e, a
ld d, $0
@@ -821,86 +780,86 @@ Function999f: ; 999f (2:599f)
ld c, a
ld a, $0
call FillBoxCGB
- call Function9b35
+ call ApplyAttrmap
ret
-Function99d9: ; 99d9 (2:59d9)
- ld hl, PalPacket_a015 + 1
- call Function9ab2
- call Function9b1d
+_CGB_MagnetTrain:
+ ld hl, PalPacket_MagnetTrain + 1
+ call CopyFourPalettes
+ call WipeAttrmap
hlcoord 0, 4, wAttrmap
- lb bc, $a, $14
+ lb bc, 10, SCREEN_WIDTH
ld a, $2
call FillBoxCGB
hlcoord 0, 6, wAttrmap
- lb bc, $6, $14
+ lb bc, 6, SCREEN_WIDTH
ld a, $1
call FillBoxCGB
- call Function9b35
- call Function9b28
+ call ApplyAttrmap
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
-Function9a03: ; 9a03 (2:5a03)
+_CGB_GamefreakLogo:
ld de, wBGPals1
- ld a, $4e
- call Function9ac7
- call Function9ad2
+ ld a, PREDEFPAL_GAMEFREAK_LOGO_BG
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
ld de, wOBPals1
- ld a, $4d
- call Function9ac7
- call Function9ad2
+ ld a, PREDEFPAL_GAMEFREAK_LOGO_OB
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
ld de, wOBPals1 palette 1
- ld a, $4d
- call Function9ac7
- call Function9ad2
- call Function9b1d
- call Function9b35
- call Function9b28
+ ld a, PREDEFPAL_GAMEFREAK_LOGO_OB
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ call WipeAttrmap
+ call ApplyAttrmap
+ call ApplyPals
ret
-Function9a2e: ; 9a2e (2:5a2e)
+_CGB_PlayerOrMonFrontpicPals:
ld de, wBGPals1
ld a, [wCurPartySpecies]
ld bc, wTempMonDVs
- call Function9bcb
- call Function9adb
- call Function9b1d
- call Function9b35
- call Function9b28
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrmap
+ call ApplyAttrmap
+ call ApplyPals
ret
-Function9a47: ; 9a47 (2:5a47)
+_CGB1e:
ld de, wBGPals1
ld a, [wCurPartySpecies]
- call Function9be4
- call Function9adb
- call Function9b1d
- call Function9b35
+ call GetMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrmap
+ call ApplyAttrmap
ret
-Function9a5a: ; 9a5a (2:5a5a)
- ld hl, PalPacket_a135 + 1
- call Function9ab2
- ld hl, Palettes_bac6
+_CGB_TradeTube:
+ ld hl, PalPacket_TradeTube + 1
+ call CopyFourPalettes
+ ld hl, PartyMenuOBPals
ld de, wOBPals1
- ld bc, $8
+ ld bc, 1 palettes
call CopyBytes
ld de, wOBPals1 palette 7
- ld a, $1c
- call Function9ac7
- call Function9ad2
- call Function9b1d
+ ld a, PREDEFPAL_TRADE_TUBE
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
+ call WipeAttrmap
ret
-Function9a7b: ; 9a7b (2:5a7b)
+_CGB_TrainerOrMonFrontpicPals:
ld de, wBGPals1
ld a, [wCurPartySpecies]
ld bc, wTempMonDVs
- call Function9bd3
- call Function9adb
- call Function9b1d
- call Function9b35
- call Function9b28
+ call GetFrontpicPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrmap
+ call ApplyAttrmap
+ call ApplyPals
ret
diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm
index bb7b7ac0..2bc553f2 100755
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -1,4 +1,3 @@
-PALPACKET_LENGTH EQU $10
INCLUDE "engine/gfx/sgb_layouts.asm"
SHINY_ATK_BIT EQU 5
@@ -7,49 +6,73 @@ SHINY_SPD_VAL EQU 10
SHINY_SPC_VAL EQU 10
CheckShininess:
+; Check if a mon is shiny by DVs at bc.
+; Return carry if shiny.
+
ld l, c
ld h, b
+
+; Attack
ld a, [hl]
- and $20
- jr z, .asm_9070
+ and 1 << SHINY_ATK_BIT
+ jr z, .NotShiny
+
+; Defense
ld a, [hli]
and $f
- cp $a
- jr nz, .asm_9070
+ cp SHINY_DEF_VAL
+ jr nz, .NotShiny
+
+; Speed
ld a, [hl]
and $f0
- cp $a0
- jr nz, .asm_9070
+ cp SHINY_SPD_VAL << 4
+ jr nz, .NotShiny
+
+; Special
ld a, [hl]
and $f
- cp $a
- jr nz, .asm_9070
+ cp SHINY_SPC_VAL
+ jr nz, .NotShiny
+
+.Shiny:
scf
ret
-.asm_9070
+.NotShiny:
and a
ret
-Unused_CheckShininess: ; 9072 (2:5072)
+Unused_CheckShininess:
+; Return carry if the DVs at hl are all 10 or higher.
+
+; Attack
ld a, [hl]
- cp $a0
- jr c, .asm_908c
+ cp 10 << 4
+ jr c, .NotShiny
+
+; Defense
ld a, [hli]
and $f
- cp $a
- jr c, .asm_908c
+ cp 10
+ jr c, .NotShiny
+
+; Speed
ld a, [hl]
- cp $a0
- jr c, .asm_908c
+ cp 10 << 4
+ jr c, .NotShiny
+
+; Special
ld a, [hl]
and $f
- cp $a
- jr c, .asm_908c
+ cp 10
+ jr c, .NotShiny
+
+.Shiny:
scf
ret
-.asm_908c
+.NotShiny:
and a
ret
@@ -57,43 +80,44 @@ Function908e:
push de
push bc
ld hl, PalPacket_a155
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
pop bc
pop de
ld a, c
- ld [wccac], a
+ ld [wSGBPals + 3], a
ld a, b
- ld [wccad], a
+ ld [wSGBPals + 4], a
ld a, e
- ld [wccae], a
+ ld [wSGBPals + 5], a
ld a, d
- ld [wccaf], a
- ld hl, wcca9
- call PushSGBPals_
+ ld [wSGBPals + 6], a
+ ld hl, wSGBPals
+ call PushSGBPals
ld hl, BlkPacket_9ee5
- call PushSGBPals_
+ call PushSGBPals
ret
InitPartyMenuPalettes:
call CheckCGB
- jr nz, .asm_90cc
+ jr nz, .cgb
ld hl, BlkPacket_9fa5
- ld de, wccaa
- ld bc, $30
+ ld de, wSGBPals + 1
+ ld bc, 6 palettes
jp CopyBytes
-.asm_90cc
- ld hl, PalPacket_a0c5 + 1
- call Function9ab2
- call Function9b9c
- call Function9b1d
+.cgb
+ ld hl, PalPacket_PartyMenu + 1
+ call CopyFourPalettes
+ call InitPartyMenuOBPals
+ call WipeAttrmap
ret
+; SGB layout for SCGB_PARTY_MENU_HP_PALS
SGB_ApplyPartyMenuHPPals:
- ld hl, wcc9b
- ld a, [wcca9]
+ ld hl, wHPPals
+ ld a, [wSGBPals]
ld e, a
ld d, $0
add hl, de
@@ -102,33 +126,36 @@ SGB_ApplyPartyMenuHPPals:
ld a, [de]
and a
ld e, $5
- jr z, .asm_90f2
+ jr z, .okay
dec a
ld e, $a
- jr z, .asm_90f2
+ jr z, .okay
ld e, $f
-.asm_90f2
+.okay
push de
- ld hl, wccb3
+ ld hl, wSGBPals + 10
ld bc, $6
- ld a, [wcca9]
+ ld a, [wSGBPals]
call AddNTimes
pop de
ld [hl], e
ret
-Function9102:
+Unreferenced_Function9102:
call CheckCGB
ret z
+; CGB only
ld hl, .BGPal
ld de, wBGPals1
- ld bc, $8
+ ld bc, 1 palettes
call CopyBytes
+
ld hl, .OBPal
ld de, wOBPals1
- ld bc, $8
+ ld bc, 1 palettes
call CopyBytes
- call Function9b28
+
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
@@ -145,171 +172,173 @@ Function9102:
RGB 08, 16, 28
RGB 00, 00, 00
-Function9136:
+Unreferenced_Function9136:
call CheckCGB
ret nz
ldh a, [hSGB]
and a
ret z
ld hl, BlkPacket_9ee5
- jp PushSGBPals_
+ jp PushSGBPals
-Function9144:
+Unreferenced_Function9144:
call CheckCGB
- jr nz, .asm_9153
+ jr nz, .cgb
ldh a, [hSGB]
and a
ret z
- ld hl, PalPacket_a095
- jp PushSGBPals_
+ ld hl, PalPacket_BetaIntroVenusaur
+ jp PushSGBPals
-.asm_9153
+.cgb
ld de, wOBPals1
- ld a, $3b
- call Function9ac7
- jp Function9ad2
+ ld a, PREDEFPAL_BETA_INTRO_VENUSAUR
+ call GetPredefPal
+ jp LoadHLPaletteIntoDE
-Function915e:
+Unreferenced_Function915e:
call CheckCGB
- jr nz, .asm_916d
+ jr nz, .cgb
ldh a, [hSGB]
and a
ret z
- ld hl, PalPacket_a0a5
- jp PushSGBPals_
+ ld hl, PalPacket_Pack
+ jp PushSGBPals
-.asm_916d
+.cgb
ld de, wOBPals1
- ld a, $3c
- call Function9ac7
- jp Function9ad2
+ ld a, PREDEFPAL_PACK
+ call GetPredefPal
+ jp LoadHLPaletteIntoDE
-Function9178:
+Unreferenced_Function9178:
call CheckCGB
- jr nz, .asm_91a9
+ jr nz, .cgb
ldh a, [hSGB]
and a
ret z
ld a, c
push af
ld hl, PalPacket_a155
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
pop af
- call Function9be4
+ call GetMonPalettePointer
ld a, [hli]
- ld [wccac], a
+ ld [wSGBPals + 3], a
ld a, [hli]
- ld [wccad], a
+ ld [wSGBPals + 4], a
ld a, [hli]
- ld [wccae], a
+ ld [wSGBPals + 5], a
ld a, [hl]
- ld [wccaf], a
- ld hl, wcca9
- jp PushSGBPals_
+ ld [wSGBPals + 6], a
+ ld hl, wSGBPals
+ jp PushSGBPals
-.asm_91a9
+.cgb
ld de, wOBPals1
ld a, c
- call Function9be4
- call Function9adb
+ call GetMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
ret
-Function91b4:
+Unreferenced_Function91b4:
ldh a, [hCGB]
and a
- jr nz, .asm_91bf
+ jr nz, .cgb
ld hl, wc602
- jp PushSGBPals_
+ jp PushSGBPals
-.asm_91bf
- ld a, [wc606]
+.cgb
+ ld a, [wc606] ; col
ld c, a
- ld a, [wc607]
- ld hl, wAttrmap
- ld de, $14
-.asm_91cc
+ ld a, [wc607] ; row
+ hlcoord 0, 0, wAttrmap
+ ld de, SCREEN_WIDTH
+.loop
and a
- jr z, .asm_91d3
+ jr z, .done
add hl, de
dec a
- jr .asm_91cc
+ jr .loop
-.asm_91d3
+.done
ld b, $0
add hl, bc
lb bc, 6, 4
- ld a, [wc605]
+ ld a, [wc605] ; value
and $3
call FillBoxCGB
call CopyTilemapAtOnce
ret
-ApplyMonOrTrainerPals: ; 91e5 (2:51e5)
+ApplyMonOrTrainerPals:
call CheckCGB
ret z
ld a, e
and a
- jr z, .asm_91f5
+ jr z, .get_trainer
ld a, [wCurPartySpecies]
- call Function9be4
- jr .asm_91fb
+ call GetMonPalettePointer
+ jr .load_palettes
-.asm_91f5
+.get_trainer
ld a, [wTrainerClass]
- call Function9bda
-.asm_91fb
+ call GetTrainerPalettePointer
+
+.load_palettes
ld de, wBGPals1
- call Function9adb
- call Function9b1d
- call Function9b35
- call Function9b28
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrmap
+ call ApplyAttrmap
+ call ApplyPals
ret
ApplyHPBarPals:
ld a, [wWhichHPBar]
and a
- jr z, .asm_921a
+ jr z, .Enemy
cp $1
- jr z, .asm_921f
+ jr z, .Player
cp $2
- jr z, .asm_9236
+ jr z, .PartyMenu
ret
-.asm_921a
- ld de, $c292
- jr .asm_9222
+.Enemy:
+ ld de, wBGPals2 palette PAL_BATTLE_BG_ENEMY_HP color 1
+ jr .okay
+
+.Player:
+ ld de, wBGPals2 palette PAL_BATTLE_BG_PLAYER_HP color 1
-.asm_921f
- ld de, $c29a
-.asm_9222
+.okay
ld l, c
ld h, $0
add hl, hl
add hl, hl
- ld bc, $6d2d
+ ld bc, HPBarPals
add hl, bc
- ld bc, $4
+ ld bc, 4
call CopyBytes
ld a, $1
ldh [hCGBPalUpdate], a
ret
-.asm_9236
+.PartyMenu:
ld e, c
inc e
hlcoord 11, 1, wAttrmap
ld bc, 2 * SCREEN_WIDTH
ld a, [wCurPartyMon]
-.asm_9241
+.loop
and a
- jr z, .asm_9248
+ jr z, .done
add hl, bc
dec a
- jr .asm_9241
+ jr .loop
-.asm_9248
+.done
lb bc, 2, 8
ld a, e
call FillBoxCGB
@@ -318,61 +347,61 @@ ApplyHPBarPals:
LoadStatsScreenPals:
call CheckCGB
ret z
- ld hl, StatsScreenPals ; $54eb
- ld b, $0
+ ld hl, StatsScreenPals
+ ld b, 0
dec c
add hl, bc
add hl, bc
ld a, [hli]
- ld [wBGPals1], a
- ld [wBGPals1 + $10], a
+ ld [wBGPals1 palette 0], a
+ ld [wBGPals1 palette 2], a
ld a, [hl]
- ld [wBGPals1 + 1], a
- ld [wBGPals1 + $11], a
- call Function9b28
+ ld [wBGPals1 palette 0 + 1], a
+ ld [wBGPals1 palette 2 + 1], a
+ call ApplyPals
ld a, $1
ldh [hCGBPalUpdate], a
ret
LoadMailPalettes:
ld l, e
- ld h, $0
+ ld h, 0
add hl, hl
add hl, hl
add hl, hl
ld de, .MailPals
add hl, de
call CheckCGB
- jr nz, .asm_92ae
+ jr nz, .cgb
push hl
ld hl, PalPacket_a155
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
pop hl
inc hl
inc hl
ld a, [hli]
- ld [wccac], a
+ ld [wSGBPals + 3], a
ld a, [hli]
- ld [wccad], a
+ ld [wSGBPals + 4], a
ld a, [hli]
- ld [wccae], a
+ ld [wSGBPals + 5], a
ld a, [hli]
- ld [wccaf], a
- ld hl, wcca9
- call PushSGBPals_
+ ld [wSGBPals + 6], a
+ ld hl, wSGBPals
+ call PushSGBPals
ld hl, BlkPacket_9ee5
- call PushSGBPals_
+ call PushSGBPals
ret
-.asm_92ae
+.cgb
ld de, wBGPals1
- ld bc, $8
+ ld bc, 1 palettes
call CopyBytes
- call Function9b28
- call Function9b1d
- call Function9b35
+ call ApplyPals
+ call WipeAttrmap
+ call ApplyAttrmap
ret
.MailPals:
@@ -380,72 +409,76 @@ INCLUDE "gfx/mail/mail.pal"
INCLUDE "engine/gfx/cgb_layouts.asm"
-Function9a94: ; 9a94 (2:5a94)
- ld hl, Palettes_9aaa
+Function9a94:
+ ld hl, .Palette
ld de, wBGPals1
- ld bc, $8
+ ld bc, 1 palettes
call CopyBytes
- call Function9b28
- call Function9b1d
- call Function9b35
+ call ApplyPals
+ call WipeAttrmap
+ call ApplyAttrmap
ret
-Palettes_9aaa:
+.Palette:
RGB 31, 31, 31
- RGB 9, 31, 31
+ RGB 09, 31, 31
RGB 10, 12, 31
- RGB 0, 3, 19
+ RGB 00, 03, 19
-Function9ab2: ; 9ab2 (2:5ab2)
+CopyFourPalettes:
ld de, wBGPals1
- ld c, $4
-Function9ab7: ; 9ab7 (2:5ab7)
+ ld c, 4
+
+CopyPalettes:
+.loop
push bc
ld a, [hli]
push hl
- call Function9ac7
- call Function9ad2
+ call GetPredefPal
+ call LoadHLPaletteIntoDE
pop hl
inc hl
pop bc
dec c
- jr nz, Function9ab7
+ jr nz, .loop
ret
-Function9ac7: ; 9ac7 (2:5ac7)
+GetPredefPal:
ld l, a
ld h, $0
add hl, hl
add hl, hl
add hl, hl
- ld bc, Palettes_a265
+ ld bc, PredefPals
add hl, bc
ret
-Function9ad2: ; 9ad2 (2:5ad2)
- ld c, $8
-.asm_9ad4
+LoadHLPaletteIntoDE:
+ ld c, 1 palettes
+.loop
ld a, [hli]
ld [de], a
inc de
dec c
- jr nz, .asm_9ad4
+ jr nz, .loop
ret
-Function9adb: ; 9adb (2:5adb)
- ld a, $ff
+LoadPalette_White_Col1_Col2_Black:
+ ld a, LOW(PALRGB_WHITE)
ld [de], a
inc de
- ld a, $7f
+ ld a, HIGH(PALRGB_WHITE)
ld [de], a
inc de
- ld c, $4
-.asm_9ae5
+
+ ld c, 2 * PAL_COLOR_SIZE
+.loop
ld a, [hli]
ld [de], a
inc de
dec c
- jr nz, .asm_9ae5
+ jr nz, .loop
+
xor a
ld [de], a
inc de
@@ -453,29 +486,30 @@ Function9adb: ; 9adb (2:5adb)
inc de
ret
-FillBoxCGB: ; 9af1 (2:5af1)
+FillBoxCGB:
+.row
push bc
push hl
-.asm_9af3
+.col
ld [hli], a
dec c
- jr nz, .asm_9af3
+ jr nz, .col
pop hl
- ld bc, $14
+ ld bc, SCREEN_WIDTH
add hl, bc
pop bc
dec b
- jr nz, FillBoxCGB
+ jr nz, .row
ret
-Function9b01: ; 9b01 (2:5b01)
+ResetBGPals:
push af
push bc
push de
push hl
ld hl, wBGPals1
- ld c, $8
-.asm_9b0a
+ ld c, 1 palettes
+.loop
ld a, $ff
ld [hli], a
ld [hli], a
@@ -487,31 +521,31 @@ Function9b01: ; 9b01 (2:5b01)
ld [hli], a
ld [hli], a
dec c
- jr nz, .asm_9b0a
+ jr nz, .loop
pop hl
pop de
pop bc
pop af
ret
-Function9b1d: ; 9b1d (2:5b1d)
+WipeAttrmap:
hlcoord 0, 0, wAttrmap
- ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
ret
-Function9b28: ; 9b28 (2:5b28)
+ApplyPals:
ld hl, wBGPals1
ld de, wBGPals2
- ld bc, $80
+ ld bc, 16 palettes
call CopyBytes
ret
-Function9b35: ; 9b35 (2:5b35)
+ApplyAttrmap:
ldh a, [rLCDC]
- bit 7, a
- jr z, .asm_9b52
+ bit rLCDC_ENABLE, a
+ jr z, .UpdateVBank1
ldh a, [hBGMapMode]
push af
ld a, $2
@@ -524,35 +558,36 @@ Function9b35: ; 9b35 (2:5b35)
ldh [hBGMapMode], a
ret
-.asm_9b52
+.UpdateVBank1:
hlcoord 0, 0, wAttrmap
- ld de, $9800
- ld b, $12
+ debgcoord 0, 0
+ ld b, SCREEN_HEIGHT
ld a, $1
ldh [rVBK], a
-.asm_9b5e
- ld c, $14
-.asm_9b60
+.row
+ ld c, SCREEN_WIDTH
+.col
ld a, [hli]
ld [de], a
inc de
dec c
- jr nz, .asm_9b60
- ld a, $c
+ jr nz, .col
+ ld a, BG_MAP_WIDTH - SCREEN_WIDTH
add e
- jr nc, .asm_9b6c
+ jr nc, .okay
inc d
-.asm_9b6c
+.okay
ld e, a
dec b
- jr nz, .asm_9b5e
+ jr nz, .row
ld a, $0
ldh [rVBK], a
ret
-Function9b75: ; 9b75 (2:5b75)
- ld hl, wcc9b
- ld a, [wcca9]
+; CGB layout for SCGB_PARTY_MENU_HP_PALS
+CGB_ApplyPartyMenuHPPals:
+ ld hl, wHPPals
+ ld a, [wSGBPals]
ld e, a
ld d, $0
add hl, de
@@ -562,146 +597,116 @@ Function9b75: ; 9b75 (2:5b75)
inc a
ld e, a
hlcoord 11, 2, wAttrmap
- ld bc, $28
- ld a, [wcca9]
-.asm_9b8d
+ ld bc, 2 * SCREEN_WIDTH
+ ld a, [wSGBPals]
+.loop
and a
- jr z, .asm_9b94
+ jr z, .done
add hl, bc
dec a
- jr .asm_9b8d
-
-.asm_9b94
+ jr .loop
+.done
lb bc, 2, 8
ld a, e
call FillBoxCGB
ret
-Function9b9c: ; 9b9c (2:5b9c)
- ld hl, Palettes_bac6
+InitPartyMenuOBPals:
+ ld hl, PartyMenuOBPals
ld de, wOBPals1
- ld bc, $10
+ ld bc, 2 palettes
call CopyBytes
ret
-Function9ba9: ; 9ba9 (2:5ba9)
+GetBattlemonBackpicPalettePointer:
push de
farcall GetPartyMonDVs
ld c, l
ld b, h
ld a, [wTempBattleMonSpecies]
- call Function9bcb
+ call GetPlayerOrMonPalettePointer
pop de
ret
-Function9bba: ; 9bba (2:5bba)
+GetEnemyFrontpicPalettePointer:
push de
farcall GetEnemyMonDVs
ld c, l
ld b, h
ld a, [wTempEnemyMonSpecies]
- call Function9bd3
+ call GetFrontpicPalettePointer
pop de
ret
-Function9bcb: ; 9bcb (2:5bcb)
+GetPlayerOrMonPalettePointer:
and a
- jp nz, Function9c66
- ld hl, TrainerPalettes
+ jp nz, GetMonNormalOrShinyPalettePointer
+ ld hl, PlayerPalette
ret
-Function9bd3: ; 9bd3 (2:5bd3)
+GetFrontpicPalettePointer:
and a
- jp nz, Function9c66
+ jp nz, GetMonNormalOrShinyPalettePointer
ld a, [wTrainerClass]
-Function9bda: ; 9bda (2:5bda)
+
+GetTrainerPalettePointer:
ld l, a
- ld h, $0
+ ld h, 0
add hl, hl
add hl, hl
ld bc, TrainerPalettes
add hl, bc
ret
-Function9be4: ; 9be4 (2:5be4)
- call Function9c5b
+GetMonPalettePointer:
+ call _GetMonPalettePointer
ret
-Function9be8:
+Unreferenced_Function9be8:
ret
-
-Function9be9:
call CheckCGB
ret z
- ld hl, Palettes_9c09
+ ld hl, BattleObjectPals
ld a, $90
ldh [rOBPI], a
- ld c, $30
-.asm_9bf6
+ ld c, 6 palettes
+.loop
ld a, [hli]
ldh [rOBPD], a
dec c
- jr nz, .asm_9bf6
- ld hl, Palettes_9c09
+ jr nz, .loop
+ ld hl, BattleObjectPals
ld de, wOBPals1 palette 2
- ld bc, $10
+ ld bc, 2 palettes
call CopyBytes
ret
-Palettes_9c09:
- RGB 31, 31, 31
- RGB 25, 25, 25
- RGB 13, 13, 13
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 31, 7
- RGB 31, 16, 1
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 19, 24
- RGB 30, 10, 6
- RGB 0, 0, 0
+BattleObjectPals:
+INCLUDE "gfx/battle_anims/battle_anims.pal"
- RGB 31, 31, 31
- RGB 12, 25, 1
- RGB 5, 14, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 8, 12, 31
- RGB 1, 4, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 18, 7
- RGB 20, 15, 3
- RGB 0, 0, 0
-
-Function9c39:
+Unreferenced_Function9c39:
call CheckCGB
ret z
ld a, $90
ldh [rOBPI], a
- ld a, $1c
- call Function9ac7
- call Function9c52
- ld a, $21
- call Function9ac7
- call Function9c52
+ ld a, PREDEFPAL_TRADE_TUBE
+ call GetPredefPal
+ call .PushPalette
+ ld a, PREDEFPAL_RB_GREENMON
+ call GetPredefPal
+ call .PushPalette
ret
-Function9c52: ; 9c52 (2:5c52)
- ld c, $8
-.asm_9c54
+.PushPalette:
+ ld c, 1 palettes
+.loop
ld a, [hli]
ldh [rOBPD], a
dec c
- jr nz, .asm_9c54
+ jr nz, .loop
ret
-Function9c5b: ; 9c5b (2:5c5b)
+_GetMonPalettePointer:
ld l, a
ld h, $0
add hl, hl
@@ -711,73 +716,73 @@ Function9c5b: ; 9c5b (2:5c5b)
add hl, bc
ret
-Function9c66: ; 9c66 (2:5c66)
+GetMonNormalOrShinyPalettePointer:
push bc
- call Function9c5b
+ call _GetMonPalettePointer
pop bc
push hl
call CheckShininess
pop hl
ret nc
+rept 4
inc hl
- inc hl
- inc hl
- inc hl
+endr
ret
-PushSGBPals_: ; 9c76 (2:5c76)
+PushSGBPals:
ld a, [wd8ba]
push af
set 7, a
ld [wd8ba], a
- call Function9c87
+ call _PushSGBPals
pop af
ld [wd8ba], a
ret
-Function9c87: ; 9c87 (2:5c87)
+_PushSGBPals:
ld a, [hl]
and $7
ret z
ld b, a
-.asm_9c8c
+.loop
push bc
xor a
ldh [rJOYP], a
ld a, $30
ldh [rJOYP], a
ld b, $10
-.asm_9c96
+.loop2
ld e, $8
ld a, [hli]
ld d, a
-.asm_9c9a
+.loop3
bit 0, d
ld a, $10
- jr nz, .asm_9ca2
+ jr nz, .okay
ld a, $20
-.asm_9ca2
+.okay
ldh [rJOYP], a
ld a, $30
ldh [rJOYP], a
rr d
dec e
- jr nz, .asm_9c9a
+ jr nz, .loop3
dec b
- jr nz, .asm_9c96
+ jr nz, .loop2
ld a, $20
ldh [rJOYP], a
ld a, $30
ldh [rJOYP], a
- call Function9ed9
+ call SGBDelayCycles
pop bc
dec b
- jr nz, .asm_9c8c
+ jr nz, .loop
ret
-InitSGBBorder: ; 9cc0 (2:5cc0)
+InitSGBBorder:
call CheckCGB
ret nz
+; SGB/DMG only
di
ld a, [wd8ba]
push af
@@ -786,1070 +791,462 @@ InitSGBBorder: ; 9cc0 (2:5cc0)
xor a
ldh [rJOYP], a
ldh [hSGB], a
- call Function9da9
- jr nc, .asm_9cf7
+ call PushSGBBorderPalsAndWait
+ jr nc, .skip
ld a, $1
ldh [hSGB], a
- call Function9d4a
- call Function9e13
- call Function9ed9
- call Function9d9e
- call Function9d8b
- call Function9ed9
- call Function9d9e
- ld hl, PalPacket_a1d5
- call Function9c87
-.asm_9cf7
+ call _InitSGBBorderPals
+ call SGBBorder_PushBGPals
+ call SGBDelayCycles
+ call SGB_ClearVRAM
+ call PushSGBBorder
+ call SGBDelayCycles
+ call SGB_ClearVRAM
+ ld hl, MaskEnCancelPacket
+ call _PushSGBPals
+
+.skip
pop af
ld [wd8ba], a
ei
ret
-InitCGBPals:: ; 9cfd (2:5cfd)
+InitCGBPals::
call CheckCGB
ret z
- ld a, $1
+; CGB only
+ ld a, BANK(vTiles3)
ldh [rVBK], a
- ld hl, $8000
- ld bc, $2000
+ ld hl, vTiles3
+ ld bc, $200 tiles
xor a
call ByteFill
- ld a, $0
+ ld a, BANK(vTiles0)
ldh [rVBK], a
- ld a, $80
+ ld a, 1 << rBGPI_AUTO_INCREMENT
ldh [rBGPI], a
- ld c, $20
-.asm_9d19
- ld a, $ff
+ ld c, 4 * 8
+.bgpals_loop
+ ld a, LOW(PALRGB_WHITE)
ldh [rBGPD], a
- ld a, $7f
+ ld a, HIGH(PALRGB_WHITE)
ldh [rBGPD], a
dec c
- jr nz, .asm_9d19
- ld a, $80
+ jr nz, .bgpals_loop
+ ld a, 1 << rOBPI_AUTO_INCREMENT
ldh [rOBPI], a
- ld c, $20
-.asm_9d2a
- ld a, $ff
+ ld c, 4 * 8
+.obpals_loop
+ ld a, LOW(PALRGB_WHITE)
ldh [rOBPD], a
- ld a, $7f
+ ld a, HIGH(PALRGB_WHITE)
ldh [rOBPD], a
dec c
- jr nz, .asm_9d2a
+ jr nz, .obpals_loop
ld hl, wBGPals1
- call Function9d3e
+ call .LoadWhitePals
ld hl, wBGPals2
-Function9d3e: ; 9d3e (2:5d3e)
- ld c, $40
-.asm_9d40
- ld a, $ff
+.LoadWhitePals:
+ ld c, 4 * 16
+.loop
+ ld a, LOW(PALRGB_WHITE)
ld [hli], a
- ld a, $7f
+ ld a, HIGH(PALRGB_WHITE)
ld [hli], a
dec c
- jr nz, .asm_9d40
+ jr nz, .loop
ret
-Function9d4a: ; 9d4a (2:5d4a)
- ld hl, .Pointers
- ld c, $9
-.asm_9d4f
+_InitSGBBorderPals:
+ ld hl, .PacketPointerTable
+ ld c, 9
+.loop
push bc
ld a, [hli]
push hl
ld h, [hl]
ld l, a
- call Function9c87
+ call _PushSGBPals
pop hl
inc hl
pop bc
dec c
- jr nz, .asm_9d4f
+ jr nz, .loop
ret
-.Pointers:
- dw PalPacket_a1c5
- dw PalPacket_a1e5
- dw PalPacket_a1f5
- dw PalPacket_a205
- dw PalPacket_a215
- dw PalPacket_a225
- dw PalPacket_a235
- dw PalPacket_a245
- dw PalPacket_a255
-
-Function9d70:
+.PacketPointerTable:
+ dw MaskEnFreezePacket
+ dw DataSndPacket1
+ dw DataSndPacket2
+ dw DataSndPacket3
+ dw DataSndPacket4
+ dw DataSndPacket5
+ dw DataSndPacket6
+ dw DataSndPacket7
+ dw DataSndPacket8
+
+Unreferenced_Function9d70:
di
xor a
ldh [rJOYP], a
- ld hl, PalPacket_a1c5
- call Function9c87
- call Function9d8b
- call Function9ed9
- call Function9d9e
- ld hl, PalPacket_a1d5
- call Function9c87
+ ld hl, MaskEnFreezePacket
+ call _PushSGBPals
+ call PushSGBBorder
+ call SGBDelayCycles
+ call SGB_ClearVRAM
+ ld hl, MaskEnCancelPacket
+ call _PushSGBPals
ei
ret
-Function9d8b: ; 9d8b (2:5d8b)
- call Function9d97
+PushSGBBorder:
+ call .LoadSGBBorderPointers
push de
- call Function9e83
+ call SGBBorder_YetMorePalPushing
pop hl
- call Function9e37
+ call SGBBorder_MorePalPushing
ret
-Function9d97: ; 9d97 (2:5d97)
+.LoadSGBBorderPointers:
ld hl, SGBBorder
ld de, SGBBorderMap
ret
-Function9d9e: ; 9d9e (2:5d9e)
- ld hl, $8000
- ld bc, $2000
+SGB_ClearVRAM:
+ ld hl, VRAM_Begin
+ ld bc, VRAM_End - VRAM_Begin
xor a
call ByteFill
ret
-Function9da9: ; 9da9 (2:5da9)
- ld hl, PalPacket_a195
- call Function9c87
- call Function9ed9
+PushSGBBorderPalsAndWait:
+ ld hl, MltReq2Packet
+ call _PushSGBPals
+ call SGBDelayCycles
ldh a, [rJOYP]
and $3
cp $3
- jr nz, .asm_9e05
+ jr nz, .carry
ld a, $20
ldh [rJOYP], a
ldh a, [rJOYP]
ldh a, [rJOYP]
- call Function9ed9
- call Function9ed9
+ call SGBDelayCycles
+ call SGBDelayCycles
ld a, $30
ldh [rJOYP], a
- call Function9ed9
- call Function9ed9
+ call SGBDelayCycles
+ call SGBDelayCycles
ld a, $10
ldh [rJOYP], a
+rept 6
ldh a, [rJOYP]
- ldh a, [rJOYP]
- ldh a, [rJOYP]
- ldh a, [rJOYP]
- ldh a, [rJOYP]
- ldh a, [rJOYP]
- call Function9ed9
- call Function9ed9
+endr
+ call SGBDelayCycles
+ call SGBDelayCycles
ld a, $30
ldh [rJOYP], a
ldh a, [rJOYP]
ldh a, [rJOYP]
ldh a, [rJOYP]
- call Function9ed9
- call Function9ed9
+ call SGBDelayCycles
+ call SGBDelayCycles
ldh a, [rJOYP]
and $3
cp $3
- jr nz, .asm_9e05
- call Function9e0a
+ jr nz, .carry
+ call .FinalPush
and a
ret
-.asm_9e05
- call Function9e0a
+.carry
+ call .FinalPush
scf
ret
-Function9e0a: ; 9e0a (2:5e0a)
- ld hl, PalPacket_a185
- call Function9c87
- jp Function9ed9
+.FinalPush:
+ ld hl, MltReq1Packet
+ call _PushSGBPals
+ jp SGBDelayCycles
-Function9e13: ; 9e13 (2:5e13)
+SGBBorder_PushBGPals:
call DisableLCD
- ld a, $e4
+ ld a, %11100100
ldh [rBGP], a
- ld hl, Palettes_a265
- ld de, $8800
- ld bc, $1000
- call Function9eb1
- call Function9ec3
- ld a, $e3
+ ld hl, PredefPals
+ ld de, vTiles1
+ ld bc, $100 tiles
+ call CopyData
+ call DrawDefaultTiles
+ ld a, LCDC_DEFAULT
ldh [rLCDC], a
- ld hl, PalPacket_a175
- call Function9c87
+ ld hl, PalTrnPacket
+ call _PushSGBPals
xor a
ldh [rBGP], a
ret
-Function9e37: ; 9e37 (2:5e37)
+SGBBorder_MorePalPushing:
call DisableLCD
ld a, $e4
ldh [rBGP], a
- ld de, $8800
- ld bc, $140
- call Function9eb1
- ld b, $12
-.asm_9e49
+ ld de, vTiles1
+ ld bc, (6 + SCREEN_WIDTH + 6) * 5 * 2
+ call CopyData
+ ld b, SCREEN_HEIGHT
+.loop
push bc
- ld bc, $c
- call Function9eb1
- ld bc, $28
- call Function9eba
- ld bc, $c
- call Function9eb1
+ ld bc, 6 * 2
+ call CopyData
+ ld bc, SCREEN_WIDTH * 2
+ call ClearBytes
+ ld bc, 6 * 2
+ call CopyData
pop bc
dec b
- jr nz, .asm_9e49
- ld bc, $140
- call Function9eb1
+ jr nz, .loop
+ ld bc, (6 + SCREEN_WIDTH + 6) * 5 * 2
+ call CopyData
ld bc, $100
- call Function9eba
- ld bc, $80
- call Function9eb1
- call Function9ec3
- ld a, $e3
+ call ClearBytes
+ ld bc, 16 palettes
+ call CopyData
+ call DrawDefaultTiles
+ ld a, LCDC_DEFAULT
ldh [rLCDC], a
- ld hl, PalPacket_a1b5
- call Function9c87
+ ld hl, PctTrnPacket
+ call _PushSGBPals
xor a
ldh [rBGP], a
ret
-Function9e83: ; 9e83 (2:5e83)
+SGBBorder_YetMorePalPushing:
call DisableLCD
- ld a, $e4
+ ld a, %11100100
ldh [rBGP], a
- ld de, $8800
+ ld de, vTiles1
ld b, $80
-.asm_9e8f
+.loop
push bc
- ld bc, $10
- call Function9eb1
- ld bc, $10
- call Function9eba
+ ld bc, 1 tiles
+ call CopyData
+ ld bc, 1 tiles
+ call ClearBytes
pop bc
dec b
- jr nz, .asm_9e8f
- call Function9ec3
- ld a, $e3
+ jr nz, .loop
+ call DrawDefaultTiles
+ ld a, LCDC_DEFAULT
ldh [rLCDC], a
- ld hl, PalPacket_a1a5
- call Function9c87
+ ld hl, ChrTrnPacket
+ call _PushSGBPals
xor a
ldh [rBGP], a
ret
-Function9eb1: ; 9eb1 (2:5eb1)
+CopyData:
+; copy bc bytes of data from hl to de
+.loop
ld a, [hli]
ld [de], a
inc de
dec bc
ld a, c
or b
- jr nz, Function9eb1
+ jr nz, .loop
ret
-Function9eba: ; 9eba (2:5eba)
+ClearBytes:
+; clear bc bytes of data starting from de
+.loop
xor a
ld [de], a
inc de
dec bc
ld a, c
or b
- jr nz, Function9eba
+ jr nz, .loop
ret
-Function9ec3: ; 9ec3 (2:5ec3)
- ld hl, $9800
- ld de, $c
- ld a, $80
- ld c, $d
-.asm_9ecd
- ld b, $14
-.asm_9ecf
+DrawDefaultTiles:
+; Draw 240 tiles (2/3 of the screen) from tiles in VRAM
+ hlbgcoord 0, 0 ; BG Map 0
+ ld de, BG_MAP_WIDTH - SCREEN_WIDTH
+ ld a, $80 ; starting tile
+ ld c, 12 + 1
+.line
+ ld b, 20
+.tile
ld [hli], a
inc a
dec b
- jr nz, .asm_9ecf
+ jr nz, .tile
+; next line
add hl, de
dec c
- jr nz, .asm_9ecd
+ jr nz, .line
ret
-Function9ed9: ; 9ed9 (2:5ed9)
+SGBDelayCycles:
ld de, 7000
-.asm_9edc
+.wait
nop
nop
nop
dec de
ld a, d
or e
- jr nz, .asm_9edc
+ jr nz, .wait
ret
-BlkPacket_9ee5: db $21, $01, $03, $00, $00, $00, $13, $11, $00, $00, $00, $00, $00, $00, $00, $00
-BlkPacket_9ef5: db $21, $01, $07, $05, $00, $0a, $13, $0d, $00, $00, $00, $00, $00, $00, $00, $00
-BlkPacket_9f05: db $22, $05, $07, $0a, $00, $0c, $13, $11, $03, $05, $01, $00, $0a, $03, $03, $00
-BlkPacket_9f15: db $0a, $08, $13, $0a, $03, $0a, $00, $04, $08, $0b, $03, $0f, $0b, $00, $13, $07
-BlkPacket_9f25: db $21, $01, $07, $05, $00, $00, $06, $06, $00, $00, $00, $00, $00, $00, $00, $00
-BlkPacket_9f35: db $21, $01, $06, $05, $0b, $01, $13, $02, $00, $00, $00, $00, $00, $00, $00, $00
-BlkPacket_9f45: db $21, $01, $07, $05, $00, $01, $07, $07, $00, $00, $00, $00, $00, $00, $00, $00
-BlkPacket_9f55: db $21, $01, $07, $05, $01, $04, $07, $0a, $00, $00, $00, $00, $00, $00, $00, $00
-BlkPacket_9f65: db $21, $01, $07, $05, $01, $01, $05, $05, $00, $00, $00, $00, $00, $00, $00, $00
-BlkPacket_9f75: db $21, $01, $07, $05, $07, $05, $0d, $0b, $00, $00, $00, $00, $00, $00, $00, $00
-BlkPacket_9f85: db $22, $05, $03, $05, $00, $00, $13, $0b, $03, $0a, $00, $04, $13, $09, $02, $0f
-BlkPacket_9f95: db $00, $06, $13, $07, $03, $00, $04, $04, $0f, $09, $03, $00, $00, $0c, $13, $11
-BlkPacket_9fa5: db $23, $07, $07, $10, $00, $00, $02, $0c, $02, $00, $0c, $01, $12, $02, $02, $00
-BlkPacket_9fb5: db $0c, $03, $12, $04, $02, $00, $0c, $05, $12, $06, $02, $00, $0c, $07, $12, $08
-BlkPacket_9fc5: db $02, $00, $0c, $09, $12, $0a, $02, $00, $0c, $0b, $12, $0c, $00, $00, $00, $00
-BlkPacket_9fd5: db $21, $02, $07, $30, $00, $00, $13, $06, $02, $04, $05, $06, $0e, $06, $00, $00
-BlkPacket_9fe5: db $21, $01, $07, $10, $00, $00, $13, $05, $00, $00, $00, $00, $00, $00, $00, $00
-BlkPacket_9ff5: db $21, $02, $07, $0a, $00, $04, $13, $0d, $03, $05, $00, $06, $13, $0b, $00, $00
-
-PalPacket_a005:
- db $51
- RGB 8, 2, 0
- RGB 9, 2, 0
- RGB 10, 2, 0
- RGB 11, 2, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a015:
- db $51
- RGB 11, 1, 0
- RGB 4, 1, 0
- RGB 0, 1, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a025:
- db $51
- RGB 1, 2, 0
- RGB 2, 2, 0
- RGB 3, 2, 0
- RGB 4, 2, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a035:
- db $51
- RGB 12, 2, 0
- RGB 12, 2, 0
- RGB 12, 2, 0
- RGB 12, 2, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a045:
- db $51
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a055:
- db $51
- RGB 22, 1, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a065:
- db $51
- RGB 23, 1, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a075:
- db $51
- RGB 24, 1, 0
- RGB 25, 1, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a085:
- db $51
- RGB 26, 1, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a095:
- db $51
- RGB 27, 1, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a0a5:
- db $51
- RGB 28, 1, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a0b5:
- db $51
- RGB 25, 1, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a0c5:
- db $51
- RGB 14, 1, 0
- RGB 15, 1, 0
- RGB 16, 1, 0
- RGB 17, 1, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a0d5:
- db $51
- RGB 26, 0, 0
- RGB 26, 0, 0
- RGB 26, 0, 0
- RGB 26, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a0e5:
- db $51
- RGB 18, 1, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a0f5:
- db $51
- RGB 28, 1, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a105:
- db $51
- RGB 29, 1, 0
- RGB 30, 1, 0
- RGB 31, 1, 0
- RGB 0, 2, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a115:
- db $51
- RGB 19, 1, 0
- RGB 20, 1, 0
- RGB 27, 0, 0
- RGB 31, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a125:
- db $51
- RGB 27, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a135:
- db $51
- RGB 28, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a145:
- db $51
- RGB 21, 1, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
- db $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a155: db $01, $ff, $7f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_a165: db $09, $ff, $7f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_a175: db $59, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_a185: db $89, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_a195: db $89, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_a1a5: db $99, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_a1b5: db $a1, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-
-PalPacket_a1c5: db $b9, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_a1d5: db $b9, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_a1e5: db $79, $5d, $08, $00, $0b, $8c, $d0, $f4, $60, $00, $00, $00, $00, $00, $00, $00
-PalPacket_a1f5: db $79, $52, $08, $00, $0b, $a9, $e7, $9f, $01, $c0, $7e, $e8, $e8, $e8, $e8, $e0
-PalPacket_a205: db $79, $47, $08, $00, $0b, $c4, $d0, $16, $a5, $cb, $c9, $05, $d0, $10, $a2, $28
-PalPacket_a215: db $79, $3c, $08, $00, $0b, $f0, $12, $a5, $c9, $c9, $c8, $d0, $1c, $a5, $ca, $c9
-PalPacket_a225: db $79, $31, $08, $00, $0b, $0c, $a5, $ca, $c9, $7e, $d0, $06, $a5, $cb, $c9, $7e
-PalPacket_a235: db $79, $26, $08, $00, $0b, $39, $cd, $48, $0c, $d0, $34, $a5, $c9, $c9, $80, $d0
-PalPacket_a245: db $79, $1b, $08, $00, $0b, $ea, $ea, $ea, $ea, $ea, $a9, $01, $cd, $4f, $0c, $d0
-PalPacket_a255: db $79, $10, $08, $00, $0b, $4c, $20, $08, $ea, $ea, $ea, $ea, $ea, $60, $ea, $ea
+INCLUDE "gfx/sgb/blk_packets.asm"
+INCLUDE "gfx/sgb/pal_packets.asm"
+INCLUDE "data/sgb_ctrl_packets.asm"
-IF DEF(_GOLD)
-Palettes_a265: INCLUDE "gfx/pals/gold_a265.pal"
-ENDC
-IF DEF(_SILVER)
-Palettes_a265: INCLUDE "gfx/pals/silver_a265.pal"
-ENDC
+PredefPals:
+INCLUDE "gfx/sgb/predef.pal"
IF DEF(_GOLD)
-SGBBorderMap: INCBIN "gfx/sgb/gold_border.sgb.tilemap"
-SGBBorderPalettes: INCLUDE "gfx/sgb/gold_border.pal"
-SGBBorder: INCBIN "gfx/sgb/gold_border.2bpp"
+SGBBorderMap:
+INCBIN "gfx/sgb/gold_border.sgb.tilemap"
+SGBBorderPalettes:
+INCLUDE "gfx/sgb/gold_border.pal"
+SGBBorder:
+INCBIN "gfx/sgb/gold_border.2bpp"
+
+ELIF DEF(_SILVER)
+SGBBorderMap:
+INCBIN "gfx/sgb/silver_border.sgb.tilemap"
+SGBBorderPalettes:
+INCLUDE "gfx/sgb/silver_border.pal"
+SGBBorder:
+INCBIN "gfx/sgb/silver_border.2bpp"
ENDC
-IF DEF(_SILVER)
-SGBBorderMap: INCBIN "gfx/sgb/silver_border.sgb.tilemap"
-SGBBorderPalettes: INCLUDE "gfx/sgb/silver_border.pal"
-SGBBorder: INCBIN "gfx/sgb/silver_border.2bpp"
-ENDC
-
-Palettes_ad2d:
- RGB 30, 26, 15
- RGB 00, 23, 00
-
- RGB 30, 26, 15
- RGB 31, 21, 00
-
- RGB 30, 26, 15
- RGB 31, 00, 00
+HPBarPals:
+INCLUDE "gfx/battle/hp_bar.pal"
-Palettes_ad39:
- RGB 30, 26, 15
- RGB 04, 17, 31
+ExpBarPalette:
+INCLUDE "gfx/battle/exp_bar.pal"
INCLUDE "data/pokemon/palettes.asm"
+
INCLUDE "data/trainers/palettes.asm"
-Functionb649: ; b649 (2:7649)
+LoadMapPals:
+ ; Which palette group is based on whether we're outside or inside
ld a, [wEnvironment]
- and $7
+ and 7
ld e, a
- ld d, $0
- ld hl, Pointers_b6ce
+ ld d, 0
+ ld hl, EnvironmentColorsPointers
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
+ ; Futher refine by time of day
ld a, [wTimeOfDayPal]
- and $3
+ maskbits NUM_DAYTIMES
add a
add a
add a
ld e, a
- ld d, $0
+ ld d, 0
add hl, de
ld e, l
ld d, h
ld hl, wBGPals1
- ld b, $8
-.asm_b66c
- ld a, [de]
+ ld b, 8
+.outer_loop
+ ld a, [de] ; lookup index for TilesetBGPalette
push de
push hl
ld l, a
- ld h, $0
+ ld h, 0
add hl, hl
add hl, hl
add hl, hl
- ld de, $775e
+ ld de, TilesetBGPalette
add hl, de
ld e, l
ld d, h
pop hl
- ld c, $8
-.asm_b67e
+ ld c, 1 palettes
+.inner_loop
ld a, [de]
inc de
ld [hli], a
dec c
- jr nz, .asm_b67e
+ jr nz, .inner_loop
pop de
inc de
dec b
- jr nz, .asm_b66c
+ jr nz, .outer_loop
ld a, [wTimeOfDayPal]
- and $3
- ld bc, $40
+ maskbits NUM_DAYTIMES
+ ld bc, 8 palettes
ld hl, MapObjectPals
call AddNTimes
ld de, wOBPals1
- ld bc, $40
+ ld bc, 8 palettes
call CopyBytes
+
ld a, [wEnvironment]
- cp $1
- jr z, .asm_b6aa
- cp $2
+ cp TOWN
+ jr z, .outside
+ cp ROUTE
ret nz
-.asm_b6aa
+.outside
ld a, [wMapGroup]
ld l, a
- ld h, $0
+ ld h, 0
add hl, hl
add hl, hl
add hl, hl
ld de, RoofPals
add hl, de
ld a, [wTimeOfDayPal]
- and $3
- cp $2
- jr c, .asm_b6c4
- inc hl
+ maskbits NUM_DAYTIMES
+ cp NITE_F
+ jr c, .morn_day
+rept 4
inc hl
- inc hl
- inc hl
-.asm_b6c4
+endr
+.morn_day
ld de, wBGPals1 palette PAL_BG_ROOF color 1
- ld bc, $4
+ ld bc, 4
call CopyBytes
ret
-Pointers_b6ce:
- dw .OutdoorColors ; unused
- dw .OutdoorColors ; TOWN
- dw .OutdoorColors ; ROUTE
- dw .IndoorColors ; INDOOR
- dw .DungeonColors ; CAVE
- dw .Perm5Colors ; ENVIRONMENT_5
- dw .IndoorColors ; GATE
- dw .DungeonColors ; DUNGEON
-
-; Valid indices: $00 - $29
-.OutdoorColors:
- db $00, $01, $02, $28, $04, $05, $06, $07 ; morn
- db $08, $09, $0a, $28, $0c, $0d, $0e, $0f ; day
- db $10, $11, $12, $29, $14, $15, $16, $17 ; nite
- db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
-
-.IndoorColors:
- db $20, $21, $22, $23, $24, $25, $26, $07 ; morn
- db $20, $21, $22, $23, $24, $25, $26, $07 ; day
- db $10, $11, $12, $13, $14, $15, $16, $07 ; nite
- db $18, $19, $1a, $1b, $1c, $1d, $1e, $07 ; dark
-
-.DungeonColors:
- db $00, $01, $02, $03, $04, $05, $06, $07 ; morn
- db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; day
- db $10, $11, $12, $13, $14, $15, $16, $17 ; nite
- db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
-
-.Perm5Colors:
- db $00, $01, $02, $03, $04, $05, $06, $07 ; morn
- db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; day
- db $10, $11, $12, $13, $14, $15, $16, $17 ; nite
- db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
-
-TilesetBGPalette: ; b75e
-INCLUDE "gfx/tilesets/bg.pal"
-
-MapObjectPals:: ; b8ae
-INCLUDE "gfx/tilesets/ob.pal"
-
-RoofPals: ; b9ae
-INCLUDE "gfx/tilesets/roof.pal"
-
-Palettes_ba86:
- RGB 27, 31, 27
- RGB 21, 21, 21
- RGB 13, 13, 13
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 07, 06
- RGB 20, 02, 03
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 10, 31, 09
- RGB 04, 14, 01
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 08, 12, 31
- RGB 01, 04, 31
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 31, 07
- RGB 31, 16, 01
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 22, 16, 08
- RGB 13, 07, 01
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 15, 31, 31
- RGB 05, 17, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 11, 11, 19
- RGB 07, 07, 12
- RGB 00, 00, 00
-
-Palettes_bac6:
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 10, 14, 20
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
+INCLUDE "data/maps/environment_colors.asm"
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
+TilesetBGPalette:
+INCLUDE "gfx/tilesets/bg_tiles.pal"
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
+MapObjectPals::
+INCLUDE "gfx/overworld/npc_sprites.pal"
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
+RoofPals:
+INCLUDE "gfx/tilesets/roofs.pal"
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 04
- RGB 00, 00, 00
+DiplomaPalettes:
+INCLUDE "gfx/diploma/diploma.pal"
- RGB 31, 31, 31
- RGB 21, 21, 21
- RGB 13, 13, 13
- RGB 07, 07, 07
+PartyMenuOBPals:
+INCLUDE "gfx/stats/party_menu_ob.pal"
- RGB 31, 31, 31
- RGB 31, 31, 07
- RGB 31, 16, 01
- RGB 07, 07, 07
+GSTitleBGPals:
+INCLUDE "gfx/title/title_bg.pal"
- RGB 31, 31, 31
- RGB 31, 19, 24
- RGB 30, 10, 06
- RGB 07, 07, 07
+GSTitleOBPals:
+INCLUDE "gfx/title/title_fg.pal"
- RGB 31, 31, 31
- RGB 12, 25, 01
- RGB 05, 14, 00
- RGB 07, 07, 07
+PokegearPals:
+INCLUDE "gfx/pokegear/pokegear.pal"
- RGB 31, 31, 31
- RGB 08, 12, 31
- RGB 01, 04, 31
- RGB 07, 07, 07
-
- RGB 31, 31, 31
- RGB 24, 18, 07
- RGB 20, 15, 03
- RGB 07, 07, 07
-
-Palettes_bb36:
-IF DEF(_GOLD)
- RGB 31, 31, 31
- RGB 18, 23, 31
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 21, 0
- RGB 12, 14, 12
- RGB 15, 20, 31
- RGB 0, 0, 17
-
- RGB 31, 31, 31
- RGB 31, 0, 0
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 29, 25, 0
- RGB 15, 20, 31
- RGB 17, 10, 1
+BetaPokerPals:
+INCLUDE "gfx/beta_poker/beta_poker.pal"
- RGB 31, 31, 31
- RGB 23, 26, 31
- RGB 18, 23, 31
- RGB 0, 0, 0
-ENDC
-
-IF DEF(_SILVER)
- RGB 31, 31, 31
- RGB 0, 12, 15
- RGB 4, 8, 21
- RGB 0, 0, 0
-
- RGB 31, 21, 0
- RGB 15, 17, 15
- RGB 4, 8, 21
- RGB 0, 0, 17
-
- RGB 31, 31, 31
- RGB 31, 0, 0
- RGB 4, 8, 21
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 23, 25
- RGB 4, 8, 21
- RGB 8, 8, 9
-
- RGB 31, 31, 31
- RGB 5, 10, 11
- RGB 0, 12, 15
- RGB 0, 0, 0
-ENDC
-
-Palettes_bb5e:
- RGB 31, 31, 31
- RGB 07, 06, 03
- RGB 07, 06, 03
- RGB 07, 06, 03
-
- RGB 31, 31, 31
- RGB 31, 31, 00
- RGB 26, 22, 00
- RGB 00, 00, 00
-
-Palettes_bb6e:
- RGB 28, 31, 20
- RGB 21, 21, 21
- RGB 13, 13, 13
- RGB 00, 00, 00
-
- RGB 28, 31, 20
- RGB 00, 31, 00
- RGB 00, 00, 31
- RGB 00, 00, 00
-
- RGB 28, 31, 20
- RGB 00, 31, 00
- RGB 15, 07, 00
- RGB 00, 00, 00
-
- RGB 28, 31, 20
- RGB 31, 15, 00
- RGB 15, 07, 00
- RGB 00, 00, 00
-
- RGB 28, 31, 20
- RGB 00, 31, 00
- RGB 00, 00, 31
- RGB 31, 00, 00
-
- RGB 28, 31, 20
- RGB 00, 31, 00
- RGB 15, 07, 00
- RGB 31, 00, 00
-
-Palettes_bb9e:
- RGB 31, 31, 31
- RGB 30, 22, 24
- RGB 18, 18, 18
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 10, 11, 31
- RGB 18, 18, 18
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 12, 31, 11
- RGB 18, 18, 18
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 29, 26, 05
- RGB 18, 18, 18
- RGB 00, 00, 00
-
-Palettes_bbbe:
-IF DEF(_GOLD)
- RGB 31, 31, 31
- RGB 24, 25, 28
- RGB 24, 24, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 10, 06
- RGB 24, 24, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 15, 31, 00
- RGB 24, 24, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 15, 31
- RGB 24, 24, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 15, 21, 31
- RGB 24, 24, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 11
- RGB 31, 31, 06
- RGB 24, 24, 09
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 16, 19, 29
- RGB 25, 22, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 21, 21, 21
- RGB 13, 13, 13
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 30, 10, 06
- RGB 31, 00, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 12, 25, 01
- RGB 05, 14, 00
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 12, 25, 01
- RGB 30, 10, 06
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 06
- RGB 20, 15, 03
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 06
- RGB 15, 21, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 06
- RGB 20, 15, 03
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 24, 21
- RGB 31, 13, 31
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 00, 00, 00
- RGB 00, 00, 00
-ENDC
-
-IF DEF(_SILVER)
- RGB 31, 31, 31
- RGB 25, 26, 14
- RGB 20, 17, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 10, 6
- RGB 20, 17, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 15, 31, 0
- RGB 20, 17, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 15, 31
- RGB 20, 17, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 15, 21, 31
- RGB 20, 17, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 11
- RGB 31, 31, 6
- RGB 20, 17, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 16, 19, 29
- RGB 25, 22, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 21, 21, 21
- RGB 13, 13, 13
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 10, 6
- RGB 31, 0, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 12, 25, 1
- RGB 5, 14, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 12, 25, 1
- RGB 30, 10, 6
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 31, 6
- RGB 20, 15, 3
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 31, 6
- RGB 15, 21, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 31, 6
- RGB 20, 15, 3
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 24, 21
- RGB 31, 13, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 0, 0, 0
- RGB 0, 0, 0
-ENDC
+SlotMachinePals:
+INCLUDE "gfx/slots/slots.pal"
diff --git a/engine/gfx/sgb_layouts.asm b/engine/gfx/sgb_layouts.asm
index b26db675..f50835fa 100755
--- a/engine/gfx/sgb_layouts.asm
+++ b/engine/gfx/sgb_layouts.asm
@@ -1,299 +1,311 @@
-LoadSGBLayout: ; 8c2d (2:4c2d)
+LoadSGBLayout:
call CheckCGB
- jp nz, Predef_LoadSGBLayoutCGB
+ jp nz, LoadSGBLayoutCGB
+
ld a, b
cp SCGB_RAM
- jr nz, .asm_8c3b
- ld a, [wColorLayoutPredefID]
-.asm_8c3b
+ jr nz, .not_ram
+ ld a, [wSGBPredef]
+.not_ram
cp SCGB_PARTY_MENU_HP_PALS
jp z, SGB_ApplyPartyMenuHPPals
ld l, a
- ld h, $0
+ ld h, 0
add hl, hl
ld de, .Jumptable
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
- ld de, FinishSGBPredefFunction
+ ld de, _LoadSGBLayout_ReturnFromJumpTable
push de
jp hl
-.Jumptable
- dw Function8c90
- dw Function8c97
- dw Function8d3f
- dw Function8d46
- dw Function8d95
- dw Function8e3c
- dw Function8e43
- dw Function8e51
- dw Function8e4a
- dw Function8e9b
- dw Function8d8e
- dw Function8eb7
- dw Function8e6e
- dw Function8f04
- dw Function8d1f
- dw Function8e81
- dw Function8e14
- dw Function8e88
- dw Function8f12
- dw Function8e7a
- dw Function8e35
- dw Function8f04
- dw Function8e0d
- dw Function8dd3
- dw Function8f0b
- dw Function8f90
- dw Function8f97
- dw Function8fc3
- dw Function8fca
- dw Function8e4a
- dw Function8f53
- dw Function8dcc
-
-Function8c90: ; 8c90 (2:4c90)
- ld hl, PalPacket_a0d5
- ld de, BlkPacket_9f05
- ret
-
-Function8c97: ; 8c97 (2:4c97)
- ld hl, BlkPacket_9f05
- call PushSGBPals_
+.Jumptable:
+ dw .SGB_BattleGrayscale
+ dw .SGB_BattleColors
+ dw .SGB_PokegearPals
+ dw .SGB_StatsScreenHPPals
+ dw .SGB_Pokedex
+ dw .SGB_SlotMachine
+ dw .SGB_BetaTitleScreen
+ dw .SGB_GSIntro
+ dw .SGB_Diploma
+ dw .SGB_MapPals
+ dw .SGB_PartyMenu
+ dw .SGB_Evolution
+ dw .SGB_GSTitleScreen
+ dw .SGB0d
+ dw .SGB_MoveList
+ dw .SGB_BetaPikachuMinigame
+ dw .SGB_PokedexSearchOption
+ dw .SGB_BetaPoker
+ dw .SGB_Pokepic
+ dw .SGB_MagnetTrain
+ dw .SGB_PackPals
+ dw .SGB_TrainerCard
+ dw .SGB_PokedexUnownMode
+ dw .SGB_BillsPC
+ dw .SGB_UnownPuzzle
+ dw .SGB_GamefreakLogo
+ dw .SGB_PlayerOrMonFrontpicPals
+ dw .SGB_TradeTube
+ dw .SGB_TrainerOrMonFrontpicPals
+ dw .SGB_MysteryGift
+ dw .SGB1e
+ dw .SGB1f
+
+.SGB_BattleGrayscale:
+ ld hl, PalPacket_BattleGrayscale
+ ld de, BlkPacket_Battle
+ ret
+
+.SGB_BattleColors:
+ ld hl, BlkPacket_Battle
+ call PushSGBPals
+
ld hl, PalPacket_a155
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
+
ld a, [wPlayerHPPal]
ld l, a
- ld h, $0
+ ld h, 0
add hl, hl
add hl, hl
- ld de, Palettes_ad2d
+ ld de, HPBarPals
add hl, de
+
ld a, [hli]
- ld [wccac], a
+ ld [wSGBPals + 3], a
ld a, [hli]
- ld [wccad], a
+ ld [wSGBPals + 4], a
ld a, [hli]
- ld [wccae], a
+ ld [wSGBPals + 5], a
ld a, [hl]
- ld [wccaf], a
+ ld [wSGBPals + 6], a
+
ld a, [wEnemyHPPal]
ld l, a
- ld h, $0
+ ld h, 0
add hl, hl
add hl, hl
- ld de, Palettes_ad2d
+
+ ld de, HPBarPals
add hl, de
ld a, [hli]
- ld [wccb2], a
+ ld [wSGBPals + 9], a
ld a, [hli]
- ld [wccb3], a
+ ld [wSGBPals + 10], a
ld a, [hli]
- ld [wccb4], a
+ ld [wSGBPals + 11], a
ld a, [hl]
- ld [wccb5], a
+ ld [wSGBPals + 12], a
+
ld hl, PalPacket_a165
- ld de, wccb9
- ld bc, $10
+ ld de, wSGBPals + PALPACKET_LENGTH
+ ld bc, PALPACKET_LENGTH
call CopyBytes
- call Function9ba9
+
+ call GetBattlemonBackpicPalettePointer
+
ld a, [hli]
- ld [wccbc], a
+ ld [wSGBPals + 19], a
ld a, [hli]
- ld [wccbd], a
+ ld [wSGBPals + 20], a
ld a, [hli]
- ld [wccbe], a
+ ld [wSGBPals + 21], a
ld a, [hl]
- ld [wccbf], a
- call Function9bba
+ ld [wSGBPals + 22], a
+ call GetEnemyFrontpicPalettePointer
ld a, [hli]
- ld [wccc2], a
+ ld [wSGBPals + 25], a
ld a, [hli]
- ld [wccc3], a
+ ld [wSGBPals + 26], a
ld a, [hli]
- ld [wccc4], a
+ ld [wSGBPals + 27], a
ld a, [hl]
- ld [wccc5], a
- ld hl, wcca9
- ld de, wccb9
- ld a, $1
- ld [wColorLayoutPredefID], a
+ ld [wSGBPals + 28], a
+
+ ld hl, wSGBPals
+ ld de, wSGBPals + PALPACKET_LENGTH
+ ld a, SCGB_BATTLE_COLORS
+ ld [wSGBPredef], a
ret
-Function8d1f: ; 8d1f (2:4d1f)
+.SGB_MoveList:
ld hl, PalPacket_a045
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
- ld hl, wccaa
+
+ ld hl, wSGBPals + 1
ld [hl], $10
inc hl
inc hl
+
ld a, [wPlayerHPPal]
- add $2f
+ add PREDEFPAL_HP_GREEN
ld [hl], a
- ld hl, wcca9
- ld de, BlkPacket_9f35
+ ld hl, wSGBPals
+ ld de, BlkPacket_MoveList
ret
-Function8d3f: ; 8d3f (2:4d3f)
- ld hl, PalPacket_a0e5
+.SGB_PokegearPals:
+ ld hl, PalPacket_Pokegear
ld de, BlkPacket_9ee5
ret
-Function8d46: ; 8d46 (2:4d46)
+.SGB_StatsScreenHPPals:
ld hl, PalPacket_a155
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
- ld a, [wcca1]
+ ld a, [wCurHPPal]
ld l, a
- ld h, $0
+ ld h, 0
add hl, hl
add hl, hl
- ld de, Palettes_ad2d
+ ld de, HPBarPals
add hl, de
ld a, [hli]
- ld [wccac], a
+ ld [wSGBPals + 3], a
ld a, [hli]
- ld [wccad], a
+ ld [wSGBPals + 4], a
ld a, [hli]
- ld [wccae], a
+ ld [wSGBPals + 5], a
ld a, [hl]
- ld [wccaf], a
+ ld [wSGBPals + 6], a
ld a, [wCurPartySpecies]
ld bc, wTempMonDVs
- call Function9bcb
+ call GetPlayerOrMonPalettePointer
ld a, [hli]
- ld [wccb2], a
+ ld [wSGBPals + 9], a
ld a, [hli]
- ld [wccb3], a
+ ld [wSGBPals + 10], a
ld a, [hli]
- ld [wccb4], a
+ ld [wSGBPals + 11], a
ld a, [hl]
- ld [wccb5], a
- ld hl, wcca9
- ld de, BlkPacket_9f25
+ ld [wSGBPals + 12], a
+ ld hl, wSGBPals
+ ld de, BlkPacket_StatsScreen
ret
-Function8d8e: ; 8d8e (2:4d8e)
- ld hl, PalPacket_a0c5
- ld de, wccaa
+.SGB_PartyMenu:
+ ld hl, PalPacket_PartyMenu
+ ld de, wSGBPals + 1
ret
-Function8d95: ; 8d95 (2:4d95)
+.SGB_Pokedex:
ld hl, PalPacket_a155
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
- ld hl, wccac
- ld [hl], $9f
+ ld hl, wSGBPals + 3
+ ld [hl], LOW(palred 31 + palgreen 20 + palblue 10)
inc hl
- ld [hl], $2a
+ ld [hl], HIGH(palred 31 + palgreen 20 + palblue 10)
inc hl
- ld [hl], $5a
+ ld [hl], LOW(palred 26 + palgreen 10 + palblue 6)
inc hl
- ld [hl], $19
+ ld [hl], HIGH(palred 26 + palgreen 10 + palblue 6)
ld a, [wCurPartySpecies]
- call Function9be4
+ call GetMonPalettePointer
ld a, [hli]
- ld [wccb2], a
+ ld [wSGBPals + 9], a
ld a, [hli]
- ld [wccb3], a
+ ld [wSGBPals + 10], a
ld a, [hli]
- ld [wccb4], a
+ ld [wSGBPals + 11], a
ld a, [hl]
- ld [wccb5], a
- ld hl, wcca9
- ld de, BlkPacket_9f45
+ ld [wSGBPals + 12], a
+ ld hl, wSGBPals
+ ld de, BlkPacket_Pokedex_PC
ret
-Function8dcc: ; 8dcc (2:4dcc)
- call Function8d95
+.SGB1f:
+ call .SGB_Pokedex
ld de, BlkPacket_9f65
ret
-Function8dd3: ; 8dd3 (2:4dd3)
+.SGB_BillsPC:
ld hl, PalPacket_a155
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
- ld hl, wccac
- ld [hl], $9f
+ ld hl, wSGBPals + 3
+ ld [hl], LOW(palred 31 + palgreen 20 + palblue 10)
inc hl
- ld [hl], $2a
+ ld [hl], HIGH(palred 31 + palgreen 20 + palblue 10)
inc hl
- ld [hl], $5a
+ ld [hl], LOW(palred 26 + palgreen 10 + palblue 6)
inc hl
- ld [hl], $19
+ ld [hl], HIGH(palred 26 + palgreen 10 + palblue 6)
ld a, [wCurPartySpecies]
ld bc, wTempMonDVs
- call Function9bcb
+ call GetPlayerOrMonPalettePointer
ld a, [hli]
- ld [wccb2], a
+ ld [wSGBPals + 9], a
ld a, [hli]
- ld [wccb3], a
+ ld [wSGBPals + 10], a
ld a, [hli]
- ld [wccb4], a
+ ld [wSGBPals + 11], a
ld a, [hl]
- ld [wccb5], a
- ld hl, wcca9
+ ld [wSGBPals + 12], a
+ ld hl, wSGBPals
ld de, BlkPacket_9f55
ret
-Function8e0d: ; 8e0d (2:4e0d)
- call Function8d95
- ld de, BlkPacket_9f75
+.SGB_PokedexUnownMode:
+ call .SGB_Pokedex
+ ld de, BlkPacket_PokedexUnownMode
ret
-Function8e14: ; 8e14 (2:4e14)
+.SGB_PokedexSearchOption:
ld hl, PalPacket_a155
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
- ld hl, wccac
- ld [hl], $9f
+ ld hl, wSGBPals + 3
+ ld [hl], LOW(palred 31 + palgreen 20 + palblue 10)
inc hl
- ld [hl], $2a
+ ld [hl], HIGH(palred 31 + palgreen 20 + palblue 10)
inc hl
- ld [hl], $5a
+ ld [hl], LOW(palred 26 + palgreen 10 + palblue 6)
inc hl
- ld [hl], $19
- ld hl, wcca9
+ ld [hl], HIGH(palred 26 + palgreen 10 + palblue 6)
+ ld hl, wSGBPals
ld de, BlkPacket_9ee5
ret
-Function8e35: ; 8e35 (2:4e35)
- ld hl, PalPacket_a0a5
+.SGB_PackPals:
+ ld hl, PalPacket_Pack
ld de, BlkPacket_9ee5
ret
-Function8e3c: ; 8e3c (2:4e3c)
- ld hl, PalPacket_a105
- ld de, BlkPacket_9f85
+.SGB_SlotMachine:
+ ld hl, PalPacket_SlotMachine
+ ld de, BlkPacket_SlotMachine
ret
-Function8e43: ; 8e43 (2:4e43)
- ld hl, PalPacket_a115
- ld de, BlkPacket_9fe5
+.SGB_BetaTitleScreen:
+ ld hl, PalPacket_BetaTitleScreen
+ ld de, BlkPacket_BetaTitleScreen
ret
-Function8e4a: ; 8e4a (2:4e4a)
- ld hl, PalPacket_a125
+.SGB_Diploma:
+.SGB_MysteryGift:
+ ld hl, PalPacket_Diploma
ld de, BlkPacket_9ee5
ret
-Function8e51: ; 8e51 (2:4e51)
- ld b, $0
- ld hl, .Table
- add hl, bc
- add hl, bc
- add hl, bc
+.SGB_GSIntro:
+ ld b, 0
+ ld hl, .BlkPacketTable_GSIntro
+rept 4
add hl, bc
+endr
ld e, [hl]
inc hl
ld d, [hl]
@@ -303,118 +315,121 @@ Function8e51: ; 8e51 (2:4e51)
ld l, a
ret
-.Table
- dw BlkPacket_9ee5, PalPacket_a055
- dw BlkPacket_9ef5, PalPacket_a075
- dw BlkPacket_9ee5, PalPacket_a085
+.BlkPacketTable_GSIntro:
+ dw BlkPacket_9ee5, PalPacket_GSIntroShellderLapras
+ dw BlkPacket_GSIntroJigglypuffPikachu, PalPacket_GSIntroJigglypuffPikachu
+ dw BlkPacket_9ee5, PalPacket_GSIntroStartersTransition
-Function8e6e: ; 8e6e (2:4e6e)
- ld hl, PalPacket_a005
- ld de, BlkPacket_9fd5
- ld a, $8
- ld [wColorLayoutPredefID], a
+.SGB_GSTitleScreen:
+ ld hl, PalPacket_GSTitleScreen
+ ld de, BlkPacket_GSTitleScreen
+ ld a, SCGB_DIPLOMA
+ ld [wSGBPredef], a
ret
-Function8e7a: ; 8e7a (2:4e7a)
- ld hl, PalPacket_a015
- ld de, BlkPacket_9ff5
+.SGB_MagnetTrain:
+ ld hl, PalPacket_MagnetTrain
+ ld de, BlkPacket_MagnetTrain
ret
-Function8e81: ; 8e81 (2:4e81)
- ld hl, PalPacket_a0b5
+.SGB_BetaPikachuMinigame:
+ ld hl, PalPacket_BetaPikachuMinigame
ld de, BlkPacket_9ee5
ret
-Function8e88: ; 8e88 (2:4e88)
+.SGB_BetaPoker:
ld hl, BlkPacket_9ee5
ld de, wc602
- ld bc, $10
+ ld bc, PALPACKET_LENGTH
call CopyBytes
- ld hl, PalPacket_a025
+ ld hl, PalPacket_BetaPoker
ld de, BlkPacket_9ee5
ret
-Function8e9b: ; 8e9b (2:4e9b)
+.SGB_MapPals:
ld hl, PalPacket_a045
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
- call Function8ff6
- ld hl, wccaa
+ call .GetMapPalsIndex
+ ld hl, wSGBPals + 1
ld [hld], a
ld de, BlkPacket_9ee5
- ld a, $9
- ld [wColorLayoutPredefID], a
+ ld a, SCGB_MAPPALS
+ ld [wSGBPredef], a
ret
-Function8eb7: ; 8eb7 (2:4eb7)
+.SGB_Evolution:
push bc
ld hl, PalPacket_a155
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
pop bc
ld a, c
and a
- jr z, .asm_8ed9
- ld hl, wccac
- ld [hl], $e7
+ jr z, .partymon
+ ; Egg
+ ld hl, wSGBPals + 3
+ ld [hl], LOW(palred 7 + palgreen 7 + palblue 7)
inc hl
- ld [hl], $1c
+ ld [hl], HIGH(palred 7 + palgreen 7 + palblue 7)
inc hl
- ld [hl], $62
+ ld [hl], LOW(palred 2 + palgreen 3 + palblue 3)
inc hl
- ld [hl], $c
- jr .asm_8efd
+ ld [hl], HIGH(palred 2 + palgreen 3 + palblue 3)
+ jr .done
-.asm_8ed9
+.partymon
ld hl, wPartyMon1DVs
- ld bc, $30
+ ld bc, PARTYMON_STRUCT_LENGTH
ld a, [wCurPartyMon]
call AddNTimes
ld c, l
ld b, h
ld a, [wPlayerHPPal]
- call Function9bcb
+ call GetPlayerOrMonPalettePointer
ld a, [hli]
- ld [wccac], a
+ ld [wSGBPals + 3], a
ld a, [hli]
- ld [wccad], a
+ ld [wSGBPals + 4], a
ld a, [hli]
- ld [wccae], a
+ ld [wSGBPals + 5], a
ld a, [hl]
- ld [wccaf], a
-.asm_8efd
- ld hl, wcca9
+ ld [wSGBPals + 6], a
+
+.done
+ ld hl, wSGBPals
ld de, BlkPacket_9ee5
ret
-Function8f04: ; 8f04 (2:4f04)
- ld hl, PalPacket_a125
+.SGB0d:
+.SGB_TrainerCard:
+ ld hl, PalPacket_Diploma
ld de, BlkPacket_9ee5
ret
-Function8f0b: ; 8f0b (2:4f0b)
- ld hl, PalPacket_a035
+.SGB_UnownPuzzle:
+ ld hl, PalPacket_UnownPuzzle
ld de, BlkPacket_9ee5
ret
-Function8f12: ; 8f12 (2:4f12)
+.SGB_Pokepic:
ld hl, PalPacket_a045
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
ld hl, BlkPacket_9ee5
- ld de, wccb9
- ld bc, $10
+ ld de, wSGBPals + PALPACKET_LENGTH
+ ld bc, PALPACKET_LENGTH
call CopyBytes
- call Function8ff6
- ld hl, wccaa
+ call .GetMapPalsIndex
+ ld hl, wSGBPals + 1
ld [hl], a
- ld hl, wccac
+ ld hl, wSGBPals + 3
ld [hl], $2e
- ld hl, wccbc
- ld a, $5
+ ld hl, wSGBPals + $13
+ ld a, 5
ld [hli], a
ld a, [wMenuBorderLeftCoord]
ld [hli], a
@@ -424,166 +439,139 @@ Function8f12: ; 8f12 (2:4f12)
ld [hli], a
ld a, [wMenuBorderBottomCoord]
ld [hl], a
- ld hl, wcca9
- ld de, wccb9
+ ld hl, wSGBPals
+ ld de, wSGBPals + PALPACKET_LENGTH
ret
-Function8f53: ; 8f53 (2:4f53)
+.SGB1e:
ld hl, PalPacket_a155
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
ld a, [wCurPartySpecies]
ld l, a
- ld h, $0
+ ld h, 0
add hl, hl
add hl, hl
add hl, hl
ld de, PokemonPalettes
add hl, de
ld a, [wce65]
- and $3
+ and 3
sla a
sla a
ld c, a
- ld b, $0
+ ld b, 0
add hl, bc
ld a, [hli]
- ld [wccac], a
+ ld [wSGBPals + 3], a
ld a, [hli]
- ld [wccad], a
+ ld [wSGBPals + 4], a
ld a, [hli]
- ld [wccae], a
+ ld [wSGBPals + 5], a
ld a, [hl]
- ld [wccaf], a
- ld hl, wcca9
+ ld [wSGBPals + 6], a
+ ld hl, wSGBPals
ld de, BlkPacket_9ee5
ret
-Function8f90: ; 8f90 (2:4f90)
- ld hl, PalPacket_a145
+.SGB_GamefreakLogo:
+ ld hl, PalPacket_GamefreakLogo
ld de, BlkPacket_9ee5
ret
-Function8f97: ; 8f97 (2:4f97)
+.SGB_PlayerOrMonFrontpicPals:
ld hl, PalPacket_a155
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
ld a, [wCurPartySpecies]
ld bc, wTempMonDVs
- call Function9bcb
+ call GetPlayerOrMonPalettePointer
ld a, [hli]
- ld [wccac], a
+ ld [wSGBPals + 3], a
ld a, [hli]
- ld [wccad], a
+ ld [wSGBPals + 4], a
ld a, [hli]
- ld [wccae], a
+ ld [wSGBPals + 5], a
ld a, [hl]
- ld [wccaf], a
- ld hl, wcca9
+ ld [wSGBPals + 6], a
+ ld hl, wSGBPals
ld de, BlkPacket_9ee5
ret
-Function8fc3: ; 8fc3 (2:4fc3)
- ld hl, PalPacket_a135
+.SGB_TradeTube:
+ ld hl, PalPacket_TradeTube
ld de, BlkPacket_9ee5
ret
-Function8fca: ; 8fca (2:4fca)
+.SGB_TrainerOrMonFrontpicPals:
ld hl, PalPacket_a155
- ld de, wcca9
- ld bc, $10
+ ld de, wSGBPals
+ ld bc, PALPACKET_LENGTH
call CopyBytes
ld a, [wCurPartySpecies]
ld bc, wTempMonDVs
- call Function9bd3
+ call GetFrontpicPalettePointer
ld a, [hli]
- ld [wccac], a
+ ld [wSGBPals + 3], a
ld a, [hli]
- ld [wccad], a
+ ld [wSGBPals + 4], a
ld a, [hli]
- ld [wccae], a
+ ld [wSGBPals + 5], a
ld a, [hl]
- ld [wccaf], a
- ld hl, wcca9
+ ld [wSGBPals + 6], a
+ ld hl, wSGBPals
ld de, BlkPacket_9ee5
ret
-Function8ff6: ; 8ff6 (2:4ff6)
+.GetMapPalsIndex:
ld a, [wTimeOfDayPal]
- cp $2
- jr c, .asm_9000
- ld a, $19
+ cp NITE_F
+ jr c, .morn_day
+ ld a, PREDEFPAL_NITE
ret
-.asm_9000
+.morn_day
ld a, [wEnvironment]
- cp $2
- jr z, .asm_9023
- cp $4
- jr z, .asm_9026
- cp $7
- jr z, .asm_9026
- cp $5
- jr z, .asm_9029
- cp $6
- jr z, .asm_902c
+ cp ROUTE
+ jr z, .route
+ cp CAVE
+ jr z, .cave
+ cp DUNGEON
+ jr z, .cave
+ cp ENVIRONMENT_5
+ jr z, .env5
+ cp GATE
+ jr z, .gate
ld a, [wMapGroup]
ld e, a
- ld d, $0
- ld hl, .SGBRoofPalInds
+ ld d, 0
+ ld hl, MapGroupRoofSGBPalInds
add hl, de
ld a, [hl]
ret
-.asm_9023
- ld a, $0
- ret
-
-.asm_9026
- ld a, $18
- ret
-
-.asm_9029
- ld a, $6
- ret
-
-.asm_902c
- ld a, $3
- ret
-
-.SGBRoofPalInds:
- db $00 ; Unused
- db $12 ; Olivine
- db $14 ; Mahogany
- db $18 ; Various Dungeons
- db $11 ; Ecruteak
- db $15 ; Blackthorn
- db $09 ; Cinnabar
- db $04 ; Cerulean
- db $0f ; Azalea
- db $16 ; Lake Of Rage
- db $0e ; Violet
- db $10 ; Goldenrod
- db $06 ; Vermilion
- db $01 ; Palette
- db $03 ; Pewter
- db $06 ; Fast Ship
- db $0b ; Indigo Plateau
- db $08 ; Fuchsia
- db $05 ; Lavender
- db $17 ; Silver Cave Outside
- db $08 ; Pokemon Center 2F
- db $07 ; Celadon
- db $13 ; Cianwood
- db $02 ; Viridian
- db $0c ; New Bark
- db $0a ; Saffron
- db $0d ; Cherrygrove
-
-FinishSGBPredefFunction: ; 904a (2:504a)
+.route
+ ld a, PREDEFPAL_ROUTES
+ ret
+
+.cave
+ ld a, PREDEFPAL_DUNGEONS
+ ret
+
+.env5
+ ld a, PREDEFPAL_VERMILION
+ ret
+
+.gate
+ ld a, PREDEFPAL_PEWTER
+ ret
+
+INCLUDE "data/maps/sgb_roof_pal_inds.asm"
+
+_LoadSGBLayout_ReturnFromJumpTable:
push de
- call PushSGBPals_
+ call PushSGBPals
pop hl
- jp PushSGBPals_
+ jp PushSGBPals
diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm
index 88241187..f23aa929 100644
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -286,7 +286,7 @@ Function11c89:
Function11cd4:
call JoyTextDelay
- ld a, [wce63]
+ ld a, [wJumptableIndex]
bit 7, a
jr nz, .asm_11cef
call Function11d27
@@ -329,7 +329,7 @@ Function11cff:
ret
Function11d27:
- ld a, [wce63]
+ ld a, [wJumptableIndex]
ld e, a
ld d, $0
ld hl, $5d36
@@ -362,7 +362,7 @@ Function11d3a:
ld hl, $e
add hl, bc
ld [hl], a
- ld hl, wce63
+ ld hl, wJumptableIndex
inc [hl]
ret
@@ -415,7 +415,7 @@ Function11d60:
.asm_11daa
call Function11fc4
- ld hl, wce63
+ ld hl, wJumptableIndex
set 7, [hl]
ret
@@ -833,7 +833,7 @@ Function1201e:
ld [wGlobalAnimYOffset], a
ldh [hSCX], a
ld [wGlobalAnimXOffset], a
- ld [wce63], a
+ ld [wJumptableIndex], a
ld [wce64], a
ldh [hBGMapMode], a
ld [wNamingScreenCurNameLength], a
@@ -959,7 +959,7 @@ Function12376:
Function1238d:
call JoyTextDelay
- ld a, [wce63]
+ ld a, [wJumptableIndex]
bit 7, a
jr nz, .asm_123a8
call Function123d5
@@ -995,7 +995,7 @@ Function123b8:
ret
Function123d5:
- ld a, [wce63]
+ ld a, [wJumptableIndex]
ld e, a
ld d, $0
ld hl, .Jumptable
@@ -1024,7 +1024,7 @@ Function123e8:
ld hl, $e
add hl, bc
ld [hl], a
- ld hl, wce63
+ ld hl, wJumptableIndex
inc [hl]
ret
@@ -1094,7 +1094,7 @@ Function12407:
.asm_1246e
call Function11fc4
- ld hl, wce63
+ ld hl, wJumptableIndex
set 7, [hl]
ret
diff --git a/engine/movie/title.asm b/engine/movie/title.asm
index d35cb703..ece0a6eb 100644
--- a/engine/movie/title.asm
+++ b/engine/movie/title.asm
@@ -13,7 +13,7 @@ TitleScreen:
ldh [hSCY], a
ldh [hSCX], a
- ld hl, $8000
+ ld hl, vTiles0
ld bc, $2000
xor a
call ByteFill
@@ -50,13 +50,13 @@ TitleScreen:
set 2, [hl]
call EnableLCD
xor a
- ld hl, wce63
+ ld hl, wJumptableIndex
ld [hli], a
ld [hli], a
ld [hli], a
ld [hl], a
ld de, $6058
- ld a, $2c ; HO-OH
+ ld a, SPRITE_ANIM_INDEX_GS_INTRO_HO_OH
call InitSpriteAnimStruct
ld hl, wSpriteAnim1
ld de, wSpriteAnim10
@@ -65,14 +65,14 @@ TitleScreen:
ld hl, wSpriteAnim1
ld [hl], $0
ld hl, wLYOverrides
- ld bc, $90
+ ld bc, wLYOverridesEnd - wLYOverrides
xor a
call ByteFill
; Let LCD Stat know we're messing around with SCX
ld a, LOW(rSCX)
ldh [hLCDCPointer], a
- ld b, $c
+ ld b, SCGB_0C
call GetSGBLayout
call Function6341
ld de, MUSIC_TITLE
diff --git a/gfx/battle/exp_bar.pal b/gfx/battle/exp_bar.pal
new file mode 100644
index 00000000..831bbda9
--- /dev/null
+++ b/gfx/battle/exp_bar.pal
@@ -0,0 +1,3 @@
+; blue
+ RGB 30, 26, 15
+ RGB 04, 17, 31
diff --git a/gfx/battle/hp_bar.pal b/gfx/battle/hp_bar.pal
new file mode 100644
index 00000000..909be8ef
--- /dev/null
+++ b/gfx/battle/hp_bar.pal
@@ -0,0 +1,9 @@
+; green
+ RGB 30, 26, 15
+ RGB 00, 23, 00
+; yellow
+ RGB 30, 26, 15
+ RGB 31, 21, 00
+; red
+ RGB 30, 26, 15
+ RGB 31, 00, 00
diff --git a/gfx/battle_anims/battle_anims.pal b/gfx/battle_anims/battle_anims.pal
new file mode 100644
index 00000000..70b31a04
--- /dev/null
+++ b/gfx/battle_anims/battle_anims.pal
@@ -0,0 +1,29 @@
+ RGB 31, 31, 31
+ RGB 25, 25, 25
+ RGB 13, 13, 13
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 31, 31, 7
+ RGB 31, 16, 1
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 31, 19, 24
+ RGB 30, 10, 6
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 12, 25, 1
+ RGB 5, 14, 0
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 8, 12, 31
+ RGB 1, 4, 31
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 24, 18, 7
+ RGB 20, 15, 3
+ RGB 0, 0, 0
diff --git a/gfx/beta_poker/beta_poker.pal b/gfx/beta_poker/beta_poker.pal
new file mode 100644
index 00000000..cce76066
--- /dev/null
+++ b/gfx/beta_poker/beta_poker.pal
@@ -0,0 +1,19 @@
+ RGB 31, 31, 31
+ RGB 30, 22, 24
+ RGB 18, 18, 18
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 10, 11, 31
+ RGB 18, 18, 18
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 12, 31, 11
+ RGB 18, 18, 18
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 29, 26, 05
+ RGB 18, 18, 18
+ RGB 00, 00, 00
diff --git a/gfx/diploma/diploma.pal b/gfx/diploma/diploma.pal
new file mode 100644
index 00000000..2c9ec645
--- /dev/null
+++ b/gfx/diploma/diploma.pal
@@ -0,0 +1,39 @@
+ RGB 27, 31, 27
+ RGB 21, 21, 21
+ RGB 13, 13, 13
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 31, 07, 06
+ RGB 20, 02, 03
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 10, 31, 09
+ RGB 04, 14, 01
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 08, 12, 31
+ RGB 01, 04, 31
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 31, 31, 07
+ RGB 31, 16, 01
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 22, 16, 08
+ RGB 13, 07, 01
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 15, 31, 31
+ RGB 05, 17, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 11, 11, 19
+ RGB 07, 07, 12
+ RGB 00, 00, 00
diff --git a/gfx/overworld/npc_sprites.pal b/gfx/overworld/npc_sprites.pal
new file mode 100644
index 00000000..b0f33479
--- /dev/null
+++ b/gfx/overworld/npc_sprites.pal
@@ -0,0 +1,39 @@
+; morn
+ RGB 28,31,16, 31,19,10, 31,07,01, 00,00,00 ; red
+ RGB 28,31,16, 31,19,10, 10,09,31, 00,00,00 ; blue
+ RGB 28,31,16, 31,19,10, 07,23,03, 00,00,00 ; green
+ RGB 28,31,16, 31,19,10, 15,10,03, 00,00,00 ; brown
+ RGB 28,31,16, 31,19,10, 30,10,06, 00,00,00 ; pink
+ RGB 31,31,31, 31,31,31, 13,13,13, 00,00,00 ; silver
+ RGB 22,31,10, 12,25,01, 05,14,00, 07,07,07 ; tree
+ RGB 28,31,16, 24,18,07, 20,15,03, 07,07,07 ; rock
+
+; day
+ RGB 27,31,27, 31,19,10, 31,07,01, 00,00,00 ; red
+ RGB 27,31,27, 31,19,10, 10,09,31, 00,00,00 ; blue
+ RGB 27,31,27, 31,19,10, 07,23,03, 00,00,00 ; green
+ RGB 27,31,27, 31,19,10, 15,10,03, 00,00,00 ; brown
+ RGB 27,31,27, 31,19,10, 30,10,06, 00,00,00 ; pink
+ RGB 31,31,31, 31,31,31, 13,13,13, 00,00,00 ; silver
+ RGB 22,31,10, 12,25,01, 05,14,00, 07,07,07 ; tree
+ RGB 27,31,27, 24,18,07, 20,15,03, 07,07,07 ; rock
+
+; nite
+ RGB 15,14,24, 31,19,10, 31,07,01, 00,00,00 ; red
+ RGB 15,14,24, 31,19,10, 10,09,31, 00,00,00 ; blue
+ RGB 15,14,24, 31,19,10, 07,23,03, 00,00,00 ; green
+ RGB 15,14,24, 31,19,10, 15,10,03, 00,00,00 ; brown
+ RGB 15,14,24, 31,19,10, 30,10,06, 00,00,00 ; pink
+ RGB 31,31,31, 31,31,31, 13,13,13, 00,00,00 ; silver
+ RGB 15,14,24, 08,13,19, 00,11,13, 00,00,00 ; tree
+ RGB 15,14,24, 12,09,15, 08,04,05, 00,00,00 ; rock
+
+; dark
+ RGB 01,01,02, 31,19,10, 31,07,01, 00,00,00 ; red
+ RGB 01,01,02, 31,19,10, 10,09,31, 00,00,00 ; blue
+ RGB 01,01,02, 31,19,10, 07,23,03, 00,00,00 ; green
+ RGB 01,01,02, 31,19,10, 15,10,03, 00,00,00 ; brown
+ RGB 01,01,02, 31,19,10, 30,10,06, 00,00,00 ; pink
+ RGB 31,31,31, 31,31,31, 13,13,13, 00,00,00 ; silver
+ RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; tree
+ RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; rock
diff --git a/gfx/pack/pack.pal b/gfx/pack/pack.pal
new file mode 100644
index 00000000..e8b4979b
--- /dev/null
+++ b/gfx/pack/pack.pal
@@ -0,0 +1,29 @@
+ RGB 31, 31, 31
+ RGB 15, 15, 31
+ RGB 00, 00, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 15, 15, 31
+ RGB 00, 00, 31
+ RGB 00, 00, 00
+
+ RGB 31, 11, 31
+ RGB 15, 15, 31
+ RGB 00, 00, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 15, 15, 31
+ RGB 00, 00, 31
+ RGB 31, 00, 00
+
+ RGB 31, 31, 31
+ RGB 15, 15, 31
+ RGB 31, 00, 00
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 07, 19, 07
+ RGB 07, 19, 07
+ RGB 00, 00, 00
diff --git a/gfx/pals/gold_a265.pal b/gfx/pals/gold_a265.pal
deleted file mode 100755
index 0d129417..00000000
--- a/gfx/pals/gold_a265.pal
+++ /dev/null
@@ -1,394 +0,0 @@
- RGB 31, 31, 31
- RGB 22, 25, 19
- RGB 16, 21, 30
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 27, 28, 31
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 28, 19
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 24, 24
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 21, 23, 31
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 21, 27
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 24, 16
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 25, 30, 26
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 25, 31
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 20, 19
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 26, 19
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 27, 28, 27
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 30, 23
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 29, 24, 29
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 23, 29
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 25, 23, 20
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 29, 26, 18
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 21, 18
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 25, 31
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 22, 21, 31
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 22, 25, 21
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 21, 21, 22
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 20, 20
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 26, 26
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 21, 14, 9
- RGB 15, 20, 20
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 12, 28, 22
- RGB 15, 20, 20
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 7, 7, 7
- RGB 2, 3, 3
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 22, 17
- RGB 16, 14, 19
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 18, 20, 27
- RGB 11, 15, 23
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 20, 10
- RGB 26, 10, 6
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 21, 25, 29
- RGB 14, 19, 25
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 27, 22, 24
- RGB 21, 15, 23
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 28, 20, 15
- RGB 21, 14, 9
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 26, 16
- RGB 9, 20, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 22, 24
- RGB 28, 15, 21
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 28, 14
- RGB 26, 20, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 21, 22
- RGB 15, 15, 18
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 23, 19, 13
- RGB 14, 12, 17
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 16, 18, 21
- RGB 10, 12, 18
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 22, 15, 16
- RGB 17, 2, 5
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 15, 20, 20
- RGB 5, 16, 16
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 23, 15, 19
- RGB 14, 4, 12
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 17, 18
- RGB 18, 13, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 23, 21, 16
- RGB 12, 12, 10
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 21, 25, 29
- RGB 30, 22, 24
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 23, 16
- RGB 29, 14, 9
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 18, 18, 18
- RGB 10, 10, 10
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 26, 15
- RGB 0, 23, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 26, 15
- RGB 31, 23, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 26, 15
- RGB 31, 0, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 29, 26, 19
- RGB 27, 20, 14
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 20, 10
- RGB 21, 0, 4
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 20, 10
- RGB 21, 0, 4
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 26, 16
- RGB 16, 12, 9
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 15, 28, 26
- RGB 12, 22, 26
- RGB 3, 16, 14
-
- RGB 31, 31, 31
- RGB 15, 28, 26
- RGB 23, 24, 24
- RGB 0, 0, 0
-
- RGB 31, 31, 24
- RGB 7, 27, 19
- RGB 26, 20, 10
- RGB 19, 12, 8
-
- RGB 31, 31, 31
- RGB 31, 28, 14
- RGB 31, 13, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 16, 18, 21
- RGB 10, 12, 18
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 23, 21, 16
- RGB 12, 12, 10
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 14, 0
- RGB 7, 11, 15
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 21, 22
- RGB 26, 10, 6
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 27, 4
- RGB 24, 20, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 13, 25
- RGB 24, 20, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 16, 19, 29
- RGB 24, 20, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 22, 24
- RGB 18, 18, 18
- RGB 16, 10, 7
-
- RGB 31, 31, 31
- RGB 21, 25, 29
- RGB 18, 18, 18
- RGB 16, 10, 7
-
- RGB 31, 31, 31
- RGB 20, 26, 16
- RGB 18, 18, 18
- RGB 16, 10, 7
-
- RGB 31, 31, 31
- RGB 31, 28, 14
- RGB 18, 18, 18
- RGB 16, 10, 7
-
- RGB 31, 31, 31
- RGB 18, 18, 18
- RGB 26, 10, 6
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 22, 24
- RGB 28, 15, 21
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 20, 0
- RGB 16, 19, 29
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 16, 2, 30
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 16, 13, 4
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 28, 4, 2
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 18, 23, 31
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 20, 11
- RGB 18, 13, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 25, 30, 0
- RGB 25, 30, 0
-
- RGB 0, 0, 0
- RGB 8, 11, 11
- RGB 21, 21, 21
- RGB 31, 31, 31
diff --git a/gfx/pals/silver_a265.pal b/gfx/pals/silver_a265.pal
deleted file mode 100644
index 791685c8..00000000
--- a/gfx/pals/silver_a265.pal
+++ /dev/null
@@ -1,394 +0,0 @@
- RGB 31, 31, 31
- RGB 22, 25, 19
- RGB 16, 21, 30
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 27, 28, 31
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 28, 19
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 24, 24
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 21, 23, 31
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 21, 27
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 24, 16
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 25, 30, 26
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 25, 31
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 20, 19
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 26, 19
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 27, 28, 27
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 30, 23
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 29, 24, 29
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 23, 29
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 25, 23, 20
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 29, 26, 18
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 21, 18
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 25, 31
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 22, 21, 31
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 22, 25, 21
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 21, 21, 22
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 20, 20
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 26, 26
- RGB 15, 20, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 21, 14, 9
- RGB 15, 20, 20
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 12, 28, 22
- RGB 15, 20, 20
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 7, 7, 7
- RGB 2, 3, 3
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 22, 17
- RGB 16, 14, 19
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 18, 20, 27
- RGB 11, 15, 23
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 20, 10
- RGB 26, 10, 6
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 21, 25, 29
- RGB 14, 19, 25
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 27, 22, 24
- RGB 21, 15, 23
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 28, 20, 15
- RGB 21, 14, 9
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 26, 16
- RGB 9, 20, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 22, 24
- RGB 28, 15, 21
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 28, 14
- RGB 26, 20, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 21, 22
- RGB 15, 15, 18
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 23, 19, 13
- RGB 14, 12, 17
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 16, 18, 21
- RGB 10, 12, 18
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 22, 15, 16
- RGB 17, 2, 5
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 15, 20, 20
- RGB 5, 16, 16
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 23, 15, 19
- RGB 14, 4, 12
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 20, 17, 18
- RGB 18, 13, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 23, 21, 16
- RGB 12, 12, 10
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 21, 25, 29
- RGB 30, 22, 24
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 23, 16
- RGB 29, 14, 9
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 18, 18, 18
- RGB 10, 10, 10
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 26, 15
- RGB 0, 23, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 26, 15
- RGB 31, 23, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 26, 15
- RGB 31, 0, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 29, 26, 19
- RGB 27, 20, 14
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 18, 17, 19
- RGB 21, 0, 4
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 20, 10
- RGB 21, 0, 4
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 26, 16
- RGB 16, 12, 9
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 15, 28, 26
- RGB 12, 22, 26
- RGB 3, 16, 14
-
- RGB 31, 31, 31
- RGB 15, 28, 26
- RGB 23, 24, 24
- RGB 0, 0, 0
-
- RGB 31, 31, 24
- RGB 7, 27, 19
- RGB 26, 20, 10
- RGB 19, 12, 8
-
- RGB 31, 31, 31
- RGB 31, 28, 14
- RGB 31, 13, 31
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 16, 18, 21
- RGB 10, 12, 18
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 23, 21, 16
- RGB 12, 12, 10
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 14, 0
- RGB 7, 11, 15
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 21, 22
- RGB 26, 10, 6
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 27, 4
- RGB 18, 17, 19
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 13, 25
- RGB 18, 17, 19
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 16, 19, 29
- RGB 18, 17, 19
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 22, 24
- RGB 18, 18, 18
- RGB 16, 10, 7
-
- RGB 31, 31, 31
- RGB 21, 25, 29
- RGB 18, 18, 18
- RGB 16, 10, 7
-
- RGB 31, 31, 31
- RGB 20, 26, 16
- RGB 18, 18, 18
- RGB 16, 10, 7
-
- RGB 31, 31, 31
- RGB 31, 28, 14
- RGB 18, 18, 18
- RGB 16, 10, 7
-
- RGB 31, 31, 31
- RGB 18, 18, 18
- RGB 26, 10, 6
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 30, 22, 24
- RGB 28, 15, 21
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 26, 20, 0
- RGB 16, 19, 29
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 16, 2, 30
- RGB 4, 8, 21
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 18, 17, 19
- RGB 4, 8, 21
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 28, 4, 2
- RGB 4, 8, 21
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 0, 12, 15
- RGB 4, 8, 21
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 24, 20, 11
- RGB 18, 13, 11
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 25, 30, 0
- RGB 25, 30, 0
-
- RGB 0, 0, 0
- RGB 8, 11, 11
- RGB 21, 21, 21
- RGB 31, 31, 31
diff --git a/gfx/pc/orange.pal b/gfx/pc/orange.pal
new file mode 100644
index 00000000..299c6b22
--- /dev/null
+++ b/gfx/pc/orange.pal
@@ -0,0 +1,4 @@
+ RGB 31, 15, 00
+ RGB 23, 12, 00
+ RGB 15, 07, 00
+ RGB 00, 00, 00
diff --git a/gfx/pokedex/cursor.pal b/gfx/pokedex/cursor.pal
new file mode 100644
index 00000000..5b202a1b
--- /dev/null
+++ b/gfx/pokedex/cursor.pal
@@ -0,0 +1,4 @@
+ RGB 00, 00, 00
+ RGB 11, 23, 00
+ RGB 07, 17, 00
+ RGB 00, 00, 00
diff --git a/gfx/pokedex/question_mark.pal b/gfx/pokedex/question_mark.pal
new file mode 100644
index 00000000..76519ba2
--- /dev/null
+++ b/gfx/pokedex/question_mark.pal
@@ -0,0 +1,4 @@
+ RGB 11, 23, 00
+ RGB 07, 17, 00
+ RGB 06, 16, 03
+ RGB 05, 12, 01
diff --git a/gfx/pokegear/pokegear.pal b/gfx/pokegear/pokegear.pal
new file mode 100644
index 00000000..75cf2cf2
--- /dev/null
+++ b/gfx/pokegear/pokegear.pal
@@ -0,0 +1,30 @@
+; border
+ RGB 28, 31, 20
+ RGB 21, 21, 21
+ RGB 13, 13, 13
+ RGB 00, 00, 00
+; earth
+ RGB 28, 31, 20
+ RGB 00, 31, 00
+ RGB 00, 00, 31
+ RGB 00, 00, 00
+; mountain
+ RGB 28, 31, 20
+ RGB 00, 31, 00
+ RGB 15, 07, 00
+ RGB 00, 00, 00
+; city (boy)
+ RGB 28, 31, 20
+ RGB 31, 15, 00
+ RGB 15, 07, 00
+ RGB 00, 00, 00
+; point of interest
+ RGB 28, 31, 20
+ RGB 00, 31, 00
+ RGB 00, 00, 31
+ RGB 31, 00, 00
+; mountain point of interest
+ RGB 28, 31, 20
+ RGB 00, 31, 00
+ RGB 15, 07, 00
+ RGB 31, 00, 00
diff --git a/gfx/sgb/blk_packets.asm b/gfx/sgb/blk_packets.asm
new file mode 100644
index 00000000..11ddb92f
--- /dev/null
+++ b/gfx/sgb/blk_packets.asm
@@ -0,0 +1,98 @@
+; macros taken from pokered's data/sgb_packets.asm
+; names taken from pandocs
+; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_Palette_Commands
+
+attr_blk: MACRO
+ db (SGB_ATTR_BLK << 3) + ((\1 * 6) / 16 + 1)
+ db \1
+ENDM
+
+attr_blk_data: MACRO
+ db \1 ; which regions are affected
+ db \2 + (\3 << 2) + (\4 << 4) ; palette for each region
+ db \5, \6, \7, \8 ; x1, y1, x2, y2
+ENDM
+
+BlkPacket_9ee5:
+ attr_blk 1
+ attr_blk_data %011, 0,0,0, 00,00, 19,17
+ ds 8
+
+BlkPacket_GSIntroJigglypuffPikachu:
+ attr_blk 1
+ attr_blk_data %111, 1,1,0, 00,10, 19,13
+ ds 8
+
+BlkPacket_Battle:
+ attr_blk 5
+ attr_blk_data %111, 2,2,0, 00,12, 19,17 ; text box: pal 2
+ attr_blk_data %011, 1,1,0, 01,00, 10,03 ; enemy HP bar: pal 1
+ attr_blk_data %011, 0,0,0, 10,08, 19,10 ; player HP+exp bar: pal 0
+ attr_blk_data %011, 2,2,0, 00,04, 08,11 ; player mon: pal 2
+ attr_blk_data %011, 3,3,0, 11,00, 19,07 ; enemy mon : pal 3
+
+BlkPacket_StatsScreen:
+ attr_blk 1
+ attr_blk_data %111, 1,1,0, 00,00, 06,06 ; mon: pal 1
+ ds 8
+
+BlkPacket_MoveList:
+ attr_blk 1
+ attr_blk_data %110, 1,1,0, 11,01, 19,02
+ ds 8
+
+BlkPacket_Pokedex_PC:
+ attr_blk 1
+ attr_blk_data %111, 1,1,0, 00,01, 07,07 ; mon: pal 1
+ ds 8
+
+BlkPacket_9f55:
+ attr_blk 1
+ attr_blk_data %111, 1,1,0, 01,04, 07,10
+ ds 8
+
+BlkPacket_9f65:
+ attr_blk 1
+ attr_blk_data %111, 1,1,0, 01,01, 05,05
+ ds 8
+
+BlkPacket_PokedexUnownMode:
+ attr_blk 1
+ attr_blk_data %111, 1,1,0, 07,05, 13,11 ; unown: pal 1
+ ds 8
+
+BlkPacket_SlotMachine:
+ attr_blk 5
+ attr_blk_data %011, 1,1,0, 00,00, 19,11 ; "3" rows and top of screen: pal 1
+ attr_blk_data %011, 2,2,0, 00,04, 19,09 ; "2" rows: pal 2
+ attr_blk_data %010, 3,3,0, 00,06, 19,07 ; "1" row: pal 3
+ attr_blk_data %011, 0,0,0, 04,04, 15,09 ; slot reels: pal 0
+ attr_blk_data %011, 0,0,0, 00,12, 19,17 ; text box: pal 0
+
+BlkPacket_9fa5:
+ attr_blk 7
+ attr_blk_data %111, 0,0,1, 00,00, 02,12
+ attr_blk_data %010, 0,0,0, 12,01, 18,02
+ attr_blk_data %010, 0,0,0, 12,03, 18,04
+ attr_blk_data %010, 0,0,0, 12,05, 18,06
+ attr_blk_data %010, 0,0,0, 12,07, 18,08
+ attr_blk_data %010, 0,0,0, 12,09, 18,10
+ attr_blk_data %010, 0,0,0, 12,11, 18,12
+ ds 4
+
+BlkPacket_GSTitleScreen:
+ attr_blk 2
+ attr_blk_data %111, 0,0,3, 00,00, 19,06
+ attr_blk_data %010, 0,1,0, 05,06, 14,06
+ ds 2
+
+BlkPacket_BetaTitleScreen:
+ attr_blk 1
+ attr_blk_data %111, 0,0,1, 00,00, 19,05 ; logo
+ ds 8
+
+BlkPacket_MagnetTrain:
+ attr_blk 2
+ attr_blk_data %111, 2,2,0, 00,04, 19,13 ; fence
+ attr_blk_data %011, 1,1,0, 00,06, 19,11 ; train
+ ds 2
diff --git a/gfx/sgb/pal_packets.asm b/gfx/sgb/pal_packets.asm
new file mode 100644
index 00000000..570abe5f
--- /dev/null
+++ b/gfx/sgb/pal_packets.asm
@@ -0,0 +1,96 @@
+; macros taken from pokered's data/sgb_packets.asm
+; names taken from pandocs
+; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_Palette_Commands
+
+sgb_pal_set: MACRO
+ db (SGB_PAL_SET << 3) + 1
+ dw PREDEFPAL_\1, PREDEFPAL_\2, PREDEFPAL_\3, PREDEFPAL_\4
+ ds 7
+ENDM
+
+sgb_pal01: MACRO
+ db (SGB_PAL01 << 3) + 1
+ENDM
+
+sgb_pal23: MACRO
+ db (SGB_PAL23 << 3) + 1
+ENDM
+
+PalPacket_GSTitleScreen:
+ sgb_pal_set GS_TITLE_SCREEN_0, GS_TITLE_SCREEN_1, GS_TITLE_SCREEN_2, GS_TITLE_SCREEN_3
+
+PalPacket_MagnetTrain:
+ sgb_pal_set BETA_SHINY_GREENMON, CGB_BADGE, RB_BROWNMON, ROUTES
+
+PalPacket_BetaPoker:
+ sgb_pal_set BETA_POKER_0, BETA_POKER_1, BETA_POKER_2, BETA_POKER_3
+
+PalPacket_UnownPuzzle:
+ sgb_pal_set UNOWN_PUZZLE, UNOWN_PUZZLE, UNOWN_PUZZLE, UNOWN_PUZZLE
+
+PalPacket_a045:
+ sgb_pal_set ROUTES, ROUTES, ROUTES, ROUTES
+
+PalPacket_GSIntroShellderLapras:
+ sgb_pal_set GS_INTRO_SHELLDER_LAPRAS, ROUTES, ROUTES, ROUTES
+
+UnreferencedPalPacket_BetaIntroLapras:
+ sgb_pal_set BETA_INTRO_LAPRAS, ROUTES, ROUTES, ROUTES
+
+PalPacket_GSIntroJigglypuffPikachu:
+ sgb_pal_set GS_INTRO_JIGGLYPUFF_PIKACHU_BG, GS_INTRO_JIGGLYPUFF_PIKACHU_OB, ROUTES, ROUTES
+
+PalPacket_GSIntroStartersTransition:
+ sgb_pal_set GS_INTRO_STARTERS_TRANSITION, ROUTES, ROUTES, ROUTES
+
+PalPacket_BetaIntroVenusaur:
+ sgb_pal_set BETA_INTRO_VENUSAUR, ROUTES, ROUTES, ROUTES
+
+PalPacket_Pack:
+ sgb_pal_set PACK, ROUTES, ROUTES, ROUTES
+
+PalPacket_BetaPikachuMinigame:
+ sgb_pal_set GS_INTRO_JIGGLYPUFF_PIKACHU_OB, ROUTES, ROUTES, ROUTES
+
+PalPacket_PartyMenu:
+ sgb_pal_set PARTY_ICON, HP_GREEN, HP_YELLOW, HP_RED
+
+PalPacket_BattleGrayscale:
+ sgb_pal_set BLACKOUT, BLACKOUT, BLACKOUT, BLACKOUT
+
+PalPacket_Pokegear:
+ sgb_pal_set POKEGEAR, ROUTES, ROUTES, ROUTES
+
+UnreferencedPalPacket_9c86:
+ sgb_pal_set PACK, ROUTES, ROUTES, ROUTES
+
+PalPacket_SlotMachine:
+ sgb_pal_set SLOT_MACHINE_0, SLOT_MACHINE_1, SLOT_MACHINE_2, SLOT_MACHINE_3
+
+PalPacket_BetaTitleScreen:
+ sgb_pal_set BETA_LOGO_1, BETA_LOGO_2, DIPLOMA, RB_PURPLEMON
+
+PalPacket_Diploma:
+ sgb_pal_set DIPLOMA, ROUTES, ROUTES, ROUTES
+
+PalPacket_TradeTube:
+ sgb_pal_set TRADE_TUBE, ROUTES, ROUTES, ROUTES
+
+PalPacket_GamefreakLogo:
+ sgb_pal_set GS_INTRO_GAMEFREAK_LOGO, ROUTES, ROUTES, ROUTES
+
+PalPacket_a155:
+ sgb_pal01
+ RGB 31, 31, 31
+rept 6
+ RGB 00, 00, 00
+endr
+ ds 1
+
+PalPacket_a165:
+ sgb_pal23
+ RGB 31, 31, 31
+rept 6
+ RGB 00, 00, 00
+endr
+ ds 1
diff --git a/gfx/sgb/predef.pal b/gfx/sgb/predef.pal
new file mode 100644
index 00000000..720f62af
--- /dev/null
+++ b/gfx/sgb/predef.pal
@@ -0,0 +1,96 @@
+ RGB 31,31,31, 22,25,19, 16,21,30, 00,00,00 ; PREDEFPAL_00
+ RGB 31,31,31, 27,28,31, 15,20,31, 00,00,00 ; PREDEFPAL_PALLET
+ RGB 31,31,31, 24,28,19, 15,20,31, 00,00,00 ; PREDEFPAL_VIRIDIAN
+ RGB 31,31,31, 24,24,24, 15,20,31, 00,00,00 ; PREDEFPAL_PEWTER
+ RGB 31,31,31, 21,23,31, 15,20,31, 00,00,00 ; PREDEFPAL_CERULEAN
+ RGB 31,31,31, 24,21,27, 15,20,31, 00,00,00 ; PREDEFPAL_LAVENDER
+ RGB 31,31,31, 31,24,16, 15,20,31, 00,00,00 ; PREDEFPAL_VERMILION
+ RGB 31,31,31, 25,30,26, 15,20,31, 00,00,00 ; PREDEFPAL_CELADON
+ RGB 31,31,31, 31,25,31, 15,20,31, 00,00,00 ; PREDEFPAL_FUCHSIA
+ RGB 31,31,31, 31,20,19, 15,20,31, 00,00,00 ; PREDEFPAL_CINNABAR
+ RGB 31,31,31, 31,26,19, 15,20,31, 00,00,00 ; PREDEFPAL_SAFFRON
+ RGB 31,31,31, 27,28,27, 15,20,31, 00,00,00 ; PREDEFPAL_INDIGO
+ RGB 31,31,31, 24,30,23, 15,20,31, 00,00,00 ; PREDEFPAL_NEW_BARK
+ RGB 31,31,31, 29,24,29, 15,20,31, 00,00,00 ; PREDEFPAL_CHERRYGROVE
+ RGB 31,31,31, 26,23,29, 15,20,31, 00,00,00 ; PREDEFPAL_VIOLET
+ RGB 31,31,31, 25,23,20, 15,20,31, 00,00,00 ; PREDEFPAL_AZALEA
+ RGB 31,31,31, 29,26,18, 15,20,31, 00,00,00 ; PREDEFPAL_GOLDENROD
+ RGB 31,31,31, 31,21,18, 15,20,31, 00,00,00 ; PREDEFPAL_ECRUTEAK
+ RGB 31,31,31, 26,25,31, 15,20,31, 00,00,00 ; PREDEFPAL_OLIVINE
+ RGB 31,31,31, 22,21,31, 15,20,31, 00,00,00 ; PREDEFPAL_CIANWOOD
+ RGB 31,31,31, 22,25,21, 15,20,31, 00,00,00 ; PREDEFPAL_MAHOGANY
+ RGB 31,31,31, 21,21,22, 15,20,31, 00,00,00 ; PREDEFPAL_BLACKTHORN
+ RGB 31,31,31, 31,20,20, 15,20,31, 00,00,00 ; PREDEFPAL_LAKE_OF_RAGE
+ RGB 31,31,31, 26,26,26, 15,20,31, 00,00,00 ; PREDEFPAL_SILVER_CAVE
+ RGB 31,31,31, 21,14,09, 15,20,20, 00,00,00 ; PREDEFPAL_DUNGEONS
+ RGB 31,31,31, 12,28,22, 15,20,20, 00,00,00 ; PREDEFPAL_NITE
+ RGB 31,31,31, 07,07,07, 02,03,03, 00,00,00 ; PREDEFPAL_BLACKOUT
+ RGB 31,31,31, 30,22,17, 16,14,19, 00,00,00 ; PREDEFPAL_DIPLOMA
+ RGB 31,31,31, 18,20,27, 11,15,23, 00,00,00 ; PREDEFPAL_TRADE_TUBE
+ RGB 31,31,31, 31,20,10, 26,10,06, 00,00,00 ; PREDEFPAL_POKEDEX
+ RGB 31,31,31, 21,25,29, 14,19,25, 00,00,00 ; PREDEFPAL_RB_CYANMON
+ RGB 31,31,31, 27,22,24, 21,15,23, 00,00,00 ; PREDEFPAL_RB_PURPLEMON
+ RGB 31,31,31, 28,20,15, 21,14,09, 00,00,00 ; PREDEFPAL_RB_BROWNMON
+ RGB 31,31,31, 20,26,16, 09,20,11, 00,00,00 ; PREDEFPAL_RB_GREENMON
+ RGB 31,31,31, 30,22,24, 28,15,21, 00,00,00 ; PREDEFPAL_RB_PINKMON
+ RGB 31,31,31, 31,28,14, 26,20,00, 00,00,00 ; PREDEFPAL_RB_YELLOWMON
+ RGB 31,31,31, 26,21,22, 15,15,18, 00,00,00 ; PREDEFPAL_CGB_BADGE
+ RGB 31,31,31, 23,19,13, 14,12,17, 00,00,00 ; PREDEFPAL_SHINY_MEWMON
+ RGB 31,31,31, 16,18,21, 10,12,18, 00,00,00 ; PREDEFPAL_SHINY_BLUEMON
+ RGB 31,31,31, 22,15,16, 17,02,05, 00,00,00 ; PREDEFPAL_SHINY_REDMON
+ RGB 31,31,31, 15,20,20, 05,16,16, 00,00,00 ; PREDEFPAL_SHINY_CYANMON
+ RGB 31,31,31, 23,15,19, 14,04,12, 00,00,00 ; PREDEFPAL_SHINY_PURPLEMON
+ RGB 31,31,31, 20,17,18, 18,13,11, 00,00,00 ; PREDEFPAL_SHINY_BROWNMON
+ RGB 31,31,31, 23,21,16, 12,12,10, 00,00,00 ; PREDEFPAL_SHINY_GREENMON
+ RGB 31,31,31, 21,25,29, 30,22,24, 00,00,00 ; PREDEFPAL_SHINY_PINKMON
+ RGB 31,31,31, 26,23,16, 29,14,09, 00,00,00 ; PREDEFPAL_SHINY_YELLOWMON
+ RGB 31,31,31, 18,18,18, 10,10,10, 00,00,00 ; PREDEFPAL_PARTY_ICON
+ RGB 31,31,31, 30,26,15, 00,23,00, 00,00,00 ; PREDEFPAL_HP_GREEN
+ RGB 31,31,31, 30,26,15, 31,23,00, 00,00,00 ; PREDEFPAL_HP_YELLOW
+ RGB 31,31,31, 30,26,15, 31,00,00, 00,00,00 ; PREDEFPAL_HP_RED
+ RGB 31,31,31, 29,26,19, 27,20,14, 00,00,00 ; PREDEFPAL_POKEGEAR
+IF DEF(_GOLD)
+ RGB 31,31,31, 24,20,10, 21,00,04, 00,00,00 ; PREDEFPAL_BETA_LOGO_1
+ELIF DEF(_SILVER)
+ RGB 31,31,31, 18,17,19, 21,00,04, 00,00,00 ; PREDEFPAL_BETA_LOGO_1
+ENDC
+ RGB 31,31,31, 31,20,10, 21,00,04, 00,00,00 ; PREDEFPAL_BETA_LOGO_2
+ RGB 31,31,31, 30,26,16, 16,12,09, 00,00,00 ; PREDEFPAL_GS_INTRO_GAMEFREAK_LOGO
+ RGB 31,31,31, 15,28,26, 12,22,26, 03,16,14 ; PREDEFPAL_GS_INTRO_SHELLDER_LAPRAS
+ RGB 31,31,31, 15,28,26, 23,24,24, 00,00,00 ; PREDEFPAL_BETA_INTRO_LAPRAS
+ RGB 31,31,24, 07,27,19, 26,20,10, 19,12,08 ; PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_BG
+ RGB 31,31,31, 31,28,14, 31,13,31, 00,00,00 ; PREDEFPAL_GS_INTRO_JIGGLYPUFF_PIKACHU_OB
+ RGB 31,31,31, 16,18,21, 10,12,18, 00,00,00 ; PREDEFPAL_GS_INTRO_STARTERS_TRANSITION
+ RGB 31,31,31, 23,21,16, 12,12,10, 00,00,00 ; PREDEFPAL_BETA_INTRO_VENUSAUR
+ RGB 31,31,31, 31,14,00, 07,11,15, 00,00,00 ; PREDEFPAL_PACK
+ RGB 31,31,31, 26,21,22, 26,10,06, 00,00,00 ; PREDEFPAL_SLOT_MACHINE_0
+IF DEF(_GOLD)
+ RGB 31,31,31, 30,27,04, 24,20,11, 00,00,00 ; PREDEFPAL_SLOT_MACHINE_1
+ RGB 31,31,31, 31,13,25, 24,20,11, 00,00,00 ; PREDEFPAL_SLOT_MACHINE_2
+ RGB 31,31,31, 16,19,29, 24,20,11, 00,00,00 ; PREDEFPAL_SLOT_MACHINE_3
+ELIF DEF(_SILVER)
+ RGB 31,31,31, 30,27,04, 18,17,19, 00,00,00 ; PREDEFPAL_SLOT_MACHINE_1
+ RGB 31,31,31, 31,13,25, 18,17,19, 00,00,00 ; PREDEFPAL_SLOT_MACHINE_2
+ RGB 31,31,31, 16,19,29, 18,17,19, 00,00,00 ; PREDEFPAL_SLOT_MACHINE_3
+ENDC
+ RGB 31,31,31, 30,22,24, 18,18,18, 16,10,07 ; PREDEFPAL_BETA_POKER_0
+ RGB 31,31,31, 21,25,29, 18,18,18, 16,10,07 ; PREDEFPAL_BETA_POKER_1
+ RGB 31,31,31, 20,26,16, 18,18,18, 16,10,07 ; PREDEFPAL_BETA_POKER_2
+ RGB 31,31,31, 31,28,14, 18,18,18, 16,10,07 ; PREDEFPAL_BETA_POKER_3
+ RGB 31,31,31, 18,18,18, 26,10,06, 00,00,00 ; PREDEFPAL_BETA_RADIO
+ RGB 31,31,31, 30,22,24, 28,15,21, 00,00,00 ; PREDEFPAL_BETA_POKEGEAR
+ RGB 31,31,31, 26,20,00, 16,19,29, 00,00,00 ; PREDEFPAL_47
+IF DEF(_GOLD)
+ RGB 31,31,31, 16,02,30, 15,20,31, 00,00,00 ; PREDEFPAL_GS_TITLE_SCREEN_0
+ RGB 31,31,31, 16,13,04, 15,20,31, 00,00,00 ; PREDEFPAL_GS_TITLE_SCREEN_1
+ RGB 31,31,31, 28,04,02, 15,20,31, 00,00,00 ; PREDEFPAL_GS_TITLE_SCREEN_2
+ RGB 31,31,31, 18,23,31, 15,20,31, 00,00,00 ; PREDEFPAL_GS_TITLE_SCREEN_3
+ELIF DEF(_SILVER)
+ RGB 31,31,31, 16,02,30, 04,08,21, 00,00,00 ; PREDEFPAL_GS_TITLE_SCREEN_0
+ RGB 31,31,31, 18,17,19, 04,08,21, 00,00,00 ; PREDEFPAL_GS_TITLE_SCREEN_1
+ RGB 31,31,31, 28,04,02, 04,08,21, 00,00,00 ; PREDEFPAL_GS_TITLE_SCREEN_2
+ RGB 31,31,31, 00,12,15, 04,08,21, 00,00,00 ; PREDEFPAL_GS_TITLE_SCREEN_3
+ENDC
+ RGB 31,31,31, 24,20,11, 18,13,11, 00,00,00 ; PREDEFPAL_UNOWN_PUZZLE
+ RGB 31,31,31, 31,31,31, 25,30,00, 25,30,00 ; PREDEFPAL_GAMEFREAK_LOGO_OB
+ RGB 00,00,00, 08,11,11, 21,21,21, 31,31,31 ; PREDEFPAL_GAMEFREAK_LOGO_BG
diff --git a/gfx/slots/slots.pal b/gfx/slots/slots.pal
new file mode 100644
index 00000000..0121d294
--- /dev/null
+++ b/gfx/slots/slots.pal
@@ -0,0 +1,162 @@
+IF DEF(_GOLD)
+ RGB 31, 31, 31
+ RGB 24, 25, 28
+ RGB 24, 24, 09
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 30, 10, 06
+ RGB 24, 24, 09
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 15, 31, 00
+ RGB 24, 24, 09
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 15, 31
+ RGB 24, 24, 09
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 15, 21, 31
+ RGB 24, 24, 09
+ RGB 00, 00, 00
+
+ RGB 31, 31, 11
+ RGB 31, 31, 06
+ RGB 24, 24, 09
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 16, 19, 29
+ RGB 25, 22, 00
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 21, 21, 21
+ RGB 13, 13, 13
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 30, 10, 06
+ RGB 31, 00, 00
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 12, 25, 01
+ RGB 05, 14, 00
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 12, 25, 01
+ RGB 30, 10, 06
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 06
+ RGB 20, 15, 03
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 06
+ RGB 15, 21, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 06
+ RGB 20, 15, 03
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 24, 21
+ RGB 31, 13, 31
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 00, 00, 00
+ RGB 00, 00, 00
+
+ELIF DEF(_SILVER)
+ RGB 31, 31, 31
+ RGB 25, 26, 14
+ RGB 20, 17, 31
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 30, 10, 6
+ RGB 20, 17, 31
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 15, 31, 0
+ RGB 20, 17, 31
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 31, 15, 31
+ RGB 20, 17, 31
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 15, 21, 31
+ RGB 20, 17, 31
+ RGB 0, 0, 0
+
+ RGB 31, 31, 11
+ RGB 31, 31, 6
+ RGB 20, 17, 31
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 16, 19, 29
+ RGB 25, 22, 0
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 21, 21, 21
+ RGB 13, 13, 13
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 30, 10, 6
+ RGB 31, 0, 0
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 12, 25, 1
+ RGB 5, 14, 0
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 12, 25, 1
+ RGB 30, 10, 6
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 31, 31, 6
+ RGB 20, 15, 3
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 31, 31, 6
+ RGB 15, 21, 31
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 31, 31, 6
+ RGB 20, 15, 3
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 31, 24, 21
+ RGB 31, 13, 31
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 31, 31, 31
+ RGB 0, 0, 0
+ RGB 0, 0, 0
+ENDC
diff --git a/gfx/stats/pages.pal b/gfx/stats/pages.pal
new file mode 100644
index 00000000..837e10cb
--- /dev/null
+++ b/gfx/stats/pages.pal
@@ -0,0 +1,15 @@
+; pink
+ RGB 31, 31, 31
+ RGB 31, 19, 31
+ RGB 31, 15, 31
+ RGB 00, 00, 00
+; green
+ RGB 31, 31, 31
+ RGB 21, 31, 14
+ RGB 17, 31, 00
+ RGB 00, 00, 00
+; blue
+ RGB 31, 31, 31
+ RGB 17, 31, 31
+ RGB 17, 31, 31
+ RGB 00, 00, 00
diff --git a/gfx/stats/party_menu_ob.pal b/gfx/stats/party_menu_ob.pal
new file mode 100644
index 00000000..70af517b
--- /dev/null
+++ b/gfx/stats/party_menu_ob.pal
@@ -0,0 +1,69 @@
+ RGB 27, 31, 27
+ RGB 31, 19, 10
+ RGB 31, 07, 04
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 31, 19, 10
+ RGB 10, 14, 20
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 31, 19, 10
+ RGB 31, 07, 04
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 31, 19, 10
+ RGB 31, 07, 04
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 31, 19, 10
+ RGB 31, 07, 04
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 31, 19, 10
+ RGB 31, 07, 04
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 31, 19, 10
+ RGB 31, 07, 04
+ RGB 00, 00, 00
+
+ RGB 27, 31, 27
+ RGB 31, 19, 10
+ RGB 31, 07, 04
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 21, 21, 21
+ RGB 13, 13, 13
+ RGB 07, 07, 07
+
+ RGB 31, 31, 31
+ RGB 31, 31, 07
+ RGB 31, 16, 01
+ RGB 07, 07, 07
+
+ RGB 31, 31, 31
+ RGB 31, 19, 24
+ RGB 30, 10, 06
+ RGB 07, 07, 07
+
+ RGB 31, 31, 31
+ RGB 12, 25, 01
+ RGB 05, 14, 00
+ RGB 07, 07, 07
+
+ RGB 31, 31, 31
+ RGB 08, 12, 31
+ RGB 01, 04, 31
+ RGB 07, 07, 07
+
+ RGB 31, 31, 31
+ RGB 24, 18, 07
+ RGB 20, 15, 03
+ RGB 07, 07, 07
diff --git a/gfx/stats/stats.pal b/gfx/stats/stats.pal
new file mode 100644
index 00000000..5b12e02b
--- /dev/null
+++ b/gfx/stats/stats.pal
@@ -0,0 +1,6 @@
+; pink
+ RGB 31, 19, 31
+; green
+ RGB 21, 31, 14
+; blue
+ RGB 17, 31, 31
diff --git a/gfx/tilesets/bg.pal b/gfx/tilesets/bg.pal
deleted file mode 100644
index 0b088472..00000000
--- a/gfx/tilesets/bg.pal
+++ /dev/null
@@ -1,209 +0,0 @@
- RGB 28, 31, 16
- RGB 21, 21, 21
- RGB 13, 13, 13
- RGB 7, 7, 7
-
- RGB 28, 31, 16
- RGB 31, 19, 24
- RGB 30, 10, 6
- RGB 7, 7, 7
-
- RGB 22, 31, 10
- RGB 12, 25, 1
- RGB 5, 14, 0
- RGB 7, 7, 7
-
- RGB 31, 31, 31
- RGB 8, 12, 31
- RGB 1, 4, 31
- RGB 7, 7, 7
-
- RGB 28, 31, 16
- RGB 31, 31, 7
- RGB 31, 16, 1
- RGB 7, 7, 7
-
- RGB 28, 31, 16
- RGB 24, 18, 7
- RGB 20, 15, 3
- RGB 7, 7, 7
-
- RGB 28, 31, 16
- RGB 15, 31, 31
- RGB 5, 17, 31
- RGB 7, 7, 7
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 0, 0, 0
-
- RGB 27, 31, 27
- RGB 21, 21, 21
- RGB 13, 13, 13
- RGB 7, 7, 7
-
- RGB 27, 31, 27
- RGB 31, 19, 24
- RGB 30, 10, 6
- RGB 7, 7, 7
-
- RGB 22, 31, 10
- RGB 12, 25, 1
- RGB 5, 14, 0
- RGB 7, 7, 7
-
- RGB 31, 31, 31
- RGB 8, 12, 31
- RGB 1, 4, 31
- RGB 7, 7, 7
-
- RGB 27, 31, 27
- RGB 31, 31, 7
- RGB 31, 16, 1
- RGB 7, 7, 7
-
- RGB 27, 31, 27
- RGB 24, 18, 7
- RGB 20, 15, 3
- RGB 7, 7, 7
-
- RGB 27, 31, 27
- RGB 15, 31, 31
- RGB 5, 17, 31
- RGB 7, 7, 7
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 0, 0, 0
-
- RGB 15, 14, 24
- RGB 11, 11, 19
- RGB 7, 7, 12
- RGB 0, 0, 0
-
- RGB 15, 14, 24
- RGB 14, 7, 17
- RGB 13, 0, 8
- RGB 0, 0, 0
-
- RGB 15, 14, 24
- RGB 8, 13, 19
- RGB 0, 11, 13
- RGB 0, 0, 0
-
- RGB 15, 14, 24
- RGB 5, 5, 17
- RGB 3, 3, 10
- RGB 0, 0, 0
-
- RGB 30, 30, 11
- RGB 16, 14, 18
- RGB 16, 14, 10
- RGB 0, 0, 0
-
- RGB 15, 14, 24
- RGB 12, 9, 15
- RGB 8, 4, 5
- RGB 0, 0, 0
-
- RGB 15, 14, 24
- RGB 13, 12, 23
- RGB 11, 9, 20
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 0, 0, 0
-
- RGB 1, 1, 2
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 1, 1, 2
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 1, 1, 2
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 1, 1, 2
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 30, 30, 11
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 1, 1, 2
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 1, 1, 2
- RGB 0, 0, 0
- RGB 0, 0, 0
- RGB 0, 0, 0
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 0, 0, 0
-
- RGB 30, 28, 26
- RGB 19, 19, 19
- RGB 13, 13, 13
- RGB 7, 7, 7
-
- RGB 30, 28, 26
- RGB 31, 19, 24
- RGB 30, 10, 6
- RGB 7, 7, 7
-
- RGB 18, 24, 9
- RGB 15, 20, 1
- RGB 9, 13, 0
- RGB 7, 7, 7
-
- RGB 30, 28, 26
- RGB 15, 16, 31
- RGB 9, 9, 31
- RGB 7, 7, 7
-
- RGB 30, 28, 26
- RGB 31, 31, 7
- RGB 31, 16, 1
- RGB 7, 7, 7
-
- RGB 26, 24, 17
- RGB 21, 17, 7
- RGB 16, 13, 3
- RGB 7, 7, 7
-
- RGB 30, 28, 26
- RGB 17, 19, 31
- RGB 14, 16, 31
- RGB 7, 7, 7
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 0, 0, 0
-
- RGB 23, 23, 31
- RGB 18, 19, 31
- RGB 13, 12, 31
- RGB 7, 7, 7
-
- RGB 15, 13, 27
- RGB 10, 9, 20
- RGB 4, 3, 18
- RGB 0, 0, 0
diff --git a/gfx/tilesets/bg_tiles.pal b/gfx/tilesets/bg_tiles.pal
new file mode 100644
index 00000000..c389f2f1
--- /dev/null
+++ b/gfx/tilesets/bg_tiles.pal
@@ -0,0 +1,53 @@
+; morn
+ RGB 28,31,16, 21,21,21, 13,13,13, 07,07,07 ; gray
+ RGB 28,31,16, 31,19,24, 30,10,06, 07,07,07 ; red
+ RGB 22,31,10, 12,25,01, 05,14,00, 07,07,07 ; green
+ RGB 31,31,31, 08,12,31, 01,04,31, 07,07,07 ; water
+ RGB 28,31,16, 31,31,07, 31,16,01, 07,07,07 ; yellow
+ RGB 28,31,16, 24,18,07, 20,15,03, 07,07,07 ; brown
+ RGB 28,31,16, 15,31,31, 05,17,31, 07,07,07 ; roof
+ RGB 31,31,31, 31,31,31, 31,31,31, 00,00,00 ; text
+
+; day
+ RGB 27,31,27, 21,21,21, 13,13,13, 07,07,07 ; gray
+ RGB 27,31,27, 31,19,24, 30,10,06, 07,07,07 ; red
+ RGB 22,31,10, 12,25,01, 05,14,00, 07,07,07 ; green
+ RGB 31,31,31, 08,12,31, 01,04,31, 07,07,07 ; water
+ RGB 27,31,27, 31,31,07, 31,16,01, 07,07,07 ; yellow
+ RGB 27,31,27, 24,18,07, 20,15,03, 07,07,07 ; brown
+ RGB 27,31,27, 15,31,31, 05,17,31, 07,07,07 ; roof
+ RGB 31,31,31, 31,31,31, 31,31,31, 00,00,00 ; text
+
+; nite
+ RGB 15,14,24, 11,11,19, 07,07,12, 00,00,00 ; gray
+ RGB 15,14,24, 14,07,17, 13,00,08, 00,00,00 ; red
+ RGB 15,14,24, 08,13,19, 00,11,13, 00,00,00 ; green
+ RGB 15,14,24, 05,05,17, 03,03,10, 00,00,00 ; water
+ RGB 30,30,11, 16,14,18, 16,14,10, 00,00,00 ; yellow
+ RGB 15,14,24, 12,09,15, 08,04,05, 00,00,00 ; brown
+ RGB 15,14,24, 13,12,23, 11,09,20, 00,00,00 ; roof
+ RGB 31,31,31, 31,31,31, 31,31,31, 00,00,00 ; text
+
+; dark
+ RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; gray
+ RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; red
+ RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; green
+ RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; water
+ RGB 30,30,11, 00,00,00, 00,00,00, 00,00,00 ; yellow
+ RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; brown
+ RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; roof
+ RGB 31,31,31, 31,31,31, 31,31,31, 00,00,00 ; text
+
+; indoor
+ RGB 30,28,26, 19,19,19, 13,13,13, 07,07,07 ; gray
+ RGB 30,28,26, 31,19,24, 30,10,06, 07,07,07 ; red
+ RGB 18,24,09, 15,20,01, 09,13,00, 07,07,07 ; green
+ RGB 30,28,26, 15,16,31, 09,09,31, 07,07,07 ; water
+ RGB 30,28,26, 31,31,07, 31,16,01, 07,07,07 ; yellow
+ RGB 26,24,17, 21,17,07, 16,13,03, 07,07,07 ; brown
+ RGB 30,28,26, 17,19,31, 14,16,31, 07,07,07 ; roof
+ RGB 31,31,31, 31,31,31, 31,31,31, 00,00,00 ; text
+
+; overworld water
+ RGB 23,23,31, 18,19,31, 13,12,31, 07,07,07 ; morn/day
+ RGB 15,13,27, 10,09,20, 04,03,18, 00,00,00 ; nite
diff --git a/gfx/tilesets/ob.pal b/gfx/tilesets/ob.pal
deleted file mode 100644
index f9fa6699..00000000
--- a/gfx/tilesets/ob.pal
+++ /dev/null
@@ -1,159 +0,0 @@
- RGB 28, 31, 16
- RGB 31, 19, 10
- RGB 31, 07, 01
- RGB 00, 00, 00
-
- RGB 28, 31, 16
- RGB 31, 19, 10
- RGB 10, 09, 31
- RGB 00, 00, 00
-
- RGB 28, 31, 16
- RGB 31, 19, 10
- RGB 07, 23, 03
- RGB 00, 00, 00
-
- RGB 28, 31, 16
- RGB 31, 19, 10
- RGB 15, 10, 03
- RGB 00, 00, 00
-
- RGB 28, 31, 16
- RGB 31, 19, 10
- RGB 30, 10, 06
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 13, 13, 13
- RGB 00, 00, 00
-
- RGB 22, 31, 10
- RGB 12, 25, 01
- RGB 05, 14, 00
- RGB 07, 07, 07
-
- RGB 28, 31, 16
- RGB 24, 18, 07
- RGB 20, 15, 03
- RGB 07, 07, 07
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 31, 07, 01
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 10, 09, 31
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 07, 23, 03
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 15, 10, 03
- RGB 00, 00, 00
-
- RGB 27, 31, 27
- RGB 31, 19, 10
- RGB 30, 10, 06
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 13, 13, 13
- RGB 00, 00, 00
-
- RGB 22, 31, 10
- RGB 12, 25, 01
- RGB 05, 14, 00
- RGB 07, 07, 07
-
- RGB 27, 31, 27
- RGB 24, 18, 07
- RGB 20, 15, 03
- RGB 07, 07, 07
-
- RGB 15, 14, 24
- RGB 31, 19, 10
- RGB 31, 07, 01
- RGB 00, 00, 00
-
- RGB 15, 14, 24
- RGB 31, 19, 10
- RGB 10, 09, 31
- RGB 00, 00, 00
-
- RGB 15, 14, 24
- RGB 31, 19, 10
- RGB 07, 23, 03
- RGB 00, 00, 00
-
- RGB 15, 14, 24
- RGB 31, 19, 10
- RGB 15, 10, 03
- RGB 00, 00, 00
-
- RGB 15, 14, 24
- RGB 31, 19, 10
- RGB 30, 10, 06
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 13, 13, 13
- RGB 00, 00, 00
-
- RGB 15, 14, 24
- RGB 08, 13, 19
- RGB 00, 11, 13
- RGB 00, 00, 00
-
- RGB 15, 14, 24
- RGB 12, 09, 15
- RGB 08, 04, 05
- RGB 00, 00, 00
-
- RGB 01, 01, 02
- RGB 31, 19, 10
- RGB 31, 07, 01
- RGB 00, 00, 00
-
- RGB 01, 01, 02
- RGB 31, 19, 10
- RGB 10, 09, 31
- RGB 00, 00, 00
-
- RGB 01, 01, 02
- RGB 31, 19, 10
- RGB 07, 23, 03
- RGB 00, 00, 00
-
- RGB 01, 01, 02
- RGB 31, 19, 10
- RGB 15, 10, 03
- RGB 00, 00, 00
-
- RGB 01, 01, 02
- RGB 31, 19, 10
- RGB 30, 10, 06
- RGB 00, 00, 00
-
- RGB 31, 31, 31
- RGB 31, 31, 31
- RGB 13, 13, 13
- RGB 00, 00, 00
-
- RGB 01, 01, 02
- RGB 00, 00, 00
- RGB 00, 00, 00
- RGB 00, 00, 00
-
- RGB 01, 01, 02
- RGB 00, 00, 00
- RGB 00, 00, 00
- RGB 00, 00, 00
diff --git a/gfx/tilesets/roof.pal b/gfx/tilesets/roofs.pal
index cef531c0..cef531c0 100644
--- a/gfx/tilesets/roof.pal
+++ b/gfx/tilesets/roofs.pal
diff --git a/gfx/title/title_bg.pal b/gfx/title/title_bg.pal
new file mode 100644
index 00000000..c1e2690f
--- /dev/null
+++ b/gfx/title/title_bg.pal
@@ -0,0 +1,52 @@
+IF DEF(_GOLD)
+ RGB 31, 31, 31
+ RGB 18, 23, 31
+ RGB 15, 20, 31
+ RGB 0, 0, 0
+
+ RGB 31, 21, 0
+ RGB 12, 14, 12
+ RGB 15, 20, 31
+ RGB 0, 0, 17
+
+ RGB 31, 31, 31
+ RGB 31, 0, 0
+ RGB 15, 20, 31
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 29, 25, 0
+ RGB 15, 20, 31
+ RGB 17, 10, 1
+
+ RGB 31, 31, 31
+ RGB 23, 26, 31
+ RGB 18, 23, 31
+ RGB 0, 0, 0
+
+ELIF DEF(_SILVER)
+ RGB 31, 31, 31
+ RGB 0, 12, 15
+ RGB 4, 8, 21
+ RGB 0, 0, 0
+
+ RGB 31, 21, 0
+ RGB 15, 17, 15
+ RGB 4, 8, 21
+ RGB 0, 0, 17
+
+ RGB 31, 31, 31
+ RGB 31, 0, 0
+ RGB 4, 8, 21
+ RGB 0, 0, 0
+
+ RGB 31, 31, 31
+ RGB 24, 23, 25
+ RGB 4, 8, 21
+ RGB 8, 8, 9
+
+ RGB 31, 31, 31
+ RGB 5, 10, 11
+ RGB 0, 12, 15
+ RGB 0, 0, 0
+ENDC
diff --git a/gfx/title/title_fg.pal b/gfx/title/title_fg.pal
new file mode 100644
index 00000000..03d1d1bc
--- /dev/null
+++ b/gfx/title/title_fg.pal
@@ -0,0 +1,10 @@
+ RGB 31, 31, 31
+ RGB 07, 06, 03
+ RGB 07, 06, 03
+ RGB 07, 06, 03
+
+ RGB 31, 31, 31
+ RGB 31, 31, 00
+ RGB 26, 22, 00
+ RGB 00, 00, 00
+
diff --git a/wram.asm b/wram.asm
index d95af439..23b0914d 100644
--- a/wram.asm
+++ b/wram.asm
@@ -392,15 +392,15 @@ wPokegearRadioChannelAddr:: dw ; c5da
wPokegearRadioMusicPlaying:: db ; c5dc
NEXTU ; c5d0
-; engine/gfx/color.asm ?
+; unused (engine/gfx/color.asm)
ds 50
-wc602:: ds 1 ; c602
-wc603:: ds 1 ; c603
-wc604:: ds 1 ; c604
-wc605:: ds 1 ; c605
-wc606:: ds 1 ; c606
-wc607:: ds 1 ; c607
+wc602:: db ; c602
+ ds 2
+
+wc605:: db ; c605
+wc606:: db ; c606
+wc607:: db ; c607
ENDU ; c634
@@ -963,16 +963,11 @@ wBGMapPalBuffer:: ds 40 ; cc48
wBGMapBufferPtrs:: ds 40 ; cc70 ; 20 bg map addresses (16x8 tiles)
wBGMapBufferEnd::
-wColorLayoutPredefID:: ds 1 ; cc98
+wSGBPredef:: db ; cc98
wPlayerHPPal:: db ; cc99
wEnemyHPPal:: db ; cc9a
-wcc9b:: ds 1 ; cc9b
-wcc9c:: ds 1 ; cc9c
-wcc9d:: ds 1 ; cc9d
-wcc9e:: ds 1 ; cc9e
-wcc9f:: ds 1 ; cc9f
-wcca0:: ds 1 ; cca0
-wcca1:: ds 1 ; cca1
+wHPPals:: ds PARTY_LENGTH ; cc9b
+wCurHPPal:: db ; cca1
wcca2:: ds 1 ; cca2
wcca3:: ds 1 ; cca3
wcca4:: ds 1 ; cca4
@@ -980,54 +975,7 @@ wcca5:: ds 1 ; cca5
wcca6:: ds 1 ; cca6
wcca7:: ds 1 ; cca7
wcca8:: ds 1 ; cca8
-wcca9:: ds 1 ; cca9
-wccaa:: ds 1 ; ccaa
-wccab:: ds 1 ; ccab
-wccac:: ds 1 ; ccac
-wccad:: ds 1 ; ccad
-wccae:: ds 1 ; ccae
-wccaf:: ds 1 ; ccaf
-wccb0:: ds 1 ; ccb0
-wccb1:: ds 1 ; ccb1
-wccb2:: ds 1 ; ccb2
-wccb3:: ds 1 ; ccb3
-wccb4:: ds 1 ; ccb4
-wccb5:: ds 1 ; ccb5
-wccb6:: ds 1 ; ccb6
-wccb7:: ds 1 ; ccb7
-wccb8:: ds 1 ; ccb8
-wccb9:: ds 1 ; ccb9
-wccba:: ds 1 ; ccba
-wccbb:: ds 1 ; ccbb
-wccbc:: ds 1 ; ccbc
-wccbd:: ds 1 ; ccbd
-wccbe:: ds 1 ; ccbe
-wccbf:: ds 1 ; ccbf
-wccc0:: ds 1 ; ccc0
-wccc1:: ds 1 ; ccc1
-wccc2:: ds 1 ; ccc2
-wccc3:: ds 1 ; ccc3
-wccc4:: ds 1 ; ccc4
-wccc5:: ds 1 ; ccc5
-wccc6:: ds 1 ; ccc6
-wccc7:: ds 1 ; ccc7
-wccc8:: ds 1 ; ccc8
-wccc9:: ds 1 ; ccc9
-wccca:: ds 1 ; ccca
-wcccb:: ds 1 ; cccb
-wcccc:: ds 1 ; cccc
-wcccd:: ds 1 ; cccd
-wccce:: ds 1 ; ccce
-wcccf:: ds 1 ; cccf
-wccd0:: ds 1 ; ccd0
-wccd1:: ds 1 ; ccd1
-wccd2:: ds 1 ; ccd2
-wccd3:: ds 1 ; ccd3
-wccd4:: ds 1 ; ccd4
-wccd5:: ds 1 ; ccd5
-wccd6:: ds 1 ; ccd6
-wccd7:: ds 1 ; ccd7
-wccd8:: ds 1 ; ccd8
+wSGBPals:: ds 48 ; cca9
wAttrmap:: ; ccd9
ds SCREEN_HEIGHT * SCREEN_WIDTH
@@ -1067,7 +1015,6 @@ wMonType:: ds 1 ; ce5f
wCurSpecies:: ds 1 ; ce60
wNamedObjectTypeBuffer:: ds 1 ; ce61
wce62:: ds 1 ; ce62
-wce63::
wJumptableIndex::
db