GliderPRO/Sources/StructuresInit.c

1 line
22 KiB
C
Raw Normal View History

//============================================================================ //---------------------------------------------------------------------------- // StructuresInit.c //---------------------------------------------------------------------------- //============================================================================ #include <Resources.h> #include "Externs.h" #include "Objects.h" #include "Play.h" #include "Player.h" #include "RectUtils.h" #include "RubberBands.h" #include "Scoreboard.h" #include "Utilities.h" #define kShadowPictID 3998 #define kBlowerPictID 4000 #define kFurniturePictID 4001 #define kBonusPictID 4002 #define kSwitchPictID 4003 #define kLightPictID 4004 #define kAppliancePictID 4005 #define kPointsPictID 4006 #define kRubberBandsPictID 4007 #define kTransportPictID 4008 #define kToastPictID 4009 #define kShreddedPictID 4010 #define kBalloonPictID 4011 #define kCopterPictID 4012 #define kDartPictID 4013 #define kBallPictID 4014 #define kDripPictID 4015 #define kEnemyPictID 4016 #define kFishPictID 4017 #define kBadgePictID 1996 extern Rect glidSrcRect, leftStartGliderSrc, rightStartGliderSrc; extern Rect gliderSrc[], shadowSrcRect, shadowSrc[]; extern Rect bandsSrcRect, bandRects[], boardSrcRect, boardDestRect; extern Rect boardTSrcRect, boardTDestRect, badgeSrcRect; extern Rect boardGSrcRect, boardGDestRect, boardPSrcRect, boardPDestRect; extern Rect boardPQDestRect, boardGQDestRect, badgesBlankRects[]; extern Rect badgesBadgesRects[], badgesDestRects[]; extern Rect nailSrcRect, sparkleSrc[]; extern Rect pointsSrc[], breadSrc[]; extern short wasScoreboardMode; //============================================================== Functions //-------------------------------------------------------------- InitScoreboardMap // Any graphics and structures relating to the scoreboard that appears<72> // across the top of the game are initialized and loaded up here. void InitScoreboardMap (void) { Rect bounds; PicHandle thePicture; CGrafPtr wasCPort; GDHandle wasWorld; OSErr theErr; short hOffset; GetGWorld(&wasCPort, &wasWorld); wasScoreboardMode = kScoreboardHigh; boardSrcRect = houseRect; ZeroRectCorner(&boardSrcRect); boardSrcRect.bottom = kScoreboardTall; theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect, kPreferredDepth); SetGWorld(boardSrcMap, nil); if (boardSrcRect.right >= 640) hOffset = (RectWide(&boardSrcRect) - kMaxViewWidth) / 2; else hOffset = -576; thePicture = GetPicture(kScoreboardPictID); if (thePicture == nil) RedAlert(kErrFailedGraphicLoad); HLock((Handle)thePicture); bounds = (*thePicture)->picFrame; HUnlock((Handle)thePicture); QOffsetRect(&bounds, -bounds.left, -bounds.top); QOffsetRect(&bounds, hOffset, 0); DrawPicture(thePicture, &bounds); ReleaseResource((Handle)thePicture); QSetRect(&badgeSrcRect, 0, 0, 32, 66); // 2144 pixels theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect, kPreferredDepth); SetGWorld(badgeSrcMap, nil); LoadGraphic(kBadgePictID); boardDestRect = boardSrcRect; QOffsetRect(&boardDestRect, 0, -kScoreboardTall); hOffset = (RectWide(&houseRect) - 640) / 2; if (hOffset < 0) hOffset = -128; QSetRect(&boardTSrcRect, 0, 0, 256, 12); // room title theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredDepth); SetGWorld(boardTSrcMap, nil); boardTDestRect = boardTSrcRect; QOffsetRect(&boardTDestRect, 137 + hOffset, 5); TextFont(applFont); TextSize(12); TextFace(bold); QSetRect(&boardGSrcRect, 0, 0, 20, 10); // # gliders theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredDepth); SetGWorld(boardGSrcMap, nil); boardGDestRect = boardGSrcRect; QOffsetRect(&boardGDestRect, 526 + hOffset, 5); TextFont(applFont); TextSize(12); TextFace(bold); QSetRect(&boardPSrcRect, 0, 0, 64, 10); // points theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredDepth); SetGWorld(boardPSrcMap, nil); boardPDestRect = boardPSrcRect; QOffsetRect(&boardPDestRect,