var lookJanitor = 0;
var lookDrunkJanitor = 0;

objectType janitor ("janitor") {
  speechColour 200, 200, 200;
  speechGap 45;
    event lookAt { #LOOK becomes POINT AT
      moveCharacter (sam, 154, 437);
      turnCharacter (sam, EAST);
      if (drugJanitor > 0) {
        if (lookDrunkJanitor == 0) {
         Say (sam, "It's Mr. Johnson, our senile old janitor who is currently drunk.");
         Say (max, "He doesn't seem that old.");
         Say (sam, "Stop contradicting me, Max.");
         lookDrunkJanitor = 1;
         return;
        }
        else {
         Say (sam, "Sleeping like a baby.");
         Say (max, "A drunk baby!");
        }
      }
     else {
      if (lookJanitor == 0) {
       Say (sam, "It's Mr. Johnson, our friendly neighborhood janitor.");
       Say (max, "And it's rude to point.");
       Say (sam, "Oops.  Sorry.");
       lookJanitor = 1;
       return;
      }
      else {
       Say (sam, "It's Mr. Johnson, the janitor.");
      }
     }
    }
    event invflintpic {
         moveCharacter (sam, 155, 437);
         turnCharacter (sam, EAST);
      Say (sam, "Have you seen this man?");
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (4, 4), wait (3, 4), wait (2, 4), wait (1, 4), wait (0, 4)), NULL, NULL));
         pause (16);
         setCostume (mopbackdrop, costume (anim ('iface/act1-1.duc', 12), NULL, NULL));
         pause (4);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (6, 4), wait (7, 4), wait (8, 4)), NULL, NULL));
         pause (12);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', 8), NULL, anim ('officehallway/janitor.duc', wait (9, 4), wait (10, 4), wait (9, 4), wait (11, 4), wait (10, 4), wait (12, 4))));
      Say (janitor, "Which one?");
      Say (sam, "Um, the center one.");
      Say (janitor, "No.");
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (0, 4)), NULL, NULL));
         pause (4);
         setCostume (mopbackdrop, costume (anim ('iface/act1-1.duc', 11), NULL, NULL));
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (1, 4), wait (2, 4)), NULL, NULL));
         pause (8);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (2, 5), wait (3, 5), wait (4, 5), wait (3, 5), wait (2, 5), wait (5, 5)), NULL, NULL));
      Say (sam, "So much for that.");
    }

    event invflintpichole {
         moveCharacter (sam, 154, 437);
         turnCharacter (sam, EAST);
      Say (sam, "Have you seen this man?");
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (4, 4), wait (3, 4), wait (2, 4), wait (1, 4), wait (0, 4)), NULL, NULL));
         pause (16);
         setCostume (mopbackdrop, costume (anim ('iface/act1-1.duc', 12), NULL, NULL));
         pause (4);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (6, 4), wait (7, 4), wait (8, 4)), NULL, NULL));
         pause (12);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', 8), NULL, anim ('officehallway/janitor.duc', wait (9, 4), wait (10, 4), wait (9, 4), wait (11, 4), wait (10, 4), wait (12, 4))));
      Say (janitor, "Which one?");
      Say (sam, "Um, the center one.");
      Say (janitor, "No.");
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (0, 4)), NULL, NULL));
         pause (4);
         setCostume (mopbackdrop, costume (anim ('iface/act1-1.duc', 11), NULL, NULL));
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (1, 4), wait (2, 4)), NULL, NULL));
         pause (8);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (2, 5), wait (3, 5), wait (4, 5), wait (3, 5), wait (2, 5), wait (5, 5)), NULL, NULL));
      Say (sam, "So much for that.");
    }
    event beerbottle {
         moveCharacter (sam, 154, 437);
         turnCharacter (sam, EAST);
         pause (10);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (4, 4), wait (3, 4), wait (2, 4), wait (1, 4), wait (0, 4)), NULL, NULL));
         pause (16);
         setCostume (mopbackdrop, costume (anim ('iface/act1-1.duc', 12), NULL, NULL));
         pause (4);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (6, 4), wait (7, 4), wait (8, 4)), NULL, NULL));
         pause (12);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (13, 4), wait (14, 4), wait (15, 4), wait (16, 4), wait (17, 8), wait (18, 4), wait (19, 10)), NULL, NULL));
         pause (40);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (20, 8), wait (21, 8), wait (22, 8), wait (21, 8)), NULL, anim ('officehallway/janitor.duc', wait (20, 8), wait (21, 8), wait (22, 8), wait (21, 8))));
         Say (janitor, "Say there youngun, did I evar tell you about...");
         Say (janitor, "...dat...stufff...");
         deleteFromStack (inventory, beerbottle);
         Say (sam, "Well, that was a freakishly disturbing sight I hope I will never have to witness again in all my years.");
         Say (max, "Me too.");
         Say (sam, "Stop saying that Max!"); 
         drugJanitor = 1;
         addCharacter (fallenKeys, 292, 366, costume (
             anim ('iface/act1-1.duc', 71),
             anim ('iface/act1-1.duc', 72), NULL)); 
         setCharacterExtra (fallenKeys, FIXEDSIZE + FRONT);
         setCharacterWalkSpeed (fallenKeys, 20);
         moveCharacter (fallenKeys, 252, 520);
         setCharacterExtra (fallenKeys, NORMAL);
         setCharacterExtra (fallenKeys, FIXEDSIZE);
    }
    event talkTo {
      if (drugJanitor > 0) {
         Say (sam, "Never disturb a sleeping drunk.");
      }
      else {
       moveCharacter (sam, 154, 437);
       turnCharacter (sam, EAST);
       moveCharacter (max, 99, 488);
       turnCharacter (max, EAST);
       if (talkToJanitor4 == 0) {
         Say (sam, "Hi!");
         talkToJanitor4 = 1;
       }
       else if (talkToJanitor4 > 0) {
         Say (sam, "We're back.");
       }
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (4, 4), wait (3, 4), wait (2, 4), wait (1, 4), wait (0, 4)), NULL, NULL));
         pause (16);
         setCostume (mopbackdrop, costume (anim ('iface/act1-1.duc', 12), NULL, NULL));
         pause (4);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (6, 4), wait (7, 4), wait (8, 4)), NULL, NULL));
         pause (12);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', 8), NULL, anim ('officehallway/janitor.duc', wait (9, 4), wait (10, 4), wait (9, 4), wait (11, 4), wait (10, 4), wait (12, 4))));
      loop {
       if (talkToJanitor1 == 0) addSpeechChoice ("How's it going, Mr. J?", 1);
       else if (talkToJanitor1 == 1) addSpeechChoice ("So, are you happy with your current lowly job?", 5);
       if (talkToJanitor2 == 0) addSpeechChoice ("Do you know who we are, by any chance?", 2);
       else if (talkToJanitor2 == 1) addSpeechChoice ("So, you seem like a depressing old man...", 6);
   if (firstTime == 2) {
       if (talkToJanitor3 == 0) addSpeechChoice ("You wouldn't happen to have seen a bunch of thugs...", 3);
       else if (talkToJanitor3 == 1) addSpeechChoice ("In that case, did you hear anything?", 8);
   }
       addSpeechChoice ("Can we have that mop?", 4);
       if (littleGirl == 1) addSpeechChoice ("Seen any rampantly missing dolls around here?", 10);
       else if (littleGirl == 2) addSpeechChoice ("Any idea how to grossly disfigure this adorable doll's hair?", 11);
       else if (littleGirl == 4) addSpeechChoice ("You wouldn't happen to know how to fix broken phones, wouldja?", 12);
       if (talkToJanitor2 == 0)  addSpeechChoice ("Gotta go save the world and so on.", 0);
       else addSpeechChoice ("Well, I guess I'll get going...", 9);

          var reply = getSpeechChoice (sam);
           if (reply == 0){
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (0, 4)), NULL, NULL));
         pause (4);
         setCostume (mopbackdrop, costume (anim ('iface/act1-1.duc', 11), NULL, NULL));
         setCostume (janitor, costume (
                 anim ('officehallway/janitor.duc', wait (1, 4), wait (2, 4)), NULL, NULL));
         pause (8);
         setCostume (janitor, costume (anim ('officehallway/janitor.duc', wait (2, 5), wait (3, 5), wait (4, 5), wait (3, 5), wait (2, 5), wait (5, 5)), NULL,anim ('officehallway/janitor.duc', wait (9, 4), wait (10, 4), wait (9, 4), wait (11, 4), wait (10, 4), wait (12, 4))));
               return;
           }
           else if (reply == 1) {
              Say (janitor, "Terrible. Some idiot spilled some toxic sludge here.");
              Say (janitor, "It's sticking to the floor and sticking to the mop and sticking to everything.");
              Say (max, "Sounds sticky.");
              Say (janitor, "Look, what do you bumbling chuckleheads want?");
              Say (janitor, "I'm kind of busy.");
              Say (sam, "You sound frustrated.  Maybe you should take a break."); 
              Say (janitor, "Actually, I am somewhat parched.");
              Say (janitor, "Some liquor would be nice.");
              talkToJanitor1 = 1;
           }
          else if (reply == 5) {
              Say (janitor, "No. I've worked in better places than this sleazy office building.");
              Say (max, "We happen to like this sleazy office.");
              Say (sam, "Quiet, fur-brain...");
              Say (sam, "Ah...such as?");
              Say (janitor, "Well, for awhile I worked as janitor on several outer space labs."); 
              Say (max, "Oh yeah! Haven't I seen you in...");
              Say (sam, "Shh! We don't want to get sued by any other companies than we already have been.");
              talkToJanitor1 = 2;
          }
          else if (reply == 2) {
              Say (janitor, "You're two kids a couple of months late for Halloween.");
              Say (max, "I hope you know a good dentist, buddy...");
              Say (sam, "Heel, Max.");
              Say (sam, "Actually, we're Sam & Max - Freelance Police!");
              Say (janitor, "And I'm the Queen of England.");
              Say (max, "Isn't it odd how quickly great heroes are forgotten?");
              Say (sam, "Tell me about it, Max.");
              Say (sam, "Everyone thinks that we've fallen off the face of the earth or died or something.");
              Say (janitor, "Aren't we all dead?");
              Say (sam, "Eh? ");
              Say (janitor, "What is this life but a mere passing moment in the overall scheme of the universe?");
              Say (max, "Weirdo.");
	      Say (max, "Can I have the Queen's autograph?");
	      Say (sam, "Where would you put it?");
	      Say (max, "That's none of your business, Sam.");
              talkToJanitor2 = 1;
          }
          else if (reply == 6) {
              Say (sam, "...elaborate on your theories of the great beyond and the universe.");
              Say (janitor, "My lifetime, your lifetime, everyone's lifetime - does not even amount to a grain of sand in the great hourglass of time, continually draining by every passing moment...");
              Say (max, "Sam, let's leave this crippled old man to mop the floors he probably uses as public bathrooms. He's scaring me.");
              Say (sam, "Good idea, my fuzzy comrade.");
              talkToJanitor2 = 2;
              addSpeechChoice ("Any more...", "Any more disturbing info you'd like to share with us for the cause of making Max and me stay up late, with wide bug-eyes like little kids and wet the bed every night for the rest of our lives?");
              Say (sam, getSpeechChoice (NULL));
              Say (janitor, "Go soak your heads.");
              Say (max, "Oooooh!  The verbal jousting has begun!");
              Say (sam, "Fat chance, Max.");
          }
         else if (reply == 3) {
             Say (sam, "...thugs that were carrying an unconscious private dick out of here roughly, would you?");
             Say (janitor, "Nope.");
             talkToJanitor3 = 1;
         }              
         else if (reply == 8) {
             Say (janitor, "Nope.");
             Say (sam, "You were in here when we came in, weren't you?");
             Say (janitor, "Yep.");
             Say (sam, "Sooo...you must have seen something.");
             Say (janitor, "Nope.");
             pause (40);
             Say (max, "I don't like this guy, Sam.");
             Say (max, "Let's take him into a dark alley and beat him until he's purple all over.");
             Say (sam, "Max, most professional interragators only resort to violence when the suspect has become increasingly annoying.");
             Say (max, "Your point?");
             pause (20);
             Say (sam, "I guess you're right.");
             Say (sam, "Sadly, while that would be amusing...");
             Say (sam, "...our schedule is too packed for senseless violence to the irksome cleaning staff."); 
             talkToJanitor3 = 2;
         }    
         else if (reply == 4) {
             Say (janitor, "Sorry, I'm using it. Maybe when I'm done.");
             Say (max, "When's your break?");
             Say (janitor, "When I finish with this mess.");
             Say (janitor, "Of course, if you had some good booze for me, I might be tempted to stop for a while.");
             Say (max, "Drunkard... ");
         }
        else if (reply == 9) {
          setCostume (janitor, costume (
                 anim ('officehallway/janitor.duc', wait (0, 4)), NULL, NULL));
          pause (4);
          setCostume (mopbackdrop, costume (
            anim ('iface/act1-1.duc', 11), NULL, NULL));
          setCostume (janitor, costume (
                 anim ('officehallway/janitor.duc', wait (1, 2), wait (2, 2)), NULL, NULL));
          pause (4);
          setCostume (janitor, costume (
                  anim ('officehallway/janitor.duc', wait (2, 5), wait (3, 5), wait (4, 5), wait (3, 5), wait (2, 5), wait (5, 5)
                       ), 
                  NULL,
                  anim ('officehallway/janitor.duc', wait (9, 4), wait (10, 4), wait (9, 4), wait (11, 4), wait (10, 4), wait (12, 4)
                       )
                       ));
             return;
        }
        else if (reply == 10) {
             Say (janitor, "Nope, but they're selling jerky down at Ma and Pa's for a buck.");
             Say (janitor, "Oh, and I may have seen a few dolls there, too.");
        }
        else if (reply == 11) {
             Say (janitor, "What for?");
             Say (sam, "To match the description of a psycho little girl.");
             Say (janitor, "I don't know... maybe dip it's head in tar...");
             Say (janitor, "...or paint...sumthin' like that.");
        }
        else if (reply == 12) {
             Say (janitor, "I just stick all the wires and stuff I can find into broken electric devices.");
             Say (sam, "Doesn't sound quite safe.");
             Say (max, "What do we know about 'safe' anyway?");
             Say (max, "We store our supply of illegal nuclear weapons next to the lighter fluid.");
             Say (sam, "Good point.");
        }
         }}
       
       }
    event verbRename {
       rename (lookAt, "Point at ");
       rename (talkTo, "Chat with ");
    }
    }