unit Globals;

interface
	uses
		Palettes;

	const
		dlgTop = 50;
		dlgLeft = 85;

		kDeleteKey = $08;
		kTabKey = $09;
		kLeftArrow = $1C;
		kRightArrow = $1D;

		kTabKeyMap = $30;
		kCommandKeyMap = $37;

		mApple = 128;	{Menu resource ID}
		iNothing = 0;
		iAboutEdit = 1;
		mFile = 129;	{Menu resource ID}
		iNew = 1;
		iOpen = 2;
		iClose = 4;
		iSave = 5;
		iSaveAs = 6;
		iQuit = 8;
		mEdit = 130;	{Menu resource ID}
		iCut = 1;
		iCopy = 2;
		iPaste = 3;
		iClear = 4;
		mSpecial = 131;	{Menu resource ID}
		iTryGlider = 1;
		iControls = 2;
		iRestoreDeep = 3;
		iGoToRoom = 5;
		iPrevRoom = 6;
		iNextRoom = 7;
		iNewRoom = 9;
		mWindows = 132;	{Menu resource ID}
		iTools = 1;
		iAutoHideTools = 2;
		iHouse = 4;
		iRoomBack = 5;
		iRoomCond = 6;
		iObject = 7;
		iHelp = 9;
		mControls = 133;{Menu resource ID}
		iHoldKey = 1;
		iDropKey = 2;
		iAbsMouse = 3;
		iRelMouse = 4;
		iConfigure = 6;

		editToObject = 1;
		editToRoom = 2;
		fileExists = 3;
		fileIsNew = 4;
		noFileOpen = 5;

		alertStrIDs = 128;
		fileStrIDs = 129;

		mainWndoID = 129;
		fileAlertID = 129;
		alertID = 128;
		saveNoQuitID = 132;
		saveNoCloseID = 133;
		houseInfoID = 134;
		depthAlertID = 136;
		rCustomKeysID = 137;
		lockAlertID = 138;
		custGetID = 256;
		objectPictID = 128;
		maskPictID = 129;

		sleep = 4;
		ceilingVert = 24;
		stairVert = 54;
		floorVert = 325;
		stackSize = 40960;
		floorLimit = floorVert + 5;
		maxThrust = 5;

		holdKey = 1;
		dropKey = 2;
		absMouse = 3;
		relMouse = 4;
		mouseSlop = 10;

		defaultLeftKey = $2B;
		defaultRightKey = $2F;
		defaultEnergyKey = $24;
		defaultBandKey = $31;

		defaultLeftName = ', key';
		defaultRightName = '. key';
		defaultEnergyName = 'return';
		defaultBandName = 'space';

		kErrUnaccounted = 1;				{error codes}
		kErrMacPlusNeeded = 2;			{these correspond with STR#}
		kErr2Or16Colors = 4;				{resources for the TEXT part}
		kErrNotEnoughMem = 5;			{of the message}
		kErrUnknownAtInit = 6;
		kErrMemLow = 7;				{unused}
		kErrGraphicsNotFound = 8;
		kErrGraphicLoad = 9;
		kErrTooManyRooms = 10;
		kErrTooManyObjects = 11;
		kErrLoadingRes = 12;
		kErrFileExists = 13;
		kErrNothingToPrint = 14;
{15 unused}
		kErrWrongHouseVers = 17;

		kErrExitSansGraphics = 20;
		kErrSavingPrefs = 25;

{furniture}
		nulObj = 0;
		table = 1;
		shelf = 2;
		books = 3;
		cabnet = 4;
		extRct = 5;
		obsRct = 6;
{blowers}
		flrVnt = 8;
		celVnt = 9;
		celDct = 10;
		candle = 11;
		lftFan = 12;
		ritFan = 13;
{table objects}
		clock = 16;
		paper = 17;
		grease = 18;
		bnsRct = 19;
		battry = 20;
		rbrBnd = 21;
{wall objects}
		litSwt = 24;
		outlet = 25;
		thermo = 26;
		shredr = 27;
		pwrSwt = 28;
		guitar = 29;
{animate objects}
		drip = 32;
		toastr = 33;
		ball = 34;
		fshBwl = 35;
		teaKtl = 36;
		window = 37;
{jewelry}
		paintg = 40;
		mirror = 41;
		basket = 42;
		macTsh = 43;
		upStar = 44;
		dnStar = 45;
{------------------------------------}
		normal = 0;	{mode}
		fadingIn = 1;
		fadingOut = 2;
		turnRt2Lf = 3;
		turnLf2Rt = 4;
		burning = 5;
		ascending = 6;
		descending = 7;
		shredding = 8;

		ignoreIt = 0;		{null or unknown objects}
		crashIt = 1;		{tables, shelves, cabinets, etc...}
		liftIt = 2;		{floor vents}
		dropIt = 3;		{ceiling blower, some ducts}
		moveIt = 4;		{exit rects/suction ceiling ducts}
		burnIt = 5;		{candle if too close}
		turnItLeft = 6;		{left fan}
		turnItRight = 7;	{right fan}
		awardIt = 8;		{clocks}
		extraIt = 9;		{folded pieces of paper}
		slideIt = 10;		{grease fallen}
		trickIt = 11;		{bonus rect}
		energizeIt = 12;	{battery}
		bandIt = 13;		{rubber bands}
		playIt = 14;		{guitar}
		lightIt = 15;		{light switch}
		zapIt = 16;		{wall outlet}
		airOnIt = 17;		{thermostats}
		shredIt = 18;		{shredder}
		toggleIt = 19;		{power switch}
		weightIt = 20;
		spillIt = 21;		{grease standing up}
		ascendIt = 22;		{up stair case}
		descendIt = 23;		{down stair case}
		steamIt = 24;

		acurID = 128;
		kCursCount = 12;

	type
		SICN = array[0..15] of Integer;
		SICNPtr = ^SICN;
		SICNHand = ^SICNPtr;

		objectData = record
				objectIs: Integer;
				boundRect: Rect;
				amount: Integer;
				extra: Integer;
				isOn: Boolean;
			end;

		roomData = record
				roomName: string[24];
				numberOObjects: Integer;
				backPictID: Integer;
				tileOrder: array[0..7] of Integer;
				leftOpen, rightOpen: Boolean;
				animateKind: Integer;
				animateNumber: Integer;
				animateDelay: LongInt;
				conditionCode: Integer;
				theObjects: array[1..16] of objectData;
			end;

		houseRec = record
				version: Integer;
				numberORooms: Integer;
				timeStamp: LongInt;
				hiScores: array[0..19] of LongInt;
				hiLevel: array[0..19] of Integer;
				hiName: array[0..19] of string[24];
				hiRoom: array[0..19] of string[24];
				pictFile: string[32];
				nextFile: string[32];
				firstFile: string[32];
				theRooms: array[1..40] of roomData;
			end;

		gliderRec = record
				destRect, oldRect, wholeRect: Rect;
				shadoDest, oldShado, wholeShado: Rect;
				touchRect: Rect;
				mode, phase: Integer;
				isRight, isForward: Boolean;
				srcNum: Integer;
				forVel: Integer;
				mass: Integer;
				bands, energy: Integer;
			end;

		cycleRec = record
				holdRect, wholeRect, oldRect: Rect;
				tiedTo, kindIs, phase: Integer;
				reset, position: LongInt;
				accel, velocity: Integer;
			end;

		acur = record
				whichBall: LongInt;
				ball: array[1..kCursCount] of CursHandle;
			end;
		acurPtr = ^acur;
		acurHand = ^acurPtr;

		BitMapPtr = ^BitMap;

	var
		theEvent: EventRecord;
		mainWndo, toolWndo: WindowPtr;
		mainPalette: PaletteHandle;
		screenArea, wholeArea, fullArea, nullRect: Rect;
		wholeRgn: RgnHandle;
{---b&w---}
		offMaskMap, offVirginMap, offLoadMap, offPlayerMap: BitMap;
		offMaskPort, offVirginPort, offLoadPort, offPlayerPort: GrafPtr;
		offMaskBits, offVirginBits, offLoadBits, offPlayerBits: Ptr;
{---color---}
		virginCPort, loadCPort, objectCPort: CGrafPort;
		virginCPtr, loadCPtr, objectCPtr: CGrafPtr;
		virginCBits, loadCBits, objectCBits: Ptr;
		rgbBlack, rgbWhite, rgbLtBlue, rgbRed, rgbDkGray: RGBColor;
		rgbYellow, rgbViolet, rgbBrown, rgbLtBrown: RGBColor;

		holdCorner: Point;
		marqueePat: array[0..4] of Pattern;
		theKeys: KeyMap;
		ballC: array[1..kCursCount] of CCrsrHandle;

		marqueeIndex, roomAt, setOTools, oneActive: Integer;
		rightOffset, downOffset, wasDepth, herKeyboard: Integer;
		fileNumber, volumeNumber, editorResNum: Integer;
		leftArrow, rightArrow, deleteKey, controlMethod: Integer;
		leftKey, rightKey, energyKey, bandKey, iGlidersHelp: Integer;
		leftName, rightName, energyName, bandName: string[12];
		housesName, resourceName: string[32];
		startPt, endPt: Point;
		handleRect: Rect;
		thisHouse: houseRec;
		thisRoom, scrapRoom: roomData;
		scrapObject, selectObject: objectData;

		currentBall: Integer;
		ballList: acurHand;

{flying the glider}

		nCycleObs: Integer;
		cycleObjects: array[1..16] of cycleRec;

		theGlider: GliderRec;
		lifeNormal: Boolean;
		currMass, liftAmount, nMortals, shiftAmount: Integer;
		glideRct: array[0..27] of Rect;
		shadoRct: array[0..1] of Rect;
		nextPhase: array[1..4, 0..16] of Integer;

		binaryFlip: Integer;
		toastRgn: RgnHandle;
		eventRect: array[0..16] of Rect;
		eventKind: array[0..16, 0..2] of LongInt;
{end}

		tileRects: array[0..7] of Rect;
		iconRect: array[0..5] of Rect;
		selectRect: array[0..5] of Rect;
		srcRect: array[0..69] of Rect;
		toolIcnID: array[0..47] of Integer;

		lightsOut, airOut, leftIsOpen, rightIsOpen: Boolean;
		hasToast, windowOpen: Boolean;

		editRoom, marqueeTime, soundPlaying, fileIsOpen, cantColor, sliding: Boolean;
		soundOn, playing, pausing, inhibitSound, doneFlag, restoreColor: Boolean;
		roomScrapDirty, objectScrapDirty, changed, inColor, cantSwitch: Boolean;
		autoHide, inBackground, hasWNE, buttonFires, bandBorne, hasSys7: Boolean;
		useColorCursor, lockIt: Boolean;

implementation

end.