function AwardRoom::onWake(%this)
{      
   %this.numAwards = 22;
   
   %this.loadAwardXML();   
   
   // Rect = POS EXTENT
   %this.awardRect[1]  = "39 303 100 201";  // Award_fiji
   %this.awardRect[2]  = "129 311 68 198";  // Award_london
   %this.awardRect[3]  = "230 314 71 199";  // Award_tokyo
   %this.awardRect[4]  = "315 334 74 190";  // Award_mexico
   %this.awardRect[5]  = "423 317 76 202";  // Award_hongkong
   %this.awardRect[6]  = "499 367 122 147"; // Award_hollywood
   %this.awardRect[7]  = "617 318 68 203";  // Award_newyork
   %this.awardRect[8]  = "669 318 91 189";  // Award_paris   
   %this.awardRect[9]  = "26 230 72 112";   // Award_no_hints
   %this.awardRect[10] = "106 227 65 117";  // Award_no_wrong_items
   %this.awardRect[11] = "161 208 72 141";  // Award_takes_movie
   %this.awardRect[12] = "238 225 104 130"; // Award_wildlife
   %this.awardRect[13] = "331 205 122 148"; // Award_toys
   %this.awardRect[14] = "433 203 99 151";  // Award_insects
   %this.awardRect[15] = "504 228 89 128";  // Award_3objects_3seconds
   %this.awardRect[16] = "578 224 73 123";  // Award_2objects_3seconds
   %this.awardRect[17] = "636 203 79 148";  // Award_all_items_2minutes
   %this.awardRect[18] = "710 244 64 103";  // Award_5star_take
   %this.awardRect[19] = "222 27 67 161";   // Award_all_hint_objects
   %this.awardRect[20] = "302 41 96 149";   // Award_150_stars
   %this.awardRect[21] = "402 29 96 165";   // Award_takes_game
   %this.awardRect[22] = "512 20 94 173";   // Award_600_objects
   
   switch$($CurPlayerNum)
   {
      case 1: 
         %this.animals   = PlayerProfile.Animals1;
         %this.bugs      = PlayerProfile.Insects1;
         %this.toys      = PlayerProfile.Toys1;
         %this.starsmini = PlayerProfile.StarsMini1;
         %this.objects   = PlayerProfile.CorrectObjs_1;
      case 2:
         %this.animals   = PlayerProfile.Animals2;
         %this.bugs      = PlayerProfile.Insects2;
         %this.toys      = PlayerProfile.Toys2;
         %this.starsmini = PlayerProfile.StarsMini2;
         %this.objects   = PlayerProfile.CorrectObjs_2;
      case 3:
         %this.animals   = PlayerProfile.Animals3;
         %this.bugs      = PlayerProfile.Insects3;
         %this.toys      = PlayerProfile.Toys3;
         %this.starsmini = PlayerProfile.StarsMini3;
         %this.objects   = PlayerProfile.CorrectObjs_3;    
      case 4:
         %this.animals   = PlayerProfile.Animals4;
         %this.bugs      = PlayerProfile.Insects4;
         %this.toys      = PlayerProfile.Toys4;
         %this.starsmini = PlayerProfile.StarsMini4;
         %this.objects   = PlayerProfile.CorrectObjs_4;
   }   
   
   %this.awardText[1]  = %this.awardDesc[1];//"Collect all stars\nfor Fiji"; // Award_fiji
   %this.awardText[2]  = %this.awardDesc[2];//"Collect all stars\nfor London"; // Award_london
   %this.awardText[3]  = %this.awardDesc[3];//"Collect all stars\nfor Tokyo"; // Award_tokyo
   %this.awardText[4]  = %this.awardDesc[4];//"Collect all stars\nfor Mexico"; // Award_mexico
   %this.awardText[5]  = %this.awardDesc[5];//"Collect all stars\nfor Hong Kong"; // Award_hongkong
   %this.awardText[6]  = %this.awardDesc[6];//"Collect all stars\nfor Hollywood"; // Award_hollywood
   %this.awardText[7]  = %this.awardDesc[7];//"Collect all stars\nfor New York"; // Award_newyork
   %this.awardText[8]  = %this.awardDesc[8];//"Collect all stars\nfor Paris"; // Award_paris
   %this.awardText[9]  = %this.awardDesc[9];//"Detective:\n" @ "Find all items in a take\nwithout using any hints"; // Award_no_hints
   %this.awardText[10] = %this.awardDesc[10];//"Eagle Eyed:\n" @ "Find all items in a take\nwithout hitting any\nwrong objects"; // Award_no_wrong_items
   %this.awardText[11] = %this.awardDesc[11];//"Full Production:\n" @ "Complete all takes\nof a movie"; // Award_takes_movie

   %text = strreplace(%this.awardDesc[12], "#" , %this.animals);
   %this.awardText[12] = %text;//"Conservationist (" @ %this.animals @ "/50):\n" @ "Remove 50 Animals"; // Award_wildlife
   %text = strreplace(%this.awardDesc[13], "#" , %this.toys);
   %this.awardText[13] = %text;//"Babysitter (" @ %this.toys @ "/50):\n" @ "Clear 50 Toys"; // Award_toys
   %text = strreplace(%this.awardDesc[14], "#" , %this.bugs);
   %this.awardText[14] = %text;//"Pest Control (" @ %this.bugs @ "/100):\n" @ "Swat 100 Bugs"; // Award_insects
   
   %this.awardText[15] = %this.awardDesc[15];//"Sharpshooter:\n" @ "Find 3 objects\nin 3 seconds"; // Award_3objects_3seconds
   %this.awardText[16] = %this.awardDesc[16];//"Rapid Fire:\n" @ "Find 2 objects\nin 3 seconds"; // Award_2objects_3seconds
   %this.awardText[17] = %this.awardDesc[17];//"Personal Assistant:\n" @ "Find all items\nwithin 2 minutes"; // Award_all_items_2minutes
   %this.awardText[18] = %this.awardDesc[18];//"Critical Favourite:\n" @ "Earn five stars\nfor a Take"; // Award_5star_take
   %text = strreplace(%this.awardDesc[19], "#" , %this.starsmini);
   %this.awardText[19] = %text;//"Puzzle Master (" @ %this.starsmini @ "/40):\n" @ "Win 40 stars\non minigames."; // Award_all_hint_objects
   %text = strreplace(%this.awardDesc[20], "#" , $CurPlayerStars);
   %this.awardText[20] = %text;//"Hall of Fame (" @ $CurPlayerStars @ "/150):\n" @ "Collect\n150 Stars"; // Award_150_stars
   %this.awardText[21] = %this.awardDesc[21];//"Complete all takes\nof all movies"; // Award_takes_game
   %text = strreplace(%this.awardDesc[22], "#" , %this.objects);
   %this.awardText[22] = %text;//"Task Master (" @ %this.objects @ "/600):\n" @ "Find\n600 items"; // Award_600_objects
            
   %this.update();   
   AwardHelpText1.setVisible(false);
   AwardHelpText2.setVisible(false);

   if (%this.cursor $= "")
   {
      // Create a cursor
      %this.cursor = new GuiBitmapCtrl() {
         canSaveDynamicFields = "0";
         Enabled = "1";
         isContainer = "0";
         HorizSizing = "relative";
         VertSizing = "relative";
         Position = "0 0";
         Extent = "50 50";
         MinExtent = "2 2";
         canSave = "1";
         Visible = "1";
         hovertime = "1000";
         alpha = "1";
         color = "255 255 255 255";
         unitClip = "0 0 1 1";
         bitmap = "scriptsAndAssets/data/ui/minigame/hand_cursor";
         wrap = "0";
      };
   
      //AwardRoomCenter.pushToBack(BackMapMenuButton);
      AwardRoomCenter.add(%this.cursor);
   }
   AwardRoomCenter.pushToBack(AwardHelpText1);
   AwardRoomCenter.pushToBack(AwardHelpText2);
   
   %this.onBackButton = false;

   %this.checkMousePos();
   Canvas.setWidescreen(AwardRoomCenter, 100, false);   
}

function AwardRoom::onSleep(%this)
{
   cancelScheduleLCA(%this.checkMousePosID);
}

function AwardRoom::onResize(%this, %width, %height)
{
   Canvas.setWidescreen(AwardRoomCenter, 2000, true);
}

// Parse XML file looking for award tags
function AwardRoom::loadAwardXML(%this)
{
   %path = "./scriptsAndAssets/data/ui/award.xml";
   
   %pXml = new SimXMLDocument();
   // Load and parse XML file.
   if(!%pXml.loadFile(%path))
   {
      echo("Failed to load " @ %path);
      return;
   }
   
   // Push the first child element named "award" onto 
   // the XML document stack.
   if(!%pXml.pushFirstChildElement("award"))
   {
      echo("Failed to load award tag.");
      return;
   }

   // Get award descs
   for(%i=1; %i<=22; %i++)
   {
      if(!%pXml.pushFirstChildElement("awarddesc" @ %i))
      {
         echo("Failed to load awarddesc" @ %i @ " tag.");
         return;
      }
      %this.awardDesc[%i] = %pXml.attribute("text");
      %pXml.popElement();
   }
   
   // Get award win texts
   if(!%pXml.pushFirstChildElement("awardgeneric" @ %i))
   {
      echo("Failed to load awardgeneric tag.");
      return;
   }
   %this.awardGeneric = %pXml.attribute("text");
   %pXml.popElement();
   
   for(%i=9; %i<=22; %i++)
   {
      if(%i $= 21) continue; // Ignore the 21th
      
      if(!%pXml.pushFirstChildElement("awardwon" @ %i))
      {
         echo("Failed to load awardwon" @ %i @ " tag.");
         return;
      }
      %this.awardWon[%i] = %pXml.attribute("text");
      %pXml.popElement();
   }   
	
   %pXml.popElement();
   
   %pXml.delete();   
   
   echo("Debug: Award XML loaded");
}


function AwardRoom::checkMousePos(%this)
{
   if ($pausedOnLoseFocus)
   {
      %this.cursor.setVisible(false);
      %this.checkMousePosID = scheduleObjLCA(%this, "HO", 100, "checkMousePos", 0);
      return;
   }
   else
      %this.cursor.setVisible(true);
      
   %curMousePos = canvas.getCursorPos();
   %mouseX = getWord(%curMousePos,0);
   %mouseY = getWord(%curMousePos,1);
   
   Canvas.hideCursor();
   %this.cursor.setPosition(%mouseX - getWord(AwardRoomCenter.getPosition(),0) + 1, 
                            %mouseY - getWord(AwardRoomCenter.getPosition(),1) + 1);

   if (%this.onBackButton)
   {
      %this.checkMousePosID = scheduleObjLCA(%this, "HO", 100, "checkMousePos", 0);
      return;
   }
   
   %winScaleX = 1.0 / 800 * getWord(AwardRoomCenter.getExtent(),0);
   %winScaleY = 1.0 / 600 * getWord(AwardRoomCenter.getExtent(),1);   

   %isPointing = AwardHelpText1.Visible;   
   
   // Check if cursor hover an award
   for(%i=1; %i <= %this.numAwards; %i++)
   {
      %rect = %this.awardRect[%i];

      // Compensate widescreen offset
      %rect2 = AwardRoomCenter.getPosition();
      
      %x = getWord(%rect, 0) * %winScaleX;
      %y = getWord(%rect, 1) * %winScaleY;
      %w = getWord(%rect, 2) * %winScaleX;
      %h = getWord(%rect, 3) * %winScaleY;
      
      %text = %this.awardText[%i];
      
      if(%mouseX >= %x    + getWord(%rect2,0) && 
         %mouseX <= %x+%w + getWord(%rect2,0) && 
         %mouseY >= %y    + getWord(%rect2,1) && 
         %mouseY <= %y+%h + getWord(%rect2,1))
      {
         %textExtent = AwardHelpText1.getExtent();
         
         // Centerize text around mouse position
         %textPosX = %mouseX - getWord(%textExtent,0)/2;
         %textPosY = %mouseY - getWord(%textExtent,1)/2;
         
         // Change position if text rect is out of the screen bounds
         %pos2 = AwardRoomCenter.getPosition();
         if(%textPosX < getWord(%pos2,0)) %textPosX += getWord(%pos2,0)-%textPosX;
         if(%textPosY < getWord(%pos2,1)) %textPosY += getWord(%pos2,1)-%textPosY;
         %ext2 = AwardRoomCenter.getExtent();
         if(%textPosX+getWord(%textExtent,0) > getWord(%rect2,0)+getWord(%ext2,0)) %textPosX -= (%textPosX+getWord(%textExtent,0))-(getWord(%rect2,0)+getWord(%ext2,0));
         if(%textPosY+getWord(%textExtent,1) > getWord(%rect2,1)+getWord(%ext2,1)) %textPosY -= (%textPosY+getWord(%textExtent,1))-(getWord(%rect2,1)+getWord(%ext2,1));
         
         AwardHelpText1.setPosition(%textPosX - getWord(%rect2,0) + 1, %textPosY - getWord(%rect2,1) + 1);
         AwardHelpText2.setPosition(%textPosX - getWord(%rect2,0), %textPosY - getWord(%rect2,1));
         AwardHelpText1.setText(%text);
         AwardHelpText2.setText(%text);
         AwardHelpText1.setVisible(true);
         AwardHelpText2.setVisible(true);
         
         // Force loop exit
         %i = 50;
      }
      else
      {
         AwardHelpText1.setText(%text);
         AwardHelpText2.setText(%text);
         AwardHelpText1.setVisible(false);
         AwardHelpText2.setVisible(false);
      }
   }
 
   if (AwardHelpText1.Visible)
   {
      if (!%isPointing)
         %this.cursor.setBitmap("scriptsAndAssets/data/ui/minigame/hand_cursor_point");
   }
   else
      if (%isPointing)
         %this.cursor.setBitmap("scriptsAndAssets/data/ui/minigame/hand_cursor");
         
   %this.checkMousePosID = scheduleObjLCA(%this, "HO", 30, "checkMousePos", 0);      
}

// Show awards according to the player profile
function AwardRoom::update(%this)
{
   Award_600_objects.setVisible(false);
   Award_takes_game.setVisible(false);
   Award_150_stars.setVisible(false);
   Award_all_hint_objects.setVisible(false);
   Award_5star_take.setVisible(false);
   Award_all_items_2minutes.setVisible(false);
   Award_2objects_3seconds.setVisible(false);
   Award_3objects_3seconds.setVisible(false);
   Award_insects.setVisible(false);
   Award_toys.setVisible(false);
   Award_wildlife.setVisible(false);
   Award_takes_movie.setVisible(false);
   Award_no_wrong_items.setVisible(false);
   Award_no_hints.setVisible(false);
   Award_paris.setVisible(false);
   Award_tokyo.setVisible(false);
   Award_newyork.setVisible(false);
   Award_hollywood.setVisible(false);
   Award_hongkong.setVisible(false);
   Award_mexico.setVisible(false);
   Award_london.setVisible(false);
   Award_fiji.setVisible(false);
   
   switch$($CurPlayerNum)
   {
   case 1:   
      if(PlayerProfile.Award_600_objects_1)        Award_600_objects.setVisible(true);
      if(PlayerProfile.Award_takes_game_1)         Award_takes_game.setVisible(true);
      if(PlayerProfile.Award_150_stars_1)          Award_150_stars.setVisible(true);
      if(PlayerProfile.Award_all_hint_objects_1)   Award_all_hint_objects.setVisible(true);
      if(PlayerProfile.Award_5star_take_1)         Award_5star_take.setVisible(true);
      if(PlayerProfile.Award_all_items_2minutes_1) Award_all_items_2minutes.setVisible(true);
      if(PlayerProfile.Award_2objects_3seconds_1)  Award_2objects_3seconds.setVisible(true);
      if(PlayerProfile.Award_3objects_3seconds_1)  Award_3objects_3seconds.setVisible(true);
      if(PlayerProfile.Award_insects_1)            Award_insects.setVisible(true);
      if(PlayerProfile.Award_toys_1)               Award_toys.setVisible(true);
      if(PlayerProfile.Award_wildlife_1)           Award_wildlife.setVisible(true);
      if(PlayerProfile.Award_takes_movie_1)        Award_takes_movie.setVisible(true);
      if(PlayerProfile.Award_no_wrong_items_1)     Award_no_wrong_items.setVisible(true);
      if(PlayerProfile.Award_no_hints_1)           Award_no_hints.setVisible(true);
      if(PlayerProfile.Award_paris_1)              Award_paris.setVisible(true);
      if(PlayerProfile.Award_tokyo_1)              Award_tokyo.setVisible(true);
      if(PlayerProfile.Award_newyork_1)            Award_newyork.setVisible(true);
      if(PlayerProfile.Award_hollywood_1)          Award_hollywood.setVisible(true);
      if(PlayerProfile.Award_hongkong_1)           Award_hongkong.setVisible(true);
      if(PlayerProfile.Award_mexico_1)             Award_mexico.setVisible(true);
      if(PlayerProfile.Award_london_1)             Award_london.setVisible(true);
      if(PlayerProfile.Award_fiji_1)               Award_fiji.setVisible(true);
      
   case 2:
      if(PlayerProfile.Award_600_objects_2)        Award_600_objects.setVisible(true);
      if(PlayerProfile.Award_takes_game_2)         Award_takes_game.setVisible(true);
      if(PlayerProfile.Award_150_stars_2)          Award_150_stars.setVisible(true);
      if(PlayerProfile.Award_all_hint_objects_2)   Award_all_hint_objects.setVisible(true);
      if(PlayerProfile.Award_5star_take_2)         Award_5star_take.setVisible(true);
      if(PlayerProfile.Award_all_items_2minutes_2) Award_all_items_2minutes.setVisible(true);
      if(PlayerProfile.Award_2objects_3seconds_2)  Award_2objects_3seconds.setVisible(true);
      if(PlayerProfile.Award_3objects_3seconds_2)  Award_3objects_3seconds.setVisible(true);
      if(PlayerProfile.Award_insects_2)            Award_insects.setVisible(true);
      if(PlayerProfile.Award_toys_2)               Award_toys.setVisible(true);
      if(PlayerProfile.Award_wildlife_2)           Award_wildlife.setVisible(true);
      if(PlayerProfile.Award_takes_movie_2)        Award_takes_movie.setVisible(true);
      if(PlayerProfile.Award_no_wrong_items_2)     Award_no_wrong_items.setVisible(true);
      if(PlayerProfile.Award_no_hints_2)           Award_no_hints.setVisible(true);
      if(PlayerProfile.Award_paris_2)              Award_paris.setVisible(true);
      if(PlayerProfile.Award_tokyo_2)              Award_tokyo.setVisible(true);
      if(PlayerProfile.Award_newyork_2)            Award_newyork.setVisible(true);
      if(PlayerProfile.Award_hollywood_2)          Award_hollywood.setVisible(true);
      if(PlayerProfile.Award_hongkong_2)           Award_hongkong.setVisible(true);
      if(PlayerProfile.Award_mexico_2)             Award_mexico.setVisible(true);
      if(PlayerProfile.Award_london_2)             Award_london.setVisible(true);
      if(PlayerProfile.Award_fiji_2)               Award_fiji.setVisible(true);

   case 3:
      if(PlayerProfile.Award_600_objects_3)        Award_600_objects.setVisible(true);
      if(PlayerProfile.Award_takes_game_3)         Award_takes_game.setVisible(true);
      if(PlayerProfile.Award_150_stars_3)          Award_150_stars.setVisible(true);
      if(PlayerProfile.Award_all_hint_objects_3)   Award_all_hint_objects.setVisible(true);
      if(PlayerProfile.Award_5star_take_3)         Award_5star_take.setVisible(true);
      if(PlayerProfile.Award_all_items_2minutes_3) Award_all_items_2minutes.setVisible(true);
      if(PlayerProfile.Award_2objects_3seconds_3)  Award_2objects_3seconds.setVisible(true);
      if(PlayerProfile.Award_3objects_3seconds_3)  Award_3objects_3seconds.setVisible(true);
      if(PlayerProfile.Award_insects_3)            Award_insects.setVisible(true);
      if(PlayerProfile.Award_toys_3)               Award_toys.setVisible(true);
      if(PlayerProfile.Award_wildlife_3)           Award_wildlife.setVisible(true);
      if(PlayerProfile.Award_takes_movie_3)        Award_takes_movie.setVisible(true);
      if(PlayerProfile.Award_no_wrong_items_3)     Award_no_wrong_items.setVisible(true);
      if(PlayerProfile.Award_no_hints_3)           Award_no_hints.setVisible(true);
      if(PlayerProfile.Award_paris_3)              Award_paris.setVisible(true);
      if(PlayerProfile.Award_tokyo_3)              Award_tokyo.setVisible(true);
      if(PlayerProfile.Award_newyork_3)            Award_newyork.setVisible(true);
      if(PlayerProfile.Award_hollywood_3)          Award_hollywood.setVisible(true);
      if(PlayerProfile.Award_hongkong_3)           Award_hongkong.setVisible(true);
      if(PlayerProfile.Award_mexico_3)             Award_mexico.setVisible(true);
      if(PlayerProfile.Award_london_3)             Award_london.setVisible(true);
      if(PlayerProfile.Award_fiji_3)               Award_fiji.setVisible(true);
   
   case 4:
      if(PlayerProfile.Award_600_objects_4)        Award_600_objects.setVisible(true);
      if(PlayerProfile.Award_takes_game_4)         Award_takes_game.setVisible(true);
      if(PlayerProfile.Award_150_stars_4)          Award_150_stars.setVisible(true);
      if(PlayerProfile.Award_all_hint_objects_4)   Award_all_hint_objects.setVisible(true);
      if(PlayerProfile.Award_5star_take_4)         Award_5star_take.setVisible(true);
      if(PlayerProfile.Award_all_items_2minutes_4) Award_all_items_2minutes.setVisible(true);
      if(PlayerProfile.Award_2objects_3seconds_4)  Award_2objects_3seconds.setVisible(true);
      if(PlayerProfile.Award_3objects_3seconds_4)  Award_3objects_3seconds.setVisible(true);
      if(PlayerProfile.Award_insects_4)            Award_insects.setVisible(true);
      if(PlayerProfile.Award_toys_4)               Award_toys.setVisible(true);
      if(PlayerProfile.Award_wildlife_4)           Award_wildlife.setVisible(true);
      if(PlayerProfile.Award_takes_movie_4)        Award_takes_movie.setVisible(true);
      if(PlayerProfile.Award_no_wrong_items_4)     Award_no_wrong_items.setVisible(true);
      if(PlayerProfile.Award_no_hints_4)           Award_no_hints.setVisible(true);
      if(PlayerProfile.Award_paris_4)              Award_paris.setVisible(true);
      if(PlayerProfile.Award_tokyo_4)              Award_tokyo.setVisible(true);
      if(PlayerProfile.Award_newyork_4)            Award_newyork.setVisible(true);
      if(PlayerProfile.Award_hollywood_4)          Award_hollywood.setVisible(true);
      if(PlayerProfile.Award_hongkong_4)           Award_hongkong.setVisible(true);
      if(PlayerProfile.Award_mexico_4)             Award_mexico.setVisible(true);
      if(PlayerProfile.Award_london_4)             Award_london.setVisible(true);
      if(PlayerProfile.Award_fiji_4)               Award_fiji.setVisible(true);   
   }
}

function BackMapMenuButton::onMouseMove(%this)
{
   AwardRoom.cursor.setBitmap("scriptsAndAssets/data/ui/minigame/hand_cursor_point");
   %this.onBackButton = true;
}

function BackMapMenuButton::onMouseLeave(%this)
{
   AwardRoom.cursor.setBitmap("scriptsAndAssets/data/ui/minigame/hand_cursor");
   %this.onBackButton = false;
}

// Test code
//AwardRoom.addAwardGui(WorldMapGui); // Initialize award feedback
//AwardRoom.showUnlockedAward();

function AwardRoom::addAwardGui(%this, %parent)
{   
   %this.referenceGui = %parent;
   
   if(!isObject(%this.referenceGui))
      return;   
   
   if(isObject(AwardUnlockedSceneTextShadow))
      AwardUnlockedSceneTextShadow.delete();
   if(isObject(AwardUnlockedSceneText))
      AwardUnlockedSceneText.delete();

   new GuiBitmapTextCtrl(AwardUnlockedSceneTextShadow) {
      canSaveDynamicFields = "0";
      Enabled = "1";
      isContainer = "0";
      HorizSizing = "relative";
      VertSizing = "relative";
      Position = "3 3";
      Extent = "800 150";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "0";
      hovertime = "1000";
      alpha = "1";
      color = "0 0 0 255";
      unitClip = "0 0 1 1";
      lockMouse = "0";
      Margin = "0 0 0 0";
      Padding = "0 0 0 0";
      AnchorTop = "1";
      AnchorBottom = "0";
      AnchorLeft = "1";
      AnchorRight = "0";
      text = "";
      maxLength = "-1";
      bitmap = "scriptsAndAssets/data/ui/shoppingfont";
      scale = "0";
      centerize = "1";
      charspacing = "1";
      charaspect = "1";
      metric = "scriptsAndAssets/data/ui/shoppingfont.ini";
   };      
   
   new GuiBitmapTextCtrl(AwardUnlockedSceneText) {
      canSaveDynamicFields = "0";
      Enabled = "1";
      isContainer = "0";
      HorizSizing = "relative";
      VertSizing = "relative";
      Position = "0 0";
      Extent = "800 150";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "0";
      hovertime = "1000";
      alpha = "1";
      color = "255 255 255 255";
      unitClip = "0 0 1 1";
      lockMouse = "0";
      Margin = "0 0 0 0";
      Padding = "0 0 0 0";
      AnchorTop = "1";
      AnchorBottom = "0";
      AnchorLeft = "1";
      AnchorRight = "0";
      text = "";
      maxLength = "-1";
      bitmap = "scriptsAndAssets/data/ui/shoppingfont";
      scale = "0";
      centerize = "1";
      charspacing = "1";
      charaspect = "1";
      metric = "scriptsAndAssets/data/ui/shoppingfont.ini";
   };
   
   %parent.add(AwardUnlockedSceneTextShadow);
   %parent.add(AwardUnlockedSceneText);
   
   %parent.pushToBack(AwardUnlockedSceneTextShadow);
   %parent.pushToBack(AwardUnlockedSceneText);   
}

// Visual feedback for the recently unlocked scenes
function AwardRoom::showUnlockedAward(%this, %text)
{
   if(!isObject(%this.referenceGui))
      return;
      
   %winScaleX = 1.0 / 800 * getWord(%this.referenceGui.getExtent(),0);
   %winScaleY = 1.0 / 600 * getWord(%this.referenceGui.getExtent(),1);
   
   %obj  = AwardUnlockedSceneText;
   %objs = AwardUnlockedSceneTextShadow;
   
   %obj.setAlpha(0);
   %objs.setAlpha(0);
   
   %obj.setText(%text);
   %objs.setText(%text);
   
   %obj.setVisible(true);
   %objs.setVisible(true);
   
   %width  = 800;
   %height = 150;
   %posx   = 400;
   %posy   = 25;
   
   %obj.animateAlpha(1, 0, 500, "0 0");
   %objs.animateAlpha(1, 0, 500, "0 0");
   
   %obj.setPosition(%posx * %winScaleX, (300-%posy) * %winScaleY);
   %obj.setExtent((%width-(%posx*2)) * %winScaleX, (%height-(%posy*2)) * %winScaleY);
   %obj.animateBounds(0 * %winScaleX, (300-(%height/2))*%winScaleY, %width*%winScaleX, %height*%winScaleY, 0, 500, "1 2");   

   %objs.setPosition((%posx+3) * %winScaleX, (303-%posy) * %winScaleY);
   %objs.setExtent((%width-(%posx*2)) * %winScaleX, (%height-(%posy*2)) * %winScaleY);
   %objs.animateBounds(3 * %winScaleX, (303-(%height/2))*%winScaleY, %width*%winScaleX, %height*%winScaleY, 0, 500, "1 2");   

   scheduleObjLCA(%this, "HO", 1800, "showUnlockedAward2", 0);
}

function AwardRoom::showUnlockedAward2(%this)
{
   %obj  = AwardUnlockedSceneText;
   %objs = AwardUnlockedSceneTextShadow;
   
   %obj.animateAlpha(0, 0, 1000, "0 0");
   %objs.animateAlpha(0, 0, 1000, "0 0");
   
   scheduleObjLCA(%this, "HO", 1000, "showUnlockedAward3", 0);
}

function AwardRoom::showUnlockedAward3(%this)
{
   %obj  = AwardUnlockedSceneText;
   %objs = AwardUnlockedSceneTextShadow;
   
   %obj.setVisible(false);
   %objs.setVisible(false);
}
