// ****************************************************************************
//
// Logic 22: The Crossroads
//
// ****************************************************************************

#include "defines.txt"

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


// Check what room the player came from and position them on the
// screen accordingly here, e.g:
 if (prev_room_no == 21) {
   position(ego,72,53);
 }
 if (prev_room_no == 29) {
   position(ego,142,86);
   }
 if (prev_room_no == 23) {
   position(ego,72,159);
   }

  animate.obj(o1);
  load.view(8);
  set.view(o1,8);
  position(o1,14,79);
  draw(o1);

  draw(ego);
  show.pic();

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

if (said("look")) {
  print("You are at the crossroads, where Loa Legba lives.");
  print("He's the guy on the left.");
}

if (said("look","man")) {
    print("That's Loa Legba.  He's not a MAN.  He's a LOA.");
    }

if (said("look","guitar")) {
    print("It looks a little beat up, but it's still basically in tune.");
    }

if (said("look","cigarette")) {
    print("That's actually a matchstick.");
    }

if (said("look","matchstick")) {
    print("It's a soggy, wet matchstick.");
    }

if ((said("look","Loa Legba") ||
     said("look","Loa"))) {
   print("A bit of Voodoo esoterica:");
   print("Loa Legba is always the first loa (or Voodoo demi-god) to be summoned in a ritual.");
   print("In the Voodoo mythos, Legba is the master of the crossroads.");
   print("So basically, he controls the traffic between Earth and Heaven, the Serpent and the Rainbow, respectively.");
   }

if (said("look","signs")) {
   print("They're like signs in the mall:  No real content, but all urging you on, nonetheless.");
   }

if (said("look","skull")) {
   print("Oh, that's Norman Finkelstein, your last boyfriend.");
   print("He was a lousy dancer and a sloppy kisser.");
   }

if (said("look","rock")) {
   print("Yes... a rock.");
   }

if ((said("talk","loa legba") ||
     said("talk","loa")  ||
     said("talk","man"))) {
    if (legba_chat==0) {
        if ((has("blowfish venom") ||
             has("blowfish"))) {
             legba_chat=1;
             }
        else {
            print("Legba: \"You know, I was fishing the other day.  I found a great, little spot to the west of here, near the graveyard.\"");
            legba_chat=1;
            return();
            }
        }
    if (legba_chat==1) {
        if (has("yellow grave mold")) {
            legba_chat=2;
            }
        else {
            print("Legba: \"That graveyard is out west of here.  Go south to the ferry and cross the river.  You'll find it.\"");
            legba_chat=2;
            return();
            }
        }
    if (legba_chat==2) {
        if (has("dream brew")) {
           legba_chat=3;
           }
        else {
           print("Legba: \"Hmm...  you need a dream brew, huh?  I can't help you.  Maybe Baron Samedi can.  He has the yellow mold you'll need.\"");
           legba_chat=3;
           return();
           }
        }
    if (legba_chat==3) {
           print("Legba: \"The villagers in town will trade with you for different potions.  The village is just east of here.\"");
           legba_chat = 4;
           return();
           }
    if (legba_chat == 4) {
           print("Legba: \"Boy, it's a good thing you're talking to me and not my brother, Kalfu.\"");
           print("VG: \"Why?\"");
           print("Legba: \"Well, Kalfu does his job, a job just like mine, but he's one of those Petro loa, which means he's awfully mean.\"");
           print("VG: \"You don't say!\"");
           print("Legba: \"Heh, I do!\"");
           legba_chat = 0;
           }
    }

if (said("listen","music")) {
    print("You can't quite place the tune.  Maybe its a Legba original.");
    }

if (said("sing")) {
    print("Legba appreciates your festivity, but you have more important things to do.");
    }

if (ego_edge_code == horizon_edge) {  // ego touching horizon
  new.room(21);
}

if (ego_edge_code == right_edge) {    // ego touching right edge of screen
  new.room(29);
}

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

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

return();