// ****************************************************************************
//
// Logic 43: Twinkie-Dinkie's House
//
// ****************************************************************************

#include "defines.txt"

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



// Check what room the player came from and position them on the
// screen accordingly here, e.g:
 if (prev_room_no == 42) {
   position(ego,140,140);
   ego_dir=7;
 }
 if (prev_room_no==44) {
   position(ego,58,63);
   ego_dir=5;
   }
  if (twinkie) {
      animate.obj(o1);
      load.view(114);
      set.view(o1,114);
      position(o1,30,120);
      }

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

  reset(done_flag);
  reset(more_done_flag);
  draw(ego);
  show.pic();
}

if (said("look")) {
  print("You see a small house built next to a path to the north.  A fortified stone wall lies to the south.");
}

if (said("look","house")) {
    print("This house matches the occupant, both in terms of color and loudness.  It is the home of Twinkie Dinkie, the Jelly Chubby, notorious children's show puppet.  It's filthy, too.  There's some kind of stuff all over the ground.");
    }

if (said("look","Twinkie Dinkie")) {
   if (more_done_flag) {
    print("Dear Erzulie, that puppet must spend all of his free time drinking brew and staring into that inane belly of his.  He's awfully bloated for a puppet.");
    }
    else {
     print("You don't see him...  her...  it.");
     }
   }

if (said("look","trees")) {
    print("Hmm...  They seem to be nothing more than cardboard stage props.");
    }

if (said("look","wall")) {
    print("It's actually only canvas and two-by-fours, but beyond that is a cliff wall towering to infinity.  Crazy dream world.");
    }

if ((said("look","ground") ||
     said("look","stuff"))) {
     print("It looks like lice-infested puppet mange.");
     }

if (said("look","puppet mange")) {
    if (!has("puppet mange")) {
    print("It's definitely lice-infested puppet mange.");
    }
    else {
       show.obj(puppet_mange);
       }
    }

if ((said("look","grass") ||
     said("look","plants") ||
     said("look","flowers"))) {
          print("It's all fake...  plastic!");
          }

if (said("take","puppet mange")) {
    if (obj.in.box(ego,20,100,50,140)) {
        print("A little dab'll do ya'...");
        get("puppet mange");
        }
    else {
        print("As much distance as you'd like to keep between you and Twinkie Dinkie, you must get closer to procure the mange.");
        }
    }

if (new_ego_y<80 &&       //Twinkie-Dinkie bars the way
    twinkie) {
    draw(o1);
    print("STOP!!!!");
    program.control();
    ego_dir=5;
    set(timer_started);
    timer1_a=0;
    }

if (timer_started) { //Time out for player
    if (timer1_a<50) {
        timer1_a++;
        }
    else {
        reset(timer_started);
        set(done_flag);
        }
    }

if (done_flag) {
    print("Oh, no, don't go any further!!!  It's scary out there!  Why don't you stay here, and we can sing happy songs and watch Basic Cable on my Tummy-Tum-Tum?");
    print("Voodoo Girl: \"Uh...  I don't think so, Twinkie-Dinkie.\"");
    ego_dir=0;
    player.control();
    reset(done_flag);
    set(more_done_flag);
    }

if ((said("talk","man") ||
     said("talk","twinkie dinkie") ||
     said("talk","thing"))) {
          if (more_done_flag) {
            if (chat == 0) {
              print ("Twinkie: \"Winkie Tonkie Blinkie Blop!!\"");
              print ("VG: \"Uh...  What?!\"");
              chat++;
              }
            if (chat == 1) {
              print("Twinkie: \"Boopie-toopie, Bobo-Gloopie!!\"");
              print("VG: \"Are you speaking Esperanto?\"");
              chat++;
              }
            if (chat == 2) {
              print("Twinkie: \"Tink-a-stink-a-Co-co-Mo-Bo!!\"");
              print("VG: \"It's useless talking to you!!\"");
              chat=0;
              }
              }
              else {
                  print("You're talking to yourself again.");
                  }
          }


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

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

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

return();