This commit is contained in:
David Ryskalczyk 2021-08-20 14:40:54 -07:00 committed by GitHub
commit 1898d733d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
93 changed files with 48499 additions and 93 deletions

View File

@ -1 +1,10 @@
//============================================================================ //---------------------------------------------------------------------------- // About.h //---------------------------------------------------------------------------- //============================================================================ void DoAbout (void);
//============================================================================
//----------------------------------------------------------------------------
// About.h
//----------------------------------------------------------------------------
//============================================================================
void DoAbout (void);

View File

@ -1 +1,47 @@
//============================================================================ //---------------------------------------------------------------------------- // DialogUtils.h //---------------------------------------------------------------------------- //============================================================================ #include <Dialogs.h> void BringUpDialog (DialogPtr *theDialog, short dialogID); //void GetPutDialogCorner (Point *); //void GetGetDialogCorner (Point *); //void CenterDialog (short); void GetDialogRect (Rect *, short); //void TrueCenterDialog (short); //void CenterAlert (short); //void ZoomOutDialogRect (short); //void ZoomOutAlertRect (short); void FlashDialogButton (DialogPtr, short); void DrawDefaultButton (DialogPtr); void GetDialogString (DialogPtr, short, StringPtr); void SetDialogString (DialogPtr, short, StringPtr); short GetDialogStringLen (DialogPtr, short); void GetDialogItemValue (DialogPtr, short, short *); void SetDialogItemValue (DialogPtr, short, short); void ToggleDialogItemValue (DialogPtr, short); void SetDialogNumToStr (DialogPtr, short, long); void GetDialogNumFromStr (DialogPtr, short, long *); void GetDialogItemRect (DialogPtr, short, Rect *); void SetDialogItemRect (DialogPtr, short, Rect *); void OffsetDialogItemRect (DialogPtr, short, short, short); void SelectFromRadioGroup (DialogPtr, short, short, short); //void AddMenuToPopUp (DialogPtr, short, MenuHandle); void GetPopUpMenuValue (DialogPtr, short, short *); void SetPopUpMenuValue (DialogPtr, short, short); void MyEnableControl(DialogPtr, short); void MyDisableControl(DialogPtr, short); void DrawDialogUserText (DialogPtr, short, StringPtr, Boolean); void DrawDialogUserText2 (DialogPtr, short, StringPtr); void LoadDialogPICT (DialogPtr, short, short); void FrameDialogItem (DialogPtr, short); void FrameDialogItemC (DialogPtr, short, long); void FrameOvalDialogItem (DialogPtr, short); void BorderDialogItem (DialogPtr, short, short); void ShadowDialogItem (DialogPtr, short, short); void EraseDialogItem (DialogPtr, short);
//============================================================================
//----------------------------------------------------------------------------
// DialogUtils.h
//----------------------------------------------------------------------------
//============================================================================
#include <Dialogs.h>
void BringUpDialog (DialogPtr *theDialog, short dialogID);
//void GetPutDialogCorner (Point *);
//void GetGetDialogCorner (Point *);
//void CenterDialog (short);
void GetDialogRect (Rect *, short);
//void TrueCenterDialog (short);
//void CenterAlert (short);
//void ZoomOutDialogRect (short);
//void ZoomOutAlertRect (short);
void FlashDialogButton (DialogPtr, short);
void DrawDefaultButton (DialogPtr);
void GetDialogString (DialogPtr, short, StringPtr);
void SetDialogString (DialogPtr, short, StringPtr);
short GetDialogStringLen (DialogPtr, short);
void GetDialogItemValue (DialogPtr, short, short *);
void SetDialogItemValue (DialogPtr, short, short);
void ToggleDialogItemValue (DialogPtr, short);
void SetDialogNumToStr (DialogPtr, short, long);
void GetDialogNumFromStr (DialogPtr, short, long *);
void GetDialogItemRect (DialogPtr, short, Rect *);
void SetDialogItemRect (DialogPtr, short, Rect *);
void OffsetDialogItemRect (DialogPtr, short, short, short);
void SelectFromRadioGroup (DialogPtr, short, short, short);
//void AddMenuToPopUp (DialogPtr, short, MenuHandle);
void GetPopUpMenuValue (DialogPtr, short, short *);
void SetPopUpMenuValue (DialogPtr, short, short);
void MyEnableControl(DialogPtr, short);
void MyDisableControl(DialogPtr, short);
void DrawDialogUserText (DialogPtr, short, StringPtr, Boolean);
void DrawDialogUserText2 (DialogPtr, short, StringPtr);
void LoadDialogPICT (DialogPtr, short, short);
void FrameDialogItem (DialogPtr, short);
void FrameDialogItemC (DialogPtr, short, long);
void FrameOvalDialogItem (DialogPtr, short);
void BorderDialogItem (DialogPtr, short, short);
void ShadowDialogItem (DialogPtr, short, short);
void EraseDialogItem (DialogPtr, short);

View File

@ -1 +1,7 @@
//============================================================================ //---------------------------------------------------------------------------- // DynamicMaps.h //---------------------------------------------------------------------------- //============================================================================
//============================================================================
//----------------------------------------------------------------------------
// DynamicMaps.h
//----------------------------------------------------------------------------
//============================================================================

View File

@ -1 +1,37 @@
//============================================================================ //---------------------------------------------------------------------------- // Environ.h //---------------------------------------------------------------------------- //============================================================================ #include <Quickdraw.h> typedef struct { Rect screen, gray; long dirID; short wasDepth, isDepth; short thisResFile; short numScreens; short vRefNum; Boolean can1Bit; Boolean can4Bit; Boolean can8Bit; Boolean wasColorOrGray; Boolean hasWNE; Boolean hasSystem7; Boolean hasColor; Boolean hasGestalt; Boolean canSwitch; Boolean canColor; Boolean hasSM3; Boolean hasQT; Boolean hasDrag; } macEnviron; extern macEnviron thisMac;
//============================================================================
//----------------------------------------------------------------------------
// Environ.h
//----------------------------------------------------------------------------
//============================================================================
#include <Quickdraw.h>
typedef struct
{
Rect screen, gray;
long dirID;
short wasDepth, isDepth;
short thisResFile;
short numScreens;
short vRefNum;
Boolean can1Bit;
Boolean can4Bit;
Boolean can8Bit;
Boolean wasColorOrGray;
Boolean hasWNE;
Boolean hasSystem7;
Boolean hasColor;
Boolean hasGestalt;
Boolean canSwitch;
Boolean canColor;
Boolean hasSM3;
Boolean hasQT;
Boolean hasDrag;
} macEnviron;
extern macEnviron thisMac;

File diff suppressed because one or more lines are too long

View File

@ -1 +1,12 @@
//============================================================================ //---------------------------------------------------------------------------- // GameOver.h //---------------------------------------------------------------------------- //============================================================================ #include <QDOffscreen.h> extern GWorldPtr angelSrcMap; extern GWorldPtr angelMaskMap;
//============================================================================
//----------------------------------------------------------------------------
// GameOver.h
//----------------------------------------------------------------------------
//============================================================================
#include <QDOffscreen.h>
extern GWorldPtr angelSrcMap;
extern GWorldPtr angelMaskMap;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,59 @@
//============================================================================ //---------------------------------------------------------------------------- // GliderVars.h //---------------------------------------------------------------------------- //============================================================================ #include <Movies.h> extern Rect blowerSrcRect; extern Rect flame[], tikiFlame[]; extern Rect coals[]; extern Rect furnitureSrcRect; extern Rect tableSrc, shelfSrc, hingeSrc, handleSrc, knobSrc; extern Rect leftFootSrc, rightFootSrc, deckSrc; extern Rect bonusSrcRect; extern Rect pointsSrcRect; extern Rect starSrc[], sparkleSrc[]; extern Rect digits[], pendulumSrc[], greaseSrcRt[], greaseSrcLf[]; extern Rect transSrcRect; extern Rect switchSrcRect; extern Rect lightSwitchSrc[], machineSwitchSrc[], thermostatSrc[]; extern Rect powerSrc[], knifeSwitchSrc[]; extern Rect lightSrcRect; extern Rect flourescentSrc1, flourescentSrc2; extern Rect trackLightSrc[]; extern Rect applianceSrcRect, toastSrcRect, shredSrcRect; // Appliances extern Rect plusScreen1, plusScreen2, tvScreen1, tvScreen2; extern Rect coffeeLight1, coffeeLight2, vcrTime1, vcrTime2; extern Rect stereoLight1, stereoLight2, microOn, microOff; extern Rect outletSrc[]; extern Rect balloonSrcRect, copterSrcRect, dartSrcRect; // Enemies extern Rect ballSrcRect, dripSrcRect, enemySrcRect; extern Rect fishSrcRect; extern Rect balloonSrc[], copterSrc[], dartSrc[]; extern Rect ballSrc[], dripSrc[], fishSrc[]; extern Rect clutterSrcRect; extern Rect flowerSrc[]; extern Rect *srcRects; extern Movie theMovie; extern Rect movieRect; extern Boolean hasMovie, tvInRoom; extern gliderType theGlider, theGlider2; extern objDataPtr masterObjects; extern Rect workSrcRect; extern Rect backSrcRect; extern Rect mainWindowRect, houseRect; extern houseHand thisHouse; extern roomPtr thisRoom; extern WindowPtr mainWindow, coordWindow; extern long theScore; extern short playOriginH, playOriginV; extern short thisRoomNumber, theMode, batteryTotal, bandsTotal; extern short foilTotal, mortals, numMasterObjects, previousRoom; extern Boolean fileDirty, gameDirty, showFoil, doZooms, isPlayMusicGame;
//============================================================================
//----------------------------------------------------------------------------
// GliderVars.h
//----------------------------------------------------------------------------
//============================================================================
#include <Movies.h>
extern Rect blowerSrcRect;
extern Rect flame[], tikiFlame[];
extern Rect coals[];
extern Rect furnitureSrcRect;
extern Rect tableSrc, shelfSrc, hingeSrc, handleSrc, knobSrc;
extern Rect leftFootSrc, rightFootSrc, deckSrc;
extern Rect bonusSrcRect;
extern Rect pointsSrcRect;
extern Rect starSrc[], sparkleSrc[];
extern Rect digits[], pendulumSrc[], greaseSrcRt[], greaseSrcLf[];
extern Rect transSrcRect;
extern Rect switchSrcRect;
extern Rect lightSwitchSrc[], machineSwitchSrc[], thermostatSrc[];
extern Rect powerSrc[], knifeSwitchSrc[];
extern Rect lightSrcRect;
extern Rect flourescentSrc1, flourescentSrc2;
extern Rect trackLightSrc[];
extern Rect applianceSrcRect, toastSrcRect, shredSrcRect; // Appliances
extern Rect plusScreen1, plusScreen2, tvScreen1, tvScreen2;
extern Rect coffeeLight1, coffeeLight2, vcrTime1, vcrTime2;
extern Rect stereoLight1, stereoLight2, microOn, microOff;
extern Rect outletSrc[];
extern Rect balloonSrcRect, copterSrcRect, dartSrcRect; // Enemies
extern Rect ballSrcRect, dripSrcRect, enemySrcRect;
extern Rect fishSrcRect;
extern Rect balloonSrc[], copterSrc[], dartSrc[];
extern Rect ballSrc[], dripSrc[], fishSrc[];
extern Rect clutterSrcRect;
extern Rect flowerSrc[];
extern Rect *srcRects;
extern Movie theMovie;
extern Rect movieRect;
extern Boolean hasMovie, tvInRoom;
extern gliderType theGlider, theGlider2;
extern objDataPtr masterObjects;
extern Rect workSrcRect;
extern Rect backSrcRect;
extern Rect mainWindowRect, houseRect;
extern houseHand thisHouse;
extern roomPtr thisRoom;
extern WindowPtr mainWindow, coordWindow;
extern long theScore;
extern short playOriginH, playOriginV;
extern short thisRoomNumber, theMode, batteryTotal, bandsTotal;
extern short foilTotal, mortals, numMasterObjects, previousRoom;
extern Boolean fileDirty, gameDirty, showFoil, doZooms, isPlayMusicGame;

View File

@ -1 +1,12 @@
//============================================================================ //---------------------------------------------------------------------------- // House.h //---------------------------------------------------------------------------- //============================================================================ #include <MacTypes.h> extern Str32 thisHouseName; extern Boolean houseUnlocked;
//============================================================================
//----------------------------------------------------------------------------
// House.h
//----------------------------------------------------------------------------
//============================================================================
#include <MacTypes.h>
extern Str32 thisHouseName;
extern Boolean houseUnlocked;

View File

@ -1 +1,11 @@
//============================================================================ //---------------------------------------------------------------------------- // MainWindow.h //---------------------------------------------------------------------------- //============================================================================ #include <QDOffscreen.h> extern GWorldPtr workSrcMap;
//============================================================================
//----------------------------------------------------------------------------
// MainWindow.h
//----------------------------------------------------------------------------
//============================================================================
#include <QDOffscreen.h>
extern GWorldPtr workSrcMap;

View File

@ -1 +1,12 @@
//============================================================================ //---------------------------------------------------------------------------- // Map.h //---------------------------------------------------------------------------- //============================================================================ #include <QDOffscreen.h> extern GWorldPtr nailSrcMap; extern WindowPtr mapWindow;
//============================================================================
//----------------------------------------------------------------------------
// Map.h
//----------------------------------------------------------------------------
//============================================================================
#include <QDOffscreen.h>
extern GWorldPtr nailSrcMap;
extern WindowPtr mapWindow;

View File

@ -1 +1,24 @@
//============================================================================ //---------------------------------------------------------------------------- // Marquee.h //---------------------------------------------------------------------------- //============================================================================ #pragma once #include <Quickdraw.h> typedef struct { Pattern pats[kNumMarqueePats]; Rect bounds, handle; short index, direction, dist; Boolean active, paused, handled; } marquee; extern marquee theMarquee;
//============================================================================
//----------------------------------------------------------------------------
// Marquee.h
//----------------------------------------------------------------------------
//============================================================================
#pragma once
#include <Quickdraw.h>
typedef struct
{
Pattern pats[kNumMarqueePats];
Rect bounds, handle;
short index, direction, dist;
Boolean active, paused, handled;
} marquee;
extern marquee theMarquee;

View File

@ -1 +1,15 @@
//============================================================================ //---------------------------------------------------------------------------- // ObjectEdit.h //---------------------------------------------------------------------------- //============================================================================ #pragma once #include <Quickdraw.h> extern Rect roomObjectRects[]; extern short objActive;
//============================================================================
//----------------------------------------------------------------------------
// ObjectEdit.h
//----------------------------------------------------------------------------
//============================================================================
#pragma once
#include <Quickdraw.h>
extern Rect roomObjectRects[];
extern short objActive;

View File

@ -1 +1,42 @@
//============================================================================ //---------------------------------------------------------------------------- // Objects.h //---------------------------------------------------------------------------- //============================================================================ extern GWorldPtr blowerSrcMap; extern GWorldPtr blowerMaskMap; extern GWorldPtr furnitureSrcMap; extern GWorldPtr furnitureMaskMap; extern GWorldPtr bonusSrcMap; extern GWorldPtr bonusMaskMap; extern GWorldPtr pointsSrcMap; extern GWorldPtr pointsMaskMap; extern GWorldPtr transSrcMap; extern GWorldPtr transMaskMap; extern GWorldPtr switchSrcMap; extern GWorldPtr lightSrcMap; extern GWorldPtr lightMaskMap; extern GWorldPtr applianceSrcMap; extern GWorldPtr applianceMaskMap; extern GWorldPtr toastSrcMap; extern GWorldPtr toastMaskMap; extern GWorldPtr shredSrcMap; extern GWorldPtr shredMaskMap; extern GWorldPtr balloonSrcMap; extern GWorldPtr balloonMaskMap; extern GWorldPtr copterSrcMap; extern GWorldPtr copterMaskMap; extern GWorldPtr dartSrcMap; extern GWorldPtr dartMaskMap; extern GWorldPtr ballSrcMap; extern GWorldPtr ballMaskMap; extern GWorldPtr dripSrcMap; extern GWorldPtr dripMaskMap; extern GWorldPtr enemySrcMap; extern GWorldPtr enemyMaskMap; extern GWorldPtr fishSrcMap; extern GWorldPtr fishMaskMap; extern GWorldPtr clutterSrcMap; extern GWorldPtr clutterMaskMap;
//============================================================================
//----------------------------------------------------------------------------
// Objects.h
//----------------------------------------------------------------------------
//============================================================================
extern GWorldPtr blowerSrcMap;
extern GWorldPtr blowerMaskMap;
extern GWorldPtr furnitureSrcMap;
extern GWorldPtr furnitureMaskMap;
extern GWorldPtr bonusSrcMap;
extern GWorldPtr bonusMaskMap;
extern GWorldPtr pointsSrcMap;
extern GWorldPtr pointsMaskMap;
extern GWorldPtr transSrcMap;
extern GWorldPtr transMaskMap;
extern GWorldPtr switchSrcMap;
extern GWorldPtr lightSrcMap;
extern GWorldPtr lightMaskMap;
extern GWorldPtr applianceSrcMap;
extern GWorldPtr applianceMaskMap;
extern GWorldPtr toastSrcMap;
extern GWorldPtr toastMaskMap;
extern GWorldPtr shredSrcMap;
extern GWorldPtr shredMaskMap;
extern GWorldPtr balloonSrcMap;
extern GWorldPtr balloonMaskMap;
extern GWorldPtr copterSrcMap;
extern GWorldPtr copterMaskMap;
extern GWorldPtr dartSrcMap;
extern GWorldPtr dartMaskMap;
extern GWorldPtr ballSrcMap;
extern GWorldPtr ballMaskMap;
extern GWorldPtr dripSrcMap;
extern GWorldPtr dripMaskMap;
extern GWorldPtr enemySrcMap;
extern GWorldPtr enemyMaskMap;
extern GWorldPtr fishSrcMap;
extern GWorldPtr fishMaskMap;
extern GWorldPtr clutterSrcMap;
extern GWorldPtr clutterMaskMap;

View File

@ -1 +1,13 @@
//============================================================================ //---------------------------------------------------------------------------- // Play.h //---------------------------------------------------------------------------- //============================================================================ #include <QDOffscreen.h> extern GWorldPtr glidSrcMap; extern GWorldPtr glid2SrcMap; extern GWorldPtr glidMaskMap;
//============================================================================
//----------------------------------------------------------------------------
// Play.h
//----------------------------------------------------------------------------
//============================================================================
#include <QDOffscreen.h>
extern GWorldPtr glidSrcMap;
extern GWorldPtr glid2SrcMap;
extern GWorldPtr glidMaskMap;

View File

@ -1 +1,12 @@
//============================================================================ //---------------------------------------------------------------------------- // Player.h //---------------------------------------------------------------------------- //============================================================================ #include <QDOffscreen.h> extern GWorldPtr shadowSrcMap; extern GWorldPtr shadowMaskMap;
//============================================================================
//----------------------------------------------------------------------------
// Player.h
//----------------------------------------------------------------------------
//============================================================================
#include <QDOffscreen.h>
extern GWorldPtr shadowSrcMap;
extern GWorldPtr shadowMaskMap;

View File

@ -1 +1,33 @@
//============================================================================ //---------------------------------------------------------------------------- // RectUtils.h //---------------------------------------------------------------------------- //============================================================================ #pragma once #include <Quickdraw.h> void FrameWHRect (short, short, short, short); void NormalizeRect (Rect *); void ZeroRectCorner (Rect *); void CenterRectOnPoint (Rect *, Point); short HalfRectWide (Rect *); short HalfRectTall (Rect *); short RectWide (Rect *); short RectTall (Rect *); void GlobalToLocalRect (Rect *); void LocalToGlobalRect (Rect *); void CenterRectInRect (Rect *, Rect *); void HOffsetRect (Rect *, short); void VOffsetRect (Rect *, short); Boolean IsRectLeftOfRect (Rect *, Rect *); void QOffsetRect (Rect *, short, short); void QSetRect (Rect *, short, short, short, short); Boolean ForceRectInRect (Rect *, Rect *); void QUnionSimilarRect (Rect *, Rect *, Rect *); void FrameRectSansCorners (Rect *); void SetEraseRect (short, short, short, short);
//============================================================================
//----------------------------------------------------------------------------
// RectUtils.h
//----------------------------------------------------------------------------
//============================================================================
#pragma once
#include <Quickdraw.h>
void FrameWHRect (short, short, short, short);
void NormalizeRect (Rect *);
void ZeroRectCorner (Rect *);
void CenterRectOnPoint (Rect *, Point);
short HalfRectWide (Rect *);
short HalfRectTall (Rect *);
short RectWide (Rect *);
short RectTall (Rect *);
void GlobalToLocalRect (Rect *);
void LocalToGlobalRect (Rect *);
void CenterRectInRect (Rect *, Rect *);
void HOffsetRect (Rect *, short);
void VOffsetRect (Rect *, short);
Boolean IsRectLeftOfRect (Rect *, Rect *);
void QOffsetRect (Rect *, short, short);
void QSetRect (Rect *, short, short, short, short);
Boolean ForceRectInRect (Rect *, Rect *);
void QUnionSimilarRect (Rect *, Rect *, Rect *);
void FrameRectSansCorners (Rect *);
void SetEraseRect (short, short, short, short);

View File

@ -1 +1,12 @@
//============================================================================ //---------------------------------------------------------------------------- // Room.h //---------------------------------------------------------------------------- //============================================================================ #include <QDOffscreen.h> extern GWorldPtr backSrcMap;
//============================================================================
//----------------------------------------------------------------------------
// Room.h
//----------------------------------------------------------------------------
//============================================================================
#include <QDOffscreen.h>
extern GWorldPtr backSrcMap;

View File

@ -1 +1,11 @@
//============================================================================ //---------------------------------------------------------------------------- // RoomGraphics.h //---------------------------------------------------------------------------- //============================================================================ #include <QDOffscreen.h> extern GWorldPtr suppSrcMap;
//============================================================================
//----------------------------------------------------------------------------
// RoomGraphics.h
//----------------------------------------------------------------------------
//============================================================================
#include <QDOffscreen.h>
extern GWorldPtr suppSrcMap;

View File

@ -1 +1,12 @@
//============================================================================ //---------------------------------------------------------------------------- // RubberBands.h //---------------------------------------------------------------------------- //============================================================================ #include <QDOffscreen.h> extern GWorldPtr bandsSrcMap; extern GWorldPtr bandsMaskMap;
//============================================================================
//----------------------------------------------------------------------------
// RubberBands.h
//----------------------------------------------------------------------------
//============================================================================
#include <QDOffscreen.h>
extern GWorldPtr bandsSrcMap;
extern GWorldPtr bandsMaskMap;

View File

@ -1 +1,15 @@
//============================================================================ //---------------------------------------------------------------------------- // Scoreboard.h //---------------------------------------------------------------------------- //============================================================================ #include <QDOffscreen.h> extern GWorldPtr boardSrcMap; extern GWorldPtr badgeSrcMap; extern GWorldPtr boardTSrcMap; extern GWorldPtr boardGSrcMap; extern GWorldPtr boardPSrcMap;
//============================================================================
//----------------------------------------------------------------------------
// Scoreboard.h
//----------------------------------------------------------------------------
//============================================================================
#include <QDOffscreen.h>
extern GWorldPtr boardSrcMap;
extern GWorldPtr badgeSrcMap;
extern GWorldPtr boardTSrcMap;
extern GWorldPtr boardGSrcMap;
extern GWorldPtr boardPSrcMap;

View File

@ -1 +1,12 @@
//============================================================================ //---------------------------------------------------------------------------- // Tools.h //---------------------------------------------------------------------------- //============================================================================ #include <QDOffscreen.h> extern GWorldPtr toolSrcMap; extern WindowPtr toolsWindow;
//============================================================================
//----------------------------------------------------------------------------
// Tools.h
//----------------------------------------------------------------------------
//============================================================================
#include <QDOffscreen.h>
extern GWorldPtr toolSrcMap;
extern WindowPtr toolsWindow;

View File

@ -1 +1,11 @@
//============================================================================ //---------------------------------------------------------------------------- // Utilities.c //---------------------------------------------------------------------------- //============================================================================ #include <QDOffscreen.h> OSErr CreateOffScreenGWorld (GWorldPtr *theGWorld, Rect *bounds, short depth);
//============================================================================
//----------------------------------------------------------------------------
// Utilities.c
//----------------------------------------------------------------------------
//============================================================================
#include <QDOffscreen.h>
OSErr CreateOffScreenGWorld (GWorldPtr *theGWorld, Rect *bounds, short depth);

View File

@ -1 +1,7 @@
#define TARGET_CARBON 1 #define ACCESSOR_CALLS_ARE_FUNCTIONS 1 #define OPAQUE_TOOLBOX_STRUCTS 1 #define OPAQUE_UPP_TYPES 1 #define forCarbon 1 #define BUILDING_RUN_LINKED_IN 0 #define DEBUG 1
#define TARGET_CARBON 1
#define ACCESSOR_CALLS_ARE_FUNCTIONS 1
#define OPAQUE_TOOLBOX_STRUCTS 1
#define OPAQUE_UPP_TYPES 1
#define forCarbon 1
#define BUILDING_RUN_LINKED_IN 0
#define DEBUG 1

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,196 @@
//============================================================================ //---------------------------------------------------------------------------- // Coordinates.c //---------------------------------------------------------------------------- //============================================================================ #include <NumberFormatting.h> #include "Externs.h" #include "Environ.h" #include "Marquee.h" #include "ObjectEdit.h" #include "RectUtils.h" Rect coordWindowRect; WindowPtr coordWindow; short isCoordH, isCoordV; short coordH, coordV, coordD; Boolean isCoordOpen; //============================================================== Functions //-------------------------------------------------------------- SetCoordinateHVD // Given a horizontal, vertical and distance value, this functionÉ // displays these values in the Coordinates window. void SetCoordinateHVD (short h, short v, short d) { #ifndef COMPILEDEMO if (h != -2) coordH = h; if (v != -2) coordV = v; if (d != -2) coordD = d; UpdateCoordWindow(); #endif } //-------------------------------------------------------------- DeltaCoordinateD // When the user is dragging a handle (such as the height of a blower)É // this function can be called and passed the amount by which the userÉ // has changed the height (delta). This function then displays it inÉ // the Coordinate window. void DeltaCoordinateD (short d) { #ifndef COMPILEDEMO coordD = d; UpdateCoordWindow(); #endif } //-------------------------------------------------------------- UpdateCoordWindow // Completely redraws and updates the Coordinate window. void UpdateCoordWindow (void) { #ifndef COMPILEDEMO Str255 tempStr, numStr; GrafPtr wasPort; if (coordWindow == nil) return; GetPort(&wasPort); SetPort((GrafPtr)coordWindow); EraseRect(&coordWindowRect); PasStringCopy("\ph: ", tempStr); if (coordH != -1) { NumToString((long)coordH, numStr); PasStringConcat(tempStr, numStr); } else PasStringConcat(tempStr, "\p-"); MoveTo(5, 12); DrawString(tempStr); PasStringCopy("\pv: ", tempStr); if (coordV != -1) { NumToString((long)coordV, numStr); PasStringConcat(tempStr, numStr); } else PasStringConcat(tempStr, "\p-"); MoveTo(4, 22); DrawString(tempStr); ForeColor(blueColor); PasStringCopy("\pd: ", tempStr); if (coordD != -1) { NumToString((long)coordD, numStr); PasStringConcat(tempStr, numStr); } else PasStringConcat(tempStr, "\p-"); MoveTo(5, 32); DrawString(tempStr); ForeColor(blackColor); SetPort((GrafPtr)wasPort); #endif } //-------------------------------------------------------------- OpenCoordWindow // Brings up the Coordinate window. void OpenCoordWindow (void) { #ifndef COMPILEDEMO Rect src, dest; Point globalMouse; short direction, dist; if (coordWindow == nil) { QSetRect(&coordWindowRect, 0, 0, 50, 38); if (thisMac.hasColor) coordWindow = NewCWindow(nil, &coordWindowRect, "\pTools", false, kWindoidWDEF, kPutInFront, true, 0L); else coordWindow = NewWindow(nil, &coordWindowRect, "\pTools", false, kWindoidWDEF, kPutInFront, true, 0L); if (coordWindow == nil) RedAlert(kErrNoMemory); // if (OptionKeyDown()) // { // isCoordH = qd.screenBits.bounds.right - 55; // isCoordV = 204; // } MoveWindow(coordWindow, isCoordH, isCoordV, true); globalMouse = MyGetGlobalMouse(); QSetRect(&src, 0, 0, 1, 1); QOffsetRect(&src, globalMouse.h, globalMouse.v); GetWindowRect(coordWindow, &dest); BringToFront(coordWindow); ShowHide(coordWindow, true); // FlagWindowFloating(coordWindow); TEMP - use flaoting windows HiliteAllWindows(); coordH = -1; coordV = -1; coordD = -1; TextFace(applFont); TextSize(9); if (objActive != kNoObjectSelected) { if (ObjectHasHandle(&direction, &dist)) coordD = dist; SetCoordinateHVD(theMarquee.bounds.left, theMarquee.bounds.top, coordD); } } UpdateCoordinateCheckmark(true); #endif } //-------------------------------------------------------------- CloseCoordWindow // Closes and disposes of the Coordinate window. void CloseCoordWindow (void) { CloseThisWindow(&coordWindow); UpdateCoordinateCheckmark(false); } //-------------------------------------------------------------- ToggleCoordinateWindow // Toggles the Coordinate windows state between open and closed. void ToggleCoordinateWindow (void) { #ifndef COMPILEDEMO if (coordWindow == nil) { OpenCoordWindow(); isCoordOpen = true; } else { CloseCoordWindow(); isCoordOpen = false; } #endif }
//============================================================================
//----------------------------------------------------------------------------
// Coordinates.c
//----------------------------------------------------------------------------
//============================================================================
#include <NumberFormatting.h>
#include "Externs.h"
#include "Environ.h"
#include "Marquee.h"
#include "ObjectEdit.h"
#include "RectUtils.h"
Rect coordWindowRect;
WindowPtr coordWindow;
short isCoordH, isCoordV;
short coordH, coordV, coordD;
Boolean isCoordOpen;
//============================================================== Functions
//-------------------------------------------------------------- SetCoordinateHVD
// Given a horizontal, vertical and distance value, this functionÉ
// displays these values in the Coordinates window.
void SetCoordinateHVD (short h, short v, short d)
{
#ifndef COMPILEDEMO
if (h != -2)
coordH = h;
if (v != -2)
coordV = v;
if (d != -2)
coordD = d;
UpdateCoordWindow();
#endif
}
//-------------------------------------------------------------- DeltaCoordinateD
// When the user is dragging a handle (such as the height of a blower)É
// this function can be called and passed the amount by which the userÉ
// has changed the height (delta). This function then displays it inÉ
// the Coordinate window.
void DeltaCoordinateD (short d)
{
#ifndef COMPILEDEMO
coordD = d;
UpdateCoordWindow();
#endif
}
//-------------------------------------------------------------- UpdateCoordWindow
// Completely redraws and updates the Coordinate window.
void UpdateCoordWindow (void)
{
#ifndef COMPILEDEMO
Str255 tempStr, numStr;
GrafPtr wasPort;
if (coordWindow == nil)
return;
GetPort(&wasPort);
SetPort((GrafPtr)coordWindow);
EraseRect(&coordWindowRect);
PasStringCopy("\ph: ", tempStr);
if (coordH != -1)
{
NumToString((long)coordH, numStr);
PasStringConcat(tempStr, numStr);
}
else
PasStringConcat(tempStr, "\p-");
MoveTo(5, 12);
DrawString(tempStr);
PasStringCopy("\pv: ", tempStr);
if (coordV != -1)
{
NumToString((long)coordV, numStr);
PasStringConcat(tempStr, numStr);
}
else
PasStringConcat(tempStr, "\p-");
MoveTo(4, 22);
DrawString(tempStr);
ForeColor(blueColor);
PasStringCopy("\pd: ", tempStr);
if (coordD != -1)
{
NumToString((long)coordD, numStr);
PasStringConcat(tempStr, numStr);
}
else
PasStringConcat(tempStr, "\p-");
MoveTo(5, 32);
DrawString(tempStr);
ForeColor(blackColor);
SetPort((GrafPtr)wasPort);
#endif
}
//-------------------------------------------------------------- OpenCoordWindow
// Brings up the Coordinate window.
void OpenCoordWindow (void)
{
#ifndef COMPILEDEMO
Rect src, dest;
Point globalMouse;
short direction, dist;
if (coordWindow == nil)
{
QSetRect(&coordWindowRect, 0, 0, 50, 38);
if (thisMac.hasColor)
coordWindow = NewCWindow(nil, &coordWindowRect,
"\pTools", false, kWindoidWDEF, kPutInFront, true, 0L);
else
coordWindow = NewWindow(nil, &coordWindowRect,
"\pTools", false, kWindoidWDEF, kPutInFront, true, 0L);
if (coordWindow == nil)
RedAlert(kErrNoMemory);
// if (OptionKeyDown())
// {
// isCoordH = qd.screenBits.bounds.right - 55;
// isCoordV = 204;
// }
MoveWindow(coordWindow, isCoordH, isCoordV, true);
globalMouse = MyGetGlobalMouse();
QSetRect(&src, 0, 0, 1, 1);
QOffsetRect(&src, globalMouse.h, globalMouse.v);
GetWindowRect(coordWindow, &dest);
BringToFront(coordWindow);
ShowHide(coordWindow, true);
// FlagWindowFloating(coordWindow); TEMP - use flaoting windows
HiliteAllWindows();
coordH = -1;
coordV = -1;
coordD = -1;
TextFace(applFont);
TextSize(9);
if (objActive != kNoObjectSelected)
{
if (ObjectHasHandle(&direction, &dist))
coordD = dist;
SetCoordinateHVD(theMarquee.bounds.left, theMarquee.bounds.top, coordD);
}
}
UpdateCoordinateCheckmark(true);
#endif
}
//-------------------------------------------------------------- CloseCoordWindow
// Closes and disposes of the Coordinate window.
void CloseCoordWindow (void)
{
CloseThisWindow(&coordWindow);
UpdateCoordinateCheckmark(false);
}
//-------------------------------------------------------------- ToggleCoordinateWindow
// Toggles the Coordinate windows state between open and closed.
void ToggleCoordinateWindow (void)
{
#ifndef COMPILEDEMO
if (coordWindow == nil)
{
OpenCoordWindow();
isCoordOpen = true;
}
else
{
CloseCoordWindow();
isCoordOpen = false;
}
#endif
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,102 @@
//============================================================================ //---------------------------------------------------------------------------- // FileError.c //---------------------------------------------------------------------------- //============================================================================ #include <NumberFormatting.h> #include <TextUtils.h> #include "Externs.h" #define rFileErrorAlert 140 #define rFileErrorStrings 140 //============================================================== Functions //-------------------------------------------------------------- CheckFileError // Given a result code (returned from a previous file operation) thisÉ // function cheks to see if the result code is an error and, if it isÉ // a common error for which I have a string message, I bring up anÉ // alert with the error message. If it is an unusual error, I stillÉ // bring up an alert but with "Miscellaneous file error" and theÉ // error ID. Boolean CheckFileError (short resultCode, StringPtr fileName) { short dummyInt, stringIndex; Str255 errMessage, errNumString; if (resultCode == noErr) // No problems? Then cruise return(true); switch (resultCode) { case dirFulErr: stringIndex = 2; break; case dskFulErr: stringIndex = 3; break; case ioErr: stringIndex = 4; break; case bdNamErr: stringIndex = 5; break; case fnOpnErr: stringIndex = 6; break; case mFulErr: stringIndex = 7; break; case tmfoErr: stringIndex = 8; break; case wPrErr: stringIndex = 9; break; case fLckdErr: stringIndex = 10; break; case vLckdErr: stringIndex = 11; break; case fBsyErr: stringIndex = 12; break; case dupFNErr: stringIndex = 13; break; case opWrErr: stringIndex = 14; break; case volOffLinErr: stringIndex = 15; break; case permErr: stringIndex = 16; break; case wrPermErr: stringIndex = 17; break; default: stringIndex = 1; break; } InitCursor(); GetIndString(errMessage, rFileErrorStrings, stringIndex); NumToString((long)resultCode, errNumString); ParamText(errMessage, errNumString, fileName, "\p"); // CenterAlert(rFileErrorAlert); dummyInt = Alert(rFileErrorAlert, 0L); return(false); }
//============================================================================
//----------------------------------------------------------------------------
// FileError.c
//----------------------------------------------------------------------------
//============================================================================
#include <NumberFormatting.h>
#include <TextUtils.h>
#include "Externs.h"
#define rFileErrorAlert 140
#define rFileErrorStrings 140
//============================================================== Functions
//-------------------------------------------------------------- CheckFileError
// Given a result code (returned from a previous file operation) thisÉ
// function cheks to see if the result code is an error and, if it isÉ
// a common error for which I have a string message, I bring up anÉ
// alert with the error message. If it is an unusual error, I stillÉ
// bring up an alert but with "Miscellaneous file error" and theÉ
// error ID.
Boolean CheckFileError (short resultCode, StringPtr fileName)
{
short dummyInt, stringIndex;
Str255 errMessage, errNumString;
if (resultCode == noErr) // No problems? Then cruise
return(true);
switch (resultCode)
{
case dirFulErr:
stringIndex = 2;
break;
case dskFulErr:
stringIndex = 3;
break;
case ioErr:
stringIndex = 4;
break;
case bdNamErr:
stringIndex = 5;
break;
case fnOpnErr:
stringIndex = 6;
break;
case mFulErr:
stringIndex = 7;
break;
case tmfoErr:
stringIndex = 8;
break;
case wPrErr:
stringIndex = 9;
break;
case fLckdErr:
stringIndex = 10;
break;
case vLckdErr:
stringIndex = 11;
break;
case fBsyErr:
stringIndex = 12;
break;
case dupFNErr:
stringIndex = 13;
break;
case opWrErr:
stringIndex = 14;
break;
case volOffLinErr:
stringIndex = 15;
break;
case permErr:
stringIndex = 16;
break;
case wrPermErr:
stringIndex = 17;
break;
default:
stringIndex = 1;
break;
}
InitCursor();
GetIndString(errMessage, rFileErrorStrings, stringIndex);
NumToString((long)resultCode, errNumString);
ParamText(errMessage, errNumString, fileName, "\p");
// CenterAlert(rFileErrorAlert);
dummyInt = Alert(rFileErrorAlert, 0L);
return(false);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,145 @@
//============================================================================ //---------------------------------------------------------------------------- // Transitions.c //---------------------------------------------------------------------------- //============================================================================ #include "Externs.h" #include "Environ.h" #include "MainWindow.h" #include "RectUtils.h" //============================================================== Functions //-------------------------------------------------------------- PourScreenOn void PourScreenOn (Rect *theRect) { #define kMaxColumnsWide 96 #define kChipHigh 20 #define kChipWide 16 Rect columnRects[kMaxColumnsWide]; short columnProgress[kMaxColumnsWide]; short i, colsComplete, colWide, rowTall; Boolean working; colWide = theRect->right / kChipWide; // determine # of cols rowTall = (theRect->bottom / kChipHigh) + 1; // determine # of rows working = true; colsComplete = 0; for (i = 0; i < colWide; i++) { columnProgress[i] = 0; QSetRect(&columnRects[i], 0, 0, kChipWide, kChipHigh); QOffsetRect(&columnRects[i], (i * kChipWide) + theRect->left, theRect->top); } while (working) { do { i = RandomInt(colWide); } while (columnProgress[i] >= rowTall); if (columnRects[i].left < theRect->left) columnRects[i].left = theRect->left; if (columnRects[i].top < theRect->top) columnRects[i].top = theRect->top; if (columnRects[i].right > theRect->right) columnRects[i].right = theRect->right; if (columnRects[i].bottom > theRect->bottom) columnRects[i].bottom = theRect->bottom; CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap), GetPortBitMapForCopyBits(GetWindowPort(mainWindow)), &columnRects[i], &columnRects[i], srcCopy, nil); QOffsetRect(&columnRects[i], 0, kChipHigh); columnProgress[i]++; if (columnProgress[i] >= rowTall) { colsComplete++; if (colsComplete >= colWide) working = false; } } } //-------------------------------------------------------------- WipeScreenOn void WipeScreenOn (short direction, Rect *theRect) { #define kWipeRectThick 4 Rect wipeRect; RgnHandle dummyRgn; short hOffset, vOffset; short i, count; wipeRect = *theRect; switch (direction) { case kAbove: wipeRect.bottom = wipeRect.top + kWipeRectThick; hOffset = 0; vOffset = kWipeRectThick; count = ((theRect->bottom - theRect->top) / kWipeRectThick) + 1; break; case kToRight: wipeRect.left = wipeRect.right - kWipeRectThick; hOffset = -kWipeRectThick; vOffset = 0; count = workSrcRect.right / kWipeRectThick; break; case kBelow: wipeRect.top = wipeRect.bottom - kWipeRectThick; hOffset = 0; vOffset = -kWipeRectThick; count = ((theRect->bottom - theRect->top) / kWipeRectThick) + 1; break; case kToLeft: wipeRect.right = wipeRect.left + kWipeRectThick; hOffset = kWipeRectThick; vOffset = 0; count = workSrcRect.right / kWipeRectThick; break; } dummyRgn = NewRgn(); for (i = 0; i < count; i++) { CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap), GetPortBitMapForCopyBits(GetWindowPort(mainWindow)), &wipeRect, &wipeRect, srcCopy, GetPortVisibleRegion(GetWindowPort(mainWindow), dummyRgn)); QOffsetRect(&wipeRect, hOffset, vOffset); if (wipeRect.top < theRect->top) wipeRect.top = theRect->top; else if (wipeRect.top > theRect->bottom) wipeRect.top = theRect->bottom; if (wipeRect.bottom < theRect->top) wipeRect.bottom = theRect->top; else if (wipeRect.bottom > theRect->bottom) wipeRect.bottom = theRect->bottom; } DisposeRgn(dummyRgn); } //-------------------------------------------------------------- DumpScreenOn void DumpScreenOn (Rect *theRect) { CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap), GetPortBitMapForCopyBits(GetWindowPort(mainWindow)), theRect, theRect, srcCopy, nil); }
//============================================================================
//----------------------------------------------------------------------------
// Transitions.c
//----------------------------------------------------------------------------
//============================================================================
#include "Externs.h"
#include "Environ.h"
#include "MainWindow.h"
#include "RectUtils.h"
//============================================================== Functions
//-------------------------------------------------------------- PourScreenOn
void PourScreenOn (Rect *theRect)
{
#define kMaxColumnsWide 96
#define kChipHigh 20
#define kChipWide 16
Rect columnRects[kMaxColumnsWide];
short columnProgress[kMaxColumnsWide];
short i, colsComplete, colWide, rowTall;
Boolean working;
colWide = theRect->right / kChipWide; // determine # of cols
rowTall = (theRect->bottom / kChipHigh) + 1; // determine # of rows
working = true;
colsComplete = 0;
for (i = 0; i < colWide; i++)
{
columnProgress[i] = 0;
QSetRect(&columnRects[i], 0, 0, kChipWide, kChipHigh);
QOffsetRect(&columnRects[i], (i * kChipWide) + theRect->left, theRect->top);
}
while (working)
{
do
{
i = RandomInt(colWide);
}
while (columnProgress[i] >= rowTall);
if (columnRects[i].left < theRect->left)
columnRects[i].left = theRect->left;
if (columnRects[i].top < theRect->top)
columnRects[i].top = theRect->top;
if (columnRects[i].right > theRect->right)
columnRects[i].right = theRect->right;
if (columnRects[i].bottom > theRect->bottom)
columnRects[i].bottom = theRect->bottom;
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
&columnRects[i], &columnRects[i], srcCopy, nil);
QOffsetRect(&columnRects[i], 0, kChipHigh);
columnProgress[i]++;
if (columnProgress[i] >= rowTall)
{
colsComplete++;
if (colsComplete >= colWide)
working = false;
}
}
}
//-------------------------------------------------------------- WipeScreenOn
void WipeScreenOn (short direction, Rect *theRect)
{
#define kWipeRectThick 4
Rect wipeRect;
RgnHandle dummyRgn;
short hOffset, vOffset;
short i, count;
wipeRect = *theRect;
switch (direction)
{
case kAbove:
wipeRect.bottom = wipeRect.top + kWipeRectThick;
hOffset = 0;
vOffset = kWipeRectThick;
count = ((theRect->bottom - theRect->top) / kWipeRectThick) + 1;
break;
case kToRight:
wipeRect.left = wipeRect.right - kWipeRectThick;
hOffset = -kWipeRectThick;
vOffset = 0;
count = workSrcRect.right / kWipeRectThick;
break;
case kBelow:
wipeRect.top = wipeRect.bottom - kWipeRectThick;
hOffset = 0;
vOffset = -kWipeRectThick;
count = ((theRect->bottom - theRect->top) / kWipeRectThick) + 1;
break;
case kToLeft:
wipeRect.right = wipeRect.left + kWipeRectThick;
hOffset = kWipeRectThick;
vOffset = 0;
count = workSrcRect.right / kWipeRectThick;
break;
}
dummyRgn = NewRgn();
for (i = 0; i < count; i++)
{
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
&wipeRect, &wipeRect, srcCopy, GetPortVisibleRegion(GetWindowPort(mainWindow), dummyRgn));
QOffsetRect(&wipeRect, hOffset, vOffset);
if (wipeRect.top < theRect->top)
wipeRect.top = theRect->top;
else if (wipeRect.top > theRect->bottom)
wipeRect.top = theRect->bottom;
if (wipeRect.bottom < theRect->top)
wipeRect.bottom = theRect->top;
else if (wipeRect.bottom > theRect->bottom)
wipeRect.bottom = theRect->bottom;
}
DisposeRgn(dummyRgn);
}
//-------------------------------------------------------------- DumpScreenOn
void DumpScreenOn (Rect *theRect)
{
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
theRect, theRect, srcCopy, nil);
}

View File

@ -1 +1,205 @@
//============================================================================ //---------------------------------------------------------------------------- // Triggers.c //---------------------------------------------------------------------------- //============================================================================ #include "Externs.h" #define kMaxTriggers 16 typedef struct { short object, room; short index, timer; short what; Boolean armed; } trigType, *trigPtr; short FindEmptyTriggerSlot (void); void FireTrigger (short); trigType triggers[kMaxTriggers]; //============================================================== Functions //-------------------------------------------------------------- ArmTrigger void ArmTrigger (hotPtr who) { short where, whoLinked; if (who->stillOver) return; where = FindEmptyTriggerSlot(); if (where != -1) { whoLinked = who->who; // what is trigger's obj. # triggers[where].room = masterObjects[whoLinked].roomLink; triggers[where].object = masterObjects[whoLinked].objectLink; triggers[where].index = whoLinked; triggers[where].timer = masterObjects[whoLinked].theObject.data.e.delay * 3; triggers[where].what = masterObjects[triggers[where].object].theObject.what; triggers[where].armed = true; } who->stillOver = true; } //-------------------------------------------------------------- FindEmptyTriggerSlot short FindEmptyTriggerSlot (void) { short where, i; where = -1; for (i = 0; i < kMaxTriggers; i++) { if (!triggers[i].armed) { where = i; break; } } return (where); } //-------------------------------------------------------------- HandleTriggers void HandleTriggers (void) { short i; for (i = 0; i < kMaxTriggers; i++) { if (triggers[i].armed) { triggers[i].timer--; if (triggers[i].timer <= 0) { triggers[i].timer = 0; triggers[i].armed = false; FireTrigger(i); } } } } //-------------------------------------------------------------- FireTrigger void FireTrigger (short index) { short triggerIs, triggeredIs; char wasState; triggerIs = triggers[index].index; if (masterObjects[triggerIs].localLink != -1) { triggeredIs = masterObjects[triggerIs].localLink; switch (masterObjects[triggeredIs].theObject.what) { case kGreaseRt: case kGreaseLf: if (SetObjectState(triggers[index].room, triggers[index].object, kForceOn, triggeredIs)) { SpillGrease(masterObjects[triggeredIs].dynaNum, masterObjects[triggeredIs].hotNum); } break; case kLightSwitch: case kMachineSwitch: case kThermostat: case kPowerSwitch: case kKnifeSwitch: case kInvisSwitch: TriggerSwitch(masterObjects[triggeredIs].dynaNum); break; case kSoundTrigger: PlayPrioritySound(kChordSound, kChordPriority); // Change me break; case kToaster: TriggerToast(masterObjects[triggeredIs].dynaNum); break; case kGuitar: PlayPrioritySound(kChordSound, kChordPriority); break; case kCoffee: PlayPrioritySound(kCoffeeSound, kCoffeePriority); break; case kOutlet: TriggerOutlet(masterObjects[triggeredIs].dynaNum); break; case kBalloon: TriggerBalloon(masterObjects[triggeredIs].dynaNum); break; case kCopterLf: case kCopterRt: TriggerCopter(masterObjects[triggeredIs].dynaNum); break; case kDartLf: case kDartRt: TriggerDart(masterObjects[triggeredIs].dynaNum); break; case kDrip: TriggerDrip(masterObjects[triggeredIs].dynaNum); break; case kFish: TriggerFish(masterObjects[triggeredIs].dynaNum); break; } } else { wasState = HGetState((Handle)thisHouse); HLock((Handle)thisHouse); triggeredIs = masterObjects[triggerIs].localLink; switch ((*thisHouse)->rooms[triggers[index].room]. objects[triggers[index].object].what) { case kGreaseRt: case kGreaseLf: if (SetObjectState(triggers[index].room, triggers[index].object, kForceOn, triggeredIs)) { SpillGrease(masterObjects[triggeredIs].dynaNum, masterObjects[triggeredIs].hotNum); } break; } HSetState((Handle)thisHouse, wasState); } } //-------------------------------------------------------------- ZeroTriggers void ZeroTriggers (void) { short i; for (i = 0; i < kMaxTriggers; i++) triggers[i].armed = false; }
//============================================================================
//----------------------------------------------------------------------------
// Triggers.c
//----------------------------------------------------------------------------
//============================================================================
#include "Externs.h"
#define kMaxTriggers 16
typedef struct
{
short object, room;
short index, timer;
short what;
Boolean armed;
} trigType, *trigPtr;
short FindEmptyTriggerSlot (void);
void FireTrigger (short);
trigType triggers[kMaxTriggers];
//============================================================== Functions
//-------------------------------------------------------------- ArmTrigger
void ArmTrigger (hotPtr who)
{
short where, whoLinked;
if (who->stillOver)
return;
where = FindEmptyTriggerSlot();
if (where != -1)
{
whoLinked = who->who; // what is trigger's obj. #
triggers[where].room = masterObjects[whoLinked].roomLink;
triggers[where].object = masterObjects[whoLinked].objectLink;
triggers[where].index = whoLinked;
triggers[where].timer = masterObjects[whoLinked].theObject.data.e.delay * 3;
triggers[where].what = masterObjects[triggers[where].object].theObject.what;
triggers[where].armed = true;
}
who->stillOver = true;
}
//-------------------------------------------------------------- FindEmptyTriggerSlot
short FindEmptyTriggerSlot (void)
{
short where, i;
where = -1;
for (i = 0; i < kMaxTriggers; i++)
{
if (!triggers[i].armed)
{
where = i;
break;
}
}
return (where);
}
//-------------------------------------------------------------- HandleTriggers
void HandleTriggers (void)
{
short i;
for (i = 0; i < kMaxTriggers; i++)
{
if (triggers[i].armed)
{
triggers[i].timer--;
if (triggers[i].timer <= 0)
{
triggers[i].timer = 0;
triggers[i].armed = false;
FireTrigger(i);
}
}
}
}
//-------------------------------------------------------------- FireTrigger
void FireTrigger (short index)
{
short triggerIs, triggeredIs;
char wasState;
triggerIs = triggers[index].index;
if (masterObjects[triggerIs].localLink != -1)
{
triggeredIs = masterObjects[triggerIs].localLink;
switch (masterObjects[triggeredIs].theObject.what)
{
case kGreaseRt:
case kGreaseLf:
if (SetObjectState(triggers[index].room, triggers[index].object,
kForceOn, triggeredIs))
{
SpillGrease(masterObjects[triggeredIs].dynaNum,
masterObjects[triggeredIs].hotNum);
}
break;
case kLightSwitch:
case kMachineSwitch:
case kThermostat:
case kPowerSwitch:
case kKnifeSwitch:
case kInvisSwitch:
TriggerSwitch(masterObjects[triggeredIs].dynaNum);
break;
case kSoundTrigger:
PlayPrioritySound(kChordSound, kChordPriority); // Change me
break;
case kToaster:
TriggerToast(masterObjects[triggeredIs].dynaNum);
break;
case kGuitar:
PlayPrioritySound(kChordSound, kChordPriority);
break;
case kCoffee:
PlayPrioritySound(kCoffeeSound, kCoffeePriority);
break;
case kOutlet:
TriggerOutlet(masterObjects[triggeredIs].dynaNum);
break;
case kBalloon:
TriggerBalloon(masterObjects[triggeredIs].dynaNum);
break;
case kCopterLf:
case kCopterRt:
TriggerCopter(masterObjects[triggeredIs].dynaNum);
break;
case kDartLf:
case kDartRt:
TriggerDart(masterObjects[triggeredIs].dynaNum);
break;
case kDrip:
TriggerDrip(masterObjects[triggeredIs].dynaNum);
break;
case kFish:
TriggerFish(masterObjects[triggeredIs].dynaNum);
break;
}
}
else
{
wasState = HGetState((Handle)thisHouse);
HLock((Handle)thisHouse);
triggeredIs = masterObjects[triggerIs].localLink;
switch ((*thisHouse)->rooms[triggers[index].room].
objects[triggers[index].object].what)
{
case kGreaseRt:
case kGreaseLf:
if (SetObjectState(triggers[index].room, triggers[index].object,
kForceOn, triggeredIs))
{
SpillGrease(masterObjects[triggeredIs].dynaNum,
masterObjects[triggeredIs].hotNum);
}
break;
}
HSetState((Handle)thisHouse, wasState);
}
}
//-------------------------------------------------------------- ZeroTriggers
void ZeroTriggers (void)
{
short i;
for (i = 0; i < kMaxTriggers; i++)
triggers[i].armed = false;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1,172 @@
//============================================================================ //---------------------------------------------------------------------------- // WindowUtils.c //---------------------------------------------------------------------------- //============================================================================ #include "Externs.h" #include "Environ.h" #include "RectUtils.h" #define kFloatingKind 2048 #define kMessageWindowTall 48 WindowPtr mssgWindow; //============================================================== Functions //-------------------------------------------------------------- GetWindowTopLeft // Returns the top left coordinate of the specified window. CorrdinatesÉ // are (of course) global (local coordinates would always be (0, 0)). void GetWindowLeftTop (WindowPtr theWindow, short *left, short *top) { Point thePoint; Rect bounds; *left = 0; *top = 0; if (theWindow != nil) { SetPortWindowPort(theWindow); GetWindowBounds(theWindow, kWindowContentRgn, &bounds); thePoint.h = bounds.left; thePoint.v = bounds.top; LocalToGlobal(&thePoint); *left = thePoint.h; *top = thePoint.v; } } //-------------------------------------------------------------- GetWindowRect // Returns bounding rectangle of the specified window in global coords. void GetWindowRect (WindowPtr theWindow, Rect *bounds) { if (theWindow != nil) { SetPortWindowPort(theWindow); GetWindowBounds(theWindow, kWindowContentRgn, bounds); LocalToGlobalRect(bounds); } } //-------------------------------------------------------------- GetLocalWindowRect // Returns bounding rectangle of the specified window in local coords. // (When you just need its width and height.) void GetLocalWindowRect (WindowPtr theWindow, Rect *bounds) { if (theWindow != nil) { SetPortWindowPort(theWindow); GetWindowBounds(theWindow, kWindowContentRgn, bounds); } } //-------------------------------------------------------------- FlagWindowFloating // Sets the specified window's windowKind field to my own kFloatingKindÉ // variable. This way I can examine a window later and determine ifÉ // it's supposed to "float" above all other windows. /* void FlagWindowFloating (WindowPtr theWindow) { if (theWindow != nil) { ((WindowPeek)theWindow)->windowKind = kFloatingKind; BringToFront(theWindow); } } //-------------------------------------------------------------- IsWindowFloating // Tests a specific window to see if it is supposed to "float" above allÉ // other windows. Boolean IsWindowFloating (WindowPtr theWindow) { if (theWindow != nil) { return (((WindowPeek)theWindow)->windowKind == kFloatingKind); } else return (false); } */ //-------------------------------------------------------------- OpenMessageWindow // Brings up a simple message window. Nice sort of utility function. // Anytime you want a small, quick message to come up, call this. void OpenMessageWindow (StringPtr title) { Rect mssgWindowRect; SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall); if (thisMac.hasColor) mssgWindow = NewCWindow(nil, &mssgWindowRect, title, false, noGrowDocProc, kPutInFront, false, 0L); else mssgWindow = NewWindow(nil, &mssgWindowRect, title, false, noGrowDocProc, kPutInFront, false, 0L); if (mssgWindow != nil) { ShowWindow(mssgWindow); SetPort((GrafPtr)mssgWindow); ClipRect(&mssgWindowRect); ForeColor(blackColor); BackColor(whiteColor); TextFont(systemFont); } } //-------------------------------------------------------------- SetMessageWindowMessage // For the above message window, this function displays a string of textÉ // in the center of the window. void SetMessageWindowMessage (StringPtr message) { Rect mssgWindowRect; if (mssgWindow != nil) { SetPort((GrafPtr)mssgWindow); SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall); InsetRect(&mssgWindowRect, 16, 16); EraseRect(&mssgWindowRect); MoveTo(mssgWindowRect.left, mssgWindowRect.bottom - 6); DrawString(message); } } //-------------------------------------------------------------- CloseMessageWindow // Closes the previously referred to "message window". void CloseMessageWindow (void) { if (mssgWindow != nil) DisposeWindow(mssgWindow); mssgWindow = nil; } //-------------------------------------------------------------- CloseThisWindow // Given a specific window, this function will close it and set the windowÉ // pointer to null. void CloseThisWindow (WindowPtr *theWindow) { if (*theWindow != nil) DisposeWindow(*theWindow); *theWindow = nil; }
//============================================================================
//----------------------------------------------------------------------------
// WindowUtils.c
//----------------------------------------------------------------------------
//============================================================================
#include "Externs.h"
#include "Environ.h"
#include "RectUtils.h"
#define kFloatingKind 2048
#define kMessageWindowTall 48
WindowPtr mssgWindow;
//============================================================== Functions
//-------------------------------------------------------------- GetWindowTopLeft
// Returns the top left coordinate of the specified window. CorrdinatesÉ
// are (of course) global (local coordinates would always be (0, 0)).
void GetWindowLeftTop (WindowPtr theWindow, short *left, short *top)
{
Point thePoint;
Rect bounds;
*left = 0;
*top = 0;
if (theWindow != nil)
{
SetPortWindowPort(theWindow);
GetWindowBounds(theWindow, kWindowContentRgn, &bounds);
thePoint.h = bounds.left;
thePoint.v = bounds.top;
LocalToGlobal(&thePoint);
*left = thePoint.h;
*top = thePoint.v;
}
}
//-------------------------------------------------------------- GetWindowRect
// Returns bounding rectangle of the specified window in global coords.
void GetWindowRect (WindowPtr theWindow, Rect *bounds)
{
if (theWindow != nil)
{
SetPortWindowPort(theWindow);
GetWindowBounds(theWindow, kWindowContentRgn, bounds);
LocalToGlobalRect(bounds);
}
}
//-------------------------------------------------------------- GetLocalWindowRect
// Returns bounding rectangle of the specified window in local coords.
// (When you just need its width and height.)
void GetLocalWindowRect (WindowPtr theWindow, Rect *bounds)
{
if (theWindow != nil)
{
SetPortWindowPort(theWindow);
GetWindowBounds(theWindow, kWindowContentRgn, bounds);
}
}
//-------------------------------------------------------------- FlagWindowFloating
// Sets the specified window's windowKind field to my own kFloatingKindÉ
// variable. This way I can examine a window later and determine ifÉ
// it's supposed to "float" above all other windows.
/*
void FlagWindowFloating (WindowPtr theWindow)
{
if (theWindow != nil)
{
((WindowPeek)theWindow)->windowKind = kFloatingKind;
BringToFront(theWindow);
}
}
//-------------------------------------------------------------- IsWindowFloating
// Tests a specific window to see if it is supposed to "float" above allÉ
// other windows.
Boolean IsWindowFloating (WindowPtr theWindow)
{
if (theWindow != nil)
{
return (((WindowPeek)theWindow)->windowKind == kFloatingKind);
}
else
return (false);
}
*/
//-------------------------------------------------------------- OpenMessageWindow
// Brings up a simple message window. Nice sort of utility function.
// Anytime you want a small, quick message to come up, call this.
void OpenMessageWindow (StringPtr title)
{
Rect mssgWindowRect;
SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall);
if (thisMac.hasColor)
mssgWindow = NewCWindow(nil, &mssgWindowRect,
title, false, noGrowDocProc, kPutInFront, false, 0L);
else
mssgWindow = NewWindow(nil, &mssgWindowRect,
title, false, noGrowDocProc, kPutInFront, false, 0L);
if (mssgWindow != nil)
{
ShowWindow(mssgWindow);
SetPort((GrafPtr)mssgWindow);
ClipRect(&mssgWindowRect);
ForeColor(blackColor);
BackColor(whiteColor);
TextFont(systemFont);
}
}
//-------------------------------------------------------------- SetMessageWindowMessage
// For the above message window, this function displays a string of textÉ
// in the center of the window.
void SetMessageWindowMessage (StringPtr message)
{
Rect mssgWindowRect;
if (mssgWindow != nil)
{
SetPort((GrafPtr)mssgWindow);
SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall);
InsetRect(&mssgWindowRect, 16, 16);
EraseRect(&mssgWindowRect);
MoveTo(mssgWindowRect.left, mssgWindowRect.bottom - 6);
DrawString(message);
}
}
//-------------------------------------------------------------- CloseMessageWindow
// Closes the previously referred to "message window".
void CloseMessageWindow (void)
{
if (mssgWindow != nil)
DisposeWindow(mssgWindow);
mssgWindow = nil;
}
//-------------------------------------------------------------- CloseThisWindow
// Given a specific window, this function will close it and set the windowÉ
// pointer to null.
void CloseThisWindow (WindowPtr *theWindow)
{
if (*theWindow != nil)
DisposeWindow(*theWindow);
*theWindow = nil;
}