diff options
Diffstat (limited to 'src/engine/sprite_controller.c')
-rw-r--r-- | src/engine/sprite_controller.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/engine/sprite_controller.c b/src/engine/sprite_controller.c index b38b647..d386d0f 100644 --- a/src/engine/sprite_controller.c +++ b/src/engine/sprite_controller.c @@ -5,8 +5,18 @@ #include "ppu/consts.h" #include "ppu/ppu.h" +#include "static/tilemap.h" + + uint8_t hh_get_palette(uint8_t tile_idx) { - return hh_g_sprite_palette[tile_idx]; + for (int i = 0; i < HH_TM_GROUPS; i++) { + if (hh_palette_lut[i] > tile_idx){ + return hh_g_sprite_palette[i-1]; + } + } + + return 0; //not found + // return hh_g_sprite_palette[tile_idx]; } void hh_setup_palettes(){ |