#TouhouDanmakufu[Stage]
#Title[Patchoulis Deadly Book, lunatic mode.]
#Text[Boss Fight against a book (?).]
#BGM[.\BGM.wav]
#Player[FREE]
#PlayLevel[Lunatic]
#ScriptVersion[2]


script_stage_main{
#include_function ".\FunctionLib.dnh"
let CSD = GetCurrentScriptDirectory;
let boss_script = CSD~"PLURAL - L.txt";
let bg1 = CSD~"Library.png";
let bg2 = CSD~"Library_Wood.png";

  @Initialize{
  LoadGraphic(bg1);
  LoadGraphic(bg2);
  boss;
  }

  @MainLoop{
    yield;
  }
  

  @BackGround{
  WriteZBuffer(true);
  UseZBuffer(true);
  SetViewFrom(200, 90, 45);
  SetViewTo(0,0,0);
  SetFog(100, 400, 0, 0, 100);
  
  //Floor.
  
  CreateFloor;
  
  //First Bookshelf.
  
  CreateBookShelf1;
  
  //Second Bookshelf.
  
  CreateBookShelf2;
  
  }

  @Finalize{

  }

  task boss{
  wait(120);
  CreateEnemyBossFromFile(boss_script, 0, 0, 0, 0, 0);
  WaitForNoEnemy;
  wait(120);
  ClearStage;
  }

  function CreateFloor(){
  
  SetTexture(bg2);
  SetGraphicRect(0,0,512,512);
  SetGraphicScale(1.2,1.2);
  SetGraphicAngle(-90, 0, 180);
  DrawGraphic3D(0,-39,0);
  }
  
  function CreateBookShelf1(){
    
  SetTexture(bg1);
  SetGraphicRect(0, 0, 512, 512);
  SetGraphicScale(0.21,0.2);
  SetGraphicAngle(30, 0, 180);
  DrawGraphic3D(80,20,-20);
  
  SetTexture(bg2);
  SetGraphicScale(0.232,0.05);
  
  SetGraphicAngle(-90, 0, 180);
  DrawGraphic3D(88,56,-20);
  
  SetGraphicScale(0.05,0.109);
  
  SetGraphicAngle(-9, -90, 180);
  DrawGraphic3D(28,20,-38);
  }
  
  function CreateBookShelf2(){
  
  SetTexture(bg1);
  SetGraphicRect(0, 0, 512, 512);
  SetGraphicScale(0.21,0.2);
  SetGraphicAngle(30, 0, 180);
  DrawGraphic3D(-80,20,20);
  
  SetTexture(bg2);
  SetGraphicScale(0.232,0.05);
  
  SetGraphicAngle(-90, 0, 180);
  DrawGraphic3D(-90.5,50,20);
  
  SetGraphicScale(0.05,0.109);
  
  SetGraphicAngle(-16, 90, 180);
  DrawGraphic3D(-37,-16,-34);
  }
 
}
