Просмотр исходного кода

Squashed 'bomberduck/' changes from 8249769e6..d22b23f57

d22b23f57 fixing some big bugs
1c10d4831 combine 1
eb5e7737c move base pack here
REVERT: 8249769e6 init
REVERT: 213f461f4 init
REVERT: d17b78c11 init
REVERT: fba152128 init
REVERT: e56a8447e init
REVERT: 9f1035042 init
REVERT: 1f3e6ed3a Delete ReadMe.md
REVERT: 14f0198bd init
REVERT: 5bc7e13f2 init
REVERT: 33f2f43ce Initial commit

git-subtree-dir: bomberduck
git-subtree-split: d22b23f57e752605ef1b6626d0167a1605c91077
Willy-JL 2 лет назад
Родитель
Сommit
f32d5483f2
5 измененных файлов с 27 добавлено и 23 удалено
  1. 1 1
      LICENSE
  2. 3 1
      application.fam
  3. 23 21
      bomberduck.c
  4. BIN
      img/1.png
  5. BIN
      img/2.png

+ 1 - 1
LICENSE

@@ -1,6 +1,6 @@
 MIT License
 MIT License
 
 
-Copyright (c) [year] [fullname]
+Copyright (c) 2023 лень
 
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 of this software and associated documentation files (the "Software"), to deal

+ 3 - 1
application.fam

@@ -3,7 +3,6 @@ App(
     name="Bomberduck",
     name="Bomberduck",
     apptype=FlipperAppType.EXTERNAL,
     apptype=FlipperAppType.EXTERNAL,
     entry_point="bomberduck_app",
     entry_point="bomberduck_app",
-    cdefines=["BOMBERDUCK"],
     requires=[
     requires=[
         "gui",
         "gui",
     ],
     ],
@@ -12,4 +11,7 @@ App(
 	fap_icon="bomb.png",
 	fap_icon="bomb.png",
     fap_category="Games",
     fap_category="Games",
     fap_icon_assets="assets",
     fap_icon_assets="assets",
+    fap_author="@leo-need-more-coffee & @xMasterX",
+    fap_version="1.1",
+    fap_description="Bomberduck(Bomberman) Game",
 )
 )

+ 23 - 21
bomberduck.c

@@ -5,7 +5,6 @@
 #include <input/input.h>
 #include <input/input.h>
 #include <notification/notification.h>
 #include <notification/notification.h>
 #include <notification/notification_messages.h>
 #include <notification/notification_messages.h>
-#include <gui/canvas_i.h>
 #include "bomberduck_icons.h"
 #include "bomberduck_icons.h"
 #include <dolphin/dolphin.h>
 #include <dolphin/dolphin.h>
 
 
@@ -21,7 +20,6 @@ int min(int a, int b) {
 #define WorldSizeY 6
 #define WorldSizeY 6
 #define BombRange 1
 #define BombRange 1
 
 
-
 typedef struct {
 typedef struct {
     FuriMutex* mutex;
     FuriMutex* mutex;
 } BomberState;
 } BomberState;
@@ -105,7 +103,7 @@ void init() {
         }
         }
     }
     }
     world.running = 1;
     world.running = 1;
-    world.bombs_count =0;
+    world.bombs_count = 0;
     vibration = false;
     vibration = false;
     for(int j = max(0, player.y - BombRange); j < min(WorldSizeY, player.y + BombRange + 1); j++) {
     for(int j = max(0, player.y - BombRange); j < min(WorldSizeY, player.y + BombRange + 1); j++) {
         world.matrix[j][player.x] = 0;
         world.matrix[j][player.x] = 0;
@@ -191,7 +189,6 @@ static const NotificationSequence vibr1 = {
     NULL,
     NULL,
 };
 };
 
 
-
 void intToStr(int num, char* str) {
 void intToStr(int num, char* str) {
     int i = 0, sign = 0;
     int i = 0, sign = 0;
 
 
@@ -344,7 +341,7 @@ static void draw_callback(Canvas* canvas, void* ctx) {
         if(world.player->x == world.endx && world.player->y == world.endy) {
         if(world.player->x == world.endx && world.player->y == world.endy) {
             if(world.level == 20) {
             if(world.level == 20) {
                 canvas_draw_str(canvas, 30, 35, "You win!");
                 canvas_draw_str(canvas, 30, 35, "You win!");
-            }else{
+            } else {
                 canvas_draw_str(canvas, 30, 35, "Next level!");
                 canvas_draw_str(canvas, 30, 35, "Next level!");
                 char str[20];
                 char str[20];
                 intToStr(world.level, str);
                 intToStr(world.level, str);
@@ -385,7 +382,7 @@ int32_t bomberduck_app(void* p) {
         return 255;
         return 255;
     }
     }
 
 
-    DOLPHIN_DEED(DolphinDeedPluginGameStart);
+    dolphin_deed(DolphinDeedPluginGameStart);
     // Создаем новый view port
     // Создаем новый view port
     ViewPort* view_port = view_port_alloc();
     ViewPort* view_port = view_port_alloc();
     // Создаем callback отрисовки, без контекста
     // Создаем callback отрисовки, без контекста
@@ -427,24 +424,24 @@ int32_t bomberduck_app(void* p) {
                 if(world.running) {
                 if(world.running) {
                     if(event.key == InputKeyUp) {
                     if(event.key == InputKeyUp) {
                         if(world.player->y > 0 &&
                         if(world.player->y > 0 &&
-                        world.matrix[world.player->y - 1][world.player->x] == 0)
+                           world.matrix[world.player->y - 1][world.player->x] == 0)
                             world.player->y--;
                             world.player->y--;
                     }
                     }
                     if(event.key == InputKeyDown) {
                     if(event.key == InputKeyDown) {
                         if(world.player->y < WorldSizeY - 1 &&
                         if(world.player->y < WorldSizeY - 1 &&
-                        world.matrix[world.player->y + 1][world.player->x] == 0)
+                           world.matrix[world.player->y + 1][world.player->x] == 0)
                             world.player->y++;
                             world.player->y++;
                     }
                     }
                     if(event.key == InputKeyLeft) {
                     if(event.key == InputKeyLeft) {
                         world.player->side = 0;
                         world.player->side = 0;
                         if(world.player->x > 0 &&
                         if(world.player->x > 0 &&
-                        world.matrix[world.player->y][world.player->x - 1] == 0)
+                           world.matrix[world.player->y][world.player->x - 1] == 0)
                             world.player->x--;
                             world.player->x--;
                     }
                     }
                     if(event.key == InputKeyRight) {
                     if(event.key == InputKeyRight) {
                         world.player->side = 1;
                         world.player->side = 1;
                         if(world.player->x < WorldSizeX - 1 &&
                         if(world.player->x < WorldSizeX - 1 &&
-                        world.matrix[world.player->y][world.player->x + 1] == 0)
+                           world.matrix[world.player->y][world.player->x + 1] == 0)
                             world.player->x++;
                             world.player->x++;
                     }
                     }
                 }
                 }
@@ -459,8 +456,8 @@ int32_t bomberduck_app(void* p) {
                 notification_message(notification, &end);
                 notification_message(notification, &end);
                 world.running = 0;
                 world.running = 0;
                 world.level += 1;
                 world.level += 1;
-                if(world.level%5==0){
-                    DOLPHIN_DEED(DolphinDeedPluginGameWin);
+                if(world.level % 5 == 0) {
+                    dolphin_deed(DolphinDeedPluginGameWin);
                 }
                 }
             }
             }
             for(int i = 0; i < world.bombs_count; i++) {
             for(int i = 0; i < world.bombs_count; i++) {
@@ -524,13 +521,18 @@ int32_t bomberduck_app(void* p) {
                         world.bombs[j] = world.bombs[j + 1];
                         world.bombs[j] = world.bombs[j + 1];
                     }
                     }
                     world.bombs_count--;
                     world.bombs_count--;
-                } else if(furi_get_tick() - world.bombs[i].planted > (unsigned long)max((3000 - world.level * 150)*2/3, 666)&&world.matrix[world.bombs[i].y][world.bombs[i].x]!=5) {
-                        world.matrix[world.bombs[i].y][world.bombs[i].x] = 5;
-                        vibration=true;
-
-                } else if(furi_get_tick() - world.bombs[i].planted > (unsigned long)max((3000 - world.level * 150)/3, 333)&& world.matrix[world.bombs[i].y][world.bombs[i].x]!=4) {
-                        world.matrix[world.bombs[i].y][world.bombs[i].x] = 4;
-                    
+                } else if(
+                    furi_get_tick() - world.bombs[i].planted >
+                        (unsigned long)max((3000 - world.level * 150) * 2 / 3, 666) &&
+                    world.matrix[world.bombs[i].y][world.bombs[i].x] != 5) {
+                    world.matrix[world.bombs[i].y][world.bombs[i].x] = 5;
+                    vibration = true;
+
+                } else if(
+                    furi_get_tick() - world.bombs[i].planted >
+                        (unsigned long)max((3000 - world.level * 150) / 3, 333) &&
+                    world.matrix[world.bombs[i].y][world.bombs[i].x] != 4) {
+                    world.matrix[world.bombs[i].y][world.bombs[i].x] = 4;
                 }
                 }
             }
             }
             for(int e = 0; e < world.enemies_count; e++) {
             for(int e = 0; e < world.enemies_count; e++) {
@@ -618,13 +620,13 @@ int32_t bomberduck_app(void* p) {
                     }
                     }
                 }
                 }
             }
             }
-            if(vibration){
+            if(vibration) {
                 notification_message(notification, &vibr1);
                 notification_message(notification, &vibr1);
             }
             }
         }
         }
 
 
-        view_port_update(view_port);
         furi_mutex_release(bomber_state->mutex);
         furi_mutex_release(bomber_state->mutex);
+        view_port_update(view_port);
     }
     }
 
 
     // Return to normal backlight settings
     // Return to normal backlight settings