// ****************************************************************************
//
// Logic 53: Inside the Gates to the Castle
//
// ****************************************************************************

#include "defines.txt"

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



// Check what room the player came from and position them on the
// screen accordingly here, e.g:
/* if (prev_room_no == 44) {
     position(ego,44,72);
     ego_dir = 5;
 }*/
  load.view(0);
  load.view(1);
  load.view(2);


  if (!is_zombie) {
  animate.obj(o1);
  load.view(103);
  set.view(o1,103);
  position(o1,20,43);
  draw(o1);

  animate.obj(o2);
  load.view(4);
  set.view(o2, 4);
  }

  if (is_zombie) {
  load.view(103);
  load.view(129);
  set.view(ego,103);

  }

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

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



if (said("look")) {
  print("You are inside the gate to the castle.    You see some kind of ve ve chalked on the wall.");
    if(!is_zombie) {print("You see a zombie, mindlessly shuffling his feet.");}
}

if (said("look","zombie")) {
    print("Zombies are darn useful and strong.  They just aren't very good at conversation, or math, or anything else requiring a functional brain.");
    }

if (said("look","ve ve")) {
    print("Is it?");
    print("Could it be?");
    print("It IS!!!");
    print("This is a special ve ve that allows an houngan to possess a zombie, provided they have an ason rattle.  One shake to possess the zombie, and another to un-possess the zombie.");
       if (!has("bone rattle")) {
           print("Hmmm...  Mama Houngan has an ason made of bone that you've had your eye on for a while.  Maybe she would trade for it.");
           }
    }

if ((said("look","ladder") ||
     said("climb","ladder"))) {
          print("It looks sturdy enough.  Just push up or down when you're centered on the ladder to climb.");
          }

if ((said("look","statue") ||
     said("push","statue") ||
     said("get","statue"))) {
          print("There are some creepy statues here, and as much as you'd like them out of the way, they are firmly cemented to the floor.");
          }

if (said("look","gate")) {
    print("Yes, that's the gate you entered.");
    }

if (said("jump")) {
    print("This is a non-jumping game.");
    }

if ((said("use","bone rattle") ||
     said("use","ve ve") ||
     said("cast","spell") ||
     said("shake","bone rattle"))) {
          if (has("bone rattle")) {
            if (!is_zombie) {
              if(new_ego_x<40 && new_ego_y==97) {
                 print("You do a little dance...");
                 print("You shout out the arcance words of power...");
                 print("You give that rattle a mean shake...");
                 print("And...");
                 position.v(o2, new_ego_x, new_ego_y);
                 draw(o2);
                 end.of.loop(o2, done_flag);
                 }
              else {
                 print("Y'see, according to UN Treaty, the user actually has to be somewhere close to the ve ve to get it to work.");
                 }
               }
            else {
                reset(is_zombie);
                position(ego, 10,96);
                new.room(53);
                }
              }
          else {
               print("Aww, I'm sorry, but you don't have a bone rattle.");
               }
     }

if (done_flag) {
    reset(done_flag);
    erase(o2);
    position(ego,20,43);
    set(is_zombie);
    new.room(53);
    }

if (said("take","ve ve")) {
    print("It's just a chalk drawing.");
    }

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

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

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

call(100);

return();