// ****************************************************************************
//
// Logic 65: The Waiting Room
//
// ****************************************************************************

#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 == 59) {
   position(ego,37,85);
 }

 if (prev_room_no==66) {
    position(ego,112,85);
    }

  animate.obj(o1); //magazines
  load.view(135);
  set.view(o1,135);
  position(o1, 103, 123);
  ignore.objs(o1);
  set.priority(o1, 15);
  draw(o1);

  index = 0;

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

if (said("look")) {
  print("This is the waiting room.");
  print("There are a couple garish, flower-print couches and and end table covered in magazines.");
  print("Also, there's a window from which the patients receive their medicine.");
}

if (said("look","couch")) {
    print("Yep, they're hideous.  Perhaps you should examine them more closely.");
    }

if ((said("look","under","couch","cushion") ||
     said("look","under","cushion"))) {
    if (obj.in.box(ego,50,43,86,53)) {
        print("Hmmm...  Well, this isn't the kind of game where you'd need dust bunnies, partially used chewing gum, or a comb with broken teeth, so...");
        print("I guess you didn't really find much of anything.");
    }
    if (obj.in.box(ego,46,123,96,133)) {
        print("Hmmm...  An old barbie doll head, a few corroded pennies, and a note that says \"Nursie is a chocolate piggie\"...");
        if (!has("jacket key")) {
            print("And a key!!!  Keys are always useful in games like these.  You pocket that!");
            get("jacket key");
            score++;
            }
    }
    if (!obj.in.box(ego,50,43,86,53) &&
        !obj.in.box(ego,46,123,96,133)) {
            print("Arms...  too...  short!");
            }
    }

if (said("look","under","couch")) {
  if (obj.in.box(ego,50,43,86,53)) {
        print("Hmmm...  a dried-up cuttlefish, some shredded stockings, and a dead cockroach.");

    }
    if (obj.in.box(ego,46,123,96,133)) {
        print("Hmmm...  an 8-Track of 70's hits, a pink hair curler, and half a boomerang.");
    }
    if (!obj.in.box(ego,50,43,86,53) &&
        !obj.in.box(ego,46,123,96,133)) {
            print("Arms...  too...  short!");
            }
         }

if (said("look","door")) {
    print("That's the door to Nursie's office.");
    print("You can smell the reek of beef jerky from within.");
    }

if (said("look","window")) {
    print("Presumably, this is where the patients get their medication.  There's a little hole in the window for talking and exchanging.");
    }

if ((said("talk","nursie") ||
     said("talk","window"))) {
       print("VG: \"Hey, I'd like some thorazine...  to go, please.\"");
       print("Nursie: \"Would you like fries with that?\"");
       print("VG: \"Uh...  sure, whatever.\"");
       print("Nursie: \"Well, too bad, the fries are all mine...  and the medicine, too!\"");
       print("VG: \"This isn't going to work.\"");
       }

if ((said("look","table") ||
     said("look","magazine") ||
     said("read","magazine") ||
     said("get","magazine") ||
     said("use","magazine"))) {
        if (obj.in.box(ego,96,113,124,135)) {
          program.control();
          move.obj(o1,103,106, 0, done_flag);

          }
        else {
          print("You're far enough away that you should just assume that there's reading material somewhere in the general direction of the table.");
          }
    }

if (done_flag) {
    reset(done_flag);
    if (index == 2) {
        index = 0;
        }
    if (index == 0) {
    print("Pycho-itry Monthly?");
    print("Hmmm...  according to this article, many psycho-itrists who have difficulty giving their patients medication will put it in their food.");
    }
    if (index == 1) {
    print("Dream Journal?");
    print("Hmmm...  if you are stuck in a nightmare and can't escape, you should snap your fingers three times.");
    get.string(s3,"Snap your fingers (y/n) ? ", 10,10, 1);
    set.string(s4, "y");
    if(compare.strings(s3,s4)) {
       new.room(204);
       }
    }
    index++;
    move.obj(o1, 103, 123, 0, more_done_flag);
    }

if (more_done_flag) {
    reset(more_done_flag);
    player.control();
    }

if (said("use","couch")) {
    print("What?!  You want to sit at a time like this?  No way!");
    }



if (ego_touching_signal_line) {
   if (new_ego_x <80) {
    new.room(59);
    }
   else {
    new.room(66);
    }
    }


return();