summaryrefslogtreecommitdiff
path: root/engine/debug
diff options
context:
space:
mode:
Diffstat (limited to 'engine/debug')
-rw-r--r--engine/debug/color_picker.asm238
1 files changed, 115 insertions, 123 deletions
diff --git a/engine/debug/color_picker.asm b/engine/debug/color_picker.asm
index 5dbc62d4a..ee9a9f6a6 100644
--- a/engine/debug/color_picker.asm
+++ b/engine/debug/color_picker.asm
@@ -58,8 +58,8 @@ DebugColorPicker:
xor a ; DEBUGCOLORMAIN_INITSCREEN
ld [wJumptableIndex], a
- ld [wcf66], a
- ld [wd003], a
+ ld [wDebugColorCurMon], a
+ ld [wDebugColorIsShiny], a
.loop
ld a, [wJumptableIndex]
bit 7, a
@@ -75,14 +75,14 @@ DebugColorPicker:
ret
DebugColor_InitMonOrTrainerColor:
- ld a, [wd002]
+ ld a, [wDebugColorIsTrainer]
and a
jr nz, DebugColor_InitTrainerColor
ld hl, PokemonPalettes
; fallthrough
DebugColor_InitMonColor:
- ld de, wOverworldMapBlocks
+ ld de, wDebugOriginalColors
ld c, NUM_POKEMON + 1
.loop
push bc
@@ -98,7 +98,7 @@ DebugColor_InitMonColor:
DebugColor_InitTrainerColor:
ld hl, TrainerPalettes
- ld de, wOverworldMapBlocks
+ ld de, wDebugOriginalColors
ld c, NUM_TRAINER_CLASSES
.loop
push bc
@@ -113,24 +113,13 @@ DebugColor_InitTrainerColor:
ret
DebugColor_InitColor:
+rept 3
ld a, BANK(PokemonPalettes) ; aka BANK(TrainerPalettes)
call GetFarByte
ld [de], a
inc de
inc hl
-
- ld a, BANK(PokemonPalettes) ; aka BANK(TrainerPalettes)
- call GetFarByte
- ld [de], a
- inc de
- inc hl
-
- ld a, BANK(PokemonPalettes) ; aka BANK(TrainerPalettes)
- call GetFarByte
- ld [de], a
- inc de
- inc hl
-
+endr
ld a, BANK(PokemonPalettes) ; aka BANK(TrainerPalettes)
call GetFarByte
ld [de], a
@@ -225,14 +214,14 @@ DebugColor_InitPalettes:
dec c
jr nz, .ob_loop
- 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
+ ld a, LOW(palred 20 + palgreen 20 + palblue 20)
+ ld [wDebugLightColor + 0], a
+ ld a, HIGH(palred 20 + palgreen 20 + palblue 20)
+ ld [wDebugLightColor + 1], a
+ ld a, LOW(palred 10 + palgreen 10 + palblue 10)
+ ld [wDebugDarkColor + 0], a
+ ld a, HIGH(palred 10 + palgreen 10 + palblue 10)
+ ld [wDebugDarkColor + 1], a
pop af
ldh [rSVBK], a
@@ -264,7 +253,7 @@ DebugColorMain:
call DebugColor_BackupSpriteColors
call .SetMaxNum
ld e, a
- ld a, [wcf66]
+ ld a, [wDebugColorCurMon]
inc a
cp e
jr c, .SwitchMon
@@ -273,7 +262,7 @@ DebugColorMain:
.PreviousMon:
call DebugColor_BackupSpriteColors
- ld a, [wcf66]
+ ld a, [wDebugColorCurMon]
dec a
cp -1
jr nz, .SwitchMon
@@ -281,14 +270,14 @@ DebugColorMain:
dec a
.SwitchMon:
- ld [wcf66], a
+ ld [wDebugColorCurMon], a
ld a, DEBUGCOLORMAIN_INITSCREEN
ld [wJumptableIndex], a
ret
.SetMaxNum:
; Looping back around the pic set.
- ld a, [wd002]
+ ld a, [wDebugColorIsTrainer]
and a
jr nz, .trainer
; mon
@@ -328,7 +317,7 @@ DebugColor_InitScreen:
call DebugColor_FillBoxWithByte
call DebugColor_LoadRGBMeter
call DebugColor_SetRGBMeter
- ld a, [wcf66]
+ ld a, [wDebugColorCurMon]
inc a
ld [wCurPartySpecies], a
ld [wDeciramBuffer], a
@@ -336,7 +325,7 @@ DebugColor_InitScreen:
ld de, wDeciramBuffer
lb bc, PRINTNUM_LEADINGZEROS | 1, 3
call PrintNum
- ld a, [wd002]
+ ld a, [wDebugColorIsTrainer]
and a
jr nz, .trainer
@@ -358,7 +347,7 @@ DebugColor_InitScreen:
lb bc, 6, 6
predef PlaceGraphic
- ld a, [wd003]
+ ld a, [wDebugColorIsShiny]
and a
jr z, .normal
; shiny
@@ -431,21 +420,21 @@ DebugColor_LoadRGBMeter:
ret
DebugColor_SetRGBMeter:
- ld a, [wcf66]
+ ld a, [wDebugColorCurMon]
inc a
ld l, a
ld h, 0
add hl, hl
add hl, hl
- ld de, wOverworldMapBlocks
+ ld de, wDebugOriginalColors
add hl, de
- ld de, wc608
+ ld de, wDebugMiddleColors
ld bc, 4
call CopyBytes
xor a
- ld [wcf64], a
- ld [wcf65], a
- ld de, wc608
+ ld [wDebugColorRGBJumptableIndex], a
+ ld [wDebugColorCurColor], a
+ ld de, wDebugLightColor
call DebugColor_CalculateRGB
ret
@@ -479,15 +468,15 @@ DebugColor_UpdatePalettes:
ldh [rSVBK], a
ld hl, wBGPals2
- ld de, wc608
+ ld de, wDebugMiddleColors
ld c, 1
call DebugColor_LoadPalettes_White_Col1_Col2_Black
hlcoord 10, 2
- ld de, wc608
+ ld de, wDebugLightColor
call DebugColor_PrintHexColor
hlcoord 15, 2
- ld de, wc608 + 2
+ ld de, wDebugDarkColor
call DebugColor_PrintHexColor
ld a, TRUE
@@ -508,13 +497,13 @@ DebugColor_UpdatePalettes:
ld [hli], a
ld a, HIGH(PALRGB_WHITE)
ld [hli], a
- ld a, [wc608]
+ ld a, [wDebugLightColor + 0]
ld [hli], a
- ld a, [wc608 + 1]
+ ld a, [wDebugLightColor + 1]
ld [hli], a
- ld a, [wc608 + 2]
+ ld a, [wDebugDarkColor + 0]
ld [hli], a
- ld a, [wc608 + 3]
+ ld a, [wDebugDarkColor + 1]
ld [hli], a
xor a
ld [hli], a
@@ -525,10 +514,10 @@ DebugColor_UpdatePalettes:
call DebugColor_PushSGBPals
hlcoord 10, 2
- ld de, wc608
+ ld de, wDebugLightColor
call DebugColor_PrintHexColor
hlcoord 15, 2
- ld de, wc608 + 2
+ ld de, wDebugDarkColor
call DebugColor_PrintHexColor
ld a, DEBUGCOLORMAIN_JOYPAD
@@ -563,7 +552,7 @@ DebugColor_Joypad:
and A_BUTTON
jr nz, .toggle_shiny
- ld a, [wcf64]
+ ld a, [wDebugColorRGBJumptableIndex]
maskbits 4 ; .PointerTable length
ld e, a
ld d, 0
@@ -583,13 +572,13 @@ DebugColor_Joypad:
.toggle_shiny
; Toggle between the normal and shiny mon colors.
- ld a, [wd002]
+ ld a, [wDebugColorIsTrainer]
and a
ret nz
- ld a, [wd003]
+ ld a, [wDebugColorIsShiny]
xor %00000100
- ld [wd003], a
+ ld [wDebugColorIsShiny], a
ld c, a
ld b, 0
ld hl, PokemonPalettes
@@ -620,16 +609,16 @@ DebugColor_SelectColorBox:
ret
.light
- xor a
- ld [wcf65], a
- ld de, wc608
+ xor a ; FALSE
+ ld [wDebugColorCurColor], a
+ ld de, wDebugLightColor
call DebugColor_CalculateRGB
ret
.dark
ld a, TRUE
- ld [wcf65], a
- ld de, wc608 + 2
+ ld [wDebugColorCurColor], a
+ ld de, wDebugDarkColor
call DebugColor_CalculateRGB
ret
@@ -641,7 +630,7 @@ DebugColor_ChangeRedValue:
ld a, [hl]
and D_UP
jr nz, DebugColor_PreviousRGBColor
- ld hl, wc608 + 10
+ ld hl, wDebugRedChannel
jr DebugColor_UpdateRGBColor
DebugColor_ChangeGreenValue:
@@ -652,7 +641,7 @@ DebugColor_ChangeGreenValue:
ld a, [hl]
and D_UP
jr nz, DebugColor_PreviousRGBColor
- ld hl, wc608 + 11
+ ld hl, wDebugGreenChannel
jr DebugColor_UpdateRGBColor
DebugColor_ChangeBlueValue:
@@ -660,7 +649,8 @@ DebugColor_ChangeBlueValue:
ld a, [hl]
and D_UP
jr nz, DebugColor_PreviousRGBColor
- ld hl, wc608 + 12
+ ld hl, wDebugBlueChannel
+ ; fallthrough
DebugColor_UpdateRGBColor:
ldh a, [hJoyLast]
@@ -691,12 +681,12 @@ DebugColor_UpdateRGBColor:
ret
DebugColor_PreviousRGBColor:
- ld hl, wcf64
+ ld hl, wDebugColorRGBJumptableIndex
dec [hl]
ret
DebugColor_NextRGBColor:
- ld hl, wcf64
+ ld hl, wDebugColorRGBJumptableIndex
inc [hl]
ret
@@ -709,7 +699,7 @@ DebugColor_InitTMHM:
ld de, DebugColor_AreYouFinishedString
call PlaceString
xor a
- ld [wd004], a
+ ld [wDebugColorCurTMHM], a
call DebugColor_PrintTMHMMove
ld a, DEBUGCOLORMAIN_TMHMJOYPAD
ld [wJumptableIndex], a
@@ -744,7 +734,7 @@ DebugColor_TMHMJoypad:
ret
.up
- ld a, [wd004]
+ ld a, [wDebugColorCurTMHM]
cp NUM_TM_HM_TUTOR - 1
jr z, .wrap_down
inc a
@@ -755,7 +745,7 @@ DebugColor_TMHMJoypad:
jr .done
.down
- ld a, [wd004]
+ ld a, [wDebugColorCurTMHM]
and a
jr z, .wrap_up
dec a
@@ -765,7 +755,7 @@ DebugColor_TMHMJoypad:
ld a, NUM_TM_HM_TUTOR - 1
.done
- ld [wd004], a
+ ld [wDebugColorCurTMHM], a
call DebugColor_PrintTMHMMove
ret
@@ -779,7 +769,7 @@ DebugColor_PrintTMHMMove:
hlcoord 10, 14
call .ClearRow
- ld a, [wd004]
+ ld a, [wDebugColorCurTMHM]
inc a
ld [wTempTMHM], a
predef GetTMHMMove
@@ -789,7 +779,7 @@ DebugColor_PrintTMHMMove:
hlcoord 10, 12
call PlaceString
- ld a, [wd004]
+ ld a, [wDebugColorCurTMHM]
call .GetNumberedTMHM
ld [wCurItem], a
predef CanLearnTMHMMove
@@ -826,48 +816,48 @@ DebugColor_PrintTMHMMove:
ret
DebugColor_CalculatePalette:
- ld a, [wc608 + 10]
+ ld a, [wDebugRedChannel]
and %00011111
ld e, a
- ld a, [wc608 + 11]
+ ld a, [wDebugGreenChannel]
and %00000111
sla a
swap a
or e
ld e, a
- ld a, [wc608 + 11]
+ ld a, [wDebugGreenChannel]
and %00011000
sla a
swap a
ld d, a
- ld a, [wc608 + 12]
+ ld a, [wDebugBlueChannel]
and %00011111
sla a
sla a
or d
ld d, a
- ld a, [wcf65]
+ ld a, [wDebugColorCurColor]
and a
jr z, .light
; dark
ld a, e
- ld [wc608 + 2], a
+ ld [wDebugDarkColor + 0], a
ld a, d
- ld [wc608 + 3], a
+ ld [wDebugDarkColor + 1], a
ret
.light
ld a, e
- ld [wc608], a
+ ld [wDebugLightColor + 0], a
ld a, d
- ld [wc608 + 1], a
+ ld [wDebugLightColor + 1], a
ret
DebugColor_CalculateRGB:
ld a, [de]
and %00011111
- ld [wc608 + 10], a
+ ld [wDebugRedChannel], a
ld a, [de]
and %11100000
swap a
@@ -879,26 +869,26 @@ DebugColor_CalculateRGB:
swap a
srl a
or b
- ld [wc608 + 11], a
+ ld [wDebugGreenChannel], a
ld a, [de]
and %01111100
srl a
srl a
- ld [wc608 + 12], a
+ ld [wDebugBlueChannel], a
ret
DebugColor_BackupSpriteColors:
- ld a, [wcf66]
+ ld a, [wDebugColorCurMon]
inc a
ld l, a
ld h, 0
add hl, hl
add hl, hl
- ld de, wOverworldMapBlocks ; MonPalette
+ ld de, wDebugOriginalColors
add hl, de
ld e, l
ld d, h
- ld hl, wc608
+ ld hl, wDebugMiddleColors
ld bc, 4
call CopyBytes
ret
@@ -1013,7 +1003,7 @@ DebugColor_PlaceCursor:
cp DEBUGCOLORMAIN_JOYPAD
jr nz, .clearsprites
- ld a, [wcf64]
+ ld a, [wDebugColorRGBJumptableIndex]
and a
jr z, .place_cursor
dec a
@@ -1023,7 +1013,7 @@ DebugColor_PlaceCursor:
ld [hl], "▶"
.place_cursor
- ld a, [wcf65]
+ ld a, [wDebugColorCurColor]
and a
jr z, .light
; dark
@@ -1037,11 +1027,11 @@ DebugColor_PlaceCursor:
ld b, $70 ; initial tile id
ld c, 5 ; initial palette
ld hl, wVirtualOAM
- ld de, wc608 + 10
+ ld de, wDebugRedChannel
call .placesprite
- ld de, wc608 + 11
+ ld de, wDebugGreenChannel
call .placesprite
- ld de, wc608 + 12
+ ld de, wDebugBlueChannel
call .placesprite
ret
@@ -1086,9 +1076,9 @@ TilesetColorPicker:
xor a
ld [wJumptableIndex], a
- ld [wcf64], a
- ld [wcf65], a
- ld [wcf66], a
+ ld [wDebugTilesetCurPalette], a
+ ld [wDebugTilesetRGBJumptableIndex], a
+ ld [wDebugTilesetCurColor], a
ldh [hMapAnims], a
call ClearSprites
call OverworldTextModeSwitch
@@ -1138,8 +1128,9 @@ DebugTileset_DrawColorSwatch:
call _DebugColor_DrawSwatch
DebugColor_DrawAttributeSwatch:
- ld a, [wcf64]
+ ld a, [wDebugTilesetCurPalette]
hlcoord 0, 0, wAttrmap
+ ; fallthrough
_DebugColor_DrawSwatch:
; Fills a 4x3 box at de with byte a.
@@ -1176,7 +1167,7 @@ DebugTileset_LoadPalettes:
ld a, BANK(wBGPals1)
ldh [rSVBK], a
- ld a, [wcf64]
+ ld a, [wDebugTilesetCurPalette]
ld l, a
ld h, 0
add hl, hl
@@ -1184,10 +1175,10 @@ DebugTileset_LoadPalettes:
add hl, hl
ld de, wBGPals1
add hl, de
- ld de, wc608
+ ld de, wDebugPalette
ld bc, 1 palettes
call CopyBytes
- ld de, wc608
+ ld de, wDebugPalette
call DebugColor_CalculateRGB
pop af
@@ -1198,15 +1189,15 @@ DebugColorMain2: ; unreferenced
ld hl, hJoyLast
ld a, [hl]
and SELECT
- jr nz, .loop7
+ jr nz, .next_palette
ld a, [hl]
and B_BUTTON
jr nz, .cancel
call DebugTileset_Joypad
ret
-.loop7
- ld hl, wcf64
+.next_palette
+ ld hl, wDebugTilesetCurPalette
ld a, [hl]
inc a
and PALETTE_MASK
@@ -1230,10 +1221,10 @@ DebugColorMain2: ; unreferenced
ldh [rSVBK], a
ld hl, wBGPals2
- ld a, [wcf64]
+ ld a, [wDebugTilesetCurPalette]
ld bc, 1 palettes
call AddNTimes
- ld de, wc608
+ ld de, wDebugPalette
ld bc, 1 palettes
call CopyBytes
@@ -1262,26 +1253,26 @@ DebugTileset_UpdatePalettes:
ldh [rSVBK], a
ld hl, wBGPals2
- ld a, [wcf64]
+ ld a, [wDebugTilesetCurPalette]
ld bc, 1 palettes
call AddNTimes
ld e, l
ld d, h
- ld hl, wc608
+ ld hl, wDebugPalette
ld bc, 1 palettes
call CopyBytes
hlcoord 1, 0
- ld de, wc608
+ ld de, wDebugWhiteTileColor
call DebugColor_PrintHexColor
hlcoord 6, 0
- ld de, wc608 + 2
+ ld de, wDebugLightTileColor
call DebugColor_PrintHexColor
hlcoord 11, 0
- ld de, wc608 + 4
+ ld de, wDebugDarkTileColor
call DebugColor_PrintHexColor
hlcoord 16, 0
- ld de, wc608 + 6
+ ld de, wDebugBlackTileColor
call DebugColor_PrintHexColor
pop af
@@ -1294,7 +1285,7 @@ DebugTileset_UpdatePalettes:
ret
DebugTileset_Joypad:
- ld a, [wcf65]
+ ld a, [wDebugTilesetRGBJumptableIndex]
maskbits 4 ; .PointerTable length
ld e, a
ld d, 0
@@ -1326,20 +1317,20 @@ DebugTileset_SelectColorBox:
ret
.left
- ld a, [wcf66]
+ ld a, [wDebugTilesetCurColor]
dec a
jr .done
.right
- ld a, [wcf66]
+ ld a, [wDebugTilesetCurColor]
inc a
.done
- and $3
- ld [wcf66], a
+ maskbits NUM_PAL_COLORS
+ ld [wDebugTilesetCurColor], a
ld e, a
ld d, 0
- ld hl, wc608
+ ld hl, wDebugPalette
add hl, de
add hl, de
ld e, l
@@ -1355,7 +1346,7 @@ DebugTileset_ChangeRedValue:
ld a, [hl]
and D_UP
jr nz, DebugTileset_PreviousRGBColor
- ld hl, wc608 + 10
+ ld hl, wDebugRedChannel
jr DebugTileset_UpdateRGBColor
DebugTileset_ChangeGreenValue:
@@ -1366,7 +1357,7 @@ DebugTileset_ChangeGreenValue:
ld a, [hl]
and D_UP
jr nz, DebugTileset_PreviousRGBColor
- ld hl, wc608 + 11
+ ld hl, wDebugGreenChannel
jr DebugTileset_UpdateRGBColor
DebugTileset_ChangeBlueValue:
@@ -1374,7 +1365,8 @@ DebugTileset_ChangeBlueValue:
ld a, [hl]
and D_UP
jr nz, DebugTileset_PreviousRGBColor
- ld hl, wc608 + 12
+ ld hl, wDebugBlueChannel
+ ; fallthrough
DebugTileset_UpdateRGBColor:
ldh a, [hJoyLast]
@@ -1404,40 +1396,40 @@ DebugTileset_UpdateRGBColor:
ret
DebugTileset_PreviousRGBColor:
- ld hl, wcf65
+ ld hl, wDebugTilesetRGBJumptableIndex
dec [hl]
ret
DebugTileset_NextRGBColor:
- ld hl, wcf65
+ ld hl, wDebugTilesetRGBJumptableIndex
inc [hl]
ret
DebugTileset_CalculatePalette:
- ld a, [wc608 + 10]
+ ld a, [wDebugRedChannel]
and %00011111
ld e, a
- ld a, [wc608 + 11]
+ ld a, [wDebugGreenChannel]
and %0000111
sla a
swap a
or e
ld e, a
- ld a, [wc608 + 11]
+ ld a, [wDebugGreenChannel]
and %00011000
sla a
swap a
ld d, a
- ld a, [wc608 + 12]
+ ld a, [wDebugBlueChannel]
and %00011111
sla a
sla a
or d
ld d, a
- ld a, [wcf66]
+ ld a, [wDebugTilesetCurColor]
ld c, a
ld b, 0
- ld hl, wc608
+ ld hl, wDebugPalette
add hl, bc
add hl, bc
ld a, e