Create macro to automatically place fading pals between two sources, and apply it to level selection menu daytime-based background pals (#12)

This commit is contained in:
xCrystal 2024-01-27 22:21:09 +01:00
parent 0d85313c54
commit 2fdfa9057f
4 changed files with 141 additions and 55 deletions

View File

@ -873,12 +873,12 @@ INCLUDE "gfx/slots/slots.pal"
LevelSelectionMenuMalePals:
table_width PAL_COLOR_SIZE * 4 * 6, LevelSelectionMenuMalePals
INCLUDE "gfx/level_selection_menu/background_male.pal"
assert_table_length NUM_DAYTIMES
assert_table_length (NUM_DAYTIMES + NUM_DAYTIMES * 2)
LevelSelectionMenuFemalePals:
table_width PAL_COLOR_SIZE * 4 * 6, LevelSelectionMenuFemalePals
INCLUDE "gfx/level_selection_menu/background_female.pal"
assert_table_length NUM_DAYTIMES
assert_table_length (NUM_DAYTIMES + NUM_DAYTIMES * 2)
LevelSelectionMenuStageTrophiesPals:
INCLUDE "gfx/level_selection_menu/stage_trophies.pal"

View File

@ -1,5 +1,7 @@
; morn
rgbpals_fade_src "lsm_f_morn"
; border
RGB 28, 31, 20
RGB 21, 21, 21
@ -7,13 +9,13 @@
RGB 00, 00, 00
; earth
RGB 28, 31, 20
RGB 00, 31, 00
RGB 00, 00, 31
RGB 07, 31, 03
RGB 05, 05, 31
RGB 00, 00, 00
; mountain
RGB 28, 31, 20
RGB 00, 31, 00
RGB 15, 07, 00
RGB 07, 31, 03
RGB 19, 11, 00
RGB 00, 00, 00
; city (girl)
RGB 28, 31, 20
@ -22,17 +24,21 @@
RGB 00, 00, 00
; point of interest
RGB 28, 31, 20
RGB 00, 31, 00
RGB 00, 00, 31
RGB 07, 31, 03
RGB 05, 05, 31
RGB 31, 00, 00
; mountain point of interest
RGB 28, 31, 20
RGB 00, 31, 00
RGB 15, 07, 00
RGB 07, 31, 03
RGB 19, 11, 00
RGB 31, 00, 00
rgbpals_fade_src_end
; day (original)
rgbpals_fade_src "lsm_f_day"
; border
RGB 28, 31, 20
RGB 21, 21, 21
@ -64,8 +70,12 @@
RGB 15, 07, 00
RGB 31, 00, 00
rgbpals_fade_src_end
; nite
rgbpals_fade_src "lsm_f_nite"
; border
RGB 28, 31, 20
RGB 21, 21, 21
@ -73,13 +83,13 @@
RGB 00, 00, 00
; earth
RGB 28, 31, 20
RGB 00, 31, 00
RGB 00, 00, 31
RGB 00, 15, 00
RGB 00, 00, 15
RGB 00, 00, 00
; mountain
RGB 28, 31, 20
RGB 00, 31, 00
RGB 15, 07, 00
RGB 00, 15, 00
RGB 09, 05, 00
RGB 00, 00, 00
; city (girl)
RGB 28, 31, 20
@ -88,17 +98,21 @@
RGB 00, 00, 00
; point of interest
RGB 28, 31, 20
RGB 00, 31, 00
RGB 00, 00, 31
RGB 00, 15, 00
RGB 00, 00, 15
RGB 31, 00, 00
; mountain point of interest
RGB 28, 31, 20
RGB 00, 31, 00
RGB 15, 07, 00
RGB 00, 15, 00
RGB 09, 05, 00
RGB 31, 00, 00
rgbpals_fade_src_end
; eve
rgbpals_fade_src "lsm_f_eve"
; border
RGB 28, 31, 20
RGB 21, 21, 21
@ -106,13 +120,13 @@
RGB 00, 00, 00
; earth
RGB 28, 31, 20
RGB 00, 31, 00
RGB 00, 00, 31
RGB 04, 22, 00
RGB 04, 00, 22
RGB 00, 00, 00
; mountain
RGB 28, 31, 20
RGB 00, 31, 00
RGB 15, 07, 00
RGB 04, 22, 00
RGB 13, 05, 00
RGB 00, 00, 00
; city (girl)
RGB 28, 31, 20
@ -121,11 +135,18 @@
RGB 00, 00, 00
; point of interest
RGB 28, 31, 20
RGB 00, 31, 00
RGB 00, 00, 31
RGB 04, 22, 00
RGB 04, 00, 22
RGB 31, 00, 00
; mountain point of interest
RGB 28, 31, 20
RGB 00, 31, 00
RGB 15, 07, 00
RGB 04, 22, 00
RGB 13, 05, 00
RGB 31, 00, 00
rgbpals_fade_src_end
rgbpals_fade_apply "lsm_f_morn", "lsm_f_day", 2
rgbpals_fade_apply "lsm_f_day", "lsm_f_eve", 2
rgbpals_fade_apply "lsm_f_eve", "lsm_f_nite", 2
rgbpals_fade_apply "lsm_f_nite", "lsm_f_morn", 2

View File

@ -1,5 +1,7 @@
; morn
rgbpals_fade_src "lsm_m_morn"
; border
RGB 28, 31, 20
RGB 21, 21, 21
@ -7,13 +9,13 @@
RGB 00, 00, 00
; earth
RGB 28, 31, 20
RGB 00, 31, 00
RGB 00, 00, 31
RGB 07, 31, 03
RGB 05, 05, 31
RGB 00, 00, 00
; mountain
RGB 28, 31, 20
RGB 00, 31, 00
RGB 15, 07, 00
RGB 07, 31, 03
RGB 19, 11, 00
RGB 00, 00, 00
; city (boy)
RGB 28, 31, 20
@ -22,17 +24,21 @@
RGB 00, 00, 00
; point of interest
RGB 28, 31, 20
RGB 00, 31, 00
RGB 00, 00, 31
RGB 07, 31, 03
RGB 05, 05, 31
RGB 31, 00, 00
; mountain point of interest
RGB 28, 31, 20
RGB 00, 31, 00
RGB 15, 07, 00
RGB 07, 31, 03
RGB 19, 11, 00
RGB 31, 00, 00
rgbpals_fade_src_end
; day (original)
rgbpals_fade_src "lsm_m_day"
; border
RGB 28, 31, 20
RGB 21, 21, 21
@ -64,8 +70,12 @@
RGB 15, 07, 00
RGB 31, 00, 00
rgbpals_fade_src_end
; nite
rgbpals_fade_src "lsm_m_nite"
; border
RGB 28, 31, 20
RGB 21, 21, 21
@ -73,13 +83,13 @@
RGB 00, 00, 00
; earth
RGB 28, 31, 20
RGB 00, 31, 00
RGB 00, 00, 31
RGB 00, 15, 00
RGB 00, 00, 15
RGB 00, 00, 00
; mountain
RGB 28, 31, 20
RGB 00, 31, 00
RGB 15, 07, 00
RGB 00, 15, 00
RGB 09, 05, 00
RGB 00, 00, 00
; city (boy)
RGB 28, 31, 20
@ -88,17 +98,21 @@
RGB 00, 00, 00
; point of interest
RGB 28, 31, 20
RGB 00, 31, 00
RGB 00, 00, 31
RGB 00, 15, 00
RGB 00, 00, 15
RGB 31, 00, 00
; mountain point of interest
RGB 28, 31, 20
RGB 00, 31, 00
RGB 15, 07, 00
RGB 00, 15, 00
RGB 09, 05, 00
RGB 31, 00, 00
rgbpals_fade_src_end
; eve
rgbpals_fade_src "lsm_m_eve"
; border
RGB 28, 31, 20
RGB 21, 21, 21
@ -106,13 +120,13 @@
RGB 00, 00, 00
; earth
RGB 28, 31, 20
RGB 00, 31, 00
RGB 00, 00, 31
RGB 04, 22, 00
RGB 04, 00, 22
RGB 00, 00, 00
; mountain
RGB 28, 31, 20
RGB 00, 31, 00
RGB 15, 07, 00
RGB 04, 22, 00
RGB 13, 05, 00
RGB 00, 00, 00
; city (boy)
RGB 28, 31, 20
@ -121,11 +135,18 @@
RGB 00, 00, 00
; point of interest
RGB 28, 31, 20
RGB 00, 31, 00
RGB 00, 00, 31
RGB 04, 22, 00
RGB 04, 00, 22
RGB 31, 00, 00
; mountain point of interest
RGB 28, 31, 20
RGB 00, 31, 00
RGB 15, 07, 00
RGB 04, 22, 00
RGB 13, 05, 00
RGB 31, 00, 00
rgbpals_fade_src_end
rgbpals_fade_apply "lsm_m_morn", "lsm_m_day", 2
rgbpals_fade_apply "lsm_m_day", "lsm_m_eve", 2
rgbpals_fade_apply "lsm_m_eve", "lsm_m_nite", 2
rgbpals_fade_apply "lsm_m_nite", "lsm_m_morn", 2

View File

@ -1,5 +1,9 @@
; Graphics macros
DEF palred EQUS "(1 << 0) *"
DEF palgreen EQUS "(1 << 5) *"
DEF palblue EQUS "(1 << 10) *"
MACRO assert_valid_rgb
rept _NARG
assert 0 <= (\1) && (\1) <= 31, "RGB channel must be 0-31"
@ -11,13 +15,53 @@ MACRO RGB
rept _NARG / 3
assert_valid_rgb \1, \2, \3
dw palred (\1) + palgreen (\2) + palblue (\3)
if DEF(fade_src)
DEF {fade_src}_{d:color_index} EQU \1
DEF color_index += 1
DEF {fade_src}_{d:color_index} EQU \2
DEF color_index += 1
DEF {fade_src}_{d:color_index} EQU \3
DEF color_index += 1
endc
shift 3
endr
ENDM
DEF palred EQUS "(1 << 0) *"
DEF palgreen EQUS "(1 << 5) *"
DEF palblue EQUS "(1 << 10) *"
MACRO rgbpals_fade_src
DEF fade_src EQUS \1
DEF color_index = 0
ENDM
MACRO rgbpals_fade_src_end
DEF {fade_src}_len = color_index
PURGE fade_src
ENDM
MACRO rgbpals_fade_apply
DEF fade_from EQUS \1
DEF fade_to EQUS \2
assert {fade_from}_len == {fade_to}_len, "fade_from pals and fade_to pals must be same length"
for i, \3
for j, 0, {fade_from}_len, 3
DEF rgbch_red = {j} + 0
DEF rgbch_green = {j} + 1
DEF rgbch_blue = {j} + 2
DEF palred_value = {fade_from}_{d:rgbch_red} + ({fade_to}_{d:rgbch_red} - {fade_from}_{d:rgbch_red}) * i / \3
DEF palgreen_value = {fade_from}_{d:rgbch_green} + ({fade_to}_{d:rgbch_green} - {fade_from}_{d:rgbch_green}) * i / \3
DEF palblue_value = {fade_from}_{d:rgbch_blue} + ({fade_to}_{d:rgbch_blue} - {fade_from}_{d:rgbch_blue}) * i / \3
dw palred (palred_value) + palgreen (palgreen_value) + palblue (palblue_value)
endr
endr
PURGE fade_from, fade_to, rgbch_red, rgbch_green, rgbch_blue, palred_value, palgreen_value, palblue_value
ENDM
/* MACRO rgbpals_fade_end
rept _NARG
for i,
endr
shift
endr
ENDM */
DEF palettes EQUS "* PALETTE_SIZE"
DEF palette EQUS "+ PALETTE_SIZE *"