// ****************************************************************************
//
// Logic 22: Cafe interior
//
// ****************************************************************************

#include "defines.txt"
#define door o1
#define woman o2


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

  if (prev_room_no == 6) {
    position(ego,130,150);
  }

  if (prev_room_no == 21) {
    position(ego,46,93);
  }

  draw(ego);
  show.pic();

  animate.obj(door);
  load.view(38);
  set.view(door,38);
  set.loop(door,7);
  stop.cycling(door);
  position(door,90,90);
  draw(door);

  animate.obj(woman);
  load.view(39);
  set.view(woman,39);
  set.loop(woman,3);
  stop.cycling(woman);
  position(woman,115,93);
  draw(woman);

  add.to.pic(39,2,0,10,131,13,13);
  add.to.pic(39,2,1,23,131,13,13);
  add.to.pic(39,2,2,53,131,13,13);
}

if (f244) {
  set.cel(door,1);
  ignore.objs(door);
}
else {
  set.cel(door,0);
  observe.objs(door);
}

if (said("open","door")) {
  if (posn(ego,83,91,103,95)) {
//    toggle(f244);
    print("The matronly owner shouts, 'You can't go back there!  (Especially not in the demo.)'");
  }
  else {
    print("You're not close enough.");
  }
}

if (said("look","table")) {
  if (posn(ego,79,91,135,111)) {
    print("Cheryl is at the counter.");
  }
  else {
    if (posn(ego,16,116,104,150)) {
      print("There are customers sitting at two tables.  They are highly engrossed in their activities.");
    }
    else {
      print("You're not close enough.");
    }
  }
}

if ((said("sit","rol") || said("get in","rol"))) {
  print("No time to sit.  You're on an important mission.");
}

if ((said("talk","person") || said("talk","woman"))) {
  if (posn(ego,79,91,135,111)) {
    if (toilet_head) {
      print("You stutter, 'Uh, Cheryl, I think the men's restroom needs to be cleaned.'");
      print("'No problem, John.  I'll get to that right after you shut the hell up and get off my back.'");
    }
    else {
      print("'What's the soup of the day?'");
      print("'Cream of screw off, you bastard, and stop wasting my time.'");
    }
  }
  else {
    if (posn(ego,16,116,32,130)) {
      print("Don't go hitting on that female customer.  She's here with someone.");
    }
    else {
      reset(input_parsed);
    }
  }
}

if (said("look","woman")) {
  if (posn(ego,79,91,135,111)) {
    print("Cheryl is a harsh woman.  You haven't helped matters by coming in here day after day and bothering her, rarely buying anything.");
  }
  else {
    print("Don't stare at people.  Especially people who don't matter.");
  }
}

if ((said("look","man") || said("look","person"))) {
  print("Don't stare at people.  Especially people who don't matter.");
}

if ((said("talk","person") || said("talk","man"))) {
  print("You'd be wasting your time talking to the customers.  They're just decoration, really.");
}

if (said("look","phone")) {
  print("It appears to be a courtesy phone for making local calls.  How nice.");
}

if ((said("use","phone") || said("dial","phone") || said("get","phone"))) {
  if (posn(ego,18,100,32,118)) {
    if (toilet_head && (!isset(phone_sheriff))) {
      print("You seize the phone and dial the sheriff's office.");
      score++; set(phone_sheriff);
      print("'Sheriff's office.  This is Sheriff Leeuwenhoek speaking.'");
      print("You tell the sheriff about the decapitated man in the bathroom.");
      print("He replies, 'So, the killer has struck again.'");
      print("He thanks you for the information, and you hang up.");
      print("Killer?  Not only is the city infested with the living dead, but there is also a serial murderer on the loose?");
      print("Things just got more complicated.");
      new.room(25);
    }
    else {
      print("You've no one to call.");
    }
  }
  else {
    print("You're not close enough.");
  }
}

if (said("look","bathroom")) {
  print("There's a hallway in the back that leads to the bathroom.");
}

if (said("look","cash register")) {
  print("Cheryl shouts, 'Hey, you!  Don't even look at my cash register!");
}

if ((said("take","cash register") || said("open","cash register"))) {
  print("Cheryl shouts, 'I'll cut off your pecker, you jackass!'");
}

if (said("look","door")) {
  print("It's probably the door to the kitchen.");
}

if (said("look","window")) {
  print("You can see into the kitchen.");
}

if ((said("look") || said("look","house"))) {
  print("Look at the inside of the cafe.  Cheryl, whose cafe this is, is standing behind the counter.");
}

if (ego_edge_code == 1) {
  new.room(25);
}

if (f3) {
  if (v31 > 144) {
    new.room(6);
  }
  else {
    new.room(21);
  }
}

return();