// ****************************************************************************
//
// Logic 42: The Talking Grub
//
// ****************************************************************************

#include "defines.txt"

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

  if (grub) {
      animate.obj(o1);
      load.view(115);
      set.view(o1,115);
      position(o1,66,123);
      universe = 2;
      cycle.time(o1, universe);
      draw(o1);
      }

// Check what room the player came from and position them on the
// screen accordingly here, e.g:
 if (prev_room_no == 40) {
   position(ego,12,140);
 }
 if (prev_room_no == 41) {
   position(ego, 71, 136);
   }
 if (prev_room_no == 43) {
   position(ego,76,60);
   ego_dir=5;
   }

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

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

if (said("look")) {
  print("You see a giant grub hanging out at the only other exit to this brief valley.");
}

if (said("look","grub")) {
   print("Your weird dream logic makes this worm remind you of Pat Trebek, the host of Wheel of Jeopardy.");
   }

if (said("talk","grub")) {
  if (grub) {
    print("Grub: \"Well-l-l, how are you, my chil-l-ld?\"");
    print("VG: \"What do you want?  Get out of my way!\"");
    print("Grub: \"No, chil-l-ld.  I shall not move until you have faced the wrath...\"");
    print("\"...the HORROR...\"");
    print("\"of...\"");
    print("WHEEL!");
    print("OF!!");
    print("JEOPARDY!!!");
    new.room(41);
    }

   else {
     print("There's no one here, anymore.");
     }
   }

if ((said("look","cliff") ||
     said("look","wall"))) {
    print("Sheer walls rise up around you.");
    }

if ((said("look","flowers") ||
     said("look","plant"))) {
    print("Poppies! Po-o-o-oppies!");
    }

if ((said("look","ground") ||
     said("look","grass"))) {
          print("While there are some curious and perhaps essential details revealed by looking at many different things.  Often, things are just exactly what they seem.");
          }

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


if (ego_edge_code == left_edge) {     // ego touching left edge of screen
  new.room(40);
}

if (sound_flag) {
    sound(19, sound_flag);
    }
return();