program Star_beehive;

uses
  OMEGA;

{$R *.res}

type
  TPlayer = record
    Tex: PTexture;
    firetex: PTexture;
    Stat: Integer;
    life: Integer;
    weapon, oldweapon: Integer;
    pos: Single;
    ShotTime: Integer;
    Deaded, Killed: Boolean;
    Frame, FrameTime, fireframe, fireframetime: Integer;
  end;
  TBullet = record
    PosX, PosY: Single;
  end;
  TSpace = record
    Tex: PTexture;
    Alpha: Byte;
    AlphaFlag: Boolean;
  end;
  TMenu = record
    LogoTex: PTexture;
    MenuActive: Integer;
    KeyDown: Integer;
  end;
  TVrag1 = record
    X, Y: Single;
    Speed: Single;
    frame: Integer;
    FrameTime: Integer;
    Deaded, Killed: Boolean;
    v: Integer;
    shotTime: Integer;
  end;
  TBoss1 = record
    Tex: PTexture;
    x, y: Single;
    health: Integer;
    b: Integer;
    Frame: Integer;
    FrameTime: Integer;
    Time: Integer;
    flag: Boolean;
    TimeShot: Integer;
    Downed: Boolean;
  end;

const
  GS_MENU = 0;
  GS_GAME = 1;
  GS_INTRO = 2;

var
  TimerUpDate: POTimer;
  GameStat: Integer;
  Font: PFont2D;
  Space: TSpace;
  Menu: TMenu;
  Player: TPlayer;
  PBullet, VBullet: array of TBullet;
  BulTex: PTexture;
  VTex: PTexture;
  VDeadTex: PTexture;
  V1: array of TVrag1;     t: Integer;
  GameTime: Integer;
  Boss: TBoss1;
  Points: Integer;
  SndpShot, SndvShot, SndpDead, SndvDead, SndMenu, Sndv4fly, Sndbonus: PSound;
  ggtex: PTexture;
  inttime: Integer;
  GameOne: Boolean = False;
  contesttex: PTexture;
  InitTime: Integer = 0;
  contestalpha: Byte = 0;
  bonustex: PTexture;

procedure BullAdd(x, y: Single; p: Boolean = True);
begin
  if p then
  begin
    SetLength(PBullet, Length(PBullet)+1);
    PBullet[Length(PBullet)-1].PosX:=x;
    PBullet[Length(PBullet)-1].PosY:=y;
  end else
  begin
    SetLength(VBullet, Length(VBullet)+1);
    VBullet[Length(VBullet)-1].PosX:=x;
    VBullet[Length(VBullet)-1].PosY:=y;
  end;
end;

procedure BullUpDate;
var
  I: Integer;
  Buf: array of TBullet;
begin
  for I:=0 to Length(PBullet)-1 do
  begin
    PBullet[I].PosY:=PBullet[I].PosY-10;
    if PBullet[I].PosY > -20 then
    begin
      SetLength(Buf, Length(Buf)+1);
      Buf[Length(Buf)-1]:=PBullet[I];
    end;
  end;
  SetLength(PBullet, Length(Buf));
  for I:=0 to Length(Buf)-1 do
    PBullet[I]:=Buf[I];
  SetLength(Buf, 0);
  for I:=0 to Length(VBullet)-1 do
  begin
    if (VBullet[I].PosY > 550)and
       (VBullet[I].PosX-Player.pos < 12)and
       (VBullet[I].PosX-Player.pos > -12)and
       (not Player.Deaded) then
    begin
      VBullet[I].PosY:=640;
      Player.Deaded:=True;
      Player.Frame:=2;
      Player.FrameTime:=0;
    end;
    VBullet[I].PosY:=VBullet[I].PosY+10;
    if VBullet[I].PosY < 620 then
    begin
      SetLength(Buf, Length(Buf)+1);
      Buf[Length(Buf)-1]:=VBullet[I];
    end;
  end;
  SetLength(VBullet, Length(Buf));
  for I:=0 to Length(Buf)-1 do
    VBullet[I]:=Buf[I];
  SetLength(Buf, 0);
end;

procedure BullDraw;
var
  I: Integer;
begin
  for I:=0 to Length(PBullet)-1 do
    ASprite_Draw(BulTex, PBullet[I].PosX, PBullet[I].PosY, 4, 8, 0);
  for I:=0 to Length(VBullet)-1 do
    ASprite_Draw(BulTex, VBullet[I].PosX, VBullet[I].PosY, 4, 8, 1);
end;

procedure v1add;
begin
  SetLength(v1, Length(v1)+1);
  v1[Length(v1)-1].X:=Random(800);
  v1[Length(v1)-1].Y:=-20;
  v1[Length(v1)-1].Speed:=Random(2)+2;
  v1[Length(v1)-1].frame:=7;
  v1[Length(v1)-1].FrameTime:=0;
  v1[Length(v1)-1].Deaded:=False;
  v1[Length(v1)-1].Killed:=False;
  v1[Length(v1)-1].v:=0;
end;

procedure v2add;
begin
  SetLength(v1, Length(v1)+1);
  v1[Length(v1)-1].X:=Random(800);
  v1[Length(v1)-1].Y:=-20;
  v1[Length(v1)-1].Speed:=Random(2)+2;
  v1[Length(v1)-1].frame:=1;
  v1[Length(v1)-1].FrameTime:=0;
  v1[Length(v1)-1].Deaded:=False;
  v1[Length(v1)-1].Killed:=False;
  v1[Length(v1)-1].v:=1;
end;

procedure v3add;
begin
  SetLength(v1, Length(v1)+1);
  v1[Length(v1)-1].X:=Random(800);
  v1[Length(v1)-1].Y:=-20;
  v1[Length(v1)-1].Speed:=Random(2)+3;
  v1[Length(v1)-1].frame:=4;
  v1[Length(v1)-1].FrameTime:=0;
  v1[Length(v1)-1].Deaded:=False;
  v1[Length(v1)-1].Killed:=False;
  v1[Length(v1)-1].v:=2;
end;

procedure v4add;
begin
  SetLength(v1, Length(v1)+1);
  v1[Length(v1)-1].X:=Random(800);
  v1[Length(v1)-1].Y:=-20;
  v1[Length(v1)-1].Speed:=Random(10)+10;
  v1[Length(v1)-1].frame:=10;
  v1[Length(v1)-1].FrameTime:=0;
  v1[Length(v1)-1].Deaded:=False;
  v1[Length(v1)-1].Killed:=False;
  v1[Length(v1)-1].v:=3;
  Snd_Play(Sndv4fly);
end;

procedure v1UpDate;
var
  I, J: Integer;
  Buf: array of TVrag1;
begin
  for I:=0 to Length(v1)-1 do
  begin
    v1[I].Y:=v1[I].Y+v1[I].Speed;
    if (not v1[I].Deaded)and(v1[I].v <> 3) then
    begin
      if Player.pos < v1[I].X then
        v1[I].X:=v1[I].X-1;
      if Player.pos > v1[I].X then
        v1[I].X:=v1[I].X+1;
    end;
    inc(v1[I].shotTime);
    if v1[I].shotTime > 40 then
    begin
      v1[I].shotTime:=0;
      case v1[I].v of
        1:
          begin
            BullAdd(v1[I].X, v1[I].Y, False);
            Snd_Play(Sndvshot);
          end;
        2:
          begin
            BullAdd(v1[I].X-4, v1[I].Y, False);
            BullAdd(v1[I].X+4, v1[I].Y, False);
            Snd_Play(Sndvshot);
          end;
      end;
    end;
    Inc(v1[I].FrameTime);
    if v1[I].FrameTime > 5 then
    begin
      v1[I].FrameTime:=0;
      v1[I].frame:=v1[I].frame+1;
      if v1[I].Deaded then
      begin
        if v1[I].frame > 4 then v1[I].Killed:=True;
      end else
      begin
        case v1[I].v of
          0: if v1[I].frame > 9 then v1[I].frame:=7;
          1: if v1[I].frame > 3 then v1[I].frame:=1;
          2: if v1[I].frame > 6 then v1[I].frame:=4;
          3: if v1[I].frame > 11 then v1[I].frame:=10;
        end;
      end;
    end;
    for J:=0 to Length(PBullet)-1 do
      if (not v1[I].Deaded)and
         (v1[I].X-PBullet[J].PosX < 8)and
         (v1[I].X-PBullet[J].PosX > -8)and
         (v1[I].Y-PBullet[J].PosY < 8)and
         (v1[I].Y-PBullet[J].PosY > -8)then
      begin
        v1[I].Deaded:=True;
        v1[I].frame:=0;
        PBullet[J].PosY:=-50;
        Points:=Points+(v1[I].v+1)*50;
        Snd_Play(Sndvdead, 0, VOLUME(70));
      end;
    if v1[I].Y > 620 then v1[I].Killed:=True;
    if (v1[I].Y > 540)and
       (v1[I].X-Player.pos < 20)and
       (v1[I].X-Player.pos > -20)and
       (not Player.Deaded)and
       (not v1[I].Deaded) then
    begin
      v1[I].Deaded:=True;
      v1[I].frame:=0;
      Player.Deaded:=True;
      Player.Frame:=2;
      Player.FrameTime:=0;
      Snd_Play(Sndpdead);
      Snd_Play(Sndvdead, 0, VOLUME(70));
    end;
    if not v1[I].Killed then
    begin
      SetLength(Buf, Length(Buf)+1);
      Buf[Length(Buf)-1]:=v1[I];
    end;
  end;
  SetLength(v1, Length(Buf));
  for I:=0 to Length(Buf)-1 do
    v1[I]:=Buf[I];
  SetLength(Buf, 0);
end;

procedure v1Draw;
var
  I: Integer;
begin
  for I:=0 to Length(v1)-1 do
  begin
    if v1[I].Deaded then
      ASprite_Draw(vdeadtex, v1[I].X-16, v1[I].Y, 32, 32, v1[I].frame)
    else
      ASprite_Draw(vtex, v1[I].X-16, v1[I].Y, 32, 32, v1[I].frame);
  end;
end;

procedure PlayerCreate;
begin
  Player.Tex:=Tex_LoadFromFile('Graphics/player.bmp', $FFFFFF, 0);
  Player.firetex:=Tex_LoadFromFile('Graphics/player_engine.bmp', $FFFFFF, 0);
  Tex_SetFramesSize(Player.Tex, 32, 32);
  Tex_SetFramesSize(Player.fireTex, 16, 16);
  Player.Stat:=0;
  Player.life:=3;
  Player.weapon:=0;
  Player.oldweapon:=0;
  Player.pos:=384;
end;

procedure PlayerDraw;
begin
  if Player.Deaded then
    ASprite_Draw(Player.Tex, Player.pos-32, 545, 64, 64, Player.Frame)
  else
  begin
    ASprite_Draw(Player.Tex, Player.pos-32, 545, 64, 64, 1);
    ASprite_Draw(Player.fireTex, Player.pos-9, 590, 16, 16, Player.fireframe);
  end;
end;

procedure NewGame;
begin
  GameStat:=GS_INTRO;
  Player.Stat:=0;
  Player.life:=10;
  Player.weapon:=0;
  Player.oldweapon:=0;
  Player.pos:=400;
  SetLength(PBullet, 0);
  SetLength(VBullet, 0);
  SetLength(v1, 0);
  GameTime:=0;
  Points:=0;
  inttime:=0;
  GameOne:=True;
end;

procedure IntroUpDate;
begin
  Inc(Inttime);
end;

procedure IntroDraw;
begin
  if inttime < 1100 then
    SSprite_Draw(ggtex, 100, 500, 600, 64);
  if (inttime > 0)and(inttime < 200) then
  begin
    Text_Draw(font, 170, 505, 'Капитан они напали с утра в 6.00.');
    Text_Draw(font, 170, 515, 'Направляются к Земле. Ваши распоряжения?');
  end;
  if (inttime > 200)and(inttime < 400) then
  begin
    Text_Draw(font, 170, 505, 'Высылаем подмогу. Ваша задача держать их как можно дольше');
    Text_Draw(font, 170, 515, 'Не пропускать не одной этой твари. Вы слышите меня?');
  end;
  if (inttime > 400)and(inttime < 600) then
  begin
    Text_Draw(font, 170, 505, 'Приказ понял');
  end;
  if (inttime > 600)and(inttime < 700) then
  begin
    GameStat:=GS_GAME;
  end;
  if (inttime > 700)and(inttime < 900) then
  begin
    Text_Draw(font, 170, 505, 'Всё сержант отдыхай дальше мы их сами.');
    Text_Draw(font, 170, 515, 'Отличная работа');
  end;
  if (inttime > 900)and(inttime < 1100) then
  begin
    Text_Draw(font, 170, 505, 'Служу отечеству');
  end;
  if inttime > 1100 then
  begin
    Text_Draw(font, 300, 205, '             КОНЕЦ ИГРЫ');
    Text_Draw(font, 300, 220, 'Специально для конкурса №72');
    Text_Draw(font, 300, 235, '                 IGDC.RU');
  end;
  if inttime > 1300 then
  begin
    inttime:=0;
    GameStat:=GS_MENU;
  end;
end;

procedure BossCreate;
begin
  Boss.Tex:=Tex_LoadFromFile('Graphics/boss.bmp', $FFFFFF, 0);
  Tex_SetFramesSize(Boss.Tex, 128, 64);
  Boss.health:=500;
  Boss.x:=242;
  Boss.y:=-100;
  Boss.b:=-1;
end;

procedure BossDraw;
begin
  case Boss.b of
    0:
      begin
        ASprite_Draw(Boss.Tex, Boss.x, Boss.y, 256, 128, Boss.Frame);
        Pr2D_Rect(Boss.x+84, Boss.y, 100, 4, $0000FF);
        Pr2D_Rect(Boss.x+84, Boss.y+1, Boss.health/5, 3, $0000FF, 255, 1);
      end;
    1: ;
    2: ;
    3: ;
  end;
end;

procedure BossUpDate;
var
  I: Integer;
begin
  case Boss.b of
    0:
      begin
        for I:=0 to Length(PBullet)-1 do
        begin
          if (Boss.Time < 1000)and
             (Boss.x-PBullet[I].PosX < -50)and
             (Boss.x-PBullet[I].PosX > -200)and
             (Boss.y-PBullet[I].PosY < 50)and
             (Boss.y-PBullet[I].PosY > -50) then
          begin
            PBullet[I].PosY:=-100;
            Boss.health:=Boss.health-1;
            Snd_Play(Sndvdead, 0, VOLUME(70));
            if Boss.health < 0 then
            begin
              Boss.Time:=1100;
              Points:=Points+5000;
            end;
          end;
        end;
        Inc(Boss.FrameTime);
        if Boss.FrameTime > 10 then
        begin
          Boss.FrameTime:=0;
          Inc(Boss.Frame);
          if Boss.Frame > 2 then Boss.Frame:=1;
        end;
        Inc(Boss.Time);
        if Boss.Time < 30 then
        begin
          Boss.y:=Boss.y+5;
        end;
        if (Boss.Time > 30)and(Boss.Time < 400) then
        begin
          if Boss.flag then
          begin
            Boss.x:=Boss.x+5;
            if Boss.x > 580 then Boss.flag:=False;
          end else
          begin
            Boss.x:=Boss.x-5;
            if Boss.x < -40 then Boss.flag:=True;
          end;
        end;
        if (Boss.Time > 100)and(Boss.Time < 400) then
        begin
          Inc(Boss.TimeShot);
          if Boss.TimeShot > 100 then
          begin
            Boss.TimeShot:=0;
            BullAdd(Boss.x+100, Boss.y+50, False);
            BullAdd(Boss.x+120, Boss.y+50, False);
            BullAdd(Boss.x+135, Boss.y+50, False);
            BullAdd(Boss.x+150, Boss.y+50, False);
            BullAdd(Boss.x+170, Boss.y+50, False);
            Snd_Play(Sndvshot);
          end;
        end;
        if (Boss.Time > 400)and(Boss.Time < 1000) then
        begin
          Snd_Play(Sndv4Fly);
          if Boss.y > 350 then
          begin
            if (not Player.Deaded)and
               (Boss.x-Player.pos < 0)and
               (Boss.x-Player.pos > -200)then
            begin
              Player.Deaded:=True;
              Player.Frame:=2;
              Player.FrameTime:=0;
            end;
          end;
          if Not Boss.Downed then
          begin
            Boss.y:=Boss.y+30;
            if Boss.y > 500 then
            begin
              Boss.Downed :=True;
            end;
          end else
          begin
            Boss.y:=Boss.y-30;
            if Boss.y < 100 then
            begin
              Boss.Downed:=False;
              Boss.Time:=30;
            end;
          end;
        end;
        if Boss.Time > 1000 then
        begin
          Boss.y:=Boss.y-5;
          if Boss.y < -100 then
          begin
            Boss.b:=-1;
            Inttime:=701;
            GameStat:=GS_INTRO;
          end;
        end;
      end;
    1: ;
    2: ;
    3: ;
  end;
end;

procedure PlayerUpDate;
begin
  if Player.Deaded then
  begin
    Inc(Player.FrameTime);
    if Player.FrameTime > 5 then
    begin
      Player.FrameTime:=0;
      Inc(Player.Frame);
      if Player.Frame > 5 then
      begin
        Dec(Player.life);
        if Player.life < 0 then
        begin
          NewGame;
          GameStat:=GS_MENU;
        end else
        begin
          Player.Deaded:=False;
          SetLength(PBullet, 0);
          SetLength(VBullet, 0);
          SetLength(v1, 0);
        end;
      end;
    end;
  end else
  begin
    inc(player.fireframetime);
    if Player.fireframetime > 4 then
    begin
      Player.fireframetime:=0;
      inc(player.fireframe);
      if player.fireframe> 3 then player.fireframe:=1;
    end;
    if (Points > 1000)and(Points < 7000) then
    begin
      if Player.weapon <> Player.oldweapon then Snd_Play(Sndbonus);
      Player.weapon:=1;
      Player.oldweapon:=Player.weapon;
    end;
    if Points > 7000 then
    begin
      if Player.weapon <> Player.oldweapon then Snd_Play(Sndbonus);
      Player.weapon:=2;
      Player.oldweapon:=Player.weapon;
    end;
    if Key_Down(37) then
    begin
      if Player.pos > 16 then Player.pos:=Player.pos-10;
    end;
    if Key_Down(39) then
    begin
      if Player.pos < 784 then Player.pos:=Player.pos+10;
    end;
    if Key_Down(38) then
    begin
      Inc(Player.ShotTime);
      if Player.ShotTime > 5 then
      begin
        case Player.weapon of
          0: BullAdd(Player.pos-4, 570);
          1:
            begin
              BullAdd(Player.pos-12, 585);
              BullAdd(Player.pos+4, 585);
            end;
          2:
            begin
              BullAdd(Player.pos-4, 570);
              BullAdd(Player.pos-12, 585);
              BullAdd(Player.pos+4, 585);
            end;
        end;
        Player.ShotTime:=0;
        Snd_Play(SndpShot, 0, VOLUME(80));
      end;
    end else Player.ShotTime:=10;
  end;
end;

procedure SpaceCreate;
begin
  Space.Tex:=Tex_LoadFromFile('Graphics/space.jpg', -1, 0);
  Space.Alpha:=0;
  Space.AlphaFlag:=False;
end;

procedure SpaceDraw;
begin
  SSprite_Draw(Space.Tex, 0, 0, 800, 600, Space.Alpha);
end;

procedure SpaceUpDate;
begin
  if Space.AlphaFlag then
  begin
    Space.Alpha:=Space.Alpha-1;
    if Space.Alpha =200 then Space.AlphaFlag:=False;
  end else
  begin
    Space.Alpha:=Space.Alpha+1;
    if Space.Alpha = 255 then Space.AlphaFlag:=True;
  end;
end;

procedure MenuCreate;
begin
  Menu.LogoTex:=Tex_LoadFromFile('Graphics/logo.bmp', $000000, 0);
  Menu.MenuActive:=0;
end;

procedure MenuDraw;
begin
  SSprite_Draw(Menu.LogoTex, 144, 30, 512, 128);
  if Menu.MenuActive = 0 then
    Text_Draw(Font, 330, 250, 'Продолжить', 2, 0, 255, $00A0FF)
  else
    Text_Draw(Font, 330, 250, 'Продолжить', 2, 0, 255, $00D0FF);
  if Menu.MenuActive = 1 then
    Text_Draw(Font, 334, 275, 'Новая игра', 2, 0, 255, $00A0FF)
  else
    Text_Draw(Font, 334, 275, 'Новая игра', 2, 0, 255, $00D0FF);
  if Menu.MenuActive = 2 then
    Text_Draw(Font, 363, 300, 'Выход', 2, 0, 255, $00A0FF)
  else
    Text_Draw(Font, 363, 300, 'Выход', 2, 0, 255, $00D0FF);
end;

procedure MenuUpDate;
begin
  if Key_Press(38) then
  begin
    Snd_Play(SndMenu);
    Menu.MenuActive:=Menu.MenuActive-1;
    if Menu.MenuActive < 0 then Menu.MenuActive:=2;
  end else
  begin
    if Key_Press(40) then
    begin
      Snd_Play(SndMenu);
      Menu.MenuActive:=Menu.MenuActive+1;
      if Menu.MenuActive > 2 then Menu.MenuActive:=0;
    end;
  end;
  if Key_Press(13) then
  begin
    Snd_Play(SndMenu);
    case Menu.MenuActive of
      0: if not GameOne then NewGame else GameStat:=GS_GAME;
      1: NewGame;
      2: OE_QUIT;
    end;
  end;
end;

procedure Init;
begin
  GameStat:=GS_MENU;
  Font:=Text_LoadFontFromFile('Graphics/font.bmp', 'font.ofi');
  BulTex:=Tex_LoadFromFile('Graphics/bullet.bmp', 0, 0);
  Tex_SetFramesSize(BulTex, 4, 8);
  VTex:=Tex_LoadFromFile('Graphics/v.bmp', $FFFFFF, 0);
  Tex_SetFramesSize(VTex, 16, 16);
  VDeadTex:=Tex_LoadFromFile('Graphics/vdead.bmp', $FFFFFF, 0);
  Tex_SetFramesSize(VDeadTex, 16, 16);
  ggtex:=Tex_LoadFromFile('Graphics/gg.jpg', -1, 0);
  contesttex:=Tex_LoadFromFile('Graphics/contest.jpg', -1, 0);
  bonustex:=Tex_LoadFromFile('Graphics/bonus.bmp', 0, 0);
  Tex_SetFramesSize(bonustex, 16, 16);
  SpaceCreate;
  MenuCreate;
  PlayerCreate;
  BossCreate;
  Snd_Init;
  SndpShot:=Snd_LoadFromFile('Sounds/Player_Shot.wav', 3);
  SndvShot:=Snd_LoadFromFile('Sounds/v_shot.wav', 5);
  SndMenu:=Snd_LoadFromFile('Sounds/menu_click.wav', 3);
  Sndpdead:=Snd_LoadFromFile('Sounds/Player_Dead.wav', 1);
  Sndvdead:=Snd_LoadFromFile('Sounds/v_dead.wav', 3);
  Sndv4fly:=Snd_LoadFromFile('Sounds/v4fly.wav', 1);
  Sndbonus:=Snd_LoadFromFile('Sounds/bonus.wav', 1);
  Media_Play('Sounds/bg.mid', True);
end;

procedure Draw;
var
  I: Integer;
begin
  if InitTime < 510 then SSprite_Draw(contesttex, 250, 150, 300, 300, contestalpha);
  if InitTime > 510 then SpaceDraw;
  if InitTime > 765 then
  begin
    case GameStat of
      GS_MENU:
        begin
          MenuDraw;
        end;
      GS_INTRO: IntroDraw;
      GS_GAME:
        begin
          PlayerDraw;
          v1Draw;
          BullDraw;
          BossDraw;
          Text_Draw(Font, 0, 0, PChar('Очки: '+U_IntToStr(Points)), 1, 0, 255, $FFFFFF);
          for I:=Player.life-1 downto 0 do
            ASprite_Draw(bonustex, 780-20*I, 10, 16, 16, 1);
          for I:=Player.weapon downto 0 do
            ASprite_Draw(bonustex, 780-20*I, 30, 16, 16, 2);
        end;
    end;
  end;
end;

procedure UpDate;
begin
  Inc(InitTime);
  if (InitTime > 0)and(InitTime < 255) then
  begin
    Inc(contestalpha);
  end;
  if (InitTime > 255)and(InitTime < 510) then
  begin
    Dec(contestalpha);
  end;
  if InitTime > 510 then SpaceUpDate;
  if InitTime > 765 then
  begin
    Inittime:=770;
    case GameStat of
      GS_MENU:
        begin
          MenuUpDate;
        end;
      GS_INTRO: IntroUpDate;
      GS_GAME:
        begin
          if Key_Down(27) then GameStat:=GS_MENU;
          PlayerUpDate;
          v1UpDate;
          BullUpDate;
          BossUpDate;
          Inc(GameTime);
          inc(t);
          if t > 100 then
          begin
            if ((GameTime > 0)and(GameTime < 3000))or((GameTime > 5000)and(GameTime < 5500)) then
            begin
              v1add;
            end;
            if ((GameTime > 1000)and(GameTime < 4000))or((GameTime > 5500)and(GameTime < 6000)) then
            begin
              v2add
            end;
            if ((GameTime > 2000)and(GameTime < 5000))or((GameTime > 6000)and(GameTime < 6500)) then
            begin
              v3add
            end;
            if (GameTime > 3000) then
            begin
              v4add;
            end;
            t:=0;
          end;
          if (GameTime > 5100)and(GameTime < 5110) then
          begin
            Boss.b:=0;
          end;
          if GameTime > 6500 then
          begin
            GameTime:=5000;
          end;
        end;
    end;
  end;
end;

procedure Quit;
begin

end;

begin
  LoadOMEGA('omega.dll');
  OE_RegProcedure(SYS_INIT, @Init);
  OE_RegProcedure(SYS_DRAW, @Draw);
  OE_RegProcedure(SYS_QUIT, @Quit);
  TimerUpDate:=Timer_Create(@UpDate, 30, 0);
  OE_SetScreenOptions(800, 600, 32, 0, True, True);
  OE_ShowCursor(False);
  OE_SetWndName('IGDC#72');
  OE_Init;
end.
