aboutsummaryrefslogtreecommitdiff
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/animator.c8
-rw-r--r--src/engine/animator.h5
-rw-r--r--src/engine/level_const.c6
-rw-r--r--src/engine/sprite_controller.h29
-rw-r--r--src/engine/types.h1
5 files changed, 33 insertions, 16 deletions
diff --git a/src/engine/animator.c b/src/engine/animator.c
index e293eb1..71d0582 100644
--- a/src/engine/animator.c
+++ b/src/engine/animator.c
@@ -39,3 +39,11 @@ void hh_update_sprite(uint16_t *idx, hh_entity* in, vec_cor cam) {
}
}
}
+
+void hh_show_quad(uint16_t *idx, hh_s_rendering* in) {
+ hh_s_ppu_loc_fam_entry temp = in->fam;
+ temp.position_y = CLAMP(in->fam.position_y, -16, HH_PPU_SCREEN_HEIGHT);
+ temp.position_x = CLAMP(in->fam.position_x, -16, HH_PPU_SCREEN_WIDTH);
+ hh_ppu_update_foreground(++*idx, temp);
+ temp.tilemap_index++;
+}
diff --git a/src/engine/animator.h b/src/engine/animator.h
index 2f6e00d..3ace959 100644
--- a/src/engine/animator.h
+++ b/src/engine/animator.h
@@ -10,5 +10,8 @@ void hh_animate_hit(hh_s_rendering*, bool hit);
/** @brief updates current animation frame */
void hh_animate(hh_s_rendering*, uint16_t start, uint16_t end, uint8_t step);
-/** @brief passively updates sprite*/
+/** @brief passively updates sprite */
void hh_update_sprite(uint16_t* idx, hh_entity* in, vec_cor cam);
+
+/** @brief always renders on same screen position */
+void hh_show_quad(uint16_t *idx, hh_s_rendering* in);
diff --git a/src/engine/level_const.c b/src/engine/level_const.c
index 2522814..4cd9a1b 100644
--- a/src/engine/level_const.c
+++ b/src/engine/level_const.c
@@ -4,7 +4,7 @@
hh_g_all_levels hh_init_game_levels(){
hh_g_all_levels levels;
- levels.current_level=1;
+ levels.current_level=0;
levels.shop.size.x=40;
levels.shop.size.y=15;
@@ -18,9 +18,9 @@ hh_g_all_levels hh_init_game_levels(){
levels.level[1].size.y=28;
levels.level[1].hh_level_completed=false;
- FILE *fp = fopen("static/shop_new.bin", "rb");
+ FILE *fp = fopen("../test/bin/level1_test.bin", "rb");
if (fp == NULL) {
- printf("shop_new.bin not found!\n");
+ printf("level1_test.bin not found!\n");
return levels;
}
fseek(fp, 0, SEEK_END);
diff --git a/src/engine/sprite_controller.h b/src/engine/sprite_controller.h
index 3693850..93a2aaf 100644
--- a/src/engine/sprite_controller.h
+++ b/src/engine/sprite_controller.h
@@ -17,11 +17,15 @@
#define HH_PAL_IDX_SKY 0
#define HH_PAL_IDX_BRICK 1
#define HH_PAL_IDX_SLIME 2
+#define HH_PAL_IDX_HUD 2
+#define HH_PAL_IDX_BULLET 3
+#define HH_PAL_IDX_GOZER 3
+#define HH_PAL_IDX_TITLE_SCREEN_ICON 3
#define HH_PAL_IDX_CRATE 4
#define HH_PAL_IDX_SHOP 5
-#define HH_PAL_IDX_TITLE_SCREEN_ICON 3
#define HH_PAL_IDX_FONT 6
#define HH_PAL_IDX_DEV 7
+
const static uint8_t hh_g_sprite_palette[HH_TM_GROUPS] = {
HH_PAL_IDX_SKY,
HH_PAL_IDX_BRICK,
@@ -29,12 +33,15 @@ const static uint8_t hh_g_sprite_palette[HH_TM_GROUPS] = {
HH_PAL_IDX_SHOP,
// HH_PAL_IDX_SHOP,
HH_PAL_IDX_TITLE_SCREEN_ICON,
- HH_PAL_IDX_FONT,
- HH_PAL_IDX_SKY,
- HH_PAL_IDX_DEV,
+ HH_PAL_IDX_TITLE_SCREEN_ICON,
+ HH_PAL_IDX_HUD,
+ HH_PAL_IDX_HUD,
+ HH_PAL_IDX_BULLET,
+ HH_PAL_IDX_GOZER,
HH_PAL_IDX_SLIME,
- HH_PAL_IDX_DEV
- // HH_PAL_IDX_FONT
+ HH_PAL_IDX_SLIME,
+ HH_PAL_IDX_DEV,
+ HH_PAL_IDX_FONT
};
@@ -62,11 +69,11 @@ const static hh_ppu_loc_palette_table_t hh_g_palette = {
{0x1,0x2,0x3},
{0x1,0x3,0x2},
{0x4,0x8,0x3},
- {0x7,0xa,0x4},
- {0x0,0x0,0x0},
- {0x0,0x0,0x0},
- {0x0,0x0,0x0},
- {0x0,0x0,0x0}},
+ {0x7,0xa,0x4},//hp HUD
+ {0xa,0xc,0x5},
+ {0xa,0x3,0x3},
+ {0x0,0x0,0x1},
+ {0xe,0xe,0xe}},
{//player //TODO: use one less color && update player indexed sprites
{0x0,0x0,0x0},
{0x1,0x1,0x1},
diff --git a/src/engine/types.h b/src/engine/types.h
index 8040e46..5fc80fa 100644
--- a/src/engine/types.h
+++ b/src/engine/types.h
@@ -26,7 +26,6 @@ typedef struct {
hh_s_ppu_loc_fam_entry fam; //screen
uint16_t frame0;
uint16_t palette;
- uint16_t ppu_foreground_index;
}hh_s_rendering;