| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #include <furi.h>
- #include "scene.h"
- #include "assets/items.h"
- static void scene_proceed_action(SceneState* state) {
- furi_assert(state);
- state->prev_action = state->action;
- state->action = roll_new(state->prev_action, ACTIONS_NUM);
- state->action_timeout = default_timeout[state->action];
- }
- static void scene_action_handler(SceneState* state) {
- furi_assert(state);
- if(state->action == MINDCONTROL) {
- if(state->player_v.x != 0 || state->player_v.y != 0) {
- state->action_timeout = default_timeout[state->action];
- }
- }
- if(state->action_timeout > 0) {
- state->action_timeout--;
- }
- }
- void dolphin_scene_update_state(SceneState* state, uint32_t t, uint32_t dt) {
- furi_assert(state);
- scene_action_handler(state);
- switch(state->action) {
- case INTERACT:
- if(state->action_timeout == 0) {
- if(state->prev_action == MINDCONTROL) {
- state->action = MINDCONTROL;
- } else {
- scene_proceed_action(state);
- }
- }
- break;
- default:
- if(state->action_timeout == 0) {
- scene_proceed_action(state);
- }
- break;
- }
- }
|