Kaynağa Gözat

Merge jetpack_joyride from https://github.com/xMasterX/all-the-plugins

Willy-JL 2 yıl önce
ebeveyn
işleme
59e505954b

+ 0 - 4
jetpack_joyride/.gitignore

@@ -1,4 +0,0 @@
-dist/*
-.vscode
-.clang-format
-.editorconfig

+ 0 - 30
jetpack_joyride/README.md

@@ -1,30 +0,0 @@
-# flipper-jetpack-game
-
-`JETPACKS, ROCKETS, AND ADVENTURE AWAITS!`
-
-![JETRIDE](docs/screenshots/gameplay.png)
-
-## Game Remake of Jetpack Joyride for Flipper Zero
-- Recreated based on the classic Jetpack Joyride game for Flipper Zero.
-- Get ready for a thrilling ride filled with obstacles, coins, and of course, jetpacks!
-
-### Usage
-
-- Start the "Jetpack Game" plugin and navigate Barry through the lab with your jetpack.
-
-### Build
-
-- Recursively clone your base firmware (official or not).
-- Clone this repository in `applications_user`.
-- Build with `./fbt fap_dist APPSRC=applications_user/flipper-jetpack-game`.
-- Retrieve the built fap in the dist subfolders.
-
-For more information about the build tool, check [here](https://github.com/flipperdevices/flipperzero-firmware/blob/dev/documentation/fbt.md).
-
-### Credits
-
-- Original Game: Jetpack Joyride by Halfbrick Studios.
-
----
-
-Feel free to raise an issue or contribute to the project! Your feedback helps make the game better for everyone.

BIN
jetpack_joyride/docs/screenshots/gameplay.png


+ 1 - 1
jetpack_joyride/includes/background_asset.c

@@ -1,4 +1,4 @@
-#include <jetpack_game_icons.h>
+#include <jetpack_joyride_icons.h>
 
 
 #include "background_assets.h"
 #include "background_assets.h"
 
 

+ 1 - 1
jetpack_joyride/includes/background_assets.h

@@ -9,7 +9,7 @@
 #include "point.h"
 #include "point.h"
 #include "states.h"
 #include "states.h"
 #include "game_sprites.h"
 #include "game_sprites.h"
-#include <jetpack_game_icons.h>
+#include <jetpack_joyride_icons.h>
 
 
 #define BG_ASSETS_MAX 3
 #define BG_ASSETS_MAX 3
 
 

+ 1 - 1
jetpack_joyride/includes/coin.c

@@ -1,7 +1,7 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdbool.h>
 #include <stdbool.h>
 
 
-#include <jetpack_game_icons.h>
+#include <jetpack_joyride_icons.h>
 #include <gui/gui.h>
 #include <gui/gui.h>
 
 
 #include "coin.h"
 #include "coin.h"

+ 1 - 1
jetpack_joyride/includes/missile.c

@@ -1,7 +1,7 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <stdbool.h>
 #include <stdbool.h>
 
 
-#include <jetpack_game_icons.h>
+#include <jetpack_joyride_icons.h>
 #include <gui/gui.h>
 #include <gui/gui.h>
 
 
 #include "states.h"
 #include "states.h"

+ 1 - 1
jetpack_joyride/includes/scientist.c

@@ -1,7 +1,7 @@
 #include "scientist.h"
 #include "scientist.h"
 #include "game_sprites.h"
 #include "game_sprites.h"
 
 
-#include <jetpack_game_icons.h>
+#include <jetpack_joyride_icons.h>
 #include <gui/gui.h>
 #include <gui/gui.h>
 
 
 void scientist_tick(SCIENTIST* const scientists) {
 void scientist_tick(SCIENTIST* const scientists) {

+ 11 - 5
jetpack_joyride/jetpack.c

@@ -1,6 +1,6 @@
 #include <stdlib.h>
 #include <stdlib.h>
 
 
-#include <jetpack_game_icons.h>
+#include <jetpack_joyride_icons.h>
 #include <furi.h>
 #include <furi.h>
 #include <gui/gui.h>
 #include <gui/gui.h>
 #include <gui/icon_animation.h>
 #include <gui/icon_animation.h>
@@ -17,8 +17,9 @@
 
 
 #include "includes/game_state.h"
 #include "includes/game_state.h"
 
 
-#define TAG "Jetpack Game"
-#define SAVING_FILENAME APP_DATA_PATH("jetpack.save")
+#define TAG "Jetpack Joyride"
+#define SAVING_DIRECTORY "/ext/apps/Games"
+#define SAVING_FILENAME SAVING_DIRECTORY "/jetpack.save"
 static GameState* global_state;
 static GameState* global_state;
 
 
 typedef enum {
 typedef enum {
@@ -40,7 +41,6 @@ static SaveGame save_game;
 
 
 static bool storage_game_state_load() {
 static bool storage_game_state_load() {
     Storage* storage = furi_record_open(RECORD_STORAGE);
     Storage* storage = furi_record_open(RECORD_STORAGE);
-    storage_common_migrate(storage, EXT_PATH("apps/Games/jetpack.save"), SAVING_FILENAME);
     File* file = storage_file_alloc(storage);
     File* file = storage_file_alloc(storage);
 
 
     uint16_t bytes_readed = 0;
     uint16_t bytes_readed = 0;
@@ -55,6 +55,12 @@ static bool storage_game_state_load() {
 static void storage_game_state_save() {
 static void storage_game_state_save() {
     Storage* storage = furi_record_open(RECORD_STORAGE);
     Storage* storage = furi_record_open(RECORD_STORAGE);
 
 
+    if(storage_common_stat(storage, SAVING_DIRECTORY, NULL) == FSE_NOT_EXIST) {
+        if(!storage_simply_mkdir(storage, SAVING_DIRECTORY)) {
+            return;
+        }
+    }
+
     File* file = storage_file_alloc(storage);
     File* file = storage_file_alloc(storage);
     if(storage_file_open(file, SAVING_FILENAME, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
     if(storage_file_open(file, SAVING_FILENAME, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
         storage_file_write(file, &save_game, sizeof(SaveGame));
         storage_file_write(file, &save_game, sizeof(SaveGame));
@@ -354,8 +360,8 @@ int32_t jetpack_game_app(void* p) {
             }
             }
         }
         }
 
 
-        view_port_update(view_port);
         furi_mutex_release(game_state->mutex);
         furi_mutex_release(game_state->mutex);
+        view_port_update(view_port);
     }
     }
 
 
     furi_timer_free(timer);
     furi_timer_free(timer);