Relaxed timing. Update readme.
This commit is contained in:
parent
c6a176d94a
commit
13736cdccd
@ -22,16 +22,21 @@ Completed work:
|
|||||||
- Allow viewing past games/scores.
|
- Allow viewing past games/scores.
|
||||||
- A join ACK removes it from the list of available games.
|
- A join ACK removes it from the list of available games.
|
||||||
- Config - Allow changing hard-coded CONTACT_INFO message.
|
- 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):
|
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.
|
- Refactor the code, so it has less duplication.
|
||||||
- Write tutorial.
|
- Write tutorial.
|
||||||
- Add game ending animations.
|
|
||||||
|
|
||||||
Future ideas:
|
Future ideas:
|
||||||
|
|
||||||
|
- Add game ending animations.
|
||||||
- Create stand-alone hardware badges that can play the game too.
|
- Create stand-alone hardware badges that can play the game too.
|
||||||
- Uses Princeton signals for second player.
|
- Uses Princeton signals for second player.
|
||||||
- Instead of subghz, use IR.
|
- Instead of subghz, use IR.
|
||||||
|
@ -51,11 +51,6 @@ static bool isFinalMove(GameState state) {
|
|||||||
return (StateRock == state) || (StatePaper == state) || (StateScissors == 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.
|
// When user makes a move, we briefly pulse the vibro motor.
|
||||||
static void single_vibro() {
|
static void single_vibro() {
|
||||||
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
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;
|
GameData* data = game_context->data;
|
||||||
GameState local_player = data->local_player;
|
GameState local_player = data->local_player;
|
||||||
|
|
||||||
canvas_set_font(canvas, FontSecondary);
|
canvas_set_font(canvas, FontPrimary);
|
||||||
|
|
||||||
switch(local_player) {
|
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:
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -673,8 +660,6 @@ static void rps_render_error(Canvas* canvas, void* ctx) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas_draw_str_aligned(canvas, 120, 55, AlignLeft, AlignTop, "E");
|
|
||||||
|
|
||||||
furi_mutex_release(game_context->mutex);
|
furi_mutex_release(game_context->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1111,16 +1096,6 @@ static void rps_state_machine_update(GameContext* game_context) {
|
|||||||
return;
|
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.
|
// Check for winner.
|
||||||
if(isFinalMove(d->local_player) && isFinalMove(d->remote_player) &&
|
if(isFinalMove(d->local_player) && isFinalMove(d->remote_player) &&
|
||||||
(duration(d->local_move_tick) > DURATION_SHOW_MOVES)) {
|
(duration(d->local_move_tick) > DURATION_SHOW_MOVES)) {
|
||||||
|
@ -141,10 +141,7 @@ typedef enum {
|
|||||||
StateWonPaper = 'w',
|
StateWonPaper = 'w',
|
||||||
StateWonScissors = '+',
|
StateWonScissors = '+',
|
||||||
// ScreenError states:
|
// ScreenError states:
|
||||||
StateError = 'E',
|
|
||||||
StateErrorRemoteTimeout = '7', // Joined but didn't make any moves.
|
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:
|
// ScrenMainMenu states:
|
||||||
StateUnknown = '?',
|
StateUnknown = '?',
|
||||||
StateMainMenuHost,
|
StateMainMenuHost,
|
||||||
@ -316,8 +313,6 @@ static bool isResult(GameState state);
|
|||||||
// @returns true if game state is a rock, paper, scissors.
|
// @returns true if game state is a rock, paper, scissors.
|
||||||
static bool isFinalMove(GameState state);
|
static bool isFinalMove(GameState state);
|
||||||
|
|
||||||
static bool isError(GameState state);
|
|
||||||
|
|
||||||
// When user makes a move, we briefly pulse the vibro motor.
|
// When user makes a move, we briefly pulse the vibro motor.
|
||||||
static void single_vibro();
|
static void single_vibro();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user