#include #include #include /*#include */ #include #include /*#include */ #include #include #include "main.h" #include "progress.h" #include "levelpack.h" #include "draw_paths.h" #include "draw_menu.h" #include "draw.h" #include "menu.h" uint8_t global_date; uint8_t keys_test(void) { kb_Scan(); return (kb_Data[6] & (kb_Enter | kb_Clear)); } uint8_t keys_test_dir(void) { uint8_t direction = 0; uint8_t count = 0; kb_key_t key = kb_Data[7]; if ((key & kb_Up ) | (kb_Data[4] & kb_8)) { direction = DIR_U; ++count; } if ((key & kb_Down ) | (kb_Data[4] & kb_2)) { direction = DIR_D; ++count; } if ((key & kb_Left ) | (kb_Data[3] & kb_4)) { direction = DIR_L; ++count; } if ((key & kb_Right) | (kb_Data[5] & kb_6)) { direction = DIR_R; ++count; } return count == 1 ? direction : DIR_0; } uint8_t keys_wait(void) { uint8_t key; while (keys_test()); // waits for a previously pressed key to be released while (!(key = keys_test())); // waits for the player to press a key while (keys_test()); // waits for the player to release the key return key; } /*void print_text(int8_t xpos, int8_t ypos, const char *text) { os_SetCursorPos(ypos, xpos); os_PutStrLine(text); }*/ /*void print_number(int8_t xpos, int8_t ypos, uint16_t value) { static char str[6]; sprintf(str, "%u", value); print_text(xpos + 5 - strlen(str), ypos, str); }*/ void main(void) { uint16_t year; uint8_t month, day; boot_GetDate(&day, &month, &year); global_date = month * 31 + day; draw_ground_init(); draw_roads_init(); draw_paths_init(); draw_menu_init(); ti_CloseAll(); progress_load(); levelpack_play(); progress_save(); os_ClrHome(); }