// ****************************************************************************
//
// Logic 12: Underground Cave
//
// ****************************************************************************

#include "defines.txt"

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



 if (prev_room_no == 13) {
   position(ego,130,80);
 }
  load.view(3);
  draw(ego);
  show.pic();
  if (!has("blue mushroom")) {
    animate.obj(o2);
    load.view(blue_mushroom);
    set.view(o2,blue_mushroom);
    position(o2,74,106);
    draw(o2);
    set(f100);
  }
  else {
    reset(f100);
  }
  draw(o0);
  show.pic();
  display(24,0,"room: %v94|3");
  reset(f255);

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



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("The churning waters suck you down.");
        erase(ego);
        set.view(ego,0);
        reset(always_animate_ego);
        new.room(204);
        }
    else {
        print("NO DIVING FROM POOLSIDE");
        }
     }

if (said("look")) {
  print("It's some kind of underground cave.  The water in the pool is deep and shows signs of a heavy current beneath the surface.");
  if (has("blue mushroom")) {
      print("And the mother of all blue mushrooms is growing in the damp darkness.");
      }

  }

if (said("look","water")) {
    print("Hmmm, this might be one of the sources to the river.  The main river springs from deep underground...");
    }

if (said("look","blue mushroom")) {
  if (has("blue mushroom")) {
     show.obj(55);
     }
  else {print("Cor blimey!  Ye hit the mother lode!");}
  }

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 (ego_edge_code == right_edge) {  // ego touching left edge
  index=0;
  call(14);
  new.room(13);
}

if (said("get","blue mushroom")) {
  if (!has("blue mushroom")) {
    if (obj.in.box(o2,66,101,90,111)) {
      erase(o2);
      get("blue mushroom");
      print("You got the Blue Mushroom!");
      v3 += 1;
      print("Now what the @#$! are you supposed to do with it?");
    }
    else {
      print("No, it's definitely not here.");
    }
  }
  else {
    print("No mushrooms, no moss, no lichen.");
  }
}

//if (ego_edge_code == bottom_edge) {    // ego touching bottom edge of screen
//  new.room();
//}

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

return();