jblanked 1 год назад
Родитель
Сommit
44067416c4
3 измененных файлов с 7 добавлено и 19 удалено
  1. 3 8
      game/level.c
  2. 0 7
      game/player.c
  3. 4 4
      game/storage.c

+ 3 - 8
game/level.c

@@ -4,11 +4,7 @@
 bool allocate_level(GameManager *manager, int index)
 {
     GameContext *game_context = game_manager_game_context_get(manager);
-    if (!game_context)
-    {
-        FURI_LOG_E("Game", "Game context is NULL");
-        return false;
-    }
+
     // open the world list from storage, then create a level for each world
     char file_path[128];
     snprintf(file_path, sizeof(file_path), STORAGE_EXT_PATH_PREFIX "/apps_data/flip_world/worlds/world_list.json");
@@ -39,7 +35,6 @@ static void set_world(Level *level, GameManager *manager, char *id)
              STORAGE_EXT_PATH_PREFIX "/apps_data/flip_world/worlds/%s/%s_json_data.json",
              id, id);
 
-    FURI_LOG_I("Game", "Loading world data from %s", file_path);
     FuriString *json_data_str = flipper_http_load_from_file(file_path);
     if (!json_data_str || furi_string_empty(json_data_str))
     {
@@ -72,7 +67,7 @@ static void set_world(Level *level, GameManager *manager, char *id)
         snprintf(file_path, sizeof(file_path),
                  STORAGE_EXT_PATH_PREFIX "/apps_data/flip_world/worlds/%s/%s_enemy_data.json",
                  id, id);
-        FURI_LOG_I("Game", "Loading enemy data from %s", file_path);
+
         FuriString *enemy_data_str = flipper_http_load_from_file(file_path);
         if (!enemy_data_str || furi_string_empty(enemy_data_str))
         {
@@ -80,7 +75,7 @@ static void set_world(Level *level, GameManager *manager, char *id)
             draw_town_world(level);
             return;
         }
-        FURI_LOG_I("Game", "Looping through enemy data");
+
         // Loop through the array
         for (int i = 0; i < MAX_ENEMIES; i++)
         {

+ 0 - 7
game/player.c

@@ -133,8 +133,6 @@ static int player_y_from_roll(float roll)
     return 0;
 }
 
-static bool is_new_level = false;
-
 // Modify player_update to track direction
 static void player_update(Entity *self, GameManager *manager, void *context)
 {
@@ -247,12 +245,10 @@ static void player_update(Entity *self, GameManager *manager, void *context)
             save_player_context(player);
             game_manager_next_level_set(manager, get_next_level(manager));
             furi_delay_ms(500);
-            is_new_level = true;
         }
         else
         {
             game_context->user_input = GameKeyOk;
-            // furi_delay_ms(100);
         }
         return;
     }
@@ -296,9 +292,6 @@ static void player_render(Entity *self, GameManager *manager, Canvas *canvas, vo
         pos.x - camera_x - 5, // Center the sprite horizontally
         pos.y - camera_y - 5  // Center the sprite vertically
     );
-
-    // draw username over player's head
-    // draw_username(canvas, pos, player->username);
 }
 
 const EntityDescription player_desc = {

+ 4 - 4
game/storage.c

@@ -202,7 +202,7 @@ bool save_player_context(PlayerContext *player_context)
 }
 
 // Helper function to load an integer
-bool load_number(const char *path_name, int *value)
+static bool load_number(const char *path_name, int *value)
 {
     if (!path_name || !value)
     {
@@ -223,7 +223,7 @@ bool load_number(const char *path_name, int *value)
 }
 
 // Helper function to load a float
-bool load_float(const char *path_name, float *value)
+static bool load_float(const char *path_name, float *value)
 {
     if (!path_name || !value)
     {
@@ -251,7 +251,7 @@ bool load_float(const char *path_name, float *value)
 }
 
 // Helper function to load an int8_t
-bool load_int8(const char *path_name, int8_t *value)
+static bool load_int8(const char *path_name, int8_t *value)
 {
     if (!path_name || !value)
     {
@@ -286,7 +286,7 @@ bool load_int8(const char *path_name, int8_t *value)
 }
 
 // Helper function to load a uint32_t
-bool load_uint32(const char *path_name, uint32_t *value)
+static bool load_uint32(const char *path_name, uint32_t *value)
 {
     if (!path_name || !value)
     {