Playing games now affect Flipper's level

All games now will increase flipper's level when you start them or win in some of them

Games with endless play like tetris or flappy bird has no winning logic so they will increase level only when you start them
This commit is contained in:
MX 2023-02-05 15:39:10 +03:00
parent 246dcdb23f
commit 72f250195c
No known key found for this signature in database
GPG Key ID: 7CCC66B7DBDD1C83
12 changed files with 50 additions and 1 deletions

View File

@ -5,6 +5,7 @@
#include <gui/view.h> #include <gui/view.h>
#include <notification/notification.h> #include <notification/notification.h>
#include <notification/notification_messages.h> #include <notification/notification_messages.h>
#include <dolphin/dolphin.h>
#define TAG "Arkanoid" #define TAG "Arkanoid"
@ -397,6 +398,9 @@ int32_t arkanoid_game_app(void* p) {
Gui* gui = furi_record_open(RECORD_GUI); Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen); gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Call dolphin deed on game start
DOLPHIN_DEED(DolphinDeedPluginGameStart);
GameEvent event; GameEvent event;
for(bool processing = true; processing;) { for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100); FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);

View File

@ -571,6 +571,8 @@ int32_t blackjack_app(void* p) {
gui_add_view_port(gui, view_port, GuiLayerFullscreen); gui_add_view_port(gui, view_port, GuiLayerFullscreen);
AppEvent event; AppEvent event;
// Call dolphin deed on game start
DOLPHIN_DEED(DolphinDeedPluginGameStart); DOLPHIN_DEED(DolphinDeedPluginGameStart);
for(bool processing = true; processing;) { for(bool processing = true; processing;) {

View File

@ -13,6 +13,7 @@
#include "level.h" #include "level.h"
#include <notification/notification.h> #include <notification/notification.h>
#include <notification/notification_messages.h> #include <notification/notification_messages.h>
#include <dolphin/dolphin.h>
#define SOUND #define SOUND
@ -989,6 +990,9 @@ int32_t doom_app() {
music_player_worker_load_rtttl_from_string(plugin_state->music_instance->worker, dsintro); music_player_worker_load_rtttl_from_string(plugin_state->music_instance->worker, dsintro);
music_player_worker_start(plugin_state->music_instance->worker); music_player_worker_start(plugin_state->music_instance->worker);
#endif #endif
// Call dolphin deed on game start
DOLPHIN_DEED(DolphinDeedPluginGameStart);
for(bool processing = true; processing;) { for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100); FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
PluginState* plugin_state = (PluginState*)acquire_mutex_block(&state_mutex); PluginState* plugin_state = (PluginState*)acquire_mutex_block(&state_mutex);

View File

@ -5,6 +5,7 @@
#include <gui/gui.h> #include <gui/gui.h>
#include <gui/icon_animation_i.h> #include <gui/icon_animation_i.h>
#include <input/input.h> #include <input/input.h>
#include <dolphin/dolphin.h>
#define TAG "Flappy" #define TAG "Flappy"
#define DEBUG false #define DEBUG false
@ -307,6 +308,9 @@ int32_t flappy_game_app(void* p) {
Gui* gui = furi_record_open(RECORD_GUI); Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen); gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Call dolphin deed on game start
DOLPHIN_DEED(DolphinDeedPluginGameStart);
GameEvent event; GameEvent event;
for(bool processing = true; processing;) { for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100); FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);

View File

@ -3,6 +3,7 @@
#include <notification/notification.h> #include <notification/notification.h>
#include <notification/notification_messages.h> #include <notification/notification_messages.h>
#include <storage/storage.h> #include <storage/storage.h>
#include <dolphin/dolphin.h>
#include "sandbox.h" #include "sandbox.h"
@ -461,6 +462,10 @@ int32_t game15_app() {
sandbox_init( sandbox_init(
FPS, (SandboxRenderCallback)render_callback, (SandboxEventHandler)game_event_handler); FPS, (SandboxRenderCallback)render_callback, (SandboxEventHandler)game_event_handler);
// Call dolphin deed on game start
DOLPHIN_DEED(DolphinDeedPluginGameStart);
sandbox_loop(); sandbox_loop();
sandbox_free(); sandbox_free();
game_free(); game_free();

View File

@ -13,6 +13,7 @@
#include <gui/gui.h> #include <gui/gui.h>
#include <input/input.h> #include <input/input.h>
#include <storage/storage.h> #include <storage/storage.h>
#include <dolphin/dolphin.h>
#include "digits.h" #include "digits.h"
#include "array_utils.h" #include "array_utils.h"
@ -382,7 +383,7 @@ int32_t game_2048_app() {
ValueMutex state_mutex; ValueMutex state_mutex;
if(!init_mutex(&state_mutex, game_state, sizeof(GameState))) { if(!init_mutex(&state_mutex, game_state, sizeof(GameState))) {
FURI_LOG_E("SnakeGame", "cannot create mutex\r\n"); FURI_LOG_E("2048Game", "cannot create mutex\r\n");
free(game_state); free(game_state);
return 255; return 255;
} }
@ -397,6 +398,9 @@ int32_t game_2048_app() {
Gui* gui = furi_record_open(RECORD_GUI); Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen); gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Call dolphin deed on game start
DOLPHIN_DEED(DolphinDeedPluginGameStart);
bool is_finished = false; bool is_finished = false;
while(!is_finished) { while(!is_finished) {
FuriStatus event_status = furi_message_queue_get(event_queue, &input, FuriWaitForever); FuriStatus event_status = furi_message_queue_get(event_queue, &input, FuriWaitForever);

View File

@ -15,6 +15,7 @@
#include <notification/notification.h> #include <notification/notification.h>
#include <notification/notification_messages.h> #include <notification/notification_messages.h>
#include <gui/canvas_i.h> #include <gui/canvas_i.h>
#include <dolphin/dolphin.h>
#define Y_FIELD_SIZE 6 #define Y_FIELD_SIZE 6
#define Y_LAST (Y_FIELD_SIZE - 1) #define Y_LAST (Y_FIELD_SIZE - 1)
@ -530,6 +531,9 @@ int32_t heap_defence_app(void* p) {
game->game_status = 0; game->game_status = 0;
game->animation = AnimationPause; game->animation = AnimationPause;
// Call dolphin deed on game start
DOLPHIN_DEED(DolphinDeedPluginGameStart);
GameEvent event = {0}; GameEvent event = {0};
while(event.input.key != InputKeyBack) { while(event.input.key != InputKeyBack) {
if(furi_message_queue_get(event_queue, &event, 100) != FuriStatusOk) { if(furi_message_queue_get(event_queue, &event, 100) != FuriStatusOk) {

View File

@ -8,6 +8,8 @@
#include <dialogs/dialogs.h> #include <dialogs/dialogs.h>
#include <m-string.h> #include <m-string.h>
#include <dolphin/dolphin.h>
#include "assets.h" #include "assets.h"
#define PLAYFIELD_WIDTH 16 #define PLAYFIELD_WIDTH 16
@ -255,6 +257,9 @@ static bool game_won(Minesweeper* minesweeper_state) {
dialog_message_set_buttons(message, NULL, "Play again", NULL); dialog_message_set_buttons(message, NULL, "Play again", NULL);
dialog_message_set_icon(message, NULL, 72, 17); dialog_message_set_icon(message, NULL, 72, 17);
// Call dolphin deed when we win the game
DOLPHIN_DEED(DolphinDeedPluginGameWin);
DialogMessageButton choice = dialog_message_show(dialogs, message); DialogMessageButton choice = dialog_message_show(dialogs, message);
dialog_message_free(message); dialog_message_free(message);
furi_string_free(tempStr); furi_string_free(tempStr);
@ -409,6 +414,9 @@ int32_t minesweeper_app(void* p) {
Gui* gui = furi_record_open("gui"); Gui* gui = furi_record_open("gui");
gui_add_view_port(gui, view_port, GuiLayerFullscreen); gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Call dolphin deed on game start
DOLPHIN_DEED(DolphinDeedPluginGameStart);
PluginEvent event; PluginEvent event;
for(bool processing = true; processing;) { for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100); FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);

View File

@ -491,6 +491,8 @@ int32_t solitaire_app(void* p) {
gui_add_view_port(gui, view_port, GuiLayerFullscreen); gui_add_view_port(gui, view_port, GuiLayerFullscreen);
AppEvent event; AppEvent event;
// Call Dolphin deed on game start
DOLPHIN_DEED(DolphinDeedPluginGameStart); DOLPHIN_DEED(DolphinDeedPluginGameStart);
for(bool processing = true; processing;) { for(bool processing = true; processing;) {

View File

@ -6,6 +6,7 @@
#include <string.h> #include <string.h>
#include <furi_hal_resources.h> #include <furi_hal_resources.h>
#include <furi_hal_gpio.h> #include <furi_hal_gpio.h>
#include <dolphin/dolphin.h>
#define BORDER_OFFSET 1 #define BORDER_OFFSET 1
#define MARGIN_OFFSET 3 #define MARGIN_OFFSET 3
@ -383,6 +384,9 @@ int32_t tetris_game_app() {
Piece* newPiece = malloc(sizeof(Piece)); Piece* newPiece = malloc(sizeof(Piece));
uint8_t downRepeatCounter = 0; uint8_t downRepeatCounter = 0;
// Call dolphin deed on game start
DOLPHIN_DEED(DolphinDeedPluginGameStart);
for(bool processing = true; processing;) { for(bool processing = true; processing;) {
// This 10U implicitly sets the game loop speed. downRepeatCounter relies on this value // This 10U implicitly sets the game loop speed. downRepeatCounter relies on this value
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 10U); FuriStatus event_status = furi_message_queue_get(event_queue, &event, 10U);

View File

@ -3,6 +3,7 @@
#include <input/input.h> #include <input/input.h>
#include <stdlib.h> #include <stdlib.h>
#include <gui/view.h> #include <gui/view.h>
#include <dolphin/dolphin.h>
#define TAG "TicTacToe" #define TAG "TicTacToe"
@ -330,6 +331,9 @@ int32_t tictactoe_game_app(void* p) {
Gui* gui = furi_record_open(RECORD_GUI); Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen); gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Call dolphin deed on game start
DOLPHIN_DEED(DolphinDeedPluginGameStart);
GameEvent event; GameEvent event;
for(bool processing = true; processing;) { for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100); FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);

View File

@ -2,6 +2,7 @@
#include <gui/gui.h> #include <gui/gui.h>
#include <input/input.h> #include <input/input.h>
#include <stdlib.h> #include <stdlib.h>
#include <dolphin/dolphin.h>
//ORIGINAL REPO: https://github.com/Dooskington/flipperzero-zombiez //ORIGINAL REPO: https://github.com/Dooskington/flipperzero-zombiez
//AUTHORS: https://github.com/Dooskington | https://github.com/DevMilanIan //AUTHORS: https://github.com/Dooskington | https://github.com/DevMilanIan
@ -313,6 +314,9 @@ int32_t zombiez_game_app(void* p) {
Gui* gui = furi_record_open(RECORD_GUI); Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen); gui_add_view_port(gui, view_port, GuiLayerFullscreen);
// Call dolphin deed on game start
DOLPHIN_DEED(DolphinDeedPluginGameStart);
PluginEvent event; PluginEvent event;
bool isRunning = true; bool isRunning = true;
while(isRunning) { while(isRunning) {