├── Glider_405 ├── B&W Art.bin ├── Color Art.bin ├── Glider Version History.txt ├── Glider.project.bin ├── Glider.r └── Sources │ ├── G-FileInNOut.p │ ├── G-GameBody.p │ ├── G-GlobalUtils.p │ ├── G-Globals.p │ ├── G-IdleInput.p │ ├── G-IdleUtils.p │ ├── G-Initialize.p │ ├── G-PlayActive.p │ ├── G-PlaySetUp.p │ ├── G-PlayUtils.p │ ├── Glider Balloons.bin │ ├── SMS.p │ ├── SMSCore.a.o │ ├── SetPage.Lib.bin │ └── sms.a.o ├── Glider_Sound_Files ├── Aww-22.glide ├── Bass-22.glide ├── BeamIn-22.glide ├── BlowerOn-22.glide ├── Bounce-22.glide ├── Clock-22.glide ├── Crunch-22.glide ├── Drip-22.glide ├── Energize-22.glide ├── Extra-22.glide ├── FireBand-22.glide ├── GetBand-22.glide ├── GoodMove-22.glide ├── GreaseFall-22.glide ├── Guitar-22.glide ├── Hey!-22.glide ├── Lightning-22.glide ├── Lightning2-22 ├── LightsOn-22.glide ├── MusicBite ├── Pop-22.glide ├── Push-22.glide ├── Shredder-22.glide ├── TeaKettle ├── Tick-22.glide ├── ToastDrop-22.glide ├── ToastJump-22.glide ├── Yow!-22.glide ├── Zap-22.glide └── snd.r ├── Houses ├── Combo House ├── Combo House 2 ├── Combo House 3 ├── Combo House 4 ├── Combo House Read Me.txt ├── Glass House ├── Glass House 2 ├── Glass House ReadMe.txt ├── Hands-off House ├── Hands-off ReadMe.txt ├── House Full of Stuff ├── House Full of Stuff 2 ├── House Full of Stuff Next Door ├── House Full of Stuff Next Door 2 ├── House Full of Stuff Read Me.txt ├── House Next Door Read Me.txt ├── House of Doom ├── House of Doom Read Me.txt ├── House of the Rising Sun ├── House of the Rising Sun 1 ├── House of the Rising Sun 2 ├── House of the Rising Sun 3 ├── Lumpy's Home ├── Lumpy's Home Read Me.txt ├── Mad House ├── Mad House 2 ├── Mad House Read Me.txt ├── Rising Sun Read Me.txt ├── The House ├── The House 2 ├── Usher House └── Usher House Read Me.txt ├── LICENSE ├── README.md └── RoomEditor_103 ├── Editor.project.bin ├── Editor.r ├── Room Editor Version History.txt └── Sources ├── About.lib (2.1) ├── About… 2.1 Intf.p ├── E-Drawing.p ├── E-FileInNOut.p ├── E-FlyGlider.p ├── E-GameBody.p ├── E-Globals.p ├── E-HouseStuff.p ├── E-Initialize.p ├── E-ObjectStuff.p ├── E-RoomStuff.p ├── E-TheMenus.p └── E-Utilities.p /Glider_405/B&W Art.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_405/B&W Art.bin -------------------------------------------------------------------------------- /Glider_405/Color Art.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_405/Color Art.bin -------------------------------------------------------------------------------- /Glider_405/Glider Version History.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_405/Glider Version History.txt -------------------------------------------------------------------------------- /Glider_405/Glider.project.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_405/Glider.project.bin -------------------------------------------------------------------------------- /Glider_405/Glider.r: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_405/Glider.r -------------------------------------------------------------------------------- /Glider_405/Sources/G-FileInNOut.p: -------------------------------------------------------------------------------- 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. -------------------------------------------------------------------------------- /Glider_405/Sources/G-GameBody.p: -------------------------------------------------------------------------------- 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} -------------------------------------------------------------------------------- /Glider_405/Sources/G-GlobalUtils.p: -------------------------------------------------------------------------------- 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. -------------------------------------------------------------------------------- /Glider_405/Sources/G-Globals.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_405/Sources/G-Globals.p -------------------------------------------------------------------------------- /Glider_405/Sources/G-IdleInput.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_405/Sources/G-IdleInput.p -------------------------------------------------------------------------------- /Glider_405/Sources/G-IdleUtils.p: -------------------------------------------------------------------------------- 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. -------------------------------------------------------------------------------- /Glider_405/Sources/G-PlayActive.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_405/Sources/G-PlayActive.p -------------------------------------------------------------------------------- /Glider_405/Sources/Glider Balloons.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_405/Sources/Glider Balloons.bin -------------------------------------------------------------------------------- /Glider_405/Sources/SMS.p: -------------------------------------------------------------------------------- 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. -------------------------------------------------------------------------------- /Glider_405/Sources/SMSCore.a.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_405/Sources/SMSCore.a.o -------------------------------------------------------------------------------- /Glider_405/Sources/SetPage.Lib.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_405/Sources/SetPage.Lib.bin -------------------------------------------------------------------------------- /Glider_405/Sources/sms.a.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_405/Sources/sms.a.o -------------------------------------------------------------------------------- /Glider_Sound_Files/Aww-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Aww-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Bass-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Bass-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/BeamIn-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/BeamIn-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/BlowerOn-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/BlowerOn-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Bounce-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Bounce-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Clock-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Clock-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Crunch-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Crunch-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Drip-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Drip-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Energize-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Energize-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Extra-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Extra-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/FireBand-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/FireBand-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/GetBand-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/GetBand-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/GoodMove-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/GoodMove-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/GreaseFall-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/GreaseFall-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Guitar-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Guitar-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Hey!-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Hey!-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Lightning-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Lightning-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Lightning2-22: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Lightning2-22 -------------------------------------------------------------------------------- /Glider_Sound_Files/LightsOn-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/LightsOn-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/MusicBite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/MusicBite -------------------------------------------------------------------------------- /Glider_Sound_Files/Pop-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Pop-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Push-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Push-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Shredder-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Shredder-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/TeaKettle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/TeaKettle -------------------------------------------------------------------------------- /Glider_Sound_Files/Tick-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Tick-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/ToastDrop-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/ToastDrop-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/ToastJump-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/ToastJump-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Yow!-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Yow!-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/Zap-22.glide: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/Zap-22.glide -------------------------------------------------------------------------------- /Glider_Sound_Files/snd.r: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Glider_Sound_Files/snd.r -------------------------------------------------------------------------------- /Houses/Combo House: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/Combo House -------------------------------------------------------------------------------- /Houses/Combo House 2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/Combo House 2 -------------------------------------------------------------------------------- /Houses/Combo House 3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/Combo House 3 -------------------------------------------------------------------------------- /Houses/Combo House 4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/Combo House 4 -------------------------------------------------------------------------------- /Houses/Combo House Read Me.txt: -------------------------------------------------------------------------------- 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! -------------------------------------------------------------------------------- /Houses/Glass House: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/Glass House -------------------------------------------------------------------------------- /Houses/Glass House 2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/Glass House 2 -------------------------------------------------------------------------------- /Houses/Glass House ReadMe.txt: -------------------------------------------------------------------------------- 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 -------------------------------------------------------------------------------- /Houses/Hands-off House: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/Hands-off House -------------------------------------------------------------------------------- /Houses/Hands-off ReadMe.txt: -------------------------------------------------------------------------------- 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. -------------------------------------------------------------------------------- /Houses/House Full of Stuff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/House Full of Stuff -------------------------------------------------------------------------------- /Houses/House Full of Stuff 2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/House Full of Stuff 2 -------------------------------------------------------------------------------- /Houses/House Full of Stuff Next Door: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/House Full of Stuff Next Door -------------------------------------------------------------------------------- /Houses/House Full of Stuff Next Door 2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/House Full of Stuff Next Door 2 -------------------------------------------------------------------------------- /Houses/House Full of Stuff Read Me.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/House Full of Stuff Read Me.txt -------------------------------------------------------------------------------- /Houses/House Next Door Read Me.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/House Next Door Read Me.txt -------------------------------------------------------------------------------- /Houses/House of Doom: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/House of Doom -------------------------------------------------------------------------------- /Houses/House of Doom Read Me.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/House of Doom Read Me.txt -------------------------------------------------------------------------------- /Houses/House of the Rising Sun: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/House of the Rising Sun -------------------------------------------------------------------------------- /Houses/House of the Rising Sun 1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/House of the Rising Sun 1 -------------------------------------------------------------------------------- /Houses/House of the Rising Sun 2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/House of the Rising Sun 2 -------------------------------------------------------------------------------- /Houses/House of the Rising Sun 3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/House of the Rising Sun 3 -------------------------------------------------------------------------------- /Houses/Lumpy's Home: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/Lumpy's Home -------------------------------------------------------------------------------- /Houses/Lumpy's Home Read Me.txt: -------------------------------------------------------------------------------- 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 -------------------------------------------------------------------------------- /Houses/Mad House: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/Mad House -------------------------------------------------------------------------------- /Houses/Mad House 2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/Mad House 2 -------------------------------------------------------------------------------- /Houses/Mad House Read Me.txt: -------------------------------------------------------------------------------- 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- -------------------------------------------------------------------------------- /Houses/Rising Sun Read Me.txt: -------------------------------------------------------------------------------- 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 -------------------------------------------------------------------------------- /Houses/The House: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/The House -------------------------------------------------------------------------------- /Houses/The House 2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/The House 2 -------------------------------------------------------------------------------- /Houses/Usher House: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/Usher House -------------------------------------------------------------------------------- /Houses/Usher House Read Me.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/Houses/Usher House Read Me.txt -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 softdorothy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Glider 4.0 2 | Original sources to Glider 4.0 by John Calhoun, originally published by Casady & Greene Inc. 3 | -------------------------------------------------------------------------------- /RoomEditor_103/Editor.project.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/RoomEditor_103/Editor.project.bin -------------------------------------------------------------------------------- /RoomEditor_103/Editor.r: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/RoomEditor_103/Editor.r -------------------------------------------------------------------------------- /RoomEditor_103/Room Editor Version History.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/RoomEditor_103/Room Editor Version History.txt -------------------------------------------------------------------------------- /RoomEditor_103/Sources/About.lib (2.1): -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/RoomEditor_103/Sources/About.lib (2.1) -------------------------------------------------------------------------------- /RoomEditor_103/Sources/About… 2.1 Intf.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/RoomEditor_103/Sources/About… 2.1 Intf.p -------------------------------------------------------------------------------- /RoomEditor_103/Sources/E-Drawing.p: -------------------------------------------------------------------------------- 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. -------------------------------------------------------------------------------- /RoomEditor_103/Sources/E-FileInNOut.p: -------------------------------------------------------------------------------- 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. -------------------------------------------------------------------------------- /RoomEditor_103/Sources/E-GameBody.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/RoomEditor_103/Sources/E-GameBody.p -------------------------------------------------------------------------------- /RoomEditor_103/Sources/E-Globals.p: -------------------------------------------------------------------------------- 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. -------------------------------------------------------------------------------- /RoomEditor_103/Sources/E-HouseStuff.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/RoomEditor_103/Sources/E-HouseStuff.p -------------------------------------------------------------------------------- /RoomEditor_103/Sources/E-Initialize.p: -------------------------------------------------------------------------------- 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. -------------------------------------------------------------------------------- /RoomEditor_103/Sources/E-ObjectStuff.p: -------------------------------------------------------------------------------- 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. -------------------------------------------------------------------------------- /RoomEditor_103/Sources/E-RoomStuff.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/RoomEditor_103/Sources/E-RoomStuff.p -------------------------------------------------------------------------------- /RoomEditor_103/Sources/E-TheMenus.p: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/softdorothy/Glider4/d023891da740a41d192e25d0e748fd1c54d940b8/RoomEditor_103/Sources/E-TheMenus.p -------------------------------------------------------------------------------- /RoomEditor_103/Sources/E-Utilities.p: -------------------------------------------------------------------------------- 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. --------------------------------------------------------------------------------