11
11
// FURI_LOG_DEV will log only during app development. Be sure that Settings/System/Log Device is "LPUART"; so we dont use serial port.
12
12
#ifdef DEVELOPMENT
13
13
#define FURI_LOG_DEV (tag , format , ...) furi_log_print_format(FuriLogLevelInfo, tag, format, ##__VA_ARGS__)
14
- #define DEV_CRASH () furi_crash()
14
+ #define DEV_CRASH () furi_crash()
15
15
#else
16
16
#define FURI_LOG_DEV (tag , format , ...)
17
17
#define DEV_CRASH ()
@@ -430,7 +430,7 @@ static bool alloc_variable_item_list(void *context, uint32_t view_id)
430
430
char _game_fps [8 ];
431
431
if (load_char ("Game-FPS" , _game_fps , sizeof (_game_fps )))
432
432
{
433
- int index = is_str (_game_fps , "30" ) ? 0 : is_str (_game_fps , "60" ) ? 1
433
+ int index = is_str (_game_fps , "30" ) ? 0 : is_str (_game_fps , "60" ) ? 1
434
434
: is_str (_game_fps , "120" ) ? 2
435
435
: is_str (_game_fps , "240" ) ? 3
436
436
: 0 ;
@@ -441,62 +441,63 @@ static bool alloc_variable_item_list(void *context, uint32_t view_id)
441
441
if (load_char ("Game-VGM-X" , _game_vgm_x , sizeof (_game_vgm_x )))
442
442
{
443
443
int vgm_x = atoi (_game_vgm_x );
444
- int index = vgm_x == -2 ? 0 :
445
- vgm_x == -1 ? 1 :
446
- vgm_x == 0 ? 2 :
447
- vgm_x == 1 ? 3 :
448
- vgm_x == 2 ? 4 :
449
- vgm_x == 3 ? 5 :
450
- vgm_x == 4 ? 6 :
451
- vgm_x == 5 ? 7 :
452
- vgm_x == 6 ? 8 :
453
- vgm_x == 7 ? 9 :
454
- vgm_x == 8 ? 10 :
455
- vgm_x == 9 ? 11 :
456
- vgm_x == 10 ? 12 :
457
- 2 ;
444
+ int index = vgm_x == -2 ? 0 : vgm_x == -1 ? 1
445
+ : vgm_x == 0 ? 2
446
+ : vgm_x == 1 ? 3
447
+ : vgm_x == 2 ? 4
448
+ : vgm_x == 3 ? 5
449
+ : vgm_x == 4 ? 6
450
+ : vgm_x == 5 ? 7
451
+ : vgm_x == 6 ? 8
452
+ : vgm_x == 7 ? 9
453
+ : vgm_x == 8 ? 10
454
+ : vgm_x == 9 ? 11
455
+ : vgm_x == 10 ? 12
456
+ : 2 ;
458
457
variable_item_set_current_value_index (app -> variable_item_game_vgm_x , index );
459
458
variable_item_set_current_value_text (app -> variable_item_game_vgm_x , vgm_levels [index ]);
460
459
}
461
460
char _game_vgm_y [8 ];
462
461
if (load_char ("Game-VGM-Y" , _game_vgm_y , sizeof (_game_vgm_y )))
463
462
{
464
463
int vgm_y = atoi (_game_vgm_y );
465
- int index = vgm_y == -2 ? 0 :
466
- vgm_y == -1 ? 1 :
467
- vgm_y == 0 ? 2 :
468
- vgm_y == 1 ? 3 :
469
- vgm_y == 2 ? 4 :
470
- vgm_y == 3 ? 5 :
471
- vgm_y == 4 ? 6 :
472
- vgm_y == 5 ? 7 :
473
- vgm_y == 6 ? 8 :
474
- vgm_y == 7 ? 9 :
475
- vgm_y == 8 ? 10 :
476
- vgm_y == 9 ? 11 :
477
- vgm_y == 10 ? 12 :
478
- 2 ;
464
+ int index = vgm_y == -2 ? 0 : vgm_y == -1 ? 1
465
+ : vgm_y == 0 ? 2
466
+ : vgm_y == 1 ? 3
467
+ : vgm_y == 2 ? 4
468
+ : vgm_y == 3 ? 5
469
+ : vgm_y == 4 ? 6
470
+ : vgm_y == 5 ? 7
471
+ : vgm_y == 6 ? 8
472
+ : vgm_y == 7 ? 9
473
+ : vgm_y == 8 ? 10
474
+ : vgm_y == 9 ? 11
475
+ : vgm_y == 10 ? 12
476
+ : 2 ;
479
477
variable_item_set_current_value_index (app -> variable_item_game_vgm_y , index );
480
478
variable_item_set_current_value_text (app -> variable_item_game_vgm_y , vgm_levels [index ]);
481
479
}
482
480
char _game_screen_always_on [8 ];
483
481
if (load_char ("Game-Screen-Always-On" , _game_screen_always_on , sizeof (_game_screen_always_on )))
484
482
{
485
- int index = is_str (_game_screen_always_on , "No" ) ? 0 : is_str (_game_screen_always_on , "Yes" ) ? 1 : 0 ;
483
+ int index = is_str (_game_screen_always_on , "No" ) ? 0 : is_str (_game_screen_always_on , "Yes" ) ? 1
484
+ : 0 ;
486
485
variable_item_set_current_value_text (app -> variable_item_game_screen_always_on , yes_or_no_choices [index ]);
487
486
variable_item_set_current_value_index (app -> variable_item_game_screen_always_on , index );
488
487
}
489
488
char _game_sound_on [8 ];
490
489
if (load_char ("Game-Sound-On" , _game_sound_on , sizeof (_game_sound_on )))
491
490
{
492
- int index = is_str (_game_sound_on , "No" ) ? 0 : is_str (_game_sound_on , "Yes" ) ? 1 : 0 ;
491
+ int index = is_str (_game_sound_on , "No" ) ? 0 : is_str (_game_sound_on , "Yes" ) ? 1
492
+ : 0 ;
493
493
variable_item_set_current_value_text (app -> variable_item_game_sound_on , yes_or_no_choices [index ]);
494
494
variable_item_set_current_value_index (app -> variable_item_game_sound_on , index );
495
495
}
496
496
char _game_vibration_on [8 ];
497
497
if (load_char ("Game-Vibration-On" , _game_vibration_on , sizeof (_game_vibration_on )))
498
498
{
499
- int index = is_str (_game_vibration_on , "No" ) ? 0 : is_str (_game_vibration_on , "Yes" ) ? 1 : 0 ;
499
+ int index = is_str (_game_vibration_on , "No" ) ? 0 : is_str (_game_vibration_on , "Yes" ) ? 1
500
+ : 0 ;
500
501
variable_item_set_current_value_text (app -> variable_item_game_vibration_on , yes_or_no_choices [index ]);
501
502
variable_item_set_current_value_index (app -> variable_item_game_vibration_on , index );
502
503
}
@@ -737,7 +738,8 @@ void free_all_views(void *context, bool should_free_variable_item_list, bool sho
737
738
}
738
739
}
739
740
740
- if (should_free_submenu_settings ) free_submenu_settings (app );
741
+ if (should_free_submenu_settings )
742
+ free_submenu_settings (app );
741
743
}
742
744
static bool fetch_world_list (FlipperHTTP * fhttp )
743
745
{
@@ -760,7 +762,7 @@ static bool fetch_world_list(FlipperHTTP *fhttp)
760
762
snprintf (fhttp -> file_path , sizeof (fhttp -> file_path ), STORAGE_EXT_PATH_PREFIX "/apps_data/flip_world/worlds/world_list.json" );
761
763
762
764
fhttp -> save_received_data = true;
763
- return flipper_http_get_request_with_headers (fhttp , "https://www.flipsocial.net/api/world/v5/list/10/" , "{\"Content-Type\":\"application/json\"}" );
765
+ return flipper_http_request (fhttp , GET , "https://www.flipsocial.net/api/world/v5/list/10/" , "{\"Content-Type\":\"application/json\"}" , NULL );
764
766
}
765
767
// we will load the palyer stats from the API and save them
766
768
// in player_spawn game method, it will load the player stats that we saved
@@ -795,7 +797,7 @@ static bool fetch_player_stats(FlipperHTTP *fhttp)
795
797
796
798
snprintf (fhttp -> file_path , sizeof (fhttp -> file_path ), STORAGE_EXT_PATH_PREFIX "/apps_data/flip_world/data/player/player_stats.json" );
797
799
fhttp -> save_received_data = true;
798
- return flipper_http_get_request_with_headers (fhttp , url , "{\"Content-Type\":\"application/json\"}" );
800
+ return flipper_http_request (fhttp , GET , url , "{\"Content-Type\":\"application/json\"}" , NULL );
799
801
}
800
802
801
803
// static bool fetch_app_update(FlipperHTTP *fhttp)
@@ -919,7 +921,7 @@ static bool _fetch_game(DataLoaderModel *model)
919
921
}
920
922
char payload [256 ];
921
923
snprintf (payload , sizeof (payload ), "{\"username\":\"%s\",\"password\":\"%s\"}" , username , password );
922
- return flipper_http_post_request_with_headers (model -> fhttp , "https://www.flipsocial.net/api/user/login/" , "{\"Content-Type\":\"application/json\"}" , payload );
924
+ return flipper_http_request (model -> fhttp , POST , "https://www.flipsocial.net/api/user/login/" , "{\"Content-Type\":\"application/json\"}" , payload );
923
925
}
924
926
else if (model -> request_index == 1 )
925
927
{
@@ -957,7 +959,7 @@ static bool _fetch_game(DataLoaderModel *model)
957
959
char payload [172 ];
958
960
snprintf (payload , sizeof (payload ), "{\"username\":\"%s\",\"password\":\"%s\"}" , username , password );
959
961
model -> title = "Registering..." ;
960
- return flipper_http_post_request_with_headers (model -> fhttp , "https://www.flipsocial.net/api/user/register/" , "{\"Content-Type\":\"application/json\"}" , payload );
962
+ return flipper_http_request (model -> fhttp , POST , "https://www.flipsocial.net/api/user/register/" , "{\"Content-Type\":\"application/json\"}" , payload );
961
963
}
962
964
else
963
965
{
@@ -1015,7 +1017,7 @@ static bool _fetch_game(DataLoaderModel *model)
1015
1017
snprintf (url , sizeof (url ), "https://www.flipsocial.net/api/world/v5/get/world/%s/" , furi_string_get_cstr (first_world ));
1016
1018
furi_string_free (world_list );
1017
1019
furi_string_free (first_world );
1018
- return flipper_http_get_request_with_headers (model -> fhttp , url , "{\"Content-Type\":\"application/json\"}" );
1020
+ return flipper_http_request (model -> fhttp , GET , url , "{\"Content-Type\":\"application/json\"}" , NULL );
1019
1021
}
1020
1022
FURI_LOG_E (TAG , "Unknown request index" );
1021
1023
return false;
@@ -1187,7 +1189,19 @@ void callback_submenu_choices(void *context, uint32_t index)
1187
1189
}
1188
1190
switch (index )
1189
1191
{
1190
- case FlipWorldSubmenuIndexRun :
1192
+ case FlipWorldSubmenuIndexGameSubmenu :
1193
+ view_dispatcher_switch_to_view (app -> view_dispatcher , FlipWorldViewGameSubmenu );
1194
+ break ;
1195
+ case FlipWorldSubmenuIndexStory :
1196
+ game_mode_index = 2 ; // GAME_MODE_STORY
1197
+ easy_flipper_dialog ("Unavailable" , "\nStory mode is not ready yet.\nPress BACK to return." );
1198
+ break ;
1199
+ case FlipWorldSubmenuIndexPvP :
1200
+ game_mode_index = 1 ; // GAME_MODE_PVP
1201
+ easy_flipper_dialog ("Unavailable" , "\nPvP mode is not ready yet.\nPress BACK to return." );
1202
+ break ;
1203
+ case FlipWorldSubmenuIndexPvE :
1204
+ game_mode_index = 0 ; // GAME_MODE_PVE
1191
1205
free_all_views (app , true, true);
1192
1206
if (!is_enough_heap (60000 ))
1193
1207
{
@@ -1248,7 +1262,6 @@ void callback_submenu_choices(void *context, uint32_t index)
1248
1262
easy_flipper_dialog ("Error" , "Failed to start game thread. Press BACK to return." );
1249
1263
return ;
1250
1264
}
1251
-
1252
1265
}
1253
1266
else
1254
1267
{
@@ -1615,7 +1628,7 @@ static bool _fetch_worlds(DataLoaderModel *model)
1615
1628
furi_record_close (RECORD_STORAGE );
1616
1629
snprintf (model -> fhttp -> file_path , sizeof (model -> fhttp -> file_path ), STORAGE_EXT_PATH_PREFIX "/apps_data/flip_world/worlds/world_list_full.json" );
1617
1630
model -> fhttp -> save_received_data = true;
1618
- return flipper_http_get_request_with_headers (model -> fhttp , "https://www.flipsocial.net/api/world/v5/get/10/" , "{\"Content-Type\":\"application/json\"}" );
1631
+ return flipper_http_request (model -> fhttp , GET , "https://www.flipsocial.net/api/world/v5/get/10/" , "{\"Content-Type\":\"application/json\"}" , NULL );
1619
1632
}
1620
1633
static char * _parse_worlds (DataLoaderModel * model )
1621
1634
{
@@ -1797,7 +1810,7 @@ void loader_draw_callback(Canvas *canvas, void *model)
1797
1810
}
1798
1811
1799
1812
DataLoaderModel * data_loader_model = (DataLoaderModel * )model ;
1800
- SerialState http_state = data_loader_model -> fhttp -> state ;
1813
+ HTTPState http_state = data_loader_model -> fhttp -> state ;
1801
1814
DataState data_state = data_loader_model -> data_state ;
1802
1815
char * title = data_loader_model -> title ;
1803
1816
0 commit comments