#include defines.txt

if (isset(new_room)) {
  load.pic(v0);
  draw.pic(v0);
  discard.pic(v0);
  set.horizon(37);
  if ((prev_room_no == 12 ||
      prev_room_no == 0  ||
      prev_room_no == 15)) {
    position(o0,80,100);
    status.line.on();
    accept.input();
  }
  load.view(13);
  load.view(14);

  if (room_up == 255) {
    add.to.pic(13,0,0,63,84,4,0);
  }
  if (room_left == 255) {
    add.to.pic(14,0,0,40,117,14,2);
  }
  if (room_right == 255) {
    add.to.pic(14,0,0,111,117,14,2);
  }
  if (room_down == 255) {
    add.to.pic(13,0,0,63,134,14,0);
  }

animate.obj(o5);
load.view(handle);
set.view(o5,handle);
position(o5,73,107);

if (index==17){
   if (!mz_switch_1) {
   set.cel(o5,0);
   draw(o5);
   stop.cycling(o5);
   }
   else {
   set.cel(o5,1);
   draw(o5);
   stop.cycling(o5);
   }
  }

if (index==3){
   if (!mz_switch_2) {
   set.cel(o5,0);
   draw(o5);
   stop.cycling(o5);
   }
   else {
   set.cel(o5,1);
   draw(o5);
   stop.cycling(o5);
   }
}

if (index==24 && doll_flag) {
   load.view(voodoo_doll);
   set.view(o5,voodoo_doll);
   draw(o5);
   }

if (index == 0 &&
    golden_caul == 4) {
    load.view(gold_shard);
    set.view(o5,gold_shard);
    draw(o5);
    }

  reset(f100);

  draw(o0);
  show.pic();
  display(24,0,"room: %v94|3");
  reset(f255);

  load.sound(66);
  sound(66,sound_flag);
}



if (said("look")) {
  print("Voodoo Girl sees lots of tunnel and lots of rocks.");
  if ((index==17 ||
       index==3)) {
          print("You see some kind of handle jutting out of the stone floor.");
          }
  if (index==24 &&
      doll_flag) {
          print("You see some kind of doll.  Is it the houngan's missing voodoo doll?");
          }
  if (index == 0 &&
      golden_caul == 4) {
          print("You see a fragment of the golden cauldron.");
          }
}

if (said("look","switch")) {
    if ((index == 17 ||
         index == 3)) {
            print("Hmm...  a handle.  I wonder what it does.");
            }
    else {
         print("You see no handles here.");
         }
    }

if (said("look","doll")) {
    if (index == 24 &&
        doll_flag) {
            print("It IS the houngan's missing doll.");
            }
    else {
        print("There are no dolls in this room.");
        }
    }

if ((said("look","shard") ||
     said("look","fragment"))) {
    if (index == 0 &&
        golden_caul == 4) {
           print("It's a glinting fragment of the legendary Golden Cauldron.");
        }
    else {
        print("You see no shards here.");
        }
    }

if ((said("look","stalactites") ||
     said("look","stalagmites") ||
     said("look","rock"))) {
         print("The ones on the Ceiling are called stalaCtites, and the ones on the Ground are stalaGmites.");
         }

if (said("use","handle")) {
    if (index==17) {
        if (mz_switch_1) {
           reset(mz_switch_1);
           }
        else {
           set(mz_switch_1);
           }
       }
    if (index==3) {
        if (mz_switch_2) {
           reset(mz_switch_2);
           }
        else {
           set(mz_switch_2);
           }
        }
    new.room(13);
    }

if (said("get","voodoo doll")) {
    if (index==24 && doll_flag) {
        print("You found the doll!");
        get("voodoo doll");
        reset(doll_flag);
        score++;
        new.room(13);
        }
    else {
        print("Huh!  What?!  You've been down here too long...  you're starting to see things.");
        }
    }

if ((said("get","fragment") ||
     said("get","shard"))) {
    if (index == 0 &&
        golden_caul == 4) {
            print("You found the fragment!");
            score++;
            golden_caul++;
            new.room(13);
            }
    else {
       print("Huh!  What?!  You've been down here too long...  you're starting to see things.");
       }
    }

if (isset(f255)) {
  player.control();
}

if (ego_touching_signal_line){
  if (new_ego_y<86) {
    if (room_up != 255) {
      index = room_up;
      call(14);
      reposition.to(o0,74,118);
      new.room(13);
    }
    else {
      print("The tunnel is choked off with rubble.");
      move.obj(o0,70,80,0,f255);
    }
  }
  if (new_ego_x>99) {
    if (room_right != 255) {
      index = room_right;
      call(14);
      reposition.to(o0,51,101);
      new.room(13);
    }
    else {
      print("The tunnel is choked off with rubble.");
      move.obj(o0,96,101,0,f255);
    }
  }
  if (new_ego_x<58) {
    if (room_left != 255) {
      if (room_left == 250) {
      new.room(15);
      }

      index = room_left;
      call(14);
      reposition.to(o0,96,101);
      new.room(13);
    }
    else {
      print("The tunnel is choked off with rubble.");
      move.obj(o0,51,101,0,f255);
    }
  }
  if (new_ego_y>132) {
    if (room_down != 255) {
      if (room_down == 250) {
          new.room(12);
          }
      else {
      index = room_down;
      call(14);
      reposition.to(o0,70,80);
      new.room(13);
      }
    }
    else {
      print("The tunnel is choked off with rubble.");
      move.obj(o0,74,118,0,f255);
    }
  }
}

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

return();

// Messages
#message 1 "The tunnel is choked off with rubble."
#message 2 "room: %v50|3"
#message 3 "You got the Blue Mushroom!"
#message 4 "Now what the @#$% are you supposed to do with it?"
#message 5 "No, it's definitely not here."
#message 6 "No mushrooms, no moss, no lichen."
#message 7 "Voodoo Girl sees lots of tunnel and lots of rocks."