//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//  Logic 103: Walking around the castle
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#include "defines.txt"

if (new_room) {
  universe=89;
  load.pic(universe);
  draw.pic(universe);
  discard.pic(universe);
  set.horizon(37);


// Check what room the player came from and position them on the
// screen accordingly here, e.g:
 if (prev_room_no == 44) {
 index=0;
 }

 if (prev_room_no == 105) {
   index = 4;
   }

  load.view(134); //Some moss on the walls
  random(0,148, temp_x);
  random(0,148, temp_y);
  universe = 134;
  temp_x2 = 0;
  temp_y2 = 4;
  add.to.pic.v(universe, temp_x2, temp_x2, temp_x, temp_y, temp_y2, temp_y2);
  load.view(134); //Some moss on the walls
  random(0,148, temp_x);
  random(0,148, temp_y);
  universe = 134;
  temp_x2 = 0;
  temp_y2 = 4;
  add.to.pic.v(universe, temp_x2, temp_x2, temp_x, temp_y, temp_y2, temp_y2);
  load.view(134); //Some moss on the walls
  random(0,148, temp_x);
  random(0,148, temp_y);
  universe = 134;
  temp_x2 = 0;
  temp_y2 = 4;
  add.to.pic.v(universe, temp_x2, temp_x2, temp_x, temp_y, temp_y2, temp_y2);
  load.view(134); //Some moss on the walls
  random(0,148, temp_x);
  random(0,148, temp_y);
  universe = 134;
  temp_x2 = 0;
  temp_y2 = 4;
  add.to.pic.v(universe, temp_x2, temp_x2, temp_x, temp_y, temp_y2, temp_y2);
  load.view(134); //Some moss on the walls
  random(0,148, temp_x);
  random(0,148, temp_y);
  universe = 134;
  temp_x2 = 0;
  temp_y2 = 4;
  add.to.pic.v(universe, temp_x2, temp_x2, temp_x, temp_y, temp_y2, temp_y2);




  discard.view(134);

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

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

if (said("look")) {
  print("You are outside the castle.  The walls rise up into the clouds above.");
}

if (said("look","wall")) {
    print("Only in the Dream World could walls be built this stout and tall.");
    }

if (said("climb","wall")) {
    print("Even if you could fit your chubby, little fingers into those narrow joints, the wall stretches beyond the clouds.  No chance!");
    }

if ((said("look","ground") ||
     said("look","grass"))) {
         print("The grass is waving as if there is a breeze, but you feel none.");
         }

if (said("look","sky")) {
         print("Far above, you see iridescent clouds swirling around the castle walls, as if the castle was some kind of nexus.");
         }

if ((said("look","moss") ||
     said("look","plant"))) {
         print("It seems like a bit of creeper is attached to the castle.  It appears to be slowly crawling across the surface of the wall!");
         }

if ((said("get","moss") ||
     said("get","plant"))) {
         print("No, when you pull on the creeper a bit, it gives out a little whimper as if in pain.");
         }

if (ego_edge_code == right_edge) {    // ego touching right edge of screen
  if (index==4) {
      new.room(105);
      }
  else {
      index++;
      new.room(103);
      }
}

if (ego_edge_code == left_edge) {     // ego touching left edge of screen
    if (index == 0) {
        new.room(44);
        }
    else {
        index--;
        new.room(103);
        }
}

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

return();