diff --git a/ReadMe.md b/ReadMe.md
index a73fa5221..1cedb8b6c 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -174,7 +174,7 @@ You can support us by using links or addresses below:
- ESP32-CAM -> Camera Suite [(by CodyTolene)](https://github.com/CodyTolene/Flipper-Zero-Camera-Suite)
Games:
-- DOOM (fixed) [(by p4nic4ttack)](https://github.com/p4nic4ttack/doom-flipper-zero/)
+- DOOM (ported and fixed by @xMasterX & @Svarich & @hedger) [(original by p4nic4ttack)](https://github.com/p4nic4ttack/doom-flipper-zero/)
- Zombiez [(Reworked By DevMilanIan)](https://github.com/RogueMaster/flipperzero-firmware-wPlugins/pull/240) [(Original By Dooskington)](https://github.com/Dooskington/flipperzero-zombiez)
- Flappy Bird [(by DroomOne)](https://github.com/DroomOne/flipperzero-firmware/tree/dev/applications/flappy_bird)
- Arkanoid (refactored by xMasterX) [(by gotnull)](https://github.com/gotnull/flipperzero-firmware-wPlugins)
diff --git a/applications/external/doom/.gitignore b/applications/external/doom/.gitignore
new file mode 100644
index 000000000..e2a15a10a
--- /dev/null
+++ b/applications/external/doom/.gitignore
@@ -0,0 +1,4 @@
+dist/*
+.vscode
+.clang-format
+.editorconfig
\ No newline at end of file
diff --git a/applications/external/doom/README.md b/applications/external/doom/README.md
index 86e8d6d28..501f644d1 100644
--- a/applications/external/doom/README.md
+++ b/applications/external/doom/README.md
@@ -1,68 +1,10 @@
# Doom Flipper Zero edition
-
-

-
## Will it run Doom?
-As tradition goes, Doom is being ported to almost every possible embedded electronic device. Therefore I did an attempt to come up with something close to Doom and still compatible on the Flipper Zero's hardware.
This is not the actual Doom game but a port made from yet another Doom port to the Arduino Nano (https://github.com/daveruiz/doom-nano/). This port is basically a raycasting engine, using Doom sprites.
+As tradition goes, Doom is being ported to almost every possible embedded electronic device. Therefore I did an attempt to come up with something close to Doom and still compatible on the Flipper Zero's hardware. This is not the actual Doom game but a port made from yet another Doom port to the Arduino Nano - https://github.com/daveruiz/doom-nano/. This port is basically a raycasting engine, using Doom sprites.
This version is very basic and might be improved over time.
-## How to install on Flipper Zero
-During the porting process, minor changes were made to the workings (and build options) of the current firmware. These changes are documented here and are necessary in order to get a working firmware build that contains this Doom port.
-### Modifying the firmware & build options
- * In the `sites/cc.scons` add the following values to the `CCFLAGS` section:
- ```
- ...
-"-Wno-unused-parameter",
-"-Wno-type-limits",
-"-Wno-unused-variable",
-...
- ```
- * In `applications/gui/canvas_i.h` comment out the following line:
- `uint8_t* canvas_get_buffer(Canvas* canvas);` --> `//uint8_t* canvas_get_buffer(Canvas* canvas);`
-
- * In `applications/gui/canvas.h` add the following lines:
- ```
- uint8_t* canvas_get_buffer(Canvas* canvas);
- void canvas_draw_icon_bitmap(Canvas* canvas, uint8_t x, uint8_t y, int16_t w, int16_t h, const Icon* icon);
- ```
- * In `applications/gui/canvas.c` add the following function:
- ```
- void canvas_draw_icon_bitmap(Canvas* canvas, uint8_t x, uint8_t y, int16_t w, int16_t h, const Icon* icon){
- furi_assert(canvas);
- furi_assert(icon);
-
- x += canvas->offset_x;
- y += canvas->offset_y;
- uint8_t* icon_data = NULL;
- furi_hal_compress_icon_decode(icon_get_data(icon), &icon_data);
- u8g2_DrawXBM(&canvas->fb, x, y, w, h, icon_data);
- }
- ```
-
-### Installing the plugin in the firmware
- * Make a folder called Doom in the applications folder. Add all the source files (also the compiled folder and it's files) in the Doom folder.
- * Make the `applications/meta/application.fam` look like the following:
- ```
- App(
- appid="basic_plugins",
- name="Basic applications for plug-in menu",
- apptype=FlipperAppType.METAPACKAGE,
- provides=[
- ...
- "doom_game",
- ...
-
- ],
- )
- ```
-
-If all went well the only thing left to do is building the firmware and installing it to the Flipper.
-
-## Screenshots
-
-
-
-
-
-
-
+## Credits
+@xMasterX - Porting to latest firmware using new plugins system, fixing many issues, adding sound
+@Svaarich - New logo screen and cool icon
+@hedger - uFBT fixes and some bugfixes
+@p4nic4ttack - First raw implementation based on doom-nano
\ No newline at end of file
diff --git a/applications/external/doom/application.fam b/applications/external/doom/application.fam
index 94fa9ab67..5ff6878ee 100644
--- a/applications/external/doom/application.fam
+++ b/applications/external/doom/application.fam
@@ -11,4 +11,8 @@ App(
order=75,
fap_icon="doom_10px.png",
fap_category="Games",
+ fap_icon_assets="assets",
+ fap_author="@xMasterX & @Svarich & @hedger (original code by @p4nic4ttack)",
+ fap_version="1.0",
+ fap_description="Will it run Doom?",
)
diff --git a/applications/external/doom/compiled/assets_icons.c b/applications/external/doom/assets.c
similarity index 84%
rename from applications/external/doom/compiled/assets_icons.c
rename to applications/external/doom/assets.c
index cbdbbc94d..864588581 100644
--- a/applications/external/doom/compiled/assets_icons.c
+++ b/applications/external/doom/assets.c
@@ -1,78 +1,4 @@
-#include "assets_icons.h"
-
-#include
-
-// Inverted icons
-
-const uint8_t _I_fire_inv_0[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x30, 0x00, 0x40, 0xee, 0x00, 0x80, 0xe6, 0x00,
- 0x80, 0xa7, 0x01, 0x80, 0xc7, 0x03, 0x40, 0x45, 0x03, 0xe0, 0x41, 0x07, 0xf8, 0x82, 0x9f, 0xb9,
- 0x01, 0x3e, 0x7c, 0x00, 0x7a, 0x6e, 0x00, 0x56, 0x1c, 0x00, 0x6c, 0xf4, 0x01, 0x3a, 0x6c, 0x00,
- 0x7e, 0xfc, 0x00, 0x1a, 0x08, 0x00, 0x3c, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-const uint8_t* const _I_fire_inv[] = {_I_fire_inv_0};
-
-const uint8_t _I_gun_inv_0[] = {
- 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x80, 0x23, 0x00, 0x00, 0x40,
- 0x20, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x40, 0x57, 0x00, 0x00, 0x20, 0x8b, 0x00, 0x00,
- 0x90, 0x11, 0x01, 0x00, 0x98, 0x00, 0x00, 0x00, 0xb0, 0x43, 0x01, 0x00, 0x94, 0x81, 0x03,
- 0x00, 0xd0, 0x45, 0x04, 0x00, 0x8c, 0x02, 0x02, 0x00, 0xc4, 0x00, 0x03, 0x00, 0xc8, 0x00,
- 0x02, 0x00, 0x4e, 0x40, 0x00, 0x00, 0x92, 0x00, 0x02, 0x80, 0x07, 0x15, 0x04, 0xe0, 0x8f,
- 0x00, 0x0c, 0xd0, 0x9d, 0x07, 0x17, 0xe0, 0x3a, 0xc0, 0x3f, 0xe0, 0xf7, 0xff, 0x77, 0xe0,
- 0xae, 0xfe, 0x4b, 0xd8, 0xdd, 0xff, 0x4d, 0x88, 0xea, 0xbe, 0x26, 0x4c, 0xf5, 0xff, 0x17,
- 0xc8, 0xfa, 0xae, 0x0b, 0xcc, 0xff, 0xdf, 0x19, 0xe8, 0xeb, 0xa7, 0x00, 0xd8, 0xf1, 0x4d,
- 0x0c, 0xc0, 0xbe, 0x1a, 0x08, 0xf6, 0xfd, 0x37, 0x04,
-};
-const uint8_t* const _I_gun_inv[] = {_I_gun_inv_0};
-
-const uint8_t _I_gun_mask_inv_0[] = {
- 0x01, 0x00, 0x53, 0x00, 0x00, 0x0c, 0x38, 0x04, 0x38, 0x09, 0xf8, 0x0c, 0x78, 0x17, 0xf0,
- 0x18, 0xf8, 0x00, 0x67, 0xff, 0x01, 0xaf, 0xc3, 0xff, 0x01, 0x80, 0x7e, 0x3f, 0xf0, 0x38,
- 0x07, 0xf0, 0x0e, 0x40, 0x31, 0x03, 0x8f, 0xfb, 0xff, 0x07, 0x01, 0x94, 0x3c, 0x0e, 0xc0,
- 0x35, 0xff, 0x85, 0xc8, 0x06, 0x30, 0x7e, 0x00, 0x0c, 0x61, 0xe2, 0xe1, 0xff, 0xc7, 0xc5,
- 0xc3, 0xff, 0x9f, 0x80, 0xca, 0xfe, 0x03, 0x2f, 0xf8, 0x0c, 0xc6, 0xc2, 0x03, 0x4b, 0xf8,
- 0xa8, 0x42, 0xe2, 0x03, 0x28, 0xf8, 0x1e, 0x80, 0x68, 0x1e, 0x28, 0x78,
-};
-const uint8_t* const _I_gun_mask_inv[] = {_I_gun_mask_inv_0};
-
-const uint8_t _I_logo_inv_0[] = {
- 0x01, 0x00, 0x92, 0x01, 0x00, 0x78, 0x03, 0xc0, 0x03, 0xfc, 0xff, 0xff, 0xfc, 0x1f, 0xf9, 0xff,
- 0xe3, 0xff, 0x0f, 0x8f, 0xfc, 0x2f, 0xe0, 0xf3, 0xdc, 0x6e, 0xf7, 0x7b, 0x1d, 0xdd, 0xef, 0x79,
- 0xbb, 0xcd, 0xce, 0xf7, 0x13, 0xb0, 0x79, 0xfc, 0x03, 0xe3, 0xfb, 0x01, 0x0f, 0xfb, 0xff, 0xbf,
- 0x11, 0x8c, 0x7c, 0x1e, 0x7e, 0x0f, 0x77, 0xbb, 0xd4, 0x02, 0x10, 0x00, 0xeb, 0xad, 0xde, 0xc8,
- 0x70, 0x3c, 0xf8, 0x01, 0xf7, 0xbf, 0xff, 0x20, 0xe0, 0xf3, 0xc0, 0x6e, 0x80, 0x0d, 0x7a, 0xde,
- 0x40, 0x83, 0xf8, 0x03, 0x10, 0xfa, 0x70, 0x07, 0xee, 0x02, 0x18, 0x30, 0x3d, 0x0a, 0xe3, 0xfb,
- 0x83, 0x86, 0xc7, 0x82, 0x1f, 0x1f, 0xf8, 0xfd, 0x61, 0x5a, 0x0d, 0x54, 0x0b, 0x55, 0xaa, 0xc0,
- 0x00, 0x84, 0x0c, 0x21, 0xf4, 0x8f, 0xf4, 0x3b, 0x70, 0x3e, 0xf7, 0x7b, 0x01, 0x9f, 0xef, 0xf7,
- 0xc3, 0xfe, 0x1f, 0x6f, 0x87, 0xee, 0x07, 0xfe, 0xff, 0x60, 0x07, 0xfe, 0x1f, 0x88, 0xef, 0xc3,
- 0xf3, 0x01, 0xfe, 0x7f, 0x30, 0x1b, 0xdf, 0xef, 0xf6, 0x0a, 0x1f, 0xf0, 0x79, 0xd0, 0x22, 0xf7,
- 0x0b, 0x9c, 0x0e, 0xed, 0x76, 0x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x1e, 0xbf, 0xcc,
- 0x5b, 0x12, 0x0c, 0x56, 0x0a, 0x51, 0x82, 0xa8, 0x28, 0x08, 0x1f, 0x32, 0x0c, 0x00, 0x3e, 0x85,
- 0xe3, 0x1e, 0x17, 0x8f, 0x4f, 0xe6, 0x1f, 0x99, 0x44, 0x0a, 0x10, 0x2f, 0x13, 0xb4, 0xc8, 0x29,
- 0x03, 0xf3, 0x89, 0x03, 0xe7, 0x10, 0x5f, 0x2a, 0x87, 0xd1, 0x1b, 0xe0, 0x0f, 0x00, 0x78, 0x03,
- 0xc0, 0x1e, 0x00, 0xf0, 0x02, 0x00,
-};
-const uint8_t* const _I_logo_inv[] = {_I_logo_inv_0};
-
-const Icon I_fire_inv =
- {.width = 24, .height = 20, .frame_count = 1, .frame_rate = 0, .frames = _I_fire_inv};
-const Icon I_gun_inv =
- {.width = 32, .height = 32, .frame_count = 1, .frame_rate = 0, .frames = _I_gun_inv};
-const Icon I_gun_mask_inv =
- {.width = 32, .height = 32, .frame_count = 1, .frame_rate = 0, .frames = _I_gun_mask_inv};
-const Icon I_logo_inv =
- {.width = 128, .height = 64, .frame_count = 1, .frame_rate = 0, .frames = _I_logo_inv};
+#include "assets.h"
const uint8_t space[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
const uint8_t zero[] = {0x00, 0x60, 0x90, 0x90, 0x90, 0x60};
diff --git a/applications/external/doom/compiled/assets_icons.h b/applications/external/doom/assets.h
similarity index 94%
rename from applications/external/doom/compiled/assets_icons.h
rename to applications/external/doom/assets.h
index 3521728de..546d7607d 100644
--- a/applications/external/doom/compiled/assets_icons.h
+++ b/applications/external/doom/assets.h
@@ -41,12 +41,6 @@
#define GRADIENT_WHITE 7
#define GRADIENT_BLACK 0
-// Inverted icons
-extern const Icon I_fire_inv;
-extern const Icon I_gun_inv;
-extern const Icon I_gun_mask_inv;
-extern const Icon I_logo_inv;
-
// Fonts
extern const uint8_t zero[];
extern const uint8_t one[];
diff --git a/applications/external/doom/assets/screenshot-imp2.jpg b/applications/external/doom/assets/screenshot-imp2.jpg
deleted file mode 100644
index 0b4c29c4f..000000000
Binary files a/applications/external/doom/assets/screenshot-imp2.jpg and /dev/null differ
diff --git a/applications/external/doom/assets/screenshot-intro2.jpg b/applications/external/doom/assets/screenshot-intro2.jpg
deleted file mode 100644
index 21fd72840..000000000
Binary files a/applications/external/doom/assets/screenshot-intro2.jpg and /dev/null differ
diff --git a/applications/external/doom/assets/screenshot-medkit2.jpg b/applications/external/doom/assets/screenshot-medkit2.jpg
deleted file mode 100644
index 4ee0269f3..000000000
Binary files a/applications/external/doom/assets/screenshot-medkit2.jpg and /dev/null differ
diff --git a/applications/external/doom/assets/screenshot-start2.jpg b/applications/external/doom/assets/screenshot-start2.jpg
deleted file mode 100644
index 6b28ed987..000000000
Binary files a/applications/external/doom/assets/screenshot-start2.jpg and /dev/null differ
diff --git a/applications/external/doom/display.h b/applications/external/doom/display.h
index 9695b5adf..89f821867 100644
--- a/applications/external/doom/display.h
+++ b/applications/external/doom/display.h
@@ -1,9 +1,8 @@
#include
-#include
#include
-#include
#include "constants.h"
-#include "compiled/assets_icons.h"
+#include
+#include "assets.h"
#define CHECK_BIT(var, pos) ((var) & (1 << (pos)))
@@ -50,14 +49,12 @@ void fadeScreen(uint8_t intensity, bool color, Canvas* const canvas);
bool getGradientPixel(uint8_t x, uint8_t y, uint8_t i);
double getActualFps();
void fps();
-void setupDisplay(Canvas* canvas);
uint8_t reverse_bits(uint8_t num);
// FPS control
double delta = 1;
uint32_t lastFrameTime = 0;
uint8_t zbuffer[128]; /// 128 = screen width & REMOVE WHEN DISPLAY.H IMPLEMENTED
-uint8_t* display_buf = NULL;
void drawGun(
int16_t x,
@@ -88,12 +85,6 @@ void drawVLine(uint8_t x, int8_t start_y, int8_t end_y, uint8_t intensity, Canva
}
}
-void setupDisplay(Canvas* canvas) {
- memset(zbuffer, 0xff, 128);
- display_buf = (uint8_t*)canvas->fb.tile_buf_ptr;
- //display_buf = u8g2_GetBufferPtr(&canvas->fb);
-}
-
void drawBitmap(
int16_t x,
int16_t y,
@@ -102,13 +93,20 @@ void drawBitmap(
int16_t h,
uint16_t color,
Canvas* const canvas) {
- UNUSED(color);
- canvas_draw_icon_bitmap(canvas, x, y, w, h, i);
+ UNUSED(w);
+ UNUSED(h);
+ if(!color) {
+ canvas_invert_color(canvas);
+ }
+ canvas_draw_icon(canvas, x, y, i);
+ if(!color) {
+ canvas_invert_color(canvas);
+ }
}
void drawText(uint8_t x, uint8_t y, uint8_t num, Canvas* const canvas) {
char buf[4];
- itoa(num, buf, 10);
+ snprintf(buf, 4, "%d", num);
drawTextSpace(x, y, buf, 1, canvas);
}
diff --git a/applications/external/doom/doom.c b/applications/external/doom/doom.c
index b9cea97a0..c2d9a6bf0 100644
--- a/applications/external/doom/doom.c
+++ b/applications/external/doom/doom.c
@@ -6,7 +6,7 @@
#include
#include "sound.h"
#include "display.h"
-#include "compiled/assets_icons.h"
+#include "assets.h"
#include "constants.h"
#include "entities.h"
#include "types.h"
@@ -226,12 +226,12 @@ UID detectCollision(
bool only_walls,
PluginState* const plugin_state) {
// Wall collision
- uint8_t round_x = (int)pos->x + (int)relative_x;
- uint8_t round_y = (int)pos->y + (int)relative_y;
+ uint8_t round_x = (int)(pos->x + relative_x);
+ uint8_t round_y = (int)(pos->y + relative_y);
uint8_t block = getBlockAt(level, round_x, round_y);
if(block == E_WALL) {
- //playSound(hit_wall_snd, HIT_WALL_SND_LEN);
+ // playSound(hit_wall_snd, HIT_WALL_SND_LEN);
return create_uid(block, round_x, round_y);
}
@@ -769,7 +769,6 @@ static void render_callback(Canvas* const canvas, void* ctx) {
furi_assert(ctx);
PluginState* plugin_state = ctx;
furi_mutex_acquire(plugin_state->mutex, FuriWaitForever);
- if(plugin_state->init) setupDisplay(canvas);
canvas_set_font(canvas, FontPrimary);
@@ -855,7 +854,6 @@ static void doom_game_update_timer_callback(FuriMessageQueue* event_queue) {
static void doom_game_tick(PluginState* const plugin_state) {
if(plugin_state->scene == GAME_PLAY) {
//fps();
- memset(display_buf, 0, SCREEN_WIDTH * (RENDER_HEIGHT / 8));
//player is alive
if(plugin_state->player.health > 0) {
if(plugin_state->up) {
@@ -983,7 +981,7 @@ int32_t doom_app() {
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
//////////////////////////////////
- if(display_buf != NULL) plugin_state->init = false;
+ plugin_state->init = false;
PluginEvent event;
#ifdef SOUND
diff --git a/applications/external/doom/assets/screenshot1.png b/applications/external/doom/img/1.png
similarity index 100%
rename from applications/external/doom/assets/screenshot1.png
rename to applications/external/doom/img/1.png
diff --git a/applications/external/doom/assets/screenshot2.png b/applications/external/doom/img/2.png
similarity index 100%
rename from applications/external/doom/assets/screenshot2.png
rename to applications/external/doom/img/2.png
diff --git a/applications/external/doom/assets/screenshot3.png b/applications/external/doom/img/3.png
similarity index 100%
rename from applications/external/doom/assets/screenshot3.png
rename to applications/external/doom/img/3.png