SGB color mode stuff!

dark caves don't currently work correctly, need to look into a fix
This commit is contained in:
Zeta_Null 2024-07-21 16:57:20 -04:00
parent 1ecdf6d1d4
commit 6757a7652a
8 changed files with 102 additions and 14 deletions

View file

@ -531,10 +531,94 @@ _CGB_Diploma:
ret
_CGB_MapPals:
ld a, [wOptions2]
and 1 << MENU_ACCOUNT
jr z, .SGBmode
ld a, [wOptions2]
and 1 << MENU_ACCOUNT
jr nz, .GBCmode
ret
.GBCmode:
call LoadMapPals
ld a, SCGB_MAPPALS
ld [wDefaultSGBLayout], a
ret
.SGBmode:
; Get SGB palette
call SGBLayoutJumptable.GetMapPalsIndex
call GetPredefPal
ld de, wBGPals1
; Copy 7 BG palettes
ld b, 7
.bg_loop
call .LoadHLBGPaletteIntoDE
dec b
jr nz, .bg_loop
; Copy PAL_BG_TEXT and 6 OB palettes
ld b, 7
.ob_loop
call .LoadHLOBPaletteIntoDE
dec b
jr nz, .ob_loop
; Copy PAL_OW_TREE and PAL_OW_ROCK
call .LoadHLBGPaletteIntoDE
call .LoadHLBGPaletteIntoDE
ld a, SCGB_MAPPALS
ld [wDefaultSGBLayout], a
ret
.LoadHLBGPaletteIntoDE:
; morn/day: shades 0, 1, 2, 3 -> 0, 1, 2, 3
; nite: shades 0, 1, 2, 3 -> 1, 2, 2, 3
push hl
ld a, [wTimeOfDayPal]
cp NITE_F
jr c, .bg_morn_day
inc hl
inc hl
call .LoadHLColorIntoDE
call .LoadHLColorIntoDE
dec hl
dec hl
call .LoadHLColorIntoDE
call .LoadHLColorIntoDE
.bg_done
pop hl
ret
.bg_morn_day
call LoadHLPaletteIntoDE
jr .bg_done
.LoadHLOBPaletteIntoDE:
; shades 0, 1, 2, 3 -> 0, 0, 1, 3
push hl
call .LoadHLColorIntoDE
dec hl
dec hl
call .LoadHLColorIntoDE
call .LoadHLColorIntoDE
inc hl
inc hl
call .LoadHLColorIntoDE
pop hl
ret
.LoadHLColorIntoDE:
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ldh [rSVBK], a
rept PAL_COLOR_SIZE
ld a, [hli]
ld [de], a
inc de
endr
pop af
ldh [rSVBK], a
ret
_CGB_PartyMenu:
ld hl, PalPacket_PartyMenu + 1
@ -627,6 +711,8 @@ _CGB_UnownPuzzle:
ret
_CGB_TrainerCard:
ld a, [wOptions2]
and 1 << MENU_ACCOUNT
ld de, wBGPals1
xor a ; CHRIS
call GetTrainerPalettePointer