?login_element?

Subversion Repositories NedoOS

Rev

Rev 949 | Blame | Compare with Previous | Last modification | View Log | Download

  1. #ifndef DIALOGS_C
  2. #define DIALOGS_C
  3. //#include <evo.h>
  4. //#include "font.c"
  5. //#include "engine.c"
  6. //#include "sprite_pool.c"
  7.  
  8. //extern static u8 lifes;
  9. //extern static u16 score;
  10.  
  11. #define REIMU_FACE 130
  12. #define MARISA_FACE 146
  13. #define CIRNO_FACE 170
  14. #define MAID_FACE 186
  15. #define PACHU_FACE 202
  16. #define FLAN_FACE 218
  17.  
  18. #define POSITION_LEFT 1
  19. #define POSITION_RIGHT 0
  20.  
  21. #define FRAME 162
  22. #define FRAME_BOTTOM 169
  23. #define FRAME_RIGHT_TOP 163
  24. #define FRAME_RIGHT_BOTTOM 166
  25. #define FRAME_VERTICAL_RIGHT 167
  26. #define FRAME_VERTICAL_LEFT 168
  27. #define FRAME_LEFT_BOTTOM 164
  28. #define FRAME_LEFT_TOP 165
  29. void draw_face(u16 start_point)
  30. {
  31.     u8 i;
  32.     u8 position_x = text_x;
  33.     for (i = 0; i < 4; i++)
  34.     {
  35.         text_x = position_x;
  36.         put_char(start_point++);
  37.         put_char(start_point++);
  38.         put_char(start_point++);
  39.         put_char(start_point++);
  40.         text_y++;
  41.     }
  42.     text_y -= 3;
  43. }
  44.  
  45. void put_slow_str(u8 *str)
  46. {
  47.     u8 i;
  48.     while (1)
  49.     {
  50.         i = *str++;
  51.         if (!i)
  52.             break;
  53.         put_char(i);
  54.         swap_screen();
  55.     }
  56. }
  57.  
  58. void draw_frame(u8 position, u8 old_text_y)
  59. {
  60.     u8 c;
  61.     u8 bias = position ? 0 : 5;
  62.     u8 right = position ? 35 : 29;
  63.  
  64.     for (c = 5; c < right; c++)
  65.     {
  66.         text_x = c + bias;
  67.         text_y = old_text_y + 4;
  68.         put_char(FRAME_BOTTOM);
  69.         text_x = c + bias;
  70.         text_y = old_text_y;
  71.         put_char(FRAME);
  72.     }
  73.     text_y = old_text_y;
  74.     text_x = right + bias;
  75.     put_char(FRAME_RIGHT_TOP);
  76.     text_x = right + bias;
  77.     text_y = old_text_y + 4;
  78.     put_char(FRAME_RIGHT_BOTTOM);
  79.     for (c = 1; c < 4; c++)
  80.     {
  81.         text_x = right + bias;
  82.         text_y = old_text_y + c;
  83.         put_char(FRAME_VERTICAL_RIGHT);
  84.         text_x = 4 + bias;
  85.         put_char(FRAME_VERTICAL_LEFT);
  86.     }
  87.     text_x = 4 + bias;
  88.     text_y = old_text_y + 4;
  89.     put_char(FRAME_LEFT_BOTTOM);
  90.     text_x = 4 + bias;
  91.     text_y = old_text_y;
  92.     put_char(FRAME_LEFT_TOP);
  93. }
  94.  
  95. // position 1 - left, 0 - right
  96. void put_dialog_string(u16 avatar, u8 *phrase, u8 position)
  97. {
  98.     u8 old_text_y = text_y;
  99.     left_pad = 0;
  100.     text_x = position ? 0 : 35;
  101.     draw_face(avatar);
  102.     left_pad = position ? 5 : 10;
  103.     right_pad = position ? 34 : 34;
  104.     draw_frame(position, old_text_y);
  105.     text_y = old_text_y + 1;
  106.     text_x = position ? 5 : 10;
  107.     put_slow_str(phrase);
  108.     left_pad = 0;
  109.     right_pad = 40;
  110.     text_y = old_text_y + 6;
  111. }
  112.  
  113. void init_dialog()
  114. {
  115.     init_text();
  116.     player.y = STARTY/*321*/;
  117.     flush_sprites();
  118.     put_str(" Lives: ");
  119.     put_num(hp);
  120.     text_x = 25;
  121.     put_str(" Score: ");
  122.     put_num(score);
  123.     text_x = 0;
  124.     text_y += 2;
  125. }
  126.  
  127. #endif