rdefeo 1 год назад
Родитель
Сommit
323c81f905
2 измененных файлов с 14 добавлено и 14 удалено
  1. 9 10
      README.md
  2. 5 4
      pinball0.cxx

+ 9 - 10
README.md

@@ -1,13 +1,14 @@
 # Pinball0 (Pinball Zero)
 # Pinball0 (Pinball Zero)
 Play pinball on your Flipperzero!
 Play pinball on your Flipperzero!
 
 
-Still a work in progress...
-
-[Get latest version](https://github.com/rdefeo/pinball0/releases)
+Get the latest version:
+* [Flipper Lab](https://lab.flipper.net/apps/pinball0)
+* [Latest builds](https://github.com/rdefeo/pinball0/releases) - manual install of .fap
+* Or build yourself with [ufbt](https://github.com/flipperdevices/flipperzero-ufbt)
 
 
 ![build status badge](https://github.com/rdefeo/pinball0/actions/workflows/build.yml/badge.svg)
 ![build status badge](https://github.com/rdefeo/pinball0/actions/workflows/build.yml/badge.svg)
 
 
-> The default tables and example tables may / will change
+> Note: The default tables and example tables may / will change
 
 
 ## Screenshots
 ## Screenshots
 
 
@@ -26,13 +27,13 @@ Still a work in progress...
 * Rollover items
 * Rollover items
 * Sounds! Blinky lights! Annoying vibrations!
 * Sounds! Blinky lights! Annoying vibrations!
 * Customizable notification settings: sound, LED, vibration
 * Customizable notification settings: sound, LED, vibration
-* Idle timeout to save battery - will exit after ~120 seconds of no key-presses
+* Idle timeout to save battery - will exit after ~2 minutes of no key-presses on menu screen
 
 
 ## Controls
 ## Controls
 * **Ok** to release the ball
 * **Ok** to release the ball
 * **Left** and **Right** to activate the left and right flippers
 * **Left** and **Right** to activate the left and right flippers
 * **Back** to return to the main menu or exit
 * **Back** to return to the main menu or exit
-* **Up** to "bump" the table if the ball gets stuck
+* **Up** to "bump" the table if the ball gets stuck. Table bumps are limited to 1 per second. if a table has `tilt_detect` enabled (default is `true`) then your 3rd table bump will tilt the machine and you'll lose the current ball!
 
 
 I find it easiest to hold the flipper with both hands so I can hit left/right with my thumbs!
 I find it easiest to hold the flipper with both hands so I can hit left/right with my thumbs!
 
 
@@ -44,17 +45,15 @@ The **SETTINGS** menu will be the "last" table listed. You can Enable / Disable
 ## Tables
 ## Tables
 Pinball0 ships with several default tables. These tables are automatically deployed into the assets folder (`/apps_assets/pinball0/tables`) on your SD card. Tables are simple JSON which means you can define your own! Your tables should be stored in the data folder (`/apps_data/pinball0/tables`). On the main menu, tables are sorted alphabetically. In order to "force" a sorting order, you can prepend any filename with `NN_` where `NN` is between `00` and `99`. When the files are displayed on the menu, if they start with `NN_`, that will be stripped - but their sorted order will be preserved.
 Pinball0 ships with several default tables. These tables are automatically deployed into the assets folder (`/apps_assets/pinball0/tables`) on your SD card. Tables are simple JSON which means you can define your own! Your tables should be stored in the data folder (`/apps_data/pinball0/tables`). On the main menu, tables are sorted alphabetically. In order to "force" a sorting order, you can prepend any filename with `NN_` where `NN` is between `00` and `99`. When the files are displayed on the menu, if they start with `NN_`, that will be stripped - but their sorted order will be preserved.
 
 
-> The default tables may change over time.
-
 In **Debug** mode, test tables will be shown. A test table is one that begins with the text `dbg`. Given that you can prefix table names for sorting purposes, here are two valid table filenames for a test table called `my FLIPS`: `dbg my FLIPS.json` and `04_dbg my FLIPS.json`. In both cases it will be displayed as `dbg my FLIPS` on the menu. I doubt that you will use this feature, but I'm documenting it anyway.
 In **Debug** mode, test tables will be shown. A test table is one that begins with the text `dbg`. Given that you can prefix table names for sorting purposes, here are two valid table filenames for a test table called `my FLIPS`: `dbg my FLIPS.json` and `04_dbg my FLIPS.json`. In both cases it will be displayed as `dbg my FLIPS` on the menu. I doubt that you will use this feature, but I'm documenting it anyway.
 
 
 
 
 ### File Format
 ### File Format
 Table units are specified at a 10x scale. This means our table is **630 x 1270** in size (as the F0 display is 64 pixels x 128 pixels). Our origin is in the top-left at 0, 0. Check out the default tables in the `assets/tables` folder for example usage.
 Table units are specified at a 10x scale. This means our table is **630 x 1270** in size (as the F0 display is 64 pixels x 128 pixels). Our origin is in the top-left at 0, 0. Check out the default tables in the `assets/tables` folder for example usage.
 
 
-These JSON elements are all defined at the top-level. The JSON can include comments - because why not!
+> There is some basic error checking when reading / parsing the table files. If the error is serious enough, you will see an error message in the app. Otherwise, check the console logs. For those familiar with `ufbt`, simply run `ufbt cli` and issue the `log` command. Then launch Pinball0. All informational and higher logs will be displayed. These logs are useful when reporting bugs/issues!
 
 
-> **DISCLAIMER:** The file format may change from release to release. Sorry. There is some basic error checking when reading / parsing the table files. If the error is serious enough, you will see an error message in the app. Otherwise, check the console logs. For those familiar with `ufbt`, simply run `ufbt cli` and issue the `log` command. Then launch Pinball0. All informational and higher logs will be displayed. These logs are useful when reporting bugs/issues!
+These JSON elements are all defined at the top-level. The JSON can include comments - because why not!
 
 
 #### lives : object (optional)
 #### lives : object (optional)
 Defines how many lives/balls you start with, and display information
 Defines how many lives/balls you start with, and display information

+ 5 - 4
pinball0.cxx

@@ -18,7 +18,7 @@
 #define GAME_FPS          30
 #define GAME_FPS          30
 #define MANUAL_ADJUSTMENT 20
 #define MANUAL_ADJUSTMENT 20
 #define IDLE_TIMEOUT      120 * 1000 // 120 seconds * 1000 ticks/sec
 #define IDLE_TIMEOUT      120 * 1000 // 120 seconds * 1000 ticks/sec
-#define BUMP_DELAY        2 * 1000 // 2 seconds
+#define BUMP_COOLDOWN     1 * 1000 // 1 seconds
 #define BUMP_MAX          3
 #define BUMP_MAX          3
 
 
 void solve(PinballApp* pb, float dt) {
 void solve(PinballApp* pb, float dt) {
@@ -494,7 +494,7 @@ extern "C" int32_t pinball0_app(void* p) {
                         if(event.type == InputTypePress) {
                         if(event.type == InputTypePress) {
                             // Table bump and Tilt tracking
                             // Table bump and Tilt tracking
                             uint32_t current_tick = furi_get_tick();
                             uint32_t current_tick = furi_get_tick();
-                            if(current_tick - app.table->last_bump >= BUMP_DELAY) {
+                            if(current_tick - app.table->last_bump >= BUMP_COOLDOWN) {
                                 app.table->bump_count++;
                                 app.table->bump_count++;
                                 app.table->last_bump = current_tick;
                                 app.table->last_bump = current_tick;
                                 if(!app.table->tilt_detect_enabled ||
                                 if(!app.table->tilt_detect_enabled ||
@@ -631,14 +631,15 @@ extern "C" int32_t pinball0_app(void* p) {
         view_port_update(view_port);
         view_port_update(view_port);
         furi_mutex_release(app.mutex);
         furi_mutex_release(app.mutex);
 
 
-        // game timing + idle check
+        // idle timeout check
         uint32_t current_tick = furi_get_tick();
         uint32_t current_tick = furi_get_tick();
-        if(current_tick - app.idle_start >= IDLE_TIMEOUT) {
+        if(app.game_mode == GM_TableSelect && current_tick - app.idle_start >= IDLE_TIMEOUT) {
             FURI_LOG_W(TAG, "Idle timeout! Exiting Pinball0...");
             FURI_LOG_W(TAG, "Idle timeout! Exiting Pinball0...");
             app.processing = false;
             app.processing = false;
             break;
             break;
         }
         }
 
 
+        // game loop timing
         uint32_t time_lapsed = current_tick - last_frame_time;
         uint32_t time_lapsed = current_tick - last_frame_time;
         dt = time_lapsed / 1000.0f;
         dt = time_lapsed / 1000.0f;
         while(dt < 1.0f / GAME_FPS) {
         while(dt < 1.0f / GAME_FPS) {