// ****************************************************************************
//
// Logic 54: Enter the Asylum
//
// ****************************************************************************

#include "defines.txt"

if (new_room) {
  load.pic(room_no);
  draw.pic(room_no);
  discard.pic(room_no);
  set.horizon(37);

// Check what room the player came from and position them on the
// screen accordingly here, e.g:
 if (prev_room_no == 51) {
   position(ego,80,80);
   print("After stepping through the gate, you feel as if you have been sucked into some kind of nightmare world.  Padded walls, a strait-jacket, and the howls of the mad.  You're either in an insane asylum or a software development house.");
   ego_dir=0;

 if (food_puzzle < 3) {
   reset(inmate1);
   reset(inmate2);
   reset(inmate3);
   reset(inmate4);
   reset(inmate5);
   escaped=0;
   }

 }

 if (prev_room_no == 57) {
   position(ego,74,120);
   }

 if (prev_room_no == 107) {
    position(ego,75,56);
    }

  load.sound(35);
  sound(35, sound_flag);

  draw(ego);
  show.pic();
}

if (said("look")) {
  print("You appear to be in a padded cell.");
}

if (said("look","wall"))
     {
          print("It is covered with some soft padding.  The padding is stained with age, cold sweat, and hospital food.  There is a vent attached to the wall.");
          }

if (said("look","floor")) {
    print("It is covered with some soft padding.  The padding is stained with age, cold sweat, and hospital food.");
    }

if (said("look","ceiling")) {
    print("Wow, even the ceilings are padded.  What kind of people are committed here?");
    }

if (said("look","vent")) {
    print("There's a stale draft blowing from the vent.  The screws are loose.");
    }

if (said("attack","vent")) {
    print("The cover just slips off.  There's no need to break it.");
    }

if ((said("take","vent") ||
     said("remove","vent"))) {
    print("Three of the screws are loose, but the fourth is still in place.  Moreover, it's a left-handed womple drive, which is impossible to get on Voodoo Island.");
    print("You can probably just open it and climb through.");
    }


if ((said("enter","vent") ||
     said("use","vent") ||
     said("climb","vent") ||
     said("open","vent") ||
     said("get","vent"))) {
    if (obj.in.box(ego, 67, 56, 88, 66)) {
        new.room(107);
        }
    else {
        print("What?!  Are you going to hurl yourself across the room?");
        }
    }

if (ego_touching_signal_line) { //ego at the door
    new.room(57);
    }


//if (ego_edge_code == horizon_edge) {  // ego touching horizon
//  new.room(2);
///}

//if (ego_edge_code == right_edge) {    // ego touching right edge of screen
//  new.room(2);
//}

//if (ego_edge_code == bottom_edge) {   // ego touching bottom edge of screen
//  new.room(2);
//}

//if (ego_edge_code == left_edge) {     // ego touching left edge of screen
//  new.room(2);
//}

if (sound_flag) {
    sound(35, sound_flag);
    }

return();