[FL-1675] Dolphin scene and included apps removed #638
Co-authored-by: あく <alleteam@gmail.com>
| @ -28,9 +28,6 @@ extern int32_t keypad_test_app(void* p); | |||||||
| extern int32_t lfrfid_app(void* p); | extern int32_t lfrfid_app(void* p); | ||||||
| extern int32_t lfrfid_debug_app(void* p); | extern int32_t lfrfid_debug_app(void* p); | ||||||
| extern int32_t nfc_app(void* p); | extern int32_t nfc_app(void* p); | ||||||
| extern int32_t passport_app(void* p); |  | ||||||
| extern int32_t food_minigame_app(void* p); |  | ||||||
| extern int32_t scene_app(void* p); |  | ||||||
| extern int32_t scened_app(void* p); | extern int32_t scened_app(void* p); | ||||||
| extern int32_t storage_test_app(void* p); | extern int32_t storage_test_app(void* p); | ||||||
| extern int32_t subghz_app(void* p); | extern int32_t subghz_app(void* p); | ||||||
| @ -248,19 +245,6 @@ const FlipperApplication FLIPPER_ARCHIVE = | |||||||
|     {.app = archive_app, .name = "Archive", .stack_size = 4096, .icon = &A_FileManager_14}; |     {.app = archive_app, .name = "Archive", .stack_size = 4096, .icon = &A_FileManager_14}; | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifdef SRV_DOLPHIN |  | ||||||
| const FlipperApplication FLIPPER_SCENE = |  | ||||||
|     {.app = scene_app, .name = "Scenes", .stack_size = 1024, .icon = &A_Games_14}; |  | ||||||
| 
 |  | ||||||
| const FlipperApplication FLIPPER_SCENE_APPS[] = { |  | ||||||
|     {.app = passport_app, .name = "Passport", .stack_size = 1024, .icon = &A_Games_14}, |  | ||||||
|     {.app = food_minigame_app, .name = "Food minigame", .stack_size = 1024, .icon = &A_Games_14}, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const size_t FLIPPER_SCENE_APPS_COUNT = sizeof(FLIPPER_SCENE_APPS) / sizeof(FlipperApplication); |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| // Settings menu
 | // Settings menu
 | ||||||
| const FlipperApplication FLIPPER_SETTINGS_APPS[] = { | const FlipperApplication FLIPPER_SETTINGS_APPS[] = { | ||||||
| #ifdef SRV_NOTIFICATION | #ifdef SRV_NOTIFICATION | ||||||
|  | |||||||
| @ -119,12 +119,6 @@ bool dolphin_view_idle_main_input(InputEvent* event, void* context) { | |||||||
|         } else if(event->key == InputKeyUp && event->type == InputTypeShort) { |         } else if(event->key == InputKeyUp && event->type == InputTypeShort) { | ||||||
|             osTimerStart(dolphin->timeout_timer, 40); |             osTimerStart(dolphin->timeout_timer, 40); | ||||||
|             view_dispatcher_switch_to_view(dolphin->idle_view_dispatcher, DolphinViewLockMenu); |             view_dispatcher_switch_to_view(dolphin->idle_view_dispatcher, DolphinViewLockMenu); | ||||||
|         } else if(event->key == InputKeyLeft && event->type == InputTypeShort) { |  | ||||||
| #if 0 |  | ||||||
|             dolphin_switch_to_app(dolphin, &FAV_APP); |  | ||||||
| #endif |  | ||||||
|         } else if(event->key == InputKeyRight && event->type == InputTypeShort) { |  | ||||||
|             dolphin_switch_to_app(dolphin, &FLIPPER_SCENE); |  | ||||||
|         } else if(event->key == InputKeyDown && event->type == InputTypeShort) { |         } else if(event->key == InputKeyDown && event->type == InputTypeShort) { | ||||||
|             dolphin_switch_to_app(dolphin, &FLIPPER_ARCHIVE); |             dolphin_switch_to_app(dolphin, &FLIPPER_ARCHIVE); | ||||||
|         } else if(event->key == InputKeyDown && event->type == InputTypeLong) { |         } else if(event->key == InputKeyDown && event->type == InputTypeLong) { | ||||||
|  | |||||||
| @ -1,321 +0,0 @@ | |||||||
| #include <furi.h> |  | ||||||
| #include <gui/gui.h> |  | ||||||
| #include "dolphin/dolphin_state.h" |  | ||||||
| 
 |  | ||||||
| #define MAX_TRIES 3 |  | ||||||
| #define DISHES_TOTAL 3 |  | ||||||
| #define LID_POS_MAX 20 |  | ||||||
| #define TRY_TIMEOUT 10 |  | ||||||
| 
 |  | ||||||
| typedef enum { |  | ||||||
|     EventTypeTick, |  | ||||||
|     EventTypeKey, |  | ||||||
|     EventTypeDeed, |  | ||||||
| } EventType; |  | ||||||
| 
 |  | ||||||
| typedef struct { |  | ||||||
|     union { |  | ||||||
|         InputEvent input; |  | ||||||
|     } value; |  | ||||||
|     EventType type; |  | ||||||
| } AppEvent; |  | ||||||
| 
 |  | ||||||
| typedef enum { |  | ||||||
|     PlayerChoiceEvent, |  | ||||||
|     OpenLootEvent, |  | ||||||
|     WinEvent, |  | ||||||
|     LooseEvent, |  | ||||||
|     FinishedEvent, |  | ||||||
|     ExitGameEvent, |  | ||||||
|     GameEventTotal, |  | ||||||
| } GameEventType; |  | ||||||
| 
 |  | ||||||
| typedef enum { |  | ||||||
|     LootSkeleton, |  | ||||||
|     LootFish, |  | ||||||
|     LootShit, |  | ||||||
|     LootTotalNum, |  | ||||||
| } LootIdEnum; |  | ||||||
| 
 |  | ||||||
| typedef struct { |  | ||||||
|     GameEventType current_event; |  | ||||||
|     osMessageQueueId_t event_queue; |  | ||||||
|     LootIdEnum loot_list[DISHES_TOTAL]; |  | ||||||
| 
 |  | ||||||
|     uint8_t cursor_pos; |  | ||||||
|     uint8_t lid_pos; |  | ||||||
|     uint8_t timeout; |  | ||||||
|     uint8_t try; |  | ||||||
| 
 |  | ||||||
|     bool selected; |  | ||||||
|     bool deed; |  | ||||||
| 
 |  | ||||||
| } GameState; |  | ||||||
| 
 |  | ||||||
| typedef struct { |  | ||||||
|     const Icon* f; |  | ||||||
|     const Icon* b; |  | ||||||
| } LootGfx; |  | ||||||
| 
 |  | ||||||
| static const Icon* letters[DISHES_TOTAL] = {&I_letterA_10x10, &I_letterB_10x10, &I_letterC_10x10}; |  | ||||||
| 
 |  | ||||||
| static const LootGfx loot[LootTotalNum] = { |  | ||||||
|     [LootSkeleton] = |  | ||||||
|         { |  | ||||||
|             .f = &I_skeleton_25x17, |  | ||||||
|             .b = &I_blackskeleton_25x17, |  | ||||||
|         }, |  | ||||||
|     [LootFish] = |  | ||||||
|         { |  | ||||||
|             .f = &I_fish_25x17, |  | ||||||
|             .b = &I_blackfish_25x17, |  | ||||||
|         }, |  | ||||||
|     [LootShit] = |  | ||||||
|         { |  | ||||||
|             .f = &I_shit_25x17, |  | ||||||
|             .b = &I_blackshit_25x17, |  | ||||||
|         }, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| static void input_callback(InputEvent* input_event, void* ctx) { |  | ||||||
|     osMessageQueueId_t event_queue = ctx; |  | ||||||
|     AppEvent event; |  | ||||||
|     event.type = EventTypeKey; |  | ||||||
|     event.value.input = *input_event; |  | ||||||
|     osMessageQueuePut(event_queue, &event, 0, osWaitForever); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void draw_dish(Canvas* canvas, GameState* state, uint8_t x, uint8_t y, uint8_t id) { |  | ||||||
|     bool active = state->cursor_pos == id; |  | ||||||
|     bool opened = state->current_event == OpenLootEvent && active; |  | ||||||
| 
 |  | ||||||
|     canvas_set_bitmap_mode(canvas, true); |  | ||||||
|     canvas_set_color(canvas, ColorBlack); |  | ||||||
| 
 |  | ||||||
|     if(active) { |  | ||||||
|         canvas_draw_icon(canvas, x, y, &I_active_plate_48x18); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     if(opened) { |  | ||||||
|         state->lid_pos = CLAMP(state->lid_pos + 1, LID_POS_MAX, 0); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     uint8_t lid_pos = (y - 17) - (opened ? state->lid_pos : 0); |  | ||||||
| 
 |  | ||||||
|     canvas_draw_icon(canvas, x + 3, y - 6, &I_plate_42x19); |  | ||||||
| 
 |  | ||||||
|     canvas_set_color(canvas, ColorWhite); |  | ||||||
|     canvas_draw_icon(canvas, x + 11, y - 10, loot[state->loot_list[id]].b); |  | ||||||
|     canvas_set_color(canvas, ColorBlack); |  | ||||||
|     canvas_draw_icon(canvas, x + 11, y - 10, loot[state->loot_list[id]].f); |  | ||||||
| 
 |  | ||||||
|     canvas_set_color(canvas, ColorWhite); |  | ||||||
|     canvas_draw_icon(canvas, x + 6, lid_pos, &I_blacklid_36x27); |  | ||||||
|     canvas_set_color(canvas, ColorBlack); |  | ||||||
|     canvas_draw_icon(canvas, x + 6, lid_pos, &I_lid_36x27); |  | ||||||
|     canvas_set_bitmap_mode(canvas, false); |  | ||||||
| 
 |  | ||||||
|     canvas_draw_icon(canvas, x + 19, y + 8, letters[id]); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void draw_dishes_scene(Canvas* canvas, GameState* state) { |  | ||||||
|     uint8_t tries_left = MAX_TRIES - state->try; |  | ||||||
|     for(size_t i = 0; i < MAX_TRIES; i++) { |  | ||||||
|         if(i < tries_left) { |  | ||||||
|             canvas_draw_disc(canvas, 5 + i * 8, 5, 2); |  | ||||||
|         } else { |  | ||||||
|             canvas_draw_circle(canvas, 5 + i * 8, 5, 2); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     for(size_t i = 0; i < DISHES_TOTAL; i++) { |  | ||||||
|         draw_dish(canvas, state, i * 40, i % 2 ? 26 : 44, i); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void render_callback(Canvas* canvas, void* ctx) { |  | ||||||
|     GameState* state = (GameState*)acquire_mutex((ValueMutex*)ctx, 25); |  | ||||||
|     canvas_clear(canvas); |  | ||||||
| 
 |  | ||||||
|     switch(state->current_event) { |  | ||||||
|     case WinEvent: |  | ||||||
|         canvas_draw_str(canvas, 30, 30, "Dolphin_happy.png"); |  | ||||||
|         break; |  | ||||||
|     case LooseEvent: |  | ||||||
|         canvas_draw_str_aligned(canvas, 64, 30, AlignCenter, AlignCenter, "Try again!"); |  | ||||||
|         break; |  | ||||||
|     case ExitGameEvent: |  | ||||||
|         break; |  | ||||||
|     case FinishedEvent: |  | ||||||
|         break; |  | ||||||
|     default: |  | ||||||
|         draw_dishes_scene(canvas, state); |  | ||||||
|         break; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     release_mutex((ValueMutex*)ctx, state); |  | ||||||
| } |  | ||||||
| static void reset_lid_pos(GameState* state) { |  | ||||||
|     state->selected = false; |  | ||||||
|     state->lid_pos = 0; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void dolphin_food_deed(GameState* state) { |  | ||||||
|     furi_assert(state); |  | ||||||
|     AppEvent event; |  | ||||||
|     event.type = EventTypeDeed; |  | ||||||
|     furi_check(osMessageQueuePut(state->event_queue, &event, 0, osWaitForever) == osOK); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void reset_loot_array(GameState* state) { |  | ||||||
|     for(size_t i = 0; i < LootTotalNum; i++) { |  | ||||||
|         state->loot_list[i] = i; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     for(size_t i = 0; i < LootTotalNum; i++) { |  | ||||||
|         int temp = state->loot_list[i]; |  | ||||||
|         int r_idx = rand() % LootTotalNum; |  | ||||||
| 
 |  | ||||||
|         state->loot_list[i] = state->loot_list[r_idx]; |  | ||||||
|         state->loot_list[r_idx] = temp; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static bool selected_is_food(GameState* state) { |  | ||||||
|     return state->loot_list[state->cursor_pos] == LootFish; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static bool tries_exceed(GameState* state) { |  | ||||||
|     return state->try == MAX_TRIES; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static bool timeout_exceed(GameState* state) { |  | ||||||
|     return state->timeout == TRY_TIMEOUT; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void gamestate_update(GameState* state, DolphinState* dolphin_state) { |  | ||||||
|     switch(state->current_event) { |  | ||||||
|     case PlayerChoiceEvent: |  | ||||||
|         if(state->selected) { |  | ||||||
|             state->current_event = OpenLootEvent; |  | ||||||
|         } |  | ||||||
|         break; |  | ||||||
|     case OpenLootEvent: |  | ||||||
|         state->timeout = CLAMP(state->timeout + 1, TRY_TIMEOUT, 0); |  | ||||||
|         if(timeout_exceed(state)) { |  | ||||||
|             state->timeout = 0; |  | ||||||
|             state->current_event = selected_is_food(state) ? WinEvent : LooseEvent; |  | ||||||
|             state->deed = selected_is_food(state); |  | ||||||
|         } |  | ||||||
|         break; |  | ||||||
|     case LooseEvent: |  | ||||||
|         state->timeout = CLAMP(state->timeout + 1, TRY_TIMEOUT, 0); |  | ||||||
|         if(timeout_exceed(state)) { |  | ||||||
|             state->timeout = 0; |  | ||||||
|             state->current_event = FinishedEvent; |  | ||||||
|         } |  | ||||||
|         break; |  | ||||||
|     case WinEvent: |  | ||||||
|         if(state->deed) { |  | ||||||
|             dolphin_food_deed(state); |  | ||||||
|         } |  | ||||||
|         break; |  | ||||||
|     case FinishedEvent: |  | ||||||
|         reset_lid_pos(state); |  | ||||||
|         reset_loot_array(state); |  | ||||||
| 
 |  | ||||||
|         state->try++; |  | ||||||
|         state->current_event = tries_exceed(state) ? ExitGameEvent : PlayerChoiceEvent; |  | ||||||
|         break; |  | ||||||
| 
 |  | ||||||
|     default: |  | ||||||
|         break; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void food_minigame_controls(GameState* state, AppEvent* event) { |  | ||||||
|     furi_assert(state); |  | ||||||
|     furi_assert(event); |  | ||||||
| 
 |  | ||||||
|     if(event->value.input.key == InputKeyRight) { |  | ||||||
|         if(state->current_event == PlayerChoiceEvent) { |  | ||||||
|             state->cursor_pos = CLAMP(state->cursor_pos + 1, DISHES_TOTAL - 1, 0); |  | ||||||
|         } |  | ||||||
|     } else if(event->value.input.key == InputKeyLeft) { |  | ||||||
|         if(state->current_event == PlayerChoiceEvent) { |  | ||||||
|             state->cursor_pos = CLAMP(state->cursor_pos - 1, DISHES_TOTAL - 1, 0); |  | ||||||
|         } |  | ||||||
|     } else if(event->value.input.key == InputKeyOk) { |  | ||||||
|         switch(state->current_event) { |  | ||||||
|         case PlayerChoiceEvent: |  | ||||||
|             state->selected = true; |  | ||||||
|             break; |  | ||||||
|         case WinEvent: |  | ||||||
|             state->current_event = FinishedEvent; |  | ||||||
|             break; |  | ||||||
|         default: |  | ||||||
|             break; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int32_t food_minigame_app(void* p) { |  | ||||||
|     GameState* state = furi_alloc(sizeof(GameState)); |  | ||||||
|     DolphinState* dolphin_state = dolphin_state_alloc(); |  | ||||||
|     dolphin_state_load(dolphin_state); |  | ||||||
| 
 |  | ||||||
|     ValueMutex state_mutex; |  | ||||||
| 
 |  | ||||||
|     state->event_queue = osMessageQueueNew(2, sizeof(AppEvent), NULL); |  | ||||||
| 
 |  | ||||||
|     furi_check(state->event_queue); |  | ||||||
| 
 |  | ||||||
|     if(!init_mutex(&state_mutex, state, sizeof(GameState*))) { |  | ||||||
|         printf("[Food minigame] cannot create mutex\r\n"); |  | ||||||
|         return 0; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     ViewPort* view_port = view_port_alloc(); |  | ||||||
| 
 |  | ||||||
|     view_port_draw_callback_set(view_port, render_callback, &state_mutex); |  | ||||||
|     view_port_input_callback_set(view_port, input_callback, state->event_queue); |  | ||||||
| 
 |  | ||||||
|     Gui* gui = furi_record_open("gui"); |  | ||||||
|     gui_add_view_port(gui, view_port, GuiLayerFullscreen); |  | ||||||
| 
 |  | ||||||
|     reset_loot_array(state); |  | ||||||
| 
 |  | ||||||
|     AppEvent event; |  | ||||||
|     while(1) { |  | ||||||
|         osStatus_t event_status = osMessageQueueGet(state->event_queue, &event, NULL, 100); |  | ||||||
|         if(event_status == osOK) { |  | ||||||
|             if(event.type == EventTypeKey && event.value.input.type == InputTypeShort) { |  | ||||||
|                 food_minigame_controls(state, &event); |  | ||||||
| 
 |  | ||||||
|                 if(event.value.input.key == InputKeyBack) { |  | ||||||
|                     break; |  | ||||||
|                 } |  | ||||||
|             } else if(event.type == EventTypeDeed) { |  | ||||||
|                 dolphin_state_on_deed(dolphin_state, DolphinDeedIButtonRead); |  | ||||||
|                 dolphin_state_save(dolphin_state); |  | ||||||
|                 state->deed = false; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if(state->current_event == ExitGameEvent) { |  | ||||||
|             break; |  | ||||||
|         } |  | ||||||
|         gamestate_update(state, dolphin_state); |  | ||||||
|         view_port_update(view_port); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     gui_remove_view_port(gui, view_port); |  | ||||||
|     view_port_free(view_port); |  | ||||||
|     furi_record_close("gui"); |  | ||||||
|     delete_mutex(&state_mutex); |  | ||||||
|     osMessageQueueDelete(state->event_queue); |  | ||||||
|     dolphin_state_free(dolphin_state); |  | ||||||
|     free(state); |  | ||||||
| 
 |  | ||||||
|     return 0; |  | ||||||
| } |  | ||||||
| @ -1,147 +0,0 @@ | |||||||
| #include <furi.h> |  | ||||||
| #include <gui/gui.h> |  | ||||||
| #include <furi-hal-version.h> |  | ||||||
| #include "dolphin/dolphin.h" |  | ||||||
| #include "dolphin/dolphin_state.h" |  | ||||||
| #include "math.h" |  | ||||||
| 
 |  | ||||||
| #define MOODS_TOTAL 3 |  | ||||||
| #define BUTTHURT_MAX 3 |  | ||||||
| 
 |  | ||||||
| typedef enum { |  | ||||||
|     EventTypeTick, |  | ||||||
|     EventTypeKey, |  | ||||||
| } EventType; |  | ||||||
| 
 |  | ||||||
| typedef struct { |  | ||||||
|     union { |  | ||||||
|         InputEvent input; |  | ||||||
|     } value; |  | ||||||
|     EventType type; |  | ||||||
| } AppEvent; |  | ||||||
| 
 |  | ||||||
| // Moods, corresponding to butthurt level. (temp, unclear about max level)
 |  | ||||||
| static const char* mood_strings[MOODS_TOTAL] = {[0] = "Happy", [1] = "Ok", [2] = "Bad"}; |  | ||||||
| 
 |  | ||||||
| static const Icon* portrait_happy[BUTTHURT_MAX] = { |  | ||||||
|     &I_passport_happy1_43x45, |  | ||||||
|     &I_passport_happy2_43x45, |  | ||||||
|     &I_passport_happy3_43x45}; |  | ||||||
| static const Icon* portrait_ok[BUTTHURT_MAX] = { |  | ||||||
|     &I_passport_okay1_43x45, |  | ||||||
|     &I_passport_okay2_43x45, |  | ||||||
|     &I_passport_okay3_43x45}; |  | ||||||
| static const Icon* portrait_bad[BUTTHURT_MAX] = { |  | ||||||
|     &I_passport_bad1_43x45, |  | ||||||
|     &I_passport_bad2_43x45, |  | ||||||
|     &I_passport_bad3_43x45}; |  | ||||||
| static const Icon** portraits[MOODS_TOTAL] = {portrait_happy, portrait_ok, portrait_bad}; |  | ||||||
| 
 |  | ||||||
| static void input_callback(InputEvent* input_event, void* ctx) { |  | ||||||
|     osMessageQueueId_t event_queue = ctx; |  | ||||||
|     AppEvent event; |  | ||||||
|     event.type = EventTypeKey; |  | ||||||
|     event.value.input = *input_event; |  | ||||||
|     osMessageQueuePut(event_queue, &event, 0, osWaitForever); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void render_callback(Canvas* canvas, void* ctx) { |  | ||||||
|     DolphinState* state = (DolphinState*)acquire_mutex((ValueMutex*)ctx, 25); |  | ||||||
| 
 |  | ||||||
|     char level[20]; |  | ||||||
|     char mood[32]; |  | ||||||
| 
 |  | ||||||
|     uint32_t butthurt = CLAMP(dolphin_state_get_butthurt(state), BUTTHURT_MAX - 1, 0); |  | ||||||
|     uint32_t current_level = dolphin_state_get_level(state); |  | ||||||
|     uint32_t prev_cap = dolphin_state_xp_to_levelup(state, current_level - 1, false); |  | ||||||
|     uint32_t exp = (dolphin_state_xp_to_levelup(state, current_level, true) * 63) / |  | ||||||
|                    (dolphin_state_xp_to_levelup(state, current_level, false) - prev_cap); |  | ||||||
|     uint8_t portrait_level = CLAMP(floor(current_level / 14), MOODS_TOTAL - 1, 0); |  | ||||||
| 
 |  | ||||||
|     canvas_clear(canvas); |  | ||||||
| 
 |  | ||||||
|     // multipass
 |  | ||||||
|     canvas_draw_icon(canvas, 0, 0, &I_PassportLeft_6x47); |  | ||||||
|     canvas_draw_icon(canvas, 0, 47, &I_PassportBottom_128x17); |  | ||||||
|     canvas_draw_line(canvas, 6, 0, 125, 0); |  | ||||||
|     canvas_draw_line(canvas, 127, 2, 127, 47); |  | ||||||
|     canvas_draw_dot(canvas, 126, 1); |  | ||||||
| 
 |  | ||||||
|     //portrait frame
 |  | ||||||
|     canvas_draw_line(canvas, 9, 6, 9, 53); |  | ||||||
|     canvas_draw_line(canvas, 10, 5, 52, 5); |  | ||||||
|     canvas_draw_line(canvas, 55, 8, 55, 53); |  | ||||||
|     canvas_draw_line(canvas, 10, 54, 54, 54); |  | ||||||
|     canvas_draw_line(canvas, 53, 5, 55, 7); |  | ||||||
| 
 |  | ||||||
|     // portrait
 |  | ||||||
|     canvas_draw_icon(canvas, 10, 9, portraits[butthurt][portrait_level]); |  | ||||||
|     canvas_draw_line(canvas, 59, 18, 124, 18); |  | ||||||
|     canvas_draw_line(canvas, 59, 31, 124, 31); |  | ||||||
|     canvas_draw_line(canvas, 59, 44, 124, 44); |  | ||||||
| 
 |  | ||||||
|     const char* my_name = furi_hal_version_get_name_ptr(); |  | ||||||
|     canvas_draw_str(canvas, 59, 15, my_name ? my_name : "Unknown"); |  | ||||||
| 
 |  | ||||||
|     snprintf(level, 20, "Level: %ld", current_level); |  | ||||||
|     snprintf(mood, 20, "Mood: %s", mood_strings[butthurt]); |  | ||||||
| 
 |  | ||||||
|     canvas_draw_str(canvas, 59, 28, mood); |  | ||||||
| 
 |  | ||||||
|     canvas_draw_str(canvas, 59, 41, level); |  | ||||||
|     canvas_set_color(canvas, ColorWhite); |  | ||||||
|     canvas_draw_box(canvas, 123 - exp, 48, exp + 1, 6); |  | ||||||
|     canvas_set_color(canvas, ColorBlack); |  | ||||||
|     canvas_draw_line(canvas, 123 - exp, 48, 123 - exp, 54); |  | ||||||
| 
 |  | ||||||
|     release_mutex((ValueMutex*)ctx, state); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int32_t passport_app(void* p) { |  | ||||||
|     DolphinState* dolphin_state = dolphin_state_alloc(); |  | ||||||
|     ValueMutex state_mutex; |  | ||||||
|     dolphin_state_load(dolphin_state); |  | ||||||
| 
 |  | ||||||
|     osMessageQueueId_t event_queue = osMessageQueueNew(2, sizeof(AppEvent), NULL); |  | ||||||
|     furi_check(event_queue); |  | ||||||
| 
 |  | ||||||
|     if(!init_mutex(&state_mutex, dolphin_state, sizeof(DolphinState*))) { |  | ||||||
|         printf("[Passport] cannot create mutex\r\n"); |  | ||||||
|         return 0; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     ViewPort* view_port = view_port_alloc(); |  | ||||||
| 
 |  | ||||||
|     view_port_draw_callback_set(view_port, render_callback, &state_mutex); |  | ||||||
|     view_port_input_callback_set(view_port, input_callback, event_queue); |  | ||||||
| 
 |  | ||||||
|     Gui* gui = furi_record_open("gui"); |  | ||||||
|     gui_add_view_port(gui, view_port, GuiLayerFullscreen); |  | ||||||
| 
 |  | ||||||
|     AppEvent event; |  | ||||||
|     while(1) { |  | ||||||
|         osStatus_t event_status = osMessageQueueGet(event_queue, &event, NULL, 25); |  | ||||||
|         if(event_status == osOK) { |  | ||||||
|             if(event.type == EventTypeKey && event.value.input.type == InputTypeShort && |  | ||||||
|                event.value.input.key == InputKeyBack) { |  | ||||||
|                 break; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         view_port_update(view_port); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     gui_remove_view_port(gui, view_port); |  | ||||||
| 
 |  | ||||||
|     view_port_free(view_port); |  | ||||||
| 
 |  | ||||||
|     furi_record_close("gui"); |  | ||||||
| 
 |  | ||||||
|     delete_mutex(&state_mutex); |  | ||||||
| 
 |  | ||||||
|     osMessageQueueDelete(event_queue); |  | ||||||
| 
 |  | ||||||
|     dolphin_state_free(dolphin_state); |  | ||||||
| 
 |  | ||||||
|     return 0; |  | ||||||
| } |  | ||||||
| @ -1,12 +0,0 @@ | |||||||
| #pragma once |  | ||||||
| 
 |  | ||||||
| // temp
 |  | ||||||
| const char* console_emotes[] = { |  | ||||||
|     "Run it, m8", |  | ||||||
|     "Lets GOOOO", |  | ||||||
|     "Click it, buddy", |  | ||||||
|     "I wanna play", |  | ||||||
|     "Wtf is this?", |  | ||||||
|     "Just do it", |  | ||||||
|     "JUST DO IT!", |  | ||||||
| }; |  | ||||||
| @ -1,233 +0,0 @@ | |||||||
| #include <gui/elements.h> |  | ||||||
| #include "applications.h" |  | ||||||
| #include "items_i.h" |  | ||||||
| #include "emotes.h" |  | ||||||
| #include <gui/icon_i.h> |  | ||||||
| 
 |  | ||||||
| const Item Food = { |  | ||||||
|     .layer = 4, |  | ||||||
|     .timeout = 100, |  | ||||||
|     .pos = |  | ||||||
|         { |  | ||||||
|             .x = 0, |  | ||||||
|             .y = 90, |  | ||||||
|         }, |  | ||||||
|     .width = 60, |  | ||||||
|     .height = 50, |  | ||||||
|     .draw = food_redraw, |  | ||||||
|     .callback = food_callback}; |  | ||||||
| 
 |  | ||||||
| const Item Console = { |  | ||||||
|     .layer = 4, |  | ||||||
|     .timeout = 100, |  | ||||||
|     .pos = |  | ||||||
|         { |  | ||||||
|             .x = 357, |  | ||||||
|             .y = 190, |  | ||||||
|         }, |  | ||||||
|     .width = 40, |  | ||||||
|     .height = 20, |  | ||||||
|     .draw = console_redraw, |  | ||||||
|     .callback = console_callback}; |  | ||||||
| 
 |  | ||||||
| const Item* Home[] = {&Food, &Console}; |  | ||||||
| 
 |  | ||||||
| const Item** Scenes[] = {Home}; |  | ||||||
| 
 |  | ||||||
| const Item** get_scene(SceneState* state) { |  | ||||||
|     return Scenes[state->scene_id]; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void dolphin_scene_start_app(SceneState* state, const FlipperApplication* flipper_app) { |  | ||||||
|     furi_assert(state); |  | ||||||
|     furi_assert(flipper_app); |  | ||||||
| 
 |  | ||||||
|     state->scene_app_thread = furi_thread_alloc(); |  | ||||||
| 
 |  | ||||||
|     furi_assert(flipper_app->app); |  | ||||||
|     furi_assert(flipper_app->name); |  | ||||||
| 
 |  | ||||||
|     furi_thread_set_name(state->scene_app_thread, flipper_app->name); |  | ||||||
|     furi_thread_set_stack_size(state->scene_app_thread, flipper_app->stack_size); |  | ||||||
|     furi_thread_set_callback(state->scene_app_thread, flipper_app->app); |  | ||||||
|     furi_thread_start(state->scene_app_thread); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| uint16_t roll_new(uint16_t prev, uint16_t max) { |  | ||||||
|     uint16_t val = 999; |  | ||||||
|     while(val != prev) { |  | ||||||
|         val = random() % max; |  | ||||||
|         break; |  | ||||||
|     } |  | ||||||
|     return val; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void dolphin_scene_type_text( |  | ||||||
|     Canvas* canvas, |  | ||||||
|     SceneState* state, |  | ||||||
|     uint8_t x, |  | ||||||
|     uint8_t y, |  | ||||||
|     const char* text) { |  | ||||||
|     char dialog_str[64]; |  | ||||||
|     char buf[64]; |  | ||||||
| 
 |  | ||||||
|     strcpy(dialog_str, (char*)text); |  | ||||||
| 
 |  | ||||||
|     if(state->dialog_progress <= strlen(dialog_str)) { |  | ||||||
|         if(HAL_GetTick() / 10 % 2 == 0) state->dialog_progress++; |  | ||||||
|         dialog_str[state->dialog_progress] = '\0'; |  | ||||||
|         snprintf(buf, state->dialog_progress, dialog_str); |  | ||||||
|     } else { |  | ||||||
|         snprintf(buf, 64, dialog_str); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     canvas_draw_str_aligned(canvas, x, y, AlignCenter, AlignCenter, buf); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const void scene_activate_item_callback(SceneState* state, Canvas* canvas) { |  | ||||||
|     furi_assert(state); |  | ||||||
|     furi_assert(canvas); |  | ||||||
| 
 |  | ||||||
|     const Item* near = is_nearby(state); |  | ||||||
|     if(near && state->use_pending == true) { |  | ||||||
|         state->action_timeout = near->timeout; |  | ||||||
|         near->callback(canvas, state); |  | ||||||
|         state->use_pending = false; |  | ||||||
|     } else if(near) { |  | ||||||
|         near->callback(canvas, state); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const Vec2 item_get_pos(SceneState* state, ItemsEnum item) { |  | ||||||
|     const Item** current = get_scene(state); |  | ||||||
|     Vec2 rel_pos = {0, 0}; |  | ||||||
| 
 |  | ||||||
|     rel_pos.x = DOLPHIN_WIDTH / 2 + (current[item]->pos.x * PARALLAX(current[item]->layer)); |  | ||||||
|     rel_pos.y = DOLPHIN_WIDTH / 4 + (current[item]->pos.y * PARALLAX(current[item]->layer)); |  | ||||||
| 
 |  | ||||||
|     return rel_pos; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| const Item* is_nearby(SceneState* state) { |  | ||||||
|     furi_assert(state); |  | ||||||
|     uint8_t item = 0; |  | ||||||
|     bool found = false; |  | ||||||
|     const Item** current = get_scene(state); |  | ||||||
|     while(item < ItemsEnumTotal) { |  | ||||||
|         int32_t rel_x = |  | ||||||
|             (DOLPHIN_CENTER + DOLPHIN_WIDTH / 2 - |  | ||||||
|              (current[item]->pos.x - state->player_global.x) * PARALLAX(current[item]->layer)); |  | ||||||
| 
 |  | ||||||
|         uint8_t item_height = current[item]->height; |  | ||||||
|         uint8_t item_width = current[item]->width; |  | ||||||
| 
 |  | ||||||
|         int32_t rel_y = current[item]->pos.y - state->player_global.y; |  | ||||||
| 
 |  | ||||||
|         if(abs(rel_x) <= item_width && abs(rel_y) <= item_height) { |  | ||||||
|             found = !found; |  | ||||||
|             break; |  | ||||||
|         } |  | ||||||
|         ++item; |  | ||||||
|     } |  | ||||||
|     return found ? current[item] : NULL; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void food_redraw(Canvas* canvas, void* s) { |  | ||||||
|     furi_assert(s); |  | ||||||
|     SceneState* state = s; |  | ||||||
| 
 |  | ||||||
|     const Icon* food_frames[] = { |  | ||||||
|         &I_food1_61x98, |  | ||||||
|         &I_food2_61x98, |  | ||||||
|         &I_food3_61x98, |  | ||||||
|         &I_food4_61x98, |  | ||||||
|         &I_food5_61x98, |  | ||||||
|         &I_food6_61x98, |  | ||||||
|         &I_food7_61x98, |  | ||||||
|         &I_food8_61x98, |  | ||||||
|         &I_food9_61x98, |  | ||||||
|         &I_food10_61x98, |  | ||||||
|         &I_food11_61x98, |  | ||||||
|         &I_food12_61x98, |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     uint8_t frame = ((HAL_GetTick() / 200) % SIZEOF_ARRAY(food_frames)); |  | ||||||
| 
 |  | ||||||
|     if(is_nearby(state) && (state->player_global.y > Food.pos.y)) { |  | ||||||
|         dolphin_scene_type_text( |  | ||||||
|             canvas, |  | ||||||
|             state, |  | ||||||
|             (Food.pos.x - state->player_global.x) * PARALLAX(Food.layer) + 90, |  | ||||||
|             state->screen.y + 8, |  | ||||||
|             console_emotes[state->emote_id]); |  | ||||||
| 
 |  | ||||||
|     } else { |  | ||||||
|         state->dialog_progress = 0; |  | ||||||
|         state->emote_id = roll_new(state->previous_emote, SIZEOF_ARRAY(console_emotes)); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     canvas_draw_icon( |  | ||||||
|         canvas, |  | ||||||
|         (Food.pos.x - state->player_global.x) * PARALLAX(Food.layer), |  | ||||||
|         Food.pos.y - state->player_global.y, |  | ||||||
|         food_frames[frame]); |  | ||||||
| 
 |  | ||||||
|     canvas_set_bitmap_mode(canvas, true); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void food_callback(Canvas* canvas, void* s) { |  | ||||||
|     furi_assert(s); |  | ||||||
|     SceneState* state = s; |  | ||||||
|     if(state->use_pending) { |  | ||||||
|         dolphin_scene_start_app(state, &FLIPPER_SCENE_APPS[1]); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void console_redraw(Canvas* canvas, void* s) { |  | ||||||
|     furi_assert(s); |  | ||||||
|     SceneState* state = s; |  | ||||||
| 
 |  | ||||||
|     const Icon* console[] = { |  | ||||||
|         &I_Console_74x67_0, |  | ||||||
|         &I_Console_74x67_1, |  | ||||||
|         &I_Console_74x67_2, |  | ||||||
|         &I_Console_74x67_3, |  | ||||||
|         &I_Console_74x67_4, |  | ||||||
|         &I_Console_74x67_5, |  | ||||||
|         &I_Console_74x67_6, |  | ||||||
|         &I_Console_74x67_7, |  | ||||||
|         &I_Console_74x67_8, |  | ||||||
| 
 |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     uint8_t frame = ((HAL_GetTick() / 100) % SIZEOF_ARRAY(console)); |  | ||||||
| 
 |  | ||||||
|     canvas_draw_icon( |  | ||||||
|         canvas, |  | ||||||
|         (Console.pos.x - state->player_global.x) * PARALLAX(Console.layer), |  | ||||||
|         Console.pos.y - state->player_global.y, |  | ||||||
|         console[frame]); |  | ||||||
| 
 |  | ||||||
|     canvas_set_bitmap_mode(canvas, true); |  | ||||||
| 
 |  | ||||||
|     if(is_nearby(state)) { |  | ||||||
|         dolphin_scene_type_text( |  | ||||||
|             canvas, |  | ||||||
|             state, |  | ||||||
|             (Console.pos.x - state->player_global.x) * PARALLAX(Console.layer) - 25, |  | ||||||
|             Console.pos.y - state->player_global.y + 14, |  | ||||||
|             console_emotes[state->emote_id]); |  | ||||||
| 
 |  | ||||||
|     } else { |  | ||||||
|         state->dialog_progress = 0; |  | ||||||
|         state->emote_id = roll_new(state->previous_emote, SIZEOF_ARRAY(console_emotes)); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void console_callback(Canvas* canvas, void* s) { |  | ||||||
|     furi_assert(s); |  | ||||||
|     SceneState* state = s; |  | ||||||
|     if(state->use_pending) { |  | ||||||
|         dolphin_scene_start_app(state, &FLIPPER_SCENE_APPS[0]); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,14 +0,0 @@ | |||||||
| #pragma once |  | ||||||
| #include "dolphin/scenes/scene.h" |  | ||||||
| 
 |  | ||||||
| typedef enum { |  | ||||||
|     ItemsFood, |  | ||||||
|     ItemsConsole, |  | ||||||
|     ItemsEnumTotal, |  | ||||||
| } ItemsEnum; |  | ||||||
| 
 |  | ||||||
| uint16_t roll_new(uint16_t prev, uint16_t max); |  | ||||||
| const Vec2 item_get_pos(SceneState* state, ItemsEnum item); |  | ||||||
| const Item* is_nearby(SceneState* state); |  | ||||||
| const Item** get_scene(SceneState* state); |  | ||||||
| const void scene_activate_item_callback(SceneState* state, Canvas* canvas); |  | ||||||
| @ -1,8 +0,0 @@ | |||||||
| #pragma once |  | ||||||
| #include "items.h" |  | ||||||
| 
 |  | ||||||
| void food_redraw(Canvas* canvas, void* state); |  | ||||||
| void food_callback(Canvas* canvas, void* state); |  | ||||||
| 
 |  | ||||||
| void console_redraw(Canvas* canvas, void* state); |  | ||||||
| void console_callback(Canvas* canvas, void* state); |  | ||||||
| @ -1,276 +0,0 @@ | |||||||
| #pragma once |  | ||||||
| #include "dolphin/scenes/scene.h" |  | ||||||
| 
 |  | ||||||
| const DolphinFrame up = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_up1_73x61, |  | ||||||
|                 .b = &I_black_up1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_up2_73x61, |  | ||||||
|                 .b = &I_black_up2_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 2, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame up_down = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_updown1_73x61, |  | ||||||
|                 .b = &I_black_updown1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_updown2_73x61, |  | ||||||
|                 .b = &I_black_updown2_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_updown3_73x61, |  | ||||||
|                 .b = &I_black_updown3_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 3, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame up_right = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_upright1_73x61, |  | ||||||
|                 .b = &I_black_upright1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_upright2_73x61, |  | ||||||
|                 .b = &I_black_upright2_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 2, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame up_left = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_upleft1_73x61, |  | ||||||
|                 .b = &I_black_upleft1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_upleft2_73x61, |  | ||||||
|                 .b = &I_black_upleft2_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 2, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame right = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_right1_73x61, |  | ||||||
|                 .b = &I_black_right1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_right2_73x61, |  | ||||||
|                 .b = &I_black_right2_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_right3_73x61, |  | ||||||
|                 .b = &I_black_right3_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 3, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame right_up = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_rightup1_73x61, |  | ||||||
|                 .b = &I_black_rightup1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_rightup2_73x61, |  | ||||||
|                 .b = &I_black_rightup2_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 2, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame right_down = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_rightdown1_73x61, |  | ||||||
|                 .b = &I_black_rightdown1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_rightdown2_73x61, |  | ||||||
|                 .b = &I_black_rightdown2_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 2, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame right_left = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_rightleft1_73x61, |  | ||||||
|                 .b = &I_black_rightleft1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_rightleft2_73x61, |  | ||||||
|                 .b = &I_black_rightleft2_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 2, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame down = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_down1_73x61, |  | ||||||
|                 .b = &I_black_down1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_down2_73x61, |  | ||||||
|                 .b = &I_black_down2_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 2, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame down_up = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_downup1_73x61, |  | ||||||
|                 .b = &I_black_downup1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_downup2_73x61, |  | ||||||
|                 .b = &I_black_downup2_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_downup3_73x61, |  | ||||||
|                 .b = &I_black_downup3_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 3, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame down_left = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_downleft1_73x61, |  | ||||||
|                 .b = &I_black_downleft1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_downleft2_73x61, |  | ||||||
|                 .b = &I_black_downleft2_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_downleft3_73x61, |  | ||||||
|                 .b = &I_black_downleft3_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 3, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame down_right = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_downright1_73x61, |  | ||||||
|                 .b = &I_black_downright1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_downright2_73x61, |  | ||||||
|                 .b = &I_black_downright2_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_downright3_73x61, |  | ||||||
|                 .b = &I_black_downright3_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 3, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame left = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_left1_73x61, |  | ||||||
|                 .b = &I_black_left1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_left2_73x61, |  | ||||||
|                 .b = &I_black_left2_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_left3_73x61, |  | ||||||
|                 .b = &I_black_left3_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 3, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame left_up = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_leftup1_73x61, |  | ||||||
|                 .b = &I_black_leftup1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_leftup2_73x61, |  | ||||||
|                 .b = &I_black_leftup2_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 2, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame left_down = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_leftdown1_73x61, |  | ||||||
|                 .b = &I_black_leftdown1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_leftdown2_73x61, |  | ||||||
|                 .b = &I_black_leftdown2_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 2, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame left_right = { |  | ||||||
|     .frames = |  | ||||||
|         { |  | ||||||
|             { |  | ||||||
|                 .f = &I_rightleft1_73x61, |  | ||||||
|                 .b = &I_black_rightleft1_73x61, |  | ||||||
|             }, |  | ||||||
|             { |  | ||||||
|                 .f = &I_rightleft2_73x61, |  | ||||||
|                 .b = &I_black_rightleft2_73x61, |  | ||||||
|             }, |  | ||||||
|         }, |  | ||||||
|     .total = 2, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| const DolphinFrame* frames[4][4] = { |  | ||||||
|     [DirUp] = {[DirUp] = &up, [DirRight] = &up_right, [DirDown] = &up_down, [DirLeft] = &up_left}, |  | ||||||
|     [DirRight] = |  | ||||||
|         {[DirUp] = &right_up, [DirRight] = &right, [DirDown] = &right_down, [DirLeft] = &right_left}, |  | ||||||
|     [DirDown] = |  | ||||||
|         {[DirUp] = &down_up, [DirRight] = &down_right, [DirDown] = &down, [DirLeft] = &down_left}, |  | ||||||
|     [DirLeft] = |  | ||||||
|         {[DirUp] = &left_up, [DirRight] = &left_right, [DirDown] = &left_down, [DirLeft] = &left}, |  | ||||||
| }; |  | ||||||
| @ -1,151 +0,0 @@ | |||||||
| #include <furi.h> |  | ||||||
| #include <furi-hal.h> |  | ||||||
| #include "scene.h" |  | ||||||
| 
 |  | ||||||
| static SceneAppGui* scene_app_gui = NULL; |  | ||||||
| static ValueMutex* scene_state_mutex = NULL; |  | ||||||
| 
 |  | ||||||
| void dolphin_scene_redraw(Canvas* canvas, void* ctx) { |  | ||||||
|     furi_assert(canvas); |  | ||||||
|     furi_assert(ctx); |  | ||||||
| 
 |  | ||||||
|     SceneState* state = (SceneState*)acquire_mutex((ValueMutex*)ctx, 25); |  | ||||||
|     if(state == NULL) return; // redraw fail
 |  | ||||||
|     uint32_t t = xTaskGetTickCount(); |  | ||||||
| 
 |  | ||||||
|     canvas_clear(canvas); |  | ||||||
|     dolphin_scene_render(state, canvas, t); |  | ||||||
|     dolphin_scene_render_state(state, canvas); |  | ||||||
|     release_mutex((ValueMutex*)ctx, state); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void dolphin_scene_handle_input(SceneState* state, InputEvent* input) { |  | ||||||
|     // printf("[kb] event: %02x %s\n", input->key, input->state ? "pressed" : "released");
 |  | ||||||
|     dolphin_scene_handle_user_input(state, input); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void dolphin_scene_tick_handler(SceneState* state, uint32_t t, uint32_t dt) { |  | ||||||
|     // printf("t: %d, dt: %d\n", t, dt);
 |  | ||||||
|     dolphin_scene_coordinates(state, dt); |  | ||||||
|     dolphin_scene_update_state(state, t, dt); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void scene_engine_tick_callback(void* p) { |  | ||||||
|     osMessageQueueId_t event_queue = p; |  | ||||||
|     AppEvent event; |  | ||||||
|     event.type = EventTypeTick; |  | ||||||
|     osMessageQueuePut(event_queue, (void*)&event, 0, 0); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static void scene_engine_input_callback(InputEvent* input_event, void* ctx) { |  | ||||||
|     osMessageQueueId_t event_queue = ctx; |  | ||||||
|     AppEvent event; |  | ||||||
|     event.type = EventTypeKey; |  | ||||||
|     event.value.input = *input_event; |  | ||||||
|     osMessageQueuePut(event_queue, (void*)&event, 0, osWaitForever); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void scene_alloc() { |  | ||||||
|     printf("scene_alloc: start\r\n"); |  | ||||||
|     furi_assert(scene_app_gui == NULL); |  | ||||||
|     furi_assert(scene_state_mutex == NULL); |  | ||||||
| 
 |  | ||||||
|     // SceneAppGui
 |  | ||||||
|     scene_app_gui = furi_alloc(sizeof(SceneAppGui)); |  | ||||||
|     scene_app_gui->mqueue = osMessageQueueNew(8, sizeof(AppEvent), NULL); |  | ||||||
|     scene_app_gui->gui = furi_record_open("gui"); |  | ||||||
|     scene_app_gui->view_port = view_port_alloc(); |  | ||||||
|     scene_app_gui->timer = |  | ||||||
|         osTimerNew(scene_engine_tick_callback, osTimerPeriodic, scene_app_gui->mqueue, NULL); |  | ||||||
|     printf("scene_alloc: timer %p\r\n", scene_app_gui->timer); |  | ||||||
|     // Scene State
 |  | ||||||
|     SceneState* scene_state = furi_alloc(sizeof(SceneState)); |  | ||||||
|     scene_state->player.y = DOLPHIN_DEFAULT_Y; |  | ||||||
|     scene_state->player.x = DOLPHIN_CENTER; |  | ||||||
| 
 |  | ||||||
|     scene_state->player_global.x = 160; |  | ||||||
|     scene_state->player_global.y = WORLD_HEIGHT; |  | ||||||
| 
 |  | ||||||
|     scene_state->frame_group = DirRight; |  | ||||||
|     scene_state->frame_type = DirRight; |  | ||||||
|     scene_state->frame_pending = DirRight; |  | ||||||
|     scene_state->last_group = DirRight; |  | ||||||
| 
 |  | ||||||
|     scene_state->screen.x = scene_state->player.x; |  | ||||||
|     scene_state->screen.y = scene_state->player.y; |  | ||||||
|     // scene_state->debug = true;
 |  | ||||||
|     scene_state_mutex = furi_alloc(sizeof(ValueMutex)); |  | ||||||
|     furi_check(init_mutex(scene_state_mutex, scene_state, sizeof(SceneState))); |  | ||||||
| 
 |  | ||||||
|     // Open GUI and register fullscreen view_port
 |  | ||||||
|     view_port_draw_callback_set(scene_app_gui->view_port, dolphin_scene_redraw, scene_state_mutex); |  | ||||||
|     view_port_input_callback_set( |  | ||||||
|         scene_app_gui->view_port, scene_engine_input_callback, scene_app_gui->mqueue); |  | ||||||
|     gui_add_view_port(scene_app_gui->gui, scene_app_gui->view_port, GuiLayerFullscreen); |  | ||||||
|     view_port_enabled_set(scene_app_gui->view_port, true); |  | ||||||
|     printf("scene_alloc: complete\r\n"); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void scene_free() { |  | ||||||
|     printf("scene_free: start\r\n"); |  | ||||||
|     view_port_enabled_set(scene_app_gui->view_port, false); |  | ||||||
|     gui_remove_view_port(scene_app_gui->gui, scene_app_gui->view_port); |  | ||||||
| 
 |  | ||||||
|     SceneState* scene_state = (SceneState*)acquire_mutex_block(scene_state_mutex); |  | ||||||
|     furi_assert(scene_state); |  | ||||||
|     free(scene_state); |  | ||||||
|     release_mutex(scene_state_mutex, scene_state); |  | ||||||
|     delete_mutex(scene_state_mutex); |  | ||||||
|     free(scene_state_mutex); |  | ||||||
|     scene_state_mutex = NULL; |  | ||||||
| 
 |  | ||||||
|     furi_check(osTimerDelete(scene_app_gui->timer) == osOK); |  | ||||||
|     furi_record_close("gui"); |  | ||||||
|     view_port_free(scene_app_gui->view_port); |  | ||||||
|     furi_check(osMessageQueueDelete(scene_app_gui->mqueue) == osOK); |  | ||||||
|     free(scene_app_gui); |  | ||||||
|     scene_app_gui = NULL; |  | ||||||
|     printf("scene_free: complete\r\n"); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int32_t scene_app(void* p) { |  | ||||||
|     furi_hal_power_insomnia_enter(); |  | ||||||
|     scene_alloc(); |  | ||||||
| 
 |  | ||||||
|     osTimerStart(scene_app_gui->timer, 40); |  | ||||||
| 
 |  | ||||||
|     uint32_t t = xTaskGetTickCount(); |  | ||||||
|     uint32_t prev_t = 0; |  | ||||||
| 
 |  | ||||||
|     while(1) { |  | ||||||
|         AppEvent event; |  | ||||||
|         if(osMessageQueueGet(scene_app_gui->mqueue, &event, 0, osWaitForever) == osOK) { |  | ||||||
|             SceneState* scene_state = (SceneState*)acquire_mutex_block(scene_state_mutex); |  | ||||||
|             if(event.type == EventTypeTick) { |  | ||||||
|                 t = xTaskGetTickCount(); |  | ||||||
|                 dolphin_scene_tick_handler(scene_state, t, (t - prev_t) % 1024); |  | ||||||
|                 prev_t = t; |  | ||||||
|             } else if(event.type == EventTypeKey) { |  | ||||||
|                 if(event.value.input.key == InputKeyBack && |  | ||||||
|                    event.value.input.type == InputTypeShort) { |  | ||||||
|                     release_mutex(scene_state_mutex, scene_state); |  | ||||||
|                     break; |  | ||||||
| 
 |  | ||||||
|                 } else { |  | ||||||
|                     dolphin_scene_handle_input(scene_state, &event.value.input); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             release_mutex(scene_state_mutex, scene_state); |  | ||||||
|             view_port_update(scene_app_gui->view_port); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     osTimerStop(scene_app_gui->timer); |  | ||||||
| 
 |  | ||||||
|     // CMSIS + FreeRTOS = Enterprise
 |  | ||||||
|     osDelay(15); |  | ||||||
| 
 |  | ||||||
|     scene_free(); |  | ||||||
|     furi_hal_power_insomnia_exit(); |  | ||||||
|     return 0; |  | ||||||
| } |  | ||||||
| @ -1,138 +0,0 @@ | |||||||
| #pragma once |  | ||||||
| 
 |  | ||||||
| #include <furi.h> |  | ||||||
| #include <gui/gui_i.h> |  | ||||||
| #include <u8g2/u8g2.h> |  | ||||||
| 
 |  | ||||||
| // global
 |  | ||||||
| #define SCALE 32 |  | ||||||
| // screen
 |  | ||||||
| 
 |  | ||||||
| #define SCREEN_WIDTH GUI_DISPLAY_WIDTH |  | ||||||
| #define SCREEN_HEIGHT GUI_DISPLAY_HEIGHT |  | ||||||
| #define BONDARIES_X_LEFT 40 |  | ||||||
| #define BONDARIES_X_RIGHT 88 |  | ||||||
| 
 |  | ||||||
| // player
 |  | ||||||
| #define DOLPHIN_WIDTH 32 |  | ||||||
| #define DOLPHIN_HEIGHT 32 |  | ||||||
| #define DOLPHIN_CENTER (SCREEN_WIDTH / 2 - DOLPHIN_WIDTH) |  | ||||||
| #define SPEED_X 4 |  | ||||||
| #define SPEED_Y 4 |  | ||||||
| #define ACTIONS_NUM 4 |  | ||||||
| #define DOLPHIN_DEFAULT_Y 2 |  | ||||||
| #define MAX_FRAMES 3 |  | ||||||
| 
 |  | ||||||
| // world
 |  | ||||||
| #define WORLD_WIDTH 256 |  | ||||||
| #define WORLD_HEIGHT 192 |  | ||||||
| 
 |  | ||||||
| #define LAYERS 8 |  | ||||||
| #define DOLPHIN_LAYER 6 |  | ||||||
| #define PARALLAX_MOD 7 |  | ||||||
| #define PARALLAX(layer) layer / PARALLAX_MOD - layer |  | ||||||
| 
 |  | ||||||
| #define DIALOG_PROGRESS 250 |  | ||||||
| 
 |  | ||||||
| enum Actions { IDLE = 0, EMOTE, INTERACT, MINDCONTROL }; |  | ||||||
| 
 |  | ||||||
| static const uint16_t default_timeout[] = |  | ||||||
|     {[IDLE] = 100, [EMOTE] = 50, [INTERACT] = 10, [MINDCONTROL] = 50}; |  | ||||||
| 
 |  | ||||||
| typedef enum { |  | ||||||
|     EventTypeTick, |  | ||||||
|     EventTypeKey, |  | ||||||
| } EventType; |  | ||||||
| 
 |  | ||||||
| typedef struct { |  | ||||||
|     union { |  | ||||||
|         InputEvent input; |  | ||||||
|     } value; |  | ||||||
|     EventType type; |  | ||||||
| } AppEvent; |  | ||||||
| 
 |  | ||||||
| typedef struct { |  | ||||||
|     int32_t x; |  | ||||||
|     int32_t y; |  | ||||||
| } Vec2; |  | ||||||
| 
 |  | ||||||
| typedef struct { |  | ||||||
|     osMessageQueueId_t mqueue; |  | ||||||
|     Gui* gui; |  | ||||||
|     ViewPort* view_port; |  | ||||||
|     osTimerId_t* timer; |  | ||||||
| } SceneAppGui; |  | ||||||
| 
 |  | ||||||
| typedef struct { |  | ||||||
|     uint8_t layer; |  | ||||||
|     uint16_t timeout; |  | ||||||
|     Vec2 pos; |  | ||||||
| 
 |  | ||||||
|     uint8_t width; |  | ||||||
|     uint8_t height; |  | ||||||
| 
 |  | ||||||
|     void (*draw)(Canvas* canvas, void* model); |  | ||||||
|     void (*callback)(Canvas* canvas, void* model); |  | ||||||
| } Item; |  | ||||||
| 
 |  | ||||||
| typedef enum { |  | ||||||
|     DirUp = 0, |  | ||||||
|     DirRight, |  | ||||||
|     DirDown, |  | ||||||
|     DirLeft, |  | ||||||
| } FrameDirectionEnum; |  | ||||||
| 
 |  | ||||||
| typedef struct { |  | ||||||
|     const Icon* f; |  | ||||||
|     const Icon* b; |  | ||||||
| } DolphinGfxAsset; |  | ||||||
| 
 |  | ||||||
| typedef struct { |  | ||||||
|     const DolphinGfxAsset frames[MAX_FRAMES]; |  | ||||||
|     const uint8_t total; |  | ||||||
| } DolphinFrame; |  | ||||||
| 
 |  | ||||||
| typedef struct { |  | ||||||
|     Vec2 player; |  | ||||||
|     Vec2 player_global; |  | ||||||
|     Vec2 player_v; |  | ||||||
|     Vec2 screen; |  | ||||||
| 
 |  | ||||||
|     FrameDirectionEnum frame_group; |  | ||||||
|     FrameDirectionEnum last_group; |  | ||||||
|     FrameDirectionEnum frame_pending; |  | ||||||
|     FrameDirectionEnum frame_type; |  | ||||||
| 
 |  | ||||||
|     const DolphinFrame* current_frame; |  | ||||||
| 
 |  | ||||||
|     bool transition; |  | ||||||
|     bool transition_pending; |  | ||||||
|     bool use_pending; |  | ||||||
|     bool debug; |  | ||||||
| 
 |  | ||||||
|     uint8_t player_anim; |  | ||||||
|     uint8_t frame_idx; |  | ||||||
| 
 |  | ||||||
|     uint8_t scene_id; |  | ||||||
|     uint8_t emote_id; |  | ||||||
|     uint8_t previous_emote; |  | ||||||
| 
 |  | ||||||
|     uint8_t action; |  | ||||||
|     uint8_t prev_action; |  | ||||||
|     uint8_t action_timeout; |  | ||||||
|     uint8_t dialog_progress; |  | ||||||
| 
 |  | ||||||
|     FuriThread* scene_app_thread; |  | ||||||
| } SceneState; |  | ||||||
| 
 |  | ||||||
| void dolphin_scene_render(SceneState* state, Canvas* canvas, uint32_t t); |  | ||||||
| void dolphin_scene_render_dolphin(SceneState* state, Canvas* canvas); |  | ||||||
| void dolphin_scene_handle_user_input(SceneState* state, InputEvent* input); |  | ||||||
| void dolphin_scene_coordinates(SceneState* state, uint32_t dt); |  | ||||||
| 
 |  | ||||||
| void dolphin_scene_render_state(SceneState* state, Canvas* canvas); |  | ||||||
| void dolphin_scene_update_state(SceneState* state, uint32_t t, uint32_t dt); |  | ||||||
| 
 |  | ||||||
| void dolphin_scene_redraw(Canvas* canvas, void* ctx); |  | ||||||
| void dolphin_scene_tick_handler(SceneState* state, uint32_t t, uint32_t dt); |  | ||||||
| void dolphin_scene_handle_input(SceneState* state, InputEvent* input); |  | ||||||
| @ -1,60 +0,0 @@ | |||||||
| #include <furi.h> |  | ||||||
| #include <gui/elements.h> |  | ||||||
| #include "scene.h" |  | ||||||
| 
 |  | ||||||
| void dolphin_scene_handle_user_input(SceneState* state, InputEvent* input) { |  | ||||||
|     furi_assert(state); |  | ||||||
|     furi_assert(input); |  | ||||||
| 
 |  | ||||||
|     state->last_group = state->frame_group; |  | ||||||
|     if(input->type == InputTypePress) { |  | ||||||
|         state->action = MINDCONTROL; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     if(state->action == MINDCONTROL) { |  | ||||||
|         if(input->type == InputTypePress) { |  | ||||||
|             if(input->key == InputKeyRight) { |  | ||||||
|                 state->player_v.y = 0; |  | ||||||
|                 state->player_v.x = SPEED_X; |  | ||||||
|             } else if(input->key == InputKeyLeft) { |  | ||||||
|                 state->player_v.y = 0; |  | ||||||
|                 state->player_v.x = -SPEED_X; |  | ||||||
|             } else if(input->key == InputKeyUp) { |  | ||||||
|                 state->player_v.x = 0; |  | ||||||
|                 state->player_v.y = -SPEED_Y; |  | ||||||
|             } else if(input->key == InputKeyDown) { |  | ||||||
|                 state->player_v.x = 0; |  | ||||||
|                 state->player_v.y = SPEED_Y; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if(input->type == InputTypeRelease) { |  | ||||||
|             state->player_v.x = 0; |  | ||||||
|             state->player_v.y = 0; |  | ||||||
|         } else if(input->type == InputTypeShort) { |  | ||||||
|             if(input->key == InputKeyOk) { |  | ||||||
|                 state->prev_action = MINDCONTROL; |  | ||||||
|                 state->action = INTERACT; |  | ||||||
|                 state->use_pending = true; |  | ||||||
|                 state->action_timeout = 0; |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void dolphin_scene_coordinates(SceneState* state, uint32_t dt) { |  | ||||||
|     furi_assert(state); |  | ||||||
| 
 |  | ||||||
|     // global pos
 |  | ||||||
|     state->player_global.x = CLAMP(state->player_global.x + state->player_v.x, WORLD_WIDTH, 0); |  | ||||||
|     state->player_global.y = CLAMP(state->player_global.y + state->player_v.y, WORLD_HEIGHT, 0); |  | ||||||
| 
 |  | ||||||
|     // nudge camera postition
 |  | ||||||
|     if(state->player_global.x > 170) { |  | ||||||
|         state->player.x = |  | ||||||
|             CLAMP(state->player.x - state->player_v.x / 2, DOLPHIN_CENTER, -DOLPHIN_WIDTH / 2); |  | ||||||
|     } else if(state->player_global.x < 70) { |  | ||||||
|         state->player.x = |  | ||||||
|             CLAMP(state->player.x - state->player_v.x / 2, DOLPHIN_WIDTH * 2, DOLPHIN_CENTER); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,47 +0,0 @@ | |||||||
| #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; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,121 +0,0 @@ | |||||||
| #include <furi.h> |  | ||||||
| #include "scene.h" |  | ||||||
| #include "assets/items.h" |  | ||||||
| #include "assets/meta.h" |  | ||||||
| #include <gui/elements.h> |  | ||||||
| 
 |  | ||||||
| void dolphin_scene_transition_handler(SceneState* state) { |  | ||||||
|     uint8_t speed_mod = (state->player_v.x || state->player_v.y || state->transition) ? 6 : 10; |  | ||||||
| 
 |  | ||||||
|     if(state->player_v.x < 0) { |  | ||||||
|         state->frame_pending = DirLeft; |  | ||||||
|     } else if(state->player_v.x > 0) { |  | ||||||
|         state->frame_pending = DirRight; |  | ||||||
|     } else if(state->player_v.y < 0) { |  | ||||||
|         state->frame_pending = DirUp; |  | ||||||
|     } else if(state->player_v.y > 0) { |  | ||||||
|         state->frame_pending = DirDown; |  | ||||||
|     } |  | ||||||
|     state->transition_pending = state->frame_group != state->frame_pending; |  | ||||||
| 
 |  | ||||||
|     if(*&frames[state->frame_group][state->frame_type]->frames[state->frame_idx].f) { |  | ||||||
|         state->current_frame = *&frames[state->frame_group][state->frame_type]; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     uint8_t total = state->current_frame->frames[2].f == NULL ? 2 : 3; |  | ||||||
| 
 |  | ||||||
|     if(state->transition_pending && !state->frame_idx) { |  | ||||||
|         state->transition_pending = false; |  | ||||||
|         state->transition = true; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     if(state->transition) { |  | ||||||
|         state->frame_type = state->frame_pending; |  | ||||||
|         state->frame_group = state->last_group; |  | ||||||
|         state->transition = !(state->frame_idx == total - 1); |  | ||||||
|     } else { |  | ||||||
|         state->frame_group = state->frame_type; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     state->player_anim++; |  | ||||||
| 
 |  | ||||||
|     if(!(state->player_anim % speed_mod)) { |  | ||||||
|         state->frame_idx = (state->frame_idx + 1) % total; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void dolphin_scene_render_dolphin(SceneState* state, Canvas* canvas) { |  | ||||||
|     furi_assert(state); |  | ||||||
|     furi_assert(canvas); |  | ||||||
| 
 |  | ||||||
|     dolphin_scene_transition_handler(state); |  | ||||||
| 
 |  | ||||||
|     canvas_set_bitmap_mode(canvas, true); |  | ||||||
|     canvas_set_color(canvas, ColorWhite); |  | ||||||
|     canvas_draw_icon( |  | ||||||
|         canvas, state->player.x, state->player.y, state->current_frame->frames[state->frame_idx].b); |  | ||||||
|     canvas_set_color(canvas, ColorBlack); |  | ||||||
|     canvas_draw_icon( |  | ||||||
|         canvas, state->player.x, state->player.y, state->current_frame->frames[state->frame_idx].f); |  | ||||||
|     canvas_set_bitmap_mode(canvas, false); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static bool item_screen_bounds_x(int32_t pos) { |  | ||||||
|     return pos > -SCREEN_WIDTH && pos < (SCREEN_WIDTH * 2); |  | ||||||
| } |  | ||||||
| static bool item_screen_bounds_y(int32_t pos) { |  | ||||||
|     return pos > -SCREEN_HEIGHT * 2 && pos < (SCREEN_HEIGHT * 2); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void dolphin_scene_render(SceneState* state, Canvas* canvas, uint32_t t) { |  | ||||||
|     furi_assert(state); |  | ||||||
|     furi_assert(canvas); |  | ||||||
| 
 |  | ||||||
|     canvas_set_font(canvas, FontSecondary); |  | ||||||
|     canvas_set_color(canvas, ColorBlack); |  | ||||||
|     const Item** current_scene = get_scene(state); |  | ||||||
| 
 |  | ||||||
|     for(uint8_t l = 0; l < LAYERS; l++) { |  | ||||||
|         for(uint8_t i = 0; i < ItemsEnumTotal; i++) { |  | ||||||
|             int32_t item_pos_X = (current_scene[i]->pos.x - state->player_global.x); |  | ||||||
|             int32_t item_pos_Y = (current_scene[i]->pos.y - state->player_global.y); |  | ||||||
| 
 |  | ||||||
|             if(item_screen_bounds_x(item_pos_X) && item_screen_bounds_y(item_pos_Y)) { |  | ||||||
|                 if(l == current_scene[i]->layer) { |  | ||||||
|                     if(current_scene[i]->draw) { |  | ||||||
|                         current_scene[i]->draw(canvas, state); |  | ||||||
|                     } |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         if(l == DOLPHIN_LAYER) dolphin_scene_render_dolphin(state, canvas); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| void dolphin_scene_render_state(SceneState* state, Canvas* canvas) { |  | ||||||
|     furi_assert(state); |  | ||||||
|     furi_assert(canvas); |  | ||||||
| 
 |  | ||||||
|     char buf[64]; |  | ||||||
| 
 |  | ||||||
|     canvas_set_font(canvas, FontSecondary); |  | ||||||
|     canvas_set_color(canvas, ColorBlack); |  | ||||||
| 
 |  | ||||||
|     // dolphin_scene_debug
 |  | ||||||
|     if(state->debug) { |  | ||||||
|         sprintf( |  | ||||||
|             buf, |  | ||||||
|             "%d:%d %d/%dP%dL%d T%d-%d", |  | ||||||
|             state->frame_idx, |  | ||||||
|             state->current_frame->frames[2].f == NULL ? 2 : 3, |  | ||||||
|             state->frame_group, |  | ||||||
|             state->frame_type, |  | ||||||
|             state->frame_pending, |  | ||||||
|             state->last_group, |  | ||||||
|             state->transition_pending, |  | ||||||
|             state->transition); |  | ||||||
|         canvas_draw_str(canvas, 0, 13, buf); |  | ||||||
|     } |  | ||||||
|     if(state->action == INTERACT) scene_activate_item_callback(state, canvas); |  | ||||||
| } |  | ||||||
| @ -1,13 +1,6 @@ | |||||||
| #pragma once | #pragma once | ||||||
| #include <gui/icon.h> | #include <gui/icon.h> | ||||||
| 
 | 
 | ||||||
| extern const Icon A_FX_Sitting_40x27; |  | ||||||
| extern const Icon A_MDIB_32x32; |  | ||||||
| extern const Icon A_MDI_32x32; |  | ||||||
| extern const Icon A_MDWLB_32x32; |  | ||||||
| extern const Icon A_MDWL_32x32; |  | ||||||
| extern const Icon A_MDWRB_32x32; |  | ||||||
| extern const Icon A_MDWR_32x32; |  | ||||||
| extern const Icon A_WatchingTV_128x64; | extern const Icon A_WatchingTV_128x64; | ||||||
| extern const Icon A_Wink_128x64; | extern const Icon A_Wink_128x64; | ||||||
| extern const Icon I_dir_10px; | extern const Icon I_dir_10px; | ||||||
| @ -24,9 +17,6 @@ extern const Icon I_ButtonLeftSmall_3x5; | |||||||
| extern const Icon I_Warning_30x23; | extern const Icon I_Warning_30x23; | ||||||
| extern const Icon I_ButtonRight_4x7; | extern const Icon I_ButtonRight_4x7; | ||||||
| extern const Icon I_ButtonCenter_7x7; | extern const Icon I_ButtonCenter_7x7; | ||||||
| extern const Icon I_FX_SittingB_40x27; |  | ||||||
| extern const Icon I_BigGames_24x24; |  | ||||||
| extern const Icon I_BigProfile_24x24; |  | ||||||
| extern const Icon I_DolphinOkay_41x43; | extern const Icon I_DolphinOkay_41x43; | ||||||
| extern const Icon I_DolphinFirstStart4_67x53; | extern const Icon I_DolphinFirstStart4_67x53; | ||||||
| extern const Icon I_DolphinFirstStart2_59x51; | extern const Icon I_DolphinFirstStart2_59x51; | ||||||
| @ -37,22 +27,7 @@ extern const Icon I_DolphinFirstStart1_59x53; | |||||||
| extern const Icon I_DolphinFirstStart8_56x51; | extern const Icon I_DolphinFirstStart8_56x51; | ||||||
| extern const Icon I_DolphinFirstStart7_61x51; | extern const Icon I_DolphinFirstStart7_61x51; | ||||||
| extern const Icon I_Flipper_young_80x60; | extern const Icon I_Flipper_young_80x60; | ||||||
| extern const Icon I_BigBurger_24x24; |  | ||||||
| extern const Icon I_FX_Bang_32x6; |  | ||||||
| extern const Icon I_DolphinFirstStart3_57x48; | extern const Icon I_DolphinFirstStart3_57x48; | ||||||
| extern const Icon I_blackfish_25x17; |  | ||||||
| extern const Icon I_blacklid_36x27; |  | ||||||
| extern const Icon I_skeleton_25x17; |  | ||||||
| extern const Icon I_letterB_10x10; |  | ||||||
| extern const Icon I_shit_25x17; |  | ||||||
| extern const Icon I_letterC_10x10; |  | ||||||
| extern const Icon I_active_plate_48x18; |  | ||||||
| extern const Icon I_fish_25x17; |  | ||||||
| extern const Icon I_blackshit_25x17; |  | ||||||
| extern const Icon I_lid_36x27; |  | ||||||
| extern const Icon I_blackskeleton_25x17; |  | ||||||
| extern const Icon I_letterA_10x10; |  | ||||||
| extern const Icon I_plate_42x19; |  | ||||||
| extern const Icon I_PassportBottom_128x17; | extern const Icon I_PassportBottom_128x17; | ||||||
| extern const Icon I_DoorLeft_8x56; | extern const Icon I_DoorLeft_8x56; | ||||||
| extern const Icon I_DoorLocked_10x56; | extern const Icon I_DoorLocked_10x56; | ||||||
| @ -102,15 +77,6 @@ extern const Icon A_U2F_14; | |||||||
| extern const Icon A_iButton_14; | extern const Icon A_iButton_14; | ||||||
| extern const Icon I_Medium_chip_22x21; | extern const Icon I_Medium_chip_22x21; | ||||||
| extern const Icon I_EMV_Chip_14x11; | extern const Icon I_EMV_Chip_14x11; | ||||||
| extern const Icon I_passport_happy1_43x45; |  | ||||||
| extern const Icon I_passport_bad3_43x45; |  | ||||||
| extern const Icon I_passport_okay2_43x45; |  | ||||||
| extern const Icon I_passport_bad2_43x45; |  | ||||||
| extern const Icon I_passport_okay3_43x45; |  | ||||||
| extern const Icon I_passport_bad1_43x45; |  | ||||||
| extern const Icon I_passport_happy3_43x45; |  | ||||||
| extern const Icon I_passport_happy2_43x45; |  | ||||||
| extern const Icon I_passport_okay1_43x45; |  | ||||||
| extern const Icon I_Health_16x16; | extern const Icon I_Health_16x16; | ||||||
| extern const Icon I_FaceCharging_29x14; | extern const Icon I_FaceCharging_29x14; | ||||||
| extern const Icon I_BatteryBody_52x28; | extern const Icon I_BatteryBody_52x28; | ||||||
| @ -126,99 +92,6 @@ extern const Icon I_RFIDDolphinSend_97x61; | |||||||
| extern const Icon I_RFIDDolphinReceive_97x61; | extern const Icon I_RFIDDolphinReceive_97x61; | ||||||
| extern const Icon I_SDQuestion_35x43; | extern const Icon I_SDQuestion_35x43; | ||||||
| extern const Icon I_SDError_43x35; | extern const Icon I_SDError_43x35; | ||||||
| extern const Icon I_Console_74x67_4; |  | ||||||
| extern const Icon I_Console_74x67_5; |  | ||||||
| extern const Icon I_Console_74x67_7; |  | ||||||
| extern const Icon I_Console_74x67_6; |  | ||||||
| extern const Icon I_Console_74x67_2; |  | ||||||
| extern const Icon I_Console_74x67_3; |  | ||||||
| extern const Icon I_Console_74x67_1; |  | ||||||
| extern const Icon I_Console_74x67_0; |  | ||||||
| extern const Icon I_Console_74x67_8; |  | ||||||
| extern const Icon I_food8_61x98; |  | ||||||
| extern const Icon I_food5_61x98; |  | ||||||
| extern const Icon I_food3_61x98; |  | ||||||
| extern const Icon I_food9_61x98; |  | ||||||
| extern const Icon I_food12_61x98; |  | ||||||
| extern const Icon I_food4_61x98; |  | ||||||
| extern const Icon I_food2_61x98; |  | ||||||
| extern const Icon I_food7_61x98; |  | ||||||
| extern const Icon I_food11_61x98; |  | ||||||
| extern const Icon I_food1_61x98; |  | ||||||
| extern const Icon I_food6_61x98; |  | ||||||
| extern const Icon I_food10_61x98; |  | ||||||
| extern const Icon I_rightdown2_73x61; |  | ||||||
| extern const Icon I_black_upright2_73x61; |  | ||||||
| extern const Icon I_black_leftup1_73x61; |  | ||||||
| extern const Icon I_black_upleft1_73x61; |  | ||||||
| extern const Icon I_black_down2_73x61; |  | ||||||
| extern const Icon I_downleft3_73x61; |  | ||||||
| extern const Icon I_down2_73x61; |  | ||||||
| extern const Icon I_black_downright2_73x61; |  | ||||||
| extern const Icon I_black_downleft2_73x61; |  | ||||||
| extern const Icon I_up2_73x61; |  | ||||||
| extern const Icon I_right1_73x61; |  | ||||||
| extern const Icon I_black_up1_73x61; |  | ||||||
| extern const Icon I_upright1_73x61; |  | ||||||
| extern const Icon I_black_rightleft2_73x61; |  | ||||||
| extern const Icon I_black_right3_73x61; |  | ||||||
| extern const Icon I_upleft2_73x61; |  | ||||||
| extern const Icon I_black_downup3_73x61; |  | ||||||
| extern const Icon I_black_updown3_73x61; |  | ||||||
| extern const Icon I_leftup2_73x61; |  | ||||||
| extern const Icon I_leftdown2_73x61; |  | ||||||
| extern const Icon I_downup1_73x61; |  | ||||||
| extern const Icon I_updown1_73x61; |  | ||||||
| extern const Icon I_rightup1_73x61; |  | ||||||
| extern const Icon I_black_rightdown1_73x61; |  | ||||||
| extern const Icon I_downleft2_73x61; |  | ||||||
| extern const Icon I_downright1_73x61; |  | ||||||
| extern const Icon I_black_downright3_73x61; |  | ||||||
| extern const Icon I_black_downleft3_73x61; |  | ||||||
| extern const Icon I_rightleft1_73x61; |  | ||||||
| extern const Icon I_black_right2_73x61; |  | ||||||
| extern const Icon I_black_rightup2_73x61; |  | ||||||
| extern const Icon I_black_downup2_73x61; |  | ||||||
| extern const Icon I_black_updown2_73x61; |  | ||||||
| extern const Icon I_black_left1_73x61; |  | ||||||
| extern const Icon I_black_leftdown2_73x61; |  | ||||||
| extern const Icon I_left1_73x61; |  | ||||||
| extern const Icon I_rightup2_73x61; |  | ||||||
| extern const Icon I_black_rightdown2_73x61; |  | ||||||
| extern const Icon I_downup2_73x61; |  | ||||||
| extern const Icon I_updown2_73x61; |  | ||||||
| extern const Icon I_right3_73x61; |  | ||||||
| extern const Icon I_downright2_73x61; |  | ||||||
| extern const Icon I_downleft1_73x61; |  | ||||||
| extern const Icon I_black_rightup1_73x61; |  | ||||||
| extern const Icon I_black_right1_73x61; |  | ||||||
| extern const Icon I_rightleft2_73x61; |  | ||||||
| extern const Icon I_left2_73x61; |  | ||||||
| extern const Icon I_black_left2_73x61; |  | ||||||
| extern const Icon I_black_downup1_73x61; |  | ||||||
| extern const Icon I_black_updown1_73x61; |  | ||||||
| extern const Icon I_black_leftdown1_73x61; |  | ||||||
| extern const Icon I_downup3_73x61; |  | ||||||
| extern const Icon I_updown3_73x61; |  | ||||||
| extern const Icon I_black_leftup2_73x61; |  | ||||||
| extern const Icon I_black_upright1_73x61; |  | ||||||
| extern const Icon I_rightdown1_73x61; |  | ||||||
| extern const Icon I_right2_73x61; |  | ||||||
| extern const Icon I_black_downleft1_73x61; |  | ||||||
| extern const Icon I_down1_73x61; |  | ||||||
| extern const Icon I_black_downright1_73x61; |  | ||||||
| extern const Icon I_up1_73x61; |  | ||||||
| extern const Icon I_downright3_73x61; |  | ||||||
| extern const Icon I_black_down1_73x61; |  | ||||||
| extern const Icon I_black_upleft2_73x61; |  | ||||||
| extern const Icon I_upleft1_73x61; |  | ||||||
| extern const Icon I_black_rightleft1_73x61; |  | ||||||
| extern const Icon I_black_up2_73x61; |  | ||||||
| extern const Icon I_upright2_73x61; |  | ||||||
| extern const Icon I_leftdown1_73x61; |  | ||||||
| extern const Icon I_left3_73x61; |  | ||||||
| extern const Icon I_leftup1_73x61; |  | ||||||
| extern const Icon I_black_left3_73x61; |  | ||||||
| extern const Icon I_BadUsb_9x8; | extern const Icon I_BadUsb_9x8; | ||||||
| extern const Icon I_PlaceholderR_30x13; | extern const Icon I_PlaceholderR_30x13; | ||||||
| extern const Icon I_Background_128x8; | extern const Icon I_Background_128x8; | ||||||
|  | |||||||
| Before Width: | Height: | Size: 369 B | 
| Before Width: | Height: | Size: 368 B | 
| @ -1 +0,0 @@ | |||||||
| 10 |  | ||||||
| Before Width: | Height: | Size: 359 B | 
| Before Width: | Height: | Size: 350 B | 
| Before Width: | Height: | Size: 350 B | 
| Before Width: | Height: | Size: 356 B | 
| @ -1 +0,0 @@ | |||||||
| 10 |  | ||||||
| Before Width: | Height: | Size: 382 B | 
| Before Width: | Height: | Size: 383 B | 
| Before Width: | Height: | Size: 383 B | 
| Before Width: | Height: | Size: 381 B | 
| @ -1 +0,0 @@ | |||||||
| 10 |  | ||||||
| Before Width: | Height: | Size: 356 B | 
| Before Width: | Height: | Size: 365 B | 
| Before Width: | Height: | Size: 363 B | 
| @ -1 +0,0 @@ | |||||||
| 10 |  | ||||||
| Before Width: | Height: | Size: 384 B | 
| Before Width: | Height: | Size: 390 B | 
| Before Width: | Height: | Size: 382 B | 
| @ -1 +0,0 @@ | |||||||
| 10 |  | ||||||
| Before Width: | Height: | Size: 357 B | 
| Before Width: | Height: | Size: 363 B | 
| Before Width: | Height: | Size: 366 B | 
| @ -1 +0,0 @@ | |||||||
| 10 |  | ||||||
| Before Width: | Height: | Size: 380 B | 
| Before Width: | Height: | Size: 389 B | 
| Before Width: | Height: | Size: 383 B | 
| @ -1 +0,0 @@ | |||||||
| 10 |  | ||||||
| Before Width: | Height: | Size: 356 B | 
| Before Width: | Height: | Size: 338 B | 
| Before Width: | Height: | Size: 340 B | 
| Before Width: | Height: | Size: 325 B | 
| Before Width: | Height: | Size: 346 B | 
| Before Width: | Height: | Size: 1.0 KiB | 
| Before Width: | Height: | Size: 1.0 KiB | 
| Before Width: | Height: | Size: 1.0 KiB | 
| Before Width: | Height: | Size: 304 B | 
| Before Width: | Height: | Size: 302 B | 
| Before Width: | Height: | Size: 1.0 KiB | 
| Before Width: | Height: | Size: 124 B | 
| Before Width: | Height: | Size: 118 B | 
| Before Width: | Height: | Size: 131 B | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.0 KiB | 
| Before Width: | Height: | Size: 318 B | 
| Before Width: | Height: | Size: 306 B | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.2 KiB | 
| Before Width: | Height: | Size: 1.2 KiB | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.2 KiB | 
| Before Width: | Height: | Size: 1.5 KiB | 
| Before Width: | Height: | Size: 1.5 KiB | 
| Before Width: | Height: | Size: 1.5 KiB | 
| Before Width: | Height: | Size: 1.5 KiB | 
| Before Width: | Height: | Size: 1.5 KiB | 
| Before Width: | Height: | Size: 1.5 KiB | 
| Before Width: | Height: | Size: 1.5 KiB | 
| Before Width: | Height: | Size: 1.5 KiB | 
| Before Width: | Height: | Size: 1.5 KiB | 
| Before Width: | Height: | Size: 1.4 KiB | 
| Before Width: | Height: | Size: 1.4 KiB | 
| Before Width: | Height: | Size: 1.4 KiB | 
| Before Width: | Height: | Size: 1.4 KiB | 
| Before Width: | Height: | Size: 1.4 KiB | 
| Before Width: | Height: | Size: 1.4 KiB | 
| Before Width: | Height: | Size: 1.3 KiB | 
| Before Width: | Height: | Size: 1.3 KiB | 
| Before Width: | Height: | Size: 1.3 KiB | 
| Before Width: | Height: | Size: 1.4 KiB | 
| Before Width: | Height: | Size: 1.4 KiB | 
| Before Width: | Height: | Size: 1.4 KiB | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.1 KiB | 
| Before Width: | Height: | Size: 1.1 KiB | 
 its your bedtime
						its your bedtime