
#include "defines.txt"

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

  position(ego,95,112);
  draw(ego);

  show.pic();

  v255=3;

  if(obj.in.room("Kitchen knife",v255)) {
  animate.obj(o1);
  load.view(2);
  set.view(o1,2);
  set.loop(o1,1);
  set.cel(o1,0);
  position(o1,72,86);
  set.priority(o1,4);
  ignore.objs(o1);
  stop.cycling(o1);
  draw(o1);
  }

  if(obj.in.room("Salt",v255)) {
  animate.obj(o2);
  load.view(2);
  set.view(o2,2);
  set.loop(o2,2);
  set.cel(o2,0);
  position(o2,53,103);
  set.priority(o2,4);
  ignore.objs(o2);
  stop.cycling(o2);
  draw(o2);
  }

  animate.obj(o4);
  load.view(3);
  set.view(o4,3);
  set.loop(o4,0);
  if(isset(f18)) {
  set.cel(o4,2);
  }
  else {
  set.cel(o4,0);
  }
  position(o4,52,104);
  set.priority(o4,4);
  ignore.objs(o4);
  stop.cycling(o4);
  draw(o4);

}

if (said("look")) {
  print("This is the poky kitchen of the house. It doesn't actually lead straight on from the living room, but you pass through the hall so often you hardly noticed it. There's a fridge, some cabinets, and a sink. A door leads back out.");
}

if (said("look","door")) {
  print("It's on the right so you can't see it, but nevertheless it is there. And it's closed.");
}

if ((said("open","door") ||
     said("enter","door"))) {
   new.room(2);
}

if (isset(f3)) {
  new.room(2);
}

if (said("look","sink")) {
  print("There's a very nasty film of grime going round it.");
}

if (said("turn","sink")) {
  print("Let's not waste time and water.");
}

if (said("look","fridge")) {
  print("Who knows what gastronomic disasters await within?");
}

if (said("look","knife")) {
  v255=3;
  if(obj.in.room("Kitchen knife",v255)) {
   print("It's your average kitchen knife with a long blade.");
  }
  else {
   reset(input_parsed);
  }
}

if (said("get","knife")) {
  v255=3;
  if(obj.in.room("Kitchen knife",v255)) {
   if(posn(ego,69,104,77,109)) {
       erase(o1);
       print("You jam the knife into your jacket pocket and almost lose a nipple.");
       get("Kitchen knife");
      }
    else {
    print("Come a little closer!");
   }
  }
  else {
   reset(input_parsed);
  }
}

if (said("open","fridge")) {
  print("Nah. You distinctly heard the yoghurt evolving opposable thumbs last night.");
}

if (said("look","cabinets")) {
  if(isset(f18)) {
     v255=3;
     if(obj.in.room("Salt",v255)) {
     print("The left-hand cabinet seems to contain a bag of salt.");
     }
     else {
      print("The left-hand cabinet is empty.");
     }
   }
  else {
   print("Whaddya know, cabinets in a kitchen. Who'd've thought?");
  }
}

if (said("look","salt")) {
   v255=3;
 if(obj.in.room("Salt",v255)) {
   if(isset(f18)) {
     print("It's a white paper bag stuffed with table salt.");
    }
   else {
     print("Salt? What salt? I don't see any salt.");
   }
  }
  else {
  reset(input_parsed);
 }
}   

if (said("get","salt")) {
   v255=3;
 if(obj.in.room("Salt",v255)) {
   if(isset(f18)) {
     erase(o2);
     get("Salt");
     print("You gather the bag of salt and pocket it.");
    }
   else {
     print("Salt? What salt? I don't see any salt.");
   }
  }
  else {
  reset(input_parsed);
 }
}   

if (said("open","cabinets")) {
  if(posn(ego,49,103,62,109)) {
     if(!isset(f18)) {
        set(f18);
        end.of.loop(o4,f255);
      }
      else {
       reset(f18);
       reverse.loop(o4,f255);
      }
     }
    else {
      print("You're only keen on opening the one on the left. Get closer.");
    }
}

return();
