// ****************************************************************************
//
// Logic 67: CHTHTHULHTYHTHTHU sleeps
//
// ****************************************************************************

#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 == 204) {
   position(ego,80,80);
 }
 if (prev_room_no == 70) {
    position(ego, 120, 160);
    }

 if (prev_room_no == 108) {
    position(ego, 80, 80);
    }

  load.view(3);
  load.view(0);
  if (!chthugone) {
  animate.obj(o1); // Great Chthuchuthuthcuhhlhuh
  load.view(118);
  set.view(o1,118);
  position(o1, 28, 70);
  set.loop(o1,0);
  universe = 2;
  cycle.time(o1, universe);
  draw(o1);
  }

  if (chthugone) {
     ignore.blocks(ego);
     }

  index = 0;

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

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

if (said("look")) {
  print("This is a desolate cave formed from the waters of Atlantis trickling through the bones of those who have glimpsed THINGS WHICH SHOULD NOT BE SEEN.");
  print("With a little redecorating you could probably make a nice summer home here.");
  if (!chthugone) {
       print("There seems to be some creepy green guy guarding the exit.");
       }
}

if ((said("look","man") ||
     said("look","god") ||
     said("look","thing") ||
     said("look","creature"))) {
        if (!chthugone) {
          print("If you're not mistaken, this is the ancient Atlantean demi-god, Chtuthtuthtutlhuththlu.");
          print("Just attempting to pronounce his name is said to drive men mad...  especially diction coaches.");
          }
        else {
          print("No one else is here, anymore.");
          }
     }

if ((said("talk","man") ||
     said("talk","god") ||
     said("talk","thing") ||
     said("talk","creature"))) {
        if (!chthugone) {
           set.loop(o1, 1);
           force.update(o1);
         if (index == 0) {
           print("VG: \"Uh, hello, Mister Chth-<mumbles>-u...?\"");
           print("CH: \"Hush, I'm supposed to be sleeping away the aeons.\"");
           print("VG: \"That's fine.  If you'd just move to one side for a moment...\"");
           print("CH: \"Shove off!\"");
           print("VG: \"Somehow, I imagined you bigger.\"");
           print("CH: \"I've been sick ever since my amulet was sundered and its pieces cast about the Stygian darkness.\"");
           print("VG: \"I totally hate it when that happens.\"");
           index++;
           set.loop(o1, 0);
           return();
             }
         if (index == 1) {
           print("VG: \"Uh, Mister C...  it's just that...\"");
           print("CH: \"What?!  What do you want?!\"");
           print("VG: \"I just need to get through and, well, confront the Dream King.\"");
           print("CH: \"Why would you want to do a thing like that?\"");
           print("VG: \"Well, I don't really want to, but I need the Golden Cauldron for one of Mama Hoodoo's spells.\"");
           print("CH: \"So, you're pretty good at finding things?\"");
           print("VG: \"Are you kidding?  I'm the BEST!!\"");
           print("CH: \"Then you should have no trouble finding the fragments of my golden amulet!\"");
           print("VG: \"But...  but...  \"");
           print("CH: \"Then I'll see about getting out of your way...  until then...  must sleep...\"");
           index++;
           set.loop(o1, 0);
           return();
           }
         if (index == 2) {
           print("CH: \"Listen, kid, get me my amulet, and I'll let you through, all right!\"");
           }

         }
        else {
           print("Nothing answers back except for the sound of your own voice.");
           }
        set.loop(o1, 0);
        }

if ((said("look","wall") ||
     said("look","sign") ||
     said("read","wall") ||
     said("read","sign"))) {
        print("It's written in the ancient Grahdflxxx dialect, which died out as a spoken language because it was necessary to punch yourself in the throat in order to make the appropriate syllables.");
        print("Not surprisingly, the Grahdflxxx's died out simoultaneously.");
        print("Roughly translated:  That does not die which may eternal nap;  and in strange aeons even death is c#$@.");
        }

if ((said("look","cave") ||
     said("look","door"))) {
          print("There is some kind of swirling darkness behind that door which makes your eyes hurt.");
          }

if (said("look","water")) {
    print("The water gently ripples, illuminated by some kind of luminescent stones embedded in the ceiling.");
    }

if (said("look","ceiling")) {
    print("Far beyond the reach of any mortals are crystals that shed a paltry light into this cave.");
    }

if ((said("give","amulet") ||
     said("give","amulet","rol"))) {
          if (has("amulet")) {
              print("CH: \"Why thank you, I lost this around 1977 B.C.  Now I can go back out on the street and get with the ladies in style.");
              set(chthugone);
              drop("amulet");
              score++;
              new.room(67);
              }
          else {
              print("You don't have the assembled amulet yet.");
              }
          }

if ((said("move","man") ||
     said("move","god") ||
     said("move","thing") ||
     said("move","creature"))) {
         print("Erm...  no, he's REALLY heavy and generally disagreeable to being shoved around.");
         }

if ((said("attack","man") ||
     said("attack","god") ||
     said("attack","thing") ||
     said("attack","creature"))) {
         print("HAHAHAHAHAHAAAAA....  no.  You couldn't fight your way out of a wet, paper bag, especially if that wet paper back was a gigantic tentacled monster, like CHuhtutlhtutltuthtuultuu.");
         }

if ((said("jump") ||
     said("jump","water"))) {
          print("No diving from poolside.");
          }

if (ego_on_water) {
    set.view(ego,3);
    set(always_animate_ego);
    }
    else {
    set.view(ego,0);
    reset(always_animate_ego);
    }

if (said("swim")) {
    if (ego_on_water) {
        print("You dive into the murky depths below");
        timer1_a=25;//breath
        timer1_b=40;
        new.room(70);

        }
    else {
        print("No diving from poolside!");
        }
    }

if (ego_touching_signal_line) { //ego goes through door
   if (shattered) {
       new.room(108);
       }
   else {
       new.room(85);
       }
   }

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

return();