From 30ed47e6ea66872951140711323844698a278fff Mon Sep 17 00:00:00 2001 From: UnavailableDev Date: Wed, 5 Apr 2023 20:43:22 +0200 Subject: Dynamic tilemap works --- src/engine/player_controller.c | 13 +++++---- src/engine/sprite_controller.h | 10 ++++--- src/static/foreground/bullet.hex | 58 ++++++++++++++++++++++++++++++++++++++++ src/static/foreground/gozer.hex | 39 +++++++++++++++++++++++++++ src/static/makefile | 6 +++-- 5 files changed, 113 insertions(+), 13 deletions(-) create mode 100644 src/static/foreground/bullet.hex create mode 100644 src/static/foreground/gozer.hex diff --git a/src/engine/player_controller.c b/src/engine/player_controller.c index 1b4eec8..807037a 100644 --- a/src/engine/player_controller.c +++ b/src/engine/player_controller.c @@ -18,16 +18,15 @@ void hh_player_actions() { .radius = 16, .pos = (vec2){128+16,32}, .vel = (vec2){0,0}, - .size = (vec2){32,32}, + .size = (vec2){16,32}, .render = { - .frame0 = HH_TM_SLIME_OFFSET, + .frame0 = HH_TM_GOZER_OFFSET, .palette = 3, - .ppu_foreground_index = 0, .fam = (hh_s_ppu_loc_fam_entry){ .horizontal_flip = false, .vertical_flip = false, .palette_index = 3, - .tilemap_index = HH_TM_SLIME_OFFSET, + .tilemap_index = HH_TM_GOZER_OFFSET, } } }, player_new = {0}; @@ -41,13 +40,13 @@ void hh_player_actions() { .pos = (vec2){-16,-16}, .vel = (vec2){0,0}, .render = { - .frame0 = 84, + .frame0 = HH_TM_BULLET_OFFSET, .palette = 3, .fam = (hh_s_ppu_loc_fam_entry){ .horizontal_flip = false, .vertical_flip = false, - .palette_index = 7, - .tilemap_index = 84, + .palette_index = 3, + .tilemap_index = HH_TM_BULLET_OFFSET, } } }; diff --git a/src/engine/sprite_controller.h b/src/engine/sprite_controller.h index 244181c..d89b068 100644 --- a/src/engine/sprite_controller.h +++ b/src/engine/sprite_controller.h @@ -12,7 +12,7 @@ //TODO: pack data inside of sprite_palette LUT //HH_PPU_PALETTE_COUNT #define HH_SPRITE_COUNT 80 -#define HH_PAL_IDX_SKY 512 +#define HH_PAL_IDX_SKY 0 #define HH_PAL_IDX_BRICK 1 const static uint8_t hh_g_sprite_palette[HH_SPRITE_COUNT] = { //TODO: FIGURE OUT HOW TO DEAL WITH DYNAMIC PALLETS @@ -70,9 +70,9 @@ const static hh_ppu_loc_palette_table_t hh_g_palette = { {0x4,0x2,0x5}, {0x7,0x3,0x7}, {0xe,0xe,0xe}, - {0xe,0xe,0xe}, //elemental - {0x0,0x0,0x0}, - {0x0,0x0,0x0}}, + {0x7,0x2,0x3}, //elemental + {0xc,0x5,0x3}, + {0xe,0xc,0x7}}, {//crates {0x5,0x7,0x7}, {0x3,0x1,0x2}, @@ -113,7 +113,9 @@ const static hh_ppu_loc_palette_table_t hh_g_palette = { void hh_setup_palettes(); +//TODO: UPDATE THIS FUNCTION /** @brief return palette index that belongs to tilemap index */ uint8_t hh_get_palette(uint8_t tile_idx); +//TODO: UPDATE THIS FUNCTION bool hh_colidable(uint8_t tile_idx); diff --git a/src/static/foreground/bullet.hex b/src/static/foreground/bullet.hex new file mode 100644 index 0000000..88f5b75 --- /dev/null +++ b/src/static/foreground/bullet.hex @@ -0,0 +1,58 @@ +;indices: 8 +;17 20 38 +;00 00 00 +;00 00 00 +;00 00 00 +;00 00 00 +;75 24 38 +;cf 57 3c +;e8 c1 70 + +000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000050: 00 00 00 00 00 00 00 00 00 05 00 05 05 05 00 00 +000060: 00 00 00 00 00 00 00 05 05 06 05 06 06 07 05 00 +000070: 00 00 00 00 00 00 05 06 05 05 06 06 07 07 07 05 +000080: 00 00 00 00 00 05 06 05 05 06 06 07 07 07 07 05 +000090: 00 00 00 00 00 00 05 05 06 05 06 06 06 07 05 00 +0000a0: 00 00 00 00 00 00 00 00 05 00 05 05 05 05 00 00 +0000b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +0000c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +0000d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +0000e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +0000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000150: 00 00 00 00 00 00 00 05 00 00 00 00 00 00 00 00 +000160: 00 00 00 00 00 00 05 06 05 00 00 00 00 00 00 00 +000170: 00 00 00 00 00 00 05 05 06 05 00 00 00 00 00 00 +000180: 00 00 00 00 00 05 06 05 05 05 00 00 00 00 00 00 +000190: 00 00 00 00 00 00 05 06 05 06 05 00 00 00 00 00 +0001a0: 00 00 00 00 00 05 06 06 06 05 00 00 00 00 00 00 +0001b0: 00 00 00 00 00 05 06 07 06 06 05 00 00 00 00 00 +0001c0: 00 00 00 00 00 05 06 07 07 06 05 00 00 00 00 00 +0001d0: 00 00 00 00 00 05 07 07 07 07 05 00 00 00 00 00 +0001e0: 00 00 00 00 00 00 05 07 07 05 00 00 00 00 00 00 +0001f0: 00 00 00 00 00 00 00 05 05 00 00 00 00 00 00 00 +000200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000210: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000230: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000270: 00 00 00 00 00 00 05 00 00 05 00 00 00 00 00 00 +000280: 00 00 00 00 00 00 00 05 05 06 05 00 00 00 00 00 +000290: 00 00 00 00 00 00 05 06 05 05 05 05 05 00 00 00 +0002a0: 00 00 00 00 00 00 00 05 05 06 06 05 06 05 00 00 +0002b0: 00 00 00 00 00 00 00 00 06 06 06 06 06 05 05 00 +0002c0: 00 00 00 00 00 00 00 00 00 05 06 06 06 07 07 05 +0002d0: 00 00 00 00 00 00 00 00 00 00 05 06 07 07 07 05 +0002e0: 00 00 00 00 00 00 00 00 00 00 00 05 05 07 07 05 +0002f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 05 05 00 \ No newline at end of file diff --git a/src/static/foreground/gozer.hex b/src/static/foreground/gozer.hex new file mode 100644 index 0000000..70a6b7f --- /dev/null +++ b/src/static/foreground/gozer.hex @@ -0,0 +1,39 @@ +;indices: 5 +;17 20 38 +;10 14 1f +;40 27 51 +;7a 36 7b +;eb ed e9 + +000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 +000020: 00 00 00 00 00 00 01 01 01 01 01 00 00 00 00 00 +000030: 00 00 00 00 01 01 03 03 03 03 03 01 01 00 00 00 +000040: 00 00 00 01 03 03 03 03 03 03 03 03 03 01 00 00 +000050: 00 00 01 03 03 03 03 03 03 03 03 03 03 03 01 00 +000060: 00 01 03 03 03 03 03 03 02 02 02 02 02 02 03 01 +000070: 00 01 03 03 03 03 03 02 01 01 01 01 02 02 02 01 +000080: 01 03 03 02 03 03 02 01 01 01 01 01 01 01 01 01 +000090: 01 03 03 02 03 01 01 01 01 01 01 01 01 01 01 01 +0000a0: 03 03 02 03 03 01 01 01 01 01 04 01 01 04 01 01 +0000b0: 03 02 02 02 03 01 01 01 01 01 04 01 01 04 01 01 +0000c0: 02 01 00 01 02 01 01 01 01 01 04 01 01 04 01 00 +0000d0: 02 00 00 00 01 02 01 01 01 01 01 01 01 01 01 00 +0000e0: 00 00 00 00 01 02 01 01 01 01 01 01 01 01 00 00 +0000f0: 00 00 00 00 00 01 01 02 01 01 01 01 01 00 00 00 +000100: 00 00 00 00 00 00 00 01 02 02 02 01 00 00 00 00 +000110: 00 00 00 00 00 00 01 03 01 01 01 00 00 00 00 00 +000120: 00 00 00 00 00 00 01 03 03 03 01 00 00 00 00 00 +000130: 00 00 00 00 00 01 03 03 03 03 03 02 00 00 00 00 +000140: 00 00 00 00 00 01 03 03 03 03 03 02 00 00 01 01 +000150: 00 00 00 00 01 03 03 03 03 03 03 02 00 00 01 01 +000160: 00 00 00 00 01 03 03 03 03 03 03 03 02 00 00 00 +000170: 00 00 00 00 01 03 01 01 03 03 03 03 02 00 00 00 +000180: 00 00 00 00 01 02 01 01 03 03 03 03 03 01 00 00 +000190: 00 00 00 01 02 01 02 02 02 03 03 02 02 01 00 00 +0001a0: 00 00 00 01 02 02 01 02 02 02 02 02 02 01 00 00 +0001b0: 00 00 01 02 02 02 01 01 01 01 01 01 01 02 01 00 +0001c0: 00 00 01 02 02 01 01 01 02 02 01 01 02 02 01 00 +0001d0: 00 00 00 01 01 00 01 01 01 01 01 01 01 00 00 01 +0001e0: 00 00 00 00 00 00 01 01 00 00 01 01 00 00 00 00 +0001f0: 00 00 00 00 00 00 01 01 00 00 01 01 00 00 00 00 \ No newline at end of file diff --git a/src/static/makefile b/src/static/makefile index 9a17326..9c75bca 100644 --- a/src/static/makefile +++ b/src/static/makefile @@ -11,9 +11,11 @@ INPUT += air.hex \ background/shop.hex \ background/title_screen_icon.hex \ foreground/title_screen_letteres_large.hex\ + foreground/bullet.hex \ + foreground/gozer.hex \ foreground/slime.hex \ - foreground/font.hex \ - world.hex + foreground/font.hex + # world.hex USER_META += world.h OUT_BIN := $(patsubst %.hex,%.bin, $(INPUT)) -- cgit v1.2.3