@@ -1193,12 +1193,15 @@ void callback_submenu_choices(void *context, uint32_t index)
view_dispatcher_switch_to_view(app->view_dispatcher, FlipWorldViewGameSubmenu);
break;
case FlipWorldSubmenuIndexStory:
+ game_mode_index = 2; // GAME_MODE_STORY
easy_flipper_dialog("Unavailable", "\nStory mode is not ready yet.\nPress BACK to return.");
case FlipWorldSubmenuIndexPvP:
+ game_mode_index = 1; // GAME_MODE_PVP
easy_flipper_dialog("Unavailable", "\nPvP mode is not ready yet.\nPress BACK to return.");
case FlipWorldSubmenuIndexPvE:
+ game_mode_index = 0; // GAME_MODE_PVE
free_all_views(app, true, true);
if (!is_enough_heap(60000))
{
@@ -10,6 +10,7 @@ int player_sprite_index = 1;
char *vgm_levels[] = {"-2", "-1", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
int vgm_x_index = 2;
int vgm_y_index = 2;
+int game_mode_index = 0;
float atof_(const char *nptr) { return (float)strtod(nptr, NULL); }
float atof_furi(const FuriString *nptr) { return atof_(furi_string_get_cstr(nptr)); }
bool is_str(const char *src, const char *dst) { return strcmp(src, dst) == 0; }
@@ -97,6 +97,7 @@ extern int player_sprite_index;
extern char *vgm_levels[];
extern int vgm_x_index;
extern int vgm_y_index;
+extern int game_mode_index;
float atof_(const char *nptr);
float atof_furi(const FuriString *nptr);
bool is_str(const char *src, const char *dst);
@@ -21,6 +21,8 @@ static void game_start(GameManager *game_manager, void *ctx)
game_context->enemy_count = 0;
game_context->npc_count = 0;
+ game_context->game_mode = game_mode_index;
+
// set all levels to NULL
for (int i = 0; i < MAX_LEVELS; i++)
game_context->levels[i] = NULL;
@@ -62,6 +62,14 @@ typedef enum
GAME_MENU_NPC, // NPC dialog
} GameMenuScreen;
+// game modes
+typedef enum
+{
+ GAME_MODE_PVE = 0, // player(s) vs everyone
+ GAME_MODE_PVP = 1, // player vs player
+ GAME_MODE_STORY = 2, // story mode
+} GameMode;
typedef struct
PlayerContext *player_context;
@@ -69,6 +77,7 @@ typedef struct
Entity *enemies[MAX_ENEMIES];
Entity *npcs[MAX_NPCS];
Entity *player;
+ //
float fps;
int level_count;
int enemy_count;
@@ -87,6 +96,8 @@ typedef struct
GameMenuScreen menu_screen;
uint8_t menu_selection;
//
+ GameMode game_mode;
int icon_count;
int icon_offset;