var doormes = 0;
var room1Cam = 0;
var startGame = 0;
var thisRoom = 0;

sub outwarehouse () {
        setSceneDimensions (5129, 640);
	addOverlay ('outwarehouse/opening-scene.tga', 0, 0);
        room1Cam = 400;
        thisRoom = 1;
        aimCamera (400, CENTRE);
        pause (50);
        playSound ('accident.mp3');
        while (room1Cam < 1236) {
             aimCamera (room1Cam, CENTRE);
             room1Cam += 35;
             pause (1);
        }
        pause (10);
        while (room1Cam < 2111) {
             aimCamera (room1Cam, CENTRE);
             room1Cam += 35;
             pause (1);
        }
        pause (10);
        while (room1Cam < 2948) {
             aimCamera (room1Cam, CENTRE);
             room1Cam += 35;
             pause (1);
        }
        pause (10);
        while (room1Cam < 3817) {
             aimCamera (room1Cam, CENTRE);
             room1Cam += 35;
             pause (1);
        }
        pause (10);
        while (room1Cam < 5045) {
             aimCamera (room1Cam, CENTRE);
             room1Cam += 35;
             pause (1);
        }
        pause (10);
        addScreenRegion (samScene1, 4660, 524, 4699, 560, 4683, 542, NORTH);
        addScreenRegion (maxScene1, 4707, 518, 4741, 530, 4724, 524, NORTH);
        pause (14);
        Say (samScene1, "It was a good thing that precariously placed ramp was there.");
        Say (maxScene1, "Yeah, nice landing Sam!");
        Say (samScene1, "Thanks.");
        Say (maxScene1, "I give it an 8.");
        pause (20);
        Say (maxScene1, "Gee, Sam, it's starting to get dark and we're still stranded here on this ridiculously avant garde balcony.");
        Say (samScene1, "Don't worry, Max.");
        Say (samScene1, "The authorities should be here soon to rescue us from this unfortunate automobile-related predicament.");
        blankScreen ();
        removeAllScreenRegions ();

        setSceneDimensions (800, 600);
        aimCamera (0, 0);
        pause (20);

	addOverlay ('outwarehouse/room.tga', 0, 0);
	setFloor ('outwarehouse/room.flo');
	setScale (-200, 1400);
	setZBuffer ('outwarehouse/room.zbu');

	addScreenRegion (pidgeons, 462, 84, 511, 113, 510, 236, NORTH);
	addScreenRegion (bigsign, 181, 27, 441, 195, 550, 237, WEST);
        addScreenRegion (ernies, 23, 366, 167, 503, 455, 484, WEST);
        addScreenRegion (waredoor, 531, 160, 535, 233, 550, 237, WEST);
        addScreenRegion (warewindow, 488, 153, 516, 224, 550, 237, WEST);

        addCharacter (desotoCrash, 548, 220, costume (anim ('iface/act1-1.duc', 33), NULL, NULL));
	addCharacter (sam, 571, 239, makeEgoAnim ());
        addCharacter (max, 502, 246, makeMaxAnim ());
        turnCharacter (max, EAST);
        setCharacterDrawMode (sam, DARK2);
        setCharacterDrawMode (max, DARK2);
        setCharacterDrawMode (desotoCrash, DARK2);
        setCharacterExtra (desotoCrash, FIXEDSIZE);

        loopSound ('outwarehouse/music.mp3');
        thisRoom = 0;

        addCharacter (_12hours, 0, 0, costume (anim ('iface/act1-1.duc', 36), NULL, NULL));
        setCharacterExtra (_12hours, FIXEDSIZE);
        pause (20);
        removeCharacter (_12hours);

        Say (sam, "Well, we've been sitting here for twelve hours and backup still hasn't arrived to help us out.");
        Say (max, "Backup?  Who called for backup?");
        Say (sam, "I thought you did, Max.");
        Say (sam, "What were you doing with the radio?"); 
        Say (max, "If I told you now, you'd probably scream till you died.");
        Say (sam, "Ah. Well, I'm sure your somewhat half-baked feline brain can devise a way to get us out of this mess.");
        Say (max, "I love it when you talk dirty like that, Sam.");
        Say (sam, "My pleasure.");
	addCharacter (inventoryIcon, 20, 575, anim ('iface/mouse.duc', 5));
	setCharacterExtra (inventoryIcon, ICON);
        startGame = 1;
        setCharacterWalkSpeed (max, 10);
}

objectType pidgeons ("pidgeon") {
	event lookAt {
		Say (sam, "It's a pidgeon.")
	}
        event talkTo {
                Say (sam, "Hello, you dispicable rat with wings.");
                playSound ('outwarehouse/pidgeon.wav');
        }
        event pickUp {
                Say (sam, "No!  Max tried to eat one of these the last time I took custody of one.");
        }
        event invmax {
                Say (max, "I can't reach their plump little bodies.");
                Say (sam, "I'm sure the pidgeons would thank you if they could.");
        }
        event verbRename {
                rename (pickUp, "Grab ");
        }
}

var lookAtBigSign = 0;

objectType bigsign ("the big sign") {
	event lookAt {
           if (lookAtBigSign == 0) {
		Say (sam, "'The Old Warehouse.'");
                Say (max, "Look at that cute ducky!  Don't you just want to throttle him?");
                lookAtBigSign = 1;
           }
           else {
                Say (sam, "'The Old Warehouse.'");
           }
	}
}

var lookAtErnies = 0;

objectType ernies ("Ernie's") {
	event lookAt {
           if (lookAtErnies == 0) {
		Say (sam, "It's Ernie's butcher shop.");
                Say (max, "Ooo!  Can we go there and feast upon the carcasses of lifeforms below us in the foodchain?");
                Say (sam, "Maybe after you've had your medication for today, Max.");
                lookAtErnies = 1;
           }
           else {
                Say (sam, "It's Ernie's butcher shop.");
           }
	}
}

objectType waredoor ("door") {
       event lookAt {
          if (doormes == 0) {
               Say (sam, "It's a door, and it's our only way off this fire escape!");
               Say (max, "Other than jumping off and splattering our limbs in all directions.");
               Say (sam, "Quiet Max!  Kids may be playing this game!");
               Say (max, "You wish.");
               doormes = 1;
         }
         else {
              Say (sam, "It's either some other-worldly being trying to resemble a door, or it's a door.");
         }
}
       event use {
               turnCharacter (sam, NORTH);
               pause (30);
               turnCharacter (sam, SOUTH);
               Say (sam, "It's locked.");
               Say (sam, "If I was inside, I could unlock it...");
               Say (sam, "...but if I was inside, I wouldn't need to unlock it!");
	       Say (max, "No wonder these adventure games take so long.");

}
        event verbRename {
                rename (use, "Open ");
        }
}

objectType warewindow ("window") {
       event lookAt {
               Say (sam, "It's a highly suspect window.");
       }
       event use {
               Say (sam, "I can't do that!");
               Say (sam, "I'd need a brick or something in similar lack of usefulness.");
               Say (sam, "Max fits that description, but he's still recovering from last time...");
       }
       event wt {
               addCharacter (brokewindow, 505, 192, costume (anim ('iface/act1-1.duc', 35), NULL, NULL));
               setCharacterExtra (brokewindow, FIXEDSIZE);
               playSound ('outwarehouse/glass.wav');
               pause (5);
               Say (sam, "Blasted police regimen...I never used the thing anyway...");
               Say (sam, "C'mon Max, let's get inside this place and see what kind of macabre adventures we may find within.");
               deleteFromStack (inventory, wt);
               gotoRoom (inwarehouse);
}
        event invmax { 
               Say (sam, "I COULD toss Max through, but he's still recovering from last time.");
               Say (sam, "Aren't you, little buddy?");
               Say (max, "I'm still picking glass out of my scalp, Sam.");
        }
        event verbRename {
                rename (use, "Break ");
        }
}

var lookAtDesotoCrash = 0;

objectType desotoCrash ("DeSoto") {
     event lookAt {
        if (lookAtDesotoCrash == 0) {
         Say (sam, "I love this car.");
         Say (max, "Sam, you are truly sick.");
        }
        else {
         Say (sam, "It's my car.");
        }
     }
     event use { #USE becomes DRIVE
         Say (sam, "I don't want to move it until we've got what we came for.");
     }
        event verbRename {
                rename (use, "Drive ");
        }
}

objectType crash ("") {}
objectType _12hours ("") {}
objectType brokewindow ("") {}

objectType samScene1 ("") {speechColour 163, 115, 7;}
objectType maxScene1 ("") {speechColour 255, 255, 255;}