diff --git a/Glider_405/B&W Art b/Glider_405/B&W Art new file mode 100755 index 0000000..e69de29 diff --git a/Glider_405/Color Art b/Glider_405/Color Art new file mode 100755 index 0000000..e69de29 diff --git a/Glider_405/Glider Version History.txt b/Glider_405/Glider Version History.txt new file mode 100755 index 0000000..98ded9f --- /dev/null +++ b/Glider_405/Glider Version History.txt @@ -0,0 +1 @@ + Glider 4.0 Version History 4.00 Original release. 4.01 In previous version, if you renamed "The House" to something else, you went through a maze of "bitch-at-you-dialogs" - this version corrects that - now it's: bitch-once/save-new-name (in preferences - the prefs are a resource type found in the Glider app). Now the Save command is no longer disabled - if a file-not-found comes up, the Save function passes the buck to the Save As function. Also I think I did a little tweaking on the "Sound" dialog box - the way it functions. 4.02 Previous versions obscured the top 20 pixels of the "Help" screens on a Mac Plus, SE, Classic, and SE 30 - this version hides the menu bar on these machines. Added a typewriter sound when you enter your name for the high scores. 4.03 Added 4 or 2 channel sound option to "Sound" dialog box - 2 channel is twice as loud and quicker as well (best for the 68000 machines) - 2 channel can sound a tad sloppy though when many sounds are firing at once (not too often and it's not too bad sounding anyway) - setting is stored in the preferences resource. Added color menu resources for color Macs. updated Casady & Greene address in About Glider 4.0 dialog box. 4.04 Fixed bug where "Can't find default house." message came up. Bumped 'SIZE' resource up from 880K to 920K to fix an out-of-memory problem. 4.05 Added trademark () symbol to all references to "Glider" (i.e. "Glider "). Renamed graphics files to "Color Art" and "B&W Art" (no longer "Art 16" & "Art 2"). Added a color animated cursor (a gray-shaded spinning beach ball - was only b&w). Now refer to the "!Mission Screen Init" as "MacsBug" (the new name we're using). Word-aligned almost all graphics in the color and b&w art files (this makes the game a tad faster - incidentally, now Glider 4.05 is incompatible with older versions of the graphics files - i.e. "Art 2" and "Art 16" will display improperly). Yanked out code that checked screen depth at the start of every game (this supposedly starts to choke up the System heap). If opening an art file fails (file not found), the default name is automatically selected and checked for. If an art file is opened and found to be the wrong pixel depth, the default art file name is looked for before bugging the user. Now updates screen after Quit/Save First/ Cancel sequence. \ No newline at end of file diff --git a/Glider_405/Glider.project b/Glider_405/Glider.project new file mode 100755 index 0000000..e69de29 diff --git a/Glider_405/Glider.rsrc b/Glider_405/Glider.rsrc new file mode 100755 index 0000000..e69de29 diff --git a/Glider_405/Sources/G-FileInNOut.p b/Glider_405/Sources/G-FileInNOut.p new file mode 100755 index 0000000..7f11a7b --- /dev/null +++ b/Glider_405/Sources/G-FileInNOut.p @@ -0,0 +1 @@ +unit FileInNOut; interface uses Palettes, Globals, GlobalUtils; function ErrorCheckFile: Boolean; function OpenHouse: Boolean; function DoOpen (whichType: Integer): Boolean; procedure DoClose (volNum: Integer); function GetHouse: Boolean; function ReadGame: Boolean; function SaveGameAs: Boolean; function SaveGame: Boolean; function WriteHouse: Boolean; implementation const dlgTop = 50; dlgLeft = 85; var typeIs: Integer; {=================================} function ErrorCheckFile; var nRooms, index: Integer; begin ErrorCheckFile := FALSE; with thisHouse do begin nRooms := numberORooms; if ((nRooms < 1) or (nRooms > 40)) then {check for valid # of rooms} begin Exit(ErrorCheckFile); end; for index := 1 to nRooms do {check PICT ID numbers} begin if (theRooms[index].backPictID < 200) or (theRooms[index].backPictID > 215) then begin Exit(ErrorCheckFile); end; end; end; ErrorCheckFile := TRUE; end; {=================================} function IOCheck (theErr: OSErr): OSErr; var dummyInt: Integer; line1, line2: Str255; alertHandle: AlertTHndl; alertRect: Rect; begin InitCursor; UseResFile(gliderResNum); if (theErr <> NoErr) then begin case theErr of DskFulErr: GetIndString(line1, rFileStrIDs, 1); FNFErr: begin fileWasLost := TRUE; GetIndString(line1, rFileStrIDs, 2); end; WPrErr: GetIndString(line1, rFileStrIDs, 3); FLckdErr: GetIndString(line1, rFileStrIDs, 4); VLckdErr: GetIndString(line1, rFileStrIDs, 5); FBsyErr, OpWrErr: GetIndString(line1, rFileStrIDs, 6); EOFErr: GetIndString(line1, rFileStrIDs, 7); otherwise GetIndString(line1, rFileStrIDs, 10); end; NumToString(theErr, line2); line2 := CONCAT('Error code = ', line2); ParamText(line1, line2, '', ''); alertHandle := AlertTHndl(Get1Resource('ALRT', rFileAlertID)); if (alertHandle <> nil) then begin HNoPurge(Handle(alertHandle)); alertRect := alertHandle^^.boundsRect; OffsetRect(alertRect, -alertRect.left, -alertRect.top); dummyInt := (screenBits.bounds.right - alertRect.right) div 2; OffsetRect(alertRect, dummyInt, 0); dummyInt := (screenBits.bounds.bottom - alertRect.bottom) div 3; OffsetRect(alertRect, 0, dummyInt); alertHandle^^.boundsRect := alertRect; HPurge(Handle(alertHandle)); end; dummyInt := Alert(rFileAlertID, nil); end; IOCheck := theErr; end; {=================================} function OpenHouse; var index: Integer; textLength: LongInt; ignored: Boolean; begin OpenHouse := FALSE; theErr := SetVol(nil, houseVolNum); if (IOCheck(theErr) <> 0) then Exit(OpenHouse); theErr := FSOpen(housesName, houseVolNum, houseNumber); if (IOCheck(theErr) <> 0) then begin if (not DoOpen(kHouseType)) then begin playing := FALSE; theErr := FSClose(houseNumber); Exit(OpenHouse); end; theErr := FSOpen(housesName, houseVolNum, houseNumber); if (IOCheck(theErr) <> 0) then begin playing := FALSE; theErr := FSClose(houseNumber); Exit(OpenHouse); end; end; theErr := SetFPos(houseNumber, FSFromStart, 0); if (IOCheck(theErr) <> 0) then begin playing := FALSE; theErr := FSClose(houseNumber); Exit(OpenHouse); end; textLength := SIZEOF(thisHouse); theErr := FSRead(houseNumber, textLength, @thisHouse); if (IOCheck(theErr) <> 0) then begin playing := FALSE; theErr := FSClose(houseNumber); Exit(OpenHouse); end; OpenHouse := TRUE; end; {=================================} function OpenSFGetHook (theSFitem: integer; theDialog: DialogPtr): integer; const statText = 11; {DITL item number of textAppButton} firstTime = -1; var itemToChange: Handle; {needed for GetDItem and SetCtlValue} itemBox: Rect; {needed for GetDItem} itemType: integer; {needed for GetDItem} statTitle: Str255; {needed for GetIndString} begin OpenSFGetHook := theSFitem; case theSFitem of firstTime: begin GetIndString(statTitle, rMiscStrID, typeIs); if (statTitle <> '') then begin { if we really got the resource} GetDItem(theDialog, statText, itemType, itemToChange, itemBox); SetIText(itemToChange, statTitle); end else GenericAlert(kErrLoadingRes); end; {firstTime} otherwise end; end; {=================================} function SimpleFileFilter (p: ParmBlkPtr): BOOLEAN; const houseType = 1; artType = 2; gameType = 3; begin SimpleFileFilter := TRUE; {Don't show it -- default} with p^.ioFlFndrInfo do case typeIs of houseType: if (fdType = 'GLhs') then SimpleFileFilter := FALSE; {Show it} artType: if (fdType = 'GLbk') then SimpleFileFilter := FALSE; {Show it} gameType: if (fdType = 'GLgm') then SimpleFileFilter := FALSE; {Show it} otherwise ; end; end; {=================================} function DoOpen; var dlgOrigin: Point; theTypeList: SFTypeList; theReply: SFReply; begin UseResFile(gliderResNum); SetPt(dlgOrigin, dlgLeft + rightOffset, dlgTop + downOffset); typeIs := whichType + 1; SFPGetFile(dlgOrigin, '', @SimpleFileFilter, -1, theTypeList, @OpenSFGetHook, theReply, rCustGetID, nil); with theReply do begin if (good) then begin case whichType of kHouseType: begin housesName := fName; houseVolNum := vRefNum; end; kArtType: begin resourceName := fName; resVolNum := vRefNum; end; kGameType: begin gameName := fName; gameVolNum := vRefNum; end; otherwise Exit(DoOpen); end; end; DoOpen := good; end; end; {=================================} procedure DoClose; begin theErr := FSClose(houseNumber); if (theErr <> NoErr) then begin GenericAlert(theErr); Exit(DoClose); end; theErr := FlushVol(nil, volNum); if (theErr <> NoErr) then begin GenericAlert(theErr); Exit(DoClose); end; end; {=================================} function GetHouse; var i: Integer; begin GetHouse := FALSE; if (not OpenHouse) then begin GenericAlert(kErrExitSansHouse); Exit(GetHouse); end; DoClose(houseVolNum); {$IFC DemoVersion} if (thisHouse.timeStamp <> 16) then begin GenericAlert(kErrNotDemoHouse); Exit(GetHouse); end; {$ENDC} if (not ErrorCheckFile) then begin GenericAlert(kErrWrongHouseVers); Exit(GetHouse); end; GetHouse := TRUE; end; {=================================} function ReadGame; type miniObject = record theAmount: Integer; theExtra: Integer; theIsOn: Boolean; end; roomState = record stateCode: Integer; objectStates: array[1..16] of miniObject; end; gameRec = record version: Integer; houseStamp: LongInt; roomIs, roomsHas: Integer; nMortals, nBands, nEnergy: Integer; isRightFace, hasEnteredLeft: Boolean; theRoomScore, theSuppScore: LongInt; workingGameNumberIs: LongInt; whichHouse: string[32]; firstHouse: string[32]; prefs: Integer; {temporary} roomWasFlags: array[1..40] of Boolean; stateOfRooms: array[1..40] of roomState; end; var theGame: gameRec; i, i2: Integer; bytesIn: LongInt; begin ReadGame := FALSE; bytesIn := SIZEOF(gameRec); theErr := SetVol(nil, gameVolNum); if (IOCheck(theErr) <> 0) then Exit(ReadGame); theErr := FSOpen(gameName, gameVolNum, gameNumber); {open the game} if (IOCheck(theErr) <> 0) then begin if ((theErr = FNFErr) and (DoOpen(kGameType))) then begin theErr := FSOpen(gameName, gameVolNum, gameNumber); if (IOCheck(theErr) <> 0) then Exit(ReadGame) end else Exit(ReadGame); end; theErr := SetFPos(gameNumber, FSFromStart, 0); if (IOCheck(theErr) <> 0) then begin playing := FALSE; theErr := FSClose(gameNumber); Exit(ReadGame); end; theErr := FSRead(gameNumber, bytesIn, @theGame); {read in the game} if (IOCheck(theErr) <> 0) then begin playing := FALSE; theErr := FSClose(gameNumber); Exit(ReadGame); end; theErr := FSClose(gameNumber); {close game file} if (IOCheck(theErr) <> 0) then begin playing := FALSE; theErr := FSClose(gameNumber); Exit(ReadGame); end; with theGame do {extract beginning game info} begin if (version >= $0200) then begin GenericAlert(kErrGameOldVers); Exit(ReadGame); end; roomAt := roomIs; roomsPassed := roomsHas; mortals := nMortals; theGlider.bands := nBands; theGlider.energy := nEnergy; theGlider.forVel := 4; theGlider.isRight := isRightFace; enteredLeft := hasEnteredLeft; roomScore := theRoomScore; suppScore := theSuppScore; workingGameNumber := workingGameNumberIs; housesName := whichHouse; firstFileName := firstHouse; end; CalcRoomScore; rollScore := roomScore + suppScore; if (not GetHouse) then {open said house} begin GenericAlert(kErrExitSansHouse); Exit(ReadGame); end; if (theGame.houseStamp <> thisHouse.timeStamp) then GenericAlert(kErrHouseModified); with theGame do {set remaining game info} begin for i := 1 to 40 do begin roomVisits[i] := roomWasFlags[i]; with stateOfRooms[i], thisHouse.theRooms[i] do begin conditionCode := stateCode; for i2 := 1 to 16 do begin theObjects[i2].amount := objectStates[i2].theAmount; theObjects[i2].extra := objectStates[i2].theExtra; theObjects[i2].isOn := objectStates[i2].theIsOn; end; {for i2} end; {with thisHouse} end; {for i} end; {with theGame} ReadGame := TRUE; end; {=================================} function WriteGame (fileNum, volNum: Integer): Boolean; type miniObject = record theAmount: Integer; theExtra: Integer; theIsOn: Boolean; end; roomState = record stateCode: Integer; objectStates: array[1..16] of miniObject; end; gameRec = record version: Integer; houseStamp: LongInt; roomIs, roomsHas: Integer; nMortals, nBands, nEnergy: Integer; isRightFace, hasEnteredLeft: Boolean; theRoomScore, theSuppScore: LongInt; workingGameNumberIs: LongInt; whichHouse: string[32]; firstHouse: string[32]; prefs: Integer; {temporary} roomWasFlags: array[1..40] of Boolean; stateOfRooms: array[1..40] of roomState; end; var theGame: gameRec; i, i2: Integer; bytesOut: LongInt; begin WriteGame := FALSE; for i := 1 to nObjects do {set current conditions of present room} case (eventKind[i, 0]) of awardIt, extraIt, energizeIt, bandIt: begin thisHouse.theRooms[roomAt].theObjects[i].amount := eventKind[i, 1]; end; lightIt, airOnIt: begin if ((not lightsOut) and (not airOut)) then thisHouse.theRooms[roomAt].conditionCode := 0; end; otherwise end; CalcRoomScore; with theGame do begin version := kGlideVersion; houseStamp := thisHouse.timeStamp; roomIs := roomAt; roomsHas := roomsPassed; nMortals := mortals; nBands := theGlider.bands; nEnergy := theGlider.energy; isRightFace := theGlider.isRight; hasEnteredLeft := enteredLeft; theRoomScore := roomScore; theSuppScore := suppScore; workingGameNumberIs := workingGameNumber; whichHouse := housesName; firstHouse := firstFileName; prefs := 0; for i := 1 to 40 do begin roomWasFlags[i] := roomVisits[i]; with stateOfRooms[i], thisHouse.theRooms[i] do begin stateCode := conditionCode; for i2 := 1 to 16 do begin objectStates[i2].theAmount := theObjects[i2].amount; objectStates[i2].theExtra := theObjects[i2].extra; objectStates[i2].theIsOn := theObjects[i2].isOn; end; {for i2} end; {with thisHouse} end; {for i} end; {with theGame} bytesOut := SIZEOF(gameRec); theErr := SetFPos(fileNum, FSFromStart, 0); if (IOCheck(theErr) <> 0) then begin theErr := FSClose(gameNumber); {close game file} Exit(WriteGame); end; theErr := FSWrite(fileNum, bytesOut, @theGame); if (IOCheck(theErr) <> 0) then begin theErr := FSClose(gameNumber); {close game file} Exit(WriteGame); end; theErr := SetEOF(fileNum, bytesOut); if (IOCheck(theErr) <> 0) then begin theErr := FSClose(gameNumber); {close game file} Exit(WriteGame); end; theErr := FSClose(fileNum); {close game file} if (IOCheck(theErr) <> 0) then begin theErr := FSClose(gameNumber); {close game file} Exit(WriteGame); end; theErr := FlushVol(nil, volNum); if (IOCheck(theErr) <> 0) then Exit(WriteGame); WriteGame := TRUE; end; {=================================} function SaveGameAs; var dlgOrigin: Point; theReply: SFReply; theInfo: FInfo; begin SaveGameAs := FALSE; SetPt(dlgOrigin, dlgLeft + rightOffset + 25, dlgTop + downOffset); SFPutFile(dlgOrigin, 'Name for game:', '', nil, theReply); with theReply do begin if (not good) then Exit(SaveGameAs); gameVolNum := vRefNum; theErr := GetFInfo(fName, gameVolNum, theInfo); case theErr of NoErr: begin if (theInfo.fdType <> 'GLgm') then begin GenericAlert(kErrFileExists); Exit(SaveGameAs); end; end; FNFErr: begin theErr := Create(fname, gameVolNum, 'GLID', 'GLgm'); if (IOCheck(theErr) <> 0) then begin Exit(SaveGameAs); end; end; otherwise begin GenericAlert(theErr); Exit(SaveGameAs); end; end; {end - case} {SetCursor- watch} gameName := fName; theErr := FSOpen(fName, gameVolNum, gameNumber); if (IOCheck(theErr) <> 0) then Exit(SaveGameAs); if (not WriteGame(gameNumber, gameVolNum)) then begin theErr := FSClose(gameNumber); {close game file} Exit(SaveGameAs); end; end; {end - with} refuseHigh := TRUE; SaveGameAs := TRUE; end; {end - function} {=================================} function SaveGame; var gameVolName: Str255; begin SaveGame := FALSE; if (gameName = '') then begin if (not SaveGameAs) then Exit(SaveGame) end else begin theErr := FSOpen(gameName, gameVolNum, gameNumber); if (IOCheck(theErr) <> 0) then begin Exit(SaveGame); end; if (not WriteGame(gameNumber, gameVolNum)) then begin Exit(SaveGame); end; end; refuseHigh := TRUE; SaveGame := TRUE; end; {=================================} function WriteHouse; var fileLength: LongInt; begin SpinBall; WriteHouse := FALSE; fileLength := SIZEOF(houseRec); SpinBall; theErr := SetVol(nil, houseVolNum); if (IOCheck(theErr) <> 0) then Exit(WriteHouse); theErr := FSOpen(housesName, houseVolNum, houseNumber); if (IOCheck(theErr) <> 0) then begin if (not DoOpen(kHouseType)) then begin playing := FALSE; theErr := FSClose(houseNumber); Exit(WriteHouse); end; theErr := FSOpen(housesName, houseVolNum, houseNumber); if (IOCheck(theErr) <> 0) then begin playing := FALSE; theErr := FSClose(houseNumber); Exit(WriteHouse); end; end; SpinBall; theErr := SetFPos(houseNumber, FSFromStart, 0); if (IOCheck(theErr) <> 0) then Exit(WriteHouse); SpinBall; theErr := FSWrite(houseNumber, fileLength, @thisHouse); if (IOCheck(theErr) <> 0) then Exit(WriteHouse); SpinBall; theErr := SetEOF(houseNumber, fileLength); if (IOCheck(theErr) <> 0) then Exit(WriteHouse); SpinBall; theErr := FSClose(houseNumber); if (IOCheck(theErr) <> 0) then begin Exit(WriteHouse); end; SpinBall; theErr := FlushVol(nil, houseVolNum); if (IOCheck(theErr) <> 0) then Exit(WriteHouse); SpinBall; WriteHouse := TRUE; end; {=================================} end. \ No newline at end of file diff --git a/Glider_405/Sources/G-GameBody.p b/Glider_405/Sources/G-GameBody.p new file mode 100755 index 0000000..1deaa81 --- /dev/null +++ b/Glider_405/Sources/G-GameBody.p @@ -0,0 +1 @@ + {------------------------------------------------------} { } { G L I D E R } { } { } { Glider 4.05, copyright 1991, Casady & Greene, Inc. } { All code contained herein is by john calhoun } { } { This is version 4.05 compiled with THINK Pascal 3.02 } { } {------------------------------------------------------} program Glider; {$I-} uses SMS, Palettes, Globals, GlobalUtils, IdleUtils, PlayActive, FileInNOut, IdleInput, Initialize; var eventHappened: Boolean; {=================================} procedure SavePrefs; type prefType = record theName: string[24]; houseName: string[32]; resName: string[32]; sndVolume: Integer; controlIs: Integer; leftIs, rightIs, energyIs, bandIs: Integer; musicIs, channel4Is, airVisIs, buttonIs, restoreIs: Boolean; leftNameIs, rightNameIs, energyNameIs, bandNameIs: string[12]; keyBoardIs: Integer; end; prefPtr = ^prefType; prefHand = ^prefPtr; var theirPrefs: prefHand; begin UseResFile(gliderResNum); theirPrefs := prefHand(NewHandle(SIZEOF(prefType))); if (theirPrefs = nil) then begin GenericAlert(kErrMemLow); Exit(SavePrefs); end; Handle(theirPrefs) := Get1Resource('Gprf', 128); if ((ResError = noErr) and (theirPrefs <> nil)) then begin HLock(Handle(theirPrefs)); with theirPrefs^^ do begin houseName := defaultHouse; theName := playerName; resName := resourceName; GetSoundVol(sndVolume); controlIs := controlMethod; leftIs := leftKey; rightIs := rightKey; energyIs := energyKey; bandIs := bandKey; musicIs := musicOn; channel4Is := is4Channel; {presently un-used} airVisIs := airVisible; buttonIs := buttonFires; restoreIs := restoreColor; leftNameIs := leftName; rightNameIs := rightName; energyNameIs := energyName; bandNameIs := bandName; keyBoardIs := herKeyBoard; end; end else begin GenericAlert(kErrLoadingRes); Exit(SavePrefs); end; ChangedResource(Handle(theirPrefs)); WriteResource(Handle(theirPrefs)); if (ResError <> noErr) then begin if ((ResError = FLckdErr) or (ResError = VLckdErr) or (ResError = WPrErr)) then GenericAlert(kErrSavingPrefs) else GenericAlert(ResError); end; HUnlock(Handle(theirPrefs)); ReleaseResource(Handle(theirPrefs)); end; {=================================} procedure DoUpdate; var whichWindow: WindowPtr; begin whichWindow := WindowPtr(theEvent.message); if (whichWindow = mainWndo) then begin BeginUpdate(mainWndo); RedrawWindowFrame; if ((demoMode = highScoreMode) and (not playing)) then DrawHiScores else if (demoMode = helpScreensMode) then DisplayAHelpScreen else begin if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, mainWndo^.visRgn) else CopyBits(offVirginMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, mainWndo^.visRgn); end; EndUpdate(mainWndo); ClipRect(wholeArea); end; end; {=================================} procedure CloseUpShop; const Color = 1; GDTypeFlag = 1; var theDevice: GDHandle; {-----------} function SetDepth (gd: GDHandle; newDepth, whichFlags, newFlags: Integer): Integer; inline $203C, $000A, $0013, $AAA2; {-----------} begin DropIdle; ShowMenuBar; SpinBall; if (hasMirror) then begin hasMirror := FALSE; HUnlock(Handle(mirrorRgn)); DisposeRgn(mirrorRgn); end; if (hasWindow) then begin hasWindow := FALSE; HUnlock(Handle(windowRgn)); DisposeRgn(windowRgn); end; if (hasToast) then begin hasToast := FALSE; HUnlock(Handle(toastRgn)); DisposeRgn(toastRgn); end; SpinBall; if (smsIsActive) then SMSExit; smsIsActive := FALSE; SpinBall; if (wholeRgn <> nil) then begin HUnlock(Handle(wholeRgn)); DisposeRgn(wholeRgn); end; SpinBall; if (inColor) then begin if (mainPalette <> nil) then DisposePalette(mainPalette); if (mainWndo <> nil) then DisposeWindow(GrafPtr(mainWndo)); CloseCPort(objectCPtr); DisposPtr(objectCBits); CloseCPort(virginCPtr); DisposPtr(virginCBits); CloseCPort(loadCPtr); DisposPtr(loadCBits); CloseCPort(reserveCPtr); DisposPtr(reserveCBits); end else begin if (mainWndo <> nil) then DisposeWindow(mainWndo); ClosePort(offVirginPort); DisposPtr(Ptr(offVirginPort)); ClosePort(offPlayerPort); DisposPtr(Ptr(offPlayerPort)); ClosePort(offLoadPort); DisposPtr(Ptr(offLoadPort)); ClosePort(offMaskPort); DisposPtr(Ptr(offMaskPort)); ClosePort(offReservePort); DisposPtr(Ptr(offReservePort)); end; SpinBall; SavePrefs; SpinBall; SetSoundVol(wasSndVolume); if ((not cantColor) and (restoreColor) and (not cantSwitch)) then begin theDevice := GetMainDevice; if (theDevice <> nil) then begin HLock(Handle(theDevice)); if (theDevice^^.gdPMap^^.pixelSize <> wasDepth) then theErr := SetDepth(theDevice, wasDepth, GDTypeFlag, Color); HUnlock(Handle(theDevice)); end; end; end; {=================================} begin InitializeAll; InitCursor; InitIdle; {$IFC not DemoVersion} DoStartUp; {$ENDC} UnloadSeg(@InitializeAll); UnloadSeg(@DoStartUp); repeat if (hasWNE) then eventHappened := WaitNextEvent(everyEvent, theEvent, kSleep, nil) else begin SystemTask; eventHappened := GetNextEvent(everyEvent, theEvent); end; if (eventHappened) then case (theEvent.what) of MouseDown: DoMouseDown; KeyDown, AutoKey: DoKeyDown; UpDateEvt: DoUpdate; DiskEvt: {call DIBadMount in response to a diskEvt} DoDiskEvent; App4Evt: DoOSEvent; otherwise end; {case} if (not pausing) then begin if (playing) then Coordinate else if ((not inBackground) and (mainWndo = FrontWindow)) then DoIdle; end; until doneFlag; {End of the event loop} CloseUpShop; {Dispose of all data structures, etc....} end. {Finis} \ No newline at end of file diff --git a/Glider_405/Sources/G-GlobalUtils.p b/Glider_405/Sources/G-GlobalUtils.p new file mode 100755 index 0000000..dff9968 --- /dev/null +++ b/Glider_405/Sources/G-GlobalUtils.p @@ -0,0 +1 @@ +unit GlobalUtils; interface uses SMS, Palettes, Globals; procedure SetPage (secondPage: Boolean); procedure SpinBall; procedure GenericAlert (whatGives: Integer); procedure DoTheSound (whichOne: Integer); procedure DoTheBass (whichOne: Integer); procedure DoTheMusic (whichOne: Integer); function Randomize (range: Integer): Integer; procedure CalcRoomScore; procedure DoErrorSound (soundNumber: Integer); procedure DissBlocks; procedure DrawHiScores; procedure HideMenuBar; procedure ShowMenuBar; procedure FatalError; procedure RedrawWindowFrame; implementation {=================================} procedure SetPage (secondPage: Boolean); EXTERNAL; {=================================} procedure SpinBall; var tempByte: SignedByte; begin if (ballList = nil) then Exit(SpinBall); tempByte := HGetState(Handle(ballList)); HLock(Handle(ballList)); with ballList^^ do begin if (whichBall = -1) then Exit(SpinBall); if (whichBall >= kCursCount) then whichBall := 1 else whichBall := whichBall + 1; if (useColorCursor) then SetCCursor(ballC[whichBall]) else SetCursor(ball[whichBall]^^); end; HSetState(Handle(ballList), tempByte); end; {=================================} procedure GenericAlert; var dummyInt: Integer; line1, line2: Str255; alertHandle: AlertTHndl; alertRect: Rect; begin if ((areFlipping) and (mainScreenHidden)) then begin mainScreenHidden := FALSE; SetPage(mainScreenHidden); end; UseResFile(gliderResNum); InitCursor; if (whatGives > 0) then begin GetIndString(line1, rAlertStrIDs, whatGives); line2 := ''; end else begin GetIndString(line1, rAlertStrIDs, 1); NumToString(whatGives, line2); line2 := CONCAT('Error = ', line2); end; ParamText(line1, line2, '', ''); alertHandle := AlertTHndl(Get1Resource('ALRT', rAlertID)); if (alertHandle <> nil) then begin HNoPurge(Handle(alertHandle)); alertRect := alertHandle^^.boundsRect; OffsetRect(alertRect, -alertRect.left, -alertRect.top); dummyInt := (screenBits.bounds.right - alertRect.right) div 2; OffsetRect(alertRect, dummyInt, 0); dummyInt := (screenBits.bounds.bottom - alertRect.bottom) div 3; OffsetRect(alertRect, 0, dummyInt); alertHandle^^.boundsRect := alertRect; HPurge(Handle(alertHandle)); end; dummyInt := Alert(rAlertID, nil); end; {=================================} procedure DoTheMusic; begin if (musicOn and soundOn) then SMSStartChan(whichOne, 1); end; {=================================} procedure DoTheBass; begin if (musicOn) then SMSStart(whichOne); end; {=================================} procedure DoTheSound; begin if (soundOn) then SMSStart(whichOne); end; {=================================} function Randomize; var rawResult: LongInt; begin rawResult := ABS(Random); Randomize := (rawResult * range) div 32768; end; {=================================} procedure CalcRoomScore; var index: Integer; begin roomScore := 0; for index := 1 to 40 do if (roomVisits[index]) then roomScore := roomScore + (500 * (index div 10 + 1)) + (roomsPassed div 41) * 2000; end; {=================================} procedure DoErrorSound; var dummyLong: LongInt; tempVolume, i: Integer; begin GetSoundVol(tempVolume); if (tempVolume <> 0) then for i := 0 to soundNumber do begin FlashMenuBar(0); Delay(8, dummyLong); FlashMenuBar(0); end; end; {=================================} procedure DissBlocks; var h, v: Integer; value: LongInt; maskR: Rect; begin value := 1; repeat if (BTST(value, 0)) then begin value := BSR(value, 1); value := BitXor(value, $240); end else begin value := BSR(value, 1); end; h := (value mod 32) * 16; v := (value div 32) * 16; SetRect(maskR, h, v, h + 16, v + 16); if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, maskR, maskR, srcCopy, wholeRgn) else CopyBits(offVirginMap, mainWndo^.portBits, maskR, maskR, srcCopy, wholeRgn); until (value = 1); if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, wholeRgn) else CopyBits(offVirginMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, wholeRgn); if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, wholeRgn) else CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, wholeRgn); end; {=================================} procedure DrawHiScores; var i, ranking: Integer; leftRect, rightRect, hole, tempRect: Rect; tempStr: Str255; wasPort: GrafPtr; begin if (playing) then begin demoMode := Randomize(lastDemo) + 1; Exit(DrawHiScores); end; GetPort(wasPort); if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); PenNormal; ranking := scoreList.rank; SetRect(leftRect, 10, 30, 251, 332); FillRect(leftRect, white); FrameRect(leftRect); PenPat(gray); if (inColor) then RGBForeColor(rgbLtBlue); for i := 0 to 20 do begin MoveTo(leftRect.left + 1, leftRect.top + 35 + (i * 13)); LineTo(leftRect.right - 2, leftRect.top + 35 + (i * 13)); end; if (inColor) then RGBForeColor(rgbBlack); if ((ranking < 20) and (inColor)) then begin RGBForeColor(rgbYellow); i := (ranking * 13) + leftRect.top + 36; SetRect(tempRect, leftRect.left + 32, i, leftRect.right - 2, i + 12); PaintRect(tempRect); RGBForeColor(rgbBlack); end; TextFont(16); TextSize(12); if (inColor) then RGBForeColor(rgbRed); MoveTo(leftRect.left + 33, leftRect.top + 30); DrawString('Rank'); MoveTo(leftRect.left + 108, leftRect.top + 30); DrawString('Name'); MoveTo(leftRect.left + 186, leftRect.top + 30); DrawString('Room #'); if (inColor) then RGBForeColor(rgbBlack); for i := 0 to 19 do begin MoveTo(leftRect.left + 38, leftRect.top + 47 + (i * 13)); NumToString(i + 1, tempStr); DrawString(tempStr); MoveTo(leftRect.left + 58, leftRect.top + 47 + (i * 13)); DrawString(thisHouse.hiName[i]); MoveTo(leftRect.left + 206, leftRect.top + 47 + (i * 13)); if (thisHouse.hiLevel[i] = 0) then tempStr := '+' else NumToString(thisHouse.hiLevel[i], tempStr); DrawString(tempStr); end; if ((ranking < 20) and (not inColor)) then begin i := (ranking * 13) + leftRect.top + 36; SetRect(tempRect, leftRect.left + 32, i, leftRect.right - 2, i + 12); InvertRect(tempRect); end; if (inColor) then RGBForeColor(rgbViolet); MoveTo(leftRect.left + 30, leftRect.top + 1); LineTo(leftRect.left + 30, leftRect.bottom); if (inColor) then RGBForeColor(rgbBlack); SetRect(hole, 0, 0, 12, 12); OffsetRect(hole, leftRect.left + 10, leftRect.top + 30); FillOval(hole, black); OffsetRect(hole, 0, 30); FillOval(hole, black); OffsetRect(hole, 0, 85); FillOval(hole, black); OffsetRect(hole, 0, 85); FillOval(hole, black); OffsetRect(hole, 0, 30); FillOval(hole, black); PenNormal; SetRect(rightRect, 261, 30, 502, 332); FillRect(rightRect, white); FrameRect(rightRect); PenPat(gray); if (inColor) then RGBForeColor(rgbLtBlue); for i := 0 to 20 do begin MoveTo(rightRect.left + 1, rightRect.top + 35 + (i * 13)); LineTo(rightRect.right - 2, rightRect.top + 35 + (i * 13)); end; if (inColor) then RGBForeColor(rgbBlack); if ((ranking < 20) and (inColor)) then begin RGBForeColor(rgbYellow); i := (ranking * 13) + rightRect.top + 36; SetRect(tempRect, rightRect.left + 32, i, rightRect.right - 2, i + 12); PaintRect(tempRect); RGBForeColor(rgbBlack); end; TextFont(16); TextSize(12); if (inColor) then RGBForeColor(rgbRed); MoveTo(rightRect.left + 33, rightRect.top + 30); DrawString('Score'); MoveTo(rightRect.left + 98, rightRect.top + 30); DrawString('Room Name'); if (inColor) then RGBForeColor(rgbBlack); for i := 0 to 19 do begin MoveTo(rightRect.left + 33, rightRect.top + 47 + (i * 13)); NumToString(thisHouse.hiScores[i], tempStr); DrawString(tempStr); MoveTo(rightRect.left + 81, rightRect.top + 47 + (i * 13)); DrawString(thisHouse.hiRoom[i]); end; if ((ranking < 20) and (not inColor)) then begin i := (ranking * 13) + rightRect.top + 36; SetRect(tempRect, rightRect.left + 32, i, rightRect.right - 2, i + 12); InvertRect(tempRect); end; if (inColor) then RGBForeColor(rgbViolet); MoveTo(rightRect.left + 30, rightRect.top + 1); LineTo(rightRect.left + 30, rightRect.bottom); if (inColor) then RGBForeColor(rgbBlack); SetRect(hole, 0, 0, 12, 12); OffsetRect(hole, rightRect.left + 10, rightRect.top + 30); FillOval(hole, black); OffsetRect(hole, 0, 30); FillOval(hole, black); OffsetRect(hole, 0, 85); FillOval(hole, black); OffsetRect(hole, 0, 85); FillOval(hole, black); OffsetRect(hole, 0, 30); FillOval(hole, black); if (inColor) then begin CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, leftRect, leftRect, srcCopy, wholeRgn); CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, rightRect, rightRect, srcCopy, wholeRgn); end else begin CopyBits(offLoadMap, MainWndo^.portBits, leftRect, leftRect, srcCopy, wholeRgn); CopyBits(offLoadMap, MainWndo^.portBits, rightRect, rightRect, srcCopy, wholeRgn); end; SetPort(wasPort); demoMode := highScoreMode; end; {=================================} function GetGrayRgn: RgnHandle; inline $2EB8, $09EE; {=================================} function GetMBarHeight: Integer; inline $3EB8, $0BAA; {=================================} procedure SetMBarHeight (newHeight: Integer); inline $31DF, $0BAA; {=================================} function GetWindowList: WindowPtr; inline $2EB8, $9D6; {=================================} function GetMBarRgn: RgnHandle; var theRect: Rect; worldRgn, mBarRgn: RgnHandle; begin theRect := GetGrayRgn^^.rgnBBox; UnionRect(theRect, screenBits.bounds, theRect); worldRgn := NewRgn; OpenRgn; FrameRoundRect(theRect, 16, 16); CloseRgn(worldRgn); theRect := screenBits.bounds; theRect.bottom := theRect.top + wasMBarHeight; mBarRgn := NewRgn; RectRgn(mBarRgn, theRect); SectRgn(worldRgn, mBarRgn, mBarRgn); DisposeRgn(worldRgn); GetMBarRgn := mBarRgn; end; {=================================} procedure HideMenuBar; var theRect: Rect; mBarHeight: Integer; grayRgn, menuBarRgn: RgnHandle; startWindow: WindowPeek; begin mBarHeight := GetMBarHeight; if (mBarHeight <> 0) then begin grayRgn := GetGrayRgn; wasMBarHeight := mBarHeight; menuBarRgn := GetMBarRgn; SetMBarHeight(0); UnionRgn(grayRgn, menuBarRgn, grayRgn); startWindow := WindowPeek(GetWindowList); PaintBehind(startWindow, menuBarRgn); CalcVisBehind(startWindow, menuBarRgn); DisposeRgn(menuBarRgn); end; end; {=================================} procedure ShowMenuBar; var grayRgn, menuBarRgn: RgnHandle; begin if (GetMBarHeight = 0) then begin grayRgn := GetGrayRgn; menuBarRgn := GetMBarRgn; SetMBarHeight(wasMBarHeight); DiffRgn(grayRgn, menuBarRgn, grayRgn); CalcVisBehind(WindowPeek(GetWindowList), menuBarRgn); DisposeRgn(menuBarRgn); DrawMenuBar; end; end; {=================================} procedure FatalError; begin InitCursor; ShowMenuBar; ExitToShell; end; {=================================} procedure RedrawWindowFrame; var tempRect: Rect; tempByte: SignedByte; thePict: PicHandle; begin SetPort(GrafPtr(mainWndo)); PenNormal; if (inColor) then RGBForeColor(rgbBlack); ClipRect(fullArea); SetRect(tempRect, -rightOffset, -downOffset, 512 + (2 * rightOffset), 0); FillRect(tempRect, black); SetRect(tempRect, -rightOffset, 342, 512 + (2 * rightOffset), 342 + downOffset); FillRect(tempRect, black); SetRect(tempRect, -rightOffset, 0, 0, 342); FillRect(tempRect, black); SetRect(tempRect, 512, 0, 512 + rightOffset, 342); FillRect(tempRect, black); UseResFile(gliderResNum); if (inColor) then begin SetRect(tempRect, -64, 0, 0, 342); thePict := GetPicture(rSidePict1); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, tempRect); HSetState(Handle(thePict), tempByte); end else GenericAlert(kErrNotEnoughMem); ReleaseResource(Handle(thePict)); end; if (inColor) then begin SetRect(tempRect, 512, 0, 512 + 64, 342); thePict := GetPicture(rSidePict2); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, tempRect); HSetState(Handle(thePict), tempByte); end else GenericAlert(kErrNotEnoughMem); ReleaseResource(Handle(thePict)); end; ClipRect(wholeArea); end; {=================================} end. \ No newline at end of file diff --git a/Glider_405/Sources/G-Globals.p b/Glider_405/Sources/G-Globals.p new file mode 100755 index 0000000..f320b86 --- /dev/null +++ b/Glider_405/Sources/G-Globals.p @@ -0,0 +1 @@ +unit Globals; interface uses Palettes; const kGlideVersion = $0100; {version of house format} kStackSize = 24576; {must be even - stack size} kSleep = 1; {sleep time in Ticks} kSuspendResumeBit = $0001; {for WNE} kResuming = 1; {for WNE} kSecondaryAddr = $3F2700; {address of alternate page buffer} kSlowScoreIncrement = 17; {fast machine extend score-odometer} kFastScoreIncrement = 37; {slow machine race score-odometer} kMouseSlop = 1; {who knows} kMinBassLoop = 14; {quickest pace of duh-dum} kBassFract = 8; {smaller = slower bass @ 1st / larger = quicker} kBonusTimeToBeat = 256; {number of passes for time bonus} kCeilingVert = 24; {absolute ceiling in pixels} kFloorVert = 325; {absolute floor in pixels} kFloorLimit = kFloorVert + 5; kMaxThrust = 5; {maximum speed (in pixels) of glider} kLastHelpScreen = 7; {number of help screens} kCursCount = 12; {number of frames for animated cursor} rAcurID = 128; {resource ID numbers} rMainWndoID = 128; rAlertID = 128; rFileAlertID = 129; rSoundDlgID = 131; rQuitNoSaveAlertID = 132; rDepthAlertID = 136; rCustomKeysID = 137; rCustGetID = 256; rAlertStrIDs = 128; rFileStrIDs = 129; rMiscStrID = 130; rDemoStrIDs = 131; rObjectPictID = 128; rMaskPictID = 129; rFarmPict = 130; rSidePict1 = 140; rSidePict2 = 141; rIdleID = 200; rColorIdleID = 210; rHelpBasePictID = 1000; kDefaultLeftKey = $2B; {default control keys} kDefaultRightKey = $2F; kDefaultEnergyKey = $24; kDefaultBandKey = $31; kDefaultLeftName = ', key'; {default names for control keys} kDefaultRightName = '. key'; kDefaultEnergyName = 'return'; kDefaultBandName = 'space'; kTabKey = $09; {misc. ascii codes} kReturnKey = $0D; kSpaceBar = $20; kSKeyMap = $01; {misc. keymap codes} kQKeyMap = $0C; kEKeyMap = $0E; kReturnKeyMap = $24; kTabKeyMap = $30; kControlKeyMap = $3B; kCommandKeyMap = $37; kShiftKey = $38; 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; kErrGraphicsNotFound = 8; kErrGraphicLoad = 9; kErrSavingPrefs = 10; kErrAirChange = 11; kErrLoadingRes = 12; kErrFileExists = 13; kErrNothingToPrint = 14; kErrWrongHouseVers = 15; kErrLoadingDfltHouse = 16; kErrLoadingPrefs = 17; kErrNotDemoHouse = 18; kErrExitSansGraphics = 19; kErrGraphicsAre2Bit = 20; kErrGraphicsAre16Bit = 21; kErrGameOldVers = 22; kErrExitSansHouse = 23; kErrHouseModified = 24; kErrBackgroundMusic = 25; kErrDepthSwitched = 26; kErrStartUpWrongType = 27; kErrNoSounds = 28; kErrVolLocked = 29; kErrMissionINIT = 30; kErrNotFirstHouse = 31; kErrDemoRefuseHouse = 32; kErrNewKeyboard = 33; kHouseType = 0; kArtType = 1; kGameType = 2; nulObj = 0; {room object codes} {furniture} 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; {glider situational modes} fadingIn = 1; fadingOut = 2; turnRt2Lf = 3; turnLf2Rt = 4; burning = 5; ascending = 6; descending = 7; shredding = 8; {objects effects codes} 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; highScoreMode = 0; {demo mode numbers} balloonMode = 1; copterMode = 2; dartMode = 3; controlMode = 4; tabMode = 5; adMode = 6; editorMode = 7; colorMusicMode = 8; ventCandleMode = 9; bandBatteryMode = 10; paperClockMode = 11; lastDemo = 11; helpScreensMode = 99; iNothing = 0; mApple = 128; {Menu resource ID} iAbout = 1; {Menu items} mGame = 129; {Menu resource ID} iBegin = 1; {Menu items} iLoadHouse = 2; iEndGame = 3; iLoadGame = 5; iSaveGame = 6; iSaveGameAs = 7; iQuit = 9; mOption = 130; {Menu resource ID} iControls = 1; {Menu items} iSound = 2; iShowAir = 3; iRestoreDeep = 4; iHiScores = 6; iHelp = 8; mControls = 131; {Menu resource ID} iHoldKeyboard = 1; {Menu items} iDropKeyboard = 2; iAbsMouse = 3; iRelMouse = 4; iConfigure = 6; whoCares = 0; {place where entered room} topOfRoom = 1; bottomOfRoom = 2; leftOfRoom = 3; rightOfRoom = 4; kWhistleSound = 13; kTapSound = 27; kCRSound = 28; kMusicSound = 29; {ID of music sound} kDuhDumSound = 30; {ID of bass beat} type 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; timeStamp: LongInt; mode, phase: Integer; srcNum: Integer; forVel: Integer; mass: Integer; bands, energy: Integer; isRight, isForward: Boolean; end; animateRec = record destRect, wholeRect, oldRect: Rect; horiOff, vertOff: Integer; kind, phase: Integer; tickStamp, delay: LongInt; unSeen: Boolean; end; cycleRec = record holdRect, wholeRect, oldRect: Rect; tiedTo, kindIs, phase: Integer; reset, position: LongInt; accel, velocity: Integer; end; bandRec = record dest, whole, old: Rect; phase, velocity: Integer; end; scoreRec = record rank: Integer; changed: Boolean; end; pointRec = record whereR: Rect; tickStamp: LongInt; saysWhat: string[16]; out: Boolean; end; lightningRec = record theBolts: array[1..3, 0..7, 0..1] of Integer; whichBolt, whatPhase: Integer; whatTime: LongInt; end; BitMapPtr = ^BitMap; IntPtr = ^Integer; LongintPtr = ^Longint; acur = record whichBall: LongInt; ball: array[1..kCursCount] of CursHandle; end; acurPtr = ^acur; acurHand = ^acurPtr; var theEvent: EventRecord; mainWndo: WindowPtr; mainPalette: PaletteHandle; wholeArea, fullArea, nullRect, smScoreRect, lgScoreRect: Rect; wholeRgn: RgnHandle; offMaskMap, offVirginMap, offLoadMap, offPlayerMap, offReserveMap: BitMap; offMaskPort, offVirginPort, offLoadPort, offPlayerPort, offReservePort: GrafPtr; offMaskBits, offVirginBits, offLoadBits, offPlayerBits, offReserveBits: Ptr; virginCPort, loadCPort, objectCPort, reserveCPort: CGrafPort; virginCPtr, loadCPtr, objectCPtr, reserveCPtr: CGrafPtr; virginCBits, loadCBits, objectCBits, reserveCBits: Ptr; rgbBlack, rgbWhite, rgbLtBlue, rgbRed, rgbBlue, rgbLtGreen: RGBColor; rgbYellow, rgbViolet, rgbBrown, rgbLtBrown, rgbDkGray: RGBColor; noCursor: CursHandle; thisHouse: houseRec; theKeys: KeyMap; theErr: OSErr; currentBall: Integer; ballList: acurHand; ballC: array[1..kCursCount] of CCrsrHandle; theAnimates: array[1..16] of animateRec; animateRct: array[0..2, -1..16] of Rect; cycleObjects: array[1..16] of cycleRec; floatPoints: pointRec; theGlider: GliderRec; roomVisits: array[1..40] of Boolean; glideRct: array[0..27] of Rect; shadoRct: array[0..1] of Rect; nextPhase: array[1..4, 0..16] of Integer; theBand: BandRec; bandRct: array[0..2] of Rect; roomScore, suppScore, rollScore, loopsThruRoom, workingGameNumber: LongInt; scoreList: scoreRec; rightOffset, downOffset, gliderResNum, wasSndVolume: Integer; controlMethod, demoMode, demoCount, wasDepth: Integer; liftAmount, mortals, shiftAmount, sideYouCantExit: Integer; leftKey, rightKey, energyKey, bandKey, scoreIncrement: Integer; roomAt, roomsPassed, nObjects, binaryFlip: Integer; gameNumber, houseNumber, wasMBarHeight: Integer; houseVolNum, gameVolNum, resVolNum, bassLoop, playBassTime: Integer; nAnimates, nCycleObs, herKeyBoard, iGlidersHelp: Integer; leftName, rightName, energyName, bandName: string[12]; playerName: string[24]; musicName, gameName, resourceName: string[32]; firstFileName, defaultHouse, housesName: string[32]; mirrorRgn, windowRgn, toastRgn: RgnHandle; theLightning: LightningRec; tileRects: array[0..7] of Rect; srcRect: array[0..69] of Rect; eventRect, reserveRects: array[0..16] of Rect; eventKind: array[0..16, 0..2] of LongInt; windowOpen, hasWindow, leftIsOpen, rightIsOpen, enteredLeft: Boolean; cantSwitch, airVisible, hasMirror, hasToast, lightsOut, airOut: Boolean; bandBorne, cantColor, soundOn, musicOn, inhibitSound, hasSys7: Boolean; buttonFires, cantMusic, smsIsActive, doneFlag, inColor: Boolean; inBackground, playing, pausing, hasWNE, restoreColor, refuseHigh: Boolean; scoreIsRolling, lifeNormal, didntExitEntrance, areFlipping: Boolean; mainScreenHidden, fileWasLost, is4Channel, useColorCursor: Boolean; implementation end. \ No newline at end of file diff --git a/Glider_405/Sources/G-IdleInput.p b/Glider_405/Sources/G-IdleInput.p new file mode 100755 index 0000000..1d3890c --- /dev/null +++ b/Glider_405/Sources/G-IdleInput.p @@ -0,0 +1 @@ +unit IdleInput; interface uses SMS, Balloons, Palettes, Globals, GlobalUtils, FileInNOut, IdleUtils, PlayUtils, PlaySetUp; procedure StartNewGame; function GetGame: Boolean; procedure HandleMenu (theMenu, theItem: integer); procedure DoMouseDown; procedure DoKeyDown; procedure DoDiskEvent; procedure DoOSEvent; {=================================} implementation {=================================} procedure StartNewGame; var i: Integer; tempRect: Rect; firstIs: string[32]; begin if (not smsIsActive) then SMSInit; smsIsActive := TRUE; if (is4Channel) then SMSSetMode(4) else SMSSetMode(2); if (not GetHouse) then Exit(StartNewGame); firstIs := thisHouse.firstFile; if (firstIs <> housesName) and (firstIs <> '') and (firstIs <> 'nil') then begin GenericAlert(kErrNotFirstHouse); housesName := firstIs; if (not OpenHouse) then begin GenericAlert(kErrExitSansHouse); Exit(StartNewGame); end; DoClose(houseVolNum); {$IFC DemoVersion} if (thisHouse.timeStamp <> 16) then begin GenericAlert(kErrNotDemoHouse); Exit(StartNewGame); end; {$ENDC} thisHouse.firstFile := ''; if (not WriteHouse) then ; end; firstFileName := housesName; HideMenuBar; if (screenBits.bounds.bottom > 382) then begin SetPort(GrafPtr(mainWndo)); PenNormal; ClipRect(fullArea); SetRect(tempRect, -rightOffset, -downOffset, 512 + 2 * rightOffset, -downOffset + 20); FillRect(tempRect, black); ClipRect(wholeArea); end; if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); with scoreList do begin changed := FALSE; rank := 20; end; roomAt := 1; roomsPassed := 1; roomScore := 0; suppScore := 0; rollScore := 0; GetDateTime(workingGameNumber); sideYouCantExit := whoCares; loopsThruRoom := 0; bassLoop := 0; playBassTime := kBonusTimeToBeat div kBassFract + kMinBassLoop; for i := 1 to 40 do roomVisits[i] := FALSE; if (ozmaFlags[3]) then begin mortals := 50; refuseHigh := TRUE; end else begin mortals := 5; refuseHigh := FALSE; end; for i := 0 to 3 do ozmaFlags[i] := FALSE; enteredLeft := TRUE; with theGlider do begin isRight := TRUE; bands := 0; forVel := 4; energy := 0; end; ResetGlider; playing := TRUE; pausing := FALSE; hasMirror := FALSE; hasWindow := FALSE; hasToast := FALSE; scoreIsRolling := FALSE; floatPoints.out := FALSE; ReadyRoom; gameName := ''; DisableItem(GetMenu(mGame), iLoadHouse); EnableItem(GetMenu(mGame), iEndGame); DisableItem(GetMenu(mGame), iLoadGame); {$IFC not DemoVersion} EnableItem(GetMenu(mGame), iSaveGame); EnableItem(GetMenu(mGame), iSaveGameAs); {$ENDC} DisableItem(GetMenu(mOption), iHiScores); SetPort(GrafPtr(mainWndo)); PenNormal; TextFont(0); TextSize(12); TextMode(patOr); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); SetCursor(noCursor^^); DissBlocks; FlushEvents(everyEvent, 0); end; {=================================} procedure DoLoadHouse; var killed: Boolean; begin {$IFC not DemoVersion} if DoOpen(kHouseType) then begin demoMode := Randomize(lastDemo) + 1; HideMenuBar; StartNewGame; end; {$ENDC} end; {=================================} procedure DoEndGame; begin SetItem(GetMenu(mGame), iBegin, 'Begin Game'); WrapItUp; DrawMenuBar; end; {=================================} function GetGame; var tempRect: Rect; begin GetGame := FALSE; if (not ReadGame) then Exit(GetGame); if (not smsIsActive) then SMSInit; smsIsActive := TRUE; if (is4Channel) then SMSSetMode(4) else SMSSetMode(2); demoMode := Randomize(lastDemo) + 1; HideMenuBar; if (screenBits.bounds.bottom > 382) then begin SetPort(GrafPtr(mainWndo)); PenNormal; ClipRect(fullArea); SetRect(tempRect, -rightOffset, -downOffset, 512 + 2 * rightOffset, -downOffset + 20); FillRect(tempRect, black); ClipRect(wholeArea); end; if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); ResetGlider; playing := TRUE; pausing := FALSE; hasMirror := FALSE; hasWindow := FALSE; hasToast := FALSE; scoreIsRolling := FALSE; refuseHigh := TRUE; floatPoints.out := FALSE; sideYouCantExit := whoCares; loopsThruRoom := 0; bassLoop := 0; playBassTime := kBonusTimeToBeat div kBassFract + kMinBassLoop; ReadyRoom; DisableItem(GetMenu(mGame), iLoadHouse); EnableItem(GetMenu(mGame), iEndGame); DisableItem(GetMenu(mGame), iLoadGame); EnableItem(GetMenu(mGame), iSaveGame); EnableItem(GetMenu(mGame), iSaveGameAs); DisableItem(GetMenu(mOption), iHiScores); SetPort(GrafPtr(mainWndo)); PenNormal; TextFont(0); TextSize(12); TextMode(patOr); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); SetCursor(noCursor^^); DissBlocks; FlushEvents(everyEvent, 0); GetGame := TRUE; end; {=================================} procedure ResumeGame; var tempRect: Rect; begin if (not smsIsActive) then SMSInit; smsIsActive := TRUE; if (is4Channel) then SMSSetMode(4) else SMSSetMode(2); HideMenuBar; SetItem(GetMenu(mGame), iBegin, 'Begin Game'); SetCursor(noCursor^^); pausing := FALSE; if (screenBits.bounds.bottom < 382) then begin SetPort(GrafPtr(mainWndo)); SetRect(tempRect, 0, 0, 512, 20); if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, tempRect, tempRect, srcCopy, nil) else CopyBits(offVirginMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, nil); end else begin SetPort(GrafPtr(mainWndo)); PenNormal; ClipRect(fullArea); SetRect(tempRect, -rightOffset, -downOffset, 512 + 2 * rightOffset, -downOffset + 20); FillRect(tempRect, black); ClipRect(wholeArea); end; if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); end; {=================================} procedure HandleMenu; {Handle menu selections realtime} var DNA, i, volNum: integer; BoolHolder, cancelIt: boolean; DAName: Str255; SavePort: GrafPtr; tempRect: Rect; begin case theMenu of mApple: case theItem of iNothing: ; iAbout: DoAbout; otherwise begin GetPort(SavePort); GetItem(GetMenu(mApple), theItem, DAName); DNA := OpenDeskAcc(DAName); SetPort(SavePort); end; end; mGame: case theItem of iBegin: begin demoMode := Randomize(lastDemo) + 1; if (pausing and playing) then ResumeGame else StartNewGame; end; iLoadHouse: DoLoadHouse; iEndGame: DoEndGame; iLoadGame: begin {$IFC not DemoVersion} if (DoOpen(kGameType)) then begin if (not GetGame) then ; end; {$ENDC} end; iSaveGame: begin {$IFC not DemoVersion} if (not SaveGame) then ; {$ENDC} end; iSaveGameAs: begin {$IFC not DemoVersion} if (not SaveGameAs) then ; {$ENDC} end; iQuit: begin {$IFC DemoVersion} playing := FALSE; pausing := FALSE; doneFlag := TRUE; {$ELSEC} if DoQuit then begin playing := FALSE; pausing := FALSE; doneFlag := TRUE; end else if (SaveGame) then begin playing := FALSE; pausing := FALSE; doneFlag := TRUE; end; {$ENDC} end; otherwise end; mOption: case theItem of iControls: ; iSound: DoSoundSettings; iShowAir: begin airVisible := not airVisible; if (airVisible) then SetItem(GetMenu(mOption), iShowAir, 'Air is Visible') else SetItem(GetMenu(mOption), iShowAir, 'Air is Invisible'); if (playing) then GenericAlert(kErrAirChange); end; iRestoreDeep: begin restoreColor := not restoreColor; if (restoreColor) then SetItem(GetMenu(mOption), iRestoreDeep, 'Depth Restore is On') else SetItem(GetMenu(mOption), iRestoreDeep, 'Depth Restore is Off'); end; iHiScores: DrawHiScores; iHelp: OpenHelpScreens; otherwise end; mControls: case theItem of iHoldKeyboard..iRelMouse: begin for i := iHoldKeyboard to iRelMouse do CheckItem(GetMenu(mControls), i, FALSE); CheckItem(GetMenu(mControls), theItem, TRUE); controlMethod := theItem; end; iConfigure: DoCustomizeKeys; otherwise end; kHMHelpMenuID: if (theItem = iGlidersHelp) then OpenHelpScreens; otherwise end; HiliteMenu(0); end; {=================================} procedure DoMouseDown; var whichWindow: WindowPtr; theMenu, theItem, code: Integer; mResult: LongInt; begin code := FindWindow(theEvent.where, whichWindow); if (demoMode = highScoreMode) then CloseHiScores else if (demoMode = helpScreensMode) then NextPageHelpScreens else case (code) of inMenuBar: begin mResult := MenuSelect(theEvent.Where); theMenu := HiWord(mResult); theItem := LoWord(mResult); HandleMenu(theMenu, theItem); end; inSysWindow: SystemClick(theEvent, whichWindow); otherwise end; end; {=================================} procedure DoKeyDown; var chCode, theMenu, theItem: Integer; mResult: LongInt; begin with theEvent do begin chCode := BitAnd(message, CharCodeMask); if (ODD(modifiers div CmdKey)) then begin mResult := MenuKey(CHR(chCode)); theMenu := HiWord(mResult); theItem := LoWord(mResult); if (theMenu <> 0) then HandleMenu(theMenu, theItem); end else begin {knock through the demo messages} if ((chCode = kSpaceBar) and (demoMode <> highScoreMode)) then begin if (demoMode = helpScreensMode) then NextPageHelpScreens else begin demoMode := demoMode + 1; if (demoMode > lastDemo) then demoMode := 1; demoCount := 0; NewMode(FALSE); end; end; if (chCode = kReturnKey) then begin if (demoMode = helpScreensMode) then CloseHelpScreens else if (demoMode = highScoreMode) then CloseHiScores; end; {return from a paused game} if ((chCode = kTabKey) and (playing) and (pausing)) then begin demoMode := Randomize(lastDemo) + 1; HideMenuBar; ResumeGame; repeat GetKeys(theKeys); until (not theKeys[kTabKeyMap]); end; {check for secret code entered!} if (chCode = $4F) then ozmaFlags[0] := TRUE; if ((chCode = $7A) and (ozmaFlags[0])) then ozmaFlags[1] := TRUE; if ((chCode = $6D) and (ozmaFlags[1])) then ozmaFlags[2] := TRUE; if ((chCode = $61) and (ozmaFlags[2])) then begin ozmaFlags[3] := TRUE; refuseHigh := TRUE; end; end; {if (Odd(mod...} end; {with theEvent} end; {procedure} {=================================} procedure DoDiskEvent; var cornerPt: Point; begin if (HiWrd(theEvent.message) <> noErr) then begin SetPt(cornerPt, 85 + rightOffset, 50 + downOffset); theErr := DIBadMount(cornerPt, theEvent.message); end; end; {=================================} procedure DoOSEvent; begin case BSR(theEvent.message, 24) of {high byte of message} 1: {suspendResumeMessage} if (BitAnd(theEvent.message, kSuspendResumeBit) = kResuming) then begin inBackground := FALSE; {it was a resume event} if (not smsIsActive) then SMSInit; smsIsActive := TRUE; if (is4Channel) then SMSSetMode(4) else SMSSetMode(2); {re-grow window's right edge} end else begin if (smsIsActive) then SMSExit; smsIsActive := FALSE; inBackground := TRUE; {it was a suspend event} {shrink window's right edge} ShowMenuBar; end; otherwise end; {CASE} end; {osEvt} {=================================} end. \ No newline at end of file diff --git a/Glider_405/Sources/G-IdleUtils.p b/Glider_405/Sources/G-IdleUtils.p new file mode 100755 index 0000000..26124ec --- /dev/null +++ b/Glider_405/Sources/G-IdleUtils.p @@ -0,0 +1 @@ +unit IdleUtils; interface uses Palettes, Globals, GlobalUtils; var ozmaFlags: array[0..3] of Boolean; procedure CloseHiScores; procedure NewMode (randomIt: Boolean); procedure DisplayAHelpScreen; procedure CloseHelpScreens; procedure NextPageHelpScreens; procedure OpenHelpScreens; procedure InitIdle; procedure DoIdle; procedure DropIdle; procedure DoAbout; procedure DoSoundSettings; procedure DoCustomizeKeys; {=================================} implementation var idleR1, idleR2, frameR, loadR: Rect; maskRgn: RgnHandle; colorPoint, loopDelay, screenNum, helpScreenNum: Integer; timeWas, tickStamp: LongInt; demoAnimate: animateRec; {=================================} procedure CloseHiScores; begin if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, wholeRgn) else CopyBits(offVirginMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, wholeRgn); NewMode(TRUE); end; {=================================} procedure NewMode; var tempR, smallR: Rect; {----------------} procedure GetTheStrings (starting: Integer); var tempStr: Str255; begin if (inColor) then RGBForeColor(rgbBlue) else TextMode(srcXOr); MoveTo(300, 57); GetIndString(tempStr, rDemoStrIDs, starting); DrawString(tempStr); MoveTo(300, 70); GetIndString(tempStr, rDemoStrIDs, starting + 1); DrawString(tempStr); MoveTo(300, 83); GetIndString(tempStr, rDemoStrIDs, starting + 2); DrawString(tempStr); MoveTo(300, 96); GetIndString(tempStr, rDemoStrIDs, starting + 3); DrawString(tempStr); if (inColor) then RGBForeColor(rgbBlack) else PenNormal; end; {----------------} begin if (randomIt) then demoMode := Randomize(lastDemo) + 1; UseResFile(gliderResNum); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); PenNormal; SetRect(tempR, 298, 20, 508, 100); FillRect(tempR, black); TextFont(16); TextSize(12); case demoMode of balloonMode: begin with demoAnimate do begin phase := 0; kind := 2; vertOff := 4; destRect := animateRct[kind, phase]; OffsetRect(destRect, -destRect.left, -destRect.top); OffsetRect(destRect, 460, 45); oldRect := destRect; wholeRect := destRect; end; GetTheStrings(1); end; copterMode: begin with demoAnimate do begin phase := 0; kind := 1; vertOff := 3; destRect := animateRct[kind, phase]; OffsetRect(destRect, -destRect.left, -destRect.top); OffsetRect(destRect, 460, 45); oldRect := destRect; wholeRect := destRect; end; GetTheStrings(5); end; dartMode: begin with demoAnimate do begin phase := 0; kind := 0; vertOff := 4; destRect := animateRct[kind, phase]; OffsetRect(destRect, -destRect.left, -destRect.top); OffsetRect(destRect, 435, 45); oldRect := destRect; wholeRect := destRect; end; GetTheStrings(9); end; controlMode: GetTheStrings(13); tabMode: GetTheStrings(17); adMode: GetTheStrings(21); editorMode: GetTheStrings(25); colorMusicMode: GetTheStrings(29); ventCandleMode: begin GetTheStrings(33); smallR := SrcRect[flrVnt]; OffsetRect(smallR, -smallR.left, -smallR.top); OffsetRect(smallR, 456, 51); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, SrcRect[flrVnt], SrcRect[flrVnt], smallR) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, SrcRect[flrVnt], SrcRect[flrVnt], smallR); smallR := SrcRect[candle]; OffsetRect(smallR, -smallR.left, -smallR.top); OffsetRect(smallR, 466, 75); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, SrcRect[candle], SrcRect[candle], smallR) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, SrcRect[candle], SrcRect[candle], smallR); end; bandBatteryMode: begin GetTheStrings(37); smallR := SrcRect[rbrBnd]; OffsetRect(smallR, -smallR.left, -smallR.top); OffsetRect(smallR, 470, 45); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, SrcRect[rbrBnd], SrcRect[rbrBnd], smallR) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, SrcRect[rbrBnd], SrcRect[rbrBnd], smallR); smallR := SrcRect[battry]; OffsetRect(smallR, -smallR.left, -smallR.top); OffsetRect(smallR, 476, 75); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, SrcRect[battry], SrcRect[battry], smallR) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, SrcRect[battry], SrcRect[battry], smallR); end; paperClockMode: begin GetTheStrings(41); smallR := SrcRect[paper]; OffsetRect(smallR, -smallR.left, -smallR.top); OffsetRect(smallR, 460, 45); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, SrcRect[paper], SrcRect[paper], smallR) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, SrcRect[paper], SrcRect[paper], smallR); smallR := SrcRect[clock]; OffsetRect(smallR, -smallR.left, -smallR.top); OffsetRect(smallR, 468, 69); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, SrcRect[clock], SrcRect[clock], smallR) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, SrcRect[clock], SrcRect[clock], smallR); end; otherwise end; SetPort(GrafPtr(mainWndo)); if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, tempR, tempR, srcCopy, GrafPtr(mainWndo)^.visRgn) else CopyBits(offVirginMap, mainWndo^.portBits, tempR, tempR, srcCopy, mainWndo^.visRgn); end; {=================================} procedure DisplayAHelpScreen; var destRect: Rect; thePict: PicHandle; tempByte: SignedByte; begin SetRect(destRect, 4, 4, 507, 130); if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); thePict := GetPicture(helpScreenNum + rHelpBasePictID); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, destRect); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrNotEnoughMem); ExitToShell; {CHANGE ME} end; ReleaseResource(Handle(thePict)); if (inColor) then begin BackColor(cyanColor); CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, destRect, destRect, srcCopy, mainWndo^.visRgn); BackColor(whiteColor); end else begin CopyBits(offLoadMap, mainWndo^.portBits, destRect, destRect, srcCopy, mainWndo^.visRgn); end; end; {=================================} procedure CloseHelpScreens; begin if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, mainWndo^.visRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, mainWndo^.visRgn); end else begin CopyBits(offVirginMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, mainWndo^.visRgn); CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, mainWndo^.visRgn); end; if (screenBits.bounds.bottom <= 342) then ShowMenuBar; if (playing) then demoMode := Randomize(lastDemo) + 1 else NewMode(TRUE); end; {=================================} procedure NextPageHelpScreens; begin if (helpScreenNum < kLastHelpScreen) then begin helpScreenNum := helpScreenNum + 1; DisplayAHelpScreen; FlushEvents(everyEvent, 0); end else CloseHelpScreens; end; {=================================} procedure OpenHelpScreens; begin helpScreenNum := 1; demoMode := helpScreensMode; if (screenBits.bounds.bottom <= 342) then HideMenuBar; DisplayAHelpScreen; repeat until (not Button); end; {=================================} procedure InitIdle; var i: Integer; begin for i := 0 to 3 do ozmaFlags[i] := FALSE; SetRect(idleR1, 0, 0, 48, 20); OffsetRect(idleR1, -512 + Randomize(450), 130 + Randomize(70)); SetRect(idleR2, 0, 0, 35, 15); OffsetRect(idleR2, -512 + Randomize(450), 130 + Randomize(70)); tickStamp := TickCount; MoveTo(3, 222); maskRgn := NewRgn; OpenRgn; LineTo(29, 222); LineTo(16, 183); LineTo(82, 183); LineTo(93, 161); LineTo(204, 161); LineTo(214, 200); LineTo(329, 200); LineTo(335, 206); LineTo(352, 206); LineTo(368, 221); LineTo(396, 221); LineTo(509, 278); LineTo(509, 130); LineTo(3, 130); LineTo(3, 222); CloseRgn(maskRgn); loopDelay := 0; colorPoint := 0; demoCount := 0; NewMode(TRUE); end; {=================================} procedure DoAnimate; begin with demoAnimate do begin phase := phase + 1; if (phase > 7) then begin phase := 0; vertOff := -vertOff; end; OffsetRect(destRect, 0, vertOff); if (inColor) then begin SetPort(GrafPtr(loadCPtr)); UnionRect(destRect, oldRect, wholeRect); FillRect(wholeRect, black); SetPort(GrafPtr(mainWndo)); CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, animateRct[kind, phase], animateRct[kind, phase], destRect); CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeRect, wholeRect, srcCopy, GrafPtr(mainWndo)^.visRgn); end else begin SetPort(offLoadPort); UnionRect(destRect, oldRect, wholeRect); FillRect(wholeRect, black); SetPort(GrafPtr(mainWndo)); CopyMask(offPlayerMap, offMaskMap, offLoadMap, animateRct[kind, phase], animateRct[kind, phase], destRect); CopyBits(offLoadMap, mainWndo^.portBits, wholeRect, wholeRect, srcCopy, mainWndo^.visRgn); end; oldRect := destRect; end; end; {=================================} procedure DoIdle; var combinedRgn: RgnHandle; dummyLong: longInt; tempR1, tempR2, srcR: Rect; begin if (demoMode = highScoreMode) then Exit(DoIdle); if (demoMode <> helpScreensMode) then begin demoCount := demoCount + 1; if (demoCount >= 159) then begin demoCount := 0; NewMode(TRUE); end; if ((demoMode >= balloonMode) and (demoMode <= dartMode)) then DoAnimate; end; OffsetRect(idleR1, 4, 0); OffsetRect(idleR2, 3, 0); if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); tempR1 := idleR1; tempR1.left := tempR1.left - 4; FillRect(tempR1, black); tempR2 := idleR2; tempR2.left := tempR2.left - 3; FillRect(tempR2, black); SetRect(srcR, 0, 318, 35, 333); SetPort(GrafPtr(mainWndo)); combinedRgn := NewRgn; if (inColor) then begin SectRgn(maskRgn, GrafPtr(mainWndo)^.visRgn, combinedRgn); CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcR, srcR, idleR2); CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, glideRct[0], glideRct[0], idleR1); CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, tempR1, tempR1, srcCopy, combinedRgn); CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, tempR2, tempR2, srcCopy, combinedRgn); end else begin SectRgn(maskRgn, mainWndo^.visRgn, combinedRgn); CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcR, srcR, idleR2); CopyMask(offPlayerMap, offMaskMap, offLoadMap, glideRct[0], glideRct[0], idleR1); CopyBits(offLoadMap, mainWndo^.portBits, tempR1, tempR1, srcCopy, combinedRgn); CopyBits(offLoadMap, mainWndo^.portBits, tempR2, tempR2, srcCopy, combinedRgn); end; DisposeRgn(combinedRgn); if (idleR1.left > 512) then begin SetRect(idleR1, 0, 0, 48, 20); OffsetRect(idleR1, -512 + Randomize(450), 130 + Randomize(70)); end; if (idleR2.left > 512) then begin SetRect(idleR2, 0, 0, 35, 15); OffsetRect(idleR2, -512 + Randomize(450), 130 + Randomize(70)); end; PenNormal; if (inColor) then case colorPoint of 0: begin frameR := wholeArea; RGBForeColor(rgbBlue); FrameRect(frameR); InsetRect(frameR, 1, 1); RGBForeColor(rgbViolet); FrameRect(frameR); InsetRect(frameR, 1, 1); RGBForeColor(rgbLtBlue); FrameRect(frameR); RGBForeColor(rgbBlack); end; 1: begin frameR := wholeArea; RGBForeColor(rgbLtBlue); FrameRect(frameR); InsetRect(frameR, 1, 1); RGBForeColor(rgbBlue); FrameRect(frameR); InsetRect(frameR, 1, 1); RGBForeColor(rgbViolet); FrameRect(frameR); RGBForeColor(rgbBlack); end; 2: begin frameR := wholeArea; RGBForeColor(rgbViolet); FrameRect(frameR); InsetRect(frameR, 1, 1); RGBForeColor(rgbLtBlue); FrameRect(frameR); InsetRect(frameR, 1, 1); RGBForeColor(rgbBlue); FrameRect(frameR); RGBForeColor(rgbBlack); end; end; loopDelay := loopDelay + 1; if (loopDelay > 5) then begin loopDelay := 0; colorPoint := colorPoint + 1; if (colorPoint > 2) then colorPoint := 0; end; repeat until (TickCount >= tickStamp + 2); tickStamp := TickCount; end; {=================================} procedure DropIdle; begin DisposeRgn(maskRgn); end; {=================================} function idleFilter (theDialog: DialogPtr; var theEvent: EventRecord; var itemHit: integer): boolean; var iconNum, iType: Integer; timeIs: LongInt; tempRect: Rect; iHand, icnHand: Handle; cicnHand: CIconHandle; begin idleFilter := FALSE; if ((theEvent.what = KeyDown) and (BitAnd(theEvent.message, CharCodeMask) = kReturnKey)) then begin itemHit := 1; idleFilter := TRUE; end; timeIs := TickCount; if (timeIs > timeWas + 90) then begin timeWas := TickCount; screenNum := screenNum + 1; if (screenNum > 3) then screenNum := 0; for iconNum := 2 to 10 do begin SpinBall; Delay(1, timeIs); SpinBall; Delay(1, timeIs); GetDItem(theDialog, iconNum, iType, iHand, tempRect); if (inColor) then begin cicnHand := GetCIcon(1226 + iconNum + (screenNum * 9)); if (cicnHand <> nil) then begin PlotCIcon(tempRect, cicnHand); DisposCIcon(cicnHand); end; end else begin icnHand := GetIcon(1226 + iconNum + (screenNum * 9)); if (icnHand <> nil) then PlotIcon(tempRect, icnHand); end; InitCursor; end; {end - for iconnum} end; {end - if (timeIs } end; {=================================} procedure DoAbout; const okayButton = 1; var savePort: GrafPtr; DType, itemHit: Integer; DItem: Handle; GetSelection: DialogPtr; tempRect: Rect; {----------------------------------} procedure RefreshIt; {Refresh the dialogs non-controls} begin SetPort(GetSelection); {Point to our dialog window} GetDItem(GetSelection, okayButton, DType, DItem, tempRect);{Get the item handle} PenSize(3, 3); {Change pen to draw thick default outline} InsetRect(tempRect, -4, -4); {Draw outside the button by 1 pixel} FrameRoundRect(tempRect, 16, 16); {Draw the outline} PenSize(1, 1); end; {----------------------------------} begin GetPort(savePort); GetSelection := GetNewDialog(228, nil, Pointer(-1));{Bring in the dialog resource} tempRect := GetSelection^.portRect; {Get window size, we will now center it} tempRect.Top := ((screenBits.Bounds.Bottom - screenBits.Bounds.Top) - (tempRect.Bottom - tempRect.Top)) div 2; tempRect.Left := ((screenBits.Bounds.Right - screenBits.Bounds.Left) - (tempRect.Right - tempRect.Left)) div 2; MoveWindow(GetSelection, tempRect.Left, tempRect.Top, TRUE);{Now move the window to the proper position} ShowWindow(GetSelection); {Open a dialog box} SelectWindow(GetSelection); {Lets see it} SetPort(GetSelection); {Prepare to add conditional text} RefreshIt; {Draw any Lists, lines, or rectangles} timeWas := TickCount; {Initialize the tick counter} screenNum := 0; {Initialize the set of icons displaying} repeat {Start of dialog handle loop} ModalDialog(@idleFilter, itemHit);{Wait until an item is hit} {End for this item selected} until (ItemHit = okayButton); {Handle dialog items until exit selected} SetPort(GrafPtr(savePort)); {Restore the previous grafport} DisposDialog(GetSelection); {Flush the dialog out of memory} end; {End of procedure} {=================================} procedure DoSoundSettings; const okayItem = 1; cancelItem = 2; soundOnItem = 3; musicOnItem = 4; incVolItem = 5; decVolItem = 6; iconItem = 7; volEqualsItem = 12; lineItem = 13; channel4Radio = 14; channel2Radio = 15; var wasPort: GrafPtr; itemT, itemHit, tempVolume, holdVolume: Integer; tempStr: Str255; itemH: Handle; theDlgPtr: DialogPtr; tempRect: Rect; leaveDlg, holdSound, holdMusic, thisSound, thisMusic, holdChannel: boolean; {----------------------------------} function FixedVolume (theVolume: Integer): Integer; begin case theVolume of 0: begin SetSoundVol(0); theVolume := 800; end; 1, 2: begin SetSoundVol(1); theVolume := 801; end; 3, 4: begin SetSoundVol(3); theVolume := 802; end; 5, 6: begin SetSoundVol(5); theVolume := 803; end; otherwise begin SetSoundVol(7); theVolume := 804; end; end; FixedVolume := theVolume; end; {----------------------------------} procedure RefreshIt; var offset, isVolume: Integer; cicnH: CIconHandle; iconH: Handle; begin SetPort(theDlgPtr); GetDItem(theDlgPtr, lineItem, itemT, itemH, tempRect); FillRect(tempRect, black); GetDItem(theDlgPtr, okayItem, itemT, itemH, tempRect); PenSize(3, 3); InsetRect(tempRect, -4, -4); FrameRoundRect(tempRect, 16, 16); PenSize(1, 1); GetSoundVol(isVolume); GetDItem(theDlgPtr, volEqualsItem, itemT, itemH, tempRect); NumToString(isVolume, tempStr); SetIText(itemH, tempStr); offset := FixedVolume(isVolume); GetDItem(theDlgPtr, iconItem, itemT, itemH, tempRect); if (inColor) then begin cicnH := GetCIcon(offset); if (cicnH <> nil) then begin PlotCIcon(tempRect, cicnH); ReleaseResource(Handle(iconH)); DisposCIcon(cicnH); end; end else begin iconH := GetIcon(offset); if (iconH <> nil) then begin PlotIcon(tempRect, iconH); ReleaseResource(iconH); end; end; end; {----------------------------------} begin FlushEvents(EveryEvent, 0); GetPort(wasPort); UseResFile(gliderResNum); GetSoundVol(holdVolume); holdSound := soundOn; holdMusic := musicOn; thisSound := soundOn; thisMusic := musicOn; holdChannel := is4Channel; theDlgPtr := GetNewDialog(rSoundDlgID, nil, Pointer(-1)); tempRect := theDlgPtr^.portRect; tempRect.Top := ((screenBits.Bounds.Bottom - screenBits.Bounds.Top) - (tempRect.Bottom - tempRect.Top)) div 2; tempRect.Left := ((screenBits.Bounds.Right - screenBits.Bounds.Left) - (tempRect.Right - tempRect.Left)) div 2; MoveWindow(theDlgPtr, tempRect.Left, tempRect.Top, TRUE);{Now move the window to the proper position} ShowWindow(theDlgPtr); SelectWindow(theDlgPtr); SetPort(theDlgPtr); GetDItem(theDlgPtr, soundOnItem, itemT, itemH, tempRect); if (soundOn) then SetCtlValue(ControlHandle(itemH), 1) else SetCtlValue(ControlHandle(itemH), 0); GetDItem(theDlgPtr, musicOnItem, itemT, itemH, tempRect); if (musicOn) then {set or hide Music On checkbox} SetCtlValue(ControlHandle(itemH), 1) else SetCtlValue(ControlHandle(itemH), 0); if (cantMusic) then HideDItem(theDlgPtr, musicOnItem); if (is4Channel) then {set radio buttons for 4/2 channel sound} GetDItem(theDlgPtr, channel4Radio, itemT, itemH, tempRect) else GetDItem(theDlgPtr, channel2Radio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 1); RefreshIt; leaveDlg := FALSE; repeat ModalDialog(nil, itemHit); GetDItem(theDlgPtr, itemHit, itemT, itemH, tempRect); if (ItemHit = okayItem) then {clicked on Okay button} begin leaveDlg := TRUE; GetSoundVol(tempVolume); soundOn := ((thisSound) and (tempVolume <> 0)); end; if (ItemHit = cancelItem) then {clicked on Cancle button} begin leaveDlg := TRUE; SetSoundVol(holdVolume); soundOn := holdSound; musicOn := holdMusic; is4Channel := holdChannel; end; if (ItemHit = soundOnItem) then begin soundOn := not soundOn; thisSound := not thisSound; GetDItem(theDlgPtr, soundOnItem, itemT, itemH, tempRect); if (soundOn) then SetCtlValue(ControlHandle(itemH), 1) else SetCtlValue(ControlHandle(itemH), 0); end; if (ItemHit = musicOnItem) then begin thisMusic := not thisMusic; musicOn := not musicOn; GetDItem(theDlgPtr, musicOnItem, itemT, itemH, tempRect); if (musicOn) then SetCtlValue(ControlHandle(itemH), 1) else SetCtlValue(ControlHandle(itemH), 0); end; if (ItemHit = incVolItem) then begin GetSoundVol(tempVolume); case tempVolume of 0: tempVolume := 1; 1, 2: tempVolume := 3; 3, 4: tempVolume := 5; otherwise tempVolume := 7; end; SetSoundVol(tempVolume); soundOn := ((thisSound) and (tempVolume <> 0)); GetDItem(theDlgPtr, soundOnItem, itemT, itemH, tempRect); if (soundOn) then SetCtlValue(ControlHandle(itemH), 1) else SetCtlValue(ControlHandle(itemH), 0); musicOn := ((thisMusic) and (tempVolume <> 0)); GetDItem(theDlgPtr, musicOnItem, itemT, itemH, tempRect); if (musicOn) then SetCtlValue(ControlHandle(itemH), 1) else SetCtlValue(ControlHandle(itemH), 0); RefreshIt; end; if (ItemHit = decVolItem) then begin GetSoundVol(tempVolume); case tempVolume of 1, 2: tempVolume := 0; 3, 4: tempVolume := 1; 5, 6: tempVolume := 3; 7: tempVolume := 5; otherwise tempVolume := 0; end; SetSoundVol(tempVolume); soundOn := ((thisSound) and (tempVolume <> 0)); GetDItem(theDlgPtr, soundOnItem, itemT, itemH, tempRect); if (soundOn) then SetCtlValue(ControlHandle(itemH), 1) else SetCtlValue(ControlHandle(itemH), 0); musicOn := ((thisMusic) and (tempVolume <> 0)); GetDItem(theDlgPtr, musicOnItem, itemT, itemH, tempRect); if (musicOn) then SetCtlValue(ControlHandle(itemH), 1) else SetCtlValue(ControlHandle(itemH), 0); RefreshIt; end; if (ItemHit = channel4Radio) then begin GetDItem(theDlgPtr, channel4Radio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 1); GetDItem(theDlgPtr, channel2Radio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 0); is4Channel := TRUE; end; if (ItemHit = channel2Radio) then begin GetDItem(theDlgPtr, channel2Radio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 1); GetDItem(theDlgPtr, channel4Radio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 0); is4Channel := FALSE; end; until leaveDlg; SetPort(GrafPtr(wasPort)); DisposDialog(theDlgPtr); end; {=================================} procedure DoCustomizeKeys; const okayItem = 1; cancelItem = 2; leftIcon = 3; rightIcon = 4; energyIcon = 5; bandIcon = 6; leftStat = 7; rightStat = 8; energyStat = 9; bandStat = 10; modeStat = 11; energyRadio = 12; bandRadio = 13; type string12 = string[12]; var wasPort: GrafPtr; itemT, itemHit, i, rawKey, rawChar: Integer; newLeftKey, newRightKey, newEnergyKey, newBandKey: Integer; theState, tempLong: LongInt; tempStr: Str255; itemH, keyHandle: Handle; theDlgPtr: DialogPtr; tempRect: Rect; newLeftName, newRightName, newEnergyName, newBandName: string[12]; leaveDlg, newButtonFires: Boolean; {------------------} procedure RefreshIt; begin SetPort(theDlgPtr); GetDItem(theDlgPtr, okayItem, itemT, itemH, tempRect);{Get the item handle} PenSize(3, 3); {Change pen to draw thick default outline} InsetRect(tempRect, -4, -4); {Draw outside the button by 1 pixel} FrameRoundRect(tempRect, 16, 16); {Draw the outline} PenNormal; end; {------------------} function ShowKeyName (rawKeyCode, rawCharCode: Integer): string12; begin if ((rawCharCode >= $21) and (rawCharCode <= $7A)) then begin if ((rawKeyCode >= $41) and (rawKeyCode <= $5C)) then tempStr := CONCAT(CHR(rawCharCode), ' keypad') else tempStr := CONCAT(CHR(rawCharCode), ' key'); end else case rawCharCode of $01: tempStr := 'home'; $03: tempStr := 'enter'; $04: tempStr := 'end'; $05: tempStr := 'help'; $08: tempStr := 'delete'; $09: tempStr := 'tab'; $0B: tempStr := 'page up'; $0C: tempStr := 'page down'; $0D: tempStr := 'return'; $10: case rawKeyCode of $60: tempStr := 'F5 key'; $61: tempStr := 'F6 key'; $62: tempStr := 'F7 key'; $63: tempStr := 'F3 key'; $64: tempStr := 'F8 key'; $65: tempStr := 'F9 key'; $67: tempStr := 'F11 key'; $69: tempStr := 'F13 key'; $6B: tempStr := 'F14 key'; $6D: tempStr := 'F10 key'; $6F: tempStr := 'F12 key'; $71: tempStr := 'F15 key'; $76: tempStr := 'F4 key'; $78: tempStr := 'F2 key'; $7A: tempStr := 'F1 key'; otherwise NumToString(rawKeyCode, tempStr); end; $1A: tempStr := 'clear'; $1B: if (rawKeyCode = $47) then tempStr := 'clear' else tempStr := 'escape'; $1C: tempStr := 'left arrow'; $1D: tempStr := 'right arrow'; $1E: tempStr := 'up arrow'; $1F: tempStr := 'down arrow'; $20: tempStr := 'space'; $7F: tempStr := 'del key'; otherwise tempStr := 'unknown'; end; ShowKeyName := tempStr; end; {------------------} begin FlushEvents(EveryEvent, 0); GetPort(wasPort); UseResFile(gliderResNum); theDlgPtr := GetNewDialog(rCustomKeysID, nil, Pointer(-1)); tempRect := theDlgPtr^.portRect; tempRect.Top := ((screenBits.Bounds.Bottom - screenBits.Bounds.Top) - (tempRect.Bottom - tempRect.Top)) div 2; tempRect.Left := ((screenBits.Bounds.Right - screenBits.Bounds.Left) - (tempRect.Right - tempRect.Left)) div 2; MoveWindow(theDlgPtr, tempRect.Left, tempRect.Top, TRUE);{Now move the window to the proper position} ShowWindow(theDlgPtr); SelectWindow(theDlgPtr); SetPort(theDlgPtr); newLeftKey := leftKey; newRightKey := rightKey; newEnergyKey := energyKey; newBandKey := bandKey; newButtonFires := buttonFires; newLeftName := leftName; newRightName := rightName; newEnergyName := energyName; newBandName := bandName; GetDItem(theDlgPtr, leftStat, itemT, itemH, tempRect); SetIText(itemH, newLeftName); GetDItem(theDlgPtr, rightStat, itemT, itemH, tempRect); SetIText(itemH, newRightName); GetDItem(theDlgPtr, energyStat, itemT, itemH, tempRect); SetIText(itemH, newEnergyName); GetDItem(theDlgPtr, bandStat, itemT, itemH, tempRect); SetIText(itemH, newBandName); if (newButtonFires) then GetDItem(theDlgPtr, bandRadio, itemT, itemH, tempRect) else GetDItem(theDlgPtr, energyRadio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 1); RefreshIt; leaveDlg := FALSE; repeat ModalDialog(nil, itemHit); GetDItem(theDlgPtr, itemHit, itemT, itemH, tempRect); if ((itemHit >= leftIcon) and (itemHit <= bandIcon)) then begin GetDItem(theDlgPtr, itemHit, itemT, itemH, tempRect); InvertRect(tempRect); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'The next key you strike will control this function.'); InvertRect(tempRect); repeat until not Button; FlushEvents(everyEvent, 0); repeat until GetNextEvent(keyDownMask, theEvent); rawKey := LoWord(BitAnd(KeyCodeMask, theEvent.message) div $FF); rawChar := LoWord(BitAnd(CharCodeMask, theEvent.message)); FlushEvents(everyEvent, 0); InvertRect(tempRect); GetDItem(theDlgPtr, itemHit, itemT, itemH, tempRect); InvertRect(tempRect); tempStr := ShowKeyName(rawKey, rawChar); GetDItem(theDlgPtr, itemHit + 4, itemT, itemH, tempRect); SetIText(itemH, tempStr); if (tempStr = 'tab') then begin SysBeep(3); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'The TAB key is reserved for pausing Glider.'); Delay(180, tempLong); case itemHit of leftIcon: tempStr := newLeftName; rightIcon: tempStr := newRightName; energyIcon: tempStr := newEnergyName; otherwise tempStr := newBandName; end; GetDItem(theDlgPtr, itemHit + 4, itemT, itemH, tempRect); SetIText(itemH, tempStr); end else case itemHit of leftIcon: begin newLeftKey := rawKey; newLeftName := COPY(tempStr, 1, 12); end; rightIcon: begin newRightKey := rawKey; newRightName := COPY(tempStr, 1, 12); end; energyIcon: begin newEnergyKey := rawKey; newEnergyName := COPY(tempStr, 1, 12); end; otherwise begin newBandKey := rawKey; newBandName := COPY(tempStr, 1, 12); end; end; GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Click on an icon to change its controlling key.'); end; if (itemHit = energyRadio) then begin newButtonFires := FALSE; GetDItem(theDlgPtr, energyRadio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 1); GetDItem(theDlgPtr, bandRadio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 0); end; if (itemHit = bandRadio) then begin newButtonFires := TRUE; GetDItem(theDlgPtr, bandRadio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 1); GetDItem(theDlgPtr, energyRadio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 0); end; if (itemHit = okayItem) then begin leaveDlg := TRUE; if ((newLeftKey = newRightKey) or (newLeftKey = newEnergyKey) or (newLeftKey = newBandKey)) then begin SysBeep(3); newLeftKey := leftKey; newLeftName := leftName; GetDItem(theDlgPtr, leftStat, itemT, itemH, tempRect); SetIText(itemH, newLeftName); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Your Left Key has been assigned to another function.'); Delay(180, tempLong); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Click on an icon to change its controlling key.'); leaveDlg := FALSE; end; if ((newRightKey = newEnergyKey) or (newRightKey = newBandKey)) then begin SysBeep(3); newRightKey := rightKey; newRightName := rightName; GetDItem(theDlgPtr, rightStat, itemT, itemH, tempRect); SetIText(itemH, newRightName); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Your Right Key has been assigned to another function.'); Delay(180, tempLong); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Click on an icon to change its controlling key.'); leaveDlg := FALSE; end; if (newEnergyKey = newBandKey) then begin SysBeep(3); newEnergyKey := energyKey; newEnergyName := energyName; GetDItem(theDlgPtr, energyStat, itemT, itemH, tempRect); SetIText(itemH, newEnergyName); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Your Energize Key has been assigned to another function.'); Delay(180, tempLong); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Click on an icon to change its controlling key.'); leaveDlg := FALSE; end; if (leaveDlg) then begin leftKey := newLeftKey; rightKey := newRightKey; energyKey := newEnergyKey; bandKey := newBandKey; buttonFires := newButtonFires; leftName := newLeftName; rightName := newRightName; energyName := newEnergyName; bandName := newBandName; end; end; if (ItemHit = cancelItem) then leaveDlg := TRUE; until leaveDlg; SetPort(GrafPtr(wasPort)); DisposDialog(theDlgPtr); end; {=================================} end. \ No newline at end of file diff --git a/Glider_405/Sources/G-Initialize.p b/Glider_405/Sources/G-Initialize.p new file mode 100755 index 0000000..a3836ee --- /dev/null +++ b/Glider_405/Sources/G-Initialize.p @@ -0,0 +1 @@ +unit Initialize; interface uses Balloons, Palettes, Globals, GlobalUtils, FileInNOut, IdleInput; procedure InitializeAll; procedure DoStartUp; {=================================} implementation {=================================} procedure InitializeAll; var i: Integer; ignoreStr: Str255; {------------------------} procedure InitToolBox; var ignore: Boolean; begin gliderResNum := CurResFile; SetApplLimit(Ptr(LongInt(GetApplLimit) - kStackSize)); MaxApplZone; MoreMasters; MoreMasters; MoreMasters; MoreMasters; MoreMasters; MoreMasters; MoreMasters; MoreMasters; MoreMasters; MoreMasters; MoreMasters; MoreMasters; InitGraf(@thePort); InitFonts; FlushEvents(everyEvent, 0); InitWindows; InitMenus; TEInit; InitDialogs(nil); ignore := EventAvail(EveryEvent, theEvent); inBackground := FALSE; end; {------------------------} procedure CheckOurEnvirons; const WNETrapNum = $60; unimplTrapNum = $9F; SoundBase = $0266; ASCBase = $0CC0; Color = 1; Monochrome = 0; GDTypeFlag = 1; kPointerBase = $3F2700 - $20; var thisWorld: SysEnvRec; tempRes: Handle; theDevice: GDHandle; initsPointer: Ptr; theResponse, initData: LongInt; sheSaid: Integer; hasINIT: Boolean; {-----------} function DepthAlert: Integer; var dummyInt: Integer; alertHandle: AlertTHndl; alertRect: Rect; begin UseResFile(gliderResNum); InitCursor; alertHandle := AlertTHndl(Get1Resource('ALRT', rDepthAlertID)); if (alertHandle <> nil) then begin HNoPurge(Handle(alertHandle)); alertRect := alertHandle^^.boundsRect; OffsetRect(alertRect, -alertRect.left, -alertRect.top); dummyInt := (screenBits.bounds.right - alertRect.right) div 2; OffsetRect(alertRect, dummyInt, 0); dummyInt := (screenBits.bounds.bottom - alertRect.bottom) div 3; OffsetRect(alertRect, 0, dummyInt); alertHandle^^.boundsRect := alertRect; HPurge(Handle(alertHandle)); end; dummyInt := Alert(rDepthAlertID, nil); DepthAlert := dummyInt; end; {-----------} function SetDepth (gd: GDHandle; newDepth, whichFlags, newFlags: Integer): Integer; inline $203C, $000A, $0013, $AAA2; {-----------} procedure ForceBlackAndWhite; begin with theDevice^^.gdPMap^^ do if (pixelSize <> 1) then if (cantSwitch) then {if we can't switch via software} begin GenericAlert(kErr2Or16Colors); {say, "Hey, set the Control Panel"} ExitToShell; end else begin {we can switch via software} theErr := SetDepth(theDevice, 1, GDTypeFlag, Color); inColor := FALSE; end; {end - we can switch via software} end; {-----------} procedure CheckAndSwitch; begin with theDevice^^.gdPMap^^ do if ((pixelSize <> 4) and (pixelSize <> 1)) then if (cantSwitch) then {if we can't switch via software} begin GenericAlert(kErr2Or16Colors); {say, "Hey, set the Control Panel"} ExitToShell; end else begin {we can switch via software} sheSaid := DepthAlert; {bring up monitor switch alert} case sheSaid of {what button did they click?} 1: {switch to 16 color} theErr := SetDepth(theDevice, 4, GDTypeFlag, Color); 2: {switch to B&W} begin theErr := SetDepth(theDevice, 1, GDTypeFlag, Color); inColor := FALSE; end; otherwise begin InitCursor; ExitToShell; end; end; end; {end - we can switch via software} end; {-----------} begin tempRes := Get1Resource('CURS', 128); if (tempRes <> nil) then begin HLock(tempRes); SetResInfo(tempRes, 128, 'oz'); if (ResError = WPrErr) or (ResError = FLckdErr) or (ResError = VLckdErr) then begin GenericAlert(kErrVolLocked); ExitToShell; end; ChangedResource(tempRes); if (ResError = WPrErr) or (ResError = FLckdErr) or (ResError = VLckdErr) then begin GenericAlert(kErrVolLocked); ExitToShell; end; WriteResource(tempRes); if (ResError = WPrErr) or (ResError = FLckdErr) or (ResError = VLckdErr) then begin GenericAlert(kErrVolLocked); ExitToShell; end; HUnlock(tempRes); ReleaseResource(tempRes); end else begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; rightOffset := (ScreenBits.bounds.right - 512) div 2; downOffset := (ScreenBits.bounds.bottom - 342) div 2; theErr := SysEnvirons(1, thisWorld); {Check on the set up of the Mac game is on } with thisWorld do begin if (machineType < envMacPlus) then {If less than a Mac 512KE (=1) then quit now!} begin GenericAlert(kErrMacPlusNeeded); ExitToShell; end; inhibitSound := FALSE; cantSwitch := (systemVersion < $0605); hasSys7 := (systemVersion >= $0700); areFlipping := (machineType = envMacPlus) or (machineType = envSE) or (machineType = 15); if (areFlipping) then begin hasINIT := TRUE; initsPointer := Pointer(kPointerBase + 1); initData := initsPointer^; if (initData <> $61) and (initData <> $48) then hasINIT := FALSE; initsPointer := Pointer(kPointerBase + 2); initData := initsPointer^; if (initData <> $6C) and (initData <> $6F) then hasINIT := FALSE; initsPointer := Pointer(kPointerBase + 3); initData := initsPointer^; if (initData <> $74) and (initData <> $6C) then hasINIT := FALSE; if ((not hasINIT) and (areFlipping)) then begin GenericAlert(kErrMissionINIT); areFlipping := FALSE; end; scoreIncrement := kFastScoreIncrement; end else scoreIncrement := kSlowScoreIncrement; herKeyboard := keyBoardType; cantColor := not hasColorQD; inColor := hasColorQD; if (inColor) then begin theDevice := GetMainDevice; if (theDevice = nil) then begin GenericAlert(kErrUnaccounted); ExitToShell; end; HLock(Handle(theDevice)); with theDevice^^.gdPMap^^ do begin wasDepth := pixelSize; GetKeys(theKeys); if (theKeys[kCommandKeyMap]) then ForceBlackAndWhite else CheckAndSwitch; if (pixelSize = 1) then inColor := FALSE; end; HUnlock(Handle(theDevice)); end; end; {end - with thisWorld} hasWNE := (NGetTrapAddress(WNETrapNum, ToolTrap) <> NGetTrapAddress(unimplTrapNum, toolTrap)); end; {------------------------} procedure LoadCursors; var count: Integer; tempByte: SignedByte; begin useColorCursor := inColor; UseResFile(gliderResNum); noCursor := GetCursor(128); ballList := acurHand(GetResource('acur', rAcurID)); if (ballList = nil) then begin GenericAlert(kErrLoadingRes); Exit(LoadCursors); end; tempByte := HGetState(Handle(ballList)); HLock(Handle(ballList)); with ballList^^ do begin for count := 1 to kCursCount do begin if (useColorCursor) then begin ballC[count] := GetCCursor(HiWord(LongInt(ball[count]))); if (ballC[count] = nil) then useColorCursor := FALSE; end; ball[count] := GetCursor(HiWord(LongInt(ball[count]))); if (ball[count] = nil) then begin GenericAlert(kErrLoadingRes); whichBall := -1; Exit(LoadCursors); end; end; whichBall := 0; end; HSetState(Handle(ballList), tempByte); end; {------------------------} procedure InitGlobalRects; begin SetRect(wholeArea, 0, 0, 512, 342); SetRect(fullArea, -rightOffset, -downOffset, 512 + rightOffset, 342 + downOffset); SetRect(nullRect, -500, -500, -500, -500); SetRect(smScoreRect, 224, 8, 296, 17); SetRect(lgScoreRect, 222, 4, 296, 21); wholeRgn := NewRgn; RectRgn(wholeRgn, wholeArea); MoveHHi(Handle(wholeRgn)); HLock(Handle(wholeRgn)); end; {------------------------} procedure SetUpColors; begin rgbBlack.red := 0; rgbBlack.green := 0; rgbBlack.blue := 0; rgbWhite.red := -1; rgbWhite.green := -1; rgbWhite.blue := -1; rgbYellow.red := -1; rgbYellow.green := -1; rgbYellow.blue := 0; rgbViolet.red := -1; rgbViolet.green := 0; rgbViolet.blue := -1; rgbRed.red := -1; rgbRed.green := 0; rgbRed.blue := 0; rgbLtBlue.red := 0; rgbLtBlue.green := -1; rgbLtBlue.blue := -1; rgbBrown.red := 22016; rgbBrown.green := 11421; rgbBrown.blue := 1316; rgbLtBrown.red := -28457; rgbLtBrown.green := 29024; rgbLtBrown.blue := 14900; rgbDkGray.red := 16384; rgbDkGray.green := 16384; rgbDkGray.blue := 16384; rgbBlue.red := 0; rgbBlue.green := 0; rgbBlue.blue := -1; rgbLtGreen.red := 7967; rgbLtGreen.green := -18503; rgbLtGreen.blue := 5140; end; {------------------------} procedure SetUpMainWndo; var thePict: PicHandle; tempRect: Rect; tempByte: SignedByte; begin {Init main window} mainWndo := nil; if (inColor) then {load the window template from resource} mainWndo := GetNewCWindow(rMainWndoID, nil, Pointer(-1)) else mainWndo := GetNewWindow(rMainWndoID, nil, WindowPtr(-1)); if (mainWndo = nil) then begin mainWndo := nil; GenericAlert(kErrNotEnoughMem); ExitToShell; end; {properly size and then show window} SizeWindow(GrafPtr(mainWndo), 512 + (2 * rightOffset), 342 + (2 * downOffset), FALSE); ShowWindow(mainWndo); SelectWindow(GrafPtr(mainWndo)); SetPort(GrafPtr(mainWndo)); {set up windows coordinate system} SetOrigin(-rightOffset, -downOffset); {fill black all around the border} SetRect(tempRect, -rightOffset, -downOffset, 512 + (2 * rightOffset), 0); FillRect(tempRect, black); SetRect(tempRect, -rightOffset, 342, 512 + (2 * rightOffset), 342 + downOffset); FillRect(tempRect, black); SetRect(tempRect, -rightOffset, 0, 0, 342); FillRect(tempRect, black); SetRect(tempRect, 512, 0, 512 + rightOffset, 342); FillRect(tempRect, black); if (inColor) then begin RGBForeColor(rgbBlack); RGBBackColor(rgbWhite); {assign palette} mainPalette := GetNewPalette(rMainWndoID); SetPalette(mainWndo, mainPalette, TRUE); {load side-bar PICTs} SetRect(tempRect, -64, 0, 0, 342); thePict := GetPicture(rSidePict1); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, tempRect); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; ReleaseResource(Handle(thePict)); end else begin TextFont(201); {This is to preload the fonts} DrawString('o'); {needed so that there is no } TextFont(200); {disk-access delay when they } DrawString('z'); {are needed in the game. } end; {load in other side-bar PICT} if (inColor) then begin SetRect(tempRect, 512, 0, 512 + 64, 342); thePict := GetPicture(rSidePict2); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, tempRect); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; ReleaseResource(Handle(thePict)); end; ClipRect(wholeArea); {load in splash PICT} if (inColor) then thePict := GetPicture(rColorIdleID) else thePict := GetPicture(rIdleID); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; ReleaseResource(Handle(thePict)); {$IFC DemoVersion} MoveTo(13, 113); TextFont(SystemFont); if (inColor) then begin ForeColor(redColor); TextMode(patOr); DrawString('DEMO VERSION'); ForeColor(blackColor); end else begin TextMode(patXOr); DrawString('DEMO VERSION'); end; {$ENDC} end; {------------------------} function NewBitMap (var theBitMap: BitMap; theRect: Rect): Ptr; begin SpinBall; with theBitMap, theRect do begin rowBytes := ((right - left + 15) div 16) * 2; baseAddr := NewPtr(rowBytes * (bottom - top)); bounds := theRect; if (MemError <> noErr) then begin GenericAlert(kErrNotEnoughMem); ExitToShell; end else NewBitMap := baseAddr; end; end; {------------------------} procedure SetUpBitMaps; var thePict: PicHandle; rawPointer: Ptr; tempRect: Rect; tempByte: SignedByte; begin {Init b&w Bitmaps} {Init offscreen virgin map} offVirginPort := GrafPtr(NewPtr(SizeOf(GrafPort))); OpenPort(offVirginPort); offVirginBits := NewBitMap(offVirginMap, wholeArea); SetPortBits(offVirginMap); ClipRect(wholeArea); EraseRect(offVirginMap.bounds); thePict := GetPicture(rIdleID); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; ReleaseResource(Handle(thePict)); {$IFC DemoVersion} MoveTo(13, 113); TextFont(SystemFont); TextMode(patXOr); DrawString('DEMO VERSION'); {$ENDC} SpinBall; {Init offscreen load map} if (areFlipping) then begin offLoadPort := GrafPtr(NewPtr(SizeOf(GrafPort))); OpenPort(offLoadPort); with offLoadMap, ScreenBits.bounds do begin rowBytes := ((right - left + 15) div 16) * 2; baseAddr := Pointer(kSecondaryAddr); bounds := ScreenBits.bounds; if (MemError <> noErr) then begin GenericAlert(kErrNotEnoughMem); ExitToShell; end else offLoadBits := baseAddr; end; SetPortBits(offLoadMap); ClipRect(ScreenBits.bounds); EraseRect(offLoadMap.bounds); end else begin offLoadPort := GrafPtr(NewPtr(SizeOf(GrafPort))); OpenPort(offLoadPort); offLoadBits := NewBitMap(offLoadMap, wholeArea); SetPortBits(offLoadMap); ClipRect(wholeArea); EraseRect(offLoadMap.bounds); end; {Init offscreen object map} offPlayerPort := GrafPtr(NewPtr(SizeOf(GrafPort))); OpenPort(offPlayerPort); offPlayerBits := NewBitMap(offPlayerMap, wholeArea); SetPortBits(offPlayerMap); ClipRect(wholeArea); EraseRect(offPlayerMap.bounds); {Init offscreen reserve map} SetRect(tempRect, 0, 0, 192, 116); offReservePort := GrafPtr(NewPtr(SizeOf(GrafPort))); OpenPort(offReservePort); offReserveBits := NewBitMap(offReserveMap, tempRect); SetPortBits(offReserveMap); ClipRect(offReserveMap.bounds); EraseRect(offReserveMap.bounds); end; {black and white set-up} {------------------------} procedure SetUpPixMaps; var thePict: PicHandle; sizeOfOff, offRowBytes: LongInt; tempRect: Rect; theDepth: Integer; tempByte: SignedByte; begin virginCPtr := @virginCPort; OpenCPort(virginCPtr); theDepth := 4; offRowBytes := ((((theDepth * (wholeArea.right - wholeArea.left)) + 15)) div 16) * 2; sizeOfOff := LONGINT(wholeArea.bottom - wholeArea.top) * offRowBytes; virginCBits := NewPtr(sizeOfOff); if (virginCPtr = nil) then begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; with virginCPtr^.portPixMap^^ do begin baseAddr := virginCBits; rowBytes := offRowBytes + $8000; bounds := wholeArea; end; RGBForeColor(rgbBlack); RGBBackColor(rgbWhite); EraseRect(thePort^.portRect); ClipRect(wholeArea); {load virgin ports PICT} SpinBall; thePict := GetPicture(rColorIdleID); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; ReleaseResource(Handle(thePict)); {$IFC DemoVersion} MoveTo(13, 113); TextFont(SystemFont); ForeColor(redColor); TextMode(patOr); DrawString('DEMO VERSION'); ForeColor(blackColor); {$ENDC} SpinBall; loadCPtr := @loadCPort; OpenCPort(loadCPtr); loadCBits := NewPtr(sizeOfOff); if (loadCBits = nil) then begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; with loadCPtr^.portPixMap^^ do begin baseAddr := loadCBits; rowBytes := offRowBytes + $8000; bounds := wholeArea; end; RGBForeColor(rgbBlack); RGBBackColor(rgbWhite); EraseRect(thePort^.portRect); ClipRect(wholeArea); objectCPtr := @objectCPort; OpenCPort(objectCPtr); objectCBits := NewPtr(sizeOfOff); if (objectCBits = nil) then begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; with objectCPtr^.portPixMap^^ do begin baseAddr := objectCBits; rowBytes := offRowBytes + $8000; bounds := wholeArea; end; RGBForeColor(rgbBlack); RGBBackColor(rgbWhite); EraseRect(thePort^.portRect); ClipRect(wholeArea); {Init offscreen reserve map} reserveCPtr := @reserveCPort; OpenCPort(reserveCPtr); SetRect(tempRect, 0, 0, 192, 116); offRowBytes := ((((theDepth * (tempRect.right - tempRect.left)) + 15)) div 16) * 2; sizeOfOff := LONGINT(tempRect.bottom - tempRect.top) * offRowBytes; reserveCBits := NewPtr(sizeOfOff); if (reserveCBits = nil) then begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; with reserveCPtr^.portPixMap^^ do begin baseAddr := reserveCBits; rowBytes := offRowBytes + $8000; bounds := tempRect; end; RGBForeColor(rgbBlack); RGBBackColor(rgbWhite); EraseRect(thePort^.portRect); ClipRect(thePort^.portRect); end; {------------------------} procedure SetUpOffMask; begin {Init offscreen mask map} offMaskPort := GrafPtr(NewPtr(SizeOf(GrafPort))); OpenPort(offMaskPort); offMaskBits := NewBitMap(offMaskMap, wholeArea); SetPortBits(offMaskMap); ClipRect(wholeArea); EraseRect(offMaskMap.bounds); end; {------------------------} procedure GetPrefs; type prefType = record theName: string[24]; houseName: string[32]; resName: string[32]; sndVolume: Integer; controlIs: Integer; leftIs, rightIs, energyIs, bandIs: Integer; musicIs, channel4Is, airVisIs, buttonIs, restoreIs: Boolean; leftNameIs, rightNameIs, energyNameIs, bandNameIs: string[12]; keyBoardIs: Integer; end; prefPtr = ^prefType; prefHand = ^prefPtr; pictDeepPt = ^Integer; pictDeepHn = ^pictDeepPt; var theirPrefs: prefHand; pictDeep: pictDeepHn; refNumber, tempVol: Integer; satisfactory: Boolean; {-----------------} procedure DefaultControls; begin leftKey := kDefaultLeftKey; rightKey := kDefaultRightKey; energyKey := kDefaultEnergyKey; bandKey := kDefaultBandKey; buttonFires := FALSE; leftName := kDefaultLeftName; rightName := kDefaultRightName; energyName := kDefaultEnergyName; bandName := kDefaultBandName; end; {-----------------} procedure Default; begin {$IFC DemoVersion} housesName := 'Demo House'; {$ELSEC} housesName := 'The House'; {$ENDC} playerName := 'Your name here...'; if (inColor) then resourceName := 'Color Art' else resourceName := 'B&W Art'; controlMethod := 3; CheckItem(GetMenu(mControls), controlMethod, TRUE); musicOn := TRUE; airVisible := FALSE; buttonFires := FALSE; restoreColor := TRUE; is4Channel := TRUE; DefaultControls; end; {-----------------} begin UseResFile(gliderResNum); theirPrefs := prefHand(NewHandle(SIZEOF(prefType))); if (theirPrefs = nil) then begin GenericAlert(kErrLoadingPrefs); Default; end else begin Handle(theirPrefs) := GetResource('Gprf', 128); if ((ResError = noErr) and (theirPrefs <> nil)) then begin HLock(Handle(theirPrefs)); with theirPrefs^^ do begin housesName := houseName; playerName := theName; resourceName := resName; SetSoundVol(sndVolume); controlMethod := controlIs; leftKey := leftIs; rightKey := rightIs; energyKey := energyIs; bandKey := bandIs; musicOn := musicIs; channel4Is := is4Channel; airVisible := airVisIs; buttonFires := buttonIs; restoreColor := restoreIs; leftName := leftNameIs; rightName := rightNameIs; energyName := energyNameIs; bandName := bandNameIs; if (keyBoardIs <> herKeyBoard) then begin GenericAlert(kErrNewKeyboard); DefaultControls; end; end; HUnlock(Handle(theirPrefs)); ReleaseResource(Handle(theirPrefs)); end else begin GenericAlert(kErrLoadingPrefs); Default; end; end; refNumber := OpenResFile(resourceName); {test to see if res legit} if (refNumber = -1) then begin if (ResError = resFNotFound) then {Hmmm. Maybe color depth has changed} begin if (inColor) then resourceName := 'Color Art' {Try the default color name} else resourceName := 'B&W Art'; {Or default B&W file name} refNumber := OpenResFile(resourceName); {test to see if res legit yet} if (refNumber = -1) then begin UseResFile(gliderResNum); {back to Gilder res file} GenericAlert(kErrGraphicsNotFound); {bitch about all this} if (not DoOpen(kArtType)) then begin GenericAlert(kErrExitSansGraphics); ExitToShell; end; refNumber := OpenResFile(resourceName); end; end else begin UseResFile(gliderResNum); {back to Gilder res file} GenericAlert(kErrGraphicsNotFound); {bitch about all this} if (not DoOpen(kArtType)) then begin GenericAlert(kErrExitSansGraphics); ExitToShell; end; refNumber := OpenResFile(resourceName); end; end; satisfactory := FALSE; {default to failure} repeat UseResFile(refNumber); {make sure we're current} pictDeep := pictDeepHn(NewHandle(SIZEOF(Integer))); if (pictDeep = nil) then {prepare for 'deep' resource} begin GenericAlert(kErrGraphicLoad); ExitToShell; end; Handle(pictDeep) := GetResource('deep', 128); if ((ResError = noErr) and (pictDeep <> nil)) then begin HLock(Handle(pictDeep)); if (inColor) then begin if (pictDeep^^ <> $0004) then {is it a 4-bit color file?} begin if (pictDeep <> nil) then begin HUnlock(Handle(pictDeep)); ReleaseResource(Handle(pictDeep)); pictDeep := nil; end; CloseResFile(refNumber); if (resourceName <> 'Color Art') then begin resourceName := 'Color Art'; refNumber := OpenResFile(resourceName);{lets try this one} end else begin GenericAlert(kErrGraphicsAre2Bit); {sorry, not 4-bit!} if (not DoOpen(kArtType)) then {last chance} begin GenericAlert(kErrExitSansGraphics); {you blew it - bye!} ExitToShell; end; refNumber := OpenResFile(resourceName);{okay, we'll try this one} end; end else satisfactory := TRUE; end {end - inColor} else {not inColor so...} begin {were in b&w mode} if (pictDeep^^ <> $0001) then begin if (pictDeep <> nil) then begin HUnlock(Handle(pictDeep)); ReleaseResource(Handle(pictDeep)); pictDeep := nil; end; CloseResFile(refNumber); if (resourceName <> 'B&W Art') then begin resourceName := 'B&W Art'; refNumber := OpenResFile(resourceName);{lets try this one} end else begin GenericAlert(kErrGraphicsAre16Bit); if (not DoOpen(kArtType)) then begin GenericAlert(kErrExitSansGraphics); ExitToShell; end; refNumber := OpenResFile(resourceName); end; end else satisfactory := TRUE; end; end {end - if ((ResError = noErr)...} else {there was an error} begin GenericAlert(kErrGraphicLoad); ExitToShell; end; if (pictDeep <> nil) then begin HUnlock(Handle(pictDeep)); ReleaseResource(Handle(pictDeep)); pictDeep := nil; end; until satisfactory; CloseResFile(refNumber); UseResFile(gliderResNum); GetSoundVol(tempVol); case tempVol of 0: SetSoundVol(0); 1, 2: SetSoundVol(1); 3, 4: SetSoundVol(3); 5, 6: SetSoundVol(5); otherwise SetSoundVol(7); end; if (tempVol = 0) then soundOn := FALSE else soundOn := not inhibitSound; end; {------------------------} procedure LoadPICTs; var wasPort: GrafPtr; thePict: PicHandle; refNumber: Integer; tempByte: SignedByte; begin refNumber := OpenResFile(resourceName); if (refNumber = -1) then begin UseResFile(gliderResNum); GenericAlert(kErrGraphicsNotFound); if (not DoOpen(kArtType)) then begin GenericAlert(kErrExitSansGraphics); ExitToShell; end; refNumber := OpenResFile(resourceName); if (refNumber = -1) then begin GenericAlert(kErrGraphicsNotFound); ExitToShell; end; end; SpinBall; GetPort(wasPort); if (inColor) then {load the objects up} SetPort(GrafPtr(objectCPtr)) else SetPort(offPlayerPort); UseResFile(refNumber); thePict := GetPicture(rObjectPictID); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; ReleaseResource(Handle(thePict)); SpinBall; SetPort(offMaskPort); UseResFile(refNumber); thePict := GetPicture(rMaskPictID); {load the masks up} if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; ReleaseResource(Handle(thePict)); SetPort(wasPort); CloseResFile(refNumber); UseResFile(gliderResNum); end; {------------------------} procedure SetUpMenus; var tempMenu: MenuHandle; i: Integer; {-------------------} begin {Init MENU bar} ClearMenuBar; tempMenu := GetMenu(mApple); if (tempMenu <> nil) then begin AddResMenu(tempMenu, 'DRVR'); InsertMenu(tempMenu, 0); end else begin GenericAlert(kErrUnknownAtInit); ExitToShell; end; tempMenu := GetMenu(mGame); if (tempMenu <> nil) then begin InsertMenu(tempMenu, 0); DisableItem(tempMenu, iEndGame); DisableItem(tempMenu, iSaveGame); DisableItem(tempMenu, iSaveGameAs); {$IFC DemoVersion} DisableItem(tempMenu, iLoadHouse); DisableItem(tempMenu, iLoadGame); {$ENDC} end else begin GenericAlert(kErrUnknownAtInit); ExitToShell; end; tempMenu := GetMenu(mOption); if (tempMenu <> nil) then InsertMenu(tempMenu, 0) else begin GenericAlert(kErrUnknownAtInit); ExitToShell; end; if (hasSys7) then {add a Help menu item} begin theErr := HMGetHelpMenuHandle(tempMenu); if (theErr = noErr) then if (tempMenu <> nil) then begin AppendMenu(tempMenu, 'Glider Help'); iGlidersHelp := CountMItems(tempMenu); end else begin tempMenu := GetMenu(mOption); AppendMenu(tempMenu, '(-'); AppendMenu(tempMenu, 'Help'); end else begin tempMenu := GetMenu(mOption); AppendMenu(tempMenu, '(-'); AppendMenu(tempMenu, 'Help'); end; end else begin AppendMenu(tempMenu, '(-'); AppendMenu(tempMenu, 'Help'); end; tempMenu := GetMenu(mControls); if (tempMenu <> nil) then InsertMenu(tempMenu, -1) else begin GenericAlert(kErrUnknownAtInit); ExitToShell; end; if (airVisible) then SetItem(GetMenu(mOption), iShowAir, 'Air is Visible') else SetItem(GetMenu(mOption), iShowAir, 'Air is Invisible'); if (restoreColor) then SetItem(GetMenu(mOption), iRestoreDeep, 'Depth Restore is On') else SetItem(GetMenu(mOption), iRestoreDeep, 'Depth Restore is Off'); if ((cantColor) or (cantSwitch)) then DisableItem(GetMenu(mOption), iRestoreDeep); CheckItem(GetMenu(mControls), controlMethod, TRUE); SetPort(GrafPtr(mainWndo)); HideMenuBar; ShowMenuBar; end; {------------------------} function PrepareSounds: Boolean; const lastSound = 28; var theSnd: Handle; i: Integer; itFailed: Boolean; begin itFailed := FALSE; cantMusic := FALSE; smsIsActive := FALSE; ErrorSound(@DoErrorSound); UseResFile(gliderResNum); for i := 1 to lastSound do begin theSnd := GetResource('SMSD', i); if ((theSnd <> nil) and (MemError = NoErr)) then begin MoveHHi(theSnd); HLock(theSnd); end else begin itFailed := TRUE; inhibitSound := TRUE; soundOn := FALSE; Leave; end; end; if (musicOn) then begin theSnd := GetResource('SMSD', kDuhDumSound); if ((theSnd <> nil) and (MemError = NoErr)) then begin MoveHHi(theSnd); HLock(theSnd); end else begin cantMusic := TRUE; musicOn := FALSE; GenericAlert(kErrBackgroundMusic); end; theSnd := GetResource('SMSD', kMusicSound); if ((theSnd <> nil) and (MemError = NoErr)) then begin MoveHHi(theSnd); HLock(theSnd); end else begin cantMusic := TRUE; musicOn := FALSE; GenericAlert(kErrBackgroundMusic); end; end; PrepareSounds := not itFailed; end; {------------------------} procedure InitAllOtherGlobalVars; var i, i2: Integer; begin doneFlag := FALSE; playing := FALSE; pausing := FALSE; refuseHigh := FALSE; mainScreenHidden := FALSE; binaryFlip := 0; GetDateTime(RandSeed); scoreList.rank := 20; for i := 0 to 7 do begin SpinBall; SetRect(tileRects[i], i * 64, 0, (i + 1) * 64, 342); end; SetRect(shadoRct[0], 256, 0, 304, 11); SetRect(shadoRct[1], 256, 12, 304, 23); SetRect(glideRct[0], 0, 0, 48, 20); {right forward} SetRect(glideRct[1], 0, 21, 48, 41); {right tipped} SetRect(glideRct[2], 0, 42, 48, 62); {left forward} SetRect(glideRct[3], 0, 63, 48, 83); {left tipped} SetRect(glideRct[4], 208, 0, 256, 20); {turn endpoint} SetRect(glideRct[5], 208, 21, 256, 41); { " } SetRect(glideRct[6], 208, 42, 256, 62); { " } SetRect(glideRct[7], 208, 63, 256, 83); { " } SetRect(glideRct[8], 208, 84, 256, 104); { " } SetRect(glideRct[9], 208, 105, 256, 125); {turn endpoint} SetRect(glideRct[10], 414, 53, 462, 73); {glider fading masks right} SetRect(glideRct[11], 414, 74, 462, 94); SetRect(glideRct[12], 414, 95, 462, 115); SetRect(glideRct[13], 414, 116, 462, 136); SetRect(glideRct[14], 414, 137, 462, 157); SetRect(glideRct[15], 414, 158, 462, 178); SetRect(glideRct[16], 414, 179, 462, 199); SetRect(glideRct[17], 463, 53, 511, 73); {glider fading masks left} SetRect(glideRct[18], 463, 74, 511, 94); SetRect(glideRct[19], 463, 95, 511, 115); SetRect(glideRct[20], 463, 116, 511, 136); SetRect(glideRct[21], 463, 137, 511, 157); SetRect(glideRct[22], 463, 158, 511, 178); SetRect(glideRct[23], 463, 179, 511, 199); SetRect(glideRct[24], 256, 24, 304, 60); {burning} SetRect(glideRct[25], 256, 61, 304, 97); SetRect(glideRct[26], 256, 98, 304, 134); SetRect(glideRct[27], 256, 135, 304, 171); for i2 := 0 to 3 do {column} for i := 0 to 3 do {row} SetRect(reserveRects[i2 * 4 + i + 1], i * 48, i2 * 29, 1 * 48 + 48, i2 * 29 + 29); SpinBall; nextPhase[1, 0] := 10; nextPhase[1, 1] := 11; nextPhase[1, 2] := 10; nextPhase[1, 3] := 11; nextPhase[1, 4] := 12; nextPhase[1, 5] := 11; nextPhase[1, 6] := 12; nextPhase[1, 7] := 13; nextPhase[1, 8] := 12; nextPhase[1, 9] := 13; nextPhase[1, 10] := 14; nextPhase[1, 11] := 13; nextPhase[1, 12] := 14; nextPhase[1, 13] := 15; nextPhase[1, 14] := 14; nextPhase[1, 15] := 15; nextPhase[1, 16] := 16; nextPhase[2, 0] := 16; nextPhase[2, 1] := 15; nextPhase[2, 2] := 16; nextPhase[2, 3] := 15; nextPhase[2, 4] := 14; nextPhase[2, 5] := 15; nextPhase[2, 6] := 14; nextPhase[2, 7] := 13; nextPhase[2, 8] := 14; nextPhase[2, 9] := 13; nextPhase[2, 10] := 12; nextPhase[2, 11] := 13; nextPhase[2, 12] := 12; nextPhase[2, 13] := 11; nextPhase[2, 14] := 12; nextPhase[2, 15] := 11; nextPhase[2, 16] := 10; nextPhase[3, 0] := 4; nextPhase[3, 1] := 4; nextPhase[3, 2] := 5; nextPhase[3, 3] := 5; nextPhase[3, 4] := 6; nextPhase[3, 5] := 6; nextPhase[3, 6] := 7; nextPhase[3, 7] := 7; nextPhase[3, 8] := 8; nextPhase[3, 9] := 8; nextPhase[3, 10] := 9; nextPhase[3, 11] := 9; nextPhase[4, 0] := 9; nextPhase[4, 1] := 9; nextPhase[4, 2] := 8; nextPhase[4, 3] := 8; nextPhase[4, 4] := 7; nextPhase[4, 5] := 7; nextPhase[4, 6] := 6; nextPhase[4, 7] := 6; nextPhase[4, 8] := 5; nextPhase[4, 9] := 5; nextPhase[4, 10] := 4; nextPhase[4, 11] := 4; SpinBall; SetRect(srcRect[celVnt], 0, 84, 48, 96); SetRect(srcRect[celDct], 0, 97, 48, 110); SetRect(srcRect[flrVnt], 0, 111, 48, 124); SetRect(srcRect[paper], 0, 125, 48, 146); SetRect(srcRect[toastr], 0, 147, 38, 174); SetRect(srcRect[60], 304, 84, 336, 115); {toast 1} SetRect(srcRect[61], 304, 116, 336, 147); {toast 2} SetRect(srcRect[62], 304, 148, 336, 179); {toast 3} SetRect(srcRect[63], 304, 180, 336, 211); {toast 4} SetRect(srcRect[64], 304, 212, 336, 243); {toast 5} SetRect(srcRect[65], 304, 244, 336, 275); {toast 6} SetRect(srcRect[teaKtl], 0, 175, 41, 205); SetRect(srcRect[lftFan], 0, 206, 35, 261); SetRect(srcRect[ritFan], 0, 262, 35, 316); SetRect(srcRect[table], 48, 23, 112, 45); SetRect(srcRect[shredr], 48, 46, 112, 70); SetRect(srcRect[books], 48, 71, 112, 126); SetRect(srcRect[clock], 112, 0, 144, 29); SetRect(srcRect[candle], 112, 30, 144, 51); SetRect(srcRect[rbrBnd], 112, 52, 144, 75); SetRect(srcRect[ball], 112, 76, 144, 108); SetRect(srcRect[fshBwl], 112, 109, 144, 138); SetRect(srcRect[66], 144, 109, 160, 125); {fish 1} SetRect(srcRect[67], 144, 126, 160, 142); {fish 2} SetRect(srcRect[68], 144, 143, 160, 159); {fish 3} SetRect(srcRect[69], 144, 160, 160, 176); {fish 4} SetRect(srcRect[grease], 112, 139, 144, 168); SetRect(srcRect[58], 112, 169, 144, 198); {grease falling 1} SetRect(srcRect[59], 112, 199, 144, 228); {grease fallen} SetRect(srcRect[litSwt], 142, 0, 160, 26); SetRect(srcRect[thermo], 144, 27, 162, 54); SetRect(srcRect[outlet], 160, 264, 192, 289); SetRect(srcRect[51], 160, 290, 192, 315); {outlet sparking 1} SetRect(srcRect[52], 160, 316, 192, 341); {outlet sparking 2} SetRect(srcRect[pwrSwt], 144, 82, 162, 108); SetRect(srcRect[guitar], 48, 127, 112, 297); SetRect(srcRect[drip], 192, 42, 208, 55); SetRect(srcRect[shelf], 192, 71, 208, 100); SetRect(srcRect[basket], 448, 270, 511, 341); SetRect(srcRect[paintg], 408, 53, 510, 146); SetRect(srcRect[battry], 144, 55, 160, 81); SetRect(srcRect[macTsh], 256, 209, 301, 267); SetRect(srcRect[upStar], 0, 0, 161, 254); SetRect(srcRect[dnStar], 0, 0, 161, 254); SetRect(srcRect[48], 144, 189, 160, 201); {candle flame} SetRect(srcRect[49], 144, 202, 160, 214); {candle flame} SetRect(srcRect[50], 144, 215, 160, 227); {candle flame} SetRect(srcRect[53], 192, 0, 208, 13); {drip} SetRect(srcRect[54], 192, 14, 208, 27); {drip} SetRect(srcRect[55], 192, 28, 208, 41); {drip} SetRect(srcRect[56], 192, 42, 208, 55); {drip} SetRect(srcRect[57], 192, 56, 208, 70); {drip} SpinBall; SetRect(animateRct[0, -1], 304, 0, 368, 22); {crushed dart} SetRect(animateRct[0, 0], 48, 0, 112, 22); {dart...} SetRect(animateRct[0, 1], 48, 0, 112, 22); SetRect(animateRct[0, 2], 48, 0, 112, 22); SetRect(animateRct[0, 3], 48, 0, 112, 22); SetRect(animateRct[0, 4], 48, 0, 112, 22); SetRect(animateRct[0, 5], 48, 0, 112, 22); SetRect(animateRct[0, 6], 48, 0, 112, 22); SetRect(animateRct[0, 7], 48, 0, 112, 22); SetRect(animateRct[1, -1], 304, 276, 336, 308); {crushed 'copter} SetRect(animateRct[1, 0], 160, 0, 192, 32); {'copter...} SetRect(animateRct[1, 1], 160, 33, 192, 65); SetRect(animateRct[1, 2], 160, 66, 192, 98); SetRect(animateRct[1, 3], 160, 99, 192, 131); SetRect(animateRct[1, 4], 160, 132, 192, 164); SetRect(animateRct[1, 5], 160, 165, 192, 197); SetRect(animateRct[1, 6], 160, 198, 192, 230); SetRect(animateRct[1, 7], 160, 231, 192, 263); SetRect(animateRct[2, -1], 304, 309, 336, 341); {popped balloon} SetRect(animateRct[2, 0], 112, 229, 144, 261); {balloon...} SetRect(animateRct[2, 1], 112, 229, 144, 261); SetRect(animateRct[2, 2], 112, 262, 144, 294); SetRect(animateRct[2, 3], 112, 262, 144, 294); SetRect(animateRct[2, 4], 112, 295, 144, 327); SetRect(animateRct[2, 5], 112, 295, 144, 327); SetRect(animateRct[2, 6], 112, 262, 144, 294); SetRect(animateRct[2, 7], 112, 262, 144, 294); SetRect(bandRct[0], 192, 155, 208, 162); SetRect(bandRct[1], 192, 163, 208, 170); SetRect(bandRct[2], 192, 171, 208, 178); end; {------------------------} begin InitToolbox; CheckOurEnvirons; LoadCursors; for i := 0 to 32 do SpinBall; InitGlobalRects; for i := 0 to 32 do SpinBall; if (inColor) then SetUpColors; for i := 0 to 32 do SpinBall; SetUpMainWndo; for i := 0 to 32 do SpinBall; if (inColor) then SetUpPixMaps else SetUpBitMaps; for i := 0 to 32 do SpinBall; SetUpOffMask; for i := 0 to 32 do SpinBall; GetSoundVol(wasSndVolume); for i := 0 to 32 do SpinBall; theErr := GetVol(@ignoreStr, houseVolNum); for i := 0 to 32 do SpinBall; GetPrefs; for i := 0 to 32 do SpinBall; if (not GetHouse) then begin GenericAlert(kErrLoadingDfltHouse); ExitToShell; end; defaultHouse := housesName; for i := 0 to 32 do SpinBall; LoadPICTs; for i := 0 to 32 do SpinBall; SetUpMenus; for i := 0 to 32 do SpinBall; if (not PrepareSounds) then GenericAlert(kErrNoSounds); if (inhibitSound) then DisableItem(GetMenu(mOption), iSound); for i := 0 to 32 do SpinBall; InitAllOtherGlobalVars; InitCursor; end; {=================================} procedure DoStartUp; var cancelIt: Boolean; theMessage, numDocs, thisDoc, ignore: Integer; docInfo: AppFile; begin CountAppFiles(theMessage, numDocs); if (theMessage = AppPrint) then begin GenericAlert(kErrNothingToPrint); ExitToShell; end; if (numDocs <> 0) then begin GetAppFiles(1, docInfo); with docInfo do begin if (fType = 'GLgm') then begin {$IFC DemoVersion} GenericAlert(kErrDemoRefuseHouse); {$ELSEC} gameName := fName; gameVolNum := vRefNum; if (not GetGame) then begin Exit(DoStartUp); end; EnableItem(GetMenu(mGame), iSaveGame); {$ENDC} end {if fType = 'GLgm'} else {if fType <> 'GLgm'} if (fType = 'GLhs') then begin {$IFC DemoVersion} GenericAlert(kErrDemoRefuseHouse); {$ELSEC} houseVolNum := vRefNum; housesName := fName; demoMode := Randomize(lastDemo) + 1; HideMenuBar; StartNewGame; {$ENDC} end else GenericAlert(kErrStartUpWrongType); ClrAppFiles(1); end; {with docInfo do} end; {if (numDocs <> 0) then} end; {=================================} end. \ No newline at end of file diff --git a/Glider_405/Sources/G-PlayActive.p b/Glider_405/Sources/G-PlayActive.p new file mode 100755 index 0000000..8b2eb28 --- /dev/null +++ b/Glider_405/Sources/G-PlayActive.p @@ -0,0 +1 @@ +unit PlayActive; interface uses SMS, Palettes, Globals, GlobalUtils, FileInNOut, PlayUtils, PlaySetUp; procedure Coordinate; var timeIs: LongInt; hotRect: Rect; sliding: Boolean; {=================================} implementation {=================================} procedure CenterMouse; const MBState = $172; MTemp = $828; RawMouse = $82C; Mouse = $830; CrsrNew = $8CE; CrsrCouple = $8CF; Couple = $FF; Uncouple = $00; var center: Point; lowGlob: Integer; lowMem: Ptr; pointPtr: ^Point; begin SetPt(center, 256, 171); lowMem := Pointer(rawMouse); pointPtr := @lowMem^; pointPtr^ := center; lowMem := Pointer(MTemp); pointPtr := @lowMem^; pointPtr^ := center; lowMem := Pointer(CrsrNew); lowMem^ := $FFFF; end; {=================================} procedure IncInt (var i: integer); inline $205F, {MOVEA.W (A7)+, A0 } $5250; {ADDQ.W #$1, (A0) } {=================================} procedure IncLong (var l: longint); inline $205F, {MOVEA.L (A7)+, A0 } $5290; {ADDQ.L #$1, (A0) } {=================================} procedure FloatTheScore (whatPoints: Integer); var tempStr: Str255; begin with floatPoints do begin if (out) then begin if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, whereR, whereR, srcCopy, wholeRgn) else CopyBits(offVirginMap, mainWndo^.portBits, whereR, whereR, srcCopy, wholeRgn); if (areFlipping) then CopyBits(offVirginMap, offLoadMap, whereR, whereR, srcCopy, wholeRgn); end; out := TRUE; whereR := theGlider.destRect; if (inColor) then whereR.top := whereR.bottom else whereR.top := whereR.top - 30; whereR.bottom := whereR.top + 12; NumToString(whatPoints, tempStr); saysWhat := tempStr; SetPort(GrafPtr(mainWndo)); if (inColor) then begin PenNormal; TextFont(16); TextSize(12); MoveTo(whereR.left, whereR.bottom - 2); RGBForeColor(rgbYellow); PenMode(srcOr); DrawString(saysWhat); PenNormal; RGBForeColor(rgbBlack); tickStamp := TickCount + 120; SetPort(GrafPtr(virginCPtr)) end else begin TextFont(201); TextMode(patBic); MoveTo(whereR.left, whereR.bottom - 2); DrawString(tempStr); TextFont(200); TextMode(patOr); MoveTo(whereR.left, whereR.bottom - 2); DrawString(tempStr); tickStamp := TickCount + 120; PenNormal; SetPort(offVirginPort); end; if (areFlipping) then begin SetPort(offLoadPort); TextFont(201); TextMode(patBic); MoveTo(whereR.left, whereR.bottom - 2); DrawString(tempStr); TextFont(200); TextMode(patOr); MoveTo(whereR.left, whereR.bottom - 2); DrawString(tempStr); tickStamp := TickCount + 120; PenNormal; SetPort(offVirginPort); end; end; end; {=================================} procedure Collision (whatKind, who: Integer); var tempStr: Str255; tempRect, srcR, destReserve: Rect; tempInt: Integer; begin case (whatKind) of ignoreIt: ; crashIt: begin lifeNormal := FALSE; with theGlider do begin DoTheSound(1); mode := fadingOut; destRect.top := destRect.bottom - 20; if (isForward) then srcNum := 0 else srcNum := 2; end; end; liftIt: if (not airOut) then liftAmount := -7; dropIt: if (not airOut) then liftAmount := 7; moveIt: begin DoTheSound(16); Transport(eventKind[who, 1]); hotRect := nullRect; {don't die in rest of SearchRects} end; turnItLeft: begin shiftAmount := -7; if (lifeNormal) then with theGlider do if (isRight) then begin lifeNormal := FALSE; theGlider.mode := turnRt2Lf; end; end; turnItRight: begin shiftAmount := 7; if (lifeNormal) then with theGlider do if (not isRight) then begin lifeNormal := FALSE; theGlider.mode := turnLf2Rt; end; end; burnIt: begin liftAmount := -7; if ((lifeNormal) and (theGlider.destRect.bottom > eventKind[who, 1])) then with theGlider do begin DoTheSound(8); lifeNormal := FALSE; if (isRight) then phase := 1; mode := burning; timeStamp := TickCount + 300; destRect.top := destRect.bottom - 36; end; end; awardIt: {clock} if (eventKind[who, 1] <> 0) then begin DoTheSound(5); StartScoreRolling; suppScore := suppScore + eventKind[who, 1]; FloatTheScore(eventKind[who, 1]); eventKind[who, 1] := 0; thisHouse.theRooms[roomAt].theObjects[who].amount := 0; destReserve := eventRect[who]; OffsetRect(destReserve, -destReserve.left, -destReserve.top); OffsetRect(destReserve, reserveRects[who].left, reserveRects[who].top); if (not lightsOut) then if (inColor) then begin CopyBits(BitMapPtr(reserveCPtr^.portPixMap^)^, BitMapPtr(virginCPtr^.portPixMap^)^, destReserve, eventRect[who], srcCopy, nil); CopyBits(BitMapPtr(reserveCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, destReserve, eventRect[who], srcCopy, nil); CopyBits(BitMapPtr(reserveCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, destReserve, eventRect[who], srcCopy, wholeRgn); end else begin CopyBits(offReserveMap, offVirginMap, destReserve, eventRect[who], srcCopy, nil); CopyBits(offReserveMap, offLoadMap, destReserve, eventRect[who], srcCopy, nil); CopyBits(offReserveMap, mainWndo^.portBits, destReserve, eventRect[who], srcCopy, wholeRgn); end; end; extraIt: {folded piece of paper} if (eventKind[who, 1] <> 0) then begin DoTheSound(10); StartScoreRolling; suppScore := suppScore + eventKind[who, 1]; FloatTheScore(eventKind[who, 1]); eventKind[who, 1] := 0; thisHouse.theRooms[roomAt].theObjects[who].amount := 0; IncInt(mortals); if (mortals <= 4) then begin SetRect(tempRect, 507, 5, 542, 20); OffsetRect(tempRect, -37 * (mortals - 1), 0); SetRect(srcR, 0, 318, 35, 333); if (inColor) then begin CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, srcR, srcR, tempRect); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, tempRect, tempRect, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, tempRect, tempRect, srcCopy, wholeRgn); end else begin CopyMask(offPlayerMap, offMaskMap, offVirginMap, srcR, srcR, tempRect); CopyBits(offVirginMap, offLoadMap, tempRect, tempRect, srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, wholeRgn); end; if (mortals = 4) then begin PenNormal; SetRect(tempRect, 384, 5, 396, 20); PaintRect(tempRect); MoveTo(tempRect.left, tempRect.bottom - 2); TextFont(16); TextSize(12); NumToString(mortals - 1, tempStr); if (inColor) then begin RGBForeColor(rgbRed); PenMode(srcOr); DrawString(tempStr); PenNormal; RGBForeColor(rgbBlack); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, tempRect, tempRect, srcCopy, nil); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, tempRect, tempRect, srcCopy, wholeRgn); end else begin TextMode(patXOr); DrawString(tempStr); PenNormal; CopyBits(offVirginMap, offLoadMap, tempRect, tempRect, srcCopy, nil); CopyBits(offVirginMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, wholeRgn); end; end; end else begin PenNormal; SetRect(tempRect, 384, 5, 396, 20); PaintRect(tempRect); MoveTo(tempRect.left, tempRect.bottom - 2); TextFont(16); TextSize(12); NumToString(mortals - 1, tempStr); if (inColor) then begin RGBForeColor(rgbRed); PenMode(srcOr); DrawString(tempStr); PenNormal; RGBForeColor(rgbBlack); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, tempRect, tempRect, srcCopy, nil); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, tempRect, tempRect, srcCopy, wholeRgn); end else begin TextMode(patXOr); DrawString(tempStr); PenNormal; CopyBits(offVirginMap, offLoadMap, tempRect, tempRect, srcCopy, nil); CopyBits(offVirginMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, wholeRgn); end; end; destReserve := eventRect[who]; OffsetRect(destReserve, -destReserve.left, -destReserve.top); OffsetRect(destReserve, reserveRects[who].left, reserveRects[who].top); if (not lightsOut) then if (inColor) then begin CopyBits(BitMapPtr(reserveCPtr^.portPixMap^)^, BitMapPtr(virginCPtr^.portPixMap^)^, destReserve, eventRect[who], srcCopy, nil); CopyBits(BitMapPtr(reserveCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, destReserve, eventRect[who], srcCopy, nil); CopyBits(BitMapPtr(reserveCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, destReserve, eventRect[who], srcCopy, wholeRgn); end else begin CopyBits(offReserveMap, offVirginMap, destReserve, eventRect[who], srcCopy, nil); CopyBits(offReserveMap, offLoadMap, destReserve, eventRect[who], srcCopy, nil); CopyBits(offReserveMap, mainWndo^.portBits, destReserve, eventRect[who], srcCopy, wholeRgn); end; end; spillIt: {grease upright} begin eventRect[who].left := eventRect[who].right; eventRect[who].right := eventRect[who].right; eventRect[who].top := eventRect[who].bottom - 5; eventKind[who, 0] := ignoreIt; {signal to the cycleOb loop that a spill has occurred} thisHouse.theRooms[roomAt].theObjects[who].isOn := FALSE; end; slideIt: {grease spilt} begin with theGlider do begin tempInt := eventRect[who].top - touchRect.bottom + 1; destRect.top := destRect.top + tempInt; destRect.bottom := destRect.bottom + tempInt; touchRect.top := touchRect.top + tempInt; touchRect.bottom := touchRect.bottom + tempInt; end; sliding := TRUE; end; bandIt: {rubber bands} if (eventKind[who, 1] <> 0) then begin DoTheSound(12); theGlider.bands := theGlider.bands + eventKind[who, 1]; FloatTheScore(eventKind[who, 1]); eventKind[who, 1] := 0; thisHouse.theRooms[roomAt].theObjects[who].amount := 0; PopTokenBand; UpdateBandNumbers; destReserve := eventRect[who]; OffsetRect(destReserve, -destReserve.left, -destReserve.top); OffsetRect(destReserve, reserveRects[who].left, reserveRects[who].top); if (not lightsOut) then if (inColor) then begin CopyBits(BitMapPtr(reserveCPtr^.portPixMap^)^, BitMapPtr(virginCPtr^.portPixMap^)^, destReserve, eventRect[who], srcCopy, nil); CopyBits(BitMapPtr(reserveCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, destReserve, eventRect[who], srcCopy, nil); CopyBits(BitMapPtr(reserveCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, destReserve, eventRect[who], srcCopy, wholeRgn); end else begin CopyBits(offReserveMap, offVirginMap, destReserve, eventRect[who], srcCopy, nil); CopyBits(offReserveMap, offLoadMap, destReserve, eventRect[who], srcCopy, nil); CopyBits(offReserveMap, mainWndo^.portBits, destReserve, eventRect[who], srcCopy, wholeRgn); end; end; energizeIt: {battery} if (eventKind[who, 1] <> 0) then begin DoTheSound(9); theGlider.energy := theGlider.energy + eventKind[who, 1]; FloatTheScore(eventKind[who, 1]); eventKind[who, 1] := 0; thisHouse.theRooms[roomAt].theObjects[who].amount := 0; PopTokenBattery; UpdateBatteryEnergy; destReserve := eventRect[who]; OffsetRect(destReserve, -destReserve.left, -destReserve.top); OffsetRect(destReserve, reserveRects[who].left, reserveRects[who].top); if (not lightsOut) then if (inColor) then begin CopyBits(BitMapPtr(reserveCPtr^.portPixMap^)^, BitMapPtr(virginCPtr^.portPixMap^)^, destReserve, eventRect[who], srcCopy, nil); CopyBits(BitMapPtr(reserveCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, destReserve, eventRect[who], srcCopy, nil); CopyBits(BitMapPtr(reserveCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, destReserve, eventRect[who], srcCopy, wholeRgn); end else begin CopyBits(offReserveMap, offVirginMap, destReserve, eventRect[who], srcCopy, nil); CopyBits(offReserveMap, offLoadMap, destReserve, eventRect[who], srcCopy, nil); CopyBits(offReserveMap, mainWndo^.portBits, destReserve, eventRect[who], srcCopy, wholeRgn); end; end; trickIt: {good move!} if (eventKind[who, 1] <> 0) then begin DoTheSound(kWhistleSound); StartScoreRolling; suppScore := suppScore + eventKind[who, 1]; FloatTheScore(eventKind[who, 1]); eventKind[who, 1] := 0; end; lightIt: if (lightsOut) then begin DoTheSound(18); lightsOut := FALSE; thisHouse.theRooms[roomAt].conditionCode := 0; LoadABackground(thisHouse.theRooms[roomAt].backPictID); ArrangeTiles; DrawAllObjects; DrawHeadline; if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, wholeRgn); end else begin CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, wholeRgn); end; end; airOnIt: if (airOut) then begin DoTheSound(3); airOut := FALSE; end; zapIt: if (eventKind[who, 1] <> 0) then begin lifeNormal := FALSE; DoTheSound(24); with theGlider do begin mode := fadingOut; destRect.top := destRect.bottom - 20; if (isForward) then srcNum := 0 else srcNum := 2; end; end; toggleIt: if (eventKind[who, 2] < TickCount) then begin DoTheSound(18); tempInt := eventKind[who, 1]; with thisHouse.theRooms[roomAt].theObjects[tempInt] do begin isOn := not isOn; case objectIs of lftFan: if (eventKind[tempInt, 0] = ignoreIt) then begin DoTheSound(3); eventKind[tempInt, 0] := turnItLeft; end else eventKind[tempInt, 0] := ignoreIt; ritFan: if (eventKind[tempInt, 0] = ignoreIt) then begin DoTheSound(3); eventKind[tempInt, 0] := turnItRight; end else eventKind[tempInt, 0] := ignoreIt; shredr: if (eventKind[tempInt, 0] = ignoreIt) then eventKind[tempInt, 0] := shredIt else eventKind[tempInt, 0] := ignoreIt; otherwise end; {case} end; {with} eventKind[who, 2] := TickCount + 90; end; playIt: if (eventKind[who, 1] < TickCount) then begin DoTheSound(15); eventKind[who, 1] := TickCount + 120; end; ascendIt: begin lifeNormal := FALSE; theGlider.mode := ascending; UpAFlight(eventKind[who, 1]); hotRect := nullRect; {don't die in rest of SearchRects} end; descendIt: begin lifeNormal := FALSE; theGlider.mode := descending; DownAFlight(eventKind[who, 1]); hotRect := nullRect; {don't die in rest of SearchRects} end; shredIt: begin lifeNormal := FALSE; with theGlider do begin mode := shredding; destRect.top := eventRect[who].bottom; destRect.bottom := destRect.top; destRect.left := eventRect[who].left + 12; destRect.right := destRect.left + 48; shadoDest.left := destRect.left; shadoDest.right := destRect.right; phase := 0; end; end; steamIt: begin liftAmount := -7; shiftAmount := -7; end; otherwise end; {case} end; {=================================} procedure SearchRects; var index, outside: Integer; tempRect: Rect; {----------------} function RectLap (rect1, rect2: Rect): Boolean; var dumRect: Rect; begin RectLap := FALSE; if (rect1.right < rect2.left) then Exit(RectLap); if (rect2.right < rect2.left) then Exit(RectLap); if (rect1.bottom < rect2.top) then Exit(RectLap); if (rect2.bottom < rect2.top) then Exit(RectLap); RectLap := SectRect(rect1, rect2, dumRect); end; {----------------} procedure BiteIt; begin with theGlider do begin DoTheSound(1); lifeNormal := FALSE; mode := fadingOut; destRect.top := destRect.bottom - 20; if (isForward) then srcNum := 0 else srcNum := 2; end; end; {----------------} procedure GetItLegal; begin {do a bump sound here} with theGlider do begin with destRect do begin left := left + outside; right := right + outside; end; with shadoDest do begin left := left + outside; right := right + outside; end; with touchRect do begin left := left + outside; right := right + outside; end; end; end; {----------------} begin with theGlider do begin hotRect := touchRect; {get 'hot rect'} if (rightIsOpen) then {check right edge} begin if (destRect.left > 500) then begin AdvanceARoom; Exit(SearchRects); end end else if (destRect.right > 512) then begin outside := 512 - destRect.right; GetItLegal; end; if (leftIsOpen) then {check left edge} begin if (destRect.right < 12) then begin RetreatARoom; Exit(SearchRects); end; end else if (destRect.left < 0) then begin outside := -destRect.left; GetItLegal; end; if (destRect.bottom > kFloorLimit) then {check floor} BiteIt; end; {---with theGlider do---} shiftAmount := 0; for index := 1 to nObjects do if (RectLap(eventRect[index], hotRect)) then Collision(eventKind[index, 0], index); if (nAnimates <> 0) then for index := 1 to nAnimates do if (RectLap(theAnimates[index].destRect, hotRect)) then begin BiteIt; Leave; end; end; {=================================} procedure HandleBand; var index: Integer; tempRect: Rect; {----------------} function RectLap (rect1, rect2: Rect): Boolean; var dumRect: Rect; begin RectLap := FALSE; if (rect1.right < rect2.left) then Exit(RectLap); if (rect2.right < rect2.left) then Exit(RectLap); if (rect1.bottom < rect2.top) then Exit(RectLap); if (rect2.bottom < rect2.top) then Exit(RectLap); RectLap := SectRect(rect1, rect2, dumRect); end; {----------------} begin with theBand do begin if ((whole.left > 512) or (whole.left < -16)) then bandBorne := FALSE; IncInt(phase); if (phase > 2) then phase := 0; whole := dest; with dest do begin left := left + velocity; right := right + velocity; end; if (velocity > 0) then whole.right := whole.right + velocity else whole.left := whole.left + velocity; if (nAnimates > 0) then for index := 1 to nAnimates do with theAnimates[index] do if (vertOff <> 12) then if (RectLap(destRect, dest)) then begin case kind of 0: DoTheSound(6); 1: DoTheSound(6); 2: DoTheSound(19); otherwise end; phase := -1; StartScoreRolling; suppScore := suppScore + 100 * (3 - kind); horiOff := 0; vertOff := 12; end; end; {with} end; {=================================} procedure GetInput; const holdKey = 1; dropKey = 2; absMouse = 3; relMouse = 4; var pull: Integer; thePt: Point; dest: Rect; {--------------------} procedure PushIt (howFast: Integer); begin with theGlider do if (energy > 0) then begin energy := energy - 1; DoTheSound(26); UpdateBatteryEnergy; if (energy = 0) then begin SetRect(dest, 308, 5, 335, 20); FillRect(dest, black); if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, dest, dest, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, dest, dest, srcCopy, wholeRgn) end else begin CopyBits(offVirginMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn); CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, wholeRgn); end; end; forVel := howFast; end; end; {--------------------} procedure FireBand; begin with theGlider do if (bands > 0) then begin DoTheSound(11); bands := bands - 1; UpdateBandNumbers; if (bands = 0) then begin SetRect(dest, 346, 5, 368, 20); FillRect(dest, black); if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, dest, dest, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, dest, dest, srcCopy, wholeRgn); end else begin CopyBits(offVirginMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn); CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, wholeRgn); end; end; bandBorne := TRUE; with theBand do begin dest.top := destRect.top + 6; dest.bottom := dest.top + 7; if (isRight) then begin dest.left := destRect.right; velocity := 16; end else begin dest.left := destRect.left - 16; velocity := -16; end; dest.right := dest.left + 16; whole := dest; old := dest; end; end; end; {--------------------} begin with theGlider do begin case controlMethod of holdKey: begin if (theKeys[leftKey]) then if (isRight) then begin isForward := FALSE; srcNum := 1; forVel := -kMaxThrust; end else begin isForward := TRUE; srcNum := 2; forVel := -kMaxThrust; end else if (theKeys[rightKey]) then if (isRight) then begin isForward := TRUE; srcNum := 0; forVel := kMaxThrust; end else begin isForward := FALSE; srcNum := 3; forVel := kMaxThrust; end else {no key of import down} begin if (isRight) then begin isForward := TRUE; srcNum := 0; forVel := 0; end else begin isForward := TRUE; srcNum := 2; forVel := 0; end; end; if (theKeys[bandKey] and (not bandBorne)) then {fire rubber bands} FireBand; if (theKeys[energyKey]) then begin if (((isRight) and (isForward)) or ((not isRight) and (not isForward))) then PushIt(16) else PushIt(-16); end; end; dropKey: begin if (((isRight) and (isForward)) or ((not isRight) and (not isForward))) then forVel := kMaxThrust else forVel := -kMaxThrust; if (theKeys[leftKey]) then if (isRight) then begin isForward := FALSE; srcNum := 1; forVel := -kMaxThrust; end else begin isForward := TRUE; srcNum := 2; forVel := -kMaxThrust; end else if (theKeys[rightKey]) then if (isRight) then begin isForward := TRUE; srcNum := 0; forVel := kMaxThrust; end else begin isForward := FALSE; srcNum := 3; forVel := kMaxThrust; end; if (theKeys[bandKey] and (not bandBorne)) then {fire rubber bands} FireBand; if (theKeys[energyKey]) then begin if (((isRight) and (isForward)) or ((not isRight) and (not isForward))) then PushIt(16) else PushIt(-16); end; end; {end - dropKey} absMouse: begin if ((theKeys[bandKey]) and (not bandBorne)) then FireBand; GetMouse(thePt); HorizonMouse; pull := (thePt.h - 256) div 32; if (pull > kMaxThrust) then pull := kMaxThrust else if (pull < -kMaxThrust) then pull := -kMaxThrust; forVel := pull; if (isRight) then if (forVel < 0) then begin isForward := FALSE; srcNum := 1; if (theKeys[energyKey]) then PushIt(-16); if (button) then begin if (not buttonFires) then PushIt(-16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end else begin isForward := TRUE; srcNum := 0; if (theKeys[energyKey]) then PushIt(16); if (button) then begin if (not buttonFires) then PushIt(16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end else begin if (forVel < 0) then begin isForward := TRUE; srcNum := 2; if (theKeys[energyKey]) then PushIt(-16); if (button) then begin if (not buttonFires) then PushIt(-16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end else begin isForward := FALSE; srcNum := 3; if (theKeys[energyKey]) then PushIt(16); if (button) then begin if (not buttonFires) then PushIt(16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end; end; end; {end - absMouse} relMouse: begin if (theKeys[bandKey] and (not bandBorne)) then {fire rubber bands} FireBand; GetMouse(thePt); forVel := (thePt.h - 256); if (forVel > kMaxThrust) then forVel := kMaxThrust else if (forVel < -kMaxThrust) then forVel := -kMaxThrust; CenterMouse; if (isRight) then if (forVel < 0) then begin isForward := FALSE; srcNum := 1; if (theKeys[energyKey]) then PushIt(-16); if (button) then begin if (not buttonFires) then PushIt(-16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end else begin isForward := TRUE; srcNum := 0; if (theKeys[energyKey]) then PushIt(16); if (button) then begin if (not buttonFires) then PushIt(16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end else begin if (forVel < 0) then begin isForward := TRUE; srcNum := 2; if (theKeys[energyKey]) then PushIt(-16); if (button) then begin if (not buttonFires) then PushIt(-16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end else begin isForward := FALSE; srcNum := 3; if (theKeys[energyKey]) then PushIt(16); if (button) then begin if (not buttonFires) then PushIt(16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end; end; end; {end - relMouse} otherwise end; {case} end; {with theGlider} end; {=================================} procedure MoveGlider; begin if (windowOpen) then {randomly move glider} begin liftAmount := liftAmount + Randomize(11) - 5; shiftAmount := shiftAmount + Randomize(11) - 5; end; with theGlider do begin liftAmount := liftAmount + 1; {add gravity} if (sliding) then begin liftAmount := 0; {zero out lift} sliding := FALSE; end else begin {vertical offset of glider} destRect.top := destRect.top + liftAmount; destRect.bottom := destRect.bottom + liftAmount; touchRect.top := touchRect.top + liftAmount; touchRect.bottom := touchRect.bottom + liftAmount; end; forVel := forVel + shiftAmount; {horizontal offset of glider} destRect.left := destRect.left + forVel; destRect.right := destRect.right + forVel; touchRect.left := destRect.left + 10; {touch rect is inset from dest} touchRect.right := destRect.right - 10; shadoDest.left := destRect.left; {shadow has same l. & r. as dest} shadoDest.right := destRect.right; end; end; {=================================} procedure MoveAnimates; var index: Integer; tempRect: Rect; {----------------} function RectLap (rect1, rect2: Rect): Boolean; var dumRect: Rect; begin RectLap := FALSE; if (rect1.right < rect2.left) then Exit(RectLap); if (rect2.right < rect2.left) then Exit(RectLap); if (rect1.bottom < rect2.top) then Exit(RectLap); if (rect2.bottom < rect2.top) then Exit(RectLap); RectLap := SectRect(rect1, rect2, dumRect); end; {----------------} begin for index := 1 to nAnimates do with theAnimates[index] do begin if (unSeen) then begin if (TickCount > tickStamp) then begin ResetAnimate(-1, index); unSeen := FALSE; end; end else begin if (phase > -1) then begin IncInt(phase); if (phase > 7) then phase := 0; end; wholeRect := destRect; with destRect do begin case kind of 0: begin left := left + horiOff; right := right + horiOff; top := top + vertOff; bottom := bottom + vertOff; wholeRect.left := wholeRect.left + horiOff; wholeRect.bottom := wholeRect.bottom + vertOff; end; 1: begin left := left + horiOff; right := right + horiOff; top := top + vertOff; bottom := bottom + vertOff; wholeRect.left := wholeRect.left + horiOff; wholeRect.bottom := wholeRect.bottom + vertOff; end; 2: begin top := top + vertOff; bottom := bottom + vertOff; if (vertOff > 0) then wholeRect.bottom := wholeRect.bottom + vertOff else wholeRect.top := wholeRect.top + vertOff; end; otherwise end; {case kind of} end; {with destRect} if (not unseen) then if (not RectLap(wholeRect, wholeArea)) then begin tickStamp := TickCount + delay; destRect := nullRect; wholeRect := nullRect; unSeen := TRUE; end; end; {if NOT (unSeen)} end; {with / for} end; {=================================} procedure MoveCycleObs; var index, diff: Integer; begin for index := 1 to nCycleObs do with cycleObjects[index] do case kindIs of candle: begin IncLong(position); if (position > 50) then position := 48; end; grease: begin if (eventKind[tiedTo, 0] = ignoreIt) then begin DoTheSound(14); eventKind[tiedTo, 0] := slideIt; reset := 1; end else if ((reset <> 0) and (reset <> 999)) then begin reset := reset + 1; if (reset > 4) then begin velocity := velocity + 1; eventRect[tiedTo].right := eventRect[tiedTo].right + 1; if (velocity > position) then reset := 999; end else begin if (reset < 3) then accel := 58 else accel := 59; end; end; end; outlet: begin if (accel = 25) then begin if (TickCount > position) then begin accel := binaryFlip + 51; {go into zap mode} position := TickCount; eventKind[tiedTo, 1] := 1; end; end else begin if (TickCount > (position + 60)) then begin accel := 25; {stop zapping} position := TickCount + reset; eventKind[tiedTo, 1] := 0; end else begin DoTheSound(24); {zapping} accel := binaryFlip + 51; end; end; end; drip: begin if (phase < 57) then begin if (binaryFlip <> 0) then begin IncInt(phase); if (phase = 57) then position := position + 160; end; end else begin velocity := velocity + accel; position := position + velocity; if (position > reset) then begin DoTheSound(7); velocity := 0; position := holdRect.bottom * 32; if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, eventRect[tiedTo], eventRect[tiedTo], srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, eventRect[tiedTo], eventRect[tiedTo], srcCopy, wholeRgn); end else begin CopyBits(offVirginMap, offLoadMap, eventRect[tiedTo], eventRect[tiedTo], srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, eventRect[tiedTo], eventRect[tiedTo], srcCopy, wholeRgn); end; eventRect[tiedTo] := holdRect; phase := 53; end; wholeRect := eventRect[tiedTo]; with eventRect[tiedTo] do begin diff := LoWord(BSR(position, 5)) - bottom; bottom := bottom + diff; top := top + diff; end; wholeRect.bottom := wholeRect.bottom + diff end; {else } end; {drip} toastr: if (phase <> 0) then begin if (binaryFlip = 0) then begin phase := phase + 1; if (phase > 65) then phase := 60; end; velocity := velocity + accel; position := position + velocity; if (position > reset) then begin DoTheSound(22); velocity := -velocity; position := reset; reset := TickCount + thisHouse.theRooms[roomAt].theObjects[tiedTo].extra; phase := 0; end; wholeRect := eventRect[tiedTo]; with eventRect[tiedTo] do begin diff := LoWord(BSR(position, 5)) - bottom; bottom := bottom + diff; top := top + diff; end; if (diff > 0) then wholeRect.bottom := wholeRect.bottom + diff else wholeRect.top := wholeRect.top + diff; end else begin if (TickCount > reset) then begin DoTheSound(23); reset := position; phase := 60; end; end; {toastr} ball: begin velocity := velocity + accel; position := position + velocity; if (position > reset) then begin DoTheSound(4); velocity := -velocity; position := reset; end; wholeRect := eventRect[tiedTo]; with eventRect[tiedTo] do begin diff := LoWord(BSR(position, 5)) - bottom; bottom := bottom + diff; top := top + diff; end; if (diff > 0) then wholeRect.bottom := wholeRect.bottom + diff else wholeRect.top := wholeRect.top + diff; end; {ball} fshBwl: if (phase <> 0) then begin if ((velocity > -16) and (velocity < 16)) then phase := 69 else begin if (velocity < 0) then phase := 66 else phase := 68; end; velocity := velocity + accel; position := position + velocity; if (position > reset) then begin DoTheSound(7); velocity := -velocity; position := reset; reset := TickCount + thisHouse.theRooms[roomAt].theObjects[tiedTo].extra; phase := 0; end; wholeRect := eventRect[tiedTo]; with eventRect[tiedTo] do begin diff := LoWord(BSR(position, 5)) - bottom; bottom := bottom + diff; top := top + diff; end; if (diff > 0) then wholeRect.bottom := wholeRect.bottom + diff else wholeRect.top := wholeRect.top + diff; end else begin if (TickCount > reset) then begin DoTheSound(7); reset := position; phase := 66; end; end; {fish bowl} teaKtl: begin if (TickCount > reset) then begin eventKind[tiedTo, 0] := steamIt; if (phase = 0) then DoTheSound(25); phase := phase + 1; if (phase > 10) then begin phase := 0; eventKind[tiedTo, 0] := ignoreIt; reset := TickCount + position; end; end; end; otherwise end; {case / with / index} end; {=================================} procedure MonitorStorm; begin with theLightning do begin if (whatPhase = 0) then begin if (TickCount > whatTime) then whatPhase := 1; end else if (whatPhase > 3) then begin whatPhase := 0; whichBolt := Randomize(3) + 1; whatTime := TickCount + Randomize(300); DoTheSound(17); end else whatPhase := whatPhase + 1; end; end; {=================================} procedure DrawFlipScene; var index, tempInt: Integer; tempRect, tempSmRect: Rect; begin if (mainScreenHidden) then begin if (hasWindow) then if (theLightning.whatPhase <> 0) then with theLightning do begin if (whatPhase = 4) then begin SetPort(mainWndo); SetClip(windowRgn); PenNormal; FillRgn(windowRgn, black); ClipRect(wholeArea); SetPort(offLoadPort); SetClip(windowRgn); FillRgn(windowRgn, black); ClipRect(wholeArea); SetPort(offVirginPort); end else begin SetPort(mainWndo); SetClip(windowRgn); PenNormal; PenSize(2, 2); PenMode(patXOr); MoveTo(theBolts[whichBolt, 0, 0], theBolts[whichBolt, 0, 1]); for index := 1 to 7 do begin LineTo(theBolts[whichBolt, index, 0], theBolts[whichBolt, index, 1]); Move(0, 2); end; ClipRect(wholeArea); SetPort(offVirginPort); end; end; {-----pop masks on-----} if (hasMirror) then with theGlider do begin tempSmRect := destRect; tempSmRect.left := tempSmRect.left - 16; tempSmRect.right := tempSmRect.right - 16; tempSmRect.top := tempSmRect.top - 32; tempSmRect.bottom := tempSmRect.bottom - 32; SetPort(mainWndo); SetClip(mirrorRgn); CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, glideRct[srcNum], glideRct[srcNum], tempSmRect); ClipRect(wholeArea); SetPort(offVirginPort); end; if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do begin case kindIs of candle: CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, srcRect[position], srcRect[position], wholeRect); outlet: CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, srcRect[accel], srcRect[accel], wholeRect); grease: begin CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, srcRect[accel], srcRect[accel], wholeRect); SetPort(offLoadPort); PenNormal; PenSize(2, 2); MoveTo(velocity - 2, wholeRect.bottom - 2); if (velocity > wholeRect.right + 1) then Line(2, 0); PenNormal; SetPort(offVirginPort); PenNormal; PenSize(2, 2); MoveTo(velocity - 2, wholeRect.bottom - 2); if (velocity > wholeRect.right + 1) then Line(2, 0); PenNormal; end; ball: CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, srcRect[kindIs], srcRect[kindIs], eventRect[tiedTo]); drip: CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, srcRect[phase], srcRect[phase], eventRect[tiedTo]); toastr: if (phase <> 0) then begin SetPort(mainWndo); SetClip(toastRgn); CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, srcRect[phase], srcRect[phase], eventRect[tiedTo]); ClipRect(wholeArea); SetPort(offVirginPort); end; fshBwl: if (phase <> 0) then CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, srcRect[phase], srcRect[phase], eventRect[tiedTo]) else CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, srcRect[69], srcRect[69], eventRect[tiedTo]); otherwise end; {case} end; with theGlider do begin if (isRight) then CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, shadoRct[0], shadoRct[0], shadoDest) else CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, shadoRct[1], shadoRct[1], shadoDest); if (lifeNormal) then CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, glideRct[srcNum], glideRct[srcNum], destRect) else case mode of fadingIn, fadingOut: begin tempInt := nextPhase[mode, phase]; if (not isRight) then tempInt := tempInt + 7; CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, glideRct[srcNum], glideRct[tempInt], destRect); end; turnLf2Rt, turnRt2Lf: begin tempInt := nextPhase[mode, phase]; CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, glideRct[tempInt], glideRct[tempInt], destRect); end; burning, ascending, descending: CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, glideRct[srcNum], glideRct[srcNum], destRect); shredding: begin SetRect(tempRect, 256, 208 - (destRect.bottom - destRect.top), 304, 208); CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, tempRect, tempRect, destRect); end; otherwise end; {case} end; if (nAnimates > 0) then for index := 1 to nAnimates do with theAnimates[index] do CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, animateRct[kind, phase], animateRct[kind, phase], destRect); if (bandBorne) then with theBand do CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, bandRct[phase], bandRct[phase], dest); with (floatPoints) do if ((out) and (tickCount > tickStamp)) then begin out := FALSE; CopyBits(offVirginMap, offLoadMap, whereR, whereR, srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, whereR, whereR, srcCopy, wholeRgn); end; {-----flip to 'other' page-----} mainScreenHidden := not mainScreenHidden; SetPage(mainScreenHidden); {-----restore 'other' page-----} if (hasMirror) then with theGlider do begin tempSmRect := oldRect; tempSmRect.left := tempSmRect.left - 16; tempSmRect.right := tempSmRect.right - 16; tempSmRect.top := tempSmRect.top - 32; tempSmRect.bottom := tempSmRect.bottom - 32; CopyBits(offVirginMap, offLoadMap, tempSmRect, tempSmRect, srcCopy, wholeRgn); end; with theGlider do begin CopyBits(offVirginMap, offLoadMap, oldRect, oldRect, srcCopy, wholeRgn); CopyBits(offVirginMap, offLoadMap, oldShado, oldShado, srcCopy, wholeRgn); oldRect := destRect; oldShado := shadoDest; end; if (nAnimates > 0) then for index := 1 to nAnimates do with theAnimates[index] do begin CopyBits(offVirginMap, offLoadMap, oldRect, oldRect, srcCopy, nil); oldRect := destRect; end; if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do begin CopyBits(offVirginMap, offLoadMap, oldRect, oldRect, srcCopy, nil); oldRect := wholeRect; end; if (bandBorne) then with theBand do begin CopyBits(offVirginMap, offLoadMap, old, old, srcCopy, nil); old := dest; end; end else {main screen is NOT hidden (is visible)} begin if (hasWindow) then if (theLightning.whatPhase <> 0) then with theLightning do begin if (whatPhase = 4) then begin SetPort(mainWndo); SetClip(windowRgn); PenNormal; FillRgn(windowRgn, black); ClipRect(wholeArea); SetPort(offLoadPort); SetClip(windowRgn); FillRgn(windowRgn, black); ClipRect(wholeArea); SetPort(offVirginPort); end else begin SetPort(offLoadPort); SetClip(windowRgn); PenNormal; PenSize(2, 2); PenMode(patXOr); MoveTo(theBolts[whichBolt, 0, 0], theBolts[whichBolt, 0, 1]); for index := 1 to 7 do begin LineTo(theBolts[whichBolt, index, 0], theBolts[whichBolt, index, 1]); Move(0, 2); end; ClipRect(wholeArea); SetPort(offVirginPort); end; end; {-----pop masks on-----} if (hasMirror) then with theGlider do begin tempSmRect := destRect; tempSmRect.left := tempSmRect.left - 16; tempSmRect.right := tempSmRect.right - 16; tempSmRect.top := tempSmRect.top - 32; tempSmRect.bottom := tempSmRect.bottom - 32; SetPort(offLoadPort); SetClip(mirrorRgn); CopyMask(offPlayerMap, offMaskMap, offLoadMap, glideRct[srcNum], glideRct[srcNum], tempSmRect); ClipRect(wholeArea); SetPort(offVirginPort); end; if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do begin case kindIs of candle: CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[position], srcRect[position], wholeRect); outlet: CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[accel], srcRect[accel], wholeRect); grease: begin CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[accel], srcRect[accel], wholeRect); SetPort(mainWndo); PenNormal; PenSize(2, 2); MoveTo(velocity - 2, wholeRect.bottom - 2); if (velocity > wholeRect.right + 1) then Line(2, 0); PenNormal; SetPort(offVirginPort); PenNormal; PenSize(2, 2); MoveTo(velocity - 2, wholeRect.bottom - 2); if (velocity > wholeRect.right + 1) then Line(2, 0); PenNormal; end; ball: CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[kindIs], srcRect[kindIs], eventRect[tiedTo]); drip: CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[phase], srcRect[phase], eventRect[tiedTo]); toastr: if (phase <> 0) then begin SetPort(offLoadPort); SetClip(toastRgn); CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[phase], srcRect[phase], eventRect[tiedTo]); ClipRect(wholeArea); SetPort(offVirginPort); end; fshBwl: if (phase <> 0) then CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[phase], srcRect[phase], eventRect[tiedTo]) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[69], srcRect[69], eventRect[tiedTo]); otherwise end; {case} end; with theGlider do begin if (isRight) then CopyMask(offPlayerMap, offMaskMap, offLoadMap, shadoRct[0], shadoRct[0], shadoDest) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, shadoRct[1], shadoRct[1], shadoDest); if (lifeNormal) then CopyMask(offPlayerMap, offMaskMap, offLoadMap, glideRct[srcNum], glideRct[srcNum], destRect) else case mode of fadingIn, fadingOut: begin tempInt := nextPhase[mode, phase]; if (not isRight) then tempInt := tempInt + 7; CopyMask(offPlayerMap, offMaskMap, offLoadMap, glideRct[srcNum], glideRct[tempInt], destRect); end; turnLf2Rt, turnRt2Lf: begin tempInt := nextPhase[mode, phase]; CopyMask(offPlayerMap, offMaskMap, offLoadMap, glideRct[tempInt], glideRct[tempInt], destRect); end; burning, ascending, descending: CopyMask(offPlayerMap, offMaskMap, offLoadMap, glideRct[srcNum], glideRct[srcNum], destRect); shredding: begin SetRect(tempRect, 256, 208 - (destRect.bottom - destRect.top), 304, 208); CopyMask(offPlayerMap, offMaskMap, offLoadMap, tempRect, tempRect, destRect); end; otherwise end; {case} end; if (nAnimates > 0) then for index := 1 to nAnimates do with theAnimates[index] do CopyMask(offPlayerMap, offMaskMap, offLoadMap, animateRct[kind, phase], animateRct[kind, phase], destRect); if (bandBorne) then with theBand do CopyMask(offPlayerMap, offMaskMap, offLoadMap, bandRct[phase], bandRct[phase], dest); with (floatPoints) do if ((out) and (tickCount > tickStamp)) then begin out := FALSE; CopyBits(offVirginMap, offLoadMap, whereR, whereR, srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, whereR, whereR, srcCopy, wholeRgn); end; {-----flip to 'other' page-----} mainScreenHidden := not mainScreenHidden; SetPage(mainScreenHidden); {-----restore 'other' page-----} if (hasMirror) then with theGlider do begin tempSmRect := oldRect; tempSmRect.left := tempSmRect.left - 16; tempSmRect.right := tempSmRect.right - 16; tempSmRect.top := tempSmRect.top - 32; tempSmRect.bottom := tempSmRect.bottom - 32; CopyBits(offVirginMap, mainWndo^.portBits, tempSmRect, tempSmRect, srcCopy, wholeRgn); end; with theGlider do begin CopyBits(offVirginMap, mainWndo^.portBits, oldRect, oldRect, srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, oldShado, oldShado, srcCopy, wholeRgn); oldRect := destRect; oldShado := shadoDest; end; if (nAnimates > 0) then for index := 1 to nAnimates do with theAnimates[index] do begin CopyBits(offVirginMap, mainWndo^.portBits, oldRect, oldRect, srcCopy, nil); oldRect := destRect; end; if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do begin CopyBits(offVirginMap, mainWndo^.portBits, oldRect, oldRect, srcCopy, nil); oldRect := wholeRect; end; if (bandBorne) then with theBand do begin CopyBits(offVirginMap, mainWndo^.portBits, old, old, srcCopy, nil); old := dest; end; end; end; {=================================} procedure DrawScene; var index, tempInt: Integer; tempRect, tempSmRect: Rect; begin if (hasWindow) then if (theLightning.whatPhase <> 0) then with theLightning do begin SetPort(mainWndo); SetClip(windowRgn); PenNormal; if (whatPhase = 4) then FillRgn(windowRgn, black) else begin PenSize(2, 2); PenMode(patXOr); MoveTo(theBolts[whichBolt, 0, 0], theBolts[whichBolt, 0, 1]); for index := 1 to 7 do begin LineTo(theBolts[whichBolt, index, 0], theBolts[whichBolt, index, 1]); Move(0, 2); end; end; ClipRect(wholeArea); SetPort(offVirginPort); end; if (hasMirror) then begin tempRect := theGlider.oldRect; tempRect.left := tempRect.left - 16; tempRect.right := tempRect.right - 16; tempRect.top := tempRect.top - 32; tempRect.bottom := tempRect.bottom - 32; CopyBits(offVirginMap, offLoadMap, tempRect, tempRect, srcCopy, mirrorRgn); end; with theGlider do begin UnionRect(destRect, oldRect, wholeRect); UnionRect(shadoDest, oldShado, wholeShado); CopyBits(offVirginMap, offLoadMap, oldRect, oldRect, srcCopy, wholeRgn); CopyBits(offVirginMap, offLoadMap, oldShado, oldShado, srcCopy, wholeRgn); oldRect := destRect; oldShado := shadoDest; end; if (nAnimates > 0) then for index := 1 to nAnimates do with theAnimates[index] do CopyBits(offVirginMap, offLoadMap, oldRect, oldRect, srcCopy, nil); if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do CopyBits(offVirginMap, offLoadMap, oldRect, oldRect, srcCopy, nil); if (bandBorne) then with theBand do CopyBits(offVirginMap, offLoadMap, old, old, srcCopy, nil); {-----pop masks on-----} if (hasMirror) then with theGlider do begin tempSmRect := destRect; tempSmRect.left := tempSmRect.left - 16; tempSmRect.right := tempSmRect.right - 16; tempSmRect.top := tempSmRect.top - 32; tempSmRect.bottom := tempSmRect.bottom - 32; SetPort(offLoadPort); SetClip(mirrorRgn); CopyMask(offPlayerMap, offMaskMap, offLoadMap, glideRct[srcNum], glideRct[srcNum], tempSmRect); ClipRect(wholeArea); SetPort(offVirginPort); UnionRect(tempRect, tempSmRect, tempRect); end; if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do begin case kindIs of candle: CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[position], srcRect[position], wholeRect); outlet, grease: CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[accel], srcRect[accel], wholeRect); ball: CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[kindIs], srcRect[kindIs], eventRect[tiedTo]); drip: CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[phase], srcRect[phase], eventRect[tiedTo]); toastr: if (phase <> 0) then begin SetPort(offLoadPort); SetClip(toastRgn); CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[phase], srcRect[phase], eventRect[tiedTo]); ClipRect(wholeArea); SetPort(offVirginPort); end; fshBwl: if (phase <> 0) then CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[phase], srcRect[phase], eventRect[tiedTo]) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[69], srcRect[69], eventRect[tiedTo]); otherwise end; {case} oldRect := wholeRect; end; with theGlider do begin if (isRight) then CopyMask(offPlayerMap, offMaskMap, offLoadMap, shadoRct[0], shadoRct[0], shadoDest) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, shadoRct[1], shadoRct[1], shadoDest); if (lifeNormal) then CopyMask(offPlayerMap, offMaskMap, offLoadMap, glideRct[srcNum], glideRct[srcNum], destRect) else case mode of fadingIn, fadingOut: begin tempInt := nextPhase[mode, phase]; if (not isRight) then tempInt := tempInt + 7; CopyMask(offPlayerMap, offMaskMap, offLoadMap, glideRct[srcNum], glideRct[tempInt], destRect); end; turnLf2Rt, turnRt2Lf: begin tempInt := nextPhase[mode, phase]; CopyMask(offPlayerMap, offMaskMap, offLoadMap, glideRct[tempInt], glideRct[tempInt], destRect); end; burning, ascending, descending: CopyMask(offPlayerMap, offMaskMap, offLoadMap, glideRct[srcNum], glideRct[srcNum], destRect); shredding: begin SetRect(tempRect, 256, 208 - (destRect.bottom - destRect.top), 304, 208); CopyMask(offPlayerMap, offMaskMap, offLoadMap, tempRect, tempRect, destRect); end; otherwise end; {case} end; if (nAnimates > 0) then for index := 1 to nAnimates do with theAnimates[index] do begin CopyMask(offPlayerMap, offMaskMap, offLoadMap, animateRct[kind, phase], animateRct[kind, phase], destRect); oldRect := wholeRect; end; if (bandBorne) then with theBand do begin CopyMask(offPlayerMap, offMaskMap, offLoadMap, bandRct[phase], bandRct[phase], dest); old := dest; end; {-----pop to visible screen-----} with (floatPoints) do if ((out) and (tickCount > tickStamp)) then begin out := FALSE; CopyBits(offVirginMap, mainWndo^.portBits, whereR, whereR, srcCopy, wholeRgn); end; if (hasMirror) then CopyBits(offLoadMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, mirrorRgn); if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do begin if (kindIs <> grease) then CopyBits(offLoadMap, mainWndo^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn) else begin CopyBits(offLoadMap, mainWndo^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn); SetPort(mainWndo); PenNormal; PenSize(2, 2); MoveTo(wholeRect.right, wholeRect.bottom - 2); if (velocity > wholeRect.right + 1) then LineTo(velocity, wholeRect.bottom - 2); PenNormal; SetPort(offVirginPort); PenNormal; PenSize(2, 2); MoveTo(wholeRect.right, wholeRect.bottom - 2); if (velocity > wholeRect.right + 1) then LineTo(velocity, wholeRect.bottom - 2); PenNormal; end; end; with theGlider do begin CopyBits(offLoadMap, mainWndo^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn); CopyBits(offLoadMap, mainWndo^.portBits, wholeShado, wholeShado, srcCopy, wholeRgn); end; if (nAnimates > 0) then for index := 1 to nAnimates do with theAnimates[index] do CopyBits(offLoadMap, mainWndo^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn); if (bandBorne) then with theBand do CopyBits(offLoadMap, mainWndo^.portBits, whole, whole, srcCopy, wholeRgn); end; {=================================} procedure DrawCScene; var index, tempInt: Integer; tempRect, tempSmRect: Rect; begin if ((hasWindow) and (theLightning.whatPhase <> 0)) then with theLightning do begin SetPort(GrafPtr(mainWndo)); SetClip(windowRgn); PenNormal; if (whatPhase = 4) then FillRgn(windowRgn, black) else begin PenMode(srcXOr); PenSize(2, 2); MoveTo(theBolts[whichBolt, 0, 0], theBolts[whichBolt, 0, 1]); for index := 1 to 7 do begin LineTo(theBolts[whichBolt, index, 0], theBolts[whichBolt, index, 1]); Move(0, 2); end; end; ClipRect(wholeArea); SetPort(GrafPtr(virginCPtr)); end; if (hasMirror) then begin with theGlider do UnionRect(destRect, oldRect, tempRect); tempRect.left := tempRect.left - 32; tempRect.right := tempRect.right - 32; tempRect.top := tempRect.top - 32; tempRect.bottom := tempRect.bottom - 32; CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, tempRect, tempRect, srcCopy, mirrorRgn); end; with theGlider do begin UnionRect(destRect, oldRect, wholeRect); UnionRect(shadoDest, oldShado, wholeShado); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, oldRect, oldRect, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, oldShado, oldShado, srcCopy, wholeRgn); oldRect := destRect; oldShado := shadoDest; end; if (nAnimates > 0) then for index := 1 to nAnimates do with theAnimates[index] do CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, oldRect, oldRect, srcCopy, wholeRgn); if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, oldRect, oldRect, srcCopy, wholeRgn); if (bandBorne) then with theBand do CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, old, old, srcCopy, wholeRgn); {-----pop masks on-----} if (hasMirror) then with theGlider do begin tempSmRect := destRect; tempSmRect.left := tempSmRect.left - 32; tempSmRect.right := tempSmRect.right - 32; tempSmRect.top := tempSmRect.top - 32; tempSmRect.bottom := tempSmRect.bottom - 32; SetPort(GrafPtr(loadCPtr)); SetClip(mirrorRgn); CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, glideRct[srcNum], glideRct[srcNum], tempSmRect); ClipRect(wholeArea); SetPort(GrafPtr(virginCPtr)); end; if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do begin case kindIs of candle: CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[position], srcRect[position], wholeRect); outlet, grease: CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[accel], srcRect[accel], wholeRect); ball: CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[kindIs], srcRect[kindIs], eventRect[tiedTo]); drip: CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[phase], srcRect[phase], eventRect[tiedTo]); toastr: if (phase <> 0) then begin SetPort(GrafPtr(loadCPtr)); SetClip(toastRgn); CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[phase], srcRect[phase], eventRect[tiedTo]); ClipRect(wholeArea); SetPort(GrafPtr(virginCPtr)); end; fshBwl: begin if (phase <> 0) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[phase], srcRect[phase], eventRect[tiedTo]) else CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[69], srcRect[69], eventRect[tiedTo]); end; otherwise ; end; {case} oldRect := wholeRect; end; with theGlider do begin if (isRight) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, shadoRct[0], shadoRct[0], shadoDest) else CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, shadoRct[1], shadoRct[1], shadoDest); if (lifeNormal) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, glideRct[srcNum], glideRct[srcNum], destRect) else case mode of fadingIn, fadingOut: begin tempInt := nextPhase[mode, phase]; if (not isRight) then tempInt := tempInt + 7; CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, glideRct[srcNum], glideRct[tempInt], destRect); end; turnLf2Rt, turnRt2Lf: begin tempInt := nextPhase[mode, phase]; CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, glideRct[tempInt], glideRct[tempInt], destRect); end; burning, ascending, descending: CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, glideRct[srcNum], glideRct[srcNum], destRect); shredding: begin SetRect(tempRect, 256, 208 - (destRect.bottom - destRect.top), 304, 208); CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, tempRect, tempRect, destRect); end; otherwise end; {case} end; if (nAnimates > 0) then for index := 1 to nAnimates do with theAnimates[index] do begin CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, animateRct[kind, phase], animateRct[kind, phase], destRect); oldRect := wholeRect; end; if (bandBorne) then with theBand do begin CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, bandRct[phase], bandRct[phase], dest); old := dest; end; {-----pop to visible screen-----} with (floatPoints) do if (out) then begin if (tickCount > tickStamp) then begin out := FALSE; CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, whereR, whereR, srcCopy, wholeRgn); end else begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, whereR, whereR, srcCopy, wholeRgn); SetPort(GrafPtr(mainWndo)); PenNormal; whereR.right := whereR.right + 2; whereR.left := whereR.left + 2; whereR.top := whereR.top - 1; whereR.bottom := whereR.bottom - 1; TextFont(16); TextSize(12); MoveTo(whereR.left, whereR.bottom - 2); if (binaryFlip = 0) then RGBForeColor(rgbBlue) else RGBForeColor(rgbRed); PenMode(srcOr); DrawString(saysWhat); PenNormal; RGBForeColor(rgbBlack); SetPort(GrafPtr(virginCPtr)) end; end; if (hasMirror) then CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, tempRect, tempRect, srcCopy, mirrorRgn); if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do begin if (kindIs <> grease) then CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn) else begin CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn); SetPort(GrafPtr(mainWndo)); PenNormal; PenSize(2, 2); MoveTo(wholeRect.right, wholeRect.bottom - 2); if (velocity > wholeRect.right + 1) then LineTo(velocity, wholeRect.bottom - 2); PenNormal; SetPort(GrafPtr(virginCPtr)); PenNormal; PenSize(2, 2); MoveTo(wholeRect.right, wholeRect.bottom - 2); if (velocity > wholeRect.right + 1) then LineTo(velocity, wholeRect.bottom - 2); PenNormal; end; end; with theGlider do begin CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn); CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeShado, wholeShado, srcCopy, wholeRgn); end; if (nAnimates > 0) then for index := 1 to nAnimates do with theAnimates[index] do CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn); if (bandBorne) then with theBand do CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, whole, whole, srcCopy, wholeRgn); end; {=================================} procedure DoSpecial; begin GetKeys(theKeys); with theGlider do case mode of fadingIn: begin if (phase = 1) then DoTheSound(2); IncInt(phase); if (phase > 16) then begin if (isRight) then srcNum := 0 else srcNum := 2; lifeNormal := TRUE; phase := 0; mode := normal; end end; fadingOut: begin IncInt(phase); if (isRight) then srcNum := 0 else srcNum := 2; if (phase > 16) then OffAMortal; end; turnRt2Lf: begin IncInt(phase); if (phase > 11) then begin lifeNormal := TRUE; phase := 0; mode := normal; shiftAmount := 0; isRight := FALSE; end; SearchRects; destRect.left := destRect.left + shiftAmount; destRect.right := destRect.right + shiftAmount; touchRect.left := touchRect.left + shiftAmount; touchRect.right := touchRect.right + shiftAmount; shadoDest.left := shadoDest.left + shiftAmount; shadoDest.right := shadoDest.right + shiftAmount; end; turnLf2Rt: begin IncInt(phase); if (phase > 11) then begin lifeNormal := TRUE; phase := 0; mode := normal; shiftAmount := 0; isRight := TRUE; end; SearchRects; destRect.left := destRect.left + shiftAmount; destRect.right := destRect.right + shiftAmount; touchRect.left := touchRect.left + shiftAmount; touchRect.right := touchRect.right + shiftAmount; shadoDest.left := shadoDest.left + shiftAmount; shadoDest.right := shadoDest.right + shiftAmount; end; burning: begin phase := 1 - phase; if (isRight) then begin srcNum := 24 + phase; forVel := 1; end else begin srcNum := 26 + phase; forVel := -1; end; SearchRects; MoveGlider; if (TickCount > timeStamp) then begin DoTheSound(1); mode := fadingOut; phase := 0; destRect.top := destRect.bottom - 20; if (isForward) then srcNum := 0 else srcNum := 2; end; end; ascending: begin destRect.left := destRect.left - 2; destRect.right := destRect.left + 48; destRect.top := destRect.top - 6; destRect.bottom := destRect.top + 20; shadoDest.left := destRect.left; shadoDest.right := destRect.right; touchRect := destRect; InsetRect(touchRect, 10, 5); if (destRect.top < 220) then begin lifeNormal := TRUE; phase := 0; mode := normal; end; end; descending: begin destRect.left := destRect.left + 2; destRect.right := destRect.left + 48; destRect.top := destRect.top + 6; destRect.bottom := destRect.top + 20; shadoDest.left := destRect.left; shadoDest.right := destRect.right; touchRect := destRect; InsetRect(touchRect, 10, 5); if (destRect.top > 120) then begin lifeNormal := TRUE; phase := 0; mode := normal; end; end; shredding: begin if (phase = 0) then begin DoTheSound(20); destRect.bottom := destRect.bottom + 1; if (destRect.bottom >= destRect.top + 36) then phase := 1; end else begin destRect.top := destRect.top + 8; destRect.bottom := destRect.bottom + 8; if (destRect.top > 342) then begin phase := 0; OffAMortal; end; end; end; {end - shred} otherwise end; end; {=================================} procedure LetsPause; begin if (smsIsActive) then SMSExit; smsIsActive := FALSE; demoMode := Randomize(lastDemo) + 1; pausing := TRUE; ForceMainToVisible; InitCursor; ShowMenuBar; SetItem(GetMenu(mGame), iBegin, 'Continue Game'); DrawMenuBar; FlushEvents(everyEvent, 0); theErr := PostEvent(KeyDown, 65); end; {=================================} procedure LetsQuit; begin ForceMainToVisible; ShowMenuBar; {$IFC DemoVersion} playing := FALSE; pausing := FALSE; doneFlag := TRUE; {$ELSEC} if DoQuit then begin playing := FALSE; pausing := FALSE; doneFlag := TRUE; end else begin if (SaveGame) then begin playing := FALSE; pausing := FALSE; doneFlag := TRUE; end else begin SetCursor(noCursor^^); SetPort(GrafPtr(mainWndo)); BeginUpdate(GrafPtr(mainWndo)); if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, nil) else CopyBits(offVirginMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, nil); EndUpdate(GrafPtr(mainWndo)); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); end; end; {$ENDC} end; {=================================} procedure LetsSave; begin {$IFC not DemoVersion} InitCursor; SpinBall; ForceMainToVisible; if (not SaveGame) then ; SpinBall; SetCursor(noCursor^^); SetPort(GrafPtr(mainWndo)); BeginUpdate(GrafPtr(mainWndo)); if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, nil) else CopyBits(offVirginMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, nil); EndUpdate(GrafPtr(mainWndo)); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); {$ENDC} end; {=================================} procedure LetsEnd; begin SetItem(GetMenu(mGame), iBegin, 'Begin Game'); WrapItUp; DrawMenuBar; end; {=================================} procedure Coordinate; var i: Integer; begin GetKeys(theKeys); while ((playing) and (not pausing)) do begin timeIs := TickCount; liftAmount := 2; binaryFlip := BitXOr(binaryFlip, 1); if (bandBorne) then HandleBand; if (lifeNormal) then begin SearchRects; GetKeys(theKeys); GetInput; MoveGlider; end else DoSpecial; if (playing) then begin if (nAnimates > 0) then MoveAnimates; if (nCycleObs > 0) then MoveCycleObs; if (hasWindow) then MonitorStorm; if (areFlipping) then DrawFlipScene else begin if (inColor) then DrawCScene else DrawScene; end; if (scoreIsRolling) then BumpTheScore; end; if (theKeys[kCommandKeyMap]) and (theKeys[kQKeyMap]) then LetsQuit; if (theKeys[kCommandKeyMap]) and (theKeys[kSKeyMap]) then LetsSave; if (theKeys[kCommandKeyMap]) and (theKeys[kEKeyMap]) then LetsEnd; if (theKeys[kTabKeyMap]) then LetsPause; SetCursor(noCursor^^); repeat until (TickCount >= (timeIs + 2)); loopsThruRoom := loopsThruRoom + 1; bassLoop := bassLoop + 1; if (bassLoop >= playBassTime) then begin bassLoop := 0; DoTheBass(kDuhDumSound); playBassTime := (kBonusTimeToBeat - loopsThruRoom) div kBassFract + kMinBassLoop; if (playBassTime < kMinBassLoop) then playBassTime := kMinBassLoop; end; end; FlushEvents(everyEvent, 0); InitCursor; DrawMenuBar; if (scoreList.rank <> 20) then DrawHiScores; end; {=================================} end. \ No newline at end of file diff --git a/Glider_405/Sources/G-PlaySetUp.p b/Glider_405/Sources/G-PlaySetUp.p new file mode 100755 index 0000000..1bf8d37 --- /dev/null +++ b/Glider_405/Sources/G-PlaySetUp.p @@ -0,0 +1 @@ +unit PlaySetUp; interface uses SMS, Balloons, Palettes, Globals, GlobalUtils, FileInNOut, PlayUtils; procedure HorizonMouse; procedure WrapItUp; procedure OffAMortal; procedure AdvanceARoom; procedure RetreatARoom; procedure UpAFlight (whatRoom: Integer); procedure DownAFlight (whatRoom: Integer); procedure Transport (whatRoom: Integer); implementation {=================================} procedure HorizonMouse; const MBState = $172; MTemp = $828; RawMouse = $82C; Mouse = $830; CrsrNew = $8CE; CrsrCouple = $8CF; Couple = $FF; Uncouple = $00; var horizon: Point; lowGlob: Integer; lowMem: Ptr; pointPtr: ^Point; begin GetMouse(horizon); horizon.v := 160; lowMem := Pointer(rawMouse); pointPtr := @lowMem^; pointPtr^ := horizon; lowMem := Pointer(MTemp); pointPtr := @lowMem^; pointPtr^ := horizon; lowMem := Pointer(CrsrNew); lowMem^ := $FFFF; end; {=================================} procedure ClosingAnimation; const waitTicks = 4; var i, refNumber, whichTwist: Integer; twisterDst, tinyGliderDst, tinyGliderSrc, wasRect, wasGlider, boltRect: Rect; twisterSrc: array[0..3] of Rect; timeWas: LongInt; tempByte: SignedByte; thePict: PicHandle; boltWasCast, hasLetUpOnButton: Boolean; {--------------} procedure CastBolt; const cloudBottom = 140; boltLength = 8; var i, start, finish: Integer; begin SetRect(boltRect, 512, cloudBottom, 0, (boltLength + 1) * 8 + cloudBottom + 2); if (inColor) then RGBForeColor(rgbWhite) else PenPat(white); start := Randomize(100) + 200; for i := 0 to boltLength do begin finish := Randomize(7) - 3 + start; MoveTo(start, i * 8 + cloudBottom + 1); LineTo(finish, (i + 1) * 8 + cloudBottom); if (start <= boltRect.left) then boltRect.left := start; if (finish <= boltRect.left) then boltRect.left := finish; if (start >= boltRect.right) then boltRect.right := start; if (finish >= boltRect.right) then boltRect.right := finish; start := finish; end; if (inColor) then RGBForeColor(rgbBlack) else PenPat(black); boltWasCast := TRUE; InsetRect(boltRect, -2, 0); end; {--------------} begin RedrawWindowFrame; SetRect(twisterSrc[0], 208, 126, 256, 188); SetRect(twisterSrc[1], 208, 189, 256, 251); SetRect(twisterSrc[2], 208, 252, 256, 314); SetRect(twisterSrc[3], 256, 268, 304, 330); SetRect(tinyGliderSrc, 235, 315, 256, 325); twisterDst := twisterSrc[0]; OffsetRect(twisterDst, -twisterDst.left, -twisterDst.top); OffsetRect(twisterDst, 230, 138); tinyGliderDst := tinyGliderSrc; OffsetRect(tinyGliderDst, -tinyGliderDst.left, -tinyGliderDst.top); OffsetRect(tinyGliderDst, 420, 90); wasGlider := tinyGliderDst; boltWasCast := FALSE; if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); refNumber := OpenResFile(resourceName); if (refNumber = -1) then begin UseResFile(gliderResNum); GenericAlert(kErrGraphicsNotFound); ShowMenuBar; if (not DoOpen(kArtType)) then Exit(ClosingAnimation); refNumber := OpenResFile(resourceName); if (refNumber = -1) then begin GenericAlert(kErrGraphicsNotFound); ShowMenuBar; Exit(ClosingAnimation); end; end; thePict := GetPicture(rFarmPict); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); ReleaseResource(Handle(thePict)); end else GenericAlert(kErrGraphicLoad); CloseResFile(refNumber); UseResFile(gliderResNum); DissBlocks; whichTwist := 0; PenNormal; if (inColor) then SetPort(GrafPtr(mainWndo)) else SetPort(mainWndo); hasLetUpOnButton := FALSE; for i := 1 to 200 do begin timeWas := TickCount + waitTicks; wasRect := twisterDst; whichTwist := i mod 4; if ((i mod 4) = 0) then begin whichTwist := whichTwist + 1; if (whichTwist > 3) then whichTwist := 0; OffsetRect(twisterDst, -1, 0); wasRect.right := wasRect.right + 1; end; OffsetRect(tinyGliderDst, -2, -(i mod 2)); wasGlider := tinyGliderDst; wasGlider.right := wasGlider.right + 2; wasGlider.bottom := wasGlider.bottom + 1; if (Randomize(20) = 0) then CastBolt; if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wasRect, wasRect, srcCopy, nil); CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, twisterSrc[whichTwist], twisterSrc[whichTwist], twisterDst); CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wasRect, wasRect, srcCopy, nil); end else begin CopyBits(offVirginMap, offLoadMap, wasRect, wasRect, srcCopy, nil); CopyMask(offPlayerMap, offMaskMap, offLoadMap, twisterSrc[whichTwist], twisterSrc[whichTwist], twisterDst); CopyBits(offLoadMap, mainWndo^.portBits, wasRect, wasRect, srcCopy, nil); end; if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wasGlider, wasGlider, srcCopy, nil); CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, tinyGliderSrc, tinyGliderSrc, tinyGliderDst); CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wasGlider, wasGlider, srcCopy, wholeRgn); end else begin CopyBits(offVirginMap, offLoadMap, wasGlider, wasGlider, srcCopy, nil); CopyMask(offPlayerMap, offMaskMap, offLoadMap, tinyGliderSrc, tinyGliderSrc, tinyGliderDst); CopyBits(offLoadMap, mainWndo^.portBits, wasGlider, wasGlider, srcCopy, wholeRgn); end; repeat if (Button) then begin if (hasLetUpOnButton) then Leave; end else hasLetUpOnButton := TRUE; GetKeys(theKeys); if (theKeys[kReturnKeyMap]) then Leave; until (TickCount > timeWas); timeWas := TickCount + waitTicks; if (Button) then begin if (hasLetUpOnButton) then Leave; end else hasLetUpOnButton := TRUE; GetKeys(theKeys); if (theKeys[kReturnKeyMap]) then Leave; if (boltWasCast) then begin DoTheSound(17); if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, boltRect, boltRect, srcCopy, wholeRgn) else CopyBits(offVirginMap, mainWndo^.portBits, boltRect, boltRect, srcCopy, wholeRgn); boltWasCast := FALSE; end; end; end; {=================================} procedure GameOver; const timeBetween = 6; var i, i2, leftOff, topOff, whichLetter: Integer; dummyLong: LongInt; letters: array[0..6] of Rect; dest: Rect; tempStr: Str255; hasLetUpOnButton: Boolean; begin SetRect(letters[0], 375, 33, 409, 78); {G} SetRect(letters[1], 375, 77, 409, 122); {a} SetRect(letters[2], 375, 121, 409, 166); {m} SetRect(letters[3], 375, 165, 409, 210); {e} SetRect(letters[4], 375, 209, 409, 254); {O} SetRect(letters[5], 375, 253, 409, 298); {v} SetRect(letters[6], 375, 297, 409, 342); {r} hasLetUpOnButton := FALSE; if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); FillRect(wholeArea, black); NumToString(roomScore + suppScore, tempStr); if (inColor) then begin PenNormal; TextFont(204); TextSize(32); MoveTo(120, 80); RGBForeColor(rgbYellow); PenMode(srcOr); DrawString(tempStr); PenNormal; RGBForeColor(rgbBlack); TextFont(SystemFont); TextSize(12); end else begin TextFont(204); TextSize(32); TextMode(patXOr); MoveTo(120, 80); DrawString(tempStr); TextFont(SystemFont); TextSize(12); end; DissBlocks; SetRect(dest, 0, 0, 34, 45); OffsetRect(dest, 113, 100); DoTheSound(21); if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, letters[0], dest, srcCopy, nil) else CopyBits(offPlayerMap, mainWndo^.portBits, letters[0], dest, srcCopy, nil); OffsetRect(dest, 36, 0); Delay(timeBetween, dummyLong); DoTheSound(21); if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, letters[1], dest, srcCopy, nil) else CopyBits(offPlayerMap, mainWndo^.portBits, letters[1], dest, srcCopy, nil); OffsetRect(dest, 36, 0); Delay(timeBetween, dummyLong); DoTheSound(21); if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, letters[2], dest, srcCopy, nil) else CopyBits(offPlayerMap, mainWndo^.portBits, letters[2], dest, srcCopy, nil); OffsetRect(dest, 36, 0); Delay(timeBetween, dummyLong); DoTheSound(21); if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, letters[3], dest, srcCopy, nil) else CopyBits(offPlayerMap, mainWndo^.portBits, letters[3], dest, srcCopy, nil); OffsetRect(dest, 36, 0); Delay(timeBetween, dummyLong); DoTheSound(21); if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, letters[4], dest, srcCopy, nil) else CopyBits(offPlayerMap, mainWndo^.portBits, letters[4], dest, srcCopy, nil); OffsetRect(dest, 36, 0); Delay(timeBetween, dummyLong); DoTheSound(21); if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, letters[5], dest, srcCopy, nil) else CopyBits(offPlayerMap, mainWndo^.portBits, letters[5], dest, srcCopy, nil); OffsetRect(dest, 36, 0); Delay(timeBetween, dummyLong); DoTheSound(21); if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, letters[3], dest, srcCopy, nil) else CopyBits(offPlayerMap, mainWndo^.portBits, letters[3], dest, srcCopy, nil); OffsetRect(dest, 36, 0); Delay(timeBetween, dummyLong); DoTheSound(21); if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, letters[6], dest, srcCopy, nil) else CopyBits(offPlayerMap, mainWndo^.portBits, letters[6], dest, srcCopy, nil); for i := 1 to 20 do begin if (Button) then begin if (hasLetUpOnButton) then Leave; end else hasLetUpOnButton := TRUE; GetKeys(theKeys); if (theKeys[kReturnKeyMap]) then Leave; SetRect(dest, 0, 0, 34, 45); OffsetRect(dest, 113, 100 + i * 8); for i2 := 0 to 7 do begin SetRect(letters[0], 375, 33, 409, 78); {G} SetRect(letters[1], 375, 77, 409, 122); {a} SetRect(letters[2], 375, 121, 409, 166); {m} SetRect(letters[3], 375, 165, 409, 210); {e} SetRect(letters[4], 375, 209, 409, 254); {O} SetRect(letters[5], 375, 253, 409, 298); {v} SetRect(letters[6], 375, 297, 409, 342); {r} if (i2 = 6) then whichLetter := 3 else if (i2 = 7) then whichLetter := 6 else whichLetter := i2; OffsetRect(dest, Randomize(i * 2 + 1) - i, 0); Delay(1, dummyLong); if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, letters[whichLetter], dest, srcCopy, nil) else CopyBits(offPlayerMap, mainWndo^.portBits, letters[whichLetter], dest, srcCopy, nil); OffsetRect(dest, 36, 0); end; end; for i := 1 to 200 do begin Delay(1, dummyLong); if (Button) then begin if (hasLetUpOnButton) then Leave; end else hasLetUpOnButton := TRUE; GetKeys(theKeys); if (theKeys[kReturnKeyMap]) then Leave; end; end; {=================================} procedure WrapItUp; var tempByte: SignedByte; tempRect: Rect; thePict: PicHandle; begin playing := FALSE; pausing := FALSE; if (hasMirror) then begin hasMirror := FALSE; HUnlock(Handle(mirrorRgn)); DisposeRgn(mirrorRgn); end; if (hasWindow) then begin hasWindow := FALSE; HUnlock(Handle(windowRgn)); DisposeRgn(windowRgn); end; if (hasToast) then begin hasToast := FALSE; HUnlock(Handle(toastRgn)); DisposeRgn(toastRgn); end; ForceMainToVisible; FlushEvents(everyEvent, 0); theErr := PostEvent(KeyDown, 65); RedrawWindowFrame; GameOver; ShowMenuBar; if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); if (inColor) then thePict := GetPicture(rColorIdleID) else thePict := GetPicture(rIdleID); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); ReleaseResource(Handle(thePict)); end else GenericAlert(kErrGraphicLoad); {$IFC DemoVersion} MoveTo(13, 113); TextFont(SystemFont); if (inColor) then begin ForeColor(redColor); TextMode(patOr); DrawString('DEMO VERSION'); ForeColor(blackColor); end else begin TextMode(patXOr); DrawString('DEMO VERSION'); end; {$ENDC} DissBlocks; {$IFC not DemoVersion} EnableItem(GetMenu(mGame), iLoadHouse); {$ENDC} DisableItem(GetMenu(mGame), iEndGame); {$IFC not DemoVersion} EnableItem(GetMenu(mGame), iLoadGame); {$ENDC} DisableItem(GetMenu(mGame), iSaveGame); DisableItem(GetMenu(mGame), iSaveGameAs); EnableItem(GetMenu(mOption), iHiScores); InitCursor; SortHiScores; if (smsIsActive) then SMSExit; smsIsActive := FALSE; end; {=================================} procedure AdvanceAFile; var i: Integer; wasHouse, newHouse: string[32]; {----------} procedure ExitGracefully; begin roomAt := 0; roomsPassed := roomsPassed - 1; ClosingAnimation; WrapItUp; Exit(AdvanceAFile); end; {----------} begin wasHouse := housesName; housesName := thisHouse.nextFile; fileWasLost := FALSE; if (not GetHouse) then ExitGracefully; if (fileWasLost) then begin newHouse := housesName; housesName := wasHouse; if (not GetHouse) then ExitGracefully; thisHouse.nextFile := newHouse; if (not WriteHouse) then ExitGracefully; housesName := thisHouse.nextFile; if (not GetHouse) then ExitGracefully; end; CalcRoomScore; suppScore := suppScore + roomScore; for i := 1 to 40 do roomVisits[i] := FALSE; roomScore := 0; end; {=================================} procedure OffAMortal; var tempRect: Rect; tempStr: Str255; begin with theGlider do begin if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeRect, wholeRect, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeShado, wholeShado, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeShado, wholeShado, srcCopy, wholeRgn); end else begin UnionRect(destRect, oldRect, wholeRect); UnionRect(shadoDest, oldShado, wholeShado); CopyBits(offVirginMap, offLoadMap, wholeRect, wholeRect, srcCopy, wholeRgn); CopyBits(offVirginMap, offLoadMap, wholeShado, wholeShado, srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, wholeShado, wholeShado, srcCopy, wholeRgn); end; end; if (hasMirror) then begin SetPort(GrafPtr(mainWndo)); EraseRgn(mirrorRgn); if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); EraseRgn(mirrorRgn); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); end; if (hasWindow) then begin SetPort(GrafPtr(mainWndo)); FillRgn(windowRgn, black); if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); FillRgn(windowRgn, black); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); end; mortals := mortals - 1; if (mortals < 1) then begin WrapItUp; Exit(OffAMortal); end; if (mortals < 4) then {hide a token glider} begin SetRect(tempRect, 470, 5, 505, 20); OffsetRect(tempRect, -37 * (mortals - 1), 0); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); PenNormal; PaintRect(tempRect); if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, tempRect, tempRect, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, tempRect, tempRect, srcCopy, wholeRgn); end else begin CopyBits(offVirginMap, offLoadMap, tempRect, tempRect, srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, wholeRgn); end; SetRect(tempRect, 384, 5, 397, 20); PaintRect(tempRect); if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, tempRect, tempRect, srcCopy, nil); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, tempRect, tempRect, srcCopy, wholeRgn); end else begin CopyBits(offVirginMap, offLoadMap, tempRect, tempRect, srcCopy, nil); CopyBits(offVirginMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, wholeRgn); end; end else begin if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); PenNormal; SetRect(tempRect, 384, 5, 396, 20); PaintRect(tempRect); MoveTo(tempRect.left, tempRect.bottom - 2); TextFont(16); TextSize(12); NumToString(mortals - 1, tempStr); if (inColor) then begin RGBForeColor(rgbRed); PenMode(srcOr); DrawString(tempStr); PenNormal; RGBForeColor(rgbBlack); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, tempRect, tempRect, srcCopy, nil); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, tempRect, tempRect, srcCopy, wholeRgn); end else begin TextMode(patXOr); DrawString(tempStr); PenNormal; CopyBits(offVirginMap, offLoadMap, tempRect, tempRect, srcCopy, nil); CopyBits(offVirginMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, wholeRgn); end; end; ResetGlider; end; {=================================} procedure CheckForTimeBonus; var tempStr: Str255; tempRect: Rect; timeBonus, dummyLong: LongInt; i: Integer; begin timeBonus := 0; if (loopsThruRoom < kBonusTimeToBeat) then timeBonus := (kBonusTimeToBeat - loopsThruRoom) * ((roomAt div 5) + 1); suppScore := suppScore + timeBonus; loopsThruRoom := 0; NumToString(timeBonus, tempStr); tempStr := CONCAT('Time Bonus = ', tempStr); SetRect(tempRect, 190, 100, 312, 117); SetPort(GrafPtr(mainWndo)); if (inColor) then begin PenNormal; PaintRect(tempRect); PenMode(patXOr); InsetRect(tempRect, 1, 1); FrameRect(tempRect); PenNormal; InsetRect(tempRect, -1, -1); RGBForeColor(rgbYellow); TextFont(16); TextSize(12); PenMode(srcOr); MoveTo(tempRect.left + 3, tempRect.bottom - 4); DrawString(tempStr); RGBForeColor(rgbBlack); SetPort(GrafPtr(virginCPtr)); PenNormal; PaintRect(tempRect); PenMode(patXOr); InsetRect(tempRect, 1, 1); FrameRect(tempRect); PenNormal; InsetRect(tempRect, -1, -1); RGBForeColor(rgbYellow); PenNormal; TextFont(16); TextSize(12); PenMode(srcOr); MoveTo(tempRect.left + 3, tempRect.bottom - 4); DrawString(tempStr); RGBForeColor(rgbBlack); end else begin PenNormal; PaintRect(tempRect); PenMode(patXOr); InsetRect(tempRect, 1, 1); FrameRect(tempRect); PenNormal; InsetRect(tempRect, -1, -1); TextFont(16); TextSize(12); TextMode(patXOr); MoveTo(tempRect.left + 3, tempRect.bottom - 4); DrawString(tempStr); PenNormal; SetPort(offVirginPort); PenNormal; PaintRect(tempRect); PenMode(patXOr); InsetRect(tempRect, 1, 1); FrameRect(tempRect); PenNormal; InsetRect(tempRect, -1, -1); TextFont(16); TextSize(12); TextMode(patXOr); MoveTo(tempRect.left + 3, tempRect.bottom - 4); DrawString(tempStr); PenNormal; SetPort(offLoadPort); PenNormal; PaintRect(tempRect); PenMode(patXOr); InsetRect(tempRect, 1, 1); FrameRect(tempRect); PenNormal; InsetRect(tempRect, -1, -1); TextFont(16); TextSize(12); TextMode(patXOr); MoveTo(tempRect.left + 3, tempRect.bottom - 4); DrawString(tempStr); PenNormal; end; for i := 1 to 30 do begin HorizonMouse; Delay(1, dummyLong); end; end; {=================================} procedure SetRoomState; var oldRoomScore: LongInt; i: Integer; begin if (didntExitEntrance) then roomVisits[roomAt] := TRUE; bassLoop := 0; playBassTime := kBonusTimeToBeat div kBassFract + kMinBassLoop; StartScoreRolling; oldRoomScore := roomScore; CalcRoomScore; if ((oldRoomScore < roomScore) and (didntExitEntrance)) then CheckForTimeBonus; loopsThruRoom := 0; for i := 1 to nObjects do case (eventKind[i, 0]) of awardIt, extraIt, energizeIt, bandIt, trickIt: begin thisHouse.theRooms[roomAt].theObjects[i].amount := eventKind[i, 1]; end; lightIt, airOnIt: begin if ((not lightsOut) and (not airOut)) then thisHouse.theRooms[roomAt].conditionCode := 0; end; otherwise end; if (hasMirror) then begin SetPort(GrafPtr(mainWndo)); EraseRgn(mirrorRgn); if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); EraseRgn(mirrorRgn); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); end; with theGlider do begin if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, destRect, destRect, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, shadoDest, shadoDest, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, destRect, destRect, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, shadoDest, shadoDest, srcCopy, wholeRgn); end else begin CopyBits(offVirginMap, offLoadMap, destRect, destRect, srcCopy, wholeRgn); CopyBits(offVirginMap, offLoadMap, shadoDest, shadoDest, srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, destRect, destRect, srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, shadoDest, shadoDest, srcCopy, wholeRgn); end; end; end; {=================================} procedure ScrollForward; var srcRect: Rect; waitTicks: LongInt; index: Integer; begin with theGlider do begin destRect.left := 0; destRect.right := 48; oldRect := destRect; wholeRect := destRect; shadoDest.left := 0; shadoDest.right := 48; oldShado := shadoDest; wholeShado := shadoDest; touchRect := destRect; InsetRect(touchRect, 10, 5); end; SetRect(srcRect, 496, 0, 512, 342); for index := 0 to 31 do begin HorizonMouse; waitTicks := TickCount; repeat until (TickCount > waitTicks); if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, srcRect, srcRect, srcCopy, nil); SetPort(GrafPtr(mainWndo)); PenNormal; MoveTo(srcRect.left - 1, srcRect.top); Line(0, 322); SetPort(GrafPtr(virginCPtr)); end else begin CopyBits(offVirginMap, mainWndo^.portBits, srcRect, srcRect, srcCopy, nil); SetPort(mainWndo); PenNormal; MoveTo(srcRect.left - 1, srcRect.top); Line(0, 322); SetPort(offVirginPort); end; srcRect.right := srcRect.right - 16; srcRect.left := srcRect.left - 16; end; end; {=================================} procedure ScrollBackward; var srcRect: Rect; waitTicks: LongInt; index: Integer; begin with theGlider do begin destRect.left := 464; destRect.right := 512; oldRect := destRect; wholeRect := destRect; shadoDest.left := 464; shadoDest.right := 512; oldShado := shadoDest; wholeShado := shadoDest; touchRect := destRect; InsetRect(touchRect, 10, 5); end; SetRect(srcRect, 0, 0, 16, 342); if (inColor) then CopyBits(GrafPtr(mainWndo)^.portBits, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, nil) else CopyBits(mainWndo^.portBits, offLoadMap, wholeArea, wholeArea, srcCopy, nil); for index := 0 to 31 do begin HorizonMouse; waitTicks := TickCount; repeat until (TickCount > waitTicks); if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, srcRect, srcRect, srcCopy, nil); SetPort(GrafPtr(mainWndo)); PenNormal; MoveTo(srcRect.right, srcRect.top); Line(0, 322); SetPort(GrafPtr(virginCPtr)); end else begin CopyBits(offVirginMap, mainWndo^.portBits, srcRect, srcRect, srcCopy, nil); SetPort(mainWndo); PenNormal; MoveTo(srcRect.right, srcRect.top); Line(0, 322); SetPort(offVirginPort); end; srcRect.right := srcRect.right + 16; srcRect.left := srcRect.left + 16; end; end; {=================================} procedure ScrollUp; var srcRect: Rect; waitTicks: LongInt; index, leftCorner: Integer; begin leftCorner := 232; for index := 1 to 16 do with thisHouse.theRooms[roomAt].theObjects[index] do if (objectIs = dnStar) then leftCorner := boundRect.left + 64; with theGlider do begin destRect.left := leftCorner; destRect.right := leftCorner + 48; destRect.top := kFloorVert - 20; destRect.bottom := kFloorVert; oldRect := destRect; wholeRect := destRect; shadoDest.left := destRect.left; shadoDest.right := destRect.right; oldShado := shadoDest; wholeShado := shadoDest; touchRect := destRect; InsetRect(touchRect, 10, 5); end; SetRect(srcRect, 0, 0, 512, 18); for index := 0 to 18 do begin HorizonMouse; waitTicks := TickCount; repeat until (TickCount > waitTicks); if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, srcRect, srcRect, srcCopy, nil); SetPort(GrafPtr(mainWndo)); PenNormal; MoveTo(srcRect.left, srcRect.bottom); Line(512, 0); SetPort(GrafPtr(virginCPtr)); end else begin CopyBits(offVirginMap, mainWndo^.portBits, srcRect, srcRect, srcCopy, nil); SetPort(mainWndo); PenNormal; MoveTo(srcRect.left, srcRect.bottom); Line(512, 0); SetPort(offVirginPort); end; srcRect.bottom := srcRect.bottom + 18; srcRect.top := srcRect.top + 18; end; end; {=================================} procedure ScrollDown; var srcRect: Rect; waitTicks: LongInt; index, leftCorner: Integer; begin leftCorner := 232; for index := 1 to 16 do with thisHouse.theRooms[roomAt].theObjects[index] do if (objectIs = upStar) then leftCorner := boundRect.left + 64; with theGlider do begin destRect.left := leftCorner; destRect.right := leftCorner + 48; destRect.top := kCeilingVert + 20; destRect.bottom := kCeilingVert + 40; oldRect := destRect; wholeRect := destRect; shadoDest.left := destRect.left; shadoDest.right := destRect.right; oldShado := shadoDest; wholeShado := shadoDest; touchRect := destRect; InsetRect(touchRect, 10, 5); end; SetRect(srcRect, 0, 324, 512, 342); for index := 0 to 18 do begin waitTicks := TickCount; repeat until (TickCount > waitTicks); if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, srcRect, srcRect, srcCopy, nil); SetPort(GrafPtr(mainWndo)); PenNormal; MoveTo(srcRect.left, srcRect.top - 1); Line(512, 0); SetPort(GrafPtr(virginCPtr)); end else begin CopyBits(offVirginMap, mainWndo^.portBits, srcRect, srcRect, srcCopy, nil); SetPort(mainWndo); PenNormal; MoveTo(srcRect.left, srcRect.top - 1); Line(512, 0); SetPort(offVirginPort); end; srcRect.bottom := srcRect.bottom - 18; srcRect.top := srcRect.top - 18; end; end; {=================================} procedure AdvanceARoom; begin didntExitEntrance := (sideYouCantExit <> rightOfRoom); SetRoomState; enteredLeft := TRUE; sideYouCantExit := leftOfRoom; roomAt := roomAt + 1; roomsPassed := roomsPassed + 1; {$IFC DemoVersion} if (roomAt > 5) then begin roomAt := 0; roomsPassed := roomsPassed - 1; ClosingAnimation; WrapItUp; Exit(AdvanceARoom); end; {$ENDC} if (roomAt > thisHouse.numberORooms) then begin if ((thisHouse.nextFile = 'nil') or (thisHouse.nextFile = '')) then begin roomAt := 0; roomsPassed := roomsPassed - 1; ClosingAnimation; WrapItUp; Exit(AdvanceARoom); end else begin AdvanceAFile; roomAt := 1; end; end; if (roomAt <> 0) then begin ReadyRoom; ScrollForward; if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, wholeRgn) else CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, wholeRgn); end; end; {=================================} procedure RetreatARoom; begin didntExitEntrance := (sideYouCantExit <> leftOfRoom); SetRoomState; enteredLeft := FALSE; sideYouCantExit := rightOfRoom; roomAt := roomAt - 1; roomsPassed := roomsPassed - 1; if (roomAt < 1) then begin roomAt := 0; roomsPassed := roomsPassed - 1; ClosingAnimation; WrapItUp; Exit(RetreatARoom); end; ReadyRoom; ScrollBackward; if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, wholeRgn) else CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, wholeRgn); end; {=================================} procedure UpAFlight; var addToIt: Integer; begin didntExitEntrance := (sideYouCantExit <> topOfRoom); SetRoomState; sideYouCantExit := bottomOfRoom; addToIt := whatRoom - roomAt; roomAt := whatRoom; roomsPassed := roomsPassed + addToIt; if ((roomAt > thisHouse.numberORooms) or (roomAt < 0)) then begin if ((thisHouse.nextFile = 'nil') or (thisHouse.nextFile = '') or (roomAt < 0)) then begin roomAt := 0; roomsPassed := roomsPassed - 1; ClosingAnimation; WrapItUp; Exit(UpAFlight); end else begin AdvanceAFile; roomAt := roomAt - 40; end; end else if (roomAt = 0) then begin roomAt := 0; roomsPassed := roomsPassed - 1; ClosingAnimation; WrapItUp; Exit(UpAFlight); end; if (roomAt <> 0) then begin ReadyRoom; ScrollUp; if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, wholeRgn) else CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, wholeRgn); end; end; {=================================} procedure DownAFlight; var addToIt: Integer; begin didntExitEntrance := (sideYouCantExit <> bottomOfRoom); SetRoomState; sideYouCantExit := topOfRoom; addToIt := whatRoom - roomAt; roomAt := whatRoom; roomsPassed := roomsPassed + addToIt; if ((roomAt < 0) or (roomAt > thisHouse.numberORooms)) then begin if ((thisHouse.nextFile = 'nil') or (thisHouse.nextFile = '') or (roomAt < 0)) then begin roomAt := 0; roomsPassed := roomsPassed - 1; ClosingAnimation; WrapItUp; Exit(DownAFlight); end else begin AdvanceAFile; roomAt := roomAt - 40; end; end else if (roomAt = 0) then begin ClosingAnimation; WrapItUp; Exit(DownAFlight); end; if (roomAt <> 0) then begin ReadyRoom; ScrollDown; if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, wholeRgn) else CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, wholeRgn); end; end; {=================================} procedure Transport; var addToIt, leftCorner, index, localRoomNumber: Integer; newRoom: Boolean; begin newRoom := (whatRoom <> roomAt); if (newRoom) then begin didntExitEntrance := TRUE; SetRoomState; sideYouCantExit := whoCares; addToIt := whatRoom - roomAt; roomAt := whatRoom; roomsPassed := roomsPassed + addToIt; if ((roomAt < 0) or (roomAt > thisHouse.numberORooms)) then begin if ((thisHouse.nextFile = 'nil') or (thisHouse.nextFile = '') or (roomAt < 0)) then begin ClosingAnimation; roomAt := 0; WrapItUp; Exit(Transport); end else begin localRoomNumber := roomAt - thisHouse.numberORooms; AdvanceAFile; roomAt := localRoomNumber; if (roomAt > thisHouse.numberORooms) then begin ClosingAnimation; roomAt := 0; WrapItUp; Exit(Transport); end end; end else if (roomAt = 0) then begin ClosingAnimation; WrapItUp; Exit(Transport); end; if (roomAt <> 0) then ReadyRoom; end else {we're transporting to the room we're in} with theGlider do if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, destRect, destRect, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, shadoDest, shadoDest, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, destRect, destRect, srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, shadoDest, shadoDest, srcCopy, wholeRgn); end else begin CopyBits(offVirginMap, offLoadMap, destRect, destRect, srcCopy, wholeRgn); CopyBits(offVirginMap, offLoadMap, shadoDest, shadoDest, srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, destRect, destRect, srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, shadoDest, shadoDest, srcCopy, wholeRgn); end; if (roomAt <> 0) then begin leftCorner := 232; for index := 1 to 16 do with thisHouse.theRooms[roomAt].theObjects[index] do if ((objectIs = celDct) and (isOn)) then leftCorner := boundRect.left; with theGlider do begin destRect.left := leftCorner; destRect.right := leftCorner + 48; destRect.top := kCeilingVert; destRect.bottom := kCeilingVert + 20; oldRect := destRect; wholeRect := destRect; shadoDest.left := destRect.left; shadoDest.right := destRect.right; oldShado := shadoDest; wholeShado := shadoDest; touchRect := destRect; InsetRect(touchRect, 10, 5); end; if (newRoom) then begin HorizonMouse; DissBlocks; if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, nil) else CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, nil); end; end; end; {=================================} end. \ No newline at end of file diff --git a/Glider_405/Sources/G-PlayUtils.p b/Glider_405/Sources/G-PlayUtils.p new file mode 100755 index 0000000..59b092a --- /dev/null +++ b/Glider_405/Sources/G-PlayUtils.p @@ -0,0 +1 @@ +unit PlayUtils; interface uses Palettes, Globals, SMS, GlobalUtils, FileInNOut; procedure ForceMainToVisible; procedure LoadABackground (whichID: Integer); procedure ArrangeTiles; procedure DrawAllObjects; procedure BumpTheScore; procedure StartScoreRolling; procedure UpdateBandNumbers; procedure PopTokenBand; procedure UpdateBatteryEnergy; procedure PopTokenBattery; procedure DrawHeadline; procedure ResetGlider; procedure ResetAnimate (typeIs, index: Integer); procedure ExtractEventRects; procedure ReadyRoom; procedure SortHiScores; function DoQuit: Boolean; implementation {=================================} procedure ForceMainToVisible; begin if ((areFlipping) and (mainScreenHidden)) then begin CopyBits(offLoadMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, nil); mainScreenHidden := FALSE; SetPage(mainScreenHidden); CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, nil); end; end; {=================================} procedure ArrangeTiles; var wasPort: GrafPtr; i, panel: Integer; begin for i := 0 to 7 do begin panel := thisHouse.theRooms[roomAt].tileOrder[i]; if (inColor) then CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, BitMapPtr(virginCPtr^.portPixMap^)^, tileRects[panel], tileRects[i], srcCopy, nil) else CopyBits(offLoadMap, offVirginMap, tileRects[panel], tileRects[i], srcCopy, nil); end; if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, nil) else CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, nil); end; {=================================} procedure LoadABackground; var refNumber: Integer; tempByte: SignedByte; thePict: PicHandle; wasPort: GrafPtr; begin refNumber := OpenResFile(resourceName); if (refNumber = -1) then begin UseResFile(gliderResNum); GenericAlert(kErrGraphicsNotFound); if (not DoOpen(kArtType)) then begin ShowMenuBar; Exit(LoadABackground); end; refNumber := OpenResFile(resourceName); if (refNumber = -1) then begin GenericAlert(kErrGraphicsNotFound); ShowMenuBar; playing := FALSE; Exit(LoadABackground); end; end; if (areFlipping) then ForceMainToVisible; GetPort(wasPort); if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); thePict := GetPicture(whichID); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); end else begin case whichID of {try to substitute} 205: thePict := GetPicture(201); 206: thePict := GetPicture(204); 207: thePict := GetPicture(200); 208: thePict := GetPicture(203); 209: thePict := GetPicture(200); otherwise begin GenericAlert(kErrGraphicLoad); ShowMenuBar; playing := FALSE; Exit(LoadABackground); end; end; if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrGraphicLoad); ShowMenuBar; playing := FALSE; Exit(LoadABackground); end; end; ReleaseResource(Handle(thePict)); SetPort(wasPort); CloseResFile(refNumber); UseResFile(gliderResNum); end; {=================================} procedure FillNFrame (theColor: RGBColor; theRect: Rect); begin RGBForeColor(theColor); PaintRect(theRect); RGBForeColor(rgbBlack); FrameRect(theRect); end; {=================================} procedure GrayNFrame (theRect: Rect); begin FillRect(theRect, gray); FrameRect(theRect); end; {=================================} procedure HiLiteARect (theColor: RGBColor; theRect: Rect); begin RGBForeColor(theColor); MoveTo(theRect.left + 1, theRect.top + 1); LineTo(theRect.right - 2, theRect.top + 1); LineTo(theRect.right - 2, theRect.bottom - 2); RGBForeColor(rgbBlack); end; {=================================} procedure GrayLiteARect (theRect: Rect); begin PenPat(white); MoveTo(theRect.left + 1, theRect.top + 1); LineTo(theRect.right - 2, theRect.top + 1); LineTo(theRect.right - 2, theRect.bottom - 2); PenNormal; MoveTo(theRect.left + 1, theRect.top + 1); LineTo(theRect.left + 1, theRect.bottom - 2); LineTo(theRect.right - 2, theRect.bottom - 2); end; {=================================} procedure LoLiteARect (theRect: Rect); begin RGBForeColor(rgbLtBrown); MoveTo(theRect.left - 1, theRect.top); LineTo(theRect.left - 1, theRect.bottom); LineTo(theRect.right - 1, theRect.bottom); RGBForeColor(rgbDkGray); MoveTo(theRect.left, theRect.top - 1); LineTo(theRect.right, theRect.top - 1); LineTo(theRect.right, theRect.bottom); RGBForeColor(rgbBlack); end; {=================================} procedure GrayLoARect (theRect: Rect); begin PenPat(white); MoveTo(theRect.left - 1, theRect.top); LineTo(theRect.left - 1, theRect.bottom); LineTo(theRect.right - 1, theRect.bottom); PenNormal; MoveTo(theRect.left, theRect.top - 1); LineTo(theRect.right, theRect.top - 1); LineTo(theRect.right, theRect.bottom); end; {=================================} procedure DrawTable (whichItem: Integer); var kind: Integer; theRect, tempRect: Rect; wasPort: GrafPtr; begin GetPort(wasPort); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); PenNormal; with thisHouse.theRooms[roomAt].theObjects[whichItem] do begin kind := objectIs; theRect := boundRect; end; if (inColor) then {***** Draw table top} begin RGBForeColor(rgbBrown); PaintRect(theRect); RGBForeColor(rgbBlack); FrameRect(theRect); MoveTo(theRect.left + 1, theRect.bottom - 2); LineTo(theRect.right - 1, theRect.bottom - 2); RGBForeColor(rgbLtBrown); MoveTo(theRect.left + 1, theRect.top + 1); LineTo(theRect.right - 2, theRect.top + 1); RGBForeColor(rgbBlack); end else begin FillRect(theRect, gray); FrameRect(theRect); MoveTo(theRect.left + 1, theRect.bottom - 2); LineTo(theRect.right - 1, theRect.bottom - 2); PenPat(white); MoveTo(theRect.left + 1, theRect.top + 1); LineTo(theRect.right - 2, theRect.top + 1); end; PenNormal; {***** Draw table shadow} SetRect(tempRect, theRect.left, kFloorVert - 0, theRect.right, kFloorVert + 20); OffsetRect(tempRect, (theRect.top - kFloorVert) div 5, 0); if (inColor) then begin PenMode(patCopy + transparent); PenPat(gray); PaintOval(tempRect); end else begin PenMode(patOr); PenPat(gray); PaintOval(tempRect); end; PenNormal; if (inColor) then {***** Draw table support} begin RGBForeColor(rgbBlack); PenSize(5, 1); MoveTo(((theRect.left + theRect.right) div 2) - 2, theRect.bottom); LineTo(((theRect.left + theRect.right) div 2) - 2, kFloorVert - 7); RGBForeColor(rgbWhite); PenSize(1, 1); MoveTo(((theRect.left + theRect.right) div 2) + 1, theRect.bottom + (theRect.right - theRect.left) div 8); LineTo(((theRect.left + theRect.right) div 2) + 1, kFloorVert - 7); RGBForeColor(rgbLtBrown); MoveTo(((theRect.left + theRect.right) div 2) + 0, theRect.bottom + (theRect.right - theRect.left) div 8); LineTo(((theRect.left + theRect.right) div 2) + 0, kFloorVert - 7); RGBForeColor(rgbBlack); end else begin PenSize(5, 1); MoveTo(((theRect.left + theRect.right) div 2) - 2, theRect.bottom); LineTo(((theRect.left + theRect.right) div 2) - 2, kFloorVert - 7); PenPat(white); PenSize(1, 1); MoveTo(((theRect.left + theRect.right) div 2) + 1, theRect.bottom + (theRect.right - theRect.left) div 8); LineTo(((theRect.left + theRect.right) div 2) + 1, kFloorVert - 7); PenPat(gray); MoveTo(((theRect.left + theRect.right) div 2) + 0, theRect.bottom + (theRect.right - theRect.left) div 8); LineTo(((theRect.left + theRect.right) div 2) + 0, kFloorVert - 7); end; PenNormal; tempRect := srcRect[kind];{***** Draw table base} OffsetRect(tempRect, -tempRect.left, -tempRect.top); OffsetRect(tempRect, ((theRect.left + theRect.right) div 2) - 31, kFloorVert - 7); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, srcRect[kind], srcRect[kind], tempRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, srcRect[kind], srcRect[kind], tempRect); SetPort(wasPort); end; {=================================} procedure DrawShelf (whichItem: Integer); var kind: Integer; theRect, tempRect: Rect; tempRgn: RgnHandle; wasPort: GrafPtr; begin GetPort(wasPort); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); PenNormal; with thisHouse.theRooms[roomAt].theObjects[whichItem] do begin kind := objectIs; theRect := boundRect; end; if (inColor) then {***** Draw shelf top} begin RGBForeColor(rgbLtBrown); PaintRect(theRect); FrameRect(theRect); MoveTo(theRect.left + 1, theRect.bottom - 2); LineTo(theRect.right - 1, theRect.bottom - 2); RGBForeColor(rgbWhite); MoveTo(theRect.left + 1, theRect.top + 1); LineTo(theRect.right - 2, theRect.top + 1); end else begin FillRect(theRect, gray); FrameRect(theRect); MoveTo(theRect.left + 1, theRect.bottom - 2); LineTo(theRect.right - 1, theRect.bottom - 2); PenPat(white); MoveTo(theRect.left + 1, theRect.top + 1); LineTo(theRect.right - 2, theRect.top + 1); end; PenNormal; tempRgn := NewRgn; {***** Draw shelf shadow} MoveTo(theRect.right, theRect.bottom - 1); OpenRgn; Line(-15, 15); LineTo(theRect.left - 15, theRect.bottom + 14); Line(0, -5); Line(15, -15); Line(0, 5); LineTo(theRect.right, theRect.bottom - 1); CloseRgn(tempRgn); PenPat(gray); if (inColor) then begin RGBForeColor(rgbBlack); PenMode(patCopy + transparent); PenPat(gray); PaintRgn(tempRgn); end else begin PenMode(patOr); PaintRgn(tempRgn); end; DisposeRgn(tempRgn); PenNormal; tempRect := srcRect[kind]; {***** Draw shelf bracket 1} OffsetRect(tempRect, -tempRect.left, -tempRect.top); {0 it out} OffsetRect(tempRect, theRect.left + 15, theRect.bottom - 2); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, srcRect[kind], srcRect[kind], tempRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, srcRect[kind], srcRect[kind], tempRect); tempRect := srcRect[kind]; {***** Draw shelf bracket 2} OffsetRect(tempRect, -tempRect.left, -tempRect.top); {0 it out} OffsetRect(tempRect, theRect.right - 25, theRect.bottom - 2); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, srcRect[kind], srcRect[kind], tempRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, srcRect[kind], srcRect[kind], tempRect); SetPort(wasPort); end; {=================================} procedure DrawMirror (whichItem: Integer); var theRect: Rect; wasPort: GrafPtr; begin if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); PenNormal; with thisHouse.theRooms[roomAt].theObjects[whichItem] do theRect := boundRect; if (inColor) then begin RGBForeColor(rgbBrown); PaintRect(theRect); RGBForeColor(rgbBlack); end else begin FillRect(theRect, gray); end; FrameRect(theRect); InsetRect(theRect, 3, 3); FillRect(theRect, white); FrameRect(theRect); PenNormal; end; {=================================} procedure DrawCabinet (whichItem: Integer); var panels, width, index, offIt: Integer; theRect, tempR: Rect; shadoRgn: RgnHandle; begin if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); PenNormal; with thisHouse.theRooms[roomAt].theObjects[whichItem] do theRect := boundRect; tempR := theRect; if (theRect.bottom > 280) then begin tempR.bottom := tempR.bottom - 5; if (inColor) then begin RGBForeColor(rgbBrown); PenMode(srcCopy + transparent); PaintRect(tempR); RGBForeColor(rgbBlack); end else begin FillRect(tempR, gray); end; FrameRect(tempR); tempR := theRect; InsetRect(tempR, 2, 0); tempR.top := tempR.bottom - 5; if (inColor) then PaintRect(tempR) else FillRect(tempR, dkGray); FrameRect(tempR); SetRect(tempR, theRect.left - 2, theRect.top, theRect.right + 2, theRect.top + 7); if (inColor) then begin RGBForeColor(rgbLtBrown); PenMode(srcCopy + transparent); PaintRect(tempR); RGBForeColor(rgbBlack); end else begin FillRect(tempR, ltGray); end; FrameRect(tempR); MoveTo(tempR.left + 2, tempR.bottom); LineTo(tempR.right - 3, tempR.bottom); shadoRgn := NewRgn; MoveTo(theRect.left, theRect.top + 5); OpenRgn; Line(-15, 15); LineTo(theRect.left - 15, theRect.bottom - 10); LineTo(theRect.left, theRect.bottom); LineTo(theRect.left, theRect.top + 5); CloseRgn(shadoRgn); HLock(Handle(shadoRgn)); if (inColor) then begin RGBForeColor(rgbBlack); PenMode(patCopy + transparent); PenPat(gray); PaintRgn(shadoRgn); end else begin PenMode(patOr); PenPat(gray); PaintRgn(shadoRgn); end; HUnlock(Handle(shadoRgn)); DisposeRgn(shadoRgn); PenNormal; offIt := 5; end else begin if (inColor) then begin RGBForeColor(rgbBrown); PenMode(srcCopy + transparent); PaintRect(theRect); RGBForeColor(rgbBlack); end else begin FillRect(theRect, gray); end; FrameRect(theRect); shadoRgn := NewRgn; MoveTo(theRect.left, theRect.top); OpenRgn; Line(-15, 15); LineTo(theRect.left - 15, theRect.bottom + 15); LineTo(theRect.right - 15, theRect.bottom + 15); Line(15, -15); LineTo(theRect.left, theRect.bottom); LineTo(theRect.left, theRect.top); CloseRgn(shadoRgn); HLock(Handle(shadoRgn)); if (inColor) then begin PenMode(srcCopy + transparent); PenPat(gray); PaintRgn(shadoRgn); end else begin PenMode(patOr); PenPat(gray); PaintRgn(shadoRgn); end; HUnlock(Handle(shadoRgn)); DisposeRgn(shadoRgn); PenNormal; offIt := 0; end; panels := (theRect.right - theRect.left) div 48; if (panels = 0) then begin tempR := theRect; InsetRect(tempR, 5, 5 + offIt); FrameRect(tempR); if (inColor) then begin RGBForeColor(rgbLtBrown); MoveTo(tempR.left + 3, tempR.top + 3); LineTo(tempR.left + 3, tempR.bottom - 4); LineTo(tempR.right - 4, tempR.bottom - 4); RGBForeColor(rgbBlack); LineTo(tempR.right - 4, tempR.top + 3); LineTo(tempR.left + 3, tempR.top + 3); end else begin PenPat(white); MoveTo(tempR.left + 3, tempR.top + 3); LineTo(tempR.left + 3, tempR.bottom - 4); LineTo(tempR.right - 4, tempR.bottom - 4); PenPat(black); LineTo(tempR.right - 4, tempR.top + 3); LineTo(tempR.left + 3, tempR.top + 3); end; end else begin width := ((theRect.right - theRect.left) - (panels + 1) * 5) div panels; SetRect(tempR, theRect.left + 5, theRect.top + 5 + offIt, theRect.left + 5 + width, theRect.bottom - 5 - offIt); for index := 1 to panels do begin if (inColor) then begin RGBForeColor(rgbLtBrown); MoveTo(tempR.left + 3, tempR.top + 3); LineTo(tempR.left + 3, tempR.bottom - 4); LineTo(tempR.right - 4, tempR.bottom - 4); RGBForeColor(rgbBlack); LineTo(tempR.right - 4, tempR.top + 3); LineTo(tempR.left + 3, tempR.top + 3); end else begin FrameRect(tempR); PenPat(white); MoveTo(tempR.left + 3, tempR.top + 3); LineTo(tempR.left + 3, tempR.bottom - 4); LineTo(tempR.right - 4, tempR.bottom - 4); PenPat(black); LineTo(tempR.right - 4, tempR.top + 3); LineTo(tempR.left + 3, tempR.top + 3); end; OffsetRect(tempR, width + 5, 0); end; end; PenNormal; end; {=================================} procedure DrawWindow (whichItem: Integer); var theRect, tempRect: Rect; kind: Integer; tempRgn: RgnHandle; windowOpen: Boolean; begin if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); PenNormal; with thisHouse.theRooms[roomAt].theObjects[whichItem] do begin kind := objectIs; theRect := boundRect; windowOpen := isOn; end; tempRgn := NewRgn; {***** Draw window shadow} MoveTo(theRect.left, theRect.top); OpenRgn; Line(-10, 10); Line(0, 5); Line(5, 5); LineTo(theRect.left - 5, theRect.bottom - 10); Line(-5, 5); Line(0, 5); Line(5, 5); LineTo(theRect.right - 5, theRect.bottom + 5); LineTo(theRect.right, theRect.bottom); LineTo(theRect.left, theRect.bottom); LineTo(theRect.left, theRect.top); CloseRgn(tempRgn); PenPat(gray); if (inColor) then begin RGBForeColor(rgbBlack); PenMode(patCopy + transparent); PenPat(gray); PaintRgn(tempRgn); end else begin PenMode(patOr); PaintRgn(tempRgn); end; DisposeRgn(tempRgn); PenNormal; if (inColor) then begin FillNFrame(rgbBrown, theRect); {***** Draw window frame and sill} HiLiteARect(rgbLtBrown, theRect); SetRect(tempRect, theRect.left - 4, theRect.top, theRect.right + 4, theRect.top + 6); FillNFrame(rgbBrown, tempRect); HiLiteARect(rgbLtBrown, tempRect); SetRect(tempRect, theRect.left - 2, theRect.top + 6, theRect.right + 2, theRect.top + 10); FillNFrame(rgbBrown, tempRect); SetRect(tempRect, theRect.left - 4, theRect.bottom - 6, theRect.right + 4, theRect.bottom); FillNFrame(rgbBrown, tempRect); HiLiteARect(rgbLtBrown, tempRect); SetRect(tempRect, theRect.left - 2, theRect.bottom - 10, theRect.right + 2, theRect.bottom - 5); FillNFrame(rgbBrown, tempRect); HiLiteARect(rgbLtBrown, tempRect); tempRect := theRect; InsetRect(tempRect, 8, 16); FillNFrame(rgbBrown, tempRect); LoLiteARect(tempRect); tempRect := theRect; {***** Draw the top window pane} InsetRect(tempRect, 8, 16); tempRect.bottom := ((theRect.bottom + theRect.top) div 2) + 2; FillNFrame(rgbBrown, tempRect); InsetRect(tempRect, 6, 6); LoLiteARect(tempRect); InsetRect(tempRect, 2, 2); LoLiteARect(tempRect); InsetRect(tempRect, 2, 2); FillNFrame(rgbBlack, tempRect); LoLiteARect(tempRect); tempRect := theRect; {Fill bottom black} InsetRect(tempRect, 8, 16); tempRect.top := ((theRect.bottom + theRect.top) div 2) + 2; FillRect(tempRect, black); tempRect := theRect; {***** Draw the bottom window pane} InsetRect(tempRect, 8, 16); tempRect.top := ((theRect.bottom + theRect.top) div 2) - 2; if (windowOpen) then OffsetRect(tempRect, 0, 26 - ((theRect.bottom - theRect.top) div 2)); FillNFrame(rgbBrown, tempRect); InsetRect(tempRect, 6, 6); LoLiteARect(tempRect); InsetRect(tempRect, 2, 2); LoLiteARect(tempRect); InsetRect(tempRect, 2, 2); FillNFrame(rgbBlack, tempRect); LoLiteARect(tempRect); RGBForeColor(rgbBlack); end else begin GrayNFrame(theRect); {***** Draw window frame and sill} GrayLiteARect(theRect); SetRect(tempRect, theRect.left - 4, theRect.top, theRect.right + 4, theRect.top + 6); GrayNFrame(tempRect); GrayLiteARect(tempRect); SetRect(tempRect, theRect.left - 2, theRect.top + 6, theRect.right + 2, theRect.top + 10); GrayNFrame(tempRect); SetRect(tempRect, theRect.left - 4, theRect.bottom - 6, theRect.right + 4, theRect.bottom); GrayNFrame(tempRect); GrayLiteARect(tempRect); SetRect(tempRect, theRect.left - 2, theRect.bottom - 10, theRect.right + 2, theRect.bottom - 5); GrayNFrame(tempRect); GrayLiteARect(tempRect); tempRect := theRect; InsetRect(tempRect, 8, 16); GrayNFrame(tempRect); GrayLoARect(tempRect); tempRect := theRect; {***** Draw the top window pane} InsetRect(tempRect, 8, 16); tempRect.bottom := ((theRect.bottom + theRect.top) div 2) + 2; GrayNFrame(tempRect); InsetRect(tempRect, 6, 6); GrayLoARect(tempRect); InsetRect(tempRect, 2, 2); GrayLoARect(tempRect); InsetRect(tempRect, 2, 2); FillRect(tempRect, black); GrayLoARect(tempRect); tempRect := theRect; {Fill bottom black} InsetRect(tempRect, 8, 16); tempRect.top := ((theRect.bottom + theRect.top) div 2) + 2; FillRect(tempRect, black); tempRect := theRect; {***** Draw the bottom window pane} InsetRect(tempRect, 8, 16); tempRect.top := ((theRect.bottom + theRect.top) div 2) - 2; if (windowOpen) then OffsetRect(tempRect, 0, 26 - ((theRect.bottom - theRect.top) div 2)); GrayNFrame(tempRect); InsetRect(tempRect, 6, 6); GrayLoARect(tempRect); InsetRect(tempRect, 2, 2); GrayLoARect(tempRect); InsetRect(tempRect, 2, 2); FillRect(tempRect, black); GrayLoARect(tempRect); end; end; {=================================} procedure DrawStair (whichItem: Integer); var refNumber, kind: Integer; tempByte: SignedByte; theRect: Rect; thePict: PicHandle; begin if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); with thisHouse.theRooms[roomAt].theObjects[whichItem] do begin kind := objectIs; theRect := boundRect; end; refNumber := OpenResFile(resourceName); if (refNumber = -1) then begin CloseResFile(refNumber); UseResFile(gliderResNum); GenericAlert(kErrGraphicsNotFound); Exit(DrawStair); end; if (kind = upStar) then thePict := GetPicture(198) else thePict := GetPicture(199); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, theRect); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrGraphicLoad); end; ReleaseResource(Handle(thePict)); CloseResFile(refNumber); UseResFile(gliderResNum); end; {=================================} procedure DrawAllObjects; var index: Integer; theSrc, destRect, destReserve: Rect; airPat: Pattern; airCPat: PixPatHandle; begin if ((nObjects < 0) or (nObjects > 16)) then begin GenericAlert(kErrWrongHouseVers); ShowMenuBar; Exit(DrawAllObjects); end; if (nObjects = 0) then begin if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, wholeRgn) else CopyBits(offVirginMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, wholeRgn); Exit(DrawAllObjects); end; if (lightsOut) then begin if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); PenNormal; PaintRect(wholeArea); for index := 1 to thisHouse.theRooms[roomAt].numberOObjects do with thisHouse.theRooms[roomAt].theObjects[index] do if (objectIs = litSwt) then begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, theSrc, theSrc, destRect); end; Exit(DrawAllObjects); end; for index := 1 to thisHouse.theRooms[roomAt].numberOObjects do with thisHouse.theRooms[roomAt].theObjects[index] do case objectIs of table: DrawTable(index); shelf: DrawShelf(index); cabNet: DrawCabinet(index); books: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, theSrc, theSrc, destRect); end; flrVnt..candle: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, theSrc, theSrc, destRect); if (airVisible) then begin if (inColor) then begin SetPort(GrafPtr(virginCPtr)); PenNormal; RGBForeColor(rgbBlack); airCPat := GetPixPat(128); if (airCPat <> nil) then PenPixPat(airCPat); PenMode(srcCopy + transparent); PaintRect(eventRect[index]); if (airCPat <> nil) then DisposPixPat(airCPat); PenNormal; end else begin SetPort(offVirginPort); PenNormal; GetIndPattern(airPat, 128, 1); PenPat(airPat); PaintRect(eventRect[index]); PenNormal; end; end; end; lftFan, ritFan: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, theSrc, theSrc, destRect); if (airVisible) then begin if (inColor) then begin SetPort(GrafPtr(virginCPtr)); PenNormal; RGBForeColor(rgbBlack); airCPat := GetPixPat(129); if (airCPat <> nil) then PenPixPat(airCPat); PenMode(srcCopy + transparent); PaintRect(eventRect[index]); if (airCPat <> nil) then DisposPixPat(airCPat); PenNormal; end else begin SetPort(offVirginPort); PenNormal; GetIndPattern(airPat, 128, 2); PenPat(airPat); PaintRect(eventRect[index]); end; end; end; grease: begin destRect := boundRect; if (not isOn) then begin theSrc := srcRect[59]; {spilled grease} if (inColor) then begin SetPort(GrafPtr(virginCPtr)); PenNormal; RGBForeColor(rgbBlack); PenSize(2, 2); MoveTo(destRect.right, destRect.bottom - 2); LineTo(amount, destRect.bottom - 2); CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, theSrc, theSrc, destRect); end else begin SetPort(offVirginPort); PenNormal; PenSize(2, 2); MoveTo(destRect.right, destRect.bottom - 2); LineTo(amount, destRect.bottom - 2); CopyMask(offPlayerMap, offMaskMap, offVirginMap, theSrc, theSrc, destRect); end; end; end; clock, paper, battry, rbrBnd: if (amount > 0) then begin theSrc := srcRect[objectIs]; destRect := boundRect; destReserve := destRect; OffsetRect(destReserve, -destReserve.left, -destReserve.top); OffsetRect(destReserve, reserveRects[index].left, reserveRects[index].top); if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(reserveCPtr^.portPixMap^)^, destRect, destReserve, srcCopy, nil); CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, theSrc, theSrc, destRect) end else begin CopyBits(offVirginMap, offReserveMap, destRect, destReserve, srcCopy, nil); CopyMask(offPlayerMap, offMaskMap, offVirginMap, theSrc, theSrc, destRect); end; end; litSwt..guitar: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, theSrc, theSrc, destRect); end; drip: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, theSrc, theSrc, destRect); end; toastr, fshBwl, teaKtl: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, theSrc, theSrc, destRect); end; window: DrawWindow(index); mirror: DrawMirror(index); paintg: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, BitMapPtr(virginCPtr^.portPixMap^)^, theSrc, destRect, srcCopy, nil) else CopyBits(offPlayerMap, offVirginMap, theSrc, destRect, srcCopy, nil); end; basket, macTsh: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, theSrc, theSrc, destRect); end; upStar, dnStar: DrawStair(index); otherwise Cycle; end; end; {=================================} procedure PopTheScore (whatScore: LongInt); var tempStr: Str255; begin PenNormal; PaintRect(lgScoreRect); NumToString(whatScore, tempStr); MoveTo(224, 17); TextFont(SystemFont); TextSize(12); if (inColor) then begin RGBForeColor(rgbLtBlue); PenMode(srcOr); DrawString(tempStr); PenNormal; RGBForeColor(rgbBlack); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, smScoreRect, smScoreRect, srcCopy, wholeRgn); end else begin TextMode(patXOr); DrawString(tempStr); if (mainScreenHidden) then CopyBits(offVirginMap, offLoadMap, smScoreRect, smScoreRect, srcCopy, nil) else CopyBits(offVirginMap, mainWndo^.portBits, smScoreRect, smScoreRect, srcCopy, nil); end; end; {=================================} procedure BumpTheScore; begin rollScore := rollScore + scoreIncrement; if (rollScore < (roomScore + suppScore)) then begin PopTheScore(rollScore); DoTheSound(21); end else begin scoreIsRolling := FALSE; rollScore := roomScore + suppScore; PopTheScore(rollScore); if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, smScoreRect, smScoreRect, srcCopy, nil) else begin CopyBits(offVirginMap, mainWndo^.portBits, smScoreRect, smScoreRect, srcCopy, nil); CopyBits(offVirginMap, offLoadMap, smScoreRect, smScoreRect, srcCopy, nil); end; end; end; {=================================} procedure StartScoreRolling; begin if (rollScore < (roomScore + suppScore)) then begin rollScore := roomScore + suppScore; PopTheScore(rollScore); end; scoreIsRolling := TRUE; end; {=================================} procedure UpdateBandNumbers; var tempStr: Str255; dest: Rect; begin SetRect(dest, 346, 5, 359, 20); FillRect(dest, black); MoveTo(dest.left, dest.bottom - 2); TextFont(16); TextSize(12); if (theGlider.bands < 100) then NumToString(theGlider.bands, tempStr) else tempStr := '++'; if (inColor) then begin RGBForeColor(rgbLtGreen); PenMode(srcOr); DrawString(tempStr); PenNormal; RGBForeColor(rgbBlack); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, dest, dest, srcCopy, nil); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, dest, dest, srcCopy, wholeRgn); end else begin TextMode(patXOr); DrawString(tempStr); PenNormal; CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil); CopyBits(offVirginMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn); end; end; {=================================} procedure PopTokenBand; var src, dest: Rect; begin SetRect(src, 36, 301, 45, 316); SetRect(dest, 359, 5, 368, 20); if (inColor) then begin CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, src, src, dest); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, dest, dest, srcCopy, wholeRgn) end else begin CopyMask(offPlayerMap, offMaskMap, offVirginMap, src, src, dest); CopyBits(offVirginMap, mainWndo^.portBits, dest, dest, srcCopy, nil); CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil); end; end; {=================================} procedure UpdateBatteryEnergy; var tempStr: Str255; dest: Rect; begin SetRect(dest, 308, 5, 326, 20); FillRect(dest, black); MoveTo(dest.left, dest.bottom - 2); TextFont(16); TextSize(12); if (theGlider.energy < 1000) then NumToString(theGlider.energy, tempStr) else tempStr := '+++'; if (inColor) then begin RGBForeColor(rgbYellow); PenMode(srcOr); DrawString(tempStr); PenNormal; RGBForeColor(rgbBlack); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, dest, dest, srcCopy, nil); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, dest, dest, srcCopy, wholeRgn); end else begin TextMode(patXOr); DrawString(tempStr); PenNormal; CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil); CopyBits(offVirginMap, mainWndo^.portBits, dest, dest, srcCopy, wholeRgn); end; end; {=================================} procedure PopTokenBattery; var src, dest: Rect; begin SetRect(src, 46, 301, 55, 316); SetRect(dest, 326, 5, 335, 20); if (inColor) then begin CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, src, src, dest); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, dest, dest, srcCopy, wholeRgn); end else begin CopyMask(offPlayerMap, offMaskMap, offVirginMap, src, src, dest); CopyBits(offVirginMap, mainWndo^.portBits, dest, dest, srcCopy, nil); CopyBits(offVirginMap, offLoadMap, dest, dest, srcCopy, nil); end; end; {=================================} procedure DrawHeadline; var index, shown: Integer; srcR, tempRect: Rect; tempStr: Str255; begin if (inColor) then {Draw the title of room} SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); SetRect(tempRect, 3, 2, 162, 23); EraseRect(tempRect); PenNormal; TextFont(SystemFont); TextSize(12); FrameRect(tempRect); MoveTo(tempRect.left - 1, tempRect.top + 2); LineTo(tempRect.left - 1, tempRect.bottom); LineTo(tempRect.right - 2, tempRect.bottom); tempStr := thisHouse.theRooms[roomAt].roomName; MoveTo(tempRect.left + 4, tempRect.top + 15); if (inColor) then begin InsetRect(tempRect, 2, 2); InvertRect(tempRect); RGBForeColor(rgbRed); PenMode(srcOr); DrawString(tempStr); PenNormal; RGBForeColor(rgbBlack); end else begin DrawString(tempStr); InsetRect(tempRect, 2, 2); InvertRect(tempRect); end; SetRect(srcR, 36, 318, 54, 341); {Pop up number of room} SetRect(tempRect, 165, 1, 183, 24); if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, BitMapPtr(virginCPtr^.portPixMap^)^, srcR, tempRect, srcCopy, wholeRgn) else CopyBits(offPlayerMap, offVirginMap, srcR, tempRect, srcCopy, wholeRgn); if (roomsPassed > 99) then shown := roomsPassed div 100 else begin if (roomsPassed > 9) then shown := roomsPassed div 10 else shown := roomsPassed; end; MoveTo(tempRect.left + 5, tempRect.bottom - 6); NumToString(shown, tempStr); DrawString(tempStr); if (roomsPassed > 9) then begin OffsetRect(srcR, 18, 0); OffsetRect(tempRect, 20, 0); if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, BitMapPtr(virginCPtr^.portPixMap^)^, srcR, tempRect, srcCopy, wholeRgn) else CopyBits(offPlayerMap, offVirginMap, srcR, tempRect, srcCopy, wholeRgn); if (roomsPassed > 99) then shown := (roomsPassed div 10) - (roomsPassed mod 10) else shown := roomsPassed mod 10; MoveTo(tempRect.left + 6, tempRect.bottom - 6); NumToString(shown, tempStr); DrawString(tempStr); if (roomsPassed > 99) then begin OffsetRect(srcR, -18, 0); OffsetRect(tempRect, 20, 0); if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, BitMapPtr(virginCPtr^.portPixMap^)^, srcR, tempRect, srcCopy, wholeRgn) else CopyBits(offPlayerMap, offVirginMap, srcR, tempRect, srcCopy, wholeRgn); shown := roomsPassed mod 100; MoveTo(tempRect.left + 5, tempRect.bottom - 6); NumToString(shown, tempStr); DrawString(tempStr); end; end; PenNormal; {Draw all 'token' gliders} SetRect(tempRect, 302, 2, 510, 23); EraseRect(tempRect); FrameRect(tempRect); MoveTo(tempRect.left - 1, tempRect.top + 2); LineTo(tempRect.left - 1, tempRect.bottom); LineTo(tempRect.right - 2, tempRect.bottom); InsetRect(tempRect, 2, 2); InvertRect(tempRect); if (Mortals > 1) then begin if (Mortals > 3) then begin SetRect(tempRect, 384, 5, 396, 20); MoveTo(tempRect.left, tempRect.bottom - 2); TextFont(16); TextSize(12); NumToString(mortals - 1, tempStr); if (inColor) then begin RGBForeColor(rgbRed); PenMode(srcOr); DrawString(tempStr); PenNormal; RGBForeColor(rgbBlack); end else begin TextMode(patXOr); DrawString(tempStr); PenNormal; end; shown := 3; end else shown := Mortals - 1; SetRect(tempRect, 470, 5, 505, 20); SetRect(srcR, 0, 318, 35, 333); for index := 1 to shown do begin if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, srcR, srcR, tempRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, srcR, srcR, tempRect); OffsetRect(tempRect, -37, 0); end; end; PenNormal; {Draw score box} SetRect(tempRect, 220, 2, 298, 23); EraseRect(tempRect); FrameRect(tempRect); MoveTo(tempRect.left - 1, tempRect.top + 2); LineTo(tempRect.left - 1, tempRect.bottom); LineTo(tempRect.right - 2, tempRect.bottom); InsetRect(tempRect, 2, 2); InvertRect(tempRect); PopTheScore(rollScore); if (theGlider.bands > 0) then begin PopTokenBand; UpdateBandNumbers; end; if (theGlider.energy > 0) then begin PopTokenBattery; UpdateBatteryEnergy; end; end; {=================================} procedure ResetGlider; begin with theGlider do begin if (mode <> burning) then begin timeStamp := 0; mode := fadingIn; phase := 0; isForward := TRUE; if (isRight) then srcNum := 0 else srcNum := 2; end; if (enteredLeft) then SetRect(destRect, 0, 40, 48, 60) else SetRect(destRect, 464, 40, 512, 60); oldRect := destRect; wholeRect := destRect; shadoDest := destRect; shadoDest.top := kFloorVert; shadoDest.bottom := kFloorVert + 11; oldShado := shadoDest; wholeShado := shadoDest; touchRect := destRect; InsetRect(touchRect, 10, 5); end; lifeNormal := FALSE; end; {=================================} procedure ResetAnimate; begin with theAnimates[index] do begin if (typeIs <> -1) then begin delay := thisHouse.theRooms[roomAt].animateDelay; kind := typeIs; unSeen := TRUE; end; case kind of 0: {dart} begin with destRect do begin left := 512; right := left + 64; top := Randomize(150); bottom := top + 22; end; phase := 0; horiOff := -8; vertOff := 1; end; 1: {copter} begin with destRect do begin left := Randomize(256) + 256; right := left + 32; top := -32; bottom := 0; end; phase := Randomize(8); horiOff := -4; vertOff := 2; end; 2: {balloon} begin with destRect do begin left := Randomize(400) + 50; right := left + 32; top := 342; bottom := 374; end; phase := Randomize(8); horiOff := 0; vertOff := -3; end; otherwise ; end; wholeRect := destRect; oldRect := destRect; tickStamp := Randomize(LoWord(delay) + 120) + TickCount + 60; end; {with theAnimates[index]} end; {=================================} procedure ExtractEventRects; var index, tempInt, tempNum: Integer; tempRect: Rect; {-------------------------} procedure SetUpGrease; begin nCycleObs := nCycleObs + 1; with thisHouse.theRooms[roomAt].theObjects[index] do begin if (isOn) then {hasn't been spilled} begin eventRect[index] := boundRect; with cycleObjects[nCycleObs] do begin kindIs := grease; tiedTo := index; wholeRect := eventRect[index]; oldRect := wholeRect; reset := 0; {phase=not spilled} accel := grease; {graphic # to display} velocity := wholeRect.right;{current length of spill} position := amount; {full length of spill} end; end else {has been spilled} begin with cycleObjects[nCycleObs] do begin kindIs := grease; tiedTo := index; wholeRect := boundRect; oldRect := wholeRect; eventRect[index].left := boundRect.right; eventRect[index].bottom := boundRect.bottom; eventRect[index].right := amount; eventRect[index].top := boundRect.bottom - 5; reset := 999; {phase=spilled} accel := 59; {graphic # to display} velocity := amount; {current length of spill} position := amount; {length of spill} end; end; end; end; {-------------------------} procedure FrameOutlet; begin nCycleObs := nCycleObs + 1; eventRect[index] := thisHouse.theRooms[roomAt].theObjects[index].boundRect; with cycleObjects[nCycleObs] do begin kindIs := outlet; tiedTo := index; eventKind[tiedTo, 1] := 0; accel := 25; wholeRect := thisHouse.theRooms[roomAt].theObjects[index].boundRect; oldRect := wholeRect; reset := thisHouse.theRooms[roomAt].theObjects[index].amount; position := TickCount; end; end; {-------------------------} procedure FrameCandle; begin nCycleObs := nCycleObs + 1; with thisHouse.theRooms[roomAt].theObjects[index] do begin tempInt := (boundRect.right + boundRect.left) div 2; SetRect(eventRect[index], tempInt - 12, amount, tempInt + 4, boundRect.top); end; with cycleObjects[nCycleObs] do begin wholeRect := thisHouse.theRooms[roomAt].theObjects[index].boundRect; wholeRect.bottom := wholeRect.top; wholeRect.top := wholeRect.bottom - 12; wholeRect.left := wholeRect.left + 5; wholeRect.right := wholeRect.left + 16; oldRect := wholeRect; kindIs := candle; position := Randomize(3) + 48; end; end; {-------------------------} procedure FrameDrip; begin nCycleObs := nCycleObs + 1; eventRect[index] := thisHouse.theRooms[roomAt].theObjects[index].boundRect; with cycleObjects[nCycleObs] do begin kindIs := drip; tiedTo := index; holdRect := thisHouse.theRooms[roomAt].theObjects[index].boundRect; wholeRect := holdRect; oldRect := wholeRect; reset := thisHouse.theRooms[roomAt].theObjects[index].amount * 32; accel := 12; position := holdRect.bottom * 32; velocity := 0; phase := 53; end; end; {-------------------------} procedure ReadyToast; begin nCycleObs := nCycleObs + 1; with thisHouse.theRooms[roomAt].theObjects[index] do begin tempInt := boundRect.left + 3; tempNum := boundRect.bottom - 3; SetRect(eventRect[index], 0, 0, 32, 31); OffsetRect(eventRect[index], tempInt, tempNum); SetRect(tempRect, tempInt, amount, tempInt + 32, boundRect.top); end; toastRgn := NewRgn; RectRgn(toastRgn, tempRect); HLock(Handle(toastRgn)); hasToast := TRUE; with cycleObjects[nCycleObs] do begin phase := 60; kindIs := toastr; tiedTo := index; wholeRect := eventRect[index]; oldRect := wholeRect; reset := tempNum * 32; accel := 8; position := reset; tempInt := (thisHouse.theRooms[roomAt].theObjects[index].amount + 32) * 32; velocity := 0; repeat velocity := velocity + accel; tempInt := tempInt + velocity; until (tempInt > reset); velocity := -velocity; end; end; {-------------------------} procedure FrameBall; begin nCycleObs := nCycleObs + 1; eventRect[index] := thisHouse.theRooms[roomAt].theObjects[index].boundRect; with cycleObjects[nCycleObs] do begin kindIs := ball; tiedTo := index; wholeRect := thisHouse.theRooms[roomAt].theObjects[index].boundRect; oldRect := wholeRect; reset := thisHouse.theRooms[roomAt].theObjects[index].boundRect.bottom * 32; accel := 8; position := reset; tempInt := (thisHouse.theRooms[roomAt].theObjects[index].amount + 32) * 32; velocity := 0; repeat velocity := velocity + accel; tempInt := tempInt + velocity; until (tempInt > reset); velocity := -velocity; end; end; {-------------------------} procedure ReadyFish; begin nCycleObs := nCycleObs + 1; with thisHouse.theRooms[roomAt].theObjects[index] do begin tempInt := boundRect.left + 8; tempNum := boundRect.top + 24; SetRect(eventRect[index], 0, 0, 16, 16); {fish rectangle} OffsetRect(eventRect[index], tempInt, tempNum); end; with cycleObjects[nCycleObs] do begin phase := 69; {# of fish rect} kindIs := fshBwl; tiedTo := index; wholeRect := eventRect[index]; oldRect := wholeRect; reset := tempNum * 32; accel := 8; position := reset; tempInt := (thisHouse.theRooms[roomAt].theObjects[index].amount + 32) * 32; velocity := 0; repeat velocity := velocity + accel; tempInt := tempInt + velocity; until (tempInt > reset); velocity := -velocity; end; end; {-------------------------} procedure ReadyTea; begin nCycleObs := nCycleObs + 1; with thisHouse.theRooms[roomAt].theObjects[index] do begin tempInt := boundRect.left; tempNum := boundRect.top; SetRect(eventRect[index], tempInt - 128, tempNum - 128, tempInt, tempNum); if (eventRect[index].top < kCeilingVert) then eventRect[index].top := kCeilingVert; if (eventRect[index].left < 0) then eventRect[index].left := 0; end; with cycleObjects[nCycleObs] do begin phase := 0; kindIs := teaKtl; tiedTo := index; SetRect(wholeRect, 0, 0, 0, 0); oldRect := wholeRect; position := thisHouse.theRooms[roomAt].theObjects[index].amount; reset := position + Randomize(120); end; end; {-------------------------} procedure FrameWindow; var i, joint: Integer; topRect, bottomRect: Rect; tempRgn: RgnHandle; begin nObjects := nObjects - 1; with thisHouse.theRooms[roomAt].theObjects[index] do begin if (isOn) then begin topRect := boundRect; {create top opening} InsetRect(topRect, 8, 16); topRect.top := ((boundRect.bottom + boundRect.top) div 2) - 2; OffsetRect(topRect, 0, 26 - ((boundRect.bottom - boundRect.top) div 2)); InsetRect(topRect, 10, 10); bottomRect := boundRect; {create bottom opening} InsetRect(bottomRect, 8, 16); bottomRect.top := ((boundRect.bottom + boundRect.top) div 2) + 10; windowOpen := TRUE; end else begin topRect := boundRect; {create top opening} InsetRect(topRect, 8, 16); topRect.bottom := ((boundRect.bottom + boundRect.top) div 2) + 2; InsetRect(topRect, 10, 10); bottomRect := boundRect; {create bottom opening} InsetRect(bottomRect, 8, 16); bottomRect.top := ((boundRect.bottom + boundRect.top) div 2) - 2; InsetRect(bottomRect, 10, 10); end; end; windowRgn := NewRgn; RectRgn(windowRgn, topRect); tempRgn := NewRgn; RectRgn(tempRgn, bottomRect); UnionRgn(windowRgn, tempRgn, windowRgn); HLock(Handle(windowRgn)); DisposeRgn(tempRgn); UnionRect(topRect, bottomRect, tempRect); tempInt := (tempRect.bottom - tempRect.top) div 7; with theLightning do begin for i := 1 to 3 do begin theBolts[i, 0, 0] := tempRect.left + Randomize(tempRect.right - tempRect.left); theBolts[i, 0, 1] := tempRect.top; for joint := 1 to 7 do repeat theBolts[i, joint, 0] := theBolts[i, joint - 1, 0] + Randomize(tempInt * 4) - tempInt * 2; theBolts[i, joint, 1] := tempInt * joint + tempRect.top; until ((theBolts[i, joint, 0] > tempRect.left) and (theBolts[i, joint, 0] < tempRect.right)); end; whichBolt := Randomize(3) + 1; whatTime := TickCount + 120 + Randomize(120); whatPhase := 0; end; hasWindow := TRUE; end; {-------------------------} procedure FrameMirror; begin nObjects := nObjects - 1; with thisHouse.theRooms[roomAt].theObjects[index] do tempRect := boundRect; InsetRect(tempRect, 5, 5); mirrorRgn := NewRgn; RectRgn(mirrorRgn, tempRect); HLock(Handle(mirrorRgn)); hasMirror := TRUE; end; {-------------------------} begin if (hasMirror) then begin hasMirror := FALSE; HUnlock(Handle(mirrorRgn)); DisposeRgn(mirrorRgn); end; if (hasWindow) then begin hasWindow := FALSE; HUnlock(Handle(windowRgn)); DisposeRgn(windowRgn); end; if (hasToast) then begin hasToast := FALSE; HUnlock(Handle(toastRgn)); DisposeRgn(toastRgn); end; windowOpen := FALSE; if (thisHouse.theRooms[roomAt].conditionCode = 2) then lightsOut := TRUE else lightsOut := FALSE; if (thisHouse.theRooms[roomAt].conditionCode = 1) then airOut := TRUE else airOut := FALSE; nCycleObs := 0; nObjects := thisHouse.theRooms[roomAt].numberOObjects; tempNum := nObjects; for index := 1 to tempNum do with thisHouse.theRooms[roomAt].theObjects[index] do begin case objectIs of table..obsRct: eventRect[index] := boundRect; flrVnt: begin tempInt := (boundRect.right + boundRect.left) div 2; SetRect(eventRect[index], tempInt - 8, amount, tempInt + 8, kFloorVert); end; celVnt: begin tempInt := (boundRect.right + boundRect.left) div 2; SetRect(eventRect[index], tempInt - 8, kCeilingVert, tempInt + 8, amount); end; celDct: if (isOn) then begin tempInt := (boundRect.right + boundRect.left) div 2; SetRect(eventRect[index], tempInt - 8, kCeilingVert, tempInt + 8, amount); end else begin eventRect[index] := boundRect; eventRect[index].bottom := eventRect[index].top + 8; end; candle: FrameCandle; lftFan: SetRect(eventRect[index], amount, boundRect.top + 10, boundRect.left, boundRect.top + 30); ritFan: SetRect(eventRect[index], boundRect.right, boundRect.top + 10, amount, boundRect.top + 30); clock, paper: eventRect[index] := boundRect; grease: SetUpGrease; bnsRct..rbrBnd: eventRect[index] := boundRect; litSwt, thermo, pwrSwt: eventRect[index] := boundRect; shredr: begin eventRect[index] := boundRect; eventRect[index].top := eventRect[index].top - 4; eventRect[index].bottom := eventRect[index].bottom - 12; end; outlet: FrameOutlet; guitar: with boundRect do SetRect(eventRect[index], left + 36, top + 24, left + 38, bottom - 56); ball: FrameBall; drip: FrameDrip; toastr: ReadyToast; fshBwl: ReadyFish; teaKtl: ReadyTea; window: FrameWindow; paintg: nObjects := nObjects - 1; mirror: FrameMirror; basket, macTsh: eventRect[index] := boundRect; upStar: with boundRect do SetRect(eventRect[index], left + 32, top, right - 32, top + 8); dnStar: with boundRect do SetRect(eventRect[index], left + 32, bottom - 8, right - 32, bottom); otherwise eventRect[index] := nullRect; end; {case} eventKind[index, 1] := 0; case objectIs of table, shelf, books, cabnet, obsRct, drip, toastr, ball, fshBwl, basket, macTsh: eventKind[index, 0] := crashIt; extRct: begin eventKind[index, 0] := moveIt; eventKind[index, 1] := amount; end; flrVnt: eventKind[index, 0] := liftIt; celVnt: eventKind[index, 0] := dropIt; celDct: if (isOn) then eventKind[index, 0] := dropIt else begin eventKind[index, 0] := moveIt; eventKind[index, 1] := extra; end; candle: begin eventKind[index, 0] := burnIt; eventKind[index, 1] := boundRect.bottom - 48; end; lftFan: if (isOn) then eventKind[index, 0] := turnItLeft else eventKind[index, 0] := ignoreIt; ritFan: if (isOn) then eventKind[index, 0] := turnItRight else eventKind[index, 0] := ignoreIt; clock: begin eventKind[index, 0] := awardIt; eventKind[index, 1] := amount; if (amount < 1) then eventRect[index] := nullRect; end; paper: begin eventKind[index, 0] := extraIt; eventKind[index, 1] := amount; if (amount < 1) then eventRect[index] := nullRect; end; grease: if (isOn) then eventKind[index, 0] := spillIt else eventKind[index, 0] := slideIt; bnsRct: begin eventKind[index, 0] := trickIt; eventKind[index, 1] := amount; if (amount < 1) then eventRect[index] := nullRect; end; battry: begin eventKind[index, 0] := energizeIt; eventKind[index, 1] := amount; if (amount < 1) then eventRect[index] := nullRect; end; rbrBnd: begin eventKind[index, 0] := bandIt; eventKind[index, 1] := amount; if (amount < 1) then eventRect[index] := nullRect; end; litSwt: eventKind[index, 0] := lightIt; outlet: eventKind[index, 0] := zapIt; thermo: eventKind[index, 0] := airOnIt; shredr: if (isOn) then eventKind[index, 0] := shredIt else eventKind[index, 0] := ignoreIt; pwrSwt: begin eventKind[index, 0] := toggleIt; eventKind[index, 1] := amount; {object# linked to} eventKind[index, 2] := TickCount;{delay from when hit} end; guitar: begin eventKind[index, 0] := playIt; eventKind[index, 1] := 0; end; upStar: begin eventKind[index, 0] := ascendIt; eventKind[index, 1] := amount; {room # linked to} end; dnStar: begin eventKind[index, 0] := descendIt; eventKind[index, 1] := amount; {room # linked to} end; otherwise eventKind[index, 0] := ignoreIt; end; {case} end; end; {=================================} procedure ReadyRoom; var index: Integer; begin with thisHouse.theRooms[roomAt] do begin rightIsOpen := rightOpen; leftIsOpen := leftOpen; if (animateNumber > 0) then begin nAnimates := animateNumber; for index := 1 to nAnimates do ResetAnimate(animateKind, index); end else nAnimates := 0; end; bandBorne := FALSE; floatPoints.out := FALSE; ExtractEventRects; LoadABackground(thisHouse.theRooms[roomAt].backPictID); DoTheMusic(kMusicSound); ArrangeTiles; DrawAllObjects; DrawHeadline; end; {=================================} procedure WriteScores; type scoreHold = record score: array[0..19] of LongInt; level: array[0..19] of Integer; name: array[0..19] of string[24]; room: array[0..19] of string[24]; end; var i, temp: Integer; textLength: LongInt; tempScore: scoreHold; houseVolName: Str255; begin with tempScore, thisHouse do {**** Hold copy of scores****} for i := 0 to 19 do begin score[i] := hiScores[i]; level[i] := hiLevel[i]; name[i] := hiName[i]; room[i] := hiRoom[i]; end; theErr := SetVol(nil, houseVolNum); if (theErr <> NoErr) then begin GenericAlert(theErr); Exit(WriteScores); end; theErr := FSOpen(housesName, houseVolNum, houseNumber); if (theErr <> NoErr) then begin GenericAlert(theErr); Exit(WriteScores); end; theErr := SetFPos(houseNumber, FSFromStart, 0); if (theErr <> NoErr) then {**** Read in virgin house ****} begin GenericAlert(theErr); Exit(WriteScores); end; textLength := SIZEOF(thisHouse); theErr := FSRead(houseNumber, textLength, @thisHouse); if (theErr <> NoErr) then begin GenericAlert(theErr); Exit(WriteScores); end; with tempScore, thisHouse do {**** modify hi scores ****} for i := 0 to 19 do begin hiScores[i] := score[i]; hiLevel[i] := level[i]; hiName[i] := name[i]; hiRoom[i] := room[i]; end; {with} theErr := SetFPos(houseNumber, FSFromStart, 0); if (theErr <> NoErr) then {**** write out new file ****} begin GenericAlert(theErr); Exit(WriteScores); end; theErr := FSWrite(houseNumber, textLength, @thisHouse); if (theErr <> NoErr) then begin GenericAlert(theErr); Exit(WriteScores); end; theErr := SetEOF(houseNumber, textLength); if (theErr <> NoErr) then begin GenericAlert(theErr); Exit(WriteScores); end; theErr := FSClose(houseNumber); {**** close file ****} if (theErr <> NoErr) then begin GenericAlert(theErr); Exit(WriteScores); end; end; {=================================} function TypewriterFilter (theDialog: DialogPtr; var theEvent: EventRecord; var itemHit: integer): boolean; var tempRect: Rect; begin TypewriterFilter := FALSE; if (theEvent.what = KeyDown) then begin if (BitAnd(theEvent.message, CharCodeMask) = kReturnKey) then begin itemHit := 1; TypewriterFilter := TRUE; end else begin {play typewriter keystroke} DoTheSound(kTapSound); end; end; end; {=================================} procedure GetName (theRank: Integer; theScore: LongInt); const okayItem = 1; nameItem = 2; rankItem = 3; scoreItem = 4; var wasPort: GrafPtr; leaveDlg: boolean; itemT, itemHit: Integer; tempStr: Str255; itemH: Handle; theDlgPtr: DialogPtr; tempRect: Rect; {----------------------------------} procedure RefreshIt; begin SetPort(theDlgPtr); GetDItem(theDlgPtr, okayItem, itemT, itemH, tempRect); PenSize(3, 3); InsetRect(tempRect, -4, -4); FrameRoundRect(tempRect, 16, 16); PenSize(1, 1); end; {----------------------------------} begin DoTheSound(kWhistleSound); FlushEvents(EveryEvent, 0); GetPort(wasPort); theDlgPtr := GetNewDialog(128, nil, Pointer(-1));{Bring in the dialog resource} tempRect := theDlgPtr^.portRect; {Get window size, we will now center it} tempRect.Top := ((screenBits.Bounds.Bottom - screenBits.Bounds.Top) - (tempRect.Bottom - tempRect.Top)) div 2; tempRect.Left := ((screenBits.Bounds.Right - screenBits.Bounds.Left) - (tempRect.Right - tempRect.Left)) div 2; MoveWindow(theDlgPtr, tempRect.Left, tempRect.Top, TRUE);{Now move the window to the proper position} ShowWindow(theDlgPtr); {Open a dialog box} SelectWindow(theDlgPtr); SetPort(theDlgPtr); GetDItem(theDlgPtr, rankItem, itemT, itemH, tempRect); NumToString(theRank + 1, tempStr); SetIText(itemH, tempStr); GetDItem(theDlgPtr, scoreItem, itemT, itemH, tempRect); NumToString(theScore, tempStr); SetIText(itemH, tempStr); GetDItem(theDlgPtr, nameItem, itemT, itemH, tempRect); SetIText(itemH, playerName); SelIText(theDlgPtr, nameItem, 0, 24); RefreshIt; leaveDlg := FALSE; repeat ModalDialog(@TypewriterFilter, itemHit); GetDItem(theDlgPtr, itemHit, itemT, itemH, tempRect); if (ItemHit = okayItem) then begin {play typewriter carriage return} DoTheSound(kCRSound); leaveDlg := TRUE; end; until leaveDlg; GetDItem(theDlgPtr, nameItem, itemT, itemH, tempRect); GetIText(itemH, tempStr); playerName := COPY(tempStr, 1, 24); DisposDialog(theDlgPtr); SetPort(GrafPtr(wasPort)); end; {=================================} procedure SortHiScores; var i: Integer; tempLong: LongInt; lastName: Str255; begin if (roomAt < 1) then begin roomsPassed := 0; lastName := 'Completed the House'; end else lastName := thisHouse.theRooms[roomAt].roomName; tempLong := suppScore + roomScore; if (housesName <> firstFileName) then begin housesName := firstFileName; if (not GetHouse) then Exit(SortHiScores); end; if (refuseHigh) then Exit(SortHiScores); with scoreList, thisHouse do begin if (tempLong <= hiScores[19]) then rank := 20 else begin changed := TRUE; hiScores[19] := tempLong; hiLevel[19] := roomsPassed; hiName[19] := ''; hiRoom[19] := lastName; rank := 19; for i := 18 downto 0 do if (tempLong > hiScores[i]) then begin hiName[i + 1] := hiName[i]; hiScores[i + 1] := hiScores[i]; hiLevel[i + 1] := hiLevel[i]; hiRoom[i + 1] := hiRoom[i]; hiName[i] := ''; hiScores[i] := tempLong; hiLevel[i] := roomsPassed; hiRoom[i] := lastName; rank := i; end; GetName(rank, tempLong); hiName[rank] := COPY(playerName, 1, 24); WriteScores; end; {else} end; {with} end; {proc} {=================================} function DoQuit; var dummyInt: Integer; alertHandle: AlertTHndl; alertRect: Rect; begin DoQuit := TRUE; if (playing) then begin UseResFile(gliderResNum); InitCursor; alertHandle := AlertTHndl(Get1Resource('ALRT', rQuitNoSaveAlertID)); if (alertHandle <> nil) then begin HNoPurge(Handle(alertHandle)); alertRect := alertHandle^^.boundsRect; OffsetRect(alertRect, -alertRect.left, -alertRect.top); dummyInt := (screenBits.bounds.right - alertRect.right) div 2; OffsetRect(alertRect, dummyInt, 0); dummyInt := (screenBits.bounds.bottom - alertRect.bottom) div 3; OffsetRect(alertRect, 0, dummyInt); alertHandle^^.boundsRect := alertRect; HPurge(Handle(alertHandle)); end; dummyInt := Alert(rQuitNoSaveAlertID, nil); if (dummyInt = 1) then DoQuit := FALSE; end; end; {=================================} end. \ No newline at end of file diff --git a/Glider_405/Sources/Glider Balloons b/Glider_405/Sources/Glider Balloons new file mode 100755 index 0000000..e69de29 diff --git a/Glider_405/Sources/SMS.p b/Glider_405/Sources/SMS.p new file mode 100755 index 0000000..0ea68cf --- /dev/null +++ b/Glider_405/Sources/SMS.p @@ -0,0 +1 @@ +unit SMS; interface const AnyChannel = -1; SMSTime1 = 26; SMSTime2 = 30; SMSTime4 = 42; procedure SMSInit; procedure SMSExit; procedure SMSSetMode (TheMode: Integer); function SMSGetMode: Integer; procedure SMSSwitcher (TheEvent: EventRecord); procedure SMSStart (SoundID: Integer); procedure SMSStartLo (SoundID: Integer); procedure SMSStartMid (SoundID: Integer); procedure SMSStartHi (SoundID: Integer); procedure SMSStartChan (SoundID, Channel: Integer); procedure SMSStartBind (SoundID: Integer; CompletionProc: Ptr); procedure SMSStartGen (SoundID, Channel, Priority, Repetitions: Integer; CompletionProc: Ptr); procedure SMSStop; procedure SMSStopP (Priority: Integer); procedure SMSStopChan (Channel: Integer); procedure SMSStopGen (Channel, Priority: Integer); procedure SMSLoad (SoundID: Integer); procedure SMSUnload (SoundID: Integer); procedure SMSLock (SoundID: Integer); procedure SMSUnlock (SoundID: Integer); procedure SMSSoundOn; procedure SMSSoundOff; procedure SMSSetState (State: Boolean); function SMSGetState: Boolean; function SMSChannelFree (Channel: Integer): Boolean; function SMSDecompress (TheSound: Handle): Integer; procedure SMSSetTiming (OneChan, TwoChan, ThreeChan: Integer); function SMSSoundManager: Boolean; implementation procedure SMSInit; EXTERNAL; procedure SMSExit; EXTERNAL; procedure SMSSetMode; EXTERNAL; function SMSGetMode; EXTERNAL; procedure SMSSwitcher; EXTERNAL; procedure SMSStart; EXTERNAL; procedure SMSStartLo; EXTERNAL; procedure SMSStartMid; EXTERNAL; procedure SMSStartHi; EXTERNAL; procedure SMSStartChan; EXTERNAL; procedure SMSStartBind; EXTERNAL; procedure SMSStartGen; EXTERNAL; procedure SMSStop; EXTERNAL; procedure SMSStopP; EXTERNAL; procedure SMSStopChan; EXTERNAL; procedure SMSStopGen; EXTERNAL; procedure SMSLoad; EXTERNAL; procedure SMSUnload; EXTERNAL; procedure SMSLock; EXTERNAL; procedure SMSUnlock; EXTERNAL; procedure SMSSoundOn; EXTERNAL; procedure SMSSoundOff; EXTERNAL; procedure SMSSetState; EXTERNAL; function SMSGetState; EXTERNAL; function SMSChannelFree; EXTERNAL; function SMSDecompress; EXTERNAL; procedure SMSSetTiming; EXTERNAL; function SMSSoundManager: Boolean; EXTERNAL; end. \ No newline at end of file diff --git a/Glider_405/Sources/SMSCore.a.o b/Glider_405/Sources/SMSCore.a.o new file mode 100755 index 0000000..1e42f60 Binary files /dev/null and b/Glider_405/Sources/SMSCore.a.o differ diff --git a/Glider_405/Sources/SetPage.Lib b/Glider_405/Sources/SetPage.Lib new file mode 100755 index 0000000..e69de29 diff --git a/Glider_405/Sources/sms.a.o b/Glider_405/Sources/sms.a.o new file mode 100755 index 0000000..7137898 Binary files /dev/null and b/Glider_405/Sources/sms.a.o differ diff --git a/Glider_Sound_Files/Aww-22.glide b/Glider_Sound_Files/Aww-22.glide new file mode 100755 index 0000000..2dee527 Binary files /dev/null and b/Glider_Sound_Files/Aww-22.glide differ diff --git a/Glider_Sound_Files/Bass-22.glide b/Glider_Sound_Files/Bass-22.glide new file mode 100755 index 0000000..d2743e3 --- /dev/null +++ b/Glider_Sound_Files/Bass-22.glide @@ -0,0 +1 @@ +z}ws}wz}}|}zvvtsuvwyz{yvvssssrrsssruvpkkkprrssrrpnpssvz~}~{vpdYQNQXdr~~~}}}||||}|||{{{zwvvvutssssssrrsvwwwwvvvutvwzzywwvvvvwyyyy{{zwsrrsvz}}ywvvvzvkaYUSU[bkrvz}}yy}~ywy}}vngbaekv|yurponrrrrpnkkmrw|}umd[UPNPSU[aejnty}~}}}}}~}||}}}}}~}}}~|yy|zvsvzyrlgca_^_bgnsz}zz}|vtsuvwz}wkb[[^dks|}{zzzzyvrniebdgnt{yskfa^[[[\_adioty}~}}}}}}}|}~~}}}}{z{}}yyz}zvssvyvld^\_diosvvvtstvy}ysporuz}vpkgb`_adku|vpjfddgkpv{}yvpkgb^YXWX[^bgmsw{~}zy|}~}||}|yy|~zwwy}}}yvrppsy|vpnlkkkkiiikmnprrstvy}vojijnt|}sjb^^^dmu}}vplihhjknrv||vpjea^[[[\_dimruvwwyyy{}}}{yyz}|yy{~}|||||||||}|vpnnpsy~yuponnppppmjgegjpv}|yvrrrsvwz~vmgfgiknruwz}}vrkgeegjnsy~|void_[[[\_bgklnppprsvwz}}zz{}}}}}}}yvvtv|}ywvssssvy}~}}}}zwrmgc__aejpv||yvsrrsvy}}wspljiijlpswz}}vpmjiikosyztpljgedddcdfhijjiiiikpty~}|}~{zyy|~zwvvwz}}yspnprw}}wrkfba`beilpv{~zvsrrrsvz}}}}}|vsponnoprsvzypkgdeiou{|vpkgedeghiiigeccdeimrvz}}}}|||}}{ywvvy}yurrsvy}|vpkgdbbcfkpv}}zwutssuvwyz{{{{zyyyz}}wvronnnpprsvy}|upkjjlpw}{vsrrrpnkhd`_^^_abbbdgkpv|}zy{}}}~}}}}yussvy}{yyyyzz{|}}}~}vnga^^adipvy|}}}}|zywvvvvvvwyyyywwwwwwy|}}ytokiggikpv}zrkiikpv}}|wvspnmkjgc_[YXZ^djpvyzywvvvyz}|z{}}zvuuwz}}{zyyzz{{{zzzz{}}vpkiggiknpsvwy{||zyvvvvvwwyyyyyyywwwvvvvwz}}wrnkjihilpv|wtsssstw|~|wrmg`[[[^_dfijkkmnoprssvwy}~{yy{}}|zzz{|}~}}zwvvuvw|}wtpolkmnprtvwwwwwwwwwwwvvwwy|}}}|yvsrpprvy{~vngb_`dkr|~yvsuvz}~~|wrmigdbbbcdgiikkkiihikosy}~}}}}}}}}}}}yvtrrrsvy}}yvsppnnnprsuvwwwwvvtsssvwz|}}|ywvusrpppppsw||slgdddgkry~}{yyyy|~}wrmjhggijkkiigdcbbdgkpsvyz|}~}|}}}}}}}yurpppsw{}wsrppprtvvvvtssrrssuvvvwyyz{{zywupnlkmpsvy{}ypidcdirz}zwvvtvw}{wuspomkkifdb`____abdgilpsvwvvo_ULECIYpmijZFH^wzz|}~wwvs~{||yvrppvvww{}zsnkms}uklu}zrrrssvz{}|}}}wyz}~}zwvplea^XRPRQPNONNOQUY[_abdegknpvwsssme^`egkptvwniiimsyysjb_^^^__abbgmrz}vmlpsuyz{vw}~~|vrpppljfccdfkpv~}{{|~}yy||}~|yvvusvvvwwwy}z{|{{ywvvwwwz|}}~}zyz{yyz}}}~~~~{ywwvvvrrrsstvvvy|}}}}}}~}}|{yywwwzzz}}}}}~~~}{yyyy{}}~~}||zzzzzzzzzyyyyyywwwyyyzyywwwwyzzz{{yyyyyzyyyzyyyyyyyyywyyyywwwwwvvvvvvwvvvwwvyyyyzzzzz{||}}||}|}|}}}}}}}}}}}}}}||}}}}}~~~~~~~~~~~~~}~~~~~~}~~}}~}}}}}}}}}}}~~}}}}}}}}}|||||}}}}}}}}}}}}}}}}~~~~~~~~~~~~~~~~~~~~~~}}}}}}}}~~~~~~~~}}~~~~~~~~~~~~~~~}}}~~}~~}}}}}}~~}~~~}}~}}}}}}}}}}}}~}}}}~}}}}}}{z}}z|}ytrrsvwwwwwvvvvwwwz|zwwz|}{wne[SNLQ[er}~~~}~~~~}}|||{z{}}}}~~}}}||||z|||{z|||}~}}}~}}}}}|}}{zy|}skb[WXY^dkpsw|~}{vuvy}vporuyywrkc^[^akwyspkiikmpprpnkjikpv{~}vng_YWUWY^dinsy}}}||}}}}}}||}}}}}~}{z{}}zywwy}|wtsvy}{tnieba`abejpvz~~}zwvvvvwz}yof_[Z\bjs{~zyyzz{yvspkhggkpv|yrlhc_^[\^`dhmsw|}|zz|}~zwwwz~~zwvvvy}|tleb_`dimpsssrrrvwz|vrnmpu|}vpid_[[^dkv}wrmieddgkpv|}yvpkd_[XWXY\afkpuy~}|zz|}|{|}}ywvwz}}|yvtssvzyvsolkiigghijknprsuvwz}ysnmnrv|vkc^[[^dmv~zunifddehmrv|}wrjea^[YYZ\`ekptwz}}~}zyy|}}}~}}}|zzz}yvrppsw}ytpmllmnmmkheddeiow~}wvsrrrtvy}zrjeccfilpvy}}wrkheegimrv|}wrlgb^[YY[_bgknpprtvw{}~}}~}}}}zvvvw||ywvvutsvw|}{yyzywurmidbbbdimrv{~{vsrrrtw|}yspkiiiikpsvy}yrlhfeginsy~ysmhdba``abdehkmnpppprvy}}|{{}|zyyz}~zvrpprvz}zvpmifcbbbeimsw}|wvsssvy|~~}}}}yupmkkkkmpruy}yrmiggimrw}}vrkhgggiikkjiihgfgknrw|~}{|}}{yyz|zvsssvy{}}wrlhda_bdimsz~|ywvvvvwyyzzzyywwvwy|}yspnmmmnprtw{ysmifgimsy|wspolkkkigedbaabbdfiknrw|}}}}}}}}}}|ywwz}~|zywwwwyz|}}|ungbaabfjosvz|||{ywwvvvvwwwyyzyyywwvwwy|~}yvrpmjiiknryypkihkpv{}yvsrnmmmkheb^[[[_cipuy}}}}{yyyy|}{zz|}}}}}}|zywwyy|||||z{|~wrlhgggiknpruvwyyyywwvvvvwyyyyywvvttttuvwy}yspkiggilpv}}wspppprvy}}||||||yvrke_\[[[^adhknrstuuuuvvvy|~~|{z{}~~}}}}}}|zyvuuuwz}wtpnkkkkmprsstvvvwwwvvvvvvwyyyzzywtsppprtw}}vnida`cgnvyvssuw|}}}}}ysnjfb`__^adgjlnnmkkklnruy|~~}}}~}}~~zwtrprsvy}{vspnmmmnpprssvvvvtsrrrsvwyyzywwvtsrponopsw||rjda__bipy}}}|{zywwwyz|~zvpkgeddegghiiifdddeimpsuwz|}}}}}}}}yusrrsvy|ytpnnnnpprrsuvvur \ No newline at end of file diff --git a/Glider_Sound_Files/BeamIn-22.glide b/Glider_Sound_Files/BeamIn-22.glide new file mode 100755 index 0000000..d397410 Binary files /dev/null and b/Glider_Sound_Files/BeamIn-22.glide differ diff --git a/Glider_Sound_Files/BlowerOn-22.glide b/Glider_Sound_Files/BlowerOn-22.glide new file mode 100755 index 0000000..67aad35 Binary files /dev/null and b/Glider_Sound_Files/BlowerOn-22.glide differ diff --git a/Glider_Sound_Files/Bounce-22.glide b/Glider_Sound_Files/Bounce-22.glide new file mode 100755 index 0000000..bf96256 Binary files /dev/null and b/Glider_Sound_Files/Bounce-22.glide differ diff --git a/Glider_Sound_Files/Clock-22.glide b/Glider_Sound_Files/Clock-22.glide new file mode 100755 index 0000000..f5ce626 Binary files /dev/null and b/Glider_Sound_Files/Clock-22.glide differ diff --git a/Glider_Sound_Files/Crunch-22.glide b/Glider_Sound_Files/Crunch-22.glide new file mode 100755 index 0000000..5e4c6a1 Binary files /dev/null and b/Glider_Sound_Files/Crunch-22.glide differ diff --git a/Glider_Sound_Files/Drip-22.glide b/Glider_Sound_Files/Drip-22.glide new file mode 100755 index 0000000..7ea3cd1 --- /dev/null +++ b/Glider_Sound_Files/Drip-22.glide @@ -0,0 +1 @@ +jjjjjjjjiirrC(Ejyl\JA==ASreZgrn\HAEQiy~ncZZcsn``j~~jQA8?Uj{lXLHJUcwy`O?AQ`pspjc^ZX\i|~pipĿspø{w~~rnswps|wpp{~j``j~n\QUigOFSi|ZJO`wg`i~pil~n^\lsUEEWy\83Wj8 207@O[dp{~nddiyɺc?& ,ElνpfbdimldTEBFXpzaE+*:L]mx~{{{~~zxxuuvz{{{{yx{~~vpnpy~~~~|~~uopyhUJCCEFP[hv~~rd^ftúnP:3:Jfȶyvzzum^ODDObxp[E3'%*2?O[fnu~~|{{{|||~~|{z{{{{zz{{~~{z~zuuxz{{{{{~znhjsvh[NEDJT`jtzz{{~ztprzvbRJIP]oû|paRLKTctzhXI<67>FWrǶp^OECK[m~s`O=3003:BJR\gpy~~~{xvy~~{uppt{xpmos{paUOLPX`fhhgfgmxpfcfp{ʷmUB9=Ja~saPE@CPat~p`PD:7449BIR\fpv|{xtsu{|{zzz{{~~vpjijmpsvz~xmfccfhjmmptz~sh`[\dn~~pf``dn|sf\UONORZaipuz|~|zurld]ZQPPRZ^chnsx|~~~|{{~~{uoihmuyspppppty|~xuuuutrrsv~sf^\ajzvjb^`fp~xl`VOLJLPZblu|{uphb\[ZX[]cfinpuy{{{{z{|{zzz{vnhhnu|zxvurrsy~{zxpmhhhms{ug`\`huzphhms|{mbZRONPV[djsz~~ztnid`[XWW[[`fjoruuuuz|~{zvv{|tmhglr{{yuplgffmv|urmmmpu||m`[`foz~phffluth^WRPRUZ`gpv~zrlfc`\[[[[`flopppsvz~~|zvsty~||{{||smhhmu|~yrlfdfmu|vplhhlot|~mb^`dmu~ü{pjhmt~sh]VQPRV[`gov{yunic\WURRW[`cdgimpv{{zupnmpz~|~|smhiou{{rjddgoy~ysomlihmuyohffipx~|phdfjuynd[WRRRV[dmsy{~{pja[XX[]`aabchnu{|{ysnmou{~zz|~unlmptztlfdgnv~~yupmiilpz~vpoopptz~{rlilpz{pg^ZUUW\cipuz~~xphc]\]^^]]]`dmtz{zxroppuz~~{z{~tpmmotvyz|yoifhlpv{~ypjfcdhr{tppmmopu{{ohhms|ynf]XWVX[`gou{~yrldaa][ZWVW[dlpuvuronnpsvz~~{z{{vrrrrrsty|tnlllmpv|uld^^clx{upnmmmorzypljpzzof`\[ZZ]bhoy~~zupnlhd`ZTRU[choppnmmmmmopru{|yvz{vspomlmpxzuspooptz~zphfgjp{~yspmlnptz{spru|{slf^[XX[cmv~~{yuurnhb[URV[`fjmnnmmmmmnopsy|zyz~zunjijnv{upmmmpuz~pga^clv~||~~{yxvz~|vspruxz{~zsnhb^\^bhpz~~{uplgfhlpsvyyyyyxvutrrrsuz{~~~|~~~uommpu{~yuutv{{vuttx{~yofbcgoy~zzzzyxvux{{zz|~{uponmpuz~~zsnmmmpsuy{|~~~~|zyuuuuvxzzzzz{|~zsonnpruz{|~{zutspsx{{{yzz{{{vrpptvv~~{yyyyyzz|~|~~{zzxz~{yyxvyzz~~|zxxvuxyyyz|~~~zvusrsrtxvy|~~~~{zxposuuxz|~{xuusuvz~{zvuuvzz||~zuppruz{xvuuxz{~zxvvxxz{~{yxxxxyz{|~~||{{{{~~~{{zzzzyzxx{~~~~{vtsrppttuxy||zvtpppsstz~|zxuuuvxz~zurrtx|{yvuuuvz|~~~|~zyyyz{|~{z{{{~~~||||{{{~~|zzzyxutsssxy|~~~{zvurpponnpruy|~|{uuspprtv{zyxvuuy{|yttuy{|xusrpruy{~~~||~~~~~{{zyz{~~|||{{zxuutuvz{~~~|{zyvvvusrppptvz||||{yxutspppppsz|{yvtssuy|~{zzxxy{zuppruz~{zusrstx{~~{zvuvy{|~~~~~~~~|{zxuttuux{|~~~~~~~|zyxtsssux{~~~|zurppppsx{~~{yvsrptz~~zurppruz~~zusrux{~~zyz{~~{zzyy{|~|zyxxz{~~{zzxxz{~~yxxxyz{|~~~{vtppoprtuzz{~~{vtstuy{~|{zz{|~zxuuxz|~zyuttvxz{|{zyxvvvyz{~{vuuuuy|~||~|{zz{|~~{{zxvusstuy{~~{zxutttttxz{~~{xvuttuvy{~|{yvutttuz|~{zz{~{zzzz{~{{yuuvyz|~|zvvvxz{~~|||||~|zxvvuvxzz{|~~~~|{{zzzyyxyy{|~~~~|zzzzz{|~~|zvuuuuuvz~~zzzzz{~~{zzzzzzzz{{zyvvvz{|~~~{zzz{|~~|{{||~~~~~~~~~{{zzz{|~|||||~{zzzzz|~~~zzzzz{~~|xvvvxz{|~|zzyyzzz~~~|{{{{zz{~~zyvuuy{|{{{|~|{zyz{|||||{{{{{{{{{{||zyyz{~~~zzzz{~~|{zyyxxvyz{~{zxvvy{~~~~{xvuvy{~~zvrooptv{|{zyzz{|~~{{{{~|ztrrsuvxyzz{{{{|||zv{ð~yuuuuuusppmjilllpv{zvvz~|xnbRC6-.8EXm~{zzzzzzzzzz~|z{{usuzufVF>=>EO[hu~{{{{snns~»yohddglopj`UNJOTbs~zvtplhhjopttsmfb``foz~tg[OB::=CJT\dmt{~{{{~{tomos{~||~xrppvxh[QJIIIJPU[dnv~~zxy~{zz{~tdRD:79BP`p{spppuyyupjd`^afmv|umcXOFB?>BHOT[gu~~~~|~~~~{tpliosz~~umd[PJFJR\hpnnoppsx|{xupputg^XURPQT[dp|{urpnmpv{~{upsvxtpmha[WRNJKPUUX[`jt{~~zroou~~|~~|~~zx{xxzrc`hnlaPC=BPaoyzuplpvzpfbbdiuxcJ4(-Em~{Ǽrh`Z[^dhnx~zpmga[QOQPKCBHWgoh\TPPV`luy{~zxuuxz{rmp|zzidcgr~pgdhpvxpg[RQUZ]^^[VRRRU[dr~zzzzzzuvzdPFJWdottstv{pdWJBBIVdpz{ohc[PFDKWbgd\QE?>FVdmpuz{~{ppx{n[QXjtmpz{~zsppnmmpv{~~vgUUbhdV?6=FJOWh~zpmlou|~r^RR[dlpptuupmlmt~pd^][[]fr~~ybLEL[cdaZQJEBEVhvxsu{Ц~~`f{~z`WQ9BjplEfl[]oyn{ľyvurnj~{vvpifd`VJ>=:118>=NQR[`da[WUQJEILOOJEETdnusrrz{ջ{stuozynun[KRZKD]vlQ=3*,<>BENQVX[[]`adfhhmpt{|vstv{{yuuuvxz|{zupnmlmpy{pjda\[]`dgjnpppppppppppnoppsxzzzyrnifddfmrv|o`RJEFOZgy|smilou{~||~ypf]WROKJJLORVWZ[ZWVUV[ait{|{~~{zzz~~{zzz{~zsojffgint{{tmhdb```cfhlnppppomjhhhmpuyzzytpnlhgdddddipxyi\TONOR[fs~~~~~~|zvsrrsx|{pg^XUTTVXZZWVRNLKKOT[bhmruyz|~~~~~zyz~~zzzz{~{rlfccdhpvzpifdddgjmmmmjihgghhlmmoprtuvvuspld`\[^chmsvz~tdWOLOWfu~{upnmjmpz~vplhda^[ZVQNKFEEEEHJNRW\chmpmmaE2$:d»~ج^WX<Cp~uuyz|ppnh|vxxsngdcmmppv{ui`[]iz~l[\lzufgghhouvzxz{~~zpruzȻ~~~|zupmd\PHC9.+.,+'(''(,4:>EIJOPR[`cnphih]PDFPT[djo~»ƻp`VVW^htthXJEBCDEEHKJT^fuzm^\dilruvop{|~|xmfbbc\XQLLOQ[dn~~~|zvvx~~~|zssxyz|ysmmlhonoppptzuv~yvvspoopppuxzz|zusuvttuz{z|~~~~||~|vspponmggghhjmootx{{~~{{{{~|{zyvtspppuuuzzzzz|||zvsrssvzz|~~~~~~|zyxuuuuuuuuutttrrrppprrrutsppppsuuuvvtstsrutttusstrssrrrprrrrpppppmnoonnponopporttsuuuuuvyxz{xxzyzyz{{{{{{z{{~~zzzzyyzz{{{||~~~~~~~||||~~~~||||~~~~||~~~~~~~~~|{~~||||||{||{{|{{{{{{zz{{{||zzzzzzzzzxyyyyzzzzzzzzz{{{{{{{||~~~~||~~~~~~~~|||||~||||||||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|~~||~~~~~~~~~~~~~~~||~~~~{{{{{{{{|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|||~~~~~~~~~~~~~~~~~~~~~~||||{{|||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|||||~~~~~~~~~~~||~~~~~~~~~~~~~~~~~~~|||~~~~~~||~~{zz|~~|{~~~~~~~|~~|{{z{{{|~|z~||~~~~|{{~|{{{{zz~~{{{zz{|~~{zzz~|{~~{{{zzvuzzuy{~~~зtjffimppppponmnpppuxuppuy~{vp`P?0&$,=Pg{~|||{|~||~~~~|zzyyxvuvzzz{|~|{{zyxxxuxxxvuyxy{|{{{|{{{zzy{{vutxziZJ>78:BN[dhpx|{volms~þzmcaflrtpg[LB>BI[pû~ric[WWZ^ddfd`[XW[cmv|zn`RE:747:COW`hs{{zyyz{~{zzzyxz{~~{z{|~~~{vuv{{urppt{xpjimr{vj`WPKIFHKPXdmu~~||{upnmmopu{ûtaQE=<@JXhv|ussuuvtoib[URRZdnx~sg\ULEB?@BFOU]hpy~{~~yuux{|upppu||upmmot{yj\PJEFNW^dhhhgffmpu~yof`^clxü{ocWNE?>CO[n{pg]VPOOT[dny{tmdZOE>979:@HQ[dlt|~~~{xuux{~xvxz{tpopu{~{ysojhhmu~tnha\ZWVTTUVX[`cfhlnpu{th`^`fnx~n[LB>=CO]n|ul`WQOOPU]foyzpfXPHB>::<@FP[cjpuzz|~~zusty~~zz{~~|{{zxuuuz~tmfddhpz~tjd^\\^`^][UPOOPWap|zpmigfgjnt{ǻufXPLLQW\dmsz~{pf[UPPRW^goyzpf\RJD?::>EKT[`cdgjmpvz~|{{|zz{{uonnpyytpnmljimpyzvttutplf]VOJJJOV]fmv|voifffjpyƻ{rib[WVVW[bhnt{~rf\UQPRW`hr~|ri^UOJHFFIKNPU[]`cccdfmt{~~{yvv{~xuttuz|~umfbcfnu{umd]WQLJJKPW^hpz~xpmhhinrx|~|zzz{~tld^[[[[]bfls{~rg]WRRW]gpzzof[URRTVW[[XWVUTQTZ`gpy~~|zvxz~~{vttuy~unhhhmrv{~{pg\UNHEJOV^iu|~xspmmmmprtuuutrppoptx~þzsic`]]]`cgjpvsh^VQRW^htxphda\[[ZWRPNJHHJKOQV[`gpx~~{z{{{{{{{{~xtppu{|yurppppsuxz{~xl`TKHHJQXahnuyyxvtppoonopppssutrrppopptx|zsmgb^XWW[`gsrd[VUZcmv~zsnif`^^]ZUPJD?=>ELVblsz{{{vsrrty~~{vuux{~{zz{~~{xusppstxxxxxuvy~|pf\URRTW[`dglopssrrppoooopssssrpnmjjjjlmptz~tic[VTTW\dmzý{phdcbdgmsz~zyyxyyytmf[PE@===BHOU[`fhjllllmmosx||yvuvz~~||~{{{zzzxurnlllpu~zpjd`[[[[]bfhijmmopppooooooprstuurpjhdccfjpz{m`VNHFLT`n~smhhlpx~{zz{{rh`XQKFEEDHORX\``^[[[\`flry||{{{~|{{||upjfdfhnt{~vohd`^^^`bdfhimoomjhggginprtusppmjhfca`adipxxfXOHEEKVcs~{zzyvurpppruy|~umcZRPNOPRTUWWVQONNPW^dhlpuy{{~{{zz{~zslhgghmrxtjd````cdffhlmmlgbaafiotuuuttsrplf\VRTZajrzĻzi[PKNR\hu~~~zupjhggjpz~ÞlUXZXXWWWQK\B'=96?3+=7,FpfPml=Rvphuڶ̾{E%Uzolfdfg^\c[[[[]]`bfc[Z[[VPOV[\[`hp|̱I"Cm|zpu⽜oRFEOc٬u\[gfh~ϻzK!.370':JOP\hu~{~xR0*P[`rypzrdTOQB400EpzysR?.1Rzϻuj`[cvĶc*0Jfzvtunbdmu{~yo~{{vuz~^9'8=X[OOBJVPFDDIczzXD=E[Ƕϫ`JHP[dmslmtv{z{zrnid^[^WOLPRWmop{upjcdfpyggx~{missz{gV4$=Q^j~{t{lfinrfh~°Ǿ[6&&0COfzodc`VT\hjmyzsptssolz~{~sxrjmu{{z[7+,3J[i{{mWQ^p¾dE<=E[Խ{hfmsz~оvW@9:>OWUQONQ\gpt{~~tg^[aiu~~~~tr~hN9(,EXfpv{vdO<7E[s{fWR[mɲǻv]RRRRX[XVRXdpxxxvtryuu{{srupdmnREBBDDFWghp{{hWLJVfzx`PKO^z{suмm[ZXRPV`b`[\hnpniirpc[XX`nuussuuzpcdunR<0.6>?JU\`hry~ubRLQ`mu~ƺrd`iñy[H=9:DNXgrh^dmpuvvy~zu{|{~xps~oo{hRHJRXVRTT`pzl[RWbnyu[ECLd~zyyػzf[VPQW[^gf^\dhgdfiy~ujb`bgnu|vt{pr~udQB:82,+4ETmmXKIQ]iv«p[RWmƾȺlXPLHEEJOZbfnv~yz{z||~vicfr~mah~p`VPKC>CO^szh[WZ`gp~dOEPf~~utzɻsjda`\]`^ZZdpyuppu~~rnmorpopzux~~~pnzr[H:40,-6BP`oxzuof\WZ`ixm``p¾xbPD@CLUZ[\dt~yrprzuszzpnouymp~|pjf\PFIP\m{xpmmnonlouz~hWQ[jxujjvɽm^[[`hlhfmtphdfmt{vuuvx{uou~tdXPNB,%=Wlvyuniffda`cjurpu||rvp`ROOU^fggnuz{{~{{z~{y~|pjlr~zz~znZB99EWm~~umbXRV`o{pnnppnp~~mdfsĺunnprpf[[[[`hruupnmpz~zz|~uptupxxh`[TB0(,6H[mvzxuohd^XW[bm{zuuv{~y{zngb^``[W^hptzzxz~yrryrs~~rnr~{y~x\D9=J\pxld^ZTPPVbx{z{ytvxmimvzpf^WV[cghiimprpmmpyzxvy|srz~~{zz~~zsh[JEFP[gpvxvtpoic[ZZ[]fs~tpt~ú{zuib[UOLTbpz{{ztprty|yxrhmv`QOU]dipu{zj[OJJLR[mvtvy||mddm~ĸ~uoh\RQZdimmmmnnmp{zvz{pp{{xx{zx{r`OEBCIRW[^diosph[NB=@Nby~xstxzzpic[UZbfjpv||{yyxuplhjpzvr{|z~~j`VW^gmpprxzysj`PD=:EWh|{zz|xrt{xh[[^cfhmsxyutuvvy{{~~||{{{z{~zust{|rmf]ZZ[`ccfjmnmjd[RLKLPZdp{|tpsrru{sb[`fo{zsmfddfjoprrrv~~|zy|~{urppprrpppu{zm`WTV[dmu{~~~~~{vvvzxy{{{{|~~|{{zz{~ztnjhgfhms{|z{~zrt{~ztlc[[[dp~~rhdcba`dddhmmlmpstvz{~ztpnv{pifgiou|zropuz{zurpppppx{uppty{~{{{~~~{{{~~{yuutssux{zuuuvz|~sjhjpx{|~~{zvrptxyvrprtz~~~~~~~zpjgip{{upjhiorsssrssuvy{|{~|{~~~{zuppppu{~~z{~{xusrpmmnptz{z{~|~{vnddp||{{~ztsvvuspdW[hy{yz~~~|vtu{xpmpuuz{pv~xrxy~|roohXJDJV`flnhdjx|sha[`lu{{zzzysnid`^fu|~{z|tnmot{~{yutspptsrpps~yi]am{{zyyy{{mjs{zphfis~zppuzz{{|{tpnpsvx{|rljpxzumlo{zspruurppry{|pmmmlif]XRHCK[cfflmhip{~{xsrponsrf^cp{~z~l[Wfx~|zxupmnppuzzpnlfagp{vv~tonoszzndiv|vrnlup`\lxlddjpz{uusppprvgXdyzomnnnljigaWRXdmu{|y||zxtppppppompxsaV[n{vtz{fV[lz|zuttx{~xuvz|{ytmddp~pip{||~smov~x{~vrruvyuppxypv~zp`RXft~|vrpmmpt{~lfn{~|{xpihmoooldc]VR[jyz~~{uspoopoonmhis~{rpzpgm{{zyz|~tg`^fpy~~ysppppty{uou~zoghpy~zux~~|zxvy{voouzzupj`^gpxzzurrtv{|||~~torusnhffgghimrpd^dmyzyz~~srxz{zxusplffflpru~~yppuz~yttuy{zzyvojmpuz~~|uppx~~pffnv{{|~~~|~~uoljo{zx~~yuvy|zslhhlnsuod^bfimpvzzzz~~|xrprspf]]cipuyvuuupsz|zzrnt|~ztplijpuz{{{~|uru{~~zspu~|{zupmlmpv|{t{~xuz~zpg]`hmruz|{xsppohisvu{zpnppifdipmh`[`iruz~zvx|~{~uoosurmihlpz~ypilu{|~~~~~~~uhadilprpoopx|{ummtxsz{z{{z{ymhjouz|~{z|~ztpi`Z`jponmmpuzz{{z~~{{vxzzuspppldabhooi`Z`r{|{|{vpnopppruvtsx~zpa[bnu~~{{~ytttpmpuvz|tposz{rt~~{{{|zrnpx{|xpnpu||{~zyvutttttpi`PJUdmrpppv~~~~{z~~rhdglpppppptvxxrjo{|z{~~zzzurppppppop{{upnopmipztpprvzxvvy|~zz{y{~zyy|{xtpgcm{~xpmnppptz~~|~rr{zpppsz~~zrmhgfdc`ZZfs{~y{{{~zpmppnfcabhpyumnrtuz|{{ulffjnt|~{zyyyzzz{{{{{yz~|usstspppv|~~~~{{vuuxxuohc`bdfimmnu~{yvyxurprtutogbacfmrx{||{~zroptyvojhggjpv|{urpprtxxxz|~{vrpppsuzz{xuuy~{vsrtuxxxvuvyzzvpppuz|yxvvz~zsommljhfbacgmry~~~~vpmmnpppnmljopsuxz{~{yvy{|zutpmgghinprux{{yxuuxz{~~~|~{zxxz|yspppsz~{zz~~zunlllmmmljlpsx{{usty{zyxvuuuupmgddgjoprsuz~|{upjdabfiosvz~{zuuuvvyz{~ypmiimptuy{~{zzyyz~~||~~{zvtsuuttuupppu~~|~~|{~zzzzzurh^VRV[dmt{~~|||~~|xpmihjpuz{{{zzz{~|uld`^bhnv~~|{{~||{|~~|{{zzzzzzxuuuv{~{zxppooor||xpjhfhu{xvxxxtrpljpy~||~~~||zyuuzzussz~{xuv||yvvyzzzzzzz{~{yyzzzyy|~{{{z{~~{{{zpmmnoruuvz~~|~~|{{zzurpnoruxzyy{~~ypoptumn{~uv~u`[{~zzglujuxtsv~xp{zv|{yvx{{xtpoiiigffhfddbdcbc[TW[]^``dfaffdhfgmttu|||~||~~{{zz~{~zvstuzzz~|ztpihgfgmnnpppnppmmljmiijjldgfdhgddddffffjfchhjjfhfdfhfdjpmntuspxyursyy{{~~~{|{{{{z{|{uyzxy{yuvvxxyyzxxzxuuzxuyvyvtssrrsrprrpsttuuuuuttuusrtsssrttxxyvy~yzzz{|~~~~~|~~|~~~~~~~~~~~{{{zxyzxxz{zzzxvvzzzz||{~~|~~~~~~~{|~|~~~~~~~~~~|{zzzz{{zzzz|||||~~|~~~|~{z{{{{|{{~~|~~~~z|{zzyxxxxxyyyzzxzzyvvyvvz{zvyzzxuvvuxzzyz{z|~~~~~~|~~~~~~~~~|{{{{~~|||~~~~~~~||{{zzzzzz{zzz{|||~~~~||{{{{{{{{zyyxvyz{|~||~~zzz{|~|{zz|~|{z{|{{{zyz~~~{{zzz{~~zyz|~{{~|{z~~|~~|{zyz||{|~~|||~~|{{~~~~~~~~zz{|~~~~~~~~~||~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~|||||~~~~~~~~~~~~~~~~~~~~~~~~~~~~||~~~{{{{{~~~~~~~~~~~~~~~~~~~~~~~~~~~~{{|~~~~~~~~~~~|||{{~~~~~~~~~~~~~~~~~||~~~~~~~~~~~~~~~~||~~~~~~~~~~~~~~~~~~~||~~~||~~~~~~~~~~~~|~~~~~~~~~~~~||~~~~~~~~~||~~~|{~~~|~||{{~~~|~|{~~~{{{{~~|{||{~~~|~~~~~~~~~~~~~~|~~{{|~~~{|~|~{{|~~~~~~~~~|~~|~~|{|~~|~~~~~~~~~~~~~~~~~~~||~~~~~~||~~~~~~~~~~~~~~~~~|~~~|||~~||~~~~~~~~~~~~||~~~~~~~||~~|{|~|{~~||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|{{{{~~|~~~~||~~~~~~~~~~~~~~~~~~~~~~{{|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|||~~~~{{{{{|~~~~~~~~~~||~~~~~~~~~~~~~~~~~~|{{|~~~|{z{{~~{~~~~~|zzz{||~~|~~|~~|||~~~~~~|{~~|~~|||{{{~~|~~{z{~~~||zupmmlllmpttprҮsb[`dimnnmmhcbffdhrsolmu|uiW=$*Jf{{{z{{||~~~~{z{{z~dC,""'0EP[gpppmjimrztg\WW[drûm[LC<99:CN[oznaVLEDEJR^mx~ul`VJB<8669=CJR[djosvz|zz~uppruz~zl^VRPQRRUVX[[]`adhnu~rd[X\fp~~m\NB<=BN[jzuh\RLKNT`lv|sh`WNEB=::BHP[gpx~{pd[TQQXaipv{~~|{zvpjd[UPPOPPQRRRWZ]bglnptuvy{~~|{{uojhms|~yvvxxsj`PC:8=EQbr~yrnlihlnpsvy{{{{ʼtdWPOPRX[`bfhmpu{þzof^[[]clu{vpid^WQNJFEFJORUWWWWZ[bir{~{{~|{{zsommpx~pdVJD@BEOWdnx~yurpruuuuspliiilpzĺujd^\\[ZXWWWZ]djtujdcdhpv{zsmd[WURTUUUROJFEIOXdmsutppnorz~|{{~~slhhmvym`VNHEFNWblv~|{{{~~~~zvpjfa^^ahpzûzpmd\XURPPPRW\fr~~xrnmllmpu|~ytponmifa[TNJHHKRZ]`ba`]]`dipv{~~||~~ztrru|vppptzyj`VPOPU[bjsxz{{{{{{~~zrib\ZZ`dmxxoh`WPJEEJR\hxxnhgipzzsjaWROOOQRRRQPPRRUX[]adhjorx{~~~~ummmr|~|{{~þth^ZXX[`dhjmmnnopruzvmd^[Z[]bhox|obXOIHJOT[ahp{yyz|zpmhb`[WRQPOOPPPPPPPTW[`dhlppsuuuxz~~{yy{xsrrv{~{zzz~üypjhhhhhhgfdccfjpv~zpg`[WWZ]chr|xnf^WPKEEHOZgv~{{{~~yrnhc`[XWURRPONNOPTW[]`cdfhjnpruuuuz~xppopx~xrppt{zurppsx{zxtmgb][[\adhpv~xmd]ZWX[^dhoty~~o`RJEDIOWfp{{{~~zuspmgca`^\[WTPOONORW^cfffba][[^dnyzvuuzzusppsv{~zvrprx~zpha\[Z[]bis~slfffimmjgddfipx~vi`TNKLPW`ipu{~~{{~vrpppssplc[RONNOPQUZ`cc`[RONLQ[fs~zsppsuz~zsppptx|~zuppptzĻvmjhggilnry|{zuplhd`][[`gpztg]WTRW\bhmpsuxyzyxtttx{{xssvz~~xpmhlpv~~zusppsuxzxupmmoryzzzz|{rjdcdmu~~vnfb``fmu~~yuuvz{|zxvy~~~|{{zz~~~||~~~||~vru{uldcht~upsz~uh][duzx~{y{vpory~~|xvz{sppzyx{zmhhp{{urpu|~zvuzznffhntuuyvh\[f{жbfz~pnбzVJJdujbzcg^@WD$RƾnQ`su{|rprlhda[WTR[[apdL.$@JP\flh[R`mvp[ROf{gXdǣ{fft]E?>Wglz{mlms{ushmplof[]brpdhpsuzzuprtnpruWB92BFK]mnjh]czuf\ROObƺzpzٻ~z{uuvyzW:&%>RWbu{yz~||tztmpusrythfipspp|~gZU[]`lz{mhlimĻx^OXp~oPDDENQJKVX`mvvttx~|zphhp|uu~|~xpuspu{{yv\LIIJQmzz~jWPJFX~¬p\^xȰzjjyjD'"'6EOZWRft{|vuz~{sjmrv~zpsvh[[dr|g[U\p[EBNmnO>:8:CJEEQ^oxvrmlhfdffovfOBBHXdmljox~{{n`[duɵ{aR[u~plmspaROOONPUVPVhtyzuz~xpintsmhm{~gWV[hpuscWWf|hRLRiu]KD@9346:K`ozumhmsxzzy|z{fRHEINOOT^mxzh[\lǫo]\jpb`g~th[RKFC@EUj{~~zuty{uu{{ribdp{~zst{vcX[`gjijry{g[[h{{cWWdz{ug[RJC=32=K[hiinzypp|uVE@DJPV]hs{vhfn|ʱuc]btuhai~pf]TKE?BOdu~~{{ytt{zrpv{|yogb`jzuuxfaaa```flroa\cimpsx~nfdlz{pu|uj`R@-+9K[flpv~~{uv|yz~y|yv{|dTOPU[]chnytosz²~fTTaoy{rz{odTECO^ltux|~{zx{ppv{vpou~ppvòmb``^[X[\ivaTRUZ[[fzp`[fr{zz{m`O:-0:N\hnu{~{xsp{|y{umpzxrt{zjcab^WRQUavphhjmmmpphhhhp{|~r[FCJWahimpuvutu|vjdfmxzzzupmhhfdhsxhcbadddlzmfhjoy|~zm[E40:IW^bhptsprz~xzzor|mbcoysnd[RKK[rupnmgcdo~{pmjimpsssyudZVTRRWamuytprz{xl`[`hu~uh`XQOUcs~zrmhffip{njpz{{~|vuttu{~||{ytpppv{{~ztppx~~z{~~~ztpuz{|~pc[[]doy~uopu{{ohhmty{{zuuz|sljp{{tmfbdmuz{~~z~|zyzvmgfffgmt{zrruvuuuvz{{zpmot{|zz|~~~~|{yz~~zyvuuv{|yssxxsopu{~{yxy{{~|zz~zxsnmjioz~{zzvx|~vrpmc\\dmx~~rnnsy|{y{zvtttuv{|xux~~rjhjpsuz~yy{|{{~{utuvz~zxtsxzxropvz{{z{{~~|{yyz{{vx{~{{z{{{{{~~xpmmppmiimu{{{~~~ztuz~~zuolntz{{{z{||~~|~{uvzzvuuutrsuuogcbdinrzzssy||zurrux{~~~ztu{~ztppty{{{{{~~|zvz|~~{{zytsy~zusppuzzuppsz~~{xy|{usru|~~|{zzvuuz|z{~~yx{xrnhjprpmljprppptx{~~xux||ytrmlpz~|zy{~{vsry|~~~zsppv~~ztprx{~v{xsmlopmgcfmx~~smhjpyzvpnpu|{{~~|{zy{~{yxy{{uph`^][[^fcanvlffhhmsz~~zz~|z{paZVWZbgfdiu{vyzmfhpzyhdcbhsy~~yvy~rpyta[^\X[g|~tmnutfVTdzxg\[[`filtxja\dpyzuof`UQW`fmpolnr{p^Wc{{umaXUROP[flifflpph`[`dinnnjigaZRE9C[x|yromjou|~{uuzxxz|xd]gpu~{umfc``dmuyurppuzz{ug^[[cluvmh`]^^[ZWVVX`gnu{~~~|{{thb`]\ZWWZ[^fjppppt~~{|yppry~zod^\[[XWW[dp|yusuxz{zvuuspomhhhmpxzxtpmhdcccbadmxunjjjnpppnmmljjlljihhf`[ZXZ`gmt{~uppopoot~~zri\Z[ahmoryypjihlprppmfa`afmu~~zz{||ypifipy~ztnhdbcdffdc[Z[`jz~upnmot{|{zyxxvuuspnjc[X\i|zpgb][XXWWWWXXQJJP]u~zxvvy{vhWRUbuymd\[]`fillhfbaaacddhmpprrojhgfhlpppls{{~{zxvussstvz{|~~|vuyzpopvzyxusrrrrsttuuutsrpppprrrtuupjc[[[`flpolhhnx|{{zzyxvuojfddhmt{~~zuuuy{~~~~~~~||{{zyxuuuttty{{|~~|zxppopvypjffddffhhjmmnnops{{vnfa`]]`bdffffda^]]]]^`adhlpu{~~yurrrrsuz{~|{yvusppppppoonmmmmmpsuvz{~~zuplfdcb`adhmrx|~{zzyyxtppommljjjlosvz|~~~||{{{|~~~|||~zpmgdbaabdgjpuxz{{~{yyyyz~~zvtrppnmmljhgffdccba``]\[[[[[[]^`bglotx{~|{yvutttvz{{|~~~~|{{zzzzzzzzzyxvuuxyzzz|||~~~~~~~~~~~~~~~~~{{{{{{|||{{zzyvuutppponmmmmmmnpruxz{{||{{zzvuuuvyz|~{vrpoprux{~zuporx{~~~{{zxvyz||{zzxutsuxxtppv{zvuuxxvtrrv{~~{yvuyz{{zsnmljhhhjmpz{zy{~{z~zuolimppru{~{{~|{zzxyzzvsuxzxt~{uxxpx[hyuj`orffopfgxzhj{zu{|uu{{z{{ndhpysmjjgjihjggffhd````\[ZVZVX][cb`adfgijnprptuutrnpppsupzɶpaWQOOLFEEEBBEEDEEKIEFIPW\[WZ[WW[agd`ZWQB7*+4>O^mv~{zxuzzyxxx{z{vrsrpuxz|{vslcb^]`hy~ri\OE:40,07=DNOQU^fjpu{~{rhb]^`^ciu~hVLIJR\gnoppmfXJ:0+,08BQdyzrmjiihmpomifccc\ZZ\dlpy|zsld^WQONKLP[dhpz~{{{||vrpmpprvz|~{ytmf`\ZWW\bhrz{~zyuohc[OE?>>>?ENT\fpvxzzupopmnt{~|zvsppmhdbadluzri`ZQJD?=:989>IWfuzvupppmhfcccdfhlou~~xspjfb^[\^^^`chouz~|zyyz|~xsppppv{~zyvuuuspnjhfgimszzpf`^[XX[[ZXX[[[\``chloppprsv{|yphfdfhntz~tfZOE=:99:>EPXamvxof[WRRRTW[^bgmry|~|xsoica`][XTPOOPUZ^bfimoptx~~~~xvvuuz{pida``bfhnu{~~xpjf\XVVVZ[\\[[XVTRQRUX]flr{~xpjgffhlopv~zm`QE<748=ELR[`florx|zphc][ZXWUTW]fmtxyzzyvtppomjhfda`^[WRRQOPU[`floppsvy{{yxyz{|xsoldbaaafjpz|{zzxvuuurohfa][VQKIIJJORX]birz|yurppopruvvvy{ynf^[ZXVRPONKKLORW[bipzü~uohda``````aadiorv{{{zvsnigd`^][ZXWWWWWVRPOOORX`irz~|{{~|vpmjiilmmnptv{{{||~~xpf]VPKHFHJORW[aflpuz~{yurppprsvyz{~zvuux{vnidb`^\[WROJFEHJOWamv{smga``dgmpuyzzzyxuutuuuuusrpmgc[UPOOPQRTWXXXXZ[]bfhpv|{{{~~xuppptuxyzzzzzxvuxzz{~xpjd^XROKIIJORX`gmpu{{zzyusrppptxz{|~|{zvsppppppppppty~ypia[UPLJIIIHIKOV^gp~zvsmhdddfjpxzz{|{zxusppmmjihfb^ZTPNLKKOQVZ[^````abdhouz~~{zyvtrpppppopruy{~|slc]ZVUUUWX[[\]^adhjmmmmmmnnpruvyz|~ztplhghjmopvz~~{xtph`XQKFEEJOV^fmuz~~~~~|zxutssux{~|xtoljhffdc`][[XVRPPONPPRW[]``cdgjosz{xtomliijpuzxrmhca```adfhhhfda````adginty|~|{xtrponmmlgggghlpuzvnf^XPHB=::=EOWbmv~{zuttuy{{|~~~~~~{{zytpmjfca`][ZXWRQPPOOPPPQTX[]bdhlpy|~zvponmmnpsv{~xuutsrpolhfc^\[[[[[\``acddfhnpuy~|ytpjgcbbddfhimmmopruvzuj`XQOKJIIJJLPU[ahpzzupppsvyz{~~{vromligffc`[WRPPOLJJLPUZ]`dfhhiijlmosy{yxxz{||||{uohaZQNJLOQW\bfjmmmpxzyzzusrppmgc][Z[^cgmu{~~yttuy~xi`ZWWWXWTRRRQRV^iu{zz{|~urttttuurojf`[[\\^``][ZWUQONLKNQRTWZ]`\ZZ[ahmt~~{yurnhfdcfhou|z{~{z{|{truusprpuzyzzytppomhd`ahhmoljhddfddc^\`fdcdfiox~~vphf`][[ZXUOOOPRQUX]iu{{z{|{uppmfc^[[WXWQQTTPIIHDBEFHNW^dlvͻ~{{{~~|uplfgiighntumffmpnmihp{xpf\UPQX^iy~~~|urpppuz{{xplihhf``djppplhdb`]XTRU[adhpx|maWWapuj`P?.%!!*6CNT[dls{zsprzǻvgRB944:?DINPNH?6,'%'0=Odzý~vpmmmprtuurpolgc`adgmptzzsnlhb^]\`finru{|{zzuuux|~yplfcacfjppppohb\WW[ahpvyyz~{vphd`XROH?81-,,,04:CP[gouz|yuusrpsu~ǻ{zutpmg`WOHB930.0268:>FP]ht~zvuttttrpmifa^^adir|zsnlmlhgfdccdffgjou{{yvvz~~{zzyz{~~zvrnhaaadipx{|~~~~{z{~~~~~~rfXNEBBBEJNOOLJFEEEJR\dhlou{{rmhgimt|~umbWJ?60+(+.29?FP[fr{zpic\ZX[\afjpu|~{yuplfb^[Z[]chorsrpppsy~|zutttv{zupnmpuyzxssrppptv{{snlllpv~{umd[RKEEEHLPU[[[[VRRQPPRV\fp~{{{{{zzz||pcWNB80,,.4=EKT[bfjnrv{uohc`][`cfgggjpz~{yuolhfa]ZWWZ]bfjpuuuuusrrrsuz|zxuuxz|~~~~~~|{~~yrppruz~~|zyupnnnoprtuz{uspmhb][VRQOONLLKJIIJPX^cfinrz{yyz~xmc[WVUROJEB@@DELT]djpsvy{yphb^]`djpruxyzz~{ridcccdfhhgfd`[[[]agmpuzzyutsssuy|ypnmmnpu~~~{uoidbbbdhmpy|zrmd[RJE@>BEINRW]adgijlnpruy{~~|zxvuttuz{tpnot~ûth^WQOONLJHEB>?BDFOVcmx{phb``gov~{upja[[\`cfhhhhgfa^\\^dipty||zxvuvy{|vpmihfffffhnpuz~{ph`XQLHD@@CFNR[bhmruurmigddghmrx{~~{{zyxxvuxyzyuux{ƾ~pf[RLIFFEDEEHJKOQW\djou~~{vuuxz~{xpmhda```^]^```^]]]`dgmpuz~~~|{{~~~~ztpnnpprpppruuuvxz{zphc^[WWVVVVVWWX[^chnprpohhhhhmopv{|zupmhffglpuzû{siaWOE@<449?FPX`fmpvz{~zyz{|~~~~|{{zxupmhd`][WVVX\afimnnopsuy{|~zxusrrstuxxxupponnnoppuz~xpigdca`^^^``````cfimpsuvz|~~{zvrpnlhgghhlnoooptx~þzndZPLJE@=:9:>DJR\gox~~~~~|~~~|{zvspnjhfcb`\\\[\`aacfhmnpsuxz{zzzzzxuuvz~~{zxuppnljhhgggimpx|~{ysmf`[UOKJJJLOPUZ`fimpsuvyyvusppmihd`]\\^afloszü~pf[ROJHEB??@CHNU\dmv~~~{zyxvtpppppppppmjihgfdcdgjmpsuvxxvrnhda`cgmpx~zupid`[XZ]cipz~zspmhb[WPJEEEJNQW[bhnptuuuutrpppmjgddb``bdgjoruz~iUHB<:6249ER[[[gz{uoopgbs~ry|us|dTTcy~{fIIJFZmomo{|yyy{vzoxtuzumlbPPV\m{smpmsuhNBHPRF9:O?21(47@QX[dimofaaXP[dh`Wfffj`]vsu ~ndvjoo[QRf|{{{z{mlf`fhjc`bfpphcQ8=HNpzmf``\PEHRWcntyxz~vľmbZW`tvz~d`g\^ag||u~~uadpzodcffld[TBKghfcZfommilrumzxy~uzvpzvdUV\ggfip~zxyumpiZR[^[`dpzrooiaW^mzzzphnzsph[\dhvh[cpyvsmuxpc[PFKUao|uptv{xpjoy~xpvzmfpz|~vnjhhopu{yvpps{zomsyspupZ92DXlt~|tpmllpvvz{~~m]fpxvmc\[ds{|~tsp^Rcpv|~f]bmryzx{~{vxrhp{zi\\^`i~|{y{|yxvsf[dpmpspx|~yndhtz{gJ=OWOIJOXdmz~yy{~zy~~ujhpvxx{{~vphb[\flhfipx~{porzzpf[[bfffr~{{{{{ui[Waf`[W[al|{rhfhp{zmhuvtpffopu~~ttz~{bQR\`fnyumlr{{uv|pjmr{{p`RE:>HLOWdls|{zyvuuvts|smnzzuofb``douutxz{{{yuyzzzvy{|{{v`KEKWhz{znhhmrz~tpomfXLKOVbmv~ysrx{{~xxusvyz||zz{zplifhs{~xpdVU]ly{rppu{z~{urs{zspu~vnd``^[QFIPW]dipz~xuzyppjfgou~xhfhhhmt{zz~{suzuty~znb[[clvvhbcdflt~{tnjhc[Z[VKJ[lrrofbfp|{zzzv{~zz~~zuz~zpu~ylfdhovz{xrv|znaWRV^m{{{y~xppsu{zh^ZZ]dmrhWJN]o~zpc[\dinpoppmd[Z`m{{tu~vnddhuzvvzyxz~~{xtpnf`fnppuzzi\VUW`luvm[OWfnpppsz{xv|yzzxsru{sjip|shfjs{o``fhmmnnlilov|ursyx~{yz{oc[[]`````]]dimuzvnddd`[WRNNTcrpbdo{{zy|~{{zy~|urrv~zj`bo{xlcafossslWHDKTU]rypmp{sfgnmjdWR[o~~~{{zzyvpg^\`a^fu{uroihpzopz{xhfhls{uuurld^^clpmc`iz{zmhp{~~p\JENVVRPVcjtummpx{{vfXQR`tvtz~zvz~~vt|{~{uocN?=J[juzvutjfdfhouzlXWaa`hyzplfcdfhihinprzzpmpu{{z~xtsz~vnhmx~tjhlnommpuphdgr{{usy~zpjlppiaWJEO^p{yppu{|tooptpllnpppmbam|~xvzuohbZRR`p~tg`afmsuphbdjmpz~zuuzyrlms{~xxyvrnhfhov{~~~zzvi][ft~|~~~~utx~{xvuuuxz{{zsh`fu{yy{|{{~phipyzcX`o{|uppuxyz|{zxutvyupf[\nz{|pd``grx{||pg[Zbny~z{ug[WWX[[XPLOWfs{~~vpnpv{u]JJUcoxufdouv{~~pfcjynQHP]i{ztsszmhjopty~zuv{|{||xux{{ung`]bfghntx{~~|{{{{z{|yvz|{vrpppsyzzz{~~~~|{||{|~~~~ymccgnx~|~{vuuy{~~zyxxrhffgmrx|{zz{~~~{~~zz{|~~~|{vutsu{~~{ypjmpy|zyz|~~{zz{|zy{~zupppomgdfinpsvz~{{zyvtsuz~zrtuttv{~~|~|z|~{zz|{unmnrx|zsprruy|~zvutpmmmifgpvzzurru{|||{{~~~~{{~{z|ztrruy{~~{{~{uojimpz~~~~zxzz{zrnmmptzzsifip{~{vpmptvyyyzzupmmpy{z{~zurrv||{{{{{|~{zzxrpuzzz{~{smljmpv{ztlhntyyyz{~|{{|{{zz{~~yuv{|xsrv{~~upptuvvxvuuux|~{z{~~|~|~{upnnppppppoptuv|{|~ursrpmlhfgls{uptz~~~~~||~zz{~{sorz~ztpptyzzyrhccgjmr~{vvz~~vruxvtpllp|~~~~~||{xsoppppu~{zyvtu{{yz~~zttux||{{zyupppsyzuppx~{uu{~vlcdhmihhmrv{~zvvz|~~zpjhjs|~z{~~|{~z{~~~|zund``hpy|~{|xsrrsuy{~|rmmpppx{yusrsuuutuxyz~{xxz|~~~zzz~~{vuz~~yuuxyyxvz{ytru{~~z{~{xuvzytohddhpz~{yy{~zyxzzyuuxyyxtpry~||~~zvsplims{yrppsxzzvspsuvz~|{{~|yvy{~{||{zvutuy|~~~{snou|~|zz{|{{{{{|~~~|yrpt~~|~~|utuz~zpnsz|zyz{{||~~{{z{{zvpnpz~~~{upppu{~~~yrmmsz~~|~zrmmmmnmlgfhnu{~zyxy|~vlfgnuz~yptz{{~~vrpv~~rgflpy{zz{{uuvyz{~|{|~~~~|{{{~~zvtpprstuy{{~~~~~~~~|~~|{~~~|zyyyy{|~~~~~~~~~~~zupruy~~{{{|~~{{{{xtssty{~~|~~~~~~~|{{{z|~{xuvz|~~|~~~~~~~|||~|{zyyyvsrtuxyz{~~~~~|{{z{~{zzzzz{~~|~~~~|zvvxz~{zzzz{|~~{{zzxvvutsuz|~~{zz{~~~~~~~~~~{zz{{~~~~zuuuvz~||~~|zxvxz{~~xsruz~~{xxz{{|{{|{zxvvz~~|~|{zz~~~~~~~~~~~|{yz{|||~{yuuuvz|~|zuuy{||||~~~~~|~~{{{~{z{|~zxzz{{{{{{{{~~|~~~{yxxyyyyyxxyz{{~~zzzyxuusstv{~~zz{~~~~~~~|~|yxz~{zyy{|~~|ytrsuuv{|{{~~{z{{{{xuuz~~{zxyyxx{~||{{{{{~{{z{{~~~~|{zyyz|{zyz|~{{~~ztpruuuttv{||{|~{vttv{~~~~~~|{urprvz~~~~~{zzz{{~~yvyzzz|~|{zzz{zzz{{|~~|{~~~~~~~{{~~{{{{|{{{~|{zz{~~|~|{{{{{zvsrrv{~~|~~{{{||{{{{||{zz{~~~~|{zyuux{~{yyyz{~~{zz{{{~~~~|{|~~~~|{zzz{|~~{xvx{~~~~~~~~~~~~~{yy{~~{z|~{xx{~~||~~~~~~~~~~~|{yx{~~~{zyz|~~{xvxz~{xuuvvxvuttuz{~{{{|~zusuy{~zyz~~~~zzz|~xstxz~~|~|{{{|~~~~~~~~~~zyxyzzz{|~~~~~~~|||~~~{zz{~~~~~~~~~~~{{zz{|~~~~~~~|{{{|~~~~~~||{{zzzz{{|~~~~~~~~~~~~~|{{|~|||||~~~~~~~|{{{{z{~~~~|||~~~~|~~~~~|{{{|~~~~{{{|~~~{zz{~{{{|~~~~~~~~|{|~~|~~~~|||~~~~|{{{|~|{{|~~~~~~~~~~~~~~{{|~~~~~~~~~~~{{{{|||||{{|~~~||||{{{zz{~~|~~~~~||~~~|~~~|zzz{{{~~~~~~~~|{{{~~|{{|||~~~~~~~~~~~~~~|{{|~~~~|~~~~~{zz{{{{{{|~~~|{z{|~zyyz{~~~|~~~~{{||||~~~|||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{zzz|~~~~~~~~~~~~~~|~~{{{{{~~||~~~~|~~~~~~~~~~~~~~{{~~|~~~~|{{~~~|{~~||~~~~{{~~~|{{{{{{{zz{|~~~~{zz{|~~|~~~|~~zzz{~~~~~~~~|{{|~~~~~~~~|~~~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~ \ No newline at end of file diff --git a/Glider_Sound_Files/Pop-22.glide b/Glider_Sound_Files/Pop-22.glide new file mode 100755 index 0000000..a695d35 Binary files /dev/null and b/Glider_Sound_Files/Pop-22.glide differ diff --git a/Glider_Sound_Files/Push-22.glide b/Glider_Sound_Files/Push-22.glide new file mode 100755 index 0000000..26a0dfb Binary files /dev/null and b/Glider_Sound_Files/Push-22.glide differ diff --git a/Glider_Sound_Files/Shredder-22.glide b/Glider_Sound_Files/Shredder-22.glide new file mode 100755 index 0000000..00c1240 --- /dev/null +++ b/Glider_Sound_Files/Shredder-22.glide @@ -0,0 +1 @@ +ưxv{a`faTN[lqkaW\ly~|l_[Z\XOIIRbiaRJTjpoqog^ckhcdinqtong\ONg|μ~~yйȼȰvfWV\ciqria]aipr{|srmjs|iZTYO@504>N[_`dmnh^T^rxy|{wm^TiuroyshuɾŲ}{~}yyriaWZadf_UNPSNIIT]`b`YVTSWZZVQW_dkub[h|ia^^fyysv~yɰnXZlynVIVn}ynp{wv{rhc^TG@A:6249?CKG906FTcvƽ¹{wx|{sollncULLNNNNPW_bipqfYQLN\i_TLJF@>>CVn{||̼ĦwpXOUehSCLiiH442"%Jkl_Ylɼ}r`I24Pgpmju{͹|||uvx~ysqz~|ui_^^]]TJKU]TGB:"DZ][XXZM82>Ys~winw{~wxwxyjeileULLPRLACKUXZ_gjeW;.4K\WKB>>C@5'%9Qd|rvԻػ|{urz{nXKXx~~lO34K\b[T[\TE0"%.8<8>JPC(#*6BTo~~{nao~zrqz~r_TYcgS<5=PN8.1>?3)(8ZkZFBNb[MNixbWaf^K6;LWTLIO\fns¿Ļ»uog_RIKSWO>5GZecW_tpQLYcRCCVj_>*(1>?3.4KR@59Nee[T[n}{rqx~sbky~~sYF9,$%>NLA8;:1&!,AR[\TYa^P80Hg|~~^KTjy{st{|ϾɽŢxqiV>(%2>C?>AHT]P8.6Rciha[XVME@JRPLLSbkjegwywzw}|wqhux_B35IYXXZ]]J) 6AEQ\WMJQ\]]^^gs{~{rrx~ywtz||~~ullpkV80C[o{ɨ~qZ]knQ,042BcnQCNegXOUlw}į̹|||r[F?>?EIKR\i_PLPWcoqkc`YQNNNNLLS`mllnqz|ywzô²zgWJ906DKE@:5259A?EQ\bfpzwv}rmw~r[JRiyp\Vj˳ֻy|xrx{i_^`fzl\_tme`YQUZZXTSUX_b`^WKHMSPNS\feb[V_gpxy|~{|ù°xhp~pqvmV[juz|yyubU[fnne``]QA603=LYTWezuklqrz}sqkc]_gqrke]VVcrƲŹԽ{|~ι|lQNYennsrojebgle]enqopmXKO^ieUJHMW\ZZ]i||~{p^V_iqo^OR^fa^vxvfLA:?Qeljgjsyy \ No newline at end of file diff --git a/Glider_Sound_Files/TeaKettle b/Glider_Sound_Files/TeaKettle new file mode 100755 index 0000000..173ae5f Binary files /dev/null and b/Glider_Sound_Files/TeaKettle differ diff --git a/Glider_Sound_Files/Tick-22.glide b/Glider_Sound_Files/Tick-22.glide new file mode 100755 index 0000000..b084201 --- /dev/null +++ b/Glider_Sound_Files/Tick-22.glide @@ -0,0 +1 @@ +~}dmikniqrxs}qjiijyvpmiilxus{s|~supmsx}rjkq|s~}tysmnrvvy}}~~ru{{|~||}v|}x{||}xt}}{}y}yv}~}}~y{ \ No newline at end of file diff --git a/Glider_Sound_Files/ToastDrop-22.glide b/Glider_Sound_Files/ToastDrop-22.glide new file mode 100755 index 0000000..adf66d8 Binary files /dev/null and b/Glider_Sound_Files/ToastDrop-22.glide differ diff --git a/Glider_Sound_Files/ToastJump-22.glide b/Glider_Sound_Files/ToastJump-22.glide new file mode 100755 index 0000000..1bb8925 Binary files /dev/null and b/Glider_Sound_Files/ToastJump-22.glide differ diff --git a/Glider_Sound_Files/Yow!-22.glide b/Glider_Sound_Files/Yow!-22.glide new file mode 100755 index 0000000..b3e96f0 Binary files /dev/null and b/Glider_Sound_Files/Yow!-22.glide differ diff --git a/Glider_Sound_Files/Zap-22.glide b/Glider_Sound_Files/Zap-22.glide new file mode 100755 index 0000000..3f5420e Binary files /dev/null and b/Glider_Sound_Files/Zap-22.glide differ diff --git a/Glider_Sound_Files/snd.rsrc b/Glider_Sound_Files/snd.rsrc new file mode 100755 index 0000000..e69de29 diff --git a/Houses/Combo House b/Houses/Combo House new file mode 100755 index 0000000..ae73257 Binary files /dev/null and b/Houses/Combo House differ diff --git a/Houses/Combo House 2 b/Houses/Combo House 2 new file mode 100755 index 0000000..3ff886d Binary files /dev/null and b/Houses/Combo House 2 differ diff --git a/Houses/Combo House 3 b/Houses/Combo House 3 new file mode 100755 index 0000000..790f8f1 Binary files /dev/null and b/Houses/Combo House 3 differ diff --git a/Houses/Combo House 4 b/Houses/Combo House 4 new file mode 100755 index 0000000..5c9bb5c Binary files /dev/null and b/Houses/Combo House 4 differ diff --git a/Houses/Combo House Read Me.txt b/Houses/Combo House Read Me.txt new file mode 100755 index 0000000..86c8dca --- /dev/null +++ b/Houses/Combo House Read Me.txt @@ -0,0 +1 @@ +What is Combo House? This is the original house that came with Glider 4.0 ("The House" & "The House 2") combined with "Mad House" & "Mad House 2" (renamed "Combo House" through "Combo House 4"). As you may remember, the last room in the original house presented you with an open window and a way out of the house. That has been changed in "Combo House" and that room now takes you to the beginning of "Mad House". Why on earth would someone want to do this? Well, because this hybrid house has over 120 rooms! By flying right out of the original house and into the new house, your "score potential" is quite large indeed! But to lessen some of the confusion, the houses were renamed "Combo House". Score big! \ No newline at end of file diff --git a/Houses/Glass House b/Houses/Glass House new file mode 100755 index 0000000..3d93f03 Binary files /dev/null and b/Houses/Glass House differ diff --git a/Houses/Glass House 2 b/Houses/Glass House 2 new file mode 100755 index 0000000..3b1fb61 Binary files /dev/null and b/Houses/Glass House 2 differ diff --git a/Houses/Glass House ReadMe.txt b/Houses/Glass House ReadMe.txt new file mode 100755 index 0000000..d5bc784 --- /dev/null +++ b/Houses/Glass House ReadMe.txt @@ -0,0 +1 @@ +Glass House has (for no particular reason) a window in each of its 62 rooms. In addition, there are a number of unusual features to this house including the Giant Loop-The-Loop, the Split-Level Rooms, The Ring of Fire, and the insidious Cage Rooms. I enjoy designing houses that are fun (not impossible) to play, with a fair amount of surprises, puzzling situations, and visually interesting layouts, and without an overdose of death traps, massive air raids, and clutters of obstacles. Try out my other house designs on AOL: Five Great Houses. All of these scenerios are even more with my Glider 4.06 custom art file: FunArt, also available on AOL. WardHarten \ No newline at end of file diff --git a/Houses/Hands-off House b/Houses/Hands-off House new file mode 100755 index 0000000..472edf8 Binary files /dev/null and b/Houses/Hands-off House differ diff --git a/Houses/Hands-off ReadMe.txt b/Houses/Hands-off ReadMe.txt new file mode 100755 index 0000000..cccbf12 --- /dev/null +++ b/Houses/Hands-off ReadMe.txt @@ -0,0 +1 @@ +This revised version of Hands-off House fixes a minor design flaw that causes the glider to occasionally get fried in room #13. If you have the original version of Hands-Off House, you can make the correction yourself by opening it with the Room Editor and changing the delay time for the left electrical outlet in room #13 from 100 to 110. Hands-off House is a 40 room Glider house that actually PLAYS ITSELF! That's right, you don't have to touch a button to flawlessly navigate through some of the most entertaining room set-ups you've ever seen. This is not a demo on how to play Glider; it is a carefully constructed house using all the familiar objects and elements, but designed in such a way that all you have to do is load the game and sit back and watch! You'll see the glider brave flame and spark, pass between deadly obstacles with microns to spare, and collect every bonus before completing the house. AND IT NEVER CRASHES! This house has some very unusual situations: multiple pathways, circuitous stairways, and recursive patterns, as well as some little oddities like candles that don't burn, outlets that don't shock, and balls that don't bounce. Because the glider's flight path is predetermined by the room set-ups, I have been able to make it do things that it never does in normal play. The result is a very intriguing bit of entertainment for Glider fans. I also have intentionally left this file unlocked so that you may explore the rooms with the Room Editor to find out how certain effects are achieved or to modify room set-ups for your own use. Hands-off House runs flawlessly on my LC II with 32 mhz accellerator. If you notice a performance problem on your Mac (like the glider crashing or bumping an object) I'd like to know about it, since I am assuming it will perform comparably on Macs of various speeds (all the dynamics of the game SHOULD be affected equally by the machine speed). One additional note: although the glider flies the same route each time, scores may vary slightly because of the random behavior in "open window" rooms. (Now I suppose someone will try to get a high score by "goosing" the glider through certain rooms where time bonuses can be improved, but I don't condone this, and anyway there are no batteries offered until the very end of the house.) WardHarten (Ward Hartenstein, Rochester, NY) P.S. Hands-off House looks especially cool with "FunArt" or "FunArt Deluxe", my custom art files for Glider 4.06. You might also try my other house designs "Five Great Houses" and "Glass House" available on AOL. \ No newline at end of file diff --git a/Houses/House Full of Stuff b/Houses/House Full of Stuff new file mode 100755 index 0000000..47a1a99 Binary files /dev/null and b/Houses/House Full of Stuff differ diff --git a/Houses/House Full of Stuff 2 b/Houses/House Full of Stuff 2 new file mode 100755 index 0000000..1c32bc5 Binary files /dev/null and b/Houses/House Full of Stuff 2 differ diff --git a/Houses/House Full of Stuff Next Door b/Houses/House Full of Stuff Next Door new file mode 100755 index 0000000..816abfb Binary files /dev/null and b/Houses/House Full of Stuff Next Door differ diff --git a/Houses/House Full of Stuff Next Door 2 b/Houses/House Full of Stuff Next Door 2 new file mode 100755 index 0000000..c74b65a Binary files /dev/null and b/Houses/House Full of Stuff Next Door 2 differ diff --git a/Houses/House Full of Stuff Read Me.txt b/Houses/House Full of Stuff Read Me.txt new file mode 100755 index 0000000..b5db645 --- /dev/null +++ b/Houses/House Full of Stuff Read Me.txt @@ -0,0 +1 @@ +The Story of The House Full of Stuff In the beginning there was no House Full of Stuff. Instead, there were lots of little three and four room houses that had been created one after another. I tried to make them bigger, but, to be honest, I got pretty darn sick of testing them out after building three or four rooms. Then, I had this thought: Why not stick all these little houses together, one after another, and make one big house, with lots and lots of stuff? So that's what I did, and now there is one big house, called the House Full of Stuff. As you go through it, you can see how the house is divided into distinct sections; each section was once a little house unto itself. More than just another house file, I believe that this house demonstrates The Way Glider Houses Ought To Be Made. Instead of getting pooped out after creating 30 or so rooms, try making a few small houses over time, and then, when you're ready, copy and paste 'em together. Hints: Room names sometimes have hints built into them There are many ways to get through the entire house without hitting every room; however, it is possibleand preferable, points-wiseto try and get through all of 'em. Questions, Comments: AOL: JeffrC \ No newline at end of file diff --git a/Houses/House Next Door Read Me.txt b/Houses/House Next Door Read Me.txt new file mode 100755 index 0000000..0050f8c --- /dev/null +++ b/Houses/House Next Door Read Me.txt @@ -0,0 +1 @@ +The Story of The House Full of Stuff Next Door I got through The House Full of Stuff, and so did a lot of other people. Some people thought some of the rooms, especially early on, were too hard. Others, mainly me, who had gone through it a few times, thought some of the rooms were getting to be too boring. And then there were the people who actually found flaws in some of the rooms. The answer to all of these problems: The House Full of Stuff Next Door. A replica of the original House Full of Stuff, built right next door to the original, but with a variety of improvements and surprises, including lots of new rooms. I wouldn't try this one until completing the original House Full of Stuff. First, House Full of Stuff Next Door is harder. Second, if you try House Full of Stuff first, you can jot down all of the problems and complaints you have with the original, and then get a special thrill as you count how many of them are solved, answered, and/or eliminated in the new version. Hints: Hints for House Full of Stuff still apply. Many rooms look exactly like the old versions, but be careful, slight alteration could spell disaster. Questions, Comments: AOL: JeffrC \ No newline at end of file diff --git a/Houses/House of Doom b/Houses/House of Doom new file mode 100755 index 0000000..21b1a4c Binary files /dev/null and b/Houses/House of Doom differ diff --git a/Houses/House of Doom Read Me.txt b/Houses/House of Doom Read Me.txt new file mode 100755 index 0000000..4ace100 --- /dev/null +++ b/Houses/House of Doom Read Me.txt @@ -0,0 +1 @@ +House of Doom is suitable for those who have completed the house that came with the game and are looking for a new challenge. It's comparable in difficulty to the 2nd half of the original house. Hints: Use battery power sparingly. You need a decent amount to finish. Be very careful going through the last room, as a wrong move can get you into serious difficulty, even with a lot of extra planes. Questions, Comments: AOL: JeffrC [ This is a busy house! That means a faster Mac may be required to get a smooth game. On low-end Macs some rooms may feel sluggish. - john] \ No newline at end of file diff --git a/Houses/House of the Rising Sun b/Houses/House of the Rising Sun new file mode 100755 index 0000000..4c5ef03 Binary files /dev/null and b/Houses/House of the Rising Sun differ diff --git a/Houses/House of the Rising Sun 1 b/Houses/House of the Rising Sun 1 new file mode 100755 index 0000000..553902d Binary files /dev/null and b/Houses/House of the Rising Sun 1 differ diff --git a/Houses/House of the Rising Sun 2 b/Houses/House of the Rising Sun 2 new file mode 100755 index 0000000..1e6e0c9 Binary files /dev/null and b/Houses/House of the Rising Sun 2 differ diff --git a/Houses/House of the Rising Sun 3 b/Houses/House of the Rising Sun 3 new file mode 100755 index 0000000..ef4f950 Binary files /dev/null and b/Houses/House of the Rising Sun 3 differ diff --git a/Houses/Lumpy's Home b/Houses/Lumpy's Home new file mode 100755 index 0000000..91e7e7b Binary files /dev/null and b/Houses/Lumpy's Home differ diff --git a/Houses/Lumpy's Home Read Me.txt b/Houses/Lumpy's Home Read Me.txt new file mode 100755 index 0000000..0802015 --- /dev/null +++ b/Houses/Lumpy's Home Read Me.txt @@ -0,0 +1 @@ +Dear Glider 4.0 Fans, Hello, my name is Tony Korlath and I designed Lumpy's Home. This was my first experience with using the Editor program and it worked quite nicely. Lumpy's Home took me about 3 hours to design. The fun part about designing your own home is that you can make it as hard or as easy as you would like. There is a least one hidden room, and I hope that you can find it. Good Luck and Happy Gliding, Tony Korlath \ No newline at end of file diff --git a/Houses/Mad House b/Houses/Mad House new file mode 100755 index 0000000..06063ab Binary files /dev/null and b/Houses/Mad House differ diff --git a/Houses/Mad House 2 b/Houses/Mad House 2 new file mode 100755 index 0000000..cb9c177 Binary files /dev/null and b/Houses/Mad House 2 differ diff --git a/Houses/Mad House Read Me.txt b/Houses/Mad House Read Me.txt new file mode 100755 index 0000000..ba68168 --- /dev/null +++ b/Houses/Mad House Read Me.txt @@ -0,0 +1 @@ +Welcome to the Mad House! This is a very difficult house to get through. I don't want to spoil it too much with a lot of hints, but I will reveal that the house is something of a maze. There are many, many rooms where you have several ways you can go. Some directions lead to certain entrapment and no return. Other directions lead to the way out. There are many ways to get through the house but an equal number of ways you can go in which you most certainly will not get through. A final hint: there are a lot of tough rooms where timing is VERY critical. This house is for the people who thought the original house (The House) was too easy. Good luck! john calhoun- \ No newline at end of file diff --git a/Houses/Rising Sun Read Me.txt b/Houses/Rising Sun Read Me.txt new file mode 100755 index 0000000..b530854 --- /dev/null +++ b/Houses/Rising Sun Read Me.txt @@ -0,0 +1 @@ +9/2/92 Hello! This is the README File to accompany "House of the Rising Sun." I created this house over the course of about one month, after finally completing "The House" that came with Glider 4.0. I figured I would give creating my own house a shot, and never realized that it would be so fun thinking up ways to make a plane crash. I'm an Apple Educational Systems Engineer for a dealership in Pennsylvania, and seeing as there aren't many schools needing Macs fixed or labs installed over the summer, I had more free time than I should have. Playing Glider helped me while away the hours. I uploaded the house to America Online and, to ensure that my work was not wasted, offered $10.00 to the first person to send me a screen shot of the completed house. I also offered $20.00 to anyone who could beat my high score. (It was 1.6 million, but then again, I knew where everything was). About 3 weeks later, I was $30.00 poorer. The same day I realized I would have to part with the other $20.00, John Calhoun E-Mailed me and said that he was interested in my house being in a collection of houses to be sold commercially. I was amazed. This was such an honor. I fixed some things here, moved some things there, and thought up some more funky names for the rooms. I took great pleasure in naming the rooms such that they would either help you get through the room, make you laugh, or just go, "Huh?" I am pleased to present House of the Rising Sun. 120 Rooms, More clocks than Pink Floyd's "Dark Side of the Moon," More balloons than a Republican National Convention, Millions of points, and, hopefully, hours of gliding pleasure. Thank you and have a nice day. Steve Sullivan Comments, suggestions, etc. may be sent to: AOL:ACME Steve AppleLink: CWED.LANG2 Internet: CWED.LANG2@applelink.apple.com \ No newline at end of file diff --git a/Houses/The House b/Houses/The House new file mode 100755 index 0000000..ffb4b7d Binary files /dev/null and b/Houses/The House differ diff --git a/Houses/The House 2 b/Houses/The House 2 new file mode 100755 index 0000000..60ecad6 Binary files /dev/null and b/Houses/The House 2 differ diff --git a/Houses/Usher House b/Houses/Usher House new file mode 100755 index 0000000..80420ed Binary files /dev/null and b/Houses/Usher House differ diff --git a/Houses/Usher House Read Me.txt b/Houses/Usher House Read Me.txt new file mode 100755 index 0000000..0c7b002 --- /dev/null +++ b/Houses/Usher House Read Me.txt @@ -0,0 +1 @@ +Usher House - Im one of the many starving 14 year olds who got up to his ears in debt to purchase Glider... It was well worth it. Ive been using Macs for seven years, six years of which were with an Original Macintosh, with a few upgrades (Do you remember those 128k machines?). Currently Im using a Mac IIsi. This house was written one lonely evening when Id gotten bored with houses that were NICE to the people in them. It originally had no gliders, batteries, rubber bands, or bonuses of any kind. I didnt just smother people with a dozen shredders in every room, but I came pretty darn close to it. It was, of course, nearly impossible to complete. I toned down the horror a little bit, and added some food in strategic places, which usually takes off more than it gives. When you try to complete the house, remember to use the time-honored practice of getting through fast, then going back for the goodies. Its now a 30 room house, with a good 100,000 points if you complete it. Have fun! Any and all comments are welcome. You can reach me as Phexem on America Online, or through Snail Mail at: Brian Eaton 1204 Milan Ave. S. Pasadena, CA 91030 [ This is one of the most difficult houses I've ever come across. Be warned. Also, some of the rooms are very busy - on a slow Mac it may feel sluggish. - john] \ No newline at end of file diff --git a/RoomEditor_103/Editor.project b/RoomEditor_103/Editor.project new file mode 100755 index 0000000..e69de29 diff --git a/RoomEditor_103/Editor.rsrc b/RoomEditor_103/Editor.rsrc new file mode 100755 index 0000000..e69de29 diff --git a/RoomEditor_103/Room Editor Version History.txt b/RoomEditor_103/Room Editor Version History.txt new file mode 100755 index 0000000..03f0df9 --- /dev/null +++ b/RoomEditor_103/Room Editor Version History.txt @@ -0,0 +1 @@ +Room Editor Version History 1.00 Original release. 1.01 I don;t remember what I added to this upgrade. 1.02 Handle the mix-up when checking 'deep' resource in art files. Updated Casady & Greene, Inc. address in About Room Editor 1.0 dialog box. Got rid of that Glider 1.0 panel that would come up in About Room Editor 1.0 box. 1.03 Renamed art files to "B&W Art" and "Color Art". Upgraded to "About 2.1" library. Added a color animated cursor (just like Glider 4.05). Opening art files is 'smarter' (i.e. will first check for appropriate default file names - if in color mode, the Editor looks for "Color Art"). Fixed the 'glide ratio' bug where the glider flew farther in the Room Editor with respect to Glider itself. The "House Info" dialog box now supports locking of a house (you can't unlock it though). The grease is now "operational" - you can slide along it. \ No newline at end of file diff --git a/RoomEditor_103/Sources/About.lib (2.1) b/RoomEditor_103/Sources/About.lib (2.1) new file mode 100755 index 0000000..3070c63 Binary files /dev/null and b/RoomEditor_103/Sources/About.lib (2.1) differ diff --git a/RoomEditor_103/Sources/About… 2.1 Intf.p b/RoomEditor_103/Sources/About… 2.1 Intf.p new file mode 100755 index 0000000..1b4e3a8 --- /dev/null +++ b/RoomEditor_103/Sources/About… 2.1 Intf.p @@ -0,0 +1 @@ +unit About; { version 2.1 last update: 1/1/92 } {} {} { About is copyrighted, and I reserve all rights to it; both source and} { compiled versions. Please do not distribute this source without my} { permission, or remove this notice. Thanks.} {} { Jon Wind (About)} { 2374 Hillwood Drive} { Maplewood, MN 55119} {} { 2.1 Changes } { Updated demo to work properly with System 7.0 and added popup menu for window types } { Improved overall stability of About unit, especially in tight memory situations } { Added support for movableDBoxProc window type } { Added support for plainDBox window type to be drawn with only scrollable text } {} { 2.0 Changes } { Created Modal and Modeless versions } { Added optional support for display of styled text } { Added support for copying styled text } { Added ability to specify how window will be centered instead of just center or not center } { Improved error checking in low memory conditions } { Shift-command-c will now also copy text } { Method of obtaining main window rect should now work for DAs, cdevs, etc } { Window dragging now gets bounds from GrayRgn } { Window centering routines now shift the window as neccessary to keep it entirely onscreen } { Option clicking in the window displays the version instead of option clicking anywhere } { OK button is now horizontally centered if MainIcon = NoIcon & Length(WinMsg) = 0; set WinMsg to an invisible character to not center it } { OK button is disabled and default roundrect is drawn in gray if the (modeless) About window is not in front } { Added support for close box instead of OK button for noGrowDocProc or rDocProc windows } { Scrolling text area is extended downward if MainIcon = NoIcon & Length(WinMsg) = 0 } { Control and window auxRecs are now used for frame and background colors } {} {$R-} interface const AboutVersion = 'About 2.1'; AboutNoIcon = -1; AboutNoCenter = -1; AboutTopCenter = 0; AboutMainCenter = 1; AboutMsg = 0; AboutTEXT = 1; movableDBoxProc = 5; type AboutFontRec = record Font, Size: Integer; Face: Style; Color: Integer; end; AboutRec = record FontInfo: array[AboutMsg..AboutTEXT] of AboutFontRec; TEXTCopy, KeyEquivs, CloseBox, Styled: Boolean; CenterMode, MainIcon, ClickIcon: Integer; ClickMsg: Str255; end; { Note: font color(s) must be blackColor, whiteColor, redColor, greenColor, blueColor, cyanColor, magentaColor, or yellowColor } { Note: if MainIcon = AboutNoIcon then no icon will be drawn } { Note: if ClickIcon = AboutNoIcon then no icon will be drawn when original icon is clicked on } { Note: if CenterMode = AboutNoCenter the window will use the supplied coordinates and will not be centered } { Note: if CenterMode = AboutTopCenter the window will be centered on the front window or the main monitor if there is no front window } { Note: if CenterMode = AboutMainCenter the window will be centered on the main monitor } { Note: if Length(ClickMsg) = 0 then no message will be drawn when original icon is clicked on } { Note: CloseBox will be ignored for dBoxProc, altDBoxProc, and movableDBoxProc windows } { Modal procedure: } { this routine does everything, returning to calling proc only after the window is dismissed... } procedure BuildAbout (WinRect: Rect; WinProc, TEXTid: Integer; WinTitle, WinMsg: Str255; WinMisc: AboutRec); { Modeless procedures: } { returns true if the specified window is an About window; otherwise returns false } function IsAboutWindow (theWindow: WindowPtr): Boolean; { open About window and return pointer to it - returns NIL if window is not created } { Note: you should keep track of this pointer only if you wish to keep specific track of it } function OpenAbout (WinRect: Rect; WinProc, TEXTid: Integer; WinTitle, WinMsg: Str255; WinMisc: AboutRec): WindowPtr; { handle event relating to About window, ie updateEvt, activateEvt, mouseDown, keyDown, etc } { Note: this proc should be called after every event for each About window for everything to work correctly } { Note: this proc calls the CloseAbout proc if the OK button or close box is selected } { Note: you can filter events passed to it to simulate a modal dialog } procedure HandleAbout (var theWindow: WindowPtr; var theEvent: EventRecord); { close the specified About window, kill data structures associated with it, and set theWindow to NIL } { Note: this proc is called by the HandleAbout proc when an About window is dismissed by selecting its OK button } { Note: this proc should be called when the program needs to remove an About window } procedure CloseAbout (var theWindow: WindowPtr); implementation procedure BuildAbout; external; function IsAboutWindow; external; function OpenAbout; external; procedure HandleAbout; external; procedure CloseAbout; external; end. \ No newline at end of file diff --git a/RoomEditor_103/Sources/E-Drawing.p b/RoomEditor_103/Sources/E-Drawing.p new file mode 100755 index 0000000..f08152a --- /dev/null +++ b/RoomEditor_103/Sources/E-Drawing.p @@ -0,0 +1 @@ +unit Drawing; interface uses Palettes, Globals, Utilities; procedure DrawRoomNum; procedure PlotSICN (theRect: Rect; theSICN: SICNHand); procedure LoadABackground (whichID: Integer); procedure DrawAllObjects; implementation {=================================} procedure DrawRoomNum; var tempStr: Str255; begin NumToString(roomAt, tempStr); tempStr := CONCAT(thisRoom.roomName, ' [', tempStr, ']'); SetWTitle(mainWndo, tempStr); end; {=================================} procedure PlotSICN; var state: SignedByte; srcBits: BitMap; begin state := HGetState(Handle(theSICN)); HLock(Handle(theSICN)); {$PUSH} srcBits.baseAddr := Ptr(@theSICN^^); {$POP} srcBits.rowBytes := 2; SetRect(srcBits.bounds, 0, 0, 16, 16); CopyBits(srcBits, GrafPtr(toolWndo)^.portBits, srcBits.bounds, theRect, srcCopy, nil); HSetState(Handle(theSICN), state); end; {=================================} procedure ArrangeTiles; var i, panel: Integer; begin for i := 0 to 7 do begin panel := thisRoom.tileOrder[i]; if (inColor) then CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, BitMapPtr(virginCPtr^.portPixMap^)^, tileRects[panel], tileRects[i], srcCopy, nil) else CopyBits(offLoadMap, offVirginMap, tileRects[panel], tileRects[i], srcCopy, nil); end; end; {=================================} procedure LoadABackground; var refNumber: Integer; tempByte: SignedByte; thePict: PicHandle; begin if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); refNumber := OpenResFile(resourceName); if (refNumber = -1) then begin CloseResFile(refNumber); UseResFile(editorResNum); GenericAlert(kErrGraphicsNotFound); Exit(LoadABackground); end; thePict := GetPicture(whichID); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); end else begin case whichID of {try to substitute} 205: thePict := GetPicture(201); 206: thePict := GetPicture(204); 207: thePict := GetPicture(200); 208: thePict := GetPicture(203); 209: thePict := GetPicture(200); otherwise begin GenericAlert(kErrGraphicLoad); Exit(LoadABackground); end; end; if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrGraphicLoad); Exit(LoadABackground); end; GenericAlert(kErrGraphicLoad); end; ReleaseResource(Handle(thePict)); CloseResFile(refNumber); UseResFile(editorResNum); if (toolWndo <> nil) then SetPort(toolWndo); ArrangeTiles; if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, nil); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, GrafPtr(mainWndo)^.visRgn) end else begin CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, nil); CopyBits(offVirginMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, mainWndo^.visRgn); end; end; {=================================} procedure FillNFrame (theColor: RGBColor; theRect: Rect); begin RGBForeColor(theColor); PaintRect(theRect); RGBForeColor(rgbBlack); FrameRect(theRect); end; {=================================} procedure GrayNFrame (theRect: Rect); begin FillRect(theRect, gray); FrameRect(theRect); end; {=================================} procedure HiLiteARect (theColor: RGBColor; theRect: Rect); begin RGBForeColor(theColor); MoveTo(theRect.left + 1, theRect.top + 1); LineTo(theRect.right - 2, theRect.top + 1); LineTo(theRect.right - 2, theRect.bottom - 2); RGBForeColor(rgbBlack); end; {=================================} procedure GrayLiteARect (theRect: Rect); begin PenPat(white); MoveTo(theRect.left + 1, theRect.top + 1); LineTo(theRect.right - 2, theRect.top + 1); LineTo(theRect.right - 2, theRect.bottom - 2); PenNormal; MoveTo(theRect.left + 1, theRect.top + 1); LineTo(theRect.left + 1, theRect.bottom - 2); LineTo(theRect.right - 2, theRect.bottom - 2); end; {=================================} procedure LoLiteARect (theRect: Rect); begin RGBForeColor(rgbLtBrown); MoveTo(theRect.left - 1, theRect.top); LineTo(theRect.left - 1, theRect.bottom); LineTo(theRect.right - 1, theRect.bottom); RGBForeColor(rgbDkGray); MoveTo(theRect.left, theRect.top - 1); LineTo(theRect.right, theRect.top - 1); LineTo(theRect.right, theRect.bottom); RGBForeColor(rgbBlack); end; {=================================} procedure GrayLoARect (theRect: Rect); begin PenPat(white); MoveTo(theRect.left - 1, theRect.top); LineTo(theRect.left - 1, theRect.bottom); LineTo(theRect.right - 1, theRect.bottom); PenNormal; MoveTo(theRect.left, theRect.top - 1); LineTo(theRect.right, theRect.top - 1); LineTo(theRect.right, theRect.bottom); end; {=================================} procedure DrawTable (whichItem: Integer); var kind: Integer; theRect, tempRect: Rect; begin if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); PenNormal; with thisRoom.theObjects[whichItem] do begin kind := objectIs; theRect := boundRect; end; if (inColor) then {***** Draw table top} begin FillNFrame(rgbBrown, theRect); MoveTo(theRect.left + 1, theRect.bottom - 2); LineTo(theRect.right - 1, theRect.bottom - 2); HiLiteARect(rgbLtBrown, theRect); end else begin GrayNFrame(theRect); GrayLiteARect(theRect); end; PenNormal; {***** Draw table shadow} SetRect(tempRect, theRect.left, floorVert - 0, theRect.right, floorVert + 20); OffsetRect(tempRect, (theRect.top - floorVert) div 5, 0); if (inColor) then begin PenMode(patCopy + transparent); PenPat(gray); PaintOval(tempRect); end else begin PenMode(patOr); PenPat(gray); PaintOval(tempRect); end; PenNormal; if (inColor) then {***** Draw table support} begin RGBForeColor(rgbBlack); PenSize(5, 1); MoveTo(((theRect.left + theRect.right) div 2) - 2, theRect.bottom); LineTo(((theRect.left + theRect.right) div 2) - 2, floorVert - 7); RGBForeColor(rgbWhite); PenSize(1, 1); MoveTo(((theRect.left + theRect.right) div 2) + 1, theRect.bottom + (theRect.right - theRect.left) div 8); LineTo(((theRect.left + theRect.right) div 2) + 1, floorVert - 7); RGBForeColor(rgbLtBrown); MoveTo(((theRect.left + theRect.right) div 2) + 0, theRect.bottom + (theRect.right - theRect.left) div 8); LineTo(((theRect.left + theRect.right) div 2) + 0, floorVert - 7); RGBForeColor(rgbBlack); end else begin PenSize(5, 1); MoveTo(((theRect.left + theRect.right) div 2) - 2, theRect.bottom); LineTo(((theRect.left + theRect.right) div 2) - 2, floorVert - 7); PenPat(white); PenSize(1, 1); MoveTo(((theRect.left + theRect.right) div 2) + 1, theRect.bottom + (theRect.right - theRect.left) div 8); LineTo(((theRect.left + theRect.right) div 2) + 1, floorVert - 7); PenPat(gray); MoveTo(((theRect.left + theRect.right) div 2) + 0, theRect.bottom + (theRect.right - theRect.left) div 8); LineTo(((theRect.left + theRect.right) div 2) + 0, floorVert - 7); end; PenNormal; tempRect := srcRect[kind];{***** Draw table base} OffsetRect(tempRect, -tempRect.left, -tempRect.top); OffsetRect(tempRect, ((theRect.left + theRect.right) div 2) - 31, floorVert - 7); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[kind], srcRect[kind], tempRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[kind], srcRect[kind], tempRect); end; {=================================} procedure DrawShelf (whichItem: Integer); var kind: Integer; theRect, tempRect: Rect; tempRgn: RgnHandle; begin if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); PenNormal; with thisRoom.theObjects[whichItem] do begin kind := objectIs; theRect := boundRect; end; if (inColor) then {***** Draw shelf top} begin RGBForeColor(rgbLtBrown); PaintRect(theRect); FrameRect(theRect); MoveTo(theRect.left + 1, theRect.bottom - 2); LineTo(theRect.right - 1, theRect.bottom - 2); RGBForeColor(rgbWhite); MoveTo(theRect.left + 1, theRect.top + 1); LineTo(theRect.right - 2, theRect.top + 1); end else begin GrayNFrame(theRect); GrayLiteARect(theRect); end; PenNormal; tempRgn := NewRgn; {***** Draw shelf shadow} MoveTo(theRect.right, theRect.bottom - 1); OpenRgn; Line(-15, 15); LineTo(theRect.left - 15, theRect.bottom + 14); Line(0, -5); Line(15, -15); Line(0, 5); LineTo(theRect.right, theRect.bottom - 1); CloseRgn(tempRgn); PenPat(gray); if (inColor) then begin RGBForeColor(rgbBlack); PenMode(patCopy + transparent); PenPat(gray); PaintRgn(tempRgn); end else begin PenMode(patOr); PaintRgn(tempRgn); end; DisposeRgn(tempRgn); PenNormal; tempRect := srcRect[kind]; {***** Draw shelf bracket 1} OffsetRect(tempRect, -tempRect.left, -tempRect.top); {0 it out} OffsetRect(tempRect, theRect.left + 15, theRect.bottom - 2); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[kind], srcRect[kind], tempRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[kind], srcRect[kind], tempRect); tempRect := srcRect[kind]; {***** Draw shelf bracket 2} OffsetRect(tempRect, -tempRect.left, -tempRect.top); {0 it out} OffsetRect(tempRect, theRect.right - 25, theRect.bottom - 2); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[kind], srcRect[kind], tempRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[kind], srcRect[kind], tempRect); end; {=================================} procedure DrawMirror (whichItem: Integer); var theRect: Rect; begin if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); PenNormal; with thisRoom.theObjects[whichItem] do theRect := boundRect; if (inColor) then begin FillNFrame(rgbBrown, theRect); HiLiteARect(rgbLtBrown, theRect); end else begin GrayNFrame(theRect); GrayLiteARect(theRect); end; InsetRect(theRect, 3, 3); FillRect(theRect, white); FrameRect(theRect); PenNormal; end; {=================================} procedure DrawCabinet (whichItem: Integer); var panels, width, index, offIt: Integer; theRect, tempR: Rect; shadoRgn: RgnHandle; begin if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); PenNormal; with thisRoom.theObjects[whichItem] do theRect := boundRect; tempR := theRect; if (theRect.bottom > 280) then {*** If the cabnet is a counter} begin tempR.bottom := tempR.bottom - 5; {*** Paint bulk of counter} if (inColor) then FillNFrame(rgbBrown, tempR) else GrayNFrame(tempR); tempR := theRect; {*** Paint foot-kick on bottom} InsetRect(tempR, 2, 0); tempR.top := tempR.bottom - 5; if (inColor) then FillNFrame(rgbDkGray, tempR) else begin FillRect(tempR, dkGray); FrameRect(tempR); end; {*** Paint counter-top} SetRect(tempR, theRect.left - 2, theRect.top, theRect.right + 2, theRect.top + 7); if (inColor) then FillNFrame(rgbLtBrown, tempR) else begin FillRect(tempR, ltGray); FrameRect(tempR); end; MoveTo(tempR.left + 2, tempR.bottom); LineTo(tempR.right - 3, tempR.bottom); shadoRgn := NewRgn; {*** Paint counter shadow} MoveTo(theRect.left, theRect.top + 5); OpenRgn; Line(-15, 15); LineTo(theRect.left - 15, theRect.bottom - 10); LineTo(theRect.left, theRect.bottom); LineTo(theRect.left, theRect.top + 5); CloseRgn(shadoRgn); HLock(Handle(shadoRgn)); if (inColor) then begin RGBForeColor(rgbBlack); PenMode(patCopy + transparent); PenPat(gray); PaintRgn(shadoRgn); end else begin PenMode(patOr); PenPat(gray); PaintRgn(shadoRgn); end; HUnlock(Handle(shadoRgn)); DisposeRgn(shadoRgn); PenNormal; offIt := 5; end else {*** It's a cabinet} begin if (inColor) then {*** Paint bulk of cabinet} FillNFrame(rgbBrown, theRect) else GrayNFrame(theRect); shadoRgn := NewRgn; {*** Paint the shadow} MoveTo(theRect.left, theRect.top); OpenRgn; Line(-15, 15); LineTo(theRect.left - 15, theRect.bottom + 15); LineTo(theRect.right - 15, theRect.bottom + 15); Line(15, -15); LineTo(theRect.left, theRect.bottom); LineTo(theRect.left, theRect.top); CloseRgn(shadoRgn); HLock(Handle(shadoRgn)); if (inColor) then begin PenMode(srcCopy + transparent); PenPat(gray); PaintRgn(shadoRgn); end else begin PenMode(patOr); PenPat(gray); PaintRgn(shadoRgn); end; HUnlock(Handle(shadoRgn)); DisposeRgn(shadoRgn); PenNormal; offIt := 0; end; panels := (theRect.right - theRect.left) div 48; if (panels = 0) then begin tempR := theRect; InsetRect(tempR, 5, 5 + offIt); FrameRect(tempR); if (inColor) then begin RGBForeColor(rgbLtBrown); MoveTo(tempR.left + 3, tempR.top + 3); LineTo(tempR.left + 3, tempR.bottom - 4); LineTo(tempR.right - 4, tempR.bottom - 4); RGBForeColor(rgbBlack); LineTo(tempR.right - 4, tempR.top + 3); LineTo(tempR.left + 3, tempR.top + 3); end else begin PenPat(white); MoveTo(tempR.left + 3, tempR.top + 3); LineTo(tempR.left + 3, tempR.bottom - 4); LineTo(tempR.right - 4, tempR.bottom - 4); PenPat(black); LineTo(tempR.right - 4, tempR.top + 3); LineTo(tempR.left + 3, tempR.top + 3); end; end else begin width := ((theRect.right - theRect.left) - (panels + 1) * 5) div panels; SetRect(tempR, theRect.left + 5, theRect.top + 5 + offIt, theRect.left + 5 + width, theRect.bottom - 5 - offIt); for index := 1 to panels do begin if (inColor) then begin RGBForeColor(rgbLtBrown); MoveTo(tempR.left + 3, tempR.top + 3); LineTo(tempR.left + 3, tempR.bottom - 4); LineTo(tempR.right - 4, tempR.bottom - 4); RGBForeColor(rgbBlack); LineTo(tempR.right - 4, tempR.top + 3); LineTo(tempR.left + 3, tempR.top + 3); end else begin FrameRect(tempR); PenPat(white); MoveTo(tempR.left + 3, tempR.top + 3); LineTo(tempR.left + 3, tempR.bottom - 4); LineTo(tempR.right - 4, tempR.bottom - 4); PenPat(black); LineTo(tempR.right - 4, tempR.top + 3); LineTo(tempR.left + 3, tempR.top + 3); end; OffsetRect(tempR, width + 5, 0); end; end; PenNormal; end; {=================================} procedure DrawARect (whichItem: Integer; popAmount: Boolean); var tempStr: Str255; theRect: Rect; number: Integer; begin if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); PenNormal; with thisRoom.theObjects[whichItem] do begin number := amount; theRect := boundRect; end; PenPat(gray); FrameRect(theRect); PenNormal; if (popAmount) then begin PenMode(srcOr); MoveTo(theRect.left + 2, theRect.bottom - 2); NumToString(number, tempStr); DrawString(tempStr); PenNormal; end; end; {=================================} procedure DrawWindow (whichItem: Integer); var theRect, tempRect: Rect; kind: Integer; tempRgn: RgnHandle; windowOpen: Boolean; begin if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); PenNormal; with thisRoom.theObjects[whichItem] do begin kind := objectIs; theRect := boundRect; windowOpen := isOn; end; tempRgn := NewRgn; {***** Draw window shadow} MoveTo(theRect.left, theRect.top); OpenRgn; Line(-10, 10); Line(0, 5); Line(5, 5); LineTo(theRect.left - 5, theRect.bottom - 10); Line(-5, 5); Line(0, 5); Line(5, 5); LineTo(theRect.right - 5, theRect.bottom + 5); LineTo(theRect.right, theRect.bottom); LineTo(theRect.left, theRect.bottom); LineTo(theRect.left, theRect.top); CloseRgn(tempRgn); PenPat(gray); if (inColor) then begin RGBForeColor(rgbBlack); PenMode(patCopy + transparent); PenPat(gray); PaintRgn(tempRgn); end else begin PenMode(patOr); PaintRgn(tempRgn); end; DisposeRgn(tempRgn); PenNormal; if (inColor) then begin FillNFrame(rgbBrown, theRect); {***** Draw window frame and sill} HiLiteARect(rgbLtBrown, theRect); SetRect(tempRect, theRect.left - 4, theRect.top, theRect.right + 4, theRect.top + 6); FillNFrame(rgbBrown, tempRect); HiLiteARect(rgbLtBrown, tempRect); SetRect(tempRect, theRect.left - 2, theRect.top + 6, theRect.right + 2, theRect.top + 10); FillNFrame(rgbBrown, tempRect); SetRect(tempRect, theRect.left - 4, theRect.bottom - 6, theRect.right + 4, theRect.bottom); FillNFrame(rgbBrown, tempRect); HiLiteARect(rgbLtBrown, tempRect); SetRect(tempRect, theRect.left - 2, theRect.bottom - 10, theRect.right + 2, theRect.bottom - 5); FillNFrame(rgbBrown, tempRect); HiLiteARect(rgbLtBrown, tempRect); tempRect := theRect; InsetRect(tempRect, 8, 16); FillNFrame(rgbBrown, tempRect); LoLiteARect(tempRect); tempRect := theRect; {***** Draw the top window pane} InsetRect(tempRect, 8, 16); tempRect.bottom := ((theRect.bottom + theRect.top) div 2) + 2; FillNFrame(rgbBrown, tempRect); InsetRect(tempRect, 6, 6); LoLiteARect(tempRect); InsetRect(tempRect, 2, 2); LoLiteARect(tempRect); InsetRect(tempRect, 2, 2); FillNFrame(rgbBlack, tempRect); LoLiteARect(tempRect); tempRect := theRect; {Fill bottom black} InsetRect(tempRect, 8, 16); tempRect.top := ((theRect.bottom + theRect.top) div 2) + 2; FillRect(tempRect, black); tempRect := theRect; {***** Draw the bottom window pane} InsetRect(tempRect, 8, 16); tempRect.top := ((theRect.bottom + theRect.top) div 2) - 2; if (windowOpen) then OffsetRect(tempRect, 0, 26 - ((theRect.bottom - theRect.top) div 2)); FillNFrame(rgbBrown, tempRect); InsetRect(tempRect, 6, 6); LoLiteARect(tempRect); InsetRect(tempRect, 2, 2); LoLiteARect(tempRect); InsetRect(tempRect, 2, 2); FillNFrame(rgbBlack, tempRect); LoLiteARect(tempRect); RGBForeColor(rgbBlack); end else begin GrayNFrame(theRect); {***** Draw window frame and sill} GrayLiteARect(theRect); SetRect(tempRect, theRect.left - 4, theRect.top, theRect.right + 4, theRect.top + 6); GrayNFrame(tempRect); GrayLiteARect(tempRect); SetRect(tempRect, theRect.left - 2, theRect.top + 6, theRect.right + 2, theRect.top + 10); GrayNFrame(tempRect); SetRect(tempRect, theRect.left - 4, theRect.bottom - 6, theRect.right + 4, theRect.bottom); GrayNFrame(tempRect); GrayLiteARect(tempRect); SetRect(tempRect, theRect.left - 2, theRect.bottom - 10, theRect.right + 2, theRect.bottom - 5); GrayNFrame(tempRect); GrayLiteARect(tempRect); tempRect := theRect; InsetRect(tempRect, 8, 16); GrayNFrame(tempRect); GrayLoARect(tempRect); tempRect := theRect; {***** Draw the top window pane} InsetRect(tempRect, 8, 16); tempRect.bottom := ((theRect.bottom + theRect.top) div 2) + 2; GrayNFrame(tempRect); InsetRect(tempRect, 6, 6); GrayLoARect(tempRect); InsetRect(tempRect, 2, 2); GrayLoARect(tempRect); InsetRect(tempRect, 2, 2); FillRect(tempRect, black); GrayLoARect(tempRect); tempRect := theRect; {Fill bottom black} InsetRect(tempRect, 8, 16); tempRect.top := ((theRect.bottom + theRect.top) div 2) + 2; FillRect(tempRect, black); tempRect := theRect; {***** Draw the bottom window pane} InsetRect(tempRect, 8, 16); tempRect.top := ((theRect.bottom + theRect.top) div 2) - 2; if (windowOpen) then OffsetRect(tempRect, 0, 26 - ((theRect.bottom - theRect.top) div 2)); GrayNFrame(tempRect); InsetRect(tempRect, 6, 6); GrayLoARect(tempRect); InsetRect(tempRect, 2, 2); GrayLoARect(tempRect); InsetRect(tempRect, 2, 2); FillRect(tempRect, black); GrayLoARect(tempRect); end; end; {=================================} procedure DrawStair (whichItem: Integer); var refNumber, kind: Integer; tempByte: SignedByte; theRect: Rect; thePict: PicHandle; begin if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); with thisRoom.theObjects[whichItem] do begin kind := objectIs; theRect := boundRect; end; refNumber := OpenResFile(resourceName); if (refNumber = -1) then begin CloseResFile(refNumber); UseResFile(editorResNum); GenericAlert(kErrGraphicsNotFound); Exit(DrawStair); end; if (kind = upStar) then thePict := GetPicture(198) else thePict := GetPicture(199); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, theRect); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrGraphicLoad); end; ReleaseResource(Handle(thePict)); CloseResFile(refNumber); UseResFile(editorResNum); end; {=================================} procedure DrawAllObjects; var wasPort: GrafPtr; index, nObjects, holdSelect: Integer; theSrc, destRect: Rect; begin GetPort(wasPort); nObjects := thisRoom.numberOObjects; if (nObjects = 0) then begin if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, GrafPtr(mainWndo)^.visRgn) else CopyBits(offVirginMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, mainWndo^.visRgn); Exit(DrawAllObjects); end; if (lightsOut) then begin if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); PenNormal; PaintRect(wholeArea); for index := 1 to thisRoom.numberOObjects do with thisRoom.theObjects[index] do if (objectIs = litSwt) then begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, theSrc, theSrc, destRect); end; if (inColor) then CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, GrafPtr(mainWndo)^.visRgn) else CopyBits(offLoadMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, mainWndo^.visRgn); Exit(DrawAllObjects); end; holdSelect := oneActive; if (holdSelect <> 0) then Deselect; if (inColor) then CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, wholeArea, wholeArea, srcCopy, wholeRgn) else CopyBits(offVirginMap, offLoadMap, wholeArea, wholeArea, srcCopy, wholeRgn); for index := 1 to thisRoom.numberOObjects do with thisRoom.theObjects[index] do case objectIs of table: DrawTable(index); shelf: DrawShelf(index); cabNet: DrawCabinet(index); books: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, theSrc, theSrc, destRect); end; extRct, bnsRct: DrawArect(index, TRUE); obsRct: DrawArect(index, FALSE); flrVnt..candle: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, theSrc, theSrc, destRect); end; lftFan, ritFan: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, theSrc, theSrc, destRect); end; grease: begin if (isOn) then theSrc := srcRect[objectIs] {grease is up} else theSrc := srcRect[59]; {grease has fallen} destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, theSrc, theSrc, destRect); end; clock, paper, battry, rbrBnd: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, theSrc, theSrc, destRect); end; litSwt..guitar: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, theSrc, theSrc, destRect); end; toastr..teaKtl: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, theSrc, theSrc, destRect); end; drip: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, theSrc, theSrc, destRect); end; window: DrawWindow(index); mirror: DrawMirror(index); paintg: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyBits(BitMapPtr(objectCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, theSrc, destRect, srcCopy, nil) else CopyBits(offPlayerMap, offLoadMap, theSrc, destRect, srcCopy, nil); end; basket, macTsh: begin theSrc := srcRect[objectIs]; destRect := boundRect; if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, theSrc, theSrc, destRect) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, theSrc, theSrc, destRect); end; upStar, dnStar: DrawStair(index); otherwise Cycle; end; if (inColor) then CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, GrafPtr(mainWndo)^.visRgn) else CopyBits(offLoadMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, mainWndo^.visRgn); if (holdSelect <> 0) then begin oneActive := holdSelect; Select; end; if (toolWndo <> nil) then SetPort(toolWndo) else SetPort(wasPort); end; {=================================} end. \ No newline at end of file diff --git a/RoomEditor_103/Sources/E-FileInNOut.p b/RoomEditor_103/Sources/E-FileInNOut.p new file mode 100755 index 0000000..963a42f --- /dev/null +++ b/RoomEditor_103/Sources/E-FileInNOut.p @@ -0,0 +1 @@ +unit FileInNOut; interface uses Palettes, Globals, Utilities; function OpenFile (fileName: Str255; vNum: Integer): Boolean; function DoOpen: Boolean; function WriteFile (theFile, volNum: Integer): Boolean; function DoSaveAs: Boolean; function DoSave: Boolean; function DoClose: Boolean; function SaveNoClose: Integer; function SaveFirst: Integer; procedure SavePrefs; implementation {=================================} function IOCheck (theErr: OSErr): Integer; var dummyInt: Integer; line1, line2: Str255; alertHandle: AlertTHndl; alertRect: Rect; begin UseResFile(editorResNum); if (theErr <> NoErr) then begin InitCursor; case theErr of DskFulErr: GetIndString(line1, fileStrIDs, 1); FNFErr: GetIndString(line1, fileStrIDs, 2); WPrErr: GetIndString(line1, fileStrIDs, 3); FLckdErr: GetIndString(line1, fileStrIDs, 4); VLckdErr: GetIndString(line1, fileStrIDs, 5); FBsyErr, OpWrErr: GetIndString(line1, fileStrIDs, 6); EOFErr: GetIndString(line1, fileStrIDs, 7); otherwise GetIndString(line1, fileStrIDs, 10); end; NumToString(theErr, line2); line2 := CONCAT('Error code = ', line2); ParamText(line1, line2, '', ''); alertHandle := AlertTHndl(Get1Resource('ALRT', fileAlertID)); if (alertHandle <> nil) then begin HNoPurge(Handle(alertHandle)); alertRect := alertHandle^^.boundsRect; OffsetRect(alertRect, -alertRect.left, -alertRect.top); dummyInt := (screenBits.bounds.right - alertRect.right) div 2; OffsetRect(alertRect, dummyInt, 0); dummyInt := (screenBits.bounds.bottom - alertRect.bottom) div 3; OffsetRect(alertRect, 0, dummyInt); alertHandle^^.boundsRect := alertRect; HPurge(Handle(alertHandle)); end; dummyInt := Alert(fileAlertID, nil); end; IOCheck := theErr; end; {=================================} function OpenFile; var textLength: LongInt; resultCode: OSErr; dummy: Boolean; begin SpinBall; OpenFile := FALSE; resultCode := FSOpen(fileName, vNum, fileNumber); if (IOCheck(resultCode) <> 0) then Exit(OpenFile); SpinBall; resultCode := SetFPos(fileNumber, FSFromStart, 0); if (IOCheck(resultCode) <> 0) then begin fileIsOpen := TRUE; dummy := DoClose; Exit(OpenFile); end; SpinBall; textLength := SIZEOF(houseRec); resultCode := FSRead(fileNumber, textLength, @thisHouse); if (IOCheck(resultCode) <> 0) then begin fileIsOpen := TRUE; dummy := DoClose; Exit(OpenFile); end; SpinBall; if (thisHouse.timeStamp <= 0) then begin GenericAlert(24); fileIsOpen := TRUE; volumeNumber := vNum; dummy := DoClose; Exit(OpenFile); end; SpinBall; fileIsOpen := TRUE; OpenFile := TRUE; lockIt := FALSE; volumeNumber := vNum; end; {=================================} function SimpleFileFilter (p: ParmBlkPtr): BOOLEAN; begin SimpleFileFilter := TRUE; {Don't show it -- default} with p^.ioFlFndrInfo do if (fdType = 'GLhs') then SimpleFileFilter := FALSE; {Show it} end; {=====================================} function DoOpen; var dlgOrigin: Point; theTypeList: SFTypeList; theReply: SFReply; begin DoOpen := FALSE; SetPt(dlgOrigin, dlgLeft + rightOffset, dlgTop + downOffset); theTypeList[0] := 'GLhs'; SFPGetFile(dlgOrigin, '', @SimpleFileFilter, -1, theTypeList, nil, theReply, custGetID, nil); with theReply do begin if (good) then begin housesName := fName; DoOpen := (OpenFile(fName, vRefNum)); InitCursor; end else begin DoOpen := FALSE; Exit(DoOpen); end; end; end; {=====================================} function WriteFile; var index, temp: Integer; fileLength: LongInt; resultCode: OSErr; begin SpinBall; WriteFile := FALSE; fileLength := SIZEOF(houseRec); SpinBall; resultCode := SetFPos(theFile, FSFromStart, 0); if (IOCheck(resultCode) <> 0) then begin Exit(WriteFile); end; SpinBall; resultCode := FSWrite(theFile, fileLength, @thisHouse); if (IOCheck(resultCode) <> 0) then begin Exit(WriteFile); end; SpinBall; resultCode := SetEOF(theFile, fileLength); if (IOCheck(resultCode) <> 0) then begin Exit(WriteFile); end; SpinBall; resultCode := FlushVol(nil, volNum); if (IOCheck(resultCode) <> 0) then begin Exit(WriteFile); end; SpinBall; changed := FALSE; WriteFile := TRUE; end; {=====================================} function DoSaveAs; var dlgOrigin: Point; theReply: SFReply; resultCode: OSErr; theInfo: FInfo; begin DoSaveAs := FALSE; if (fileIsOpen) then begin if (not DoClose) then Exit(DoSaveAs); end; SetPt(dlgOrigin, dlgLeft + rightOffset + 20, dlgTop + downOffset); SFPutFile(dlgOrigin, 'Name for house:', '', nil, theReply); with theReply do begin if (not good) then Exit(DoSaveAs); volumeNumber := vRefNum; resultCode := GetFInfo(fName, vRefNum, theInfo); case resultCode of NoErr: if (theInfo.fdType <> 'GLhs') then begin GenericAlert(kErrFileExists); Exit(DoSaveAs); end; FNFErr: begin resultCode := Create(fname, vRefNum, 'GLed', 'GLhs'); if (IOCheck(resultCode) <> 0) then Exit(DoSaveAs); end; otherwise begin GenericAlert(resultCode); Exit(DoSaveAs); end; end; {end - case} {SetCursor- watch} housesName := fName; if (thisHouse.firstFile = '') then thisHouse.firstFile := housesName; GetDateTime(thisHouse.timeStamp); if (not lockIt) then thisHouse.timeStamp := -thisHouse.timeStamp; SpinBall; resultCode := FSOpen(fName, vRefNum, fileNumber); if (IOCheck(resultCode) <> 0) then Exit(DoSaveAs); if (not WriteFile(fileNumber, vRefNum)) then begin InitCursor; Exit(DoSaveAs); end; InitCursor; end; {end - with} fileIsOpen := TRUE; EnableItem(GetMenu(mFile), iSave); DoSaveAs := TRUE; end; {=====================================} function DoSave; var resultCode: OSErr; begin DoSave := FALSE; if ((housesName = 'untitled') and (not fileIsOpen)) then begin if (not DoSaveAs) then Exit(DoSave); end else begin GetDateTime(thisHouse.timeStamp); if (not lockIt) then thisHouse.timeStamp := -thisHouse.timeStamp; if (not WriteFile(fileNumber, volumeNumber)) then begin InitCursor; Exit(DoSave); end; InitCursor; end; DoSave := TRUE; end; {=================================} function DoClose; var resultCode: OSErr; begin DoClose := FALSE; if (fileIsOpen) then begin resultCode := FSClose(fileNumber); if (IOCheck(resultCode) <> 0) then Exit(DoClose); resultCode := FlushVol(nil, volumeNumber); if (IOCheck(resultCode) <> 0) then Exit(DoClose); EnableItem(GetMenu(mFile), 1); EnableItem(GetMenu(mFile), 2); DisableItem(GetMenu(mFile), 4); DisableItem(GetMenu(mFile), 5); DisableItem(GetMenu(mFile), 6); DisableItem(GetMenu(mFile), 7); end; fileIsOpen := FALSE; housesName := 'untitled'; DoClose := TRUE; end; {=====================================} function SaveNoClose; const saveBut = 1; closeBut = 2; cancelBut = 6; var leaveDlg: Boolean; theDlgPtr: DialogPtr; wasPort: GrafPtr; tempRect: Rect; cntlType, index, itemHit, tempInt, rightOff, downOff: Integer; dlgItem: Handle; {-------------------------} procedure Redraw; var index: Integer; begin SetPort(theDlgPtr); {Point to our dialog window} GetDItem(theDlgPtr, saveBut, cntlType, dlgItem, tempRect);{Get the item handle} PenSize(3, 3); {Change pen to draw thick default outline} InsetRect(tempRect, -4, -4); {Draw outside the button by 1 pixel} FrameRoundRect(tempRect, 16, 16); {Draw the outline} PenNormal; end; {-------------------------} begin GetPort(wasPort); theDlgPtr := GetNewDialog(saveNoCloseID, nil, Pointer(-1)); with theDlgPtr^.portBits do begin rightOff := rightOffset - bounds.left; downOff := downOffset - bounds.top; end; MoveWindow(theDlgPtr, rightOff, downOff, FALSE); ShowWindow(theDlgPtr); SelectWindow(theDlgPtr); SetPort(theDlgPtr); Redraw; leaveDlg := FALSE; repeat ModalDialog(nil, itemHit); GetDItem(theDlgPtr, itemHit, cntlType, dlgItem, tempRect); if (itemHit = saveBut) or (itemHit = closeBut) or (itemHit = cancelBut) then begin SaveNoClose := itemHit; leaveDlg := TRUE; end; until leaveDlg; DisposDialog(theDlgPtr); if (toolWndo <> nil) then SetPort(toolWndo) else SetPort(wasPort); end; {=====================================} function SaveFirst; const saveBut = 1; quitBut = 2; cancelBut = 6; var leaveDlg: Boolean; theDlgPtr: DialogPtr; wasPort: GrafPtr; tempRect: Rect; cntlType, index, itemHit, tempInt, rightOff, downOff: Integer; dlgItem: Handle; {-------------------------} procedure Redraw; var index: Integer; begin SetPort(theDlgPtr); {Point to our dialog window} GetDItem(theDlgPtr, saveBut, cntlType, dlgItem, tempRect);{Get the item handle} PenSize(3, 3); {Change pen to draw thick default outline} InsetRect(tempRect, -4, -4); {Draw outside the button by 1 pixel} FrameRoundRect(tempRect, 16, 16); {Draw the outline} PenNormal; end; {-------------------------} begin GetPort(wasPort); theDlgPtr := GetNewDialog(saveNoQuitID, nil, Pointer(-1)); with theDlgPtr^.portBits do begin rightOff := rightOffset - bounds.left; downOff := downOffset - bounds.top; end; MoveWindow(theDlgPtr, rightOff, downOff, FALSE); ShowWindow(theDlgPtr); SelectWindow(theDlgPtr); SetPort(theDlgPtr); Redraw; leaveDlg := FALSE; repeat ModalDialog(nil, itemHit); GetDItem(theDlgPtr, itemHit, cntlType, dlgItem, tempRect); if (itemHit = saveBut) or (itemHit = quitBut) or (itemHit = cancelBut) then begin SaveFirst := itemHit; leaveDlg := TRUE; end; until leaveDlg; DisposDialog(theDlgPtr); if (toolWndo <> nil) then SetPort(toolWndo) else SetPort(wasPort); end; {=================================} procedure SavePrefs; type prefType = record resName: string[32]; controlIs: Integer; leftIs, rightIs, energyIs, bandIs: Integer; buttonIs, restoreIs: Boolean; leftNameIs, rightNameIs, energyNameIs, bandNameIs: string[12]; isKeyBoard: Integer; end; prefPtr = ^prefType; prefHand = ^prefPtr; var theirPrefs: prefHand; theErr: OSErr; volName: Str255; begin UseResFile(editorResNum); theirPrefs := prefHand(NewHandle(SIZEOF(prefType))); if (theirPrefs <> nil) then HLock(Handle(theirPrefs)) else begin GenericAlert(kErrSavingPrefs); Exit(SavePrefs); end; Handle(theirPrefs) := GetResource('Gprf', 128); if ((ResError = noErr) and (theirPrefs <> nil)) then with theirPrefs^^ do begin resName := resourceName; controlIs := controlMethod; leftIs := leftKey; rightIs := rightKey; energyIs := energyKey; bandIs := bandKey; buttonIs := buttonFires; restoreIs := restoreColor; leftNameIs := leftName; rightNameIs := rightName; energyNameIs := energyName; bandNameIs := bandName; isKeyBoard := herKeyBoard; end else begin GenericAlert(kErrSavingPrefs); Exit(SavePrefs); end; ChangedResource(Handle(theirPrefs)); WriteResource(Handle(theirPrefs)); if (ResError <> noErr) then begin if ((ResError = FLckdErr) or (ResError = VLckdErr) or (ResError = WPrErr)) then GenericAlert(kErrSavingPrefs) else GenericAlert(ResError); end; HUnlock(Handle(theirPrefs)); ReleaseResource(Handle(theirPrefs)); end; {=================================} end. \ No newline at end of file diff --git a/RoomEditor_103/Sources/E-FlyGlider.p b/RoomEditor_103/Sources/E-FlyGlider.p new file mode 100755 index 0000000..531123f --- /dev/null +++ b/RoomEditor_103/Sources/E-FlyGlider.p @@ -0,0 +1 @@ +unit FlyGlider; interface uses Palettes, Globals, Utilities, Drawing, ObjectStuff; procedure ResetGlider; procedure ExtractEventRects; procedure ReadyRoom; procedure FlyGlider; var nObjects: Integer; timeIs: LongInt; testRoom: roomData; {=================================} implementation {=================================} procedure CenterMouse; const MBState = $172; MTemp = $828; RawMouse = $82C; Mouse = $830; CrsrNew = $8CE; CrsrCouple = $8CF; Couple = $FF; Uncouple = $00; var center: Point; lowGlob: Integer; lowMem: Ptr; pointPtr: ^Point; begin SetPt(center, 256, 171); lowMem := Pointer(rawMouse); pointPtr := @lowMem^; pointPtr^ := center; lowMem := Pointer(MTemp); pointPtr := @lowMem^; pointPtr^ := center; lowMem := Pointer(CrsrNew); lowMem^ := $FFFF; end; {=================================} procedure ReadyGlider; var mousePt: Point; dummyLong, timeToStop: LongInt; tempRect: Rect; begin with theGlider do begin bands := 0; forVel := 4; energy := 0; mode := fadingIn; phase := 0; isForward := TRUE; isRight := TRUE; if (isRight) then SetRect(destRect, 0, 40, 48, 60) else SetRect(destRect, 464, 40, 512, 60); oldRect := destRect; wholeRect := destRect; srcNum := 0; mass := currMass; end; lifeNormal := FALSE; PenNormal; PenMode(patXOr); FrameRect(theGlider.destRect); repeat until not Button; repeat with theGlider do begin FrameRect(oldRect); GetMouse(mousePt); SetRect(destRect, -24, -10, 24, 10); OffsetRect(destRect, mousePt.h, mousePt.v); FrameRect(destRect); oldRect := destRect; end; until Button; FrameRect(theGlider.oldRect); tempRect := theGlider.oldRect; InsetRect(tempRect, -1, -1); FrameRect(tempRect); with theGlider do begin oldRect := destRect; wholeRect := destRect; shadoDest := destRect; shadoDest.top := floorVert; shadoDest.bottom := floorVert + 11; oldShado := shadoDest; wholeShado := shadoDest; touchRect := destRect; InsetRect(touchRect, 10, 5); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, GrafPtr(mainWndo)^.portBits, glideRct[srcNum], glideRct[srcNum], destRect) else CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, glideRct[srcNum], glideRct[srcNum], destRect) end; timeToStop := TickCount + 120; repeat SpinBall; Delay(2, dummyLong); until (TickCount > timeToStop); FrameRect(tempRect); end; {=================================} procedure ExtractEventRects; var index, tempInt, tempNum: Integer; tempRect: Rect; {-------------------------} procedure SetUpGrease; begin nCycleObs := nCycleObs + 1; with testRoom.theObjects[index] do begin if (isOn) then begin eventRect[index] := boundRect; with cycleObjects[nCycleObs] do begin kindIs := grease; tiedTo := index; wholeRect := eventRect[index]; oldRect := wholeRect; reset := 0; {phase=not spilled} accel := grease; {graphic # to display} velocity := wholeRect.right;{current length of spill} position := amount; {full length of spill} end; end else begin eventRect[index].left := boundRect.right; eventRect[index].bottom := boundRect.bottom; eventRect[index].right := amount; eventRect[index].top := boundRect.bottom - 4; with cycleObjects[nCycleObs] do begin kindIs := grease; tiedTo := index; wholeRect := boundRect; oldRect := wholeRect; reset := 999; {phase=spilled} accel := 59; {graphic # to display} velocity := amount; {current length of spill} position := amount; {length of spill} end; end; end; end; {-------------------------} procedure FrameOutlet; begin nCycleObs := nCycleObs + 1; eventRect[index] := testRoom.theObjects[index].boundRect; with cycleObjects[nCycleObs] do begin kindIs := outlet; tiedTo := index; eventKind[tiedTo, 1] := 0; accel := 25; wholeRect := testRoom.theObjects[index].boundRect; oldRect := wholeRect; reset := testRoom.theObjects[index].amount; position := TickCount; end; end; {-------------------------} procedure FrameCandle; begin nCycleObs := nCycleObs + 1; with testRoom.theObjects[index] do begin tempInt := (boundRect.right + boundRect.left) div 2; SetRect(eventRect[index], tempInt - 12, amount, tempInt + 4, boundRect.top); end; with cycleObjects[nCycleObs] do begin wholeRect := testRoom.theObjects[index].boundRect; wholeRect.bottom := wholeRect.top; wholeRect.top := wholeRect.bottom - 12; wholeRect.left := wholeRect.left + 5; wholeRect.right := wholeRect.left + 16; oldRect := wholeRect; kindIs := candle; position := DoRandom(3) + 48; end; end; {-------------------------} procedure FrameDrip; var objectType: Integer; begin nCycleObs := nCycleObs + 1; eventRect[index] := testRoom.theObjects[index].boundRect; with cycleObjects[nCycleObs] do begin kindIs := drip; tiedTo := index; holdRect := testRoom.theObjects[index].boundRect; wholeRect := holdRect; oldRect := wholeRect; reset := testRoom.theObjects[index].amount * 32; accel := 12; position := holdRect.bottom * 32; velocity := 0; phase := 53; with testRoom.theObjects[index] do if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, srcRect[objectIs], srcRect[objectIs], boundRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, srcRect[objectIs], srcRect[objectIs], boundRect); end; end; {-------------------------} procedure ReadyToast; begin nCycleObs := nCycleObs + 1; with testRoom.theObjects[index] do begin tempInt := boundRect.left + 3; tempNum := boundRect.bottom - 3; SetRect(eventRect[index], 0, 0, 32, 31); OffsetRect(eventRect[index], tempInt, tempNum); SetRect(tempRect, tempInt, amount, tempInt + 32, boundRect.top); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, srcRect[objectIs], srcRect[objectIs], boundRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, srcRect[objectIs], srcRect[objectIs], boundRect); end; toastRgn := NewRgn; RectRgn(toastRgn, tempRect); hasToast := TRUE; with cycleObjects[nCycleObs] do begin phase := 60; kindIs := toastr; tiedTo := index; wholeRect := eventRect[index]; oldRect := wholeRect; reset := tempNum * 32; accel := 8; position := reset; tempInt := (testRoom.theObjects[index].amount + 32) * 32; velocity := 0; repeat velocity := velocity + accel; tempInt := tempInt + velocity; until (tempInt > reset); velocity := -velocity; end; end; {-------------------------} procedure FrameBall; begin nCycleObs := nCycleObs + 1; eventRect[index] := testRoom.theObjects[index].boundRect; with cycleObjects[nCycleObs] do begin kindIs := ball; tiedTo := index; wholeRect := testRoom.theObjects[index].boundRect; oldRect := wholeRect; reset := testRoom.theObjects[index].boundRect.bottom * 32; accel := 8; position := reset; tempInt := (testRoom.theObjects[index].amount + 32) * 32; velocity := 0; repeat velocity := velocity + accel; tempInt := tempInt + velocity; until (tempInt > reset); velocity := -velocity; end; end; {-------------------------} procedure ReadyFish; begin nCycleObs := nCycleObs + 1; with testRoom.theObjects[index] do begin tempInt := boundRect.left + 8; tempNum := boundRect.top + 24; SetRect(eventRect[index], 0, 0, 16, 16); {fish rectangle} OffsetRect(eventRect[index], tempInt, tempNum); if (inColor) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(virginCPtr^.portPixMap^)^, srcRect[objectIs], srcRect[objectIs], boundRect) else CopyMask(offPlayerMap, offMaskMap, offVirginMap, srcRect[objectIs], srcRect[objectIs], boundRect); end; with cycleObjects[nCycleObs] do begin phase := 69; {# of fish rect} kindIs := fshBwl; tiedTo := index; wholeRect := eventRect[index]; oldRect := wholeRect; reset := tempNum * 32; accel := 8; position := reset; tempInt := (testRoom.theObjects[index].amount + 32) * 32; velocity := 0; repeat velocity := velocity + accel; tempInt := tempInt + velocity; until (tempInt > reset); velocity := -velocity; end; end; {-------------------------} procedure ReadyTea; begin nCycleObs := nCycleObs + 1; with testRoom.theObjects[index] do begin tempInt := boundRect.left; tempNum := boundRect.top; SetRect(eventRect[index], tempInt - 128, tempNum - 128, tempInt, tempNum); if (eventRect[index].top < ceilingVert) then eventRect[index].top := ceilingVert; if (eventRect[index].left < 0) then eventRect[index].left := 0; end; with cycleObjects[nCycleObs] do begin phase := 0; kindIs := teaKtl; tiedTo := index; SetRect(wholeRect, 0, 0, 0, 0); oldRect := wholeRect; position := testRoom.theObjects[index].amount; reset := position + DoRandom(120); end; end; {-------------------------} procedure FrameWindow; begin nObjects := nObjects - 1; end; {-------------------------} procedure FrameMirror; begin nObjects := nObjects - 1; with testRoom.theObjects[index] do tempRect := boundRect; InsetRect(tempRect, 5, 5); end; {-------------------------} begin windowOpen := FALSE; if (testRoom.conditionCode = 2) then lightsOut := TRUE else lightsOut := FALSE; if (testRoom.conditionCode = 1) then airOut := TRUE else airOut := FALSE; nCycleObs := 0; nObjects := testRoom.numberOObjects; tempNum := nObjects; for index := 1 to tempNum do with testRoom.theObjects[index] do begin case objectIs of table..obsRct: eventRect[index] := boundRect; flrVnt: begin tempInt := (boundRect.right + boundRect.left) div 2; SetRect(eventRect[index], tempInt - 8, amount, tempInt + 8, floorVert); end; celVnt: begin tempInt := (boundRect.right + boundRect.left) div 2; SetRect(eventRect[index], tempInt - 8, ceilingVert, tempInt + 8, amount); end; celDct: if (isOn) then begin tempInt := (boundRect.right + boundRect.left) div 2; SetRect(eventRect[index], tempInt - 8, ceilingVert, tempInt + 8, amount); end else begin eventRect[index] := boundRect; eventRect[index].bottom := eventRect[index].top + 8; end; candle: FrameCandle; lftFan: SetRect(eventRect[index], amount, boundRect.top + 10, boundRect.left, boundRect.top + 30); ritFan: SetRect(eventRect[index], boundRect.right, boundRect.top + 10, amount, boundRect.top + 30); clock, paper: eventRect[index] := boundRect; grease: SetUpGrease; bnsRct..rbrBnd: eventRect[index] := boundRect; litSwt, thermo, pwrSwt: eventRect[index] := boundRect; shredr: begin eventRect[index] := boundRect; eventRect[index].top := eventRect[index].top - 4; eventRect[index].bottom := eventRect[index].bottom - 12; end; outlet: FrameOutlet; guitar: with boundRect do SetRect(eventRect[index], left + 36, top + 24, left + 38, bottom - 56); ball: FrameBall; drip: FrameDrip; toastr: ReadyToast; fshBwl: ReadyFish; teaKtl: ReadyTea; window: FrameWindow; paintg: nObjects := nObjects - 1; mirror: FrameMirror; basket, macTsh: eventRect[index] := boundRect; upStar: with boundRect do SetRect(eventRect[index], left + 32, top, right - 32, top + 8); dnStar: with boundRect do SetRect(eventRect[index], left + 32, bottom - 8, right - 32, bottom); otherwise eventRect[index] := nullRect; end; {case} eventKind[index, 1] := 0; case objectIs of table, shelf, books, cabnet, obsRct, drip, toastr, ball, fshBwl, basket, macTsh: eventKind[index, 0] := crashIt; extRct: eventKind[index, 0] := moveIt; flrVnt: eventKind[index, 0] := liftIt; celVnt: eventKind[index, 0] := dropIt; celDct: if (isOn) then eventKind[index, 0] := dropIt else begin eventKind[index, 0] := moveIt; eventKind[index, 1] := extra; end; candle: begin eventKind[index, 0] := burnIt; eventKind[index, 1] := boundRect.bottom - 48; end; lftFan: if (isOn) then eventKind[index, 0] := turnItLeft else eventKind[index, 0] := ignoreIt; ritFan: if (isOn) then eventKind[index, 0] := turnItRight else eventKind[index, 0] := ignoreIt; clock: begin eventKind[index, 0] := awardIt; eventKind[index, 1] := amount; if (amount < 1) then eventRect[index] := nullRect; end; paper: begin eventKind[index, 0] := extraIt; eventKind[index, 1] := amount; if (amount < 1) then eventRect[index] := nullRect; end; grease: if (isOn) then eventKind[index, 0] := spillIt else eventKind[index, 0] := slideIt; bnsRct: begin eventKind[index, 0] := trickIt; eventKind[index, 1] := amount; if (amount < 1) then eventRect[index] := nullRect; end; battry: begin eventKind[index, 0] := energizeIt; eventKind[index, 1] := amount; if (amount < 1) then eventRect[index] := nullRect; end; rbrBnd: begin eventKind[index, 0] := bandIt; eventKind[index, 1] := amount; if (amount < 1) then eventRect[index] := nullRect; end; litSwt: eventKind[index, 0] := lightIt; outlet: eventKind[index, 0] := zapIt; thermo: eventKind[index, 0] := airOnIt; shredr: if (isOn) then eventKind[index, 0] := shredIt else eventKind[index, 0] := ignoreIt; pwrSwt: begin eventKind[index, 0] := toggleIt; eventKind[index, 1] := amount; {object# linked to} end; guitar: begin eventKind[index, 0] := playIt; eventKind[index, 1] := 0; end; upStar: begin eventKind[index, 0] := ascendIt; eventKind[index, 1] := amount; {room # linked to} end; dnStar: begin eventKind[index, 0] := descendIt; eventKind[index, 1] := amount; {room # linked to} end; otherwise eventKind[index, 0] := ignoreIt; end; {case} end; end; {=================================} procedure ReadyRoom; var index: Integer; begin with testRoom do begin rightIsOpen := rightOpen; leftIsOpen := leftOpen; end; ExtractEventRects; end; {=================================} function RectLap (rect1, rect2: Rect): Boolean; var dumRect: Rect; begin RectLap := FALSE; if (rect1.right < rect2.left) then Exit(RectLap); if (rect2.right < rect2.left) then Exit(RectLap); if (rect1.bottom < rect2.top) then Exit(RectLap); if (rect2.bottom < rect2.top) then Exit(RectLap); RectLap := SectRect(rect1, rect2, dumRect); end; {=================================} procedure Collision (whatKind, who: Integer); var tempInt: Integer; tempRect, srcR: Rect; begin case (whatKind) of ignoreIt: ; crashIt: begin SysBeep(1); lifeNormal := FALSE; with theGlider do begin mode := fadingOut; destRect.top := destRect.bottom - 20; if (isForward) then srcNum := 0 else srcNum := 2; end; end; liftIt: if (not airOut) then liftAmount := -7; moveIt: begin SysBeep(1); lifeNormal := FALSE; with theGlider do begin mode := fadingOut; destRect.top := destRect.bottom - 20; if (isForward) then srcNum := 0 else srcNum := 2; end; end; dropIt: if (not airOut) then liftAmount := 7; turnItLeft: begin shiftAmount := -7; if (lifeNormal) then with theGlider do if (isRight) then begin lifeNormal := FALSE; theGlider.mode := turnRt2Lf; end; end; turnItRight: begin shiftAmount := 7; if (lifeNormal) then with theGlider do if (not isRight) then begin lifeNormal := FALSE; theGlider.mode := turnLf2Rt; end; end; burnIt: begin liftAmount := -7; if ((lifeNormal) and (theGlider.destRect.bottom > eventKind[who, 1])) then with theGlider do begin SysBeep(1); lifeNormal := FALSE; if (isRight) then phase := 1; mode := burning; destRect.top := destRect.bottom - 36; end; end; awardIt: if (eventKind[who, 1] <> 0) then begin SysBeep(1); eventKind[who, 1] := 0; end; extraIt: if (eventKind[who, 1] <> 0) then begin SysBeep(1); eventKind[who, 1] := 0; end; spillIt: {grease upright} begin eventRect[who].left := eventRect[who].right; eventRect[who].right := eventRect[who].right; eventRect[who].top := eventRect[who].bottom - 5; eventKind[who, 0] := ignoreIt; {signal to the cycleOb loop that a spill has occurred} thisHouse.theRooms[roomAt].theObjects[who].isOn := FALSE; end; slideIt: {grease spilt} begin with theGlider do begin tempInt := eventRect[who].top - touchRect.bottom + 1; destRect.top := destRect.top + tempInt; destRect.bottom := destRect.bottom + tempInt; touchRect.top := touchRect.top + tempInt; touchRect.bottom := touchRect.bottom + tempInt; end; sliding := TRUE; end; bandIt: if (eventKind[who, 1] <> 0) then begin SysBeep(1); eventKind[who, 1] := 0; end; energizeIt: if (eventKind[who, 1] <> 0) then begin SysBeep(1); theGlider.energy := theGlider.energy + eventKind[who, 1]; eventKind[who, 1] := 0; end; trickIt: if (eventKind[who, 1] <> 0) then begin SysBeep(1); eventKind[who, 1] := 0; end; lightIt: if (lightsOut) then begin SysBeep(1); testRoom.conditionCode := 0; lightsOut := FALSE; end; airOnIt: if (airOut) then begin SysBeep(1); airOut := FALSE; end; zapIt: begin if (eventKind[who, 1] <> 0) then begin lifeNormal := FALSE; with theGlider do begin mode := fadingOut; destRect.top := destRect.bottom - 20; if (isForward) then srcNum := 0 else srcNum := 2; end; {end - with theGlider} end; {end - if (eventKind} end; {end - zapIt} toggleIt: if (eventKind[who, 2] < TickCount) then begin SysBeep(1); tempInt := eventKind[who, 1]; with thisHouse.theRooms[roomAt].theObjects[tempInt] do begin isOn := not isOn; case objectIs of lftFan: if (eventKind[tempInt, 0] = ignoreIt) then begin SysBeep(1); eventKind[tempInt, 0] := turnItLeft; end else eventKind[tempInt, 0] := ignoreIt; ritFan: if (eventKind[tempInt, 0] = ignoreIt) then begin SysBeep(1); eventKind[tempInt, 0] := turnItRight; end else eventKind[tempInt, 0] := ignoreIt; shredr: if (eventKind[tempInt, 0] = ignoreIt) then eventKind[tempInt, 0] := shredIt else eventKind[tempInt, 0] := ignoreIt; otherwise end; {case} end; {with} eventKind[who, 2] := TickCount + 90; end; playIt: if (eventKind[who, 1] < TickCount) then begin SysBeep(1); eventKind[who, 1] := TickCount + 120; end; ascendIt: begin lifeNormal := FALSE; theGlider.mode := ascending; playing := FALSE; end; descendIt: begin lifeNormal := FALSE; theGlider.mode := descending; playing := FALSE; end; shredIt: begin lifeNormal := FALSE; with theGlider do begin mode := shredding; destRect.top := eventRect[who].bottom; destRect.bottom := destRect.top; destRect.left := eventRect[who].left + 12; destRect.right := destRect.left + 48; shadoDest.left := destRect.left; shadoDest.right := destRect.right; phase := 0; end; end; steamIt: begin liftAmount := -7; shiftAmount := -7; end; otherwise end; {case} end; {=================================} procedure SearchRects; var index, outside: Integer; hotRect, tempRect: Rect; {----------------} procedure BiteIt; begin with theGlider do begin SysBeep(1); lifeNormal := FALSE; mode := fadingOut; if (isForward) then srcNum := 0 else srcNum := 2; end; end; {----------------} procedure GetItLegal; begin {do a bump sound here} with theGlider do begin with destRect do begin left := left + outside; right := right + outside; end; with shadoDest do begin left := left + outside; right := right + outside; end; with touchRect do begin left := left + outside; right := right + outside; end; end; end; {----------------} begin with theGlider do begin hotRect := touchRect; {get 'hot rect'} if (rightIsOpen) then {check right edge} begin if (destRect.left > 500) then begin playing := FALSE; Exit(SearchRects); end end else if (destRect.right > 512) then begin outside := 512 - destRect.right; GetItLegal; end; if (leftIsOpen) then {check left edge} begin if (destRect.right < 12) then begin playing := FALSE; Exit(SearchRects); end; end else if (destRect.left < 0) then begin outside := -destRect.left; GetItLegal; end; if (destRect.bottom > floorLimit) then {check floor} BiteIt; end; {---with theGlider do---} shiftAmount := 0; for index := 1 to nObjects do if (RectLap(eventRect[index], hotRect)) then Collision(eventKind[index, 0], index); end; {=================================} procedure GetInput; var pull: Integer; thePt: Point; dest: Rect; {--------------------} procedure PushIt (howFast: Integer); begin with theGlider do forVel := howFast; end; {--------------------} procedure FireBand; begin end; {--------------------} begin with theGlider do begin case controlMethod of holdKey: begin GetKeys(theKeys); if (theKeys[leftKey]) then if (isRight) then begin isForward := FALSE; srcNum := 1; forVel := -maxThrust; end else begin isForward := TRUE; srcNum := 2; forVel := -maxThrust; end else if (theKeys[rightKey]) then if (isRight) then begin isForward := TRUE; srcNum := 0; forVel := maxThrust; end else begin isForward := FALSE; srcNum := 3; forVel := maxThrust; end else {no key of import down} begin if (isRight) then begin isForward := TRUE; srcNum := 0; forVel := 0; end else begin isForward := TRUE; srcNum := 2; forVel := 0; end; end; if (theKeys[bandKey] and (not bandBorne)) then {fire rubber bands} FireBand; if (theKeys[energyKey]) then begin if (((isRight) and (isForward)) or ((not isRight) and (not isForward))) then PushIt(16) else PushIt(-16); end; end; dropKey: begin if (((isRight) and (isForward)) or ((not isRight) and (not isForward))) then forVel := maxThrust else forVel := -maxThrust; GetKeys(theKeys); if (theKeys[leftKey]) then if (isRight) then begin isForward := FALSE; srcNum := 1; forVel := -maxThrust; end else begin isForward := TRUE; srcNum := 2; forVel := -maxThrust; end else if (theKeys[rightKey]) then if (isRight) then begin isForward := TRUE; srcNum := 0; forVel := maxThrust; end else begin isForward := FALSE; srcNum := 3; forVel := maxThrust; end; if (theKeys[bandKey] and (not bandBorne)) then {fire rubber bands} FireBand; if (theKeys[energyKey]) then begin if (((isRight) and (isForward)) or ((not isRight) and (not isForward))) then PushIt(16) else PushIt(-16); end; end; {end - dropKey} absMouse: begin GetKeys(theKeys); if ((theKeys[bandKey]) and (not bandBorne)) then FireBand; GetMouse(thePt); pull := (thePt.h - 256 + rightOffset) div 32; if (pull > maxThrust) then pull := maxThrust else if (pull < -maxThrust) then pull := -maxThrust; forVel := pull; if (isRight) then if (forVel < 0) then begin isForward := FALSE; srcNum := 1; if (theKeys[energyKey]) then PushIt(-16); if (button) then begin if (not buttonFires) then PushIt(-16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end else begin isForward := TRUE; srcNum := 0; if (theKeys[energyKey]) then PushIt(16); if (button) then begin if (not buttonFires) then PushIt(16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end else begin if (forVel < 0) then begin isForward := TRUE; srcNum := 2; if (theKeys[energyKey]) then PushIt(-16); if (button) then begin if (not buttonFires) then PushIt(-16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end else begin isForward := FALSE; srcNum := 3; if (theKeys[energyKey]) then PushIt(16); if (button) then begin if (not buttonFires) then PushIt(16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end; end; end; {end - absMouse} relMouse: begin GetKeys(theKeys); if (theKeys[bandKey] and (not bandBorne)) then {fire rubber bands} FireBand; GetMouse(thePt); forVel := (thePt.h - 256 + rightOffset) div mouseSlop; if (forVel > maxThrust) then forVel := maxThrust else if (forVel < -maxThrust) then forVel := -maxThrust; CenterMouse; if (isRight) then if (forVel < 0) then begin isForward := FALSE; srcNum := 1; if (theKeys[energyKey]) then PushIt(-16); if (button) then begin if (not buttonFires) then PushIt(-16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end else begin isForward := TRUE; srcNum := 0; if (theKeys[energyKey]) then PushIt(16); if (button) then begin if (not buttonFires) then PushIt(16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end else begin if (forVel < 0) then begin isForward := TRUE; srcNum := 2; if (theKeys[energyKey]) then PushIt(-16); if (button) then begin if (not buttonFires) then PushIt(-16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end else begin isForward := FALSE; srcNum := 3; if (theKeys[energyKey]) then PushIt(16); if (button) then begin if (not buttonFires) then PushIt(16) else if ((not bandBorne) and (buttonFires)) then FireBand; end; end; end; end; {end - relMouse} otherwise ; end; {case} end; {with theGlider} end; {=================================} procedure MoveGlider; begin with theGlider do begin liftAmount := liftAmount + 1; {add gravity} if (sliding) then begin liftAmount := 0; {zero out lift} sliding := FALSE; end else begin {vertical offset of glider} destRect.top := destRect.top + liftAmount; destRect.bottom := destRect.bottom + liftAmount; touchRect.top := touchRect.top + liftAmount; touchRect.bottom := touchRect.bottom + liftAmount; end; forVel := forVel + shiftAmount; {horizontal offset of glider} destRect.left := destRect.left + forVel; destRect.right := destRect.right + forVel; touchRect.left := destRect.left + 10; {touch rect is inset from dest} touchRect.right := destRect.right - 10; shadoDest.left := destRect.left; {shadow has same l. & r. as dest} shadoDest.right := destRect.right; end; end; {=================================} procedure IncInt (var i: integer); inline $205F, {MOVEA.W (A7)+, A0 } $5250; {ADDQ.W #$1, (A0) } {=================================} procedure IncLong (var l: longint); inline $205F, {MOVEA.L (A7)+, A0 } $5290; {ADDQ.L #$1, (A0) } {=================================} procedure MoveCycleObs; var index, diff: Integer; begin for index := 1 to nCycleObs do with cycleObjects[index] do case kindIs of candle: begin IncLong(position); if (position > 50) then position := 48; end; grease: begin if (eventKind[tiedTo, 0] = ignoreIt) then begin SysBeep(1); eventKind[tiedTo, 0] := slideIt; reset := 1; end; if ((reset <> 0) and (reset <> 999)) then begin reset := reset + 1; if (reset > 4) then begin velocity := velocity + 1; eventRect[tiedTo].right := eventRect[tiedTo].right + 1; if (velocity > position) then reset := 999; end else begin if (reset < 3) then accel := 58 else accel := 59; end; end; end; outlet: begin if (accel = 25) then begin if (TickCount > (position + reset)) then begin accel := binaryFlip + 51; position := TickCount; eventKind[tiedTo, 1] := 1; end; end else begin if (TickCount > (position + 60)) then begin accel := 25; position := TickCount; eventKind[tiedTo, 1] := 0; end else accel := binaryFlip + 51; end; end; drip: begin if (phase < 57) then begin if (binaryFlip <> 0) then begin IncInt(phase); if (phase = 57) then position := position + 160; end; end else begin velocity := velocity + accel; position := position + velocity; if (position > reset) then begin velocity := 0; position := holdRect.bottom * 32; if (inColor) then begin CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, eventRect[tiedTo], eventRect[tiedTo], srcCopy, wholeRgn); CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, eventRect[tiedTo], eventRect[tiedTo], srcCopy, wholeRgn); end else begin CopyBits(offVirginMap, offLoadMap, eventRect[tiedTo], eventRect[tiedTo], srcCopy, wholeRgn); CopyBits(offVirginMap, mainWndo^.portBits, eventRect[tiedTo], eventRect[tiedTo], srcCopy, wholeRgn); end; eventRect[tiedTo] := holdRect; phase := 53; end; wholeRect := eventRect[tiedTo]; with eventRect[tiedTo] do begin diff := (position div 32) - bottom; bottom := bottom + diff; top := top + diff; end; wholeRect.bottom := wholeRect.bottom + diff end; {else } end; {drip} toastr: if (phase <> 0) then begin if (binaryFlip = 0) then begin phase := phase + 1; if (phase > 65) then phase := 60; end; velocity := velocity + accel; position := position + velocity; if (position > reset) then begin velocity := -velocity; position := reset; reset := TickCount + thisHouse.theRooms[roomAt].theObjects[tiedTo].extra; phase := 0; end; wholeRect := eventRect[tiedTo]; with eventRect[tiedTo] do begin diff := (position div 32) - bottom; bottom := bottom + diff; top := top + diff; end; if (diff > 0) then wholeRect.bottom := wholeRect.bottom + diff else wholeRect.top := wholeRect.top + diff; end else begin if (TickCount > reset) then begin reset := position; phase := 60; end; end; {toastr} ball: begin velocity := velocity + accel; position := position + velocity; if (position > reset) then begin velocity := -velocity; position := reset; end; wholeRect := eventRect[tiedTo]; with eventRect[tiedTo] do begin diff := (position div 32) - bottom; bottom := bottom + diff; top := top + diff; end; if (diff > 0) then wholeRect.bottom := wholeRect.bottom + diff else wholeRect.top := wholeRect.top + diff; end; {ball} fshBwl: if (phase <> 0) then begin if ((velocity > -16) and (velocity < 16)) then phase := 69 else begin if (velocity < 0) then phase := 66 else phase := 68; end; velocity := velocity + accel; position := position + velocity; if (position > reset) then begin velocity := -velocity; position := reset; reset := TickCount + thisHouse.theRooms[roomAt].theObjects[tiedTo].extra; phase := 0; end; wholeRect := eventRect[tiedTo]; with eventRect[tiedTo] do begin diff := (position div 32) - bottom; bottom := bottom + diff; top := top + diff; end; if (diff > 0) then wholeRect.bottom := wholeRect.bottom + diff else wholeRect.top := wholeRect.top + diff; end else begin if (TickCount > reset) then begin reset := position; phase := 66; end; end; {fish bowl} teaKtl: begin if (TickCount > reset) then begin eventKind[tiedTo, 0] := steamIt; if (phase = 0) then ; phase := phase + 1; if (phase > 10) then begin phase := 0; eventKind[tiedTo, 0] := ignoreIt; reset := TickCount + position; end; end; end; otherwise end; {case / with / index} end; {=================================} procedure DoSpecial; begin with theGlider do case mode of fadingIn: begin IncInt(phase); if (phase > 16) then begin if (isForward) then srcNum := 0 else srcNum := 3; lifeNormal := TRUE; phase := 0; mode := normal; end end; fadingOut: begin IncInt(phase); if (isRight) then srcNum := 0 else srcNum := 2; if (phase > 16) then playing := FALSE; end; turnRt2Lf: begin IncInt(phase); if (phase > 11) then begin lifeNormal := TRUE; phase := 0; mode := normal; shiftAmount := 0; isRight := FALSE; end; SearchRects; destRect.left := destRect.left + shiftAmount; destRect.right := destRect.right + shiftAmount; touchRect.left := touchRect.left + shiftAmount; touchRect.right := touchRect.right + shiftAmount; shadoDest.left := shadoDest.left + shiftAmount; shadoDest.right := shadoDest.right + shiftAmount; end; turnLf2Rt: begin IncInt(phase); if (phase > 11) then begin lifeNormal := TRUE; phase := 0; mode := normal; shiftAmount := 0; isRight := TRUE; end; SearchRects; destRect.left := destRect.left + shiftAmount; destRect.right := destRect.right + shiftAmount; touchRect.left := touchRect.left + shiftAmount; touchRect.right := touchRect.right + shiftAmount; shadoDest.left := shadoDest.left + shiftAmount; shadoDest.right := shadoDest.right + shiftAmount; end; burning: begin phase := 1 - phase; if (isRight) then begin srcNum := 24 + phase; forVel := 1; end else begin srcNum := 26 + phase; forVel := -1; end; SearchRects; MoveGlider; end; ascending: begin destRect.left := destRect.left - 2; destRect.right := destRect.left + 48; destRect.top := destRect.top - 6; destRect.bottom := destRect.top + 20; shadoDest.left := destRect.left; shadoDest.right := destRect.right; touchRect := destRect; InsetRect(touchRect, 10, 5); if (destRect.top < 150) then begin lifeNormal := TRUE; phase := 0; mode := normal; end; end; descending: begin destRect.left := destRect.left + 2; destRect.right := destRect.left + 48; destRect.top := destRect.top + 6; destRect.bottom := destRect.top + 20; shadoDest.left := destRect.left; shadoDest.right := destRect.right; touchRect := destRect; InsetRect(touchRect, 10, 5); if (destRect.top > 150) then begin lifeNormal := TRUE; phase := 0; mode := normal; end; end; shredding: begin if (phase = 0) then begin destRect.bottom := destRect.bottom + 1; if (destRect.bottom >= destRect.top + 36) then phase := 1; end else begin destRect.top := destRect.top + 8; destRect.bottom := destRect.bottom + 8; if (destRect.top > 342) then begin phase := 0; playing := FALSE; end; end; end; {end - shred} otherwise ; end; end; {=================================} procedure DrawScene; var index, tempInt: Integer; tempRect, tempSmRect: Rect; begin if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do CopyBits(offVirginMap, offLoadMap, wholeRect, wholeRect, srcCopy, wholeRgn); {-----pop masks on-----} if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do begin case kindIs of candle: CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[position], srcRect[position], wholeRect); outlet: CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[accel], srcRect[accel], wholeRect); ball: CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[kindIs], srcRect[kindIs], eventRect[tiedTo]); drip: CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[phase], srcRect[phase], eventRect[tiedTo]); toastr: if (phase <> 0) then begin SetPort(offLoadPort); HLock(Handle(toastRgn)); SetClip(toastRgn); CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[phase], srcRect[phase], eventRect[tiedTo]); ClipRect(wholeArea); HUnlock(Handle(toastRgn)); SetPort(mainWndo); end; fshBwl: if (phase <> 0) then CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[phase], srcRect[phase], eventRect[tiedTo]) else CopyMask(offPlayerMap, offMaskMap, offLoadMap, srcRect[69], srcRect[69], eventRect[tiedTo]); otherwise ; end; {case} oldRect := wholeRect; end; {-----pop to visible screen-----} if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do CopyBits(offLoadMap, mainWndo^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn); with theGlider do begin if (isRight) then CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, shadoRct[0], shadoRct[0], shadoDest) else CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, shadoRct[1], shadoRct[1], shadoDest); if (lifeNormal) then CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, glideRct[srcNum], glideRct[srcNum], destRect) else case mode of fadingIn, fadingOut: begin tempInt := nextPhase[mode, phase]; if (not isRight) then tempInt := tempInt + 7; CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, glideRct[srcNum], glideRct[tempInt], destRect); end; turnLf2Rt, turnRt2Lf: begin tempInt := nextPhase[mode, phase]; CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, glideRct[tempInt], glideRct[tempInt], destRect); end; burning, ascending, descending: CopyMask(offPlayerMap, offMaskMap, mainWndo^.portBits, glideRct[srcNum], glideRct[srcNum], destRect); otherwise ; end; {case} end; end; {=================================} procedure DrawCScene; var index, tempInt: Integer; tempRect, tempSmRect: Rect; begin if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do CopyBits(BitMapPtr(virginCPtr^.portPixMap^)^, BitMapPtr(loadCPtr^.portPixMap^)^, oldRect, oldRect, srcCopy, wholeRgn); {-----pop masks on-----} if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do begin case kindIs of candle: CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[position], srcRect[position], wholeRect); outlet, grease: CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[accel], srcRect[accel], wholeRect); ball: CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[kindIs], srcRect[kindIs], eventRect[tiedTo]); drip: CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[phase], srcRect[phase], eventRect[tiedTo]); toastr: if (phase <> 0) then begin SetPort(GrafPtr(loadCPtr)); HLock(Handle(toastRgn)); SetClip(toastRgn); CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[phase], srcRect[phase], eventRect[tiedTo]); HUnlock(Handle(toastRgn)); ClipRect(wholeArea); SetPort(GrafPtr(mainWndo)); end; fshBwl: begin if (phase <> 0) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[phase], srcRect[phase], eventRect[tiedTo]) else CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, BitMapPtr(loadCPtr^.portPixMap^)^, srcRect[69], srcRect[69], eventRect[tiedTo]); end; otherwise end; {case} oldRect := wholeRect; end; {-----pop to visible screen-----} if (nCycleObs > 0) then for index := 1 to nCycleObs do with cycleObjects[index] do begin if (kindIs <> grease) then CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn) else begin CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeRect, wholeRect, srcCopy, wholeRgn); SetPort(GrafPtr(mainWndo)); PenNormal; PenSize(2, 2); MoveTo(wholeRect.right, wholeRect.bottom - 2); LineTo(velocity, wholeRect.bottom - 2); end; end; with theGlider do begin if (lifeNormal) then CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, GrafPtr(mainWndo)^.portBits, glideRct[srcNum], glideRct[srcNum], destRect) else case mode of fadingIn, fadingOut: begin tempInt := nextPhase[mode, phase]; if (not isRight) then tempInt := tempInt + 7; CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, GrafPtr(mainWndo)^.portBits, glideRct[srcNum], glideRct[tempInt], destRect); end; turnLf2Rt, turnRt2Lf: begin tempInt := nextPhase[mode, phase]; CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, GrafPtr(mainWndo)^.portBits, glideRct[tempInt], glideRct[tempInt], destRect); end; burning, ascending, descending: CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, GrafPtr(mainWndo)^.portBits, glideRct[srcNum], glideRct[srcNum], destRect); shredding: begin SetRect(tempRect, 265, 208 - (destRect.bottom - destRect.top), 313, 208); CopyMask(BitMapPtr(objectCPtr^.portPixMap^)^, offMaskMap, GrafPtr(mainWndo)^.portBits, tempRect, tempRect, destRect); end; otherwise ; end; {case} end; end; {=================================} procedure FlyGlider; var i: Integer; profileTime: LongInt; tempRect: Rect; begin AutoHideShow(TRUE); thisHouse.theRooms[roomAt] := thisRoom; testRoom := thisRoom; if (inColor) then CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, wholeArea, wholeArea, srcCopy, GrafPtr(mainWndo)^.visRgn) else CopyBits(offLoadMap, mainWndo^.portBits, wholeArea, wholeArea, srcCopy, mainWndo^.visRgn); SetPort(GrafPtr(mainWndo)); PenNormal; TextFont(0); TextSize(12); TextMode(patOr); ClipRect(fullArea); SetRect(tempRect, -rightOffset, -downOffset, 512 + (2 * rightOffset), 0); FillRect(tempRect, black); SetRect(tempRect, -rightOffset, 342, 512 + (2 * rightOffset), 342 + downOffset); FillRect(tempRect, black); SetRect(tempRect, -rightOffset, 0, 0, 342); FillRect(tempRect, black); SetRect(tempRect, 512, 0, 512 + rightOffset, 342); FillRect(tempRect, black); ClipRect(wholeArea); playing := TRUE; pausing := FALSE; hasToast := FALSE; sliding := FALSE; ReadyRoom; ReadyGlider; HideCursor; while ((playing) and (not pausing)) do begin timeIs := TickCount; liftAmount := 2; binaryFlip := BitXOr(binaryFlip, 1); if (lifeNormal) then begin SearchRects; GetInput; MoveGlider; end else DoSpecial; if (playing) then begin if (nCycleObs > 0) then MoveCycleObs; SetPort(GrafPtr(mainWndo)); if (inColor) then DrawCScene else DrawScene; end; if (theKeys[kTabKeyMap]) then {pausing} begin repeat GetKeys(theKeys); until (not theKeys[kTabKeyMap]); repeat GetKeys(theKeys); until (theKeys[kTabKeyMap]); repeat GetKeys(theKeys); until (not theKeys[kTabKeyMap]); end; if (theKeys[kCommandKeyMap]) then {aborted} begin playing := FALSE; end; repeat until (TickCount >= (timeIs + 2)); end; if (hasToast) then begin hasToast := FALSE; DisposeRgn(toastRgn); end; lightsOut := FALSE; airOut := FALSE; LoadABackground(thisRoom.backPictID); DrawAllObjects; SetPort(GrafPtr(mainWndo)); PenNormal; TextFont(0); TextSize(12); TextMode(patOr); ClipRect(fullArea); SetRect(tempRect, -rightOffset, -downOffset, 512 + (2 * rightOffset), 0); FillRect(tempRect, black); SetRect(tempRect, -rightOffset, 342, 512 + (2 * rightOffset), 342 + downOffset); FillRect(tempRect, black); SetRect(tempRect, -rightOffset, 0, 0, 342); FillRect(tempRect, black); SetRect(tempRect, 512, 0, 512 + rightOffset, 342); FillRect(tempRect, black); ClipRect(wholeArea); FlushEvents(everyEvent, 0); InitCursor; AutoHideShow(FALSE); end; {=================================} end. \ No newline at end of file diff --git a/RoomEditor_103/Sources/E-GameBody.p b/RoomEditor_103/Sources/E-GameBody.p new file mode 100755 index 0000000..ab2a954 --- /dev/null +++ b/RoomEditor_103/Sources/E-GameBody.p @@ -0,0 +1 @@ +program RoomEditor; {===========================================================} { } { R O O M E D I T O R 1.02 } { For Glider 4.0 } { } { All code 1991 john calhoun } { } { Published and 1991 Casady & Greene, Inc. } { } {===========================================================} {$I-} uses Palettes, About, Globals, Utilities, Drawing, HouseStuff, RoomStuff, ObjectStuff, FileInNOut, Initialize, TheMenus, FlyGlider; var downIsDubl: Longint; eventHappened: Boolean; {=================================} procedure UpDateMain; var tempRect: Rect; begin DrawRoomNum; end; {=================================} procedure DoMainWindow; var thePt: Point; {--------------------} procedure DoASimpleClik; var which: Integer; hitARect: Boolean; begin if (StillDown) then begin if (PtInRect(thePt, handleRect)) then begin DragHandle; Exit(DoASimpleClik); end; hitARect := FALSE; for which := 1 to thisRoom.numberOObjects do if (PtInRect(thePt, thisRoom.theObjects[which].boundRect)) then begin Deselect; oneActive := which; hitARect := TRUE; Leave; end; if (hitARect) then begin DragObject(oneActive); DrawAllObjects; UpdateMenuItems(editToObject); end else begin Deselect; UpdateMenuItems(editToRoom); end; end else begin hitARect := FALSE; for which := 1 to thisRoom.numberOObjects do if (PtInRect(thePt, thisRoom.theObjects[which].boundRect)) then begin Deselect; oneActive := which; hitARect := TRUE; Leave; end; if (hitARect) then begin DrawAllObjects; UpdateMenuItems(editToObject); end else begin Deselect; UpdateMenuItems(editToRoom); end; end; end; {--------------------} procedure DoADublClik; var which: Integer; cancelIt, hitARect: Boolean; begin if (PtInRect(thePt, thisRoom.theObjects[oneActive].boundRect)) then begin DoObjectInfo; UpdateMenuItems(editToObject); end else begin hitARect := FALSE; for which := 1 to thisRoom.numberOObjects do if (PtInRect(thePt, thisRoom.theObjects[which].boundRect)) then begin Deselect; oneActive := which; hitARect := TRUE; Leave; end; if (hitARect) then begin DrawAllObjects; end else begin if (editRoom) then begin UpdateMenuItems(editToRoom); cancelIt := TRUE; DoRoomCondInfo(cancelIt); end else begin Deselect; UpdateMenuItems(editToRoom); end; end; end; end; {--------------------} begin SetPort(GrafPtr(mainWndo)); thePt := theEvent.where; GlobalToLocal(thePt); if (theEvent.what = mouseDown) then begin if (theEvent.when <= downIsDubl) then DoADublClik else DoASimpleClik; end else if (theEvent.what = mouseUp) then downIsDubl := theEvent.when + GetDblTime; if (toolWndo <> nil) then SetPort(GrafPtr(toolWndo)); end; {=================================} procedure DoDrag (whichWindow: WindowPtr); var wasRect, tempRect: Rect; begin Deselect; wasRect := whichWindow^.portRect; tempRect := screenbits.bounds; tempRect.top := tempRect.top + 20; DragWindow(whichWindow, theEvent.where, tempRect); if (whichWindow = toolWndo) then ShowWindow(whichWindow); if (toolWndo <> nil) then SelectWindow(toolWndo); end; {=================================} procedure DoGoAway (WhichWindow: WindowPtr); var wasRect, tempRect: Rect; begin if (theEvent.what <> MouseUp) then Exit(DoGoAway); if TrackGoAway(whichWindow, theEvent.where) then begin Deselect; case (GetWRefCon(whichWindow)) of 1: CloseTools; otherwise ; end; end; end; {=================================} procedure DoInContent (whichWindow: WindowPtr); begin if ((whichWindow <> FrontWindow) and (whichWindow <> mainWndo)) then SelectWindow(toolWndo) else case (GetWRefCon(whichWindow)) of 0: DoMainWindow; 1: DoTools; otherwise end;{case} end; {=================================} procedure DoUpdate; var whichWindow: WindowPtr; begin whichWindow := WindowPtr(theEvent.message); SetPort(whichWindow); BeginUpdate(whichWindow); case (GetWRefCon(whichWindow)) of 0: UpDateMain; 1: UpdateTools; otherwise begin end; end; EndUpdate(whichWindow); DrawAllObjects; DrawRoomNum; UpdateTools; if (toolWndo <> nil) then SetPort(toolWndo); end; {=================================} procedure DoStartUp; var cancelIt: Boolean; theMessage, numDocs, thisDoc, ignore: Integer; docInfo: AppFile; begin CountAppFiles(theMessage, numDocs); if (theMessage = AppPrint) then begin GenericAlert(kErrNothingToPrint); ExitToShell; end; if (numDocs = 0) then begin DoOpenHouse; Exit(DoStartUp); end; GetAppFiles(1, docInfo); with docInfo do begin if fType = 'GLhs' then begin if (not OpenFile(fName, vRefNum)) then begin InitCursor; DoNewHouse; Exit(DoStartUp); end; InitCursor; housesName := fName; changed := FALSE; roomScrapDirty := FALSE; objectScrapDirty := FALSE; roomAt := 1; thisRoom := thisHouse.theRooms[roomAt]; EnableItem(GetMenu(mFile), iSave); EnableItem(GetMenu(mFile), iSaveAs); oneActive := 0; handleRect := nullRect; LoadABackground(thisRoom.backPictID); UpdateMenuItems(fileExists); UpdateMenuItems(editToRoom); DrawAllObjects; DrawRoomNum; OpenTools; end else begin DoNewHouse; end; ClrAppFiles(1); end; end; {=================================} procedure DoMouseDown; var whichWindow: WindowPtr; mResult: longint; theMenu, theItem, code: integer; begin code := FindWindow(theEvent.where, whichWindow); case (code) of inMenuBar: begin mResult := MenuSelect(theEvent.Where); theMenu := HiWord(mResult); theItem := LoWord(mResult); HandleMenu(theMenu, theItem); end; inGoAway: DoGoAway(whichWindow); inContent: DoInContent(whichWindow); inDrag: DoDrag(whichWindow); inSysWindow: SystemClick(theEvent, whichWindow); otherwise ; end; end; {=================================} procedure DoKeyDown; var mResult: longint; chCode, theMenu, theItem, wasActive: integer; begin with theEvent do begin chCode := BitAnd(message, CharCodeMask); if (Odd(modifiers div CmdKey)) then begin mResult := MenuKey(CHR(chCode)); theMenu := HiWord(mResult); theItem := LoWord(mResult); if (theMenu <> 0) then HandleMenu(theMenu, theItem); end else case chCode of kTabKey: if (thisRoom.numberOObjects > 0) then begin wasActive := oneActive; Deselect; oneActive := wasActive + 1; if (oneActive > thisRoom.numberOObjects) then oneActive := 1; UpdateMenuItems(editToObject); DrawAllObjects; end; kLeftArrow: DoPrevRoom; kRightArrow: DoNextRoom; kDeleteKey: DoClear; otherwise end; end; end; {=================================} procedure DoDiskEvent; var cornerPt: Point; theErr: OSErr; begin if (HiWrd(theEvent.message) <> noErr) then begin SetPt(cornerPt, 85 + rightOffset, 50 + downOffset); theErr := DIBadMount(cornerPt, theEvent.message); end; end; {=================================} procedure DoOSEvent; begin case BSR(theEvent.message, 24) of {high byte of message} 1: begin if (BAnd(theEvent.message, 1) <> 0) then begin inBackground := FALSE; {it was a resume event} if (not SameScreenDepth) then GenericAlert(23); end else begin inBackground := TRUE; {it was a suspend event} end; end; {suspendResumeMessage} otherwise ; end; {CASE} end; {osEvt} {=================================} procedure CloseUpShop; const Color = 1; GDTypeFlag = 1; var theDevice: GDHandle; theErr: OSErr; {-----------} function SetDepth (gd: GDHandle; newDepth, whichFlags, newFlags: Integer): Integer; inline $203C, $000A, $0013, $AAA2; {-----------} begin CloseTools; if (inColor) then begin DisposePalette(mainPalette); if (mainWndo <> nil) then DisposeWindow(GrafPtr(mainWndo)); CloseCPort(objectCPtr); DisposPtr(objectCBits); CloseCPort(virginCPtr); DisposPtr(virginCBits); CloseCPort(loadCPtr); DisposPtr(loadCBits); end else begin if (mainWndo <> nil) then DisposeWindow(mainWndo); ClosePort(offVirginPort); DisposPtr(Ptr(offVirginPort)); ClosePort(offPlayerPort); DisposPtr(Ptr(offPlayerPort)); ClosePort(offLoadPort); DisposPtr(Ptr(offLoadPort)); ClosePort(offMaskPort); DisposPtr(Ptr(offMaskPort)); end; SavePrefs; if ((not cantColor) and (restoreColor) and (not cantSwitch)) then begin theDevice := GetMainDevice; HLock(Handle(theDevice)); if (theDevice^^.gdPMap^^.pixelSize <> wasDepth) then theErr := SetDepth(theDevice, wasDepth, GDTypeFlag, Color); HUnlock(Handle(theDevice)); end; end; {=================================} begin InitVariables; UnloadSeg(@InitVariables); DoStartUp; downIsDubl := TickCount; repeat if (hasWNE) then eventHappened := WaitNextEvent(everyEvent, theEvent, sleep, nil) else begin SystemTask; eventHappened := GetNextEvent(everyEvent, theEvent); end; if (eventHappened) then case (theEvent.what) of NullEvent: ; MouseDown, MouseUp: DoMouseDown; KeyDown, AutoKey: DoKeyDown; UpDateEvt: DoUpdate; DiskEvt: {call DIBadMount in response to a diskEvt} DoDiskEvent; App4Evt: DoOSEvent; otherwise ; end; {case} if ((marqueeTime) and (not inBackground)) then DoMarquee; until doneFlag; {End of the event loop} CloseUpShop; end. {End of the program} \ No newline at end of file diff --git a/RoomEditor_103/Sources/E-Globals.p b/RoomEditor_103/Sources/E-Globals.p new file mode 100755 index 0000000..47d00f2 --- /dev/null +++ b/RoomEditor_103/Sources/E-Globals.p @@ -0,0 +1 @@ +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. \ No newline at end of file diff --git a/RoomEditor_103/Sources/E-HouseStuff.p b/RoomEditor_103/Sources/E-HouseStuff.p new file mode 100755 index 0000000..cd7c739 --- /dev/null +++ b/RoomEditor_103/Sources/E-HouseStuff.p @@ -0,0 +1 @@ +unit HouseStuff; interface uses Palettes, Globals, Utilities; function DeleteRoom: Boolean; function InsertRoom: Boolean; procedure DoHouseInfo; procedure ErrorCheckHouse; implementation {=================================} function DeleteRoom; var i: Integer; begin DeleteRoom := FALSE; {assume error} if (roomAt < thisHouse.numberORooms) then {if not on last room} for i := roomAt to thisHouse.numberORooms do thisHouse.theRooms[i] := thisHouse.theRooms[i + 1]; {shift rooms left} thisHouse.numberORooms := thisHouse.numberORooms - 1; {subtract 1 from #} if (roomAt > 1) then roomAt := roomAt - 1 {preceding room is activated} else begin roomAt := 1; if (thisHouse.numberORooms <= 1) then {if only one room} begin thisHouse.numberORooms := 1; {we'll call up the dlg} Exit(DeleteRoom); {for creating a room} end; end; DeleteRoom := TRUE; end; {=================================} function InsertRoom; var i: Integer; begin InsertRoom := FALSE; if (thisHouse.numberORooms >= 40) then {trying to add 41 rooms} begin GenericAlert(kErrTooManyRooms); Exit(InsertRoom); end; thisHouse.theRooms[roomAt] := thisRoom; {insert room to date} if (roomAt < thisHouse.numberORooms) then {shift only if in middle} for i := thisHouse.numberORooms downto roomAt + 1 do thisHouse.theRooms[i + 1] := thisHouse.theRooms[i]; {shift rooms right} roomAt := roomAt + 1; {kick roomAt over to right} thisHouse.theRooms[roomAt] := scrapRoom; {copy scrap into house} thisRoom := thisHouse.theRooms[roomAt]; {get copy for active room} thisHouse.numberORooms := thisHouse.numberORooms + 1; {one more room} InsertRoom := TRUE; end; {=================================} procedure DoFlushScores; var i: Integer; begin for i := 0 to 19 do begin thisHouse.hiScores[i] := 0; thisHouse.hiLevel[i] := 0; thisHouse.hiName[i] := 'no one...'; thisHouse.hiRoom[i] := 'no room...'; end; end; {=================================} procedure DoHouseInfo; const okayBut = 1; nameStat = 2; numOfStat = 3; versStat = 4; backStat = 5; firstEdit = 6; nextEdit = 7; flushBut = 8; lockBut = 17; cancelBut = 18; var leaveDlg, willLockIt: Boolean; theDlgPtr: DialogPtr; wasPort: GrafPtr; tempRect: Rect; cntlType, index, itemHit, tempInt, rightOff, downOff: Integer; dlgItem: Handle; cntlHand, tempCntlHand: controlhandle; tempStr, tempStr2: Str255; {-------------------------} procedure Redraw; var width: Integer; begin SetPort(theDlgPtr); {Point to our dialog window} GetDItem(theDlgPtr, okayBut, cntlType, dlgItem, tempRect);{Get the item handle} PenSize(3, 3); {Change pen to draw thick default outline} InsetRect(tempRect, -4, -4); {Draw outside the button by 1 pixel} FrameRoundRect(tempRect, 16, 16); {Draw the outline} PenNormal; with theDlgPtr^.portRect do width := right - left; MoveTo(4, 38); Line(width - 8, 0); MoveTo(4, 40); Line(width - 8, 0); GetKeys(theKeys); if (theKeys[$37]) then begin MoveTo(5, 37); NumToString(thisHouse.timeStamp, tempStr); DrawString(tempStr); end; end; {-------------------------} begin GetPort(wasPort); theDlgPtr := GetNewDialog(houseInfoID, nil, Pointer(-1)); with theDlgPtr^.portBits do begin rightOff := rightOffset - bounds.left; downOff := downOffset - bounds.top; end; MoveWindow(theDlgPtr, rightOff, downOff, FALSE); ShowWindow(theDlgPtr); SelectWindow(theDlgPtr); SetPort(theDlgPtr); GetDItem(theDlgPtr, nameStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, housesName); with thisHouse do begin NumToString(numberORooms, tempStr); {pop in number of rooms} GetDItem(theDlgPtr, numOfStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, tempStr); tempInt := version div 256; {compute version number} NumToString(tempInt, tempStr); tempInt := version mod 256; NumToString(tempInt, tempStr2); tempStr := CONCAT(tempStr, '.', tempStr2); {and pop it in} GetDItem(theDlgPtr, versStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, tempStr); GetDItem(theDlgPtr, backStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, pictFile); {pop in background file} GetDItem(theDlgPtr, firstEdit, cntlType, dlgItem, tempRect); SetIText(dlgItem, firstFile); {pop in first house file} GetDItem(theDlgPtr, nextEdit, cntlType, dlgItem, tempRect); SetIText(dlgItem, nextFile); {pop in next house file} end; willLockIt := lockIt; Redraw; leaveDlg := FALSE; SelIText(theDlgPtr, nextEdit, 0, 32); repeat ModalDialog(nil, itemHit); GetDItem(theDlgPtr, itemHit, cntlType, dlgItem, tempRect); if (itemHit = okayBut) then begin leaveDlg := TRUE; GetDItem(theDlgPtr, firstEdit, cntlType, dlgItem, tempRect); GetIText(dlgItem, tempStr); {Get text entered for first file} thisHouse.firstFile := COPY(tempStr, 1, 32); GetDItem(theDlgPtr, nextEdit, cntlType, dlgItem, tempRect); GetIText(dlgItem, tempStr); {Get text entered for next file} thisHouse.nextFile := COPY(tempStr, 1, 32); lockIt := willLockIt; changed := TRUE; end; if (itemHit = cancelBut) then begin leaveDlg := TRUE; end; if (itemHit = lockBut) then begin if (Alert(lockAlertID, nil) = 1) then willLockIt := TRUE; end; if (itemHit = flushBut) then DoFlushScores; until leaveDlg; DisposDialog(theDlgPtr); if (toolWndo <> nil) then SetPort(toolWndo) else SetPort(wasPort); end; {=================================} procedure ErrorCheckHouse; const roomUnnamed = 1; tooManyObs = 2; badPictID = 3; badAnimKind = 4; badAnimNum = 5; badAnimDelay = 6; badRoomCond = 7; type problem = record howMany: Integer; whichOnes: array[1..40] of Boolean; end; problemTally = array[roomUnnamed..badRoomCond] of problem; var i, i2, obs: Integer; progR: Rect; theProblems: problemTally; begin SetPort(GrafPtr(mainWndo)); PenNormal; TextFont(0); TextSize(12); PenSize(2, 2); SetRect(progR, 156, 100, 356, 130); {check house record} EraseRect(progR); FrameRect(progR); MoveTo(progR.left + 20, progR.bottom - 10); DrawString('Checking House'); with thisHouse do begin SpinBall; if (version > $01FF) then begin GenericAlert(kErrWrongHouseVers); EraseRect(progR); FrameRect(progR); MoveTo(progR.left + 20, progR.bottom - 10); DrawString('Checking House'); end; SpinBall; if ((numberORooms < 1) or (numberORooms > 40)) then begin GenericAlert(18); EraseRect(progR); FrameRect(progR); MoveTo(progR.left + 20, progR.bottom - 10); DrawString('Checking House'); end; {check room records} EraseRect(progR); FrameRect(progR); MoveTo(progR.left + 20, progR.bottom - 10); DrawString('Checking Rooms'); for i := roomUnnamed to badRoomCond do with theProblems[i] do begin howMany := 0; for i2 := 1 to 40 do whichOnes[i2] := FALSE; end; for i := 1 to numberORooms do with theRooms[i] do begin SpinBall; if (roomName = '') then with theProblems[roomUnnamed] do begin howMany := howMany + 1; whichOnes[i] := TRUE; end; SpinBall; if ((numberOObjects < 0) or (numberOObjects > 16)) then with theProblems[tooManyObs] do begin howMany := howMany + 1; whichOnes[i] := TRUE; end; SpinBall; if ((backPictID < 200) or (backPictID > 209)) then with theProblems[badPictID] do begin howMany := howMany + 1; whichOnes[i] := TRUE; end; SpinBall; if ((animateKind < 0) or (animateKind > 3)) then with theProblems[badAnimKind] do begin howMany := howMany + 1; whichOnes[i] := TRUE; end; SpinBall; if ((animateNumber < 0) or (animateNumber > 16)) then with theProblems[badAnimNum] do begin howMany := howMany + 1; whichOnes[i] := TRUE; end; SpinBall; if (animateDelay < 0) then with theProblems[badAnimDelay] do begin howMany := howMany + 1; whichOnes[i] := TRUE; end; SpinBall; if ((conditionCode < 0) or (conditionCode > 2)) then with theProblems[badRoomCond] do begin howMany := howMany + 1; whichOnes[i] := TRUE; end; end; InitCursor; for i := roomUnnamed to badRoomCond do if (theProblems[i].howMany <> 0) then begin GenericAlert(19); Leave; end; end; if (inColor) then CopyBits(BitMapPtr(loadCPtr^.portPixMap^)^, GrafPtr(mainWndo)^.portBits, progR, progR, srcCopy, GrafPtr(mainWndo)^.visRgn) else CopyBits(offLoadMap, mainWndo^.portBits, progR, progR, srcCopy, mainWndo^.visRgn); if (toolWndo <> nil) then SetPort(GrafPtr(toolWndo)); end; {=================================} end. \ No newline at end of file diff --git a/RoomEditor_103/Sources/E-Initialize.p b/RoomEditor_103/Sources/E-Initialize.p new file mode 100755 index 0000000..3feabe9 --- /dev/null +++ b/RoomEditor_103/Sources/E-Initialize.p @@ -0,0 +1 @@ +unit Initialize; interface uses Balloons, Palettes, Globals, Utilities, RoomStuff; procedure InitVariables; {=================================} implementation {=================================} procedure InitVariables; var index, theDepth: Integer; sizeOfOff, offRowBytes: LongInt; tempByte: SignedByte; rawPointer: Ptr; thePict: PicHandle; tempRect: Rect; ignore: Boolean; {---------------------} procedure CheckOurEnvirons; const WNETrapNum = $60; unimplTrapNum = $9F; Color = 1; Monochrome = 0; GDTypeFlag = 1; var sheSaid: Integer; err: OSErr; thisWorld: SysEnvRec; theDevice: GDHandle; {-----------} function DepthAlert: Integer; var dummyInt: Integer; alertHandle: AlertTHndl; alertRect: Rect; begin UseResFile(editorResNum); InitCursor; alertHandle := AlertTHndl(Get1Resource('ALRT', depthAlertID)); if (alertHandle <> nil) then begin HNoPurge(Handle(alertHandle)); alertRect := alertHandle^^.boundsRect; OffsetRect(alertRect, -alertRect.left, -alertRect.top); dummyInt := (screenBits.bounds.right - alertRect.right) div 2; OffsetRect(alertRect, dummyInt, 0); dummyInt := (screenBits.bounds.bottom - alertRect.bottom) div 3; OffsetRect(alertRect, 0, dummyInt); alertHandle^^.boundsRect := alertRect; HPurge(Handle(alertHandle)); end; dummyInt := Alert(depthAlertID, nil); DepthAlert := dummyInt; end; {-----------} function SetDepth (gd: GDHandle; newDepth, whichFlags, newFlags: Integer): Integer; inline $203C, $000A, $0013, $AAA2; {-----------} begin rightOffset := (ScreenBits.bounds.right - 512) div 2; downOffset := (ScreenBits.bounds.bottom - 342) div 2; err := SysEnvirons(1, thisWorld); {Check on the set up of the Mac game is on } with thisWorld do begin if (machineType < 1) then {If less than a Mac 512KE (=1) then quit now!} begin GenericAlert(kErrMacPlusNeeded); ExitToShell; end; if (systemVersion < $0602) then begin inhibitSound := TRUE; GenericAlert(3); end else inhibitSound := FALSE; cantColor := not hasColorQD; inColor := hasColorQD; cantSwitch := (systemVersion < $0605); hasSys7 := (systemVersion >= $0700); if (inColor) then begin theDevice := GetMainDevice; HLock(Handle(theDevice)); with theDevice^^.gdPMap^^ do begin wasDepth := pixelSize; if ((pixelSize <> 4) and (pixelSize <> 1)) then if (cantSwitch) then begin GenericAlert(kErr2Or16Colors); ExitToShell; end else begin sheSaid := DepthAlert; case sheSaid of 1: err := SetDepth(theDevice, 4, GDTypeFlag, Color); 2: begin err := SetDepth(theDevice, 1, GDTypeFlag, Color); inColor := FALSE; end; otherwise ExitToShell; end; end; if (pixelSize = 1) then inColor := FALSE; end; HUnlock(Handle(theDevice)); end; herKeyboard := keyBoardType; case keyBoardType of {determine keycodes} envMacPlusKbd: begin leftArrow := $46; rightArrow := $42; deleteKey := $33; end; envAExtendKbd, envStandADBKbd: begin leftArrow := $7B; rightArrow := $7C; deleteKey := $33; end; otherwise begin leftArrow := $2B; rightArrow := $2F; deleteKey := $0; end; end; {case} end; {end - with} hasWNE := (NGetTrapAddress(WNETrapNum, ToolTrap) <> NGetTrapAddress(unimplTrapNum, toolTrap)); end; {---------------------} procedure LoadCursors; var count: Integer; tempByte: SignedByte; begin useColorCursor := inColor; UseResFile(editorResNum); ballList := acurHand(GetResource('acur', acurID)); if (ballList = nil) then begin GenericAlert(kErrLoadingRes); Exit(LoadCursors); end; tempByte := HGetState(Handle(ballList)); HLock(Handle(ballList)); with ballList^^ do begin for count := 1 to kCursCount do begin if (useColorCursor) then begin ballC[count] := GetCCursor(HiWord(LongInt(ball[count]))); if (ballC[count] = nil) then useColorCursor := FALSE; end; ball[count] := GetCursor(HiWord(LongInt(ball[count]))); if (ball[count] = nil) then begin GenericAlert(kErrLoadingRes); whichBall := -1; Exit(LoadCursors); end; end; whichBall := 0; end; HSetState(Handle(ballList), tempByte); end; {---------------------} procedure SetUpColors; begin SpinBall; rgbBlack.red := 0; rgbBlack.green := 0; rgbBlack.blue := 0; rgbWhite.red := -1; rgbWhite.green := -1; rgbWhite.blue := -1; rgbYellow.red := -1; rgbYellow.green := -1; rgbYellow.blue := 0; rgbViolet.red := -1; rgbViolet.green := 0; rgbViolet.blue := -1; rgbRed.red := -1; rgbRed.green := 0; rgbRed.blue := 0; rgbLtBlue.red := 0; rgbLtBlue.green := -1; rgbLtBlue.blue := -1; rgbBrown.red := 22016; rgbBrown.green := 11421; rgbBrown.blue := 1316; rgbLtBrown.red := -28457; rgbLtBrown.green := 29024; rgbLtBrown.blue := 14900; rgbDkGray.red := 16384; rgbDkGray.green := 16384; rgbDkGray.blue := 16384; end; {---------------------} procedure SetUpMainWndo; begin SpinBall; SetRect(screenArea, 0, 0, 512, 322); SetRect(wholeArea, 0, 0, 512, 342); SetRect(nullRect, -500, -500, -499, -499); SetRect(fullArea, -rightOffset, -downOffset, 512 + rightOffset, 342 + downOffset); wholeRgn := NewRgn; RectRgn(wholeRgn, wholeArea); SpinBall; {Init main window} mainWndo := nil; if (inColor) then mainWndo := GetNewCWindow(mainWndoID, nil, WindowPtr(-1)) else mainWndo := GetNewWindow(mainWndoID, nil, WindowPtr(-1)); if (mainWndo = nil) then GenericAlert(kErrLoadingRes); SetPort(GrafPtr(mainWndo)); MoveWindow(GrafPtr(mainWndo), rightOffset, downOffset, FALSE); ShowWindow(GrafPtr(mainWndo)); SetWRefCon(mainWndo, 0); ClipRect(wholeArea); if (inColor) then begin mainPalette := GetNewPalette(mainWndoID); SetPalette(mainWndo, mainPalette, TRUE); end; end; {---------------------} procedure SetUpMenus; var tempMenu: MenuHandle; theErr: OSErr; begin SpinBall; ClearMenuBar; tempMenu := GetMenu(mApple); if (tempMenu <> nil) then begin AddResMenu(tempMenu, 'DRVR'); InsertMenu(tempMenu, 0); end else begin GenericAlert(kErrUnknownAtInit); ExitToShell; end; SpinBall; tempMenu := GetMenu(mFile); if (tempMenu <> nil) then InsertMenu(tempMenu, 0) else begin GenericAlert(kErrUnknownAtInit); ExitToShell; end; SpinBall; tempMenu := GetMenu(mEdit); if (tempMenu <> nil) then InsertMenu(tempMenu, 0) else begin GenericAlert(kErrUnknownAtInit); ExitToShell; end; SpinBall; tempMenu := GetMenu(mSpecial); if (tempMenu <> nil) then InsertMenu(tempMenu, 0) else begin GenericAlert(kErrUnknownAtInit); ExitToShell; end; SpinBall; tempMenu := GetMenu(mControls); if (tempMenu <> nil) then InsertMenu(tempMenu, -1) else begin GenericAlert(kErrUnknownAtInit); ExitToShell; end; SpinBall; tempMenu := GetMenu(mWindows); if (tempMenu <> nil) then InsertMenu(tempMenu, 0) else begin GenericAlert(kErrUnknownAtInit); ExitToShell; end; if (hasSys7) then {add a Help menu item} begin theErr := HMGetHelpMenuHandle(tempMenu); if (theErr = noErr) then if (tempMenu <> nil) then begin AppendMenu(tempMenu, 'Room Editor Help'); iGlidersHelp := CountMItems(tempMenu); end else begin tempMenu := GetMenu(mWindows); AppendMenu(tempMenu, '(-'); AppendMenu(tempMenu, 'Help'); end else begin tempMenu := GetMenu(mWindows); AppendMenu(tempMenu, '(-'); AppendMenu(tempMenu, 'Help'); end; end else begin AppendMenu(tempMenu, '(-'); AppendMenu(tempMenu, 'Help'); end; SpinBall; DrawMenuBar; end; {---------------------} function NewBitMap (var theBitMap: BitMap; theRect: Rect): Ptr; begin with theBitMap, theRect do begin rowBytes := ((right - left + 15) div 16) * 2; baseAddr := NewPtr(rowBytes * (bottom - top)); bounds := theRect; if (MemError <> noErr) then begin GenericAlert(kErrNotEnoughMem); NewBitMap := nil; ExitToShell; end else NewBitMap := baseAddr; end; end; {---------------------} procedure SetUpBitMaps; begin SpinBall; {Init b&w Bitmaps} {Init offscreen virgin map} offVirginPort := GrafPtr(NewPtr(SizeOf(GrafPort))); OpenPort(offVirginPort); offVirginBits := NewBitMap(offVirginMap, wholeArea); SetPortBits(offVirginMap); ClipRect(wholeArea); EraseRect(offVirginMap.bounds); SpinBall; {Init offscreen load map} offLoadPort := GrafPtr(NewPtr(SizeOf(GrafPort))); OpenPort(offLoadPort); offLoadBits := NewBitMap(offLoadMap, wholeArea); SetPortBits(offLoadMap); ClipRect(wholeArea); EraseRect(offLoadMap.bounds); SpinBall; {Init offscreen object map} offPlayerPort := GrafPtr(NewPtr(SizeOf(GrafPort))); OpenPort(offPlayerPort); offPlayerBits := NewBitMap(offPlayerMap, wholeArea); SetPortBits(offPlayerMap); ClipRect(wholeArea); EraseRect(offPlayerMap.bounds); end; {---------------------} procedure SetUpPixMaps; begin SetPort(GrafPtr(mainWndo)); RGBForeColor(rgbBlack); RGBBackColor(rgbWhite); SpinBall; virginCPtr := @virginCPort; OpenCPort(virginCPtr); theDepth := 4; offRowBytes := ((((theDepth * (wholeArea.right - wholeArea.left)) + 15)) div 16) * 2; sizeOfOff := LONGINT(wholeArea.bottom - wholeArea.top) * offRowBytes; virginCBits := NewPtr(sizeOfOff); if (virginCPtr = nil) then begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; with virginCPtr^.portPixMap^^ do begin baseAddr := virginCBits; rowBytes := offRowBytes + $8000; bounds := wholeArea; end; RGBForeColor(rgbBlack); RGBBackColor(rgbWhite); EraseRect(thePort^.portRect); ClipRect(wholeArea); SpinBall; loadCPtr := @loadCPort; OpenCPort(loadCPtr); loadCBits := NewPtr(sizeOfOff); if (loadCBits = nil) then begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; with loadCPtr^.portPixMap^^ do begin baseAddr := loadCBits; rowBytes := offRowBytes + $8000; bounds := wholeArea; end; RGBForeColor(rgbBlack); RGBBackColor(rgbWhite); EraseRect(thePort^.portRect); ClipRect(wholeArea); SpinBall; objectCPtr := @objectCPort; OpenCPort(objectCPtr); objectCBits := NewPtr(sizeOfOff); if (objectCBits = nil) then begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; with objectCPtr^.portPixMap^^ do begin baseAddr := objectCBits; rowBytes := offRowBytes + $8000; bounds := wholeArea; end; RGBForeColor(rgbBlack); RGBBackColor(rgbWhite); EraseRect(thePort^.portRect); ClipRect(wholeArea); end; {---------------------} procedure SetUpOffMask; begin SpinBall; {Init offscreen mask map} offMaskPort := GrafPtr(NewPtr(SizeOf(GrafPort))); OpenPort(offMaskPort); offMaskBits := NewBitMap(offMaskMap, wholeArea); SetPortBits(offMaskMap); ClipRect(wholeArea); EraseRect(offMaskMap.bounds); end; {---------------------} function DoOpenResFile: Boolean; var dlgOrigin: Point; theTypeList: SFTypeList; theReply: SFReply; begin SpinBall; DoOpenResFile := FALSE; SetPt(dlgOrigin, dlgLeft + rightOffset, dlgTop + downOffset); theTypeList[0] := 'GLbk'; SFGetFile(dlgOrigin, '', nil, 1, theTypeList, nil, theReply); with theReply do begin if (good) then begin resourceName := fName; DoOpenResFile := TRUE; end; end; end; {-----------------} procedure GetPrefs; type prefType = record resName: string[32]; controlIs: Integer; leftIs, rightIs, energyIs, bandIs: Integer; buttonIs, restoreIs: Boolean; leftNameIs, rightNameIs, energyNameIs, bandNameIs: string[12]; isKeyBoard: Integer; end; prefPtr = ^prefType; prefHand = ^prefPtr; pictDeepPt = ^Integer; pictDeepHn = ^pictDeepPt; var theirPrefs: prefHand; pictDeep: pictDeepHn; refNumber, tempVol: Integer; satisfactory: Boolean; {-----------------} procedure DefaultControls; begin leftKey := defaultLeftKey; rightKey := defaultRightKey; energyKey := defaultEnergyKey; bandKey := defaultBandKey; buttonFires := FALSE; leftName := defaultLeftName; rightName := defaultRightName; energyName := defaultEnergyName; bandName := defaultBandName; end; {-----------------} procedure Default; begin if (inColor) then resourceName := 'Art 16' else resourceName := 'Art 2'; controlMethod := absMouse; restoreColor := TRUE; DefaultControls; end; {-----------------} begin SpinBall; UseResFile(editorResNum); theirPrefs := prefHand(NewHandle(SIZEOF(prefType))); if (theirPrefs = nil) then begin Default; Exit(GetPrefs); end; Handle(theirPrefs) := GetResource('Gprf', 128); if ((ResError = noErr) and (theirPrefs <> nil)) then begin HLock(Handle(theirPrefs)); with theirPrefs^^ do begin resourceName := resName; controlMethod := controlIs; leftKey := leftIs; rightKey := rightIs; energyKey := energyIs; bandKey := bandIs; buttonFires := buttonIs; restoreColor := restoreIs; leftName := leftNameIs; rightName := rightNameIs; energyName := energyNameIs; bandName := bandNameIs; if (isKeyBoard <> herKeyBoard) then DefaultControls; end; HUnlock(Handle(theirPrefs)); ReleaseResource(Handle(theirPrefs)); end else begin Default; end; SpinBall; if ((controlMethod < holdKey) or (controlMethod > relMouse)) then controlMethod := absMouse; CheckItem(GetMenu(mControls), controlMethod, TRUE); if (restoreColor) then SetItem(GetMenu(mSpecial), iRestoreDeep, 'Depth Restore is On') else SetItem(GetMenu(mSpecial), iRestoreDeep, 'Depth Restore is Off'); if ((cantColor) or (cantSwitch)) then DisableItem(GetMenu(mSpecial), iRestoreDeep); refNumber := OpenResFile(resourceName); {test to see if res legit} if (refNumber = -1) then begin if (ResError = resFNotFound) then {Hmmm. Maybe color depth has changed} begin if (inColor) then resourceName := 'Color Art' {Try the default color name} else resourceName := 'B&W Art'; {Or default B&W file name} refNumber := OpenResFile(resourceName); {test to see if res legit yet} if (refNumber = -1) then begin UseResFile(editorResNum); {back to Editor res file} GenericAlert(kErrGraphicsNotFound); {bitch about all this} if (not DoOpenResFile) then begin GenericAlert(kErrExitSansGraphics); ExitToShell; end; refNumber := OpenResFile(resourceName); end; end else begin UseResFile(editorResNum); {back to Editor res file} GenericAlert(kErrGraphicsNotFound); {bitch about all this} if (not DoOpenResFile) then begin GenericAlert(kErrExitSansGraphics); ExitToShell; end; refNumber := OpenResFile(resourceName); end; end; satisfactory := FALSE; repeat UseResFile(refNumber); pictDeep := pictDeepHn(NewHandle(SIZEOF(Integer))); if (pictDeep = nil) then begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; Handle(pictDeep) := GetResource('deep', 128); if ((ResError = noErr) and (pictDeep <> nil)) then begin HLock(Handle(pictDeep)); if (inColor) then begin if (pictDeep^^ <> $0004) then begin if (pictDeep <> nil) then begin HUnlock(Handle(pictDeep)); ReleaseResource(Handle(pictDeep)); pictDeep := nil; end; CloseResFile(refNumber); if (resourceName <> 'Color Art') then begin resourceName := 'Color Art'; refNumber := OpenResFile(resourceName); end else begin GenericAlert(21); if (not DoOpenResFile) then begin GenericAlert(kErrExitSansGraphics); ExitToShell; end; refNumber := OpenResFile(resourceName); end; end else satisfactory := TRUE; end else {were in b&w mode} begin if (pictDeep^^ <> $0001) then begin if (pictDeep <> nil) then begin HUnlock(Handle(pictDeep)); ReleaseResource(Handle(pictDeep)); pictDeep := nil; end; CloseResFile(refNumber); if (resourceName <> 'B&W Art') then begin resourceName := 'B&W Art'; refNumber := OpenResFile(resourceName); end else begin GenericAlert(22); if (not DoOpenResFile) then begin GenericAlert(20); ExitToShell; end; refNumber := OpenResFile(resourceName); end; end else satisfactory := TRUE; end; end else begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; if (pictDeep <> nil) then begin HUnlock(Handle(pictDeep)); ReleaseResource(Handle(pictDeep)); pictDeep := nil; end; until satisfactory; CloseResFile(refNumber); UseResFile(editorResNum); end; {---------------------} procedure LoadPICTs; var refNumber: Integer; wasPort: GrafPtr; begin SpinBall; refNumber := OpenResFile(resourceName); if (refNumber = -1) then begin UseResFile(editorResNum); GenericAlert(kErrGraphicsNotFound); if (not DoOpenResFile) then ExitToShell; refNumber := OpenResFile(resourceName); if (refNumber = -1) then begin GenericAlert(kErrGraphicsNotFound); ExitToShell; end; end; UseResFile(refNumber); SpinBall; GetPort(wasPort); if (inColor) then {load the objects up} SetPort(GrafPtr(objectCPtr)) else SetPort(offPlayerPort); thePict := GetPicture(objectPictID); if (thePict^ <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; ReleaseResource(Handle(thePict)); SpinBall; SetPort(offMaskPort); thePict := GetPicture(maskPictID); {load the mask up} if (thePict^ <> nil) then begin tempByte := HGetState(Handle(thePict)); MoveHHi(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, wholeArea); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrNotEnoughMem); ExitToShell; end; ReleaseResource(Handle(thePict)); SpinBall; SetPort(wasPort); CloseResFile(refNumber); UseResFile(editorResNum); end; {---------------------} begin editorResNum := CurResFile; SetApplLimit(Ptr(LongInt(GetApplLimit) - StackSize)); MaxApplZone; for index := 1 to 10 do MoreMasters; InitGraf(@thePort); InitFonts; InitWindows; InitMenus; TEInit; InitDialogs(nil); InitCursor; for index := 1 to 3 do ignore := EventAvail(EveryEvent, theEvent); inBackground := FALSE; SetCursor(GetCursor(WatchCursor)^^); CheckOurEnvirons; LoadCursors; SpinBall; if (inColor) then SetUpColors; SpinBall; SetUpMenus; SpinBall; SetUpMainWndo; SpinBall; if (inColor) then SetUpPixMaps else SetUpBitMaps; SpinBall; SetUpOffMask; SpinBall; GetPrefs; SpinBall; LoadPICTs; SpinBall; doneFlag := FALSE; soundOn := not inhibitSound; playing := FALSE; pausing := FALSE; roomScrapDirty := FALSE; objectScrapDirty := FALSE; fileIsOpen := FALSE; autoHide := FALSE; lightsOut := FALSE; bandBorne := TRUE; lockIt := FALSE; binaryFlip := 1; GetDateTime(RandSeed); FlushRoom(thisRoom); setOTools := 0; toolWndo := nil; housesName := 'untitled'; marqueeTime := FALSE; marqueeIndex := 0; for index := 0 to 4 do begin SpinBall; GetIndPattern(marqueePat[index], 128, index + 1); end; for index := 0 to 7 do SetRect(tileRects[index], index * 64, 0, (index + 1) * 64, 342); SetRect(iconRect[0], 5, 55, 37, 87); SetRect(iconRect[1], 41, 55, 73, 87); SetRect(iconRect[2], 5, 90, 37, 122); SetRect(iconRect[3], 41, 90, 73, 122); SetRect(iconRect[4], 5, 125, 37, 157); SetRect(iconRect[5], 41, 125, 73, 157); SpinBall; SetRect(selectRect[0], 8, 6, 24, 22); SetRect(selectRect[1], 31, 6, 47, 22); SetRect(selectRect[2], 54, 6, 70, 22); SetRect(selectRect[3], 8, 28, 24, 44); SetRect(selectRect[4], 31, 28, 47, 44); SetRect(selectRect[5], 54, 28, 70, 44); SetRect(shadoRct[0], 256, 0, 304, 11); SetRect(shadoRct[1], 256, 12, 304, 23); SpinBall; SetRect(glideRct[0], 0, 0, 48, 20); {right forward} SetRect(glideRct[1], 0, 21, 48, 41); {right tipped} SetRect(glideRct[2], 0, 42, 48, 62); {left forward} SetRect(glideRct[3], 0, 63, 48, 83); {left tipped} SetRect(glideRct[4], 208, 0, 256, 20); {turn endpoint} SetRect(glideRct[5], 208, 21, 256, 41); { " } SetRect(glideRct[6], 208, 42, 256, 62); { " } SetRect(glideRct[7], 208, 63, 256, 83); { " } SetRect(glideRct[8], 208, 84, 256, 104); { " } SetRect(glideRct[9], 208, 105, 256, 125);{turn endpoint} SetRect(glideRct[10], 414, 53, 462, 73); {glider fading masks right} SetRect(glideRct[11], 414, 74, 462, 94); SetRect(glideRct[12], 414, 95, 462, 115); SetRect(glideRct[13], 414, 116, 462, 136); SetRect(glideRct[14], 414, 137, 462, 157); SetRect(glideRct[15], 414, 158, 462, 178); SetRect(glideRct[16], 414, 179, 462, 199); SetRect(glideRct[17], 463, 53, 511, 73); {glider fading masks left} SetRect(glideRct[18], 463, 74, 511, 94); SetRect(glideRct[19], 463, 95, 511, 115); SetRect(glideRct[20], 463, 116, 511, 136); SetRect(glideRct[21], 463, 137, 511, 157); SetRect(glideRct[22], 463, 158, 511, 178); SetRect(glideRct[23], 463, 179, 511, 199); SetRect(glideRct[24], 265, 24, 313, 60); {burning} SetRect(glideRct[25], 265, 61, 313, 97); SetRect(glideRct[26], 265, 98, 313, 134); SetRect(glideRct[27], 265, 135, 313, 171); SpinBall; nextPhase[1, 0] := 10; nextPhase[1, 1] := 11; nextPhase[1, 2] := 10; nextPhase[1, 3] := 11; nextPhase[1, 4] := 12; nextPhase[1, 5] := 11; nextPhase[1, 6] := 12; nextPhase[1, 7] := 13; nextPhase[1, 8] := 12; nextPhase[1, 9] := 13; nextPhase[1, 10] := 14; nextPhase[1, 11] := 13; nextPhase[1, 12] := 14; nextPhase[1, 13] := 15; nextPhase[1, 14] := 14; nextPhase[1, 15] := 15; nextPhase[1, 16] := 16; nextPhase[2, 0] := 16; nextPhase[2, 1] := 15; nextPhase[2, 2] := 16; nextPhase[2, 3] := 15; nextPhase[2, 4] := 14; nextPhase[2, 5] := 15; nextPhase[2, 6] := 14; nextPhase[2, 7] := 13; nextPhase[2, 8] := 14; nextPhase[2, 9] := 13; nextPhase[2, 10] := 12; nextPhase[2, 11] := 13; nextPhase[2, 12] := 12; nextPhase[2, 13] := 11; nextPhase[2, 14] := 12; nextPhase[2, 15] := 11; nextPhase[2, 16] := 10; nextPhase[3, 0] := 4; nextPhase[3, 1] := 4; nextPhase[3, 2] := 5; nextPhase[3, 3] := 5; nextPhase[3, 4] := 6; nextPhase[3, 5] := 6; nextPhase[3, 6] := 7; nextPhase[3, 7] := 7; nextPhase[3, 8] := 8; nextPhase[3, 9] := 8; nextPhase[3, 10] := 9; nextPhase[3, 11] := 9; nextPhase[4, 0] := 9; nextPhase[4, 1] := 9; nextPhase[4, 2] := 8; nextPhase[4, 3] := 8; nextPhase[4, 4] := 7; nextPhase[4, 5] := 7; nextPhase[4, 6] := 6; nextPhase[4, 7] := 6; nextPhase[4, 8] := 5; nextPhase[4, 9] := 5; nextPhase[4, 10] := 4; nextPhase[4, 11] := 4; SpinBall; SetRect(srcRect[celVnt], 0, 84, 48, 96); SetRect(srcRect[celDct], 0, 97, 48, 110); SetRect(srcRect[flrVnt], 0, 111, 48, 124); SetRect(srcRect[paper], 0, 125, 48, 146); SetRect(srcRect[toastr], 0, 147, 38, 174); SetRect(srcRect[60], 304, 84, 336, 115); {toast 1} SetRect(srcRect[61], 304, 116, 336, 147); {toast 2} SetRect(srcRect[62], 304, 148, 336, 179); {toast 3} SetRect(srcRect[63], 304, 180, 336, 211); {toast 4} SetRect(srcRect[64], 304, 212, 336, 243); {toast 5} SetRect(srcRect[65], 304, 244, 336, 275); {toast 6} SetRect(srcRect[teaKtl], 0, 175, 41, 205); SetRect(srcRect[lftFan], 0, 206, 35, 261); SetRect(srcRect[ritFan], 0, 262, 35, 316); SetRect(srcRect[table], 48, 23, 112, 45); SetRect(srcRect[shredr], 48, 46, 112, 70); SetRect(srcRect[books], 48, 71, 112, 126); SetRect(srcRect[clock], 112, 0, 144, 29); SetRect(srcRect[candle], 112, 30, 144, 51); SetRect(srcRect[rbrBnd], 112, 52, 144, 75); SetRect(srcRect[ball], 112, 76, 144, 108); SetRect(srcRect[fshBwl], 112, 109, 144, 138); SetRect(srcRect[66], 144, 109, 160, 125); {fish 1} SetRect(srcRect[67], 144, 126, 160, 142); {fish 2} SetRect(srcRect[68], 144, 143, 160, 159); {fish 3} SetRect(srcRect[69], 144, 160, 160, 176); {fish 4} SetRect(srcRect[grease], 112, 139, 144, 168); SetRect(srcRect[58], 112, 169, 144, 198); {grease falling 1} SetRect(srcRect[59], 112, 199, 144, 228); {grease fallen} SetRect(srcRect[litSwt], 142, 0, 160, 26); SetRect(srcRect[thermo], 144, 27, 162, 54); SetRect(srcRect[outlet], 160, 264, 192, 289); SetRect(srcRect[51], 160, 290, 192, 315); {outlet sparking 1} SetRect(srcRect[52], 160, 316, 192, 341); {outlet sparking 2} SetRect(srcRect[pwrSwt], 144, 82, 162, 108); SetRect(srcRect[guitar], 48, 127, 112, 297); SetRect(srcRect[drip], 192, 42, 208, 55); SetRect(srcRect[shelf], 192, 71, 208, 100); SetRect(srcRect[basket], 448, 270, 511, 341); SetRect(srcRect[paintg], 408, 53, 510, 146); SetRect(srcRect[battry], 144, 55, 160, 81); SetRect(srcRect[macTsh], 256, 209, 301, 267); SetRect(srcRect[upStar], 0, 0, 161, 254); SetRect(srcRect[dnStar], 0, 0, 161, 254); SetRect(srcRect[48], 144, 189, 160, 201); {candle flame} SetRect(srcRect[49], 144, 202, 160, 214); {candle flame} SetRect(srcRect[50], 144, 215, 160, 227); {candle flame} SetRect(srcRect[53], 192, 0, 208, 13); {drip} SetRect(srcRect[54], 192, 14, 208, 27); {drip} SetRect(srcRect[55], 192, 28, 208, 41); {drip} SetRect(srcRect[56], 192, 42, 208, 55); {drip} SetRect(srcRect[57], 192, 56, 208, 70); {drip} SpinBall; toolIcnID[0] := 400; toolIcnID[1] := 401; toolIcnID[2] := 402; toolIcnID[3] := 403; toolIcnID[4] := 404; toolIcnID[5] := 405; toolIcnID[6] := 406; toolIcnID[8] := 408; toolIcnID[9] := 409; toolIcnID[10] := 410; toolIcnID[11] := 411; toolIcnID[12] := 412; toolIcnID[13] := 413; toolIcnID[16] := 416; toolIcnID[17] := 417; toolIcnID[18] := 418; toolIcnID[19] := 419; toolIcnID[20] := 420; toolIcnID[21] := 421; toolIcnID[24] := 424; toolIcnID[25] := 425; toolIcnID[26] := 426; toolIcnID[27] := 427; toolIcnID[28] := 428; toolIcnID[29] := 429; toolIcnID[32] := 432; toolIcnID[33] := 433; toolIcnID[34] := 434; toolIcnID[35] := 435; toolIcnID[36] := 436; toolIcnID[37] := 437; toolIcnID[40] := 440; toolIcnID[41] := 441; toolIcnID[42] := 442; toolIcnID[43] := 443; toolIcnID[44] := 444; toolIcnID[45] := 445; InitCursor; end; {=================================} end. \ No newline at end of file diff --git a/RoomEditor_103/Sources/E-ObjectStuff.p b/RoomEditor_103/Sources/E-ObjectStuff.p new file mode 100755 index 0000000..b501e84 --- /dev/null +++ b/RoomEditor_103/Sources/E-ObjectStuff.p @@ -0,0 +1 @@ +unit ObjectStuff; interface uses Palettes, Globals, Utilities, Drawing, RoomStuff; procedure AutoHideShow (hiding: Boolean); procedure SetUpFields; procedure DragObject (which: Integer); procedure DragHandle; procedure DragOffPalette (whatKind: Integer); procedure CloseTools; procedure UpdateTools; procedure OpenTools; procedure DoTools; procedure BumpAPixel (hori, vert: Integer); procedure DoObjectInfo; function InsertObject: Boolean; implementation const objectInfoID = 131; {=================================} procedure AutoHideShow (hiding: Boolean); begin if (hiding) then begin if (toolWndo <> nil) then begin SetPort(GrafPtr(toolWndo)); SetPt(holdCorner, toolWndo^.portRect.left, toolWndo^.portRect.top); LocalToGlobal(holdCorner); DisposeWindow(GrafPtr(toolWndo)); toolWndo := nil; SetPort(GrafPtr(mainWndo)); end else SetPt(holdCorner, -1000, 0); end else {not hiding - showing} begin if (holdCorner.h <> -1000) then begin if (inColor) then toolWndo := GetNewCWindow(128, nil, WindowPtr(-1)) else toolWndo := GetNewWindow(128, nil, WindowPtr(-1)); if (toolWndo = nil) then begin GenericAlert(kErrLoadingRes); ExitToShell; end; SetPort(GrafPtr(toolWndo)); MoveWindow(toolWndo, holdCorner.h, holdCorner.v, FALSE); ShowWindow(toolWndo); SetWRefCon(toolWndo, 1); UpdateTools; end; end; end; {=================================} procedure SetUpFields; var tempBool: Boolean; tempAmount, tempExtra, what: Integer; begin what := thisRoom.theObjects[oneActive].objectIs; case (what) of flrVnt, ball, toastr, fshBwl: tempAmount := ceilingVert + 20; extRct, upStar, dnStar: tempAmount := roomAt; celVnt, celDct, drip: tempAmount := floorVert - 20; candle: begin tempAmount := thisRoom.theObjects[oneActive].boundRect.top - 100; if (tempAmount < ceilingVert + 50) then tempAmount := ceilingVert + 50; end; lftFan: begin tempAmount := thisRoom.theObjects[oneActive].boundRect.left - 100; if (tempAmount < 0) then tempAmount := 0; end; ritFan, grease: begin tempAmount := thisRoom.theObjects[oneActive].boundRect.right + 100; if (tempAmount > 512) then tempAmount := 512; end; clock, paper, bnsRct: tempAmount := 1000; rbrBnd: tempAmount := 10; battry: tempAmount := 40; outlet, teaKtl: tempAmount := 120; pwrSwt: tempAmount := 0; otherwise tempAmount := 0; end; case (what) of celDct, lftFan, ritFan, grease, shredr: tempBool := TRUE; otherwise tempBool := FALSE; end; case (what) of celDct: tempExtra := roomAt; drip, toastr, fshBwl: tempExtra := 120; otherwise tempExtra := 0; end; with thisRoom.theObjects[oneActive] do begin objectIs := what; amount := tempAmount; extra := tempExtra; isOn := tempBool; end; end; {=================================} procedure DragObject; var floorLockOn, ceilingLockOn, stairLockOn: Boolean; isPt, wasPt, refPt: Point; theSrc, oldRect, destRect: Rect; what, errorIs: Integer; begin SetPort(GrafPtr(mainWndo)); what := thisRoom.theObjects[which].objectIs; destRect := thisRoom.theObjects[which].boundRect; oldRect := destRect; theSrc := srcRect[what]; floorLockOn := FALSE; ceilingLockOn := FALSE; stairLockOn := FALSE; if (what = flrVnt) then floorLockOn := TRUE; if ((what = celDct) or (what = celVnt)) then ceilingLockOn := TRUE; if ((what = upStar) or (what = dnStar)) then stairLockOn := TRUE; isPt := theEvent.where; wasPt := isPt; PenPat(gray); PenMode(patXOr); FrameRect(destRect); while (WaitMouseUp) do begin GetMouse(isPt); LocalToGlobal(isPt); if ((isPt.h <> wasPt.h) or (isPt.v <> wasPt.v)) then begin FrameRect(destRect); if ((floorLockOn) or (ceilingLockOn) or (stairLockOn)) then OffsetRect(destRect, isPt.h - wasPt.h, 0) else OffsetRect(destRect, isPt.h - wasPt.h, isPt.v - wasPt.v); FrameRect(destRect); oldRect := destRect; end; wasPt := isPt; end; FrameRect(destRect); PenNormal; if (toolWndo <> nil) then SetPort(toolWndo); changed := TRUE; thisRoom.theObjects[which].boundRect := destRect; if (ErrorCheckObject(thisRoom.theObjects[which], errorIs)) then SysBeep(1); {*** temp beep for error} end; {=================================} procedure DragHandle; const horiLock = 0; vertLock = 1; noLock = 2; var min, max, restrict, saveActive: Integer; savePos, savePos2, min2, max2, kind: Integer; stretchFrame: Rect; wasPt, isPt: Point; square: Boolean; begin saveActive := oneActive; Deselect; changed := TRUE; SetPort(GrafPtr(mainWndo)); with thisRoom.theObjects[saveActive] do begin case (objectIs) of {Pop the handle out} table, shelf: begin min := boundRect.left + 64; max := 512; restrict := horiLock; square := FALSE; end; flrVnt, candle, toastr, ball, fshBwl: begin min := ceilingVert + 20; max := boundRect.top - 20; restrict := vertLock; square := FALSE; end; celVnt, celDct, drip: begin min := boundRect.bottom + 20; max := floorVert; restrict := vertLock; square := FALSE; end; lftFan: begin min := 0; max := boundRect.left - 20; restrict := horiLock; square := FALSE; end; ritFan, grease: begin min := boundRect.right + 20; max := 512; restrict := horiLock; square := FALSE; end; otherwise begin min := boundRect.left + 32; max := 512; min2 := boundRect.top + 32; max2 := 342; stretchFrame := boundRect; square := TRUE; end; end; {End of case} end; {End of with} PenPat(gray); PenMode(PatXOr); if (square) then FrameRect(stretchFrame) else begin MoveTo(startPt.h, startPt.v); LineTo(endPt.h, endPt.v); end; PaintRect(handleRect); GetMouse(wasPt); isPt := wasPt; while WaitMouseUp do begin GetMouse(isPt); if (square) then begin if ((isPt.h <> wasPt.h) or (isPt.v <> wasPt.v)) then begin FrameRect(stretchFrame); PaintRect(handleRect); savePos := endPt.h; savePos2 := endPt.v; endPt := isPt; if (endPt.h > max) then endPt.h := max; if (endPt.h < min) then endPt.h := min; if (endPt.v > max2) then endPt.v := max2; if (endPt.v < min2) then endPt.v := min2; OffsetRect(handleRect, endPt.h - savePos, endPt.v - savePos2); stretchFrame.right := endPt.h; stretchFrame.bottom := endPt.v; FrameRect(stretchFrame); PaintRect(handleRect); end; end else begin if ((restrict = horiLock) and (isPt.h <> wasPt.h)) then begin MoveTo(startPt.h, startPt.v); LineTo(endPt.h, endPt.v); PaintRect(handleRect); savePos := endPt.h; endPt.h := isPt.h; if (endPt.h > max) then endPt.h := max; if (endPt.h < min) then endPt.h := min; OffsetRect(handleRect, endPt.h - savePos, 0); MoveTo(startPt.h, startPt.v); LineTo(endPt.h, endPt.v); PaintRect(handleRect); end; if ((restrict = vertLock) and (isPt.v <> wasPt.v)) then begin MoveTo(startPt.h, startPt.v); LineTo(endPt.h, endPt.v); PaintRect(handleRect); savePos := endPt.v; endPt.v := isPt.v; if (endPt.v > max) then endPt.v := max; if (endPt.v < min) then endPt.v := min; OffsetRect(handleRect, 0, endPt.v - savePos); MoveTo(startPt.h, startPt.v); LineTo(endPt.h, endPt.v); PaintRect(handleRect); end; end; wasPt := isPt; end; if (square) then FrameRect(stretchFrame) else begin MoveTo(startPt.h, startPt.v); LineTo(endPt.h, endPt.v); end; PaintRect(handleRect); PenNormal; if (toolWndo <> nil) then SetPort(toolWndo); with thisRoom.theObjects[saveActive] do case (objectIs) of table, shelf: boundRect.right := wasPt.h; cabnet, extRct, obsRct, bnsRct, window, mirror: begin boundRect := stretchFrame; end; otherwise if (restrict = horiLock) then amount := endPt.h else amount := endPt.v; end; kind := thisRoom.theObjects[saveActive].objectIs; oneActive := saveActive; changed := TRUE; case kind of {some objects require a complete redrawing} table, shelf, cabnet, extRct, obsRct, bnsRct, window, mirror: DrawAllObjects; otherwise {others are unaffected by a handle-drag} Select; end; end; {=================================} procedure DragOffPalette; var thePt: Point; i: Integer; finalRect: Rect; wasPort: GrafPtr; begin GetPort(wasPort); SetPort(GrafPtr(mainWndo)); with thisRoom do begin if (numberOObjects < 16) then numberOObjects := numberOObjects + 1 else begin SetPort(wasPort); GenericAlert(kErrTooManyObjects); Exit(DragOffPalette); end; if (whatKind = toastr) or (whatKind = window) or (whatKind = mirror) then for i := 1 to numberOObjects - 1 do with theObjects[i] do if (objectIs = whatKind) then begin numberOObjects := numberOObjects - 1; SetPort(wasPort); GenericAlert(16); Exit(DragOffPalette); end; if (autoHide) then AutoHideShow(TRUE); oneActive := thisRoom.numberOObjects; thisRoom.theObjects[oneActive].objectIs := whatKind; end; {with thisRoom do} thePt := theEvent.where; GlobalToLocal(thePt); case whatKind of table: SetRect(finalRect, thePt.h - 50, thePt.v - 5, thePt.h + 50, thePt.v + 4); shelf: SetRect(finalRect, thePt.h - 50, thePt.v - 4, thePt.h + 50, thePt.v + 3); cabnet: SetRect(finalRect, thePt.h - 50, thePt.v - 30, thePt.h + 50, thePt.v + 30); extRct, obsRct, bnsRct: SetRect(finalRect, thePt.h - 32, thePt.v - 16, thePt.h + 32, thePt.v + 16); mirror: SetRect(finalRect, thePt.h - 32, thePt.v - 64, thePt.h + 32, thePt.v + 64); flrVnt: begin finalRect := srcRect[whatKind]; OffsetRect(finalRect, -finalRect.left, -finalRect.top); OffsetRect(finalRect, thePt.h, floorVert); OffsetRect(finalRect, -(finalRect.right - finalRect.left) div 2, 0); end; celVnt, celDct: begin finalRect := srcRect[whatKind]; OffsetRect(finalRect, -finalRect.left, -finalRect.top); OffsetRect(finalRect, thePt.h, ceilingVert); OffsetRect(finalRect, -(finalRect.right - finalRect.left) div 2, 0); end; window: SetRect(finalRect, thePt.h - 50, thePt.v - 60, thePt.h + 50, thePt.v + 60); upStar, dnStar: begin finalRect := srcRect[whatKind]; OffsetRect(finalRect, -finalRect.left, -finalRect.top); OffsetRect(finalRect, thePt.h, stairVert); OffsetRect(finalRect, -(finalRect.right - finalRect.left) div 2, 0); end; otherwise begin finalRect := srcRect[whatKind]; OffsetRect(finalRect, -finalRect.left, -finalRect.top); {Set to 0,0} OffsetRect(finalRect, thePt.h, thePt.v); {Offset to cursor} OffsetRect(finalRect, (finalRect.left - finalRect.right) div 2, (finalRect.top - finalRect.bottom) div 2); end; end; thisRoom.theObjects[oneActive].boundRect := finalRect; SetUpFields; DragObject(oneActive); SortObjects; DrawAllObjects; if (autoHide) then AutoHideShow(FALSE); UpdateMenuItems(editToObject); SetPort(wasPort); end; {=================================} procedure CloseTools; begin if (toolWndo <> nil) then begin DisposeWindow(GrafPtr(toolWndo)); toolWndo := nil; end; end; {=================================} procedure UpdateTools; var index, tempInt: Integer; tempRect: Rect; icnHand: Handle; cicnHand: CIconHandle; theSICN: SICNHand; wasPort: GrafPtr; begin if (toolWndo = nil) then Exit(UpdateTools); GetPort(wasPort); SetPort(GrafPtr(toolWndo)); PenNormal; ForeColor(cyanColor); MoveTo(5, 50); LineTo(70, 50); ForeColor(blackCOlor); if (inColor) then begin for index := 0 to 5 do begin SpinBall; cicnHand := GetCIcon(133 + index); if (cicnHand <> nil) then PlotCIcon(selectRect[index], cicnHand) else GenericAlert(kErrLoadingRes); DisposCIcon(cicnHand); end; end else begin for index := 0 to 5 do begin SpinBall; theSICN := SICNHand(GetResource('SICN', 256 + index)); if (theSICN <> nil) then PlotSICN(selectRect[index], theSICN); end; end; tempRect := selectRect[setOTools]; InsetRect(tempRect, -3, -3); PenSize(2, 2); PenPat(black); ForeColor(redColor); FrameRect(tempRect); ForeColor(blackColor); PenNormal; for index := 0 to 5 do begin SpinBall; if (setOTools = 0) then tempInt := index + 1 else tempInt := index; if (inColor) then begin cicnHand := GetCIcon(toolIcnId[tempInt + (8 * setOTools)]); if (cicnHand <> nil) then PlotCIcon(iconRect[index], cicnHand) else GenericAlert(kErrLoadingRes); DisposCIcon(cicnHand); end else begin icnHand := GetIcon(toolIcnId[tempInt + (8 * setOTools)]); if (icnHand <> nil) then PlotIcon(iconRect[index], icnHand) else GenericAlert(kErrLoadingRes); end; end; SetPort(wasPort); InitCursor; end; {=================================} procedure OpenTools; begin if (toolWndo = nil) then begin if (inColor) then toolWndo := GetNewCWindow(128, nil, WindowPtr(-1)) else toolWndo := GetNewWindow(128, nil, WindowPtr(-1)); if (toolWndo = nil) then begin GenericAlert(kErrLoadingRes); ExitToShell; end; SetPort(GrafPtr(toolWndo)); MoveWindow(toolWndo, screenBits.bounds.right - 99, 40, FALSE); ShowWindow(toolWndo); SetWRefCon(toolWndo, 1); UpdateTools; end else SelectWindow(toolWndo); end; {=================================} procedure DoTools; var index, what: Integer; tempRect: Rect; thePt: Point; begin if (toolWndo = nil) then Exit(DoTools); if (theEvent.what = MouseDown) then begin thePt := theEvent.where; GlobalToLocal(thePt); for index := 0 to 5 do if (PtInRect(thePt, iconRect[index])) then begin Deselect; changed := TRUE; what := index + (setOTools * 8); if (setOTools = 0) then what := what + 1; if (toolIcnID[what] <> 400) then DragOffPalette(what) else what := 0; end; for index := 0 to 5 do if (PtInRect(thePt, selectRect[index])) then if (setOTools <> index) then begin tempRect := selectRect[setOTools]; InsetRect(tempRect, -3, -3); PenSize(2, 2); if (inColor) then begin RGBForeColor(rgbWhite); FrameRect(tempRect); RGBForeColor(rgbBlack); end else begin FrameRect(tempRect); PenMode(patXOr); FrameRect(tempRect); PenNormal; end; setOTools := index; UpdateTools; end; end; end; {=================================} procedure BumpAPixel; var holdObject, what: Integer; destRect, theSrc: Rect; begin holdObject := oneActive; Deselect; oneActive := holdObject; destRect := thisRoom.theObjects[oneActive].boundRect; what := thisRoom.theObjects[oneActive].objectIs; if (((what = flrVnt) or (what = celVnt) or (what = celDct)) and (vert <> 0)) then vert := 0; OffsetRect(destRect, hori, vert); {error check that bounds have been respected HERE} theSrc := srcRect[what]; DrawAllObjects; with thisRoom.theObjects[oneActive] do begin boundRect := destRect; case objectIs of candle, toastr..fshBwl: begin amount := amount + vert; if (amount < (ceilingVert + 20)) then amount := ceilingVert + 20; end; lftFan: begin amount := amount + hori; if (amount < 0) then amount := 0; end; ritFan, grease: begin amount := amount + hori; if (amount > 512) then amount := 512; end; otherwise ; end; {case} end; {with} Select; end; {=================================} procedure DoObjectInfo; const inactive = 255; active = 0; okayBut = 1; cancelBut = 2; leftEdit = 3; topEdit = 4; widthEdit = 5; heightEdit = 6; delayEdit = 7; onRadio = 8; offRadio = 9; leftStat = 12; topStat = 13; widthStat = 14; heightStat = 15; delayStat = 16; numStat = 18; var wasPort: GrafPtr; leaveDlg: Boolean; theDlgPtr: DialogPtr; tempRect, wasRect: Rect; cntlType, itemHit, tempInt, rightOff, downOff, i, whichSelect: Integer; tempLong: LongInt; dlgItem: Handle; strTemp: Str255; tempObject: objectData; {-------------------------} function ReadNumber (item: Integer): Integer; begin GetDItem(theDlgPtr, item, cntlType, dlgItem, tempRect); GetIText(dlgItem, strTemp); StringToNum(strTemp, tempLong); ReadNumber := LoWord(tempLong); end; {-------------------------} procedure WriteNumber (item, value: Integer; select: Boolean); begin GetDItem(theDlgPtr, item, cntlType, dlgItem, tempRect); NumToString(value, strTemp); SetIText(dlgItem, strTemp); if (select) then SelIText(theDlgPtr, item, 0, 4); end; {-------------------------} procedure Redraw; var width: Integer; begin SetPort(theDlgPtr); {Point to our dialog window} GetDItem(theDlgPtr, okayBut, cntlType, dlgItem, tempRect);{Get the item handle} PenSize(3, 3); {Change pen to draw thick default outline} InsetRect(tempRect, -4, -4); {Draw outside the button by 1 pixel} FrameRoundRect(tempRect, 16, 16); {Draw the outline} PenNormal; with theDlgPtr^.portRect do width := right - left; MoveTo(4, 38); Line(width - 8, 0); MoveTo(4, 40); Line(width - 8, 0); end; {-------------------------} begin GetPort(wasPort); theDlgPtr := GetNewDialog(objectInfoID, nil, Pointer(-1)); with theDlgPtr^.portBits do begin rightOff := rightOffset - bounds.left; downOff := downOffset - bounds.top; end; MoveWindow(theDlgPtr, rightOff, downOff, FALSE); ShowWindow(theDlgPtr); SelectWindow(theDlgPtr); SetPort(theDlgPtr); tempObject := thisRoom.theObjects[oneActive]; with tempObject do begin {pop object number as static field} WriteNumber(numStat, oneActive, FALSE); {pop left coordinate into edit text field} WriteNumber(leftEdit, boundRect.left, FALSE); {pop top coordinate into edit text field} WriteNumber(topEdit, boundRect.top, FALSE); whichSelect := leftEdit; case objectIs of table, shelf: begin WriteNumber(widthEdit, boundRect.right - boundRect.left, FALSE); HideDItem(theDlgPtr, heightEdit); HideDItem(theDlgPtr, heightStat); whichSelect := widthEdit; end; cabNet, extRct, obsRct, bnsRct, window, mirror: begin WriteNumber(widthEdit, boundRect.right - boundRect.left, FALSE); WriteNumber(heightEdit, boundRect.bottom - boundRect.top, FALSE); whichSelect := widthEdit; end; flrVnt, celVnt, upStar, dnStar: begin HideDItem(theDlgPtr, topEdit); HideDItem(theDlgPtr, topStat); HideDItem(theDlgPtr, widthEdit); HideDItem(theDlgPtr, widthStat); HideDItem(theDlgPtr, heightEdit); HideDItem(theDlgPtr, heightStat); end; celDct: begin HideDItem(theDlgPtr, topEdit); HideDItem(theDlgPtr, topStat); WriteNumber(widthEdit, extra, FALSE); GetDItem(theDlgPtr, widthStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, 'Rm # link'); HideDItem(theDlgPtr, heightEdit); HideDItem(theDlgPtr, heightStat); whichSelect := widthEdit; end; drip, toastr, fshBwl: begin WriteNumber(widthEdit, extra, FALSE); GetDItem(theDlgPtr, widthStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, 'Delay (1/60th secs)'); HideDItem(theDlgPtr, heightEdit); HideDItem(theDlgPtr, heightStat); whichSelect := widthEdit; end; otherwise begin HideDItem(theDlgPtr, widthEdit); HideDItem(theDlgPtr, widthStat); HideDItem(theDlgPtr, heightEdit); HideDItem(theDlgPtr, heightStat); end; end; {case objectIs} case objectIs of extRct, upStar, dnStar: begin WriteNumber(delayEdit, amount, FALSE); GetDItem(theDlgPtr, delayStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, 'Room # connected to:'); whichSelect := delayEdit; end; flrVnt..ritFan: begin case objectIs of flrVnt, candle: WriteNumber(delayEdit, boundRect.top - amount, FALSE); celVnt, celDct: WriteNumber(delayEdit, amount - boundRect.bottom, FALSE); lftFan: WriteNumber(delayEdit, boundRect.left - amount, FALSE); ritFan: WriteNumber(delayEdit, amount - boundRect.right, FALSE); end; GetDItem(theDlgPtr, delayStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, 'Length of air column:'); if (objectIs <> celDct) then whichSelect := delayEdit; end; drip, toastr, ball, fshBwl: begin case objectIs of toastr, ball, fshBwl: WriteNumber(delayEdit, boundRect.top - amount, FALSE); drip: WriteNumber(delayEdit, amount - boundRect.bottom, FALSE); end; GetDItem(theDlgPtr, delayStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, 'Length of travel:'); whichSelect := delayEdit; end; outlet, teaKtl: begin WriteNumber(delayEdit, amount, FALSE); GetDItem(theDlgPtr, delayStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, 'Delay (1/60):'); whichSelect := delayEdit; end; clock, paper, bnsRct: begin WriteNumber(delayEdit, amount, FALSE); GetDItem(theDlgPtr, delayStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, 'Points awarded:'); whichSelect := delayEdit; end; rbrBnd, battry: begin WriteNumber(delayEdit, amount, FALSE); GetDItem(theDlgPtr, delayStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, 'Quantity:'); whichSelect := delayEdit; end; pwrSwt: begin WriteNumber(delayEdit, amount, FALSE); GetDItem(theDlgPtr, delayStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, 'Object # linked to:'); whichSelect := delayEdit; end; grease: begin WriteNumber(delayEdit, amount - boundRect.right, FALSE); GetDItem(theDlgPtr, delayStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, 'Length of spill:'); whichSelect := delayEdit; end; otherwise begin HideDItem(theDlgPtr, delayEdit); HideDItem(theDlgPtr, delayStat); end; end; {case objectIs} case objectIs of lftFan, ritFan, shredr, celDct, grease, window: begin if (isOn) then GetDItem(theDlgPtr, onRadio, cntlType, dlgItem, tempRect) else GetDItem(theDlgPtr, offRadio, cntlType, dlgItem, tempRect); SetCtlValue(ControlHandle(dlgItem), 1); if (objectIs = celDct) then begin GetDItem(theDlgPtr, onRadio, cntlType, dlgItem, tempRect); SetCTitle(ControlHandle(dlgItem), 'Blower'); GetDItem(theDlgPtr, offRadio, cntlType, dlgItem, tempRect); SetCTitle(ControlHandle(dlgItem), 'Suction'); end; if (objectIs = grease) then begin GetDItem(theDlgPtr, onRadio, cntlType, dlgItem, tempRect); SetCTitle(ControlHandle(dlgItem), 'Up'); GetDItem(theDlgPtr, offRadio, cntlType, dlgItem, tempRect); SetCTitle(ControlHandle(dlgItem), 'Spilled'); end; if (objectIs = window) then begin GetDItem(theDlgPtr, onRadio, cntlType, dlgItem, tempRect); SetCTitle(ControlHandle(dlgItem), 'Window Open'); GetDItem(theDlgPtr, offRadio, cntlType, dlgItem, tempRect); SetCTitle(ControlHandle(dlgItem), 'Window Closed'); end; end; otherwise begin HideDItem(theDlgPtr, onRadio); HideDItem(theDlgPtr, offRadio); end; end; {case objectIs} end; {end - with tempRoom do} {select the left coordinate text edit field} SelIText(theDlgPtr, whichSelect, 0, 254); Redraw; leaveDlg := FALSE; repeat ModalDialog(nil, itemHit); GetDItem(theDlgPtr, itemHit, cntlType, dlgItem, tempRect); if (itemHit = okayBut) then begin leaveDlg := TRUE; with tempObject do begin tempInt := ReadNumber(leftEdit); {error check left coord} if (tempInt < 0) then begin SysBeep(1); WriteNumber(leftEdit, 0, TRUE); leaveDlg := FALSE; end else if ((tempInt + (boundRect.right - boundRect.left)) > 512) then begin SysBeep(1); WriteNumber(leftEdit, 512 - (boundRect.right - boundRect.left), TRUE); leaveDlg := FALSE; end else begin tempInt := tempInt - boundRect.left; boundRect.left := boundRect.left + tempInt; boundRect.right := boundRect.right + tempInt; end; case objectIs of table..obsRct, candle..macTsh: begin tempInt := ReadNumber(topEdit); {error check top coord} if (tempInt < ceilingVert) then begin SysBeep(1); WriteNumber(topEdit, ceilingVert, TRUE); leaveDlg := FALSE; end else if ((tempInt + (boundRect.bottom - boundRect.top)) > floorVert) then begin SysBeep(1); WriteNumber(topEdit, floorVert - (boundRect.bottom - boundRect.top), TRUE); leaveDlg := FALSE; end else begin tempInt := tempInt - boundRect.top; boundRect.top := boundRect.top + tempInt; boundRect.bottom := boundRect.bottom + tempInt; end; end; otherwise end; case objectIs of table, shelf, cabNet, extRct, obsRct, bnsRct, window, mirror: begin tempInt := ReadNumber(widthEdit); {error check width} if (tempInt + boundRect.left > 512) or (tempInt < 0) then begin SysBeep(1); if (tempInt < 0) then WriteNumber(widthEdit, 16, TRUE) else WriteNumber(widthEdit, 512 - boundRect.left, TRUE); leaveDlg := FALSE; end else boundRect.right := boundRect.left + tempInt; end; otherwise end; case objectIs of cabNet, extRct, obsRct, bnsRct, window, mirror: begin tempInt := ReadNumber(heightEdit); {error check height} if (boundRect.top + tempInt > floorVert) or (tempInt < 0) then begin SysBeep(1); if (tempInt < 0) then WriteNumber(heightEdit, 16, TRUE) else WriteNumber(heightEdit, floorVert - boundRect.top, TRUE); leaveDlg := FALSE; end else boundRect.bottom := boundRect.top + tempInt; end; otherwise end; case objectIs of extRct, upStar, dnStar: begin tempInt := ReadNumber(delayEdit); {error check 'amount'} if ((tempInt < 1) or (tempInt > 80)) then begin SysBeep(1); WriteNumber(delayEdit, roomAt, TRUE); leaveDlg := FALSE; end else amount := tempInt; end; flrVnt, candle, toastr, ball, fshBwl: begin tempInt := ReadNumber(delayEdit); if (boundRect.top - tempInt < ceilingVert) then begin SysBeep(1); WriteNumber(delayEdit, boundRect.top - ceilingVert, TRUE); leaveDlg := FALSE; end else amount := boundRect.top - tempInt; end; celVnt, celDct, drip: begin tempInt := ReadNumber(delayEdit); if (boundRect.bottom + tempInt > floorVert) then begin SysBeep(1); WriteNumber(delayEdit, floorVert - boundRect.bottom, TRUE); leaveDlg := FALSE; end else amount := boundRect.bottom + tempInt; end; lftFan: begin tempInt := ReadNumber(delayEdit); if (boundRect.left - tempInt < 0) then begin SysBeep(1); WriteNumber(delayEdit, boundRect.left, TRUE); leaveDlg := FALSE; end else amount := boundRect.left - tempInt; end; ritFan, grease: begin tempInt := ReadNumber(delayEdit); if (boundRect.right + tempInt > 512) then begin SysBeep(1); WriteNumber(delayEdit, 512 - boundRect.right, TRUE); leaveDlg := FALSE; end else amount := boundRect.right + tempInt; end; clock, paper, bnsRct, battry, rbrBnd, outlet, teaKtl: begin tempInt := ReadNumber(delayEdit); if (tempInt < 0) then begin SysBeep(1); WriteNumber(delayEdit, -1 * tempInt, TRUE); leaveDlg := FALSE; end else amount := tempInt; end; pwrSwt: begin tempInt := ReadNumber(delayEdit); if (tempInt < 0) or (tempInt > 16) then begin SysBeep(1); WriteNumber(delayEdit, 0, TRUE); leaveDlg := FALSE; end else amount := tempInt; end; otherwise end; case objectIs of celDct: begin tempInt := ReadNumber(widthEdit); {error check other} if ((tempInt < 1) or (tempInt > 80)) then begin SysBeep(1); WriteNumber(widthEdit, roomAt, TRUE); leaveDlg := FALSE; end else extra := tempInt; end; drip, toastr, fshBwl: begin tempInt := ReadNumber(widthEdit); {error check other} if (tempInt < 0) then begin SysBeep(1); WriteNumber(widthEdit, -1 * tempInt, TRUE); leaveDlg := FALSE; end else extra := tempInt; end; otherwise end; end; {end - with tempObject} if (leaveDlg) then begin thisRoom.theObjects[oneActive] := tempObject; changed := TRUE; end; end; if (itemHit = cancelBut) then leaveDlg := TRUE; if (itemHit = onRadio) then begin tempObject.isOn := TRUE; GetDItem(theDlgPtr, onRadio, cntlType, dlgItem, tempRect); SetCtlValue(ControlHandle(dlgItem), 1); GetDItem(theDlgPtr, offRadio, cntlType, dlgItem, tempRect); SetCtlValue(ControlHandle(dlgItem), 0); end; if (itemHit = offRadio) then begin tempObject.isOn := FALSE; GetDItem(theDlgPtr, onRadio, cntlType, dlgItem, tempRect); SetCtlValue(ControlHandle(dlgItem), 0); GetDItem(theDlgPtr, offRadio, cntlType, dlgItem, tempRect); SetCtlValue(ControlHandle(dlgItem), 1); end; until leaveDlg; DisposDialog(theDlgPtr); if (toolWndo <> nil) then SetPort(toolWndo) else SetPort(wasPort); DrawAllObjects; end; {=================================} function InsertObject; begin InsertObject := FALSE; if (thisRoom.numberOObjects >= 16) then begin GenericAlert(kErrTooManyObjects); Exit(InsertObject); end; Deselect; with thisRoom do begin numberOObjects := numberOObjects + 1; theObjects[numberOObjects] := scrapObject; end; oneActive := thisRoom.numberOObjects; Select; InsertObject := TRUE; end; {=================================} end. \ No newline at end of file diff --git a/RoomEditor_103/Sources/E-RoomStuff.p b/RoomEditor_103/Sources/E-RoomStuff.p new file mode 100755 index 0000000..3b1e0b4 --- /dev/null +++ b/RoomEditor_103/Sources/E-RoomStuff.p @@ -0,0 +1 @@ +unit RoomStuff; interface uses Palettes, Globals, Utilities, Drawing; procedure SortObjects; function InsertNewRoom: Boolean; procedure FlushRoom (var whichRoom: roomData); procedure DoGotoDial; function roomFltr (theDlg: DialogPtr; var theEvnt: EventRecord; var itemHit: integer): boolean; procedure DoRoomBackInfo (var shouldOpen: Boolean); procedure DoRoomCondInfo (var shouldOpen: Boolean); implementation const roomCondID = 129; roomBackID = 130; var tempTile: array[0..7] of Integer; backNumber: Integer; {=================================} procedure SortObjects; var holdActive, i, count, itemType: Integer; holdRoom: RoomData; begin FlushRoom(holdRoom); count := 0; holdActive := oneActive; for i := 1 to 16 do begin itemType := thisRoom.theObjects[i].objectIs; if ((itemType <> paintg) and (itemType <> mirror) and (itemType <> window) and (itemType <> 0)) then begin count := count + 1; if (oneActive = i) then holdActive := count; holdRoom.theObjects[count] := thisRoom.theObjects[i]; thisRoom.theObjects[i].objectIs := 0; end; end; for i := 1 to 16 do begin itemType := thisRoom.theObjects[i].objectIs; if (itemType <> 0) then begin count := count + 1; if (oneActive = i) then holdActive := count; holdRoom.theObjects[count] := thisRoom.theObjects[i]; end; end; for i := 1 to thisRoom.numberOObjects do thisRoom.theObjects[i] := holdRoom.theObjects[i]; with thisRoom do if (count <> numberOObjects) then {*** Check for agreement} begin count := 0; {*** Run a second check} for i := 1 to 16 do if (theObjects[i].objectIs <> 0) then count := count + 1; numberOObjects := count; {*** We'll go with this #} if (numberOObjects < 16) then for i := numberOObjects + 1 to 16 do begin theObjects[i].objectIs := 0; {*** Zero-out excess fields} theObjects[i].boundRect := nullRect; theObjects[i].amount := 0; theObjects[i].extra := 0; theObjects[i].isOn := FALSE; end; end; oneActive := holdActive; {*** Restore active object} end; {=================================} function InsertNewRoom; var i: Integer; begin InsertNewRoom := FALSE; if (thisHouse.numberORooms >= 40) then {trying to add 41 rooms} begin GenericAlert(kErrTooManyRooms); Exit(InsertNewRoom); end; thisHouse.theRooms[roomAt] := thisRoom; {insert room to date} if (roomAt < thisHouse.numberORooms) then {shift only if in middle} for i := thisHouse.numberORooms downto roomAt + 1 do thisHouse.theRooms[i + 1] := thisHouse.theRooms[i]; {shift rooms right} roomAt := roomAt + 1; {kick active over to right} FlushRoom(thisRoom); {flush new room copy} thisHouse.theRooms[roomAt] := thisRoom; {copy active into house} thisHouse.numberORooms := thisHouse.numberORooms + 1; {one more room} InsertNewRoom := TRUE; end; {=================================} procedure FlushRoom; var index: Integer; defaultName: Str255; begin NumToString(roomAt, defaultName); defaultName := CONCAT('Room # ', defaultName); with whichRoom do begin roomName := defaultName; numberOObjects := 0; backPictID := 200; for index := 0 to 7 do tileOrder[index] := 0; animateKind := 0; animateNumber := 0; animateDelay := 0; conditionCode := 0; for index := 1 to 16 do begin theObjects[index].objectIs := 0; theObjects[index].boundRect := nullRect; theObjects[index].amount := 0; theObjects[index].extra := 0; theObjects[index].isOn := FALSE; end; end; end; {=================================} procedure DoGotoDial; const okayBut = 1; cancelBut = 2; gotoEdit = 3; numOfStat = 4; currStat = 5; var leaveDlg: Boolean; tempLong: LongInt; theDlgPtr: DialogPtr; tempRect: Rect; cntlType, index, itemHit, tempInt, rightOff, downOff: Integer; dlgItem: Handle; cntlHand, tempCntlHand: controlhandle; strTemp: Str255; {-------------------------} procedure Redraw; var index: Integer; begin SetPort(theDlgPtr); {Point to our dialog window} GetDItem(theDlgPtr, okayBut, cntlType, dlgItem, tempRect);{Get the item handle} PenSize(3, 3); {Change pen to draw thick default outline} InsetRect(tempRect, -4, -4); {Draw outside the button by 1 pixel} FrameRoundRect(tempRect, 16, 16); {Draw the outline} PenNormal; end; {-------------------------} begin theDlgPtr := GetNewDialog(261, nil, Pointer(-1)); with theDlgPtr^.portBits do begin rightOff := rightOffset - bounds.left; downOff := downOffset - bounds.top; end; MoveWindow(theDlgPtr, rightOff, downOff, FALSE); ShowWindow(theDlgPtr); SelectWindow(theDlgPtr); SetPort(theDlgPtr); with thisHouse do begin NumToString(numberORooms, strTemp); GetDItem(theDlgPtr, numOfStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, strTemp); end; NumToString(roomAt, strTemp); GetDItem(theDlgPtr, currStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, strTemp); NumToString(roomAt, strTemp); GetDItem(theDlgPtr, gotoEdit, cntlType, dlgItem, tempRect); SetIText(dlgItem, strTemp); SelIText(theDlgPtr, gotoEdit, 0, 3); Redraw; leaveDlg := FALSE; repeat ModalDialog(nil, itemHit); GetDItem(theDlgPtr, itemHit, cntlType, dlgItem, tempRect); if (itemHit = okayBut) then begin GetDItem(theDlgPtr, gotoEdit, cntlType, dlgItem, tempRect); GetIText(dlgItem, strTemp); {Get the text entered} StringToNum(strTemp, tempLong); if ((LoWord(tempLong) > 0) and (LoWord(tempLong) < thisHouse.numberORooms + 1)) then begin leaveDlg := TRUE; roomAt := LoWord(tempLong); end else begin SysBeep(1); NumToString(roomAt, strTemp); GetDItem(theDlgPtr, gotoEdit, cntlType, dlgItem, tempRect); SetIText(dlgItem, strTemp); SelIText(theDlgPtr, gotoEdit, 0, 3); end; end; if (itemHit = cancelBut) then begin leaveDlg := TRUE; end; until leaveDlg; DisposDialog(theDlgPtr); if (toolWndo <> nil) then SetPort(toolWndo) else SetPort(mainWndo); end; {=================================} function roomFltr; var cntlType, index, whichTile, itemDropped: Integer; wasPt, newPt: Point; dlgItem: Handle; thePict: PicHandle; tempRect, sameRect, dest, tempRect2: Rect; tempByte: SignedByte; {----------------} procedure ClickedInLeftBox; var index2: Integer; begin whichTile := (wasPt.h - 17) div 8; SetRect(tempRect, 0, 0, 8, 49); {a tile rect} OffsetRect(tempRect, 17 + (whichTile * 8), 83); GetMouse(wasPt); newPt := wasPt; PenPat(gray); PenMode(patXOr); FrameRect(tempRect); while (WaitMouseUp) do begin GetMouse(newPt); if (newPt.h <> wasPt.h) then begin FrameRect(tempRect); OffsetRect(tempRect, newPt.h - wasPt.h, 0); FrameRect(tempRect); wasPt := newPt; end; {end - if (a)} end; {end - while} FrameRect(tempRect); PenNormal; SetRect(dest, 111, 83, 175, 132); if (PtInRect(newPt, dest)) then begin itemDropped := (newPt.h - 111) div 8; if ((itemDropped > -1) and (itemDropped < 8)) then tempTile[itemDropped] := whichTile else SysBeep(1); end; for index2 := 0 to 7 do begin SetRect(tempRect, 0, 0, 8, 49); OffsetRect(tempRect, 111 + (index2 * 8), 83); thePict := GetPicture(300 + tempTile[index2] + (backNumber * 8)); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, tempRect); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrGraphicLoad); end; ReleaseResource(Handle(thePict)); end; {end - for} end; {end - if PtInRect} {----------------} begin roomFltr := FALSE; {assume no events} if ((theEvnt.what = KeyDown) and (BitAnd(theEvnt.message, CharCodeMask) = $0D)) then begin {'carriage' return hit} itemHit := 1; roomFltr := TRUE; end; if (theEvnt.what = MouseDown) then begin GetMouse(wasPt); SetRect(tempRect, 17, 83, 81, 132); if (PtInRect(wasPt, tempRect)) then {tempRect => left tile rect} ClickedInLeftBox; end; {end - if mouseDown} SetRect(tempRect2, 17, 78, 81, 81); {erase any old markers} EraseRect(tempRect2); SetRect(tempRect2, 17, 134, 81, 137); EraseRect(tempRect2); GetMouse(wasPt); SetRect(tempRect, 17, 83, 81, 132); if (PtInRect(wasPt, tempRect)) then {tempRect => left tile rect} begin whichTile := (wasPt.h - 17) div 8; SetRect(tempRect, 0, 0, 8, 49); {a tile rect} OffsetRect(tempRect, 17 + (whichTile * 8), 83); tempRect2 := tempRect; {draw top marker over tile} tempRect2.top := tempRect2.top - 5; tempRect2.bottom := tempRect2.top + 3; ForeColor(redColor); PaintRect(tempRect2); ForeColor(blackColor); tempRect2 := tempRect; {draw bottom marker under tile} tempRect2.bottom := tempRect2.bottom + 5; tempRect2.top := tempRect2.bottom - 3; ForeColor(redColor); PaintRect(tempRect2); ForeColor(blackColor); end; end; {=================================} procedure DoRoomBackInfo; const okayBut = 1; cancelBut = 2; backIcon1 = 3; backIcon10 = 12; backStat = 13; tileStat = 14; var wasPort: GrafPtr; leaveDlg: Boolean; theDlgPtr: DialogPtr; tempRect, wasRect: Rect; cntlType, i, i2, itemHit, tempInt, rightOff, downOff: Integer; dlgItem: Handle; strTemp: Str255; backName: array[0..9] of string[18]; thePict: PicHandle; tempRoom: roomData; {-------------------------} procedure Redraw; var i, width: Integer; tempByte: SignedByte; begin SetPort(theDlgPtr); {Point to our dialog window} GetDItem(theDlgPtr, okayBut, cntlType, dlgItem, tempRect);{Get the item handle} PenSize(3, 3); {Change pen to draw thick default outline} InsetRect(tempRect, -4, -4); {Draw outside the button by 1 pixel} FrameRoundRect(tempRect, 16, 16); {Draw the outline} GetDItem(theDlgPtr, backNumber + backIcon1, cntlType, dlgItem, tempRect); PenSize(2, 2); InsetRect(tempRect, -2, -2); ForeColor(redColor); FrameRect(tempRect); ForeColor(blackColor); wasRect := tempRect; PenNormal; with theDlgPtr^.portRect do width := right - left; MoveTo(4, 38); Line(width - 8, 0); MoveTo(4, 40); Line(width - 8, 0); for i := 0 to 7 do begin SetRect(tempRect, 0, 0, 8, 49); OffsetRect(tempRect, 111 + (i * 8), 83); thePict := GetPicture(300 + tempTile[i] + (backNumber * 8)); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, tempRect); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrGraphicLoad); end; ReleaseResource(Handle(thePict)); end; for i := 0 to 7 do begin SetRect(tempRect, 0, 0, 8, 49); OffsetRect(tempRect, 17 + (i * 8), 83); thePict := GetPicture(300 + i + (backNumber * 8)); if (thePict <> nil) then begin tempByte := HGetState(Handle(thePict)); HLock(Handle(thePict)); DrawPicture(thePict, tempRect); HSetState(Handle(thePict), tempByte); end else begin GenericAlert(kErrGraphicLoad); end; ReleaseResource(Handle(thePict)); end; ForeColor(redColor); SetRect(tempRect, 15, 81, 83, 134); FrameRect(tempRect); ForeColor(blueColor); SetRect(tempRect, 109, 81, 177, 134); FrameRect(tempRect); ForeColor(blackColor); end; {-------------------------} begin GetPort(wasPort); theDlgPtr := GetNewDialog(roomBackID, nil, Pointer(-1)); if (theDlgPtr = nil) then begin GenericAlert(kErrLoadingRes); Exit(DoRoomBackInfo); end; with theDlgPtr^.portBits do begin rightOff := rightOffset - bounds.left; downOff := downOffset - bounds.top; end; MoveWindow(theDlgPtr, rightOff, downOff, FALSE); ShowWindow(theDlgPtr); SelectWindow(theDlgPtr); SetPort(theDlgPtr); backName[0] := 'Plain Room'; backName[1] := 'Paneled Room'; backName[2] := 'Basement'; backName[3] := 'Japanese Room'; backName[4] := 'Childs Room'; backName[5] := 'Unfinished Room'; backName[6] := 'Hip Wallpaper'; backName[7] := 'Entertainment'; backName[8] := 'Bathroom'; backName[9] := 'Kitchen'; tempRoom := thisRoom; with tempRoom do begin backNumber := backPictID - 200; for i := 0 to 7 do tempTile[i] := tileOrder[i]; GetDItem(theDlgPtr, backStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, backName[backNumber]); end; if (not shouldOpen) then HideDItem(theDlgPtr, cancelBut); Redraw; leaveDlg := FALSE; shouldOpen := FALSE; repeat ModalDialog(@roomFltr, itemHit); GetDItem(theDlgPtr, itemHit, cntlType, dlgItem, tempRect); for i := backIcon1 to backIcon10 do if (itemHit = i) then begin PenSize(2, 2); PenPat(white); FrameRect(wasRect); GetDItem(theDlgPtr, i, cntlType, dlgItem, tempRect); InsetRect(tempRect, -2, -2); PenPat(black); ForeColor(redColor); FrameRect(tempRect); ForeColor(blackColor); wasRect := tempRect; PenNormal; backNumber := i - backIcon1; GetDItem(theDlgPtr, backStat, cntlType, dlgItem, tempRect); SetIText(dlgItem, backName[backNumber]); tempRoom.backPictID := backNumber + 200; for i2 := 0 to 7 do case backNumber of 0..3, 5: tempTile[i2] := 0; otherwise tempTile[i2] := i2 end; Redraw; end; if (itemHit = okayBut) then begin leaveDlg := TRUE; changed := TRUE; with tempRoom do begin for i := 0 to 7 do begin tileOrder[i] := tempTile[i]; end; case backPictId of 200..203, 205: begin if (tileOrder[0] = 6) then {don't allow backward walls} tileOrder[0] := 0; if (tileOrder[7] = 7) then tileOrder[7] := 0; if (tileOrder[0] = 7) then {check left open} leftOpen := FALSE else leftOpen := TRUE; if (tileOrder[7] = 6) then {check right open} rightOpen := FALSE else rightOpen := TRUE; for i := 1 to 6 do {don't allow walls in the middle} if ((tileOrder[i] = 6) or (tileOrder[i] = 7)) then begin SysBeep(1); tileOrder[i] := 0; end; end; otherwise begin leftOpen := TRUE; rightOpen := TRUE; end; end; {end - case} if (roomAt = 1) then leftOpen := FALSE; end; {end - with} if (leaveDlg) then begin thisRoom := tempRoom; end; end; if (itemHit = cancelBut) then begin if (thisHouse.numberORooms < 1) then shouldOpen := TRUE; leaveDlg := TRUE; end; until leaveDlg; DisposDialog(theDlgPtr); if (toolWndo <> nil) then SetPort(toolWndo) else SetPort(wasPort); end; {=================================} {=================================} procedure DoRoomCondInfo; const inactive = 255; active = 0; okayBut = 1; cancelBut = 2; normalRadio = 3; lightsRadio = 5; nothingRadio = 6; dartsRadio = 9; numOfEdit = 10; delayEdit = 11; nameEdit = 12; objectsStat = 13; roomNumStat = 14; var leaveDlg: Boolean; theDlgPtr: DialogPtr; tempRect, wasRect: Rect; cntlType, itemHit, tempInt, rightOff, downOff, i: Integer; tempLong: LongInt; dlgItem: Handle; strTemp: Str255; wasPort: GrafPtr; tempRoom: roomData; {-------------------------} procedure Redraw; var width: Integer; begin SetPort(theDlgPtr); {Point to our dialog window} GetDItem(theDlgPtr, okayBut, cntlType, dlgItem, tempRect);{Get the item handle} PenSize(3, 3); {Change pen to draw thick default outline} InsetRect(tempRect, -4, -4); {Draw outside the button by 1 pixel} FrameRoundRect(tempRect, 16, 16); {Draw the outline} PenNormal; with theDlgPtr^.portRect do width := right - left; MoveTo(4, 38); Line(width - 8, 0); MoveTo(4, 40); Line(width - 8, 0); end; {-------------------------} begin GetPort(wasPort); theDlgPtr := GetNewDialog(roomCondID, nil, Pointer(-1)); if (theDlgPtr = nil) then begin GenericAlert(kErrLoadingRes); Exit(DoRoomCondInfo); end; with theDlgPtr^.portBits do begin rightOff := rightOffset - bounds.left; downOff := downOffset - bounds.top; end; MoveWindow(theDlgPtr, rightOff, downOff, FALSE); ShowWindow(theDlgPtr); SelectWindow(theDlgPtr); SetPort(theDlgPtr); tempRoom := thisRoom; with tempRoom do begin {pop name of room into edit text field} GetDItem(theDlgPtr, nameEdit, cntlType, dlgItem, tempRect); strTemp := roomName; SetIText(dlgItem, strTemp); {pop the room number as static text} GetDItem(theDlgPtr, roomNumStat, cntlType, dlgItem, tempRect); NumToString(roomAt, strTemp); SetIText(dlgItem, strTemp); {pop up number of animates into edit text field} GetDItem(theDlgPtr, numOfEdit, cntlType, dlgItem, tempRect); NumToString(animateNumber, strTemp); SetIText(dlgItem, strTemp); {pop up delay - convert to seconds} GetDItem(theDlgPtr, delayEdit, cntlType, dlgItem, tempRect); NumToString(animateDelay, strTemp); SetIText(dlgItem, strTemp); {pop up number of objects as static text} GetDItem(theDlgPtr, objectsStat, cntlType, dlgItem, tempRect); NumToString(numberOObjects, strTemp); SetIText(dlgItem, strTemp); {select radio button representing animate kind} if (animateNumber > 0) then begin tempInt := 9 - animateKind; GetDItem(theDlgPtr, tempInt, cntlType, dlgItem, tempRect); SetCtlValue(ControlHandle(dlgItem), 1); end else begin GetDItem(theDlgPtr, nothingRadio, cntlType, dlgItem, tempRect); SetCtlValue(ControlHandle(dlgItem), 1); end; {select radio button representing condition of room} GetDItem(theDlgPtr, conditionCode + 3, cntlType, dlgItem, tempRect); SetCtlValue(ControlHandle(dlgItem), 1); {decide whether or not to gray out cancel button} if (not shouldOpen) then begin GetDItem(theDlgPtr, cancelBut, cntlType, dlgItem, tempRect); HiliteControl(ControlHandle(dlgItem), inactive); end; end; {end - with tempRoom do} {select the name of the room} SelIText(theDlgPtr, nameEdit, 0, 24); Redraw; leaveDlg := FALSE; shouldOpen := FALSE; repeat ModalDialog(nil, itemHit); GetDItem(theDlgPtr, itemHit, cntlType, dlgItem, tempRect); for i := normalRadio to lightsRadio do if (itemHit = i) then begin for tempInt := normalRadio to lightsRadio do begin GetDItem(theDlgPtr, tempInt, cntlType, dlgItem, tempRect); SetCtlValue(ControlHandle(dlgItem), 0); end; GetDItem(theDlgPtr, i, cntlType, dlgItem, tempRect); SetCtlValue(ControlHandle(dlgItem), 1); tempRoom.conditionCode := i - normalRadio; end; for i := nothingRadio to dartsRadio do if (itemHit = i) then begin for tempInt := nothingRadio to dartsRadio do begin GetDItem(theDlgPtr, tempInt, cntlType, dlgItem, tempRect); SetCtlValue(ControlHandle(dlgItem), 0); end; GetDItem(theDlgPtr, i, cntlType, dlgItem, tempRect); SetCtlValue(ControlHandle(dlgItem), 1); if (itemHit = nothingRadio) then begin tempRoom.animateNumber := 0; GetDItem(theDlgPtr, numOfEdit, cntlType, dlgItem, tempRect); NumToString(tempRoom.animateNumber, strTemp); SetIText(dlgItem, strTemp); end else begin tempRoom.animateKind := 9 - i; end; end; if (itemHit = okayBut) then begin leaveDlg := TRUE; with tempRoom do begin GetDItem(theDlgPtr, numOfEdit, cntlType, dlgItem, tempRect); GetIText(dlgItem, strTemp); {Get the text entered} StringToNum(strTemp, tempLong); tempRoom.animateNumber := LoWord(tempLong); if (tempRoom.animateNumber < 0) then begin SysBeep(1); leaveDlg := FALSE; tempInt := -tempRoom.animateNumber; if (tempInt > 16) then tempInt := 16; NumToString(tempInt, strTemp); SetIText(dlgItem, strTemp); end; if (tempRoom.animateNumber > 16) then begin SysBeep(1); leaveDlg := FALSE; NumToString(16, strTemp); SetIText(dlgItem, strTemp); end; GetDItem(theDlgPtr, delayEdit, cntlType, dlgItem, tempRect); GetIText(dlgItem, strTemp); {Get the text entered} StringToNum(strTemp, tempLong); tempRoom.animateDelay := LoWord(tempLong); if (tempRoom.animateDelay < 0) then begin SysBeep(1); leaveDlg := FALSE; tempInt := -tempRoom.animateDelay; if (tempInt > 16) then tempInt := 16; NumToString(tempInt, strTemp); SetIText(dlgItem, strTemp); end; GetDItem(theDlgPtr, nameEdit, cntlType, dlgItem, tempRect); GetIText(dlgItem, strTemp); {Get the text entered} if (LENGTH(strTemp) > 24) then strTemp := COPY(strTemp, 1, 24); tempRoom.roomName := strTemp; end; {end - with tempRoom} if (leaveDlg) then begin changed := TRUE; thisRoom := tempRoom; DrawRoomNum; end; end; if (itemHit = cancelBut) then begin if (thisHouse.numberORooms < 1) then shouldOpen := TRUE; leaveDlg := TRUE; end; until leaveDlg; DisposDialog(theDlgPtr); if (toolWndo <> nil) then SetPort(toolWndo) else SetPort(wasPort); end; {=================================} end. \ No newline at end of file diff --git a/RoomEditor_103/Sources/E-TheMenus.p b/RoomEditor_103/Sources/E-TheMenus.p new file mode 100755 index 0000000..8bdd7ea --- /dev/null +++ b/RoomEditor_103/Sources/E-TheMenus.p @@ -0,0 +1 @@ +unit TheMenus; interface uses Balloons, Palettes, About, Globals, Utilities, Drawing, HouseStuff, RoomStuff, ObjectStuff, FileInNOut, FlyGlider; procedure DoNewHouse; procedure DoOpenHouse; procedure DoPrevRoom; procedure DoNextRoom; procedure DoNewRoom; function DoSaveHouse: Boolean; function DoSaveHouseAs: Boolean; procedure DoClear; procedure HandleMenu (theMenu, theItem: integer); {=================================} implementation {=================================} procedure DoTest; begin end; {=================================} procedure DoOpenHouse; var canceled: Boolean; begin if (not DoOpen) then begin DoNewHouse; Exit(DoOpenHouse); end; ErrorCheckHouse; changed := FALSE; roomAt := 1; thisRoom := thisHouse.theRooms[roomAt]; EnableItem(GetMenu(mFile), iSave); EnableItem(GetMenu(mFile), iSaveAs); oneActive := 0; handleRect := nullRect; LoadABackground(thisRoom.backPictID); UpdateMenuItems(fileExists); UpdateMenuItems(editToRoom); DrawAllObjects; DrawRoomNum; OpenTools; end; {=================================} procedure DoNewHouse; var cancelIt: Boolean; index: Integer; begin roomAt := 1; FlushRoom(thisRoom); with thisHouse do begin version := $0100; numberORooms := 0; for index := 0 to 19 do begin hiScores[index] := 0; hiLevel[index] := 0; hiName[index] := 'no one...'; hiRoom[index] := 'no room...'; end; pictFile := resourceName; nextFile := ''; firstFile := ''; theRooms[roomAt] := thisRoom; end; changed := FALSE; oneActive := 0; handleRect := nullRect; thisHouse.numberORooms := 1; cancelIt := FALSE; DoRoomBackInfo(cancelIt); LoadABackground(thisRoom.backPictID); UpdateMenuItems(fileIsNew); UpdateMenuItems(editToRoom); OpenTools; end; {=================================} procedure DoMenuClose; const saveBut = 1; cancelBut = 6; var buttonClicked: Integer; dummyBool: Boolean; begin Deselect; if (changed) then begin buttonClicked := SaveNoClose; if (buttonClicked = saveBut) then begin thisHouse.theRooms[roomAt] := thisRoom; if (fileIsOpen) then begin if (not DoSaveHouse) then begin dummyBool := DoClose; Exit(DoMenuClose); end; dummyBool := DoClose; end else begin if (not DoSaveHouseAs) then Exit(DoMenuClose); end; end else if (buttonClicked = cancelBut) then begin Exit(DoMenuClose); end else dummyBool := DoClose; end else dummyBool := DoClose; FlushRoom(thisRoom); roomAt := 0; changed := FALSE; SetPort(GrafPtr(mainWndo)); EraseRect(wholeArea); if (inColor) then SetPort(GrafPtr(loadCPtr)) else SetPort(offLoadPort); EraseRect(wholeArea); if (inColor) then SetPort(GrafPtr(virginCPtr)) else SetPort(offVirginPort); EraseRect(wholeArea); CloseTools; UpdateMenuItems(noFileOpen); end; {=================================} procedure DoGoToRoom; var wasRoom: Integer; begin thisHouse.theRooms[roomAt] := thisRoom; wasRoom := roomAt; DoGotoDial; if (wasRoom <> roomAt) then begin thisRoom := thisHouse.theRooms[roomAt]; Deselect; LoadABackground(thisRoom.backPictID); DrawAllObjects; DrawRoomNum; UpdateMenuItems(editToRoom); end; end; {=================================} procedure DoPrevRoom; begin thisHouse.theRooms[roomAt] := thisRoom; roomAt := roomAt - 1; if (roomAt < 1) then roomAt := thisHouse.numberORooms; thisRoom := thisHouse.theRooms[roomAt]; Deselect; LoadABackground(thisRoom.backPictID); DrawAllObjects; DrawRoomNum; UpdateMenuItems(editToRoom); end; {=================================} procedure DoNextRoom; begin thisHouse.theRooms[roomAt] := thisRoom; roomAt := roomAt + 1; if (roomAt > thisHouse.numberORooms) then roomAt := 1; thisRoom := thisHouse.theRooms[roomAt]; Deselect; LoadABackground(thisRoom.backPictID); DrawAllObjects; DrawRoomNum; UpdateMenuItems(editToRoom); end; {=================================} procedure DoNewRoom; var cancelIt: Boolean; begin thisHouse.theRooms[roomAt] := thisRoom; if (not InsertNewRoom) then begin Exit(DoNewRoom); end; cancelIt := TRUE; changed := TRUE; DoRoomBackInfo(cancelIt); LoadABackground(thisRoom.backPictID); DrawRoomNum; oneActive := 0; UpdateMenuItems(editToRoom); end; {=================================} function DoSaveHouse; var dummyBool: Boolean; begin thisHouse.theRooms[roomAt] := thisRoom; ErrorCheckHouse; dummyBool := DoSave; DoSaveHouse := dummyBool; end; {=================================} function DoSaveHouseAs; var dummyBool: Boolean; begin thisHouse.theRooms[roomAt] := thisRoom; ErrorCheckHouse; dummyBool := DoSaveAs; DoSaveHouseAs := dummyBool; end; {=================================} procedure DoQuit; const saveBut = 1; quitBut = 2; cancelBut = 6; var buttonClicked: Integer; dummyBool: Boolean; begin if (changed) then begin buttonClicked := SaveFirst; if (buttonClicked = saveBut) then begin if (fileIsOpen) then begin if DoSaveHouse then begin doneFlag := TRUE; dummyBool := DoClose; end else begin Exit(DoQuit); end; end else {else - file is NOT open} begin if DoSaveHouseAs then begin doneFlag := TRUE; dummyBool := DoClose; end else Exit(DoQuit); end; end else if (buttonClicked = quitBut) then begin if (fileIsOpen) then dummyBool := DoClose; doneFlag := TRUE; end else if (buttonClicked = cancelBut) then Exit(DoQuit); end {end - if changed} else {else - no changes} begin if (fileIsOpen) then dummyBool := DoClose; doneFlag := TRUE; end; end; {=================================} procedure DoHelp; var aboutStuff: AboutRec; tempR: Rect; wasPort: GrafPtr; begin GetPort(wasPort); SetPort(GrafPtr(mainWndo)); with aboutStuff do begin FontInfo[AboutMsg].Font := 0; FontInfo[AboutMsg].Size := 0; FontInfo[AboutMsg].Face := []; FontInfo[AboutMsg].Color := RedColor; FontInfo[AboutTEXT].Font := 1; FontInfo[AboutTEXT].Size := 9; FontInfo[AboutTEXT].Face := []; FontInfo[AboutTEXT].Color := BlueColor; TEXTCopy := TRUE; KeyEquivs := TRUE; CloseBox := FALSE; Styled := TRUE; CenterMode := AboutMainCenter; MainIcon := 128; ClickIcon := 129; ClickMsg := 'by john calhoun 1991 Casady & Greene, Inc.'; end; SetRect(tempR, 12, 30, 500, 332); OffsetRect(tempR, rightOffset, downOffset); BuildAbout(tempR, DBoxProc, 128, 'Editor Help', 'Room Editor 1.0 - General Help', aboutStuff); SetPort(wasPort); end; {=================================} procedure DoCut; var cancelIt: Boolean; begin if (editRoom) then {no object selected} begin {so, cut whole room} if (not DeleteRoom) then begin scrapRoom := thisRoom; {store room just cut} FlushRoom(thisRoom); {flush it} cancelIt := FALSE; {force user to create a room} DoRoomBackInfo(cancelIt); end else begin roomScrapDirty := TRUE; objectScrapDirty := FALSE; SetItem(GetMenu(mEdit), iPaste, 'Paste Room'); EnableItem(GetMenu(mEdit), iPaste); scrapRoom := thisRoom; thisRoom := thisHouse.theRooms[roomAt]; end; LoadABackground(thisRoom.backPictID); {load the new room in} oneActive := 0; {insure no active object} handleRect := nullRect; DrawAllObjects; DrawRoomNum; changed := TRUE; end else begin objectScrapDirty := TRUE; roomScrapDirty := FALSE; SetItem(GetMenu(mEdit), iPaste, 'Paste Object'); EnableItem(GetMenu(mEdit), iPaste); scrapObject := thisRoom.theObjects[oneActive]; thisRoom.theObjects[oneActive].objectIs := 0; Deselect; {Sort will set correct # of objects} SortObjects; {0-ing out the type will kill it in the sort routine} DrawAllObjects; changed := TRUE; end; end; {=================================} procedure DoCopy; begin if (editRoom) then begin scrapRoom := thisRoom; roomScrapDirty := TRUE; objectScrapDirty := FALSE; SetItem(GetMenu(mEdit), iPaste, 'Paste Room'); EnableItem(GetMenu(mEdit), iPaste); end else begin scrapObject := thisRoom.theObjects[oneActive]; objectScrapDirty := TRUE; roomScrapDirty := FALSE; SetItem(GetMenu(mEdit), iPaste, 'Paste Object'); EnableItem(GetMenu(mEdit), iPaste); end; end; {=================================} procedure DoPaste; begin if (roomScrapDirty) then begin if (not InsertRoom) then Exit(DoPaste); LoadABackground(thisRoom.backPictID); {draw the pasted room in} oneActive := 0; {insure no active object} handleRect := nullRect; DrawAllObjects; DrawRoomNum; changed := TRUE; end else begin if (InsertObject) then begin SortObjects; DrawAllObjects; changed := TRUE; end else Exit(DoPaste); end; end; {=================================} procedure DoClear; var cancelIt: Boolean; begin if (editRoom) then begin if (not DeleteRoom) then begin FlushRoom(thisRoom); {flush it} cancelIt := FALSE; {force user to create a room} DoRoomBackInfo(cancelIt); end else begin thisRoom := thisHouse.theRooms[roomAt]; end; LoadABackground(thisRoom.backPictID); {load the new room in} oneActive := 0; {insure no active object} handleRect := nullRect; DrawAllObjects; DrawRoomNum; changed := TRUE; end else begin thisRoom.theObjects[oneActive].objectIs := 0; Deselect; SortObjects; DrawAllObjects; changed := TRUE; end; end; {=================================} procedure HandleMenu; {Handle menu selections realtime} var DNA, holdActive, i: integer; DAName: Str255; SavePort: GrafPtr; boolHolder, cancelIt: boolean; begin case theMenu of mApple: case theItem of iNothing: ; iAboutEdit: DoAbout; otherwise begin GetPort(SavePort); GetItem(GetMenu(mApple), theItem, DAName); DNA := OpenDeskAcc(DAName); SetPort(SavePort); end; end; mFile: case theItem of {Handle all commands in this menu list} iNew: DoNewHouse; iOpen: DoOpenHouse; iClose: DoMenuClose; iSave: cancelIt := DoSaveHouse; iSaveAs: cancelIt := DoSaveHouseAs; iQuit: DoQuit; otherwise end; mEdit: case theItem of {Handle all commands in this menu list} iCut: DoCut; iCopy: DoCopy; iPaste: DoPaste; iClear: DoClear; otherwise ; end; mSpecial: case theItem of {Handle all commands in this menu list} iTryGlider: FlyGlider; iControls: ; iRestoreDeep: begin restoreColor := not restoreColor; if (restoreColor) then SetItem(GetMenu(mSpecial), iRestoreDeep, 'Depth Restore is On') else SetItem(GetMenu(mSpecial), iRestoreDeep, 'Depth Restore is Off'); end; iGoToRoom: DoGoToRoom; iNextRoom: DoNextRoom; iPrevRoom: DoPrevRoom; iNewRoom: DoNewRoom; otherwise ; end; mWindows: case theItem of {Handle all commands in this menu list} iTools: OpenTools; iAutoHideTools: begin autoHide := not autoHide; if (autoHide) then SetItem(GetMenu(mWindows), iAutoHideTools, 'Auto-Hide Tools is On') else SetItem(GetMenu(mWindows), iAutoHideTools, 'Auto-Hide Tools is Off'); end; iHouse: DoHouseInfo; iRoomBack: begin cancelIt := TRUE; DoRoomBackInfo(cancelIt); LoadABackground(thisRoom.backPictID); DrawAllObjects; end; iRoomCond: begin cancelIt := TRUE; DoRoomCondInfo(cancelIt); DrawAllObjects; end; iObject: DoObjectInfo; iHelp: DoHelp; otherwise end; mControls: case theItem of iHoldKey..iRelMouse: begin for i := iHoldkey to iRelMouse do CheckItem(GetMenu(mControls), i, FALSE); CheckItem(GetMenu(mControls), theItem, TRUE); controlMethod := theItem; end; iConfigure: DoCustomizeKeys; otherwise end; kHMHelpMenuID: if (theItem = iGlidersHelp) then DoHelp; otherwise end; HiliteMenu(0); end; {=================================} end. {End of unit} \ No newline at end of file diff --git a/RoomEditor_103/Sources/E-Utilities.p b/RoomEditor_103/Sources/E-Utilities.p new file mode 100755 index 0000000..d47f6d9 --- /dev/null +++ b/RoomEditor_103/Sources/E-Utilities.p @@ -0,0 +1 @@ +unit Utilities; interface uses Palettes, Globals; procedure SpinBall; function SameScreenDepth: Boolean; function DoRandom (range: Integer): Integer; procedure UpdateMenuItems (whatMode: Integer); procedure Select; procedure Deselect; procedure DoMarquee; procedure GenericAlert (whatGives: Integer); function ErrorCheckObject (var wasObject: objectData; var errorType: Integer): Boolean; procedure DoCustomizeKeys; function idleFilter (theDialog: DialogPtr; var theEvent: EventRecord; var itemHit: integer): boolean; procedure DoAbout; {=================================} implementation {=================================} var screenNum: Integer; timeWas: LongInt; {=================================} procedure SpinBall; var tempByte: SignedByte; begin if (ballList = nil) then Exit(SpinBall); tempByte := HGetState(Handle(ballList)); HLock(Handle(ballList)); with ballList^^ do begin if (whichBall = -1) then Exit(SpinBall); if (whichBall >= kCursCount) then whichBall := 1 else whichBall := whichBall + 1; if (useColorCursor) then SetCCursor(ballC[whichBall]) else SetCursor(ball[whichBall]^^); end; HSetState(Handle(ballList), tempByte); end; {=================================} function SameScreenDepth; var err: OSErr; thisWorld: SysEnvRec; theDevice: GDHandle; begin SameScreenDepth := TRUE; err := SysEnvirons(1, thisWorld); with thisWorld do begin if (hasColorQD) then begin theDevice := GetMainDevice; HLock(Handle(theDevice)); if ((inColor) and (theDevice^^.gdPMap^^.pixelSize <> 4)) then SameScreenDepth := FALSE else if ((not inColor) and (theDevice^^.gdPMap^^.pixelSize <> 1)) then SameScreenDepth := FALSE; HUnlock(Handle(theDevice)); end; {end - hasColorQD} end; {with thisWorld} end; {=================================} function DoRandom; var rawResult: LongInt; begin rawResult := ABS(Random); DoRandom := (rawResult * range) div 32768; end; {=================================} procedure UpdateMenuItems; begin case whatMode of editToObject: begin SetItem(GetMenu(mEdit), iCut, 'Cut Object'); SetItem(GetMenu(mEdit), iCopy, 'Copy Object'); SetItem(GetMenu(mEdit), iPaste, 'Paste Object'); DisableItem(GetMenu(mEdit), iPaste); SetItem(GetMenu(mEdit), iClear, 'Clear Object'); editRoom := FALSE; if (objectScrapDirty) then EnableItem(GetMenu(mEdit), iPaste) else if (roomScrapDirty) then begin SetItem(GetMenu(mEdit), iPaste, 'Paste Room'); EnableItem(GetMenu(mEdit), iPaste); end; end; editToRoom: begin SetItem(GetMenu(mEdit), iCut, 'Cut Room'); SetItem(GetMenu(mEdit), iCopy, 'Copy Room'); SetItem(GetMenu(mEdit), iPaste, 'Paste Room'); DisableItem(GetMenu(mEdit), iPaste); SetItem(GetMenu(mEdit), iClear, 'Clear Room'); editRoom := TRUE; if (roomScrapDirty) then EnableItem(GetMenu(mEdit), iPaste) else if (objectScrapDirty) then begin SetItem(GetMenu(mEdit), iPaste, 'Paste Object'); EnableItem(GetMenu(mEdit), iPaste); end; end; fileExists: begin DisableItem(GetMenu(mFile), iNew); DisableItem(GetMenu(mFile), iOpen); EnableItem(GetMenu(mFile), iClose); EnableItem(GetMenu(mFile), iSave); EnableItem(GetMenu(mFile), iSaveAs); EnableItem(GetMenu(mEdit), iCut); EnableItem(GetMenu(mEdit), iCopy); EnableItem(GetMenu(mEdit), iClear); if (roomScrapDirty) then EnableItem(GetMenu(mEdit), iPaste) else if (objectScrapDirty) then begin SetItem(GetMenu(mEdit), iPaste, 'Paste Object'); EnableItem(GetMenu(mEdit), iPaste); end; EnableItem(GetMenu(mSpecial), iTryGlider); EnableItem(GetMenu(mSpecial), iGoToRoom); EnableItem(GetMenu(mSpecial), iPrevRoom); EnableItem(GetMenu(mSpecial), iNextRoom); EnableItem(GetMenu(mSpecial), iNewRoom); EnableItem(GetMenu(mWindows), iTools); EnableItem(GetMenu(mWindows), iHouse); EnableItem(GetMenu(mWindows), iRoomBack); EnableItem(GetMenu(mWindows), iRoomCond); DisableItem(GetMenu(mWindows), iObject); end; fileIsNew: begin DisableItem(GetMenu(mFile), iNew); DisableItem(GetMenu(mFile), iOpen); EnableItem(GetMenu(mFile), iClose); DisableItem(GetMenu(mFile), iSave); EnableItem(GetMenu(mFile), iSaveAs); EnableItem(GetMenu(mEdit), iCut); EnableItem(GetMenu(mEdit), iCopy); EnableItem(GetMenu(mEdit), iClear); if (roomScrapDirty) then EnableItem(GetMenu(mEdit), iPaste) else if (objectScrapDirty) then begin SetItem(GetMenu(mEdit), iPaste, 'Paste Object'); EnableItem(GetMenu(mEdit), iPaste); end; EnableItem(GetMenu(mSpecial), iTryGlider); EnableItem(GetMenu(mSpecial), iGoToRoom); EnableItem(GetMenu(mSpecial), iPrevRoom); EnableItem(GetMenu(mSpecial), iNextRoom); EnableItem(GetMenu(mSpecial), iNewRoom); EnableItem(GetMenu(mWindows), iTools); EnableItem(GetMenu(mWindows), iHouse); EnableItem(GetMenu(mWindows), iRoomBack); EnableItem(GetMenu(mWindows), iRoomCond); DisableItem(GetMenu(mWindows), iObject); end; noFileOpen: begin EnableItem(GetMenu(mFile), iNew); EnableItem(GetMenu(mFile), iOpen); DisableItem(GetMenu(mFile), iClose); DisableItem(GetMenu(mFile), iSave); DisableItem(GetMenu(mFile), iSaveAs); DisableItem(GetMenu(mEdit), iCut); DisableItem(GetMenu(mEdit), iCopy); DisableItem(GetMenu(mEdit), iPaste); DisableItem(GetMenu(mEdit), iClear); DisableItem(GetMenu(mSpecial), iTryGlider); DisableItem(GetMenu(mSpecial), iGoToRoom); DisableItem(GetMenu(mSpecial), iPrevRoom); DisableItem(GetMenu(mSpecial), iNextRoom); DisableItem(GetMenu(mSpecial), iNewRoom); DisableItem(GetMenu(mWindows), iTools); DisableItem(GetMenu(mWindows), iHouse); DisableItem(GetMenu(mWindows), iRoomBack); DisableItem(GetMenu(mWindows), iRoomCond); DisableItem(GetMenu(mWindows), iObject); end; otherwise ; end; end; {=================================} procedure Select; begin if (oneActive = 0) then begin DisableItem(GetMenu(mWindows), iObject); Exit(Select); end; EnableItem(GetMenu(mWindows), iObject); SetPort(GrafPtr(mainWndo)); ClipRect(wholeArea); PenNormal; PenMode(patXOr); PenPat(marqueePat[4]); {Initial set-up pattern for marquee} FrameRect(thisRoom.theObjects[oneActive].boundRect); marqueeIndex := 0; {Start marquee pats at pat 1} marqueeTime := TRUE; with thisRoom.theObjects[oneActive] do begin case (objectIs) of {Pop the handle out} table, shelf: begin SetPt(startPt, boundRect.right, (boundRect.top + boundRect.bottom) div 2); SetPt(endPt, boundRect.right + 4, (boundRect.top + boundRect.bottom) div 2); end; cabnet, extRct, obsRct, bnsRct, window, mirror: begin SetPt(startPt, boundRect.right, boundRect.bottom); SetPt(endPt, boundRect.right + 4, boundRect.bottom + 4); end; flrVnt, candle, ball, fshBwl, toastr: begin SetPt(startPt, (boundRect.left + boundRect.right) div 2, boundRect.top - 1); SetPt(endPt, (boundRect.left + boundRect.right) div 2, amount); end; celVnt, celDct, drip: begin SetPt(startPt, (boundRect.left + boundRect.right) div 2, boundRect.bottom + 1); SetPt(endPt, (boundRect.left + boundRect.right) div 2, amount); end; lftFan: begin SetPt(startPt, boundRect.left - 1, (boundRect.top + boundRect.bottom) div 2); SetPt(endPt, amount, (boundRect.top + boundRect.bottom) div 2); end; ritFan, grease: begin SetPt(startPt, boundRect.right + 1, (boundRect.top + boundRect.bottom) div 2); SetPt(endPt, amount, (boundRect.top + boundRect.bottom) div 2); end; otherwise begin SetPt(startPt, -500, -500); SetPt(endPt, -499, -499); end; end; {End of case} end; {End of with} SetRect(handleRect, endPt.h - 3, endPt.v - 3, endPt.h + 3, endPt.v + 3); MoveTo(startPt.h, startPt.v); LineTo(endPt.h, endPt.v); PaintRect(handleRect); PenNormal; if (toolWndo <> nil) then SetPort(toolWndo); end; {=================================} procedure Deselect; begin DisableItem(GetMenu(mWindows), iObject); if (oneActive = 0) then begin Exit(Deselect); end; repeat DoMarquee; until (marqueeIndex = 0); SetPort(GrafPtr(mainWndo)); PenMode(patXOr); PenPat(marqueePat[4]); FrameRect(thisRoom.theObjects[oneActive].boundRect); MoveTo(startPt.h, startPt.v); LineTo(endPt.h, endPt.v); PaintRect(handleRect); PenNormal; oneActive := 0; handleRect := nullRect; if (toolWndo <> nil) then SetPort(toolWndo); marqueeTime := FALSE; end; {=================================} procedure DoMarquee; var dummyLong: LongInt; begin Delay(2, dummyLong); SetPort(GrafPtr(mainWndo)); PenNormal; PenMode(patXOr); PenPat(marqueePat[marqueeIndex]); FrameRect(thisRoom.theObjects[oneActive].boundRect); MoveTo(startPt.h, startPt.v); LineTo(endPt.h, endPt.v); PaintRect(handleRect); marqueeIndex := marqueeIndex + 1; if (marqueeIndex > 3) then marqueeIndex := 0; if (toolWndo <> nil) then SetPort(toolWndo); end; {=================================} procedure GenericAlert; var dummyInt: Integer; line1, line2: Str255; alertHandle: AlertTHndl; alertRect: Rect; begin UseResFile(editorResNum); InitCursor; if (whatGives > 0) then begin GetIndString(line1, alertStrIDs, whatGives); line2 := ''; end else begin GetIndString(line1, alertStrIDs, 1); NumToString(whatGives, line2); line2 := CONCAT('Error = ', line2); end; ParamText(line1, line2, '', ''); alertHandle := AlertTHndl(Get1Resource('ALRT', alertID)); if (alertHandle <> nil) then begin HNoPurge(Handle(alertHandle)); alertRect := alertHandle^^.boundsRect; OffsetRect(alertRect, -alertRect.left, -alertRect.top); dummyInt := (screenBits.bounds.right - alertRect.right) div 2; OffsetRect(alertRect, dummyInt, 0); dummyInt := (screenBits.bounds.bottom - alertRect.bottom) div 3; OffsetRect(alertRect, 0, dummyInt); alertHandle^^.boundsRect := alertRect; HPurge(Handle(alertHandle)); end; dummyInt := Alert(alertID, nil); end; {=================================} function ErrorCheckObject; const noError = 0; kindError = 1; boundError = 2; amountError = 3; extraError = 4; isOnError = 5; var inError: Boolean; {-----------------} procedure ShiftOrSet (var valueIs, otherValue: Integer; valueShould, objectType: Integer; upDown: Boolean); begin case objectType of {these objects are just set} table, shelf: if (upDown) then otherValue := otherValue + (valueShould - valueIs); cabnet, extRct, obsRct, bnsRct, window, mirror: ; otherwise {other objects are offset} otherValue := otherValue + (valueShould - valueIs); end; valueIs := valueShould; end; {-----------------} begin inError := FALSE; errorType := noError; with wasObject do begin case objectIs of nulObj..obsRct, flrVnt..ritFan, clock..rbrBnd: ; litSwt..guitar, drip..window, paintg..dnStar: ; otherwise begin objectIs := 0; inError := TRUE; errorType := kindError; end; end; {case - objectIs} with boundRect do begin if (left < 0) then begin ShiftOrSet(left, right, 0, objectIs, FALSE); inError := TRUE; errorType := boundError; end; if (left > (512 - 16)) then begin ShiftOrSet(left, right, 512 - 16, objectIs, FALSE); inError := TRUE; errorType := boundError; end; if (right > 512) then begin ShiftOrSet(right, left, 512, objectIs, FALSE); inError := TRUE; errorType := boundError; end; if (right < 16) then begin ShiftOrSet(right, left, 16, objectIs, FALSE); inError := TRUE; errorType := boundError; end; if (top < 0) then begin ShiftOrSet(top, bottom, 0, objectIs, TRUE); inError := TRUE; errorType := boundError; end; if (top > (342 - 16)) then begin ShiftOrSet(top, bottom, 342 - 16, objectIs, TRUE); inError := TRUE; errorType := boundError; end; if (bottom > 342) then begin ShiftOrSet(bottom, top, 342, objectIs, TRUE); inError := TRUE; errorType := boundError; end; if (bottom < 16) then begin ShiftOrSet(bottom, top, 16, objectIs, TRUE); inError := TRUE; errorType := boundError; end; end; {end - with boundRect} case objectIs of extRct, upStar, dnStar: if ((amount < 1) or (amount > 80)) then {room link must be 1..80} begin amount := roomAt; inError := TRUE; errorType := amountError; end; pwrSwt: if ((amount < 0) or (amount > 16)) then {object link must be 0..16} begin amount := 0; inError := TRUE; errorType := amountError; end; flrVnt, candle, toastr, ball, fshBwl: {air etc. column not too high} if ((amount < ceilingVert + 10) or (amount > boundRect.top)) then begin amount := ceilingVert + 10; inError := TRUE; errorType := amountError; end; celVnt, celDct, drip: {air etc. column not too low} if ((amount < boundRect.bottom) or (amount > floorVert)) then begin amount := floorVert; inError := TRUE; errorType := amountError; end; lftFan: {air column not too left} if ((amount < 0) or (amount > boundRect.left)) then begin amount := 0; inError := TRUE; errorType := amountError; end; ritFan, grease: {air etc. column not too right} if ((amount < boundRect.right) or (amount > 512)) then begin amount := 512; inError := TRUE; errorType := amountError; end; clock, paper, bnsRct: {points not too high or neg.} if ((amount < 0) or (amount > 10000)) then begin amount := 1000; inError := TRUE; errorType := amountError; end; battry, rbrBnd: {things not too high or neg.} if ((amount < 0) or (amount > 100)) then begin amount := 20; inError := TRUE; errorType := amountError; end; outlet, teaKtl: {delay not too high or neg.} if ((amount < 0) or (amount > 600)) then begin amount := 30; inError := TRUE; errorType := amountError; end; otherwise end; {case - objectIs} case objectIs of celDct: {room must be 1..80} if ((extra < 1) or (extra > 80)) then begin extra := roomAt; inError := TRUE; errorType := extraError; end; drip, fshBwl: if ((extra < 0) or (extra > 600)) then begin extra := 30; inError := TRUE; errorType := extraError; end; end; {case - objectIs} end; {end - with wasObject} ErrorCheckObject := inError; end; {=================================} procedure DoCustomizeKeys; const okayItem = 1; cancelItem = 2; leftIcon = 3; rightIcon = 4; energyIcon = 5; bandIcon = 6; leftStat = 7; rightStat = 8; energyStat = 9; bandStat = 10; modeStat = 11; energyRadio = 12; bandRadio = 13; type string12 = string[12]; var wasPort: GrafPtr; itemT, itemHit, i, rawKey, rawChar: Integer; newLeftKey, newRightKey, newEnergyKey, newBandKey: Integer; theState, tempLong: LongInt; tempStr: Str255; itemH, keyHandle: Handle; theDlgPtr: DialogPtr; tempRect: Rect; newLeftName, newRightName, newEnergyName, newBandName: string[12]; leaveDlg, newButtonFires: Boolean; {------------------} procedure RefreshIt; begin SetPort(theDlgPtr); GetDItem(theDlgPtr, okayItem, itemT, itemH, tempRect);{Get the item handle} PenSize(3, 3); {Change pen to draw thick default outline} InsetRect(tempRect, -4, -4); {Draw outside the button by 1 pixel} FrameRoundRect(tempRect, 16, 16); {Draw the outline} PenNormal; end; {------------------} function ShowKeyName (rawKeyCode, rawCharCode: Integer): string12; begin if ((rawCharCode >= $21) and (rawCharCode <= $7A)) then begin if ((rawKeyCode >= $41) and (rawKeyCode <= $5C)) then tempStr := CONCAT(CHR(rawCharCode), ' keypad') else tempStr := CONCAT(CHR(rawCharCode), ' key'); end else case rawCharCode of $01: tempStr := 'home'; $03: tempStr := 'enter'; $04: tempStr := 'end'; $05: tempStr := 'help'; $08: tempStr := 'delete'; $09: tempStr := 'tab'; $0B: tempStr := 'page up'; $0C: tempStr := 'page down'; $0D: tempStr := 'return'; $10: case rawKeyCode of $60: tempStr := 'F5 key'; $61: tempStr := 'F6 key'; $62: tempStr := 'F7 key'; $63: tempStr := 'F3 key'; $64: tempStr := 'F8 key'; $65: tempStr := 'F9 key'; $67: tempStr := 'F11 key'; $69: tempStr := 'F13 key'; $6B: tempStr := 'F14 key'; $6D: tempStr := 'F10 key'; $6F: tempStr := 'F12 key'; $71: tempStr := 'F15 key'; $76: tempStr := 'F4 key'; $78: tempStr := 'F2 key'; $7A: tempStr := 'F1 key'; otherwise NumToString(rawKeyCode, tempStr); end; $1A: tempStr := 'clear'; $1B: if (rawKeyCode = $47) then tempStr := 'clear' else tempStr := 'escape'; $1C: tempStr := 'left arrow'; $1D: tempStr := 'right arrow'; $1E: tempStr := 'up arrow'; $1F: tempStr := 'down arrow'; $20: tempStr := 'space'; $7F: tempStr := 'del key'; otherwise tempStr := 'unknown'; end; ShowKeyName := tempStr; end; {------------------} begin FlushEvents(EveryEvent, 0); GetPort(wasPort); UseResFile(editorResNum); theDlgPtr := GetNewDialog(rCustomKeysID, nil, Pointer(-1)); tempRect := theDlgPtr^.portRect; tempRect.Top := ((screenBits.Bounds.Bottom - screenBits.Bounds.Top) - (tempRect.Bottom - tempRect.Top)) div 2; tempRect.Left := ((screenBits.Bounds.Right - screenBits.Bounds.Left) - (tempRect.Right - tempRect.Left)) div 2; MoveWindow(theDlgPtr, tempRect.Left, tempRect.Top, TRUE);{Now move the window to the proper position} ShowWindow(theDlgPtr); SelectWindow(theDlgPtr); SetPort(theDlgPtr); newLeftKey := leftKey; newRightKey := rightKey; newEnergyKey := energyKey; newBandKey := bandKey; newButtonFires := buttonFires; newLeftName := leftName; newRightName := rightName; newEnergyName := energyName; newBandName := bandName; GetDItem(theDlgPtr, leftStat, itemT, itemH, tempRect); SetIText(itemH, newLeftName); GetDItem(theDlgPtr, rightStat, itemT, itemH, tempRect); SetIText(itemH, newRightName); GetDItem(theDlgPtr, energyStat, itemT, itemH, tempRect); SetIText(itemH, newEnergyName); GetDItem(theDlgPtr, bandStat, itemT, itemH, tempRect); SetIText(itemH, newBandName); if (newButtonFires) then GetDItem(theDlgPtr, bandRadio, itemT, itemH, tempRect) else GetDItem(theDlgPtr, energyRadio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 1); RefreshIt; leaveDlg := FALSE; repeat ModalDialog(nil, itemHit); GetDItem(theDlgPtr, itemHit, itemT, itemH, tempRect); if ((itemHit >= leftIcon) and (itemHit <= bandIcon)) then begin GetDItem(theDlgPtr, itemHit, itemT, itemH, tempRect); InvertRect(tempRect); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'The next key you strike will control this function.'); InvertRect(tempRect); repeat until not Button; FlushEvents(everyEvent, 0); repeat until GetNextEvent(keyDownMask, theEvent); rawKey := LoWord(BitAnd(KeyCodeMask, theEvent.message) div $FF); rawChar := LoWord(BitAnd(CharCodeMask, theEvent.message)); FlushEvents(everyEvent, 0); InvertRect(tempRect); GetDItem(theDlgPtr, itemHit, itemT, itemH, tempRect); InvertRect(tempRect); tempStr := ShowKeyName(rawKey, rawChar); GetDItem(theDlgPtr, itemHit + 4, itemT, itemH, tempRect); SetIText(itemH, tempStr); if (tempStr = 'tab') then begin SysBeep(3); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'The TAB key is reserved for pausing Glider.'); Delay(180, tempLong); case itemHit of leftIcon: tempStr := newLeftName; rightIcon: tempStr := newRightName; energyIcon: tempStr := newEnergyName; otherwise tempStr := newBandName; end; GetDItem(theDlgPtr, itemHit + 4, itemT, itemH, tempRect); SetIText(itemH, tempStr); end else case itemHit of leftIcon: begin newLeftKey := rawKey; newLeftName := COPY(tempStr, 1, 12); end; rightIcon: begin newRightKey := rawKey; newRightName := COPY(tempStr, 1, 12); end; energyIcon: begin newEnergyKey := rawKey; newEnergyName := COPY(tempStr, 1, 12); end; otherwise begin newBandKey := rawKey; newBandName := COPY(tempStr, 1, 12); end; end; GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Click on an icon to change its controlling key.'); end; if (itemHit = energyRadio) then begin newButtonFires := FALSE; GetDItem(theDlgPtr, energyRadio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 1); GetDItem(theDlgPtr, bandRadio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 0); end; if (itemHit = bandRadio) then begin newButtonFires := TRUE; GetDItem(theDlgPtr, bandRadio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 1); GetDItem(theDlgPtr, energyRadio, itemT, itemH, tempRect); SetCtlValue(ControlHandle(itemH), 0); end; if (itemHit = okayItem) then begin leaveDlg := TRUE; if ((newLeftKey = newRightKey) or (newLeftKey = newEnergyKey) or (newLeftKey = newBandKey)) then begin SysBeep(3); newLeftKey := leftKey; newLeftName := leftName; GetDItem(theDlgPtr, leftStat, itemT, itemH, tempRect); SetIText(itemH, newLeftName); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Your Left Key has been assigned to another function.'); Delay(180, tempLong); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Click on an icon to change its controlling key.'); leaveDlg := FALSE; end; if ((newRightKey = newEnergyKey) or (newRightKey = newBandKey)) then begin SysBeep(3); newRightKey := rightKey; newRightName := rightName; GetDItem(theDlgPtr, rightStat, itemT, itemH, tempRect); SetIText(itemH, newRightName); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Your Right Key has been assigned to another function.'); Delay(180, tempLong); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Click on an icon to change its controlling key.'); leaveDlg := FALSE; end; if (newEnergyKey = newBandKey) then begin SysBeep(3); newEnergyKey := energyKey; newEnergyName := energyName; GetDItem(theDlgPtr, energyStat, itemT, itemH, tempRect); SetIText(itemH, newEnergyName); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Your Energize Key has been assigned to another function.'); Delay(180, tempLong); GetDItem(theDlgPtr, modeStat, itemT, itemH, tempRect); SetIText(itemH, 'Click on an icon to change its controlling key.'); leaveDlg := FALSE; end; if (leaveDlg) then begin leftKey := newLeftKey; rightKey := newRightKey; energyKey := newEnergyKey; bandKey := newBandKey; buttonFires := newButtonFires; leftName := newLeftName; rightName := newRightName; energyName := newEnergyName; bandName := newBandName; end; end; if (ItemHit = cancelItem) then leaveDlg := TRUE; until leaveDlg; SetPort(GrafPtr(wasPort)); DisposDialog(theDlgPtr); end; {=================================} function idleFilter; var iconNum, iType: Integer; timeIs: LongInt; tempRect: Rect; iHand, icnHand: Handle; cicnHand: CIconHandle; begin idleFilter := FALSE; if ((theEvent.what = KeyDown) and (BitAnd(theEvent.message, CharCodeMask) = 13)) then begin itemHit := 1; idleFilter := TRUE; end; timeIs := TickCount; if (timeIs > timeWas + 90) then begin timeWas := TickCount; screenNum := screenNum + 1; if (screenNum > 3) then screenNum := 0; for iconNum := 2 to 10 do begin Delay(2, timeIs); GetDItem(theDialog, iconNum, iType, iHand, tempRect); if (inColor) then begin cicnHand := GetCIcon(1226 + iconNum + (screenNum * 9)); if (cicnHand <> nil) then begin PlotCIcon(tempRect, cicnHand); DisposCIcon(cicnHand); end; end else begin icnHand := GetIcon(1226 + iconNum + (screenNum * 9)); if (icnHand <> nil) then PlotIcon(tempRect, icnHand); end; end; {end - for iconnum} end; {end - if (timeIs } end; {=================================} procedure DoAbout; const okayButton = 1; var savePort: GrafPtr; ExitDialog: boolean; excessSpace, DType, Index, itemHit, temp: Integer; iTemp: LongInt; DItem: Handle; ThisEditText: TEHandle; CItem, CTempItem: controlhandle; GetSelection: DialogPtr; TheDialogPtr: DialogPeek; tempRect: Rect; {----------------------------------} procedure Refresh_Dialog; {Refresh the dialogs non-controls} var rTempRect: Rect; {Temp rectangle used for drawing} begin SetPort(GetSelection); {Point to our dialog window} GetDItem(GetSelection, okayButton, DType, DItem, tempRect);{Get the item handle} PenSize(3, 3); {Change pen to draw thick default outline} InsetRect(tempRect, -4, -4); {Draw outside the button by 1 pixel} FrameRoundRect(tempRect, 16, 16); {Draw the outline} PenSize(1, 1); {Restore the pen size to the default value} end; {----------------------------------} begin {Start of dialog handler} GetPort(savePort); {Get the previous grafport} GetSelection := GetNewDialog(228, nil, Pointer(-1));{Bring in the dialog resource} tempRect := GetSelection^.portRect; {Get window size, we will now center it} tempRect.Top := ((screenBits.Bounds.Bottom - screenBits.Bounds.Top) - (tempRect.Bottom - tempRect.Top)) div 2; tempRect.Left := ((screenBits.Bounds.Right - screenBits.Bounds.Left) - (tempRect.Right - tempRect.Left)) div 2; MoveWindow(GetSelection, tempRect.Left, tempRect.Top, TRUE);{Now move the window to the proper position} ShowWindow(GetSelection); {Open a dialog box} SelectWindow(GetSelection); {Lets see it} SetPort(GetSelection); {Prepare to add conditional text} Refresh_Dialog; {Draw any Lists, lines, or rectangles} timeWas := TickCount; {Initialize the tick counter} screenNum := 0; {Initialize the set of icons displaying} ExitDialog := FALSE; {Do not exit dialog handle loop yet} repeat {Start of dialog handle loop} ModalDialog(@idleFilter, itemHit);{Wait until an item is hit} GetDItem(GetSelection, itemHit, DType, DItem, tempRect); {Get item information} CItem := Pointer(DItem); {Get the control handle} if (ItemHit = okayButton) then {Handle the Button being pressed} begin exitDialog := TRUE; {Exit the dialog when this selection is made} end; {End for this item selected} until exitDialog; {Handle dialog items until exit selected} SetPort(GrafPtr(savePort)); {Restore the previous grafport} DisposDialog(GetSelection); {Flush the dialog out of memory} end; {End of procedure} {=================================} end. \ No newline at end of file