Skip to content

Commit

Permalink
Squashed 'applications/external/' changes from e43e4f6bf65..5864b3f1010
Browse files Browse the repository at this point in the history
5864b3f1010 WAV Player: Fix unresponsiveness
cfea009edfb BLE Spam: Fix delay help section
bec77fd399f Format
b643a4aad2b Merge totp from https://github.com/akopachov/flipper-zero_authenticator
094d65a4018 Merge solitaire from https://github.com/doofy-dev/flipper_solitaire
4a0f5a9ee36 Merge nfc_playlist from https://github.com/acegoal07/FlipperZero_NFC_Playlist
a83d4bca832 Merge laser_tag from https://github.com/RocketGod-git/Flipper-Zero-Laser-Tag
df3c9f9 Merge pull request #6 from jamisonderek/jamisonderek/rfid-ammo
bb8b73f Up button scans EM4100 health tag.
6e8234e Merge pull request #7 from lucaspwo/update-api-72_1
0a7ce69 Merge pull request #39 from xtruan/patch-1
c7b2006d5a2 chore: Updated version
f77e6fb59fe feat: confirm `topt export` on the device (#240) (#241)
8026dd6 fix: add zero back
22445c5 feat: allow delay up to 12s
25655af Updated to API 72.1
f0181ef Update laser_tag_10px.png
48f86b9 Update laser_tag_10px.png
d6d4119a92a Add laser_tag from https://github.com/RocketGod-git/Flipper-Zero-Laser-Tag
54d7fe3eeb6 Fix adding new app
43ff28abf2a Merge seader from https://github.com/bettse/seader
5f1159d9604 Merge picopass from https://gitlab.com/bettse/picopass
c5e3d62 Update for v1.1
0cece4d Update icon, remove test fap folder
2ed4e45 Update README.md
881263d Get rid of laod_path when dealing with non-seader save
9e32cc75d0d Revert "SubGHz Bruteforcer: Fix one/two byte text"
018f9f6 Move parse from card menu to card read success
56ac248 Debug log of save location for agnostic
7d70a7a Explicitly set credential type before saving
d5a4a95 replace ANY_PATH references
e93f3cab71c Merge seader from https://github.com/bettse/seader
c21ec24 Update
f9b4be2 update
f841cb0 updates
b2015f3 Add contributor
6e3882f Fixes
725f889 Preparing for app catalog submittal
59b65a9 Merge pull request #5 from jamisonderek/jamisonderek/always-rx
5fbc4f4 Free IR controller if alloced.
6a56928 Always RX except when shooting
026c92b Merge pull request #4 from jamisonderek/jamisonderek/team-color
85539e0 Blink with team color
14067edf8c0 No github, this is not a vulnerability
7d70b9b Replace backticks with single quote marks
94f1bee Remove deprecated function
0d40373 Update changelog
cbeb02e Bump version to 1.17
e03ad23 Merge branch 'CVE-2024-41566' into 'main'
fb3160c Merge branch 'main' of https://github.com/RocketGod-git/Flipper-Zero-Laser-Tag
0064f1e Remove unused files
2d3fe78 Update README.md
430da4a Add Game Over screen. Fix reload ammo logic.
7d2fe20 Add beep when firing laser
0689af8 CVE-2024-41566: When keys are unknown emulate with a dummy MAC and ignore reader MACs
2b3aac8 Update README.md
4b82100 Update README.md
f6a4170 OFW version
8f00fc1 Update game screen for extra sexiness
a31fe3f Bump to v3.1
f65e802 Correct key calculation for save as SR
cc34587 New splash screen and team select screen. Game screen up next.
e425136 Merge pull request #3 from jamisonderek/double-stop
5bff6b7 Merge pull request #2 from jamisonderek/jamisonderek/ir-nec
3b05028 Remove extra rx_stop call
90609a3 increase delay + add an address
5a6d100 uncompressed icons start with 0.
afde2ee Added splash screen will customize more later, added sound/vibro, added logging, still crashes after team selection and not sure why
e1d90b0 Fixed some stuff. Added tons of logging for cli log,  but ir still crashes.
3cca0c7 Make the Laser Tag game.
e1fa614 Initial commit

git-subtree-dir: applications/external
git-subtree-split: 5864b3f1010951a9246381caa5769b4c96053f7b
  • Loading branch information
RogueMaster committed Sep 3, 2024
1 parent 101df30 commit 10de518
Show file tree
Hide file tree
Showing 67 changed files with 2,850 additions and 429 deletions.
10 changes: 7 additions & 3 deletions .utils/add-subtree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ if [ "${prevremotedir}" != "" ]; then
mv -T "${prevremotedir}" "${path}"
fi

# Add new remote at the top
echo "${repo} ${branch} ${subdir}" | cat - "${gitsubtree}" 2> /dev/null > "${gitsubtree}.new"
mv "${gitsubtree}.new" "${gitsubtree}"
if [ -e "${gitsubtree}" ]; then
# Add new remote at the top
echo "${repo} ${branch} ${subdir}" | cat - "${gitsubtree}" > "${gitsubtree}.new"
mv "${gitsubtree}.new" "${gitsubtree}"
else
echo "${repo} ${branch} ${subdir}" > "${gitsubtree}"
fi
git add "${gitsubtree}"
git commit --amend --no-edit

Expand Down
2 changes: 1 addition & 1 deletion ble_spam/ble_spam.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ static void draw_callback(Canvas* canvas, void* _ctx) {
AlignTop,
"\e#Delay\e# is time between\n"
"attack attempts (top right),\n"
"keep 30ms for best results",
"keep 20ms for best results",
false);
break;
case PageHelpDistance:
Expand Down
2 changes: 2 additions & 0 deletions laser_tag/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
7 changes: 7 additions & 0 deletions laser_tag/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist/*
.vscode
.clang-format
.clangd
.editorconfig
.env
.ufbt
1 change: 1 addition & 0 deletions laser_tag/.gitsubtree
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/RocketGod-git/Flipper-Zero-Laser-Tag main /
674 changes: 674 additions & 0 deletions laser_tag/LICENSE

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions laser_tag/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Flipper-Zero-Laser-Tag

## 🚀 Flipper Zero Laser Tag - Team based

Flipper Zero Laser Tag brings your favorite laser tag experience to your Flipper Zero device! Whether you’re battling friends or just practicing your aim, this open-source project lets you dominate the laser tag arena with just your Flipper Zero.

### ⚡ Key Features:

- **Team Battles**: Choose your team and face off in epic Red vs. Blue laser battles.
- **Real-Time Gameplay**: Smooth and responsive laser firing and hit detection.
- **Immersive Sound**: Laser firing and game-over sounds to enhance your battlefield experience.
- **Dynamic Health and Ammo Bars**: Keep track of your health and ammo with clean, dynamic UI elements.
- **Vibration Feedback**: Feel every hit with integrated vibration feedback.

## 📸 Screenshots

![Screenshot-20240823-224628](https://github.com/user-attachments/assets/5836ee25-23ce-4845-b342-2b360e32e341)
![Screenshot-20240823-224637](https://github.com/user-attachments/assets/119e8e80-49fc-421a-bc61-ec7185d05bc0)
![Screenshot-20240823-224640](https://github.com/user-attachments/assets/7a9bdb69-42fe-48d7-9e5f-7616e2f68d10)
![Screenshot-20240823-224647](https://github.com/user-attachments/assets/d5e10e1b-64a5-4a72-a624-2cfe2237add5)

## 🕹️ How to Play

1. **Select Your Team**: Use the Left or Right button to choose between Red or Blue team.
2. **Fire Your Laser**: Press the OK button to shoot your laser at your opponents.
3. **Reload**: When your ammo runs out, press 'Down' to reload and get back into action.
4. **Survive**: Track your health, and make sure to avoid getting hit by your opponents' lasers. If your health reaches zero, it's game over!

## 🤔 ToDo:

- Allow RFID tags to be scanned with Flipper to add health or other powerups so they can be placed around the play field.
- Possibly tap teammates Flipper to increase their health.

![rocketgod_logo](https://github.com/RocketGod-git/shodanbot/assets/57732082/7929b554-0fba-4c2b-b22d-6772d23c4a18)
20 changes: 20 additions & 0 deletions laser_tag/application.fam
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
App(
appid="laser_tag",
name="Laser Tag",
apptype=FlipperAppType.EXTERNAL,
entry_point="laser_tag_app",
cdefines=["APP_LASER_TAG"],
fap_category="Games",
fap_author="@RocketGod-git & @jamisonderek",
fap_version="1.1",
fap_description="Laser Tag game for Flipper Zero",
fap_icon="icons/laser_tag_10px.png",
fap_libs=["assets"],
fap_weburl="https://github.com/RocketGod-Git/Flipper-Zero-Laser-Tag",
requires=[
"gui",
"infrared",
],
stack_size=2 * 1024,
order=10,
)
8 changes: 8 additions & 0 deletions laser_tag/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## v1.1

- Update app icon


## v1.0

- Initial release.
25 changes: 25 additions & 0 deletions laser_tag/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Flipper-Zero-Laser-Tag

## Laser Tag for Flipper Zero - Team Based!

Flipper Zero Laser Tag brings your favorite laser tag experience to your Flipper Zero device! Whether you’re battling friends or just practicing your aim, this open-source project lets you dominate the laser tag arena with just your Flipper Zero.

## Key Features:

- **Team Battles**: Choose your team and face off in epic Red vs. Blue laser battles.
- **Real-Time Gameplay**: Smooth and responsive laser firing and hit detection.
- **Immersive Sound**: Laser firing and game-over sounds to enhance your battlefield experience.
- **Dynamic Health and Ammo Bars**: Keep track of your health and ammo with clean, dynamic UI elements.
- **Vibration Feedback**: Feel every hit with integrated vibration feedback.

## How to Play

1. **Select Your Team**: Use the Left or Right button to choose between Red or Blue team.
2. **Fire Your Laser**: Press the OK button to shoot your laser at your opponents.
3. **Reload**: When your ammo runs out, press 'Down' to reload and get back into action.
4. **Survive**: Track your health, and make sure to avoid getting hit by your opponents' lasers. If your health reaches zero, it's game over!

## ToDo:

- Allow RFID tags to be scanned with Flipper to add health or other powerups so they can be placed around the play field.
- Possibly tap teammates Flipper to increase their health.
113 changes: 113 additions & 0 deletions laser_tag/game_state.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#include "game_state.h"
#include <furi.h>
#include <stdlib.h>

struct GameState {
LaserTagTeam team;
uint8_t health;
uint16_t ammo;
uint32_t game_time;
bool game_over;
};

GameState* game_state_alloc() {
GameState* state = malloc(sizeof(GameState));
if(!state) {
FURI_LOG_E("GameState", "Failed to allocate GameState");
return NULL;
}
state->team = TeamRed;
state->health = INITIAL_HEALTH;
state->ammo = INITIAL_AMMO;
state->game_time = 0;
state->game_over = false;
FURI_LOG_I("GameState", "GameState allocated successfully");
return state;
}

void game_state_reset(GameState* state) {
furi_assert(state);
state->health = INITIAL_HEALTH;
state->ammo = INITIAL_AMMO;
state->game_time = 0;
state->game_over = false;
FURI_LOG_I("GameState", "GameState reset");
}

void game_state_set_team(GameState* state, LaserTagTeam team) {
furi_assert(state);
state->team = team;
FURI_LOG_I("GameState", "Team set to %s", (team == TeamRed) ? "Red" : "Blue");
}

LaserTagTeam game_state_get_team(GameState* state) {
furi_assert(state);
return state->team;
}

void game_state_decrease_health(GameState* state, uint8_t amount) {
furi_assert(state);
if(state->health > amount) {
state->health -= amount;
} else {
state->health = 0;
state->game_over = true;
FURI_LOG_W("GameState", "Health depleted, game over");
}
FURI_LOG_I("GameState", "Health decreased to %d", state->health);
}

void game_state_increase_health(GameState* state, uint8_t amount) {
furi_assert(state);
state->health = (state->health + amount > MAX_HEALTH) ? MAX_HEALTH : state->health + amount;
FURI_LOG_I("GameState", "Health increased to %d", state->health);
}

uint8_t game_state_get_health(GameState* state) {
furi_assert(state);
return state->health;
}

void game_state_decrease_ammo(GameState* state, uint16_t amount) {
furi_assert(state);
if(state->ammo > amount) {
state->ammo -= amount;
} else {
state->ammo = 0;
FURI_LOG_W("GameState", "Ammo depleted");
}
FURI_LOG_I("GameState", "Ammo decreased to %d", state->ammo);
}

void game_state_increase_ammo(GameState* state, uint16_t amount) {
furi_assert(state);
state->ammo += amount;
FURI_LOG_I("GameState", "Ammo increased to %d", state->ammo);
}

uint16_t game_state_get_ammo(GameState* state) {
furi_assert(state);
return state->ammo;
}

void game_state_update_time(GameState* state, uint32_t delta_time) {
furi_assert(state);
state->game_time += delta_time;
FURI_LOG_I("GameState", "Game time updated to %ld seconds", state->game_time);
}

uint32_t game_state_get_time(GameState* state) {
furi_assert(state);
return state->game_time;
}

bool game_state_is_game_over(GameState* state) {
furi_assert(state);
return state->game_over;
}

void game_state_set_game_over(GameState* state, bool game_over) {
furi_assert(state);
state->game_over = game_over;
FURI_LOG_I("GameState", "Game over status set to %s", game_over ? "true" : "false");
}
42 changes: 42 additions & 0 deletions laser_tag/game_state.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#pragma once

#include <stdint.h>
#include <stdbool.h>

typedef enum {
TeamRed,
TeamBlue
} LaserTagTeam;

typedef enum {
LaserTagStateSplashScreen,
LaserTagStateTeamSelect,
LaserTagStateGame,
LaserTagStateGameOver,
} LaserTagState;

typedef struct GameState GameState;

GameState* game_state_alloc();
void game_state_reset(GameState* state);

void game_state_set_team(GameState* state, LaserTagTeam team);
LaserTagTeam game_state_get_team(GameState* state);

void game_state_decrease_health(GameState* state, uint8_t amount);
void game_state_increase_health(GameState* state, uint8_t amount);
uint8_t game_state_get_health(GameState* state);

void game_state_decrease_ammo(GameState* state, uint16_t amount);
void game_state_increase_ammo(GameState* state, uint16_t amount);
uint16_t game_state_get_ammo(GameState* state);

void game_state_update_time(GameState* state, uint32_t delta_time);
uint32_t game_state_get_time(GameState* state);

bool game_state_is_game_over(GameState* state);
void game_state_set_game_over(GameState* state, bool game_over);

#define INITIAL_HEALTH 100
#define INITIAL_AMMO 100
#define MAX_HEALTH 100
Binary file added laser_tag/icons/laser_tag_10px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 10de518

Please sign in to comment.