1 line
26 KiB
C
Executable File
1 line
26 KiB
C
Executable File
/*============================================================*/
|
|
/*============================================================*/
|
|
/*== ==*/
|
|
/*== Initialize Game Structures ==*/
|
|
/*== ==*/
|
|
/*============================================================*/
|
|
/*============================================================*/
|
|
|
|
|
|
/*======================================================== Includes */
|
|
|
|
#include "Globals.h"
|
|
#include "UnivUtilities.h"
|
|
#include "InitGameStructs.h"
|
|
#include "Prefs.h"
|
|
#include <Sound.h>
|
|
#include "AnimCursor.h"
|
|
#include "PlayerStats.h"
|
|
|
|
|
|
/*======================================================== SetPrefsToDefault */
|
|
|
|
void SetPrefsToDefault (void)
|
|
|
|
{
|
|
short i;
|
|
|
|
lifeTime = 0L;
|
|
encryptedNumber = 0L;
|
|
GetChooserName((StringPtr)theNames[0]);
|
|
if (theNames[0][0] == 0)
|
|
PasStringCopy((StringPtr)"\pPlayer 1", (StringPtr)theNames[0]);
|
|
PasStringCopy((StringPtr)"\pPlayer 2", (StringPtr)theNames[1]);
|
|
PasStringCopy((StringPtr)"\pPlayer 3", (StringPtr)theNames[2]);
|
|
PasStringCopy((StringPtr)"\pPlayer 4", (StringPtr)theNames[3]);
|
|
PasStringCopy((StringPtr)"\pPlayer 5", (StringPtr)theNames[4]);
|
|
PasStringCopy((StringPtr)"\pPlayer 6", (StringPtr)theNames[5]);
|
|
PasStringCopy((StringPtr)"\pPlayer 7", (StringPtr)theNames[6]);
|
|
PasStringCopy((StringPtr)"\pPlayer 8", (StringPtr)theNames[7]);
|
|
PasStringCopy((StringPtr)"\pPlayer 9", (StringPtr)theNames[8]);
|
|
PasStringCopy((StringPtr)"\pPlayer 10", (StringPtr)theNames[9]);
|
|
|
|
ResetWorldRecords();
|
|
|
|
theOpponent.persona = kSimpleGeorge;
|
|
whichHumanNumber = 1;
|
|
whichGame = kStandardGame;
|
|
GetSoundVol(&soundVolume);
|
|
isLeague = kLittleLeague;
|
|
|
|
for (i = 0; i < 10; i++)
|
|
{
|
|
teaksThreshholds[i] = 50;
|
|
}
|
|
|
|
theOpponent.teaksThresh = teaksThreshholds[whichHumanNumber - 1];
|
|
|
|
useQD = FALSE;
|
|
willUseQD = useQD;
|
|
replayGoals = TRUE;
|
|
replayFouls = FALSE;
|
|
replayOnR = TRUE;
|
|
autoTeamsDialog = TRUE;
|
|
showBoardCursor = FALSE;
|
|
leftGoalIsPlayers = TRUE;
|
|
soundOn = TRUE;
|
|
beamSoundOn = TRUE;
|
|
incidentSoundOn = TRUE;
|
|
collisionSoundOn = TRUE;
|
|
crowdSoundOn = TRUE;
|
|
autoSetDepth = TRUE;
|
|
enableAnnouncer = TRUE;
|
|
enableBackground = FALSE;
|
|
doZooms = TRUE;
|
|
replayZooms = TRUE;
|
|
doSkipFrames = FALSE;
|
|
|
|
for (i = 0; i < 10; i++)
|
|
{
|
|
theStats[i].tournamentTime = 0L;
|
|
theStats[i].bestPlatinumTime = 0L;
|
|
theStats[i].copperTitles = 0;
|
|
theStats[i].bronzeTitles = 0;
|
|
theStats[i].silverTitles = 0;
|
|
theStats[i].goldTitles = 0;
|
|
theStats[i].platinumTitles = 0;
|
|
|
|
theStats[i].played = 0;
|
|
theStats[i].won = 0;
|
|
theStats[i].goals = 0;
|
|
theStats[i].fouls = 0;
|
|
theStats[i].criticals = 0;
|
|
theStats[i].oppGoals = 0;
|
|
theStats[i].oppFouls = 0;
|
|
theStats[i].oppCriticals = 0;
|
|
theStats[i].georgeState = kUnplayedState;
|
|
theStats[i].maraState = kUnplayedState;
|
|
theStats[i].ottoState = kUnplayedState;
|
|
theStats[i].claireState = kUnplayedState;
|
|
theStats[i].eazeState = kUnplayedState;
|
|
theStats[i].teakState = kUnplayedState;
|
|
}
|
|
}
|
|
|
|
|
|
/*======================================================== LoadThePreferences */
|
|
|
|
void LoadThePreferences (void)
|
|
|
|
{
|
|
prefsInfo thePreferred;
|
|
short i;
|
|
|
|
if (LoadPrefs(&thePreferred) == FALSE)
|
|
{
|
|
SetPrefsToDefault();
|
|
return;
|
|
}
|
|
|
|
if (thePreferred.prefVersion >= 0x0200)
|
|
{
|
|
SetPrefsToDefault();
|
|
return;
|
|
}
|
|
|
|
encryptedNumber = thePreferred.encryption;
|
|
lifeTime = thePreferred.timeWas;
|
|
|
|
PasStringCopy((StringPtr)thePreferred.mostTitlesName, (StringPtr)mostTitlesName);
|
|
mostTitlesDate = thePreferred.mostTitlesDate;
|
|
mostTitles = thePreferred.mostTitles;
|
|
PasStringCopy((StringPtr)thePreferred.mostPointsName, (StringPtr)mostPointsName);
|
|
mostPointsDate = thePreferred.mostPointsDate;
|
|
mostPoints = thePreferred.mostPoints;
|
|
PasStringCopy((StringPtr)thePreferred.mostFoulsName, (StringPtr)mostFoulsName);
|
|
mostFoulsDate = thePreferred.mostFoulsDate;
|
|
mostFouls = thePreferred.mostFouls;
|
|
PasStringCopy((StringPtr)thePreferred.mostCritsName, (StringPtr)mostCritsName);
|
|
mostCritsDate = thePreferred.mostCritsDate;
|
|
mostCrits = thePreferred.mostCrits;
|
|
|
|
for (i = 0; i < 10; i++)
|
|
{
|
|
PasStringCopy((StringPtr)thePreferred.namesWere[i], (StringPtr)theNames[i]);
|
|
}
|
|
|
|
theOpponent.persona = thePreferred.opponentWas;
|
|
if ((theOpponent.persona < kSimpleGeorge) || (theOpponent.persona > kNetHuman))
|
|
theOpponent.persona = kSimpleGeorge;
|
|
|
|
whichHumanNumber = thePreferred.playerWas;
|
|
if ((whichHumanNumber < 1) || (whichHumanNumber > 10))
|
|
whichHumanNumber = 1;
|
|
|
|
whichGame = thePreferred.gameWas;
|
|
if ((whichGame < kPracticeBoardin) || (whichGame > kTournament))
|
|
whichGame = kStandardGame;
|
|
|
|
isLeague = thePreferred.wasLeague;
|
|
if ((isLeague < kLittleLeague) || (isLeague > kProfessional))
|
|
isLeague = kLittleLeague;
|
|
|
|
for (i = 0; i < 10; i++)
|
|
{
|
|
teaksThreshholds[i] = thePreferred.wasTeaksThresh[i];
|
|
if ((teaksThreshholds[i] < 4) || (teaksThreshholds[i] > 95))
|
|
teaksThreshholds[i] = 50;
|
|
}
|
|
|
|
theOpponent.teaksThresh = teaksThreshholds[whichHumanNumber - 1];
|
|
|
|
soundVolume = thePreferred.wasVolume;
|
|
if ((soundVolume < 0) || (soundVolume > 7))
|
|
soundVolume = 7;
|
|
|
|
useQD = thePreferred.wasUseQD;
|
|
willUseQD = useQD;
|
|
autoTeamsDialog = thePreferred.wasAutoTeams;
|
|
replayGoals = thePreferred.replayGoalsWas;
|
|
replayFouls = thePreferred.replayFoulsWas;
|
|
replayOnR = thePreferred.replayOnRWas;
|
|
showBoardCursor = thePreferred.wasShowCursor;
|
|
leftGoalIsPlayers = thePreferred.leftGoalWasPlayers;
|
|
soundOn = thePreferred.wasSoundOn;
|
|
beamSoundOn = thePreferred.wasBeamSoundOn;
|
|
incidentSoundOn = thePreferred.wasIncidentSoundOn;
|
|
collisionSoundOn = thePreferred.wasCollisionSoundOn;
|
|
crowdSoundOn = thePreferred.wasCrowdSoundOn;
|
|
autoSetDepth = thePreferred.wasSetDepth;
|
|
enableAnnouncer = thePreferred.wasAnnouncer;
|
|
enableBackground = thePreferred.wasBackground;
|
|
doZooms = thePreferred.wasZooms;
|
|
replayZooms = thePreferred.wasReplayZooms;
|
|
doSkipFrames = thePreferred.wasSkipFrames;
|
|
netOnly = thePreferred.wasNetOnly;
|
|
|
|
for (i = 0; i < 10; i++)
|
|
{
|
|
theStats[i].tournamentTime = thePreferred.wasStats[i].tournamentTime;
|
|
theStats[i].bestPlatinumTime = thePreferred.wasStats[i].bestPlatinumTime;
|
|
theStats[i].copperTitles = thePreferred.wasStats[i].copperTitles;
|
|
theStats[i].bronzeTitles = thePreferred.wasStats[i].bronzeTitles;
|
|
theStats[i].silverTitles = thePreferred.wasStats[i].silverTitles;
|
|
theStats[i].goldTitles = thePreferred.wasStats[i].goldTitles;
|
|
theStats[i].platinumTitles = thePreferred.wasStats[i].platinumTitles;
|
|
|
|
theStats[i].played = thePreferred.wasStats[i].played;
|
|
theStats[i].won = thePreferred.wasStats[i].won;
|
|
theStats[i].goals = thePreferred.wasStats[i].goals;
|
|
theStats[i].fouls = thePreferred.wasStats[i].fouls;
|
|
theStats[i].criticals = thePreferred.wasStats[i].criticals;
|
|
theStats[i].oppGoals = thePreferred.wasStats[i].oppGoals;
|
|
theStats[i].oppFouls = thePreferred.wasStats[i].oppFouls;
|
|
theStats[i].oppCriticals = thePreferred.wasStats[i].oppCriticals;
|
|
theStats[i].georgeState = thePreferred.wasStats[i].georgeState;
|
|
theStats[i].maraState = thePreferred.wasStats[i].maraState;
|
|
theStats[i].ottoState = thePreferred.wasStats[i].ottoState;
|
|
theStats[i].claireState = thePreferred.wasStats[i].claireState;
|
|
theStats[i].eazeState = thePreferred.wasStats[i].eazeState;
|
|
theStats[i].teakState = thePreferred.wasStats[i].teakState;
|
|
}
|
|
|
|
#if kDemoVersion
|
|
theOpponent.persona = kSimpleGeorge;
|
|
whichGame = kStandardGame;
|
|
isLeague = kLittleLeague;
|
|
netOnly = FALSE;
|
|
#endif
|
|
}
|
|
|
|
|
|
/*======================================================== LoadLargeDataStructures */
|
|
|
|
void LoadLargeDataStructures (void)
|
|
|
|
{
|
|
Handle tempResHand;
|
|
short resID;
|
|
|
|
littleForceTable = (short *)NewPtr(sizeof(forceData));
|
|
if (littleForceTable == kNilPointer)
|
|
DeathError(kErrNoMemory);
|
|
|
|
juniorForceTable = (short *)NewPtr(sizeof(forceData));
|
|
if (juniorForceTable == kNilPointer)
|
|
DeathError(kErrNoMemory);
|
|
|
|
varsityForceTable = (short *)NewPtr(sizeof(forceData));
|
|
if (varsityForceTable == kNilPointer)
|
|
DeathError(kErrNoMemory);
|
|
|
|
minorForceTable = (short *)NewPtr(sizeof(forceData));
|
|
if (minorForceTable == kNilPointer)
|
|
DeathError(kErrNoMemory);
|
|
|
|
proForceTable = (short *)NewPtr(sizeof(forceData));
|
|
if (proForceTable == kNilPointer)
|
|
DeathError(kErrNoMemory);
|
|
|
|
if (displayMode == kDisplay13Inch)
|
|
resID = kLargeDishDataID;
|
|
else
|
|
resID = kSmallDishDataID;
|
|
|
|
tempResHand = GetResource('vert', resID);
|
|
if (tempResHand != kNilPointer)
|
|
{
|
|
HLock(tempResHand);
|
|
BlockMove(*tempResHand, &vertTable, sizeof(vertData));
|
|
HUnlock(tempResHand);
|
|
ReleaseResource(tempResHand);
|
|
}
|
|
else
|
|
DeathError(kErrNoMemory);
|
|
|
|
if (displayMode == kDisplay13Inch)
|
|
resID = 1100;
|
|
else
|
|
resID = 1000;
|
|
|
|
tempResHand = GetResource('forc', resID + 0);
|
|
if (tempResHand != kNilPointer)
|
|
{
|
|
HLock(tempResHand);
|
|
BlockMove(*tempResHand, littleForceTable, sizeof(forceData));
|
|
HUnlock(tempResHand);
|
|
ReleaseResource(tempResHand);
|
|
}
|
|
else
|
|
DeathError(kErrNoMemory);
|
|
|
|
tempResHand = GetResource('forc', resID + 1);
|
|
if (tempResHand != kNilPointer)
|
|
{
|
|
HLock(tempResHand);
|
|
BlockMove(*tempResHand, juniorForceTable, sizeof(forceData));
|
|
HUnlock(tempResHand);
|
|
ReleaseResource(tempResHand);
|
|
}
|
|
else
|
|
DeathError(kErrNoMemory);
|
|
|
|
tempResHand = GetResource('forc', resID + 2);
|
|
if (tempResHand != kNilPointer)
|
|
{
|
|
HLock(tempResHand);
|
|
BlockMove(*tempResHand, varsityForceTable, sizeof(forceData));
|
|
HUnlock(tempResHand);
|
|
ReleaseResource(tempResHand);
|
|
}
|
|
else
|
|
DeathError(kErrNoMemory);
|
|
|
|
tempResHand = GetResource('forc', resID + 3);
|
|
if (tempResHand != kNilPointer)
|
|
{
|
|
HLock(tempResHand);
|
|
BlockMove(*tempResHand, minorForceTable, sizeof(forceData));
|
|
HUnlock(tempResHand);
|
|
ReleaseResource(tempResHand);
|
|
}
|
|
else
|
|
DeathError(kErrNoMemory);
|
|
|
|
tempResHand = GetResource('forc', resID + 4);
|
|
if (tempResHand != kNilPointer)
|
|
{
|
|
HLock(tempResHand);
|
|
BlockMove(*tempResHand, proForceTable, sizeof(forceData));
|
|
HUnlock(tempResHand);
|
|
ReleaseResource(tempResHand);
|
|
}
|
|
else
|
|
DeathError(kErrNoMemory);
|
|
|
|
switch (displayMode)
|
|
{
|
|
case kDisplay9Inch:
|
|
case kDisplay12Inch:
|
|
resID = kSmallDishDataID;
|
|
break;
|
|
case kDisplay13Inch:
|
|
resID = kLargeDishDataID;
|
|
break;
|
|
}
|
|
|
|
tempResHand = GetResource('sPts', resID);
|
|
if (tempResHand != kNilPointer)
|
|
{
|
|
HLock(tempResHand);
|
|
BlockMove(*tempResHand, &starList, sizeof(starData));
|
|
HUnlock(tempResHand);
|
|
ReleaseResource(tempResHand);
|
|
}
|
|
else
|
|
DeathError(kErrNoMemory);
|
|
}
|
|
|
|
|
|
/*======================================================== VarInit */
|
|
|
|
void VarInit (void)
|
|
|
|
{
|
|
short i, j, halfWide;
|
|
|
|
SpinCursor(7);
|
|
|
|
SetRect(&leftArrowDest, 0, 0, 19, 32);
|
|
SetRect(&rightArrowDest, 0, 0, 19, 32);
|
|
|
|
switch (displayMode)
|
|
{
|
|
case kDisplay13Inch:
|
|
screenWide = 640;
|
|
screenHigh = 480;
|
|
displayHCenter = 320;
|
|
displayVCenter = 240;
|
|
arenaSize = kLargeArena;
|
|
OffsetRect(&leftArrowDest, 90, 40);
|
|
OffsetRect(&rightArrowDest, 530, 40);
|
|
break;
|
|
case kDisplay12Inch:
|
|
screenWide = 512;
|
|
screenHigh = 384;
|
|
displayHCenter = 256;
|
|
displayVCenter = 192;
|
|
arenaSize = kSmallArena;
|
|
OffsetRect(&leftArrowDest, 65, 0);
|
|
OffsetRect(&rightArrowDest, 428, 0);
|
|
break;
|
|
case kDisplay9Inch:
|
|
screenWide = 512;
|
|
screenHigh = 342;
|
|
displayHCenter = 256;
|
|
displayVCenter = 171;
|
|
arenaSize = kSmallArena;
|
|
OffsetRect(&leftArrowDest, 65, 0);
|
|
OffsetRect(&rightArrowDest, 428, 0);
|
|
break;
|
|
}
|
|
|
|
screenHCenter = ((screenBits.bounds.right - screenBits.bounds.left) / 2) +
|
|
screenBits.bounds.left;
|
|
screenVCenter = ((screenBits.bounds.bottom - screenBits.bounds.top) / 2) +
|
|
screenBits.bounds.top;
|
|
|
|
/* Initialize Booleans */
|
|
thisTime = Ticks;
|
|
replaySomething = replayGoals || replayFouls || replayOnR;
|
|
smsActivated = FALSE;
|
|
pausing = FALSE;
|
|
newGame = FALSE;
|
|
|
|
if (leftGoalIsPlayers)
|
|
{
|
|
leftPlayerNumber = kHumanPlayer;
|
|
rightPlayerNumber = theOpponent.persona;
|
|
}
|
|
else
|
|
{
|
|
rightPlayerNumber = kHumanPlayer;
|
|
leftPlayerNumber = theOpponent.persona;
|
|
}
|
|
|
|
antiFacing[kFacingSouth] = kFacingSouth;
|
|
antiFacing[kFacingSouthEast] = kFacingSouthWest;
|
|
antiFacing[kFacingEast] = kFacingWest;
|
|
antiFacing[kFacingNorthEast] = kFacingNorthWest;
|
|
antiFacing[kFacingNorth] = kFacingNorth;
|
|
antiFacing[kFacingNorthWest] = kFacingNorthEast;
|
|
antiFacing[kFacingWest] = kFacingEast;
|
|
antiFacing[kFacingSouthWest] = kFacingSouthEast;
|
|
antiFacing[kFacingRested] = kFacingRested;
|
|
|
|
primaryMode = kIdleMode;
|
|
isDepth = thisMac.isDepth;
|
|
GetDateTime((unsigned long *)&randSeed);
|
|
if (arenaSize == kLargeArena)
|
|
{
|
|
halfWide = kMaxBoardForceLg * kPlayerInputSensitive + kPlayerInputSensitive + 19;
|
|
SetRect(&mouseFrame, screenHCenter - halfWide, screenVCenter - halfWide,
|
|
screenHCenter + halfWide, screenVCenter + halfWide);
|
|
|
|
maxBoardForce = kMaxBoardForceLg;
|
|
}
|
|
else
|
|
{
|
|
halfWide = kMaxBoardForceSm * kPlayerInputSensitive + kPlayerInputSensitive + 19;
|
|
SetRect(&mouseFrame, screenHCenter - halfWide, screenVCenter - halfWide,
|
|
screenHCenter + halfWide, screenVCenter + halfWide);
|
|
|
|
maxBoardForce = kMaxBoardForceSm;
|
|
}
|
|
|
|
switch (isDepth)
|
|
{
|
|
case kDisplay1Bit:
|
|
break;
|
|
case kDisplay4Bit:
|
|
Index2Color(13, &starColors[0]);
|
|
Index2Color(14, &starColors[1]);
|
|
Index2Color(0, &starColors[2]);
|
|
break;
|
|
case kDisplay8Bit:
|
|
Index2Color(13, &starColors[0]);
|
|
Index2Color(14, &starColors[1]);
|
|
Index2Color(0, &starColors[2]);
|
|
break;
|
|
}
|
|
|
|
/* Initialize Rects */
|
|
SetRect(&leftArrowSrc, 0, 70, 19, 102);
|
|
SetRect(&rightArrowSrc, 0, 102, 19, 134);
|
|
|
|
SetRect(&leftArrowStorage, 368, 0, 387, 32);
|
|
SetRect(&rightArrowStorage, 368, 32, 387, 64);
|
|
|
|
SetRect(&screenRect, 0, 0, screenWide, screenHigh);
|
|
SetRect(&nullRect, 0, 0, 0, 0);
|
|
|
|
SetRect(&replayRect, 0, 0, 192, 128);
|
|
OffsetRect(&replayRect, screenWide - 208, 4);
|
|
|
|
replayData = kNilPointer;
|
|
replayData = (replayPtr)NewPtr(sizeof(replayType));
|
|
if (replayData != kNilPointer)
|
|
canReplay = TRUE;
|
|
else
|
|
canReplay = FALSE;
|
|
|
|
if (canReplay)
|
|
replayData->frame = 0;
|
|
|
|
screenRgn = NewRgn();
|
|
RectRgn(screenRgn, &screenRect);
|
|
}
|
|
|
|
|
|
/*======================================================== InitBallData */
|
|
|
|
void InitBallData (void)
|
|
|
|
{
|
|
short doorIsDown;
|
|
|
|
SetRect(&theBall.srcRect, 0, 0, 16, 12);
|
|
if (arenaSize == kSmallArena)
|
|
{
|
|
theBall.initXPos = kSmInitBallXPos;
|
|
theBall.initZPos = kSmInitBallZPos;
|
|
theBall.initXVel = kSmInitBallXVel;
|
|
theBall.initZVel = kSmInitBallZVel;
|
|
}
|
|
else
|
|
{
|
|
theBall.initXPos = kLgInitBallXPos;
|
|
theBall.initZPos = kLgInitBallZPos;
|
|
theBall.initXVel = kLgInitBallXVel;
|
|
theBall.initZVel = kLgInitBallZVel;
|
|
}
|
|
|
|
SetRect(&theDoor.srcRects[kLeftDoor][kDoorIsClosed], 0, 138, 32, 159);
|
|
SetRect(&theDoor.srcRects[kRightDoor][kDoorIsClosed], 0, 159, 32, 180);
|
|
SetRect(&theDoor.srcRects[kLeftDoor][kDoorIsOpen], 0, 180, 32, 201);
|
|
SetRect(&theDoor.srcRects[kRightDoor][kDoorIsOpen], 0, 201, 32, 222);
|
|
|
|
switch (displayMode)
|
|
{
|
|
case kDisplay13Inch:
|
|
doorIsDown = 86;
|
|
break;
|
|
case kDisplay12Inch:
|
|
doorIsDown = 52;
|
|
break;
|
|
case kDisplay9Inch:
|
|
if (isColor)
|
|
doorIsDown = 52;
|
|
else
|
|
doorIsDown = 54;
|
|
break;
|
|
}
|
|
SetRect(&theDoor.destRects[kLeftDoor], 0, 0, 32, 21); /* left door - dest */
|
|
OffsetRect(&theDoor.destRects[kLeftDoor], screenWide / 2 - 32, doorIsDown);
|
|
SetRect(&theDoor.destRects[kRightDoor], 0, 0, 32, 21); /* right door - dest */
|
|
OffsetRect(&theDoor.destRects[kRightDoor], screenWide / 2, doorIsDown);
|
|
|
|
theDoor.doorState = kDoorIsClosed;
|
|
theDoor.doorOpen = kLeftDoor;
|
|
theDoor.phase = 0;
|
|
theDoor.stateChanged = FALSE;
|
|
|
|
antiWhosBall[kBallIsNotHere] = kBallIsNotHere;
|
|
antiWhosBall[kBallRollsFreely] = kBallRollsFreely;
|
|
antiWhosBall[kPlayerHasBall] = kOpponentHasBall;
|
|
antiWhosBall[kOpponentHasBall] = kPlayerHasBall;
|
|
}
|
|
|
|
|
|
/*======================================================== InitPlayerData */
|
|
|
|
void InitPlayerData (void)
|
|
|
|
{
|
|
short i;
|
|
Rect tempRect;
|
|
|
|
thePlayer.selector = kPlayerSelector;
|
|
thePlayer.strategy = kRunDiagonal;
|
|
thePlayer.turnCount = 0;
|
|
if (arenaSize == kSmallArena)
|
|
thePlayer.turnNow = 18;
|
|
else
|
|
thePlayer.turnNow = 18;
|
|
|
|
SetRect(&tempRect, 0, 0, 32, 44); /* initialize player src rects */
|
|
for (i = 0; i < 9; i++)
|
|
{
|
|
OffHRect(&tempRect, 32);
|
|
playerSrcRects[i][0] = tempRect;
|
|
}
|
|
|
|
SetRect(&tempRect, 0, 44, 32, 88);
|
|
for (i = 0; i < 9; i++)
|
|
{
|
|
OffHRect(&tempRect, 32);
|
|
playerSrcRects[i][1] = tempRect;
|
|
}
|
|
|
|
SetRect(&tempRect, 0, 88, 32, 132);
|
|
for (i = 0; i < 9; i++)
|
|
{
|
|
OffHRect(&tempRect, 32);
|
|
playerSrcRects[i][2] = tempRect;
|
|
}
|
|
|
|
SetRect(&tempRect, 0, 132, 32, 176); /* initialize fade mask rects */
|
|
for (i = 0; i < 9; i++)
|
|
{
|
|
OffHRect(&tempRect, 32);
|
|
fadeMaskRects[i][0] = tempRect;
|
|
}
|
|
|
|
SetRect(&tempRect, 0, 176, 32, 220);
|
|
for (i = 0; i < 9; i++)
|
|
{
|
|
OffHRect(&tempRect, 32);
|
|
fadeMaskRects[i][1] = tempRect;
|
|
}
|
|
|
|
SetRect(&tempRect, 0, 220, 32, 264);
|
|
for (i = 0; i < 9; i++)
|
|
{
|
|
OffHRect(&tempRect, 32);
|
|
fadeMaskRects[i][2] = tempRect;
|
|
}
|
|
|
|
SetRect(&boardCursor.srcRect, 0, 62, 16, 70);
|
|
|
|
fadeMaskSequence[0] = 0; fadeMaskSequence[1] = 1; fadeMaskSequence[2] = 0;
|
|
fadeMaskSequence[3] = 1; fadeMaskSequence[4] = 0; fadeMaskSequence[5] = 1;
|
|
fadeMaskSequence[6] = 2; fadeMaskSequence[7] = 1; fadeMaskSequence[8] = 0;
|
|
fadeMaskSequence[9] = 1; fadeMaskSequence[10] = 2;
|
|
fadeMaskSequence[11] = 1; fadeMaskSequence[12] = 2; fadeMaskSequence[13] = 1;
|
|
fadeMaskSequence[14] = 2; fadeMaskSequence[15] = 1; fadeMaskSequence[16] = 2;
|
|
fadeMaskSequence[17] = 3; fadeMaskSequence[18] = 2; fadeMaskSequence[19] = 1;
|
|
fadeMaskSequence[20] = 2; fadeMaskSequence[21] = 3;
|
|
fadeMaskSequence[22] = 2; fadeMaskSequence[23] = 3; fadeMaskSequence[24] = 2;
|
|
fadeMaskSequence[25] = 3; fadeMaskSequence[26] = 2; fadeMaskSequence[27] = 3;
|
|
fadeMaskSequence[28] = 4; fadeMaskSequence[29] = 3; fadeMaskSequence[30] = 2;
|
|
fadeMaskSequence[31] = 3; fadeMaskSequence[32] = 4;
|
|
fadeMaskSequence[33] = 3; fadeMaskSequence[34] = 4; fadeMaskSequence[35] = 3;
|
|
fadeMaskSequence[36] = 4; fadeMaskSequence[37] = 3; fadeMaskSequence[38] = 4;
|
|
fadeMaskSequence[39] = 5; fadeMaskSequence[40] = 4; fadeMaskSequence[41] = 3;
|
|
fadeMaskSequence[42] = 4; fadeMaskSequence[43] = 5;
|
|
fadeMaskSequence[44] = 4; fadeMaskSequence[45] = 5; fadeMaskSequence[46] = 4;
|
|
fadeMaskSequence[47] = 5; fadeMaskSequence[48] = 4; fadeMaskSequence[49] = 5;
|
|
fadeMaskSequence[50] = 6; fadeMaskSequence[51] = 5; fadeMaskSequence[52] = 4;
|
|
fadeMaskSequence[53] = 5; fadeMaskSequence[54] = 6;
|
|
fadeMaskSequence[55] = 5; fadeMaskSequence[56] = 6; fadeMaskSequence[57] = 5;
|
|
fadeMaskSequence[58] = 6; fadeMaskSequence[59] = 5; fadeMaskSequence[60] = 6;
|
|
fadeMaskSequence[61] = 7; fadeMaskSequence[62] = 6; fadeMaskSequence[63] = 5;
|
|
fadeMaskSequence[64] = 6; fadeMaskSequence[65] = 7;
|
|
fadeMaskSequence[66] = 8; fadeMaskSequence[67] = 7; fadeMaskSequence[68] = 8;
|
|
|
|
spacialToDirection[0] = kFacingNorthWest;
|
|
spacialToDirection[1] = kFacingNorth;
|
|
spacialToDirection[2] = kFacingNorthEast;
|
|
spacialToDirection[3] = kFacingWest;
|
|
spacialToDirection[4] = kFacingRested;
|
|
spacialToDirection[5] = kFacingEast;
|
|
spacialToDirection[6] = kFacingSouthWest;
|
|
spacialToDirection[7] = kFacingSouth;
|
|
spacialToDirection[8] = kFacingSouthEast;
|
|
}
|
|
|
|
|
|
/*======================================================== InitOpponentData */
|
|
|
|
void InitOpponentData (void)
|
|
|
|
{
|
|
short i;
|
|
Rect tempRect;
|
|
|
|
theOpponent.selector = kOpponentSelector;
|
|
theOpponent.strategy = kRunDiagonal;
|
|
theOpponent.turnCount = 0;
|
|
if (arenaSize == kSmallArena)
|
|
theOpponent.turnNow = 18;
|
|
else
|
|
theOpponent.turnNow = 18;
|
|
|
|
SetRect(&tempRect, 0, 132, 32, 176); /* initialize player src rects */
|
|
for (i = 0; i < 9; i++)
|
|
{
|
|
OffHRect(&tempRect, 32);
|
|
opponentSrcRects[i][0] = tempRect;
|
|
}
|
|
|
|
SetRect(&tempRect, 0, 176, 32, 220);
|
|
for (i = 0; i < 9; i++)
|
|
{
|
|
OffHRect(&tempRect, 32);
|
|
opponentSrcRects[i][1] = tempRect;
|
|
}
|
|
|
|
SetRect(&tempRect, 0, 220, 32, 264);
|
|
for (i = 0; i < 9; i++)
|
|
{
|
|
OffHRect(&tempRect, 32);
|
|
opponentSrcRects[i][2] = tempRect;
|
|
}
|
|
|
|
boardForceTable[kFacingSouth][kXComponent] = maxBoardForce * 0.0;
|
|
boardForceTable[kFacingSouth][kZComponent] = maxBoardForce * -1.0;
|
|
|
|
boardForceTable[kFacingSouthEast][kXComponent] = maxBoardForce * 0.70711;
|
|
boardForceTable[kFacingSouthEast][kZComponent] = maxBoardForce * -0.70711;
|
|
|
|
boardForceTable[kFacingEast][kXComponent] = maxBoardForce * 1.0;
|
|
boardForceTable[kFacingEast][kZComponent] = maxBoardForce * 0.0;
|
|
|
|
boardForceTable[kFacingNorthEast][kXComponent] = maxBoardForce * 0.70711;
|
|
boardForceTable[kFacingNorthEast][kZComponent] = maxBoardForce * 0.70711;
|
|
|
|
boardForceTable[kFacingNorth][kXComponent] = maxBoardForce * 0.0;
|
|
boardForceTable[kFacingNorth][kZComponent] = maxBoardForce * 1.0;
|
|
|
|
boardForceTable[kFacingNorthWest][kXComponent] = maxBoardForce * -0.70711;
|
|
boardForceTable[kFacingNorthWest][kZComponent] = maxBoardForce * 0.70711;
|
|
|
|
boardForceTable[kFacingWest][kXComponent] = maxBoardForce * -1.0;
|
|
boardForceTable[kFacingWest][kZComponent] = maxBoardForce * 0.0;
|
|
|
|
boardForceTable[kFacingSouthWest][kXComponent] = maxBoardForce * -0.70711;
|
|
boardForceTable[kFacingSouthWest][kZComponent] = maxBoardForce * -0.70711;
|
|
|
|
boardForceTable[kFacingRested][kXComponent] = maxBoardForce * 0.0;
|
|
boardForceTable[kFacingRested][kZComponent] = maxBoardForce * 0.0;
|
|
}
|
|
|
|
|
|
/*======================================================== InitDigiDispData */
|
|
|
|
void InitDigiDispData (void)
|
|
|
|
{
|
|
Rect tempRect;
|
|
short i;
|
|
|
|
SetRect(&tempRect, 336, 0, 352, 24);
|
|
for (i = 0; i < 11; i++)
|
|
{
|
|
scoreDisplays[kLeftScoreSelector].srcRects[i] = tempRect;
|
|
OffVRect(&tempRect, 24);
|
|
}
|
|
SetRect(&tempRect, 352, 0, 368, 24);
|
|
for (i = 0; i < 11; i++)
|
|
{
|
|
scoreDisplays[kRightScoreSelector].srcRects[i] = tempRect;
|
|
OffVRect(&tempRect, 24);
|
|
}
|
|
|
|
SetRect(&colonSrc[0], 0, 26, 16, 50);
|
|
SetRect(&colonSrc[1], 16, 26, 32, 50);
|
|
|
|
SetRect(&timingSource, 392, 238, 400, 264);
|
|
|
|
switch (displayMode)
|
|
{
|
|
case kDisplay13Inch:
|
|
SetRect(&tempRect, 0, 437, 16, 461);
|
|
OffHRect(&tempRect, 32);
|
|
scoreDisplays[kLeftScoreSelector].destRects[kHundredsPlace] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kLeftScoreSelector].destRects[kTensPlace] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kLeftScoreSelector].destRects[kOnesPlace] = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 437, 16, 461);
|
|
OffHRect(&tempRect, 560);
|
|
scoreDisplays[kRightScoreSelector].destRects[kHundredsPlace] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kRightScoreSelector].destRects[kTensPlace] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kRightScoreSelector].destRects[kOnesPlace] = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 461, 16, 467);
|
|
OffHRect(&tempRect, 32);
|
|
scoreDisplays[kLeftScoreSelector].lightDest[0] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kLeftScoreSelector].lightDest[1] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kLeftScoreSelector].lightDest[2] = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 461, 16, 467);
|
|
OffHRect(&tempRect, 560);
|
|
scoreDisplays[kRightScoreSelector].lightDest[0] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kRightScoreSelector].lightDest[1] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kRightScoreSelector].lightDest[2] = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 0, 8, 26);
|
|
OffsetRect(&tempRect, 88, 437);
|
|
leftTimingDest = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 0, 8, 26);
|
|
OffsetRect(&tempRect, 616, 437);
|
|
rightTimingDest = tempRect;
|
|
break;
|
|
|
|
case kDisplay12Inch:
|
|
SetRect(&tempRect, 0, 330, 16, 354);
|
|
OffHRect(&tempRect, 32);
|
|
scoreDisplays[kLeftScoreSelector].destRects[kHundredsPlace] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kLeftScoreSelector].destRects[kTensPlace] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kLeftScoreSelector].destRects[kOnesPlace] = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 330, 16, 354);
|
|
OffHRect(&tempRect, 432);
|
|
scoreDisplays[kRightScoreSelector].destRects[kHundredsPlace] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kRightScoreSelector].destRects[kTensPlace] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kRightScoreSelector].destRects[kOnesPlace] = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 354, 16, 360);
|
|
OffHRect(&tempRect, 32);
|
|
scoreDisplays[kLeftScoreSelector].lightDest[0] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kLeftScoreSelector].lightDest[1] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kLeftScoreSelector].lightDest[2] = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 354, 16, 360);
|
|
OffHRect(&tempRect, 432);
|
|
scoreDisplays[kRightScoreSelector].lightDest[0] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kRightScoreSelector].lightDest[1] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kRightScoreSelector].lightDest[2] = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 0, 8, 26);
|
|
OffsetRect(&tempRect, 88, 330);
|
|
leftTimingDest = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 0, 8, 26);
|
|
OffsetRect(&tempRect, 488, 330);
|
|
rightTimingDest = tempRect;
|
|
break;
|
|
|
|
case kDisplay9Inch:
|
|
SetRect(&tempRect, 0, 308, 16, 332);
|
|
OffHRect(&tempRect, 32);
|
|
scoreDisplays[kLeftScoreSelector].destRects[kHundredsPlace] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kLeftScoreSelector].destRects[kTensPlace] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kLeftScoreSelector].destRects[kOnesPlace] = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 308, 16, 332);
|
|
OffHRect(&tempRect, 432);
|
|
scoreDisplays[kRightScoreSelector].destRects[kHundredsPlace] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kRightScoreSelector].destRects[kTensPlace] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kRightScoreSelector].destRects[kOnesPlace] = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 332, 16, 338);
|
|
OffHRect(&tempRect, 32);
|
|
scoreDisplays[kLeftScoreSelector].lightDest[0] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kLeftScoreSelector].lightDest[1] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kLeftScoreSelector].lightDest[2] = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 332, 16, 338);
|
|
OffHRect(&tempRect, 432);
|
|
scoreDisplays[kRightScoreSelector].lightDest[0] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kRightScoreSelector].lightDest[1] = tempRect;
|
|
OffHRect(&tempRect, 16);
|
|
scoreDisplays[kRightScoreSelector].lightDest[2] = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 0, 8, 26);
|
|
OffsetRect(&tempRect, 88, 308);
|
|
leftTimingDest = tempRect;
|
|
|
|
SetRect(&tempRect, 0, 0, 8, 26);
|
|
OffsetRect(&tempRect, 488, 308);
|
|
rightTimingDest = tempRect;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|