?login_element?

Subversion Repositories NedoOS

Rev

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

  1. #ifndef LEVEL1_C
  2. #define LEVEL1_C
  3. #include "gameloop.c"
  4. #include "level_fragments.h"
  5. #include "engine.c"
  6. #include "resources.h"
  7. #include "dialogs.c"
  8. #include "gameloop.c"
  9. #include "level2.c"
  10. #include "interpreter.c"
  11.  
  12. //static void init_level(u8 image);
  13. static void init_level(u8 pal, char *fn);
  14. static void start_level(u8 pal, char *fn, u8 *name);
  15.  
  16. static void dialog_level1();
  17.  
  18. static void prepare_boss1()
  19. {
  20.     flush_sprites();
  21. music_stop();
  22. init_level(PAL256_BG2, "bg2-16.bmp");
  23.     music_play(MUS_NWZ);
  24.     dialog_level1();
  25.     bullet_sprite = MARISA_BULLET;
  26.     //init_level(IMG256_BG2);
  27. unpack_pal256(PAL256_BG2, 0);
  28.     scroll_pos = 192;
  29.     push_npc(144, 20, 0, 0, MARISA, 255, 1500, 1);
  30. }
  31.  
  32. static void l1f_dialog()
  33. {
  34.     init_dialog(); //TODO почему где-то здесь приостанавливается музыка?
  35.     swap_screen();
  36.     put_dialog_string(MARISA_FACE, "Cool down, Reimu!", 0);
  37.     put_dialog_string(REIMU_FACE, "???", 1);
  38.     put_dialog_string(MARISA_FACE, "I've heard buzzing\nfairies near Shrine.", 0);
  39.     put_dialog_string(REIMU_FACE, "Welll...\nThese insects will subside\nnow.", 1);
  40. //swap_screen();
  41.     wait_for_space();
  42.     init_level2();
  43. }
  44.  
  45. static void process_boss1()
  46. {
  47.     Npc *boss;
  48.     i8 b;
  49.     u8 c;
  50.     if (scroll_pos < 2)
  51.         scroll_speed = 0;
  52.  
  53.     boss = find_npc_by_type(BOSS_TYPE);
  54.     if (boss == 0)
  55.     {
  56.         l1f_dialog();
  57.         return;
  58.     }
  59.  
  60.     switch (level_loop)
  61.     {
  62.     case 1:
  63.         boss->sprite.dx = -1;
  64.         break;
  65.         just_star(2, boss->sprite.x + 16, boss->sprite.y + 16);
  66.         just_star(6, boss->sprite.x + 16, boss->sprite.y + 16);
  67.         just_star(11, boss->sprite.x + 16, boss->sprite.y + 16);
  68.     case 13:
  69.         boss->sprite.dx = 1;
  70.         break;
  71.         boss_shoot1(16, boss->sprite.x + 16, boss->sprite.y + 16);
  72.         just_star(26, boss->sprite.x + 16, boss->sprite.y + 16);
  73.         just_star(31, boss->sprite.x + 16, boss->sprite.y + 16);
  74.         just_star(36, boss->sprite.x + 16, boss->sprite.y + 16);
  75.         boss_shoot1(41, boss->sprite.x + 16, boss->sprite.y + 16);
  76.     case 57:
  77.         boss->sprite.dx = -1;
  78.         break;
  79.         boss_shoot1(58, boss->sprite.x + 16, boss->sprite.y + 16);
  80.     case 90:
  81.         boss->sprite.dx = 0;
  82.         break;
  83.         boss_shoot1(91, boss->sprite.x + 16, boss->sprite.y + 16);
  84.     case 120:
  85.         level_loop = 0;
  86.         for (c = 0; c < 5; c++)
  87.             push_bonus(BONUS_CARD, boss->sprite.x + 16, boss->sprite.y + 16, 3 - (c * 2), 2);
  88.     default:
  89.         break;
  90.     }
  91. }
  92.  
  93. static void dialog_level1()
  94. {
  95.     init_dialog();
  96.     swap_screen();
  97.     put_dialog_string(REIMU_FACE, "Have you seen my donation\nbox?", POSITION_LEFT);
  98.     put_dialog_string(MARISA_FACE, "Where was no money?!\nWho will need it?", POSITION_RIGHT);
  99.     put_dialog_string(REIMU_FACE, "I'll beat you for these\nwords!", POSITION_LEFT);
  100. //swap_screen();
  101.     wait_for_space();
  102. }
  103.  
  104. const u8 level1_bytecode[] = {
  105.     Nop(5),
  106.     MakeEnemiesPair(FAIRY, 1, 10),
  107.     Nop(5),
  108.     MakeCaravan(16, FIARY2, 2, 10, BONUS_CARD),
  109.     Nop(5),
  110.     MakeLeftFlyers(160, GHOST, 10, BONUS_CARD),
  111.     MakeRightFlyers(100, GHOST, 10, BONUS_CARD),
  112.     Nop(20),
  113.     MakeBoomFairy(32, 30, HEALTH_CARD),
  114.     Nop(15),
  115.     MakeBoomFairy(200, 30, HEALTH_CARD),
  116.     Nop(20),
  117.     MakeEnemyWave(FIARY3, 1, 15),
  118.     MidBoss1(GHOST, 255),
  119.     DoubleCaravan(FAIRY, 5, 25, BONUS_CARD),
  120.     Nop(20),
  121.     MakeBoomFairy(160, 30, HEALTH_CARD),
  122.     MakeLeftFlyers(160, FAIRY, 10, 0),
  123.     MakeRightFlyers(100, FIARY3, 10, 0),
  124.     MakeLeftFlyers(32, FIARY2, 10, 0),
  125.     JustStar(160, 120, 3),
  126.     Nop(10),
  127.     JustStar(32, 32, 1),
  128.     JustStar(210, 132, 1),
  129.     Nop(10),
  130.     MakeShootingStar(160, 100, INJAN, 10, 20),
  131.     Nop(15),
  132.     MakeShootingStar(64, 64, INJAN, 10, 20),
  133.     Nop(15),
  134.     MakeShootingStar(256, 64, INJAN, 10, 20),
  135.     Nop(20),
  136.     PushNpc(160, -10, 0, 1, MARISA, 255, 1024, 0),
  137.     Nop(10),
  138.     End };
  139.  
  140. static void process_level1()
  141. {
  142.     if (executing) {
  143.         vm_step();
  144.     } else {
  145.         prepare_boss1();
  146.         process_level = process_boss1;
  147.     }
  148. }
  149.  
  150. #endif