
    typedef char Message[40];
    Message GameMessage[10];

    int MessageState=0;
    int MessageFlag =0;
    int MessagePtr;
    int MessageStatus=0;

    void CallMessageBox(int TransparencyFlag)
	{

	if (MessageState==0)
	      {
	    MessageState =1;
	    MessageFlag  =TransparencyFlag;
	    MessagePtr   =random(10);
	    MessageStatus=0;
	      }
	}

    void DisplayMessageBox(void)
    {
    static int BlinkMessage;
    
      if (MessageState==0)return;

      if (MessageStatus++> 200){MessageState =0;}

      else
    {
    if (GameLoopCount%8==1)
    {
    Compliment(BlinkMessage);
    }

    if (BlinkMessage)
    PrintRomString(1,190,248,
    GameMessage[MessagePtr],MessageFlag);
    }
    }

    void Print (char string[80])
     {
      int kount;
       for (kount=0;kount<=strlen(string);kount++)
	{

	 printf("%c",string[kount]);
	 sound(4500);delay(2);nosound();
	 if (string[kount]==' '){

		 sound(2500);delay(10);nosound();} // TODO
	}
	printf("\n");
	sound(3500);delay(10);nosound();
    }//end print



    void Credits (void)
    {

      set_video_mode(text);
      textcolor(10);
      clrscr();

      Print(" Programmed By Kami (FasTics) in Collaboration With Khurram, ");
      Print(" FastIcs karachi.                       [1999-2k] ");
      Print(" ");
      Print(" This Game had been Made For The Sole Purpose Of Learning");
      Print(" And is Free For Distribution");
      Print(" It Was Made In Just A Short Notice Of 5 Days,");
      Print(" Therefore, It Is Not THAT Good");
      Print(" ");
      Print(" DISCLAIMER! Please Take Notice That This SoftWare is");
      Print(" Supplied On As Is Basis. ");
      Print(" I Am Not Responsible For Any Damage Caused To You, ");
      Print(" Your Computer Or Your GrandFather ");
      Print(" ");
      Print(" My Special Thanks To M.Raza, My Senior Who Helped Me Greatly");
      Print(" In My Initial Stages, I Will Do The Same To Everyone Who Is Not");
      Print(" A LalChee Person");
      Print(" ");

      Print(" Send Your Programming Requests To :> kami587@yahoo.com ");
      Print("                             Or To :> sher_dil@yahoo.com ");
      Print("  ");
      Print("                   Love, Kami To All Family And Friends ");
      Print(" Hit Any Key To Continue.");
      getch();
      set_video_mode(vga256);

      BITMAP MenuMap;
   FadeAway();
   bitmap_load("D:\\bitmaps\\Loading.bmp",&MenuMap);
   bitmap_show_buffer_db(&MenuMap,
   (SCREEN_WIDTH-MenuMap.width) >>1,
   (SCREEN_HEIGHT-MenuMap.height) >>1);
   show_double_buffer();
   FadeIn(&MenuMap);
   ChangePalette('b');

   farfree(MenuMap.data);

     }



   void PauseMenu (void)
   {
    nosound();
    FadeAway();
    set_video_mode(text);
    textcolor(10);
    clrscr();

    if (KeyboardInstalled)
     uninstall_keyboard();

Print(" Game Control Modes....");
Print(" This Game Can Support Upto 3 Kinds Of Control Mechanisms.");
Print(" ");
Print(" Mechanism # 1:>>");
Print(" This Gives Easy Interfacing Using The KeyBoard. ");
Print(" The CursorKeys Are The Directional Keys.");
Print(" The CntrlKeys Are The Horizontal Fire Keys.");
Print(" The AltKeys Are The HomingFire Keys.");
Print(" ");
Print(" Mechanism # 2:>>");
Print(" This Gives Easy Interfacing Using The Mouse. ");
Print(" The Mouse Absoloute Location Is The Same As Our Aircraft.");
Print(" The Mouse Keys Are The Combination Of All FirePower.");
Print(" ");
Print(" Mechanism # 3:>>");
Print(" This Gives Advanced Interfacing Using The Mouse. ");
Print(" The Mouse Acceleration Is Used To Control The Aircraft.");
Print(" The Mouse Keys Is The Combination Of All FirePower.");
Print(" ");
Print(" The Mouse Acceleration Can Be Set Anywhere In The Game.");
Print(" To Access This Menu Press The SpaceBar Key.");
Print(" ");
Print(" What Mode Do You Want To Enter ?");
printf(" Simply Enter A Choice (1-3)  ::> ");

    ControlMechanism=getch()-48;
    if ((ControlMechanism<1) || (ControlMechanism>3))
    ControlMechanism=1;

    delay(300);
    if (KeyboardInstalled)
    install_keyboard();


   FadeAway();
   set_video_mode(vga256);
   FadeAway();
   BITMAP MenuMap;
   bitmap_load("D:\\bitmaps\\Loading.bmp",&MenuMap);
   bitmap_show_buffer_db(&MenuMap,
   (SCREEN_WIDTH-MenuMap.width) >>1,
   (SCREEN_HEIGHT-MenuMap.height) >>1);
   show_double_buffer();
   FadeIn(&MenuMap);
   if (PalChanged)
   ChangePalette('b');
   farfree(MenuMap.data);



   }



    void Options (void)
    {
   nosound();
   BITMAP MenuMap;
   FadeAway();
   bitmap_load("D:\\bitmaps\\Loading.bmp",&MenuMap);
   bitmap_show_buffer_db(&MenuMap,
   (SCREEN_WIDTH-MenuMap.width) >>1,
   (SCREEN_HEIGHT-MenuMap.height) >>1);
   show_double_buffer();
   FadeIn(&MenuMap);
   farfree(MenuMap.data);
   ChangePalette('b');

    if (KeyboardInstalled)
     uninstall_keyboard();

    int Color = 248;
    int data = image.speed;
    image.speed=1;

    for (int i=180; i>=100 ; i--)
    {
    image.scroll_bitmap_horizontally_db();
    ScrollBackSprites();

    PrintRomString(10,i-90,Color,"              OPTION MENU  "		,1);
    PrintRomString(10,i-80,Color,"            aero blasters II "	,1);
    PrintRomString(10,i-50,Color,"              Player Lives "		,1);
    PrintRomString(6,i-40,Color, "                Continues "		,1);
    PrintRomString(6,i-30,Color, "                              "	,1);
    PrintRomString(6,i-20,Color, "           Mouse-y Sensitivity"	,1);
    PrintRomString(6,i-10,Color, "              Control Method"		,1);
    PrintRomString(6,i,Color,    "            Player Fire Speed"	,1);
    PrintRomString(6,i+10,Color, "                  Exit"		,1);

    waitretrace();
    show_double_buffer();
    }

    char str[40];
    int c[8];
    for(;;)
    {
    GameLoopCount++;
    c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=1;

    image.scroll_bitmap_horizontally_db();
    ScrollBackSprites();

    object[0].MouseScanControl2();
    object[0].InBoundary();
    object[0].sprite.LExhaustAir();
    object[0].sprite.paste_db();

    if (object[0].sprite.y > 110)
       c[7]=0;
    else
    if (object[0].sprite.y > 100)
       c[6]=0;
    else
    if (object[0].sprite.y > 90)
       c[5]=0;
    else
    if (object[0].sprite.y > 80)
       c[4]=0;
    else
    if (object[0].sprite.y > 70)
       c[3]=0;
    else
    if (object[0].sprite.y > 60)
       c[2]=0;
    else
    if (object[0].sprite.y > 50)
       c[1]=0;



    if (c[7]==0 && GetButton()==1)
    {delay(1000);image.speed=-1;break;}
    if (c[6]==0 && GetButton()==1)
    {
    sprintf(str,"Player Fire ::> %d",object[0].FireSpeed);
    PrintRomString(6,180,Color,str,0);
    PrintRomString(6,190,Color,"Please Enter New Value",1);
    waitretrace();
    show_double_buffer();
    object[0].FireSpeed=getch()-48;
    }
    if (c[5]==0 && GetButton()==1)
    {
    sprintf(str,"Control Mechanism ::> %d",ControlMechanism);
    PrintRomString(6,180,Color,str,0);
    PrintRomString(6,190,Color,"Please Enter New Value",1);
    waitretrace();
    show_double_buffer();
    ControlMechanism=getch()-48;
    if ((ControlMechanism<1) || (ControlMechanism>3))
    ControlMechanism=1;
    }
       if (c[4]==0 && GetButton()==1)
       {
    sprintf(str,"Mouse Mechanism");
    PrintRomString(6,180,Color,str,0);
    PrintRomString(6,190,Color,"Please Enter New x-cord Value (1-10)",0);
    waitretrace();
    show_double_buffer();
    int xx=(getch()-48)*10;
    if ((xx<1) || (xx>100))
    xx=50;
    sprintf(str,"Mouse Mechanism");
    PrintRomString(6,180,Color,str,0);
    PrintRomString(6,190,Color,"Please Enter New y-cord Value (1-10)",0);
    waitretrace();
    show_double_buffer();
    int yy=(getch()-48)*10;
    if ((yy<1) || (yy>100))
    yy=50;
    SenseMouse(xx,yy);
    }

       if (c[2]==0 && GetButton()==1)
       {
    sprintf(str,"Continues ::> %d",Continue);
    PrintRomString(6,180,Color,str,0);
    PrintRomString(6,190,Color,"Please Enter New Value",0);
    waitretrace();
    show_double_buffer();
    Continue=getch()-48;
    if ((Continue<1) || (Continue>100))
    Continue=5;
       }
       if (c[1]==0 && GetButton()==1)
       {
    sprintf(str,"Player Lives ::> %d",object[0].sprite.state);
    PrintRomString(6,180,Color,str,0);
    PrintRomString(6,190,Color,"Please Enter New Value",0);
    waitretrace();
    show_double_buffer();
    object[0].sprite.state=getch()-48;
    if ((object[0].sprite.state<1) || (object[0].sprite.state>3))
    object[0].sprite.state=5;
    }



    PrintRomString(10,100-90,Color,"              OPTION MENU  "		,1);
    PrintRomString(10,100-80,Color,"            aero blasters II "	,1);
    PrintRomString(10,100-50,Color,"              Player Lives           ",c[1]);
    PrintRomString(6,100-40,Color, "                Continues            ",c[2]);
    PrintRomString(6,100-30,Color, "                                     ",c[3]);
    PrintRomString(6,100-20,Color, "            Mouse Sensitivity        ",c[4]);
    PrintRomString(6,100-10,Color, "              Control Method         ",c[5]);
    PrintRomString(6,100,Color,    "            Player Fire Speed        ",c[6]);
    PrintRomString(6,100+10,Color, "                  Exit               ",c[7]);

    waitretrace();
    show_double_buffer();
    }
      image.speed= data;
      if (KeyboardInstalled)
     install_keyboard();


   FadeAway();
   bitmap_load("D:\\bitmaps\\Loading.bmp",&MenuMap);
   bitmap_show_buffer_db(&MenuMap,
   (SCREEN_WIDTH-MenuMap.width) >>1,
   (SCREEN_HEIGHT-MenuMap.height) >>1);
   show_double_buffer();
   FadeIn(&MenuMap);
   if (PalChanged)
   ChangePalette('b');
   farfree(MenuMap.data);


   }




    int MainMenu (void)
    {
    BITMAP MenuMap;
    int Value=0;

    FadeAway();
    bitmap_show_buffer_db(&image.wallpaper,
    (SCREEN_WIDTH-image.wallpaper.width) >>1,
    (SCREEN_HEIGHT-image.wallpaper.height) >>1);
    show_double_buffer();
    FadeIn(&image.wallpaper);
    ChangePalette('b');
    //ChangePalette('r');
    //int Color=186;
    int Color = 248;

    for (int i=180; i>=100 ; i--)
    {
    image.scroll_bitmap_horizontally_db();
    ScrollBackSprites();
    PrintRomString(10,i-90,Color,"           AERO BLASTERS II  ",1);
    PrintRomString(10,i-80,Color,"         the final vengenance ",1);
    PrintRomString(10,i-20,Color,"              game start",1);
    PrintRomString(6,i-10,Color,   "                options ",1);
    PrintRomString(6,i,Color,"                credits",1);
    PrintRomString(10,i+10,Color,"                 exit ",1);
    waitretrace();
    show_double_buffer();
    }


    int ch[5];
    for(;;)
    {
    GameLoopCount++;
    ch[1]=ch[2]=ch[3]=ch[4]=1;

    image.scroll_bitmap_horizontally_db();
    ScrollBackSprites();

    object[0].MouseScanControl2();
    object[0].InBoundary();
    object[0].sprite.LExhaustAir();
    object[0].sprite.paste_db();


    if (object[0].sprite.y > 110)
       ch[4]=0;
    else
    if (object[0].sprite.y > 100)
       ch[3]=0;
    else
    if (object[0].sprite.y > 90)
       ch[2]=0;
    else
    if (object[0].sprite.y > 80)
       ch[1]=0;


       if (ch[4]==0 && GetButton()==1)
       {Value=0;smooth();FadeAway();

      set_video_mode(text);
      delay(1000);
      puts(" Programmed By Kami in Collaboration With Khurram, ");
      puts(" FastIcs karachi.                     [1999-2000]");
      puts(" Send Your Programming Requests To :> kami587@yahoo.com ");
      puts("                             Or To :> sher_dil@yahoo.com ");
      puts("  ");
      puts(" Hit Any Key To Continue.");
      delay(1000);
      reboot();}

       if (ch[2]==0 && GetButton()==1)
       {Options();ChangePalette('b');delay(100);}
       if (ch[3]==0 && GetButton()==1)
       Credits();
       if (ch[1]==0 && GetButton()==1)
       {Value=1;break;}


    PrintRomString(10+88,10,Color,"AERO BLASTERS II",1);
    PrintRomString(10+9*8,20,Color,"the final vengenance",1);
    PrintRomString(10+14*8,80,Color,"game start",ch[1]);
    PrintRomString(6+16*8,90,Color,"options",ch[2]);
    PrintRomString(6+16*8,100,Color,"credits",ch[3]);
    PrintRomString(10+16*8,110,Color," exit ",ch[4]);

    waitretrace();
    show_double_buffer();
    }

   FadeAway();
   bitmap_load("D:\\bitmaps\\Loading.bmp",&MenuMap);
   bitmap_show_buffer_db(&MenuMap,
   (SCREEN_WIDTH-MenuMap.width) >>1,
   (SCREEN_HEIGHT-MenuMap.height) >>1);
   show_double_buffer();
   FadeIn(&MenuMap);



   farfree(MenuMap.data);

   return(Value);
   }




