//Script by Evil Pumpkin for "BOH" (unreleased)
// modded by me.... "Evil Pumpkin 0wnz joo!!"
// 
// 

#include "../../../lib/std.mi"

Global Int seeking,now;
Global String Hitten;
Global slider hidseek;

Global layer seek1,seekfull;
Global map seekmap;
Global region seekregion;

System.onscriptloaded(){
 Layout mainshade = getContainer("Main").getLayout("shade");
 hidseek = mainshade.getObject("shadehidseek");

 seek1 = mainshade.getObject("shadeseek");
 seekfull = mainshade.getObject("shadeseekfull");
 seekregion = New Region;
 seekregion.loadfrombitmap("shadeseekregion");
 seek1.setregion(seekregion);
 seekmap = New Map;
 seekmap.loadmap("shadeseekmap");

 seekfull.hide();
}

seek1.onleftbuttondown(int x, int y){
 seeking = 1;
 x= x-seek1.getleft();
 y= y-seek1.gettop();
 if (seekmap.inregion(x,y)){
  now= seekmap.getvalue(x,y);
  seekfull.setregionfrommap(seekmap,now,1);
 }
}

seek1.onmousemove(int x, int y){
 if (seeking){
  x= x-seek1.getleft();
  y= y-seek1.gettop();
  if (seekmap.inregion(x,y)){
   now= seekmap.getvalue(x,y);
   seekfull.setregionfrommap(seekmap,now,1);
  }
 }
}

seek1.onleftbuttonup(int x, int y){
 now = now/255*system.getplayitemlength();
 seekto(now);
 seeking=0;
}

hidseek.onpostedposition(int p){
 if (!seeking){seekfull.show();seekfull.setregionfrommap(seekmap,p,1);} 
}

System.onstop(){
 seekfull.hide();
}
