summaryrefslogtreecommitdiff
path: root/predef
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@gmail.com>2015-12-16 21:57:42 -0500
committerPikalaxALT <PikalaxALT@gmail.com>2015-12-16 21:57:42 -0500
commit7203e9d2cc757a95bac02ec019ffa094f516c9dd (patch)
treee9cffc2a3d71ac4797600d05be242d740a90885f /predef
parent879b430fce7d2ad470512a21183586c78b81535f (diff)
Map script and color shenanigans
Diffstat (limited to 'predef')
-rw-r--r--predef/cgb.asm354
-rwxr-xr-xpredef/crystal.asm614
-rw-r--r--predef/sgb.asm16
3 files changed, 803 insertions, 181 deletions
diff --git a/predef/cgb.asm b/predef/cgb.asm
index ea5580f8e..b681d6df7 100644
--- a/predef/cgb.asm
+++ b/predef/cgb.asm
@@ -84,12 +84,12 @@ _CGB00: ; 8db8
_CGB01: ; 8ddb
ld de, UnknBGPals
- call Function9729
+ call GetBattlemonBackpicPalettePointer
push hl
- call Function9643
- call Function973a
+ call LoadPalette_White_Col1_Col2_Black
+ call GetEnemyFrontpicPalettePointer
push hl
- call Function9643
+ call LoadPalette_White_Col1_Col2_Black
ld a, [EnemyHPPal]
ld l, a
ld h, $0
@@ -98,7 +98,7 @@ rept 2
endr
ld bc, Palettes_a8be
add hl, bc
- call Function9643
+ call LoadPalette_White_Col1_Col2_Black
ld a, [PlayerHPPal]
ld l, a
ld h, $0
@@ -107,18 +107,17 @@ rept 2
endr
ld bc, Palettes_a8be
add hl, bc
- call Function9643
+ call LoadPalette_White_Col1_Col2_Black
ld hl, Palettes_a8ca
- call Function9643
+ call LoadPalette_White_Col1_Col2_Black
ld de, UnknOBPals
pop hl
- call Function9643
+ call LoadPalette_White_Col1_Col2_Black
pop hl
- call Function9643
+ call LoadPalette_White_Col1_Col2_Black
ld a, SCGB_01
ld [SGBPredef], a
- call Function96a4
-
+ call ApplyPals
Function8e23: ; 8e23
call Function8e85
hlcoord 0, 0, AttrMap
@@ -151,25 +150,23 @@ Function8e23: ; 8e23
call ByteFill
ld hl, Palettes_979c
ld de, UnknOBPals + $10
- ld bc, $0030
+ ld bc, $30
ld a, $5
call FarCopyWRAM
- call Function96b3
+ call ApplyAttrMap
ret
; 8e85
Function8e85: ; 8e85
callba Function100dc0
-
Function8e8b: ; 8e8b
ld hl, Palette_b311
jr nc, .asm_8e93
ld hl, Palette_b309
-
.asm_8e93
ld de, UnknBGPals + 8 * 7
- ld bc, $0008
+ ld bc, $8
ld a, $5
call FarCopyWRAM
ret
@@ -180,10 +177,9 @@ Function8e9f: ; 8e9f
ld hl, Palette_b311
jr nc, .asm_8ead
ld hl, Palette_b309
-
.asm_8ead
ld de, UnknBGPals
- ld bc, $0008
+ ld bc, $8
ld a, $5
call FarCopyWRAM
ret
@@ -198,13 +194,12 @@ _CGB02: ; 8eb9
.asm_8ec5
ld hl, Palettes_b729
-
.asm_8ec8
ld de, UnknBGPals
- ld bc, $0030
+ ld bc, 6 palettes
ld a, $5
call FarCopyWRAM
- call Function96a4
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -220,41 +215,47 @@ rept 2
endr
ld bc, Palettes_a8be
add hl, bc
- call Function9643
+ call LoadPalette_White_Col1_Col2_Black
ld a, [CurPartySpecies]
ld bc, TempMonDVs
- call Function974b
- call Function9643
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
ld hl, Palettes_a8ca
- call Function9643
+ call LoadPalette_White_Col1_Col2_Black
ld hl, Palette8f52
ld de, UnknBGPals + 8 * 3
- ld bc, $0018
+ ld bc, 3 palettes
ld a, $5
call FarCopyWRAM
- call Function9699
+ call WipeAttrMap
+
hlcoord 0, 0, AttrMap
lb bc, 8, SCREEN_WIDTH
ld a, $1
call FillBoxCGB
+
hlcoord 10, 16, AttrMap
- ld bc, $000a
+ ld bc, 10
ld a, $2
call ByteFill
+
hlcoord 13, 5, AttrMap
lb bc, 2, 2
ld a, $3
call FillBoxCGB
+
hlcoord 15, 5, AttrMap
lb bc, 2, 2
ld a, $4
call FillBoxCGB
+
hlcoord 17, 5, AttrMap
lb bc, 2, 2
ld a, $5
call FillBoxCGB
- call Function96b3
- call Function96a4
+
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -298,11 +299,10 @@ _CGB04: ; 8f70
jr .asm_8f90
.asm_8f8a
- call Function9775
- call Function9643
-
+ call GetMonPalettePointer_
+ call LoadPalette_White_Col1_Col2_Black
.asm_8f90
- call Function9699
+ call WipeAttrMap
hlcoord 1, 1, AttrMap
lb bc, 7, 7
ld a, $1
@@ -310,11 +310,11 @@ _CGB04: ; 8f70
call Function971a
ld hl, Palette8fc2
ld de, UnknOBPals + $38
- ld bc, $0008
+ ld bc, 1 palettes
ld a, $5
call FarCopyWRAM
- call Function96b3
- call Function96a4
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -340,25 +340,24 @@ _CGB17: ; 8fca
call LoadHLPaletteIntoDE
ld a, [CurPartySpecies]
cp $ff
- jr nz, .asm_8fe4
+ jr nz, .GetMonPalette
ld hl, Palette9036
call LoadHLPaletteIntoDE
- jr .asm_8fed
+ jr .Resume
-.asm_8fe4
+.GetMonPalette
ld bc, TempMonDVs
- call Function974b
- call Function9643
-
-.asm_8fed
- call Function9699
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+.Resume
+ call WipeAttrMap
hlcoord 1, 4, AttrMap
lb bc, 7, 7
ld a, $1
call FillBoxCGB
call Function971a
- call Function96b3
- call Function96a4
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -369,19 +368,19 @@ Function9009: ; 9009
call LoadHLPaletteIntoDE
jr .asm_901a
+.unused
ld bc, TempMonDVs
- call Function974b
- call Function9643
-
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
.asm_901a
- call Function9699
+ call WipeAttrMap
hlcoord 1, 1, AttrMap
lb bc, 7, 7
ld a, $1
call FillBoxCGB
call Function971a
- call Function96b3
- call Function96a4
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -400,16 +399,16 @@ _CGB16: ; 903e
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
ld a, [CurPartySpecies]
- call Function9775
- call Function9643
- call Function9699
+ call GetMonPalettePointer_
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrMap
hlcoord 7, 5, AttrMap
lb bc, 7, 7
ld a, $1
call FillBoxCGB
call Function971a
- call Function96b3
- call Function96a4
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -418,10 +417,10 @@ _CGB16: ; 903e
_CGB05: ; 906e
ld hl, Palettes_b7a9
ld de, UnknBGPals
- ld bc, $0080
+ ld bc, $80
ld a, $5
call FarCopyWRAM
- call Function9699
+ call WipeAttrMap
hlcoord 0, 2, AttrMap
lb bc, 10, 3
ld a, $2
@@ -459,11 +458,11 @@ _CGB05: ; 906e
ld a, $1
call FillBoxCGB
hlcoord 0, 12, AttrMap
- ld bc, $0078
+ ld bc, $78
ld a, $7
call ByteFill
- call Function96b3
- call Function96a4
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -472,7 +471,7 @@ _CGB05: ; 906e
_CGB06: ; 90f8
ld hl, PalPacket_9ca6 + 1
call CopyFourPalettes
- call Function9699
+ call WipeAttrMap
ld de, UnknOBPals
ld a, $3c
call GetAthPalletFromPalettes9df6
@@ -481,8 +480,8 @@ _CGB06: ; 90f8
lb bc, 12, SCREEN_WIDTH
ld a, $1
call FillBoxCGB
- call Function96b3
- call Function96a4
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -512,10 +511,10 @@ Function9133: ; 9133
call LoadHLPaletteIntoDE
ld hl, Palette_9156
ld de, UnknOBPals
- ld bc, $0010
+ ld bc, 2 palettes
ld a, $5
call FarCopyWRAM
- call Function9699
+ call WipeAttrMap
ret
; 914e
@@ -542,11 +541,12 @@ Function9166: ; 9166
ld a, $38
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
+
ld de, UnknOBPals
ld a, $39
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
- call Function9699
+ call WipeAttrMap
ret
; 9180
@@ -557,32 +557,32 @@ Function9180: ; 9180
ld a, $3a
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
- call Function9699
+ call WipeAttrMap
ret
; 9195
_CGB11: ; 9195
ld hl, Palettes_b789
ld de, UnknBGPals
- ld bc, $0028
+ ld bc, 5 palettes
ld a, $5
call FarCopyWRAM
- call Function96a4
- call Function9699
- call Function96b3
+ call ApplyPals
+ call WipeAttrMap
+ call ApplyAttrMap
ret
; 91ad
_CGB08: ; 91ad
ld hl, Palettes_b641
ld de, UnknBGPals
- ld bc, $0080
+ ld bc, 16 palettes
ld a, $5
call FarCopyWRAM
ld hl, PalPacket_9cb6 + 1
call CopyFourPalettes
- call Function9699
- call Function96b3
+ call WipeAttrMap
+ call ApplyAttrMap
ret
; 91c8
@@ -599,7 +599,7 @@ _CGB0a: ; 91d1
call Function8e9f
call Function8e85
call Function971a
- call Function96b3
+ call ApplyAttrMap
ret
; 91e4
@@ -607,13 +607,13 @@ _CGB0b: ; 91e4
ld de, UnknBGPals
ld a, c
and a
- jr z, .asm_91f5
+ jr z, .pokemon
ld a, $1a
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
jr .got_palette
-.asm_91f5
+.pokemon
ld hl, PartyMon1DVs
ld bc, PARTYMON_STRUCT_LENGTH
ld a, [CurPartyMon]
@@ -621,8 +621,8 @@ _CGB0b: ; 91e4
ld c, l
ld b, h
ld a, [PlayerHPPal]
- call Function974b
- call Function9643
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
ld hl, Palettes_979c
ld de, UnknOBPals + 2 palettes
ld bc, 6 palettes
@@ -630,9 +630,9 @@ _CGB0b: ; 91e4
call FarCopyWRAM
.got_palette
- call Function9699
- call Function96b3
- call Function96a4
+ call WipeAttrMap
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -641,17 +641,17 @@ _CGB0b: ; 91e4
_CGB0c: ; 9228
ld hl, Palettes_b6f1
ld de, UnknBGPals
- ld bc, $0028
+ ld bc, 5 palettes
ld a, $5
call FarCopyWRAM
ld hl, Palettes_b719
ld de, UnknOBPals
- ld bc, $0010
+ ld bc, 2 palettes
ld a, $5
call FarCopyWRAM
ld a, SCGB_08
ld [SGBPredef], a
- call Function96a4
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -660,8 +660,8 @@ _CGB0c: ; 9228
_CGB0d: ; 9251
ld hl, PalPacket_9cb6 + 1
call CopyFourPalettes
- call Function9699
- call Function96b3
+ call WipeAttrMap
+ call ApplyAttrMap
ret
; 925e
@@ -683,59 +683,58 @@ _CGB18: ; 925e
ld [hl], a
pop af
ld [rSVBK], a
- call Function9699
- call Function96b3
+ call WipeAttrMap
+ call ApplyAttrMap
ret
; 9289
_CGB15: ; 9289
ld de, UnknBGPals
xor a
- call Function976b
- call Function9643
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
ld a, $1
- call Function976b
- call Function9643
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
ld a, $3
- call Function976b
- call Function9643
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
ld a, $2
- call Function976b
- call Function9643
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
ld a, $4
- call Function976b
- call Function9643
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
ld a, $7
- call Function976b
- call Function9643
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
ld a, $6
- call Function976b
- call Function9643
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
ld a, $5
- call Function976b
- call Function9643
+ call GetTrainerPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
ld a, $24
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
+
hlcoord 0, 0, AttrMap
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, [PlayerGender]
and a
ld a, $1
- jr z, .asm_92e3
+ jr z, .got_gender
ld a, $0
-
-.asm_92e3
+.got_gender
call ByteFill
hlcoord 14, 1, AttrMap
lb bc, 7, 5
ld a, [PlayerGender]
and a
ld a, $0
- jr z, .asm_92f6
+ jr z, .got_gender2
ld a, $1
-
-.asm_92f6
+.got_gender2
call FillBoxCGB
hlcoord 18, 1, AttrMap
ld [hl], $1
@@ -770,24 +769,22 @@ _CGB15: ; 9289
ld a, [PlayerGender]
and a
push af
- jr z, .asm_935d
+ jr z, .got_gender3
hlcoord 14, 14, AttrMap
lb bc, 2, 4
ld a, $1
call FillBoxCGB
-
-.asm_935d
+.got_gender3
pop af
ld c, $0
- jr nz, .asm_9363
+ jr nz, .got_gender4
inc c
-
-.asm_9363
+.got_gender4
ld a, c
hlcoord 18, 1, AttrMap
ld [hl], a
- call Function96b3
- call Function96a4
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -806,14 +803,14 @@ rept 2
endr
ld bc, Palettes_a8be
add hl, bc
- call Function9643
- call Function9699
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrMap
hlcoord 11, 1, AttrMap
lb bc, 2, 9
ld a, $1
call FillBoxCGB
- call Function96b3
- call Function96a4
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -822,9 +819,9 @@ endr
_CGB0f: ; 93a6
ld hl, PalPacket_9c46 + 1
call CopyFourPalettes
- call Function9699
- call Function96b3
- call Function96a4
+ call WipeAttrMap
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -835,35 +832,36 @@ _CGB10: ; 93ba
ld a, $1d
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
- call Function9699
- call Function96b3
- call Function96a4
+ call WipeAttrMap
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
; 93d3
_CGB14: ; 93d3
+; pack pals
ld a, [BattleType]
cp BATTLETYPE_TUTORIAL
- jr z, .asm_93e6
+ jr z, .tutorial_male
ld a, [PlayerGender]
bit 0, a
- jr z, .asm_93e6
+ jr z, .tutorial_male
ld hl, Palettes_9469
- jr .asm_93e9
+ jr .got_gender
-.asm_93e6
+.tutorial_male
ld hl, Palettes_9439
-.asm_93e9
+.got_gender
ld de, UnknBGPals
- ld bc, $0040
+ ld bc, 8 palettes ; 6 palettes?
ld a, $5
call FarCopyWRAM
- call Function9699
+ call WipeAttrMap
hlcoord 0, 0, AttrMap
lb bc, 1, 10
ld a, $1
@@ -884,8 +882,8 @@ _CGB14: ; 93d3
lb bc, 3, 5
ld a, $5
call FillBoxCGB
- call Function96b3
- call Function96a4
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -896,22 +894,27 @@ Palettes_9439: ; 9439
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
@@ -923,22 +926,27 @@ Palettes_9469: ; 9469
RGB 31, 14, 31
RGB 31, 07, 31
RGB 00, 00, 00
+
RGB 31, 31, 31
RGB 31, 14, 31
RGB 31, 07, 31
RGB 00, 00, 00
+
RGB 15, 15, 31
RGB 31, 14, 31
RGB 31, 07, 31
RGB 00, 00, 00
+
RGB 31, 31, 31
RGB 31, 14, 31
RGB 31, 07, 31
RGB 31, 00, 00
+
RGB 31, 31, 31
RGB 31, 14, 31
RGB 31, 00, 00
RGB 00, 00, 00
+
RGB 31, 31, 31
RGB 07, 19, 07
RGB 07, 19, 07
@@ -947,17 +955,17 @@ Palettes_9469: ; 9469
_CGB12: ; 9499
call _CGB09
- ld de, $0014
+ ld de, SCREEN_WIDTH
hlcoord 0, 0, AttrMap
ld a, [wMenuBorderTopCoord]
-.asm_94a5
+.loop
and a
- jr z, .asm_94ac
+ jr z, .found_top
dec a
add hl, de
- jr .asm_94a5
+ jr .loop
-.asm_94ac
+.found_top
ld a, [wMenuBorderLeftCoord]
ld e, a
ld d, $0
@@ -976,14 +984,14 @@ _CGB12: ; 9499
ld c, a
ld a, $0
call FillBoxCGB
- call Function96b3
+ call ApplyAttrMap
ret
; 94d0
_CGB13: ; 94d0
ld hl, PalPacket_9ba6 + 1
call CopyFourPalettes
- call Function9699
+ call WipeAttrMap
hlcoord 0, 4, AttrMap
lb bc, 10, SCREEN_WIDTH
ld a, $2
@@ -992,8 +1000,8 @@ _CGB13: ; 94d0
lb bc, 6, SCREEN_WIDTH
ld a, $1
call FillBoxCGB
- call Function96b3
- call Function96a4
+ call ApplyAttrMap
+ call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ret
@@ -1010,9 +1018,9 @@ _CGB19: ; 94fa
ld hl, Palette_9521
ld de, UnknOBPals + 8
call LoadHLPaletteIntoDE
- call Function9699
- call Function96b3
- call Function96a4
+ call WipeAttrMap
+ call ApplyAttrMap
+ call ApplyPals
ret
; 9521
@@ -1027,21 +1035,21 @@ _CGB1a: ; 9529
ld de, UnknBGPals
ld a, [CurPartySpecies]
ld bc, TempMonDVs
- call Function974b
- call Function9643
- call Function9699
- call Function96b3
- call Function96a4
+ call GetPlayerOrMonPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrMap
+ call ApplyAttrMap
+ call ApplyPals
ret
; 9542
_CGB1e: ; 9542
ld de, UnknBGPals
ld a, [CurPartySpecies]
- call Function9775
- call Function9643
- call Function9699
- call Function96b3
+ call GetMonPalettePointer_
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrMap
+ call ApplyAttrMap
ret
; 9555
@@ -1050,14 +1058,14 @@ _CGB1b: ; 9555
call CopyFourPalettes
ld hl, Palettes_b681
ld de, UnknOBPals
- ld bc, $0008
+ ld bc, $8
ld a, $5
call FarCopyWRAM
ld de, UnknOBPals + $38
ld a, $1c
call GetAthPalletFromPalettes9df6
call LoadHLPaletteIntoDE
- call Function9699
+ call WipeAttrMap
ret
; 9578
@@ -1065,22 +1073,22 @@ _CGB1c: ; 9578
ld de, UnknBGPals
ld a, [CurPartySpecies]
ld bc, TempMonDVs
- call Function9764
- call Function9643
- call Function9699
- call Function96b3
- call Function96a4
+ call GetFrontpicPalettePointer
+ call LoadPalette_White_Col1_Col2_Black
+ call WipeAttrMap
+ call ApplyAttrMap
+ call ApplyPals
ret
; 9591
_CGB1d: ; 9591
ld hl, Palette95e0
ld de, UnknBGPals
- ld bc, $0010
+ ld bc, $10
ld a, $5
call FarCopyWRAM
- call Function96a4
- call Function9699
+ call ApplyPals
+ call WipeAttrMap
hlcoord 3, 7, AttrMap
lb bc, 8, 14
ld a, $1
@@ -1101,7 +1109,7 @@ _CGB1d: ; 9591
lb bc, 12, 1
ld a, $1
call FillBoxCGB
- call Function96b3
+ call ApplyAttrMap
ret
; 95e0
diff --git a/predef/crystal.asm b/predef/crystal.asm
new file mode 100755
index 000000000..e288dff12
--- /dev/null
+++ b/predef/crystal.asm
@@ -0,0 +1,614 @@
+GetMysteryGift_MobileAdapterLayout: ; 4930f (mobile)
+ ld a, b
+ cp SCGB_RAM
+ jr nz, .not_ram
+ ld a, [SGBPredef]
+.not_ram
+ push af
+ callba Function9673
+ pop af
+ ld l, a
+ ld h, 0
+ add hl, hl
+ ld de, .jumptable
+ add hl, de
+ ld a, [hli]
+ ld h, [hl]
+ ld l, a
+ ld de, .done
+ push de
+ jp [hl]
+.done
+ ret
+; 49330 (12:5330)
+
+.jumptable: ; 49330
+ jumptable_start
+ jumptable MG_Mobile_Layout00
+ jumptable MG_Mobile_Layout01
+ jumptable MG_Mobile_Layout02
+; 49336
+
+MG_Mobile_Layout_FillBox: ; 49336
+.row
+ push bc
+ push hl
+.col
+ ld [hli], a
+ dec c
+ jr nz, .col
+ pop hl
+ ld bc, SCREEN_WIDTH
+ add hl, bc
+ pop bc
+ dec b
+ jr nz, .row
+ ret
+; 49346
+
+MG_Mobile_Layout_WipeAttrMap: ; 49346 (12:5346)
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
+ xor a
+ call ByteFill
+ ret
+
+MG_Mobile_Layout_LoadPals: ; 49351 (12:5351)
+ ld de, UnknBGPals
+ ld hl, Palette_493e1
+ ld bc, 5 palettes
+ ld a, $5 ; BANK(UnknBGPals)
+ call FarCopyWRAM
+ ld de, UnknBGPals + 7 palettes
+ ld hl, Palette_TextBG7
+ ld bc, 1 palettes
+ ld a, $5 ; BANK(UnknBGPals)
+ call FarCopyWRAM
+ ret
+
+MG_Mobile_Layout00: ; 4936e (12:536e)
+ call MG_Mobile_Layout_LoadPals
+ call MG_Mobile_Layout_WipeAttrMap
+ call MG_Mobile_Layout_CreatePalBoxes
+ callba ApplyAttrMap
+ callba ApplyPals
+ ret
+
+MG_Mobile_Layout_CreatePalBoxes: ; 49384 (12:5384)
+ hlcoord 0, 0, AttrMap
+ lb bc, 4, 1
+ ld a, $1
+ call MG_Mobile_Layout_FillBox
+ lb bc, 2, 1
+ ld a, $2
+ call MG_Mobile_Layout_FillBox
+ lb bc, 6, 1
+ ld a, $3
+ call MG_Mobile_Layout_FillBox
+ hlcoord 1, 0, AttrMap
+ ld a, $1
+ lb bc, 3, 18
+ call MG_Mobile_Layout_FillBox
+ lb bc, 2, 18
+ ld a, $2
+ call MG_Mobile_Layout_FillBox
+ lb bc, 12, 18
+ ld a, $3
+ call MG_Mobile_Layout_FillBox
+ hlcoord 19, 0, AttrMap
+ lb bc, 4, 1
+ ld a, $1
+ call MG_Mobile_Layout_FillBox
+ lb bc, 2, 1
+ ld a, $2
+ call MG_Mobile_Layout_FillBox
+ lb bc, 6, 1
+ ld a, $3
+ call MG_Mobile_Layout_FillBox
+ hlcoord 0, 12, AttrMap
+ ld bc, 6 * SCREEN_WIDTH
+ ld a, $7
+ call ByteFill
+ ret
+; 493e1 (12:53e1)
+
+Palette_493e1: ; 493e1
+ RGB 03, 07, 09
+ RGB 26, 31, 00
+ RGB 20, 16, 03
+ RGB 31, 31, 31
+
+ RGB 13, 24, 29
+ RGB 11, 16, 30
+ RGB 07, 11, 22
+ RGB 05, 06, 18
+
+ RGB 31, 31, 31
+ RGB 20, 26, 31
+ RGB 13, 24, 29
+ RGB 11, 16, 30
+
+ RGB 31, 31, 31
+ RGB 20, 26, 31
+ RGB 00, 00, 00
+ RGB 00, 00, 00
+
+ RGB 31, 31, 31
+ RGB 20, 16, 08
+ RGB 31, 00, 00
+ RGB 00, 00, 00
+; 49409
+
+LoadOW_BGPal7:: ; 49409
+ ld hl, Palette_TextBG7
+ ld de, UnknBGPals + 8 * 7
+ ld bc, 8
+ ld a, $5
+ call FarCopyWRAM
+ ret
+; 49418
+
+Palette_TextBG7: ; 49418
+ RGB 31, 31, 31
+ RGB 08, 19, 28
+ RGB 05, 05, 16
+ RGB 00, 00, 00
+; 49420
+
+Function49420:: ; 49420 (12:5420)
+ ld hl, MansionPalette4
+ ld de, UnknBGPals + $30
+ ld bc, $8
+ ld a, $5 ; BANK(UnknBGPals)
+ call FarCopyWRAM
+ ret
+; 4942f (12:542f)
+
+MG_Mobile_Layout01: ; 4942f
+ call MG_Mobile_Layout_LoadPals
+ ld de, UnknBGPals + $38
+ ld hl, Palette_49478
+ ld bc, $8
+ ld a, $5 ; BANK(UnknBGPals)
+ call FarCopyWRAM
+ call MG_Mobile_Layout_WipeAttrMap
+ hlcoord 0, 0, AttrMap
+ ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
+ xor a
+ call ByteFill
+ hlcoord 0, 14, AttrMap
+ ld bc, 4 * SCREEN_WIDTH
+ ld a, $7
+ call ByteFill
+ ld a, [wd002]
+ bit 6, a
+ jr z, .asm_49464
+ call Function49480
+ jr .asm_49467
+
+.asm_49464
+ call Function49496
+
+.asm_49467
+ callba ApplyAttrMap
+ callba ApplyPals
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+; 49478
+
+Palette_49478: ; 49478
+ RGB 31, 31, 31
+ RGB 26, 31, 00
+ RGB 20, 16, 03
+ RGB 00, 00, 00
+; 49480
+
+Function49480: ; 49480
+ hlcoord 0, 0, AttrMap
+ lb bc, 4, SCREEN_WIDTH
+ ld a, $7
+ call MG_Mobile_Layout_FillBox
+ hlcoord 0, 2, AttrMap
+ ld a, $4
+ ld [hl], a
+ hlcoord 19, 2, AttrMap
+ ld [hl], a
+ ret
+; 49496
+
+Function49496: ; 49496
+ hlcoord 0, 0, AttrMap
+ lb bc, 2, SCREEN_WIDTH
+ ld a, $7
+ call MG_Mobile_Layout_FillBox
+ hlcoord 0, 1, AttrMap
+ ld a, $4
+ ld [hl], a
+ hlcoord 19, 1, AttrMap
+ ld [hl], a
+ ret
+; 494ac
+
+LoadSpecialMapPalette: ; 494ac
+ ld a, [wTileset]
+ cp TILESET_POKECOM_CENTER
+ jr z, .pokecom_2f
+ cp TILESET_BATTLE_TOWER
+ jr z, .battle_tower
+ cp TILESET_ICE_PATH
+ jr z, .ice_path
+ cp TILESET_HOUSE_1
+ jr z, .house
+ cp TILESET_RADIO_TOWER
+ jr z, .radio_tower
+ cp TILESET_CELADON_MANSION
+ jr z, .mansion_mobile
+ jr .do_nothing
+
+.pokecom_2f
+ call LoadPokeComPalette
+ scf
+ ret
+
+.battle_tower
+ call LoadBattleTowerPalette
+ scf
+ ret
+
+.ice_path
+ ld a, [wPermission] ; permission
+ and 7
+ cp 3 ; Hall of Fame
+ jr z, .do_nothing
+ call LoadIcePathPalette
+ scf
+ ret
+
+.house
+ call LoadHousePalette
+ scf
+ ret
+
+.radio_tower
+ call LoadRadioTowerPalette
+ scf
+ ret
+
+.mansion_mobile
+ call LoadMansionPalette
+ scf
+ ret
+
+.do_nothing
+ and a
+ ret
+; 494f2
+
+LoadPokeComPalette: ; 494f2
+ ld a, $5
+ ld de, UnknBGPals
+ ld hl, PokeComPalette
+ ld bc, 8 palettes
+ call FarCopyWRAM
+ ret
+; 49501
+
+PokeComPalette: ; 49501
+INCLUDE "tilesets/pokecom.pal"
+; 49541
+
+LoadBattleTowerPalette: ; 49541
+ ld a, $5
+ ld de, UnknBGPals
+ ld hl, BattleTowerPalette
+ ld bc, 8 palettes
+ call FarCopyWRAM
+ ret
+; 49550
+
+BattleTowerPalette: ; 49550
+INCLUDE "tilesets/battle_tower.pal"
+; 49590
+
+LoadIcePathPalette: ; 49590
+ ld a, $5
+ ld de, UnknBGPals
+ ld hl, IcePathPalette
+ ld bc, 8 palettes
+ call FarCopyWRAM
+ ret
+; 4959f
+
+IcePathPalette: ; 4959f
+INCLUDE "tilesets/ice_path.pal"
+; 495df
+
+LoadHousePalette: ; 495df
+ ld a, $5
+ ld de, UnknBGPals
+ ld hl, HousePalette
+ ld bc, 8 palettes
+ call FarCopyWRAM
+ ret
+; 495ee
+
+HousePalette: ; 495ee
+INCLUDE "tilesets/house.pal"
+; 4962e
+
+LoadRadioTowerPalette: ; 4962e
+ ld a, $5
+ ld de, UnknBGPals
+ ld hl, RadioTowerPalette
+ ld bc, 8 palettes
+ call FarCopyWRAM
+ ret
+; 4963d
+
+RadioTowerPalette: ; 4963d
+INCLUDE "tilesets/radio_tower.pal"
+; 4967d
+
+MansionPalette1: ; 4967d
+ RGB 30, 28, 26
+ RGB 19, 19, 19
+ RGB 13, 13, 13
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 31, 19, 24
+ RGB 30, 10, 06
+ RGB 07, 07, 07
+
+ RGB 18, 24, 09
+ RGB 15, 20, 01
+ RGB 09, 13, 00
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 15, 16, 31
+ RGB 09, 09, 31
+ RGB 07, 07, 07
+
+ RGB 30, 28, 26
+ RGB 31, 31, 07
+ RGB 31, 16, 01
+ RGB 07, 07, 07
+
+ RGB 26, 24, 17
+ RGB 21, 17, 07
+ RGB 16, 13, 03
+ RGB 07, 07, 07
+
+MansionPalette3: ; 496ad
+ RGB 30, 28, 26
+ RGB 17, 19, 31
+ RGB 14, 16, 31
+ RGB 07, 07, 07
+
+ RGB 31, 31, 16
+ RGB 31, 31, 16
+ RGB 14, 09, 00
+ RGB 00, 00, 00
+; 496bd
+
+MansionPalette4: ; 496bd
+ RGB 05, 05, 16
+ RGB 08, 19, 28
+ RGB 00, 00, 00
+ RGB 31, 31, 31
+; 496c5
+
+LoadMansionPalette: ; 496c5
+ ld a, $5
+ ld de, UnknBGPals
+ ld hl, MansionPalette1
+ ld bc, 8 palettes
+ call FarCopyWRAM
+ ld a, $5
+ ld de, UnknBGPals + 4 palettes
+ ld hl, MansionPalette2
+ ld bc, 1 palettes
+ call FarCopyWRAM
+ ld a, $5
+ ld de, UnknBGPals + 3 palettes
+ ld hl, MansionPalette3
+ ld bc, 1 palettes
+ call FarCopyWRAM
+ ld a, $5
+ ld de, UnknBGPals + 6 palettes
+ ld hl, MansionPalette4
+ ld bc, 1 palettes
+ call FarCopyWRAM
+ ret
+; 496fe
+
+MansionPalette2: ; 496fe
+ RGB 25, 24, 23
+ RGB 20, 19, 19
+ RGB 14, 16, 31
+ RGB 07, 07, 07
+; 49706
+
+MG_Mobile_Layout02: ; 49706
+ ld hl, Palette_49732
+ ld de, UnknBGPals
+ ld bc, 1 palettes
+ ld a, $5
+ call FarCopyWRAM
+ callba ApplyPals
+ call MG_Mobile_Layout_WipeAttrMap
+ callba ApplyAttrMap
+ ld hl, Palette_4973a
+ ld de, UnknOBPals
+ ld bc, 1 palettes
+ ld a, $5
+ call FarCopyWRAM
+ ret
+; 49732
+
+Palette_49732: ; 49732
+ RGB 31, 31, 31
+ RGB 23, 16, 07
+ RGB 23, 07, 07
+ RGB 03, 07, 20
+; 4973a
+
+Palette_4973a: ; 4973a
+ RGB 00, 00, 00
+ RGB 07, 05, 31
+ RGB 14, 18, 31
+ RGB 31, 31, 31
+; 49742
+
+Function49742: ; 49742
+ ld hl, Palette_49757
+ ld de, UnknBGPals
+ ld bc, $40
+ ld a, $5
+ call FarCopyWRAM
+ callba ApplyPals
+ ret
+; 49757
+
+Palette_49757: ; 49757
+ RGB 31, 31, 63
+ RGB 00, 00, 00
+ RGB 00, 00, 00
+ RGB 00, 00, 00
+
+ RGB 31, 31, 63
+ RGB 00, 00, 00
+ RGB 00, 00, 00
+ RGB 00, 00, 00
+
+ RGB 04, 02, 15
+ RGB 21, 00, 21
+ RGB 31, 00, 00
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 21, 00, 21
+ RGB 30, 16, 26
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 21, 00, 21
+ RGB 16, 16, 16
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 21, 00, 21
+ RGB 31, 12, 12
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 21, 00, 21
+ RGB 07, 08, 31
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 21, 00, 21
+ RGB 29, 28, 09
+ RGB 31, 31, 31
+; 49797
+
+Function49797: ; 49797
+ hlcoord 0, 0, AttrMap
+ lb bc, 16, 2
+ ld a, $4
+ call MG_Mobile_Layout_FillBox
+ ld a, $3
+ ldcoord_a 0, 1, AttrMap
+ ldcoord_a 0, 14, AttrMap
+ hlcoord 2, 0, AttrMap
+ lb bc, 8, 18
+ ld a, $5
+ call MG_Mobile_Layout_FillBox
+ hlcoord 2, 8, AttrMap
+ lb bc, 8, 18
+ ld a, $6
+ call MG_Mobile_Layout_FillBox
+ hlcoord 0, 16, AttrMap
+ lb bc, 2, SCREEN_WIDTH
+ ld a, $4
+ call MG_Mobile_Layout_FillBox
+ ld a, $3
+ lb bc, 6, 1
+ hlcoord 6, 1, AttrMap
+ call MG_Mobile_Layout_FillBox
+ ld a, $3
+ lb bc, 6, 1
+ hlcoord 17, 1, AttrMap
+ call MG_Mobile_Layout_FillBox
+ ld a, $3
+ lb bc, 6, 1
+ hlcoord 6, 9, AttrMap
+ call MG_Mobile_Layout_FillBox
+ ld a, $3
+ lb bc, 6, 1
+ hlcoord 17, 9, AttrMap
+ call MG_Mobile_Layout_FillBox
+ ld a, $2
+ hlcoord 2, 16, AttrMap
+ ld [hli], a
+ ld a, $7
+rept 3
+ ld [hli], a
+endr
+ ld a, $2
+ ld [hl], a
+ hlcoord 2, 17, AttrMap
+ ld a, $3
+ ld bc, 6
+ call ByteFill
+ ret
+; 49811
+
+Function49811: ; 49811
+ ld hl, Palette_49826
+ ld de, UnknBGPals + $10
+ ld bc, $30
+ ld a, $5
+ call FarCopyWRAM
+ callba ApplyPals
+ ret
+; 49826
+
+Palette_49826: ; 49826
+ RGB 04, 02, 15
+ RGB 07, 09, 31
+ RGB 31, 00, 00
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 07, 09, 31
+ RGB 15, 23, 30
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 07, 09, 31
+ RGB 16, 16, 16
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 07, 09, 31
+ RGB 25, 07, 04
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 07, 09, 31
+ RGB 03, 22, 08
+ RGB 31, 31, 31
+
+ RGB 04, 02, 15
+ RGB 07, 09, 31
+ RGB 29, 28, 09
+ RGB 31, 31, 31
+; 49856
+
+Function49856: ; 49856
+ call Function49797
+ ret
+; 4985a
diff --git a/predef/sgb.asm b/predef/sgb.asm
index c10e84d1e..471eeea39 100644
--- a/predef/sgb.asm
+++ b/predef/sgb.asm
@@ -114,7 +114,7 @@ endr
ld bc, $0010
call CopyBytes
- call Function9729
+ call GetBattlemonBackpicPalettePointer
ld a, [hli]
ld [wcda9 + $13], a
@@ -124,7 +124,7 @@ endr
ld [wcda9 + $15], a
ld a, [hl]
ld [wcda9 + $16], a
- call Function973a
+ call GetEnemyFrontpicPalettePointer
ld a, [hli]
ld [wcda9 + $19], a
ld a, [hli]
@@ -190,7 +190,7 @@ endr
ld [wcda9 + 6], a
ld a, [CurPartySpecies]
ld bc, wd10e + 21
- call Function974b
+ call GetPlayerOrMonPalettePointer
ld a, [hli]
ld [wcda9 + 9], a
ld a, [hli]
@@ -224,7 +224,7 @@ endr
inc hl
ld [hl], $19
ld a, [CurPartySpecies]
- call Function9775
+ call GetMonPalettePointer_
ld a, [hli]
ld [wcda9 + 9], a
ld a, [hli]
@@ -253,7 +253,7 @@ endr
ld [hl], $19
ld a, [CurPartySpecies]
ld bc, wd10e + 21
- call Function974b
+ call GetPlayerOrMonPalettePointer
ld a, [hli]
ld [wcda9 + 9], a
ld a, [hli]
@@ -410,7 +410,7 @@ endr
ld c, l
ld b, h
ld a, [PlayerHPPal]
- call Function974b
+ call GetPlayerOrMonPalettePointer
ld a, [hli]
ld [wcda9 + 3], a
ld a, [hli]
@@ -515,7 +515,7 @@ endr
call CopyBytes
ld a, [CurPartySpecies]
ld bc, wd10e + 21
- call Function974b
+ call GetPlayerOrMonPalettePointer
ld a, [hli]
ld [wcda9 + 3], a
ld a, [hli]
@@ -542,7 +542,7 @@ endr
call CopyBytes
ld a, [CurPartySpecies]
ld bc, wd10e + 21
- call Function9764
+ call GetFrontpicPalettePointer
ld a, [hli]
ld [wcda9 + 3], a
ld a, [hli]