unit Picture4;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, MPlayer, TransparentPanel, jpeg, Buttons, StdCtrls;

type
  TPic4 = class(TForm)
    Image1: TImage;
    left_sensor: TImage;
    TopSensor: TImage;
    right_sensor: TImage;
    bottom_sensor: TImage;
    InvPic: TImage;
    InvBev: TBevel;
    Music1: TMediaPlayer;
    Inventar1: TMediaPlayer;
    Video1: TMediaPlayer;
    inv_delay: TTimer;
    bigmirrorsensor: TImage;
    delay_vidstart: TTimer;
    doorsensor: TImage;
    doorsensor2: TImage;
    lightsensor: TImage;
    exitsensor: TImage;
    nav_sensor1: TImage;
    nav_sensor2: TImage;
    nav_sensor3: TImage;
    nav_sensor4: TImage;
    nav_sensor5: TImage;
    nav_sensor6: TImage;
    nav_sensor7: TImage;
    nav_sensor8: TImage;
    chambersensor: TImage;
    entrancesensor: TImage;
    entrancesensor2: TImage;
    hallwaysensor: TImage;
    dark_centersensor: TImage;
    plugsensor: TImage;
    doorsensor3: TImage;
    key2sensor: TImage;
    exitsensor2: TImage;
    plugsensor2: TImage;
    chipsensor: TImage;
    drawersensor: TImage;
    locksensor: TImage;
    mirrorexit: TImage;
    mirrorexit2: TImage;
    SpeedButton1: TSpeedButton;
    signsensor: TImage;
    signsensor2: TImage;
    gatesensor: TImage;
    ae_sensor: TImage;
    leftaislesensor: TImage;
    rightaislesensor: TImage;
    leftexitsensor: TImage;
    graves_exitsensor: TImage;
    rightexitsensor: TImage;
    chapel_leftsensor: TImage;
    chapel_rightsensor: TImage;
    smallchapelsensor: TImage;
    holesensor: TImage;
    gravesensor: TImage;
    sicklesensor: TImage;
    bushsensor: TImage;
    sticksensor: TImage;
    chipslotsensor: TImage;
    candlessensor: TImage;
    litcandlesensor: TImage;
    ae_candle: TImage;
    ari_candle: TImage;
    dem_candle: TImage;
    gg_candle: TImage;
    jcm_candle: TImage;
    in_candle: TImage;
    hl_candle: TImage;
    SpeedButton2: TSpeedButton;
    sound: TMediaPlayer;
    SpeedButton3: TSpeedButton;
    SpeedButton4: TSpeedButton;
    throwback1: TTimer;
    throwback2: TTimer;
    boss_sensor1: TImage;
    boss_sensor2: TImage;
    throwback3: TTimer;
    staffsensor: TImage;
    final_delay: TTimer;
    report: TButton;
    reporttimer: TTimer;
    Memo1: TMemo;
    procedure inv_delayTimer(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure InvPicClick(Sender: TObject);
    procedure InvPicDblClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure Video1Notify(Sender: TObject);
    procedure Music1Notify(Sender: TObject);
    procedure right_sensorDblClick(Sender: TObject);
    procedure left_sensorDblClick(Sender: TObject);
    procedure InvPicMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure InvPicEndDrag(Sender, Target: TObject; X, Y: Integer);
    procedure bigmirrorsensorDragOver(Sender, Source: TObject; X,
      Y: Integer; State: TDragState; var Accept: Boolean);
    procedure bigmirrorsensorDragDrop(Sender, Source: TObject; X,
      Y: Integer);
    procedure delay_vidstartTimer(Sender: TObject);
    procedure bigmirrorsensorDblClick(Sender: TObject);
    procedure doorsensorDblClick(Sender: TObject);
    procedure exitsensorDblClick(Sender: TObject);
    procedure doorsensor2DblClick(Sender: TObject);
    procedure lightsensorDblClick(Sender: TObject);
    procedure nav_sensor1DblClick(Sender: TObject);
    procedure bottom_sensorDblClick(Sender: TObject);
    procedure nav_sensor2DblClick(Sender: TObject);
    procedure nav_sensor4DblClick(Sender: TObject);
    procedure nav_sensor5DblClick(Sender: TObject);
    procedure nav_sensor3DblClick(Sender: TObject);
    procedure nav_sensor6DblClick(Sender: TObject);
    procedure nav_sensor7DblClick(Sender: TObject);
    procedure nav_sensor8DblClick(Sender: TObject);
    procedure entrancesensorDblClick(Sender: TObject);
    procedure chambersensorDblClick(Sender: TObject);
    procedure hallwaysensorDblClick(Sender: TObject);
    procedure entrancesensor2DblClick(Sender: TObject);
    procedure dark_centersensorDblClick(Sender: TObject);
    procedure plugsensorDblClick(Sender: TObject);
    procedure exitsensor2DblClick(Sender: TObject);
    procedure key2sensorDblClick(Sender: TObject);
    procedure doorsensor3DblClick(Sender: TObject);
    procedure plugsensor2DragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure plugsensor2DragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure drawersensorDblClick(Sender: TObject);
    procedure locksensorDragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure locksensorDragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure chipsensorDblClick(Sender: TObject);
    procedure mirrorexitDblClick(Sender: TObject);
    procedure mirrorexit2DblClick(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure signsensor2DblClick(Sender: TObject);
    procedure signsensorDblClick(Sender: TObject);
    procedure gatesensorDblClick(Sender: TObject);
    procedure rightaislesensorDblClick(Sender: TObject);
    procedure leftaislesensorDblClick(Sender: TObject);
    procedure ae_sensorDblClick(Sender: TObject);
    procedure leftexitsensorDblClick(Sender: TObject);
    procedure graves_exitsensorDblClick(Sender: TObject);
    procedure rightexitsensorDblClick(Sender: TObject);
    procedure chapel_rightsensorDblClick(Sender: TObject);
    procedure chapel_leftsensorDblClick(Sender: TObject);
    procedure holesensorDblClick(Sender: TObject);
    procedure smallchapelsensorDblClick(Sender: TObject);
    procedure gravesensorDblClick(Sender: TObject);
    procedure sicklesensorDblClick(Sender: TObject);
    procedure bushsensorDragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure bushsensorDragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure sticksensorDblClick(Sender: TObject);
    procedure chipslotsensorDragOver(Sender, Source: TObject; X,
      Y: Integer; State: TDragState; var Accept: Boolean);
    procedure chipslotsensorDragDrop(Sender, Source: TObject; X,
      Y: Integer);
    procedure candlessensorDblClick(Sender: TObject);
    procedure litcandlesensorDragOver(Sender, Source: TObject; X,
      Y: Integer; State: TDragState; var Accept: Boolean);
    procedure litcandlesensorDragDrop(Sender, Source: TObject; X,
      Y: Integer);
    procedure ae_candleDragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure ari_candleDragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure gg_candleDragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure hl_candleDragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure in_candleDragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure jcm_candleDragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure dem_candleDragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure ae_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure ari_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure dem_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure gg_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure hl_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure in_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure jcm_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure SpeedButton2Click(Sender: TObject);
    procedure soundNotify(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure SpeedButton4Click(Sender: TObject);
    procedure throwback1Timer(Sender: TObject);
    procedure throwback2Timer(Sender: TObject);
    procedure boss_sensor1DragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure boss_sensor1DragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure boss_sensor2DragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure throwback3Timer(Sender: TObject);
    procedure staffsensorDblClick(Sender: TObject);
    procedure boss_sensor2DragDrop(Sender, Source: TObject; X, Y: Integer);
    procedure final_delayTimer(Sender: TObject);
    procedure reporttimerTimer(Sender: TObject);
    procedure reportClick(Sender: TObject);
  private
    { Private declarations }
    procedure Videoplay(videofile:string);
  public
    { Public declarations }
    musicstart, mirrorsmashed, lighttaken, light, firsttimelight, plug,
    firsttimeplug, plugtaken, pluginserted, key2, key2taken, firsttimekey2,
    chip, chiptaken, firsttimechip, stick1, stick2, stick1taken, firsttimestick1,
    chipused, sickle, firsttimesickle, sickletaken, sickleused, ari_lit, ae_lit,
    dem_lit, gg_lit, jcm_lit, in_lit, hl_lit, musicchange, bubble,firsttimestick2,
    chapelopen, musicpause, creditsplaying, bosspresent:Boolean;
    candlecombination:String;
  end;

var
  Pic4: TPic4;

var
  Panel:TTransparentPanel;

implementation

uses Picture2, Picture3, evo_menu;

{$R *.dfm}

procedure TPic4.Videoplay(videofile:string);
begin
 Panel:=TTransparentPanel.Create(self);
 Panel.Parent := Self;
 Panel.Left := 72;
 Panel.Top := 40;
 Panel.Width:=640;
 Panel.Height:=480;

 video1.FileName:=videofile;

 video1.Open;
 video1.Display:=panel;
 video1.DisplayRect:=Panel.ClientRect;
 video1.play;
end;

procedure TPic4.inv_delayTimer(Sender: TObject);
begin
 pic2.finite:=false;

 pic2.cycles:=0;

 repeat
 if pic2.invitem<39 then pic2.invitem:=pic2.invitem+1 else
  begin
   pic2.invitem:=1;
   pic2.cycles:=1;
  end;

 if (pic2.invitem=1) and (pic2.book=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=1) and (pic2.book=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\book.gif');
   pic2.displayeditem:='book';
   pic2.finite:=true;
  end;

 if (pic2.invitem=2) and (pic2.drawerempty=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=2) and (pic2.drawerempty=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\shirt.gif');
   pic2.displayeditem:='shirt';
   pic2.finite:=true;
  end;

 if (pic2.invitem=3) and (pic2.coins=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=3) and (pic2.coins=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\coins.gif');
   pic2.displayeditem:='coins';
   pic2.finite:=true;
  end;

 if (pic2.invitem=4) and (pic2.spear=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=4) and (pic2.spear=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\spear.gif');
   pic2.displayeditem:='spear';
   pic2.finite:=true;
  end;

 if (pic2.invitem=5) and (pic2.medallion=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=5) and (pic2.medallion=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\medallion.gif');
   pic2.displayeditem:='medallion';
   pic2.finite:=true;
  end;

 if (pic2.invitem=6) and (pic2.book2=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=6) and (pic2.book2=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\book2.gif');
   pic2.displayeditem:='book2';
   pic2.finite:=true;
  end;

 if (pic2.invitem=7) and (pic2.token=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=7) and (pic2.token=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\token.gif');
   pic2.displayeditem:='token';
   pic2.finite:=true;
  end;

 if (pic2.invitem=8) and (pic2.lens=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=8) and (pic2.lens=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\lens.gif');
   pic2.displayeditem:='lens';
   pic2.finite:=true;
  end;

 if (pic2.invitem=9) and (pic2.blanket=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=9) and (pic2.blanket=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\blanket.gif');
   pic2.displayeditem:='blanket';
   pic2.finite:=true;
  end;

 if (pic2.invitem=10) and (pic2.scroll=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=10) and (pic2.scroll=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\scroll.gif');
   pic2.displayeditem:='scroll';
   pic2.finite:=true;
  end;

 if (pic2.invitem=11) and (pic2.spear2=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=11) and (pic2.spear2=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\spear2.gif');
   pic2.displayeditem:='spear2';
   pic2.finite:=true;
  end;

 if (pic2.invitem=12) and (pic2.spear3=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=12) and (pic2.spear3=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\spear3.gif');
   pic2.displayeditem:='spear3';
   pic2.finite:=true;
  end;

 if (pic2.invitem=13) and (pic2.flask1=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=13) and (pic2.flask1=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\flask1.gif');
   pic2.displayeditem:='flask1';
   pic2.finite:=true;
  end;

 if (pic2.invitem=14) and (pic2.key1=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=14) and (pic2.key1=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\key1.gif');
   pic2.displayeditem:='key1';
   pic2.finite:=true;
  end;

 if (pic2.invitem=15) and (pic2.emptyflask=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=15) and (pic2.emptyflask=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\flask_empty.gif');
   pic2.displayeditem:='emptyflask';
   pic2.finite:=true;
  end;

 if (pic2.invitem=16) and (pic2.sword=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=16) and (pic2.sword=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\sword.gif');
   pic2.displayeditem:='sword';
   pic2.finite:=true;
  end;

 if (pic2.invitem=17) and (pic3.crowbar=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=17) and (pic3.crowbar=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\crowbar.gif');
   pic2.displayeditem:='crowbar';
   pic2.finite:=true;
  end;

 if (pic2.invitem=18) and (pic3.dust=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=18) and (pic3.dust=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\dust.gif');
   pic2.displayeditem:='dust';
   pic2.finite:=true;
  end;

 if (pic2.invitem=19) and (pic3.card=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=19) and (pic3.card=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\card.gif');
   pic2.displayeditem:='card';
   pic2.finite:=true;
  end;

 if (pic2.invitem=20) and (pic3.stone=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=20) and (pic3.stone=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\stone.gif');
   pic2.displayeditem:='stone';
   pic2.finite:=true;
  end;

 if (pic2.invitem=21) and (pic3.mirror=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=21) and (pic3.mirror=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\mirror.gif');
   pic2.displayeditem:='mirror';
   pic2.finite:=true;
  end;

 if (pic2.invitem=22) and (pic3.shieldbook=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=22) and (pic3.shieldbook=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\shieldbook.gif');
   pic2.displayeditem:='shieldbook';
   pic2.finite:=true;
  end;

 if (pic2.invitem=23) and (pic3.cloak=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=23) and (pic3.cloak=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\cloak.gif');
   pic2.displayeditem:='cloak';
   pic2.finite:=true;
  end;

 if (pic2.invitem=24) and (pic3.powder=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=24) and (pic3.powder=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\powder.gif');
   pic2.displayeditem:='powder';
   pic2.finite:=true;
  end;

 if (pic2.invitem=25) and (pic3.yellowflask=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=25) and (pic3.yellowflask=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\flask_yellow.gif');
   pic2.displayeditem:='yellowflask';
   pic2.finite:=true;
  end;

 if (pic2.invitem=26) and (pic3.paper=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=26) and (pic3.paper=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\paper.gif');
   pic2.displayeditem:='paper';
   pic2.finite:=true;
  end;

 if (pic2.invitem=27) and (pic3.waterflask=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=27) and (pic3.waterflask=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\flask2.gif');
   pic2.displayeditem:='waterflask';
   pic2.finite:=true;
  end;

 if (pic2.invitem=28) and (pic3.glass1=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=28) and (pic3.glass1=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\glass1.gif');
   pic2.displayeditem:='glass1';
   pic2.finite:=true;
  end;

 if (pic2.invitem=29) and (pic3.glass2=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=29) and (pic3.glass2=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\glass2.gif');
   pic2.displayeditem:='glass2';
   pic2.finite:=true;
  end;

 if (pic2.invitem=30) and (pic3.glass3=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=30) and (pic3.glass3=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\glass3.gif');
   pic2.displayeditem:='glass3';
   pic2.finite:=true;
  end;

 if (pic2.invitem=31) and (pic3.shieldbook2=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=31) and (pic3.shieldbook2=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\shieldbook2.gif');
   pic2.displayeditem:='shieldbook2';
   pic2.finite:=true;
  end;

 if (pic2.invitem=32) and (light=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=32) and (light=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\light.gif');
   pic2.displayeditem:='light';
   pic2.finite:=true;
  end;

 if (pic2.invitem=33) and (plug=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=33) and (plug=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\plug.gif');
   pic2.displayeditem:='plug';
   pic2.finite:=true;
  end;

 if (pic2.invitem=34) and (chip=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=34) and (chip=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\chip.gif');
   pic2.displayeditem:='chip';
   pic2.finite:=true;
  end;

 if (pic2.invitem=35) and (key2=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=35) and (key2=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\key2.gif');
   pic2.displayeditem:='key2';
   pic2.finite:=true;
  end;

 if (pic2.invitem=36) and (sickle=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=36) and (sickle=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\sickle.gif');
   pic2.displayeditem:='sickle';
   pic2.finite:=true;
  end;

 if (pic2.invitem=37) and (stick1=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=37) and (stick1=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\stick1.gif');
   pic2.displayeditem:='stick1';
   pic2.finite:=true;
  end;

 if (pic2.invitem=38) and (stick2=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=38) and (stick2=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\stick2.gif');
   pic2.displayeditem:='stick2';
   pic2.finite:=true;
  end;

 if (pic2.invitem=39) and (bubble=false) then pic2.invitem:=pic2.invitem+1;
 if (pic2.invitem=39) and (bubble=true) then
  begin
   invpic.Picture.loadfromfile('resources\inv\bubble.gif');
   pic2.displayeditem:='bubble';
   pic2.finite:=true;
  end;

until (pic2.cycles=1) or (pic2.finite=true);

inv_delay.enabled:=false;
end;

procedure TPic4.FormClose(Sender: TObject; var Action: TCloseAction);
begin
 if creditsplaying=true then
  begin
   video1.notify:=false;
   video1.stop;
  end
 else
 if musicstart=false then
  begin
   music1.notify:=false;
   music1.stop;
  end;
 evomenu.show;
end;

procedure TPic4.InvPicClick(Sender: TObject);
begin
 Inv_delay.Enabled:=true;
end;

procedure TPic4.InvPicDblClick(Sender: TObject);
begin
 inv_delay.enabled:=false;
end;

procedure TPic4.FormActivate(Sender: TObject);
begin
 inv_delay.Enabled:=true;
 image1.Picture.LoadFromFile('resources\img\black.jpeg');
 invpic.Visible:=false;

 musicstart:=true;
 Status:=0;
end;

procedure TPic4.FormShow(Sender: TObject);
begin
 delay_vidstart.enabled:=true;
end;

procedure TPic4.Video1Notify(Sender: TObject);
begin
 with Sender as TMediaPlayer do
   begin
     case Mode of
       mpStopped:
        begin
         panel.free;

         if musicstart=true then
          begin
           Music1.FileName:='resources\music\r.avi';
           Music1.Open;
           Music1.play;
           Music1.notify:=true;
           musicstart:=false;
          end;

         if status=0 then
          begin
           invpic.Visible:=true;

           if mirrorsmashed=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_131b.jpeg');
            end
           else
           if mirrorsmashed=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_131.jpeg');
            end;

           bigmirrorsensor.Visible:=false;
          end;

         if status=1 then
          begin

           if mirrorsmashed=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_133.jpeg');
            end
           else
           if mirrorsmashed=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_133b.jpeg');
            end;
           
           bigmirrorsensor.Visible:=false;
          end;

         if status=2 then
          begin
           if mirrorsmashed=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_132.jpeg');
             bigmirrorsensor.Visible:=true;
            end
          else
           if mirrorsmashed=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_134.jpeg');
             bigmirrorsensor.Visible:=true;
            end
          end;

         if status=3 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_135.jpeg');
           bigmirrorsensor.Visible:=false;
           doorsensor.Visible:=true;
           lightsensor.Visible:=false;
           exitsensor.Visible:=false;
          end;

         if status=4 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_136.jpeg');
           doorsensor.Visible:=false;
           doorsensor2.visible:=true;
          end;

         if status=5 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_137.jpeg');
           doorsensor.Visible:=false;
           doorsensor2.visible:=false;
           nav_sensor1.visible:=false;
          end;

         if status=6 then
          begin
           if lighttaken=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_138.jpeg');
             lightsensor.Visible:=true;
            end
           else
           if lighttaken=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_139.jpeg');
            end;

           if firsttimelight=true then
            begin
             firsttimelight:=false;
             light:=true;
             invpic.Picture.loadfromfile('resources\inv\light.gif');
             pic2.displayeditem:='light';
            end;

           exitsensor.visible:=true;
           doorsensor.Visible:=false;
          end;

          if status=7 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_140.jpeg');
           doorsensor2.Visible:=false;
           nav_sensor1.visible:=true;
           nav_sensor2.Visible:=false;
           nav_sensor3.Visible:=false;
          end;

         if status=8 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_135b.jpeg');
           exitsensor.visible:=false;
           lightsensor.Visible:=false;
          end;

         if status=9 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_141.jpeg');
           nav_sensor4.Visible:=false;
           nav_sensor1.visible:=true;
           nav_sensor6.visible:=false;
          end;

         if status=10 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_142.jpeg');
           nav_sensor1.visible:=false;
           nav_sensor2.Visible:=false;
           nav_sensor3.Visible:=false;
           nav_sensor4.Visible:=true;
           nav_sensor6.visible:=false;
          end;

         if status=11 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_143.jpeg');
           nav_sensor1.visible:=false;
           nav_sensor2.Visible:=true;
           nav_sensor3.Visible:=true;
           nav_sensor4.Visible:=false;
           nav_sensor5.visible:=false;
          end;

         if status=12 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_144.jpeg');
           nav_sensor1.visible:=false;
           nav_sensor4.Visible:=false;
           nav_sensor5.Visible:=true;
           nav_sensor7.visible:=false;
           nav_sensor8.visible:=false;
          end;

         if status=13 then
          begin
           if bubble=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_145.jpeg');
            end
           else
           if bubble=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_145b.jpeg');
            end;
            nav_sensor5.Visible:=false;
          end;

         if status=14 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_146.jpeg');
           nav_sensor5.Visible:=false;
           nav_sensor6.visible:=true;
          end;

         if status=15 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_152b.jpeg');
           nav_sensor5.visible:=true;
           chambersensor.Visible:=false;
           entrancesensor.Visible:=false;
           entrancesensor2.visible:=false;
           hallwaysensor.Visible:=false;
          end;

          if status=16 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_152.jpeg');
           nav_sensor3.Visible:=false;
           nav_sensor2.Visible:=false;
           nav_sensor5.visible:=false;
           chambersensor.Visible:=true;
           entrancesensor.Visible:=true;
          end;

          if status=17 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_147.jpeg');
           nav_sensor6.visible:=false;
          end;

          if status=18 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_148.jpeg');
           nav_sensor5.Visible:=false;
          end;

          if status=19 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_150.jpeg');
           nav_sensor7.visible:=false;
           nav_sensor8.visible:=false;
           nav_sensor5.visible:=true;
           boss_sensor1.visible:=false;
           boss_sensor2.visible:=false;
           staffsensor.visible:=false;
          end;

          if status=20 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_149.jpeg');
           nav_sensor7.visible:=true;
           nav_sensor8.visible:=true;
          end;

          if status=21 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_151.jpeg');
           nav_sensor5.Visible:=true;
          end;

          if status=22 then
          begin
           if lighttaken=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_153b.jpeg');
             dark_centersensor.Visible:=false;
            end
           else
            if lighttaken=true then
             begin
              image1.Picture.LoadFromFile('resources\img\4_153.jpeg');
              dark_centersensor.Visible:=true;
             end;

           plugsensor.visible:=false;
           chambersensor.Visible:=false;
           entrancesensor.Visible:=false;
           entrancesensor2.visible:=false;
           hallwaysensor.Visible:=false;
           doorsensor3.visible:=false;
          end;

          if status=23 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_155.jpeg');
           dark_centersensor.Visible:=false;
           plugsensor.visible:=false;
          end;

          if status=24 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_152c.jpeg');
           entrancesensor2.visible:=false;
           hallwaysensor.Visible:=false;
           dark_centersensor.Visible:=false;
           doorsensor3.visible:=true;
           chambersensor.Visible:=false;
          end;

          if status=25 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_158.jpeg');
           entrancesensor2.visible:=true;
           hallwaysensor.Visible:=true;
           dark_centersensor.Visible:=false;
           doorsensor3.visible:=false;
           exitsensor2.visible:=false;
          end;

          if status=26 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_154.jpeg');
           dark_centersensor.Visible:=false;
          end;

          if status=27 then
          begin
           if plugtaken=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_156.jpeg');
             plugsensor.visible:=true;
            end
          else
           if plugtaken=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_157.jpeg');
            end;

          if firsttimeplug=true then
           begin
            firsttimeplug:=false;
            plug:=true;
            invpic.Picture.loadfromfile('resources\inv\plug.gif');
            pic2.displayeditem:='plug';
           end;

          dark_centersensor.Visible:=false;

          end;

         if status=28 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_159.jpeg');
           doorsensor3.visible:=false;
           chipsensor.visible:=false;
           plugsensor2.visible:=false;
           drawersensor.visible:=true;
           locksensor.Visible:=true;
           mirrorexit.visible:=false;
           exitsensor2.visible:=false;

           if firsttimekey2=true then
           begin
            firsttimekey2:=false;
            key2:=true;
            invpic.Picture.loadfromfile('resources\inv\key2.gif');
            pic2.displayeditem:='key2';
           end;
          end;

         if status=29 then
          begin
           if key2taken=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_160.jpeg');
             key2sensor.visible:=true;
            end
          else
           if key2taken=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_161.jpeg');
            end;

           if firsttimekey2=true then
           begin
            firsttimekey2:=false;
            key2:=true;
            invpic.Picture.loadfromfile('resources\inv\key2.gif');
            pic2.displayeditem:='key2';
           end;

           exitsensor2.visible:=true;
           drawersensor.visible:=false;
           locksensor.Visible:=false;

           end;

         if status=30 then
          begin
           if pluginserted=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_162.jpeg');
             plugsensor2.visible:=true;
            end
          else
           if pluginserted=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_163.jpeg');
            end;

           if musicchange=true then
            begin
             Music1.FileName:='resources\music\r.avi';
             Music1.Open;
             Music1.play;
             Music1.notify:=true;
             musicchange:=false;

             invpic.Visible:=true;
            end;

           drawersensor.visible:=false;
           locksensor.Visible:=false;
           mirrorexit.visible:=true;
           mirrorexit2.Visible:=false;

           end;

          if status=31 then
          begin
           if chiptaken=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_164.jpeg');
             chipsensor.visible:=true;
            end
          else
           if chiptaken=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_165.jpeg');
            end;

           if firsttimechip=true then
           begin
            firsttimechip:=false;
            chip:=true;
            invpic.Picture.loadfromfile('resources\inv\chip.gif');
            pic2.displayeditem:='chip';
           end;

           drawersensor.visible:=false;
           locksensor.Visible:=false;

           end;

          if status=32 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_164b.jpeg');
           drawersensor.visible:=false;
           locksensor.Visible:=false;
          end;

          if status=33 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_167.jpeg');
           mirrorexit.visible:=false;
           mirrorexit2.Visible:=false;
           nav_sensor5.visible:=true;

           if musicchange=true then
            begin
             Music1.FileName:='resources\music\k.avi';
             Music1.Open;
             Music1.play;
             Music1.notify:=true;
             musicchange:=false;
            end;
          end;

          if status=34 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_168.jpeg');
           mirrorexit2.Visible:=true;
           nav_sensor5.visible:=false;
          end;

          if status=35 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_169.jpeg');
           nav_sensor5.visible:=false;
           signsensor.Visible:=true;
           signsensor2.Visible:=true;
           gatesensor.Visible:=true;
          end;

          if status=36 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_170.jpeg');
           signsensor.Visible:=false;
           signsensor2.Visible:=false;
           gatesensor.Visible:=false;
          end;

          if status=37 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_172.jpeg');
           signsensor.Visible:=false;
           signsensor2.Visible:=false;
           gatesensor.Visible:=false;
           nav_sensor5.Visible:=false;
           rightaislesensor.visible:=true;
           leftaislesensor.visible:=true;
           ae_sensor.visible:=true;

           ari_candle.visible:=false;
           ae_candle.visible:=false;
           dem_candle.Visible:=false;
          end;

          if status=38 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_176.jpeg');
           nav_sensor5.Visible:=true;
           rightaislesensor.visible:=false;
           leftaislesensor.visible:=false;
           ae_sensor.visible:=false;
           graves_exitsensor.visible:=false;
          end;

          if status=39 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_173.jpeg');
           rightaislesensor.visible:=false;
           leftaislesensor.visible:=false;
           ae_sensor.visible:=false;
           rightexitsensor.visible:=true;
           graves_exitsensor.visible:=false;

           in_candle.Visible:=false;
           hl_candle.Visible:=false;
          end;

          if status=40 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_177.jpeg');
           rightaislesensor.visible:=false;
           leftaislesensor.visible:=false;
           ae_sensor.visible:=false;
           leftexitsensor.visible:=true;
           graves_exitsensor.visible:=false;

           gg_candle.visible:=false;
           jcm_candle.Visible:=false;
          end;

          if status=41 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_175.jpeg');
           leftexitsensor.Visible:=false;
           graves_exitsensor.visible:=true;
           chapel_rightsensor.visible:=false;
          end;

          if status=42 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_179.jpeg');
           rightexitsensor.visible:=false;
           graves_exitsensor.visible:=true;
           chapel_leftsensor.visible:=false;
          end;

          if status=43 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_178.jpeg');
           leftexitsensor.visible:=false;
           chapel_leftsensor.visible:=true;
          end;

          if status=44 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_174.jpeg');
           rightexitsensor.visible:=false;
           chapel_rightsensor.visible:=true;
          end;

          if status=45 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_180.jpeg');
           nav_sensor5.Visible:=true;
           chapel_rightsensor.visible:=false;
           chapel_leftsensor.visible:=false;
          end;

          if status=46 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_181.jpeg');
           nav_sensor5.Visible:=false;
          end;

          if status=47 then
          begin
           if ari_lit=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_182.jpeg');
             ari_candle.visible:=true;
            end
           else
            if ari_lit=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_203.jpeg');
            end;
          end;

          if status=48 then
          begin
           if dem_lit=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_184.jpeg');
             dem_candle.Visible:=true;
            end
           else
            if dem_lit=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_202.jpeg');
            end;
          end;

          if status=49 then
          begin
           if ae_lit=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_183.jpeg');
             ae_candle.Visible:=true;
            end
           else
            if ae_lit=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_208.jpeg');
            end;

           invpic.visible:=true; 

           if musicpause=true then
            begin
             musicpause:=false;
             music1.Notify:=true;
             music1.play;
            end;
          end;

          if status=50 then
          begin
           if in_lit=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_187.jpeg');
             in_candle.Visible:=true;
            end
           else
            if in_lit=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_204.jpeg');
            end;

            rightexitsensor.visible:=false;
          end;

          if status=51 then
          begin
           if hl_lit=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_188.jpeg');
             hl_candle.Visible:=true;
            end
           else
            if hl_lit=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_205.jpeg');
            end;

            rightexitsensor.visible:=false;
          end;

          if status=52 then
          begin
           if jcm_lit=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_186.jpeg');
             jcm_candle.Visible:=true;
            end
           else
            if jcm_lit=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_207.jpeg');
            end;

            leftexitsensor.visible:=false;
          end;

          if status=53 then
          begin
           if gg_lit=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_185.jpeg');
             gg_candle.Visible:=true;
            end
           else
            if gg_lit=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_206.jpeg');
            end;

            leftexitsensor.visible:=false;
          end;

          if status=54 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_189.jpeg');
           nav_sensor5.Visible:=false;
           bushsensor.Visible:=false;
          end;

          if status=55 then
          begin
           if sickleused=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_190.jpeg');
             bushsensor.Visible:=true;
            end
           else
            if sickleused=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_201.jpeg');
            end;

            nav_sensor5.visible:=true;
          end;

          if status=56 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_191.jpeg');
           nav_sensor5.Visible:=false;
           smallchapelsensor.Visible:=false;
           holesensor.Visible:=false;
           bushsensor.Visible:=false;
          end;

          if status=57 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_192.jpeg');
           nav_sensor5.Visible:=false;
           smallchapelsensor.Visible:=true;
           holesensor.Visible:=true;
          end;

          if status=58 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_193.jpeg');
           smallchapelsensor.Visible:=false;
           holesensor.Visible:=false;
           gravesensor.visible:=true;
           sicklesensor.visible:=false;
          end;

          if status=59 then
          begin
           if sickletaken=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_194.jpeg');
            end
           else
            if sickletaken=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_195.jpeg');
            end;

           if firsttimesickle=true then
           begin
            firsttimesickle:=false;
            sickle:=true;
            invpic.Picture.loadfromfile('resources\inv\sickle.gif');
            pic2.displayeditem:='sickle';
           end;

            sicklesensor.visible:=true;
            gravesensor.visible:=false;
          end;

          if status=60 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_196.jpeg');
           gravesensor.visible:=false;
           nav_sensor5.Visible:=true;
          end;

          if status=61 then
          begin
           if chipused=false then
            begin
             image1.Picture.LoadFromFile('resources\img\4_197.jpeg');
             chipslotsensor.visible:=true;
            end
           else
            if chipused=true then
            begin
             image1.Picture.LoadFromFile('resources\img\4_200.jpeg');
             candlessensor.Visible:=true;
            end;

           if firsttimestick1=true then
           begin
            firsttimestick1:=false;
            stick1:=true;
            invpic.Picture.loadfromfile('resources\inv\stick1.gif');
            pic2.displayeditem:='stick1';
           end;

           litcandlesensor.Visible:=false;
           sticksensor.Visible:=true;
           smallchapelsensor.Visible:=false;
           holesensor.Visible:=false;
           nav_sensor5.visible:=false;
          end;

          if status=62 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_198.jpeg');
           sticksensor.Visible:=false;
           chipslotsensor.visible:=false;
           candlessensor.Visible:=false;
           litcandlesensor.Visible:=true;

           if firsttimestick2=true then
           begin
            firsttimestick2:=false;
            stick2:=true;
            invpic.Picture.loadfromfile('resources\inv\stick2.gif');
            pic2.displayeditem:='stick2';
           end;
          end;

          if status=63 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_199.jpeg');
           nav_sensor5.visible:=true;
           sticksensor.Visible:=false;
           chipslotsensor.visible:=false;
           candlessensor.Visible:=false;
          end;

          if status=64 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_210.jpeg');

           sound.FileName:='resources\audio\ghost.avi';
           sound.Open;
           sound.play;
           sound.notify:=true;
          end;

          if status=65 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_201b.jpeg');
           bushsensor.Visible:=false;
          end;

          if status=66 then
          begin
           bubble:=true;
           invpic.Picture.loadfromfile('resources\inv\bubble.gif');
           pic2.displayeditem:='bubble';
           bosspresent:=true;
           videoplay('resources\anim\4_540c.avi');
           status:=30;
          end;

          if status=67 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_212.jpeg');
           nav_sensor5.visible:=false;
           throwback1.enabled:=true;
           boss_sensor1.visible:=true;
          end;

          if status=68 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_213.jpeg');
           throwback1.enabled:=false;
           throwback2.enabled:=true;
           boss_sensor1.visible:=false;
           boss_sensor2.visible:=true;
          end;

          if status=69 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_214.jpeg');
           throwback2.enabled:=false;
           throwback3.enabled:=true;
           boss_sensor2.visible:=false;
           staffsensor.visible:=true;
          end;

          if status=70 then
          begin
           image1.Picture.LoadFromFile('resources\img\4_211.jpeg');
           final_delay.enabled:=true;
          end;

          if status=71 then
          begin
           image1.Picture.LoadFromFile('resources\img\black.jpeg');

           sound.FileName:='resources\audio\positiv_negativ.avi';
           sound.Open;
           sound.play;
           sound.notify:=true;
          end;
         end;
       end;
      Notify := True;
   end;
end;

procedure TPic4.Music1Notify(Sender: TObject);
begin
if music1.NotifyValue=nvSuccessful then
  begin
    music1.Play;
    music1.Notify := True;
  end;
end;

procedure TPic4.right_sensorDblClick(Sender: TObject);
begin
 if (status=0) and (mirrorsmashed=false) then
  begin
   videoplay('resources\anim\4_384.avi');
   status:=1;
  end
else
 if (status=0) and (mirrorsmashed=true) then
  begin
   videoplay('resources\anim\4_385.avi');
   status:=1;
  end
else
 if (status=1) and (mirrorsmashed=false) then
  begin
   videoplay('resources\anim\4_389.avi');
   status:=2;
  end
else
 if (status=1) and (mirrorsmashed=true) then
  begin
   videoplay('resources\anim\4_391.avi');
   status:=2;
  end
else
 if (status=2) and (mirrorsmashed=false) then
  begin
   videoplay('resources\anim\4_392.avi');
   status:=0;
  end
else
 if (status=2) and (mirrorsmashed=true) then
  begin
   videoplay('resources\anim\4_394.avi');
   status:=0;
  end
else
 if (status=6) and (lighttaken=false) then
  begin
   videoplay('resources\anim\4_407.avi');
   status:=3;
  end
else
 if (status=6) and (lighttaken=true) then
  begin
   videoplay('resources\anim\4_405.avi');
   status:=3;
  end
else
 if status=8 then
  begin
   videoplay('resources\anim\4_396.avi');
   status:=1;
  end
else
 if status=4 then
  begin
   videoplay('resources\anim\4_404.avi');
   status:=5;
  end
else
 if (status=5) and (lighttaken=false) then
  begin
   videoplay('resources\anim\4_403.avi');
   status:=6;
  end
else
 if (status=5) and (lighttaken=true) then
  begin
   videoplay('resources\anim\4_402.avi');
   status:=6;
  end
else
 if status=7 then
  begin
   videoplay('resources\anim\4_419.avi');
   status:=11;
  end
else
 if status=9 then
  begin
   videoplay('resources\anim\4_430.avi');
   status:=7;
  end
else
 if status=10 then
  begin
   videoplay('resources\anim\4_426.avi');
   status:=9;
  end
else
 if status=14 then
  begin
   videoplay('resources\anim\4_433.avi');
   status:=10;
  end
else
 if status=15 then
  begin
   videoplay('resources\anim\4_441.avi');
   status:=16;
  end
else
 if status=17 then
  begin
   videoplay('resources\anim\4_488.avi');
   status:=18;
  end
else
 if status=20 then
  begin
   videoplay('resources\anim\4_492.avi');
   status:=18;
  end
else
 if status=21 then
  begin
   videoplay('resources\anim\4_498.avi');
   status:=12;
  end
else
 if status=21 then
  begin
   videoplay('resources\anim\4_500.avi');
   status:=19;
  end
else
 if (status=25) and (lighttaken=false) then
  begin
   videoplay('resources\anim\4_449.avi');
   status:=22;
  end
else
 if (status=25) and (lighttaken=true) then
  begin
   videoplay('resources\anim\4_448.avi');
   status:=22;
  end
else
 if status=24 then
  begin
   videoplay('resources\anim\4_452.avi');
   status:=25;
  end
else
 if status=26 then
  begin
   videoplay('resources\anim\4_466.avi');
   status:=23;
  end
else
 if (status=23) and (plugtaken=false) then
  begin
   videoplay('resources\anim\4_463.avi');
   status:=27;
  end
else
 if (status=23) and (plugtaken=true) then
  begin
   videoplay('resources\anim\4_462.avi');
   status:=27;
  end
else
 if (status=29) and (key2taken=false) then
  begin
   videoplay('resources\anim\4_484.avi');
   status:=28;
  end
 else
 if (status=29) and (key2taken=true) then
  begin
   videoplay('resources\anim\4_487.avi');
   status:=28;
  end
else
 if (status=28) and (pluginserted=false) then
  begin
   videoplay('resources\anim\4_469.avi');
   status:=30;
  end
else
 if (status=28) and (pluginserted=true) then
  begin
   videoplay('resources\anim\4_468.avi');
   status:=30;
  end
else
 if status=34 then
  begin
   videoplay('resources\anim\4_539.avi');
   status:=33;
  end
else
 if status=38 then
  begin
   videoplay('resources\anim\4_555.avi');
   status:=37;
  end
else
if (status=48) and (dem_lit=false) then
  begin
   videoplay('resources\anim\4_557.avi');
   status:=37;
  end
else
 if (status=48) and (dem_lit=true) then
  begin
   videoplay('resources\anim\4_556.avi');
   status:=37;
  end
else
if (status=37) and (ari_lit=false) then
  begin
   videoplay('resources\anim\4_552.avi');
   status:=47;
  end
else
 if (status=37) and (ari_lit=true) then
  begin
   videoplay('resources\anim\4_553.avi');
   status:=47;
  end
else
if (status=53) and (gg_lit=false) then
  begin
   videoplay('resources\anim\4_528.avi');
   status:=40;
  end
else
 if (status=53) and (gg_lit=true) then
  begin
   videoplay('resources\anim\4_527.avi');
   status:=40;
  end
else
if (status=40) and (jcm_lit=false) then
  begin
   videoplay('resources\anim\4_522.avi');
   status:=52;
  end
else
 if (status=40) and (jcm_lit=true) then
  begin
   videoplay('resources\anim\4_523.avi');
   status:=52;
  end
else
 if status=43 then
  begin
   videoplay('resources\anim\4_533.avi');
   status:=42;
  end
else
if (status=39) and (in_lit=false) then
  begin
   videoplay('resources\anim\4_507.avi');
   status:=50;
  end
else
 if (status=39) and (in_lit=true) then
  begin
   videoplay('resources\anim\4_508.avi');
   status:=50;
  end
else
if (status=51) and (hl_lit=false) then
  begin
   videoplay('resources\anim\4_517.avi');
   status:=39;
  end
else
 if (status=51) and (hl_lit=true) then
  begin
   videoplay('resources\anim\4_516.avi');
   status:=39;
  end
else
 if status=44 then
  begin
   videoplay('resources\anim\4_504.avi');
   status:=45;
  end
else
 if status=46 then
  begin
   videoplay('resources\anim\4_597.avi');
   status:=41;
  end
else
 if status=45 then
  begin
   videoplay('resources\anim\4_578.avi');
   status:=54;
  end
else
 if (status=54) and (sickleused=false) then
  begin
   videoplay('resources\anim\4_581.avi');
   status:=55;
  end
else
 if (status=54) and (sickleused=true) then
  begin
   videoplay('resources\anim\4_582.avi');
   status:=55;
  end
else
 if (status=55) and (sickleused=false) then
  begin
   videoplay('resources\anim\4_591.avi');
   status:=56;
  end
else
 if (status=55) and (sickleused=true) then
  begin
   videoplay('resources\anim\4_586.avi');
   status:=56;
  end
else
 if status=56 then
  begin
   videoplay('resources\anim\4_594.avi');
   status:=46;
  end
else
 if (status=60) and (chipused=false) then
  begin
   videoplay('resources\anim\4_573.avi');
   status:=61;
  end
else
 if (status=60) and (chipused=true) then
  begin
   videoplay('resources\anim\4_574.avi');
   status:=61;
  end
else
 if status=67 then
  begin
   videoplay('resources\anim\4_619.avi');
   throwback1.Enabled:=false;
   status:=19;
  end
end;

procedure TPic4.left_sensorDblClick(Sender: TObject);
begin
 if (status=0) and (mirrorsmashed=false) then
  begin
   videoplay('resources\anim\4_386.avi');
   status:=2;
  end
else
if (status=0) and (mirrorsmashed=true) then
  begin
   videoplay('resources\anim\4_387.avi');
   status:=2;
  end
else
 if (status=2) and (mirrorsmashed=false) then
  begin
   videoplay('resources\anim\4_393.avi');
   status:=1;
  end
else
 if (status=2) and (mirrorsmashed=true) then
  begin
   videoplay('resources\anim\4_395.avi');
   status:=1;
  end
else
 if (status=1) and (mirrorsmashed=false) then
  begin
   videoplay('resources\anim\4_388.avi');
   status:=0;
  end
else
 if (status=1) and (mirrorsmashed=true) then
  begin
   videoplay('resources\anim\4_390.avi');
   status:=0;
  end
else
 if (status=3) and (lighttaken=false) then
  begin
   videoplay('resources\anim\4_410.avi');
   status:=6;
  end
else
 if (status=3) and (lighttaken=true) then
  begin
   videoplay('resources\anim\4_409.avi');
   status:=6;
  end
else
 if status=8 then
  begin
   videoplay('resources\anim\4_397.avi');
   status:=2;
  end
else
 if status=7 then
  begin
   videoplay('resources\anim\4_418b.avi');
   status:=5;
  end
else
 if status=5 then
  begin
   videoplay('resources\anim\4_401.avi');
   status:=4;
  end
else
 if status=11 then
  begin
   videoplay('resources\anim\4_421.avi');
   status:=7;
  end
else
 if status=12 then
  begin
   videoplay('resources\anim\4_427.avi');
   status:=14;
  end
else
 if status=9 then
  begin
  videoplay('resources\anim\4_431.avi');
   status:=10;
  end
else
 if status=14 then
  begin
   videoplay('resources\anim\4_434.avi');
   status:=9;
  end
else
 if status=10 then
  begin
   videoplay('resources\anim\4_424.avi');
   status:=11;
  end
else
 if status=16 then
  begin
   videoplay('resources\anim\4_455.avi');
   status:=15;
  end
else
if status=17 then
  begin
   videoplay('resources\anim\4_489.avi');
   status:=19;
  end
else
if status=18 then
  begin
   videoplay('resources\anim\4_494.avi');
   status:=20;
  end
else
if status=19 then
  begin
   videoplay('resources\anim\4_496.avi');
   status:=21;
  end
else
if status=23 then
  begin
   videoplay('resources\anim\4_464.avi');
   status:=26;
  end
else
if (status=27) and (plugtaken=false) then
  begin
   videoplay('resources\anim\4_458.avi');
   status:=23;
  end
else
if (status=27) and (plugtaken=true) then
  begin
   videoplay('resources\anim\4_460.avi');
   status:=23;
  end
else
if (status=22) and (lighttaken=false) then
  begin
   videoplay('resources\anim\4_442.avi');
   status:=25;
  end
else
if (status=22) and (lighttaken=true) then
  begin
   videoplay('resources\anim\4_443.avi');
   status:=25;
  end
else
if (status=28) and (key2taken=false) then
  begin
   videoplay('resources\anim\4_474.avi');
   status:=29;
  end
else
if (status=28) and (key2taken=true) then
  begin
   videoplay('resources\anim\4_473.avi');
   status:=29;
  end
else
 if (status=30) and (pluginserted=false) then
  begin
   videoplay('resources\anim\4_475.avi');
   status:=28;
  end
else
 if (status=30) and (pluginserted=true) then
  begin
   videoplay('resources\anim\4_478.avi');
   status:=28;
  end
else
 if status=33 then
  begin
   videoplay('resources\anim\4_536.avi');
   status:=34;
  end
else
 if status=34 then
  begin
   videoplay('resources\anim\4_538.avi');
  end
else
 if status=36 then
  begin
   videoplay('resources\anim\4_541.avi');
   status:=35;
  end
else
if (status=37) and (dem_lit=false) then
  begin
   videoplay('resources\anim\4_548.avi');
   status:=48;
  end
else
 if (status=37) and (dem_lit=true) then
  begin
   videoplay('resources\anim\4_549.avi');
   status:=48;
  end
else
if (status=47) and (ari_lit=false) then
  begin
   videoplay('resources\anim\4_564.avi');
   status:=37;
  end
else
 if (status=47) and (ari_lit=true) then
  begin
   videoplay('resources\anim\4_563.avi');
   status:=37;
  end
else
if (status=40) and (gg_lit=false) then
  begin
   videoplay('resources\anim\4_520.avi');
   status:=53;
  end
else
 if (status=50) and (gg_lit=true) then
  begin
   videoplay('resources\anim\4_521.avi');
   status:=53;
  end
else
if (status=52) and (jcm_lit=false) then
  begin
   videoplay('resources\anim\4_531.avi');
   status:=40;
  end
else
 if (status=52) and (jcm_lit=true) then
  begin
   videoplay('resources\anim\4_530.avi');
   status:=40;
  end
else
 if status=44 then
  begin
   videoplay('resources\anim\4_503.avi');
   status:=41;
  end
else
if (status=50) and (in_lit=false) then
  begin
   videoplay('resources\anim\4_514.avi');
   status:=39;
  end
else
 if (status=50) and (in_lit=true) then
  begin
   videoplay('resources\anim\4_513.avi');
   status:=39;
  end
else
if (status=39) and (hl_lit=false) then
  begin
   videoplay('resources\anim\4_509.avi');
   status:=51;
  end
else
 if (status=39) and (hl_lit=true) then
  begin
   videoplay('resources\anim\4_510.avi');
   status:=51;
  end
else
 if status=43 then
  begin
   videoplay('resources\anim\4_534.avi');
   status:=45;
  end
else
 if status=46 then
  begin
   videoplay('resources\anim\4_596.avi');
   status:=42;
  end
else
 if status=45 then
  begin
   videoplay('resources\anim\4_580.avi');
   status:=57;
  end
else
 if status=54 then
  begin
   videoplay('resources\anim\4_583.avi');
   status:=46;
  end
else
 if (status=55) and (sickleused=false) then
  begin
   videoplay('resources\anim\4_589.avi');
   status:=54;
  end
else
 if (status=55) and (sickleused=true) then
  begin
   videoplay('resources\anim\4_584.avi');
   status:=54;
  end
else
 if (status=56) and (sickleused=false) then
  begin
   videoplay('resources\anim\4_592.avi');
   status:=55;
  end
else
 if (status=56) and (sickleused=true) then
  begin
   videoplay('resources\anim\4_593.avi');
   status:=55;
  end
else
 if status=58 then
  begin
   videoplay('resources\anim\4_571.avi');
   status:=60;
  end
else
 if status=67 then
  begin
   videoplay('resources\anim\4_616.avi');
   status:=68;
   throwback1.enabled:=false;
  end
end;

procedure TPic4.InvPicMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
 if (Button = mbRight) and (pic2.displayeditem='crowbar') then InvPic.BeginDrag(False);
 if (Button = mbRight) and (pic2.displayeditem='plug') then InvPic.BeginDrag(False);
 if (Button = mbRight) and (pic2.displayeditem='key2') then InvPic.BeginDrag(False);
 if (Button = mbRight) and (pic2.displayeditem='sickle') then InvPic.BeginDrag(False);
 if (Button = mbRight) and (pic2.displayeditem='chip') then InvPic.BeginDrag(False);
 if (Button = mbRight) and (pic2.displayeditem='stick1') then InvPic.BeginDrag(False);
 if (Button = mbRight) and (pic2.displayeditem='stick2') then InvPic.BeginDrag(False);
 if (Button = mbRight) and (pic2.displayeditem='bubble') then InvPic.BeginDrag(False);
end;

procedure TPic4.InvPicEndDrag(Sender, Target: TObject; X, Y: Integer);
begin
if Target = boss_sensor2 then
  begin
   if pic2.displayeditem='bubble' then
    begin
     bubble:=false;
     invpic.picture.loadfromfile('resources/img/black.jpeg');
     inv_delay.Enabled:=true;
    end
   end
else
if Target = boss_sensor1 then
  begin
   if pic2.displayeditem='bubble' then
    begin
     bubble:=false;
     invpic.picture.loadfromfile('resources/img/black.jpeg');
     inv_delay.Enabled:=true;
    end
   end
else
if Target = litcandlesensor then
  begin
   if pic2.displayeditem='stick1' then
    begin
     stick1:=false;
     invpic.picture.loadfromfile('resources/img/black.jpeg');
     inv_delay.Enabled:=true;
    end
   end
else
if Target = chipslotsensor then
  begin
   if pic2.displayeditem='chip' then
    begin
     chip:=false;
     invpic.picture.loadfromfile('resources/img/black.jpeg');
     inv_delay.Enabled:=true;
    end
   end
else
if Target = bigmirrorsensor then
  begin
   if pic2.displayeditem='crowbar' then
    begin
     pic3.crowbar:=false;
     invpic.picture.loadfromfile('resources/img/black.jpeg');
     inv_delay.Enabled:=true;
    end
   end
else
if Target = plugsensor2 then
  begin
   if pic2.displayeditem='plug' then
    begin
     plug:=false;
     invpic.picture.loadfromfile('resources/img/black.jpeg');
     inv_delay.Enabled:=true;
    end
   end
else
if Target = locksensor then
  begin
   if pic2.displayeditem='key2' then
    begin
     key2:=false;
     invpic.picture.loadfromfile('resources/img/black.jpeg');
     inv_delay.Enabled:=true;
    end
   end
end;

procedure TPic4.bigmirrorsensorDragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
if (Status=2) and (pic2.displayeditem='crowbar') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.bigmirrorsensorDragDrop(Sender, Source: TObject; X,
  Y: Integer);
begin
 if (status=2) and (pic2.displayeditem='crowbar') and (mirrorsmashed=false) then
  begin
   videoplay('resources\anim\4_383.avi');
   mirrorsmashed:=true;
  end
end;

procedure TPic4.delay_vidstartTimer(Sender: TObject);
begin
 delay_vidstart.enabled:=false;
 videoplay('resources\video\pic4intro.avi');
 status:=0;
end;

procedure TPic4.bigmirrorsensorDblClick(Sender: TObject);
begin
  if (status=2) and (mirrorsmashed=true) then
  begin
   videoplay('resources\anim\4_399.avi');
   status:=3;
  end
end;

procedure TPic4.doorsensorDblClick(Sender: TObject);
begin
 if status=3 then
  begin
   videoplay('resources\anim\4_408.avi');
   status:=4;
  end
end;

procedure TPic4.exitsensorDblClick(Sender: TObject);
begin
 if (status=6) and (lighttaken=false) then
  begin
   videoplay('resources\anim\4_414b.avi');
   status:=8;
  end
 else
  if (status=6) and (lighttaken=true) then
  begin
   videoplay('resources\anim\4_413b.avi');
   status:=8;
  end
end;

procedure TPic4.doorsensor2DblClick(Sender: TObject);
begin
 if status=4 then
  begin
   videoplay('resources\anim\4_415b.avi');
   status:=7;
  end
end;

procedure TPic4.lightsensorDblClick(Sender: TObject);
begin
 if status=6 then
  begin
   videoplay('resources\anim\4_406.avi');
   lighttaken:=true;
   firsttimelight:=true;
  end
end;

procedure TPic4.nav_sensor1DblClick(Sender: TObject);
begin
 if status=7 then
  begin
   videoplay('resources\anim\4_420.avi');
   status:=9;
  end
else
 if status=9 then
  begin
   videoplay('resources\anim\4_432.avi');
   status:=12;
  end
end;

procedure TPic4.bottom_sensorDblClick(Sender: TObject);
begin
 if status=12 then
  begin
   videoplay('resources\anim\4_427.avi');
   status:=14;
  end
else
 if (status=13) and (bosspresent=false) then
  begin
   videoplay('resources\anim\4_437.avi');
   status:=12;
  end
else
 if (status=13) and (bosspresent=true) then
  begin
   videoplay('resources\anim\4_436.avi');
   status:=12;
  end
else
if (status=22) and (lighttaken=false) then
  begin
   videoplay('resources\anim\4_442.avi');
   status:=25;
  end
else
if (status=22) and (lighttaken=true) then
  begin
   videoplay('resources\anim\4_443.avi');
   status:=25;
  end
else
if status=23 then
  begin
   videoplay('resources\anim\4_461.avi');
   status:=22;
  end
else
 if status=26 then
  begin
   videoplay('resources\anim\4_465.avi');
   status:=22;
  end
else
 if (status=27) and (plugtaken=false) then
  begin
   videoplay('resources\anim\4_456.avi');
   status:=22;
  end
else
 if (status=27) and (plugtaken=true) then
  begin
   videoplay('resources\anim\4_459.avi');
   status:=22;
  end
else
 if status=32 then
  begin
   videoplay('resources\anim\4_482.avi');
   status:=28;
  end
else
 if (status=31) and (chiptaken=false) then
  begin
   videoplay('resources\anim\4_479.avi');
   status:=28;
   firsttimekey2:=true;
  end
else
 if (status=31) and (chiptaken=true) then
  begin
   videoplay('resources\anim\4_481.avi');
   status:=28;
   firsttimekey2:=true;
  end
else
 if status=36 then
  begin
   videoplay('resources\anim\4_541.avi');
   status:=35;
  end
else
 if status=37 then
  begin
   videoplay('resources\anim\4_547.avi');
   status:=38;
  end
else
 if status=38 then
  begin
   videoplay('resources\anim\4_555.avi');
   status:=37;
  end
else
 if (status=49) and (ae_lit=false) then
  begin
   videoplay('resources\anim\4_562.avi');
   status:=37;
  end
else
if (status=48) and (dem_lit=false) then
  begin
   videoplay('resources\anim\4_557.avi');
   status:=37;
  end
else
 if (status=48) and (dem_lit=true) then
  begin
   videoplay('resources\anim\4_556.avi');
   status:=37;
  end
else
if (status=47) and (ari_lit=false) then
  begin
   videoplay('resources\anim\4_564.avi');
   status:=37;
  end
else
 if (status=47) and (ari_lit=true) then
  begin
   videoplay('resources\anim\4_563.avi');
   status:=37;
  end
else
 if status=40 then
  begin
   videoplay('resources\anim\4_519.avi');
   status:=41;
  end
else
 if status=41 then
  begin
   videoplay('resources\anim\4_525.avi');
   status:=40;
  end
else
if (status=53) and (gg_lit=false) then
  begin
   videoplay('resources\anim\4_528.avi');
   status:=40;
  end
else
 if (status=53) and (gg_lit=true) then
  begin
   videoplay('resources\anim\4_527.avi');
   status:=40;
  end
else
if (status=52) and (jcm_lit=false) then
  begin
   videoplay('resources\anim\4_531.avi');
   status:=40;
  end
else
 if (status=52) and (jcm_lit=true) then
  begin
   videoplay('resources\anim\4_530.avi');
   status:=40;
  end
else
 if status=39 then
  begin
   videoplay('resources\anim\4_506.avi');
   status:=42;
  end
else
 if status=42 then
  begin
   videoplay('resources\anim\4_511.avi');
   status:=39;
  end
else
if (status=50) and (in_lit=false) then
  begin
   videoplay('resources\anim\4_514.avi');
   status:=39;
  end
else
 if (status=50) and (in_lit=true) then
  begin
   videoplay('resources\anim\4_513.avi');
   status:=39;
  end
else
if (status=51) and (hl_lit=false) then
  begin
   videoplay('resources\anim\4_517.avi');
   status:=39;
  end
else
 if (status=51) and (hl_lit=true) then
  begin
   videoplay('resources\anim\4_516.avi');
   status:=39;
  end
else
 if status=46 then
  begin
   videoplay('resources\anim\4_598.avi');
   status:=45;
  end
else
 if status=45 then
  begin
   videoplay('resources\anim\4_579.avi');
   status:=46;
  end
else
 if status=56 then
  begin
   videoplay('resources\anim\4_595.avi');
   status:=57;
  end
else
 if status=57 then
  begin
   videoplay('resources\anim\4_600.avi');
   status:=56;
  end
else
 if (status=61) and (chipused=false) then
  begin
   videoplay('resources\anim\4_607.avi');
   status:=63;
  end
else
 if (status=61) and (chipused=true) then
  begin
   videoplay('resources\anim\4_604.avi');
   status:=63;
  end
else
 if (status=63) and (chipused=false) then
  begin
   videoplay('resources\anim\4_610.avi');
   status:=61;
  end
else
 if (status=63) and (chipused=true) then
  begin
   videoplay('resources\anim\4_611.avi');
   status:=61;
  end
else
 if status=58 then
  begin
   videoplay('resources\anim\4_571.avi');
   status:=60;
  end
else
 if (status=59) and (sickletaken=false) then
  begin
   videoplay('resources\anim\4_566.avi');
   status:=58;
  end
else
 if (status=59) and (sickletaken=true) then
  begin
   videoplay('resources\anim\4_568.avi');
   status:=58;
  end
else
if status=65 then
  begin
   videoplay('resources\anim\4_587.avi');
   status:=55;
  end
else
 if status=62 then
  begin
   videoplay('resources\anim\4_613.avi');
   status:=61;
  end
end;

procedure TPic4.nav_sensor2DblClick(Sender: TObject);
begin
 if status=11 then
  begin
   videoplay('resources\anim\4_422.avi');
   status:=10;
  end
end;

procedure TPic4.nav_sensor4DblClick(Sender: TObject);
begin
 if status=10 then
  begin
   videoplay('resources\anim\4_425.avi');
   status:=12;
  end
end;

procedure TPic4.nav_sensor5DblClick(Sender: TObject);
begin
if (status=12) and (bosspresent=false) then
  begin
   videoplay('resources\anim\4_428.avi');
   status:=13;
  end
else
if (status=12) and (bosspresent=true) then
  begin
   videoplay('resources\anim\4_429.avi');
   status:=13;
  end
else
if status=15 then
  begin
   videoplay('resources\anim\4_454.avi');
   status:=11;
  end
else
if status=21 then
  begin
   videoplay('resources\anim\4_499.avi');
   status:=18;
  end
else
if (status=19) and (bosspresent=false) then
  begin
   videoplay('resources\anim\4_495.avi');
  end
else
if (status=19) and (bosspresent=true) then
  begin
   videoplay('resources\anim\4_497b.avi');
   status:=67;
  end
else
if status=33 then
  begin
   videoplay('resources\anim\4_537.avi');
   status:=35;
  end
else
if status=38 then
  begin
   videoplay('resources\anim\4_554.avi');
   status:=34;
  end
else
if (status=45) and (chapelopen=false) then
  begin
   videoplay('resources\anim\4_575.avi');
  end
else
if (status=45) and (chapelopen=true) then
  begin
   music1.notify:=false;
   music1.Stop;
   invpic.Visible:=false;
   videoplay('resources\anim\4_576.avi');
   status:=64;
  end
else
if status=63 then
  begin
   videoplay('resources\anim\4_609.avi');
   status:=56;
  end
else
if status=60 then
  begin
   videoplay('resources\anim\4_572.avi');
   status:=56;
  end
else
if status=55 then
  begin
   videoplay('resources\anim\4_585.avi');
   status:=65;
  end
end;

procedure TPic4.nav_sensor3DblClick(Sender: TObject);
begin
if status=11 then
  begin
   videoplay('resources\anim\4_423.avi');
   status:=16;
  end
end;

procedure TPic4.nav_sensor6DblClick(Sender: TObject);
begin
if status=14 then
  begin
   videoplay('resources\anim\4_435.avi');
   status:=17;
  end
end;

procedure TPic4.nav_sensor7DblClick(Sender: TObject);
begin
 if status=20 then
  begin
   videoplay('resources\anim\4_493.avi');
   status:=19;
  end
end;

procedure TPic4.nav_sensor8DblClick(Sender: TObject);
begin
 if status=20 then
  begin
   videoplay('resources\anim\4_491.avi');
   status:=12;
  end
end;

procedure TPic4.entrancesensorDblClick(Sender: TObject);
begin
 if status=16 then
  begin
   videoplay('resources\anim\4_440.avi');
   status:=24;
  end
end;

procedure TPic4.chambersensorDblClick(Sender: TObject);
begin
 if (status=16) and (lighttaken=false) then
  begin
   videoplay('resources\anim\4_439.avi');
   status:=22;
  end
 else
 if (status=16) and (lighttaken=true) then
  begin
   videoplay('resources\anim\4_438.avi');
   status:=22;
  end
end;

procedure TPic4.hallwaysensorDblClick(Sender: TObject);
begin
 if status=25 then
  begin
   videoplay('resources\anim\4_451.avi');
   status:=15;
  end
end;

procedure TPic4.entrancesensor2DblClick(Sender: TObject);
begin
 if status=25 then
  begin
   videoplay('resources\anim\4_450.avi');
   status:=24;
  end
end;

procedure TPic4.dark_centersensorDblClick(Sender: TObject);
begin
 if status=22 then
  begin
   videoplay('resources\anim\4_446.avi');
   status:=23;
  end
end;

procedure TPic4.plugsensorDblClick(Sender: TObject);
begin
 if (status=27) and (plugtaken=false) then
  begin
   videoplay('resources\anim\4_457.avi');
   plugtaken:=true;
   firsttimeplug:=true;
  end
end;

procedure TPic4.exitsensor2DblClick(Sender: TObject);
begin
 if (status=29) and (key2taken=false) then
  begin
   videoplay('resources\anim\4_483.avi');
   status:=25;
  end
 else
 if (status=29) and (key2taken=true) then
  begin
   videoplay('resources\anim\4_486.avi');
   status:=25;
  end
end;

procedure TPic4.key2sensorDblClick(Sender: TObject);
begin
 if (status=29) and (key2taken=false) then
  begin
   videoplay('resources\anim\4_485.avi');
   key2:=true;
   firsttimekey2:=true;
   key2taken:=true;
  end
end;

procedure TPic4.doorsensor3DblClick(Sender: TObject);
begin
 if status=24 then
  begin
   videoplay('resources\anim\4_453.avi');
   status:=28;
  end
end;

procedure TPic4.plugsensor2DragDrop(Sender, Source: TObject; X,
  Y: Integer);
begin
 if (status=30) and (pic2.displayeditem='plug') and (pluginserted=false) then
  begin
   videoplay('resources\anim\4_476.avi');
   pluginserted:=true;
  end
end;

procedure TPic4.plugsensor2DragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
if (Status=30) and (pic2.displayeditem='plug') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.drawersensorDblClick(Sender: TObject);
begin
 if status=28 then
  begin
   videoplay('resources\anim\4_470.avi');
   status:=32;
  end
end;

procedure TPic4.locksensorDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
if (Status=28) and (pic2.displayeditem='key2') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.locksensorDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
 if (status=28) and (pic2.displayeditem='key2') and (chiptaken=false) then
  begin
   videoplay('resources\anim\4_471.avi');
   status:=31;
  end
else
 if (status=28) and (pic2.displayeditem='key2') and (chiptaken=true) then
  begin
   videoplay('resources\anim\4_472.avi');
   status:=31;
  end
end;

procedure TPic4.chipsensorDblClick(Sender: TObject);
begin
 if (status=31) and (chiptaken=false) then
  begin
   videoplay('resources\anim\4_480.avi');
   chiptaken:=true;
   firsttimechip:=true;
  end
end;

procedure TPic4.mirrorexitDblClick(Sender: TObject);
begin
 if (status=30) and (pluginserted=true) then
  begin
   videoplay('resources\anim\4_477b.avi');
   status:=33;

   musicchange:=true;
   music1.Notify:=false;
   music1.Stop;
  end
end;

procedure TPic4.mirrorexit2DblClick(Sender: TObject);
begin
 if status=34 then
  begin
   videoplay('resources\anim\4_540b.avi');
   status:=30;

   musicchange:=true;
   music1.Notify:=false;
   music1.Stop;
  end
end;

procedure TPic4.SpeedButton1Click(Sender: TObject);
begin
 status:=30;
 pluginserted:=true;
 chip:=true;
 stick2:=true;
 invpic.visible:=true;
end;

procedure TPic4.signsensor2DblClick(Sender: TObject);
begin
 if status=35 then
  begin
   videoplay('resources\anim\4_542.avi');
  end
end;

procedure TPic4.signsensorDblClick(Sender: TObject);
begin
 if status=35 then
  begin
   videoplay('resources\anim\4_543.avi');
   status:=36;
  end
end;

procedure TPic4.gatesensorDblClick(Sender: TObject);
begin
 if status=35 then
  begin
   videoplay('resources\anim\4_544.avi');
   status:=37;
  end
end;

procedure TPic4.rightaislesensorDblClick(Sender: TObject);
begin
 if status=37 then
  begin
   videoplay('resources\anim\4_545.avi');
   status:=39;
  end
end;

procedure TPic4.leftaislesensorDblClick(Sender: TObject);
begin
 if status=37 then
  begin
   videoplay('resources\anim\4_546.avi');
   status:=40;
  end
end;

procedure TPic4.ae_sensorDblClick(Sender: TObject);
begin
if (status=37) and (ae_lit=false) then
  begin
   videoplay('resources\anim\4_550.avi');
   status:=49;
  end
else
 if (status=37) and (ae_lit=true) then
  begin
   videoplay('resources\anim\4_551.avi');
   status:=49;
  end
end;

procedure TPic4.leftexitsensorDblClick(Sender: TObject);
begin
if status=40 then
  begin
   videoplay('resources\anim\4_524.avi');
   status:=43;
  end
end;

procedure TPic4.graves_exitsensorDblClick(Sender: TObject);
begin
 if status=41 then
  begin
   videoplay('resources\anim\4_526.avi');
   status:=38;
  end
else
 if status=42 then
  begin
   videoplay('resources\anim\4_512.avi');
   status:=38;
  end
end;

procedure TPic4.rightexitsensorDblClick(Sender: TObject);
begin
 if status=39 then
  begin
   videoplay('resources\anim\4_505.avi');
   status:=44;
  end
end;

procedure TPic4.chapel_rightsensorDblClick(Sender: TObject);
begin
 if status=44 then
  begin
   videoplay('resources\anim\4_504.avi');
   status:=45;
  end
end;

procedure TPic4.chapel_leftsensorDblClick(Sender: TObject);
begin
 if status=43 then
  begin
   videoplay('resources\anim\4_534.avi');
   status:=45;
  end
end;

procedure TPic4.holesensorDblClick(Sender: TObject);
begin
 if status=57 then
  begin
   videoplay('resources\anim\4_599.avi');
   status:=58;
  end
end;

procedure TPic4.smallchapelsensorDblClick(Sender: TObject);
begin
 if (status=57) and (chipused=false) then
  begin
   videoplay('resources\anim\4_601.avi');
   status:=61;
  end
else
 if (status=57) and (chipused=true) then
  begin
   videoplay('resources\anim\4_602.avi');
   status:=61;
  end
end;

procedure TPic4.gravesensorDblClick(Sender: TObject);
begin
 if (status=58) and (sickletaken=false) then
  begin
   videoplay('resources\anim\4_569.avi');
   status:=59;
  end
else
 if (status=58) and (sickletaken=true) then
  begin
   videoplay('resources\anim\4_570.avi');
   status:=59;
  end
end;

procedure TPic4.sicklesensorDblClick(Sender: TObject);
begin
 if status=59 then
  begin
   videoplay('resources\anim\4_567.avi');
   sickletaken:=true;
   firsttimesickle:=true;
  end
end;

procedure TPic4.bushsensorDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
if (Status=55) and (pic2.displayeditem='sickle') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.bushsensorDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
 if (status=55) and (pic2.displayeditem='sickle') and (sickleused=false) then
  begin
   videoplay('resources\anim\4_590.avi');
   sickleused:=true;
   bushsensor.Visible:=false;
  end
end;

procedure TPic4.sticksensorDblClick(Sender: TObject);
begin
 if (status=61) and (chipused=false) and (stick1taken=false) then
  begin
   videoplay('resources\anim\4_606.avi');
   firsttimestick1:=true;
   stick1taken:=true;
  end
else
 if (status=61) and (chipused=true) and (stick1taken=false) then
  begin
   videoplay('resources\anim\4_603.avi');
   firsttimestick1:=true;
   stick1taken:=true;
  end
end;

procedure TPic4.chipslotsensorDragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
if (Status=61) and (pic2.displayeditem='chip') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.chipslotsensorDragDrop(Sender, Source: TObject; X,
  Y: Integer);
begin
 if (status=61) and (pic2.displayeditem='chip') and (chipused=false) then
  begin
   videoplay('resources\anim\4_608.avi');
   chipused:=true;
   chipslotsensor.visible:=false;
   status:=62;
  end
end;

procedure TPic4.candlessensorDblClick(Sender: TObject);
begin
 if status=61 then
  begin
   videoplay('resources\anim\4_605.avi');
   status:=62;
  end
end;

procedure TPic4.litcandlesensorDragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
if (Status=62) and (pic2.displayeditem='stick1') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.litcandlesensorDragDrop(Sender, Source: TObject; X,
  Y: Integer);
begin
 if (status=62) and (pic2.displayeditem='stick1') then
  begin
   videoplay('resources\anim\4_612.avi');
   litcandlesensor.visible:=false;
   firsttimestick2:=true;
  end
end;

procedure TPic4.ae_candleDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
if (Status=49) and (pic2.displayeditem='stick2') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.ari_candleDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
if (Status=47) and (pic2.displayeditem='stick2') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.gg_candleDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
if (Status=53) and (pic2.displayeditem='stick2') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.hl_candleDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
if (Status=51) and (pic2.displayeditem='stick2') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.in_candleDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
if (Status=50) and (pic2.displayeditem='stick2') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.jcm_candleDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
if (Status=52) and (pic2.displayeditem='stick2') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.dem_candleDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
if (Status=48) and (pic2.displayeditem='stick2') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.ae_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
 if (status=49) and (pic2.displayeditem='stick2') then
  begin
   if candlecombination='ari.dem.gg.in.jcm.hl.' then
    begin
     music1.Notify:=false;
     music1.Pause;
     musicpause:=true;
     videoplay('resources\anim\4_559.avi');
     chapelopen:=true;
     invpic.Visible:=false;
    end
   else
    begin
     videoplay('resources\anim\4_561.avi');
    end;

   ae_candle.Visible:=false;
   ari_lit:=false;
   dem_lit:=false;
   gg_lit:=false;
   in_lit:=false;
   jcm_lit:=false;
   hl_lit:=false;
   candlecombination:='';
  end
end;

procedure TPic4.ari_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
 if (status=47) and (pic2.displayeditem='stick2') then
  begin
   videoplay('resources\anim\4_565.avi');
   ari_lit:=true;
   ari_candle.Visible:=false;

   if candlecombination=''
   then candlecombination:=candlecombination+'ari.'
   else candlecombination:='';
  end
end;

procedure TPic4.dem_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
 if (status=48) and (pic2.displayeditem='stick2') then
  begin
   videoplay('resources\anim\4_558.avi');
   dem_lit:=true;
   dem_candle.Visible:=false;

   if candlecombination='ari.'
   then candlecombination:=candlecombination+'dem.'
   else candlecombination:='';
  end
end;

procedure TPic4.gg_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
 if (status=53) and (pic2.displayeditem='stick2') then
  begin
   videoplay('resources\anim\4_529.avi');
   gg_lit:=true;
   gg_candle.visible:=false;

   if candlecombination='ari.dem.'
   then candlecombination:=candlecombination+'gg.'
   else candlecombination:='';
  end
end;

procedure TPic4.in_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
 if (status=50) and (pic2.displayeditem='stick2') then
  begin
   videoplay('resources\anim\4_515.avi');
   in_lit:=true;
   in_candle.visible:=false;

   if candlecombination='ari.dem.gg.'
   then candlecombination:=candlecombination+'in.'
   else candlecombination:='';
  end
end;

procedure TPic4.jcm_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
 if (status=52) and (pic2.displayeditem='stick2') then
  begin
   videoplay('resources\anim\4_532.avi');
   jcm_lit:=true;
   jcm_candle.visible:=false;

   if candlecombination='ari.dem.gg.in.'
   then candlecombination:=candlecombination+'jcm.'
   else candlecombination:='';
  end
end;

procedure TPic4.hl_candleDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
 if (status=51) and (pic2.displayeditem='stick2') then
  begin
   videoplay('resources\anim\4_518.avi');
   hl_lit:=true;
   hl_candle.Visible:=false;

   if candlecombination='ari.dem.gg.in.jcm.'
   then candlecombination:=candlecombination+'hl.'
   else candlecombination:='';
  end
end;

procedure TPic4.SpeedButton2Click(Sender: TObject);
begin
 candlecombination:='ari.dem.gg.in.jcm.hl.';
end;

procedure TPic4.soundNotify(Sender: TObject);
begin
 with Sender as TMediaPlayer do
   begin
     case Mode of
       mpStopped:
        begin
         if status=64 then
          begin
           videoplay('resources\anim\4_577.avi');
           status:=66;
           musicchange:=true;
          end
         else
         if status=71 then
          begin
           creditsplaying:=true;
           videoplay('resources\video\credits.avi');
           status:=-1; //final status
          end;
        end;
       end;
     end;
end;

procedure TPic4.SpeedButton3Click(Sender: TObject);
begin
 status:=19;
end;

procedure TPic4.SpeedButton4Click(Sender: TObject);
begin
 invpic.Visible:=true;
 bubble:=true;
end;

procedure TPic4.throwback1Timer(Sender: TObject);
begin
 videoplay('resources\anim\4_620.avi');
 status:=19;
 throwback1.Enabled:=false;
end;

procedure TPic4.throwback2Timer(Sender: TObject);
begin
 videoplay('resources\anim\4_618.avi');
 status:=19;
 throwback2.Enabled:=false;
end;

procedure TPic4.boss_sensor1DragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
if (Status=67) and (pic2.displayeditem='bubble') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.boss_sensor1DragDrop(Sender, Source: TObject; X,
  Y: Integer);
begin
 if (status=67) and (pic2.displayeditem='bubble') then
  begin
   videoplay('resources\anim\4_624.avi');
   throwback1.Enabled:=false;
  end
end;

procedure TPic4.boss_sensor2DragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
if (Status=68) and (pic2.displayeditem='bubble') then
  begin
   if (Source = InvPic) then Accept := True;
  end
end;

procedure TPic4.throwback3Timer(Sender: TObject);
begin
 videoplay('resources\anim\4_615.avi');
 status:=19;
 throwback3.Enabled:=false;
end;

procedure TPic4.staffsensorDblClick(Sender: TObject);
begin
 music1.Notify:=false;
 music1.Stop;
 videoplay('resources\anim\4_617.avi');
 status:=70;
 throwback3.Enabled:=false;
 invpic.Visible:=false;
end;

procedure TPic4.boss_sensor2DragDrop(Sender, Source: TObject; X,
  Y: Integer);
begin
 if (status=68) and (pic2.displayeditem='bubble') then
  begin
   videoplay('resources\anim\4_622.avi');
   throwback2.Enabled:=false;
   status:=69;
  end
end;

procedure TPic4.final_delayTimer(Sender: TObject);
begin
 videoplay('resources\anim\4_614.avi');
 status:=71;
 final_delay.enabled:=false;
end;

procedure TPic4.reporttimerTimer(Sender: TObject);
begin
 memo1.lines.Clear;
 if ae_sensor.visible=true then memo1.Lines.Add('ae_sensor');
 if bigmirrorsensor.visible=true then memo1.Lines.Add('bigmirrorsensor');
 if chambersensor.visible=true then memo1.Lines.Add('chambersensor');
 if dark_centersensor.visible=true then memo1.Lines.Add('dark_centersensor');
 if doorsensor.visible=true then memo1.Lines.Add('doorsensor');

 if doorsensor2.visible=true then memo1.Lines.Add('doorsensor2');
 if doorsensor3.visible=true then memo1.Lines.Add('doorsensor3');
 if exitsensor.visible=true then memo1.Lines.Add('exitsensor');
 if exitsensor2.visible=true then memo1.Lines.Add('exitsensor2');
 if gatesensor.visible=true then memo1.Lines.Add('gatesensor');

 if graves_exitsensor.visible=true then memo1.Lines.Add('graves_exitsensor');
 if hallwaysensor.visible=true then memo1.Lines.Add('hallwaysensor');
 if leftaislesensor.visible=true then memo1.Lines.Add('leftaislesensor');
 if leftexitsensor.visible=true then memo1.Lines.Add('leftexitsensor');
 if mirrorexit.visible=true then memo1.Lines.Add('mirrorexit');

 if nav_sensor1.visible=true then memo1.Lines.Add('nav_sensor1');
 if nav_sensor2.visible=true then memo1.Lines.Add('nav_sensor2');
 if nav_sensor4.visible=true then memo1.Lines.Add('nav_sensor4');
 if nav_sensor6.visible=true then memo1.Lines.Add('nav_sensor6');
 if nav_sensor7.visible=true then memo1.Lines.Add('nav_sensor7');

 if rightexitsensor.visible=true then memo1.Lines.Add('rightexitsensor');
 if smallchapelsensor.visible=true then memo1.Lines.Add('smallchapelsensor');
 if mirrorexit.visible=true then memo1.Lines.Add('mirrorexit');
 if mirrorexit2.visible=true then memo1.Lines.Add('mirrorexit2');
end;

procedure TPic4.reportClick(Sender: TObject);
begin
 reporttimer.Enabled:= not reporttimer.Enabled;
end;

end.


