2018-03-13 12:07:16 +00:00
|
|
|
INCLUDE "engine/gfx/sgb_layouts.asm"
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2015-11-01 23:13:31 +00:00
|
|
|
SHINY_ATK_BIT EQU 5
|
|
|
|
SHINY_DEF_VAL EQU 10
|
|
|
|
SHINY_SPD_VAL EQU 10
|
|
|
|
SHINY_SPC_VAL EQU 10
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
CheckShininess:
|
2013-09-15 22:02:02 +00:00
|
|
|
; Check if a mon is shiny by DVs at bc.
|
|
|
|
; Return carry if shiny.
|
|
|
|
|
|
|
|
ld l, c
|
|
|
|
ld h, b
|
|
|
|
|
|
|
|
; Attack
|
|
|
|
ld a, [hl]
|
2015-11-01 23:13:31 +00:00
|
|
|
and 1 << SHINY_ATK_BIT
|
2020-10-26 19:45:57 +00:00
|
|
|
jr z, .not_shiny
|
2013-09-15 22:02:02 +00:00
|
|
|
|
|
|
|
; Defense
|
|
|
|
ld a, [hli]
|
2016-04-02 13:28:46 +00:00
|
|
|
and $f
|
2015-11-01 23:13:31 +00:00
|
|
|
cp SHINY_DEF_VAL
|
2020-10-26 19:45:57 +00:00
|
|
|
jr nz, .not_shiny
|
2013-09-15 22:02:02 +00:00
|
|
|
|
|
|
|
; Speed
|
|
|
|
ld a, [hl]
|
2016-04-02 13:28:46 +00:00
|
|
|
and $f0
|
2015-11-01 23:13:31 +00:00
|
|
|
cp SHINY_SPD_VAL << 4
|
2020-10-26 19:45:57 +00:00
|
|
|
jr nz, .not_shiny
|
2013-09-15 22:02:02 +00:00
|
|
|
|
|
|
|
; Special
|
|
|
|
ld a, [hl]
|
2016-04-02 13:28:46 +00:00
|
|
|
and $f
|
2015-11-01 23:13:31 +00:00
|
|
|
cp SHINY_SPC_VAL
|
2020-10-26 19:45:57 +00:00
|
|
|
jr nz, .not_shiny
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2020-10-26 19:45:57 +00:00
|
|
|
; shiny
|
2013-09-15 22:02:02 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2020-10-26 19:45:57 +00:00
|
|
|
.not_shiny
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-05 03:36:27 +00:00
|
|
|
Unused_CheckShininess:
|
|
|
|
; Return carry if the DVs at hl are all 10 or higher.
|
2013-09-15 22:02:02 +00:00
|
|
|
|
|
|
|
; Attack
|
|
|
|
ld a, [hl]
|
|
|
|
cp 10 << 4
|
2020-10-26 19:45:57 +00:00
|
|
|
jr c, .not_shiny
|
2013-09-15 22:02:02 +00:00
|
|
|
|
|
|
|
; Defense
|
|
|
|
ld a, [hli]
|
2016-04-02 13:28:46 +00:00
|
|
|
and $f
|
2013-09-15 22:02:02 +00:00
|
|
|
cp 10
|
2020-10-26 19:45:57 +00:00
|
|
|
jr c, .not_shiny
|
2013-09-15 22:02:02 +00:00
|
|
|
|
|
|
|
; Speed
|
|
|
|
ld a, [hl]
|
|
|
|
cp 10 << 4
|
2020-10-26 19:45:57 +00:00
|
|
|
jr c, .not_shiny
|
2013-09-15 22:02:02 +00:00
|
|
|
|
|
|
|
; Special
|
|
|
|
ld a, [hl]
|
2016-04-02 13:28:46 +00:00
|
|
|
and $f
|
2013-09-15 22:02:02 +00:00
|
|
|
cp 10
|
2020-10-26 19:45:57 +00:00
|
|
|
jr c, .not_shiny
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2020-10-26 19:45:57 +00:00
|
|
|
; shiny
|
2013-09-15 22:02:02 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2020-10-26 19:45:57 +00:00
|
|
|
.not_shiny
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2020-06-21 20:27:43 +00:00
|
|
|
SGB_ApplyCreditsPals: ; unreferenced
|
2013-09-15 22:02:02 +00:00
|
|
|
push de
|
|
|
|
push bc
|
2020-10-04 22:32:33 +00:00
|
|
|
ld hl, PalPacket_Pal01
|
2015-12-22 23:03:00 +00:00
|
|
|
ld de, wSGBPals
|
2015-11-16 21:01:45 +00:00
|
|
|
ld bc, PALPACKET_LENGTH
|
2013-09-15 22:02:02 +00:00
|
|
|
call CopyBytes
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
ld a, c
|
2015-12-22 23:03:00 +00:00
|
|
|
ld [wSGBPals + 3], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, b
|
2015-12-22 23:03:00 +00:00
|
|
|
ld [wSGBPals + 4], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, e
|
2015-12-22 23:03:00 +00:00
|
|
|
ld [wSGBPals + 5], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, d
|
2015-12-22 23:03:00 +00:00
|
|
|
ld [wSGBPals + 6], a
|
|
|
|
ld hl, wSGBPals
|
2018-07-23 04:13:43 +00:00
|
|
|
call PushSGBPals
|
2020-10-04 22:32:33 +00:00
|
|
|
ld hl, BlkPacket_AllPal0
|
2018-07-23 04:13:43 +00:00
|
|
|
call PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
InitPartyMenuPalettes:
|
2018-01-18 05:16:03 +00:00
|
|
|
ld hl, PalPacket_PartyMenu + 1
|
2015-10-21 14:43:42 +00:00
|
|
|
call CopyFourPalettes
|
2015-12-28 15:57:04 +00:00
|
|
|
call InitPartyMenuOBPals
|
2020-02-13 17:30:13 +00:00
|
|
|
call WipeAttrmap
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2020-07-04 20:18:16 +00:00
|
|
|
; SGB layout for SCGB_PARTY_MENU_HP_BARS
|
2018-06-24 14:09:41 +00:00
|
|
|
SGB_ApplyPartyMenuHPPals:
|
2015-12-23 03:19:33 +00:00
|
|
|
ld hl, wHPPals
|
2015-12-22 23:03:00 +00:00
|
|
|
ld a, [wSGBPals]
|
2013-09-15 22:02:02 +00:00
|
|
|
ld e, a
|
2020-11-09 20:17:03 +00:00
|
|
|
ld d, 0
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, de
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
ld a, [de]
|
|
|
|
and a
|
|
|
|
ld e, $5
|
2015-12-22 23:03:00 +00:00
|
|
|
jr z, .okay
|
2013-09-15 22:02:02 +00:00
|
|
|
dec a
|
|
|
|
ld e, $a
|
2015-12-22 23:03:00 +00:00
|
|
|
jr z, .okay
|
2013-09-15 22:02:02 +00:00
|
|
|
ld e, $f
|
2015-12-22 23:03:00 +00:00
|
|
|
.okay
|
2013-09-15 22:02:02 +00:00
|
|
|
push de
|
2015-12-22 23:03:00 +00:00
|
|
|
ld hl, wSGBPals + 10
|
2015-12-09 23:25:44 +00:00
|
|
|
ld bc, $6
|
2015-12-22 23:03:00 +00:00
|
|
|
ld a, [wSGBPals]
|
2013-09-15 22:02:02 +00:00
|
|
|
call AddNTimes
|
|
|
|
pop de
|
|
|
|
ld [hl], e
|
|
|
|
ret
|
|
|
|
|
2020-10-05 02:34:50 +00:00
|
|
|
Intro_LoadMagikarpPalettes: ; unreferenced
|
2013-09-15 22:02:02 +00:00
|
|
|
call CheckCGB
|
|
|
|
ret z
|
2020-10-28 17:35:39 +00:00
|
|
|
|
2016-05-05 19:07:37 +00:00
|
|
|
; CGB only
|
2020-10-30 20:12:25 +00:00
|
|
|
ld hl, .MagikarpBGPal
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wBGPals1
|
2015-12-09 23:25:44 +00:00
|
|
|
ld bc, 1 palettes
|
2018-01-04 19:53:50 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2013-09-15 22:02:02 +00:00
|
|
|
call FarCopyWRAM
|
|
|
|
|
2020-10-30 20:12:25 +00:00
|
|
|
ld hl, .MagikarpOBPal
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wOBPals1
|
2015-12-09 23:25:44 +00:00
|
|
|
ld bc, 1 palettes
|
2018-01-04 19:53:50 +00:00
|
|
|
ld a, BANK(wOBPals1)
|
2013-09-15 22:02:02 +00:00
|
|
|
call FarCopyWRAM
|
|
|
|
|
2015-12-17 02:57:42 +00:00
|
|
|
call ApplyPals
|
2020-08-03 21:41:01 +00:00
|
|
|
ld a, TRUE
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hCGBPalUpdate], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2020-10-30 20:12:25 +00:00
|
|
|
.MagikarpBGPal:
|
|
|
|
INCLUDE "gfx/intro/gs_magikarp_bg.pal"
|
|
|
|
|
|
|
|
.MagikarpOBPal:
|
|
|
|
INCLUDE "gfx/intro/gs_magikarp_ob.pal"
|
2015-12-09 23:25:44 +00:00
|
|
|
|
2020-10-05 02:34:50 +00:00
|
|
|
Intro_LoadAllPal0: ; unreferenced
|
2013-09-15 22:02:02 +00:00
|
|
|
call CheckCGB
|
|
|
|
ret nz
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hSGB]
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2020-10-04 22:32:33 +00:00
|
|
|
ld hl, BlkPacket_AllPal0
|
2018-07-23 04:13:43 +00:00
|
|
|
jp PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2020-10-05 02:34:50 +00:00
|
|
|
Intro_LoadBetaIntroVenusaurPalettes: ; unreferenced
|
2013-09-15 22:02:02 +00:00
|
|
|
call CheckCGB
|
2016-01-04 13:43:55 +00:00
|
|
|
jr nz, .cgb
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hSGB]
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2018-06-01 06:11:44 +00:00
|
|
|
ld hl, PalPacket_BetaIntroVenusaur
|
2018-07-23 04:13:43 +00:00
|
|
|
jp PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-01-04 13:43:55 +00:00
|
|
|
.cgb
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wOBPals1
|
2018-06-01 06:11:44 +00:00
|
|
|
ld a, PREDEFPAL_BETA_INTRO_VENUSAUR
|
2015-12-22 23:03:00 +00:00
|
|
|
call GetPredefPal
|
2015-10-21 14:43:42 +00:00
|
|
|
jp LoadHLPaletteIntoDE
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2020-10-05 02:34:50 +00:00
|
|
|
Intro_LoadPackPalettes: ; unreferenced
|
2013-09-15 22:02:02 +00:00
|
|
|
call CheckCGB
|
2016-01-04 13:43:55 +00:00
|
|
|
jr nz, .cgb
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hSGB]
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
|
|
|
ret z
|
2018-01-18 05:16:03 +00:00
|
|
|
ld hl, PalPacket_Pack
|
2018-07-23 04:13:43 +00:00
|
|
|
jp PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-01-04 13:43:55 +00:00
|
|
|
.cgb
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wOBPals1
|
2018-01-18 20:06:43 +00:00
|
|
|
ld a, PREDEFPAL_PACK
|
2015-12-22 23:03:00 +00:00
|
|
|
call GetPredefPal
|
2015-10-21 14:43:42 +00:00
|
|
|
jp LoadHLPaletteIntoDE
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2020-06-21 20:27:43 +00:00
|
|
|
GSIntro_LoadMonPalette: ; unreferenced
|
2013-09-15 22:02:02 +00:00
|
|
|
call CheckCGB
|
2016-05-11 13:49:03 +00:00
|
|
|
jr nz, .cgb
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hSGB]
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
ld a, c
|
|
|
|
push af
|
2020-10-04 22:32:33 +00:00
|
|
|
ld hl, PalPacket_Pal01
|
2015-12-22 23:03:00 +00:00
|
|
|
ld de, wSGBPals
|
2015-11-16 21:01:45 +00:00
|
|
|
ld bc, PALPACKET_LENGTH
|
2013-09-15 22:02:02 +00:00
|
|
|
call CopyBytes
|
|
|
|
pop af
|
2018-07-23 04:13:43 +00:00
|
|
|
call GetMonPalettePointer
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
2015-12-22 23:03:00 +00:00
|
|
|
ld [wSGBPals + 3], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
2015-12-22 23:03:00 +00:00
|
|
|
ld [wSGBPals + 4], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
2015-12-22 23:03:00 +00:00
|
|
|
ld [wSGBPals + 5], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hl]
|
2015-12-22 23:03:00 +00:00
|
|
|
ld [wSGBPals + 6], a
|
|
|
|
ld hl, wSGBPals
|
2018-07-23 04:13:43 +00:00
|
|
|
jp PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
.cgb
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wOBPals1
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, c
|
2018-07-23 04:13:43 +00:00
|
|
|
call GetMonPalettePointer
|
2015-12-17 02:57:42 +00:00
|
|
|
call LoadPalette_White_Col1_Col2_Black
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
LoadTrainerClassPaletteAsNthBGPal:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wTrainerClass]
|
2015-12-17 02:57:42 +00:00
|
|
|
call GetTrainerPalettePointer
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, e
|
2020-04-04 21:46:36 +00:00
|
|
|
jr LoadNthMiddleBGPal
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
LoadMonPaletteAsNthBGPal:
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartySpecies]
|
2018-07-23 04:13:43 +00:00
|
|
|
call _GetMonPalettePointer
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, e
|
|
|
|
bit 7, a
|
2020-04-04 21:46:36 +00:00
|
|
|
jr z, LoadNthMiddleBGPal
|
2013-09-15 22:02:02 +00:00
|
|
|
and $7f
|
|
|
|
inc hl
|
2016-05-11 13:49:03 +00:00
|
|
|
inc hl
|
|
|
|
inc hl
|
|
|
|
inc hl
|
2015-02-06 07:59:50 +00:00
|
|
|
|
2020-04-04 21:46:36 +00:00
|
|
|
LoadNthMiddleBGPal:
|
2013-09-15 22:02:02 +00:00
|
|
|
push hl
|
2018-01-01 14:08:21 +00:00
|
|
|
ld hl, wBGPals1
|
2016-05-11 13:49:03 +00:00
|
|
|
ld de, 1 palettes
|
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
2016-05-11 13:49:03 +00:00
|
|
|
jr z, .got_addr
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, de
|
|
|
|
dec a
|
2016-05-11 13:49:03 +00:00
|
|
|
jr .loop
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
.got_addr
|
2013-09-15 22:02:02 +00:00
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
pop hl
|
2015-12-17 02:57:42 +00:00
|
|
|
call LoadPalette_White_Col1_Col2_Black
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2020-10-05 02:34:50 +00:00
|
|
|
LoadBetaPokerPalettes: ; unreferenced
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hCGB]
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
2016-05-11 13:49:03 +00:00
|
|
|
jr nz, .cgb
|
2020-05-18 00:59:15 +00:00
|
|
|
ld hl, wBetaPokerSGBPals
|
2018-07-23 04:13:43 +00:00
|
|
|
jp PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
.cgb
|
2020-05-18 00:59:15 +00:00
|
|
|
ld a, [wBetaPokerSGBCol]
|
2013-09-15 22:02:02 +00:00
|
|
|
ld c, a
|
2020-05-18 00:59:15 +00:00
|
|
|
ld a, [wBetaPokerSGBRow]
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2016-05-11 13:49:03 +00:00
|
|
|
ld de, SCREEN_WIDTH
|
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
2016-05-11 13:49:03 +00:00
|
|
|
jr z, .done
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, de
|
|
|
|
dec a
|
2016-05-11 13:49:03 +00:00
|
|
|
jr .loop
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
.done
|
2020-05-18 00:59:15 +00:00
|
|
|
ld b, 0
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, bc
|
2015-10-21 14:43:42 +00:00
|
|
|
lb bc, 6, 4
|
2020-05-18 00:59:15 +00:00
|
|
|
ld a, [wBetaPokerSGBAttr]
|
2013-09-15 22:02:02 +00:00
|
|
|
and $3
|
2015-11-13 05:49:27 +00:00
|
|
|
call FillBoxCGB
|
2017-12-24 23:11:17 +00:00
|
|
|
call CopyTilemapAtOnce
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
ApplyMonOrTrainerPals:
|
2013-09-15 22:02:02 +00:00
|
|
|
call CheckCGB
|
|
|
|
ret z
|
|
|
|
ld a, e
|
|
|
|
and a
|
2015-12-26 23:11:55 +00:00
|
|
|
jr z, .get_trainer
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartySpecies]
|
2018-07-23 04:13:43 +00:00
|
|
|
call GetMonPalettePointer
|
2015-12-26 23:11:55 +00:00
|
|
|
jr .load_palettes
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2015-12-26 23:11:55 +00:00
|
|
|
.get_trainer
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wTrainerClass]
|
2015-12-17 02:57:42 +00:00
|
|
|
call GetTrainerPalettePointer
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2015-12-26 23:11:55 +00:00
|
|
|
.load_palettes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wBGPals1
|
2015-12-17 02:57:42 +00:00
|
|
|
call LoadPalette_White_Col1_Col2_Black
|
2020-02-13 17:30:13 +00:00
|
|
|
call WipeAttrmap
|
|
|
|
call ApplyAttrmap
|
2015-12-17 02:57:42 +00:00
|
|
|
call ApplyPals
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
ApplyHPBarPals:
|
2015-12-26 23:11:55 +00:00
|
|
|
ld a, [wWhichHPBar]
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
2015-12-26 23:11:55 +00:00
|
|
|
jr z, .Enemy
|
2013-09-15 22:02:02 +00:00
|
|
|
cp $1
|
2015-12-26 23:11:55 +00:00
|
|
|
jr z, .Player
|
2013-09-15 22:02:02 +00:00
|
|
|
cp $2
|
2015-12-26 23:11:55 +00:00
|
|
|
jr z, .PartyMenu
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Enemy:
|
2018-01-23 00:40:17 +00:00
|
|
|
ld de, wBGPals2 palette PAL_BATTLE_BG_ENEMY_HP color 1
|
2015-12-26 23:11:55 +00:00
|
|
|
jr .okay
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Player:
|
2018-01-23 00:40:17 +00:00
|
|
|
ld de, wBGPals2 palette PAL_BATTLE_BG_PLAYER_HP color 1
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2015-12-26 23:11:55 +00:00
|
|
|
.okay
|
2013-09-15 22:02:02 +00:00
|
|
|
ld l, c
|
|
|
|
ld h, $0
|
|
|
|
add hl, hl
|
2015-12-27 02:59:03 +00:00
|
|
|
add hl, hl
|
2017-12-16 03:36:33 +00:00
|
|
|
ld bc, HPBarPals
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, bc
|
2015-12-26 23:11:55 +00:00
|
|
|
ld bc, 4
|
2018-01-04 19:53:50 +00:00
|
|
|
ld a, BANK(wBGPals2)
|
2013-09-15 22:02:02 +00:00
|
|
|
call FarCopyWRAM
|
2020-08-03 21:41:01 +00:00
|
|
|
ld a, TRUE
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hCGBPalUpdate], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.PartyMenu:
|
2013-09-15 22:02:02 +00:00
|
|
|
ld e, c
|
|
|
|
inc e
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 11, 1, wAttrmap
|
2015-12-26 23:11:55 +00:00
|
|
|
ld bc, 2 * SCREEN_WIDTH
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wCurPartyMon]
|
2015-12-26 23:11:55 +00:00
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
2015-12-26 23:11:55 +00:00
|
|
|
jr z, .done
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, bc
|
|
|
|
dec a
|
2015-12-26 23:11:55 +00:00
|
|
|
jr .loop
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2015-12-26 23:11:55 +00:00
|
|
|
.done
|
2015-10-21 14:43:42 +00:00
|
|
|
lb bc, 2, 8
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, e
|
2015-11-13 05:49:27 +00:00
|
|
|
call FillBoxCGB
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
LoadStatsScreenPals:
|
2013-09-15 22:02:02 +00:00
|
|
|
call CheckCGB
|
|
|
|
ret z
|
2015-12-23 03:19:33 +00:00
|
|
|
ld hl, StatsScreenPals
|
2014-03-02 21:02:55 +00:00
|
|
|
ld b, 0
|
2013-09-15 22:02:02 +00:00
|
|
|
dec c
|
|
|
|
add hl, bc
|
2015-12-27 02:59:03 +00:00
|
|
|
add hl, bc
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rSVBK]
|
2013-09-15 22:02:02 +00:00
|
|
|
push af
|
2018-01-04 00:12:45 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
2018-01-01 14:08:21 +00:00
|
|
|
ld [wBGPals1 palette 0], a
|
|
|
|
ld [wBGPals1 palette 2], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hl]
|
2018-01-01 14:08:21 +00:00
|
|
|
ld [wBGPals1 palette 0 + 1], a
|
|
|
|
ld [wBGPals1 palette 2 + 1], a
|
2013-09-15 22:02:02 +00:00
|
|
|
pop af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2015-12-17 02:57:42 +00:00
|
|
|
call ApplyPals
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $1
|
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
LoadMailPalettes:
|
2013-09-15 22:02:02 +00:00
|
|
|
ld l, e
|
2014-03-02 21:02:55 +00:00
|
|
|
ld h, 0
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, hl
|
2016-05-10 16:31:49 +00:00
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
2016-05-11 13:49:03 +00:00
|
|
|
ld de, .MailPals
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, de
|
|
|
|
call CheckCGB
|
2016-05-11 13:49:03 +00:00
|
|
|
jr nz, .cgb
|
2013-09-15 22:02:02 +00:00
|
|
|
push hl
|
2020-10-04 22:32:33 +00:00
|
|
|
ld hl, PalPacket_Pal01
|
2015-12-22 23:03:00 +00:00
|
|
|
ld de, wSGBPals
|
2015-11-16 21:01:45 +00:00
|
|
|
ld bc, PALPACKET_LENGTH
|
2013-09-15 22:02:02 +00:00
|
|
|
call CopyBytes
|
|
|
|
pop hl
|
|
|
|
inc hl
|
2015-12-27 02:59:03 +00:00
|
|
|
inc hl
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
2015-12-22 23:03:00 +00:00
|
|
|
ld [wSGBPals + 3], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
2015-12-22 23:03:00 +00:00
|
|
|
ld [wSGBPals + 4], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
2015-12-22 23:03:00 +00:00
|
|
|
ld [wSGBPals + 5], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
2015-12-22 23:03:00 +00:00
|
|
|
ld [wSGBPals + 6], a
|
|
|
|
ld hl, wSGBPals
|
2018-07-23 04:13:43 +00:00
|
|
|
call PushSGBPals
|
2020-10-04 22:32:33 +00:00
|
|
|
ld hl, BlkPacket_AllPal0
|
2018-07-23 04:13:43 +00:00
|
|
|
call PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
.cgb
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wBGPals1
|
2015-12-09 23:25:44 +00:00
|
|
|
ld bc, 1 palettes
|
2018-01-04 19:53:50 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2013-09-15 22:02:02 +00:00
|
|
|
call FarCopyWRAM
|
2015-12-17 02:57:42 +00:00
|
|
|
call ApplyPals
|
2020-02-13 17:30:13 +00:00
|
|
|
call WipeAttrmap
|
|
|
|
call ApplyAttrmap
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
.MailPals:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/mail/mail.pal"
|
2015-12-09 23:25:44 +00:00
|
|
|
|
2018-03-13 12:07:16 +00:00
|
|
|
INCLUDE "engine/gfx/cgb_layouts.asm"
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
CopyFourPalettes:
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wBGPals1
|
2018-01-15 06:10:56 +00:00
|
|
|
ld c, 4
|
2013-12-24 22:11:52 +00:00
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
CopyPalettes:
|
2015-10-21 14:43:42 +00:00
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
push bc
|
|
|
|
ld a, [hli]
|
|
|
|
push hl
|
2015-12-22 23:03:00 +00:00
|
|
|
call GetPredefPal
|
2015-10-21 14:43:42 +00:00
|
|
|
call LoadHLPaletteIntoDE
|
2013-09-15 22:02:02 +00:00
|
|
|
pop hl
|
|
|
|
inc hl
|
|
|
|
pop bc
|
|
|
|
dec c
|
2015-10-21 14:43:42 +00:00
|
|
|
jr nz, .loop
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
GetPredefPal:
|
2013-09-15 22:02:02 +00:00
|
|
|
ld l, a
|
2020-11-09 20:17:03 +00:00
|
|
|
ld h, 0
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, hl
|
2016-05-05 19:07:37 +00:00
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
2017-12-16 03:36:33 +00:00
|
|
|
ld bc, PredefPals
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, bc
|
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
LoadHLPaletteIntoDE:
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rSVBK]
|
2013-09-15 22:02:02 +00:00
|
|
|
push af
|
2018-01-04 00:12:45 +00:00
|
|
|
ld a, BANK(wOBPals1)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2018-01-27 02:25:49 +00:00
|
|
|
ld c, 1 palettes
|
2015-10-21 14:43:42 +00:00
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
2015-10-21 14:43:42 +00:00
|
|
|
jr nz, .loop
|
2013-09-15 22:02:02 +00:00
|
|
|
pop af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
LoadPalette_White_Col1_Col2_Black:
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rSVBK]
|
2013-09-15 22:02:02 +00:00
|
|
|
push af
|
2018-01-04 00:12:45 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2015-12-17 02:57:42 +00:00
|
|
|
|
2018-01-18 16:16:24 +00:00
|
|
|
ld a, LOW(PALRGB_WHITE)
|
2013-09-15 22:02:02 +00:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
2018-01-18 16:16:24 +00:00
|
|
|
ld a, HIGH(PALRGB_WHITE)
|
2013-09-15 22:02:02 +00:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-17 02:57:42 +00:00
|
|
|
|
2018-01-23 00:40:17 +00:00
|
|
|
ld c, 2 * PAL_COLOR_SIZE
|
2015-10-21 14:43:42 +00:00
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
2015-10-21 14:43:42 +00:00
|
|
|
jr nz, .loop
|
2015-12-17 02:57:42 +00:00
|
|
|
|
2013-09-15 22:02:02 +00:00
|
|
|
xor a
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-17 02:57:42 +00:00
|
|
|
|
2013-09-15 22:02:02 +00:00
|
|
|
pop af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
FillBoxCGB:
|
2015-10-21 14:43:42 +00:00
|
|
|
.row
|
2013-09-15 22:02:02 +00:00
|
|
|
push bc
|
|
|
|
push hl
|
2015-10-21 14:43:42 +00:00
|
|
|
.col
|
2013-09-15 22:02:02 +00:00
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-10-21 14:43:42 +00:00
|
|
|
jr nz, .col
|
2013-09-15 22:02:02 +00:00
|
|
|
pop hl
|
2015-10-21 14:43:42 +00:00
|
|
|
ld bc, SCREEN_WIDTH
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-10-21 14:43:42 +00:00
|
|
|
jr nz, .row
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
ResetBGPals:
|
2013-09-15 22:02:02 +00:00
|
|
|
push af
|
|
|
|
push bc
|
|
|
|
push de
|
|
|
|
push hl
|
2016-05-11 13:49:03 +00:00
|
|
|
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rSVBK]
|
2013-09-15 22:02:02 +00:00
|
|
|
push af
|
2018-01-04 00:12:45 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2016-05-11 13:49:03 +00:00
|
|
|
|
2018-01-01 14:08:21 +00:00
|
|
|
ld hl, wBGPals1
|
2017-12-25 17:41:31 +00:00
|
|
|
ld c, 1 palettes
|
2015-11-20 20:15:32 +00:00
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $ff
|
|
|
|
ld [hli], a
|
2016-05-11 13:49:03 +00:00
|
|
|
ld [hli], a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hli], a
|
2013-09-15 22:02:02 +00:00
|
|
|
xor a
|
|
|
|
ld [hli], a
|
2016-05-11 13:49:03 +00:00
|
|
|
ld [hli], a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hli], a
|
2013-09-15 22:02:02 +00:00
|
|
|
dec c
|
2015-11-20 20:15:32 +00:00
|
|
|
jr nz, .loop
|
2016-05-11 13:49:03 +00:00
|
|
|
|
2013-09-15 22:02:02 +00:00
|
|
|
pop af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2016-05-11 13:49:03 +00:00
|
|
|
|
2013-09-15 22:02:02 +00:00
|
|
|
pop hl
|
|
|
|
pop de
|
|
|
|
pop bc
|
|
|
|
pop af
|
|
|
|
ret
|
|
|
|
|
2020-02-13 17:30:13 +00:00
|
|
|
WipeAttrmap:
|
|
|
|
hlcoord 0, 0, wAttrmap
|
2015-07-22 19:57:02 +00:00
|
|
|
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
|
2013-09-15 22:02:02 +00:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
ApplyPals:
|
2018-01-01 14:08:21 +00:00
|
|
|
ld hl, wBGPals1
|
|
|
|
ld de, wBGPals2
|
2015-12-09 23:25:44 +00:00
|
|
|
ld bc, 16 palettes
|
2018-01-30 19:05:25 +00:00
|
|
|
ld a, BANK(wGBCPalettes)
|
2013-09-15 22:02:02 +00:00
|
|
|
call FarCopyWRAM
|
|
|
|
ret
|
|
|
|
|
2020-02-13 17:30:13 +00:00
|
|
|
ApplyAttrmap:
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rLCDC]
|
2017-12-29 17:53:21 +00:00
|
|
|
bit rLCDC_ENABLE, a
|
2015-12-17 02:57:42 +00:00
|
|
|
jr z, .UpdateVBank1
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hBGMapMode]
|
2013-09-15 22:02:02 +00:00
|
|
|
push af
|
|
|
|
ld a, $2
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2013-09-15 22:02:02 +00:00
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
pop af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.UpdateVBank1:
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2015-11-20 16:47:52 +00:00
|
|
|
debgcoord 0, 0
|
2015-12-17 02:57:42 +00:00
|
|
|
ld b, SCREEN_HEIGHT
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $1
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rVBK], a
|
2015-12-17 02:57:42 +00:00
|
|
|
.row
|
|
|
|
ld c, SCREEN_WIDTH
|
|
|
|
.col
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
2015-12-17 02:57:42 +00:00
|
|
|
jr nz, .col
|
|
|
|
ld a, BG_MAP_WIDTH - SCREEN_WIDTH
|
2013-09-15 22:02:02 +00:00
|
|
|
add e
|
2015-12-17 02:57:42 +00:00
|
|
|
jr nc, .okay
|
2013-09-15 22:02:02 +00:00
|
|
|
inc d
|
2015-12-17 02:57:42 +00:00
|
|
|
.okay
|
2013-09-15 22:02:02 +00:00
|
|
|
ld e, a
|
|
|
|
dec b
|
2015-12-17 02:57:42 +00:00
|
|
|
jr nz, .row
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $0
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rVBK], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2020-07-04 20:18:16 +00:00
|
|
|
; CGB layout for SCGB_PARTY_MENU_HP_BARS
|
2018-06-24 14:09:41 +00:00
|
|
|
CGB_ApplyPartyMenuHPPals:
|
2015-12-23 03:19:33 +00:00
|
|
|
ld hl, wHPPals
|
2015-12-22 23:03:00 +00:00
|
|
|
ld a, [wSGBPals]
|
2013-09-15 22:02:02 +00:00
|
|
|
ld e, a
|
2020-11-09 20:17:03 +00:00
|
|
|
ld d, 0
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, de
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
ld a, [de]
|
|
|
|
inc a
|
|
|
|
ld e, a
|
2020-02-13 17:30:13 +00:00
|
|
|
hlcoord 11, 2, wAttrmap
|
2015-12-23 03:19:33 +00:00
|
|
|
ld bc, 2 * SCREEN_WIDTH
|
2015-12-22 23:03:00 +00:00
|
|
|
ld a, [wSGBPals]
|
2015-12-23 03:19:33 +00:00
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
2015-12-23 03:19:33 +00:00
|
|
|
jr z, .done
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, bc
|
|
|
|
dec a
|
2015-12-23 03:19:33 +00:00
|
|
|
jr .loop
|
|
|
|
.done
|
2015-10-21 14:43:42 +00:00
|
|
|
lb bc, 2, 8
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, e
|
2015-11-13 05:49:27 +00:00
|
|
|
call FillBoxCGB
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
InitPartyMenuOBPals:
|
2017-12-16 03:36:33 +00:00
|
|
|
ld hl, PartyMenuOBPals
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wOBPals1
|
2015-12-09 23:25:44 +00:00
|
|
|
ld bc, 2 palettes
|
2018-01-04 19:53:50 +00:00
|
|
|
ld a, BANK(wOBPals1)
|
2013-09-15 22:02:02 +00:00
|
|
|
call FarCopyWRAM
|
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
GetBattlemonBackpicPalettePointer:
|
2013-09-15 22:02:02 +00:00
|
|
|
push de
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GetPartyMonDVs
|
2013-09-15 22:02:02 +00:00
|
|
|
ld c, l
|
|
|
|
ld b, h
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wTempBattleMonSpecies]
|
2015-12-17 02:57:42 +00:00
|
|
|
call GetPlayerOrMonPalettePointer
|
2013-09-15 22:02:02 +00:00
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
GetEnemyFrontpicPalettePointer:
|
2013-09-15 22:02:02 +00:00
|
|
|
push de
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall GetEnemyMonDVs
|
2013-09-15 22:02:02 +00:00
|
|
|
ld c, l
|
|
|
|
ld b, h
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wTempEnemyMonSpecies]
|
2015-12-17 02:57:42 +00:00
|
|
|
call GetFrontpicPalettePointer
|
2013-09-15 22:02:02 +00:00
|
|
|
pop de
|
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
GetPlayerOrMonPalettePointer:
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
2015-12-17 02:57:42 +00:00
|
|
|
jp nz, GetMonNormalOrShinyPalettePointer
|
2015-10-24 14:34:19 +00:00
|
|
|
ld a, [wPlayerSpriteSetupFlags]
|
2018-01-22 19:34:55 +00:00
|
|
|
bit PLAYERSPRITESETUP_FEMALE_TO_MALE_F, a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr nz, .male
|
2017-12-28 12:15:46 +00:00
|
|
|
ld a, [wPlayerGender]
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
2015-10-24 14:34:19 +00:00
|
|
|
jr z, .male
|
2014-03-02 02:43:16 +00:00
|
|
|
ld hl, KrisPalette
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2015-10-24 14:34:19 +00:00
|
|
|
.male
|
2018-02-05 03:45:04 +00:00
|
|
|
ld hl, PlayerPalette
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
GetFrontpicPalettePointer:
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
2015-12-17 02:57:42 +00:00
|
|
|
jp nz, GetMonNormalOrShinyPalettePointer
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wTrainerClass]
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
GetTrainerPalettePointer:
|
2013-09-15 22:02:02 +00:00
|
|
|
ld l, a
|
2014-03-02 02:43:16 +00:00
|
|
|
ld h, 0
|
2016-05-11 13:49:03 +00:00
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
2014-03-02 02:43:16 +00:00
|
|
|
ld bc, TrainerPalettes
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, bc
|
|
|
|
ret
|
|
|
|
|
2018-07-23 04:13:43 +00:00
|
|
|
GetMonPalettePointer:
|
|
|
|
call _GetMonPalettePointer
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2020-10-05 20:15:57 +00:00
|
|
|
CGBCopyBattleObjectPals: ; unreferenced
|
|
|
|
; dummied out
|
2018-01-02 19:00:14 +00:00
|
|
|
ret
|
2014-03-02 02:43:16 +00:00
|
|
|
call CheckCGB
|
|
|
|
ret z
|
2017-12-25 17:41:31 +00:00
|
|
|
ld hl, BattleObjectPals
|
2020-10-05 20:15:57 +00:00
|
|
|
ld a, (1 << rOBPI_AUTO_INCREMENT) | $10
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rOBPI], a
|
2015-12-17 02:57:42 +00:00
|
|
|
ld c, 6 palettes
|
|
|
|
.loop
|
2014-03-02 02:43:16 +00:00
|
|
|
ld a, [hli]
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rOBPD], a
|
2014-03-02 02:43:16 +00:00
|
|
|
dec c
|
2015-12-17 02:57:42 +00:00
|
|
|
jr nz, .loop
|
2017-12-25 17:41:31 +00:00
|
|
|
ld hl, BattleObjectPals
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wOBPals1 palette 2
|
2015-12-09 23:25:44 +00:00
|
|
|
ld bc, 2 palettes
|
2018-01-04 19:53:50 +00:00
|
|
|
ld a, BANK(wOBPals1)
|
2014-03-02 02:43:16 +00:00
|
|
|
call FarCopyWRAM
|
|
|
|
ret
|
|
|
|
|
2017-12-25 17:41:31 +00:00
|
|
|
BattleObjectPals:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/battle_anims/battle_anims.pal"
|
2015-12-09 23:25:44 +00:00
|
|
|
|
2020-10-06 00:10:01 +00:00
|
|
|
CGBCopyTwoPredefObjectPals: ; unreferenced
|
2014-03-02 02:43:16 +00:00
|
|
|
call CheckCGB
|
|
|
|
ret z
|
2020-10-05 20:15:57 +00:00
|
|
|
ld a, (1 << rOBPI_AUTO_INCREMENT) | $10
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rOBPI], a
|
2018-01-18 05:16:03 +00:00
|
|
|
ld a, PREDEFPAL_TRADE_TUBE
|
2015-12-22 23:03:00 +00:00
|
|
|
call GetPredefPal
|
2016-05-11 13:49:03 +00:00
|
|
|
call .PushPalette
|
2018-01-18 17:31:19 +00:00
|
|
|
ld a, PREDEFPAL_RB_GREENMON
|
2015-12-22 23:03:00 +00:00
|
|
|
call GetPredefPal
|
2016-05-11 13:49:03 +00:00
|
|
|
call .PushPalette
|
2014-03-02 02:43:16 +00:00
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
.PushPalette:
|
2015-12-17 02:57:42 +00:00
|
|
|
ld c, 1 palettes
|
2015-10-21 14:43:42 +00:00
|
|
|
.loop
|
2014-03-02 02:43:16 +00:00
|
|
|
ld a, [hli]
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rOBPD], a
|
2014-03-02 02:43:16 +00:00
|
|
|
dec c
|
2015-10-21 14:43:42 +00:00
|
|
|
jr nz, .loop
|
2014-03-02 02:43:16 +00:00
|
|
|
ret
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2018-07-23 04:13:43 +00:00
|
|
|
_GetMonPalettePointer:
|
2013-09-15 22:02:02 +00:00
|
|
|
ld l, a
|
2020-11-09 20:17:03 +00:00
|
|
|
ld h, 0
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, hl
|
2016-05-10 16:31:49 +00:00
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
2015-02-07 05:07:35 +00:00
|
|
|
ld bc, PokemonPalettes
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, bc
|
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
GetMonNormalOrShinyPalettePointer:
|
2013-09-15 22:02:02 +00:00
|
|
|
push bc
|
2018-07-23 04:13:43 +00:00
|
|
|
call _GetMonPalettePointer
|
2013-09-15 22:02:02 +00:00
|
|
|
pop bc
|
|
|
|
push hl
|
|
|
|
call CheckShininess
|
|
|
|
pop hl
|
|
|
|
ret nc
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 4
|
2013-09-15 22:02:02 +00:00
|
|
|
inc hl
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2018-07-23 04:13:43 +00:00
|
|
|
PushSGBPals:
|
2020-10-28 17:35:39 +00:00
|
|
|
ld a, [wJoypadDisable]
|
2013-09-15 22:02:02 +00:00
|
|
|
push af
|
2020-10-28 17:35:39 +00:00
|
|
|
set JOYPAD_DISABLE_SGB_TRANSFER_F, a
|
|
|
|
ld [wJoypadDisable], a
|
2018-07-23 04:13:43 +00:00
|
|
|
call _PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
pop af
|
2020-10-28 17:35:39 +00:00
|
|
|
ld [wJoypadDisable], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2018-07-23 04:13:43 +00:00
|
|
|
_PushSGBPals:
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hl]
|
|
|
|
and $7
|
|
|
|
ret z
|
|
|
|
ld b, a
|
2015-10-21 14:43:42 +00:00
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
push bc
|
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rJOYP], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $30
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rJOYP], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld b, $10
|
2015-10-21 14:43:42 +00:00
|
|
|
.loop2
|
2013-09-15 22:02:02 +00:00
|
|
|
ld e, $8
|
|
|
|
ld a, [hli]
|
|
|
|
ld d, a
|
2015-10-21 14:43:42 +00:00
|
|
|
.loop3
|
2013-09-15 22:02:02 +00:00
|
|
|
bit 0, d
|
|
|
|
ld a, $10
|
2015-10-21 14:43:42 +00:00
|
|
|
jr nz, .okay
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $20
|
2015-10-21 14:43:42 +00:00
|
|
|
.okay
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rJOYP], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $30
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rJOYP], a
|
2013-09-15 22:02:02 +00:00
|
|
|
rr d
|
|
|
|
dec e
|
2015-10-21 14:43:42 +00:00
|
|
|
jr nz, .loop3
|
2013-09-15 22:02:02 +00:00
|
|
|
dec b
|
2015-10-21 14:43:42 +00:00
|
|
|
jr nz, .loop2
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $20
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rJOYP], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $30
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rJOYP], a
|
2015-12-23 03:19:33 +00:00
|
|
|
call SGBDelayCycles
|
2013-09-15 22:02:02 +00:00
|
|
|
pop bc
|
|
|
|
dec b
|
2015-10-21 14:43:42 +00:00
|
|
|
jr nz, .loop
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2018-01-16 19:30:10 +00:00
|
|
|
InitSGBBorder:
|
2013-09-15 22:02:02 +00:00
|
|
|
call CheckCGB
|
|
|
|
ret nz
|
2020-10-28 17:35:39 +00:00
|
|
|
|
2016-05-05 19:07:37 +00:00
|
|
|
; SGB/DMG only
|
2013-09-15 22:02:02 +00:00
|
|
|
di
|
2020-10-28 17:35:39 +00:00
|
|
|
ld a, [wJoypadDisable]
|
2013-09-15 22:02:02 +00:00
|
|
|
push af
|
2020-10-28 17:35:39 +00:00
|
|
|
set JOYPAD_DISABLE_SGB_TRANSFER_F, a
|
|
|
|
ld [wJoypadDisable], a
|
|
|
|
|
2013-09-15 22:02:02 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rJOYP], a
|
|
|
|
ldh [hSGB], a
|
2016-05-11 13:49:03 +00:00
|
|
|
call PushSGBBorderPalsAndWait
|
2016-05-05 19:07:37 +00:00
|
|
|
jr nc, .skip
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $1
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hSGB], a
|
2016-05-11 13:49:03 +00:00
|
|
|
call _InitSGBBorderPals
|
|
|
|
call SGBBorder_PushBGPals
|
2015-12-23 03:19:33 +00:00
|
|
|
call SGBDelayCycles
|
2016-05-11 13:49:03 +00:00
|
|
|
call SGB_ClearVRAM
|
|
|
|
call PushSGBBorder
|
2015-12-23 03:19:33 +00:00
|
|
|
call SGBDelayCycles
|
2016-05-11 13:49:03 +00:00
|
|
|
call SGB_ClearVRAM
|
2018-01-18 03:37:04 +00:00
|
|
|
ld hl, MaskEnCancelPacket
|
2018-07-23 04:13:43 +00:00
|
|
|
call _PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-05-05 19:07:37 +00:00
|
|
|
.skip
|
2013-09-15 22:02:02 +00:00
|
|
|
pop af
|
2020-10-28 17:35:39 +00:00
|
|
|
ld [wJoypadDisable], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ei
|
|
|
|
ret
|
|
|
|
|
2016-05-05 19:07:37 +00:00
|
|
|
InitCGBPals::
|
2013-09-15 22:02:02 +00:00
|
|
|
call CheckCGB
|
|
|
|
ret z
|
2020-10-28 17:35:39 +00:00
|
|
|
|
2016-05-05 19:07:37 +00:00
|
|
|
; CGB only
|
2018-01-18 06:25:19 +00:00
|
|
|
ld a, BANK(vTiles3)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rVBK], a
|
2018-01-18 06:25:19 +00:00
|
|
|
ld hl, vTiles3
|
2016-01-04 13:43:55 +00:00
|
|
|
ld bc, $200 tiles
|
2013-09-15 22:02:02 +00:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
2018-01-18 06:25:19 +00:00
|
|
|
ld a, BANK(vTiles0)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rVBK], a
|
2018-01-01 18:43:02 +00:00
|
|
|
ld a, 1 << rBGPI_AUTO_INCREMENT
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rBGPI], a
|
2016-01-04 13:43:55 +00:00
|
|
|
ld c, 4 * 8
|
|
|
|
.bgpals_loop
|
2018-01-18 16:16:24 +00:00
|
|
|
ld a, LOW(PALRGB_WHITE)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rBGPD], a
|
2018-01-18 16:16:24 +00:00
|
|
|
ld a, HIGH(PALRGB_WHITE)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rBGPD], a
|
2013-09-15 22:02:02 +00:00
|
|
|
dec c
|
2016-01-04 13:43:55 +00:00
|
|
|
jr nz, .bgpals_loop
|
2018-01-01 18:43:02 +00:00
|
|
|
ld a, 1 << rOBPI_AUTO_INCREMENT
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rOBPI], a
|
2016-01-04 13:43:55 +00:00
|
|
|
ld c, 4 * 8
|
|
|
|
.obpals_loop
|
2018-01-18 16:16:24 +00:00
|
|
|
ld a, LOW(PALRGB_WHITE)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rOBPD], a
|
2018-01-18 16:16:24 +00:00
|
|
|
ld a, HIGH(PALRGB_WHITE)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rOBPD], a
|
2013-09-15 22:02:02 +00:00
|
|
|
dec c
|
2016-01-04 13:43:55 +00:00
|
|
|
jr nz, .obpals_loop
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rSVBK]
|
2013-09-15 22:02:02 +00:00
|
|
|
push af
|
2018-01-04 00:12:45 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2018-01-01 14:08:21 +00:00
|
|
|
ld hl, wBGPals1
|
2016-01-04 13:43:55 +00:00
|
|
|
call .LoadWhitePals
|
2018-01-01 14:08:21 +00:00
|
|
|
ld hl, wBGPals2
|
2016-01-04 13:43:55 +00:00
|
|
|
call .LoadWhitePals
|
2013-09-15 22:02:02 +00:00
|
|
|
pop af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.LoadWhitePals:
|
2016-01-04 13:43:55 +00:00
|
|
|
ld c, 4 * 16
|
2015-11-20 20:15:32 +00:00
|
|
|
.loop
|
2018-01-18 16:16:24 +00:00
|
|
|
ld a, LOW(PALRGB_WHITE)
|
2013-09-15 22:02:02 +00:00
|
|
|
ld [hli], a
|
2018-01-18 16:16:24 +00:00
|
|
|
ld a, HIGH(PALRGB_WHITE)
|
2013-09-15 22:02:02 +00:00
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-11-20 20:15:32 +00:00
|
|
|
jr nz, .loop
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
_InitSGBBorderPals:
|
2018-01-18 03:37:04 +00:00
|
|
|
ld hl, .PacketPointerTable
|
2016-01-04 13:43:55 +00:00
|
|
|
ld c, 9
|
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
push bc
|
|
|
|
ld a, [hli]
|
|
|
|
push hl
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2018-07-23 04:13:43 +00:00
|
|
|
call _PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
pop hl
|
|
|
|
inc hl
|
|
|
|
pop bc
|
|
|
|
dec c
|
2016-01-04 13:43:55 +00:00
|
|
|
jr nz, .loop
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2018-01-18 03:37:04 +00:00
|
|
|
.PacketPointerTable:
|
|
|
|
dw MaskEnFreezePacket
|
|
|
|
dw DataSndPacket1
|
|
|
|
dw DataSndPacket2
|
|
|
|
dw DataSndPacket3
|
|
|
|
dw DataSndPacket4
|
|
|
|
dw DataSndPacket5
|
|
|
|
dw DataSndPacket6
|
|
|
|
dw DataSndPacket7
|
|
|
|
dw DataSndPacket8
|
2014-03-02 02:43:16 +00:00
|
|
|
|
2020-10-05 20:15:57 +00:00
|
|
|
UpdateSGBBorder: ; unreferenced
|
2014-03-02 02:43:16 +00:00
|
|
|
di
|
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rJOYP], a
|
2018-01-18 03:37:04 +00:00
|
|
|
ld hl, MaskEnFreezePacket
|
2018-07-23 04:13:43 +00:00
|
|
|
call _PushSGBPals
|
2016-05-11 13:49:03 +00:00
|
|
|
call PushSGBBorder
|
2015-12-23 03:19:33 +00:00
|
|
|
call SGBDelayCycles
|
2016-05-11 13:49:03 +00:00
|
|
|
call SGB_ClearVRAM
|
2018-01-18 03:37:04 +00:00
|
|
|
ld hl, MaskEnCancelPacket
|
2018-07-23 04:13:43 +00:00
|
|
|
call _PushSGBPals
|
2014-03-02 02:43:16 +00:00
|
|
|
ei
|
|
|
|
ret
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
PushSGBBorder:
|
2016-01-04 13:43:55 +00:00
|
|
|
call .LoadSGBBorderPointers
|
2013-09-15 22:02:02 +00:00
|
|
|
push de
|
2016-05-11 13:49:03 +00:00
|
|
|
call SGBBorder_YetMorePalPushing
|
2013-09-15 22:02:02 +00:00
|
|
|
pop hl
|
2016-05-11 13:49:03 +00:00
|
|
|
call SGBBorder_MorePalPushing
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
.LoadSGBBorderPointers:
|
2020-06-17 14:39:17 +00:00
|
|
|
ld hl, SGBBorderGFX
|
2020-10-26 19:45:57 +00:00
|
|
|
ld de, SGBBorderMapAndPalettes
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
SGB_ClearVRAM:
|
2017-12-27 04:07:46 +00:00
|
|
|
ld hl, VRAM_Begin
|
|
|
|
ld bc, VRAM_End - VRAM_Begin
|
2013-09-15 22:02:02 +00:00
|
|
|
xor a
|
|
|
|
call ByteFill
|
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
PushSGBBorderPalsAndWait:
|
2018-01-18 03:37:04 +00:00
|
|
|
ld hl, MltReq2Packet
|
2018-07-23 04:13:43 +00:00
|
|
|
call _PushSGBPals
|
2015-12-23 03:19:33 +00:00
|
|
|
call SGBDelayCycles
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rJOYP]
|
2013-09-15 22:02:02 +00:00
|
|
|
and $3
|
|
|
|
cp $3
|
2016-05-11 13:49:03 +00:00
|
|
|
jr nz, .carry
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $20
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rJOYP], a
|
|
|
|
ldh a, [rJOYP]
|
|
|
|
ldh a, [rJOYP]
|
2015-12-23 03:19:33 +00:00
|
|
|
call SGBDelayCycles
|
|
|
|
call SGBDelayCycles
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $30
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rJOYP], a
|
2015-12-23 03:19:33 +00:00
|
|
|
call SGBDelayCycles
|
|
|
|
call SGBDelayCycles
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $10
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rJOYP], a
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 6
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rJOYP]
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2015-12-23 03:19:33 +00:00
|
|
|
call SGBDelayCycles
|
|
|
|
call SGBDelayCycles
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $30
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rJOYP], a
|
|
|
|
ldh a, [rJOYP]
|
|
|
|
ldh a, [rJOYP]
|
|
|
|
ldh a, [rJOYP]
|
2015-12-23 03:19:33 +00:00
|
|
|
call SGBDelayCycles
|
|
|
|
call SGBDelayCycles
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rJOYP]
|
2013-09-15 22:02:02 +00:00
|
|
|
and $3
|
|
|
|
cp $3
|
2016-05-11 13:49:03 +00:00
|
|
|
jr nz, .carry
|
|
|
|
call .FinalPush
|
2013-09-15 22:02:02 +00:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
.carry
|
|
|
|
call .FinalPush
|
2013-09-15 22:02:02 +00:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
.FinalPush:
|
2018-01-18 03:37:04 +00:00
|
|
|
ld hl, MltReq1Packet
|
2018-07-23 04:13:43 +00:00
|
|
|
call _PushSGBPals
|
2015-12-23 03:19:33 +00:00
|
|
|
jp SGBDelayCycles
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
SGBBorder_PushBGPals:
|
2013-09-15 22:02:02 +00:00
|
|
|
call DisableLCD
|
2016-05-05 19:07:37 +00:00
|
|
|
ld a, %11100100
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rBGP], a
|
2017-12-16 03:36:33 +00:00
|
|
|
ld hl, PredefPals
|
2017-12-28 12:32:33 +00:00
|
|
|
ld de, vTiles1
|
2017-12-25 18:40:10 +00:00
|
|
|
ld bc, $100 tiles
|
2013-09-15 22:02:02 +00:00
|
|
|
call CopyData
|
|
|
|
call DrawDefaultTiles
|
2017-12-29 18:22:33 +00:00
|
|
|
ld a, LCDC_DEFAULT
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rLCDC], a
|
2018-01-18 03:37:04 +00:00
|
|
|
ld hl, PalTrnPacket
|
2018-07-23 04:13:43 +00:00
|
|
|
call _PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rBGP], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
SGBBorder_MorePalPushing:
|
2013-09-15 22:02:02 +00:00
|
|
|
call DisableLCD
|
|
|
|
ld a, $e4
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rBGP], a
|
2017-12-28 12:32:33 +00:00
|
|
|
ld de, vTiles1
|
2019-11-03 19:15:20 +00:00
|
|
|
ld bc, (6 + SCREEN_WIDTH + 6) * 5 * 2
|
2013-09-15 22:02:02 +00:00
|
|
|
call CopyData
|
2019-11-03 19:15:20 +00:00
|
|
|
ld b, SCREEN_HEIGHT
|
2016-05-11 13:49:03 +00:00
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
push bc
|
2019-11-03 19:15:20 +00:00
|
|
|
ld bc, 6 * 2
|
2013-09-15 22:02:02 +00:00
|
|
|
call CopyData
|
2019-11-03 19:15:20 +00:00
|
|
|
ld bc, SCREEN_WIDTH * 2
|
2013-09-15 22:02:02 +00:00
|
|
|
call ClearBytes
|
2019-11-03 19:15:20 +00:00
|
|
|
ld bc, 6 * 2
|
2013-09-15 22:02:02 +00:00
|
|
|
call CopyData
|
|
|
|
pop bc
|
|
|
|
dec b
|
2016-05-11 13:49:03 +00:00
|
|
|
jr nz, .loop
|
2019-11-03 19:15:20 +00:00
|
|
|
ld bc, (6 + SCREEN_WIDTH + 6) * 5 * 2
|
2013-09-15 22:02:02 +00:00
|
|
|
call CopyData
|
2019-03-13 02:55:40 +00:00
|
|
|
ld bc, $100
|
2013-09-15 22:02:02 +00:00
|
|
|
call ClearBytes
|
2015-12-09 23:25:44 +00:00
|
|
|
ld bc, 16 palettes
|
2013-09-15 22:02:02 +00:00
|
|
|
call CopyData
|
|
|
|
call DrawDefaultTiles
|
2017-12-29 18:22:33 +00:00
|
|
|
ld a, LCDC_DEFAULT
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rLCDC], a
|
2018-01-18 03:37:04 +00:00
|
|
|
ld hl, PctTrnPacket
|
2018-07-23 04:13:43 +00:00
|
|
|
call _PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rBGP], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2016-05-11 13:49:03 +00:00
|
|
|
SGBBorder_YetMorePalPushing:
|
2013-09-15 22:02:02 +00:00
|
|
|
call DisableLCD
|
2016-01-04 13:43:55 +00:00
|
|
|
ld a, %11100100
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rBGP], a
|
2017-12-28 12:32:33 +00:00
|
|
|
ld de, vTiles1
|
2013-09-15 22:02:02 +00:00
|
|
|
ld b, $80
|
2016-05-11 13:49:03 +00:00
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
push bc
|
2016-01-04 13:43:55 +00:00
|
|
|
ld bc, 1 tiles
|
2013-09-15 22:02:02 +00:00
|
|
|
call CopyData
|
2016-01-04 13:43:55 +00:00
|
|
|
ld bc, 1 tiles
|
2013-09-15 22:02:02 +00:00
|
|
|
call ClearBytes
|
|
|
|
pop bc
|
|
|
|
dec b
|
2016-05-11 13:49:03 +00:00
|
|
|
jr nz, .loop
|
2013-09-15 22:02:02 +00:00
|
|
|
call DrawDefaultTiles
|
2017-12-29 18:22:33 +00:00
|
|
|
ld a, LCDC_DEFAULT
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rLCDC], a
|
2018-01-18 03:37:04 +00:00
|
|
|
ld hl, ChrTrnPacket
|
2018-07-23 04:13:43 +00:00
|
|
|
call _PushSGBPals
|
2013-09-15 22:02:02 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rBGP], a
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
CopyData:
|
2013-09-15 22:02:02 +00:00
|
|
|
; copy bc bytes of data from hl to de
|
2016-05-05 19:07:37 +00:00
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec bc
|
|
|
|
ld a, c
|
|
|
|
or b
|
2016-05-05 19:07:37 +00:00
|
|
|
jr nz, .loop
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
ClearBytes:
|
2013-09-15 22:02:02 +00:00
|
|
|
; clear bc bytes of data starting from de
|
2016-05-05 19:07:37 +00:00
|
|
|
.loop
|
2013-09-15 22:02:02 +00:00
|
|
|
xor a
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec bc
|
|
|
|
ld a, c
|
|
|
|
or b
|
2016-05-05 19:07:37 +00:00
|
|
|
jr nz, .loop
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-25 00:10:37 +00:00
|
|
|
DrawDefaultTiles:
|
2013-09-15 22:02:02 +00:00
|
|
|
; Draw 240 tiles (2/3 of the screen) from tiles in VRAM
|
2015-11-20 16:47:52 +00:00
|
|
|
hlbgcoord 0, 0 ; BG Map 0
|
2016-01-04 13:43:55 +00:00
|
|
|
ld de, BG_MAP_WIDTH - SCREEN_WIDTH
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, $80 ; starting tile
|
|
|
|
ld c, 12 + 1
|
|
|
|
.line
|
|
|
|
ld b, 20
|
|
|
|
.tile
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
|
|
|
dec b
|
|
|
|
jr nz, .tile
|
|
|
|
; next line
|
|
|
|
add hl, de
|
|
|
|
dec c
|
|
|
|
jr nz, .line
|
|
|
|
ret
|
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
SGBDelayCycles:
|
2015-12-23 03:19:33 +00:00
|
|
|
ld de, 7000
|
|
|
|
.wait
|
2013-09-15 22:02:02 +00:00
|
|
|
nop
|
|
|
|
nop
|
|
|
|
nop
|
|
|
|
dec de
|
|
|
|
ld a, d
|
|
|
|
or e
|
2015-12-23 03:19:33 +00:00
|
|
|
jr nz, .wait
|
2013-09-15 22:02:02 +00:00
|
|
|
ret
|
|
|
|
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/sgb/blk_packets.asm"
|
|
|
|
INCLUDE "gfx/sgb/pal_packets.asm"
|
2018-01-18 16:16:24 +00:00
|
|
|
INCLUDE "data/sgb_ctrl_packets.asm"
|
2014-03-02 02:43:16 +00:00
|
|
|
|
2017-12-16 03:36:33 +00:00
|
|
|
PredefPals:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/sgb/predef.pal"
|
2015-12-09 23:25:44 +00:00
|
|
|
|
2020-10-26 19:45:57 +00:00
|
|
|
SGBBorderMapAndPalettes:
|
2020-04-07 22:06:10 +00:00
|
|
|
; interleaved tile ids and palette ids, without the center 20x18 screen area
|
|
|
|
INCBIN "gfx/sgb/sgb_border.sgb.tilemap"
|
2020-10-26 19:45:57 +00:00
|
|
|
; four SGB palettes of 16 colors each; only the first 4 colors are used
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/sgb/sgb_border.pal"
|
2015-12-09 23:25:44 +00:00
|
|
|
|
2020-06-17 14:39:17 +00:00
|
|
|
SGBBorderGFX:
|
2017-12-11 22:51:04 +00:00
|
|
|
INCBIN "gfx/sgb/sgb_border.2bpp"
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2017-12-16 03:36:33 +00:00
|
|
|
HPBarPals:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/battle/hp_bar.pal"
|
2014-03-02 02:43:16 +00:00
|
|
|
|
2017-12-16 03:36:33 +00:00
|
|
|
ExpBarPalette:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/battle/exp_bar.pal"
|
2014-03-02 02:43:16 +00:00
|
|
|
|
2017-12-27 06:29:15 +00:00
|
|
|
INCLUDE "data/pokemon/palettes.asm"
|
2017-12-26 23:45:04 +00:00
|
|
|
|
2017-12-27 06:29:15 +00:00
|
|
|
INCLUDE "data/trainers/palettes.asm"
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
LoadMapPals:
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall LoadSpecialMapPalette
|
2015-12-22 23:03:00 +00:00
|
|
|
jr c, .got_pals
|
2015-06-23 17:46:51 +00:00
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
; Which palette group is based on whether we're outside or inside
|
2017-12-24 18:08:38 +00:00
|
|
|
ld a, [wEnvironment]
|
2014-03-02 06:22:33 +00:00
|
|
|
and 7
|
2013-09-15 22:02:02 +00:00
|
|
|
ld e, a
|
2014-03-02 06:22:33 +00:00
|
|
|
ld d, 0
|
2017-12-25 17:41:31 +00:00
|
|
|
ld hl, EnvironmentColorsPointers
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, de
|
2015-12-27 02:59:03 +00:00
|
|
|
add hl, de
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2016-04-02 13:28:46 +00:00
|
|
|
; Futher refine by time of day
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wTimeOfDayPal]
|
2018-01-16 22:27:50 +00:00
|
|
|
maskbits NUM_DAYTIMES
|
2013-09-15 22:02:02 +00:00
|
|
|
add a
|
2016-04-02 13:28:46 +00:00
|
|
|
add a
|
|
|
|
add a
|
2013-09-15 22:02:02 +00:00
|
|
|
ld e, a
|
2014-03-02 06:22:33 +00:00
|
|
|
ld d, 0
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, de
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [rSVBK]
|
2013-09-15 22:02:02 +00:00
|
|
|
push af
|
2018-01-04 00:12:45 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2018-01-01 14:08:21 +00:00
|
|
|
ld hl, wBGPals1
|
2015-12-22 23:03:00 +00:00
|
|
|
ld b, 8
|
|
|
|
.outer_loop
|
2016-04-02 13:28:46 +00:00
|
|
|
ld a, [de] ; lookup index for TilesetBGPalette
|
2013-09-15 22:02:02 +00:00
|
|
|
push de
|
|
|
|
push hl
|
|
|
|
ld l, a
|
2014-03-02 06:22:33 +00:00
|
|
|
ld h, 0
|
2016-04-02 13:28:46 +00:00
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
2015-06-23 17:46:51 +00:00
|
|
|
ld de, TilesetBGPalette
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, de
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
pop hl
|
2015-12-22 23:03:00 +00:00
|
|
|
ld c, 1 palettes
|
|
|
|
.inner_loop
|
2013-09-15 22:02:02 +00:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-12-22 23:03:00 +00:00
|
|
|
jr nz, .inner_loop
|
2013-09-15 22:02:02 +00:00
|
|
|
pop de
|
|
|
|
inc de
|
|
|
|
dec b
|
2015-12-22 23:03:00 +00:00
|
|
|
jr nz, .outer_loop
|
2013-09-15 22:02:02 +00:00
|
|
|
pop af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rSVBK], a
|
2013-09-15 22:02:02 +00:00
|
|
|
|
2015-12-22 23:03:00 +00:00
|
|
|
.got_pals
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wTimeOfDayPal]
|
2018-01-16 22:27:50 +00:00
|
|
|
maskbits NUM_DAYTIMES
|
2015-12-22 23:03:00 +00:00
|
|
|
ld bc, 8 palettes
|
2015-06-23 17:46:51 +00:00
|
|
|
ld hl, MapObjectPals
|
2013-09-15 22:02:02 +00:00
|
|
|
call AddNTimes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld de, wOBPals1
|
2015-12-22 23:03:00 +00:00
|
|
|
ld bc, 8 palettes
|
2018-01-01 14:08:21 +00:00
|
|
|
ld a, BANK(wOBPals1)
|
2013-09-15 22:02:02 +00:00
|
|
|
call FarCopyWRAM
|
2015-06-23 17:46:51 +00:00
|
|
|
|
2017-12-24 18:08:38 +00:00
|
|
|
ld a, [wEnvironment]
|
2015-12-22 23:03:00 +00:00
|
|
|
cp TOWN
|
|
|
|
jr z, .outside
|
|
|
|
cp ROUTE
|
2013-09-15 22:02:02 +00:00
|
|
|
ret nz
|
2015-12-22 23:03:00 +00:00
|
|
|
.outside
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wMapGroup]
|
2013-09-15 22:02:02 +00:00
|
|
|
ld l, a
|
2014-03-02 21:02:55 +00:00
|
|
|
ld h, 0
|
2016-05-11 13:49:03 +00:00
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
|
|
|
add hl, hl
|
2015-06-23 17:46:51 +00:00
|
|
|
ld de, RoofPals
|
2013-09-15 22:02:02 +00:00
|
|
|
add hl, de
|
2018-01-23 22:39:09 +00:00
|
|
|
ld a, [wTimeOfDayPal]
|
2018-01-16 22:27:50 +00:00
|
|
|
maskbits NUM_DAYTIMES
|
2017-12-11 06:02:28 +00:00
|
|
|
cp NITE_F
|
2015-12-22 23:03:00 +00:00
|
|
|
jr c, .morn_day
|
2015-07-21 02:18:18 +00:00
|
|
|
rept 4
|
2013-09-15 22:02:02 +00:00
|
|
|
inc hl
|
2015-07-21 02:18:18 +00:00
|
|
|
endr
|
2015-12-22 23:03:00 +00:00
|
|
|
.morn_day
|
2018-01-23 00:40:17 +00:00
|
|
|
ld de, wBGPals1 palette PAL_BG_ROOF color 1
|
2015-06-23 17:46:51 +00:00
|
|
|
ld bc, 4
|
2018-01-04 19:53:50 +00:00
|
|
|
ld a, BANK(wBGPals1)
|
2013-09-15 22:02:02 +00:00
|
|
|
call FarCopyWRAM
|
|
|
|
ret
|
2016-04-02 13:28:46 +00:00
|
|
|
|
2017-12-25 17:41:31 +00:00
|
|
|
INCLUDE "data/maps/environment_colors.asm"
|
2014-03-02 06:22:33 +00:00
|
|
|
|
2018-01-18 16:37:05 +00:00
|
|
|
PartyMenuBGMobilePalette:
|
|
|
|
INCLUDE "gfx/stats/party_menu_bg_mobile.pal"
|
2015-12-09 23:25:44 +00:00
|
|
|
|
2018-01-18 16:37:05 +00:00
|
|
|
PartyMenuBGPalette:
|
|
|
|
INCLUDE "gfx/stats/party_menu_bg.pal"
|
2015-12-09 23:25:44 +00:00
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
TilesetBGPalette:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/tilesets/bg_tiles.pal"
|
2014-03-02 21:02:55 +00:00
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
MapObjectPals::
|
2018-01-12 07:56:14 +00:00
|
|
|
INCLUDE "gfx/overworld/npc_sprites.pal"
|
2014-03-02 21:02:55 +00:00
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
RoofPals:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/tilesets/roofs.pal"
|
2014-03-02 21:02:55 +00:00
|
|
|
|
2016-06-06 22:23:00 +00:00
|
|
|
DiplomaPalettes:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/diploma/diploma.pal"
|
2014-03-02 21:02:55 +00:00
|
|
|
|
2017-12-16 03:36:33 +00:00
|
|
|
PartyMenuOBPals:
|
2018-01-18 16:37:05 +00:00
|
|
|
INCLUDE "gfx/stats/party_menu_ob.pal"
|
2014-03-02 21:02:55 +00:00
|
|
|
|
2020-10-26 19:45:57 +00:00
|
|
|
UnusedBattleObjectPals: ; unreferenced
|
2020-06-03 16:20:34 +00:00
|
|
|
INCLUDE "gfx/battle_anims/unused_battle_anims.pal"
|
|
|
|
|
2018-01-18 05:16:03 +00:00
|
|
|
UnusedGSTitleBGPals:
|
|
|
|
INCLUDE "gfx/title/unused_gs_bg.pal"
|
2014-03-02 21:02:55 +00:00
|
|
|
|
2018-01-18 05:16:03 +00:00
|
|
|
UnusedGSTitleOBPals:
|
|
|
|
INCLUDE "gfx/title/unused_gs_fg.pal"
|
2015-12-09 23:25:44 +00:00
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
MalePokegearPals:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/pokegear/pokegear.pal"
|
2015-12-09 23:25:44 +00:00
|
|
|
|
2016-04-02 13:28:46 +00:00
|
|
|
FemalePokegearPals:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/pokegear/pokegear_f.pal"
|
2015-12-09 23:25:44 +00:00
|
|
|
|
2018-06-01 06:11:44 +00:00
|
|
|
BetaPokerPals:
|
|
|
|
INCLUDE "gfx/beta_poker/beta_poker.pal"
|
2015-12-09 23:25:44 +00:00
|
|
|
|
2017-12-11 01:50:08 +00:00
|
|
|
SlotMachinePals:
|
2018-01-10 04:21:32 +00:00
|
|
|
INCLUDE "gfx/slots/slots.pal"
|