Relaxed timing. Update readme.

This commit is contained in:
Derek Jamison 2023-03-24 09:12:37 -04:00
parent c6a176d94a
commit 13736cdccd
3 changed files with 13 additions and 38 deletions

View File

@ -22,16 +22,21 @@ Completed work:
- Allow viewing past games/scores.
- A join ACK removes it from the list of available games.
- Config - Allow changing hard-coded CONTACT_INFO message.
- Config - Allow saving CONTACT_INFO message.
- Relaxed timing, so Count 1/Count 2/RPS no longer have to be timed tightly.
- Play again screen.
Remaining work (for subghz version):
- Config - Allow saving CONTACT_INFO message.
- Play again from one Flipper Zero auto-starts/exit other Flipper Zero.
- Wrap user content to two lines on Past Games screen.
- Allow for replacement keyboard.
- Refactor the code, so it has less duplication.
- Write tutorial.
- Add game ending animations.
Future ideas:
- Add game ending animations.
- Create stand-alone hardware badges that can play the game too.
- Uses Princeton signals for second player.
- Instead of subghz, use IR.

View File

@ -51,11 +51,6 @@ static bool isFinalMove(GameState state) {
return (StateRock == state) || (StatePaper == state) || (StateScissors == state);
}
static bool isError(GameState state) {
return (StateError == state) || (StateErrorLocalFast == state) ||
(StateErrorRemoteFast == state) || (StateErrorRemoteTimeout == state);
}
// When user makes a move, we briefly pulse the vibro motor.
static void single_vibro() {
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
@ -649,23 +644,15 @@ static void rps_render_error(Canvas* canvas, void* ctx) {
GameData* data = game_context->data;
GameState local_player = data->local_player;
canvas_set_font(canvas, FontSecondary);
canvas_set_font(canvas, FontPrimary);
switch(local_player) {
case StateError:
canvas_draw_str_aligned(canvas, 5, 55, AlignLeft, AlignTop, "Unknown error");
break;
case StateErrorLocalFast:
canvas_draw_str_aligned(canvas, 5, 55, AlignLeft, AlignTop, "Too fast!");
break;
case StateErrorRemoteFast:
canvas_draw_str_aligned(canvas, 5, 55, AlignLeft, AlignTop, "Remote too fast!");
break;
case StateErrorRemoteTimeout:
canvas_draw_str_aligned(canvas, 5, 55, AlignLeft, AlignTop, "Remote timeout.");
canvas_draw_str_aligned(canvas, 15, 5, AlignLeft, AlignTop, "Remote timeout.");
canvas_set_font(canvas, FontSecondary);
canvas_draw_str_aligned(canvas, 5, 20, AlignLeft, AlignTop, "It appears the remote");
canvas_draw_str_aligned(canvas, 5, 30, AlignLeft, AlignTop, "user has left the game?");
break;
default:
@ -673,8 +660,6 @@ static void rps_render_error(Canvas* canvas, void* ctx) {
break;
}
canvas_draw_str_aligned(canvas, 120, 55, AlignLeft, AlignTop, "E");
furi_mutex_release(game_context->mutex);
}
@ -1111,16 +1096,6 @@ static void rps_state_machine_update(GameContext* game_context) {
return;
}
// TEMP - After Error, we reset back to Looking for player.
if(isError(d->local_player) && (duration(d->local_move_tick) > DURATION_SHOW_ERROR)) {
d->local_player = StateMainMenuHost;
d->remote_player = StateUnknown;
d->screen_state = ScreenMainMenu;
FURI_LOG_I(TAG, "Reset from Error.");
return;
}
// Check for winner.
if(isFinalMove(d->local_player) && isFinalMove(d->remote_player) &&
(duration(d->local_move_tick) > DURATION_SHOW_MOVES)) {

View File

@ -141,10 +141,7 @@ typedef enum {
StateWonPaper = 'w',
StateWonScissors = '+',
// ScreenError states:
StateError = 'E',
StateErrorRemoteTimeout = '7', // Joined but didn't make any moves.
StateErrorRemoteFast = '8', // Remote user sent moves after than local user.
StateErrorLocalFast = '9', // Local user sent moves after than remote user.
// ScrenMainMenu states:
StateUnknown = '?',
StateMainMenuHost,
@ -316,8 +313,6 @@ static bool isResult(GameState state);
// @returns true if game state is a rock, paper, scissors.
static bool isFinalMove(GameState state);
static bool isError(GameState state);
// When user makes a move, we briefly pulse the vibro motor.
static void single_vibro();