// ****************************************************************************
//
// Logic 55: Psychotic Psal's Room
//
// ****************************************************************************

#include "defines.txt"

if (new_room) {
  universe=56;
  load.pic(universe);
  draw.pic(universe);
  discard.pic(universe);
  set.horizon(37);

  if (prev_room_no==57) {
   position(ego,70,58);
   ego_dir=0;
   }

 if (prev_room_no == 107) {
     position(ego,70,135);
     }

 if (!inmate1) {
  animate.obj(o1);
  load.view(116);
  load.view(120);
  set.view(o1,116);
  position(o1,70,110);
  draw(o1);
  }

  reset(more_done_flag);

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

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

if (said("look")) {
  print("You are in a padded room.");
  if (!inmate1) {
      print("A strange, grinning man is bound in a straitjacket.");
      }
}

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, 60, 125, 87, 136)) {
        new.room(107);
        }
    else {
        print("What?!  Are you going to hurl yourself across the room?");
        }
    }

if (said("look","man")) {
    print("That looks like your average, ordinary madman.  He's grinning in a rather unsettling manner, and he is wearing a straitjacket.");
    }

if (said("talk","man")) {
    if (!inmate1) {
        print("\"Hi, I'm glad to meet you.  We don't get many visitors here at the asylum, no, no, no, NO!!!\"");
        print("\"Have you met the orderly, yet?  He's the rather tall gentlemen who bears a passing resemblance to a hypodermic needle on legs\"");
        print("\"I could probably distract him for a while if you untied my straitjacket.\"");
        }
    else {
        print("You've been here too long.  The crazy is soaking into your brain.");
        }
    }

if ((said("untie","straitjacket") ||
     said("look","straitjacket")) &&
    !inmate1) {
       print("You take a look at the complex variety of clasps and whatnot and realize that it is beyond your power to untie them.");
       }

if (!inmate1) {

  if ((said("put","purple slime","on","straitjacket") ||
       said("use","purple slime","on","straitjacket"))) {
         distance(o1, ego, range);
         if (range <= 10) {
          set(done_flag);
          print("You apply some purple slime to the straitjacket.");
          }
         else {
           print("You aren't close enough to help him.");
           }
       }

  if ((said("put","slime eater","on","straitjacket") ||
       said("use","slime eater","on","straitjacket") ||
       said("put","slime eater","on","purple slime") ||
       said("use","slime eater","on","purple slime"))) {
          if (done_flag &&
              has("slime eater")) {
            distance(ego, o1, range);
            if (range <= 10) {
              print("The purple slime eater gnaws through the straps and bindings in a matter of seconds.  Unfortunately, it ate too much and popped.");
              set(inmate1);
              escaped++;
              drop("slime eater");
              print("\"Hey, thanks!  Sorry about your pet...  uh...  I'll just go off and cause some trouble, now.\"");
              set.view(o1,120);
              move.obj(o1,70,45,1,more_done_flag);
              }
            else {
              print("Get a little closer.");
              }
            }
          else {
              print("Hmm, no, something's not right.");
              }
     }
}

if (more_done_flag) {
    reset(more_done_flag);
    erase(o1);
    }


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

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

call(205);
return();