summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xengine/color.asm197
-rwxr-xr-xpredef/cgb.asm158
-rwxr-xr-xpredef/sgb.asm150
-rw-r--r--wram.asm2
4 files changed, 496 insertions, 11 deletions
diff --git a/engine/color.asm b/engine/color.asm
index ccd58a92..17b98b29 100755
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -117,7 +117,7 @@ SGB_ApplyPartyMenuHPPals:
ld [hl], e
ret
-Function8b07:
+Function9102:
call CheckCGB
ret z
ld hl, .BGPal
@@ -246,8 +246,185 @@ Function91b4:
call LoadEDTile
ret
-ApplyMonOrTrainerPals:
- dr $91e5, $9311
+ApplyMonOrTrainerPals: ; 91e5 (2:51e5)
+ call CheckCGB
+ ret z
+ ld a, e
+ and a
+ jr z, .asm_91f5
+ ld a, [wd004]
+ call Function9be4
+ jr .asm_91fb
+
+.asm_91f5
+ ld a, [wTrainerClass]
+ call Function9bda
+.asm_91fb
+ ld de, wUnknBGPals
+ call Function9adb
+ call Function9b1d
+ call Function9b35
+ call Function9b28
+ ret
+
+ApplyHPBarPals:
+ ld a, [wd007]
+ and a
+ jr z, .asm_921a
+ cp $1
+ jr z, .asm_921f
+ cp $2
+ jr z, .asm_9236
+ ret
+
+.asm_921a
+ ld de, $c292
+ jr .asm_9222
+
+.asm_921f
+ ld de, $c29a
+.asm_9222
+ ld l, c
+ ld h, $0
+ add hl, hl
+ add hl, hl
+ ld bc, $6d2d
+ add hl, bc
+ ld bc, $4
+ call CopyBytes
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+
+.asm_9236
+ ld e, c
+ inc e
+ hlcoord 11, 1, wAttrMap
+ ld bc, 2 * SCREEN_WIDTH
+ ld a, [wd005]
+.asm_9241
+ and a
+ jr z, .asm_9248
+ add hl, bc
+ dec a
+ jr .asm_9241
+
+.asm_9248
+ lb bc, 2, 8
+ ld a, e
+ call Function9af1
+ ret
+
+LoadStatsScreenPals:
+ call CheckCGB
+ ret z
+ ld hl, StatsScreenPals ; $54eb
+ ld b, $0
+ dec c
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld [wUnknBGPals], a
+ ld [wUnknBGPals + $10], a
+ ld a, [hl]
+ ld [wUnknBGPals + 1], a
+ ld [wUnknBGPals + $11], a
+ call Function9b28
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ret
+
+LoadMailPalettes:
+ ld l, e
+ ld h, $0
+ add hl, hl
+ add hl, hl
+ add hl, hl
+ ld de, .MailPals
+ add hl, de
+ call CheckCGB
+ jr nz, .asm_92ae
+ push hl
+ ld hl, PalPacket_a155
+ ld de, wcca9
+ ld bc, $10
+ call CopyBytes
+ pop hl
+ inc hl
+ inc hl
+ ld a, [hli]
+ ld [wccac], a
+ ld a, [hli]
+ ld [wccad], a
+ ld a, [hli]
+ ld [wccae], a
+ ld a, [hli]
+ ld [wccaf], a
+ ld hl, wcca9
+ call PushSGBPals_
+ ld hl, BlkPacket_9ee5
+ call PushSGBPals_
+ ret
+
+.asm_92ae
+ ld de, wUnknBGPals
+ ld bc, $8
+ call CopyBytes
+ call Function9b28
+ call Function9b1d
+ call Function9b35
+ ret
+
+.MailPals:
+ RGB 20, 31, 11
+ RGB 31, 19, 00
+ RGB 31, 10, 09
+ RGB 00, 00, 00
+
+ RGB 15, 20, 31
+ RGB 30, 26, 00
+ RGB 31, 12, 00
+ RGB 00, 00, 00
+
+ RGB 24, 17, 31
+ RGB 30, 26, 00
+ RGB 08, 11, 31
+ RGB 00, 00, 00
+
+ RGB 31, 25, 17
+ RGB 31, 18, 04
+ RGB 28, 12, 05
+ RGB 00, 00, 00
+
+ RGB 19, 26, 31
+ RGB 31, 05, 08
+ RGB 31, 09, 31
+ RGB 00, 00, 00
+
+ RGB 31, 19, 28
+ RGB 31, 21, 00
+ RGB 12, 22, 00
+ RGB 00, 00, 00
+
+ RGB 19, 17, 23
+ RGB 30, 26, 00
+ RGB 31, 12, 00
+ RGB 00, 00, 00
+
+ RGB 07, 26, 31
+ RGB 26, 26, 27
+ RGB 31, 11, 11
+ RGB 00, 00, 00
+
+ RGB 21, 31, 21
+ RGB 30, 26, 00
+ RGB 31, 12, 00
+ RGB 00, 00, 00
+
+ RGB 07, 26, 31
+ RGB 31, 31, 00
+ RGB 00, 21, 00
+ RGB 00, 00, 00
INCLUDE "predef/cgb.asm"
@@ -262,13 +439,21 @@ Function9ad2:
Function9adb:
dr $9adb, $9af1
Function9af1:
- dr $9af1, $9b1d
+ dr $9af1, $9b01
+Function9b01:
+ dr $9b01, $9b1d
Function9b1d:
dr $9b1d, $9b28
Function9b28:
- dr $9b28, $9b9c
+ dr $9b28, $9b35
+Function9b35:
+ dr $9b35, $9b75
+Function9b75:
+ dr $9b75, $9b9c
Function9b9c:
- dr $9b9c, $9be4
+ dr $9b9c, $9bda
+Function9bda:
+ dr $9bda, $9be4
Function9be4:
dr $9be4, $9c76
PushSGBPals_:
diff --git a/predef/cgb.asm b/predef/cgb.asm
index ed71d8be..96dea80e 100755
--- a/predef/cgb.asm
+++ b/predef/cgb.asm
@@ -1,4 +1,158 @@
CheckCGB:
- dr $9311, $9315
+ ld a, [hCGB]
+ and a
+ ret
+
Predef_LoadSGBLayoutCGB:
- dr $9315, $9a94
+ ld a, b
+ cp SCGB_RAM
+ jr nz, .asm_931d
+ ld a, [wColorLayoutPredefID]
+.asm_931d
+ cp SCGB_PARTY_MENU_HP_PALS
+ jp z, Function9b75
+ call Function9b01
+ 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, .return
+ 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
+ dw Function9a94
+ dw Function9a47
+ dw Function9502
+
+Function9376:
+ dr $9376, $9399
+
+Function9399:
+ dr $9399, $944a
+
+Function944a:
+ dr $944a, $945e
+
+Function945e:
+ dr $945e, $94eb
+
+StatsScreenPals:
+ dr $94eb, $94f1
+
+Function94f1:
+ dr $94f1, $9502
+
+Function9502:
+ dr $9502, $9561
+
+Function9561:
+ dr $9561, $95d5
+
+Function95d5:
+ dr $95d5, $9605
+
+Function9605:
+ dr $9605, $968d
+
+Function968d:
+ dr $968d, $96b7
+
+Function96b7:
+ dr $96b7, $9728
+
+Function9728:
+ dr $9728, $973e
+
+Function973e:
+ dr $973e, $9757
+
+Function9757:
+ dr $9757, $9760
+
+Function9760:
+ dr $9760, $976d
+
+Function976d:
+ dr $976d, $97af
+
+Function97af:
+ dr $97af, $97d4
+
+Function97d4:
+ dr $97d4, $97e1
+
+Function97e1:
+ dr $97e1, $9802
+
+Function9802:
+ dr $9802, $98be
+
+Function98be:
+ dr $98be, $98f1
+
+Function98f1:
+ dr $98f1, $9905
+
+Function9905:
+ dr $9905, $991e
+
+Function991e:
+ dr $991e, $999f
+
+Function999f:
+ dr $999f, $99d9
+
+Function99d9:
+ dr $99d9, $9a03
+
+Function9a03:
+ dr $9a03, $9a2e
+
+Function9a2e:
+ dr $9a2e, $9a47
+
+Function9a47:
+ dr $9a47, $9a5a
+
+Function9a5a:
+ dr $9a5a, $9a7b
+
+Function9a7b:
+ dr $9a7b, $9a94
diff --git a/predef/sgb.asm b/predef/sgb.asm
index c7a2b950..9a7bac3a 100755
--- a/predef/sgb.asm
+++ b/predef/sgb.asm
@@ -1,2 +1,148 @@
-Predef_LoadSGBLayout:
- dr $8c2d, $9052
+Predef_LoadSGBLayout: ; 8c2d (2:4c2d)
+ call CheckCGB
+ jp nz, Predef_LoadSGBLayoutCGB
+ ld a, b
+ cp SCGB_RAM
+ jr nz, .asm_8c3b
+ ld a, [wColorLayoutPredefID]
+.asm_8c3b
+ cp SCGB_PARTY_MENU_HP_PALS
+ jp z, SGB_ApplyPartyMenuHPPals
+ 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, FinishSGBPredefFunction
+ 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:
+ dr $8c90, $8c97
+
+Function8c97:
+ dr $8c97, $8d1f
+
+Function8d1f:
+ dr $8d1f, $8d3f
+
+Function8d3f:
+ dr $8d3f, $8d46
+
+Function8d46:
+ dr $8d46, $8d8e
+
+Function8d8e:
+ dr $8d8e, $8d95
+
+Function8d95:
+ dr $8d95, $8dcc
+
+Function8dcc:
+ dr $8dcc, $8dd3
+
+Function8dd3:
+ dr $8dd3, $8e0d
+
+Function8e0d:
+ dr $8e0d, $8e14
+
+Function8e14:
+ dr $8e14, $8e35
+
+Function8e35:
+ dr $8e35, $8e3c
+
+Function8e3c:
+ dr $8e3c, $8e43
+
+Function8e43:
+ dr $8e43, $8e4a
+
+Function8e4a:
+ dr $8e4a, $8e51
+
+Function8e51:
+ dr $8e51, $8e6e
+
+Function8e6e:
+ dr $8e6e, $8e7a
+
+Function8e7a:
+ dr $8e7a, $8e81
+
+Function8e81:
+ dr $8e81, $8e88
+
+Function8e88:
+ dr $8e88, $8e9b
+
+Function8e9b:
+ dr $8e9b, $8eb7
+
+Function8eb7:
+ dr $8eb7, $8f04
+
+Function8f04:
+ dr $8f04, $8f0b
+
+Function8f0b:
+ dr $8f0b, $8f12
+
+Function8f12:
+ dr $8f12, $8f53
+
+Function8f53:
+ dr $8f53, $8f90
+
+Function8f90:
+ dr $8f90, $8f97
+
+Function8f97:
+ dr $8f97, $8fc3
+
+Function8fc3:
+ dr $8fc3, $8fca
+
+Function8fca:
+ dr $8fca, $904a
+
+FinishSGBPredefFunction:
+ dr $904a, $9052
diff --git a/wram.asm b/wram.asm
index ea2daa37..98de8db9 100644
--- a/wram.asm
+++ b/wram.asm
@@ -1928,7 +1928,7 @@ wcc94:: ds 1 ; cc94
wcc95:: ds 1 ; cc95
wcc96:: ds 1 ; cc96
wcc97:: ds 1 ; cc97
-wcc98:: ds 1 ; cc98
+wColorLayoutPredefID:: ds 1 ; cc98
wcc99:: ds 1 ; cc99
wcc9a:: ds 1 ; cc9a
wcc9b:: ds 1 ; cc9b