pokecrystal-board/engine/debug/color_picker.asm

1428 lines
20 KiB
NASM
Raw Normal View History

2018-01-31 08:38:45 -08:00
const_def $6a
const DEBUGTEST_TICKS_1 ; $6a
const DEBUGTEST_TICKS_2 ; $6b
const DEBUGTEST_WHITE ; $6c
const DEBUGTEST_LIGHT ; $6d
const DEBUGTEST_DARK ; $6e
const DEBUGTEST_BLACK ; $6f
const DEBUGTEST_0 ; $70
const DEBUGTEST_1 ; $71
const DEBUGTEST_2 ; $72
const DEBUGTEST_3 ; $73
const DEBUGTEST_4 ; $74
const DEBUGTEST_5 ; $75
const DEBUGTEST_6 ; $76
const DEBUGTEST_7 ; $77
const DEBUGTEST_8 ; $78
const DEBUGTEST_9 ; $79
const DEBUGTEST_A ; $7a
const DEBUGTEST_B ; $7b
const DEBUGTEST_C ; $7c
const DEBUGTEST_D ; $7d
const DEBUGTEST_E ; $7e
const DEBUGTEST_F ; $7f
2020-10-06 10:50:02 -07:00
DebugColorPicker:
2015-11-19 15:07:20 -08:00
; A debug menu to test monster and trainer palettes at runtime.
ldh a, [hCGB]
2015-11-19 15:07:20 -08:00
and a
2020-10-06 10:50:02 -07:00
jr nz, .cgb
ldh a, [hSGB]
2015-11-19 15:07:20 -08:00
and a
ret z
2020-10-06 10:50:02 -07:00
.cgb
ldh a, [hInMenu]
2015-11-19 15:07:20 -08:00
push af
2020-10-06 10:50:02 -07:00
ld a, 1
ldh [hInMenu], a
2015-11-19 15:07:20 -08:00
call DisableLCD
2020-10-06 10:50:02 -07:00
call DebugColor_InitVRAM
call DebugColor_LoadGFX
call DebugColor_InitPalettes
call DebugColor_InitMonColor
2015-11-19 15:07:20 -08:00
call EnableLCD
ld de, MUSIC_NONE
call PlayMusic
xor a
ld [wJumptableIndex], a
ld [wcf66], a
ld [wd003], a
2020-10-06 10:50:02 -07:00
.loop
2015-11-19 15:07:20 -08:00
ld a, [wJumptableIndex]
bit 7, a
2020-10-06 10:50:02 -07:00
jr nz, .exit
call DebugColorMain
call DebugColor_PlaceCursor
2015-11-19 15:07:20 -08:00
call DelayFrame
2020-10-06 10:50:02 -07:00
jr .loop
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.exit
2015-11-19 15:07:20 -08:00
pop af
ldh [hInMenu], a
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
DebugColor_InitMonColor:
2015-11-19 15:07:20 -08:00
ld a, [wd002]
and a
2020-10-06 10:50:02 -07:00
jr nz, DebugColor_InitTrainerColor
2015-11-19 15:07:20 -08:00
ld hl, PokemonPalettes
2020-10-06 10:50:02 -07:00
DebugColor_InitMonColor2:
ld de, wOverworldMapBlocks
2015-11-19 15:07:20 -08:00
ld c, NUM_POKEMON + 1
2020-10-06 10:50:02 -07:00
.loop
2015-11-19 15:07:20 -08:00
push bc
push hl
2020-10-06 10:50:02 -07:00
call DebugColor_InitColor
2015-11-19 15:07:20 -08:00
pop hl
ld bc, 8
add hl, bc
pop bc
dec c
2020-10-06 10:50:02 -07:00
jr nz, .loop
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
DebugColor_InitTrainerColor:
2015-11-19 15:07:20 -08:00
ld hl, TrainerPalettes
ld de, wOverworldMapBlocks
2015-11-19 15:07:20 -08:00
ld c, NUM_TRAINER_CLASSES
2020-10-06 10:50:02 -07:00
.loop
2015-11-19 15:07:20 -08:00
push bc
push hl
2020-10-06 10:50:02 -07:00
call DebugColor_InitColor
2015-11-19 15:07:20 -08:00
pop hl
ld bc, 4
add hl, bc
pop bc
dec c
2020-10-06 10:50:02 -07:00
jr nz, .loop
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
DebugColor_InitColor:
ld a, BANK(PokemonPalettes) ; aka BANK(TrainerPalettes)
2015-11-19 15:07:20 -08:00
call GetFarByte
ld [de], a
inc de
inc hl
2020-10-06 10:50:02 -07:00
ld a, BANK(PokemonPalettes) ; aka BANK(TrainerPalettes)
2015-11-19 15:07:20 -08:00
call GetFarByte
ld [de], a
inc de
inc hl
2020-10-06 10:50:02 -07:00
ld a, BANK(PokemonPalettes) ; aka BANK(TrainerPalettes)
2015-11-19 15:07:20 -08:00
call GetFarByte
ld [de], a
inc de
inc hl
2020-10-06 10:50:02 -07:00
ld a, BANK(PokemonPalettes) ; aka BANK(TrainerPalettes)
2015-11-19 15:07:20 -08:00
call GetFarByte
ld [de], a
inc de
ret
2020-10-06 10:50:02 -07:00
DebugColor_InitVRAM:
ld a, BANK(vTiles3)
ldh [rVBK], a
2020-10-06 10:50:02 -07:00
ld hl, vTiles3
ld bc, sScratch - vTiles3
2015-11-19 15:07:20 -08:00
xor a
call ByteFill
2020-10-06 10:50:02 -07:00
ld a, BANK(vTiles0)
ldh [rVBK], a
2017-12-28 04:32:33 -08:00
ld hl, vTiles0
ld bc, sScratch - vTiles0
2015-11-19 15:07:20 -08:00
xor a
call ByteFill
2020-10-06 10:50:02 -07:00
hlcoord 0, 0, wAttrmap
2015-11-19 15:07:20 -08:00
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
2020-10-06 10:50:02 -07:00
2015-11-19 15:07:20 -08:00
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
xor a
call ByteFill
2020-10-06 10:50:02 -07:00
2015-11-19 15:07:20 -08:00
call ClearSprites
ret
2020-10-06 10:50:02 -07:00
DebugColor_LoadGFX:
ld hl, DebugColor_GFX
ld de, vTiles2 tile DEBUGTEST_TICKS_1
ld bc, 22 tiles
2015-11-19 15:07:20 -08:00
call CopyBytes
2020-10-06 10:50:02 -07:00
ld hl, DebugUpArrowGFX
2017-12-28 04:32:33 -08:00
ld de, vTiles0
ld bc, 1 tiles
2015-11-19 15:07:20 -08:00
call CopyBytes
2020-10-06 10:50:02 -07:00
2015-11-19 15:07:20 -08:00
call LoadStandardFont
2017-12-28 04:32:33 -08:00
ld hl, vTiles1
2020-10-06 10:50:02 -07:00
ld bc, $80 tiles
.loop
2015-11-19 15:07:20 -08:00
ld a, [hl]
xor $ff
ld [hli], a
dec bc
ld a, c
or b
2020-10-06 10:50:02 -07:00
jr nz, .loop
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
DebugColor_InitPalettes:
ldh a, [hCGB]
2015-11-19 15:07:20 -08:00
and a
ret z
2020-10-06 10:50:02 -07:00
ldh a, [rSVBK]
2015-11-19 15:07:20 -08:00
push af
ld a, BANK(wBGPals2)
ldh [rSVBK], a
2020-10-06 10:50:02 -07:00
2018-03-02 16:39:16 -08:00
ld hl, Palette_DebugBG
2018-01-01 06:08:21 -08:00
ld de, wBGPals2
2017-12-15 19:36:33 -08:00
ld bc, 16 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
2020-10-06 10:50:02 -07:00
ld a, 1 << rBGPI_AUTO_INCREMENT
ldh [rBGPI], a
2018-03-02 16:39:16 -08:00
ld hl, Palette_DebugBG
ld c, 8 palettes
2015-11-19 15:07:20 -08:00
xor a
2020-10-06 10:50:02 -07:00
.bg_loop
ldh [rBGPD], a
2015-11-19 15:07:20 -08:00
dec c
2020-10-06 10:50:02 -07:00
jr nz, .bg_loop
ld a, 1 << rOBPI_AUTO_INCREMENT
ldh [rOBPI], a
2018-03-02 16:39:16 -08:00
ld hl, Palette_DebugOB
ld c, 8 palettes
2020-10-06 10:50:02 -07:00
.ob_loop
2015-11-19 15:07:20 -08:00
ld a, [hli]
ldh [rOBPD], a
2015-11-19 15:07:20 -08:00
dec c
2020-10-06 10:50:02 -07:00
jr nz, .ob_loop
2015-11-19 15:07:20 -08:00
ld a, $94
ld [wc608], a
ld a, $52
ld [wc608 + 1], a
ld a, $4a
ld [wc608 + 2], a
ld a, $29
ld [wc608 + 3], a
2020-10-06 10:50:02 -07:00
2015-11-19 15:07:20 -08:00
pop af
ldh [rSVBK], a
2015-11-19 15:07:20 -08:00
ret
2018-06-24 07:09:41 -07:00
Palette_DebugBG:
INCLUDE "gfx/debug/bg.pal"
2015-11-19 15:07:20 -08:00
2018-06-24 07:09:41 -07:00
Palette_DebugOB:
INCLUDE "gfx/debug/ob.pal"
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
DebugColorMain:
2015-11-19 15:07:20 -08:00
call JoyTextDelay
ld a, [wJumptableIndex]
2020-10-06 10:50:02 -07:00
cp 4
2015-11-19 15:07:20 -08:00
jr nc, .asm_81a8b
ld hl, hJoyLast
ld a, [hl]
and SELECT
2020-10-06 10:50:02 -07:00
jr nz, .NextMon
2015-11-19 15:07:20 -08:00
ld a, [hl]
and START
2020-10-06 10:50:02 -07:00
jr nz, .PreviousMon
2015-11-19 15:07:20 -08:00
.asm_81a8b
jumptable Jumptable_81acf, wJumptableIndex
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.NextMon
call DebugColor_BackupSpriteColors
call DebugColor_SetMaxNum
2015-11-19 15:07:20 -08:00
ld e, a
ld a, [wcf66]
inc a
cp e
2020-10-06 10:50:02 -07:00
jr c, .SwitchMon
2015-11-19 15:07:20 -08:00
xor a
2020-10-06 10:50:02 -07:00
jr .SwitchMon
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.PreviousMon
call DebugColor_BackupSpriteColors
2015-11-19 15:07:20 -08:00
ld a, [wcf66]
dec a
2020-10-06 10:50:02 -07:00
cp -1
jr nz, .SwitchMon
call DebugColor_SetMaxNum
2015-11-19 15:07:20 -08:00
dec a
2020-10-06 10:50:02 -07:00
.SwitchMon
2015-11-19 15:07:20 -08:00
ld [wcf66], a
ld a, 0
2015-11-19 15:07:20 -08:00
ld [wJumptableIndex], a
ret
2020-10-06 10:50:02 -07:00
DebugColor_SetMaxNum:
2015-11-19 15:07:20 -08:00
; Looping back around the pic set.
ld a, [wd002]
and a
2020-10-06 10:50:02 -07:00
jr nz, .trainer
; .mon
2015-11-19 15:07:20 -08:00
ld a, NUM_POKEMON ; CELEBI
ret
2020-10-06 10:50:02 -07:00
.trainer
2015-11-19 15:07:20 -08:00
ld a, NUM_TRAINER_CLASSES - 1 ; MYSTICALMAN
ret
2018-06-24 07:09:41 -07:00
Jumptable_81acf:
2020-10-06 10:50:02 -07:00
dw DebugColor_InitScreen
2015-11-19 15:07:20 -08:00
dw Function81c18
dw Function81c33
dw Function81cc2
dw Function81d8e
dw Function81daf
2020-10-06 10:50:02 -07:00
DebugColor_InitScreen:
2015-11-19 15:07:20 -08:00
xor a
ldh [hBGMapMode], a
2015-11-19 15:07:20 -08:00
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, DEBUGTEST_BLACK
2015-11-19 15:07:20 -08:00
call ByteFill
hlcoord 1, 3
lb bc, 7, 18
ld a, DEBUGTEST_WHITE
call DebugColor_FillBoxWithByte
2015-11-19 15:07:20 -08:00
hlcoord 11, 0
lb bc, 2, 3
ld a, DEBUGTEST_LIGHT
call DebugColor_FillBoxWithByte
2015-11-19 15:07:20 -08:00
hlcoord 16, 0
lb bc, 2, 3
ld a, DEBUGTEST_DARK
call DebugColor_FillBoxWithByte
2020-10-06 10:50:02 -07:00
call DebugColor_LoadRGBMeter
call DebugColor_SetRGBMeter
2015-11-19 15:07:20 -08:00
ld a, [wcf66]
inc a
2018-01-23 14:39:09 -08:00
ld [wCurPartySpecies], a
ld [wDeciramBuffer], a
2015-11-19 15:07:20 -08:00
hlcoord 0, 1
ld de, wDeciramBuffer
2015-11-19 15:07:20 -08:00
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
call PrintNum
ld a, [wd002]
and a
2020-10-06 10:50:02 -07:00
jr nz, .trainer
; .mon
ld a, UNOWN_A
2018-01-23 14:39:09 -08:00
ld [wUnownLetter], a
2015-11-19 15:07:20 -08:00
call GetPokemonName
hlcoord 4, 1
call PlaceString
xor a
ld [wBoxAlignment], a
2015-11-19 15:07:20 -08:00
hlcoord 12, 3
call _PrepMonFrontpic
2017-12-28 04:32:33 -08:00
ld de, vTiles2 tile $31
predef GetMonBackpic
2015-11-19 15:07:20 -08:00
ld a, $31
ldh [hGraphicStartTile], a
2015-11-19 15:07:20 -08:00
hlcoord 2, 4
lb bc, 6, 6
predef PlaceGraphic
2020-10-06 10:50:02 -07:00
2015-11-19 15:07:20 -08:00
ld a, [wd003]
and a
2020-10-06 10:50:02 -07:00
jr z, .load_normal_text
; .load_shiny_text
ld de, DebugColor_ShinyText
jr .place_switch_text
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.load_normal_text
ld de, DebugColor_NormalText
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.place_switch_text
2015-11-19 15:07:20 -08:00
hlcoord 7, 17
call PlaceString
hlcoord 0, 17
2020-10-06 10:50:02 -07:00
ld de, DebugColor_SwitchText
2015-11-19 15:07:20 -08:00
call PlaceString
2020-10-06 10:50:02 -07:00
jr .done
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.trainer
ld a, [wDeciramBuffer]
2018-01-23 14:39:09 -08:00
ld [wTrainerClass], a
2017-12-24 09:47:30 -08:00
callfar GetTrainerAttributes
2018-01-23 14:39:09 -08:00
ld de, wStringBuffer1
2015-11-19 15:07:20 -08:00
hlcoord 4, 1
call PlaceString
2017-12-28 04:32:33 -08:00
ld de, vTiles2
callfar GetTrainerPic
2015-11-19 15:07:20 -08:00
xor a
2018-01-23 14:39:09 -08:00
ld [wTempEnemyMonSpecies], a
ldh [hGraphicStartTile], a
2015-11-19 15:07:20 -08:00
hlcoord 2, 3
lb bc, 7, 7
predef PlaceGraphic
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.done
ld a, 1
2015-11-19 15:07:20 -08:00
ld [wJumptableIndex], a
ret
2020-10-06 10:50:02 -07:00
DebugColor_ShinyText:
db "レア", DEBUGTEST_BLACK, DEBUGTEST_BLACK, "@" ; Rare (shiny)
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
DebugColor_NormalText:
db "ノーマル@" ; Normal
DebugColor_SwitchText:
db DEBUGTEST_A, "きりかえ▶@" ; (A) Switches
DebugColor_LoadRGBMeter:
decoord 0, 11, wAttrmap
2015-11-19 15:07:20 -08:00
hlcoord 2, 11
ld a, $1
call Function81bde
decoord 0, 13, wAttrmap
2015-11-19 15:07:20 -08:00
hlcoord 2, 13
ld a, $2
call Function81bde
decoord 0, 15, wAttrmap
2015-11-19 15:07:20 -08:00
hlcoord 2, 15
ld a, $3
2018-06-24 07:09:41 -07:00
Function81bde:
2015-11-19 15:07:20 -08:00
push af
ld a, DEBUGTEST_TICKS_1
2015-11-19 15:07:20 -08:00
ld [hli], a
2020-10-06 10:50:02 -07:00
ld bc, 15
ld a, DEBUGTEST_TICKS_2
2015-11-19 15:07:20 -08:00
call ByteFill
ld l, e
ld h, d
pop af
2020-10-06 10:50:02 -07:00
ld bc, 20 * 2
2015-11-19 15:07:20 -08:00
call ByteFill
ret
2020-10-06 10:50:02 -07:00
DebugColor_SetRGBMeter:
2015-11-19 15:07:20 -08:00
ld a, [wcf66]
inc a
ld l, a
2020-10-06 10:50:02 -07:00
ld h, 0
2015-11-19 15:07:20 -08:00
add hl, hl
add hl, hl
ld de, wOverworldMapBlocks
2015-11-19 15:07:20 -08:00
add hl, de
ld de, wc608
ld bc, 4
call CopyBytes
xor a
ld [wcf64], a
ld [wcf65], a
ld de, wc608
2020-10-06 10:50:02 -07:00
call DebugColor_CalculateRGB
2015-11-19 15:07:20 -08:00
ret
2018-06-24 07:09:41 -07:00
Function81c18:
ldh a, [hCGB]
2015-11-19 15:07:20 -08:00
and a
2020-10-06 10:50:02 -07:00
jr z, .sgb
ld a, 2
ldh [hBGMapMode], a
2015-11-19 15:07:20 -08:00
call DelayFrame
call DelayFrame
call DelayFrame
2020-10-06 10:50:02 -07:00
.sgb
2015-11-19 15:07:20 -08:00
call WaitBGMap
2020-10-06 10:50:02 -07:00
ld a, 2
2015-11-19 15:07:20 -08:00
ld [wJumptableIndex], a
ret
2018-06-24 07:09:41 -07:00
Function81c33:
ldh a, [hCGB]
2015-11-19 15:07:20 -08:00
and a
2020-10-06 10:50:02 -07:00
jr z, .sgb
; .cgb
ldh a, [rSVBK]
2015-11-19 15:07:20 -08:00
push af
ld a, BANK(wBGPals2)
ldh [rSVBK], a
2020-10-06 10:50:02 -07:00
2018-01-01 06:08:21 -08:00
ld hl, wBGPals2
2015-11-19 15:07:20 -08:00
ld de, wc608
ld c, $1
call Function81ee3
hlcoord 10, 2
ld de, wc608
call Function81ca7
hlcoord 15, 2
ld de, wc608 + 2
call Function81ca7
2020-08-03 14:41:01 -07:00
ld a, TRUE
ldh [hCGBPalUpdate], a
2020-10-06 10:50:02 -07:00
ld a, 3
2015-11-19 15:07:20 -08:00
ld [wJumptableIndex], a
2020-10-06 10:50:02 -07:00
2015-11-19 15:07:20 -08:00
pop af
ldh [rSVBK], a
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
.sgb
ld hl, wSGBPals
ld a, 1
2015-11-19 15:07:20 -08:00
ld [hli], a
ld a, LOW(PALRGB_WHITE)
2015-11-19 15:07:20 -08:00
ld [hli], a
ld a, HIGH(PALRGB_WHITE)
2015-11-19 15:07:20 -08:00
ld [hli], a
ld a, [wc608]
ld [hli], a
ld a, [wc608 + 1]
ld [hli], a
ld a, [wc608 + 2]
ld [hli], a
ld a, [wc608 + 3]
ld [hli], a
xor a
ld [hli], a
ld [hli], a
2015-11-19 15:07:20 -08:00
ld [hl], a
ld hl, wSGBPals
2015-11-19 15:07:20 -08:00
call Function81f0c
hlcoord 10, 2
ld de, wc608
call Function81ca7
hlcoord 15, 2
ld de, wc608 + 2
call Function81ca7
2020-10-06 10:50:02 -07:00
ld a, 3
2015-11-19 15:07:20 -08:00
ld [wJumptableIndex], a
ret
2018-06-24 07:09:41 -07:00
Function81ca7:
2015-11-19 15:07:20 -08:00
inc hl
inc hl
inc hl
2015-11-19 15:07:20 -08:00
ld a, [de]
call Function81cbc
ld a, [de]
swap a
call Function81cbc
inc de
ld a, [de]
call Function81cbc
ld a, [de]
swap a
2018-06-24 07:09:41 -07:00
Function81cbc:
2015-11-19 15:07:20 -08:00
and $f
add DEBUGTEST_0
2015-11-19 15:07:20 -08:00
ld [hld], a
ret
2018-06-24 07:09:41 -07:00
Function81cc2:
ldh a, [hJoyLast]
2015-11-19 15:07:20 -08:00
and B_BUTTON
2020-10-06 10:50:02 -07:00
jr nz, .b
ldh a, [hJoyLast]
2015-11-19 15:07:20 -08:00
and A_BUTTON
2020-10-06 10:50:02 -07:00
jr nz, .a
2015-11-19 15:07:20 -08:00
ld a, [wcf64]
and $3
ld e, a
ld d, 0
ld hl, Jumptable_81d02
add hl, de
add hl, de
2015-11-19 15:07:20 -08:00
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.b
ld a, 4
2015-11-19 15:07:20 -08:00
ld [wJumptableIndex], a
ret
2020-10-06 10:50:02 -07:00
.a
2015-11-19 15:07:20 -08:00
ld a, [wd002]
and a
ret nz
ld a, [wd003]
2020-10-06 10:50:02 -07:00
xor %00000100
2015-11-19 15:07:20 -08:00
ld [wd003], a
ld c, a
ld b, 0
ld hl, PokemonPalettes
add hl, bc
2020-10-06 10:50:02 -07:00
call DebugColor_InitMonColor2
ld a, 0
2015-11-19 15:07:20 -08:00
ld [wJumptableIndex], a
ret
2018-06-24 07:09:41 -07:00
Jumptable_81d02:
2020-10-06 10:50:02 -07:00
dw DebugColor_SelectColorBox
dw DebugColor_ChangeRedValue
dw DebugColor_ChangeGreenValue
dw DebugColor_ChangeBlueValue
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
DebugColor_SelectColorBox:
2015-11-19 15:07:20 -08:00
ld hl, hJoyLast
ld a, [hl]
and D_DOWN
2020-10-06 10:50:02 -07:00
jr nz, DebugColor_NextRGBColor
2015-11-19 15:07:20 -08:00
ld a, [hl]
and D_LEFT
2020-10-06 10:50:02 -07:00
jr nz, .lightcolor
2015-11-19 15:07:20 -08:00
ld a, [hl]
and D_RIGHT
2020-10-06 10:50:02 -07:00
jr nz, .darkcolor
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
.lightcolor
2015-11-19 15:07:20 -08:00
xor a
ld [wcf65], a
ld de, wc608
2020-10-06 10:50:02 -07:00
call DebugColor_CalculateRGB
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
.darkcolor
2015-11-19 15:07:20 -08:00
ld a, $1
ld [wcf65], a
ld de, wc608 + 2
2020-10-06 10:50:02 -07:00
call DebugColor_CalculateRGB
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
DebugColor_ChangeRedValue:
2015-11-19 15:07:20 -08:00
ld hl, hJoyLast
ld a, [hl]
and D_DOWN
2020-10-06 10:50:02 -07:00
jr nz, DebugColor_NextRGBColor
2015-11-19 15:07:20 -08:00
ld a, [hl]
and D_UP
2020-10-06 10:50:02 -07:00
jr nz, DebugColor_PreviousRGBColor
2015-11-19 15:07:20 -08:00
ld hl, wc608 + 10
2020-10-06 10:50:02 -07:00
jr DebugColor_UpdateSpriteColor
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
DebugColor_ChangeGreenValue:
2015-11-19 15:07:20 -08:00
ld hl, hJoyLast
ld a, [hl]
and D_DOWN
2020-10-06 10:50:02 -07:00
jr nz, DebugColor_NextRGBColor
2015-11-19 15:07:20 -08:00
ld a, [hl]
and D_UP
2020-10-06 10:50:02 -07:00
jr nz, DebugColor_PreviousRGBColor
2015-11-19 15:07:20 -08:00
ld hl, wc608 + 11
2020-10-06 10:50:02 -07:00
jr DebugColor_UpdateSpriteColor
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
DebugColor_ChangeBlueValue:
2015-11-19 15:07:20 -08:00
ld hl, hJoyLast
ld a, [hl]
and D_UP
2020-10-06 10:50:02 -07:00
jr nz, DebugColor_PreviousRGBColor
2015-11-19 15:07:20 -08:00
ld hl, wc608 + 12
2020-10-06 10:50:02 -07:00
DebugColor_UpdateSpriteColor:
ldh a, [hJoyLast]
2015-11-19 15:07:20 -08:00
and D_RIGHT
2020-10-06 10:50:02 -07:00
jr nz, .increment_color_value
ldh a, [hJoyLast]
2015-11-19 15:07:20 -08:00
and D_LEFT
2020-10-06 10:50:02 -07:00
jr nz, .decrement_color_value
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
.increment_color_value:
2015-11-19 15:07:20 -08:00
ld a, [hl]
2020-10-06 10:50:02 -07:00
cp 31
2015-11-19 15:07:20 -08:00
ret nc
inc [hl]
2020-10-06 10:50:02 -07:00
jr .done
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.decrement_color_value:
2015-11-19 15:07:20 -08:00
ld a, [hl]
and a
ret z
dec [hl]
2020-10-06 10:50:02 -07:00
.done:
call DebugColor_CalculatePalette
ld a, 2
2015-11-19 15:07:20 -08:00
ld [wJumptableIndex], a
ret
2020-10-06 10:50:02 -07:00
DebugColor_PreviousRGBColor:
2015-11-19 15:07:20 -08:00
ld hl, wcf64
dec [hl]
ret
2020-10-06 10:50:02 -07:00
DebugColor_NextRGBColor:
2015-11-19 15:07:20 -08:00
ld hl, wcf64
inc [hl]
ret
2018-06-24 07:09:41 -07:00
Function81d8e:
2015-11-19 15:07:20 -08:00
hlcoord 0, 10
2020-10-06 10:50:02 -07:00
ld bc, SCREEN_WIDTH * 8
ld a, DEBUGTEST_BLACK
2015-11-19 15:07:20 -08:00
call ByteFill
hlcoord 2, 12
2020-10-06 10:50:02 -07:00
ld de, DebugColor_AreYouFinishedString
2015-11-19 15:07:20 -08:00
call PlaceString
xor a
ld [wd004], a
call Function81df4
2020-10-06 10:50:02 -07:00
ld a, 5
2015-11-19 15:07:20 -08:00
ld [wJumptableIndex], a
ret
2018-06-24 07:09:41 -07:00
Function81daf:
2015-11-19 15:07:20 -08:00
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON
2020-10-06 10:50:02 -07:00
jr nz, .cancel
call DebugColor_TMHMJoypad
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
.cancel
ld a, 0
2015-11-19 15:07:20 -08:00
ld [wJumptableIndex], a
ret
2020-10-06 10:50:02 -07:00
.exit ; unreferenced
2015-11-19 15:07:20 -08:00
ld hl, wJumptableIndex
set 7, [hl]
ret
2020-10-06 10:50:02 -07:00
DebugColor_TMHMJoypad:
2015-11-19 15:07:20 -08:00
ld hl, hJoyLast
ld a, [hl]
and D_UP
2020-10-06 10:50:02 -07:00
jr nz, .up
2015-11-19 15:07:20 -08:00
ld a, [hl]
and D_DOWN
2020-10-06 10:50:02 -07:00
jr nz, .down
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
.up
2015-11-19 15:07:20 -08:00
ld a, [wd004]
2020-10-06 10:50:02 -07:00
cp NUM_TM_HM_TUTOR - 1
jr z, .wrap_down
2015-11-19 15:07:20 -08:00
inc a
2020-10-06 10:50:02 -07:00
jr .done
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.wrap_down
2015-11-19 15:07:20 -08:00
xor a
2020-10-06 10:50:02 -07:00
jr .done
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.down
2015-11-19 15:07:20 -08:00
ld a, [wd004]
and a
2020-10-06 10:50:02 -07:00
jr z, .wrap_up
2015-11-19 15:07:20 -08:00
dec a
2020-10-06 10:50:02 -07:00
jr .done
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.wrap_up
ld a, NUM_TM_HM_TUTOR - 1
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.done
2015-11-19 15:07:20 -08:00
ld [wd004], a
call Function81df4
ret
2018-06-24 07:09:41 -07:00
Function81df4:
2015-11-19 15:07:20 -08:00
hlcoord 10, 11
call Function81e5e
hlcoord 10, 12
call Function81e5e
hlcoord 10, 13
call Function81e5e
hlcoord 10, 14
call Function81e5e
ld a, [wd004]
inc a
ld [wTempTMHM], a
predef GetTMHMMove
ld a, [wTempTMHM]
ld [wPutativeTMHMMove], a
2015-11-19 15:07:20 -08:00
call GetMoveName
hlcoord 10, 12
call PlaceString
ld a, [wd004]
call Function81e55
2018-01-23 14:39:09 -08:00
ld [wCurItem], a
predef CanLearnTMHMMove
2015-11-19 15:07:20 -08:00
ld a, c
and a
2020-10-06 10:50:02 -07:00
ld de, DebugColor_AbleText
jr nz, .place_string
ld de, DebugColor_NotAbleText
.place_string
2015-11-19 15:07:20 -08:00
hlcoord 10, 14
call PlaceString
ret
2020-10-06 10:50:02 -07:00
DebugColor_AbleText:
db "おぼえられる@" ; Learnable
DebugColor_NotAbleText:
db "おぼえられない@" ; Not learnable
2015-11-19 15:07:20 -08:00
2018-06-24 07:09:41 -07:00
Function81e55:
2020-10-06 10:50:02 -07:00
cp NUM_TMS
jr c, .tm
; .hm
2015-11-19 15:07:20 -08:00
inc a
inc a
2020-10-06 10:50:02 -07:00
.tm
add TM01
2015-11-19 15:07:20 -08:00
ret
2018-06-24 07:09:41 -07:00
Function81e5e:
ld bc, 10
ld a, DEBUGTEST_BLACK
2015-11-19 15:07:20 -08:00
call ByteFill
ret
2020-10-06 10:50:02 -07:00
DebugColor_CalculatePalette:
2015-11-19 15:07:20 -08:00
ld a, [wc608 + 10]
2020-10-06 10:50:02 -07:00
and %00011111
2015-11-19 15:07:20 -08:00
ld e, a
ld a, [wc608 + 11]
2020-10-06 10:50:02 -07:00
and %00000111
2015-11-19 15:07:20 -08:00
sla a
swap a
or e
ld e, a
ld a, [wc608 + 11]
2020-10-06 10:50:02 -07:00
and %00011000
2015-11-19 15:07:20 -08:00
sla a
swap a
ld d, a
ld a, [wc608 + 12]
2020-10-06 10:50:02 -07:00
and %00011111
2015-11-19 15:07:20 -08:00
sla a
sla a
or d
ld d, a
ld a, [wcf65]
and a
2020-10-06 10:50:02 -07:00
jr z, .LightPalette
; .DarkPalette
2015-11-19 15:07:20 -08:00
ld a, e
ld [wc608 + 2], a
ld a, d
ld [wc608 + 3], a
ret
2020-10-06 10:50:02 -07:00
.LightPalette
2015-11-19 15:07:20 -08:00
ld a, e
ld [wc608], a
ld a, d
ld [wc608 + 1], a
ret
2020-10-06 10:50:02 -07:00
DebugColor_CalculateRGB:
2015-11-19 15:07:20 -08:00
ld a, [de]
2020-10-06 10:50:02 -07:00
and %00011111
2015-11-19 15:07:20 -08:00
ld [wc608 + 10], a
ld a, [de]
2020-10-06 10:50:02 -07:00
and %11100000
2015-11-19 15:07:20 -08:00
swap a
srl a
ld b, a
inc de
ld a, [de]
2020-10-06 10:50:02 -07:00
and %00000011
2015-11-19 15:07:20 -08:00
swap a
srl a
or b
ld [wc608 + 11], a
ld a, [de]
2020-10-06 10:50:02 -07:00
and %01111100
2015-11-19 15:07:20 -08:00
srl a
srl a
ld [wc608 + 12], a
ret
2020-10-06 10:50:02 -07:00
DebugColor_BackupSpriteColors:
2015-11-19 15:07:20 -08:00
ld a, [wcf66]
inc a
ld l, a
2020-10-06 10:50:02 -07:00
ld h, 0
2015-11-19 15:07:20 -08:00
add hl, hl
add hl, hl
2020-10-06 10:50:02 -07:00
ld de, wOverworldMapBlocks ; MonPalette
2015-11-19 15:07:20 -08:00
add hl, de
ld e, l
ld d, h
ld hl, wc608
ld bc, 4
call CopyBytes
ret
2018-06-24 07:09:41 -07:00
Function81ee3:
2020-10-06 10:50:02 -07:00
; Set palette buffer
.loop
ld a, LOW(PALRGB_WHITE)
2015-11-19 15:07:20 -08:00
ld [hli], a
ld a, HIGH(PALRGB_WHITE)
2015-11-19 15:07:20 -08:00
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
ld a, [de]
inc de
ld [hli], a
xor a
ld [hli], a
ld [hli], a
2015-11-19 15:07:20 -08:00
dec c
2020-10-06 10:50:02 -07:00
jr nz, .loop
2015-11-19 15:07:20 -08:00
ret
DebugColor_FillBoxWithByte:
2015-11-19 15:07:20 -08:00
; For some reason, we have another copy of FillBoxWithByte here
.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
2018-06-24 07:09:41 -07:00
Function81f0c:
2015-11-19 15:07:20 -08:00
ld a, [wcfbe]
push af
set 7, a
ld [wcfbe], a
2020-10-06 10:50:02 -07:00
call DebugColor_PushSGBPals
2015-11-19 15:07:20 -08:00
pop af
ld [wcfbe], a
ret
2020-10-06 10:50:02 -07:00
DebugColor_PushSGBPals:
2015-11-19 15:07:20 -08:00
ld a, [hl]
and $7
ret z
ld b, a
2020-10-06 10:50:02 -07:00
.loop
2015-11-19 15:07:20 -08:00
push bc
xor a
ldh [rJOYP], a
2015-11-19 15:07:20 -08:00
ld a, $30
ldh [rJOYP], a
2015-11-19 15:07:20 -08:00
ld b, $10
2020-10-06 10:50:02 -07:00
.loop2
2015-11-19 15:07:20 -08:00
ld e, $8
ld a, [hli]
ld d, a
2020-10-06 10:50:02 -07:00
.loop3
2015-11-19 15:07:20 -08:00
bit 0, d
ld a, $10
2020-10-06 10:50:02 -07:00
jr nz, .okay
2015-11-19 15:07:20 -08:00
ld a, $20
2020-10-06 10:50:02 -07:00
.okay
ldh [rJOYP], a
2015-11-19 15:07:20 -08:00
ld a, $30
ldh [rJOYP], a
2015-11-19 15:07:20 -08:00
rr d
dec e
2020-10-06 10:50:02 -07:00
jr nz, .loop3
2015-11-19 15:07:20 -08:00
dec b
2020-10-06 10:50:02 -07:00
jr nz, .loop2
2015-11-19 15:07:20 -08:00
ld a, $20
ldh [rJOYP], a
2015-11-19 15:07:20 -08:00
ld a, $30
ldh [rJOYP], a
2015-11-19 15:07:20 -08:00
ld de, 7000
2020-10-06 10:50:02 -07:00
.wait
2015-11-19 15:07:20 -08:00
nop
nop
nop
dec de
ld a, d
or e
2020-10-06 10:50:02 -07:00
jr nz, .wait
2015-11-19 15:07:20 -08:00
pop bc
dec b
2020-10-06 10:50:02 -07:00
jr nz, .loop
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
DebugColor_PlaceCursor:
ld a, DEBUGTEST_BLACK
2015-11-19 15:07:20 -08:00
hlcoord 10, 0
ld [hl], a
hlcoord 15, 0
ld [hl], a
hlcoord 1, 11
ld [hl], a
hlcoord 1, 13
ld [hl], a
hlcoord 1, 15
ld [hl], a
ld a, [wJumptableIndex]
2020-10-06 10:50:02 -07:00
cp 3
jr nz, .clearsprites
2015-11-19 15:07:20 -08:00
ld a, [wcf64]
and a
jr z, .asm_81f8d
dec a
hlcoord 1, 11
ld bc, 2 * SCREEN_WIDTH
call AddNTimes
2020-10-06 10:50:02 -07:00
ld [hl], "▶"
2015-11-19 15:07:20 -08:00
.asm_81f8d
ld a, [wcf65]
and a
2020-10-06 10:50:02 -07:00
jr z, .lightcolor
; .darkcolor
2015-11-19 15:07:20 -08:00
hlcoord 15, 0
2020-10-06 10:50:02 -07:00
jr .place
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.lightcolor
2015-11-19 15:07:20 -08:00
hlcoord 10, 0
2020-10-06 10:50:02 -07:00
.place
ld [hl], "▶"
2015-11-19 15:07:20 -08:00
ld b, $70
ld c, $5
ld hl, wVirtualOAM
2015-11-19 15:07:20 -08:00
ld de, wc608 + 10
2020-10-06 10:50:02 -07:00
call .placesprite
2015-11-19 15:07:20 -08:00
ld de, wc608 + 11
2020-10-06 10:50:02 -07:00
call .placesprite
2015-11-19 15:07:20 -08:00
ld de, wc608 + 12
2020-10-06 10:50:02 -07:00
call .placesprite
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
.placesprite
2015-11-19 15:07:20 -08:00
ld a, b
2018-01-10 10:47:57 -08:00
ld [hli], a ; y
2015-11-19 15:07:20 -08:00
ld a, [de]
add a
add a
2018-01-10 10:47:57 -08:00
add 3 * TILE_WIDTH
ld [hli], a ; x
2015-11-19 15:07:20 -08:00
xor a
2018-01-10 10:47:57 -08:00
ld [hli], a ; tile id
2015-11-19 15:07:20 -08:00
ld a, c
2018-01-10 10:47:57 -08:00
ld [hli], a ; attributes
ld a, 2 * TILE_WIDTH
2015-11-19 15:07:20 -08:00
add b
ld b, a
inc c
ret
2020-10-06 10:50:02 -07:00
.clearsprites
2015-11-19 15:07:20 -08:00
call ClearSprites
ret
2020-10-06 10:50:02 -07:00
DebugColor_AreYouFinishedString:
db "おわりますか?" ; Are you finished?
next "はい<DOT><DOT><DOT>", DEBUGTEST_A ; YES...(A)
next "いいえ<DOT><DOT>", DEBUGTEST_B ; NO..(B)
2015-11-19 15:07:20 -08:00
db "@"
DebugUpArrowGFX:
INCBIN "gfx/debug/up_arrow.2bpp"
2020-10-06 10:50:02 -07:00
DebugColor_GFX:
2015-11-19 15:07:20 -08:00
INCBIN "gfx/debug/color_test.2bpp"
TilesetColorPicker:
; A debug function to test tileset palettes at runtime.
2020-10-06 10:50:02 -07:00
; dummied out
2015-11-19 15:07:20 -08:00
ret
xor a
ld [wJumptableIndex], a
ld [wcf64], a
ld [wcf65], a
ld [wcf66], a
ldh [hMapAnims], a
2015-11-19 15:07:20 -08:00
call ClearSprites
call OverworldTextModeSwitch
2015-12-11 13:59:40 -08:00
call WaitBGMap2
2015-11-19 15:07:20 -08:00
xor a
ldh [hBGMapMode], a
2020-10-06 10:50:02 -07:00
ld de, DebugColor_GFX
ld hl, vTiles2 tile DEBUGTEST_TICKS_1
2020-10-06 10:50:02 -07:00
lb bc, BANK(DebugColor_GFX), 22
2015-11-19 15:07:20 -08:00
call Request2bpp
ld de, DebugUpArrowGFX
2017-12-28 04:32:33 -08:00
ld hl, vTiles1
lb bc, BANK(DebugUpArrowGFX), 1
2015-11-19 15:07:20 -08:00
call Request2bpp
2017-12-28 04:32:33 -08:00
ld a, HIGH(vBGMap1)
ldh [hBGMapAddress + 1], a
2015-11-19 15:07:20 -08:00
hlcoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, DEBUGTEST_BLACK
2015-11-19 15:07:20 -08:00
call ByteFill
hlcoord 0, 0, wAttrmap
2015-11-19 15:07:20 -08:00
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
ld a, PAL_BG_TEXT
2015-11-19 15:07:20 -08:00
call ByteFill
decoord 1, 1, 0
ld a, DEBUGTEST_WHITE
call DebugTileset_DrawColorSwatch
decoord 6, 1, 0
ld a, DEBUGTEST_LIGHT
call DebugTileset_DrawColorSwatch
decoord 11, 1, 0
ld a, DEBUGTEST_DARK
call DebugTileset_DrawColorSwatch
decoord 16, 1, 0
ld a, DEBUGTEST_BLACK
call DebugTileset_DrawColorSwatch
call DebugTileset_LoadRGBMeter
2015-11-19 15:07:20 -08:00
call Function8220f
2015-12-11 13:59:40 -08:00
call WaitBGMap2
2015-11-19 15:07:20 -08:00
ld [wJumptableIndex], a
ld a, $40
ldh [hWY], a
2015-11-19 15:07:20 -08:00
ret
DebugTileset_DrawColorSwatch:
2015-11-19 15:07:20 -08:00
hlcoord 0, 0
call _DebugColor_DrawSwatch
2015-11-19 15:07:20 -08:00
DebugColor_DrawAttributeSwatch:
2015-11-19 15:07:20 -08:00
ld a, [wcf64]
hlcoord 0, 0, wAttrmap
2015-11-19 15:07:20 -08:00
_DebugColor_DrawSwatch:
; Fills a 4x3 box at de with byte a.
2015-11-19 15:07:20 -08:00
add hl, de
rept 4
ld [hli], a
endr
rept 2
ld bc, SCREEN_WIDTH - 4
2015-11-19 15:07:20 -08:00
add hl, bc
rept 4
ld [hli], a
endr
endr
ret
DebugTileset_LoadRGBMeter:
2015-11-19 15:07:20 -08:00
hlcoord 2, 4
2020-10-06 10:50:02 -07:00
call .Place
2015-11-19 15:07:20 -08:00
hlcoord 2, 6
2020-10-06 10:50:02 -07:00
call .Place
2015-11-19 15:07:20 -08:00
hlcoord 2, 8
2020-10-06 10:50:02 -07:00
.Place:
ld a, DEBUGTEST_TICKS_1
2015-11-19 15:07:20 -08:00
ld [hli], a
ld bc, 15
ld a, DEBUGTEST_TICKS_2
2015-11-19 15:07:20 -08:00
call ByteFill
ret
2018-06-24 07:09:41 -07:00
Function8220f:
ldh a, [rSVBK]
2015-11-19 15:07:20 -08:00
push af
ld a, BANK(wBGPals1)
ldh [rSVBK], a
2020-10-06 10:50:02 -07:00
2015-11-19 15:07:20 -08:00
ld a, [wcf64]
ld l, a
2020-10-06 10:50:02 -07:00
ld h, 0
2015-11-19 15:07:20 -08:00
add hl, hl
add hl, hl
add hl, hl
2018-01-01 06:08:21 -08:00
ld de, wBGPals1
2015-11-19 15:07:20 -08:00
add hl, de
ld de, wc608
ld bc, 1 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
ld de, wc608
2020-10-06 10:50:02 -07:00
call DebugColor_CalculateRGB
2015-11-19 15:07:20 -08:00
pop af
ldh [rSVBK], a
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
DebugColorMain2: ; unreferenced
2015-11-19 15:07:20 -08:00
ld hl, hJoyLast
ld a, [hl]
and SELECT
jr nz, .loop7
ld a, [hl]
and B_BUTTON
jr nz, .cancel
2015-11-19 15:07:20 -08:00
call Function822f0
ret
.loop7
ld hl, wcf64
ld a, [hl]
inc a
and PALETTE_MASK
cp PAL_BG_TEXT
jr nz, .palette_ok
xor a ; PAL_BG_GRAY
.palette_ok
2015-11-19 15:07:20 -08:00
ld [hl], a
decoord 1, 1, 0
call DebugColor_DrawAttributeSwatch
decoord 6, 1, 0
call DebugColor_DrawAttributeSwatch
decoord 11, 1, 0
call DebugColor_DrawAttributeSwatch
decoord 16, 1, 0
call DebugColor_DrawAttributeSwatch
ldh a, [rSVBK]
2015-11-19 15:07:20 -08:00
push af
ld a, BANK(wBGPals2)
ldh [rSVBK], a
2018-01-01 06:08:21 -08:00
ld hl, wBGPals2
2015-11-19 15:07:20 -08:00
ld a, [wcf64]
2018-01-01 05:47:16 -08:00
ld bc, 1 palettes
2015-11-19 15:07:20 -08:00
call AddNTimes
ld de, wc608
2018-01-01 05:47:16 -08:00
ld bc, 1 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
pop af
ldh [rSVBK], a
2020-10-06 10:50:02 -07:00
ld a, 2
ldh [hBGMapMode], a
2015-11-19 15:07:20 -08:00
ld c, 3
call DelayFrames
2020-10-06 10:50:02 -07:00
ld a, 1
ldh [hBGMapMode], a
2015-11-19 15:07:20 -08:00
ret
.cancel
2015-11-19 15:07:20 -08:00
call ClearSprites
ldh a, [hWY]
2020-10-06 10:50:02 -07:00
xor %11010000
ldh [hWY], a
2015-11-19 15:07:20 -08:00
ret
2018-06-24 07:09:41 -07:00
Function822a3:
ldh a, [rSVBK]
2015-11-19 15:07:20 -08:00
push af
ld a, BANK(wBGPals2)
ldh [rSVBK], a
2018-01-01 06:08:21 -08:00
ld hl, wBGPals2
2015-11-19 15:07:20 -08:00
ld a, [wcf64]
2018-01-01 05:47:16 -08:00
ld bc, 1 palettes
2015-11-19 15:07:20 -08:00
call AddNTimes
ld e, l
ld d, h
ld hl, wc608
2018-01-01 05:47:16 -08:00
ld bc, 1 palettes
2015-11-19 15:07:20 -08:00
call CopyBytes
hlcoord 1, 0
ld de, wc608
call Function81ca7
hlcoord 6, 0
ld de, wc608 + 2
call Function81ca7
hlcoord 11, 0
ld de, wc608 + 4
call Function81ca7
hlcoord 16, 0
ld de, wc608 + 6
call Function81ca7
pop af
ldh [rSVBK], a
2020-08-03 14:41:01 -07:00
ld a, TRUE
ldh [hCGBPalUpdate], a
2015-11-19 15:07:20 -08:00
call DelayFrame
ret
2018-06-24 07:09:41 -07:00
Function822f0:
2015-11-19 15:07:20 -08:00
ld a, [wcf65]
and 3
ld e, a
ld d, 0
2020-10-06 10:50:02 -07:00
ld hl, .PointerTable
2015-11-19 15:07:20 -08:00
add hl, de
add hl, de
2015-11-19 15:07:20 -08:00
ld a, [hli]
ld h, [hl]
ld l, a
jp hl
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.PointerTable:
dw DebugColor_SelectColorBox2
dw Function82339 ; Red
dw Function8234b ; Green
dw Function8235d ; Blue
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
DebugColor_SelectColorBox2:
2015-11-19 15:07:20 -08:00
ld hl, hJoyLast
ld a, [hl]
and D_DOWN
jr nz, Function8238c
ld a, [hl]
and D_LEFT
2020-10-06 10:50:02 -07:00
jr nz, .left
2015-11-19 15:07:20 -08:00
ld a, [hl]
and D_RIGHT
2020-10-06 10:50:02 -07:00
jr nz, .right
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
.left
2015-11-19 15:07:20 -08:00
ld a, [wcf66]
dec a
2020-10-06 10:50:02 -07:00
jr .done
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.right
2015-11-19 15:07:20 -08:00
ld a, [wcf66]
inc a
2020-10-06 10:50:02 -07:00
.done
2015-11-19 15:07:20 -08:00
and $3
ld [wcf66], a
ld e, a
2020-10-06 10:50:02 -07:00
ld d, 0
2015-11-19 15:07:20 -08:00
ld hl, wc608
add hl, de
add hl, de
2015-11-19 15:07:20 -08:00
ld e, l
ld d, h
2020-10-06 10:50:02 -07:00
call DebugColor_CalculateRGB
2015-11-19 15:07:20 -08:00
ret
2018-06-24 07:09:41 -07:00
Function82339:
2015-11-19 15:07:20 -08:00
ld hl, hJoyLast
ld a, [hl]
and D_DOWN
jr nz, Function8238c
ld a, [hl]
and D_UP
jr nz, Function82387
ld hl, wc608 + 10
jr Function82368
2018-06-24 07:09:41 -07:00
Function8234b:
2015-11-19 15:07:20 -08:00
ld hl, hJoyLast
ld a, [hl]
and D_DOWN
jr nz, Function8238c
ld a, [hl]
and D_UP
jr nz, Function82387
ld hl, wc608 + 11
jr Function82368
2018-06-24 07:09:41 -07:00
Function8235d:
2015-11-19 15:07:20 -08:00
ld hl, hJoyLast
ld a, [hl]
and D_UP
jr nz, Function82387
ld hl, wc608 + 12
2018-06-24 07:09:41 -07:00
Function82368:
ldh a, [hJoyLast]
2015-11-19 15:07:20 -08:00
and D_RIGHT
2020-10-06 10:50:02 -07:00
jr nz, .right
ldh a, [hJoyLast]
2015-11-19 15:07:20 -08:00
and D_LEFT
2020-10-06 10:50:02 -07:00
jr nz, .left
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
.right
2015-11-19 15:07:20 -08:00
ld a, [hl]
2020-10-06 10:50:02 -07:00
cp 31
2015-11-19 15:07:20 -08:00
ret nc
inc [hl]
2020-10-06 10:50:02 -07:00
jr .done
2015-11-19 15:07:20 -08:00
2020-10-06 10:50:02 -07:00
.left
2015-11-19 15:07:20 -08:00
ld a, [hl]
and a
ret z
dec [hl]
2020-10-06 10:50:02 -07:00
.done
2015-11-19 15:07:20 -08:00
call Function82391
call Function822a3
ret
2018-06-24 07:09:41 -07:00
Function82387:
2015-11-19 15:07:20 -08:00
ld hl, wcf65
dec [hl]
ret
2018-06-24 07:09:41 -07:00
Function8238c:
2015-11-19 15:07:20 -08:00
ld hl, wcf65
inc [hl]
ret
2018-06-24 07:09:41 -07:00
Function82391:
2015-11-19 15:07:20 -08:00
ld a, [wc608 + 10]
2020-10-06 10:50:02 -07:00
and %00011111
2015-11-19 15:07:20 -08:00
ld e, a
ld a, [wc608 + 11]
2020-10-06 10:50:02 -07:00
and %0000111
2015-11-19 15:07:20 -08:00
sla a
swap a
or e
ld e, a
ld a, [wc608 + 11]
2020-10-06 10:50:02 -07:00
and %00011000
2015-11-19 15:07:20 -08:00
sla a
swap a
ld d, a
ld a, [wc608 + 12]
2020-10-06 10:50:02 -07:00
and %00011111
2015-11-19 15:07:20 -08:00
sla a
sla a
or d
ld d, a
ld a, [wcf66]
ld c, a
2020-10-06 10:50:02 -07:00
ld b, 0
2015-11-19 15:07:20 -08:00
ld hl, wc608
add hl, bc
add hl, bc
2015-11-19 15:07:20 -08:00
ld a, e
ld [hli], a
ld [hl], d
ret
2020-10-06 10:50:02 -07:00
; unused
2015-11-19 15:07:20 -08:00
ret
2020-10-06 10:50:02 -07:00
; unused
2015-11-19 15:07:20 -08:00
ret