draw_states.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. #include "draw_states.h"
  2. #include "fxlib.h"
  3. #include "fixed.h"
  4. #include <stdio.h>
  5. // static functions
  6. static void fillBackground(Game_Data *data);
  7. static void draw_big_num(unsigned char *txt, int x, int y, unsigned char isReversed);
  8. static void drawPlayer(Game_Data *data, int player_angle);
  9. static void drawPolygon(Game_Data *data, int nb_lines, Line_Transition line_transition);
  10. static void drawDiagonals(Game_Data *data, int nb_lines, Line_Transition line_transition);
  11. static void drawHud(Game_Data *data);
  12. static void drawChrono(Game_Data *data);
  13. static int getLevel(Game_Data *data);
  14. static unsigned int length_of_print_string(unsigned char* txt);
  15. static void drawTopLeftCornerText(unsigned char* txt, unsigned char isReversed);
  16. static void drawTopRightCornerText(unsigned char* txt, unsigned char isReversed);
  17. static void drawBottomLeftCornerText(unsigned char* txt, unsigned char isReversed);
  18. static void drawBottomRightCornerText(unsigned char* txt, unsigned char isReversed);
  19. static const unsigned char title_spr[] = {0x07, 0xF6, 0x1B, 0xFD, 0xFE, 0xFE, 0x00, 0x00, 0x0F, 0xF6, 0x1B, 0xFD, 0xFE, 0xFF, 0x00, 0x00, 0x0C, 0x06, 0x1B, 0x0D, 0x80, 0xC3, 0x00, 0x00, 0x0F, 0xF6, 0x1B, 0x0D, 0xFE, 0xC3, 0x00, 0x00, 0x0F, 0xF6, 0x1B, 0xFD, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x36, 0x1B, 0xF9, 0x80, 0xFF, 0x00, 0x00, 0x0F, 0xF7, 0xFB, 0x01, 0xFE, 0xC3, 0x00, 0x00, 0x0F, 0xE3, 0xFB, 0x00, 0xFE, 0xC3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC3, 0x7F, 0xB0, 0xCF, 0xEF, 0xF3, 0xFB, 0xF8, 0xC3, 0x7F, 0xB0, 0xDF, 0xEF, 0xF7, 0xFB, 0xFC, 0xC3, 0x60, 0x30, 0xD8, 0x6C, 0x06, 0x1B, 0x0C, 0xFF, 0x7F, 0xBF, 0xD8, 0x6C, 0x36, 0x1B, 0x0C, 0xFF, 0x7F, 0x9F, 0x9F, 0xEC, 0x36, 0x1B, 0x0C, 0xC3, 0x60, 0x30, 0xDF, 0xEC, 0x36, 0x1B, 0x0C, 0xC3, 0x7F, 0xB0, 0xD8, 0x6F, 0xF7, 0xFB, 0x0C, 0xC3, 0x3F, 0xB0, 0xD8, 0x6F, 0xE7, 0xF3, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x9F, 0xCF, 0xEF, 0xF3, 0xF8, 0x00, 0x00, 0x7F, 0xBF, 0xDF, 0xEF, 0xF7, 0xF8, 0x00, 0x00, 0x60, 0x30, 0xD8, 0x01, 0x86, 0x18, 0x00, 0x00, 0x60, 0x30, 0xDF, 0xE1, 0x86, 0x18, 0x00, 0x00, 0x60, 0x3F, 0xDF, 0xE1, 0x86, 0x18, 0x00, 0x00, 0x60, 0x3F, 0xC0, 0x61, 0x86, 0x18, 0x00, 0x00, 0x7F, 0xB0, 0xDF, 0xEF, 0xF7, 0xF8, 0x00, 0x00, 0x3F, 0xB0, 0xDF, 0xCF, 0xF7, 0xF0, 0x00};
  20. static const unsigned char hex_border_top_left[8] = {0xF0, 0xF0, 0xE0, 0xE0, 0xC0, 0xC0, 0x80, 0x80};
  21. static const unsigned char hex_border_top_right[8] ={0x1F, 0x1F, 0x0F, 0x0F, 0x07, 0x07, 0x03, 0x03};
  22. static const unsigned char hex_border_bottom_left[8] = {0x80, 0x80, 0xC0, 0xC0, 0xE0, 0xE0, 0xF0, 0xF0};
  23. static const unsigned char hex_border_bottom_right[8] ={0x03, 0x03, 0x07, 0x07, 0x0F, 0x0F, 0x1F, 0x1F};
  24. static const unsigned char hex_border_top_left_rev[8] = {0x0F, 0x0F, 0x1F, 0x1F, 0x3F, 0x3F, 0x7F, 0x7F};
  25. static const unsigned char hex_border_top_right_rev[8] ={0xE0, 0xE0, 0xF0, 0xF0, 0xF8, 0xF8, 0xFC, 0xFC};
  26. static const unsigned char hex_border_bottom_left_rev[8] = {0x7F, 0x7F, 0x3F, 0x3F, 0x1F, 0x1F, 0x0F, 0x0F};
  27. static const unsigned char hex_border_bottom_right_rev[8] ={0xFC, 0xFC, 0xF8, 0xF8, 0xF0, 0xF0, 0xE0, 0xE0};
  28. static const unsigned char big_hex_border_left[] = {128,128,192,192,224,224,240,240,248,248};
  29. static const unsigned char big_hex_border_left_rev[] = {248,248,120,120,56,56,24,24,8,8};
  30. // 44*8
  31. static const unsigned char level_spr[] = {192,127,176,223,236,0,192,127,176,223,236,0,192,96,48,216,12,0,192,127,176,223,236,0,192,127,176,223,236,0,192,96,48,216,12,0,255,127,191,223,239,240,127,63,191,143,231,240};
  32. static const unsigned char level_spr_rev[] = {63,128,79,32,19,240,63,128,79,32,19,240,63,159,207,39,243,240,63,128,79,32,19,240,63,128,79,32,19,240,63,159,207,39,243,240,0,128,64,32,16,0,128,192,64,112,24,0};
  33. static const unsigned char num_0[] = {127,255,195,195,195,195,255,254};
  34. static const unsigned char num_1[] = {240,248,24,24,24,24,255,255};
  35. static const unsigned char num_2[] = {255,255,3,127,254,192,255,255};
  36. static const unsigned char num_3[] = {254,255,3,255,255,3,255,254};
  37. static const unsigned char num_4[] = {195,195,195,255,127,3,3,3};
  38. static const unsigned char num_5[] = {255,255,192,254,127,3,255,255};
  39. static const unsigned char num_6[] = {255,255,192,254,255,195,255,255};
  40. static const unsigned char num_7[] = {254,255,3,3,3,3,3,3};
  41. static const unsigned char num_8[] = {127,255,195,255,255,195,255,254};
  42. static const unsigned char num_9[] = {255,255,195,255,127,3,255,255};
  43. static const unsigned char num_0_rev[] = {128,0,60,60,60,60,0,1};
  44. static const unsigned char num_1_rev[] = {15,7,231,231,231,231,0,0};
  45. static const unsigned char num_2_rev[] = {0,0,252,128,1,63,0,0};
  46. static const unsigned char num_3_rev[] = {1,0,252,0,0,252,0,1};
  47. static const unsigned char num_4_rev[] = {60,60,60,0,128,252,252,252};
  48. static const unsigned char num_5_rev[] = {0,0,63,1,128,252,0,0};
  49. static const unsigned char num_6_rev[] = {0,0,63,1,0,60,0,0};
  50. static const unsigned char num_7_rev[] = {1,0,252,252,252,252,252,252};
  51. static const unsigned char num_8_rev[] = {128,0,60,0,0,60,0,1};
  52. static const unsigned char num_9_rev[] = {0,0,60,0,128,252,0,0};
  53. static const unsigned char *num_tab[10] = {
  54. num_0,
  55. num_1,
  56. num_2,
  57. num_3,
  58. num_4,
  59. num_5,
  60. num_6,
  61. num_7,
  62. num_8,
  63. num_9
  64. };
  65. static const unsigned char *num_tab_rev[10] = {
  66. num_0_rev,
  67. num_1_rev,
  68. num_2_rev,
  69. num_3_rev,
  70. num_4_rev,
  71. num_5_rev,
  72. num_6_rev,
  73. num_7_rev,
  74. num_8_rev,
  75. num_9_rev
  76. };
  77. static const unsigned char *step_text[6] = {
  78. "Point",
  79. "Line",
  80. "Triangle",
  81. "Square",
  82. "Pentagon",
  83. "Hexagon"
  84. };
  85. void draw_game(Game_Data *data)
  86. {
  87. fillBackground(data);
  88. // draw the player and the lines
  89. drawPlayer(data, data->player_angle);
  90. drawPolygon(data, data->nb_lines, data->line_transition);
  91. drawDiagonals(data, data->nb_lines, data->line_transition);
  92. // showing the walls
  93. if(data->list != NULL)
  94. drawWalls(data->list, data, data->nb_lines, data->line_transition);
  95. drawHud(data);
  96. }
  97. void draw_title(Game_Data *data)
  98. {
  99. fillBackground(data);
  100. ML_bmp_or(title_spr, 12, (64-26)/2, 62, 26);
  101. drawPolygon(data, data->nb_lines, data->line_transition);
  102. drawDiagonals(data, data->nb_lines, data->line_transition);
  103. drawBottomLeftCornerText("Press Shift", data->are_colors_reversed);
  104. drawTopRightCornerText("By Eiyeron & Adbook", data->are_colors_reversed);
  105. }
  106. void draw_menu(Game_Data *data)
  107. {
  108. fillBackground(data);
  109. drawPolygon(data, data->nb_lines, data->line_transition);
  110. drawDiagonals(data, data->nb_lines, data->line_transition);
  111. drawTopRightCornerText(data->entry_difficulties[data->current_entry - 1], data->are_colors_reversed);
  112. if(data->current_entry > 3) {
  113. // Hyper Mode
  114. drawBottomRightCornerText("Hyper Mode", data->are_colors_reversed);
  115. }
  116. }
  117. void draw_game_over(Game_Data *data)
  118. {
  119. const int time_y_position = 21;
  120. const int time_border_y_position = time_y_position - 1;
  121. const int time_bottom_border_y_position = time_border_y_position + 9;
  122. const int level_y_position = 10;
  123. const int level_border_y_position = level_y_position - 1;
  124. const int level_bottom_border_y_position = level_border_y_position + 9;
  125. const int x_offset = 2;
  126. const int level_num_x_position = 44+2 + x_offset; // offset from level sprite
  127. int time_length;
  128. unsigned char int_time_text[32];
  129. unsigned char decimal_text[32];
  130. unsigned char level_text[2] = "0";
  131. level_text[0] = getLevel(data) + '1';
  132. sprintf(int_time_text, "%u", (int)data->chrono_time);
  133. sprintf(decimal_text, ":%02u", (int)(data->chrono_time*100)%100);
  134. time_length = time_length = 9*strlen(int_time_text);
  135. fillBackground(data);
  136. drawPolygon(data, data->nb_lines, data->line_transition);
  137. drawDiagonals(data, data->nb_lines, data->line_transition);
  138. if(!data->are_colors_reversed) {
  139. ML_rectangle(0, level_border_y_position, level_num_x_position + 9, level_bottom_border_y_position, 0, BLACK, BLACK);
  140. ML_bmp_or(big_hex_border_left, level_num_x_position + 9, level_border_y_position, 5, 10);
  141. ML_bmp_and(level_spr_rev, x_offset, level_y_position, 44, 8);
  142. ML_rectangle(0, time_border_y_position, time_length + 3*4, time_bottom_border_y_position, 0, BLACK, BLACK);
  143. ML_bmp_or(big_hex_border_left, time_length + 3*4, time_border_y_position, 5, 10);
  144. PrintMini(time_length + x_offset, time_y_position, decimal_text, MINI_REV);
  145. }
  146. else {
  147. ML_rectangle(0, level_border_y_position, level_num_x_position + 9, level_bottom_border_y_position, 0, WHITE, WHITE);
  148. ML_bmp_and(big_hex_border_left_rev, level_num_x_position + 9 + 1, level_border_y_position, 4, 10);
  149. ML_bmp_or(level_spr, x_offset, level_y_position, 44, 8);
  150. ML_rectangle(0, time_border_y_position, time_length + 3*4, time_bottom_border_y_position, 0, WHITE, WHITE);
  151. ML_bmp_and(big_hex_border_left_rev, time_length + 3*4 + 1, time_border_y_position, 4, 10);
  152. PrintMini(time_length + x_offset, time_y_position, decimal_text, MINI_OVER);
  153. }
  154. draw_big_num(level_text, level_num_x_position, level_y_position, !data->are_colors_reversed);
  155. draw_big_num(int_time_text, x_offset, time_y_position, !data->are_colors_reversed);
  156. drawTopLeftCornerText(step_text[getLevel(data)], data->are_colors_reversed);
  157. drawBottomRightCornerText("Shift to retry", data->are_colors_reversed);
  158. }
  159. static void fillBackground(Game_Data *data) {
  160. if(data->are_colors_reversed) {
  161. int i, end, *pointer_long, vram;
  162. char *pointer_byte;
  163. vram = (int)ML_vram_adress();
  164. end = 4-vram&3;
  165. pointer_byte = (char*)vram;
  166. for(i=0 ; i<end ; i++) pointer_byte[i] = 0xFF;
  167. pointer_long = (int*) (vram+end);
  168. for(i=0 ; i<255 ; i++) pointer_long[i] = 0xFFFFFFFF;
  169. pointer_byte += 1020+end;
  170. end = vram&3;
  171. for(i=0 ; i<end ; i++) pointer_byte[i] = 0xFF;
  172. } else {
  173. ML_clear_vram();
  174. }
  175. }
  176. static void drawChrono(Game_Data *data) {
  177. unsigned char time_text[32] = "";
  178. sprintf(time_text, "%.2f", data->chrono_time);
  179. if(data->chrono_time < 60) {
  180. // Drawing the text with the little progress bar. As I offset the text,
  181. // I need to remake the whole routine.
  182. ML_Color drawing_color = data->are_colors_reversed ? WHITE : BLACK;
  183. unsigned int text_color = data->are_colors_reversed ? MINI_OVER : MINI_REV;
  184. unsigned short length_of_time, length_of_time_line;
  185. length_of_time = strlen(time_text);
  186. length_of_time_line = 4 * length_of_time;
  187. PrintMini(0, 0, time_text, text_color);
  188. ML_horizontal_line(6, 0, (data->chrono_time/60.) * (length_of_time_line - 2), drawing_color);
  189. ML_horizontal_line(7, 0, length_of_time_line - 1, drawing_color);
  190. if(!data->are_colors_reversed) {
  191. ML_bmp_8_or(hex_border_top_left, length_of_time_line, 0);
  192. } else {
  193. ML_bmp_8_and(hex_border_top_left_rev, length_of_time_line, 0);
  194. }
  195. }
  196. else {
  197. drawTopLeftCornerText(time_text, data->are_colors_reversed);
  198. }
  199. }
  200. static int getLevel(Game_Data *data) {
  201. unsigned short step_time[5] = {
  202. 10,
  203. 20,
  204. 30,
  205. 45,
  206. 60
  207. };
  208. unsigned short current_step, i;
  209. current_step = 5;
  210. for(i = 0; i < 5; i++) {
  211. if(data->chrono_time < step_time[i]) {
  212. current_step = i;
  213. break;
  214. }
  215. }
  216. return current_step;
  217. }
  218. static void drawHud(Game_Data *data) {
  219. drawChrono(data);
  220. drawTopRightCornerText(step_text[getLevel(data)], data->are_colors_reversed);
  221. }
  222. static void drawPolygon(Game_Data *data, int nb_lines, Line_Transition line_transition) {
  223. int x[32];
  224. int y[32];
  225. int i = 0;
  226. int angle = 0;
  227. Camera* cam= &data->cam;
  228. ML_Color drawing_color = data->are_colors_reversed ? WHITE : BLACK;
  229. float tmp_angle = 0.0;
  230. float transition_angle = 0.0;
  231. float delta_angle = 0.0;
  232. if(line_transition.delta_nb_lines == 1)
  233. nb_lines ++;
  234. if(line_transition.counter_start != 0)
  235. transition_angle = (360.0 / (float)nb_lines) * ((float)line_transition.counter / (float)line_transition.counter_start);
  236. delta_angle = 360.0/nb_lines;
  237. do
  238. {
  239. // TODO : use fixed for only two trig calls?
  240. x[i] = (8. + cam->zoom)*cos(PI * (tmp_angle + cam->angle)/180.) + cam->cX;
  241. y[i] = (8. + cam->zoom)*sin(PI * (tmp_angle + cam->angle)/180.) + cam->cY;
  242. i++;
  243. switch(line_transition.delta_nb_lines)
  244. {
  245. case 0:
  246. tmp_angle += delta_angle;
  247. break;
  248. case 1:
  249. if(i < nb_lines)
  250. tmp_angle += (360 - (delta_angle - transition_angle)) / (nb_lines - 1);
  251. else
  252. tmp_angle += delta_angle - transition_angle;
  253. break;
  254. case -1:
  255. if(i < nb_lines)
  256. tmp_angle += (360 - transition_angle) / (nb_lines - 1);
  257. else
  258. tmp_angle = transition_angle;
  259. break;
  260. }
  261. }while(i <= nb_lines);
  262. // draw the aforementionned circle, depending on the camera's center
  263. // ML_filled_circle(cam.cX, cam.cY, 6, BLACK);
  264. ML_polygone(x, y, nb_lines, drawing_color);
  265. // draw the player. At such a low scale, it was impossible to draw a rotating triangle, so its a radius 1 circle instead.
  266. // TODO : Replace it for a quick sprite blit, or unwrapped ML_pixel procedure.
  267. }
  268. // draws the player
  269. // at first, was supposed to draw an hexagon in the center, plus a triangle to show the player,
  270. // but the hexagon was not visible, and it was a pixel mess, so we're showing a circle instead.
  271. // there is still for code to calculate the vertices of the hexagon, in case we want to change that again
  272. static void drawPlayer(Game_Data *data, int player_angle)
  273. {
  274. ML_Color drawing_color = data->are_colors_reversed ? WHITE : BLACK;
  275. ML_filled_circle((9. + data->cam.zoom)*cos( PI*(player_angle + data->cam.angle)/180) + data->cam.cX, (9. + data->cam.zoom)*sin( PI*(player_angle+data->cam.angle)/180) + data->cam.cY, 1, drawing_color);
  276. }
  277. // draws one of the three rotating lines
  278. static void drawDiagonals(Game_Data *data, int nb_lines, Line_Transition line_transition)
  279. {
  280. fix tmp_angle = FIX(data->cam.angle);
  281. int i = 0;
  282. fix x1 = 0, y1 = 0, x2 = 0, y2 = 0;
  283. fix delta_angle = 0;
  284. fix coeff = 0;
  285. fix transition_angle = 0;
  286. ML_Color drawing_color = data->are_colors_reversed ? WHITE : BLACK;
  287. delta_angle = fdiv(FIX(360), FIX(nb_lines));
  288. if(line_transition.delta_nb_lines == 1)
  289. nb_lines ++;
  290. if(line_transition.counter_start != 0)
  291. coeff = fdiv(FIX(line_transition.counter), FIX(line_transition.counter_start));
  292. transition_angle = fmul(delta_angle, coeff);
  293. do{
  294. x1 = fmul(FIX(9) + ftofix(data->cam.zoom), fcos(tmp_angle));
  295. y1 = fmul(FIX(9) + ftofix(data->cam.zoom), fsin(tmp_angle));
  296. x2 = fmul(fcos(tmp_angle), FIX(128));
  297. y2 = fmul(fsin(tmp_angle), FIX(128));
  298. ML_line(UNFIX(x1) + data->cam.cX, UNFIX(y1) + data->cam.cY, UNFIX(x2) + data->cam.cX, UNFIX(y2) + data->cam.cY, drawing_color);
  299. i++;
  300. switch(line_transition.delta_nb_lines){
  301. case 0:
  302. tmp_angle += fdiv(FIX(360), FIX(nb_lines));
  303. break;
  304. case 1:
  305. if(i < nb_lines - 1)
  306. {
  307. tmp_angle += fdiv(FIX(360) - (delta_angle - transition_angle), FIX(nb_lines - 1));
  308. }else{
  309. tmp_angle += delta_angle - transition_angle;
  310. }
  311. break;
  312. case -1:
  313. if(i < nb_lines - 1)
  314. {
  315. tmp_angle += fdiv(FIX(360) - transition_angle, FIX(nb_lines - 1));
  316. }else{
  317. tmp_angle += transition_angle;
  318. }
  319. break;
  320. }
  321. if(tmp_angle >= FIX(360)) tmp_angle = tmp_angle - FIX(359);
  322. }while(i < nb_lines);
  323. }
  324. static unsigned int length_of_print_string(unsigned char* txt) {
  325. // TODO : define
  326. unsigned int text_length = 0;
  327. unsigned int i;
  328. unsigned int current_char_length = 0;
  329. for(i = 0; i < strlen(txt); i++) {
  330. switch(txt[i]) {
  331. // upper case
  332. case 'K':
  333. case 'M':
  334. case 'N':
  335. case 'Q':
  336. case 'W':
  337. current_char_length = 6;
  338. break;
  339. // lower case
  340. case 'i':
  341. current_char_length = 2;
  342. break;
  343. case 'n':
  344. case 'r':
  345. current_char_length = 5;
  346. break;
  347. case 'm':
  348. case 'w':
  349. current_char_length = 6;
  350. break;
  351. case '&':
  352. current_char_length = 5;
  353. break;
  354. case '[':
  355. case ']':
  356. current_char_length = 3;
  357. break;
  358. default:
  359. current_char_length = 4;
  360. break;
  361. }
  362. text_length += current_char_length;
  363. }
  364. return text_length;
  365. }
  366. static void drawTopLeftCornerText(unsigned char* txt, unsigned char isReversed) {
  367. ML_Color drawing_color = isReversed ? WHITE : BLACK;
  368. unsigned int text_color = isReversed ? MINI_OVER : MINI_REV;
  369. unsigned int text_length = length_of_print_string(txt);
  370. if(!isReversed) {
  371. ML_bmp_8_or(hex_border_top_left, text_length, 0);
  372. } else {
  373. ML_bmp_8_and(hex_border_top_left_rev, text_length, 0);
  374. }
  375. PrintMini(0, 1, txt, text_color);
  376. ML_horizontal_line(7, 0, text_length, drawing_color);
  377. }
  378. static void drawTopRightCornerText(unsigned char* txt, unsigned char isReversed) {
  379. ML_Color drawing_color = isReversed ? WHITE : BLACK;
  380. unsigned int text_color = isReversed ? MINI_OVER : MINI_REV;
  381. int text_length = length_of_print_string(txt);
  382. int xPosition = 128 - text_length;
  383. if(!isReversed) {
  384. ML_bmp_8_or(hex_border_top_right, xPosition - 8, 0);
  385. } else {
  386. ML_bmp_8_and(hex_border_top_right_rev, xPosition - 8, 0);
  387. }
  388. PrintMini(xPosition, 1, txt, text_color);
  389. ML_horizontal_line(7, xPosition, 127, drawing_color);
  390. }
  391. static void drawBottomLeftCornerText(unsigned char* txt, unsigned char isReversed) {
  392. ML_Color drawing_color = isReversed ? WHITE : BLACK;
  393. unsigned int text_length = length_of_print_string(txt);
  394. unsigned int text_color = isReversed ? MINI_OVER : MINI_REV;
  395. if(!isReversed) {
  396. ML_bmp_8_or(hex_border_bottom_left, text_length - 1, 56);
  397. } else {
  398. ML_bmp_8_and(hex_border_bottom_left_rev, text_length - 1, 56);
  399. }
  400. PrintMini(0, 57, txt, text_color);
  401. ML_horizontal_line(63, 0, text_length, drawing_color);
  402. }
  403. static void drawBottomRightCornerText(unsigned char* txt, unsigned char isReversed) {
  404. ML_Color drawing_color = isReversed ? WHITE : BLACK;
  405. unsigned int text_color = isReversed ? MINI_OVER : MINI_REV;
  406. int text_length = length_of_print_string(txt);
  407. int xPosition = 128 - text_length;
  408. if(!isReversed) {
  409. ML_bmp_8_or(hex_border_bottom_right, xPosition - 8, 56);
  410. } else {
  411. ML_bmp_8_and(hex_border_bottom_right_rev, xPosition - 8, 56);
  412. }
  413. ML_horizontal_line(63, xPosition, 127, drawing_color);
  414. PrintMini(xPosition, 57, txt, text_color);
  415. }
  416. static void draw_big_num(unsigned char *txt, int x, int y, unsigned char isReversed) {
  417. int i;
  418. for(i = 0; i < strlen(txt); i++) {
  419. if(txt[i] >= '0' && txt[i] <= '9')
  420. if(isReversed)
  421. ML_bmp_8_and(num_tab_rev[txt[i] - '0'], x + 9*i, y);
  422. else
  423. ML_bmp_8_or(num_tab[txt[i] - '0'], x + 9*i, y);
  424. }
  425. }