mirror of
https://github.com/softdorothy/GliderPRO.git
synced 2024-11-29 07:49:46 +00:00
1 line
21 KiB
C
1 line
21 KiB
C
|
//============================================================================
//----------------------------------------------------------------------------
// HighScores.c
//----------------------------------------------------------------------------
//============================================================================
#include <Folders.h>
#include <NumberFormatting.h>
#include <Script.h>
#include <Sound.h>
#include <StringCompare.h>
#include "DialogUtils.h"
#include "Externs.h"
#include "Environ.h"
#include "House.h"
#include "MainWindow.h"
#include "RectUtils.h"
#include "Utilities.h"
#define kHighScoresPictID 1994
#define kHighScoresMaskID 1998
#define kHighNameDialogID 1020
#define kHighBannerDialogID 1021
#define kHighNameItem 2
#define kNameNCharsItem 5
#define kHighBannerItem 2
#define kBannerScoreNCharsItem 5
void DrawHighScores (void);
void UpdateNameDialog (DialogPtr);
pascal Boolean NameFilter (DialogPtr, EventRecord *, short *);
void GetHighScoreName (short);
void UpdateBannerDialog (DialogPtr);
pascal Boolean BannerFilter (DialogPtr, EventRecord *, short *);
void GetHighScoreBanner (void);
Boolean CreateScoresFolder (long *);
Boolean FindHighScoresFolder (short *, long *);
Boolean OpenHighScoresFile (FSSpec *, short *);
Str31 highBanner;
Str15 highName;
short lastHighScore;
Boolean keyStroke;
extern short splashOriginH, splashOriginV;
extern Boolean quickerTransitions, resumedSavedGame;
//============================================================== Functions
//-------------------------------------------------------------- DoHighScores
// Handles fading in and cleaning up the high scores screen.
void DoHighScores (void)
{
Rect tempRect;
SpinCursor(3);
SetPort((GrafPtr)workSrcMap);
PaintRect(&workSrcRect);
QSetRect(&tempRect, 0, 0, 640, 480);
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
LoadScaledGraphic(kStarPictID, &tempRect);
// if (quickerTransitions)
// DissBitsChunky(&workSrcRect);
// else
// DissBits(&workSrcRect);
SpinCursor(3);
SetPort((GrafPtr)workSrcMap);
DrawHighScores();
SpinCursor(3);
// if (quickerTransitions)
// DissBitsChunky(&workSrcRect);
// else
// DissBits(&workSrcRect);
InitCursor();
DelayTicks(60);
WaitForInputEvent(30);
RedrawSplashScreen();
}
//-------------------------------------------------------------- DrawHighScores
// Draws the actual scores on the screen.
#define kScoreSpacing 18
#define kScoreWide 352
#define kKimsLifted 4
void DrawHighScores (void)
{
GWorldPtr tempMap, tempMask;
CGrafPtr wasCPort;
GDHandle wasWorld;
OSErr theErr;
houseType *thisHousePtr;
Rect tempRect, tempRect2;
Str255 tempStr;
short scoreLeft, bannerWidth, i, dropIt;
char wasState;
scoreLeft = ((thisMac.screen.right - thisMac.screen.left) - kScoreWide) / 2;
dropIt = 129 + splashOriginV;
GetGWorld(&wasCPort, &wasWorld);
QSetRect(&tempRect, 0, 0, 332, 30);
theErr = CreateOffScreenGWorld(&tempMap, &tempRect, kPreferredDepth);
SetGWorld(tempMap, nil);
LoadGraphic(kHighScoresPictID);
theErr = CreateOffScreenGWorld(&tempMask, &tempRect, 1);
SetGWorld(tempMask, nil);
LoadGraphic(kHighScoresMaskID);
tempRect2 = tempRect;
QOffsetRect(&tempRect2, scoreLeft + (kScoreWide - 332) / 2, dropIt - 60);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
(BitMap *)*GetGWorldPixMap(tempMask),
(BitMap *)*GetGWorldPixMap(workSrcMap),
&tempRect, &tempRect, &tempRect2);
DisposeGWorld(tempMap);
DisposeGWorld(tempMask);
SetGWorld(wasCPort, wasWorld);
TextFont(applFont);
TextFace(bold);
TextSize(14);
PasStringCopy("\p<EFBFBD> ", tempStr);
PasStringConcat(tempStr, thisHouseName);
PasStringConcat(tempStr, "\p <20>");
MoveTo(scoreLeft + ((kScoreWide - StringWidth(tempStr)) / 2) - 1, dropIt - 66);
ForeColor(blackColor);
DrawString(tempStr);
MoveTo(scoreLeft + ((kScoreWide - StringWidth(tempStr)) / 2), dropIt - 65);
ForeColor(cyanColor);
DrawString(tempStr);
ForeColor(blackColor);
TextFont(applFont);
TextFace(bold);
TextSize(12);
wasState = HGetState((Handle)thisHouse);
HLo
|