
#include "defines.txt"

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

  show.pic();

  program.control();
  prevent.input();

  reset(f27);
  reset(f43);
  reset(f44);
  reset(f45);
  reset(f46);
  reset(f47);
  reset(f60);
  reset(f61);
  reset(f62);
  reset(f63);
  reset(f64);


  v42 = 0;

  animate.obj(o2);
  load.view(8);
  set.view(o2,8);
  set.loop(o2,1);
  set.cel(o2,0);
  v255=2;
  cycle.time(o2,v255);
  position(o2,71,100);
  set.priority(o2,4);
  draw(o2);

  end.of.loop(o2,f26);
}

v27--;
v28--;
v29--;

if(isset(f26)) {
  reset(f26);
  v27=12;
}

if(v27==1) {
  set.loop(o2,2);
  end.of.loop(o2,f27);
  v28=20;
}  

if(isset(f27)) {
  reset(f27);
  position(ego,71,100);
  erase(o2);
  load.view(0);
  set.view(ego,0);
  draw(ego);
}

if(v28==1) {
  print("Ah, the joys of interdimensional travel. Never knowing where you're going to land flat on your face next.");
  print("You should have been transported back across the bridge left by your last portal to your secret cave ... how the hell did you get here?");
  print("Elandra did tell you to take the rotation of the earth into account, but you didn't listen, did you? No, you know best, you always know best. You twit.");
  print("Oh well. Your notes should contain details on a spell to get you home.");
  accept.input();
  player.control();
}  

if (said("look")) {
  print("You are on a tiny little island in the middle of the sea, covered in sand. In a dramatic break with tradition there isn't even a solitary palm tree.");
}

if (said("look","sand")) {
  print("It's very yellow and sandy, but feels quite hard underfoot.");
}

if (said("look","ship")) {
  if(isset(f46)) {
    print("It looks like a small steamer heading east. Too far away to see you.");
  }
  else {
    print("I see no ships!");
  }
}

if (said("look","water")) {
  print("It stretches on for miles in all directions.");
  v255 = 20;
  if (obj.in.room("Dead fish",v255)) {
     print("The water is very clear, though. You can see a little fish flipping around in the shallows.");
  }
}

if (said("look","fish")) {
  v255=20;
  if(obj.in.room("Dead fish",v255)) {
     if(isset(f29)) {
        print("It's dead. Happy now?");
     }
     else {
     print("It's a little blue fish swimming around in the shallow waters around the island.");
     }
  }
  else {
  reset(input_parsed);
  }
}

if ((said("viogra","fish") ||
     said("cast","viogra","fish"))) {
  v255=20;
  if(obj.in.room("Dead fish",v255)) {
     if(!isset(f29)) {
        animate.obj(o1);
        load.view(24);
        set.view(o1,24);
        set.loop(o1,0);
        set.cel(o1,0);
        v255=3;
        cycle.time(o1,v255);
        position(o1,71,136);
        draw(o1);
        print("The fish closes its own gills and floats up to the surface, dead. You bully.");
        set(f29);
     }
     else {
       print("The poor fella's dead. Leave him alone.");
     }
  }
  else {
  print("There's no need for that.");
  }
}

if (said("move","sand")) {
  if(!isset(f45)) {
  print("You sweep away some of the sand from the centre of the island, revealing a patch of rock.");
   animate.obj(o4);
   load.view(23);
   set.view(o4,23);
   set.loop(o4,0);
   set.cel(o4,0);
   position(o4,61,118);
   ignore.objs(o4);
   stop.cycling(o4);
   set.priority(o4,4);
   draw(o4);
   set(f45);  
 }
 else {
 print("No need for that now.");
 }
}

if ((said("draw","circle") ||
     said("draw","magic","circle") ||
     said("draw","circle","circle") ||
     said("draw","magic","circle","circle") ||
     said("draw","circle","crayon") ||
     said("draw","magic","circle","crayon") ||
     said("draw","magic","circle","circle","crayon"))) {
 if(!isset(f45)) {
   print("Oh sure. Yellow crayon on yellow sand.");
  }
  else {
  move.obj(ego,62,95,1,f44);
  }
}

if(isset(f44)) {
  reset(f44);
  if(!isset(f60)) {
     set.loop(o4,1);
     print("You sketch out the standard magic pentagram in the rock.");
     set(f60);
   }
   else {
     print("You have a feeling you shouldn't have done that.");
     set(f30);
   }
}

if ((said("drop","fish") ||
     said("put","fish","circle") ||
     said("put","fish","circle","circle"))) {
 if(!isset(f60)) {
   print("Where would you put it?");
  }
 else {
 if((has("Dead fish") || has("Bloody fish"))) {
  move.obj(ego,62,95,1,f43);
  }
 else {
  print("You don't have that.");
 }
 }
}

if(isset(f43)) {
     reset(f43);
  if(!isset(f61)) {
     v29=150;
     start.cycling(o4);
     set(f61);
     print("You lay the poor dead thing in the circle. It is immediately absorbed by the magic.");
     if(has("Bloody fish")) {
       drop("Bloody fish");
       set(f63);
     }
     if(has("Dead fish")) {
       drop("Dead fish");
     }
   }
   else {
     print("You have a feeling you shouldn't have done that.");
     set(f30);
   }
}  

if (said("point","ship")) {
   if(isset(f61)) {
      if(isset(f46)) {
          print("You point at the ship, feeling foolish.");
          set(f62);
      }
      else {
      print("I see no ships!");
      }
      }
    else {
     print("Why?");
    }
}

if (said("get","fish")) {
  move.obj(ego,71,127,1,f28);
}

if (isset(f28)) {
  reset(f28);
  v255=20;
  if(obj.in.room("Dead fish",v255)) {
     if(isset(f29)) {
       set(f50);
       erase(o1);
       print("You take the fish with you. Perhaps you have a promising career in fishmongery ahead of you.");
       get("Dead fish");
     }
     else {
     print("You try to grab the fish, but it slips out of your grasp easily.");
     }
  }
  else {
      print("No more fish here. Does that really surprise you?");
      }
}

if (said("look","book")) {
 if(!isset(f60)) {
  print("Ah, here's a good simple spell you could do: \"TRANSPORTATION BY EXCHANGE OF VELOCITY.\"");
  print("\"Step one - draw a standard pentagram on a stone floor.\"");
 }
 if(!isset(f61)) {
  print("\"Step two - place a sacrifice in the pentagram so that its blood seeps into it.\"");
 }
 if(!isset(f62)) {
  print("\"Step three - point at what you want to exchange velocities with.\"");
 }
  print("\"Step four - step into the circle.\"");
}

if(v29==1) {
   animate.obj(o3);
   load.view(26);
   set.view(o3,26);
   set.loop(o3,0);
   set.cel(o3,0);
   position(o3,0,55);
   stop.cycling(o3);
   draw(o3);
   set(f46);

   move.obj(o3,152,55,1,f47);
}  

if(isset(f47)) {
   reset(f46);
   erase(o3);
}

if(posn(ego,62,100,73,115)) {
  if(isset(f60)) {
   reset(f60);
   set(f30);
  }
}

if(isset(f30)) {
  reset(f30);
  print("Boy, this could've been a very stupid thing to do.");
  stop.motion(ego);
  erase(ego);
  animate.obj(o5);
  load.view(25);
  set.view(o5,25);
  set.loop(o5,0);
  set.cel(o5,0);
  position(o5,62,95);
  set.priority(o5,4);
  draw(o5);
  end.of.loop(o5,f31);
}

if(isset(f31)) {
  reset(f31);
  v42 = 50;
}

v42--;

if(v42==1) {

  if((isset(f62)) && (isset(f63))) {
    new.room(22);
   }
else {
new.room(21);
}
}

return();
