diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/demo.c | 2 | ||||
-rw-r--r-- | src/engine/animator.c | 1 | ||||
-rw-r--r-- | src/game_loop/shop.c | 7 | ||||
-rw-r--r-- | src/game_loop/shop.h | 2 | ||||
-rw-r--r-- | src/game_loop/ui.c | 9 | ||||
-rw-r--r-- | src/game_loop/ui.h | 2 | ||||
-rw-r--r-- | src/static/.gitignore | 1 | ||||
-rw-r--r-- | src/static/dynamic.tsx | 71 |
8 files changed, 84 insertions, 11 deletions
@@ -59,7 +59,7 @@ void hh_demo_loop(unsigned long frame) { } break; case hh_e_state_shop: - hh_shop(&hh_game_states, &hh_game.shop); + hh_shop(&hh_game_states, &hh_game.shop, hh_game.current_level); break; case hh_e_state_gameplay: hh_gameplay(&hh_game, &hh_game_states); diff --git a/src/engine/animator.c b/src/engine/animator.c index 71d0582..0811ba7 100644 --- a/src/engine/animator.c +++ b/src/engine/animator.c @@ -45,5 +45,4 @@ void hh_show_quad(uint16_t *idx, hh_s_rendering* in) { 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/game_loop/shop.c b/src/game_loop/shop.c index 60fc70b..ab2a1a0 100644 --- a/src/game_loop/shop.c +++ b/src/game_loop/shop.c @@ -4,7 +4,7 @@ #include "game_loop/ui.h" -void hh_shop(hh_e_game_state* hh_game_state, hh_level_entity* level_shop){ +void hh_shop(hh_e_game_state* hh_game_state, hh_level_entity* level_shop, int current_level){ static hh_e_shop_states hh_e_shop = hh_e_shop_show; static hh_e_upgrades upgrades[HH_SHOP_UPG_DISPLAY] = {0}; static uint8_t selected = 0; @@ -22,7 +22,10 @@ void hh_shop(hh_e_game_state* hh_game_state, hh_level_entity* level_shop){ selected = HH_SHOP_UPG_DISPLAY/2; hh_shop_display(selected, &upgrades); int idx = 16; - hh_ui_show_char(&idx,"aBYz09",(vec2){32,32}); + // hh_ui_show_char(&idx,"abyz09",(vec2){32,32}); + char* c[3]; + itoa(c,current_level); + hh_ui_show_char(&idx,c,(vec2){304-16-8,0}); hh_e_shop = hh_e_shop_main; break; diff --git a/src/game_loop/shop.h b/src/game_loop/shop.h index 6f8f5a7..cce0817 100644 --- a/src/game_loop/shop.h +++ b/src/game_loop/shop.h @@ -34,4 +34,4 @@ void hh_shop_display(uint8_t selected, hh_e_upgrades* upgrades); /** @brief moves 'cursor' through selection field */ void hh_shift_selected(uint8_t* pos, bool dir, uint8_t min, uint8_t max); -void hh_shop(hh_e_game_state* ,hh_level_entity* ); +void hh_shop(hh_e_game_state* ,hh_level_entity* , int); diff --git a/src/game_loop/ui.c b/src/game_loop/ui.c index 3354d43..8980d03 100644 --- a/src/game_loop/ui.c +++ b/src/game_loop/ui.c @@ -16,7 +16,6 @@ void hh_ui_show_hp(int* idx, hh_entity* player, uint8_t max_hp, vec_cor cam_pos) }); } } - void hh_ui_show_char(int* idx, char* str, vec2 pos) { int i = 0; int tilemap_idx, @@ -38,10 +37,16 @@ void hh_ui_show_char(int* idx, char* str, vec2 pos) { .horizontal_flip = false, .vertical_flip = false, .palette_index = palette_idx, .tilemap_index = tilemap_idx, - .position_x = 8 + i*15, .position_y = 8 + .position_x = pos.x + i*15, .position_y = pos.y } }); i++; } } + +void itoa(char *c, int i) { + c[0] = i + '0'; + c[1] = '\0'; +} + diff --git a/src/game_loop/ui.h b/src/game_loop/ui.h index 7a8ffbd..527cc74 100644 --- a/src/game_loop/ui.h +++ b/src/game_loop/ui.h @@ -17,3 +17,5 @@ void hh_ui_show_hp(int* idx, hh_entity* player, uint8_t max_hp, vec_cor cam_pos) void hh_ui_show_char(int* idx, char* str, vec2 pos); +/** @brief converts char* [0] to i and [1]='\0' */ +void itoa(char *c, int i); diff --git a/src/static/.gitignore b/src/static/.gitignore index e960c6e..4d628f9 100644 --- a/src/static/.gitignore +++ b/src/static/.gitignore @@ -7,3 +7,4 @@ tiled.mk *.csv *.out *.tiled-session +*.tmx diff --git a/src/static/dynamic.tsx b/src/static/dynamic.tsx index 742083f..fde4347 100644 --- a/src/static/dynamic.tsx +++ b/src/static/dynamic.tsx @@ -1,6 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<tileset version="1.10" tiledversion="1.10.1" name="dynamic" tilewidth="16" tileheight="16" tilecount="108" columns="0"> +<tileset version="1.10" tiledversion="1.10.1" name="dynamic" tilewidth="16" tileheight="16" tilecount="129" columns="0"> <grid orientation="orthogonal" width="1" height="1"/> + <tile id="107"> + <image width="16" height="16" source="tiled/font_35.png"/> + </tile> <tile id="0"> <image width="16" height="16" source="tiled/font_34.png"/> </tile> @@ -103,9 +106,51 @@ <tile id="33"> <image width="16" height="16" source="tiled/font_01.png"/> </tile> + <tile id="108"> + <image width="16" height="16" source="tiled/boss1_05.png"/> + </tile> + <tile id="109"> + <image width="16" height="16" source="tiled/boss1_04.png"/> + </tile> + <tile id="110"> + <image width="16" height="16" source="tiled/boss1_03.png"/> + </tile> + <tile id="111"> + <image width="16" height="16" source="tiled/boss1_02.png"/> + </tile> + <tile id="112"> + <image width="16" height="16" source="tiled/boss1_01.png"/> + </tile> + <tile id="113"> + <image width="16" height="16" source="tiled/boss1_00.png"/> + </tile> <tile id="34"> <image width="16" height="16" source="tiled/font_00.png"/> </tile> + <tile id="114"> + <image width="16" height="16" source="tiled/slime_jumpable_07.png"/> + </tile> + <tile id="115"> + <image width="16" height="16" source="tiled/slime_jumpable_06.png"/> + </tile> + <tile id="116"> + <image width="16" height="16" source="tiled/slime_jumpable_05.png"/> + </tile> + <tile id="117"> + <image width="16" height="16" source="tiled/slime_jumpable_04.png"/> + </tile> + <tile id="118"> + <image width="16" height="16" source="tiled/slime_jumpable_03.png"/> + </tile> + <tile id="119"> + <image width="16" height="16" source="tiled/slime_jumpable_02.png"/> + </tile> + <tile id="120"> + <image width="16" height="16" source="tiled/slime_jumpable_01.png"/> + </tile> + <tile id="121"> + <image width="16" height="16" source="tiled/slime_jumpable_00.png"/> + </tile> <tile id="35"> <image width="16" height="16" source="tiled/slime_03.png"/> </tile> @@ -130,6 +175,27 @@ <tile id="42"> <image width="16" height="16" source="tiled/bullet_01.png"/> </tile> + <tile id="122"> + <image width="16" height="16" source="tiled/upgrades_04.png"/> + </tile> + <tile id="123"> + <image width="16" height="16" source="tiled/upgrades_03.png"/> + </tile> + <tile id="124"> + <image width="16" height="16" source="tiled/upgrades_02.png"/> + </tile> + <tile id="125"> + <image width="16" height="16" source="tiled/upgrades_01.png"/> + </tile> + <tile id="126"> + <image width="16" height="16" source="tiled/upgrades_00.png"/> + </tile> + <tile id="127"> + <image width="16" height="16" source="tiled/hud_heart_01.png"/> + </tile> + <tile id="128"> + <image width="16" height="16" source="tiled/hud_heart_00.png"/> + </tile> <tile id="43"> <image width="16" height="16" source="tiled/bullet_00.png"/> </tile> @@ -322,7 +388,4 @@ <tile id="106"> <image width="16" height="16" source="tiled/air_00.png"/> </tile> - <tile id="107"> - <image width="16" height="16" source="tiled/font_35.png"/> - </tile> </tileset> |