?login_element?

Subversion Repositories NedoOS

Rev

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

  1. #ifndef LEVEL3_C
  2. #define LEVEL3_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 "sprite_pool.c"
  10. #include "level4.c"
  11.  
  12. //static void init_level(u8 image);
  13. //static void start_level(u8 image, u8 *name);
  14. static void init_level(u8 pal, char *fn);
  15. static void start_level(u8 pal, char *fn, u8 *name);
  16.  
  17. static void process_level3();
  18.  
  19. i16 px, py;
  20. u8 l3s = 0;
  21. const u8 l3intro[] = {
  22.     DroppedEnemy(40, KNIFES, 10),
  23.     DroppedEnemy(100, KNIFES, 10),
  24.     DroppedEnemy(20, KNIFES, 10),
  25.     DroppedEnemy(140, KNIFES, 10),
  26.     DroppedEnemy(80, KNIFES, 10),
  27.     DroppedEnemy(180, KNIFES, 10),
  28.     Nop(10),
  29.     End
  30. };
  31.  
  32. const u8 boss3[] = {
  33.     DroppedEnemy(20, KNIFES, 10),
  34.     DroppedEnemy(40, KNIFES, 10),
  35.     DroppedEnemy(100, KNIFES, 10),
  36.     Nop(20),
  37.     DroppedEnemy(30, KNIFES, 10),
  38.     DroppedEnemy(40, KNIFES, 10),
  39.     Nop(20),
  40.     AimedCircle(FIREBALL, 1, 1),
  41.     Nop(10),
  42.     AimedCircle(FIREBALL, 1, 1),
  43.     Nop(30),
  44.     DroppedEnemy(10, KNIFES, 10),
  45.     DroppedEnemy(90, KNIFES, 10),
  46.     Nop(20),
  47.     DroppedEnemy(20, KNIFES, 10),
  48.     DroppedEnemy(190, KNIFES, 10),
  49.     DroppedEnemy(140, KNIFES, 10),
  50.     Nop(30),
  51.     AimedCircle(FIREBALL, 1, 1),
  52.     Nop(10),
  53.     AimedCircle(FIREBALL, 1, 1),
  54.     Nop(10),
  55.     AimedCircle(FIREBALL, 1, 1),
  56.     Nop(40),
  57.     MarisaHelp,
  58.     Nop(20),
  59.     DroppedEnemy(20, KNIFES, 10),
  60.     DroppedEnemy(60, KNIFES, 10),
  61.     Nop(20),
  62.     DroppedEnemy(140, KNIFES, 10),
  63.     DroppedEnemy(130, KNIFES, 10),
  64.     DroppedEnemy(40, KNIFES, 10),
  65.     Nop(20),
  66.     End
  67. };
  68.  
  69. const u8 level3[] = {
  70.     MakeEnemyWave(EYE, 1, 20),
  71.     MakeLeftFlyers(70, BAT, 10, BONUS_CARD),
  72.     MakeRightFlyers(120, BAT, 10, BONUS_CARD),
  73.     MakeRightFlyers(15, BAT, 10, BONUS_CARD),
  74.     Nop(20),
  75.     MakeShootingStar(120, 64, FIREBALL, 20, 20),
  76.     Nop(20),
  77.     DroppedEnemy(20, KNIFES, 10),
  78.     DroppedEnemy(40, KNIFES, 10),
  79.     DroppedEnemy(100, KNIFES, 10),
  80.     DroppedEnemy(30, KNIFES, 10),
  81.     DroppedEnemy(40, KNIFES, 10),
  82.     Nop(10),
  83.     DroppedEnemy(120, KNIFES, 10),
  84.     DroppedEnemy(140, KNIFES, 10),
  85.     DroppedEnemy(10, KNIFES, 10),
  86.     DroppedEnemy(130, KNIFES, 10),
  87.     DroppedEnemy(140, KNIFES, 10),
  88.     Nop(20),
  89.     MakeBoomFairy(120, 40, HEALTH_CARD),
  90.     Nop(20),
  91.     DroppedEnemy(20, KNIFES, 10),
  92.     DroppedEnemy(40, KNIFES, 10),
  93.     DroppedEnemy(100, KNIFES, 10),
  94.     DroppedEnemy(30, KNIFES, 10),
  95.     DroppedEnemy(40, KNIFES, 10),
  96.     Nop(10),
  97.     DroppedEnemy(120, KNIFES, 10),
  98.     DroppedEnemy(140, KNIFES, 10),
  99.     DroppedEnemy(10, KNIFES, 10),
  100.     DroppedEnemy(130, KNIFES, 10),
  101.     DroppedEnemy(140, KNIFES, 10),
  102.     Nop(20),
  103.     AimedSideEnemies(KNIFE_LEFT, 10, 6),
  104.     Nop(20),
  105.     MarisaHelp,
  106.     Nop(10),
  107.     AimedCircle(FIREBALL, 5, 10),
  108.     Nop(20),
  109.     FiringTrap(EYE),
  110.     Nop(20),
  111.     TriangleHalf(1, BAT, 20, HEALTH_CARD),
  112.     Nop(10),
  113.     TriangleHalf(0, BAT, 20, HEALTH_CARD),
  114.     Nop(20),
  115.     MakeShootingStar(160, 70, FIREBALL, 33, 33),
  116.     Nop(20),
  117.     MidBoss1(EYE, 500),
  118.     Nop(20),
  119.     DoubleCaravan(BAT, 40, 50, BONUS_CARD),
  120.     Nop(20),
  121.     AimedCircle(FIREBALL, 5, 5),
  122.     Nop(5),
  123.     JustStar(80, 120, 5),
  124.     AimedCircle(FIREBALL, 5, 5),
  125.     DroppedEnemy(120, KNIFES, 10),
  126.     DroppedEnemy(140, KNIFES, 10),
  127.     DroppedEnemy(10, KNIFES, 10),
  128.     DroppedEnemy(130, KNIFES, 10),
  129.     DroppedEnemy(140, KNIFES, 10),
  130.     DroppedEnemy(120, KNIFES, 10),
  131.     DroppedEnemy(140, KNIFES, 10),
  132.     DroppedEnemy(10, KNIFES, 10),
  133.     DroppedEnemy(130, KNIFES, 10),
  134.     DroppedEnemy(140, KNIFES, 10),
  135.     Nop(20),
  136.     PushNpc(160, -20, 0, 1, MAID, 255, 1024, 0),
  137.     Nop(15),
  138.     End
  139. };
  140.  
  141. static void init_level3()
  142. {
  143.     level_loop = 0;
  144.     scroll_speed = 1;
  145.     process_level = process_level3;
  146.     flush_sprites();
  147.     //start_level(IMG256_BG5, "Scarlet Devil Mansion");
  148. start_level(PAL256_BG5, "bg5-16.bmp", "Scarlet Devil Mansion");
  149.     music_play(MUS_SISTERS);
  150.     bullet_sprite = DEFAULT_BULLET;
  151.     init_vm(l3intro);
  152.     l3s = 0;
  153.     state = STATE_PLAY;
  154. }
  155.  
  156. static void dialog_l3b()
  157. {
  158.     init_dialog();
  159.     swap_screen();
  160.     put_dialog_string(REIMU_FACE, "And here is the famous\nhospitality of the Scarlets.", 1);
  161. //swap_screen();
  162.     wait_for_space();
  163.     flush_sprites();
  164.     //init_level(IMG256_BG5);
  165. init_level(0/*PAL256_BG5*/, "bg5-16.bmp");
  166. unpack_pal256(PAL256_BG5, 0);
  167.     init_vm(level3);
  168. }
  169.  
  170. static void dialog_l3f()
  171. {
  172.     init_dialog();
  173.     swap_screen();
  174.     put_dialog_string(REIMU_FACE, "I've not asked you!\nI'm going to talk with\nPatchuly!", 1);
  175. //swap_screen();
  176.     wait_for_space();
  177.     flush_sprites();
  178.     init_level4();
  179. }
  180.  
  181. static void process_boss3()
  182. {
  183.     u8 c;
  184.     Npc *boss;
  185.  
  186.     if (scroll_pos < 4)
  187.     {
  188.         scroll_speed = -2;
  189.     }
  190.    
  191.     if (scroll_pos > 190) {
  192.         scroll_speed = 2;
  193.     }
  194.  
  195.     boss = find_npc_by_type(BOSS_TYPE);
  196.  
  197.     if (boss)
  198.     {
  199.         if (boss->sprite.x <= 20 || boss->sprite.x >= 280)
  200.         {
  201.             boss->sprite.dx = -boss->sprite.dx;
  202.             boss->sprite.x += boss->sprite.dx;
  203.         }
  204.         if (boss->sprite.y <= 20 || boss->sprite.y >= 120)
  205.         {
  206.             boss->sprite.dy = -boss->sprite.dy;
  207.             boss->sprite.y += boss->sprite.dy;
  208.         }
  209.     }
  210.     else
  211.     {
  212.         dialog_l3f();
  213.         return;
  214.     }
  215.  
  216.     if (executing) {
  217.         vm_step();
  218.     } else {
  219.         init_vm(boss3);
  220.     }
  221.  
  222.     if (level_loop % 15 < 6)
  223.         push_star(boss->sprite.x + 8, boss->sprite.y);
  224. }
  225.  
  226. static void dialog_l3m()
  227. {
  228. music_stop();
  229. init_level(PAL256_BG6, "bg6-16.bmp");
  230.     music_play(MUS_HARD);
  231.     init_dialog();
  232.     swap_screen();
  233.     put_dialog_string(MAID_FACE, "Hello!\nWe are too busy today!\nCome tomorrow please!", 0);
  234.     put_dialog_string(REIMU_FACE, "Did I ask about it?\nI need to talk with\nyour bookworm!", 1);
  235.     put_dialog_string(MAID_FACE, "No no no!\nPatchuly is veery busy\nnow!", 0);
  236. //swap_screen();
  237.     wait_for_space();
  238.     init_dialog();
  239.     swap_screen();
  240.     put_dialog_string(REIMU_FACE, "Who will ask you?", 1);
  241. //swap_screen();
  242.     wait_for_space();
  243.     //init_level(IMG256_BG6);
  244. unpack_pal256(PAL256_BG6, 0);
  245.     level_loop = 0;
  246.     process_level = process_boss3;
  247.     scroll_pos = 192;
  248.     scroll_speed = 2;
  249.     push_npc(144, 20, 2, 2, MAID, BOSS_TYPE, 1100, 1);
  250.     init_vm(boss3);
  251.     bullet_sprite = SAKUYA_BULLET;
  252. }
  253.  
  254.  
  255.  
  256. static void process_level3()
  257. {
  258.     if (executing) {
  259.         vm_step();
  260.     } else {
  261.         switch (l3s)
  262.         {
  263.         case 0:
  264.             l3s++;
  265.             dialog_l3b();
  266.             break;
  267.         case 1:
  268.             dialog_l3m();
  269.             break;
  270.         default:
  271.             break;
  272.         }
  273.     }
  274. }
  275. #endif