From 806b9b47db0667b54eb39d28eb21d727da07948d Mon Sep 17 00:00:00 2001 From: John Calhoun Date: Wed, 27 Jan 2016 20:50:55 -0800 Subject: [PATCH] First check-in. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This project was originally compiled with THINK C for the Macintosh. The project file is a THINK C project file. Then there is the assembly static library (SMS) that is linked in to provide fast, 4-channel sound (written by Patrick Buckland). Resource files, a balloon file for “balloon help” when it was a thing…. Good luck to anyone trying to bring this beast back to life. --- Headers/About.h | 1 + Headers/AnimCursor.h | 1 + Headers/AppleTalkDDP.h | 1 + Headers/Ball.h | 1 + Headers/CommonPerson.h | 1 + Headers/Computer.h | 1 + Headers/ConfigureSound.h | 1 + Headers/DissBits.h | 1 + Headers/Dynamics.h | 1 + Headers/Environ.h | 1 + Headers/FileError.h | 1 + Headers/Globals.h | 1 + Headers/Human.h | 1 + Headers/Idle.h | 1 + Headers/IdleRoutines.h | 1 + Headers/InitGameStructs.h | 1 + Headers/Initialize.h | 1 + Headers/Main.h | 1 + Headers/MainWindow.h | 1 + Headers/Menu.h | 1 + Headers/NetOpponent.h | 1 + Headers/PlayCore.h | 1 + Headers/PlayUtils.h | 1 + Headers/PlayerStats.h | 1 + Headers/Prefs.h | 1 + Headers/Render.h | 1 + Headers/RenderAsm1.h | 1 + Headers/RenderAsm4.h | 1 + Headers/RenderQD.h | 1 + Headers/Replay.h | 1 + Headers/SMS.h | 1 + Headers/Show_help.h | 1 + Headers/SoundUtils.h | 1 + Headers/TeamSetUp.h | 1 + Headers/UnivUtilities.h | 1 + Headers/ValidInstall.h | 1 + Misc/Pararena 2.0 History.txt | 1 + Misc/Show_help1.6 Folder/Edit Pararena Help | Bin 0 -> 29824 bytes Misc/Show_help1.6 Folder/Para Help.rsrc | 0 Para Sounds | 0 Pararena.project | 0 Pararena.project.rsrc | 0 Sources/Abandoned Routines.c | 1 + Sources/About.c | 1 + Sources/AnimCursor.c | 1 + Sources/AppleTalkDDP.c | 1 + Sources/Ball.c | 1 + Sources/CommonPerson.c | 1 + Sources/Computer.c | 1 + Sources/ConfigureSound.c | 1 + Sources/DissBits.c | 1 + Sources/DumpPict.c | 1 + Sources/Dynamics.c | 1 + Sources/Environ.c | 1 + Sources/FileError.c | 1 + Sources/Human.c | 1 + Sources/Idle.c | 1 + Sources/IdleRoutines.c | 1 + Sources/InitGameStructs.c | 1 + Sources/Initialize.c | 1 + Sources/Main.c | 1 + Sources/MainWindow.c | 1 + Sources/Menu.c | 1 + Sources/NetOpponent.c | 1 + Sources/Para.bloon | 0 Sources/PlayCore.c | 1 + Sources/PlayUtils.c | 1 + Sources/PlayerStats.c | 1 + Sources/Prefs.c | 1 + Sources/Render.c | 1 + Sources/RenderAsm1.c | 1 + Sources/RenderAsm4.c | 1 + Sources/RenderQD.c | 1 + Sources/Replay.c | 1 + Sources/SMSCore.a.π | 0 Sources/Show_help.c | 1 + Sources/SoundUtils.c | 1 + Sources/TeamSetUp.c | 1 + Sources/UnivUtilities.c | 1 + Sources/ValidInstall.c | 1 + Sources/sms.a.π | 0 81 files changed, 73 insertions(+) create mode 100755 Headers/About.h create mode 100755 Headers/AnimCursor.h create mode 100755 Headers/AppleTalkDDP.h create mode 100755 Headers/Ball.h create mode 100755 Headers/CommonPerson.h create mode 100755 Headers/Computer.h create mode 100755 Headers/ConfigureSound.h create mode 100755 Headers/DissBits.h create mode 100755 Headers/Dynamics.h create mode 100755 Headers/Environ.h create mode 100755 Headers/FileError.h create mode 100755 Headers/Globals.h create mode 100755 Headers/Human.h create mode 100755 Headers/Idle.h create mode 100755 Headers/IdleRoutines.h create mode 100755 Headers/InitGameStructs.h create mode 100755 Headers/Initialize.h create mode 100755 Headers/Main.h create mode 100755 Headers/MainWindow.h create mode 100755 Headers/Menu.h create mode 100755 Headers/NetOpponent.h create mode 100755 Headers/PlayCore.h create mode 100755 Headers/PlayUtils.h create mode 100755 Headers/PlayerStats.h create mode 100755 Headers/Prefs.h create mode 100755 Headers/Render.h create mode 100755 Headers/RenderAsm1.h create mode 100755 Headers/RenderAsm4.h create mode 100755 Headers/RenderQD.h create mode 100755 Headers/Replay.h create mode 100755 Headers/SMS.h create mode 100755 Headers/Show_help.h create mode 100755 Headers/SoundUtils.h create mode 100755 Headers/TeamSetUp.h create mode 100755 Headers/UnivUtilities.h create mode 100755 Headers/ValidInstall.h create mode 100755 Misc/Pararena 2.0 History.txt create mode 100755 Misc/Show_help1.6 Folder/Edit Pararena Help create mode 100755 Misc/Show_help1.6 Folder/Para Help.rsrc create mode 100755 Para Sounds create mode 100755 Pararena.project create mode 100755 Pararena.project.rsrc create mode 100755 Sources/Abandoned Routines.c create mode 100755 Sources/About.c create mode 100755 Sources/AnimCursor.c create mode 100755 Sources/AppleTalkDDP.c create mode 100755 Sources/Ball.c create mode 100755 Sources/CommonPerson.c create mode 100755 Sources/Computer.c create mode 100755 Sources/ConfigureSound.c create mode 100755 Sources/DissBits.c create mode 100755 Sources/DumpPict.c create mode 100755 Sources/Dynamics.c create mode 100755 Sources/Environ.c create mode 100755 Sources/FileError.c create mode 100755 Sources/Human.c create mode 100755 Sources/Idle.c create mode 100755 Sources/IdleRoutines.c create mode 100755 Sources/InitGameStructs.c create mode 100755 Sources/Initialize.c create mode 100755 Sources/Main.c create mode 100755 Sources/MainWindow.c create mode 100755 Sources/Menu.c create mode 100755 Sources/NetOpponent.c create mode 100755 Sources/Para.bloon create mode 100755 Sources/PlayCore.c create mode 100755 Sources/PlayUtils.c create mode 100755 Sources/PlayerStats.c create mode 100755 Sources/Prefs.c create mode 100755 Sources/Render.c create mode 100755 Sources/RenderAsm1.c create mode 100755 Sources/RenderAsm4.c create mode 100755 Sources/RenderQD.c create mode 100755 Sources/Replay.c create mode 100755 Sources/SMSCore.a.π create mode 100755 Sources/Show_help.c create mode 100755 Sources/SoundUtils.c create mode 100755 Sources/TeamSetUp.c create mode 100755 Sources/UnivUtilities.c create mode 100755 Sources/ValidInstall.c create mode 100755 Sources/sms.a.π diff --git a/Headers/About.h b/Headers/About.h new file mode 100755 index 0000000..06a8ee9 --- /dev/null +++ b/Headers/About.h @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== About Dialog Routines Header == //== == //============================================================ //============================================================ #pragma once //======================================================== Prototypes void HiLiteOkayButton (void); void UnHiLiteOkayButton (void); void UpdateMainPict (DialogPtr); pascal Boolean AboutFilter (DialogPtr, EventRecord *, short *); void DoAbout (void); //======================================================== Constants #define rAboutDialogID 150 // res ID of About dialog #define buttItemOkay 1 // item number of okay button #define textItemVers 2 // item number of version text #define pictItemMain 4 // item number of main PICT #define kOkayButtPICTNotHiLit 150 // res ID of hilit button PICT #define kOkayButtPICTHiLit 151 // res ID of unhilit button PICT #define kAboutBandWPICT 152 // res ID of main B&W PICT #define kAboutColorPICT 153 // res ID of main color PICT //======================================================== Global Vars extern Boolean isColor, doZooms; \ No newline at end of file diff --git a/Headers/AnimCursor.h b/Headers/AnimCursor.h new file mode 100755 index 0000000..c823972 --- /dev/null +++ b/Headers/AnimCursor.h @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== AnimCursor Header == //== == //============================================================ //============================================================ //======================================================== Defines #define rAcurID 128 #define rHandCursorID 1000 //======================================================== Structs typedef struct // defines acur format { short n; short index; union { Handle cursorHdl; short resID; } frame[1]; } acurRec, *acurPtr, **acurHandle; //======================================================== Prototypes Boolean GetMonoCursors (acurHandle); Boolean GetColorCursors (acurHandle); void InitAnimatedCursor (acurHandle); void LoadCursors (void); void DisposCursors (void); void IncrementCursor (void); void DecrementCursor (void); void SpinCursor (short); void BackSpinCursor (short); //======================================================== External Variables extern Cursor handCursor; extern Boolean isColor; \ No newline at end of file diff --git a/Headers/AppleTalkDDP.h b/Headers/AppleTalkDDP.h new file mode 100755 index 0000000..fdd585d --- /dev/null +++ b/Headers/AppleTalkDDP.h @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== AppleTalkDDP Header == //== == //============================================================ //============================================================ #include #include "Globals.h" //======================================================== Defines #define kBufferSize 1536 #define kLookupBufferSize 2048 #define kThisType "\pPararena" #define kAnyZone "\p*" #define kLookUpSelector "\p=" #define kMaxLookUpNumber 8 #define rNetStringID 190 #define rNetSelectDialogID 190 #define kButtNetOkay 1 #define kButtNetCancel 2 #define kButtNetLook 3 #define kButtNetNext 4 #define kButtNetPrev 5 #define kTextNetNumber 6 #define kTextNetWho 7 #define kNetPowBalloonItem 10 #define kUserNetFrame 11 #define kNetErrWrongSize 321 #define kNetErrNoErr 0 #define kNetErrBadHardware 1 #define kNetErrDriverFailed 2 #define kNetErrSocketFailed 3 #define kNetErrRegisterFailed 4 #define kNetErrCloseFailed 5 #define kNetErrUserCancelled 6 #define kNetErrRemoveFailed 7 #define kNetErrBuffersFailed 8 //======================================================== Type Definitions typedef struct { Str255 name; AddrBlock address; } netUserArray[kMaxLookUpNumber]; //======================================================== Prototypes short InitializeAppleTalk (void); // functions to call from outside OSErr RegisterNameOnNet (void); // listed in calling sequence pascal Boolean NamesFilter (DialogPtr, EventRecord *, short *); Boolean SelectNetOpponentAsynch (void); OSErr RequestReceiveDDP (void); OSErr PollIncomingDDP (long, short, short); OSErr PollSpecificDDP (long, short, short); OSErr SendOutgoingDDP (long, short); short CloseDownAppleTalk (void); OSErr OpenAppleTalkDriver (void); // functions called internally void GetDefaultName (void); OSErr OpenSocketDDP (void); OSErr LookUpNamesAsynch (void); Boolean IsThereAnotherName (short); Boolean IsLookUpFinished (void); OSErr ProcessAName (netUserArray, short); void UpdateNetOpponents (DialogPtr, netUserArray, short, short); Boolean DetermineMasterSlave (void); OSErr DeRegisterName (void); OSErr CloseSocketDDP (void); //======================================================== External Variables extern string31 theNames[10]; extern long speedFlag, theirSpeed; extern short whichHumanNumber; extern Boolean isColor; \ No newline at end of file diff --git a/Headers/Ball.h b/Headers/Ball.h new file mode 100755 index 0000000..add499d --- /dev/null +++ b/Headers/Ball.h @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Ball Header == //== == //============================================================ //============================================================ //======================================================== Defines #define kInitBallFiringTime 120 // Ball constants //======================================================== Prototypes void BallRectFromPosition (void); void ResetBall (void); void DoAFoul (void); void DoBallFiring (void); void MoveRollingBall (void); void DoBallInGoal (void); void DoBallRolling (void); void HandleBall (void); //======================================================== External Variables extern playerType thePlayer, theOpponent; extern ballType theBall; extern doorType theDoor; extern WindowPtr mainWndo; extern RGBColor RGBBlackColor, RGBWhiteColor; extern RgnHandle screenRgn; extern GrafPtr offMaskPort; extern BitMap offMaskMap; extern CGrafPort offCPartsPort, offCWorkPort; extern CGrafPtr offCPartsPtr, offCWorkPtr; extern BitMap offPartsBits, offWorkBits; extern Rect offPartsRect, offWorkRect, offMaskRect; extern long oldDistSquared; extern short arenaSize, displayMode, displayHCenter, screenWide, screenHigh; extern short playerScore, opponentScore, whosGotBall, loopsBallHeld; extern short leftGoalLeague, rightGoalLeague; extern short vertTable[41][81]; extern short *littleForceTable, *juniorForceTable, *varsityForceTable; extern short *minorForceTable, *proForceTable; extern Boolean leftGoalIsPlayers, leftScoredLast, drawThisFrame; \ No newline at end of file diff --git a/Headers/CommonPerson.h b/Headers/CommonPerson.h new file mode 100755 index 0000000..849f7a1 --- /dev/null +++ b/Headers/CommonPerson.h @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Common Person Header == //== == //============================================================ //============================================================ //======================================================== Prototypes void PersonRectFromPosition (playerType *); void ResetPerson (playerType *); void StartPersonBeamOut (playerType *); void MovePerson (playerType *); void OpponentDecides (playerType *); void DoPersonInArena (playerType *); void DoPersonBeamingIn (playerType *); void DoPersonBeamingOut (playerType *); void PersonStasisToBeamIn (playerType *); void DoPersonInStasis (playerType *); void HandlePerson (playerType *); //======================================================== External Variables extern ballType theBall; extern WindowPtr mainWndo; extern RGBColor RGBBlackColor, RGBWhiteColor; extern RgnHandle screenRgn; extern GrafPtr offMaskPort; extern BitMap offMaskMap; extern CGrafPort offCPartsPort, offCWorkPort; extern CGrafPtr offCPartsPtr, offCWorkPtr; extern BitMap offPartsBits, offWorkBits; extern Rect offPartsRect, offWorkRect, offMaskRect; extern Rect playerSrcRects[9][3], opponentSrcRects[9][3]; extern Rect fadeMaskRects[9][3]; extern long playerSrcAddrs[9][3], fadeMaskAddrs[9][3], opponentSrcAddrs[9][3]; extern long maskAddrs[9][3]; extern short arenaSize, displayMode, displayHCenter, displayVCenter; extern short screenHigh, screenWide, whosGotBall, leftGoalLeague; extern short rightGoalLeague; extern short vertTable[41][81]; extern short *littleForceTable, *juniorForceTable, *varsityForceTable; extern short *minorForceTable, *proForceTable; extern short fadeMaskSequence[69]; extern Boolean leftGoalIsPlayers, netGameInSession, drawThisFrame; \ No newline at end of file diff --git a/Headers/Computer.h b/Headers/Computer.h new file mode 100755 index 0000000..5839e35 --- /dev/null +++ b/Headers/Computer.h @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Computer Header == //== == //============================================================ //============================================================ //======================================================== Defines #define kGeorgeCrouchPercent 60 #define kMaraCrouchPercent 70 #define kOttoCrouchPercent 80 #define kClaireCrouchPercent 90 #define kEazeCrouchPercent 96 #define kTeakCrouchPercent 98 //======================================================== Prototypes short DiagonalToPerson (playerType *); short DiagonalToBall (playerType *); short OctalToPoint (playerType *, register short, register short); void LookUpBoardForce (playerType *); Boolean NearTheBall (playerType *); Boolean NearTheEdge (playerType *); Boolean NearTheEdgeSmarter (playerType *); Boolean NearTheGoal (playerType *); Boolean NearPerson (void); Boolean DecentShot (playerType *); Boolean ExcellentShot (playerType *); Boolean ExcellentDirectionalShot (playerType *, short); Boolean PointingToDisaster (playerType *); short RunTheDiagonalNE (playerType *); short RunTheDiagonalNW (playerType *); short RunTheDiagonalSmarterNE (playerType *); short RunTheDiagonalSmarterNW (playerType *); short RunTheDiagonalSmartestNE (playerType *); short RunTheDiagonalSmartestNW (playerType *); short SeekPlayerGoal (playerType *); short AnticipateBall (playerType *, short); short SeekPersonsGoal (playerType *); short AnticipatePersonsFlank (playerType *, short); short AnticipatePersonsFace (playerType *, short); short RunTheCircleRight (playerType *); short RunTheCircleLeft (playerType *); void BrakeIfLeaving (playerType *); void BashUnlessLeaving (playerType *); void GeorgeDecides (playerType *); void MaraDecides (playerType *); void OttoDecides (playerType *); void ClaireDecides (playerType *); void EazeDecides (playerType *); void TeakDecides (playerType *); //======================================================== External Variables extern playerType thePlayer; extern playerType theOpponent; extern ballType theBall; extern long oldDistSquared; extern short whosGotBall, arenaSize, loopsBallHeld; extern short *littleForceTable; extern short vertTable[41][81]; // temp testing extern short displayHCenter; // temp testing extern short spacialToDirection[9]; extern short boardForceTable[9][2]; extern Boolean gameIsOver; \ No newline at end of file diff --git a/Headers/ConfigureSound.h b/Headers/ConfigureSound.h new file mode 100755 index 0000000..78c5376 --- /dev/null +++ b/Headers/ConfigureSound.h @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== ConfigureSound Header == //== == //============================================================ //============================================================ //======================================================== Prototypes void UpdateVolumeIcon (DialogPtr); void UpdateSoundDialog (DialogPtr); pascal Boolean SoundFilter (DialogPtr, EventRecord *, short *); Boolean DoConfigureSound (void); //======================================================== Defines #define rSoundDialogID 210 #define kSoundOkay 1 #define kSoundCancel 2 #define kSoundBalloon 3 #define kSoundVolume 6 #define kSoundLouder 7 #define kSoundSofter 8 #define kSoundIconRect 9 #define kSoundEnable 10 #define kSoundBeam 11 #define kSoundIncidental 12 #define kSoundCollisions 13 #define kSoundCrowd 14 #define kSoundTitleLeft 6 #define kSoundTitleTop 16 //======================================================== External Variables extern short soundVolume; extern Boolean isColor, doZooms, soundOn; extern Boolean beamSoundOn, incidentSoundOn, collisionSoundOn, crowdSoundOn; \ No newline at end of file diff --git a/Headers/DissBits.h b/Headers/DissBits.h new file mode 100755 index 0000000..2362637 --- /dev/null +++ b/Headers/DissBits.h @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== DissBits Header == //== == //============================================================ //============================================================ //======================================================== Routines void DissBits13QD (Rect *clippedRect); void DissBits12QD (Rect *clippedRect); void DissBits13Assm1 (Rect *clippedRect); void DissBits13Assm4 (Rect *clippedRect); void DissBits12Assm1 (Rect *clippedRect); void DissBits12Assm4 (Rect *clippedRect); void DissolveWorkToMain (void); //======================================================== Globals extern WindowPtr mainWndo; extern CGrafPort offCWorkPort; extern CGrafPtr offCWorkPtr; extern BitMap offWorkBits; extern Ptr offWorkPix; extern Rect offWorkRect; extern long screenRowAddrs[480], workRowOffsets[480]; extern short screenRowBytes, workRowBytes, displayMode; extern Boolean isColor, useQD; \ No newline at end of file diff --git a/Headers/Dynamics.h b/Headers/Dynamics.h new file mode 100755 index 0000000..3546f4d --- /dev/null +++ b/Headers/Dynamics.h @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Dynamics Header == //== == //============================================================ //============================================================ //======================================================== Defines #define kPersonMass 4 // purely relative & arbitrary unit #define kPersonSmallMass 2 // for colliding with ball #define kBallMass 1 #define kPersonBallMass 5 #define kPersonPersonMass 8 #define kPersonDampening 2 // fraction subtracted when wall collided #define kBallDampening 3 // bigger => more energy lost #define kLoopsImpactless 6 #define kFrameToDampen 5 #define kEnergyAbsorbed 32 // fraction of velocity subtracted @ impact #define kPBEnergyAbsorbed 4 // as above but for player/ball collisions //======================================================== Prototypes void DoPersonBallMerged (playerType *); // catching/dropping the ball void DoPersonBallParted (playerType *); void DoPersonBallCollided (playerType *); // ball/person dynamics void DoPersonPersonCollided (void); void CheckPersonBallCollision (playerType *); // test ball/person coll. void CheckPersonPersonCollision (void); void CheckPersonBallCollision (playerType *); short GetPlaceOnArena (short, short); void HandlePersonWallCollision (playerType *); // handle collisions with the wall void CheckUpOnBall (void); void HandleBallWallCollision (void); void HandleCollisions (void); // handle non-wall collisions //======================================================== External Variables extern playerType theOpponent; extern playerType thePlayer; extern ballType theBall; extern long oldDistSquared; extern short whosGotBall, loopsBallHeld, leftGoalLeague, rightGoalLeague; extern short *littleForceTable, *juniorForceTable, *varsityForceTable; extern short *minorForceTable, *proForceTable; extern short boardForceTable[9][2]; extern Boolean imTheMaster, netGameInSession, drawThisFrame; \ No newline at end of file diff --git a/Headers/Environ.h b/Headers/Environ.h new file mode 100755 index 0000000..3522dbb --- /dev/null +++ b/Headers/Environ.h @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Environ Header == //== == //============================================================ //============================================================ //======================================================== Defines // Alert and Dialog ID Constants #define rSwitchDepthAlert 130 //======================================================== Prototypes Boolean TrapExists (short); Boolean DoWeHaveGestalt (void); Boolean DoWeHaveWNE (void); Boolean DoWeHaveColor (void); Boolean DoWeHaveSystem602 (void); Boolean DoWeHaveSystem605 (void); Boolean DoWeHaveSystem7 (void); short HowWillWeDisplay (Boolean); short WhatsOurDepth (void); Boolean CanWeDisplay4Bit (void); void SwitchDepthOrAbort (void); void CheckOurEnvirons (void); //======================================================== External Variables extern macEnvironment thisMac; extern short displayMode; extern Boolean isColor, knowsColor; \ No newline at end of file diff --git a/Headers/FileError.h b/Headers/FileError.h new file mode 100755 index 0000000..71ed4aa --- /dev/null +++ b/Headers/FileError.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== File Error Handling Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ #pragma once /*======================================================== Prototypes */ Boolean CheckFileError (short, StringPtr); /*======================================================== Constants */ #define rFileErrorAlert 140 /* res ID of alert */ #define rFileErrorStrings 140 /* res ID of string list */ \ No newline at end of file diff --git a/Headers/Globals.h b/Headers/Globals.h new file mode 100755 index 0000000..281f291 --- /dev/null +++ b/Headers/Globals.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Global Declarations ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ #pragma once #include "Palettes.h" /*======================================================== Constants */ #define kDisplay9Inch 1 /* Display Constants */ #define kDisplay12Inch 2 /* we display on a 12" monitor */ #define kDisplay13Inch 3 /* we display on a 13" or larger monitor */ #define kSmallArena 1 /* we're using the small dish */ #define kLargeArena 2 /* we have available the large dish */ #define kIdleMode 0 /* Game modes - game is not in progress */ #define kPlayMode 1 /* a game is in progress */ #define kLeftScoreSelector 0 /* score board & timer constants */ #define kRightScoreSelector 1 /* refers to the score on the right */ #define kOnesPlace 2 /* the one's digit of the score/time */ #define kTensPlace 1 /* the tens's digit of the score/time */ #define kHundredsPlace 0 /* the hundreds's digit of the score */ #define kMinutesPlace 0 /* the minutes's digit of the time */ #define kBlankCharacter 10 /* constant meaning, 'No number' - blank */ #define kPlayerSelector 0 /* means this is the player structure */ #define kOpponentSelector 1 /* means this is the opponent structure */ #define kLeftGoal 0 /* goal selector constants */ #define kRightGoal 1 /* referes to the right hand goal */ #define kSmInitLeftXPos -3072 /* left goal constants */ #define kSmInitLeftZPos 0 /* initial place for player to appear */ #define kLgInitLeftXPos -4096 /* and initial X position */ #define kLgInitLeftZPos 0 /* and Z for the large arena */ #define kSmInitRightXPos 3072 /* right goal constants */ #define kSmInitRightZPos 0 /* for small arena - right position */ #define kLgInitRightXPos 4096 /* and X position for player to begin */ #define kLgInitRightZPos 0 /* and the Z position */ #define kBallFiring 0 /* Ball modes */ #define kBallRolling 1 /* the ball is subject to the dish dynamics */ #define kBallHeld 2 /* the ball is being carried */ #define kBallInStasis 3 /* the ball is waiting to be fired into arena */ #define kPlayerHolding 0 /* Ball modifiers */ #define kOpponentHolding 1 /* the opponent has the ball */ #define kNoOneLastHeld 2 /* no one has yet touched the ball */ #define kPlayerLastHeld 3 /* player was the last one touching ball */ #define kOpponentLastHeld 4 /* opponent was the last one touching ball */ #define kBallIsNotHere 0 /* Status of ball - for opponent decisions */ #define kBallRollsFreely 1 /* no one has caught the ball */ #define kPlayerHasBall 2 /* the player has grabbed the ball */ #define kOpponentHasBall 3 /* the opponent has grabbed the ball */ #define kInArena 0 /* Person modes */ #define kBeamingIn 1 /* in the process of fading in */ #define kBeamingOut 2 /* in the process of fading out */ #define kInStasis 3 /* waiting to be beamed in */ #define kStanding 0 /* Person display mode modifiers */ #define kCarrying 1 /* display graphic of player with ball */ #define kCrouching 2 /* display graphic of player crouching */ #define kNoOpponent -1 /* Opponent/Player types (personas) */ #define kHumanPlayer 0 /* player is the user */ #define kSimpleGeorge 1 /* player is computer George */ #define kMadMara 2 /* player is computer Mara */ #define kHeavyOtto 3 /* player is computer Otto */ #define kCleverClaire 4 /* player is computer Claire */ #define kMisterEaze 5 /* player is computer Eaze */ #define kMissTeak 6 /* player is computer Teak */ #define kNetHuman 7 /* player is a human on the network */ #define kRunDiagonal 0 /* goal-scoring selectors */ #define kRunCircle 1 /* run around the edge of dish to score */ #define kFacingSouth 0 /* Directional constants */ #define kFacingSouthEast 1 /* facing bottom-right corner of screen */ #define kFacingEast 2 /* facing right edge of screen */ #define kFacingNorthEast 3 /* facing top-right corner of screen */ #define kFacingNorth 4 /* facing away from user */ #define kFacingNorthWest 5 /* facing top-left corner of screen */ #define kFacingWest 6 /* facing left edge of screen */ #define kFacingSouthWest 7 /* facing bottom-left corner of screen */ #define kFacingRested 8 /* player is centered (facing user) */ #define kLastDirection 7 /* last (maximum) direction */ #define kFirstDirection 0 /* first (minimum) direction */ #define kNoOneWon 0 /* constant describing who won a game */ #define kPlayerWon 1 /* player has won the game */ #define kOpponentWon 2 /* the opponent has won the game */ #define kDoorIsClosed 0 /* Ball-firing door constants */ #define kDoorIsOpen 1 /* selector constants */ #define kLeftDoor 0 /* which door selectors */ #define kRightDoor 1 /* which door selectors */ #define kDoorPhases 16 /* game loops door remains open */ #define kMaxReplayFrames 300 /* frames preserved for instant replay */ #define kLoopLimitOnHeldBall 1200 /* # of frames allowed to hold ball (20 s) */ #define kTimingScale 46 /* kLoopLimitOnHeldBall / 26 pixels */ #define kLoopLimitOnIdleBall 1800 /* # of frames allowed for dead ball (30 s) */ #define kAddForceFract 4 /* fraction of force added when crouching */ #define kCriticalFoul 3 /* this # fouls -> give other player point */ #define kRoundSeconds 240 /* 240 seconds = 4 minutes */ #define kLengthOfPenalty 60 /* animation "loops" left out of arena */ #define kHooplaTime 600 /* ticks winner has to show off */ #define kCrowdClosingHoopla 500 /* ticks crowd/mob carry on after game */ #define kTickDelay 1L /* minimum (& ideal) time for 1 game loop */ #define kEndOfFadeSequence 68 /* 'frames' - duration of fade in/out */ #define kVelocitySensitive 8 /* was 8 ... smaller = more sensitive */ #define kFrictionFraction 128 /* was 128 ... smaller = more friction */ #define kPlayerInputSensitive 3 /* smaller is MORE sensitive */ #define kMaxBoardForceLg 64 /* max force applied when skating was 64 */ #define kMaxBoardForceSm 57 /* max force applied when skating was 57 */ #define kPersonImpulse 18 /* force with which ball is thrown (was 16) */ #define kNumberOfStars 256 /* number of stars in resource (blinking) */ #define kNumberOfStarColors 3 /* for color, number of colors to animate */ #define kFramesToSkip 6 /* number of frames to skip for PowerBooks */ #define kXComponent 0 /* constant for arrays involving x & z */ #define kZComponent 1 /* this one refers to the z component */ #define kOutOBounds -12345 /* Force Table constants */ #define kBackBoard -2345 /* in force array, refers to the backboard */ #define kGoalPath -345 /* signifies hole (goal path) used to score */ #define kIsNormal 0 /* Flag constants */ #define kIsOutOfBounds 1 /* means the player/ball has left the dish */ #define kIsRebounding 2 /* the player/ball has hit the backboard */ #define kIsInGoal 3 /* the ball is in the goal (ding! ding!) */ #define kPlayerSrc 0 /* refers to the player source indicee */ #define kOpponentSrc 1 /* refers to the opponent source indicee */ #define kMask 0 /* refers to a standard mask indicee */ #define kFadeMask 1 /* refers to the fad mask indicee */ #define kSmallDishDataID 1000 /* resource ID's for small arena data */ #define kLargeDishDataID 1001 /* resource ID's for large arena data */ #define rArenaPictSm1BitID 1000 /* PICT Resource ID Constants */ #define rArenaPictSm4BitID 1001 /* 16 color small arena PICT */ #define rArenaPictLg4BitID 1002 /* 16 color large arena PICT */ #define rArenaPictLg8BitID 1003 /* 256 color large arena PICT */ #define rArenaPictLg1BitID 1004 /* b&w large arena PICT */ #define rPartsPict1BitID 1010 /* bits (hah) and pieces b&w PICT */ #define rPartsPict4BitID 1011 /* the same for 16 colors */ #define rPartsPict8BitID 1012 /* and for 256 colors */ #define rMaskPict1ID 1020 /* mask PICT with 1 pixel outline */ #define rMaskPict48ID 1021 /* mask PICT for color (no outline) */ #define kAnnouncerPict1ID 1100 /* the basic announcer PICT for b&w */ #define kAnnouncerPict4ID 1101 /* the 16 color announcer PICT */ #define kBalloon1PictID 2000 /* and the Pow! balloon PICT for b&w */ #define kBalloon4PictID 2001 /* the 16 color Pow! balloon */ #define rAbortGameAlertID 1009 /* alert warning player */ #define rCantRepeatAlertID 1011 /* alert informing user of repeated tourny */ #define rHelpDialogID 3000 /* ID for help dialog */ #define rHelpBasePictID 3100 /* ID for first PICT in help dialog */ #define rNamesStringID 1000 /* the opponents names */ #define rMiscStrings 1001 /* other miscellaneous strings */ #define kMaxNumberOfSounds 26 /* number of 'primary' game sounds */ #define kMaxIncidentalSounds 3 /* number of 'incidental' sounds */ #define kLastIncidentalSounds 28 /* ID of last incidental sound */ #define kClashSound 1 /* sound ('SMSD') resource ID numbers */ #define kRicochetSound 2 /* these are the primary game sounds */ #define kScoreSound 3 /* sound of a goal being scored */ #define kBallFiringSound 4 /* sound of ball firing onto arena */ #define kBeamInSound 5 /* sound of player beaming in*/ #define kBeamOutSound 6 /* and sound of player beaming out */ #define kFoulSound 7 /* sound made by the foul bell */ #define kBallPickUpSound 8 /* sound of player grabbing up the ball */ #define kCrowdSound 9 /* the soft crowd drone in background */ #define kCrowdSwellSound 10 /* the crowd sound rises in volume */ #define kApplauseSound 11 /* full-out loud crowd appluase */ #define kCrowdFadeSound 12 /* and the crowd fades back down */ #define kBellSound 13 /* the bell (end of period/game) sound */ #define kMobSwellSound 14 /* the booing-crowd sound gets louder */ #define kMobSound 15 /* loudest booing crowd */ #define kMobFadeSound 16 /* and the crowd fades back down */ #define kHoldingSound 17 /* the warning sound "Holding" */ #define kGameSound 18 /* part one of "Game Point" sound */ #define kPointSound 19 /* referee saying second half - "point" */ #define kBallDropSound 20 /* ball being released by player */ #define kBrakeSound 21 /* when brakes are applied */ #define kAllSound 22 /* part one of "All Tied" sound */ #define kTiedSound 23 /* referee saying second half - "tied" */ #define kIdleSound 24 /* when ball is idle (about beamed out) */ #define kOverSound 25 /* "Game over" sound (goes with kGameSound) */ #define kBeerManSound 26 /* incidental "Beer man!" shout */ #define kHotDogSound 27 /* incidental "Hot dog!" shout */ #define kProgramSound 28 /* incidental "Program!" shout */ #define kLadiesSound 100 /* one-time sounds, load-when-needed */ #define kAndSound 101 /* of "Ladies - and - gentlemen" */ #define kGentlemenSound 102 /* the announcer saying "gentlemen" */ #define kParSound 103 /* announcer saying "Pair - uh - reenuh!" */ #define kASound 104 /* the "-a-" from "a-rena" */ #define kRenaSound 105 /* the "-rena" sound */ #define kApplauseSwellTicks 16 /* really 15.959 */ #define kApplauseFadeTicks 20 /* really 20.013 */ #define kMobSwellTicks 21 /* really 21.566 */ #define kMobFadeTicks 21 /* really 21.566 */ #define kClashPriority 0x2700 /* sound priority for above sound */ #define kRicochetPriority 0x2704 /* sound priority for above sound */ #define kScorePriority 0x6704 /* sound priority for above sound */ #define kBallFiringPriority 0x4700 /* sound priority for above sound */ #define kBeamInPriority 0x4704 /* sound priority for above sound */ #define kBeamOutPriority 0x4708 /* sound priority for above sound */ #define kFoulPriority 0x6700 /* sound priority for above sound */ #define kBallPickUpPriority 0x2708 /* sound priority for above sound */ #define kCrowdPriority 0x7FF0 /* sound priority for above sound */ #define kCrowdSwellPriority 0x7FF0 /* sound priority for above sound */ #define kApplausePriority 0x7FF0 /* sound priority for above sound */ #define kCrowdFadePriority 0x7FF0 /* sound priority for above sound */ #define kBellPriority 0x6708 /* sound priority for above sound */ #define kMobSwellPriority 0x7FF0 /* sound priority for above sound */ #define kMobPriority 0x7FF0 /* sound priority for above sound */ #define kMobFadePriority 0x7FF0 /* sound priority for above sound */ #define kHoldingPriority 0x670C /* sound priority for above sound */ #define kGamePriority 0x470C /* sound priority for above sound */ #define kPointPriority 0x4710 /* sound priority for above sound */ #define kBallDropPriority 0x270C /* sound priority for above sound */ #define kBrakePriority 0x2710 /* sound priority for above sound */ #define kAllPriority 0x4600 /* sound priority for above sound */ #define kTiedPriority 0x4604 /* sound priority for above sound */ #define kIdlePriority 0x4712 /* sound priority for above sound */ #define kOverPriority 0x4714 /* sound priority for above sound */ #define kPracticeBoardin 1 /* various game scenarios (sets of rules) */ #define kPracticeScoring 2 /* play around with the ball - no opponent */ #define kStandardGame 3 /* modified volleyball rule variation */ #define kTournament 4 /* player first to 13 wins */ #define kLittleLeague 0 /* league constants defined */ #define kJuniorVarsity 1 /* league constants defined */ #define kVarsity 2 /* league constants defined */ #define kMinorLeague 3 /* league constants defined */ #define kProfessional 4 /* league constants defined */ #define kGameIsOverMessage -1 /* net-game ... game is resolved */ #define kPausedMessage -2 /* net-game ... other player has paused */ #define kInstantReplayMessage -3 /* net-game ... other player in instant replay */ #define kAbortGameMessage -4 /* net-game ... other player stopped game */ #define kEndGameMessage -5 /* net-game ... game has ended */ #define kConfirmMessage -9 /* net-game ... confirms messg. recvd. */ #define kUnplayedState 0 /* states for player stats flags */ #define kLostState 1 /* indicates played and lost */ #define kWonState 2 /* indicates played and won */ #define kSkunkedState 3 /* indicates played and won 5 to 0 */ /*======================================================== Structs Defined */ typedef short forceData[41][41][2]; /* from 'forc' resource */ typedef short vertData[41][81]; /* from 'vert' resource */ typedef Point starData[kNumberOfStars]; /* from 'sPts' resource */ typedef char string31[32]; typedef struct /* defines player object */ { Rect isRect; /* current bounds rect */ Rect wasRect; /* old bounds rect */ Rect srcRect; /* source rect for graphic */ Rect maskRect; /* mask rect for graphic */ long srcAddr, maskAddr; /* for asm graphics */ short xPos, zPos; /* real x & z position of player */ short xVel, zVel; /* real x & z velocity of player */ short hMouse, vMouse; /* screen centered mouse position */ short direction, posture; /* direction player facing & posture */ short flag, persona, selector; /* situations, who's acting?, who? */ short strategy, turnCount, turnNow; /* used for running-the-circle shots */ short teaksThresh, whichGoal; /* for Miss Teak only!, left/right */ short initXPos, initZPos; /* initial x & z position of player */ short justHitWall; /* flags a recent collision */ short justHitBall; /* flags a recent collision */ short justHitOpponent; /* flags a recent collision */ short loopsBallHeld; /* keeps track of # of loops ball held */ char mode; /* mode player is in */ char dirFlagSrc; /* for selecting src entities */ char postFlagSrc; /* ditto */ char arrayFlagMask, dirFlagMask; /* for selecting src & mask entities */ char postFlagMask; /* ditto */ char brakeApplied; /* flags whether brake is applied */ char bashApplied; /* flags whether bashing key applied */ Boolean buttonIs; /* the state of the mouse button */ Boolean mouseWasLetUp; /* did human release mouse button */ } playerType; typedef struct /* defines ball object */ { Rect isRect; /* current bounds rect */ Rect wasRect; /* old bounds rect */ Rect srcRect; /* source pixMap bounds rect */ Rect eraser; /* kludge to hold rect for erasing */ short xPos, zPos; /* real x & z position of ball */ short xVel, zVel; /* real x & z velocity of ball */ short modifier; /* ball modifier */ short flag; /* flags various situations detected */ short initXPos, initZPos; /* initial x & z position of ball */ short initXVel, initZVel; /* initial x & z velocity of ball */ short justHitWall; /* flags a recent collision */ short loopsBallIdle; /* counts frames ball idle */ char mode; /* mode ball is in */ Boolean eraseTheBall; /* a kludge to flag a clean erase */ Boolean dontDraw; /* kludge for the ball out of bounds */ } ballType; typedef struct { Rect srcRects[2][2]; /* rects containing door src graphics */ Rect destRects[2]; /* dest rects for left & right doors */ long srcAddrs[2][2]; /* screen address for asm graphics */ long screenDestAddr[2]; /* screen address for asm graphics */ long workDestAddr[2]; /* off-work address for asm graphics */ long backDestAddr[2]; /* background address for asm graphics */ short phase; /* phase of the door, by 0 it closes */ char doorState; /* 0 if closed, 1 if open */ char doorOpen; /* 0 if left open, 1 if right */ Boolean stateChanged; /* boolean flagging an open or a close */ } doorType; typedef struct /* defines a digit of timer/score */ { Rect srcRects[11]; /* source of digits 0-9 and */ Rect destRects[3]; /* dest rects for up to 3 digits */ Rect lightDest[4]; /* dest rects for the little lights */ long srcAddrs[11]; /* source address for asm graphics */ long destAddrs[3]; /* screen dest address for asm */ } digiDispType; typedef struct /* defines board cursor structure */ { Rect isRect; /* current bounds rect */ Rect wasRect; /* old bounds rect */ Rect srcRect; /* source pixMap bounds rect */ long srcAddr, maskAddr; /* for the ol' asm. */ short xPos, zPos; /* real x & z position of cursor */ Boolean isVisible; /* kludge for the ball out of bounds */ } cursorType; typedef struct /* net data struct sent to slave game */ { short messageType; /* 2 bytes */ long ballIsPoint; /* 4 bytes */ long eraserPoint; /* 4 bytes */ long playerIsPoint; /* 4 bytes */ long opponentIsPoint; /* 4 bytes */ short opponentXPos; /* 2 bytes */ short opponentZPos; /* 2 bytes */ char playerArrayDirSrc; /* 1 byte */ char playerPostArray; /* 1 byte */ char playerDirPostMask; /* 1 byte */ char opponentArrayDirSrc; /* 1 byte */ char opponentPostArray; /* 1 byte */ char opponentDirPostMask; /* 1 byte */ char ballWhosMode; /* 1 byte */ char playerOpponentMode; /* 1 byte */ char bitFlags; /* 1 byte */ char packedFoulsRead; /* 1 byte */ char playerScoreReads; /* 1 byte */ char opponentScoreReads; /* 1 byte */ char soundPlayed; /* 1 byte */ char padding; /* 1 byte, total = 36 */ } masterSendType; typedef struct /* net data struct sent from slave */ { short messageType; /* 2 bytes */ short mouseH; /* 2 bytes */ short mouseV; /* 2 bytes */ char bits; /* 1 byte */ char padding; /* 1 byte, total = 8 */ } slaveSendType; typedef struct { Rect playerIs; Rect opponentIs; Rect ballIs; char playerArraySrc; char playerDirSrc; char playerPostSrc; char playerArrayMask; char playerDirMask; char playerPostMask; char playerMode; char opponentArraySrc; char opponentDirSrc; char opponentPostSrc; char opponentArrayMask; char opponentDirMask; char opponentPostMask; char opponentMode; char ballMode; char wheresBall; Boolean ballDontDraw; } frameType; typedef struct { frameType data[kMaxReplayFrames]; short frame, lastFrame; short hVel, vVel; } replayType, *replayPtr; typedef struct { short wasDepth, isDepth; /* bit depth before/currently */ Boolean hasWNE, hasSystem7; /* various attributes */ Boolean hasColor, hasGestalt; /* various attributes */ Boolean canSwitch, canColor; /* various attributes */ } macEnvironment; typedef struct { short number; short priority; short when; } soundQueue; typedef struct { long tournamentTime; long bestPlatinumTime; short copperTitles; short bronzeTitles; short silverTitles; short goldTitles; short platinumTitles; short played; short won; short goals; short fouls; short criticals; short oppGoals; short oppFouls; short oppCriticals; short georgeState; short maraState; short ottoState; short claireState; short eazeState; short teakState; } statType; typedef struct /* defines preference format */ { short prefVersion; short unusedShort; long timeWas; long encryption; statType wasStats[10]; string31 mostTitlesName; long mostTitlesDate; short mostTitles; string31 mostPointsName; long mostPointsDate; short mostPoints; string31 mostFoulsName; long mostFoulsDate; short mostFouls; string31 mostCritsName; long mostCritsDate; short mostCrits; string31 namesWere[10]; short opponentWas; short playerWas; short gameWas; short wasVolume; short wasLeague; short wasTeaksThresh[10]; Boolean wasUseQD; Boolean wasAutoTeams; Boolean replayGoalsWas; Boolean replayFoulsWas; Boolean replayOnRWas; Boolean wasShowCursor; Boolean leftGoalWasPlayers; Boolean wasSoundOn; Boolean wasBeamSoundOn; Boolean wasIncidentSoundOn; Boolean wasCollisionSoundOn; Boolean wasCrowdSoundOn; Boolean wasSetDepth; Boolean wasAnnouncer; Boolean wasBackground; Boolean wasZooms; Boolean wasReplayZooms; Boolean wasSkipFrames; Boolean wasNetOnly; } prefsInfo; \ No newline at end of file diff --git a/Headers/Human.h b/Headers/Human.h new file mode 100755 index 0000000..2e37f4d --- /dev/null +++ b/Headers/Human.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Human Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Prototypes */ void DetermineHumanFacing (playerType *); void GetHumanInput (void); void PrepareNetHumanInput (void); void ProcessNetPlayerInput (void); void HandleBoardCursor (void); /*======================================================== External Variables */ extern playerType thePlayer, theOpponent; extern ballType theBall; extern cursorType boardCursor; extern KeyMap theKeyMap; extern WindowPtr mainWndo; extern RGBColor RGBBlackColor, RGBWhiteColor; extern RgnHandle screenRgn; extern GrafPtr offMaskPort; extern BitMap offMaskMap; extern CGrafPort offCPartsPort, offCWorkPort; extern CGrafPtr offCPartsPtr, offCWorkPtr; extern BitMap offPartsBits, offWorkBits; extern Rect offPartsRect, offWorkRect, offMaskRect, mouseFrame; extern Rect playerSrcRects[9][3]; extern Rect fadeMaskRects[9][3]; extern long playerSrcAddrs[9][3], fadeMaskAddrs[9][3]; extern long maskAddrs[9][3]; extern short arenaSize, displayMode, displayHCenter, displayVCenter; extern short screenWide, screenHigh, maxBoardForce; extern short screenHCenter, screenVCenter; extern short vertTable[41][81]; extern short boardForceTable[9][2]; extern short spacialToDirection[9]; extern short fadeMaskSequence[69]; extern Boolean leftGoalIsPlayers, showBoardCursor, disableBoardCursor; extern Boolean wasBrakeOn; \ No newline at end of file diff --git a/Headers/Idle.h b/Headers/Idle.h new file mode 100755 index 0000000..da6a26a --- /dev/null +++ b/Headers/Idle.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Idle Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ #pragma once /*======================================================== Routine Prototypes */ void DoMouseEvent (void); void DoKeyDown (void); void DoUpdateEvent (WindowPtr); void DoDiskEvent (void); short WindowType (WindowPtr); void DoActivate (WindowPtr, Boolean); void DoActivateEvent (void); void DoSuspendResumeEvent (void); void HandleEvent (void); /*======================================================== Globals */ extern macEnvironment thisMac; extern WindowPtr mainWndo; extern EventRecord theEvent; extern Rect dragRect, sizeRect, nullRect; extern short primaryMode, soundVolume, wasSoundVolume; extern Boolean quitting, inBackground, pausing, splashIsUp; \ No newline at end of file diff --git a/Headers/IdleRoutines.h b/Headers/IdleRoutines.h new file mode 100755 index 0000000..8ded381 --- /dev/null +++ b/Headers/IdleRoutines.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== IdleRoutines Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ #pragma once /*======================================================== Defines */ #define rReplayDialogID 1001 #define kButtReplayOkay 1 #define kButtReplayCancel 2 #define kCheckGoals 3 #define kCheckFouls 4 #define kCheckOnR 5 #define kUserBalloonReplay 7 #define kCheckReplayZooms 8 #define kReplayTitleLeft 6 #define kReplayTitleTop 16 #define rNamesDialogID 1003 #define kButtNamesOkay 1 #define kButtNamesCancel 2 #define kEditFirstName 3 #define kEditLastName 12 #define kUserBalloonNames 13 #define kNamesTitleLeft 6 #define kNamesTitleTop 16 #define rPrefsDialogID 1002 #define kButtPrefsOkay 1 #define kButtPrefsCancel 2 #define kUserBalloonPrefs 3 #define kCheckUseQD 5 #define kCheckCursor 6 #define kCheckDepth 7 #define kCheckAnnouncer 8 #define kCheckBackground 9 #define kCheckZooms 10 #define kCheckSkip 11 #define kPrefsTitleLeft 6 #define kPrefsTitleTop 16 #define rRecordsDialogID 1006 #define kButtRecordsOkay 1 #define kNameRecordsTitles 2 #define kNameRecordsPoints 3 #define kNameRecordsDelta 4 #define kNameRecordsFouls 5 #define kNameRecordsCrits 6 #define kAmountRecordsTitles 7 #define kAmountRecordsPoints 8 #define kAmountRecordsDelta 9 #define kAmountRecordsFouls 10 #define kAmountRecordsCrits 11 #define kDateRecordsTitles 12 #define kDateRecordsPoints 13 #define kDateRecordsDelta 14 #define kDateRecordsFouls 15 #define kDateRecordsCrits 16 #define kUserBalloonRecords 37 #define kUserFirstFrameRecords 39 #define kUserLastFrameRecords 43 #define kUserHiddenReset 44 #define kRecordsTitleLeft 6 #define kRecordsTitleTop 16 #define rMemoryDialogID 1007 #define kButtMemoryOkay 1 #define kTextPrimarySounds 2 #define kTextIncidentalSounds 3 #define kTextFreeMemory 4 #define kUserBalloonMemory 8 #define kMemoryTitleLeft 6 #define kMemoryTitleTop 16 #define rLeagueDialogID 1008 #define kButtLeagueOkay 1 #define kButtLeagueCancel 2 #define kRadioLittleLeague 3 #define kRadioJrVarsity 4 #define kRadioVarsity 5 #define kRadioMinorLeague 6 #define kRadioProfessional 7 #define kUserBalloonLeague 8 #define kLeagueTitleLeft 6 #define kLeagueTitleTop 16 /*======================================================== Function Prototypes */ void DrawOpenHand (void); void DrawClosedHand (void); void DrawOpenMouth (short); void DrawClosedMouth (short); void DoOpeningAnnouncer (void); void DoNew (void); void DoOpen (void); void DoSave (void); void DoSaveAs (void); void HandleSwitchItem (void); void UpdateReplayDialog (DialogPtr); pascal Boolean ReplayFilter (DialogPtr, EventRecord *, short *); Boolean ConfigureInstantReplay (void); void UpdateNamesDialog (DialogPtr); pascal Boolean EditNameFilter (DialogPtr, EventRecord *, short *); Boolean ConfigureNames (void); void UpdatePrefsDialog (DialogPtr); pascal Boolean PrefsFilter (DialogPtr, EventRecord *, short *); Boolean ConfigurePreferences (void); void UpdateRecordsDialog (DialogPtr); pascal Boolean RecordsFilter (DialogPtr, EventRecord *, short *); Boolean DisplayRecords (void); void UpdateMemoryDialog (DialogPtr); pascal Boolean MemoryFilter (DialogPtr, EventRecord *, short *); Boolean DisplayMemory (void); void UpdateLeagueDialog (DialogPtr); pascal Boolean LeagueFilter (DialogPtr, EventRecord *, short *); Boolean ConfigureLeague (void); Boolean ConvertPararena (void); /*======================================================== Globals */ extern playerType thePlayer, theOpponent; extern macEnvironment thisMac; extern string31 theNames[10]; extern string31 mostTitlesName, mostPointsName; extern string31 mostFoulsName, mostCritsName; extern soundQueue crowdQueue; extern WindowPtr mainWndo; extern EventRecord theEvent; extern GrafPtr offWorkPtr; extern CGrafPtr offCPartsPtr, offCWorkPtr, offCBackPtr; extern BitMap offPartsBits, offWorkBits, offBackBits; extern Rect dragRect, sizeRect, replayRect; extern long timeElapsed, baseTime, wasTime, lifeTime; extern long mostTitlesDate, mostPointsDate; extern long mostFoulsDate, mostCritsDate; extern short mostTitles, mostPoints, mostFouls, mostCrits, whichGame; extern short primaryMode, playerFouls, opponentFouls, isLeague; extern short playerScore, opponentScore, displayMode, soundFileRefNum; extern short leftPlayerNumber, rightPlayerNumber; extern Boolean quitting, isColor, newGame, enableBackground, doZooms; extern Boolean replayGoals, replayFouls, replayOnR, replaySomething, soundOn; extern Boolean willUseQD, showBoardCursor, enableAnnouncer, autoSetDepth; extern Boolean replayZooms, doSkipFrames, netOnly, canNetwork; extern Boolean soundLoaded[kMaxNumberOfSounds]; extern Boolean incidentSoundLoaded[kMaxIncidentalSounds]; \ No newline at end of file diff --git a/Headers/InitGameStructs.h b/Headers/InitGameStructs.h new file mode 100755 index 0000000..abdc86b --- /dev/null +++ b/Headers/InitGameStructs.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== InitGameStructs Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Defines */ #define kSmInitBallXPos 384 /* ball constants */ #define kSmInitBallZPos 14000 #define kSmInitBallXVel -4800 #define kSmInitBallZVel 0 #define kLgInitBallXPos 384 #define kLgInitBallZPos 17728 #define kLgInitBallXVel -5600 /* was -5600 */ #define kLgInitBallZVel 0 /*======================================================== Routines */ void SetPrefsToDefault (void); void LoadThePreferences (void); void LoadLargeDataStructures (void); void VarInit (void); void InitBallData (void); void InitPlayerData (void); void InitOpponentData (void); void InitDigiDispData (void); /*======================================================== External Variables */ extern ballType theBall; extern playerType thePlayer; extern playerType theOpponent; extern doorType theDoor; extern digiDispType scoreDisplays[2]; extern cursorType boardCursor; extern replayType *replayData; extern statType theStats[10]; extern string31 theNames[10]; extern string31 mostTitlesName, mostPointsName; extern string31 mostFoulsName, mostCritsName; extern macEnvironment thisMac; extern RGBColor starColors[3]; extern Rect screenRect, nullRect, replayRect, colonDest, mouseFrame; extern Rect leftArrowSrc, rightArrowSrc, leftArrowDest, rightArrowDest; extern Rect leftArrowStorage, rightArrowStorage; extern Rect timingSource, leftTimingDest, rightTimingDest; extern Rect playerSrcRects[9][3], fadeMaskRects[9][3], opponentSrcRects[9][3]; extern Rect colonSrc[2]; extern Point starList[kNumberOfStars]; extern RgnHandle screenRgn; /* pull later */ extern long mostTitlesDate, mostPointsDate, lifeTime; extern long mostFoulsDate, mostCritsDate, speedFlag; extern long thisTime, encryptedNumber; extern short mostTitles, mostPoints, mostFouls, mostCrits; extern short screenWide, screenHigh, displayHCenter, displayVCenter, isDepth; extern short displayMode, arenaSize, primaryMode, whichGame, isLeague; extern short whichHumanNumber, leftPlayerNumber, rightPlayerNumber; extern short screenHCenter, screenVCenter, soundVolume; extern short maxBoardForce; extern short antiWhosBall[4]; extern short vertTable[41][81]; extern short fadeMaskSequence[69]; extern short antiFacing[9]; extern short spacialToDirection[9]; extern short boardForceTable[9][2]; extern short teaksThreshholds[10]; extern short *littleForceTable, *juniorForceTable, *varsityForceTable; extern short *minorForceTable, *proForceTable; extern Boolean quitting, leftGoalIsPlayers, enableBackground; extern Boolean useQD, isColor, showBoardCursor, autoSetDepth, enableAnnouncer; extern Boolean pausing, newGame, autoTeamsDialog, canReplay, doSkipFrames; extern Boolean replayGoals, replayFouls, replayOnR, replaySomething, willUseQD; extern Boolean soundOn, beamSoundOn, incidentSoundOn, collisionSoundOn; extern Boolean crowdSoundOn, smsActivated, doZooms, replayZooms, netOnly; \ No newline at end of file diff --git a/Headers/Initialize.h b/Headers/Initialize.h new file mode 100755 index 0000000..3fb6402 --- /dev/null +++ b/Headers/Initialize.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Initialization Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Prototypes */ void ToolBoxInit (void); void BitMapInit (void); void PixMap4Init (void); void MaskMapInit (void); void MaskPixInit (void); void GetBaseAddressC (void); void GetBaseAddress1 (void); void LoadSounds (void); void SpeedTest (void); void InitializeAll (void); /*======================================================== Globals */ extern ballType theBall; extern playerType thePlayer; extern playerType theOpponent; extern doorType theDoor; extern digiDispType scoreDisplays[2]; extern cursorType boardCursor; extern macEnvironment thisMac; extern EventRecord theEvent; /* offscreen variables */ extern GrafPtr offBackPtr, offPartsPtr, offWorkPtr, offMaskPtr; extern BitMap offBackBits, offPartsBits, offWorkBits, offMaskMap; extern CGrafPort offCBackPort, offCPartsPort, offCWorkPort, offCMaskPort; extern CGrafPtr offCBackPtr, offCPartsPtr, offCWorkPtr, offCMaskPtr; extern Ptr offBackPix, offPartsPix, offWorkPix, offMaskPix; extern Rect offBackRect, offPartsRect, offWorkRect, offMaskRect; extern Rect leftArrowStorage, rightArrowStorage; extern Rect colonDest, replayRect, rightArrowDest, leftArrowDest; extern Rect playerSrcRects[9][3], fadeMaskRects[9][3], opponentSrcRects[9][3]; extern Rect colonSrc[2]; extern long screenBase, replaySrc, replayDest; extern long insetBytes; extern long ballSrcAddr, ballMaskAddr; extern long playerSrcAddrs[9][3], fadeMaskAddrs[9][3], opponentSrcAddrs[9][3]; extern long maskAddrs[9][3]; extern long screenRowAddrs[480], workRowOffsets[480]; extern short workRowBytes, backRowBytes, partsRowBytes, soundFileRefNum; extern short screenRowBytes, maskCRowBytes, maskRowBytes, soundVolume; extern short displayMode, screenWide, screenHigh, isDepth, wasSoundVolume; extern short soundPriorities[kMaxNumberOfSounds]; extern Boolean inBackground, smsActivated; extern Boolean useQD, isColor, canNetwork, netOnly; extern Boolean soundLoaded[kMaxNumberOfSounds]; extern Boolean incidentSoundLoaded[kMaxIncidentalSounds]; \ No newline at end of file diff --git a/Headers/Main.h b/Headers/Main.h new file mode 100755 index 0000000..a7a674b --- /dev/null +++ b/Headers/Main.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Main Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ #pragma once /*======================================================== Function Prototypes */ pascal void ThisSysBeep (short); void RootLoop (void); void DumpTheDefaults (void); void ShutItDown (void); \ No newline at end of file diff --git a/Headers/MainWindow.h b/Headers/MainWindow.h new file mode 100755 index 0000000..085472c --- /dev/null +++ b/Headers/MainWindow.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Main Window Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Defines */ #define rMainWndoID 128 /* 'wind' Resource ID Constant */ #define rCLUTID 128 /* 'clut' Resource ID Constant */ #define rSplashPICT1 5000 /* 'PICT' ID for B&W splash screen */ #define rSplashPICT4 5001 /* 'PICT' ID for 16 color splash screen */ /*======================================================== Routines */ void EraseMenuBarRect (void); void FixVisRegion (void); void LoadBackgroundPict (void); void UpdateGoalPicts (Boolean); void RefreshMainWindow (void); void OpenMainWindow (void); void DoSplashScreen (void); void CloseMainWindow (void); /*======================================================== External Variables */ extern playerType thePlayer; extern WindowPtr mainWndo; extern RGBColor RGBBlackColor, RGBWhiteColor; extern BitMap offBackBits, offWorkBits; extern GrafPtr offBackPtr; extern CGrafPtr offCBackPtr, offCWorkPtr; extern Rect dragRect, offWorkRect; extern short screenHigh, screenWide, arenaSize, displayMode, wasMenuBarHeight; extern short horizontal, vertical, primaryMode; extern short leftGoalLeague, rightGoalLeague; extern Boolean isColor, leftGoalIsPlayers, useQD, splashIsUp; \ No newline at end of file diff --git a/Headers/Menu.h b/Headers/Menu.h new file mode 100755 index 0000000..39dcf9c --- /dev/null +++ b/Headers/Menu.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Menu Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Defines */ /* Menu Constants */ #define iNoItem 0 #define rAppleMenuID 128 /* Apple */ #define iAboutItem 1 #define rFileMenuID 129 /* File */ #define iNewGame 1 #define iResumeGame 2 #define iEndGame 3 #define iQuit 5 #define rGameMenuID 130 /* Game */ #define iTeamsSetUp 1 #define iChooseLeague 2 #define iPracticeBoardin 4 #define iPracticeScoring 5 #define iStandardGame 6 #define iTournament 7 #define rOptionsMenuID 131 /* Options */ #define iInstantReplay 1 #define iSound 2 #define iNames 3 #define iPreferences 4 #define iPlayersStats 6 #define iRecords 7 #define iMemory 9 #define iConvert 10 #define iHelp 11 /*======================================================== Routines */ void CheckGameMenu (void); void SetMBarToPlaying (void); void SetMBarToIdle (void); void ValidateMenuBar (void); void DoAppleMenu (short); void DoFileMenu (short); void DoGameMenu (short); void DoOptionsMenu (short); void DoMenuChoice (long); void MenuBarInit (void); /*======================================================== Globals */ extern macEnvironment thisMac; extern short primaryMode, whichGame, leftPlayerNumber, rightPlayerNumber; extern short system7HelpItem; extern Boolean quitting, menuBarIsHidden, pausing, netOnly; \ No newline at end of file diff --git a/Headers/NetOpponent.h b/Headers/NetOpponent.h new file mode 100755 index 0000000..fcc7141 --- /dev/null +++ b/Headers/NetOpponent.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== NetOpponent Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Defines */ #define kNetworkVersion 1 #define kHelloIndicator 4321 #define kRequestSize 6 #define kEnviroMessageSize 16 #define kRequestEnvironment 3735 #define kGotYourEnvironment 842 /*======================================================== Type Definintions */ typedef struct { long speed; /* 4 bytes */ short version; /* 2 bytes */ short arena; /* 2 bytes */ short goal; /* 2 bytes */ short spotPts; /* 2 bytes */ short league; /* 2 bytes */ Boolean scoredLast; /* 1 byte */ Boolean limited; /* 1 byte */ } environMessage; /* total size = 16 bytes */ typedef struct { short requested; /* 2 bytes */ short firstArgument; /* 2 bytes */ short secondArgument; /* 2 bytes */ } requestMessage; /* total size = 6 bytes */ /*======================================================== Prototypes */ OSErr SendSynchPulse (void); OSErr SendThisEnvironment (void); OSErr BegForSomething (short); Boolean WaitForSynch (short); Boolean ConfirmEnvironmentMatch (void); Boolean WhatsTheGamesOutcome (void); void PrepareStandardMessage (void); void SendMessage (void); Boolean SendModalMessage (short); void ConfirmModalMessage (void); void ReceiveMessage (void); void TranslateStandardMessage (void); void InitializeMessages (void); Boolean SpotPoints (void); /*======================================================== External Variables */ extern playerType thePlayer; extern playerType theOpponent; extern ballType theBall; extern doorType theDoor; extern masterSendType masterMessage; extern slaveSendType slaveMessage; extern long speedFlag, theirSpeed; extern short frameCounter, newFrameCount, lastFrameCount; extern short playerTotalFouls, opponentTotalFouls, playerTotalGoals; extern short playerTotalCrits, opponentTotalCrits, opponentTotalGoals; extern short playerFouls, opponentFouls, screenWide, wasLastSound; extern short playerScore, opponentScore, whosGotBall, primaryMode; extern short masterSendSize, slaveSendSize, loopDelay, isLeague, theirLeague; extern short droppedPackets, sentPackets, lengthOfApplause, lengthOfMob; extern short arenaSize, whichGame, spotPoints, spottedPoints, lastByteCount; extern short firstPackageShort; extern short antiFacing[9]; extern short antiWhosBall[4]; extern char playerWonTheGame; extern Boolean imTheMaster, netMirroring, leftScoredLast, playerInBack; extern Boolean useQD, leftGoalIsPlayers, madeThePickUp, theyAreMajor; extern Boolean gameIsOver, doZooms, netOnly; \ No newline at end of file diff --git a/Headers/PlayCore.h b/Headers/PlayCore.h new file mode 100755 index 0000000..e59ba51 --- /dev/null +++ b/Headers/PlayCore.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Play Core Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Prototypes */ void DoCommandKey (void); void DoPausing (void); void UnPauseGame (void); void DoSpecial (void); void DoSoundToggle (void); void CheckAbortiveInput (void); void HandleTimerEtc (void); void RunGameOverGame (void); void RunNetGameOverGame (void); void RunNetGame (void); void RunBoardinGame (void); void RunScorinGame (void); void RunStandardGame (void); void PlayGame (void); /*======================================================== External Variables */ extern playerType thePlayer; extern playerType theOpponent; extern ballType theBall; extern doorType theDoor; extern digiDispType scoreDisplays[2]; extern replayType *replayData; extern statType theStats[10]; extern string31 theNames[10]; extern soundQueue crowdQueue, incidentalQueue; extern KeyMap theKeyMap; extern EventRecord theEvent; extern WindowPtr mainWndo; extern RGBColor RGBBlackColor, RGBWhiteColor; extern RgnHandle screenRgn; extern GrafPtr offMaskPort; extern BitMap offMaskMap; extern CGrafPort offCPartsPort, offCWorkPort; extern CGrafPtr offCPartsPtr, offCWorkPtr, offCBackPtr; extern BitMap offPartsBits, offWorkBits, offBackBits; extern Rect offPartsRect, offWorkRect, offMaskRect; extern Rect cameraRect, replayRect, colonDest, screenRect; extern Rect colonSrc[2]; extern long timeElapsed, baseTime, wasTime, timePaused, replayFlag; extern short frameCounter, newFrameCount, lastFrameCount; extern short primaryMode, displayMode, screenWide, screenHigh, arenaSize; extern short displayHCenter, displayVCenter, whichGame, loopsBallHeld; extern short playerFouls, opponentFouls, whosGotBall, whichHumanNumber; extern short playerScore, opponentScore, lengthOfApplause; extern short leftPlayerNumber, rightPlayerNumber, loopDelay, wasLastSound; extern short masterSendSize, slaveSendSize, loopDelay, lengthOfMob; extern short droppedPackets, sentPackets, lastSoundPriority; extern short teaksThreshholds[10]; extern char playerWonTheGame; extern Boolean pausing, quitting, useQD, isColor, leftScoredLast, gameIsOver; extern Boolean autoTeamsDialog, leftGoalIsPlayers, madeThePickUp, soundOn; extern Boolean netGameInSession, imTheMaster, playerJustScored, enableAnnouncer; extern Boolean canReplay, replayGoals, replayFouls, replayOnR, replaySomething; extern Boolean disableBoardCursor, smsActivated, newGame, enableBackground; extern Boolean soundLoaded[kMaxNumberOfSounds]; \ No newline at end of file diff --git a/Headers/PlayUtils.h b/Headers/PlayUtils.h new file mode 100755 index 0000000..f5defdd --- /dev/null +++ b/Headers/PlayUtils.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== PlayUtils Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Prototypes */ void DoEndGame (void); void UpdateWorldRecords (void); void UpdateStats (void); void InitiateGameOver (void); void DoSlaveGameOver (void); void DrawNames (void); void UpdatePlayerScore (void); void UpdateOpponentScore (void); void DoPlayerScores (void); void DoOpponentScores (void); void HandlePlayerFoul (void); void HandleOpponentFoul (void); Boolean DoNetGameSetUp (void); void DisplayHoopla (void); Boolean CantRepeatTournament (void); Boolean MustProLeagueTournament (void); Boolean CanWePlay (void); void PrepareNewGame (void); /*======================================================== External Variables */ extern playerType thePlayer; extern playerType theOpponent; extern ballType theBall; extern doorType theDoor; extern digiDispType scoreDisplays[2]; extern replayType *replayData; extern statType theStats[10]; extern string31 theNames[10]; extern string31 mostTitlesName, mostPointsName; extern string31 mostFoulsName, mostCritsName; extern soundQueue crowdQueue, incidentalQueue; extern Str255 thisName, opponentsName; extern KeyMap theKeyMap; extern WindowPtr mainWndo; extern RGBColor RGBBlackColor, RGBWhiteColor; extern RgnHandle screenRgn; extern GrafPtr offMaskPort; extern BitMap offMaskMap; extern CGrafPort offCPartsPort, offCWorkPort; extern CGrafPtr offCPartsPtr, offCWorkPtr, offCBackPtr; extern BitMap offPartsBits, offWorkBits, offBackBits; extern Rect offPartsRect, offWorkRect, offMaskRect; extern Rect cameraRect, replayRect, colonDest, screenRect; extern Rect colonSrc[2]; extern long timeElapsed, baseTime, wasTime, timePaused, replayFlag; extern long mostTitlesDate, mostPointsDate; extern long mostFoulsDate, mostCritsDate; extern short frameCounter, newFrameCount, lastFrameCount; extern short mostTitles, mostPoints, mostFouls, mostCrits; extern short primaryMode, displayMode, screenWide, screenHigh, arenaSize; extern short displayHCenter, displayVCenter, whichGame, loopsBallHeld; extern short playerFouls, opponentFouls, whosGotBall, whichHumanNumber; extern short playerTotalFouls, opponentTotalFouls, playerTotalGoals; extern short playerTotalCrits, opponentTotalCrits, opponentTotalGoals; extern short playerScore, opponentScore, lengthOfApplause; extern short leftPlayerNumber, rightPlayerNumber, loopDelay, wasLastSound; extern short masterSendSize, slaveSendSize, loopDelay, lengthOfMob; extern short droppedPackets, sentPackets, lastSoundPriority; extern short spotPoints, spottedPoints, isLeague; extern short teaksThreshholds[10]; extern char playerWonTheGame; extern Boolean pausing, quitting, useQD, isColor, leftScoredLast, gameIsOver; extern Boolean autoTeamsDialog, leftGoalIsPlayers, madeThePickUp, soundOn; extern Boolean netGameInSession, imTheMaster, playerJustScored, enableAnnouncer; extern Boolean canReplay, replayGoals, replayFouls, replayOnR, replaySomething; extern Boolean disableBoardCursor, smsActivated, newGame, theyAreMajor; extern Boolean wasBrakeOn, drawThisFrame, splashIsUp; extern Boolean soundLoaded[kMaxNumberOfSounds]; \ No newline at end of file diff --git a/Headers/PlayerStats.h b/Headers/PlayerStats.h new file mode 100755 index 0000000..32c7fd9 --- /dev/null +++ b/Headers/PlayerStats.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== PlayerStats Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Defines */ #define rStatsDialogID 1004 #define rEraseStatsAlertID 1005 #define kStatsPopMenuID 1000 #define kTitles1PictID 1030 #define kTallys1PictID 1031 #define kDefeated1PictID 1032 #define kX1PictID 1033 #define kCheck1PictID 1034 #define kTitles4PictID 1040 #define kTallys4PictID 1041 #define kDefeated4PictID 1042 #define kX4PictID 1043 #define kCheck4PictID 1044 #define kStatsOkay 1 #define kStatsTitles 2 #define kStatsTallys 3 #define kStatsDefeated 4 #define kStatsBalloon 5 #define kStatsPopUp 6 #define kStatsErase 9 #define kEraseStatsOkay 1 #define kStatsTitleLeft 6 #define kStatsTitleTop 16 /*======================================================== Prototypes */ void EraseStats (short); void DrawStatsPopUpItem (void); void DrawStatsPopUp (void); void RedrawStatValues (void); void UpdateStatsDialog (DialogPtr); void DoStatsPopUpSelect (DialogPtr); pascal Boolean StatsFilter (DialogPtr, EventRecord *, short *); Boolean DoPlayerStats (void); void ResetWorldRecords (void); /*======================================================== External Variables */ extern statType theStats[10]; extern string31 theNames[10]; extern string31 mostTitlesName, mostPointsName; extern string31 mostFoulsName, mostCritsName; extern Rect teamsPopUpRect; extern MenuHandle teamsPopUp; extern long mostTitlesDate, mostPointsDate; extern long mostFoulsDate, mostCritsDate; extern short mostTitles, mostPoints, mostFouls, mostCrits; extern short teamsPopUpWidth, popUpItemSelected, whichHumanNumber; extern short teaksThreshholds[10]; extern Boolean isColor, doZooms; \ No newline at end of file diff --git a/Headers/Prefs.h b/Headers/Prefs.h new file mode 100755 index 0000000..ffaa795 --- /dev/null +++ b/Headers/Prefs.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Preferences Handling Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ #pragma once /*======================================================== Constants */ #define kPrefCreatorType 'RenA' /* creator type of prefs file */ #define kPrefFileType 'renP' /* file type of prefs file */ #define kPrefFileName "\pPara Prefs" /* name of prefs file */ #define kDefaultPrefFName "\pPreferences" /* name for pref folder if error */ #define rPrefsStringsID 160 /* resource ID of prefs strings */ #define kPrefsFNameIndex 1 /* string corresponding to folder name */ /*======================================================== Prototypes */ Boolean CanUseFindFolder (void); Boolean GetPrefsFPathSyst7 (long *, short *); Boolean CreatePrefsFolder (short *); Boolean GetPrefsFPathSyst6 (short *); Boolean WritePrefsFileSyst7 (long *, short *, prefsInfo *); Boolean WritePrefsFileSyst6 (short *, prefsInfo *); Boolean SavePrefs (prefsInfo *); Boolean ReadPrefsFileSyst7 (long *, short *, prefsInfo *); Boolean ReadPrefsFileSyst6 (short *, prefsInfo *); Boolean LoadPrefs (prefsInfo *); \ No newline at end of file diff --git a/Headers/Render.h b/Headers/Render.h new file mode 100755 index 0000000..2c5c48b --- /dev/null +++ b/Headers/Render.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Render Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Prototypes */ void FillInTheSrcAndMaskRect (playerType *); void FillInTheSrcAndMaskAddr (playerType *); void DetermineFrameRate (void); void HandlePreGraphics (void); void HandlePostGraphics (void); void RenderScene (void); void DisplayScoreDigit (short, short, short); void DisplayPlayerFouls (short); void DisplayOpponentFouls (short); void TwinkleAStar (void); void DrawAllStars (void); void UpdateArrows (void); void UpdateBallTimers (playerType *); /*======================================================== External Variables */ extern playerType thePlayer; extern playerType theOpponent; extern ballType theBall; extern cursorType boardCursor; extern Rect leftTimingDest, rightTimingDest; extern Rect playerSrcRects[9][3], fadeMaskRects[9][3], opponentSrcRects[9][3]; extern long playerSrcAddrs[9][3], fadeMaskAddrs[9][3]; extern long maskAddrs[9][3], opponentSrcAddrs[9][3]; extern long screenRowAddrs[480], workRowOffsets[480]; extern short isDepth; extern Boolean useQD, isColor, netGameInSession, playerInBack, drawThisFrame; extern Boolean imTheMaster, madeThePickUp, leftGoalIsPlayers, doSkipFrames; extern Boolean splashIsUp; \ No newline at end of file diff --git a/Headers/RenderAsm1.h b/Headers/RenderAsm1.h new file mode 100755 index 0000000..1d4648d --- /dev/null +++ b/Headers/RenderAsm1.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== RenderAsm1 Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Prototypes */ void DropDoorToWorkMapAsm1 (void); void MaskCursorAsm1 (long, short); void MaskBallAsm1 (long, short); void MaskPlayerAsm1 (long, long, long, short); void DumpWholePlayerAsm1 (long, long); void DumpWholeBallAsm1 (long, long); void DumpCursorAsm1 (long, long); void DumpDoorToScreenAsm1 (void); void PatchPlayerAsm1 (long, long); void PatchBallAsm1 (long, long); void PatchCursorAsm1 (long, long); void RenderSceneAsm1 (void); void ReplayWorkToMainAsm1 (void); /*======================================================== External Variables */ extern playerType thePlayer; extern playerType theOpponent; extern ballType theBall; extern doorType theDoor; extern digiDispType scoreDisplays[2]; extern cursorType boardCursor; extern BitMap offBackBits, offPartsBits, offWorkBits; extern Rect screenRect, cameraRect; extern WindowPtr mainWndo; extern Ptr offBackPix, offPartsPix, offWorkPix; extern long screenBase, replaySrc, replayDest; extern long ballSrcAddr, ballMaskAddr; extern long screenRowAddrs[480], workRowOffsets[480]; extern long playerSrcAddrs[9][3], fadeMaskAddrs[9][3], opponentSrcAddrs[9][3]; extern long maskAddrs[9][3]; extern short screenRowBytes, workRowBytes, backRowBytes, partsRowBytes; extern short maskRowBytes; extern Boolean knowsColor, playerInBack, showBoardCursor, disableBoardCursor; extern Boolean drawThisFrame; \ No newline at end of file diff --git a/Headers/RenderAsm4.h b/Headers/RenderAsm4.h new file mode 100755 index 0000000..27c61c1 --- /dev/null +++ b/Headers/RenderAsm4.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== RenderAsm4 Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Prototypes */ void DropDoorToWorkMapAsm4 (void); void MaskBoardCursorAsm4 (long, short); void MaskBallAsm4 (long, short); void MaskPlayerAsm4 (long, long, long, short); void DumpWholePlayerAsm4 (long, long); void DumpWholeBallAsm4 (long, long); void DumpCursorAsm4 (long, long); void DumpDoorToScreenAsm4 (void); void PatchPlayerAsm4 (long, long); void PatchBallAsm4 (long, long); void PatchCursorAsm4 (long, long); void RenderSceneAsm4 (void); void ReplayWorkToMainAsm4 (void); /*======================================================== External Variables */ extern playerType thePlayer; extern playerType theOpponent; extern ballType theBall; extern doorType theDoor; extern digiDispType scoreDisplays[2]; extern cursorType boardCursor; extern BitMap offMaskMap; extern Rect screenRect, cameraRect; extern CGrafPtr offCPartsPtr, offCWorkPtr; extern Ptr offBackPix, offPartsPix, offWorkPix; extern long screenBase, replaySrc, replayDest; extern long ballSrcAddr, ballMaskAddr; extern long screenRowAddrs[480], workRowOffsets[480]; extern long playerSrcAddrs[9][3], fadeMaskAddrs[9][3], opponentSrcAddrs[9][3]; extern long maskAddrs[9][3]; extern short screenRowBytes, workRowBytes, backRowBytes, partsRowBytes; extern Boolean playerInBack, showBoardCursor, disableBoardCursor, drawThisFrame; \ No newline at end of file diff --git a/Headers/RenderQD.h b/Headers/RenderQD.h new file mode 100755 index 0000000..a15430a --- /dev/null +++ b/Headers/RenderQD.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== QuickDraw Rendering Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Prototypes */ void RenderSceneQD1 (void); void RenderSceneQDC (void); void DisplayScoreDigitQD1 (short, short, short); void DisplayScoreDigitQDC (short, short, short); void DisplayPlayerFoulsQD1 (short); void DisplayPlayerFoulsQDC (short); void DisplayOpponentFoulsQD1 (short); void DisplayOpponentFoulsQDC (short); void TwinkleAStarQD1 (short); void TwinkleAStarQDC (short, short); void DrawOffscreenAStarQD1 (short); void DrawOffscreenAStarQDC (short, short); void UpdateArrowsQD1 (void); void UpdateArrowsQDC (void); void RedrawWholeScreen (void); void ReplayBackToWorkQD1 (void); void ReplayBackToWorkQDC (void); void ReplayWorkToMainQD1 (void); void ReplayWorkToMainQDC (void); Boolean DumpPict (short); void UpdateBallTimersQD1 (Rect *); void UpdateBallTimersQDC (Rect *); /*======================================================== External Variables */ extern playerType thePlayer; extern playerType theOpponent; extern ballType theBall; extern doorType theDoor; extern digiDispType scoreDisplays[2]; extern replayType *replayData; extern RGBColor RGBBlackColor; extern RGBColor starColors[3]; extern WindowPtr mainWndo; extern GrafPtr offBackPtr, offWorkPtr; extern GrafPtr offMaskPort; extern BitMap offBackBits, offPartsBits, offWorkBits; extern BitMap offMaskMap; extern CGrafPort offCBackPort, offCPartsPort, offCWorkPort; extern CGrafPtr offCBackPtr, offCPartsPtr, offCWorkPtr; extern Rect offBackRect, offPartsRect, offWorkRect, offMaskRect; extern Rect replayRect, cameraRect, colonDest; extern Rect leftArrowSrc, rightArrowSrc, leftArrowDest, rightArrowDest; extern Rect leftArrowStorage, rightArrowStorage, timingSource; extern Rect playerSrcRects[9][3], fadeMaskRects[9][3], opponentSrcRects[9][3]; extern Rect colonSrc[2]; extern Point starList[kNumberOfStars]; extern short displayMode, screenWide, screenHigh, whosGotBall; extern short playerFouls, opponentFouls; extern Boolean leftGoalIsPlayers, playerInBack, playerJustScored, isColor; extern Boolean drawThisFrame, showBoardCursor; \ No newline at end of file diff --git a/Headers/Replay.h b/Headers/Replay.h new file mode 100755 index 0000000..c3e0d93 --- /dev/null +++ b/Headers/Replay.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Replay Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Constants Defined */ #define kCameraInertia 5 /*======================================================== Prototypes */ void AmassReplayData (void); void DoInstantReplay (void); void RenderInstantReplayQD1 (void); void RenderInstantReplayQDC (void); void RenderInstantReplay (void); /*======================================================== External Variables */ extern playerType thePlayer; extern playerType theOpponent; extern ballType theBall; extern doorType theDoor; extern digiDispType scoreDisplays[2]; extern replayType *replayData; extern WindowPtr mainWndo; extern GrafPtr offBackPtr, offWorkPtr; extern RGBColor RGBBlackColor, RGBWhiteColor; extern RgnHandle screenRgn; extern GrafPtr offMaskPort; extern BitMap offPartsBits, offWorkBits, offBackBits, offMaskMap; extern CGrafPort offCPartsPort, offCWorkPort; extern CGrafPtr offCPartsPtr, offCWorkPtr, offCBackPtr; extern Ptr offBackPix; extern Rect offPartsRect, offWorkRect, offMaskRect; extern Rect cameraRect, replayRect, colonDest, screenRect; extern Rect playerSrcRects[9][3], fadeMaskRects[9][3], opponentSrcRects[9][3]; extern Rect colonSrc[2]; extern long timeElapsed, baseTime, wasTime, replaySrc, replayDest; extern short frameCounter, newFrameCount, lastFrameCount; extern short primaryMode, displayMode, screenWide, screenHigh, arenaSize; extern short displayHCenter, displayVCenter, workRowBytes, screenRowBytes; extern short playerFouls, opponentFouls; extern short playerScore, opponentScore; extern short leftPlayerNumber, rightPlayerNumber, loopDelay; extern short masterSendSize, slaveSendSize, loopDelay; extern short droppedPackets, sentPackets, whosGotBall; extern Boolean pausing, quitting, useQD, isColor, leftScoredLast, replayZooms; extern Boolean autoTeamsDialog, leftGoalIsPlayers, madeThePickUp; extern Boolean netGameInSession, imTheMaster, canReplay, playerJustScored; \ No newline at end of file diff --git a/Headers/SMS.h b/Headers/SMS.h new file mode 100755 index 0000000..e6b4991 --- /dev/null +++ b/Headers/SMS.h @@ -0,0 +1 @@ +#define AnyChannel -1 #define SMSTime1 26 #define SMSTime2 30 #define SMSTime4 42 #define kNoChannel 0 #define kOneChannel 1 #define kTwoChannel 2 #define kFourChannel 4 pascal extern void SMSINIT(void); pascal extern void SMSEXIT(void); pascal extern void SMSSETMODE (short theMode); pascal extern int SMSGETMODE (void); pascal extern void SMSSWITCHER (EventRecord *theEvent); pascal extern void SMSSTART (short soundID); pascal extern void SMSSTARTLO (short soundID); pascal extern void SMSSTARTMID (short soundID); pascal extern void SMSSTARTHI (short soundID); pascal extern void SMSSTARTCHAN (short soundID, short channel); pascal extern void SMSSTARTBIND (short soundID, Ptr completionProc); pascal extern void SMSSTARTGEN (short soundID, short channel, short priority, short repetitions, Ptr completionProc); pascal extern void SMSSTOP (void); pascal extern void SMSSTOPP (short priority); pascal extern void SMSSTOPCHAN (short channel); pascal extern void SMSSTOPGEN (short channel, short priority); pascal extern void SMSLOAD (short soundID); pascal extern void SMSUNLOAD (short soundID); pascal extern void SMSLOCK (short soundID); pascal extern void SMSUNLOCK (short soundID); pascal extern void SMSSOUNDON (void); pascal extern void SMSSOUNDOFF (void); pascal extern void SMSSETSTATE (Boolean state); pascal extern char SMSGETSTATE (void); pascal extern char SMSCHANNELFREE (short channel); pascal extern int SMSDECOMPRESS (Handle theSound); pascal extern void SMSSETIMING (short oneChan, short twoChan, short threeChan); pascal extern char SMSSOUNDMANAGER (void); \ No newline at end of file diff --git a/Headers/Show_help.h b/Headers/Show_help.h new file mode 100755 index 0000000..88c19b3 --- /dev/null +++ b/Headers/Show_help.h @@ -0,0 +1 @@ +pascal void Show_help( short help_dlog_id, StringPtr help_text_name, short base_pict_id, StringPtr default_filename, StringPtr default_menuname ); pascal void Flash_button( DialogPtr the_dialog, short item_number ); \ No newline at end of file diff --git a/Headers/SoundUtils.h b/Headers/SoundUtils.h new file mode 100755 index 0000000..327598c --- /dev/null +++ b/Headers/SoundUtils.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== SoundUtils Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Prototypes */ void TurnSMSOn (void); void TurnSMSOff (void); void PlaySoundSMS (short); void PlayIncidentSoundSMS (short); void FlushSoundQueues (void); void BeginGamePointSound (void); void BeginAllTiedSound (void); void StartCrowdSound (void); void StartApplauseSound (void); void Applaud (void); void StartMobSound (void); void HandleCrowdSound (void); void StopCrowdSound (void); void ResumeCrowdSound (void); void QueueUpIncidental (short, short, short); void HandleIncidentalQueue (void); /*======================================================== External Variables */ extern soundQueue crowdQueue, incidentalQueue; extern short lengthOfApplause, lengthOfMob, whichGame, wasLastSound; extern short lastSoundPriority, soundFileRefNum; extern short soundPriorities[kMaxNumberOfSounds]; extern Boolean beamSoundOn, incidentSoundOn, collisionSoundOn, crowdSoundOn; extern Boolean smsActivated, soundOn, imTheMaster, gameIsOver, netGameInSession; extern Boolean soundLoaded[kMaxNumberOfSounds]; extern Boolean incidentSoundLoaded[kMaxIncidentalSounds]; \ No newline at end of file diff --git a/Headers/TeamSetUp.h b/Headers/TeamSetUp.h new file mode 100755 index 0000000..ce89315 --- /dev/null +++ b/Headers/TeamSetUp.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Team Set-Up Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Defines */ #define rTeamsDialogID 1000 #define kTeamsPopMenuID 1000 #define kButtItemOkay 1 #define kButtItemCancel 2 #define kUserPopUpItem 3 #define kUserIconItem 4 #define kGeorgeIconItem 5 #define kMaraIconItem 6 #define kOttoIconItem 7 #define kClaireIconItem 8 #define kEazeIconItem 9 #define kTeakIconItem 10 #define kNetIconItem 11 #define kLeftStandItem 12 #define kRightStandItem 13 #define kPowBalloonItem 14 #define kStandsItem 15 #define kSeperatorItem 16 #define kArenaFrameItem 17 #define kCheckTeamsAuto 18 #define kTeamsTitleLeft 6 #define kTeamsTitleTop 16 #define rTeamsStandPictID1 2002 #define rTeamsStandPictID4 2003 #define rTeamsSeperatorPictID1 2004 #define rTeamsSeperatorPictID4 2005 /*======================================================== Prototypes */ void WhosOnFirst (void); void UpdateLeftStand (DialogPtr); void UpdateRightStand (DialogPtr); void DrawTeamsPopUpItem (void); void DrawTeamsPopUp (void); void RedrawStandNames (DialogPtr); void RedrawNetIcon (DialogPtr); void GrayOutIcons (DialogPtr); void UpdateTeamsDialog (DialogPtr); void DoDragIcon (DialogPtr, Point, short); void DoTeamsPopUpSelect (void); void SwapLeftAndRightSelected (DialogPtr); pascal Boolean TeamsFilter (DialogPtr, EventRecord *, short *); Boolean DoTeamsSetUp (void); /*======================================================== Globals */ extern playerType thePlayer; extern playerType theOpponent; extern string31 theNames[10]; extern Cursor handCursor; extern short whichHumanNumber, leftPlayerNumber, rightPlayerNumber, arenaSize; extern short whichGame, leftGoalLeague, rightGoalLeague, isLeague, theirLeague; extern Boolean isColor, autoTeamsDialog, canNetwork, leftGoalIsPlayers; extern Boolean disableBoardCursor, netGameInSession, doZooms; \ No newline at end of file diff --git a/Headers/UnivUtilities.h b/Headers/UnivUtilities.h new file mode 100755 index 0000000..99c0eeb --- /dev/null +++ b/Headers/UnivUtilities.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Universal Utilities Routines Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ #pragma once /* switch depth resources reserve 130-139 ID's */ /* file error resources reserve 140-149 ID's */ /* about dialog resources reserve 150-159 ID's */ /* preference resources reserve 160-169 ID's */ /* death error resources reserve 170-179 ID's */ /* minor error resources reserve 180-189 ID's */ /* network resources reserve 190-199 ID's */ /* message window resources reserve 200-209 ID's */ /* sound dialog resources reserve 210-219 ID's */ /* keys configure resources reserve 220-229 ID's */ /*======================================================== Compiler Directives */ #define kDemoVersion 0 /*======================================================== Prototypes */ void CenterDialog (short); void CenterAlert (short); void FlashDialogButton (DialogPtr, short); void DrawDefaultButton (DialogPtr, short); void SetDialogString (DialogPtr, short, StringPtr); void SetDialogNumToStr (DialogPtr, short, long); void EnableControl(DialogPtr, short); void DisableControl(DialogPtr, short); void SelectFromRadioGroup (DialogPtr, short, short, short); void LocalToGlobalRect (Rect *); void GlobalToLocalRect (Rect *); void ZoomOutDialogRect (short); void PasStringCopy (StringPtr, StringPtr); void PasStringCopyNum (StringPtr, StringPtr, short); void PasStringConcat (StringPtr, StringPtr); short RandomInt (short); Boolean RandomCoin (void); void DeathError (short); void MinorError (short); void SimpleMessage (void); Boolean KeyIsDown (short); Boolean CommandKeyIsDown (void); Boolean OptionKeyIsDown (void); Boolean CommandPeriodDown (void); void RectFromWindow (Rect *, WindowPtr); OSErr GetRect (Rect *, short); void ShowMenuBar (WindowPtr); void HideMenuBar (WindowPtr); void USSecsToDateString (long, StringPtr); void IntlSecsToDateString (long, StringPtr); void HoldIt (short); void GetOrigin (Point *); void SetMouse (Point); Boolean ForcePointInRect(Point *, Rect *); void GetChooserName (StringPtr); /*======================================================== Defines */ #define kNilPointer 0L /* a long zero (nil or NULL) */ #define kPutInFront (WindowPtr)-1L /* for opening windows in front */ #define kRemoveAllEvents 0 #define kMaxShort 32767 #define kMinShort -32738 #define kAsynch TRUE #define kSynch FALSE #define kActive 0 #define kInactive 255 #define kSleepTime 0L #define kNormalUpdates TRUE #define kLeaveItWhereItIs FALSE #define kSuspendResumeMssg 1 /* high byte suspend/resume message */ #define kResumeMask 1 /* bit for resume vs. suspend */ #define kDITop 0x0050 /* 80 decimal */ #define kDILeft 0x0070 /* 112 decimal */ #define kPutDialogWide 344 /* Height in pixels of SFPut dialog */ #define kPutDialogTall 188 /* Width in pixels of SFPut dialog */ #define kGetDialogWide 344 /* Height in pixels of SFGet dialog */ #define kGetDialogTall 166 /* Width in pixels of SFGet dialog */ #define kWNETrap 0x60 #define kSetDepthTrap 0xA2 #define kUnimpTrap 0x9F #define kGestaltTrap 0xAD #define kIsNilWindow 0 #define kIsUnknownWindow 1 #define kIsDAWindow 2 #define kWhiteColor4Bit 0 #define kYellowColor4Bit 1 #define kFuschiaColor4Bit 4 #define kVioletColor4Bit 5 #define kBlueColor4Bit 6 #define kBlackColor4Bit 15 #define kWhiteColor8Bit 0 #define kBlackColor8Bit 255 #define kNullString "\p" #define kDisplay1Bit 1 #define kDisplay2Bit 2 #define kDisplay4Bit 4 #define kDisplay8Bit 8 #define kEnterKeyASCII 0x03 /* ASCII code for the Enter key */ #define kHelpKeyASCII 0x05 /* ASCII code for the Help key */ #define kTabKeyASCII 0x09 /* ASCII code for the TAB key */ #define kReturnKeyASCII 0x0D /* ASCII code for Return key */ #define kLeftArrowKeyASCII 0x1C // ASCII code for the Left Arrow key #define kRightArrowKeyASCII 0x1D // ASCII code for the Right Arrow key #define kUpArrowKeyASCII 0x1E // ASCII code for the Up Arrow key #define kDownArrowKeyASCII 0x1F // ASCII code for the Down Arrow key #define k0KeyASCII 0x30 #define k1KeyASCII 0x31 #define k2KeyASCII 0x32 #define k3KeyASCII 0x33 #define k4KeyASCII 0x34 #define k5KeyASCII 0x35 #define k6KeyASCII 0x36 #define k7KeyASCII 0x37 #define kZKeyMap 1 /* key map offset for Z key */ #define kSKeyMap 6 /* key map offset for S key */ #define kRKeyMap 8 /* key map offset for R key */ #define kEKeyMap 9 /* key map offset for E key */ #define kQKeyMap 11 /* key map offset for Q key */ #define kBKeyMap 12 /* key map offset for B key */ #define kPeriodKeyMap 40 /* key map offset for Period key */ #define kMKeyMap 41 /* key map offset for M key */ #define kNKeyMap 42 /* key map offset for N key */ #define kCommandKeyMap 48 /* key map offset for Command key */ #define kSpaceBarMap 54 /* key map offset for Space Bar */ #define kTabKeyMap 55 /* key map offset for Tab key */ #define kOptionKeyMap 61 /* key map offset for Option key */ #define rDeathAlertID 170 /* alert res. ID for death error */ #define rErrTitleID 170 /* string ID for death error title*/ #define rErrMssgID 171 /* string ID for death error message*/ #define rMinorAlertID 180 /* alert res. ID for minor error */ #define rMinorErrMssgID 180 /* string ID for minor error message*/ #define rSimpleWindID 200 /* window ID for simple message */ #define rSimpleMssgID 200 /* string ID for simple message */ #define kErrUnnaccounted 1 #define kErrNeedMacPlus 2 #define kErrNeedSystem602 3 #define kErrNoDevice 4 #define kErrFailedSwitch 5 #define kErr2or16Colors 6 #define kErrNoPictRsrc 7 #define kErrNoMemory 8 #define kErrNoResource 9 #define kErrPastBeta 10 #define kErrFailedValidation 11 #define kMinorCantNetAndNetOnly 12 #define kMinorNoNetConfirm 1 #define kMinorMasterWrong 2 #define kMinorArenaTooBig 3 #define kMinorArenaTooSmall 4 #define kMinorNetPlayFailed 5 #define kMinor2HumanPlayers 6 #define kMinor2NetPlayers 7 #define kMinorOpponentAborted 9 #define kMinorRegisterFailed 10 #define kMinorSynchFailed 11 #define kMinorNoMasterPossible 12 #define kMinorNetCantPractice 13 #define kMinorNetCantTournament 15 #define kMinorWrongNetVersion 16 #define kMinorCantNetDefault 17 #define kMinorNeedOneValidCopy 18 #define kMinorNetworkOnlyRestrict 19 /*======================================================== Macros Defined */ #define SetRect(rect,l,t,r,b) {(rect)->top = (t); (rect)->left = (l); (rect)->bottom = (b); (rect)->right = (r);} #define OffHRect(rect,h) {(rect)->left += (h); (rect)->right += (h);} #define OffVRect(rect,v) {(rect)->top += (v); (rect)->bottom += (v);} #define topLeft(r) (((Point *) &(r))[0]) #define botRight(r) (((Point *) &(r))[1]) #define LeftShoveRect(rect,l,t) {(rect)->right += ((l)-(rect)->left); (rect)->bottom += ((t)-(rect)->top); (rect)->left += ((l)-(rect)->left); (rect)->top += ((t)-(rect)->top);} #define abs(a) ((a) <0? -(a) : (a)) #define HiWrd(aLong) (((aLong) >> 16) & 0xFFFF) #define LoWrd(aLong) ((aLong) & 0xFFFF) \ No newline at end of file diff --git a/Headers/ValidInstall.h b/Headers/ValidInstall.h new file mode 100755 index 0000000..fa6a442 --- /dev/null +++ b/Headers/ValidInstall.h @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== ValidInstall Header ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Defines */ #define kEncryptMask 0x08423735 #define kLegalVolumeCreation 0xA687BB77 #define rMasterDialogID 1010 #define kMasterFinderButton 1 #define kMasterNetOnlyButton 2 #define kMasterUserBalloon 3 #define kMasterTitleLeft 6 #define kMasterTitleTop 16 /*======================================================== Prototypes */ short GetSystemVolume (void); long VolumeCreated (void); Boolean VolumeMatchesPrefs (long, long *); Boolean PowerBook100Exception (void); Boolean SpecificVolumeCreated (void); pascal Boolean MasterFilter (DialogPtr, EventRecord *, short *); Boolean GetMasterDisk (void); Boolean ValidInstallation (Boolean); /*======================================================== External Variables */ extern long encryptedNumber, tempLong; extern Boolean isColor; \ No newline at end of file diff --git a/Misc/Pararena 2.0 History.txt b/Misc/Pararena 2.0 History.txt new file mode 100755 index 0000000..1d1e025 --- /dev/null +++ b/Misc/Pararena 2.0 History.txt @@ -0,0 +1 @@ +_____________________________________________________ _____________________________________________________ Pararena 2.0 Version History _____________________________________________________ _____________________________________________________ === Pararena 2.00 === Initial release. === Pararena 2.01 === No longer attempts to unmount start-up volume during validation. Forces opponents to both play Professional League when playing each other. Forces opponents to play a Standard Game when playing each other. Doesn't steal your "show off time" when Instant Replay comes up after game over. First Demo version spun off. === Pararena 2.02 === Got rid of random bit of text that could appear in "About" dialog (non-Demo only). === Pararena 2.03 === Changed 4-bit About box PICT. Recompiled with THINK C 5.04. Cleaned up some of the ValidInstall.c code (nil completionPtrs, NewPtr() calls, etc.). Cleaned up color splash screen just a touch. Replaced DisposHandle() calls with DisposCIcon() calls in Sound dialog. Added a few keyboard shortcuts in Sound dialog. Fixed GetChooserName function. Added 1993 to the copyright strings. Changed back-door date to my sister's birthday. Doesn't complain if UnmountVol() fails because of fBsyErr. === Pararena 2.04 === No longer register name on network via a temp param block (now stays allocated). Filled in Prefs file calls ioCompletion field with nil pointer just to be safe. Moved ShieldCursor() call to beginning of direct-to-screen routines. Added ShowCursor() calls to tail of direct-to-screen drawing. === Pararena 2.05 === Call InitCursor() after dismissing Help dialog (sometimes left the text cursor). Got rid of the Beep from Switch Depth Alert (most annoying). Fixed white rect around Instant Replay window (was being menuBar clipped). Fixed garbage left behind by Instant Replay window (was being menuBar clipped). <-- note: v. 2.05 never shipped since a bug was found to have been introduced --> === Pararena 2.06 === Completely rewrote the MenuBar show/hide routine to fix the bug introduced in 2.05. Modified how pixmaps created to fix a bug on my Duo 210 - no SetEntries() call. === Pararena 2.07 === Recompiled with THINK C 6.00. Added secret QT feature - holding down dumps replay to PICTs. \ No newline at end of file diff --git a/Misc/Show_help1.6 Folder/Edit Pararena Help b/Misc/Show_help1.6 Folder/Edit Pararena Help new file mode 100755 index 0000000000000000000000000000000000000000..f0052c60cc323966ad7b1832b103cb17bf4bf7ea GIT binary patch literal 29824 zcmeI53zQt?mEXS}NicvK2}yXwyJ&+n5}H8|gbj;<(E}lage(nUJF#(1cg;+rp005} zG?E`Mi!o7bui5o(lHIJ&hGUzPSc$#tW*>>~XL_)}&N(?}X*{~!Ro~-&_q*@!R@u3JcW89vwmCk|f6jKUHS4&Z`xKlz z`#bywt~lV_ImO&P|8<#jD;HdJuFuVO{r%OBkA2XZy~zcIU+oL@z3|PxS;5ynr$d3_ z|8j2mUl;D`JDtXVXWGoNQgQ5YSMqb-%ND$wgm(a``WvaQ?sJ zr8{ZK-<_p9^*8gZ|4(@7bK*|_-;xJ!-MqZ7PQN6t*Y!stU2xr%3-4tY_YK?;(J>0J-SfT*tw~G?s)t^SXyxOXi?N^ zO-4qseNnR+PDEOx2)MTuO$F8TS5Vr?GMlBK6|0{p+lZ#4u$2u_o{Y+e_l1qaX%`z{ zP@~t|Q)5v>*ISd-rcrRimx{?e`H@?Vc2vwpY(+;~BaKEp)6}eX&(90i8P#Q>_l+DH zm9BevIrz2jICr4vmi*Jdc1s??292KS3cq{66+ZF1FW>LAyZ@h4VD|RChemTg9X_7< zeg*d+%n`UH-*kniSOeGfIhTF+-+n&-_PYZkdv@EnHlTdV!vBnDJj7w3LBH}^%pJ^SNt%>Cp! zu5#xE?)^5`UZ4s8d+Be~{JFXN=N|tqSKIu($lq7*d*1G9z?WWl>Bm2x^}ROAYZQ2m z0xD^yW z?zR_RctqE{Z?YV?a%Vh!EEuWPoFk%`irdZT&S^a2T2#hU$03#%JzkA!m7t`brD7%C zhqsOwt&XF1NnUc&)wz4!vVtpYEPSkRN8$G$V~QmYng3(6bc@{wSR9bfRQNBBxZUk{s|sriA981ES$vi_n@PwzH#8LN zj~i2At#-`fj#fAp9FC3!&6#S80HPU;MXi}As{182Hw9zuRxlFx`) zG0kLDFHSR)#;ev@uqSvmt{0!M z9)qs&bc+EGO^0P-9I#982XD&X^2qc=z6IuY*dRkqjk0hFVY8V|pF{jF7De3F*43%A zqGTBgg59_~!+7Xx@X!y%Llf7X77x{;@sx$?;$4fK7hxagZgywdET1d9rSP9-nPvY2 zi_8L7PR3JF7yCJPpX={i=KgizQ|^xn-*rnFKysDvUpa2qVZfYFX~Sz#eWEovm=~xG zewP`&DLINs7u;g<23zFY|T*^!XB56$#)+`ly0fkD}!BY-4txuB;iPCGhGu8i+)=?v1TU2);+aqJt6_4 zq=0z476sNWxG~tADlo}vFz7E|6>QmHxVocG9TJ1(%E2)xg z3Y)AZS${AYiVe!~)Kus-S$ZQJSLgXWu;>(igs?)2E8Cox=M3A;h1`)1k*(YWCP^A) zYwYIi@lYD6%Y3+cRso!aH|W~xcISo zHg)&W=@@$<wuoPX>Hs0JMmLdct zaeg)lhITwgdqhT>YJFm{MTk>gfm(Wno=VDxz1ScT&fXS$XFP>d(o{lHEAMQiIAZ=b zPOt{g18KLYB4+4Pa@ze3-fEt1`%NkL*raq$#8^yxx)_}v9=%#EHhaQ--5VDwk1C|# zQ+Ql#*->^u!Z_SRw;-aD7Edru97J?(H0R0XpnF~4(!zCarf{o!!po&uTa(Kc-KrHy zX5W6d7RkKaeY>!|@bF{Hbgg3-yCfj<$hw5Im-m#i&3wjWeG<`*uuYkYG?jTQ!kx?u zMKfql#%&zwF&UFYl;-KWoOURg5iI>hsmlm1V((wK4Uc{{E}uVReic3V z!EJPxzz>(XV})IGDkZ(Gvn6k_uQrYzNzrb z?qK1Q0hgBiO-EZ{7reufiy{)$IWB*CK|sf|P%n2pIyOkOD7 zjUAp~pfoB@mWMaf8C`WUC3ksW5t+LbOT68i`ah{%+uETpVUEi$5 za?z&3@+7`?vuGVPTh}UB#@pQ$;8-jC6ZeaS=jVHf`=gma2b^7qrJ0rVCKjNyyHX|R zk|Pj{y~_pA|4$0P<-S$;{zCfXm}NfwldZMbv};uG{ers^d_N4nk1WKOut1^R0+dq^ z@K77y?pWORi4%4@iI1}L*PBWKDVNEh~VXJJ)6XG*ATT9Xo%waFLn! zX&@r%U^+%pte0l0Ry=asDUS4sGAUn;SQ3B)?&5QB3x3Dm|1>RwtU2g7HQ? zm4tU{-1Kae>)jiHdNlKLvnRKUVe>HAGK+WFMy^^42OTDdWuAgEe9{~Furt9cwZR?l zESHhHW3jwelJ0of&ZBv|j|R;Z3#1F_O@&Uy#$wyhX)&+1L<5e(LzdTSRlTDbG*yKn zMpW7;suR;CWw`3XUfsR8rwn&VUf~g*X<(i~{B4j6SR22U+nL0E# zsVlq)&t(_0QR?xG+}au4#IH>%FSZQZzG#RZwHV&aNHyHUU2mTJ_uw;0;v?r>YH=hr z4EHTPhBX|0=7pwgu^BN2wvvrzmLZb%srt+cGL+p;6F*f_Z%MI@6``2sVzhM-#Ihis z!>SdMH_eu5g_qb)479L5?ZII zk>Bqzh}JKXtoBErdb48R0OKs8Yky>sQR8H1I7@>V2OghG1#(s z>ouFzu%n#i^T0rXRXBNNkmF&o&U|IGF^9>*o5k^V-O`r%Rw)6+7MxJvLLAFiKc#!f zVw1X`pOGn&xX$y0k3M>XBl2jxQ;AhLd+X+{o~v{5mB-Q-ObNw#WA{c< z&gqmds_RXMT!Z-&>HR#9b)&vX!=zYhA~Vo3ld0-xCcbuentZ3( z$wX}OIdXraJ3*dY%Tc>0ODBq7{(7crPDj;s+43F=ufr!jEUJ(y5$fyIu2O9_1f>h0M)swvH? zMfa*IwbK=eF$N=aNvl)gt`rMX{~cTx(fLVO({rK8JtRgGv&6}0ANnQP3Vjv!^A6t3 zGw^6-o9DH%F5aW`fHmnP{Icu*pv}*gWM0rL_z8-adN^D1RPe`elw<(x$fna?*Rzqo zR80M_qK&iJV`Rz2MHN*sJH_$sq;NV|rHZESethbTkH&BAEbY^?&YC^?AjCg;6~upiUr<~*bMmScM^C&pwn4_%9#i z=r8~2`@)s{?4wZlO>XDN!Cn5juzZX3JN3f;*|9V13O#Oki~{2`+?H)`e8W~(xZ%c! z&gD+go$c1T%Ye7L0e2AicHkKBVc@R-e*^e&;1_{UxME?o8z`&+z6rPo*a98_-Us|e z;3t5e0{#&ABUkLZ#I5by0F2x~UlsTn;Aerq4g5XeA8`LE;D6`$|8~VCo87>YYk>QK zZvoP8$)qbT-R9OVy%AV-152lXM}ZFje;xRnz{i1q?25~_yMbl50vo_45d4>c|FTcI zwadN${4;)k4fq2f_?@xb4V-Zv@ZSPI2mBWBd%)*`FS_EHSGs{S*8%??@b3fP4}1vt zpMl>5vd;d3EB5~aa2N0vx3>Rnz|ZpgG2mYUzXSXqz#q8cSxel&SpJUR;QN3d z1b!I!Fpzbe^=07KfM0jTvkPwE?3KW~-P*IE-`O+#en0S6fu8{WJ`nnyv&;>gvm7`A z+zmVid>`2Wm1A_0WF9DwhzUT&4BR{MAfh&Ml05<_|1R@u!!Dsb5f$wr_SHBzhULgCidY0?| z0QhUb-vB-V{8Ql5z^?+qZ#DR>hF@00FRT9+IOmFMoEunk25=MbIw1SJhJ9Z1PT*l+ z6L=K(pj*2Jd06u(zaIns$PJtip67$-`QUl}1;7$;8}J5KeBEPi;C1lN>z)O|&jaxN z0DQj|IU(LF%{y(m`<->067S?smgYLp>xPJ}&cFi-cxcz{;X#0Of zj*DO6PoIPBTGTwN_-Js)*uAR#Iuc!fR&jKOddgaOENYPRBUz(7K56SPn5K?#EG7*e zgd_q(JK?azc5^u3Sd$jGcJ+!vo(WRF=8W360QaehQ%n{}nK?f=p&v&gIEP!d`1CmS zK?F0=(K3m29;hM)jHjn*UvI4^tyESq2w9x1Nn@t$IVav6m>T-&@wp!|AX9#|l3cw; z-JXmpoN2=ULe|r6#ZzI6^^&bjm)N4LMu}w7`LAe^Z+In(+}2s7(RIP3FSE*O^J-Sw zbCoF$FSE)b%y2-56-_u{BqgNiF~h!+NQ1ckEW=kaP&ZnGF`7*_(){<7$`f%|gJuko z9(_|gkh4U?4^Lp=BsmBRUJ=G3Sny%LpGJ_fm^L$ zS7%kExQ&NxR=9<8MWxaskE_m}fT7`+LWL15b9*aHX1p!R4aB&WKm}xal1Tu^<+#%OXzn)b3=rLe`10+B0}{v1!L@E z%QeD~myS4mC{z0lvY@5}eV$s)kfagw*h+0OBRMopa1aTn+l^_S#x+z@`b0Z>)OuUdgvLTU1turjXGFJZ+FLfJ&Dx!MS}p*hvt z=)F5P;jMncJoTqS67(Qp6sfnUh);_?nSTOOXU= z8JmC&I{}A0rDTzuR&jRJkV>pXROU+aLDs>sXrfxLiwZ1<8MKv2QBN?@2&btn_v}@R zlVc#O*AJo!1qkf2lz*}>sd_gd++aAurKX7e+^MD5ny$l}mSk7KY=V7(U8S-ss+h-0 z_!Yy74MTFUBpQ}9`d-gszBh9x3r*IU&Xv*3&t+`LOf58kX7aL}V1V?7H4Z^klWP0d zVW^W3BxNGYg8jrbdoXEzN3v$R0trbLCnm>;ml#Lrnu?_rt%8Nwm!`@-5^I)9 zfjF%9U|Ol@qb(Cg-u}twF&R6A%z2WE(bC~Mdy#pnQn?8`QelB;frQ566jwt}MWkWt z)h6#vfE6KPJe9Vlx`_aQ<_H6=*{JzVFnw{k$`%+E?BSqJ& zF;Z}amS81bn!z+7Y=khI4bwQ43>R(lR5-yIcDs@sF`I_)&tp(N)Cl%8!XraFdb3 zo2@9Mfvcn9^8H&Kv7kkM0qZmbp0I#_`KBw*-d`YaWIeQn?(m_&t*gl{xSpCpA>0r#?dE z-uA=<+BbEmGfoO8(ECs>+Z~(?uU0ykA&W;s3M!-xz11~^q&^UKdRl&!JVAcrLgm;2 z#csCE#F#)<%Y~8?lX|8ARiipTwAN_Gj!Bte53V%E$ZRk2Eqox(0sqa`h;od;1Jljp zi8#8V3WTgZufA=A-vY1f=G)^H}JZ^*Wuwu_)o5a59P%0_S7Mn1h=xj{a zQwu@`(c8RXdDK=^CB85#;F-|-@ApcgvPFw(hX0_SFRE-Xb}(1p8*bIycr%sAt=0?@ z6wk!<+-hv`-b5lxwpDaX8$xoeYB4RoN#bE!>w`ATUWZIJmY3zc{>bC;Q-{|!CaV@l z+oFfPAmJDy@JwPp&eTGvx^O~c%{HI*@maD~D|h#=$Ox7@4WgaHR3yO~?DA!HrH zem70M>6zApk@!B7J)MJO4RnWG38BhWL_TEH%|n+E0tqI zhg$LU2_CYe5#uwSVyO+7c?H)Dw=1#-XEaM9P$I-X~yLbZP1`lK$>ue#@C zgp)cBWYxafOr)KJSOG6sQif@8ENp5kz5j;PXN5$3r&=K-kiZEreo$Wt-C}$pq_hBr zGe^kkGKHet;w;@p#%)wfIpnc##nOu2Hu1C;+D)cG01@=_iuNJ|o+5HL?7NSS?C=Aa z|EW|JR;Ql+$hSP`+sVhK4pbH^x21V$Gezl3a{Sr3Jbd9wwbm5l5A8O3hczq=51=WX z=TS0>G~x*y2KFxB<1P6fR8PZG2S^|)a|ns{;50VEn&lpoET2fl08m+!zBY?ie3-&P zuQ9RNZxFjS7{d_BVVRCCok0eu&a>IE-tUx-nApY%KiQ^W52cEPpX_goA&{49gqC3p zdG~R!j}nz&Gzt$xeKU4yHHD71d`}gtYk@@2gr4hRg=F0IIL2kgbW+twp`IP*AL3;( zw;6m5MEaCmqFL_AHbhM)N%uIVPB6GHtOOJlKw(RPp-~kn#P|seZcZhtMq#dJlD+GR zVw%eApqrGn#jWuM*Kkjb?5+5h$EX-?#UjfN@9vwFDHKm!)r@prop&BUk~D}$42vrtszovYMiwJhB59s!?|ZOLf+V zlbGuerjLTbJJMZ!n(YW{@r2i9)RQR^OsZCya5`O!ZxxKiM~$Pj2V{?tDACB`0Qq%E zid%Zpr@Lf!c`)9F^^S~jiyjrX6()DHef4<_cuIQvhy=_RZwoE)mgcq23EO!LItci5 z6^$%um+RoymmemZN@FfMj&GG@E#C$;<$}ra*P|as1Wz%-+)5*yAdh37iWRuqcaL+@ zh~1olIQx;Z>#e&8*4Bn*ykbGT&qlm$Qg6H^@_)INYBN0c<(iO1G!+xs#EsOI z@q_qVIX@QSzbrzX?MCaEe(qpI@Pv^KnUU9H@I*$26Dd0Km{DztYiP1Ayt?u6xAOQX zEWJGnC)!cB%HFOJR#(AzZ>AlSEm8h6mo-ll@JWwUB^zC5s+HCxW8BJvGZYK@0S+|c zaV22o#w4?=Q^P-)W9bRwrqS;68Q~)8_1Jf7ZlOc3u?>?ZNj=RmL3oL!mUHagn(VGw z``nyTfd@>*sKD7yQJ6llY1^qRjLD2L=3qFqDZujpf1(q{B!CyqYo1qT-71!U})d;m<)~!#BvZZuTiMLqz*-&lh#k zJYZTJhgw_DE;Y=Tq@SwyrBS`nZ$_6FF%yk0#$`f=#SJ!Ifi+=8&$AsCV1IL7nb*2P z1C2tAuA@^$UTBL0{#b!{K^kMHnW83EgQO1Fi0^UvlLIwa3~`|@*w{T~M(-gE1v^#v zDI+yvDmGW94zufoMl_IJcsF{;f*$!T(|Q3*#6Hc)CQ(Ae9R>PN7W{v%z zRFTA7q<0yWREEe41jGcMxE3YIOdxVTth6@%H9=?KIM@zNpVPzLQ`b@ER|K3p+ULU7Gpe40? zXWdk$)@&|LMj5Q5c2M!Eyd6#`_XacMqhV8}h?$!mB)Al6ibHa{e&}#@Iv7#xN$8nu zQ+i6zejTGiK!=Hje(CnGl6s|t8|W{xa>K*JCC*l2xH=f*wKRHv6=lDAw9jw4qF?Kt zMYy?R&>SWsOdAlYl6g7^r->qdfG%|WYolzu#Mmn;P`1jmeeMC2xW+3C(DX=-PfpfC zqXG6L4Vz>VAWagdDfgxInL%JYvOh$j`@*s%B{D%dq?2e%kOn)GxA%}KQ8!ouu9IG` z;EVagXSPo3C9fblz&51c_$r4*a)f1L>)71A{^SM^Vj7%v6ey>9a4+!zTmrM8IbdX@ zP62j)3-5&BZ)rpDU5#+&geRJ@oN-#ZR{vrx`H9%RI>i9I`j^KB602jAq)pK_k~g%C zg+$Vm@SIUXh>mCUlUPD8qKf#i1}20lOMbX!i8gVnttF9_?0gCoj5;YR;K?Hdy@UkBodK8dB@{A-EO` zZ6m8)mS{?%Y7?I62wf!ILC4#7?n*5#vUEVtjgQ6gVZ21fM&sF5mnMj#wWrCWwR(~U zJ!VHov6XQtVUi?-@g04>Q?|g?)me-$>*!7jVV%1#r0!>uiQ_dSv5G^w4xEsaoP zL_CJm3tcKr+tnq<$g2F3Thy z=}u_Pgi12$C{5$COZh}uTmB$)m=& zH)2Q|l|7KTgzWW9l00__%hN*AVrfP*gW#W&lFTHQLnN^DmfvZimZ!MqR5ZCZo<|lG zoQq5KRK8_PZLvDR!8c7?*zjT$@q3fVDmfx~G}ss6E*yj4<1s9f$_CFGl9N%k*lZ8G zyl!R_o2DF_R^QZn6!p4B!eVK;9Z8zZcDKsgZiL*FA37h%;bhGt+7XmL1B}u>hf10V z68|t1iWlOTREYs7SK%~`O`G9(j(kos5lu{6Ws4YWtB!`;V9VC`wBlhQrnk&RjU0_h zv2g>oO-2fjgw>k)am;U1kN`kSDAffgZQFXAQNg;15E?Y`;E-%cl%&*Zv5pbBTQ|lP z7v|(WgvrP$L9=99F?fnRG`YiL>m5YqWhkUys(#*_nnq82+eB6!lne;==;SfbAuEGs z#^>^+Cb$dr29VT<(9myggabw*U6^dS)^9$$i92Ci?>F4mZu_s)cGIVEv@hli!YOvN z>3IZ_rS6ehSjgL+QpE*RnzZ4o?Zgf=DaI6v*ugQSAg|rL`8HlN1s>7SP~44D8->iG zPjJXjY;Qghr-xPC9&JJij{(+Dy;~{W5pPRNJ0jr{)-R{RA`xIPFb4gmX-O#*s+ILIl&zN>Zv-@YI+mm4c=&T?q7^y%mw(U#`UwpK{t zINQc=E2W#pZXoUK$dSlX4foMRKi6EGknAy3)Lo`FIT2c0wn1-OICQYY9nqt*(&Rog zfBNhNA-ESO~n;c@s<@A!gd0h zIOH8)R%BGsgi_+Ln?=WxB8>+AP?2w$nC4Ur(H7KJ=NwvHOaOivcc4#MzQ~Me=ky#= zqR0@Ll3dZuj@CNLig%=N0M0rjQ=5eUk zOIA`SGU7=2D8)z#w#FXf&M_VAupg)|G?U2DIm%GvgX_rC$mU=Vf(oa(X&^E2`Zq;uruX?q`^XeGjlOR zAt}{kNgEieTn<~Ywx=tAPiE5$W&A>ED2#WK&d^n*AiQvB7nF-nmzS7Yh~TthiXL+qg(#SJXSZ>szqR%rf;h^o-A*;W-ci_;?u=G|sXOF|>Arl2b&^HA;xI|*eXTnn-$0mq->>9>& z^LTf~p3#}c^=eI8oI#fnJ@f%V6HdM*u2I~)zMC*_Ha59?IJld)qQMe=X|SHT@>oHh zQqoYMRn@aVrRlKR7-~-rHKLCW)!UOLZr+lxb&AIIMV=3Om7in0^ylb1w+6ou1n(W% zJiL8da6@pEKYe{aLVK^s0DmAb^&w=qbT?6k5|>JAnj|EOo-zUGHiY*RZg+34*6(dMu1~d9@a5~X`&)*u zWjEye+U?+0`V2Rkjk0sEbIY6!;V$7VbX#~DS^r*O|E3Q!_kvFz8r^Zb{y!O$n|ep< z#r*LSI(v(s)5GZCn0^L2*Lg!-=la_8y7N8K_7~=_=h|PCUZ0!m%Z>90mw%bR<8H;= zgFI;6#~<@7{(09ehQI!QCGE4s|4UMudI5dksi!3-V&3)$wT?vCCcA9SPUD|obY$=C WMgtnJ*xwF5)WBO);<4R&`u_rrAz0@C literal 0 HcmV?d00001 diff --git a/Misc/Show_help1.6 Folder/Para Help.rsrc b/Misc/Show_help1.6 Folder/Para Help.rsrc new file mode 100755 index 0000000..e69de29 diff --git a/Para Sounds b/Para Sounds new file mode 100755 index 0000000..e69de29 diff --git a/Pararena.project b/Pararena.project new file mode 100755 index 0000000..e69de29 diff --git a/Pararena.project.rsrc b/Pararena.project.rsrc new file mode 100755 index 0000000..e69de29 diff --git a/Sources/Abandoned Routines.c b/Sources/Abandoned Routines.c new file mode 100755 index 0000000..c68c00a --- /dev/null +++ b/Sources/Abandoned Routines.c @@ -0,0 +1 @@ +/*======================================================== ShowMenuBar */ void ShowMenuBar (WindowPtr theWindow) { Rect theRect; RgnHandle worldRgn, menuBarRgn; GrafPtr wasPort; Point originPt; if (GetMBarHeight() == 0) { GetPort((GrafPtr)&wasPort); SetPort((GrafPtr)theWindow); GetOrigin(&originPt); SetOrigin(0, 0); MBarHeight = wasMenuBarHeight; theRect = (**GetGrayRgn()).rgnBBox; UnionRect(&theRect, &screenBits.bounds, &theRect); worldRgn = NewRgn(); OpenRgn(); FrameRoundRect(&theRect, 16, 16); CloseRgn(worldRgn); theRect = screenBits.bounds; theRect.bottom = theRect.top + wasMenuBarHeight; menuBarRgn = NewRgn(); RectRgn(menuBarRgn, &theRect); SectRgn(worldRgn, menuBarRgn, menuBarRgn); /* /------------------\ */ DisposeRgn(worldRgn); /* |__________________| */ UnionRgn(theWindow->visRgn, menuBarRgn, theWindow->visRgn); DiffRgn(theWindow->visRgn, menuBarRgn, theWindow->visRgn); DisposeRgn(menuBarRgn); DrawMenuBar(); SetOrigin(originPt.h, originPt.v); SetPort((GrafPtr)wasPort); } } /*======================================================== HideMenuBar */ void HideMenuBar (WindowPtr theWindow) { Rect theRect; RgnHandle worldRgn, menuBarRgn; GrafPtr wasPort; Point originPt; short nowMBarHeight; nowMBarHeight = GetMBarHeight(); if (nowMBarHeight != 0) { GetPort((GrafPtr)&wasPort); SetPort((GrafPtr)theWindow); GetOrigin(&originPt); SetOrigin(0, 0); wasMenuBarHeight = GetMBarHeight(); MBarHeight = 0; theRect = (**GetGrayRgn()).rgnBBox; UnionRect(&theRect, &screenBits.bounds, &theRect); worldRgn = NewRgn(); // /-----------\ OpenRgn(); // | whole | FrameRoundRect(&theRect, 16, 16); // | desktop | CloseRgn(worldRgn); // \___________/ theRect = screenBits.bounds; theRect.bottom = theRect.top + wasMenuBarHeight; menuBarRgn = NewRgn(); RectRgn(menuBarRgn, &theRect); SectRgn(worldRgn, menuBarRgn, menuBarRgn); // /------------------\ DisposeRgn(worldRgn); // |__________________| UnionRgn(theWindow->visRgn, menuBarRgn, theWindow->visRgn); DisposeRgn(menuBarRgn); SetOrigin(originPt.h, originPt.v); SetPort((GrafPtr)wasPort); } } /*======================================================== ShowMenuBar */ void ShowMenuBar (WindowPtr theWindow) { Rect theRect; short nowMBarHeight; nowMBarHeight = GetMBarHeight(); if (nowMBarHeight == 0) { MBarHeight = wasMenuBarHeight; DiffRgn(GrayRgn, menuBarRgn, GrayRgn); DisposeRgn(menuBarRgn); // DrawMenuBar(); } } /*======================================================== HideMenuBar */ void HideMenuBar (WindowPtr theWindow) { Rect theRect; short nowMBarHeight; nowMBarHeight = GetMBarHeight(); if (nowMBarHeight != 0) { wasMenuBarHeight = GetMBarHeight(); MBarHeight = 0; theRect = screenBits.bounds; theRect.bottom = theRect.top + wasMenuBarHeight; menuBarRgn = NewRgn(); RectRgn(menuBarRgn, &theRect); UnionRgn(GrayRgn, menuBarRgn, GrayRgn); PaintOne(kNilPointer, menuBarRgn); } } \ No newline at end of file diff --git a/Sources/About.c b/Sources/About.c new file mode 100755 index 0000000..60a7459 --- /dev/null +++ b/Sources/About.c @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== About Dialog Routines == //== == //============================================================ //============================================================ //======================================================== Includes #include "About.h" #include "UnivUtilities.h" //======================================================== Local Vars static RgnHandle okayButtRgn; static Rect okayButtonBounds, mainPICTBounds; static Boolean okayButtIsHiLit, clickedDownInOkay; //======================================================== Procedures //======================================================== HiLiteOkayButton void HiLiteOkayButton (void) { PicHandle thePict; if (!okayButtIsHiLit) { thePict = GetPicture(kOkayButtPICTHiLit); if (thePict != kNilPointer) { DrawPicture(thePict, &okayButtonBounds); ReleaseResource((Handle)thePict); okayButtIsHiLit = TRUE; } } } //======================================================== UnHiLiteOkayButton void UnHiLiteOkayButton (void) { PicHandle thePict; if (okayButtIsHiLit) { thePict = GetPicture(kOkayButtPICTNotHiLit); if (thePict != kNilPointer) { DrawPicture(thePict, &okayButtonBounds); ReleaseResource((Handle)thePict); okayButtIsHiLit = FALSE; } } } //======================================================== UpdateMainPict void UpdateMainPict (DialogPtr theDialog) { PicHandle thePict; BeginUpdate((GrafPtr)theDialog); DrawDialog((GrafPtr)theDialog); if (isColor) thePict = GetPicture(kAboutColorPICT); else thePict = GetPicture(kAboutBandWPICT); if (thePict != kNilPointer) { DrawPicture(thePict, &mainPICTBounds); ReleaseResource((Handle)thePict); } EndUpdate((GrafPtr)theDialog); } //======================================================== AboutFilter pascal Boolean AboutFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit) { Point mousePt; long dummyLong; if (Button() && clickedDownInOkay) { GetMouse(&mousePt); if(PtInRgn(mousePt, okayButtRgn)) HiLiteOkayButton(); else UnHiLiteOkayButton(); } switch (theEvent->what) { case keyDown: switch ((theEvent->message) & charCodeMask) { case kReturnKeyASCII: case kEnterKeyASCII: HiLiteOkayButton(); Delay(8, &dummyLong); UnHiLiteOkayButton(); *itemHit = buttItemOkay; return(TRUE); break; default: return(FALSE); } break; case mouseDown: mousePt = theEvent->where; GlobalToLocal(&mousePt); if(PtInRgn(mousePt, okayButtRgn)) { clickedDownInOkay = TRUE; return(FALSE); } else return(FALSE); break; case mouseUp: mousePt = theEvent->where; GlobalToLocal(&mousePt); if(PtInRgn(mousePt, okayButtRgn) && clickedDownInOkay) { UnHiLiteOkayButton(); *itemHit = buttItemOkay; return(TRUE); } else { clickedDownInOkay = FALSE; return(FALSE); } break; case updateEvt: UpdateMainPict(theDialog); theEvent->what = nullEvent; return(FALSE); break; default: return(FALSE); break; } } //======================================================== DoAbout void DoAbout (void) { DialogPtr aboutDialog; Str255 longVersion; StringPtr messagePtr; VersRecHndl version; Handle itemHandle; Rect itemRect; short itemType, itemHit; CenterDialog(rAboutDialogID); // Call our universal centering routine if (doZooms) ZoomOutDialogRect(rAboutDialogID); aboutDialog = GetNewDialog(rAboutDialogID, kNilPointer, kPutInFront); if (aboutDialog == kNilPointer) return; SetPort((GrafPtr)aboutDialog); // Bring up the dialog ShowWindow((GrafPtr)aboutDialog); ParamText("\p", "\p", "\p", "\p"); #if kDemoVersion ParamText("\pDEMO COPY", "\p", "\p", "\p"); #endif // Get version info from 'vers' resource version = (VersRecHndl)GetResource('vers', 1); if (version != kNilPointer) { messagePtr = (StringPtr)(((unsigned long) &(**version).shortVersion[1]) + ((**version).shortVersion[0])); BlockMove((Ptr)messagePtr, &longVersion, ((unsigned char) *messagePtr) + 1); GetDItem(aboutDialog, textItemVers, &itemType, &itemHandle, &itemRect); SetIText(itemHandle, longVersion); // Modify text item to show vers } GetDItem(aboutDialog, buttItemOkay, &itemType, &itemHandle, &okayButtonBounds); okayButtRgn = NewRgn(); // Create diagonal button region OpenRgn(); MoveTo(okayButtonBounds.left + 1, okayButtonBounds.top + 45); Line(44, -44); Line(16, 16); Line(-44, 44); Line(-16, -16); CloseRgn(okayButtRgn); okayButtIsHiLit = FALSE; // Initially, button is not hilit clickedDownInOkay = FALSE; // Initially, didn't click in okay button GetDItem(aboutDialog, pictItemMain, &itemType, &itemHandle, &mainPICTBounds); UpdateMainPict(aboutDialog); do // Loop until user wants to exit { ModalDialog(AboutFilter, &itemHit); } while (itemHit != buttItemOkay); DisposeRgn(okayButtRgn); // Clean up! DisposDialog(aboutDialog); } \ No newline at end of file diff --git a/Sources/AnimCursor.c b/Sources/AnimCursor.c new file mode 100755 index 0000000..2cb05ee --- /dev/null +++ b/Sources/AnimCursor.c @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Animated Cursor File == //== == //============================================================ //============================================================ #include "UnivUtilities.h" #include "AnimCursor.h" //======================================================== Local Variables acurHandle animCursorH = kNilPointer; Boolean useColorCursor = FALSE; //======================================================== Functions //======================================================== GetMonoCursors Boolean GetMonoCursors (acurHandle ballCursH) { short i, j; CursHandle cursHdl; if (ballCursH) // Were we passed a legit acur handle? { j = (*ballCursH)->n; // Get number of 'frames' in the acur for (i = 0; i < j; i++) // Start walking the frames { cursHdl = GetCursor((*ballCursH)->frame[i].resID); if (cursHdl == kNilPointer) // Did the cursor load? It didn't?... { // Well then, toss what we got. for (j = 0; j < i; j++) DisposHandle((*ballCursH)->frame[j].cursorHdl); return(FALSE); // And report this to mother. } // However!... else // If cursor loaded ok... { // Detach it from the resource map... DetachResource((Handle)cursHdl); // And then assign it to our struct (*ballCursH)->frame[i].cursorHdl = (Handle)cursHdl; } } } return(TRUE); // Mom, success! } //======================================================== GetColorCursors Boolean GetColorCursors (acurHandle ballCursH) { short i, j; CCrsrHandle cursHdl; Boolean result = TRUE; if (ballCursH) { j = (*ballCursH)->n; // Get the number of cursors HideCursor(); // Hide the cursor for (i = 0; i < j; i++) // Walk through the acur resource { cursHdl = GetCCursor((*ballCursH)->frame[i].resID); // Get the cursor if (cursHdl == kNilPointer) // Make sure a real cursor was returned { // If not, trash all cursors loaded for (j = 0; j < i; j++) DisposCCursor((CCrsrHandle)(*ballCursH)->frame[j].cursorHdl); result = FALSE; // Tell calling proc we failed break; // And break out of the loop } else // But, if the cursor loaded ok { // add it to our list or cursor handles (*ballCursH)->frame[i].cursorHdl = (Handle)cursHdl; SetCCursor((CCrsrHandle)(*ballCursH)->frame[i].cursorHdl); } } InitCursor(); // Show the cursor again (as arrow) } return(result); // Return to calling proc w/ results } //======================================================== InitAnimatedCursor void InitAnimatedCursor (acurHandle ballCursH) { short i, j; Boolean useColor; useColor = isColor; if (!ballCursH) ballCursH = (void *)GetResource('acur', 128); if (ballCursH && ballCursH != animCursorH) { HNoPurge((Handle)ballCursH); MoveHHi((Handle)ballCursH); HLock((Handle)ballCursH); if (useColor) useColor = GetColorCursors(ballCursH); if (!useColor && !GetMonoCursors(ballCursH)) return; DisposCursors(); animCursorH = ballCursH; useColorCursor = useColor; (*ballCursH)->index = 0; } } //======================================================== LoadCursors void LoadCursors (void) { CursHandle handCursorH; InitAnimatedCursor((acurHandle)GetResource('acur', rAcurID)); handCursorH = GetCursor(rHandCursorID); HLock((Handle)handCursorH); handCursor = **handCursorH; HUnlock((Handle)handCursorH); } //======================================================== DisposCursors void DisposCursors (void) { register short i, j; if (animCursorH != kNilPointer) { j = (*animCursorH)->n; if (useColorCursor) { for (i = 0; i < j; i++) { if ((*animCursorH)->frame[i].cursorHdl != kNilPointer) DisposCCursor((CCrsrHandle)(*animCursorH)->frame[i].cursorHdl); } } else { for (i = 0; i < j; i++) { if ((*animCursorH)->frame[i].cursorHdl != kNilPointer) DisposHandle((Handle)(*animCursorH)->frame[i].cursorHdl); } } ReleaseResource((Handle)animCursorH); animCursorH = kNilPointer; } } //======================================================== IncrementCursor void IncrementCursor (void) { if (animCursorH == 0) InitAnimatedCursor(kNilPointer); if (animCursorH) { (*animCursorH)->index++; (*animCursorH)->index %= (*animCursorH)->n; if (useColorCursor) SetCCursor((CCrsrHandle)(*animCursorH)->frame[(*animCursorH)->index].cursorHdl); else SetCursor((CursPtr)*(*animCursorH)->frame[(*animCursorH)->index].cursorHdl); } else SetCursor((CursPtr)*GetCursor(watchCursor)); } //======================================================== DecrementCursor void DecrementCursor (void) { if (animCursorH == 0) InitAnimatedCursor(kNilPointer); if (animCursorH) { (*animCursorH)->index--; if (((*animCursorH)->index) < 0) (*animCursorH)->index = ((*animCursorH)->n) - 1; if (useColorCursor) SetCCursor((CCrsrHandle)(*animCursorH)->frame[(*animCursorH)->index].cursorHdl); else SetCursor((CursPtr)*(*animCursorH)->frame[(*animCursorH)->index].cursorHdl); } else SetCursor((CursPtr)*GetCursor(watchCursor)); } //======================================================== SpinCursor void SpinCursor (short incrementIndex) { long dummyLong; short i; for (i = 0; i < incrementIndex; i++) { IncrementCursor(); Delay(1, &dummyLong); } } //======================================================== BackSpinCursor void BackSpinCursor (short decrementIndex) { long dummyLong; short i; for (i = 0; i < decrementIndex; i++) { DecrementCursor(); Delay(1, &dummyLong); } } \ No newline at end of file diff --git a/Sources/AppleTalkDDP.c b/Sources/AppleTalkDDP.c new file mode 100755 index 0000000..15e9262 --- /dev/null +++ b/Sources/AppleTalkDDP.c @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== AppleTalkDDP Unit == //== == //============================================================ //============================================================ //======================================================== Includes #include "Globals.h" #include "UnivUtilities.h" #include "AppleTalkDDP.h" #include "AnimCursor.h" //======================================================== Local Variables ATDDPRecHandle inABRecordDDP, outABRecordDDP; EntityName thisEntity; EntityName theLookupEntity; MPPParamBlock theLookUpBlock, theNameBlock; NamesTableEntry theNameTable; AddrBlock opponentsAddress; netUserArray knownNetUserArray; Str255 thisName, opponentsName; Ptr sendBuffer, receiveBuffer; OSErr netErr; short thisSocket, knownNetUsers, netUserNowSelected, lastByteCount; short firstPackageShort; char theLookupBuffer[kLookupBufferSize]; Boolean newAppleTalkCalls, nameIsRegistered, imTheMaster, requestNoted; //======================================================== Functions //======================================================== InitializeAppleTalk short InitializeAppleTalk (void) { #define kNCVersion 48 SysEnvRec thisWorld; Boolean callWorked; thisSocket = 0; nameIsRegistered = FALSE; requestNoted = FALSE; netErr = SysEnvirons(2, &thisWorld); // get machine environment if (netErr != noErr) return(kNetErrBadHardware); if (thisWorld.machineType < env512KE) // abort on less than Mac 512KE return(kNetErrBadHardware); // do we have the new calls? newAppleTalkCalls = (thisWorld.atDrvrVersNum >= kNCVersion); netErr = OpenAppleTalkDriver(); if (netErr != noErr) return (kNetErrDriverFailed); sendBuffer = NewPtr(kBufferSize); if (sendBuffer == kNilPointer) return (kNetErrBuffersFailed); receiveBuffer = NewPtr(kBufferSize); if (receiveBuffer == kNilPointer) return (kNetErrBuffersFailed); inABRecordDDP = (ATDDPRecHandle)NewHandle(ddpSize); if (inABRecordDDP == kNilPointer) return (kNetErrBuffersFailed); MoveHHi((Handle)inABRecordDDP); HLock((Handle)inABRecordDDP); outABRecordDDP = (ATDDPRecHandle)NewHandle(ddpSize); if (outABRecordDDP == kNilPointer) return (kNetErrBuffersFailed); MoveHHi((Handle)outABRecordDDP); HLock((Handle)outABRecordDDP); GetDefaultName(); if (thisName[0] == 0) GetIndString(thisName, rNetStringID, 2); netErr = OpenSocketDDP(); // open an ATP socket if (netErr != noErr) return(kNetErrSocketFailed); return (kNetErrNoErr); } //======================================================== RegisterNameOnNet OSErr RegisterNameOnNet (void) { #define kDoVerify 0xFF MPPParamBlock theNameBlock; OSErr theErr; Boolean itWorked; theErr = noErr; if (nameIsRegistered) return (theErr); PasStringCopy((StringPtr)theNames[whichHumanNumber - 1], (StringPtr)thisName); NBPSetEntity((Ptr)&thisEntity, (Ptr)thisName, (Ptr)kThisType, (Ptr)kAnyZone); NBPSetNTE((Ptr)&theNameTable, (Ptr)thisName, (Ptr)kThisType, (Ptr)kAnyZone, thisSocket); theNameBlock.MPPioCompletion = kNilPointer; theNameBlock.NBPinterval = 3; theNameBlock.NBPcount = 3; theNameBlock.NBPentityPtr = (Ptr)&theNameTable; theNameBlock.NBPverifyFlag = kDoVerify; theErr = PRegisterName(&theNameBlock, kSynch); if (theErr == noErr) nameIsRegistered = TRUE; return (theErr); } //======================================================== NamesFilter pascal Boolean NamesFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit) { switch (theEvent->what) { case keyDown: switch ((theEvent->message) & charCodeMask) { case kEnterKeyASCII: case kReturnKeyASCII: if (netUserNowSelected != 0) { FlashDialogButton(theDialog, kButtNetOkay); *itemHit = kButtNetOkay; return(TRUE); } break; default: return(FALSE); break; } break; default: while (IsThereAnotherName(knownNetUsers)) { knownNetUsers++; ProcessAName(knownNetUserArray, knownNetUsers); if (netUserNowSelected == 0) netUserNowSelected = 1; UpdateNetOpponents(theDialog, knownNetUserArray, knownNetUsers, netUserNowSelected); } if (IsLookUpFinished()) { netErr = LookUpNamesAsynch(); } return(FALSE); break; } } //======================================================== SelectNetOpponentAsynch Boolean SelectNetOpponentAsynch (void) { #define kBalloon1PictID 2000 #define kBalloon4PictID 2001 #define kNetTitleLeft 6 #define kNetTitleTop 16 #define kLookingIndex 8 DialogPtr netSelectAsynchDialog; PicHandle thePict; Handle itemHandle; Rect iRect; Str255 newTitle, lookingString; short itemHit, iType; Boolean leaveDialog, userOkayed; knownNetUsers = 0; netUserNowSelected = 0; CenterDialog(rNetSelectDialogID); netSelectAsynchDialog = GetNewDialog(rNetSelectDialogID, kNilPointer, kPutInFront); SetPort((GrafPtr)netSelectAsynchDialog); ShowWindow((GrafPtr)netSelectAsynchDialog); GetDItem(netSelectAsynchDialog, kUserNetFrame, &iType, &itemHandle, &iRect); ForeColor(cyanColor); FrameRect(&iRect); ForeColor(blackColor); GetDItem(netSelectAsynchDialog, kNetPowBalloonItem, &iType, &itemHandle, &iRect); if (isColor) thePict = GetPicture(kBalloon4PictID); else thePict = GetPicture(kBalloon1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetIndString(newTitle, rNetStringID, 3); if (newTitle[0] == 0) PasStringCopy((StringPtr)"\pChoose Opponent", (StringPtr)newTitle); MoveTo(kNetTitleLeft, kNetTitleTop); DrawString(newTitle); GetIndString(lookingString, rMiscStrings, kLookingIndex); UpdateNetOpponents(netSelectAsynchDialog, knownNetUserArray, knownNetUsers, netUserNowSelected); GetDItem(netSelectAsynchDialog, kTextNetWho, &iType, &itemHandle, &iRect); ForeColor(blueColor); SetIText(itemHandle, lookingString); ForeColor(blackColor); netErr = LookUpNamesAsynch(); leaveDialog = FALSE; while (leaveDialog == FALSE) { ModalDialog(NamesFilter, &itemHit); switch (itemHit) { case kButtNetOkay: PasStringCopy((StringPtr)knownNetUserArray[netUserNowSelected - 1].name, (StringPtr)opponentsName); opponentsAddress = knownNetUserArray[netUserNowSelected - 1].address; leaveDialog = TRUE; userOkayed = TRUE; break; case kButtNetCancel: userOkayed = FALSE; leaveDialog = TRUE; break; case kButtNetNext: netUserNowSelected++; if (netUserNowSelected > knownNetUsers) netUserNowSelected = 1; GetDItem(netSelectAsynchDialog, kTextNetWho, &iType, &itemHandle, &iRect); ForeColor(blueColor); SetIText(itemHandle, knownNetUserArray[netUserNowSelected - 1].name); ForeColor(blackColor); break; case kButtNetPrev: netUserNowSelected--; if (netUserNowSelected < 1) netUserNowSelected = knownNetUsers; GetDItem(netSelectAsynchDialog, kTextNetWho, &iType, &itemHandle, &iRect); ForeColor(blueColor); SetIText(itemHandle, knownNetUserArray[netUserNowSelected - 1].name); ForeColor(blackColor); break; default: break; } } DisposDialog(netSelectAsynchDialog); return (userOkayed); } //======================================================== RequestReceiveDDP OSErr RequestReceiveDDP (void) { #define kChecksumReq TRUE OSErr readErr; if (requestNoted) return; requestNoted = TRUE; (*inABRecordDDP)->abOpcode = tDDPRead; (*inABRecordDDP)->abResult = 0; (*inABRecordDDP)->abUserReference = 0L; (*inABRecordDDP)->ddpType = 5; (*inABRecordDDP)->ddpSocket = thisSocket; (*inABRecordDDP)->ddpReqCount = kBufferSize; (*inABRecordDDP)->ddpDataPtr = receiveBuffer; readErr = DDPRead(inABRecordDDP, kChecksumReq, kAsynch); return (readErr); } //======================================================== PollIncomingDDP OSErr PollIncomingDDP (long theData, short maxBytes, short maxTickWait) { long tickAbort; OSErr requestErr; short bytesGot; tickAbort = Ticks + (long)maxTickWait; while (((*inABRecordDDP)->abResult > 0) && (Ticks < tickAbort)); netErr = (*inABRecordDDP)->abResult; bytesGot = (*inABRecordDDP)->ddpActCount; if (netErr == noErr) { lastByteCount = bytesGot; requestNoted = FALSE; if ((bytesGot > 0) && ((*inABRecordDDP)->ddpAddress.aNode == opponentsAddress.aNode)) { if (bytesGot > maxBytes) { bytesGot = maxBytes; } BlockMove(receiveBuffer, (Ptr)theData, (long)bytesGot); } requestErr = RequestReceiveDDP(); } return (netErr); } //======================================================== PollSpecificDDP OSErr PollSpecificDDP (long theData, short exactBytes, short maxTickWait) { long tickAbort; OSErr requestErr; short bytesGot; tickAbort = Ticks + (long)maxTickWait; while (((*inABRecordDDP)->abResult > 0) && (Ticks < tickAbort)); netErr = (*inABRecordDDP)->abResult; bytesGot = (*inABRecordDDP)->ddpActCount; if (netErr == noErr) { lastByteCount = bytesGot; requestNoted = FALSE; if ((bytesGot > 0) && ((*inABRecordDDP)->ddpAddress.aNode == opponentsAddress.aNode)) { if (bytesGot != exactBytes) { BlockMove(receiveBuffer, (Ptr)&firstPackageShort, 2L); netErr = kNetErrWrongSize; } else { BlockMove(receiveBuffer, (Ptr)theData, (long)bytesGot); } } requestErr = RequestReceiveDDP(); } return (netErr); } //======================================================== SendOutgoingDDP OSErr SendOutgoingDDP (long theData, short dataSize) { #define kChecksumSend FALSE BlockMove((Ptr)theData, sendBuffer, (long)dataSize); (*outABRecordDDP)->abOpcode = tDDPWrite; (*outABRecordDDP)->abUserReference = 0L; (*outABRecordDDP)->ddpType = 5; (*outABRecordDDP)->ddpSocket = thisSocket; (*outABRecordDDP)->ddpAddress = opponentsAddress; (*outABRecordDDP)->ddpReqCount = dataSize; (*outABRecordDDP)->ddpDataPtr = sendBuffer; netErr = DDPWrite(outABRecordDDP, kChecksumSend, kSynch); return (netErr); } //======================================================== CloseDownAppleTalk short CloseDownAppleTalk (void) { Boolean callWorked; netErr = DeRegisterName(); if (netErr != noErr) return (netErr); netErr = CloseSocketDDP(); if (netErr != noErr) return (netErr); if (outABRecordDDP != kNilPointer) { HUnlock((Handle)outABRecordDDP); DisposHandle((Handle)outABRecordDDP); } if (inABRecordDDP != kNilPointer) { HUnlock((Handle)inABRecordDDP); DisposHandle((Handle)inABRecordDDP); } if (sendBuffer != kNilPointer) DisposPtr(sendBuffer); if (receiveBuffer != kNilPointer) DisposPtr(receiveBuffer); return (kNetErrNoErr); } //======================================================== OpenAppleTalkDriver OSErr OpenAppleTalkDriver (void) { short refNum; netErr = OpenDriver("\p.MPP", &refNum); return (netErr); } //======================================================== GetDefaultName void GetDefaultName (void) { #define kChooserStringID -16096 Handle theNameHandle; theNameHandle = (Handle)GetString(kChooserStringID); if (theNameHandle != kNilPointer) PasStringCopy((StringPtr)*theNameHandle, (StringPtr)thisName); else thisName[0] = 0; if (thisName[0] == 0) GetIndString(thisName, rNetStringID, 2); if (thisName[0] == 0) PasStringCopy((StringPtr)"\pNo Name", (StringPtr)thisName); } //======================================================== OpenSocketDDP OSErr OpenSocketDDP (void) { netErr = DDPOpenSocket(&thisSocket, kNilPointer); return (netErr); } //======================================================== LookUpNames OSErr LookUpNamesAsynch (void) { SpinCursor(12); NBPSetEntity((Ptr)&theLookupEntity, (Ptr)kLookUpSelector, (Ptr)kThisType, (Ptr)kAnyZone); theLookUpBlock.NBPinterval = 6; theLookUpBlock.NBPcount = 5; theLookUpBlock.NBPentityPtr = (Ptr)&theLookupEntity; theLookUpBlock.NBPretBuffPtr = (Ptr)&theLookupBuffer; theLookUpBlock.NBPretBuffSize = kLookupBufferSize; theLookUpBlock.NBPmaxToGet = kMaxLookUpNumber; netErr = PLookupName(&theLookUpBlock, kAsynch); InitCursor(); return (netErr); } //======================================================== IsThereAnotherName Boolean IsThereAnotherName (short youThink) { short howMany; howMany = theLookUpBlock.NBPnumGotten; if (howMany > youThink) return(TRUE); else return(FALSE); } //======================================================== IsLookUpFinished Boolean IsLookUpFinished (void) { short howMany, transmitsLeft; howMany = theLookUpBlock.NBPnumGotten; transmitsLeft = theLookUpBlock.NBPcount; if ((howMany == kMaxLookUpNumber) || (transmitsLeft == 0)) return(TRUE); else return(FALSE); } //======================================================== ProcessAName OSErr ProcessAName (netUserArray netOpponents, short nameNumber) { EntityName lookupEntity; AddrBlock theAddrBlock; short howMany; netErr = noErr; howMany = theLookUpBlock.NBPnumGotten; if ((howMany == 0) || (nameNumber == 0)) { return (netErr); } if (howMany > kMaxLookUpNumber) howMany = kMaxLookUpNumber; if (nameNumber > kMaxLookUpNumber) nameNumber = kMaxLookUpNumber; if (howMany < nameNumber) { return (netErr); } netErr = NBPExtract((Ptr)&theLookupBuffer, howMany, nameNumber, &lookupEntity, &theAddrBlock); if (netErr == noErr) { netOpponents[nameNumber - 1].address = theAddrBlock; PasStringCopy((StringPtr)lookupEntity.objStr, (StringPtr)netOpponents[nameNumber - 1].name); } return (netErr); } //======================================================== UpdateNetOpponents void UpdateNetOpponents (DialogPtr theDialog, netUserArray netOpponents, short number, short who) { #define kNoOpponentIndex 9 Handle itemHandle; Rect iRect; Str255 numberString, noOpponentString, newTitle; short iType; DrawDialog((GrafPtr)theDialog); if (number == 0) { GetDItem(theDialog, kButtNetOkay, &iType, &itemHandle, &iRect); HiliteControl((ControlHandle)itemHandle, 255); } else { GetDItem(theDialog, kButtNetOkay, &iType, &itemHandle, &iRect); HiliteControl((ControlHandle)itemHandle, 0); DrawDefaultButton(theDialog, kButtNetOkay); } NumToString((long)number, numberString); GetDItem(theDialog, kTextNetNumber, &iType, &itemHandle, &iRect); SetIText(itemHandle, numberString); GetIndString(noOpponentString, rMiscStrings, kNoOpponentIndex); if (number == 0) { GetIndString(newTitle, rNetStringID, 1); GetDItem(theDialog, kTextNetWho, &iType, &itemHandle, &iRect); if (newTitle[0] == 0) PasStringCopy((StringPtr)noOpponentString, (StringPtr)newTitle); ForeColor(blueColor); SetIText(itemHandle, newTitle); ForeColor(blackColor); GetDItem(theDialog, kButtNetNext, &iType, &itemHandle, &iRect); HiliteControl((ControlHandle)itemHandle, 255); GetDItem(theDialog, kButtNetPrev, &iType, &itemHandle, &iRect); HiliteControl((ControlHandle)itemHandle, 255); } else { GetDItem(theDialog, kTextNetWho, &iType, &itemHandle, &iRect); ForeColor(blueColor); SetIText(itemHandle, netOpponents[who - 1].name); ForeColor(blackColor); if (number <= 1) { GetDItem(theDialog, kButtNetNext, &iType, &itemHandle, &iRect); HiliteControl((ControlHandle)itemHandle, 255); GetDItem(theDialog, kButtNetPrev, &iType, &itemHandle, &iRect); HiliteControl((ControlHandle)itemHandle, 255); } else { GetDItem(theDialog, kButtNetNext, &iType, &itemHandle, &iRect); HiliteControl((ControlHandle)itemHandle, 0); GetDItem(theDialog, kButtNetPrev, &iType, &itemHandle, &iRect); HiliteControl((ControlHandle)itemHandle, 0); } } } //======================================================== DetermineMasterSlave Boolean DetermineMasterSlave (void) { short i; Boolean mediated; mediated = FALSE; if (speedFlag > theirSpeed) { imTheMaster = TRUE; mediated = TRUE; } else if (speedFlag < theirSpeed) { imTheMaster = FALSE; mediated = TRUE; } else if (thisName[0] > opponentsName[0]) { imTheMaster = TRUE; mediated = TRUE; } else if (thisName[0] < opponentsName[0]) { imTheMaster = FALSE; mediated = TRUE; } else { for (i = 1; i < thisName[0]; i++) { if (thisName[i] > opponentsName[i]) { imTheMaster = TRUE; mediated = TRUE; break; } else if (thisName[i] < opponentsName[i]) { imTheMaster = FALSE; mediated = TRUE; break; } } if (!mediated) { if (thisSocket > (short)opponentsAddress.aSocket) { imTheMaster = TRUE; mediated = TRUE; } else if (thisSocket < (short)opponentsAddress.aSocket) { imTheMaster = FALSE; mediated = TRUE; } } } return (mediated); } //======================================================== DeRegisterName OSErr DeRegisterName (void) { netErr = noErr; if (nameIsRegistered) { theNameBlock.NBPentityPtr = (Ptr) &thisEntity; netErr = PRemoveName(&theNameBlock, kSynch); if (netErr == noErr) nameIsRegistered = FALSE; } return (netErr); } //======================================================== CloseSocketDDP OSErr CloseSocketDDP (void) { netErr = noErr; if (thisSocket != 0) netErr = DDPCloseSocket((Byte)thisSocket); thisSocket = 0; return (netErr); } \ No newline at end of file diff --git a/Sources/Ball.c b/Sources/Ball.c new file mode 100755 index 0000000..3f4c7b5 --- /dev/null +++ b/Sources/Ball.c @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Ball Handling Routines == //== == //============================================================ //============================================================ //======================================================== Includes #include "Globals.h" #include "UnivUtilities.h" #include "Ball.h" #include "Render.h" #include "PlayUtils.h" #include "SoundUtils.h" #include "Dynamics.h" //======================================================== Functions //======================================================== BallRectFromPosition void BallRectFromPosition (void) { short rootHeight, actualHeight; short indexX, absoluteX, fractionalX; short indexZ, fractionalZ; theBall.isRect.left = (theBall.xPos / 64) + displayHCenter - 5; theBall.isRect.right = theBall.isRect.left + 16; absoluteX = theBall.xPos; if (absoluteX < 0) absoluteX = -absoluteX; indexX = absoluteX / 512; fractionalX = absoluteX % 512; indexZ = (theBall.zPos / 512) + 40; fractionalZ = theBall.zPos % 512; rootHeight = vertTable[indexX][indexZ]; actualHeight = rootHeight + (fractionalX * (vertTable[indexX + 1][indexZ] - rootHeight)) / 512; actualHeight += (fractionalZ * (vertTable[indexX][indexZ + 1] - rootHeight)) / 512; theBall.isRect.bottom = actualHeight + 4; theBall.isRect.top = theBall.isRect.bottom - 12; if ((theBall.isRect.bottom > screenHigh) || (theBall.isRect.top < 0) || (theBall.isRect.right > screenWide) || (theBall.isRect.left < 0)) { theBall.isRect = theBall.wasRect; } } //======================================================== ResetBall void ResetBall (void) { theBall.mode = kBallFiring; theBall.modifier = kInitBallFiringTime + RandomInt(60) - 30; theBall.flag = kIsNormal; theBall.xPos = theBall.initXPos; theBall.zPos = theBall.initZPos; theBall.xVel = theBall.initXVel + RandomInt(3000) - 1000; theBall.zVel = theBall.initZVel; theBall.justHitWall = 0; theBall.dontDraw = FALSE; if (RandomCoin()) // was if (leftScoredLast) { leftScoredLast = TRUE; theBall.xVel *= -1; theBall.xPos += 384; } else { leftScoredLast = FALSE; theBall.xPos -= 384; } thePlayer.mouseWasLetUp = TRUE; theOpponent.mouseWasLetUp = TRUE; BallRectFromPosition(); whosGotBall = kBallIsNotHere; thePlayer.loopsBallHeld = 0; theOpponent.loopsBallHeld = 0; if (thePlayer.persona == kMissTeak) { oldDistSquared = ((long)(thePlayer.xPos) * (long)(thePlayer.xPos)) + ((long)(thePlayer.zPos) * (long)(thePlayer.zPos)); } else if (theOpponent.persona == kMissTeak) { oldDistSquared = ((long)(theOpponent.xPos) * (long)(theOpponent.xPos)) + ((long)(theOpponent.zPos) * (long)(theOpponent.zPos)); } UpdateBallTimers(&thePlayer); UpdateBallTimers(&theOpponent); UpdateArrows(); } //======================================================== DoAFoul void DoAFoul (void) { if (theBall.modifier == kPlayerLastHeld) HandlePlayerFoul(); else HandleOpponentFoul(); theBall.eraseTheBall = TRUE; ResetBall(); } //======================================================== DoBallFiring void DoBallFiring (void) { theBall.modifier--; if (theBall.modifier == 0) { PlaySoundSMS(kBallFiringSound); theBall.mode = kBallRolling; theBall.modifier = kNoOneLastHeld; theBall.loopsBallIdle = kLoopLimitOnIdleBall; theDoor.doorState = kDoorIsOpen; theDoor.phase = kDoorPhases; theDoor.stateChanged = TRUE; if (leftScoredLast) theDoor.doorOpen = kLeftDoor; else theDoor.doorOpen = kRightDoor; whosGotBall = kBallRollsFreely; } } //======================================================== MoveRollingBall void MoveRollingBall (void) { #define kOffTheDishLg 473497600L // 340 x 64 ^2 #define kOffTheDishSm 321126400L // 280 x 64 ^2 long ballDistSquared; short indexX, indexZ; short signX, signZ; short forceX, forceZ; short frictionX, frictionZ; short tempVel; indexX = theBall.xPos; if (indexX < 0) { indexX = -indexX; signX = -1; } else { signX = 1; } indexX /= 512; indexZ = theBall.zPos; if (indexZ < 0) { indexZ = -indexZ; signZ = -1; } else { signZ = 1; } indexZ /= 512; if (theBall.xPos < 0) { switch (leftGoalLeague) { case kLittleLeague: forceX = *(littleForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kJuniorVarsity: forceX = *(juniorForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kVarsity: forceX = *(varsityForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kMinorLeague: forceX = *(minorForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kProfessional: forceX = *(proForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; default: forceX = 0; break; } } else { switch (rightGoalLeague) { case kLittleLeague: forceX = *(littleForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kJuniorVarsity: forceX = *(juniorForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kVarsity: forceX = *(varsityForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kMinorLeague: forceX = *(minorForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kProfessional: forceX = *(proForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; default: forceX = 0; break; } } switch (forceX) { case kOutOBounds: theBall.flag = kIsOutOfBounds; break; case kBackBoard: if (theBall.zPos < 0) theBall.flag = kIsOutOfBounds; else { HandleBallWallCollision(); theBall.xPos += (theBall.xVel / kVelocitySensitive); theBall.zPos += (theBall.zVel / kVelocitySensitive); } break; case kGoalPath: if (theBall.zPos < 0) theBall.flag = kIsOutOfBounds; else theBall.flag = kIsInGoal; break; default: theBall.flag = kIsNormal; forceX *= signX; if (theBall.xPos < 0) { switch (leftGoalLeague) { case kLittleLeague: forceZ = *(littleForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kJuniorVarsity: forceZ = *(juniorForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kVarsity: forceZ = *(varsityForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kMinorLeague: forceZ = *(minorForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kProfessional: forceZ = *(proForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; default: forceZ = 0; break; } } else { switch (rightGoalLeague) { case kLittleLeague: forceZ = *(littleForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kJuniorVarsity: forceZ = *(juniorForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kVarsity: forceZ = *(varsityForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kMinorLeague: forceZ = *(minorForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kProfessional: forceZ = *(proForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; default: forceZ = 0; break; } } theBall.xVel -= forceX; theBall.zVel -= forceZ; if (theBall.justHitWall == 0) { frictionX = theBall.xVel / kFrictionFraction; frictionZ = theBall.zVel / kFrictionFraction; theBall.xVel -= frictionX; theBall.zVel -= frictionZ; } theBall.xPos += (theBall.xVel / kVelocitySensitive); theBall.zPos += (theBall.zVel / kVelocitySensitive); break; } ballDistSquared = ((long)theBall.xPos * (long)theBall.xPos) + ((long)theBall.zPos * (long)theBall.zPos); if (arenaSize == kLargeArena) { if (ballDistSquared > kOffTheDishLg) theBall.dontDraw = TRUE; else theBall.dontDraw = FALSE; } else { if (ballDistSquared > kOffTheDishSm) theBall.dontDraw = TRUE; else theBall.dontDraw = FALSE; } BallRectFromPosition(); } //======================================================== DoBallInGoal void DoBallInGoal (void) { theBall.eraseTheBall = TRUE; if (theBall.xPos < 0) { if (leftGoalIsPlayers) DoPlayerScores(); else DoOpponentScores(); } else { if (!leftGoalIsPlayers) DoPlayerScores(); else DoOpponentScores(); } ResetBall(); } //======================================================== DoBallRolling void DoBallRolling (void) { switch (theBall.flag) { case kIsNormal: case kIsRebounding: MoveRollingBall(); theBall.loopsBallIdle--; if (theBall.loopsBallIdle == 120) { PlaySoundSMS(kIdleSound); } if (theBall.loopsBallIdle == 0) { theBall.eraseTheBall = TRUE; ResetBall(); } break; case kIsOutOfBounds: DoAFoul(); break; case kIsInGoal: DoBallInGoal(); break; default: break; } } //======================================================== HandleBall void HandleBall (void) { switch (theBall.mode) { case kBallFiring: DoBallFiring(); break; case kBallRolling: DoBallRolling(); break; case kBallHeld: break; case kBallInStasis: break; } if (theDoor.phase != 0) { theDoor.phase--; if (theDoor.phase == 0) { theDoor.doorState = kDoorIsClosed; theDoor.stateChanged = TRUE; } } } \ No newline at end of file diff --git a/Sources/CommonPerson.c b/Sources/CommonPerson.c new file mode 100755 index 0000000..55e9f3f --- /dev/null +++ b/Sources/CommonPerson.c @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Common Person Handling Routines == //== == //============================================================ //============================================================ //======================================================== Includes #include "Globals.h" #include "UnivUtilities.h" #include "CommonPerson.h" #include "SoundUtils.h" #include "Dynamics.h" #include "Computer.h" #include "Human.h" #include "PlayUtils.h" #include "Ball.h" #include "Render.h" //======================================================== Functions //======================================================== PersonRectFromPosition void PersonRectFromPosition (playerType *who) { short rootHeight, actualHeight; short indexX, absoluteX, fractionalX; short indexZ, fractionalZ; who->isRect.left = (who->xPos / 64) - 16 + displayHCenter; who->isRect.right = who->isRect.left + 32; absoluteX = who->xPos; if (absoluteX < 0) absoluteX = -absoluteX; indexX = absoluteX / 512; fractionalX = absoluteX % 512; indexZ = (who->zPos / 512) + 40; fractionalZ = who->zPos % 512; rootHeight = vertTable[indexX][indexZ]; actualHeight = rootHeight + (fractionalX * (vertTable[indexX + 1][indexZ] - rootHeight)) / 512; actualHeight += (fractionalZ * (vertTable[indexX][indexZ + 1] - rootHeight)) / 512; who->isRect.bottom = actualHeight + 4; who->isRect.top = who->isRect.bottom - 44; if ((who->isRect.bottom > screenHigh) || (who->isRect.top < 0) || (who->isRect.right > screenWide) || (who->isRect.left < 0)) { who->isRect = who->wasRect; } } //======================================================== ResetPerson void ResetPerson (playerType *who) { if (who->selector == kPlayerSelector) { who->dirFlagSrc = kFacingRested; who->postFlagSrc = kStanding; who->arrayFlagMask = kFadeMask; who->dirFlagMask = fadeMaskSequence[0]; who->postFlagMask = kStanding; } else { who->dirFlagSrc = kFacingRested; who->postFlagSrc = kStanding; who->arrayFlagMask = kFadeMask; who->dirFlagMask = fadeMaskSequence[0]; who->postFlagMask = kStanding; } who->xPos = who->initXPos; who->zPos = who->initZPos; who->xVel = 0; who->zVel = 0; who->direction = kFacingRested; who->mode = kInStasis; who->posture = kStanding; who->flag = kLengthOfPenalty; who->justHitWall = 0; who->justHitBall = 0; who->justHitOpponent = 0; who->loopsBallHeld = 0; who->brakeApplied = FALSE; who->bashApplied = FALSE; if ((who->persona == kHumanPlayer) || (who->persona == kNetHuman)) who->mouseWasLetUp = TRUE; PersonRectFromPosition(who); } //======================================================== StartPersonBeamOut void StartPersonBeamOut (playerType *who) { PlaySoundSMS(kBeamOutSound); who->mode = kBeamingOut; who->flag = 0; } //======================================================== MovePerson void MovePerson (playerType *who) { short indexX, indexZ; short signX, signZ; short forceX, forceZ; short frictionX, frictionZ; indexX = who->xPos; if (indexX < 0) { indexX = -indexX; signX = -1; } else { signX = 1; } indexX /= 512; indexZ = who->zPos; if (indexZ < 0) { indexZ = -indexZ; signZ = -1; } else { signZ = 1; } indexZ /= 512; if (who->xPos < 0) { switch (leftGoalLeague) { case kLittleLeague: forceX = *(littleForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kJuniorVarsity: forceX = *(juniorForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kVarsity: forceX = *(varsityForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kMinorLeague: forceX = *(minorForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kProfessional: forceX = *(proForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; default: forceX = 0; break; } } else { switch (rightGoalLeague) { case kLittleLeague: forceX = *(littleForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kJuniorVarsity: forceX = *(juniorForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kVarsity: forceX = *(varsityForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kMinorLeague: forceX = *(minorForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kProfessional: forceX = *(proForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; default: forceX = 0; break; } } switch (forceX) { case kOutOBounds: who->flag = kIsOutOfBounds; break; case kGoalPath: case kBackBoard: if (who->zPos < 0) { who->flag = kIsOutOfBounds; } else { HandlePersonWallCollision(who); who->xPos += (who->xVel / kVelocitySensitive); who->zPos += (who->zVel / kVelocitySensitive); } break; default: who->flag = kIsNormal; forceX *= signX; if (who->xPos < 0) { switch (leftGoalLeague) { case kLittleLeague: forceZ = *(littleForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kJuniorVarsity: forceZ = *(juniorForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kVarsity: forceZ = *(varsityForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kMinorLeague: forceZ = *(minorForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kProfessional: forceZ = *(proForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; default: forceZ = 0; break; } } else { switch (rightGoalLeague) { case kLittleLeague: forceZ = *(littleForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kJuniorVarsity: forceZ = *(juniorForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kVarsity: forceZ = *(varsityForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kMinorLeague: forceZ = *(minorForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; case kProfessional: forceZ = *(proForceTable + indexX * 82 + indexZ * 2 + kZComponent) * signZ; break; default: forceZ = 0; break; } } who->xVel -= forceX; who->zVel -= forceZ; if (who->justHitWall == 0) { frictionX = who->xVel / kFrictionFraction; frictionZ = who->zVel / kFrictionFraction; who->xVel -= frictionX; who->zVel -= frictionZ; } who->xPos += (who->xVel / kVelocitySensitive); who->zPos += (who->zVel / kVelocitySensitive); break; } PersonRectFromPosition(who); } //======================================================== OpponentDecides void OpponentDecides (playerType *who) { switch (who->persona) { case kSimpleGeorge: GeorgeDecides(who); break; case kMadMara: MaraDecides(who); break; case kHeavyOtto: OttoDecides(who); break; case kCleverClaire: ClaireDecides(who); break; case kMisterEaze: EazeDecides(who); break; case kMissTeak: TeakDecides(who); break; case kNetHuman: DetermineHumanFacing(who); ProcessNetPlayerInput(); break; default: break; } } //======================================================== DoPersonInArena void DoPersonInArena (playerType *who) { switch (who->flag) { case kIsNormal: case kIsRebounding: if (who->persona == kHumanPlayer) { DetermineHumanFacing(who); GetHumanInput(); } else { OpponentDecides(who); } MovePerson(who); break; case kIsOutOfBounds: if ((theBall.modifier == kPlayerHolding) && (who->selector == kPlayerSelector)) { HandlePlayerFoul(); ResetBall(); } else if ((theBall.modifier == kOpponentHolding) && (who->selector == kOpponentSelector)) { HandleOpponentFoul(); ResetBall(); } StartPersonBeamOut(who); break; } if (((theBall.modifier == kPlayerHolding) && (who->selector == kPlayerSelector)) || ((theBall.modifier == kOpponentHolding) && (who->selector == kOpponentSelector))) { if (who->loopsBallHeld != 0) { who->loopsBallHeld--; UpdateBallTimers(who); if (who->loopsBallHeld == 120) { PlaySoundSMS(kHoldingSound); } else if (who->loopsBallHeld == 0) { if (whosGotBall == kPlayerHasBall) { HandlePlayerFoul(); } else { HandleOpponentFoul(); } theBall.eraseTheBall = TRUE; ResetBall(); } } } if (who->selector == kPlayerSelector) { who->dirFlagSrc = who->direction; who->postFlagSrc = who->posture; who->arrayFlagMask = kMask; who->dirFlagMask = who->direction; who->postFlagMask = who->posture; } else { who->dirFlagSrc = who->direction; who->postFlagSrc = who->posture; who->arrayFlagMask = kMask; who->dirFlagMask = who->direction; who->postFlagMask = who->posture; } } //======================================================== DoPersonBeamingIn void DoPersonBeamingIn (playerType *who) { who->flag--; if (who->flag < 0) // person has fully faded in { who->mode = kInArena; who->flag = kIsNormal; if (who->selector == kPlayerSelector) { who->dirFlagSrc = who->direction; who->postFlagSrc = who->posture; who->arrayFlagMask = kMask; who->dirFlagMask = who->direction; who->postFlagMask = who->posture; } else { who->dirFlagSrc = who->direction; who->postFlagSrc = who->posture; who->arrayFlagMask = kMask; who->dirFlagMask = who->direction; who->postFlagMask = who->posture; } } else // person is still fading in { if (who->selector == kPlayerSelector) { who->dirFlagSrc = kFacingRested; who->postFlagSrc = who->posture; who->arrayFlagMask = kFadeMask; who->dirFlagMask = fadeMaskSequence[who->flag]; who->postFlagMask = who->posture; } else { who->dirFlagSrc = kFacingRested; who->postFlagSrc = who->posture; who->arrayFlagMask = kFadeMask; who->dirFlagMask = fadeMaskSequence[who->flag]; who->postFlagMask = who->posture; } } } //======================================================== DoPersonBeamingOut void DoPersonBeamingOut (playerType *who) { who->flag++; if (who->flag > kEndOfFadeSequence) // person has fully faded out { drawThisFrame = TRUE; who->flag = kEndOfFadeSequence; ResetPerson(who); } else { if (who->flag == kEndOfFadeSequence) drawThisFrame = TRUE; if (who->selector == kPlayerSelector) { who->dirFlagSrc = kFacingRested; who->postFlagSrc = who->posture; who->arrayFlagMask = kFadeMask; who->dirFlagMask = fadeMaskSequence[who->flag]; who->postFlagMask = who->posture; } else { who->dirFlagSrc = kFacingRested; who->postFlagSrc = who->posture; who->arrayFlagMask = kFadeMask; who->dirFlagMask = fadeMaskSequence[who->flag]; who->postFlagMask = who->posture; } } } //======================================================== PersonStasisToBeamIn void PersonStasisToBeamIn (playerType *who) { PlaySoundSMS(kBeamInSound); who->mode = kBeamingIn; who->flag = kEndOfFadeSequence; if (who->selector == kPlayerSelector) { who->dirFlagSrc = kFacingRested; who->postFlagSrc = who->posture; who->arrayFlagMask = kFadeMask; who->dirFlagMask = fadeMaskSequence[who->flag]; who->postFlagMask = who->posture; } else { who->dirFlagSrc = kFacingRested; who->postFlagSrc = who->posture; who->arrayFlagMask = kFadeMask; who->dirFlagMask = fadeMaskSequence[who->flag]; who->postFlagMask = who->posture; } } //======================================================== DoPersonInStasis void DoPersonInStasis (playerType *who) { who->flag--; if (who->flag < 1) PersonStasisToBeamIn(who); } //======================================================== HandlePerson void HandlePerson (playerType *who) { switch (who->mode) { case kInArena: DoPersonInArena(who); break; case kBeamingIn: DoPersonBeamingIn(who); break; case kBeamingOut: DoPersonBeamingOut(who); break; case kInStasis: DoPersonInStasis(who); break; } } \ No newline at end of file diff --git a/Sources/Computer.c b/Sources/Computer.c new file mode 100755 index 0000000..c42507f --- /dev/null +++ b/Sources/Computer.c @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Computer Persona Handling Routines == //== == //============================================================ //============================================================ //======================================================== Includes #include "Globals.h" #include "UnivUtilities.h" #include "Computer.h" #include "Dynamics.h" #include "SoundUtils.h" //======================================================== Functions //======================================================== DiagonalToPlayer short DiagonalToPerson (playerType *who) { short newDirection; if (who->selector == kOpponentSelector) { if (thePlayer.xPos > theOpponent.xPos) { if (thePlayer.zPos > theOpponent.zPos) newDirection = kFacingNorthEast; else newDirection = kFacingSouthEast; } else { if (thePlayer.zPos > theOpponent.zPos) newDirection = kFacingNorthWest; else newDirection = kFacingSouthWest; } } else { if (theOpponent.xPos > thePlayer.xPos) { if (theOpponent.zPos > thePlayer.zPos) newDirection = kFacingNorthEast; else newDirection = kFacingSouthEast; } else { if (theOpponent.zPos > thePlayer.zPos) newDirection = kFacingNorthWest; else newDirection = kFacingSouthWest; } } return (newDirection); } //======================================================== DiagonalToBall short DiagonalToBall (playerType *who) { short newDirection; if (theBall.xPos > who->xPos) { if (theBall.zPos > who->zPos) newDirection = kFacingNorthEast; else newDirection = kFacingSouthEast; } else { if (theBall.zPos > who->zPos) newDirection = kFacingNorthWest; else newDirection = kFacingSouthWest; } return (newDirection); } //======================================================== OctalToPoint short OctalToPoint (playerType *who, register short xPos, register short zPos) { register long rise, run; short newDirection; if (xPos > who->xPos) { if (zPos > who->zPos) newDirection = kFacingNorthEast; else newDirection = kFacingSouthEast; } else { if (zPos > who->zPos) newDirection = kFacingNorthWest; else newDirection = kFacingSouthWest; } switch (newDirection) { case kFacingNorthEast: rise = (long)zPos - (long)who->zPos; run = (long)xPos - (long)who->xPos; if ((rise * 2) < run) { newDirection = kFacingEast; } else if (rise > (run * 2)) { newDirection = kFacingNorth; } else { newDirection = kFacingNorthEast; } break; case kFacingNorthWest: rise = (long)zPos - (long)who->zPos; run = (long)who->xPos - (long)xPos; if ((rise * 2) < run) { newDirection = kFacingWest; } else if (rise > (run * 2)) { newDirection = kFacingNorth; } else { newDirection = kFacingNorthWest; } break; case kFacingSouthEast: rise = (long)who->zPos - (long)zPos; run = (long)xPos - (long)who->xPos; if ((rise * 2) < run) { newDirection = kFacingEast; } else if (rise > (run * 2)) { newDirection = kFacingSouth; } else { newDirection = kFacingSouthEast; } break; case kFacingSouthWest: rise = (long)who->zPos - (long)zPos; run = (long)who->xPos - (long)xPos; if ((rise * 2) < run) { newDirection = kFacingWest; } else if (rise > (run * 2)) { newDirection = kFacingSouth; } else { newDirection = kFacingSouthWest; } break; } return (newDirection); } //======================================================== LookUpBoardForce void LookUpBoardForce (playerType *who) { short boardXForce, boardZForce; if ((who->justHitWall == 0) && (who->justHitOpponent == 0)) { boardXForce = boardForceTable[who->direction][kXComponent]; boardZForce = boardForceTable[who->direction][kZComponent]; if (who->bashApplied) { boardXForce *= 4; // 200% inc in board force boardZForce *= 4; } if (who->posture == kCrouching) { boardXForce += boardXForce / kAddForceFract; // 25% inc in board force boardZForce += boardZForce / kAddForceFract; // tried 50%, but harsh } who->xVel += boardXForce; who->zVel += boardZForce; } } //======================================================== NearTheBall Boolean NearTheBall (playerType *who) { #define kNearDistSquared 16777216L // a distance of 64 register long xDistance, zDistance, distanceSquared; Boolean nearBall; xDistance = who->xPos - theBall.xPos; zDistance = who->zPos - theBall.zPos; distanceSquared = (xDistance * xDistance) + (zDistance * zDistance); if (distanceSquared < kNearDistSquared) nearBall = TRUE; else nearBall = FALSE; return (nearBall); } //======================================================== NearTheEdge Boolean NearTheEdge (playerType *who) { #define kSmEdgeDistSquared 108826624L // a distance of 163 #define kLgEdgeDistSquared 170459136L // a distance of 204 register long distanceSquared; Boolean nearEdge; distanceSquared = ((long)who->xPos * (long)who->xPos) + ((long)who->zPos * (long)who->zPos); if (arenaSize == kLargeArena) { if (distanceSquared > kLgEdgeDistSquared) nearEdge = TRUE; else nearEdge = FALSE; } else { if (distanceSquared > kLgEdgeDistSquared) nearEdge = TRUE; else nearEdge = FALSE; } return(nearEdge); } //======================================================== NearTheEdgeSmarter Boolean NearTheEdgeSmarter (playerType *who) { #define kFramesConsidered 8L #define kSmEdgeDistSquared 108826624L // a distance of 163 #define kLgEdgeDistSquared 170459136L // a distance of 204 register long distanceSquared; long anticipatedX, anticipatedZ; Boolean nearEdge; anticipatedX = (long)who->xPos + ((long)(who->xVel / kVelocitySensitive) * kFramesConsidered); anticipatedZ = (long)who->zPos + ((long)(who->zVel / kVelocitySensitive) * kFramesConsidered); distanceSquared = (anticipatedX * anticipatedX) + (anticipatedZ * anticipatedZ); if (arenaSize == kLargeArena) { if (distanceSquared > kLgEdgeDistSquared) nearEdge = TRUE; else nearEdge = FALSE; } else { if (distanceSquared > kSmEdgeDistSquared) nearEdge = TRUE; else nearEdge = FALSE; } return(nearEdge); } //======================================================== NearTheGoal Boolean NearTheGoal (playerType *who) { #define kSmGoalXThreshRt 9123 // 84% of distance (10861) #define kSmGoalXThreshLf -9123 // 84% of distance from center #define kSmGoalZThresh 9123 // 84% of distance from center #define kLgGoalXThreshRt 11811 // 87% of distance from center #define kLgGoalXThreshLf -11811 // 87% of distance from center #define kLgGoalZThresh 11811 // 87% of distance from center Boolean nearGoal; if (arenaSize == kLargeArena) { if (who->whichGoal == kRightGoal) { if ((who->xPos > kLgGoalXThreshRt) && (who->zPos > kLgGoalZThresh)) nearGoal = TRUE; else nearGoal = FALSE; } else { if ((who->xPos < kLgGoalXThreshLf) && (who->zPos > kLgGoalZThresh)) nearGoal = TRUE; else nearGoal = FALSE; } } else { if (who->whichGoal == kRightGoal) { if ((who->xPos > kSmGoalXThreshRt) && (who->zPos > kSmGoalZThresh)) nearGoal = TRUE; else nearGoal = FALSE; } else { if ((who->xPos < kSmGoalXThreshLf) && (who->zPos > kSmGoalZThresh)) nearGoal = TRUE; else nearGoal = FALSE; } } return (nearGoal); } //======================================================== NearPerson Boolean NearPerson (void) { #define kNearPlayerDistSqr 58982400L // a distance of 120 register long xDistance, zDistance, distanceSquared; Boolean nearPlayer; xDistance = theOpponent.xPos - thePlayer.xPos; zDistance = theOpponent.zPos - thePlayer.zPos; distanceSquared = (xDistance * xDistance) + (zDistance * zDistance); if (distanceSquared < kNearPlayerDistSqr) nearPlayer = TRUE; else nearPlayer = FALSE; return (nearPlayer); } //======================================================== DecentShot Boolean DecentShot (playerType *who) { #define kFramesToTrackBall 8 register long newVelX, newVelZ; register long newPosX, newPosZ; short i, ballsPlace, indexX, indexZ; Boolean shootIt; newVelX = (long)who->xVel / kVelocitySensitive; newVelZ = (long)who->zVel / kVelocitySensitive; newPosX = (long)who->xPos; newPosZ = (long)who->zPos; shootIt = FALSE; for (i = 0; i < kFramesToTrackBall; i++) { newPosX += newVelX; newPosZ += newVelZ; indexX = abs(newPosX / 512); indexZ = abs(newPosZ / 512); ballsPlace = *(littleForceTable + indexX * 82 + indexZ * 2 + kXComponent); if (((ballsPlace == kBackBoard) || (ballsPlace == kGoalPath)) && (newPosZ > 0) && (((who->whichGoal == kRightGoal) && (newPosX > 0)) || ((who->whichGoal == kLeftGoal) && (newPosX < 0)))) { shootIt = TRUE; break; } else if (ballsPlace == kOutOBounds) { break; } } return (shootIt); } //======================================================== ExcellentShot Boolean ExcellentShot (playerType *who) { #define kFramesToTrackBall 8 register long newVelX, newVelZ; register long newPosX, newPosZ; short i, ballsPlace, indexX, indexZ; Boolean shootIt; newVelX = (long)who->xVel / kVelocitySensitive; newVelZ = (long)who->zVel / kVelocitySensitive; newPosX = (long)who->xPos; newPosZ = (long)who->zPos; shootIt = FALSE; for (i = 0; i < kFramesToTrackBall; i++) { newPosX += newVelX; newPosZ += newVelZ; indexX = abs(newPosX / 512); indexZ = abs(newPosZ / 512); ballsPlace = *(proForceTable + indexX * 82 + indexZ * 2 + kXComponent); if ((ballsPlace == kGoalPath) && (newPosZ > 0) && (((who->whichGoal == kRightGoal) && (newPosX > 0)) || ((who->whichGoal == kLeftGoal) && (newPosX < 0)))) { shootIt = TRUE; break; } else if (ballsPlace == kOutOBounds) { break; } } return (shootIt); } //======================================================== ExcellentShot Boolean ExcellentDirectionalShot (playerType *who, short directed) { #define kFramesTrackDirBall 8 register short newPosX, newPosZ; short newVelX, newVelZ; short i, ballsPlace, indexX, indexZ; Boolean shootIt; newVelX = boardForceTable[directed][kXComponent] * kPersonImpulse; newVelZ = boardForceTable[directed][kZComponent] * kPersonImpulse; newPosX = who->xPos + newVelX; newPosZ = who->zPos + newVelZ; newVelX += who->xVel / kVelocitySensitive; newVelZ += who->zVel / kVelocitySensitive; shootIt = FALSE; for (i = 0; i < kFramesTrackDirBall; i++) { newPosX += newVelX; newPosZ += newVelZ; indexX = abs(newPosX / 512); indexZ = abs(newPosZ / 512); ballsPlace = *(littleForceTable + indexX * 82 + indexZ * 2 + kXComponent); if (who->whichGoal == kRightGoal) { if ((ballsPlace == kGoalPath) && (newPosZ > 0) && (newPosX > 0)) { shootIt = TRUE; break; } else if ((ballsPlace == kOutOBounds) || (ballsPlace == kBackBoard)) { break; } } else { if ((ballsPlace == kGoalPath) && (newPosZ > 0) && (newPosX < 0)) { shootIt = TRUE; break; } else if ((ballsPlace == kOutOBounds) || (ballsPlace == kBackBoard)) { break; } } } return (shootIt); } //======================================================== PointingToDisaster Boolean PointingToDisaster (playerType *who) { #define kFarDisasterLookAhead 128L // was 144L #define kSmDisasterSquared 235929600L // a distance of 240 #define kLgDisasterSquared 368640000L // a distance of 300 long possibleX, possibleZ, distanceSquared; Boolean nearDisaster; possibleX = (long)who->xPos + (long)boardForceTable[who->direction][kXComponent] * kFarDisasterLookAhead; possibleZ = (long)who->zPos + (long)boardForceTable[who->direction][kZComponent] * kFarDisasterLookAhead; distanceSquared = (possibleX * possibleX) + (possibleZ * possibleZ); if (arenaSize == kLargeArena) { if (distanceSquared > kLgDisasterSquared) { nearDisaster = TRUE; } else { nearDisaster = FALSE; } } else { if (distanceSquared > kSmDisasterSquared) { nearDisaster = TRUE; } else { nearDisaster = FALSE; } } return(nearDisaster); } //======================================================== RunTheDiagonalNE short RunTheDiagonalNE (playerType *who) { short newDirection; switch (who->direction) { case kFacingNorthEast: if ((who->xVel < 0) && (who->zVel < 0)) { if ((who->xPos < 0) && (who->zPos < 0)) newDirection = kFacingNorthEast; else newDirection = kFacingSouthWest; } else { newDirection = kFacingNorthEast; if (NearTheEdge(who) && (who->xPos > 0) && (who->zPos > 0)) DoPersonBallParted(who); // shoot that ball! } break; case kFacingSouthWest: if ((who->xVel > 0) && (who->zVel > 0)) { if ((who->xPos > 0) && (who->zPos > 0)) newDirection = kFacingSouthWest; else newDirection = kFacingNorthEast; } else { if (NearTheEdge(who) && (who->xPos < 0) && (who->zPos < 0)) newDirection = kFacingNorthEast; else newDirection = kFacingSouthWest; } break; default: newDirection = kFacingSouthWest; break; } return (newDirection); } //======================================================== RunTheDiagonalNW short RunTheDiagonalNW (playerType *who) { short newDirection; switch (who->direction) { case kFacingNorthWest: if ((who->xVel > 0) && (who->zVel < 0)) { if ((who->xPos > 0) && (who->zPos < 0)) newDirection = kFacingNorthWest; else newDirection = kFacingSouthEast; } else { newDirection = kFacingNorthWest; if (NearTheEdge(who) && (who->xPos < 0) && (who->zPos > 0)) DoPersonBallParted(who); // shoot that ball! } break; case kFacingSouthEast: if ((who->xVel > 0) && (who->zVel > 0)) { if ((who->xPos < 0) && (who->zPos > 0)) newDirection = kFacingSouthEast; else newDirection = kFacingNorthWest; } else { if (NearTheEdge(who) && (who->xPos > 0) && (who->zPos < 0)) newDirection = kFacingNorthWest; else newDirection = kFacingSouthEast; } break; default: newDirection = kFacingSouthEast; break; } return (newDirection); } //======================================================== RunTheDiagonalSmarterNE short RunTheDiagonalSmarterNE (playerType *who) { short newDirection; switch (who->direction) { case kFacingNorthEast: if ((who->xVel < 0) && (who->zVel < 0)) { if ((who->xPos < 0) && (who->zPos < 0)) newDirection = kFacingNorthEast; else newDirection = kFacingSouthWest; } else { newDirection = kFacingNorthEast; if (NearTheEdgeSmarter(who) && (who->xPos > 0) && (who->zPos > 0) && (DecentShot(who))) DoPersonBallParted(who); // shoot that ball! } break; case kFacingSouthWest: if ((who->xVel > 0) && (who->zVel > 0)) { if ((who->xPos > 0) && (who->zPos > 0)) newDirection = kFacingSouthWest; else newDirection = kFacingNorthEast; } else { if (NearTheEdgeSmarter(who) && (who->xPos < 0) && (who->zPos < 0)) newDirection = kFacingNorthEast; else newDirection = kFacingSouthWest; } break; default: newDirection = kFacingSouthWest; break; } return (newDirection); } //======================================================== RunTheDiagonalSmarterNW short RunTheDiagonalSmarterNW (playerType *who) { short newDirection; switch (who->direction) { case kFacingNorthWest: if ((who->xVel > 0) && (who->zVel < 0)) // bugs in this code! { if ((who->xPos > 0) && (who->zPos < 0)) newDirection = kFacingNorthWest; else newDirection = kFacingSouthEast; } else { newDirection = kFacingNorthWest; if (NearTheEdgeSmarter(who) && (who->xPos < 0) && (who->zPos > 0) && DecentShot(who)) DoPersonBallParted(who); // shoot that ball! } break; case kFacingSouthEast: if ((who->xVel < 0) && (who->zVel > 0)) { if ((who->xPos < 0) && (who->zPos > 0)) newDirection = kFacingSouthEast; else newDirection = kFacingNorthWest; } else { if (NearTheEdgeSmarter(who) && (who->xPos > 0) && (who->zPos < 0)) newDirection = kFacingNorthWest; else newDirection = kFacingSouthEast; } break; default: newDirection = kFacingSouthEast; break; } return (newDirection); } //======================================================== RunTheDiagonalSmartestNE short RunTheDiagonalSmartestNE (playerType *who) { short newDirection; switch (who->direction) { case kFacingNorthEast: if ((who->xVel < 0) && (who->zVel < 0)) { if ((who->xPos < 0) && (who->zPos < 0)) newDirection = kFacingNorthEast; else newDirection = kFacingSouthWest; } else { newDirection = kFacingNorthEast; if (NearTheEdgeSmarter(who) && (who->xPos > 0) && (who->zPos > 0) && ExcellentShot(who)) DoPersonBallParted(who); // shoot that ball! } break; case kFacingSouthWest: if ((who->xVel > 0) && (who->zVel > 0)) { if ((who->xPos > 0) && (who->zPos > 0)) newDirection = kFacingSouthWest; else newDirection = kFacingNorthEast; } else { if (NearTheEdgeSmarter(who) && (who->xPos < 0) && (who->zPos < 0)) newDirection = kFacingNorthEast; else newDirection = kFacingSouthWest; } break; default: newDirection = kFacingSouthWest; break; } return (newDirection); } //======================================================== RunTheDiagonalSmartestNW short RunTheDiagonalSmartestNW (playerType *who) { short newDirection; switch (who->direction) { case kFacingNorthWest: if ((who->xVel > 0) && (who->zVel < 0)) { if ((who->xPos > 0) && (who->zPos < 0)) // bugs in this function newDirection = kFacingNorthWest; else newDirection = kFacingSouthEast; } else { newDirection = kFacingNorthWest; if (NearTheEdgeSmarter(who) && (who->xPos < 0) && (who->zPos > 0) && ExcellentShot(who)) DoPersonBallParted(who); // shoot that ball! } break; case kFacingSouthEast: if ((who->xVel < 0) && (who->zVel > 0)) { if ((who->xPos < 0) && (who->zPos > 0)) newDirection = kFacingSouthEast; else newDirection = kFacingNorthWest; } else { if (NearTheEdgeSmarter(who) && (who->xPos > 0) && (who->zPos < 0)) newDirection = kFacingNorthWest; else newDirection = kFacingSouthEast; } break; default: newDirection = kFacingSouthEast; break; } return (newDirection); } //======================================================== SeekPlayerGoal short SeekPersonsGoal (playerType *who) { #define kSmallArenaGoalXSRt -10861 #define kSmallArenaGoalXSLf 10861 #define kSmallArenaGoalZS 10861 #define kLargeArenaGoalXSRt -13576 #define kLargeArenaGoalXSLf 13576 #define kLargeArenaGoalZS 13576 short newDirection; if (who->whichGoal == kRightGoal) { if (arenaSize == kLargeArena) newDirection = OctalToPoint(who, kLargeArenaGoalXSRt, kLargeArenaGoalZS); else newDirection = OctalToPoint(who, kSmallArenaGoalXSRt, kSmallArenaGoalZS); } else { if (arenaSize == kLargeArena) newDirection = OctalToPoint(who, kLargeArenaGoalXSLf, kLargeArenaGoalZS); else newDirection = OctalToPoint(who, kSmallArenaGoalXSLf, kSmallArenaGoalZS); } return (newDirection); } //======================================================== AnticipateBall short AnticipateBall (playerType *who, short framesAhead) { register long newX, newZ; short newDirection; if (NearTheBall(who)) { newDirection = OctalToPoint(who, theBall.xPos, theBall.zPos); } else { newX = (long)theBall.xPos + (long)theBall.xVel / kVelocitySensitive * (long)framesAhead; newZ = (long)theBall.zPos + (long)theBall.zVel / kVelocitySensitive * (long)framesAhead; if (newX > kMaxShort) newX = kMaxShort; if (newX < kMinShort) newX = kMinShort; if (newZ > kMaxShort) newZ = kMaxShort; if (newZ < kMinShort) newZ = kMinShort; newDirection = OctalToPoint(who, (short)newX, (short)newZ); } return (newDirection); } //======================================================== AnticipatePersonsFlank short AnticipatePersonsFlank (playerType *who, short framesAhead) { #define kFlankingDistXRt -3072 // -48 pixels #define kFlankingDistXLf 3072 // -48 pixels #define kFlankingDistZ 3072 // 48 pixels register long newX, newZ; short newDirection; if (who->selector == kOpponentSelector) { if (who->whichGoal == kRightGoal) { newX = (long)thePlayer.xPos + kFlankingDistXRt + (long)thePlayer.xVel / kVelocitySensitive * (long)framesAhead; } else { newX = (long)thePlayer.xPos + kFlankingDistXLf + (long)thePlayer.xVel / kVelocitySensitive * (long)framesAhead; } newZ = (long)thePlayer.zPos + kFlankingDistZ + (long)thePlayer.zVel / kVelocitySensitive * (long)framesAhead; } else { if (who->whichGoal == kRightGoal) { newX = (long)theOpponent.xPos + kFlankingDistXRt + (long)theOpponent.xVel / kVelocitySensitive * (long)framesAhead; } else { newX = (long)theOpponent.xPos + kFlankingDistXLf + (long)theOpponent.xVel / kVelocitySensitive * (long)framesAhead; } newZ = (long)theOpponent.zPos + kFlankingDistZ + (long)theOpponent.zVel / kVelocitySensitive * (long)framesAhead; } if (newX > kMaxShort) newX = kMaxShort; if (newX < kMinShort) newX = kMinShort; if (newZ > kMaxShort) newZ = kMaxShort; if (newZ < kMinShort) newZ = kMinShort; newDirection = OctalToPoint(who, (short)newX, (short)newZ); return (newDirection); } //======================================================== AnticipatePersonsFace short AnticipatePersonsFace (playerType *who, short framesAhead) { register long newX, newZ; short newDirection; if (who->selector == kOpponentSelector) { newX = (long)thePlayer.xPos + (long)thePlayer.xVel / kVelocitySensitive * (long)framesAhead; newZ = (long)thePlayer.zPos + (long)thePlayer.zVel / kVelocitySensitive * (long)framesAhead; } else { newX = (long)theOpponent.xPos + (long)theOpponent.xVel / kVelocitySensitive * (long)framesAhead; newZ = (long)theOpponent.zPos + (long)theOpponent.zVel / kVelocitySensitive * (long)framesAhead; } if (newX > kMaxShort) newX = kMaxShort; if (newX < kMinShort) newX = kMinShort; if (newZ > kMaxShort) newZ = kMaxShort; if (newZ < kMinShort) newZ = kMinShort; newDirection = OctalToPoint(who, (short)newX, (short)newZ); return (newDirection); } //======================================================== RunTheCircleRight short RunTheCircleRight (playerType *who) { short newDirection; newDirection = who->direction; who->turnCount++; if ((who->turnCount == who->turnNow) || (PointingToDisaster(who))) { who->turnCount = 0; newDirection ++; if (newDirection > kLastDirection) newDirection -= (kLastDirection + 1); } if ((!gameIsOver) && (NearTheGoal(who)) && (ExcellentDirectionalShot(who, kFacingNorthEast))) { newDirection = kFacingNorthEast; who->direction = newDirection; DoPersonBallParted(who); // shoot that ball! } return (newDirection); } //======================================================== RunTheCircleLeft short RunTheCircleLeft (playerType *who) { short newDirection; newDirection = who->direction; who->turnCount++; if ((who->turnCount == who->turnNow) || (PointingToDisaster(who))) { who->turnCount = 0; newDirection --; if (newDirection < kFirstDirection) newDirection += (kLastDirection + 1); } if ((NearTheGoal(who)) && (ExcellentDirectionalShot(who, kFacingNorthWest))) { newDirection = kFacingNorthWest; who->direction = newDirection; DoPersonBallParted(who); // shoot that ball! } return (newDirection); } //======================================================== BrakeIfLeaving void BrakeIfLeaving (playerType *who) { long xDelta, zDelta, newDistSquared; xDelta = (long)who->xPos - (long)theBall.xPos; zDelta = (long)who->zPos - (long)theBall.zPos; newDistSquared = (xDelta * xDelta) + (zDelta * zDelta); if (newDistSquared > oldDistSquared) { who->brakeApplied = TRUE; } oldDistSquared = newDistSquared; } //======================================================== BashUnlessLeaving void BashUnlessLeaving (playerType *who) { #define kMaximumRammingSpeed 25600000L long xDelta, zDelta, velocitySquared, newDistSquared; xDelta = (long)thePlayer.xPos - (long)theOpponent.xPos; zDelta = (long)thePlayer.zPos - (long)theOpponent.zPos; velocitySquared = ((long)who->xVel * (long)who->xVel) + ((long)who->zVel * (long)who->zVel); newDistSquared = (xDelta * xDelta) + (zDelta * zDelta); if (newDistSquared < oldDistSquared) { if (velocitySquared < kMaximumRammingSpeed) who->bashApplied = TRUE; } else who->brakeApplied = TRUE; oldDistSquared = newDistSquared; } //======================================================== GeorgeDecides void GeorgeDecides (playerType *who) { short willCrouch; if (gameIsOver) { who->direction = RunTheCircleRight(who); LookUpBoardForce(who); return; } switch (whosGotBall) { case kBallIsNotHere: who->direction = kFacingRested; who->posture = kStanding; break; case kBallRollsFreely: if (((who->loopsBallHeld) == 0) || ((who->loopsBallHeld) > 60)) { who->direction = DiagonalToBall(who); LookUpBoardForce(who); willCrouch = (short)(Ticks % 100); if ((NearTheBall(who)) && (willCrouch < kGeorgeCrouchPercent)) who->posture = kCrouching; else who->posture = kStanding; } else { who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); who->posture = kStanding; } break; case kPlayerHasBall: if (who->selector == kOpponentSelector) { who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); who->posture = kStanding; } else { if (who->whichGoal == kRightGoal) who->direction = RunTheDiagonalNE(who); else who->direction = RunTheDiagonalNW(who); LookUpBoardForce(who); who->posture = kCarrying; if ((who->loopsBallHeld) < 60) DoPersonBallParted(who); // shoot that ball! } break; case kOpponentHasBall: if (who->selector == kOpponentSelector) { if (who->whichGoal == kRightGoal) who->direction = RunTheDiagonalNE(who); else who->direction = RunTheDiagonalNW(who); LookUpBoardForce(who); who->posture = kCarrying; if ((who->loopsBallHeld) < 60) DoPersonBallParted(who); // shoot that ball! } else { who->direction = OctalToPoint(who, theOpponent.xPos, theOpponent.zPos); who->posture = kStanding; } break; } } //======================================================== MaraDecides void MaraDecides (playerType *who) { short willCrouch; #if kDemoVersion return; #else if (gameIsOver) { who->direction = RunTheCircleRight(who); LookUpBoardForce(who); return; } switch (whosGotBall) { case kBallIsNotHere: if (who->selector == kOpponentSelector) who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); else who->direction = OctalToPoint(who, theOpponent.xPos, theOpponent.zPos); who->posture = kStanding; break; case kBallRollsFreely: if (((who->loopsBallHeld) == 0) || ((who->loopsBallHeld) > 50)) { who->direction = DiagonalToBall(who); LookUpBoardForce(who); willCrouch = (short)(Ticks % 100); if ((NearTheBall(who)) && (willCrouch < kMaraCrouchPercent)) who->posture = kCrouching; else who->posture = kStanding; } else { who->direction = thePlayer.direction; who->posture = kStanding; LookUpBoardForce(who); } break; case kPlayerHasBall: if (who->selector == kOpponentSelector) { who->direction = thePlayer.direction; LookUpBoardForce(who); who->posture = kStanding; } else { if (who->whichGoal == kRightGoal) who->direction = RunTheDiagonalNE(who); else who->direction = RunTheDiagonalNW(who); LookUpBoardForce(who); who->posture = kCarrying; if ((who->loopsBallHeld) < 50) DoPersonBallParted(who); // shoot that ball! } break; case kOpponentHasBall: if (who->selector == kOpponentSelector) { if (who->whichGoal == kRightGoal) who->direction = RunTheDiagonalNE(who); else who->direction = RunTheDiagonalNW(who); LookUpBoardForce(who); who->posture = kCarrying; if ((who->loopsBallHeld) < 50) DoPersonBallParted(who); // shoot that ball! } else { who->direction = theOpponent.direction; LookUpBoardForce(who); who->posture = kStanding; } break; } #endif } //======================================================== OttoDecides void OttoDecides (playerType *who) { short willCrouch; Boolean wasBraking; #if kDemoVersion return; #else if (gameIsOver) { who->direction = RunTheCircleRight(who); LookUpBoardForce(who); return; } wasBraking = who->brakeApplied; who->bashApplied = FALSE; who->brakeApplied = FALSE; switch (whosGotBall) { case kBallIsNotHere: if (who->selector == kOpponentSelector) who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); else who->direction = OctalToPoint(who, theOpponent.xPos, theOpponent.zPos); who->posture = kStanding; break; case kBallRollsFreely: if (((who->loopsBallHeld) == 0) || ((who->loopsBallHeld) > 40)) { who->direction = AnticipateBall(who, 6); LookUpBoardForce(who); willCrouch = (short)(Ticks % 100); if ((NearTheBall(who)) && (willCrouch < kOttoCrouchPercent)) who->posture = kCrouching; else who->posture = kStanding; if (NearTheEdge(who)) who->direction = OctalToPoint(who, 0, 0); } else { BashUnlessLeaving(who); who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); LookUpBoardForce(who); if (NearTheEdge(who)) who->direction = OctalToPoint(who, 0, 0); who->posture = kStanding; } break; case kPlayerHasBall: if (who->selector == kOpponentSelector) { BashUnlessLeaving(who); who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); LookUpBoardForce(who); who->posture = kStanding; if (NearTheEdge(who)) who->direction = OctalToPoint(who, 0, 0); } else { if (who->whichGoal == kRightGoal) who->direction = RunTheDiagonalSmarterNE(who); else who->direction = RunTheDiagonalSmarterNW(who); LookUpBoardForce(who); who->posture = kCarrying; if ((who->loopsBallHeld) < 40) DoPersonBallParted(who); // shoot that ball! } break; case kOpponentHasBall: if (who->selector == kOpponentSelector) { if (who->whichGoal == kRightGoal) who->direction = RunTheDiagonalSmarterNE(who); else who->direction = RunTheDiagonalSmarterNW(who); LookUpBoardForce(who); who->posture = kCarrying; if ((who->loopsBallHeld) < 40) DoPersonBallParted(who); // shoot that ball! } else { BashUnlessLeaving(who); who->direction = OctalToPoint(who, theOpponent.xPos, theOpponent.zPos); LookUpBoardForce(who); who->posture = kStanding; if (NearTheEdge(who)) who->direction = OctalToPoint(who, 0, 0); } break; } if (!wasBraking && who->brakeApplied) PlaySoundSMS(kBrakeSound); #endif } //======================================================== ClaireDecides void ClaireDecides (playerType *who) { short willCrouch; #if kDemoVersion return; #else if (gameIsOver) { who->direction = RunTheCircleRight(who); LookUpBoardForce(who); return; } switch (whosGotBall) { case kBallIsNotHere: who->posture = kStanding; if (who->selector == kOpponentSelector) who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); else who->direction = OctalToPoint(who, theOpponent.xPos, theOpponent.zPos); break; case kBallRollsFreely: if (((who->loopsBallHeld) == 0) || ((who->loopsBallHeld) > 30)) { willCrouch = (short)(Ticks % 100); if ((NearTheBall(who)) && (willCrouch < kClaireCrouchPercent)) who->posture = kCrouching; else who->posture = kStanding; who->direction = AnticipateBall(who, 8); LookUpBoardForce(who); if (NearTheEdgeSmarter(who)) who->direction = OctalToPoint(who, 0, 0); } else { who->direction = AnticipatePersonsFlank(who, 8); LookUpBoardForce(who); if (NearTheEdgeSmarter(who)) who->direction = OctalToPoint(who, 0, 0); who->posture = kStanding; } break; case kPlayerHasBall: if (who->selector == kOpponentSelector) { who->posture = kStanding; who->direction = AnticipatePersonsFlank(who, 8); LookUpBoardForce(who); if (NearTheEdgeSmarter(who)) who->direction = OctalToPoint(who, 0, 0); } else { who->posture = kCarrying; if (who->whichGoal == kRightGoal) who->direction = RunTheCircleRight(who); else who->direction = RunTheCircleLeft(who); LookUpBoardForce(who); if ((who->loopsBallHeld) < 30) DoPersonBallParted(who); // shoot that ball! } break; case kOpponentHasBall: if (who->selector == kOpponentSelector) { who->posture = kCarrying; if (who->whichGoal == kRightGoal) who->direction = RunTheCircleRight(who); else who->direction = RunTheCircleLeft(who); LookUpBoardForce(who); if ((who->loopsBallHeld) < 30) DoPersonBallParted(who); // shoot that ball! } else { who->posture = kStanding; who->direction = AnticipatePersonsFlank(who, 8); LookUpBoardForce(who); if (NearTheEdgeSmarter(who)) who->direction = OctalToPoint(who, 0, 0); } break; } #endif } //======================================================== EazeDecides void EazeDecides (playerType *who) { short willCrouch; Boolean wasBraking; #if kDemoVersion return; #else if (gameIsOver) { who->direction = RunTheCircleRight(who); LookUpBoardForce(who); return; } wasBraking = who->brakeApplied; who->bashApplied = FALSE; who->brakeApplied = FALSE; switch (whosGotBall) { case kBallIsNotHere: who->posture = kStanding; if (who->selector == kOpponentSelector) who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); else who->direction = OctalToPoint(who, theOpponent.xPos, theOpponent.zPos); break; case kBallRollsFreely: if (((who->loopsBallHeld) == 0) || ((who->loopsBallHeld) > 20)) { willCrouch = (short)(Ticks % 100); if ((NearTheBall(who)) && (willCrouch < kEazeCrouchPercent)) { BrakeIfLeaving(who); who->posture = kCrouching; } else who->posture = kStanding; who->direction = AnticipateBall(who, 12); LookUpBoardForce(who); if (NearTheEdgeSmarter(who)) who->direction = OctalToPoint(who, 0, 0); } else { if (NearPerson()) who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); else who->direction = AnticipatePersonsFace(who, 12); if (NearTheEdgeSmarter(who)) { BrakeIfLeaving(who); who->direction = OctalToPoint(who, 0, 0); } LookUpBoardForce(who); who->posture = kStanding; } break; case kPlayerHasBall: if (who->selector == kOpponentSelector) { who->posture = kStanding; if (NearPerson()) who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); else who->direction = AnticipatePersonsFace(who, 12); LookUpBoardForce(who); if (NearTheEdgeSmarter(who)) who->direction = OctalToPoint(who, 0, 0); } else { who->posture = kCarrying; if (who->strategy == kRunDiagonal) { if (who->whichGoal == kRightGoal) who->direction = RunTheDiagonalSmartestNE(who); else who->direction = RunTheDiagonalSmartestNW(who); } else { if (who->whichGoal == kRightGoal) who->direction = RunTheCircleRight(who); else who->direction = RunTheCircleLeft(who); } LookUpBoardForce(who); if ((who->loopsBallHeld) < 20) DoPersonBallParted(who); // shoot that ball! } break; case kOpponentHasBall: if (who->selector == kOpponentSelector) { who->posture = kCarrying; if (who->strategy == kRunDiagonal) { if (who->whichGoal == kRightGoal) who->direction = RunTheDiagonalSmartestNE(who); else who->direction = RunTheDiagonalSmartestNW(who); } else { if (who->whichGoal == kRightGoal) who->direction = RunTheCircleRight(who); else who->direction = RunTheCircleLeft(who); } LookUpBoardForce(who); if ((who->loopsBallHeld) < 20) DoPersonBallParted(who); // shoot that ball! } else { who->posture = kStanding; if (NearPerson()) who->direction = OctalToPoint(who, theOpponent.xPos, theOpponent.zPos); else who->direction = AnticipatePersonsFace(who, 12); LookUpBoardForce(who); if (NearTheEdgeSmarter(who)) who->direction = OctalToPoint(who, 0, 0); } break; } if (!wasBraking && who->brakeApplied) PlaySoundSMS(kBrakeSound); #endif } //======================================================== TeakDecides void TeakDecides (playerType *who) { short willCrouch; Boolean wasBraking; #if kDemoVersion return; #else if (gameIsOver) { who->direction = RunTheCircleRight(who); LookUpBoardForce(who); return; } wasBraking = who->brakeApplied; who->bashApplied = FALSE; who->brakeApplied = FALSE; switch (whosGotBall) { case kBallIsNotHere: who->posture = kStanding; if (who->selector == kOpponentSelector) who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); else who->direction = OctalToPoint(who, theOpponent.xPos, theOpponent.zPos); break; case kBallRollsFreely: if (((who->loopsBallHeld) == 0) || ((who->loopsBallHeld) > 10)) { BrakeIfLeaving(who); willCrouch = (short)(Ticks % 100); if ((NearTheBall(who)) && (willCrouch < kTeakCrouchPercent)) { who->posture = kCrouching; } else { who->posture = kStanding; } who->direction = AnticipateBall(who, 16); if (NearTheEdgeSmarter(who)) { who->direction = OctalToPoint(who, 0, 0); who->brakeApplied = TRUE; } LookUpBoardForce(who); } else { if (NearPerson()) { BashUnlessLeaving(who); who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); } else { who->direction = AnticipatePersonsFace(who, 16); } LookUpBoardForce(who); if (NearTheEdgeSmarter(who)) who->direction = OctalToPoint(who, 0, 0); who->posture = kStanding; } break; case kPlayerHasBall: if (who->selector == kOpponentSelector) { who->posture = kStanding; if (NearPerson()) { BashUnlessLeaving(who); who->direction = OctalToPoint(who, thePlayer.xPos, thePlayer.zPos); } else { who->direction = AnticipatePersonsFace(who, 16); } LookUpBoardForce(who); if (NearTheEdgeSmarter(who)) who->direction = OctalToPoint(who, 0, 0); } else { who->posture = kCarrying; switch (who->strategy) { case kRunDiagonal: if (who->whichGoal == kRightGoal) who->direction = RunTheDiagonalSmartestNE(who); else who->direction = RunTheDiagonalSmartestNW(who); break; case kRunCircle: if (who->whichGoal == kRightGoal) who->direction = RunTheCircleRight(who); else who->direction = RunTheCircleLeft(who); break; } LookUpBoardForce(who); if ((who->loopsBallHeld) < 10) DoPersonBallParted(who); // shoot that ball! } break; case kOpponentHasBall: if (who->selector == kOpponentSelector) { who->posture = kCarrying; switch (who->strategy) { case kRunDiagonal: if (who->whichGoal == kRightGoal) who->direction = RunTheDiagonalSmartestNE(who); else who->direction = RunTheDiagonalSmartestNW(who); break; case kRunCircle: if (who->whichGoal == kRightGoal) who->direction = RunTheCircleRight(who); else who->direction = RunTheCircleLeft(who); break; } LookUpBoardForce(who); if ((who->loopsBallHeld) < 10) DoPersonBallParted(who); // shoot that ball! } else { who->posture = kStanding; if (NearPerson()) { BashUnlessLeaving(who); who->direction = OctalToPoint(who, theOpponent.xPos, theOpponent.zPos); } else { who->direction = AnticipatePersonsFace(who, 16); } LookUpBoardForce(who); if (NearTheEdgeSmarter(who)) who->direction = OctalToPoint(who, 0, 0); } break; } if (!wasBraking && who->brakeApplied) PlaySoundSMS(kBrakeSound); #endif } \ No newline at end of file diff --git a/Sources/ConfigureSound.c b/Sources/ConfigureSound.c new file mode 100755 index 0000000..2844a32 --- /dev/null +++ b/Sources/ConfigureSound.c @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Configure Sound Routines == //== == //============================================================ //============================================================ //======================================================== Includes #include "Globals.h" #include "UnivUtilities.h" #include "ConfigureSound.h" #include //======================================================== Functions //======================================================== UpdateVolumeIcon void UpdateVolumeIcon (DialogPtr theDialog) { Str255 textStr; CIconHandle cicnHandle; Handle iHandle, iconHandle; Rect iRect; short iType; GetDItem(theDialog, kSoundIconRect, &iType, &iHandle, &iRect); if (isColor) { cicnHandle = GetCIcon(210 + soundVolume); PlotCIcon(&iRect, cicnHandle); DisposCIcon(cicnHandle); } else { iconHandle = GetIcon(210 + soundVolume); PlotIcon(&iRect, iconHandle); } GetDItem(theDialog, kSoundVolume, &iType, &iHandle, &iRect); NumToString((long)soundVolume, textStr); SetIText(iHandle, textStr); } //======================================================== UpdateSoundDialog void UpdateSoundDialog (DialogPtr theDialog) { PicHandle thePict; Str255 theTitle; Handle iHandle; Rect iRect; short iType; DrawDialog(theDialog); UpdateVolumeIcon(theDialog); GetDItem(theDialog, kSoundBalloon, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kBalloon4PictID); else thePict = GetPicture(kBalloon1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetIndString(theTitle, rMiscStrings, 4); if (theTitle[0] == 0) PasStringCopy((StringPtr)"\pSound Options", (StringPtr)theTitle); MoveTo(kSoundTitleLeft, kSoundTitleTop); DrawString(theTitle); DrawDefaultButton(theDialog, kSoundOkay); } //======================================================== SoundFilter pascal Boolean SoundFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit) { switch (theEvent->what) { case keyDown: switch ((theEvent->message) & charCodeMask) { case kReturnKeyASCII: case kEnterKeyASCII: FlashDialogButton(theDialog, kSoundOkay); *itemHit = kSoundOkay; return(TRUE); break; case kLeftArrowKeyASCII: case kDownArrowKeyASCII: *itemHit = kSoundSofter; return(TRUE); break; case kRightArrowKeyASCII: case kUpArrowKeyASCII: *itemHit = kSoundLouder; return(TRUE); break; case k0KeyASCII: case k1KeyASCII: case k2KeyASCII: case k3KeyASCII: case k4KeyASCII: case k5KeyASCII: case k6KeyASCII: case k7KeyASCII: soundVolume = ((theEvent->message) & charCodeMask) - k0KeyASCII; UpdateVolumeIcon(theDialog); return(TRUE); break; default: return(FALSE); } break; case updateEvt: BeginUpdate((GrafPtr)theDialog); UpdateSoundDialog(theDialog); EndUpdate((GrafPtr)theDialog); theEvent->what = nullEvent; return(FALSE); break; default: return(FALSE); break; } } //======================================================== DoConfigureSound Boolean DoConfigureSound (void) { DialogPtr soundDialog; Handle iHandle; Rect iRect; short itemHit, iType, wasVolume; Boolean leaveDialog, userOkayed, wasState; CenterDialog(rSoundDialogID); if (doZooms) ZoomOutDialogRect(rSoundDialogID); soundDialog = GetNewDialog(rSoundDialogID, kNilPointer, kPutInFront); SetPort((GrafPtr)soundDialog); ShowWindow((GrafPtr)soundDialog); wasVolume = soundVolume; UpdateSoundDialog(soundDialog); if (!soundOn) { GetDItem(soundDialog, kSoundBeam, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, 255); GetDItem(soundDialog, kSoundIncidental, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, 255); GetDItem(soundDialog, kSoundCollisions, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, 255); GetDItem(soundDialog, kSoundCrowd, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, 255); } GetDItem(soundDialog, kSoundEnable, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)soundOn); GetDItem(soundDialog, kSoundBeam, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)beamSoundOn); GetDItem(soundDialog, kSoundIncidental, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)incidentSoundOn); GetDItem(soundDialog, kSoundCollisions, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)collisionSoundOn); GetDItem(soundDialog, kSoundCrowd, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)crowdSoundOn); leaveDialog = FALSE; while (!leaveDialog) { ModalDialog(SoundFilter, &itemHit); switch (itemHit) { case kSoundOkay: GetDItem(soundDialog, kSoundEnable, &iType, &iHandle, &iRect); soundOn = (Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(soundDialog, kSoundBeam, &iType, &iHandle, &iRect); beamSoundOn = (Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(soundDialog, kSoundIncidental, &iType, &iHandle, &iRect); incidentSoundOn = (Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(soundDialog, kSoundCollisions, &iType, &iHandle, &iRect); collisionSoundOn = (Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(soundDialog, kSoundCrowd, &iType, &iHandle, &iRect); crowdSoundOn = (Boolean)GetCtlValue((ControlHandle)iHandle); SetSoundVol(soundVolume); userOkayed = TRUE; leaveDialog = TRUE; break; case kSoundCancel: soundVolume = wasVolume; userOkayed = FALSE; leaveDialog = TRUE; break; case kSoundLouder: if (soundVolume < 7) { soundVolume++; UpdateVolumeIcon(soundDialog); } break; case kSoundSofter: if (soundVolume > 0) { soundVolume--; UpdateVolumeIcon(soundDialog); } break; case kSoundEnable: GetDItem(soundDialog, kSoundEnable, &iType, &iHandle, &iRect); wasState = (Boolean)GetCtlValue((ControlHandle)iHandle); wasState = !wasState; SetCtlValue((ControlHandle)iHandle, (short)wasState); if (wasState) { GetDItem(soundDialog, kSoundBeam, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, 0); GetDItem(soundDialog, kSoundIncidental, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, 0); GetDItem(soundDialog, kSoundCollisions, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, 0); GetDItem(soundDialog, kSoundCrowd, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, 0); } else { GetDItem(soundDialog, kSoundBeam, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, 255); GetDItem(soundDialog, kSoundIncidental, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, 255); GetDItem(soundDialog, kSoundCollisions, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, 255); GetDItem(soundDialog, kSoundCrowd, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, 255); } break; case kSoundBeam: case kSoundIncidental: case kSoundCollisions: case kSoundCrowd: GetDItem(soundDialog, itemHit, &iType, &iHandle, &iRect); wasState = (Boolean)GetCtlValue((ControlHandle)iHandle); wasState = !wasState; SetCtlValue((ControlHandle)iHandle, (short)wasState); break; default: break; } } DisposDialog(soundDialog); return (userOkayed); } \ No newline at end of file diff --git a/Sources/DissBits.c b/Sources/DissBits.c new file mode 100755 index 0000000..b5dd5a6 --- /dev/null +++ b/Sources/DissBits.c @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== DissBits Routines == //== == //============================================================ //============================================================ //======================================================== Includes #include "Globals.h" #include "UnivUtilities.h" #include "DissBits.h" //======================================================== DissBitsMed13QD void DissBits13QD (Rect *clippedRect) { Rect transRect; RgnHandle clipRgn; register short value = 1; register short mask = 0x0CA0; short rectH, rectV; clipRgn = NewRgn(); RectRgn(clipRgn, clippedRect); do { if (value & 1) // pseudo-random # between 1 and 4095 value = (value >> 1) ^ mask; else value = (value >> 1); rectH = (value % 80) * 8; // convert value into screen coords rectV = ((value / 80) * 10) + clippedRect->top; SetRect(&transRect, rectH, rectV, rectH + 8, rectV + 10); if (isColor) // copy bits within rect to mainWndo CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &transRect, &transRect, srcCopy, clipRgn); else CopyBits(&offWorkBits, &(mainWndo->portBits), &transRect, &transRect, srcCopy, clipRgn); } while (value != 1); rectH = 0; // handle special case for zero rectV = clippedRect->top; SetRect(&transRect, rectH, rectV, rectH + 8, rectV + 10); if (isColor) CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &transRect, &transRect, srcCopy, clipRgn); else CopyBits(&offWorkBits, &(mainWndo->portBits), &transRect, &transRect, srcCopy, clipRgn); DisposeRgn(clipRgn); } //======================================================== DissBits12QD void DissBits12QD (Rect *clippedRect) { Rect transRect; RgnHandle clipRgn; register short value = 1; register short mask = 0x0500; short rectH, rectV; clipRgn = NewRgn(); RectRgn(clipRgn, clippedRect); do { if (value & 1) // pseudo-random # between 1 and 2047 value = (value >> 1) ^ mask; else value = (value >> 1); rectH = (value % 64) * 8; // convert # into screen coords rectV = ((value / 64) * 12) + clippedRect->top; SetRect(&transRect, rectH, rectV, rectH + 8, rectV + 12); if (isColor) // copy bits within rect to mainWndo CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &transRect, &transRect, srcCopy, clipRgn); else CopyBits(&offWorkBits, &(mainWndo->portBits), &transRect, &transRect, srcCopy, clipRgn); } while (value != 1); rectH = 0; // handle special case for zero rectV = clippedRect->top; SetRect(&transRect, rectH, rectV, rectH + 8, rectV + 12); if (isColor) CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &transRect, &transRect, srcCopy, clipRgn); else CopyBits(&offWorkBits, &(mainWndo->portBits), &transRect, &transRect, srcCopy, clipRgn); DisposeRgn(clipRgn); } //======================================================== DissBits13Assm4 void DissBits13Assm4 (Rect *clippedRect) { Point zeroPt; long screenOffset, workOffset; short mask = 0x3500; short value = 1; short rectH, rectV, rowsThen; char theMode; SetPt(&zeroPt, 0, 0); ShieldCursor(clippedRect, zeroPt); theMode = true32b; SwapMMUMode(&theMode); do { if (value & 1) // produces # between 1 and 16383 value = (value >> 1) ^ mask; else value = (value >> 1); rectH = (value % 160) * 4; // convert to screen coords rectV = ((value / 160) * 5) + clippedRect->top; if (rectV > (clippedRect->bottom - 5)) { rowsThen = clippedRect->bottom - rectV; if (rowsThen > 0) { workOffset = (long)((long)rectH >> 1) + workRowOffsets[rectV] + (long)offWorkPix; screenOffset = (long)((long)rectH >> 1) + screenRowAddrs[rectV]; asm 68000 { move.l workOffset, a0 ; source move.l screenOffset, a1 ; destination move.w workRowBytes, d0 move.w screenRowBytes, d1 move.w rowsThen, d2 ; how many rows @1 move.w (a0),(a1) ; move a row adda.w d0, a0 adda.w d1, a1 subq.w #1, d2 ; decrement counter bne @1 ; branch if not zero } } } else { workOffset = (long)((long)rectH >> 1) + workRowOffsets[rectV] + (long)offWorkPix; screenOffset = (long)((long)rectH >> 1) + screenRowAddrs[rectV]; asm 68000 { move.l workOffset, a0 ; source move.l screenOffset, a1 ; dest move.w workRowBytes, d0 move.w screenRowBytes, d1 move.w (a0),(a1) ; move row 1 adda.w d0, a0 adda.w d1, a1 move.w (a0),(a1) ; move row 2 adda.w d0, a0 adda.w d1, a1 move.w (a0),(a1) ; move row 3 adda.w d0, a0 adda.w d1, a1 move.w (a0),(a1) ; move row 4 adda.w d0, a0 adda.w d1, a1 move.w (a0),(a1) ; move row 5 } } } while (value != 1); rectH = 0; // handle special case for zero rectV = clippedRect->top; workOffset = (long)((long)rectH >> 1) + workRowOffsets[rectV] + (long)offWorkPix; screenOffset = (long)((long)rectH >> 1) + screenRowAddrs[rectV]; asm 68000 { move.l workOffset, a0 ; source move.l screenOffset, a1 ; destination move.w workRowBytes, d0 move.w screenRowBytes, d1 move.w (a0),(a1) ; move row 1 adda.w d0, a0 adda.w d1, a1 move.w (a0),(a1) ; move row 2 adda.w d0, a0 adda.w d1, a1 move.w (a0),(a1) ; move row 3 adda.w d0, a0 adda.w d1, a1 move.w (a0),(a1) ; move row 4 adda.w d0, a0 adda.w d1, a1 move.w (a0),(a1) ; move row 5 } SwapMMUMode(&theMode); ShowCursor(); } //======================================================== DissBits12Assm4 void DissBits12Assm4 (Rect *clippedRect) { Point zeroPt; long screenOffset, workOffset; short value = 1; short mask = 0x1B00; short rectH, rectV, rowsThen; char theMode; SetPt(&zeroPt, 0, 0); ShieldCursor(clippedRect, zeroPt); theMode = true32b; SwapMMUMode(&theMode); do { if (value & 1) // produces value between 1 and 8191 value = (value >> 1) ^ mask; else value = (value >> 1); rectH = (value % 128) << 2; // convert to screen coords rectV = ((value / 128) * 6) + clippedRect->top; if (rectV > clippedRect->bottom - 6) { rowsThen = clippedRect->bottom - rectV; if (rowsThen > 0) { screenOffset = (rectH >> 1) + screenRowAddrs[rectV]; workOffset = (long)((long)rectH >> 1) + workRowOffsets[rectV] + (long)offWorkPix; asm 68000 { move.l screenOffset, a0 move.l workOffset, a1 move.w screenRowBytes, d0 move.w workRowBytes, d1 move.w rowsThen, d2 @1 move.w (a1),(a0) ; move a row adda.w d0, a0 adda.w d1, a1 subq.w #1, d2 ; decrement counter bne @1 ; branch if not zero } } } else { screenOffset = (rectH >> 1) + screenRowAddrs[rectV]; workOffset = (long)((long)rectH >> 1) + workRowOffsets[rectV] + (long)offWorkPix; asm 68000 { move.l screenOffset, a0 move.l workOffset, a1 move.w screenRowBytes, d0 move.w workRowBytes, d1 move.w (a1),(a0) ; move row 1 adda.w d0, a0 adda.w d1, a1 move.w (a1),(a0) ; move row 2 adda.w d0, a0 adda.w d1, a1 move.w (a1),(a0) ; move row 3 adda.w d0, a0 adda.w d1, a1 move.w (a1),(a0) ; move row 4 adda.w d0, a0 adda.w d1, a1 move.w (a1),(a0) ; move row 5 adda.w d0, a0 adda.w d1, a1 move.w (a1),(a0) ; move row 6 } } } while (value != 1); rectH = 0; // handle special case for zero rectV = clippedRect->top; screenOffset = (rectH >> 1) + screenRowAddrs[rectV]; workOffset = (long)((long)rectH >> 1) + workRowOffsets[rectV] + (long)offWorkPix; asm 68000 { move.l screenOffset, a0 move.l workOffset, a1 move.w screenRowBytes, d0 move.w workRowBytes, d1 move.w (a1),(a0) ; move row 1 adda.w d0, a0 adda.w d1, a1 move.w (a1),(a0) ; move row 2 adda.w d0, a0 adda.w d1, a1 move.w (a1),(a0) ; move row 3 adda.w d0, a0 adda.w d1, a1 move.w (a1),(a0) ; move row 4 adda.w d0, a0 adda.w d1, a1 move.w (a1),(a0) ; move row 5 adda.w d0, a0 adda.w d1, a1 move.w (a1),(a0) ; move row 6 } SwapMMUMode(&theMode); ShowCursor(); } //======================================================== DissolveWorkToMain void DissolveWorkToMain (void) { switch (displayMode) { case kDisplay9Inch: case kDisplay12Inch: if (useQD) DissBits12QD(&offWorkRect); else { if (isColor) DissBits12Assm4(&offWorkRect); else DissBits12QD(&offWorkRect); } break; case kDisplay13Inch: if (useQD) DissBits13QD(&offWorkRect); else { if (isColor) DissBits13Assm4(&offWorkRect); else DissBits13QD(&offWorkRect); } break; default: break; } } \ No newline at end of file diff --git a/Sources/DumpPict.c b/Sources/DumpPict.c new file mode 100755 index 0000000..351357f --- /dev/null +++ b/Sources/DumpPict.c @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Dump Pict Routines == //== == //============================================================ //============================================================ #include "UnivUtilities.h" //extern GrafPtr offWorkPtr; //extern BitMap offWorkBits; //extern CGrafPort offCWorkPort; //extern CGrafPtr offCWorkPtr; //extern Rect replayRect; //-------------------------------------------------------- Type Definitions typedef struct { PicHandle pHand; short gRef; Boolean fileOK; } GDataRec; typedef struct { CGrafPort TRUEPort; GDataRec GDStuff; } GportPlus, *GPPtr; //-------------------------------------------------------- Prototypes void DeathKiss (short, short, StringPtr); pascal void PutPICTData (Ptr, short); //-------------------------------------------------------- PutPICTData pascal void PutPICTData (Ptr dataPtr, short byteCount) { long longCount; GPPtr myPortPlus; GetPort((GrafPtr *)&myPortPlus); longCount = byteCount; if (myPortPlus->GDStuff.fileOK) { if (FSWrite(myPortPlus->GDStuff.gRef, &longCount, dataPtr) != noErr) myPortPlus->GDStuff.fileOK = FALSE; if (myPortPlus->GDStuff.pHand != kNilPointer) (**(myPortPlus->GDStuff.pHand)).picSize += longCount; } } //-------------------------------------------------------- DeathKiss void DeathKiss (short globalRef, short vrefnum, StringPtr nameStr) { OSErr theErr; if (globalRef != 0) theErr = FSClose(globalRef); theErr = FSDelete(nameStr, vrefnum); SysBeep(1); } //-------------------------------------------------------- PICTOut void PICTOut (void) { OSErr err; short i, vrefnum, globalRef; long longCount, longZero, bytesAvail; CQDProcs myProcs; QDProcs myOldProcs; Picture savePictSizeFrame; Str255 nameStr; GrafPtr oldPort; GportPlus wPortPlus; GPPtr wPortPlusPtr; PicHandle pictHand; SysEnvRec theWorld; BitMapPtr bitPtr; GDHandle myDev; err = SysEnvirons(1, &theWorld); wPortPlusPtr = &wPortPlus; globalRef = 0; if (GetVInfo(0, (StringPtr)nameStr, &vrefnum, &bytesAvail) != noErr) { DeathKiss(globalRef, vrefnum, nameStr); return; } PasStringCopy("\pScreen 0", nameStr); do { err = Create(nameStr, vrefnum, 'GAO.', 'PICT'); if (err != noErr) { if (err == dupFNErr) { nameStr[8]++; } else { DeathKiss(globalRef, vrefnum, nameStr); return; } } } while (err != noErr); if (FSOpen(nameStr, vrefnum, &globalRef) != 0) { DeathKiss(globalRef, vrefnum, nameStr); return; } longZero = 0L; longCount = 4L; for (i = 0; i < (532 / 4); i++) { err = FSWrite(globalRef, &longCount, &longZero); if (err != noErr) { DeathKiss(globalRef, vrefnum, nameStr); return; } } if (SetFPos(globalRef, fsFromStart, 522) != noErr) { DeathKiss(globalRef, vrefnum, nameStr); return; } GetPort(&oldPort); wPortPlus.GDStuff.gRef = globalRef; wPortPlus.GDStuff.pHand = kNilPointer; wPortPlus.GDStuff.fileOK = TRUE; if (theWorld.hasColorQD) { OpenCPort((CGrafPtr)wPortPlusPtr); SetStdCProcs(&myProcs); ((GrafPtr)wPortPlusPtr)->grafProcs = (QDProcs *)&myProcs; myProcs.putPicProc = (QDPtr)PutPICTData; myDev = GetMainDevice(); bitPtr = (BitMapPtr)*(**myDev).gdPMap; } else { OpenPort((GrafPtr)wPortPlusPtr); SetStdProcs(&myOldProcs); ((GrafPtr)wPortPlusPtr)->grafProcs = &myOldProcs; myOldProcs.putPicProc = (QDPtr)PutPICTData; bitPtr = (BitMapPtr)&wPortPlusPtr->TRUEPort.portPixMap; } ClipRect(&bitPtr->bounds); pictHand = OpenPicture(&bitPtr->bounds); if (pictHand != kNilPointer) { wPortPlus.GDStuff.pHand = pictHand; CopyBits(bitPtr, bitPtr, &bitPtr->bounds, &bitPtr->bounds, srcCopy, kNilPointer); ClosePicture(); KillPicture(pictHand); } else wPortPlus.GDStuff.fileOK = FALSE; ((GrafPtr)wPortPlusPtr)->grafProcs = kNilPointer; SetPort(oldPort); if (theWorld.hasColorQD) CloseCPort((CGrafPtr)wPortPlusPtr); else ClosePort((GrafPtr)wPortPlusPtr); if (!(wPortPlus.GDStuff.fileOK)) { DeathKiss(globalRef, vrefnum, nameStr); return; } if (SetFPos(globalRef, fsFromStart, 512) != noErr) { DeathKiss(globalRef, vrefnum, nameStr); return; } longCount = sizeof(Picture); if (FSWrite(globalRef, &longCount, &savePictSizeFrame) != noErr) { DeathKiss(globalRef, vrefnum, nameStr); return; } if (FSClose(globalRef) != noErr) { DeathKiss(globalRef, vrefnum, nameStr); return; } } \ No newline at end of file diff --git a/Sources/Dynamics.c b/Sources/Dynamics.c new file mode 100755 index 0000000..68d2812 --- /dev/null +++ b/Sources/Dynamics.c @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Game Dynamics Routines == //== == //============================================================ //============================================================ //======================================================== Includes #include "Globals.h" #include "UnivUtilities.h" #include "Dynamics.h" #include "SoundUtils.h" #include "Render.h" #include "Ball.h" //======================================================== Functions //======================================================== DoPersonBallMerged void DoPersonBallMerged (playerType *who) { register long xMomentum, zMomentum; short strategum; PlaySoundSMS(kBallPickUpSound); // calc. components of momentum xMomentum = (who->xVel * kPersonMass) + (theBall.xVel * kBallMass); zMomentum = (who->zVel * kPersonMass) + (theBall.zVel * kBallMass); // momentum / mass = velocity who->xVel = xMomentum / kPersonBallMass; who->zVel = zMomentum / kPersonBallMass; if ((who->persona == kHumanPlayer) || (who->persona == kNetHuman)) { who->mouseWasLetUp = FALSE; } else { if (who->persona == kMisterEaze) { who->strategy = (short)RandomCoin(); } else if (who->persona == kMissTeak) { strategum = RandomInt(100); if (strategum < who->teaksThresh) who->strategy = kRunDiagonal; else who->strategy = kRunCircle; } } theBall.eraseTheBall = TRUE; drawThisFrame = TRUE; who->posture = kCarrying; theBall.mode = kBallHeld; if (who->selector == kPlayerSelector) { whosGotBall = kPlayerHasBall; theBall.modifier = kPlayerHolding; theOpponent.loopsBallHeld = 0; // zero out the other's timer if (thePlayer.loopsBallHeld == 0) // ??? thePlayer.loopsBallHeld = kLoopLimitOnHeldBall; } else { whosGotBall = kOpponentHasBall; theBall.modifier = kOpponentHolding; thePlayer.loopsBallHeld = 0; if (theOpponent.loopsBallHeld == 0) theOpponent.loopsBallHeld = kLoopLimitOnHeldBall; } UpdateBallTimers(&thePlayer); UpdateBallTimers(&theOpponent); UpdateArrows(); } //======================================================== DoPersonBallParted void DoPersonBallParted (playerType *who) { #define kBallDiskDistance 1216 #define kOffsetMultiplier 2 short deltaPX, deltaPZ; PlaySoundSMS(kBallDropSound); deltaPX = boardForceTable[who->direction][kXComponent] * kPersonImpulse; deltaPZ = boardForceTable[who->direction][kZComponent] * kPersonImpulse; theBall.xVel = who->xVel + (deltaPX / kBallMass); // momentum => velocity theBall.zVel = who->zVel + (deltaPZ / kBallMass); // x & z components theBall.xPos = who->xPos + (deltaPX * kOffsetMultiplier); // get ball clear theBall.zPos = who->zPos + (deltaPZ * kOffsetMultiplier); // of disk. BallRectFromPosition(); who->xVel -= deltaPX / kPersonMass; who->zVel -= deltaPZ / kPersonMass; who->posture = kCrouching; theBall.mode = kBallRolling; whosGotBall = kBallRollsFreely; if (who->selector == kPlayerSelector) { theBall.modifier = kPlayerLastHeld; } else { theBall.modifier = kOpponentLastHeld; } if (thePlayer.persona == kMissTeak) { oldDistSquared = ((long)(thePlayer.xPos) * (long)(thePlayer.xPos)) + ((long)(thePlayer.zPos) * (long)(thePlayer.zPos)); } else if (theOpponent.persona == kMissTeak) { oldDistSquared = ((long)(theOpponent.xPos) * (long)(theOpponent.xPos)) + ((long)(theOpponent.zPos) * (long)(theOpponent.zPos)); } if ((who->persona == kHumanPlayer) || (who->persona == kNetHuman)) who->mouseWasLetUp = FALSE; UpdateArrows(); } //======================================================== DoPersonBallCollided void DoPersonBallCollided (playerType *who) { #define kPBLimitScale 512L // 1024 occ. probs, 2048 more probs short original2XVel, original2ZVel; long distX, distZ; long new1XVel, new1ZVel, new2XVel, new2ZVel; long distSquared, scalar1, scalar2; who->xPos -= (who->xVel / kVelocitySensitive); who->zPos -= (who->zVel / kVelocitySensitive); theBall.xVel -= theBall.xVel / kPBEnergyAbsorbed; theBall.zVel -= theBall.zVel / kPBEnergyAbsorbed; who->xVel -= who->xVel / kPBEnergyAbsorbed; who->zVel -= who->zVel / kPBEnergyAbsorbed; theBall.xVel /= kPersonSmallMass; theBall.zVel /= kPersonSmallMass; who->xVel /= kBallMass; who->zVel /= kBallMass; original2XVel = who->xVel; original2ZVel = who->zVel;; theBall.xVel -= original2XVel; theBall.zVel -= original2ZVel; who->xVel = 0; who->zVel = 0; distX = (long)who->xPos - (long)theBall.xPos; distZ = (long)who->zPos - (long)theBall.zPos; distSquared = ((distX * distX) + (distZ * distZ)) / kPBLimitScale; scalar1 = (((long)-theBall.xVel * distZ) + ((long)theBall.zVel * distX)) / kPBLimitScale; scalar2 = (((long)theBall.xVel * distX) + ((long)theBall.zVel * distZ)) / kPBLimitScale; if (distSquared != 0) { new1XVel = -scalar1 * distZ / distSquared; new1ZVel = scalar1 * distX / distSquared; new2XVel = scalar2 * distX / distSquared; new2ZVel = scalar2 * distZ / distSquared; } if (theBall.justHitWall == 0) { theBall.xVel = (short)new1XVel + original2XVel; theBall.zVel = (short)new1ZVel + original2ZVel; } who->xVel = (short)new2XVel + original2XVel; who->zVel = (short)new2ZVel + original2ZVel; theBall.xVel *= kPersonSmallMass; theBall.zVel *= kPersonSmallMass; who->xVel *= kBallMass; who->zVel *= kBallMass; } //======================================================== DoPersonPersonCollided void DoPersonPersonCollided (void) { #define kLimitScale 1024L short original2XVel, original2ZVel; long distX, distZ; long new1XVel, new1ZVel, new2XVel, new2ZVel; long distSquared, scalar1, scalar2; PlaySoundSMS(kClashSound); thePlayer.justHitOpponent = kLoopsImpactless; theOpponent.justHitOpponent = kLoopsImpactless; thePlayer.justHitWall = 0; theOpponent.justHitWall = 0; thePlayer.xVel -= thePlayer.xVel / kEnergyAbsorbed; thePlayer.zVel -= thePlayer.zVel / kEnergyAbsorbed; theOpponent.xVel -= theOpponent.xVel / kEnergyAbsorbed; theOpponent.zVel -= theOpponent.zVel / kEnergyAbsorbed; original2XVel = theOpponent.xVel; original2ZVel = theOpponent.zVel;; thePlayer.xVel -= original2XVel; thePlayer.zVel -= original2ZVel; theOpponent.xVel = 0; theOpponent.zVel = 0; distX = (long)theOpponent.xPos - (long)thePlayer.xPos; distZ = (long)theOpponent.zPos - (long)thePlayer.zPos; distSquared = ((distX * distX) + (distZ * distZ)) / kLimitScale; scalar1 = (((long)-thePlayer.xVel * distZ) + ((long)thePlayer.zVel * distX)) / kLimitScale; scalar2 = (((long)thePlayer.xVel * distX) + ((long)thePlayer.zVel * distZ)) / kLimitScale; if (distSquared != 0) { new1XVel = -scalar1 * distZ / distSquared; new1ZVel = scalar1 * distX / distSquared; new2XVel = scalar2 * distX / distSquared; new2ZVel = scalar2 * distZ / distSquared; } thePlayer.xVel = (short)new1XVel + original2XVel; thePlayer.zVel = (short)new1ZVel + original2ZVel; theOpponent.xVel = (short)new2XVel + original2XVel; theOpponent.zVel = (short)new2ZVel + original2ZVel; } //======================================================== CheckPersonBallCollision void CheckPersonBallCollision (playerType *who) { #define kSqrImpactDistancePB 1478656L // r. of ball = 416, r. disk = 800 long sqrXDistance, sqrDistance; // Add these & square the result. if ((who->mode != kInArena) || (theBall.mode != kBallRolling) || (who->justHitBall != 0)) { return; } sqrXDistance = ((long)theBall.xPos - who->xPos) * ((long)theBall.xPos - who->xPos); if (sqrXDistance < kSqrImpactDistancePB) // check x 1st (one mult. only) { sqrDistance = sqrXDistance + ((long)theBall.zPos - who->zPos) * ((long)theBall.zPos - who->zPos); if (sqrDistance < kSqrImpactDistancePB) { if ((who->posture == kCrouching) && (who->mouseWasLetUp)) { DoPersonBallMerged(who); } else { PlaySoundSMS(kClashSound); DoPersonBallCollided(who); who->justHitBall = kLoopsImpactless; CheckUpOnBall(); if (who->selector == kPlayerSelector) { theBall.modifier = kPlayerLastHeld; } else { theBall.modifier = kOpponentLastHeld; } } } } } //======================================================== CheckPersonPersonCollision void CheckPersonPersonCollision (void) { #define kSqrImpactDistancePO 2560000L // 2 * r. disk = 800 long sqrXDistance, sqrDistance; // Add these & square the result. if ((thePlayer.mode != kInArena) || (theOpponent.mode != kInArena) || (thePlayer.justHitOpponent != 0)) { return; } sqrXDistance = ((long)theOpponent.xPos - thePlayer.xPos) * ((long)theOpponent.xPos - thePlayer.xPos); if (sqrXDistance < kSqrImpactDistancePO) // check x first (one multiply only) { sqrDistance = sqrXDistance + ((long)theOpponent.zPos - thePlayer.zPos) * ((long)theOpponent.zPos - thePlayer.zPos); if (sqrDistance < kSqrImpactDistancePO) { DoPersonPersonCollided(); do { thePlayer.xPos += (thePlayer.xVel / kVelocitySensitive); thePlayer.zPos += (thePlayer.zVel / kVelocitySensitive); theOpponent.xPos += (theOpponent.xVel / kVelocitySensitive); theOpponent.zPos += (theOpponent.zVel / kVelocitySensitive); sqrXDistance = ((long)theOpponent.xPos - thePlayer.xPos) * ((long)theOpponent.xPos - thePlayer.xPos); sqrDistance = sqrXDistance + ((long)theOpponent.zPos - thePlayer.zPos) * ((long)theOpponent.zPos - thePlayer.zPos); } while (sqrDistance < kSqrImpactDistancePO); } } } //======================================================== GetPlaceOnArena short GetPlaceOnArena (short xPos, short zPos) { register short indexX, indexZ; short signX, signZ; short forceX, forceZ; indexX = xPos; if (indexX < 0) { indexX = -indexX; signX = -1; } else { signX = 1; } indexX /= 512; indexZ = zPos; if (indexZ < 0) { indexZ = -indexZ; signZ = -1; } else { signZ = 1; } indexZ /= 512; if (xPos < 0) { switch (leftGoalLeague) { case kLittleLeague: forceX = *(littleForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kJuniorVarsity: forceX = *(juniorForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kVarsity: forceX = *(varsityForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kMinorLeague: forceX = *(minorForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kProfessional: forceX = *(proForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; default: forceX = 0; break; } } else { switch (rightGoalLeague) { case kLittleLeague: forceX = *(littleForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kJuniorVarsity: forceX = *(juniorForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kVarsity: forceX = *(varsityForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kMinorLeague: forceX = *(minorForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; case kProfessional: forceX = *(proForceTable + indexX * 82 + indexZ * 2 + kXComponent); break; default: forceX = 0; break; } } return (forceX); } //======================================================== HandlePersonWallCollision void HandlePersonWallCollision (playerType *who) { short tempVel, wheresIt; if (who->justHitWall != 0) { who->flag = kIsNormal; return; } if (who->xPos < 0) { if (who->xVel > who->zVel) return; } else { if (-who->xVel > who->zVel) return; } PlaySoundSMS(kRicochetSound); who->flag = kIsRebounding; who->justHitWall = kLoopsImpactless; who->xPos -= (who->xVel / kVelocitySensitive); who->zPos -= (who->zVel / kVelocitySensitive); if (who->xPos < 0) { tempVel = who->xVel; who->xVel = who->zVel; who->zVel = tempVel; } else { tempVel = who->xVel; who->xVel = -who->zVel; who->zVel = -tempVel; } wheresIt = GetPlaceOnArena(who->xPos, who->zPos); if ((wheresIt == kBackBoard) || (wheresIt == kGoalPath)) { if (who->zVel > 0) who->zVel *= -1; if (who->xPos < 0) { if (who->xVel < 0) who->xVel *= -1; } else { if (who->xVel > 0) who->xVel *= -1; } } } //======================================================== CheckUpOnBall void CheckUpOnBall (void) { short wheresIt; wheresIt = GetPlaceOnArena(theBall.xPos, theBall.zPos); if (wheresIt == kBackBoard) { if (theBall.zVel > 0) theBall.zVel *= -1; if (theBall.xPos < 0) { if (theBall.xVel < 0) theBall.xVel *= -1; } else { if (theBall.xVel > 0) theBall.xVel *= -1; } } } //======================================================== HandleBallWallCollision void HandleBallWallCollision (void) { short tempVel; if (theBall.justHitWall != 0) { theBall.flag = kIsNormal; return; } if (theBall.xPos < 0) { if (theBall.xVel > theBall.zVel) return; } else { if (-theBall.xVel > theBall.zVel) return; } PlaySoundSMS(kRicochetSound); theBall.flag = kIsRebounding; theBall.justHitWall = kLoopsImpactless; thePlayer.justHitBall = 0; theOpponent.justHitBall = 0; theBall.xPos -= (theBall.xVel / kVelocitySensitive); theBall.zPos -= (theBall.zVel / kVelocitySensitive); if (theBall.xPos < 0) { tempVel = theBall.xVel; theBall.xVel = theBall.zVel; theBall.zVel = tempVel; } else { tempVel = theBall.xVel; theBall.xVel = -theBall.zVel; theBall.zVel = -tempVel; } CheckUpOnBall(); } //======================================================== HandleCollisions void HandleCollisions (void) { if (netGameInSession) { if (imTheMaster) { CheckPersonBallCollision(&thePlayer); CheckPersonBallCollision(&theOpponent); } else { CheckPersonBallCollision(&theOpponent); CheckPersonBallCollision(&thePlayer); } } else { CheckPersonBallCollision(&thePlayer); CheckPersonBallCollision(&theOpponent); } CheckPersonPersonCollision(); if (thePlayer.justHitWall > 0) { thePlayer.justHitWall--; if (thePlayer.justHitWall == kFrameToDampen) { thePlayer.xVel -= thePlayer.xVel / kPersonDampening; thePlayer.zVel -= thePlayer.zVel / kPersonDampening; } } if (thePlayer.justHitBall > 0) thePlayer.justHitBall--; if (thePlayer.justHitOpponent > 0) thePlayer.justHitOpponent--; if (theOpponent.justHitWall > 0) { theOpponent.justHitWall--; if (theOpponent.justHitWall == kFrameToDampen) { theOpponent.xVel -= theOpponent.xVel / kPersonDampening; theOpponent.zVel -= theOpponent.zVel / kPersonDampening; } } if (theOpponent.justHitBall > 0) theOpponent.justHitBall--; if (theOpponent.justHitOpponent > 0) theOpponent.justHitOpponent--; if (theBall.justHitWall > 0) { theBall.justHitWall--; if (theBall.justHitWall == kFrameToDampen) { theBall.xVel /= kBallDampening; theBall.zVel /= kBallDampening; } } } \ No newline at end of file diff --git a/Sources/Environ.c b/Sources/Environ.c new file mode 100755 index 0000000..c89919b --- /dev/null +++ b/Sources/Environ.c @@ -0,0 +1 @@ +//============================================================ //============================================================ //== == //== Environ-Checking Routines == //== == //============================================================ //============================================================ //======================================================== Includes #include "Globals.h" #include "UnivUtilities.h" #include "Environ.h" //======================================================== Functions //======================================================== TrapExists Boolean TrapExists (short trapNumber) { return ((NGetTrapAddress(trapNumber, ToolTrap) != NGetTrapAddress(kUnimpTrap, ToolTrap))); } //======================================================== DoWeHaveGestalt Boolean DoWeHaveGestalt (void) { return (TrapExists(kGestaltTrap)); } //======================================================== DoWeHaveWNE Boolean DoWeHaveWNE (void) { return (TrapExists(kWNETrap)); } //======================================================== DoWeHaveColor Boolean DoWeHaveColor (void) { SysEnvRec thisWorld; SysEnvirons(2, &thisWorld); return (thisWorld.hasColorQD); } //======================================================== DoWeHaveSystem602 Boolean DoWeHaveSystem602 (void) { SysEnvRec thisWorld; Boolean haveIt; SysEnvirons(2, &thisWorld); if (thisWorld.systemVersion >= 0x0602) haveIt = TRUE; else haveIt = FALSE; return (haveIt); } //======================================================== DoWeHaveSystem605 Boolean DoWeHaveSystem605 (void) { SysEnvRec thisWorld; Boolean haveIt; SysEnvirons(2, &thisWorld); if (thisWorld.systemVersion >= 0x0605) haveIt = TRUE; else haveIt = FALSE; return (haveIt); } //======================================================== DoWeHaveSystem7 Boolean DoWeHaveSystem7 (void) { SysEnvRec thisWorld; Boolean haveIt; SysEnvirons(2, &thisWorld); if (thisWorld.systemVersion >= 0x0700) haveIt = TRUE; else haveIt = FALSE; return (haveIt); } //======================================================== HowWillWeDisplay short HowWillWeDisplay (Boolean commandKeyHeld) { short displayAs, isWide, isTall; isWide = screenBits.bounds.right - screenBits.bounds.left; isTall = screenBits.bounds.bottom - screenBits.bounds.top; if (commandKeyHeld) { if ((isWide >= 512) && (isTall >= 384) && isColor) displayAs = kDisplay12Inch; else displayAs = kDisplay9Inch; } else { if ((isWide >= 640) && (isTall >= 480)) displayAs = kDisplay13Inch; else { if ((isWide >= 512) && (isTall >= 384) && isColor) displayAs = kDisplay12Inch; else displayAs = kDisplay9Inch; } } return(displayAs); } //======================================================== WhatsOurDepth short WhatsOurDepth (void) { GDHandle theDevice; short thisDepth; char wasState; if (thisMac.hasColor) { theDevice = GetMainDevice(); if (theDevice != kNilPointer) { wasState = HGetState((Handle)theDevice); HLock((Handle)theDevice); thisDepth = (**(**theDevice).gdPMap).pixelSize; HSetState((Handle)theDevice, wasState); } else DeathError(kErrNoDevice); } else thisDepth = 1; return (thisDepth); } //======================================================== CanWeDisplay4Bit Boolean CanWeDisplay4Bit (void) { GDHandle theDevice; short canDepth; short GDTypeFlag = 1, colorFlag = 1; Boolean canDo; canDo = FALSE; if (thisMac.hasColor && thisMac.canSwitch) { theDevice = GetMainDevice(); if (theDevice != kNilPointer) { HLock((Handle)theDevice); canDepth = HasDepth(theDevice, 4, GDTypeFlag, colorFlag); HUnlock((Handle)theDevice); if (canDepth != 0) canDo = TRUE; } else DeathError(kErrNoDevice); } return (canDo); } //======================================================== SwitchDepthOrAbort void SwitchDepthOrAbort (void) { GDHandle theDevice; AlertTHndl alertHandle; Rect alertRect; OSErr theErr; short usersDecision, dummyInt; short GDTypeFlag = 1, colorFlag = 1; char tagByte; if (thisMac.canSwitch) { alertHandle = (AlertTHndl)GetResource('ALRT', rSwitchDepthAlert); if (alertHandle != kNilPointer) { HNoPurge((Handle)alertHandle); alertRect = (**alertHandle).boundsRect; OffsetRect(&alertRect, -alertRect.left, -alertRect.top); dummyInt = (screenBits.bounds.right - alertRect.right) / 2; OffsetRect(&alertRect, dummyInt, 0); dummyInt = (screenBits.bounds.bottom - alertRect.bottom) / 3; OffsetRect(&alertRect, 0, dummyInt); (**alertHandle).boundsRect = alertRect; HPurge((Handle)alertHandle); } else { } usersDecision = Alert(rSwitchDepthAlert, kNilPointer); switch (usersDecision) { case 1: theDevice = GetMainDevice(); if (theDevice != kNilPointer) { tagByte = HGetState((Handle)theDevice); HLock((Handle)theDevice); theErr = SetDepth(theDevice, 4, GDTypeFlag, colorFlag); HSetState((Handle)theDevice, tagByte); if (theErr != noErr) DeathError(kErrFailedSwitch); else thisMac.isDepth = 4; } else DeathError(kErrNoDevice); break; case 2: theDevice = GetMainDevice(); if (theDevice != kNilPointer) { tagByte = HGetState((Handle)theDevice); HLock((Handle)theDevice); theErr = SetDepth(theDevice, 1, GDTypeFlag, colorFlag); HSetState((Handle)theDevice, tagByte); if (theErr != noErr) DeathError(kErrFailedSwitch); else thisMac.isDepth = 1; } else DeathError(kErrNoDevice); break; case 3: ExitToShell(); break; } } else DeathError(kErr2or16Colors); } //======================================================== CheckOurEnvirons void CheckOurEnvirons (void) { Boolean commandKeyPressed; commandKeyPressed = CommandKeyIsDown(); thisMac.hasGestalt = DoWeHaveGestalt(); thisMac.hasWNE = DoWeHaveWNE(); thisMac.hasColor = DoWeHaveColor(); knowsColor = thisMac.hasColor; if (!(DoWeHaveSystem602())) { DeathError(kErrNeedSystem602); } thisMac.canSwitch = DoWeHaveSystem605(); thisMac.hasSystem7 = DoWeHaveSystem7(); thisMac.wasDepth = WhatsOurDepth(); thisMac.canColor = CanWeDisplay4Bit(); if ((thisMac.wasDepth != 4) && (thisMac.wasDepth != 1) && (thisMac.canColor)) { SwitchDepthOrAbort(); } else { thisMac.isDepth = thisMac.wasDepth; } isColor = (thisMac.isDepth != kDisplay1Bit); displayMode = HowWillWeDisplay(commandKeyPressed); } \ No newline at end of file diff --git a/Sources/FileError.c b/Sources/FileError.c new file mode 100755 index 0000000..0e12ae5 --- /dev/null +++ b/Sources/FileError.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== File Error Handling File ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "UnivUtilities.h" #include "FileError.h" /*======================================================== CheckFileError */ 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); } \ No newline at end of file diff --git a/Sources/Human.c b/Sources/Human.c new file mode 100755 index 0000000..0fb63b1 --- /dev/null +++ b/Sources/Human.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Human Player Specific Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "Human.h" #include "SoundUtils.h" #include "Dynamics.h" /*======================================================== Functions */ /*======================================================== DetermineHumanFacing */ void DetermineHumanFacing (playerType *who) { #define kLoHThreshhold -12 #define kHiHThreshhold 12 #define kLoVThreshhold -8 #define kHiVThreshhold 8 if (who->hMouse < kLoHThreshhold) { if (who->vMouse < kLoVThreshhold) who->direction = kFacingSouthWest; else { if (who->vMouse > kHiVThreshhold) who->direction = kFacingNorthWest; else who->direction = kFacingWest; } } else { if (who->hMouse > kHiHThreshhold) { if (who->vMouse < kLoVThreshhold) who->direction = kFacingSouthEast; else { if (who->vMouse > kHiVThreshhold) who->direction = kFacingNorthEast; else who->direction = kFacingEast; } } else { if (who->vMouse < kLoVThreshhold) who->direction = kFacingSouth; else { if (who->vMouse > kHiVThreshhold) who->direction = kFacingNorth; else who->direction = kFacingRested; } } } } /*======================================================== GetHumanInput */ void GetHumanInput (void) { Point mousePt; short boardXForce, boardZForce; Boolean brakeOn, bashOn; GetMouse(&mousePt); LocalToGlobal(&mousePt); if (ForcePointInRect(&mousePt, &mouseFrame)) SetMouse(mousePt); thePlayer.hMouse = (mousePt.h - screenHCenter) / kPlayerInputSensitive; thePlayer.vMouse = (screenVCenter - mousePt.v) / kPlayerInputSensitive; thePlayer.buttonIs = Button(); brakeOn = BitTst(&theKeyMap, kSpaceBarMap); bashOn = BitTst(&theKeyMap, kBKeyMap) || BitTst(&theKeyMap, kMKeyMap) || BitTst(&theKeyMap, kNKeyMap); boardXForce = thePlayer.hMouse; boardZForce = thePlayer.vMouse; if (boardXForce > maxBoardForce) boardXForce = maxBoardForce; else if (boardXForce < -maxBoardForce) boardXForce = -maxBoardForce; if (boardZForce > maxBoardForce) boardZForce = maxBoardForce; else if (boardZForce < -maxBoardForce) boardZForce = -maxBoardForce; thePlayer.bashApplied = FALSE; if ((whosGotBall != kPlayerHasBall) && (bashOn) && (!brakeOn)) { thePlayer.bashApplied = bashOn; boardXForce = boardForceTable[thePlayer.direction][kXComponent]; boardZForce = boardForceTable[thePlayer.direction][kZComponent]; boardXForce *= 3; /* 150% increase in board force */ boardZForce *= 3; } if ((thePlayer.buttonIs) && (!thePlayer.bashApplied)) { boardXForce += boardXForce / kAddForceFract; /* 25% increase in board force */ boardZForce += boardZForce / kAddForceFract; /* tried 50%, but it was harsh */ } if (thePlayer.justHitWall == 0) { thePlayer.xVel += boardXForce; thePlayer.zVel += boardZForce; } if ((brakeOn == TRUE) && (thePlayer.brakeApplied == FALSE)) PlaySoundSMS(kBrakeSound); thePlayer.brakeApplied = brakeOn; if (brakeOn) { thePlayer.xVel -= thePlayer.xVel / 10; /* a 10% decrease in velocity */ thePlayer.zVel -= thePlayer.zVel / 10; } if (thePlayer.buttonIs) { if ((theBall.modifier == kPlayerHolding) && (thePlayer.mouseWasLetUp)) DoPersonBallParted(&thePlayer); thePlayer.posture = kCrouching; } else { thePlayer.mouseWasLetUp = TRUE; if (theBall.modifier == kPlayerHolding) thePlayer.posture = kCarrying; else thePlayer.posture = kStanding; } } /*======================================================== PrepareNetHumanInput */ void PrepareNetHumanInput (void) { Point mousePt; GetMouse(&mousePt); LocalToGlobal(&mousePt); if (ForcePointInRect(&mousePt, &mouseFrame)) SetMouse(mousePt); thePlayer.hMouse = (mousePt.h - screenHCenter) / kPlayerInputSensitive; thePlayer.vMouse = (screenVCenter - mousePt.v) / kPlayerInputSensitive; thePlayer.buttonIs = Button(); thePlayer.brakeApplied = BitTst(&theKeyMap, kSpaceBarMap); thePlayer.bashApplied = BitTst(&theKeyMap, kBKeyMap) || BitTst(&theKeyMap, kMKeyMap) || BitTst(&theKeyMap, kNKeyMap); } /*======================================================== ProcessNetPlayerInput */ void ProcessNetPlayerInput (void) { short boardXForce, boardZForce; boardXForce = theOpponent.hMouse; boardZForce = theOpponent.vMouse; if (boardXForce > maxBoardForce) boardXForce = maxBoardForce; else if (boardXForce < -maxBoardForce) boardXForce = -maxBoardForce; if (boardZForce > maxBoardForce) boardZForce = maxBoardForce; else if (boardZForce < -maxBoardForce) boardZForce = -maxBoardForce; if ((theOpponent.bashApplied) && (whosGotBall != kOpponentHasBall) && (!theOpponent.brakeApplied)) { boardXForce = boardForceTable[theOpponent.direction][kXComponent]; boardZForce = boardForceTable[theOpponent.direction][kZComponent]; boardXForce *= 3; /* 150% increase in board force */ boardZForce *= 3; } if ((theOpponent.buttonIs) && (!theOpponent.bashApplied)) { boardXForce += boardXForce / kAddForceFract; /* 25% increase in board force */ boardZForce += boardZForce / kAddForceFract; /* tried 50%, but it was harsh */ } if (theOpponent.justHitWall == 0) { theOpponent.xVel += boardXForce; theOpponent.zVel += boardZForce; } if ((wasBrakeOn == FALSE) && (theOpponent.brakeApplied == TRUE)) PlaySoundSMS(kBrakeSound); wasBrakeOn = theOpponent.brakeApplied; if (wasBrakeOn) { theOpponent.bashApplied = FALSE; theOpponent.xVel -= theOpponent.xVel / 10; /* a 10% decrease in velocity */ theOpponent.zVel -= theOpponent.zVel / 10; } if (theOpponent.buttonIs) { if ((theBall.mode == kBallHeld) && (theBall.modifier == kOpponentHolding) && (theOpponent.mouseWasLetUp)) DoPersonBallParted(&theOpponent); theOpponent.posture = kCrouching; } else { theOpponent.mouseWasLetUp = TRUE; if (theBall.modifier == kOpponentHolding) theOpponent.posture = kCarrying; else theOpponent.posture = kStanding; } } /*======================================================== HandleBoardCursor */ void HandleBoardCursor (void) { short rootHeight, actualHeight; short indexX, absoluteX, fractionalX; short indexZ, fractionalZ; if ((!showBoardCursor) || (disableBoardCursor)) return; boardCursor.xPos = thePlayer.xPos + (thePlayer.hMouse * 16); boardCursor.zPos = thePlayer.zPos + (thePlayer.vMouse * 16); boardCursor.isRect.left = (boardCursor.xPos / 64) + displayHCenter - 5; if (boardCursor.isRect.left < 0) boardCursor.isRect.left = 0; else if (boardCursor.isRect.left + 16 > screenWide) boardCursor.isRect.left = screenWide - 16; boardCursor.isRect.right = boardCursor.isRect.left + 16; absoluteX = boardCursor.xPos; if (absoluteX < 0) absoluteX = -absoluteX; indexX = absoluteX / 512; fractionalX = absoluteX % 512; indexZ = (boardCursor.zPos / 512) + 40; fractionalZ = boardCursor.zPos % 512; rootHeight = vertTable[indexX][indexZ]; actualHeight = rootHeight + (fractionalX * (vertTable[indexX + 1][indexZ] - rootHeight)) / 512; actualHeight += (fractionalZ * (vertTable[indexX][indexZ + 1] - rootHeight)) / 512; boardCursor.isRect.bottom = actualHeight + 4; if (boardCursor.isRect.bottom > screenHigh) boardCursor.isRect.bottom = screenHigh; else if (boardCursor.isRect.bottom < 12) boardCursor.isRect.bottom = 12; boardCursor.isRect.top = boardCursor.isRect.bottom - 8; } \ No newline at end of file diff --git a/Sources/Idle.c b/Sources/Idle.c new file mode 100755 index 0000000..4fa9187 --- /dev/null +++ b/Sources/Idle.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Idle Routines ==*/ /*== ==*/ /*== (event handling routines) ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "AppleEvents.h" #include "Globals.h" #include "UnivUtilities.h" #include "Idle.h" #include "Menu.h" #include "MainWindow.h" #include "SoundUtils.h" #include #include "Show_help.h" /*======================================================== DoMouseEvent */ void DoMouseEvent (void) { WindowPtr whichWindow; GrafPtr wasPort; Point tempPt; Rect sizeRect; long menuChoice, windSize; short thePart; thePart = FindWindow(theEvent.where, &whichWindow); switch (thePart) { case inMenuBar: menuChoice = MenuSelect(theEvent.where); DoMenuChoice(menuChoice); break; case inSysWindow: SystemClick(&theEvent, whichWindow); break; case inDrag: break; case inContent: break; case inGrow: break; case inGoAway: break; case inZoomIn: break; case inZoomOut: break; default: break; } } /*======================================================== DoKeyDown */ void DoKeyDown (void) { register char theChar; theChar = theEvent.message & charCodeMask; if ((theEvent.modifiers & cmdKey) != 0) DoMenuChoice(MenuKey(theChar)); else { if ((theChar == kTabKeyASCII) && (primaryMode == kPlayMode) && (pausing)) { pausing = FALSE; } else if (theChar == kHelpKeyASCII) { Show_help(rHelpDialogID, (StringPtr)"\pParaHelp", rHelpBasePictID, (StringPtr)"\pPararena Help", (StringPtr)"\p"); } } } /*======================================================== DoUpdateEvent */ void DoUpdateEvent (WindowPtr theWindow) { GrafPtr wasPort; GetPort(&wasPort); SetPort((GrafPtr)theWindow); BeginUpdate((GrafPtr)theWindow); if (theWindow == mainWndo) { if (splashIsUp) DoSplashScreen(); else RefreshMainWindow(); } EndUpdate(theWindow); SetPort((GrafPtr)wasPort); } /*======================================================== DoDiskEvent */ void DoDiskEvent (void) { Point dialogPt; short theErr; if (HiWrd(theEvent.message) != noErr) { SetPt(&dialogPt, kDILeft, kDITop); theErr = DIBadMount(dialogPt, theEvent.message); } } /*======================================================== WindowType */ short WindowType (WindowPtr theWindow) { if (theWindow == kNilPointer) return (kIsNilWindow); if (((WindowPeek)theWindow)->windowKind < 0) return (kIsDAWindow); return (kIsUnknownWindow); } /*======================================================== DoActivate */ void DoActivate (WindowPtr theWindow, Boolean isToActivate) { short typeIs; typeIs = WindowType(theWindow); } /*======================================================== DoActivateEvent */ void DoActivateEvent (void) { DoActivate((GrafPtr)theEvent.message, (theEvent.modifiers & activeFlag) != 0); } /*======================================================== DoSuspendResumeEvent */ void DoSuspendResumeEvent (void) { short nowVolume; switch ((theEvent.message >> 24) & 0x0FF) /* high byte of message */ { case kSuspendResumeMssg: inBackground = ((theEvent.message & kResumeMask) == 0); DoActivate(FrontWindow(), !inBackground); if (inBackground) { TurnSMSOff(); } else { GetSoundVol(&nowVolume); if (nowVolume != soundVolume) { wasSoundVolume = nowVolume; } } break; default: break; } } /*======================================================== HandleEvent */ void HandleEvent (void) { RgnHandle mouseRgn; Boolean gotEvent; if ( thisMac.hasWNE ) { mouseRgn = kNilPointer; gotEvent = WaitNextEvent(everyEvent, &theEvent, kSleepTime, mouseRgn); } else { SystemTask(); gotEvent = GetNextEvent(everyEvent, &theEvent); } if (gotEvent) { switch (theEvent.what) { case nullEvent: break; case mouseDown: DoMouseEvent(); break; case mouseUp: DoMouseEvent(); break; case autoKey: DoKeyDown(); break; case keyDown: DoKeyDown(); break; case keyUp: break; case updateEvt: DoUpdateEvent((GrafPtr)theEvent.message); break; case diskEvt: DoDiskEvent(); break; case activateEvt: DoActivateEvent(); break; case app4Evt: DoSuspendResumeEvent(); break; case kHighLevelEvent: break; default: break; } } } \ No newline at end of file diff --git a/Sources/IdleRoutines.c b/Sources/IdleRoutines.c new file mode 100755 index 0000000..7dbe2de --- /dev/null +++ b/Sources/IdleRoutines.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Idle Support Routines ==*/ /*== ==*/ /*== (routines called from idle.c) ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "SMS.h" #include "IdleRoutines.h" #include "SoundUtils.h" #include "PlayerStats.h" #include "ValidInstall.h" /*======================================================== Functions */ /*======================================================== DrawOpenHand */ void DrawOpenHand (void) { Rect srcRect, destRect; SetRect(&srcRect, 16, 227, 29, 236); SetRect(&destRect, 0, 0, 13, 9); OffsetRect(&destRect, replayRect.left + 74, replayRect.top + 55); if (isColor) CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &srcRect, &destRect, srcCopy, nil); else CopyBits(&offPartsBits, &(mainWndo->portBits), &srcRect, &destRect, srcCopy, nil); } /*======================================================== DrawClosedHand */ void DrawClosedHand (void) { Rect srcRect, destRect; SetRect(&srcRect, 0, 227, 13, 236); SetRect(&destRect, 0, 0, 13, 9); OffsetRect(&destRect, replayRect.left + 74, replayRect.top + 55); if (isColor) CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &srcRect, &destRect, srcCopy, nil); else CopyBits(&offPartsBits, &(mainWndo->portBits), &srcRect, &destRect, srcCopy, nil); } /*======================================================== DrawOpenMouth */ void DrawOpenMouth (short waitFor) { Rect srcRect, destRect; long dummyLong; SetRect(&srcRect, 16, 222, 25, 227); SetRect(&destRect, 0, 0, 9, 5); OffsetRect(&destRect, replayRect.left + 152, replayRect.top + 49); if (isColor) CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &srcRect, &destRect, srcCopy, nil); else CopyBits(&offPartsBits, &(mainWndo->portBits), &srcRect, &destRect, srcCopy, nil); Delay(waitFor, &dummyLong); } /*======================================================== DrawClosedMouth */ void DrawClosedMouth (short waitFor) { Rect srcRect, destRect; long dummyLong; SetRect(&srcRect, 0, 222, 9, 227); SetRect(&destRect, 0, 0, 9, 5); OffsetRect(&destRect, replayRect.left + 152, replayRect.top + 49); if (isColor) CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &srcRect, &destRect, srcCopy, nil); else CopyBits(&offPartsBits, &(mainWndo->portBits), &srcRect, &destRect, srcCopy, nil); Delay(waitFor, &dummyLong); } /*======================================================== DoOpeningAnnouncer */ void DoOpeningAnnouncer (void) { Rect tempRect; GrafPtr wasPort; PicHandle thePict; Handle theSound; long dummyLong; short i; if (soundFileRefNum == -1) return; tempRect = replayRect; InsetRect(&tempRect, 63, 63); GetPort((GrafPtr *)&wasPort); if (isColor) { SetPort((GrafPtr)offCWorkPtr); thePict = GetPicture(kAnnouncerPict4ID); } else { SetPort((GrafPtr)offWorkPtr); thePict = GetPicture(kAnnouncerPict1ID); } if (thePict == kNilPointer) return; DrawPicture(thePict, &replayRect); ReleaseResource((Handle)thePict); SetPort((GrafPtr)mainWndo); for (i = 1; i < 65; i++) { PenPat(black); FrameRect(&tempRect); InsetRect(&tempRect, -1, -1); PenPat(white); FrameRect(&tempRect); } PenNormal(); SetPort((GrafPtr)wasPort); tempRect = replayRect; tempRect.top = tempRect.bottom - 4; for (i = 0; i < 32; i++) { if (isColor) CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &tempRect, &tempRect, srcCopy, nil); else CopyBits(&offWorkBits, &(mainWndo->portBits), &tempRect, &tempRect, srcCopy, nil); tempRect.top -= 4; tempRect.bottom -= 4; } DrawClosedMouth(0); DrawOpenHand(); while (Button()) { } StartCrowdSound(); if (!Button() && (soundFileRefNum != -1)) { theSound = GetResource('SMSD', kLadiesSound); if (theSound != kNilPointer) { HLock(theSound); if (soundOn) SMSSTART(kLadiesSound); DrawOpenHand(); DrawOpenMouth(8); DrawClosedMouth(4); DrawOpenMouth(8); DrawClosedHand(); DrawClosedMouth(70); HUnlock(theSound); ReleaseResource(theSound); } } if (!Button() && (soundFileRefNum != -1)) { theSound = GetResource('SMSD', kAndSound); if (theSound != kNilPointer) { HLock(theSound); if (soundOn) SMSSTART(kAndSound); DrawOpenHand(); DrawOpenMouth(50); DrawClosedHand(); DrawClosedMouth(40); HUnlock(theSound); ReleaseResource(theSound); } } if (!Button() && (soundFileRefNum != -1)) { theSound = GetResource('SMSD', kGentlemenSound); if (theSound != kNilPointer) { HLock(theSound); if (soundOn) SMSSTART(kGentlemenSound); DrawOpenHand(); DrawOpenMouth(10); DrawClosedMouth(6); DrawOpenMouth(10); DrawClosedMouth(6); DrawOpenMouth(30); DrawClosedHand(); DrawClosedMouth(28); HUnlock(theSound); ReleaseResource(theSound); } } if (!Button() && (soundFileRefNum != -1)) { theSound = GetResource('SMSD', kParSound); if (theSound != kNilPointer) { HLock(theSound); if (soundOn) SMSSTART(kParSound); DrawOpenHand(); DrawOpenMouth(50); DrawClosedHand(); DrawClosedMouth(50); HUnlock(theSound); ReleaseResource(theSound); } } if (!Button() && (soundFileRefNum != -1)) { theSound = GetResource('SMSD', kASound); if (theSound != kNilPointer) { HLock(theSound); if (soundOn) SMSSTART(kASound); DrawOpenHand(); DrawOpenMouth(50); DrawClosedHand(); DrawClosedMouth(40); HUnlock(theSound); ReleaseResource(theSound); } } StartApplauseSound(); HoldIt(kApplauseSwellTicks); Applaud(); if (!Button() && (soundFileRefNum != -1)) { theSound = GetResource('SMSD', kRenaSound); if (theSound != kNilPointer) { HLock(theSound); if (soundOn) SMSSTART(kRenaSound); DrawOpenHand(); DrawOpenMouth(16); DrawClosedMouth(8); DrawOpenMouth(96); DrawClosedMouth(0); HUnlock(theSound); ReleaseResource(theSound); } } InsetRect(&replayRect, -1, -1); if (isColor) { CopyBits(&((GrafPtr)offCBackPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &replayRect, &replayRect, srcCopy, nil); CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &replayRect, &replayRect, srcCopy, nil); } else { CopyBits(&offBackBits, &offWorkBits, &replayRect, &replayRect, srcCopy, nil); CopyBits(&offWorkBits, &(mainWndo->portBits), &replayRect, &replayRect, srcCopy, nil); } InsetRect(&replayRect, 1, 1); crowdQueue.number = kCrowdFadeSound; crowdQueue.when = 300; } /*======================================================== DoNew */ void DoNew (void) { switch (primaryMode) { case kIdleMode: primaryMode = kPlayMode; newGame = TRUE; break; case kPlayMode: break; } } /*======================================================== UpdateInstantReplay */ void UpdateReplayDialog (DialogPtr theDialog) { PicHandle thePict; Str255 theTitle; Handle iHandle; Rect iRect; short iType; DrawDialog(theDialog); GetDItem(theDialog, kUserBalloonReplay, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kBalloon4PictID); else thePict = GetPicture(kBalloon1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetIndString(theTitle, rMiscStrings, 1); if (theTitle[0] == 0) PasStringCopy((StringPtr)"\pInstant Replay", (StringPtr)theTitle); MoveTo(kReplayTitleLeft, kReplayTitleTop); DrawString(theTitle); DrawDefaultButton(theDialog, kButtReplayOkay); } /*======================================================== ReplayFilter */ pascal Boolean ReplayFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit) { switch (theEvent->what) { case keyDown: switch ((theEvent->message) & charCodeMask) { case kReturnKeyASCII: case kEnterKeyASCII: FlashDialogButton(theDialog, kButtReplayOkay); *itemHit = kButtReplayOkay; return(TRUE); break; default: return(FALSE); } break; case updateEvt: BeginUpdate((GrafPtr)theDialog); UpdateReplayDialog(theDialog); EndUpdate((GrafPtr)theDialog); theEvent->what = nullEvent; return(FALSE); break; default: return(FALSE); break; } } /*======================================================== ConfigureInstantReplay */ Boolean ConfigureInstantReplay (void) { DialogPtr replayDialog; Handle iHandle; Rect iRect; short itemHit, iType; Boolean leaveDialog, userOkayed, wasState; CenterDialog(rReplayDialogID); if (doZooms) ZoomOutDialogRect(rReplayDialogID); replayDialog = GetNewDialog(rReplayDialogID, kNilPointer, kPutInFront); SetPort((GrafPtr)replayDialog); ShowWindow((GrafPtr)replayDialog); UpdateReplayDialog(replayDialog); GetDItem(replayDialog, kCheckGoals, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)replayGoals); GetDItem(replayDialog, kCheckFouls, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)replayFouls); GetDItem(replayDialog, kCheckOnR, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)replayOnR); GetDItem(replayDialog, kCheckReplayZooms, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)replayZooms); leaveDialog = FALSE; while (!leaveDialog) { ModalDialog(ReplayFilter, &itemHit); switch (itemHit) { case kButtReplayOkay: GetDItem(replayDialog, kCheckGoals, &iType, &iHandle, &iRect); replayGoals = (Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(replayDialog, kCheckFouls, &iType, &iHandle, &iRect); replayFouls = (Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(replayDialog, kCheckOnR, &iType, &iHandle, &iRect); replayOnR = (Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(replayDialog, kCheckReplayZooms, &iType, &iHandle, &iRect); replayZooms = (Boolean)GetCtlValue((ControlHandle)iHandle); replaySomething = replayGoals || replayFouls || replayOnR; userOkayed = TRUE; leaveDialog = TRUE; break; case kButtReplayCancel: userOkayed = FALSE; leaveDialog = TRUE; break; case kCheckGoals: case kCheckFouls: case kCheckOnR: case kCheckReplayZooms: GetDItem(replayDialog, itemHit, &iType, &iHandle, &iRect); wasState = (Boolean)GetCtlValue((ControlHandle)iHandle); wasState = !wasState; SetCtlValue((ControlHandle)iHandle, (short)wasState); break; default: break; } } DisposDialog(replayDialog); return (userOkayed); } /*======================================================== UpdateNamesDialog */ void UpdateNamesDialog (DialogPtr theDialog) { PicHandle thePict; Str255 theTitle; Handle iHandle; Rect iRect; short iType; DrawDialog(theDialog); GetDItem(theDialog, kUserBalloonNames, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kBalloon4PictID); else thePict = GetPicture(kBalloon1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetIndString(theTitle, rMiscStrings, 3); if (theTitle[0] == 0) PasStringCopy((StringPtr)"\pEdit Names", (StringPtr)theTitle); MoveTo(kNamesTitleLeft, kNamesTitleTop); DrawString(theTitle); DrawDefaultButton(theDialog, kButtNamesOkay); } /*======================================================== EditNameFilter */ pascal Boolean EditNameFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit) { switch (theEvent->what) { case keyDown: switch ((theEvent->message) & charCodeMask) { case kReturnKeyASCII: case kEnterKeyASCII: FlashDialogButton(theDialog, kButtNamesOkay); *itemHit = kButtNamesOkay; return(TRUE); break; default: return(FALSE); } break; case updateEvt: BeginUpdate((GrafPtr)theDialog); UpdateNamesDialog(theDialog); EndUpdate((GrafPtr)theDialog); theEvent->what = nullEvent; return(FALSE); break; default: return(FALSE); break; } } /*======================================================== ConfigureNames */ Boolean ConfigureNames (void) { DialogPtr namesDialog; Handle iHandle; Rect iRect; Str255 tempStr; short itemHit, iType, i, blewIt; Boolean leaveDialog, userOkayed; CenterDialog(rNamesDialogID); if (doZooms) ZoomOutDialogRect(rNamesDialogID); namesDialog = GetNewDialog(rNamesDialogID, kNilPointer, kPutInFront); SetPort((GrafPtr)namesDialog); ShowWindow((GrafPtr)namesDialog); UpdateNamesDialog(namesDialog); for (i = 0; i < 10; i++) { GetDItem(namesDialog, kEditFirstName + i, &iType, &iHandle, &iRect); SetIText(iHandle, (StringPtr)theNames[i]); } SelIText(namesDialog, kEditFirstName + whichHumanNumber - 1, 0, 32767); leaveDialog = FALSE; while (!leaveDialog) { ModalDialog(EditNameFilter, &itemHit); switch (itemHit) { case kButtNamesOkay: blewIt = -1; for (i = 0; i < 10; i++) { GetDItem(namesDialog, kEditFirstName + i, &iType, &iHandle, &iRect); GetIText(iHandle, tempStr); if (tempStr[0] > 31) blewIt = i; } if (blewIt == -1) { for (i = 0; i < 10; i++) { GetDItem(namesDialog, kEditFirstName + i, &iType, &iHandle, &iRect); GetIText(iHandle, (StringPtr)theNames[i]); } userOkayed = TRUE; leaveDialog = TRUE; } else { SysBeep(20); SelIText(namesDialog, kEditFirstName + blewIt, 0, 32767); } break; case kButtNamesCancel: userOkayed = FALSE; leaveDialog = TRUE; break; default: break; } } DisposDialog(namesDialog); return (userOkayed); } /*======================================================== UpdatePrefsDialog */ void UpdatePrefsDialog (DialogPtr theDialog) { PicHandle thePict; Str255 theTitle; Handle iHandle; Rect iRect; short iType; DrawDialog(theDialog); GetDItem(theDialog, kUserBalloonPrefs, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kBalloon4PictID); else thePict = GetPicture(kBalloon1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetIndString(theTitle, rMiscStrings, 2); if (theTitle[0] == 0) PasStringCopy((StringPtr)"\pPreferences", (StringPtr)theTitle); MoveTo(kPrefsTitleLeft, kPrefsTitleTop); DrawString(theTitle); DrawDefaultButton(theDialog, kButtPrefsOkay); } /*======================================================== PrefsFilter */ pascal Boolean PrefsFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit) { switch (theEvent->what) { case keyDown: switch ((theEvent->message) & charCodeMask) { case kReturnKeyASCII: case kEnterKeyASCII: FlashDialogButton(theDialog, kButtPrefsOkay); *itemHit = kButtPrefsOkay; return(TRUE); break; default: return(FALSE); } break; case updateEvt: BeginUpdate((GrafPtr)theDialog); UpdatePrefsDialog(theDialog); EndUpdate((GrafPtr)theDialog); theEvent->what = nullEvent; return(FALSE); break; default: return(FALSE); break; } } /*======================================================== ConfigurePreferences */ Boolean ConfigurePreferences (void) { DialogPtr prefsDialog; Handle iHandle; Rect iRect; short itemHit, iType; Boolean leaveDialog, userOkayed, wasState; CenterDialog(rPrefsDialogID); if (doZooms) ZoomOutDialogRect(rPrefsDialogID); prefsDialog = GetNewDialog(rPrefsDialogID, kNilPointer, kPutInFront); SetPort((GrafPtr)prefsDialog); ShowWindow((GrafPtr)prefsDialog); UpdatePrefsDialog(prefsDialog); GetDItem(prefsDialog, kCheckUseQD, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)willUseQD); GetDItem(prefsDialog, kCheckCursor, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)showBoardCursor); GetDItem(prefsDialog, kCheckDepth, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)autoSetDepth); if (!thisMac.hasColor) HiliteControl((ControlHandle)iHandle, kInactive); GetDItem(prefsDialog, kCheckAnnouncer, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)(!enableAnnouncer)); if (soundFileRefNum == -1) HiliteControl((ControlHandle)iHandle, kInactive); GetDItem(prefsDialog, kCheckBackground, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)(enableBackground)); GetDItem(prefsDialog, kCheckZooms, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)(doZooms)); GetDItem(prefsDialog, kCheckSkip, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)(doSkipFrames)); leaveDialog = FALSE; while (!leaveDialog) { ModalDialog(PrefsFilter, &itemHit); switch (itemHit) { case kButtPrefsOkay: GetDItem(prefsDialog, kCheckUseQD, &iType, &iHandle, &iRect); willUseQD = (Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(prefsDialog, kCheckCursor, &iType, &iHandle, &iRect); showBoardCursor = (Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(prefsDialog, kCheckDepth, &iType, &iHandle, &iRect); autoSetDepth = (Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(prefsDialog, kCheckAnnouncer, &iType, &iHandle, &iRect); enableAnnouncer = !(Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(prefsDialog, kCheckBackground, &iType, &iHandle, &iRect); enableBackground = (Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(prefsDialog, kCheckZooms, &iType, &iHandle, &iRect); doZooms = (Boolean)GetCtlValue((ControlHandle)iHandle); GetDItem(prefsDialog, kCheckSkip, &iType, &iHandle, &iRect); doSkipFrames = (Boolean)GetCtlValue((ControlHandle)iHandle); userOkayed = TRUE; leaveDialog = TRUE; break; case kButtPrefsCancel: userOkayed = FALSE; leaveDialog = TRUE; break; case kCheckUseQD: case kCheckCursor: case kCheckDepth: case kCheckAnnouncer: case kCheckBackground: case kCheckZooms: case kCheckSkip: GetDItem(prefsDialog, itemHit, &iType, &iHandle, &iRect); wasState = (Boolean)GetCtlValue((ControlHandle)iHandle); wasState = !wasState; SetCtlValue((ControlHandle)iHandle, (short)wasState); break; default: break; } } DisposDialog(prefsDialog); return (userOkayed); } /*======================================================== UpdateRecordsDialog */ void UpdateRecordsDialog (DialogPtr theDialog) { PicHandle thePict; Str255 theTitle; Handle iHandle; Rect iRect; short iType, i; DrawDialog(theDialog); GetDItem(theDialog, kUserBalloonRecords, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kBalloon4PictID); else thePict = GetPicture(kBalloon1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetIndString(theTitle, rMiscStrings, 7); if (theTitle[0] == 0) PasStringCopy((StringPtr)"\pWorld Records", (StringPtr)theTitle); MoveTo(kRecordsTitleLeft, kRecordsTitleTop); DrawString(theTitle); DrawDefaultButton(theDialog, kButtRecordsOkay); ForeColor(cyanColor); for (i = kUserFirstFrameRecords; i <= kUserLastFrameRecords; i++) { GetDItem(theDialog, i, &iType, &iHandle, &iRect); FrameRect(&iRect); } ForeColor(blackColor); } /*======================================================== RecordsFilter */ pascal Boolean RecordsFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit) { switch (theEvent->what) { case keyDown: switch ((theEvent->message) & charCodeMask) { case kReturnKeyASCII: case kEnterKeyASCII: FlashDialogButton(theDialog, kButtRecordsOkay); *itemHit = kButtRecordsOkay; return(TRUE); break; default: return(FALSE); } break; case updateEvt: BeginUpdate((GrafPtr)theDialog); UpdateRecordsDialog(theDialog); EndUpdate((GrafPtr)theDialog); theEvent->what = nullEvent; return(FALSE); break; default: return(FALSE); break; } } /*======================================================== DisplayRecords */ Boolean DisplayRecords (void) { DialogPtr recordsDialog; Handle iHandle; Rect iRect; Str255 theDate; short itemHit, iType, i; Boolean leaveDialog, userOkayed; CenterDialog(rRecordsDialogID); if (doZooms) ZoomOutDialogRect(rRecordsDialogID); recordsDialog = GetNewDialog(rRecordsDialogID, kNilPointer, kPutInFront); SetPort((GrafPtr)recordsDialog); ShowWindow((GrafPtr)recordsDialog); UpdateRecordsDialog(recordsDialog); ForeColor(blueColor); SetDialogString (recordsDialog, kNameRecordsTitles, (StringPtr)mostTitlesName); SetDialogString (recordsDialog, kNameRecordsPoints, (StringPtr)mostPointsName); SetDialogString (recordsDialog, kNameRecordsFouls, (StringPtr)mostFoulsName); SetDialogString (recordsDialog, kNameRecordsCrits, (StringPtr)mostCritsName); SetDialogNumToStr (recordsDialog, kAmountRecordsTitles, (long)mostTitles); SetDialogNumToStr (recordsDialog, kAmountRecordsPoints, (long)mostPoints); SetDialogNumToStr (recordsDialog, kAmountRecordsFouls, (long)mostFouls); SetDialogNumToStr (recordsDialog, kAmountRecordsCrits, (long)mostCrits); USSecsToDateString(mostTitlesDate, theDate); SetDialogString (recordsDialog, kDateRecordsTitles, theDate); USSecsToDateString(mostPointsDate, theDate); SetDialogString (recordsDialog, kDateRecordsPoints, theDate); USSecsToDateString(mostFoulsDate, theDate); SetDialogString (recordsDialog, kDateRecordsFouls, theDate); USSecsToDateString(mostCritsDate, theDate); SetDialogString (recordsDialog, kDateRecordsCrits, theDate); ForeColor(blackColor); leaveDialog = FALSE; while (!leaveDialog) { ModalDialog(RecordsFilter, &itemHit); switch (itemHit) { case kButtRecordsOkay: userOkayed = TRUE; leaveDialog = TRUE; break; case kUserHiddenReset: ResetWorldRecords(); break; default: break; } } DisposDialog(recordsDialog); return (userOkayed); } /*======================================================== UpdateMemoryDialog */ void UpdateMemoryDialog (DialogPtr theDialog) { PicHandle thePict; Str255 theTitle; Handle iHandle; Rect iRect; short iType; DrawDialog(theDialog); GetDItem(theDialog, kUserBalloonMemory, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kBalloon4PictID); else thePict = GetPicture(kBalloon1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetIndString(theTitle, rMiscStrings, 10); if (theTitle[0] == 0) PasStringCopy((StringPtr)"\pMemory Info", (StringPtr)theTitle); MoveTo(kMemoryTitleLeft, kMemoryTitleTop); DrawString(theTitle); DrawDefaultButton(theDialog, kButtMemoryOkay); } /*======================================================== MemoryFilter */ pascal Boolean MemoryFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit) { switch (theEvent->what) { case keyDown: switch ((theEvent->message) & charCodeMask) { case kReturnKeyASCII: case kEnterKeyASCII: FlashDialogButton(theDialog, kButtMemoryOkay); *itemHit = kButtMemoryOkay; return(TRUE); break; default: return(FALSE); } break; case updateEvt: BeginUpdate((GrafPtr)theDialog); UpdateMemoryDialog(theDialog); EndUpdate((GrafPtr)theDialog); theEvent->what = nullEvent; return(FALSE); break; default: return(FALSE); break; } } /*======================================================== DisplayMemory */ Boolean DisplayMemory (void) { DialogPtr memoryDialog; Handle iHandle; Rect iRect; Str255 aString; long freeMemory; short itemHit, iType, i, lastPrimarySound, lastIncidentalSound; Boolean leaveDialog, userOkayed, showTime; showTime = OptionKeyIsDown(); CenterDialog(rMemoryDialogID); if (doZooms) ZoomOutDialogRect(rMemoryDialogID); memoryDialog = GetNewDialog(rMemoryDialogID, kNilPointer, kPutInFront); SetPort((GrafPtr)memoryDialog); ShowWindow((GrafPtr)memoryDialog); UpdateMemoryDialog(memoryDialog); lastPrimarySound = 0; for (i = 1; i < kMaxNumberOfSounds; i++) { if (soundLoaded[i] == TRUE) lastPrimarySound = i; } lastIncidentalSound = 0; for (i = 0; i < kMaxIncidentalSounds; i++) { if (incidentSoundLoaded[i] == TRUE) lastIncidentalSound = i + 1; } freeMemory = FreeMem() / 1024L; ForeColor(blueColor); SetDialogNumToStr (memoryDialog, kTextPrimarySounds, (long)lastPrimarySound); SetDialogNumToStr (memoryDialog, kTextIncidentalSounds, (long)lastIncidentalSound); SetDialogNumToStr (memoryDialog, kTextFreeMemory, (long)freeMemory); ForeColor(blackColor); if (showTime) { MoveTo(16, 160); NumToString((lifeTime / 3600), aString); DrawString(aString); } leaveDialog = FALSE; while (!leaveDialog) { ModalDialog(MemoryFilter, &itemHit); switch (itemHit) { case kButtMemoryOkay: userOkayed = TRUE; leaveDialog = TRUE; break; default: break; } } DisposDialog(memoryDialog); return (userOkayed); } /*======================================================== UpdateLeagueDialog */ void UpdateLeagueDialog (DialogPtr theDialog) { PicHandle thePict; Str255 theTitle; Handle iHandle; Rect iRect; short iType; DrawDialog(theDialog); GetDItem(theDialog, kUserBalloonLeague, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kBalloon4PictID); else thePict = GetPicture(kBalloon1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetIndString(theTitle, rMiscStrings, 12); if (theTitle[0] == 0) PasStringCopy((StringPtr)"\pSelect League", (StringPtr)theTitle); MoveTo(kLeagueTitleLeft, kLeagueTitleTop); DrawString(theTitle); DrawDefaultButton(theDialog, kButtLeagueOkay); } /*======================================================== LeagueFilter */ pascal Boolean LeagueFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit) { switch (theEvent->what) { case keyDown: switch ((theEvent->message) & charCodeMask) { case kReturnKeyASCII: case kEnterKeyASCII: FlashDialogButton(theDialog, kButtLeagueOkay); *itemHit = kButtLeagueOkay; return(TRUE); break; default: return(FALSE); } break; case updateEvt: BeginUpdate((GrafPtr)theDialog); UpdateLeagueDialog(theDialog); EndUpdate((GrafPtr)theDialog); theEvent->what = nullEvent; return(FALSE); break; default: return(FALSE); break; } } /*======================================================== ConfigureLeague */ Boolean ConfigureLeague (void) { DialogPtr leagueDialog; Handle iHandle; Rect iRect; short itemHit, iType, tempLeague; Boolean leaveDialog, userOkayed; CenterDialog(rLeagueDialogID); if (doZooms) ZoomOutDialogRect(rLeagueDialogID); leagueDialog = GetNewDialog(rLeagueDialogID, kNilPointer, kPutInFront); SetPort((GrafPtr)leagueDialog); ShowWindow((GrafPtr)leagueDialog); UpdateLeagueDialog(leagueDialog); tempLeague = isLeague; #if kDemoVersion tempLeague = kLittleLeague; DisableControl(leagueDialog, kRadioJrVarsity); DisableControl(leagueDialog, kRadioVarsity); DisableControl(leagueDialog, kRadioMinorLeague); DisableControl(leagueDialog, kRadioProfessional); #endif SelectFromRadioGroup (leagueDialog, tempLeague + kRadioLittleLeague, kRadioLittleLeague, kRadioProfessional); leaveDialog = FALSE; while (!leaveDialog) { ModalDialog(LeagueFilter, &itemHit); switch (itemHit) { case kButtLeagueOkay: if (isLeague != tempLeague) { userOkayed = TRUE; isLeague = tempLeague; #if kDemoVersion isLeague = kLittleLeague; #endif } else { userOkayed = FALSE; } leaveDialog = TRUE; break; case kButtLeagueCancel: userOkayed = FALSE; leaveDialog = TRUE; break; case kRadioLittleLeague: case kRadioJrVarsity: case kRadioVarsity: case kRadioMinorLeague: case kRadioProfessional: tempLeague = itemHit - kRadioLittleLeague; SelectFromRadioGroup (leagueDialog, itemHit, kRadioLittleLeague, kRadioProfessional); break; default: break; } } DisposDialog(leagueDialog); return (userOkayed); } /*======================================================== ConvertPararena */ Boolean ConvertPararena (void) { #define rConvertParaALRT 1012 Str255 theText; short sheWants; Boolean doOrDont, wereLegit; if (netOnly) GetIndString(theText, rMiscStrings, 21); else GetIndString(theText, rMiscStrings, 22); if (theText[0] != 0) ParamText(theText, "\p", "\p", "\p"); CenterAlert(rConvertParaALRT); sheWants = Alert(rConvertParaALRT, kNilPointer); if (sheWants == 1) { doOrDont = FALSE; } else { doOrDont = TRUE; if (netOnly) { wereLegit = ValidInstallation(FALSE); if (wereLegit) { netOnly = FALSE; if (!canNetwork) { thePlayer.persona = kHumanPlayer; theOpponent.persona = kMissTeak; leftPlayerNumber = kHumanPlayer; rightPlayerNumber = theOpponent.persona; MinorError(kMinorCantNetDefault); } } else { thePlayer.persona = kHumanPlayer; theOpponent.persona = kNetHuman; leftPlayerNumber = kHumanPlayer; rightPlayerNumber = theOpponent.persona; whichGame = kStandardGame; encryptedNumber = 0L; netOnly = TRUE; } } else { if (!canNetwork) MinorError(kMinorCantNetAndNetOnly); thePlayer.persona = kHumanPlayer; theOpponent.persona = kNetHuman; leftPlayerNumber = kHumanPlayer; rightPlayerNumber = theOpponent.persona; whichGame = kStandardGame; encryptedNumber = 0L; netOnly = TRUE; } } return (doOrDont); } \ No newline at end of file diff --git a/Sources/InitGameStructs.c b/Sources/InitGameStructs.c new file mode 100755 index 0000000..7b7a226 --- /dev/null +++ b/Sources/InitGameStructs.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Initialize Game Structures ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "InitGameStructs.h" #include "Prefs.h" #include #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; } } \ No newline at end of file diff --git a/Sources/Initialize.c b/Sources/Initialize.c new file mode 100755 index 0000000..1eb5f6d --- /dev/null +++ b/Sources/Initialize.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Initialization Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "UnivUtilities.h" #include "Globals.h" #include "AppleTalkDDP.h" #include "Initialize.h" #include "AnimCursor.h" #include "MainWindow.h" #include #include "Render.h" #include "Environ.h" #include "InitGameStructs.h" #include "TeamSetUp.h" #include "Menu.h" #include "ValidInstall.h" /*======================================================== ToolBoxInit */ void ToolBoxInit (void) { short count; InitGraf(&thePort); InitFonts(); FlushEvents(everyEvent, kRemoveAllEvents); InitWindows(); InitMenus(); TEInit(); InitDialogs(kNilPointer); InitCursor(); MaxApplZone(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); MoreMasters(); for (count = 1; count <= 3; count++) EventAvail(everyEvent, &theEvent); inBackground = FALSE; } /*======================================================== BitMapInit */ void BitMapInit (void) { PicHandle thePict; short mapWidth, mapHeight; SpinCursor(7); /* Set up offscreen bit map for various game objects */ offPartsPtr = (GrafPtr)(NewPtr(sizeof(GrafPort))); OpenPort(offPartsPtr); mapWidth = 400; mapHeight = 264; SetRect(&offPartsRect, 0, 0, mapWidth, mapHeight); partsRowBytes = ((offPartsRect.right - offPartsRect.left + 15) / 16) * 2; offPartsBits.rowBytes = partsRowBytes; offPartsBits.bounds = offPartsRect; offPartsBits.baseAddr = NewPtr((long)offPartsBits.rowBytes * (offPartsRect.bottom - offPartsRect.top)); if (offPartsBits.baseAddr == kNilPointer) DeathError(kErrNoMemory); if (MemError() != noErr) DeathError(kErrNoMemory); SetPortBits(&offPartsBits); ClipRect(&offPartsRect); EraseRect(&offPartsRect); thePict = GetPicture(rPartsPict1BitID); if (thePict != kNilPointer) { DrawPicture(thePict, &offPartsRect); ReleaseResource((Handle)thePict); } else DeathError(kErrNoPictRsrc); /* Set up offscreen bit map for preloading assembled graphics */ offWorkPtr = (GrafPtr)(NewPtr(sizeof(GrafPort))); OpenPort(offWorkPtr); mapWidth = screenWide; mapHeight = screenHigh; SetRect(&offWorkRect, 0, 0, mapWidth, mapHeight); workRowBytes = ((offWorkRect.right - offWorkRect.left + 15) / 16) * 2; offWorkBits.rowBytes = workRowBytes; offWorkBits.bounds = offWorkRect; offWorkBits.baseAddr = NewPtr((long)offWorkBits.rowBytes * (offWorkRect.bottom - offWorkRect.top)); if (offWorkBits.baseAddr == kNilPointer) DeathError(kErrNoMemory); if (MemError() != noErr) DeathError(kErrNoMemory); SetPortBits(&offWorkBits); ClipRect(&offWorkRect); EraseRect(&offWorkRect); /* Set up offscreen bit map for a virgin copy of background */ offBackPtr = (GrafPtr)(NewPtr(sizeof(GrafPort))); OpenPort(offBackPtr); mapWidth = screenWide; mapHeight = screenHigh; SetRect(&offBackRect, 0, 0, mapWidth, mapHeight); backRowBytes = ((offBackRect.right - offBackRect.left + 15) / 16) * 2; offBackBits.rowBytes = backRowBytes; offBackBits.bounds = offBackRect; offBackBits.baseAddr = NewPtr((long)offBackBits.rowBytes * (offBackRect.bottom - offBackRect.top)); if (offBackBits.baseAddr == kNilPointer) DeathError(kErrNoMemory); if (MemError() != noErr) DeathError(kErrNoMemory); SetPortBits(&offBackBits); ClipRect(&offBackRect); EraseRect(&offBackRect); LoadBackgroundPict(); CopyBits(&offBackBits, &offWorkBits, &offBackRect, &offBackRect, srcCopy, nil); CopyBits(&offBackBits, &offPartsBits, &rightArrowDest, &rightArrowStorage, srcCopy, nil); CopyBits(&offBackBits, &offPartsBits, &leftArrowDest, &leftArrowStorage, srcCopy, nil); } /*======================================================== PixMapInit */ void PixMap4Init (void) { GDHandle thisGDevice; CTabHandle thisCMHandle; PicHandle thePict; Rect pictRect; long sizeOfOff; OSErr theErr; short theDepth, mapWidth, mapHeight; SpinCursor(7); thisGDevice = GetMainDevice(); offCPartsPtr = &offCPartsPort; /* set up parts port */ OpenCPort(offCPartsPtr); theDepth = 4; mapWidth = 400; mapHeight = 264; SetRect (&offPartsRect, 0, 0, mapWidth, mapHeight); partsRowBytes = (((theDepth * mapWidth) + 15) >> 4) << 1; sizeOfOff = (long)mapHeight * (long)partsRowBytes; offPartsPix = NewPtr(sizeOfOff); if (offPartsPix == kNilPointer) { DeathError(kErrNoMemory); } (**(*offCPartsPtr).portPixMap).baseAddr = offPartsPix; (**(*offCPartsPtr).portPixMap).rowBytes = (short)partsRowBytes + 0x8000; (**(*offCPartsPtr).portPixMap).bounds = offPartsRect; SetPort((GrafPtr)offCPartsPtr); ClipRect(&offPartsRect); thisCMHandle = (**(**thisGDevice).gdPMap).pmTable; theErr = HandToHand((Handle *)&thisCMHandle); if (theErr != noErr) DeathError(kErrNoMemory); (**(*offCPartsPtr).portPixMap).pmTable = thisCMHandle; PmForeColor(kBlackColor4Bit); PmBackColor(kWhiteColor4Bit); thePict = GetPicture(rPartsPict4BitID); if (thePict != kNilPointer) { DrawPicture(thePict, &offPartsRect); ReleaseResource((Handle)thePict); } else DeathError(kErrNoPictRsrc); /* set up work port for pre-graphics */ offCWorkPtr = &offCWorkPort; OpenCPort(offCWorkPtr); theDepth = 4; mapWidth = screenWide; mapHeight = screenHigh; SetRect (&offWorkRect, 0, 0, mapWidth, mapHeight); workRowBytes = (((theDepth * mapWidth) + 15) >> 4) << 1; sizeOfOff = (long)mapHeight * (long)workRowBytes; offWorkPix = NewPtr(sizeOfOff); if (offWorkPix == kNilPointer) { DeathError(kErrNoMemory); } (**(*offCWorkPtr).portPixMap).baseAddr = offWorkPix; (**(*offCWorkPtr).portPixMap).rowBytes = workRowBytes + 0x8000; (**(*offCWorkPtr).portPixMap).bounds = offWorkRect; SetPort((GrafPtr)offCWorkPtr); ClipRect(&offWorkRect); thisCMHandle = (**(**thisGDevice).gdPMap).pmTable; theErr = HandToHand((Handle *)&thisCMHandle); if (theErr != noErr) DeathError(kErrNoMemory); (**(*offCPartsPtr).portPixMap).pmTable = thisCMHandle; PmForeColor(kBlackColor4Bit); PmBackColor(kWhiteColor4Bit); /* set up background port */ offCBackPtr = &offCBackPort; OpenCPort(offCBackPtr); theDepth = 4; mapWidth = screenWide; mapHeight = screenHigh; SetRect (&offBackRect, 0, 0, mapWidth, mapHeight); backRowBytes = (((theDepth * mapWidth) + 15) >> 4) << 1; sizeOfOff = (long)mapHeight * (long)backRowBytes; offBackPix = NewPtr(sizeOfOff); if (offBackPix == kNilPointer) { DeathError(kErrNoMemory); } (**(*offCBackPtr).portPixMap).baseAddr = offBackPix; (**(*offCBackPtr).portPixMap).rowBytes = backRowBytes + 0x8000; (**(*offCBackPtr).portPixMap).bounds = offBackRect; SetPort((GrafPtr)offCBackPtr); ClipRect(&offBackRect); thisCMHandle = (**(**thisGDevice).gdPMap).pmTable; theErr = HandToHand((Handle *)&thisCMHandle); if (theErr != noErr) DeathError(kErrNoMemory); (**(*offCPartsPtr).portPixMap).pmTable = thisCMHandle; PmForeColor(kBlackColor4Bit); PmBackColor(kWhiteColor4Bit); LoadBackgroundPict(); CopyBits(&((GrafPtr)offCBackPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &offBackRect, &offBackRect, srcCopy, nil); CopyBits(&((GrafPtr)offCBackPtr)->portBits, &((GrafPtr)offCPartsPtr)->portBits, &rightArrowDest, &rightArrowStorage, srcCopy, nil); CopyBits(&((GrafPtr)offCBackPtr)->portBits, &((GrafPtr)offCPartsPtr)->portBits, &leftArrowDest, &leftArrowStorage, srcCopy, nil); } /*======================================================== MaskMapInit */ void MaskMapInit (void) { PicHandle thePict; short mapWidth, mapHeight; SpinCursor(7); offMaskPtr = (GrafPtr)(NewPtr(sizeof(GrafPort))); OpenPort(offMaskPtr); mapWidth = 320; mapHeight = 264; SetRect(&offMaskRect, 0, 0, mapWidth, mapHeight); maskRowBytes = ((offMaskRect.right - offMaskRect.left + 15) / 16) * 2; offMaskMap.rowBytes = maskRowBytes; offMaskMap.baseAddr = NewPtr((long)offMaskMap.rowBytes * (offMaskRect.bottom - offMaskRect.top)); if (offMaskMap.baseAddr == kNilPointer) DeathError(kErrNoMemory); offMaskMap.bounds = offMaskRect; if (MemError() != noErr) DeathError(kErrNoMemory); SetPortBits(&offMaskMap); ClipRect(&offMaskRect); EraseRect(&offMaskRect); if (isColor) thePict = GetPicture(rMaskPict48ID); else thePict = GetPicture(rMaskPict1ID); if (thePict != kNilPointer) { DrawPicture(thePict, &offMaskRect); ReleaseResource((Handle)thePict); } else DeathError(kErrNoPictRsrc); } /*======================================================== MaskPixInit */ void MaskPixInit (void) { GDHandle thisGDevice; CTabHandle thisCMHandle; PicHandle thePict; Rect pictRect; long sizeOfOff; OSErr theErr; short theDepth, mapWidth, mapHeight; thisGDevice = GetMainDevice(); offCMaskPtr = &offCMaskPort; /* set up Mask port */ OpenCPort(offCMaskPtr); theDepth = 4; mapWidth = 320; mapHeight = 264; SetRect (&offMaskRect, 0, 0, mapWidth, mapHeight); maskCRowBytes = (((theDepth * mapWidth) + 15) >> 4) << 1; sizeOfOff = (long)mapHeight * (long)maskCRowBytes; offMaskPix = NewPtr(sizeOfOff); if (offMaskPix == kNilPointer) { DeathError(kErrNoMemory); } (**(*offCMaskPtr).portPixMap).baseAddr = offMaskPix; (**(*offCMaskPtr).portPixMap).rowBytes = (short)maskCRowBytes + 0x8000; (**(*offCMaskPtr).portPixMap).bounds = offMaskRect; SetPort((GrafPtr)offCMaskPtr); ClipRect(&offMaskRect); thisCMHandle = (**(**thisGDevice).gdPMap).pmTable; theErr = HandToHand((Handle *)&thisCMHandle); if (theErr != noErr) DeathError(kErrNoMemory); (**(*offCPartsPtr).portPixMap).pmTable = thisCMHandle; PmForeColor(kBlackColor4Bit); PmBackColor(kWhiteColor4Bit); if (isColor) thePict = GetPicture(rMaskPict48ID); else thePict = GetPicture(rMaskPict1ID); if (thePict != kNilPointer) { DrawPicture(thePict, &offMaskRect); ReleaseResource((Handle)thePict); } else DeathError(kErrNoPictRsrc); } /*======================================================== GetBaseAddressC */ void GetBaseAddressC (void) { GDHandle theDevice; PixMapHandle pixMapH; long insetHPix, insetVPix; short i; theDevice = GetMainDevice(); pixMapH = (**theDevice).gdPMap; screenBase = (long)((**pixMapH).baseAddr); screenRowBytes = (**pixMapH).rowBytes & 0x7FFF; insetHPix = (long)(screenBits.bounds.right - screenBits.bounds.left - screenWide) / 2L; insetVPix = (long)(screenBits.bounds.bottom - screenBits.bounds.top - screenHigh) / 2L; insetBytes = (insetVPix * (long)screenRowBytes) + (insetHPix * (long)isDepth / 8L); for (i = 0; i < 480; i++) screenRowAddrs[i] = ((long)screenRowBytes * (long)i) + screenBase + (long)insetBytes; for (i = 0; i < 480; i++) workRowOffsets[i] = (long)workRowBytes * (long)i; theDoor.srcAddrs[0][0] = ((long)theDoor.srcRects[0][0].top * partsRowBytes) + ((long)theDoor.srcRects[0][0].left * (long)isDepth / 8L) + (long)offPartsPix; theDoor.srcAddrs[0][1] = ((long)theDoor.srcRects[0][1].top * partsRowBytes) + ((long)theDoor.srcRects[0][1].left * (long)isDepth / 8L) + (long)offPartsPix; theDoor.srcAddrs[1][0] = ((long)theDoor.srcRects[1][0].top * partsRowBytes) + ((long)theDoor.srcRects[1][0].left * (long)isDepth / 8L) + (long)offPartsPix; theDoor.srcAddrs[1][1] = ((long)theDoor.srcRects[1][1].top * partsRowBytes) + ((long)theDoor.srcRects[1][1].left * (long)isDepth / 8L) + (long)offPartsPix; theDoor.screenDestAddr[0] = ((long)theDoor.destRects[0].top * (long)screenRowBytes) + ((long)theDoor.destRects[0].left * (long)isDepth / 8L) + screenBase + insetBytes; theDoor.screenDestAddr[1] = ((long)theDoor.destRects[1].top * (long)screenRowBytes) + ((long)theDoor.destRects[1].left * (long)isDepth / 8L) + screenBase + insetBytes; theDoor.workDestAddr[0] = ((long)theDoor.destRects[0].top * workRowBytes) + ((long)theDoor.destRects[0].left * (long)isDepth / 8L) + (long)offWorkPix; theDoor.workDestAddr[1] = ((long)theDoor.destRects[1].top * workRowBytes) + ((long)theDoor.destRects[1].left * (long)isDepth / 8L) + (long)offWorkPix; theDoor.backDestAddr[0] = ((long)theDoor.destRects[0].top * backRowBytes) + ((long)theDoor.destRects[0].left * (long)isDepth / 8L) + (long)offBackPix; theDoor.backDestAddr[1] = ((long)theDoor.destRects[1].top * backRowBytes) + ((long)theDoor.destRects[1].left * (long)isDepth / 8L) + (long)offBackPix; for (i = 0; i < 9; i++) { playerSrcAddrs[i][0] = ((long)playerSrcRects[i][0].top * partsRowBytes) + ((long)playerSrcRects[i][0].left * (long)isDepth / 8L) + (long)offPartsPix; playerSrcAddrs[i][1] = ((long)playerSrcRects[i][1].top * partsRowBytes) + ((long)playerSrcRects[i][1].left * (long)isDepth / 8L) + (long)offPartsPix; playerSrcAddrs[i][2] = ((long)playerSrcRects[i][2].top * partsRowBytes) + ((long)playerSrcRects[i][2].left * (long)isDepth / 8L) + (long)offPartsPix; maskAddrs[i][0] = ((long)playerSrcRects[i][0].top * maskCRowBytes) + ((long)playerSrcRects[i][0].left * (long)isDepth / 8L) + (long)offMaskPix; maskAddrs[i][1] = ((long)playerSrcRects[i][1].top * maskCRowBytes) + ((long)playerSrcRects[i][1].left * (long)isDepth / 8L) + (long)offMaskPix; maskAddrs[i][2] = ((long)playerSrcRects[i][2].top * maskCRowBytes) + ((long)playerSrcRects[i][2].left * (long)isDepth / 8L) + (long)offMaskPix; opponentSrcAddrs[i][0] = ((long)opponentSrcRects[i][0].top * partsRowBytes) + ((long)opponentSrcRects[i][0].left * (long)isDepth / 8L) + (long)offPartsPix; opponentSrcAddrs[i][1] = ((long)opponentSrcRects[i][1].top * partsRowBytes) + ((long)opponentSrcRects[i][1].left * (long)isDepth / 8L) + (long)offPartsPix; opponentSrcAddrs[i][2] = ((long)opponentSrcRects[i][2].top * partsRowBytes) + ((long)opponentSrcRects[i][2].left * (long)isDepth / 8L) + (long)offPartsPix; fadeMaskAddrs[i][0] = ((long)fadeMaskRects[i][0].top * maskCRowBytes) + ((long)fadeMaskRects[i][0].left * (long)isDepth / 8L) + (long)offMaskPix; fadeMaskAddrs[i][1] = ((long)fadeMaskRects[i][1].top * maskCRowBytes) + ((long)fadeMaskRects[i][1].left * (long)isDepth / 8L) + (long)offMaskPix; fadeMaskAddrs[i][2] = ((long)fadeMaskRects[i][2].top * maskCRowBytes) + ((long)fadeMaskRects[i][2].left * (long)isDepth / 8L) + (long)offMaskPix; } ballSrcAddr = ((long)theBall.srcRect.top * partsRowBytes) + ((long)theBall.srcRect.left * (long)isDepth / 8L) + (long)offPartsPix; ballMaskAddr = ((long)theBall.srcRect.top * maskCRowBytes) + ((long)theBall.srcRect.left * (long)isDepth / 8L) + (long)offMaskPix; boardCursor.srcAddr = ((long)boardCursor.srcRect.top * partsRowBytes) + ((long)boardCursor.srcRect.left * (long)isDepth / 8L) + (long)offPartsPix; boardCursor.maskAddr = ((long)boardCursor.srcRect.top * maskCRowBytes) + ((long)boardCursor.srcRect.left * (long)isDepth / 8L) + (long)offMaskPix; replaySrc = ((long)replayRect.top * workRowBytes) + ((long)replayRect.left * (long)isDepth / 8L) + (long)offWorkPix; replayDest = ((long)replayRect.top * (long)screenRowBytes) + ((long)replayRect.left * (long)isDepth / 8L) + screenBase + insetBytes; } /*======================================================== GetBaseAddress1 */ void GetBaseAddress1 (void) { long insetHPix, insetVPix; short i; screenBase = (long)screenBits.baseAddr; screenRowBytes = screenBits.rowBytes; insetHPix = (long)(screenBits.bounds.right - screenBits.bounds.left - screenWide) / 2L; insetVPix = (long)(screenBits.bounds.bottom - screenBits.bounds.top - screenHigh) / 2L; insetBytes = (insetVPix * (long)screenRowBytes) + (insetHPix / 8L); for (i = 0; i < 480; i++) screenRowAddrs[i] = ((long)screenRowBytes * (long)i) + screenBase + (long)insetBytes; for (i = 0; i < 480; i++) workRowOffsets[i] = (long)workRowBytes * (long)i; theDoor.srcAddrs[0][0] = ((long)theDoor.srcRects[0][0].top * partsRowBytes) + ((long)theDoor.srcRects[0][0].left / 8L) + (long)offPartsBits.baseAddr; theDoor.srcAddrs[0][1] = ((long)theDoor.srcRects[0][1].top * partsRowBytes) + ((long)theDoor.srcRects[0][1].left / 8L) + (long)offPartsBits.baseAddr; theDoor.srcAddrs[1][0] = ((long)theDoor.srcRects[1][0].top * partsRowBytes) + ((long)theDoor.srcRects[1][0].left / 8L) + (long)offPartsBits.baseAddr; theDoor.srcAddrs[1][1] = ((long)theDoor.srcRects[1][1].top * partsRowBytes) + ((long)theDoor.srcRects[1][1].left / 8L) + (long)offPartsBits.baseAddr; theDoor.screenDestAddr[0] = ((long)theDoor.destRects[0].top * (long)screenRowBytes) + ((long)theDoor.destRects[0].left / 8L) + screenBase + insetBytes; theDoor.screenDestAddr[1] = ((long)theDoor.destRects[1].top * (long)screenRowBytes) + ((long)theDoor.destRects[1].left / 8L) + screenBase + insetBytes; theDoor.workDestAddr[0] = ((long)theDoor.destRects[0].top * workRowBytes) + ((long)theDoor.destRects[0].left / 8L) + (long)offWorkBits.baseAddr; theDoor.workDestAddr[1] = ((long)theDoor.destRects[1].top * workRowBytes) + ((long)theDoor.destRects[1].left / 8L) + (long)offWorkBits.baseAddr; theDoor.backDestAddr[0] = ((long)theDoor.destRects[0].top * backRowBytes) + ((long)theDoor.destRects[0].left / 8L) + (long)offBackBits.baseAddr; theDoor.backDestAddr[1] = ((long)theDoor.destRects[1].top * backRowBytes) + ((long)theDoor.destRects[1].left / 8L) + (long)offBackBits.baseAddr; for (i = 0; i < 9; i++) { playerSrcAddrs[i][0] = ((long)playerSrcRects[i][0].top * partsRowBytes) + ((long)playerSrcRects[i][0].left / 8L) + (long)offPartsBits.baseAddr; playerSrcAddrs[i][1] = ((long)playerSrcRects[i][1].top * partsRowBytes) + ((long)playerSrcRects[i][1].left / 8L) + (long)offPartsBits.baseAddr; playerSrcAddrs[i][2] = ((long)playerSrcRects[i][2].top * partsRowBytes) + ((long)playerSrcRects[i][2].left / 8L) + (long)offPartsBits.baseAddr; maskAddrs[i][0] = ((long)playerSrcRects[i][0].top * maskRowBytes) + ((long)playerSrcRects[i][0].left / 8L) + (long)offMaskMap.baseAddr; maskAddrs[i][1] = ((long)playerSrcRects[i][1].top * maskRowBytes) + ((long)playerSrcRects[i][1].left / 8L) + (long)offMaskMap.baseAddr; maskAddrs[i][2] = ((long)playerSrcRects[i][2].top * maskRowBytes) + ((long)playerSrcRects[i][2].left / 8L) + (long)offMaskMap.baseAddr; opponentSrcAddrs[i][0] = ((long)opponentSrcRects[i][0].top * partsRowBytes) + ((long)opponentSrcRects[i][0].left / 8L) + (long)offPartsBits.baseAddr; opponentSrcAddrs[i][1] = ((long)opponentSrcRects[i][1].top * partsRowBytes) + ((long)opponentSrcRects[i][1].left / 8L) + (long)offPartsBits.baseAddr; opponentSrcAddrs[i][2] = ((long)opponentSrcRects[i][2].top * partsRowBytes) + ((long)opponentSrcRects[i][2].left / 8L) + (long)offPartsBits.baseAddr; fadeMaskAddrs[i][0] = ((long)fadeMaskRects[i][0].top * maskRowBytes) + ((long)fadeMaskRects[i][0].left / 8L) + (long)offMaskMap.baseAddr; fadeMaskAddrs[i][1] = ((long)fadeMaskRects[i][1].top * maskRowBytes) + ((long)fadeMaskRects[i][1].left / 8L) + (long)offMaskMap.baseAddr; fadeMaskAddrs[i][2] = ((long)fadeMaskRects[i][2].top * maskRowBytes) + ((long)fadeMaskRects[i][2].left / 8L) + (long)offMaskMap.baseAddr; } ballSrcAddr = ((long)theBall.srcRect.top * partsRowBytes) + ((long)theBall.srcRect.left / 8L) + (long)offPartsBits.baseAddr; ballMaskAddr = ((long)theBall.srcRect.top * maskRowBytes) + ((long)theBall.srcRect.left / 8L) + (long)offMaskMap.baseAddr; boardCursor.srcAddr = ((long)boardCursor.srcRect.top * partsRowBytes) + ((long)boardCursor.srcRect.left / 8L) + (long)offPartsBits.baseAddr; boardCursor.maskAddr = ((long)boardCursor.srcRect.top * maskRowBytes) + ((long)boardCursor.srcRect.left / 8L) + (long)offMaskMap.baseAddr; replaySrc = ((long)replayRect.top * workRowBytes) + ((long)replayRect.left / 8L) + (long)offWorkBits.baseAddr; replayDest = ((long)replayRect.top * (long)screenRowBytes) + ((long)replayRect.left / 8L) + screenBase + insetBytes; } /*======================================================== LoadSounds */ void LoadSounds (void) { Str255 fileName; Handle theSound, memoryBuffer; short i; GetSoundVol(&wasSoundVolume); SetSoundVol(soundVolume); soundPriorities[0] = 0; soundPriorities[kClashSound] = kClashPriority; soundPriorities[kRicochetSound] = kRicochetPriority; soundPriorities[kScoreSound] = kScorePriority; soundPriorities[kBallFiringSound] = kBallFiringPriority; soundPriorities[kBeamInSound] = kBeamInPriority; soundPriorities[kBeamOutSound] = kBeamOutPriority; soundPriorities[kFoulSound] = kFoulPriority; soundPriorities[kBallPickUpSound] = kBallPickUpPriority; soundPriorities[kCrowdSound] = kCrowdPriority; soundPriorities[kCrowdSwellSound] = kCrowdSwellPriority; soundPriorities[kApplauseSound] = kApplausePriority; soundPriorities[kCrowdFadeSound] = kCrowdFadePriority; soundPriorities[kBellSound] = kBellPriority; soundPriorities[kMobSwellSound] = kMobSwellPriority; soundPriorities[kMobSound] = kMobPriority; soundPriorities[kMobFadeSound] = kMobFadePriority; soundPriorities[kHoldingSound] = kHoldingPriority; soundPriorities[kGameSound] = kGamePriority; soundPriorities[kPointSound] = kPointPriority; soundPriorities[kBallDropSound] = kBallDropPriority; soundPriorities[kBrakeSound] = kBrakePriority; soundPriorities[kAllSound] = kAllPriority; soundPriorities[kTiedSound] = kTiedPriority; soundPriorities[kIdleSound] = kIdlePriority; soundPriorities[kOverSound] = kOverPriority; memoryBuffer = NewHandle(65536L); if (memoryBuffer == kNilPointer) DeathError(kErrNoMemory); for (i = 1; i < kMaxNumberOfSounds; i++) { theSound = GetResource('SMSD', i); if (theSound != kNilPointer) { MoveHHi(theSound); HLock(theSound); HNoPurge(theSound); soundLoaded[i] = TRUE; } else soundLoaded[i] = FALSE; } soundFileRefNum = -1; GetIndString(fileName, rMiscStrings, 6); if (fileName[0] != 0) { soundFileRefNum = OpenResFile((StringPtr)StripAddress((Ptr)fileName)); UseResFile(soundFileRefNum); for (i = kMaxNumberOfSounds; i <= kLastIncidentalSounds; i++) { theSound = GetResource('SMSD', i); if (theSound != kNilPointer) { MoveHHi(theSound); HLock(theSound); HNoPurge(theSound); incidentSoundLoaded[i - kMaxNumberOfSounds] = TRUE; } else incidentSoundLoaded[i - kMaxNumberOfSounds] = FALSE; } } DisposeHandle(memoryBuffer); } /*======================================================== SpeedTest */ void SpeedTest (void) { long thisTime; speedFlag = 0L; thisTime = Ticks; while (thisTime == Ticks); thisTime += 15L; while (thisTime >= Ticks) { TwinkleAStar(); speedFlag++; } } /*======================================================== InitializeAll */ void InitializeAll (void) { short netErr; Boolean wereLegit; ToolBoxInit(); CheckOurEnvirons(); LoadCursors(); CouldAlert(rDeathAlertID); LoadThePreferences(); #if kDemoVersion canNetwork = FALSE; #else if (!netOnly) { wereLegit = ValidInstallation(TRUE); if (wereLegit) { netOnly = FALSE; } else { encryptedNumber = 0L; netOnly = TRUE; } } if (netOnly) { thePlayer.persona = kHumanPlayer; theOpponent.persona = kNetHuman; whichGame = kStandardGame; } netErr = InitializeAppleTalk(); if (netErr == kNetErrNoErr) canNetwork = TRUE; else { canNetwork = FALSE; if (netOnly) { MinorError(kMinorCantNetAndNetOnly); } else if (theOpponent.persona == kNetHuman) { theOpponent.persona = kMissTeak; MinorError(kMinorCantNetDefault); } } #endif LoadLargeDataStructures(); VarInit(); InitBallData(); InitPlayerData(); InitOpponentData(); InitDigiDispData(); OpenMainWindow(); DoSplashScreen(); if (isColor) PixMap4Init(); else BitMapInit(); if ((!useQD) && (isColor)) MaskPixInit(); MaskMapInit(); if (isColor) GetBaseAddressC(); else GetBaseAddress1(); WhosOnFirst(); UpdateGoalPicts(FALSE); MenuBarInit(); LoadSounds(); SpeedTest(); FlushEvents(everyEvent, kRemoveAllEvents); } \ No newline at end of file diff --git a/Sources/Main.c b/Sources/Main.c new file mode 100755 index 0000000..9f73a1b --- /dev/null +++ b/Sources/Main.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Main Body ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /* */ /* Pararena 2.06 by john calhoun */ /* 1992 Casady & Greene, Inc. */ /* */ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "AnimCursor.h" #include "Prefs.h" #include "Main.h" #include "Idle.h" #include "IdleRoutines.h" #include "Render.h" #include "PlayCore.h" #include "Initialize.h" #include "AppleTalkDDP.h" #include "SoundUtils.h" #include "MainWindow.h" #include /*======================================================== Globals */ ballType theBall; playerType thePlayer; playerType theOpponent; doorType theDoor; digiDispType scoreDisplays[2]; cursorType boardCursor; replayType *replayData; masterSendType masterMessage; slaveSendType slaveMessage; statType theStats[10]; string31 theNames[10]; macEnvironment thisMac; soundQueue crowdQueue, incidentalQueue; WindowPtr mainWndo; KeyMap theKeyMap; RGBColor RGBBlackColor, RGBWhiteColor; RGBColor starColors[3]; RgnHandle screenRgn; EventRecord theEvent; Cursor handCursor; GrafPtr offBackPtr, offPartsPtr, offWorkPtr, offMaskPtr; BitMap offBackBits, offPartsBits, offWorkBits, offMaskMap; CGrafPort offCBackPort, offCPartsPort, offCWorkPort, offCMaskPort; CGrafPtr offCBackPtr, offCPartsPtr, offCWorkPtr, offCMaskPtr; Ptr offBackPix, offPartsPix, offWorkPix, offMaskPix; Str255 courseFName, gameFName; string31 mostTitlesName, mostPointsName; string31 mostFoulsName, mostCritsName; Rect offBackRect, offPartsRect, offWorkRect, offMaskRect; Rect screenRect, dragRect, nullRect, mouseFrame; Rect replayRect, cameraRect, colonDest, leftTimingDest, rightTimingDest; Rect leftArrowSrc, rightArrowSrc, leftArrowDest, rightArrowDest; Rect leftArrowStorage, rightArrowStorage, timingSource; Rect playerSrcRects[9][3], fadeMaskRects[9][3], opponentSrcRects[9][3]; Rect colonSrc[2]; Point starList[kNumberOfStars]; long screenBase, mostTitlesDate, mostPointsDate, speedFlag, theirSpeed; long mostFoulsDate, mostCritsDate, oldDistSquared, tempLong; long insetBytes, replaySrc, replayDest, lifeTime, thisTime, encryptedNumber; long ballSrcAddr, ballMaskAddr; long screenRowAddrs[480], workRowOffsets[480]; long playerSrcAddrs[9][3], fadeMaskAddrs[9][3], opponentSrcAddrs[9][3]; long maskAddrs[9][3]; long timeElapsed, baseTime, wasTime, timePaused, replayFlag; short frameCounter, newFrameCount, lastFrameCount; short mostTitles, mostPoints, mostFouls, mostCrits, isLeague; short screenRowBytes, workRowBytes, backRowBytes, partsRowBytes; short maskCRowBytes, maskRowBytes, displayMode, screenWide, screenHigh; short primaryMode, arenaSize, isDepth, whichGame, loopsBallHeld; short displayHCenter, displayVCenter, playerFouls, opponentFouls; short playerTotalFouls, opponentTotalFouls, playerTotalGoals, opponentTotalGoals; short playerTotalCrits, opponentTotalCrits, lastSoundPriority, spottedPoints; short masterSendSize, slaveSendSize, loopDelay, soundFileRefNum; short droppedPackets, sentPackets, wasSoundVolume, wasLastSound; short playerScore, opponentScore, whosGotBall, maxBoardForce; short whichHumanNumber, leftPlayerNumber, rightPlayerNumber, spotPoints; short screenHCenter, screenVCenter, soundVolume, lengthOfApplause, lengthOfMob; short leftGoalLeague, rightGoalLeague, theirLeague, system7HelpItem; short horizontal, vertical; short vertTable[41][81]; short *littleForceTable, *juniorForceTable, *varsityForceTable; short *minorForceTable, *proForceTable; short fadeMaskSequence[69]; short spacialToDirection[9]; short boardForceTable[9][2]; short teaksThreshholds[10]; short antiFacing[9]; short antiWhosBall[4]; short soundPriorities[kMaxNumberOfSounds]; char playerWonTheGame; Boolean quitting, inBackground, isColor, knowsColor, autoSetDepth, doSkipFrames; Boolean useQD, playerInBack, canReplay, gameIsOver, newGame, smsActivated; Boolean pausing, leftScoredLast, netGameInSession, madeThePickUp, drawThisFrame; Boolean autoTeamsDialog, leftGoalIsPlayers, canNetwork, netMirroring, netOnly; Boolean replayGoals, replayFouls, replayOnR, replaySomething, willUseQD; Boolean playerJustScored, showBoardCursor, disableBoardCursor, enableAnnouncer; Boolean soundOn, beamSoundOn, incidentSoundOn, collisionSoundOn, crowdSoundOn; Boolean enableBackground, theyAreMajor, wasBrakeOn, doZooms, replayZooms; Boolean splashIsUp; Boolean soundLoaded[kMaxNumberOfSounds]; Boolean incidentSoundLoaded[kMaxIncidentalSounds]; /*======================================================== ThisSysBeep */ pascal void ThisSysBeep (short sndNum) { long dummyLong; short i; if (sndNum == 0) return; for (i = 0; i < sndNum; i++) { FlashMenuBar(0); Delay(8, &dummyLong); FlashMenuBar(0); Delay(8, &dummyLong); } } /*======================================================== RootLoop */ void RootLoop (void) { switch (primaryMode) /* depending upon which 'mode' we're in */ { case kIdleMode: /* idling - basically interface hashing */ HandleEvent(); if (!splashIsUp) TwinkleAStar(); break; case kPlayMode: /* playing - an active game is in session */ if (!pausing) PlayGame(); else { HandleEvent(); } break; } } /*======================================================== Main */ main() { InitializeAll(); /* initialize everything! */ UnloadSeg(InitializeAll); ErrorSound((ProcPtr)ThisSysBeep); InitCursor(); while (!quitting) /* call the root loop until we quit */ { RootLoop(); /* see above */ } ShutItDown(); /* destroy all data, restore Mac */ } /*======================================================== DumpTheDefaults */ void DumpTheDefaults (void) { prefsInfo thePreferred; short i; Boolean howItWent; thePreferred.prefVersion = 0x0100; thePreferred.encryption = encryptedNumber; thePreferred.timeWas = lifeTime + (Ticks - thisTime); PasStringCopy((StringPtr)mostTitlesName, (StringPtr)thePreferred.mostTitlesName); thePreferred.mostTitlesDate = mostTitlesDate; thePreferred.mostTitles = mostTitles; PasStringCopy((StringPtr)mostPointsName, (StringPtr)thePreferred.mostPointsName); thePreferred.mostPointsDate = mostPointsDate; thePreferred.mostPoints = mostPoints; PasStringCopy((StringPtr)mostFoulsName, (StringPtr)thePreferred.mostFoulsName); thePreferred.mostFoulsDate = mostFoulsDate; thePreferred.mostFouls = mostFouls; PasStringCopy((StringPtr)mostCritsName, (StringPtr)thePreferred.mostCritsName); thePreferred.mostCritsDate = mostCritsDate; thePreferred.mostCrits = mostCrits; PasStringCopy((StringPtr)theNames[0], (StringPtr)thePreferred.namesWere[0]); PasStringCopy((StringPtr)theNames[1], (StringPtr)thePreferred.namesWere[1]); PasStringCopy((StringPtr)theNames[2], (StringPtr)thePreferred.namesWere[2]); PasStringCopy((StringPtr)theNames[3], (StringPtr)thePreferred.namesWere[3]); PasStringCopy((StringPtr)theNames[4], (StringPtr)thePreferred.namesWere[4]); PasStringCopy((StringPtr)theNames[5], (StringPtr)thePreferred.namesWere[5]); PasStringCopy((StringPtr)theNames[6], (StringPtr)thePreferred.namesWere[6]); PasStringCopy((StringPtr)theNames[7], (StringPtr)thePreferred.namesWere[7]); PasStringCopy((StringPtr)theNames[8], (StringPtr)thePreferred.namesWere[8]); PasStringCopy((StringPtr)theNames[9], (StringPtr)thePreferred.namesWere[9]); thePreferred.opponentWas = theOpponent.persona; thePreferred.playerWas = whichHumanNumber; thePreferred.gameWas = whichGame; for (i = 0; i < 10; i++) { thePreferred.wasTeaksThresh[i] = teaksThreshholds[i]; } thePreferred.wasVolume = soundVolume; thePreferred.wasLeague = isLeague; thePreferred.wasUseQD = willUseQD; thePreferred.wasAutoTeams = autoTeamsDialog; thePreferred.replayGoalsWas = replayGoals; thePreferred.replayFoulsWas = replayFouls; thePreferred.replayOnRWas = replayOnR; thePreferred.wasShowCursor = showBoardCursor; thePreferred.leftGoalWasPlayers = leftGoalIsPlayers; thePreferred.wasSoundOn = soundOn; thePreferred.wasBeamSoundOn = beamSoundOn; thePreferred.wasIncidentSoundOn = incidentSoundOn; thePreferred.wasCollisionSoundOn = collisionSoundOn; thePreferred.wasCrowdSoundOn = crowdSoundOn; thePreferred.wasSetDepth = autoSetDepth; thePreferred.wasAnnouncer = enableAnnouncer; thePreferred.wasBackground = enableBackground; thePreferred.wasZooms = doZooms; thePreferred.wasReplayZooms = replayZooms; thePreferred.wasSkipFrames = doSkipFrames; thePreferred.wasNetOnly = netOnly; for (i = 0; i < 10; i++) { thePreferred.wasStats[i].tournamentTime = theStats[i].tournamentTime; thePreferred.wasStats[i].bestPlatinumTime = theStats[i].bestPlatinumTime; thePreferred.wasStats[i].copperTitles = theStats[i].copperTitles; thePreferred.wasStats[i].bronzeTitles = theStats[i].bronzeTitles; thePreferred.wasStats[i].silverTitles = theStats[i].silverTitles; thePreferred.wasStats[i].goldTitles = theStats[i].goldTitles; thePreferred.wasStats[i].platinumTitles = theStats[i].platinumTitles; thePreferred.wasStats[i].played = theStats[i].played; thePreferred.wasStats[i].won = theStats[i].won; thePreferred.wasStats[i].goals = theStats[i].goals; thePreferred.wasStats[i].fouls = theStats[i].fouls; thePreferred.wasStats[i].criticals = theStats[i].criticals; thePreferred.wasStats[i].oppGoals = theStats[i].oppGoals; thePreferred.wasStats[i].oppFouls = theStats[i].oppFouls; thePreferred.wasStats[i].oppCriticals = theStats[i].oppCriticals; thePreferred.wasStats[i].georgeState = theStats[i].georgeState; thePreferred.wasStats[i].maraState = theStats[i].maraState; thePreferred.wasStats[i].ottoState = theStats[i].ottoState; thePreferred.wasStats[i].claireState = theStats[i].claireState; thePreferred.wasStats[i].eazeState = theStats[i].eazeState; thePreferred.wasStats[i].teakState = theStats[i].teakState; } howItWent = SavePrefs(&thePreferred); } /*======================================================== ShutItDown */ void ShutItDown (void) { GDHandle theDevice; OSErr theErr; short netErr; short GDTypeFlag = 1, colorFlag = 1; char tagByte; Boolean itWorked; netErr = CloseDownAppleTalk(); TurnSMSOff(); SetSoundVol(wasSoundVolume); if (soundFileRefNum != -1) CloseResFile(soundFileRefNum); if (isColor) { if (offCPartsPtr != kNilPointer) CloseCPort(offCPartsPtr); if (offPartsPix != kNilPointer) DisposPtr(offPartsPix); if (offCBackPtr != kNilPointer) CloseCPort(offCBackPtr); if (offBackPix != kNilPointer) DisposPtr(offBackPix); if (offCWorkPtr != kNilPointer) CloseCPort(offCWorkPtr); if (offWorkPix != kNilPointer) DisposPtr(offWorkPix); } else { if (offBackPtr != kNilPointer) ClosePort(offBackPtr); if (offPartsPtr != kNilPointer) ClosePort(offPartsPtr); if (offWorkPtr != kNilPointer) ClosePort(offWorkPtr); } if ((!useQD) && (isColor)) { if (offCMaskPtr != kNilPointer) CloseCPort(offCMaskPtr); if (offMaskPix != kNilPointer) DisposPtr(offMaskPix); } if (offMaskPtr != kNilPointer) ClosePort(offMaskPtr); if (replayData != kNilPointer) DisposPtr((Ptr)replayData); DisposCursors(); /* drop cursors */ DumpTheDefaults(); CloseMainWindow(); if (screenRgn != kNilPointer) /* destroy regions */ DisposeRgn(screenRgn); if ((thisMac.canSwitch) && (thisMac.wasDepth != thisMac.isDepth) && (autoSetDepth)) { theDevice = GetMainDevice(); if (theDevice != kNilPointer) { tagByte = HGetState((Handle)theDevice); HLock((Handle)theDevice); theErr = SetDepth(theDevice, thisMac.wasDepth, GDTypeFlag, colorFlag); HSetState((Handle)theDevice, tagByte); } } FlushEvents(everyEvent, kRemoveAllEvents); /* flush and bolt! */ } \ No newline at end of file diff --git a/Sources/MainWindow.c b/Sources/MainWindow.c new file mode 100755 index 0000000..de206fc --- /dev/null +++ b/Sources/MainWindow.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Main Window Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "MainWindow.h" #include "Render.h" /*======================================================== Functions */ /*======================================================== EraseMenuBarRect */ void EraseMenuBarRect (void) { RgnHandle newVis; GrafPtr wasPort; Rect theRect; Point thePoint; GetPort(&wasPort); SetPort((GrafPtr)mainWndo); GetOrigin(&thePoint); SetOrigin(0, 0); theRect = screenBits.bounds; theRect.bottom = theRect.top + wasMenuBarHeight; newVis = NewRgn(); RectRgn(newVis, &theRect); UnionRgn(mainWndo->visRgn, newVis, mainWndo->visRgn); if (isColor) CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &theRect, &theRect, srcCopy, kNilPointer); else CopyBits(&offWorkBits, &(mainWndo->portBits), &theRect, &theRect, srcCopy, kNilPointer); DisposeRgn(newVis); SetOrigin(thePoint.h, thePoint.v); SetPort((GrafPtr)wasPort); } /*======================================================== FixVisRegion */ void FixVisRegion (void) { RgnHandle newVis; GrafPtr wasPort; Rect theRect; Point thePoint; GetPort(&wasPort); SetPort((GrafPtr)mainWndo); GetOrigin(&thePoint); SetOrigin(0, 0); theRect = screenBits.bounds; theRect.top += wasMenuBarHeight; newVis = NewRgn(); RectRgn(newVis, &theRect); SectRgn(mainWndo->visRgn, newVis, mainWndo->visRgn); DisposeRgn(newVis); SetOrigin(thePoint.h, thePoint.v); SetPort((GrafPtr)wasPort); } /*======================================================== LoadBackgroundPict */ void LoadBackgroundPict (void) { Rect pictRect; PicHandle thePict; if (isColor) { SetPort((GrafPtr)offCBackPtr); if (displayMode == kDisplay13Inch) thePict = GetPicture(rArenaPictLg4BitID); else thePict = GetPicture(rArenaPictSm4BitID); if (thePict != kNilPointer) { HLock((Handle)thePict); pictRect = (**thePict).picFrame; DrawPicture(thePict, &pictRect); HUnlock((Handle)thePict); ReleaseResource((Handle)thePict); } else DeathError(kErrNoPictRsrc); } else { SetPort((GrafPtr)offBackPtr); if (displayMode == kDisplay13Inch) thePict = GetPicture(rArenaPictLg1BitID); else thePict = GetPicture(rArenaPictSm1BitID); if (thePict != kNilPointer) { HLock((Handle)thePict); pictRect = (**thePict).picFrame; DrawPicture(thePict, &pictRect); HUnlock((Handle)thePict); ReleaseResource((Handle)thePict); } else DeathError(kErrNoPictRsrc); } } /*======================================================== UpdateGoalPicts */ void UpdateGoalPicts (Boolean drawToMain) { #define kBackBoardHeight 20 RGBColor theRGBColor; Rect tempRect; RgnHandle leftRgn, rightRgn, tempRgn; GrafPtr wasPort; LoadBackgroundPict(); leftRgn = kNilPointer; rightRgn = kNilPointer; if (arenaSize == kSmallArena) { leftRgn = NewRgn(); /* define left & right goal regions for small arena */ OpenRgn(); MoveTo(6, 174); LineTo(14, 138); LineTo(39, 104); LineTo(78, 76); LineTo(132, 53); LineTo(191, 40); LineTo(256, 34); LineTo(256, 34 - kBackBoardHeight); LineTo(191, 40 - kBackBoardHeight); LineTo(132, 53 - kBackBoardHeight); LineTo(78, 76 - kBackBoardHeight); LineTo(39, 104 - kBackBoardHeight); LineTo(14, 138 - kBackBoardHeight); LineTo(6, 174 - kBackBoardHeight); LineTo(6, 174); CloseRgn(leftRgn); rightRgn = NewRgn(); OpenRgn(); MoveTo(512 - 6, 174); LineTo(512 - 14, 138); LineTo(512 - 39, 104); LineTo(512 - 78, 76); LineTo(512 - 132, 53); LineTo(512 - 191, 40); LineTo(512 - 256, 34); LineTo(512 - 256, 34 - kBackBoardHeight); LineTo(512 - 191, 40 - kBackBoardHeight); LineTo(512 - 132, 53 - kBackBoardHeight); LineTo(512 - 78, 76 - kBackBoardHeight); LineTo(512 - 39, 104 - kBackBoardHeight); LineTo(512 - 14, 138 - kBackBoardHeight); LineTo(512 - 6, 174 - kBackBoardHeight); LineTo(512 - 6, 174); CloseRgn(rightRgn); } else { leftRgn = NewRgn(); /* define left & right goal regions for large arena */ OpenRgn(); MoveTo(12, 250); LineTo(22, 203); LineTo(53, 158); LineTo(102, 119); LineTo(166, 89); LineTo(240, 70); LineTo(320, 64); LineTo(320, 64 - kBackBoardHeight); LineTo(240, 70 - kBackBoardHeight); LineTo(166, 89 - kBackBoardHeight); LineTo(102, 119 - kBackBoardHeight); LineTo(53, 158 - kBackBoardHeight); LineTo(22, 203 - kBackBoardHeight); LineTo(12, 250 - kBackBoardHeight); LineTo(12, 250); CloseRgn(leftRgn); rightRgn = NewRgn(); OpenRgn(); MoveTo(640 - 12, 250); LineTo(640 - 22, 203); LineTo(640 - 53, 158); LineTo(640 - 102, 119); LineTo(640 - 166, 89); LineTo(640 - 240, 70); LineTo(640 - 320, 64); LineTo(640 - 320, 64 - kBackBoardHeight); LineTo(640 - 240, 70 - kBackBoardHeight); LineTo(640 - 166, 89 - kBackBoardHeight); LineTo(640 - 102, 119 - kBackBoardHeight); LineTo(640 - 53, 158 - kBackBoardHeight); LineTo(640 - 22, 203 - kBackBoardHeight); LineTo(640 - 12, 250 - kBackBoardHeight); LineTo(640 - 12, 250); CloseRgn(rightRgn); } if (arenaSize == kSmallArena) { switch (leftGoalLeague) { case kLittleLeague: tempRgn = NewRgn(); SetRectRgn(tempRgn, 11, 0, 208, 384); /* A, 0, D, 384 */ SectRgn(leftRgn, tempRgn, leftRgn); SetRectRgn(tempRgn, 34, 0, 140, 384); /* B, 0, C, 384 */ DiffRgn(leftRgn, tempRgn, leftRgn); DisposeRgn(tempRgn); break; case kJuniorVarsity: tempRgn = NewRgn(); SetRectRgn(tempRgn, 14, 0, 188, 384); /* A, 0, D, 384 */ SectRgn(leftRgn, tempRgn, leftRgn); SetRectRgn(tempRgn, 40, 0, 132, 384); /* B, 0, C, 384 */ DiffRgn(leftRgn, tempRgn, leftRgn); DisposeRgn(tempRgn); break; case kVarsity: tempRgn = NewRgn(); SetRectRgn(tempRgn, 19, 0, 173, 384); /* A, 0, D, 384 */ SectRgn(leftRgn, tempRgn, leftRgn); SetRectRgn(tempRgn, 50, 0, 113, 384); /* B, 0, C, 384 */ DiffRgn(leftRgn, tempRgn, leftRgn); DisposeRgn(tempRgn); break; case kMinorLeague: tempRgn = NewRgn(); SetRectRgn(tempRgn, 22, 0, 166, 384); /* A, 0, D, 384 */ SectRgn(leftRgn, tempRgn, leftRgn); SetRectRgn(tempRgn, 55, 0, 104, 384); /* B, 0, C, 384 */ DiffRgn(leftRgn, tempRgn, leftRgn); DisposeRgn(tempRgn); break; case kProfessional: tempRgn = NewRgn(); SetRectRgn(tempRgn, 27, 0, 154, 384); /* A, 0, D, 384 */ SectRgn(leftRgn, tempRgn, leftRgn); SetRectRgn(tempRgn, 69, 0, 82, 384); /* B, 0, C, 384 */ DiffRgn(leftRgn, tempRgn, leftRgn); DisposeRgn(tempRgn); break; default: break; } } else { switch (leftGoalLeague) { case kLittleLeague: tempRgn = NewRgn(); SetRectRgn(tempRgn, 20, 0, 246, 480); /* A, 0, D, 480 */ SectRgn(leftRgn, tempRgn, leftRgn); SetRectRgn(tempRgn, 47, 0, 174, 480); /* B, 0, C, 480 */ DiffRgn(leftRgn, tempRgn, leftRgn); DisposeRgn(tempRgn); break; case kJuniorVarsity: tempRgn = NewRgn(); SetRectRgn(tempRgn, 25, 0, 230, 480); /* A, 0, D, 480 */ SectRgn(leftRgn, tempRgn, leftRgn); SetRectRgn(tempRgn, 58, 0, 158, 480); /* B, 0, C, 480 */ DiffRgn(leftRgn, tempRgn, leftRgn); DisposeRgn(tempRgn); break; case kVarsity: tempRgn = NewRgn(); SetRectRgn(tempRgn, 32, 0, 208, 480); /* A, 0, D, 480 */ SectRgn(leftRgn, tempRgn, leftRgn); SetRectRgn(tempRgn, 67, 0, 145, 480); /* B, 0, C, 480 */ DiffRgn(leftRgn, tempRgn, leftRgn); DisposeRgn(tempRgn); break; case kMinorLeague: tempRgn = NewRgn(); SetRectRgn(tempRgn, 42, 0, 190, 480); /* A, 0, D, 480 */ SectRgn(leftRgn, tempRgn, leftRgn); SetRectRgn(tempRgn, 80, 0, 125, 480); /* B, 0, C, 480 */ DiffRgn(leftRgn, tempRgn, leftRgn); DisposeRgn(tempRgn); break; case kProfessional: tempRgn = NewRgn(); SetRectRgn(tempRgn, 50, 0, 170, 480); /* A, 0, D, 480 */ SectRgn(leftRgn, tempRgn, leftRgn); SetRectRgn(tempRgn, 96, 0, 110, 480); /* B, 0, C, 480 */ DiffRgn(leftRgn, tempRgn, leftRgn); DisposeRgn(tempRgn); break; default: break; } } if (arenaSize == kSmallArena) { switch (rightGoalLeague) { case kLittleLeague: tempRgn = NewRgn(); SetRectRgn(tempRgn, 512 - 208, 0, 512 - 11, 384); /* D, 0, A, 384 */ SectRgn(rightRgn, tempRgn, rightRgn); SetRectRgn(tempRgn, 512 - 140, 0, 512 - 34, 384); /* C, 0, B, 384 */ DiffRgn(rightRgn, tempRgn, rightRgn); DisposeRgn(tempRgn); break; case kJuniorVarsity: tempRgn = NewRgn(); SetRectRgn(tempRgn, 512 - 188, 0, 512 - 14, 384); /* D, 0, A, 384 */ SectRgn(rightRgn, tempRgn, rightRgn); SetRectRgn(tempRgn, 512 - 132, 0, 512 - 40, 384); /* C, 0, B, 384 */ DiffRgn(rightRgn, tempRgn, rightRgn); DisposeRgn(tempRgn); break; case kVarsity: tempRgn = NewRgn(); SetRectRgn(tempRgn, 512 - 173, 0, 512 - 19, 384); /* D, 0, A, 384 */ SectRgn(rightRgn, tempRgn, rightRgn); SetRectRgn(tempRgn, 512 - 113, 0, 512 - 50, 384); /* C, 0, B, 384 */ DiffRgn(rightRgn, tempRgn, rightRgn); DisposeRgn(tempRgn); break; case kMinorLeague: tempRgn = NewRgn(); SetRectRgn(tempRgn, 512 - 166, 0, 512 - 22, 384); /* D, 0, A, 384 */ SectRgn(rightRgn, tempRgn, rightRgn); SetRectRgn(tempRgn, 512 - 104, 0, 512 - 55, 384); /* C, 0, B, 384 */ DiffRgn(rightRgn, tempRgn, rightRgn); DisposeRgn(tempRgn); break; case kProfessional: tempRgn = NewRgn(); SetRectRgn(tempRgn, 512 - 154, 0, 512 - 27, 384); /* D, 0, A, 384 */ SectRgn(rightRgn, tempRgn, rightRgn); SetRectRgn(tempRgn, 512 - 82, 0, 512 - 69, 384); /* C, 0, B, 384 */ DiffRgn(rightRgn, tempRgn, rightRgn); DisposeRgn(tempRgn); break; default: break; } } else { switch (rightGoalLeague) { case kLittleLeague: tempRgn = NewRgn(); SetRectRgn(tempRgn, 640 - 246, 0, 640 - 20, 480); /* D, 0, A, 480 */ SectRgn(rightRgn, tempRgn, rightRgn); SetRectRgn(tempRgn, 640 - 174, 0, 640 - 47, 480); /* C, 0, B, 480 */ DiffRgn(rightRgn, tempRgn, rightRgn); DisposeRgn(tempRgn); break; case kJuniorVarsity: tempRgn = NewRgn(); SetRectRgn(tempRgn, 640 - 230, 0, 640 - 25, 480); /* D, 0, A, 480 */ SectRgn(rightRgn, tempRgn, rightRgn); SetRectRgn(tempRgn, 640 - 158, 0, 640 - 58, 480); /* C, 0, B, 480 */ DiffRgn(rightRgn, tempRgn, rightRgn); DisposeRgn(tempRgn); break; case kVarsity: tempRgn = NewRgn(); SetRectRgn(tempRgn, 640 - 208, 0, 640 - 32, 480); /* D, 0, A, 480 */ SectRgn(rightRgn, tempRgn, rightRgn); SetRectRgn(tempRgn, 640 - 145, 0, 640 - 67, 480); /* C, 0, B, 480 */ DiffRgn(rightRgn, tempRgn, rightRgn); DisposeRgn(tempRgn); break; case kMinorLeague: tempRgn = NewRgn(); SetRectRgn(tempRgn, 640 - 190, 0, 640 - 42, 480); /* D, 0, A, 480 */ SectRgn(rightRgn, tempRgn, rightRgn); SetRectRgn(tempRgn, 640 - 125, 0, 640 - 80, 480); /* C, 0, B, 480 */ DiffRgn(rightRgn, tempRgn, rightRgn); DisposeRgn(tempRgn); break; case kProfessional: tempRgn = NewRgn(); SetRectRgn(tempRgn, 640 - 170, 0, 640 - 50, 480); /* D, 0, A, 480 */ SectRgn(rightRgn, tempRgn, rightRgn); SetRectRgn(tempRgn, 640 - 110, 0, 640 - 96, 480); /* C, 0, B, 480 */ DiffRgn(rightRgn, tempRgn, rightRgn); DisposeRgn(tempRgn); break; default: break; } } GetPort(&wasPort); if (isColor) { SetPort((GrafPtr)offCBackPtr); Index2Color(kYellowColor4Bit, &theRGBColor); RGBForeColor(&theRGBColor); OffsetRgn(leftRgn, -1, -1); PaintRgn(leftRgn); OffsetRgn(leftRgn, 1, 1); OffsetRgn(rightRgn, 1, -1); PaintRgn(rightRgn); OffsetRgn(rightRgn, -1, 1); Index2Color(kBlueColor4Bit, &theRGBColor); RGBForeColor(&theRGBColor); PaintRgn(leftRgn); Index2Color(kVioletColor4Bit, &theRGBColor); RGBForeColor(&theRGBColor); PaintRgn(rightRgn); RGBForeColor(&RGBBlackColor); } else { SetPort((GrafPtr)offBackPtr); OffsetRgn(leftRgn, -1, -1); FillRgn(leftRgn, white); OffsetRgn(leftRgn, 1, 1); OffsetRgn(rightRgn, 1, -1); FillRgn(rightRgn, white); OffsetRgn(rightRgn, -1, 1); FillRgn(leftRgn, white); FillRgn(rightRgn, gray); } if (leftRgn != kNilPointer) DisposeRgn(leftRgn); if (rightRgn != kNilPointer) DisposeRgn(rightRgn); if (isColor) { CopyBits(&((GrafPtr)offCBackPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &offWorkRect, &offWorkRect, srcCopy, kNilPointer); if ((drawToMain) && (!splashIsUp)) { CopyBits(&((GrafPtr)offCBackPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &offWorkRect, &offWorkRect, srcCopy, ((GrafPtr)mainWndo)->visRgn); } } else { CopyBits(&offBackBits, &offWorkBits, &offWorkRect, &offWorkRect, srcCopy, kNilPointer); if ((drawToMain) && (!splashIsUp)) { CopyBits(&offBackBits, &(mainWndo->portBits), &offWorkRect, &offWorkRect, srcCopy, mainWndo->visRgn); } } SetPort((GrafPtr)wasPort); } /*======================================================== RefreshMainWindow */ void RefreshMainWindow (void) { Rect borderRect; GrafPtr wasPort; Point zeroPoint; short playWide, playHigh; GetPort(&wasPort); SetPort((GrafPtr)mainWndo); PenNormal(); playHigh = offWorkRect.bottom - offWorkRect.top; playWide = offWorkRect.right - offWorkRect.left; GetOrigin(&zeroPoint); SetOrigin(0, 0); borderRect = screenBits.bounds; if (primaryMode != kPlayMode) borderRect.top += GetMBarHeight(); ClipRect(&borderRect); SetRect(&borderRect, screenBits.bounds.left, screenBits.bounds.top, screenBits.bounds.right, -zeroPoint.v); FillRect(&borderRect, black); /* top peice */ SetRect(&borderRect, screenBits.bounds.left, playHigh - zeroPoint.v, screenBits.bounds.right, screenBits.bounds.bottom); FillRect(&borderRect, black); /* bottom peice */ SetRect(&borderRect, screenBits.bounds.left, -zeroPoint.v, -zeroPoint.h, playHigh - zeroPoint.v); FillRect(&borderRect, black); /* left peice */ SetRect(&borderRect, playWide - zeroPoint.h, -zeroPoint.v, screenBits.bounds.right, playHigh - zeroPoint.v); FillRect(&borderRect, black); /* right peice */ SetOrigin(zeroPoint.h, zeroPoint.v); DrawAllStars(); if (isColor) CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &offWorkRect, &offWorkRect, srcCopy, ((GrafPtr)mainWndo)->visRgn); else CopyBits(&offWorkBits, &(mainWndo->portBits), &offWorkRect, &offWorkRect, srcCopy, mainWndo->visRgn); DisplayPlayerFouls(0); DisplayOpponentFouls(0); SetPort((GrafPtr)wasPort); } /*======================================================== OpenMainWindow */ void OpenMainWindow (void) { if (isColor) { mainWndo = GetNewCWindow(rMainWndoID, kNilPointer, kPutInFront ); } else { mainWndo = GetNewWindow(rMainWndoID, kNilPointer, kPutInFront ); } horizontal = screenBits.bounds.right - screenBits.bounds.left; vertical = screenBits.bounds.bottom - screenBits.bounds.top; SizeWindow((GrafPtr)mainWndo, horizontal, vertical, kNormalUpdates); ShowWindow((GrafPtr)mainWndo); SetPort((GrafPtr)mainWndo); ClipRect(&screenBits.bounds); if (!isColor) FillRect(&screenBits.bounds, black); horizontal = (screenWide - (screenBits.bounds.right - screenBits.bounds.left)) / 2; vertical = (screenHigh - (screenBits.bounds.bottom - screenBits.bounds.top)) / 2; SetOrigin(horizontal, vertical); if (isColor) /* If in color, we need to dick with palettes */ { Index2Color(kBlackColor4Bit, &RGBBlackColor); Index2Color(kWhiteColor4Bit, &RGBWhiteColor); RGBForeColor(&RGBBlackColor); RGBBackColor(&RGBWhiteColor); } /* Define dragRect for limiting dragging of a window */ dragRect = screenBits.bounds; dragRect.top += 30; /* menu bar height + title bar height */ InsetRect(&dragRect, 4, 4); } /*======================================================== DoSplashScreen */ void DoSplashScreen (void) { Rect frame; GrafPtr wasPort; PicHandle thePict; Point origin; GetPort((GrafPtr *)&wasPort); SetPort((GrafPtr)mainWndo); splashIsUp = TRUE; GetOrigin(&origin); SetOrigin(0, 0); if (isColor) thePict = GetPicture(rSplashPICT4); else thePict = GetPicture(rSplashPICT1); if (thePict != kNilPointer) { HLock((Handle)thePict); frame = (**thePict).picFrame; HUnlock((Handle)thePict); OffsetRect(&frame, -frame.left, -frame.top); OffsetRect(&frame, 0, ((screenBits.bounds.bottom - screenBits.bounds.top - frame.bottom - 20) / 2) + 10); if ((screenBits.bounds.right - screenBits.bounds.left) < frame.right) { OffsetRect(&frame, screenBits.bounds.right - screenBits.bounds.left - frame.right, 0); } else if ((screenBits.bounds.right - screenBits.bounds.left) > frame.right) { OffsetRect(&frame, (screenBits.bounds.right - screenBits.bounds.left - frame.right) / 2, 0); } DrawPicture(thePict, &frame); ReleaseResource((Handle)thePict); } SetOrigin(origin.h, origin.v); SetPort((GrafPtr)wasPort); } /*======================================================== CloseMainWindow */ void CloseMainWindow (void) { if (mainWndo != kNilPointer) DisposeWindow((GrafPtr)mainWndo); } \ No newline at end of file diff --git a/Sources/Menu.c b/Sources/Menu.c new file mode 100755 index 0000000..86a23de --- /dev/null +++ b/Sources/Menu.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Menu Routines ==*/ /*== ==*/ /*== (menu handling routines) ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "Menu.h" #include "IdleRoutines.h" #include "About.h" #include "PlayUtils.h" #include "TeamSetUp.h" #include "MainWindow.h" #include "ConfigureSound.h" #include "PlayerStats.h" #include "AnimCursor.h" #include "Show_help.h" #include "Balloons.h" /*======================================================== Variables */ MenuHandle appleMenuH, fileMenuH, gameMenuH, optionsMenuH; /*======================================================== Functions */ /*======================================================== CheckGameMenu */ void CheckGameMenu (void) { short i; for (i = iPracticeBoardin; i <= iTournament; i++) CheckItem(gameMenuH, i, FALSE); #if kDemoVersion CheckItem(gameMenuH, iStandardGame, TRUE); DisableItem(gameMenuH, iPracticeBoardin); DisableItem(gameMenuH, iPracticeScoring); DisableItem(gameMenuH, iTournament); #else CheckItem(gameMenuH, iPracticeBoardin + whichGame - 1, TRUE); #endif } /*======================================================== SetMBarToPlaying */ void SetMBarToPlaying (void) { DisableItem(fileMenuH, iNewGame); EnableItem(fileMenuH, iResumeGame); EnableItem(fileMenuH, iEndGame); DisableItem(gameMenuH, iTeamsSetUp); DisableItem(gameMenuH, iChooseLeague); DisableItem(gameMenuH, iPracticeBoardin); DisableItem(gameMenuH, iPracticeScoring); DisableItem(gameMenuH, iStandardGame); DisableItem(gameMenuH, iTournament); } /*======================================================== SetMBarToIdle */ void SetMBarToIdle (void) { EnableItem(fileMenuH, iNewGame); DisableItem(fileMenuH, iResumeGame); DisableItem(fileMenuH, iEndGame); EnableItem(gameMenuH, iTeamsSetUp); EnableItem(gameMenuH, iChooseLeague); if (!netOnly) { #if kDemoVersion DisableItem(gameMenuH, iPracticeBoardin); DisableItem(gameMenuH, iPracticeScoring); DisableItem(gameMenuH, iTournament); #else EnableItem(gameMenuH, iPracticeBoardin); EnableItem(gameMenuH, iPracticeScoring); EnableItem(gameMenuH, iTournament); #endif } EnableItem(gameMenuH, iStandardGame); } /*======================================================== ValidateMenuBar */ void ValidateMenuBar (void) { Str255 miscString; if (netOnly) { DisableItem(gameMenuH, iPracticeBoardin); DisableItem(gameMenuH, iPracticeScoring); DisableItem(gameMenuH, iTournament); GetIndString(miscString, rMiscStrings, 19); if (miscString[0] == 0) PasStringCopy((StringPtr)"\pMake Net-Only", (StringPtr)miscString); SetItem(optionsMenuH, iConvert, miscString); } else { #if kDemoVersion DisableItem(gameMenuH, iPracticeBoardin); DisableItem(gameMenuH, iPracticeScoring); DisableItem(gameMenuH, iTournament); DisableItem(optionsMenuH, iConvert); #else EnableItem(gameMenuH, iPracticeBoardin); EnableItem(gameMenuH, iPracticeScoring); EnableItem(gameMenuH, iTournament); #endif GetIndString(miscString, rMiscStrings, 20); if (miscString[0] == 0) PasStringCopy((StringPtr)"\pValidate Pararena", (StringPtr)miscString); SetItem(optionsMenuH, iConvert, miscString); } } /*======================================================== DoAppleMenu */ void DoAppleMenu (short theItem) { Str255 daName; GrafPtr wasPort; short daNumber; switch (theItem) { case iAboutItem: DoAbout(); break; default: GetItem(appleMenuH, theItem, daName); GetPort(&wasPort); daNumber = OpenDeskAcc(daName); SetPort((GrafPtr)wasPort); break; } } /*======================================================== DoFileMenu */ void DoFileMenu (short theItem) { switch (theItem) { case iNewGame: DoNew(); break; case iResumeGame: pausing = FALSE; break; case iEndGame: DoEndGame(); break; case iQuit: quitting = TRUE; break; default: break; } } /*======================================================== DoGameMenu */ void DoGameMenu (short theItem) { short i; Boolean sheSaid; switch (theItem) { case iTeamsSetUp: sheSaid = DoTeamsSetUp(); if (sheSaid) { WhosOnFirst(); UpdateGoalPicts(TRUE); } break; case iChooseLeague: sheSaid = ConfigureLeague(); if (sheSaid) { WhosOnFirst(); UpdateGoalPicts(TRUE); } break; case iPracticeBoardin: whichGame = kPracticeBoardin; break; case iPracticeScoring: whichGame = kPracticeScoring; break; case iStandardGame: whichGame = kStandardGame; break; case iTournament: whichGame = kTournament; break; default: break; } if ((theItem >= iPracticeBoardin) && (theItem <= iTournament)) { #if kDemoVersion whichGame = kStandardGame; #endif CheckGameMenu(); } } /*======================================================== DoOptionsMenu */ void DoOptionsMenu (short theItem) { Boolean sheSaid; switch (theItem) { case iInstantReplay: sheSaid = ConfigureInstantReplay(); break; case iSound: sheSaid = DoConfigureSound(); break; case iNames: sheSaid = ConfigureNames(); break; case iPreferences: sheSaid = ConfigurePreferences(); break; case iPlayersStats: sheSaid = DoPlayerStats(); break; case iRecords: sheSaid = DisplayRecords(); break; case iMemory: sheSaid = DisplayMemory(); break; case iConvert: sheSaid = ConvertPararena(); if (sheSaid) { ValidateMenuBar(); CheckGameMenu(); } break; case iHelp: Show_help(rHelpDialogID, (StringPtr)"\pParaHelp", rHelpBasePictID, (StringPtr)"\pPararena Help", (StringPtr)"\p"); InitCursor(); break; default: break; } } /*======================================================== DoMenuChoice */ void DoMenuChoice (long menuChoice) { short theMenu, theItem; if (menuChoice != 0) { theMenu = HiWrd(menuChoice); theItem = LoWrd(menuChoice); switch (theMenu) { case rAppleMenuID: DoAppleMenu(theItem); break; case rFileMenuID: DoFileMenu(theItem); break; case rGameMenuID: DoGameMenu(theItem); break; case rOptionsMenuID: DoOptionsMenu(theItem); break; case kHMHelpMenuID: if (theItem == system7HelpItem) { Show_help(rHelpDialogID, (StringPtr)"\pParaHelp", rHelpBasePictID, (StringPtr)"\pPararena Help", (StringPtr)"\p"); InitCursor(); } break; default: break; } HiliteMenu(0); } } /*======================================================== MenuBarInit */ void MenuBarInit (void) { Str255 miscString, longHelpString; MenuHandle tempMenu; OSErr theErr; short whichItem; SpinCursor(7); appleMenuH = GetMenu(rAppleMenuID); AddResMenu(appleMenuH, 'DRVR'); InsertMenu(appleMenuH, 0); fileMenuH = GetMenu(rFileMenuID); InsertMenu(fileMenuH, 0); gameMenuH = GetMenu(rGameMenuID); InsertMenu(gameMenuH, 0); whichItem = whichGame + iPracticeBoardin - 1; CheckItem(gameMenuH, whichItem, TRUE); GetIndString(miscString, rMiscStrings, 17); if (miscString[0] == 0) PasStringCopy((StringPtr)"\pHelp", (StringPtr)miscString); GetIndString(longHelpString, rMiscStrings, 18); if (longHelpString[0] == 0) PasStringCopy((StringPtr)"\pPararena Help", (StringPtr)longHelpString); optionsMenuH = GetMenu(rOptionsMenuID); InsertMenu(optionsMenuH, 0); if (thisMac.hasSystem7) { theErr = HMGetHelpMenuHandle(&tempMenu); if ((theErr == noErr) && (tempMenu != kNilPointer)) { AppendMenu(tempMenu, longHelpString); system7HelpItem = CountMItems(tempMenu); } else { AppendMenu(optionsMenuH, miscString); } } else { AppendMenu(optionsMenuH, miscString); } ValidateMenuBar(); DrawMenuBar(); } \ No newline at end of file diff --git a/Sources/NetOpponent.c b/Sources/NetOpponent.c new file mode 100755 index 0000000..dbc41c5 --- /dev/null +++ b/Sources/NetOpponent.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Net Opponent Handling Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "AppleTalkDDP.h" #include "NetOpponent.h" #include "AnimCursor.h" #include "SoundUtils.h" #include "PlayUtils.h" #include "Replay.h" #include "Render.h" /*======================================================== Functions */ /*======================================================== SendSynchPulse */ OSErr SendSynchPulse (void) { OSErr netErr; short helloMessage; helloMessage = kHelloIndicator; netErr = SendOutgoingDDP((long)&helloMessage, 2); return (netErr); } /*======================================================== SendThisEnvironment */ OSErr SendThisEnvironment (void) { environMessage thisMessage; OSErr theErr; thisMessage.speed = speedFlag; thisMessage.version = kNetworkVersion; thisMessage.arena = arenaSize; thisMessage.goal = thePlayer.whichGoal; thisMessage.spotPts = spotPoints; thisMessage.league = isLeague; thisMessage.scoredLast = leftScoredLast; thisMessage.limited = netOnly; theErr = SendOutgoingDDP((long)&thisMessage, kEnviroMessageSize); return(theErr); } /*======================================================== BegForSomething */ OSErr BegForSomething (short anythingLove) { requestMessage requestor; OSErr theErr; requestor.requested = anythingLove; requestor.firstArgument = 0; requestor.secondArgument = 0; theErr = SendOutgoingDDP((long)&requestor, kRequestSize); return (theErr); } /*======================================================== WaitForSynch */ Boolean WaitForSynch (short timeOut) { long imVeryBored, dummyLong; OSErr theErr; short helloMessage, replyMessage; Boolean iHearYou; replyMessage = 0; dummyLong = 0; iHearYou = FALSE; imVeryBored = Ticks + timeOut; theErr = RequestReceiveDDP(); while ((Ticks < imVeryBored) && (!iHearYou)) { IncrementCursor(); theErr = PollSpecificDDP((long)&replyMessage, 2, 3); if (CommandPeriodDown()) break; if ((theErr == noErr) && (replyMessage == kHelloIndicator)) { iHearYou = TRUE; Delay(4, &dummyLong); } else if (theErr == kNetErrWrongSize) { if (lastByteCount == kRequestSize) { if (firstPackageShort == kRequestEnvironment) theErr = SendThisEnvironment(); else theErr = BegForSomething(kGotYourEnvironment); } else if (lastByteCount == kEnviroMessageSize) { theErr = BegForSomething(kGotYourEnvironment); } } SendSynchPulse(); } InitCursor(); return (iHearYou); } /*======================================================== ConfirmEnvironmentMatch */ Boolean ConfirmEnvironmentMatch (void) { environMessage theirMessage; long timeToBail; OSErr theErr; Boolean confirmed, needEnviron, sheSaysOkay, sheWants; theirMessage.speed = 0L; theirMessage.version = 0; theirMessage.arena = -1; theirMessage.goal = -1; theirMessage.spotPts = 0; theirMessage.league = 0; theirMessage.scoredLast = !leftScoredLast; theirMessage.limited = TRUE; theErr = RequestReceiveDDP(); timeToBail = Ticks + 3600; confirmed = FALSE; sheSaysOkay = FALSE; sheWants = FALSE; needEnviron = TRUE; theErr = BegForSomething(kRequestEnvironment); while ((!confirmed) && (Ticks < timeToBail)) { IncrementCursor(); if (CommandPeriodDown()) timeToBail = Ticks; theErr = PollSpecificDDP((long)&theirMessage, kEnviroMessageSize, 2); if (theErr == noErr) { needEnviron = FALSE; } else if ((theErr == kNetErrWrongSize) && (lastByteCount == kRequestSize)) { if (firstPackageShort == kRequestEnvironment) { sheWants = TRUE; } else if (firstPackageShort == kGotYourEnvironment) { sheWants = FALSE; sheSaysOkay = TRUE; if (!needEnviron) { confirmed = TRUE; } } } if (sheWants) { theErr = SendThisEnvironment(); sheWants = FALSE; } else if (needEnviron) theErr = BegForSomething(kRequestEnvironment); else theErr = BegForSomething(kGotYourEnvironment); } if (!confirmed) /* why did we leave the loop */ MinorError(kMinorNoNetConfirm); /* inform user of error */ else { if (theirMessage.version != kNetworkVersion) { MinorError(kMinorWrongNetVersion); confirmed = FALSE; } else if (theirMessage.arena != arenaSize) { if (theirMessage.arena > arenaSize) MinorError(kMinorArenaTooBig); else MinorError(kMinorArenaTooSmall); confirmed = FALSE; } else if (theirMessage.limited && netOnly) { MinorError(kMinorNeedOneValidCopy); confirmed = FALSE; } else { theirSpeed = theirMessage.speed; confirmed = DetermineMasterSlave(); if (confirmed) { netMirroring = (theirMessage.goal == thePlayer.whichGoal); spottedPoints = theirMessage.spotPts; theirLeague = theirMessage.league; if (!imTheMaster) leftScoredLast = theirMessage.scoredLast; } else { MinorError(kMinorNoMasterPossible); } } } InitCursor(); return (confirmed); } /*======================================================== WhatsTheGamesOutcome */ Boolean WhatsTheGamesOutcome (void) { typedef struct { short playerTotGoals; short opponentTotGoals; short playerTotFouls; short opponentTotFouls; short playerTotCrits; short opponentTotCrits; Boolean playerWon; } outcomeMessage; outcomeMessage thisMessage, theirMessage; long timeToBail, dummyLong; OSErr theErr; short outcomeMessageSize; Boolean confirmed; thisMessage.playerTotGoals = opponentTotalGoals; thisMessage.opponentTotGoals = playerTotalGoals; thisMessage.playerTotFouls = opponentTotalFouls; thisMessage.opponentTotFouls = playerTotalFouls; thisMessage.playerTotCrits = opponentTotalCrits; thisMessage.opponentTotCrits = playerTotalCrits; if (playerWonTheGame == kPlayerWon) thisMessage.playerWon = kOpponentWon; else thisMessage.playerWon = kPlayerWon; theirMessage.playerTotGoals = 0; theirMessage.opponentTotGoals = 0; theirMessage.playerTotFouls = 0; theirMessage.opponentTotFouls = 0; theirMessage.playerTotCrits = 0; theirMessage.opponentTotCrits = 0; theirMessage.playerWon = 0; outcomeMessageSize = (short)sizeof(theirMessage); timeToBail = Ticks + 300; confirmed = FALSE; theErr = RequestReceiveDDP(); while ((!confirmed) && (Ticks < timeToBail)) { theErr = PollSpecificDDP((long)&theirMessage, outcomeMessageSize, 2); if (theErr == noErr) { confirmed = TRUE; Delay(4, &dummyLong); } theErr = SendOutgoingDDP((long)&thisMessage, outcomeMessageSize); } theErr = SendOutgoingDDP((long)&thisMessage, outcomeMessageSize); if ((confirmed) && (!imTheMaster)) { playerTotalGoals = theirMessage.playerTotGoals; opponentTotalGoals = theirMessage.opponentTotGoals; playerTotalFouls = theirMessage.playerTotFouls; opponentTotalFouls = theirMessage.opponentTotFouls; playerTotalCrits = theirMessage.playerTotCrits; opponentTotalCrits = theirMessage.opponentTotCrits; playerWonTheGame = theirMessage.playerWon; } return (confirmed); } /*======================================================== PrepareStandardMessage */ void PrepareStandardMessage (void) { if (imTheMaster) { masterMessage.messageType = frameCounter; masterMessage.ballIsPoint = ((long)theBall.isRect.top << 16) | (long)theBall.isRect.left; masterMessage.eraserPoint = ((long)theBall.eraser.top << 16) | (long)theBall.eraser.left; masterMessage.playerIsPoint = ((long)thePlayer.isRect.top << 16) | (long)thePlayer.isRect.left; masterMessage.opponentIsPoint = ((long)theOpponent.isRect.top << 16) | (long)theOpponent.isRect.left; masterMessage.opponentXPos = theOpponent.xPos; masterMessage.opponentZPos = theOpponent.zPos; masterMessage.playerArrayDirSrc = (char)thePlayer.dirFlagSrc; masterMessage.playerPostArray = ((char)thePlayer.postFlagSrc << 4) | (char)thePlayer.arrayFlagMask; masterMessage.playerDirPostMask = ((char)thePlayer.dirFlagMask << 4) | (char)thePlayer.postFlagMask; masterMessage.opponentArrayDirSrc = (char)theOpponent.dirFlagSrc; masterMessage.opponentPostArray = ((char)theOpponent.postFlagSrc << 4) | (char)theOpponent.arrayFlagMask; masterMessage.opponentDirPostMask = ((char)theOpponent.dirFlagMask << 4) | (char)theOpponent.postFlagMask; masterMessage.ballWhosMode = ((char)theBall.mode << 4) | (char)antiWhosBall[whosGotBall]; masterMessage.playerOpponentMode = ((char)thePlayer.mode << 4) | (char)theOpponent.mode; masterMessage.bitFlags = ((char)theBall.dontDraw << 4) | ((char)theBall.eraseTheBall << 3) | ((char)theDoor.doorOpen << 2) | ((char)theDoor.doorState << 1) | (char)playerInBack; masterMessage.packedFoulsRead = ((char)opponentFouls << 4) | (char)playerFouls; masterMessage.playerScoreReads = playerScore; masterMessage.opponentScoreReads = opponentScore; masterMessage.soundPlayed = (unsigned char)wasLastSound; } else { slaveMessage.messageType = frameCounter; if (netMirroring) slaveMessage.mouseH = -thePlayer.hMouse; else slaveMessage.mouseH = thePlayer.hMouse; slaveMessage.mouseV = thePlayer.vMouse; slaveMessage.bits = ((char)thePlayer.bashApplied << 2) | ((char)thePlayer.buttonIs << 1) | (char)thePlayer.brakeApplied; } } /*======================================================== SendMessage */ void SendMessage (void) { OSErr theErr; if (imTheMaster) theErr = SendOutgoingDDP((long)&masterMessage, masterSendSize); else theErr = SendOutgoingDDP((long)&slaveMessage, slaveSendSize); } /*======================================================== SendModalMessage */ Boolean SendModalMessage (short theMessage) { long timeOut; OSErr theErr; Boolean modeConfirmed; if (imTheMaster) masterMessage.messageType = theMessage; else slaveMessage.messageType = theMessage; timeOut = Ticks + 240L; modeConfirmed = FALSE; while ((Ticks < timeOut) && (!modeConfirmed)) { if (imTheMaster) { theErr = SendOutgoingDDP((long)&masterMessage, masterSendSize); theErr = PollSpecificDDP ((long)&slaveMessage, slaveSendSize, 3); if ((theErr == noErr) && (slaveMessage.messageType == kConfirmMessage)) { modeConfirmed = TRUE; } } else { theErr = SendOutgoingDDP((long)&slaveMessage, slaveSendSize); theErr = PollSpecificDDP ((long)&masterMessage, masterSendSize, 3); if ((theErr == noErr) && (masterMessage.messageType == kConfirmMessage)) { modeConfirmed = TRUE; } } } if (modeConfirmed) return(TRUE); else return(FALSE); } /*======================================================== ConfirmModalMessage */ void ConfirmModalMessage (void) { OSErr theErr; if (imTheMaster) { masterMessage.messageType = kConfirmMessage; theErr = SendOutgoingDDP((long)&masterMessage, masterSendSize); } else { slaveMessage.messageType = kConfirmMessage; theErr = SendOutgoingDDP((long)&slaveMessage, slaveSendSize); } } /*======================================================== ReceiveMessage */ void ReceiveMessage (void) { OSErr theErr; Boolean itWorked; #if kDemoVersion return; #else if (imTheMaster) theErr = PollSpecificDDP ((long)&slaveMessage, slaveSendSize, loopDelay); else theErr = PollSpecificDDP ((long)&masterMessage, masterSendSize, loopDelay); madeThePickUp = FALSE; if (theErr == noErr) { if (imTheMaster) newFrameCount = slaveMessage.messageType; else newFrameCount = masterMessage.messageType; switch (newFrameCount) { case kGameIsOverMessage: ConfirmModalMessage(); itWorked = WhatsTheGamesOutcome(); if (playerScore > opponentScore) { lengthOfApplause = 1500; StartApplauseSound(); } else { lengthOfMob = 1500; StartMobSound(); } DoSlaveGameOver(); break; case kInstantReplayMessage: ConfirmModalMessage(); DoInstantReplay(); break; case kAbortGameMessage: ConfirmModalMessage(); if (!gameIsOver) { TurnSMSOff(); FlushEvents(everyEvent, kRemoveAllEvents); MinorError(kMinorOpponentAborted); } primaryMode = kIdleMode; break; case kEndGameMessage: ConfirmModalMessage(); gameIsOver = TRUE; primaryMode = kIdleMode; break; case kConfirmMessage: break; default: if ((newFrameCount < frameCounter) && (loopDelay < 3)) loopDelay++; else if ((newFrameCount > frameCounter) && (loopDelay > 1)) loopDelay--; TranslateStandardMessage(); if (imTheMaster) frameCounter = newFrameCount; lastFrameCount = newFrameCount; madeThePickUp = TRUE; if (frameCounter < 32000) { frameCounter++; } else { frameCounter = 0; newFrameCount = 0; lastFrameCount = 0; } break; } } #endif } /*======================================================== TranslateStandardMessage */ void TranslateStandardMessage (void) { short wasGotBall, wasPlayerFouls, wasOpponentFouls; short rawPlayerDirSrc, rawPlayerDirMask; short rawOpponentDirSrc, rawOpponentDirMask; Boolean tempDoorState; #if kDemoVersion return; #else if (imTheMaster) { theOpponent.hMouse = slaveMessage.mouseH; theOpponent.vMouse = slaveMessage.mouseV; theOpponent.bashApplied = (Boolean)((slaveMessage.bits >> 2) & 0x01); theOpponent.buttonIs = (Boolean)((slaveMessage.bits >> 1) & 0x01); theOpponent.brakeApplied = (Boolean)(slaveMessage.bits & 0x01); } else { if (netMirroring) { theBall.isRect.left = screenWide - LoWrd(masterMessage.ballIsPoint) - 16; theBall.eraser.left = screenWide - LoWrd(masterMessage.eraserPoint) - 16; theOpponent.isRect.left = screenWide - LoWrd(masterMessage.playerIsPoint) - 32; thePlayer.isRect.left = screenWide - LoWrd(masterMessage.opponentIsPoint) - 32; theDoor.doorOpen = !(Boolean)((masterMessage.bitFlags >> 2) & 0x01); thePlayer.xPos = -masterMessage.opponentXPos; thePlayer.zPos = masterMessage.opponentZPos; } else { theBall.isRect.left = LoWrd(masterMessage.ballIsPoint); theBall.eraser.left = LoWrd(masterMessage.eraserPoint); theOpponent.isRect.left = LoWrd(masterMessage.playerIsPoint); thePlayer.isRect.left = LoWrd(masterMessage.opponentIsPoint); theDoor.doorOpen = (Boolean)((masterMessage.bitFlags >> 2) & 0x01); thePlayer.xPos = masterMessage.opponentXPos; thePlayer.zPos = masterMessage.opponentZPos; } theBall.isRect.top = HiWrd(masterMessage.ballIsPoint); theBall.isRect.right = theBall.isRect.left + 16; theBall.isRect.bottom = theBall.isRect.top + 12; theBall.eraser.top = HiWrd(masterMessage.eraserPoint); theBall.eraser.right = theBall.eraser.left + 16; theBall.eraser.bottom = theBall.eraser.top + 12; theOpponent.isRect.top = HiWrd(masterMessage.playerIsPoint); theOpponent.isRect.right = theOpponent.isRect.left + 32; theOpponent.isRect.bottom = theOpponent.isRect.top + 44; thePlayer.isRect.top = HiWrd(masterMessage.opponentIsPoint); thePlayer.isRect.right = thePlayer.isRect.left + 32; thePlayer.isRect.bottom = thePlayer.isRect.top + 44; theOpponent.arrayFlagMask = (short)(masterMessage.playerPostArray & 0x0F); thePlayer.arrayFlagMask = (short)(masterMessage.opponentPostArray & 0x0F); rawPlayerDirSrc = (short)(masterMessage.playerArrayDirSrc & 0x0F); rawPlayerDirMask = (short)((masterMessage.playerDirPostMask >> 4) & 0x0F); rawOpponentDirSrc = (short)(masterMessage.opponentArrayDirSrc & 0x0F); rawOpponentDirMask = (short)((masterMessage.opponentDirPostMask >> 4) & 0x0F); if (netMirroring) { if (theOpponent.arrayFlagMask == kFadeMask) { theOpponent.dirFlagSrc = rawPlayerDirSrc; theOpponent.dirFlagMask = rawPlayerDirMask; } else { theOpponent.dirFlagSrc = antiFacing[rawPlayerDirSrc]; theOpponent.dirFlagMask = antiFacing[rawPlayerDirMask]; } if (thePlayer.arrayFlagMask == kFadeMask) { thePlayer.dirFlagSrc = rawOpponentDirSrc; thePlayer.dirFlagMask = rawOpponentDirMask; } else { thePlayer.dirFlagSrc = antiFacing[rawOpponentDirSrc]; thePlayer.dirFlagMask = antiFacing[rawOpponentDirMask]; } } else { theOpponent.dirFlagSrc = rawPlayerDirSrc; theOpponent.dirFlagMask = rawPlayerDirMask; thePlayer.dirFlagSrc = rawOpponentDirSrc; thePlayer.dirFlagMask = rawOpponentDirMask; } theOpponent.postFlagSrc = (short)((masterMessage.playerPostArray >> 4) & 0x0F); theOpponent.postFlagMask = (short)(masterMessage.playerDirPostMask & 0x0F); thePlayer.postFlagSrc = (short)((masterMessage.opponentPostArray >> 4) & 0x0F); thePlayer.postFlagMask = (short)(masterMessage.opponentDirPostMask & 0x0F); theBall.mode = (masterMessage.ballWhosMode >> 4) & 0x0F; wasGotBall = whosGotBall; whosGotBall = (short)(masterMessage.ballWhosMode & 0x0F); if (whosGotBall != wasGotBall) { switch (whosGotBall) { case kPlayerHasBall: theOpponent.loopsBallHeld = 0; if (thePlayer.loopsBallHeld == 0) thePlayer.loopsBallHeld = kLoopLimitOnHeldBall; break; case kOpponentHasBall: thePlayer.loopsBallHeld = 0; if (theOpponent.loopsBallHeld == 0) theOpponent.loopsBallHeld = kLoopLimitOnHeldBall; break; case kBallIsNotHere: thePlayer.loopsBallHeld = 0; theOpponent.loopsBallHeld = 0; break; default: break; } UpdateBallTimers(&thePlayer); UpdateBallTimers(&theOpponent); UpdateArrows(); } thePlayer.mode = masterMessage.playerOpponentMode & 0x0F; theOpponent.mode = (masterMessage.playerOpponentMode >> 4) & 0x0F; theBall.dontDraw = (Boolean)((masterMessage.bitFlags >> 4) & 0x01); theBall.eraseTheBall = (Boolean)((masterMessage.bitFlags >> 3) & 0x01); tempDoorState = (Boolean)((masterMessage.bitFlags >> 1) & 0x01); if (tempDoorState != theDoor.doorState) theDoor.stateChanged = TRUE; theDoor.doorState = tempDoorState; playerInBack = !((Boolean)(masterMessage.bitFlags & 0x01)); wasPlayerFouls = playerFouls; playerFouls = (masterMessage.packedFoulsRead >> 4) & 0x0F; if (wasPlayerFouls != playerFouls) { lengthOfMob = 90; StartMobSound(); DisplayPlayerFouls(playerFouls); } wasOpponentFouls = opponentFouls; opponentFouls = masterMessage.packedFoulsRead & 0x0F; if (wasOpponentFouls != opponentFouls) { lengthOfApplause = 90; StartApplauseSound(); DisplayOpponentFouls(opponentFouls); } if (masterMessage.playerScoreReads > opponentScore) { opponentScore = masterMessage.playerScoreReads; lengthOfMob = 120; StartMobSound(); UpdateOpponentScore(); } if (masterMessage.opponentScoreReads > playerScore) { playerScore = masterMessage.opponentScoreReads; lengthOfApplause = 120; StartApplauseSound(); UpdatePlayerScore(); } wasLastSound = (short)masterMessage.soundPlayed; } #endif } /*======================================================== InitializeMessages */ void InitializeMessages (void) { if (!imTheMaster) { masterMessage.messageType = 0; masterMessage.ballIsPoint = ((long)theBall.isRect.top << 16) | (long)theBall.isRect.left; masterMessage.eraserPoint = ((long)theBall.eraser.top << 16) | (long)theBall.eraser.left; masterMessage.playerIsPoint = ((long)theOpponent.isRect.top << 16) | (long)theOpponent.isRect.left; masterMessage.opponentIsPoint = ((long)thePlayer.isRect.top << 16) | (long)thePlayer.isRect.left; masterMessage.playerArrayDirSrc = (char)theOpponent.dirFlagSrc; masterMessage.playerPostArray = ((char)theOpponent.postFlagSrc << 4) | (char)theOpponent.arrayFlagMask; masterMessage.playerDirPostMask = ((char)theOpponent.dirFlagMask << 4) | (char)theOpponent.postFlagMask; masterMessage.opponentArrayDirSrc = (char)thePlayer.dirFlagSrc; masterMessage.opponentPostArray = ((char)thePlayer.postFlagSrc << 4) | (char)thePlayer.arrayFlagMask; masterMessage.opponentDirPostMask = ((char)thePlayer.dirFlagMask << 4) | (char)thePlayer.postFlagMask; masterMessage.ballWhosMode = ((char)theBall.mode << 4) | (char)antiWhosBall[whosGotBall]; masterMessage.playerOpponentMode = ((char)theOpponent.mode << 4) | (char)thePlayer.mode; masterMessage.bitFlags = ((char)theBall.dontDraw << 4) | ((char)theBall.eraseTheBall << 3) | ((char)theDoor.doorOpen << 2) | ((char)theDoor.doorState << 1) | (char)playerInBack; masterMessage.packedFoulsRead = ((char)playerFouls << 4) | (char)opponentFouls; masterMessage.playerScoreReads = playerScore; masterMessage.opponentScoreReads = opponentScore; masterMessage.soundPlayed = (unsigned char)wasLastSound; } else { slaveMessage.messageType = 0; if (netMirroring) slaveMessage.mouseH = -theOpponent.hMouse; else slaveMessage.mouseH = theOpponent.hMouse; slaveMessage.mouseV = theOpponent.vMouse; slaveMessage.bits = 0x00; } } /*======================================================== SpotPoints */ Boolean SpotPoints (void) { #define rSpotDialogID 191 #define kButtSpotOkay 1 #define kEditSpotPoints 2 #define kUserBalloonNames 4 #define kNamesTitleLeft 6 #define kNamesTitleTop 16 DialogPtr spotDialog; PicHandle thePict; Handle iHandle; Rect iRect; Str255 tempStr; long tempLong; short itemHit, iType; Boolean leaveDialog, userOkayed; CenterDialog(rSpotDialogID); if (doZooms) ZoomOutDialogRect(rSpotDialogID); NumToString(speedFlag, tempStr); spotPoints = 0; ParamText("\p4", tempStr, "\p", "\p"); spotDialog = GetNewDialog(rSpotDialogID, kNilPointer, kPutInFront); SetPort((GrafPtr)spotDialog); ShowWindow((GrafPtr)spotDialog); GetDItem(spotDialog, kUserBalloonNames, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kBalloon4PictID); else thePict = GetPicture(kBalloon1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetIndString(tempStr, rMiscStrings, 11); if (tempStr[0] == 0) PasStringCopy((StringPtr)"\pSpot Points", (StringPtr)tempStr); MoveTo(kNamesTitleLeft, kNamesTitleTop); DrawString(tempStr); DrawDefaultButton(spotDialog, kButtSpotOkay); SelIText(spotDialog, kEditSpotPoints, 0, 32767); leaveDialog = FALSE; while (!leaveDialog) { ModalDialog(kNilPointer, &itemHit); switch (itemHit) { case kButtSpotOkay: GetDItem(spotDialog, kEditSpotPoints, &iType, &iHandle, &iRect); GetIText(iHandle, tempStr); StringToNum(tempStr, &tempLong); spotPoints = (short)tempLong; if ((spotPoints > 4) || (spotPoints < 0)) { SysBeep(20); SelIText(spotDialog, kEditSpotPoints, 0, 32767); } else { userOkayed = TRUE; leaveDialog = TRUE; } break; default: break; } } DisposDialog(spotDialog); return (userOkayed); } \ No newline at end of file diff --git a/Sources/Para.bloon b/Sources/Para.bloon new file mode 100755 index 0000000..e69de29 diff --git a/Sources/PlayCore.c b/Sources/PlayCore.c new file mode 100755 index 0000000..e2f2395 --- /dev/null +++ b/Sources/PlayCore.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Play Handling Core Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "AppleTalkDDP.h" #include "Globals.h" #include "UnivUtilities.h" #include "PlayCore.h" #include "NetOpponent.h" #include "SoundUtils.h" #include "MainWindow.h" #include "PlayUtils.h" #include "RenderQD.h" #include "Replay.h" #include "CommonPerson.h" #include "Human.h" #include "Dynamics.h" #include "Render.h" #include "Ball.h" /*======================================================== Functions */ /*======================================================== DoCommandKey */ void DoCommandKey (void) { #define kNoThanksButton 1 short response; Boolean dummyBool; if (BitTst(&theKeyMap, kQKeyMap)) /* is -Q- key held down? */ { quitting = TRUE; primaryMode = kIdleMode; if (netGameInSession) dummyBool = SendModalMessage(kAbortGameMessage); } if (BitTst(&theKeyMap, kEKeyMap)) /* is -E- key held down? */ { if ((whichGame == kTournament) && (!gameIsOver)) { timePaused = Ticks; FlushSoundQueues(); StopCrowdSound(); TurnSMSOff(); InitCursor(); FlushEvents(everyEvent, kRemoveAllEvents); CenterAlert(rAbortGameAlertID); response = Alert(rAbortGameAlertID, kNilPointer); TurnSMSOn(); RefreshMainWindow(); ResumeCrowdSound(); UpdatePlayerScore(); UpdateOpponentScore(); timePaused = Ticks - timePaused; baseTime += timePaused / 60; RedrawWholeScreen(); HideCursor(); if (response == kNoThanksButton) { return; } else { playerWonTheGame = kOpponentWon; UpdateStats(); UpdateWorldRecords(); primaryMode = kIdleMode; } } else { primaryMode = kIdleMode; if (netGameInSession) { dummyBool = SendModalMessage(kAbortGameMessage); } } } } /*======================================================== DoPausing */ void DoPausing (void) { if (!netGameInSession) { pausing = TRUE; timePaused = Ticks; } } /*======================================================== UnPauseGame */ void UnPauseGame (void) { TurnSMSOn(); HideMenuBar((GrafPtr)mainWndo); EraseMenuBarRect(); RefreshMainWindow(); ResumeCrowdSound(); UpdatePlayerScore(); UpdateOpponentScore(); timePaused = Ticks - timePaused; baseTime += timePaused / 60; RedrawWholeScreen(); HideCursor(); } /*======================================================== DoSpecial */ void DoSpecial (void) { Point theMouse; GetMouse(&theMouse); LocalToGlobal(&theMouse); theMouse.h -= displayHCenter; theMouse.v -= displayVCenter; theBall.xPos = theMouse.h * 128; theBall.zPos = -theMouse.v * 128; theBall.xVel = 0; theBall.zVel = 0; } /*======================================================== DoSoundToggle */ void DoSoundToggle (void) { soundOn = !soundOn; if (soundOn) { StartCrowdSound(); } else { StopCrowdSound(); } while (BitTst(&theKeyMap, kSKeyMap)) GetKeys(theKeyMap); } /*======================================================== CheckAbortiveInput */ void CheckAbortiveInput (void) { Boolean confirmed; GetKeys(theKeyMap); if (BitTst(&theKeyMap, kCommandKeyMap)) DoCommandKey(); if (BitTst(&theKeyMap, kTabKeyMap)) DoPausing(); if (BitTst(&theKeyMap, kSKeyMap)) DoSoundToggle(); if ((replayOnR) && (BitTst(&theKeyMap, kRKeyMap))) { if (netGameInSession) { confirmed = SendModalMessage(kInstantReplayMessage); } DoInstantReplay(); } if (BitTst(&theKeyMap, kOptionKeyMap) && BitTst(&theKeyMap, kZKeyMap)) DoSpecial(); } /*======================================================== HandleTimerEtc */ void HandleTimerEtc (void) { if (replaySomething) { replayFlag++; if (replayFlag == 0) DoInstantReplay(); } theDoor.stateChanged = FALSE; if ((netGameInSession) && (!imTheMaster)) return; timeElapsed = (Ticks / 60) - baseTime; /* get seconds elapsed */ } /*======================================================== RunGameOverGame */ void RunGameOverGame (void) { long waitTil, endWhen, pauseTime; short starsWinked, lightNumber; Boolean dummyBool; lightNumber = 0; waitTil = Ticks + kTickDelay; endWhen = Ticks + kHooplaTime; while ((!pausing) && (primaryMode == kPlayMode)) { DetermineFrameRate(); if (playerWonTheGame == kPlayerWon) { HandlePerson(&thePlayer); if (theOpponent.mode == kBeamingOut) HandlePerson(&theOpponent); } else if (playerWonTheGame == kOpponentWon) { HandlePerson(&theOpponent); if (thePlayer.mode == kBeamingOut) HandlePerson(&thePlayer); } if (waitTil > endWhen) { if (playerWonTheGame == kPlayerWon) { if (thePlayer.mode == kInStasis) { primaryMode = kIdleMode; } else if (thePlayer.mode == kInArena) { StartPersonBeamOut(&thePlayer); } else HandlePerson(&thePlayer); } else if (playerWonTheGame == kOpponentWon) { if (theOpponent.mode == kInStasis) { primaryMode = kIdleMode; } else if (theOpponent.mode == kInArena) { StartPersonBeamOut(&theOpponent); } else HandlePerson(&theOpponent); } } HandleBoardCursor(); HandleCollisions(); HandleCrowdSound(); HandleIncidentalQueue(); CheckAbortiveInput(); if (enableBackground) dummyBool = GetOSEvent(everyEvent, &theEvent); HideCursor(); starsWinked = 0; while (Ticks < waitTil) { CheckAbortiveInput(); if (starsWinked < 3) { TwinkleAStar(); starsWinked++; } } waitTil = Ticks + kTickDelay; if (replaySomething) AmassReplayData(); HandlePreGraphics(); RenderScene(); HandlePostGraphics(); pauseTime = Ticks; HandleTimerEtc(); pauseTime = Ticks - pauseTime; waitTil += pauseTime; endWhen += pauseTime; } } /*======================================================== RunNetGameOverGame */ void RunNetGameOverGame (void) { long waitTil, endWhen; short starsWinked; Boolean dummyBool; waitTil = Ticks + kTickDelay; endWhen = Ticks + kHooplaTime; while ((!pausing) && (primaryMode == kPlayMode)) { DetermineFrameRate(); if (imTheMaster) { if (playerWonTheGame == kPlayerWon) { HandlePerson(&thePlayer); ReceiveMessage(); /* get user input from slave */ if (theOpponent.mode == kBeamingOut) { HandlePerson(&theOpponent); } } else if (playerWonTheGame == kOpponentWon) { ReceiveMessage(); /* get user input from slave */ HandlePerson(&theOpponent); if (thePlayer.mode == kBeamingOut) HandlePerson(&thePlayer); } if (waitTil > endWhen) { if (playerWonTheGame == kPlayerWon) { if (thePlayer.mode == kInStasis) { dummyBool = SendModalMessage(kEndGameMessage); primaryMode = kIdleMode; } else if (thePlayer.mode == kInArena) { StartPersonBeamOut(&thePlayer); } else HandlePerson(&thePlayer); } else if (playerWonTheGame == kOpponentWon) { if (theOpponent.mode == kInStasis) { dummyBool = SendModalMessage(kEndGameMessage); primaryMode = kIdleMode; } else if (theOpponent.mode == kInArena) { StartPersonBeamOut(&theOpponent); } else HandlePerson(&theOpponent); } } HandleBoardCursor(); HandleCollisions(); } else { PrepareNetHumanInput(); PrepareStandardMessage(); SendMessage(); } HandleCrowdSound(); HandleIncidentalQueue(); CheckAbortiveInput(); if (enableBackground) dummyBool = GetOSEvent(everyEvent, &theEvent); HideCursor(); starsWinked = 0; while (Ticks < waitTil) { CheckAbortiveInput(); if (starsWinked < 3) { TwinkleAStar(); starsWinked++; } } waitTil = Ticks + kTickDelay; if (imTheMaster) { if (replaySomething) AmassReplayData(); HandlePreGraphics(); if (primaryMode == kPlayMode) { PrepareStandardMessage(); SendMessage(); /* send a "frame" to slave */ } wasLastSound = 0; lastSoundPriority = 0; } else { ReceiveMessage(); HandleBoardCursor(); if (replaySomething) AmassReplayData(); HandlePreGraphics(); if ((wasLastSound > 0) && (wasLastSound <= kLastIncidentalSounds)) { PlaySoundSMS(wasLastSound); } wasLastSound = 0; lastSoundPriority = 0; } RenderScene(); HandlePostGraphics(); HandleTimerEtc(); } } /*======================================================== RunNetGame */ void RunNetGame (void) { long waitTil; short starsWinked; Boolean dummyBool; waitTil = Ticks + kTickDelay; while ((!pausing) && (primaryMode == kPlayMode) && (!gameIsOver)) { DetermineFrameRate(); if (imTheMaster) { HandlePerson(&thePlayer); HandleBoardCursor(); ReceiveMessage(); /* get user input from slave */ HandlePerson(&theOpponent); HandleBall(); HandleCollisions(); } else { PrepareNetHumanInput(); PrepareStandardMessage(); SendMessage(); /* send user input to master */ } HandleCrowdSound(); HandleIncidentalQueue(); CheckAbortiveInput(); if (enableBackground) dummyBool = GetOSEvent(everyEvent, &theEvent); HideCursor(); starsWinked = 0; while (Ticks < waitTil) { CheckAbortiveInput(); if (starsWinked < 3) { TwinkleAStar(); starsWinked++; } } waitTil = Ticks + kTickDelay; if (imTheMaster) { if (replaySomething) AmassReplayData(); HandlePreGraphics(); if (primaryMode == kPlayMode) { PrepareStandardMessage(); SendMessage(); /* send a "frame" to slave */ } wasLastSound = 0; lastSoundPriority = 0; } else { ReceiveMessage(); /* receive a "frame" from master */ if (whosGotBall == kPlayerHasBall) { thePlayer.loopsBallHeld--; if (thePlayer.loopsBallHeld < 0) thePlayer.loopsBallHeld = 0; UpdateBallTimers(&thePlayer); } else if (whosGotBall == kOpponentHasBall) { theOpponent.loopsBallHeld--; if (theOpponent.loopsBallHeld < 0) theOpponent.loopsBallHeld = 0; UpdateBallTimers(&theOpponent); } HandleBoardCursor(); if (replaySomething) AmassReplayData(); HandlePreGraphics(); if ((wasLastSound > 0) && (wasLastSound <= kLastIncidentalSounds)) { PlaySoundSMS(wasLastSound); } wasLastSound = 0; lastSoundPriority = 0; } RenderScene(); HandlePostGraphics(); HandleTimerEtc(); } if (gameIsOver) { if (imTheMaster) { dummyBool = SendModalMessage(kGameIsOverMessage); dummyBool = WhatsTheGamesOutcome(); } RunNetGameOverGame(); } } /*======================================================== RunBoardinGame */ void RunBoardinGame (void) { long waitTil; short starsWinked; Boolean dummyBool; waitTil = Ticks + kTickDelay; while ((!pausing) && (primaryMode == kPlayMode)) { DetermineFrameRate(); HandlePerson(&thePlayer); HandleBoardCursor(); if (thePlayer.justHitWall > 0) thePlayer.justHitWall--; CheckAbortiveInput(); if (enableBackground) dummyBool = GetOSEvent(everyEvent, &theEvent); HideCursor(); starsWinked = 0; while (Ticks < waitTil) { CheckAbortiveInput(); if (starsWinked < 3) { TwinkleAStar(); starsWinked++; } } waitTil = Ticks + kTickDelay; if (replaySomething) AmassReplayData(); HandlePreGraphics(); RenderScene(); HandlePostGraphics(); HandleTimerEtc(); } } /*======================================================== RunScorinGame */ void RunScorinGame (void) { long waitTil; short starsWinked; Boolean dummyBool; waitTil = Ticks + kTickDelay; while ((!pausing) && (primaryMode == kPlayMode)) { DetermineFrameRate(); HandlePerson(&thePlayer); HandleBoardCursor(); HandleBall(); HandleCollisions(); CheckAbortiveInput(); if (enableBackground) dummyBool = GetOSEvent(everyEvent, &theEvent); HideCursor(); starsWinked = 0; while (Ticks < waitTil) { CheckAbortiveInput(); if (starsWinked < 3) { TwinkleAStar(); starsWinked++; } } waitTil = Ticks + kTickDelay; if (replaySomething) AmassReplayData(); HandlePreGraphics(); RenderScene(); HandlePostGraphics(); HandleTimerEtc(); } } /*======================================================== RunStandardGame */ void RunStandardGame (void) { long waitTil; short starsWinked; Boolean dummyBool; waitTil = Ticks + kTickDelay; while ((!pausing) && (primaryMode == kPlayMode) && (!gameIsOver)) { DetermineFrameRate(); HandlePerson(&thePlayer); HandleBoardCursor(); HandlePerson(&theOpponent); HandleBall(); HandleCollisions(); HandleCrowdSound(); HandleIncidentalQueue(); CheckAbortiveInput(); if (enableBackground) dummyBool = GetOSEvent(everyEvent, &theEvent); HideCursor(); starsWinked = 0; while (Ticks < waitTil) { CheckAbortiveInput(); if (starsWinked < 3) { TwinkleAStar(); starsWinked++; } } waitTil = Ticks + kTickDelay; if (replaySomething) AmassReplayData(); HandlePreGraphics(); RenderScene(); HandlePostGraphics(); HandleTimerEtc(); } if (gameIsOver) RunGameOverGame(); } /*======================================================== PlayGame */ void PlayGame (void) { if (newGame) PrepareNewGame(); else UnPauseGame(); if (netGameInSession) { RunNetGame(); } else { switch (whichGame) { case kPracticeBoardin: RunBoardinGame(); break; case kPracticeScoring: RunScorinGame(); break; case kStandardGame: case kTournament: RunStandardGame(); break; default: break; } } FlushSoundQueues(); StopCrowdSound(); TurnSMSOff(); RedrawWholeScreen(); ShowMenuBar((GrafPtr)mainWndo); FixVisRegion(); InitCursor(); FlushEvents(everyEvent, kRemoveAllEvents); if (primaryMode != kPlayMode) DoEndGame(); } \ No newline at end of file diff --git a/Sources/PlayUtils.c b/Sources/PlayUtils.c new file mode 100755 index 0000000..bf0a605 --- /dev/null +++ b/Sources/PlayUtils.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Play Utility Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "AppleTalkDDP.h" #include "Globals.h" #include "UnivUtilities.h" #include "PlayUtils.h" #include "Render.h" #include "Ball.h" #include "Menu.h" #include "SoundUtils.h" #include "CommonPerson.h" #include "NetOpponent.h" #include "TeamSetUp.h" #include "MainWindow.h" #include "IdleRoutines.h" #include "Replay.h" #include "DissBits.h" /*======================================================== Functions */ /*======================================================== DoEndGame */ void DoEndGame (void) { pausing = FALSE; primaryMode = kIdleMode; SetMBarToIdle(); } /*======================================================== UpdateWorldRecords */ void UpdateWorldRecords (void) { if (playerScore > mostPoints) { mostPoints = playerScore; GetDateTime((unsigned long *)&mostPointsDate); PasStringCopy((StringPtr)theNames[whichHumanNumber - 1], (StringPtr)mostPointsName); } if ((opponentScore > mostPoints) && (theOpponent.persona >= kSimpleGeorge) && (theOpponent.persona <= kMissTeak)) { mostPoints = opponentScore; GetDateTime((unsigned long *)&mostPointsDate); GetIndString((StringPtr)mostPointsName, rNamesStringID, theOpponent.persona + 1); } if (playerTotalFouls > mostFouls) { mostFouls = playerTotalFouls; GetDateTime((unsigned long *)&mostFoulsDate); PasStringCopy((StringPtr)theNames[whichHumanNumber - 1], (StringPtr)mostFoulsName); } if ((opponentTotalFouls > mostFouls) && (theOpponent.persona >= kSimpleGeorge) && (theOpponent.persona <= kMissTeak)) { mostFouls = opponentTotalFouls; GetDateTime((unsigned long *)&mostFoulsDate); GetIndString((StringPtr)mostFoulsName, rNamesStringID, theOpponent.persona + 1); } if (playerTotalCrits > mostCrits) { mostCrits = playerTotalCrits; GetDateTime((unsigned long *)&mostCritsDate); PasStringCopy((StringPtr)theNames[whichHumanNumber - 1], (StringPtr)mostCritsName); } if ((opponentTotalCrits > mostCrits) && (theOpponent.persona >= kSimpleGeorge) && (theOpponent.persona <= kMissTeak)) { mostCrits = opponentTotalCrits; GetDateTime((unsigned long *)&mostCritsDate); GetIndString((StringPtr)mostCritsName, rNamesStringID, theOpponent.persona + 1); } } /*======================================================== UpdateStats */ void UpdateStats (void) { short statusFlag, didWon, skunked; if (theStats[whichHumanNumber - 1].played < kMaxShort) theStats[whichHumanNumber - 1].played++; /* increment # of games played */ if ((theStats[whichHumanNumber - 1].goals + playerTotalGoals) < kMaxShort) theStats[whichHumanNumber - 1].goals += playerTotalGoals; else theStats[whichHumanNumber - 1].goals = kMaxShort; if ((theStats[whichHumanNumber - 1].oppGoals + opponentTotalGoals) < kMaxShort) theStats[whichHumanNumber - 1].oppGoals += opponentTotalGoals; else theStats[whichHumanNumber - 1].oppGoals = kMaxShort; if ((theStats[whichHumanNumber - 1].fouls + playerTotalFouls) < kMaxShort) theStats[whichHumanNumber - 1].fouls += playerTotalFouls; else theStats[whichHumanNumber - 1].fouls = kMaxShort; if ((theStats[whichHumanNumber - 1].oppFouls + opponentTotalFouls) < kMaxShort) theStats[whichHumanNumber - 1].oppFouls += opponentTotalFouls; else theStats[whichHumanNumber - 1].oppFouls = kMaxShort; if ((theStats[whichHumanNumber - 1].criticals + playerTotalCrits) < kMaxShort) theStats[whichHumanNumber - 1].criticals += playerTotalCrits; else theStats[whichHumanNumber - 1].criticals = kMaxShort; if ((theStats[whichHumanNumber - 1].oppCriticals + opponentTotalCrits) < kMaxShort) theStats[whichHumanNumber - 1].oppCriticals += opponentTotalCrits; else theStats[whichHumanNumber - 1].oppCriticals = kMaxShort; if ((playerWonTheGame == kPlayerWon) && (theStats[whichHumanNumber - 1].won < kMaxShort)) theStats[whichHumanNumber - 1].won++; /* increment # of games won */ if (whichGame == kTournament) { if (playerWonTheGame == kPlayerWon) { if (opponentTotalGoals == 0) { statusFlag = kSkunkedState; } else { statusFlag = kWonState; } } else { statusFlag = kLostState; } switch (theOpponent.persona) { case kSimpleGeorge: theStats[whichHumanNumber - 1].georgeState = statusFlag; break; case kMadMara: theStats[whichHumanNumber - 1].maraState = statusFlag; break; case kHeavyOtto: theStats[whichHumanNumber - 1].ottoState = statusFlag; break; case kCleverClaire: theStats[whichHumanNumber - 1].claireState = statusFlag; break; case kMisterEaze: theStats[whichHumanNumber - 1].eazeState = statusFlag; break; case kMissTeak: theStats[whichHumanNumber - 1].teakState = statusFlag; break; default: break; } if ((theStats[whichHumanNumber - 1].georgeState != kUnplayedState) && (theStats[whichHumanNumber - 1].maraState != kUnplayedState) && (theStats[whichHumanNumber - 1].ottoState != kUnplayedState) && (theStats[whichHumanNumber - 1].claireState != kUnplayedState) && (theStats[whichHumanNumber - 1].eazeState != kUnplayedState) && (theStats[whichHumanNumber - 1].teakState != kUnplayedState)) { didWon = 0; if (theStats[whichHumanNumber - 1].georgeState >= kWonState) didWon++; if (theStats[whichHumanNumber - 1].maraState >= kWonState) didWon++; if (theStats[whichHumanNumber - 1].ottoState >= kWonState) didWon++; if (theStats[whichHumanNumber - 1].claireState >= kWonState) didWon++; if (theStats[whichHumanNumber - 1].eazeState >= kWonState) didWon++; if (theStats[whichHumanNumber - 1].teakState >= kWonState) didWon++; skunked = 0; if (theStats[whichHumanNumber - 1].georgeState == kSkunkedState) skunked++; if (theStats[whichHumanNumber - 1].maraState == kSkunkedState) skunked++; if (theStats[whichHumanNumber - 1].ottoState == kSkunkedState) skunked++; if (theStats[whichHumanNumber - 1].claireState == kSkunkedState) skunked++; if (theStats[whichHumanNumber - 1].eazeState == kSkunkedState) skunked++; if (theStats[whichHumanNumber - 1].teakState == kSkunkedState) skunked++; switch (didWon) { case 3: if (theStats[whichHumanNumber - 1].copperTitles < kMaxShort) theStats[whichHumanNumber - 1].copperTitles++; break; case 4: if (theStats[whichHumanNumber - 1].bronzeTitles < kMaxShort) theStats[whichHumanNumber - 1].bronzeTitles++; break; case 5: if (theStats[whichHumanNumber - 1].silverTitles < kMaxShort) theStats[whichHumanNumber - 1].silverTitles++; break; case 6: if (skunked == 6) { if (theStats[whichHumanNumber - 1].platinumTitles < kMaxShort) theStats[whichHumanNumber - 1].platinumTitles++; } else { if (theStats[whichHumanNumber - 1].goldTitles < kMaxShort) theStats[whichHumanNumber - 1].goldTitles++; } break; default: break; } if (theStats[whichHumanNumber - 1].goldTitles > mostTitles) { mostTitles = theStats[whichHumanNumber - 1].goldTitles; GetDateTime((unsigned long *)&mostTitlesDate); PasStringCopy((StringPtr)theNames[whichHumanNumber - 1], (StringPtr)mostTitlesName); } theStats[whichHumanNumber - 1].georgeState = kUnplayedState; theStats[whichHumanNumber - 1].maraState = kUnplayedState; theStats[whichHumanNumber - 1].ottoState = kUnplayedState; theStats[whichHumanNumber - 1].claireState = kUnplayedState; theStats[whichHumanNumber - 1].eazeState = kUnplayedState; theStats[whichHumanNumber - 1].teakState = kUnplayedState; } } } /*======================================================== InitiateGameOver */ void InitiateGameOver (void) { if (gameIsOver) return; PlaySoundSMS(kBellSound); if (playerScore > opponentScore) playerWonTheGame = kPlayerWon; else if (playerScore < opponentScore) playerWonTheGame = kOpponentWon; else playerWonTheGame = kNoOneWon; if (playerWonTheGame == kPlayerWon) { StartPersonBeamOut(&theOpponent); lengthOfApplause = kCrowdClosingHoopla; StartApplauseSound(); } else if (playerWonTheGame == kOpponentWon) { StartPersonBeamOut(&thePlayer); lengthOfMob = kCrowdClosingHoopla; StartMobSound(); } else { StartPersonBeamOut(&thePlayer); StartPersonBeamOut(&theOpponent); lengthOfMob = kCrowdClosingHoopla; StartMobSound(); } if ((theOpponent.persona == kMissTeak) && (thePlayer.persona == kHumanPlayer)) teaksThreshholds[whichHumanNumber - 1] = theOpponent.teaksThresh; if ((whichGame >= kStandardGame) && (thePlayer.persona == kHumanPlayer)) { UpdateStats(); UpdateWorldRecords(); } incidentalQueue.number = kGameSound; incidentalQueue.when = 180; incidentalQueue.priority = 100; gameIsOver = TRUE; } /*======================================================== DoSlaveGameOver */ void DoSlaveGameOver (void) { if ((gameIsOver) || (imTheMaster)) return; gameIsOver = TRUE; if ((whichGame >= kStandardGame) && (thePlayer.persona == kHumanPlayer)) { UpdateStats(); UpdateWorldRecords(); } } /*======================================================== DrawNames */ void DrawNames (void) { #define rShortNameStrID 1002 #define kNoOnesName 7 Str255 theName1, theName2, tempStr; Rect name1Rect, name2Rect; GrafPtr wasPort; short i, charsToDisplay, offset; GetPort(&wasPort); SetPort((GrafPtr)mainWndo); switch (displayMode) { case kDisplay9Inch: SetRect(&name1Rect, 0, 0, 64, 6); SetRect(&name2Rect, 0, 0, 64, 6); OffsetRect(&name1Rect, 25, 301); OffsetRect(&name2Rect, 425, 301); TextFont(202); TextSize(7); break; case kDisplay12Inch: SetRect(&name1Rect, 0, 0, 69, 9); SetRect(&name2Rect, 0, 0, 69, 9); OffsetRect(&name1Rect, 25, 319); OffsetRect(&name2Rect, 425, 319); TextFont(systemFont); TextSize(12); break; case kDisplay13Inch: SetRect(&name1Rect, 0, 0, 69, 9); SetRect(&name2Rect, 0, 0, 69, 9); OffsetRect(&name1Rect, 25, 426); OffsetRect(&name2Rect, 553, 426); TextFont(systemFont); TextSize(12); break; default: break; } if (leftGoalIsPlayers) { if (thePlayer.persona == kHumanPlayer) PasStringCopy((StringPtr)theNames[whichHumanNumber - 1], (StringPtr)theName1); else { if (whichGame >= kStandardGame) GetIndString(theName1, rShortNameStrID, thePlayer.persona); else GetIndString(theName1, rShortNameStrID, kNoOnesName); } } else { if (theOpponent.persona == kNetHuman) { PasStringCopy((StringPtr)opponentsName, (StringPtr)theName1); } else { if (whichGame >= kStandardGame) GetIndString(theName1, rShortNameStrID, theOpponent.persona); else GetIndString(theName1, rShortNameStrID, kNoOnesName); } } UprString(theName1, TRUE); charsToDisplay = theName1[0]; for (i = 0; i < theName1[0]; i++) { PasStringCopyNum((StringPtr)theName1, (StringPtr)tempStr, i + 1); if ((StringWidth(tempStr)) < (name1Rect.right - name1Rect.left)) charsToDisplay = i + 1; } theName1[0] = charsToDisplay; if (leftGoalIsPlayers) { if (theOpponent.persona == kNetHuman) { PasStringCopy((StringPtr)opponentsName, (StringPtr)theName2); } else { if (whichGame >= kStandardGame) GetIndString(theName2, rShortNameStrID, theOpponent.persona); else GetIndString(theName2, rShortNameStrID, kNoOnesName); } } else { if (thePlayer.persona == kHumanPlayer) PasStringCopy((StringPtr)theNames[whichHumanNumber - 1], (StringPtr)theName2); else { if (whichGame >= kStandardGame) GetIndString(theName2, rShortNameStrID, thePlayer.persona); else GetIndString(theName2, rShortNameStrID, kNoOnesName); } } UprString(theName2, TRUE); charsToDisplay = theName2[0]; for (i = 0; i < theName2[0]; i++) { PasStringCopyNum((StringPtr)theName2, (StringPtr)tempStr, i + 1); if ((StringWidth(tempStr)) < (name2Rect.right - name2Rect.left)) charsToDisplay = i + 1; } theName2[0] = charsToDisplay; FillRect(&name1Rect, black); FillRect(&name2Rect, black); TextMode(srcXor); offset = ((name1Rect.right - name1Rect.left) - StringWidth(theName1)) / 2; MoveTo(name1Rect.left + offset, name1Rect.bottom); DrawString(theName1); offset = ((name2Rect.right - name2Rect.left) - StringWidth(theName2)) / 2; MoveTo(name2Rect.left + offset, name2Rect.bottom); DrawString(theName2); if (isColor) { CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCWorkPtr)->portBits, &name1Rect, &name1Rect, srcCopy, nil); CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCBackPtr)->portBits, &name1Rect, &name1Rect, srcCopy, nil); CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCWorkPtr)->portBits, &name2Rect, &name2Rect, srcCopy, nil); CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCBackPtr)->portBits, &name2Rect, &name2Rect, srcCopy, nil); } else { CopyBits(&(mainWndo->portBits), &offWorkBits, &name1Rect, &name1Rect, srcCopy, nil); CopyBits(&(mainWndo->portBits), &offBackBits, &name1Rect, &name1Rect, srcCopy, nil); CopyBits(&(mainWndo->portBits), &offWorkBits, &name2Rect, &name2Rect, srcCopy, nil); CopyBits(&(mainWndo->portBits), &offBackBits, &name2Rect, &name2Rect, srcCopy, nil); } SetPort((GrafPtr)wasPort); } /*======================================================== UpdatePlayerScore */ void UpdatePlayerScore (void) { short isOnes, isTens, isHundreds, selector; playerJustScored = TRUE; if (leftGoalIsPlayers) selector = kLeftScoreSelector; else selector = kRightScoreSelector; isHundreds = playerScore / 100; if (isHundreds == 0) DisplayScoreDigit(kHundredsPlace, kBlankCharacter, selector); else DisplayScoreDigit(kHundredsPlace, isHundreds, selector); isTens = (playerScore - isHundreds * 100) / 10; if ((isTens == 0) && (isHundreds == 0)) DisplayScoreDigit(kTensPlace, kBlankCharacter, selector); else DisplayScoreDigit(kTensPlace, isTens, selector); isOnes = playerScore % 10; DisplayScoreDigit(kOnesPlace, isOnes, selector); } /*======================================================== UpdateOpponentScore */ void UpdateOpponentScore (void) { short isOnes, isTens, isHundreds, selector; playerJustScored = FALSE; if (leftGoalIsPlayers) selector = kRightScoreSelector; else selector = kLeftScoreSelector; isHundreds = opponentScore / 100; if (isHundreds == 0) DisplayScoreDigit(kHundredsPlace, kBlankCharacter, selector); else DisplayScoreDigit(kHundredsPlace, isHundreds, selector); isTens = (opponentScore - isHundreds * 100) / 10; if ((isTens == 0) && (isHundreds == 0)) DisplayScoreDigit(kTensPlace, kBlankCharacter, selector); else DisplayScoreDigit(kTensPlace, isTens, selector); isOnes = opponentScore % 10; DisplayScoreDigit(kOnesPlace, isOnes, selector); } /*======================================================== DoPlayerScores */ void DoPlayerScores (void) { lengthOfApplause = 120; StartApplauseSound(); PlaySoundSMS(kScoreSound); playerScore++; playerTotalGoals++; if (thePlayer.whichGoal == kLeftGoal) leftScoredLast = TRUE; else leftScoredLast = FALSE; if (whichGame == kStandardGame) { if (playerScore - opponentScore == 4) { BeginGamePointSound(); } else if ((playerScore >= 10) && (playerScore - opponentScore >= 1)) { BeginGamePointSound(); } if (playerScore == opponentScore) { BeginAllTiedSound(); } } else if (whichGame == kTournament) { if (playerScore - opponentScore == 6) { BeginGamePointSound(); } else if ((playerScore >= 16) && (playerScore - opponentScore >= 2)) { BeginGamePointSound(); } if (playerScore == opponentScore) { BeginAllTiedSound(); } } UpdatePlayerScore(); DisplayPlayerFouls(playerFouls); if (thePlayer.persona == kMissTeak) { if (thePlayer.strategy == kRunDiagonal) thePlayer.teaksThresh++; else if (thePlayer.strategy == kRunCircle) thePlayer.teaksThresh--; if (thePlayer.teaksThresh < 4) thePlayer.teaksThresh = 4; if (thePlayer.teaksThresh > 95) thePlayer.teaksThresh = 95; } if ((!netGameInSession) && (replayGoals)) replayFlag = -50; switch (whichGame) { case kStandardGame: if (playerScore >= 11) { if (playerScore >= (opponentScore + 2)) { InitiateGameOver(); } } else { if (playerScore >= (opponentScore + 5)) { InitiateGameOver(); } } break; case kTournament: if (playerScore >= 17) { if (playerScore >= (opponentScore + 3)) { InitiateGameOver(); } } else { if (playerScore >= (opponentScore + 7)) { InitiateGameOver(); } } break; default: break; } } /*======================================================== DoOpponentScores */ void DoOpponentScores (void) { lengthOfMob = 120; StartMobSound(); PlaySoundSMS(kScoreSound); opponentScore++; opponentTotalGoals++; if (theOpponent.whichGoal == kLeftGoal) leftScoredLast = TRUE; else leftScoredLast = FALSE; if (whichGame == kStandardGame) { if (opponentScore - playerScore == 4) { BeginGamePointSound(); } else if ((opponentScore >= 10) && (opponentScore - playerScore >= 1)) { BeginGamePointSound(); } if (playerScore == opponentScore) { BeginAllTiedSound(); } } else if (whichGame == kTournament) { if (opponentScore - playerScore == 6) { BeginGamePointSound(); } else if ((opponentScore >= 16) && (opponentScore - playerScore >= 2)) { BeginGamePointSound(); } if (playerScore == opponentScore) { BeginAllTiedSound(); } } UpdateOpponentScore(); DisplayOpponentFouls(opponentFouls); if (theOpponent.persona == kMissTeak) { if (theOpponent.strategy == kRunDiagonal) theOpponent.teaksThresh++; else if (theOpponent.strategy == kRunCircle) theOpponent.teaksThresh--; if (theOpponent.teaksThresh < 4) theOpponent.teaksThresh = 4; if (theOpponent.teaksThresh > 95) theOpponent.teaksThresh = 95; } if ((!netGameInSession) && (replayGoals)) replayFlag = -50; switch (whichGame) { case kStandardGame: if (opponentScore >= 11) { if (opponentScore >= (playerScore + 2)) { InitiateGameOver(); } } else { if (opponentScore >= (playerScore + 5)) { InitiateGameOver(); } } break; case kTournament: if (opponentScore >= 17) { if (opponentScore >= (playerScore + 3)) { InitiateGameOver(); } } else { if (opponentScore >= (playerScore + 7)) { InitiateGameOver(); } } break; default: break; } } /*======================================================== HandlePlayerFoul */ void HandlePlayerFoul (void) { lengthOfMob = 90; StartMobSound(); if ((whichGame == kPracticeBoardin) || (whichGame == kPracticeScoring)) PlaySoundSMS(kFoulSound); else QueueUpIncidental(kFoulSound, 6, 100); playerFouls++; playerTotalFouls++; if (playerFouls == kCriticalFoul) { playerTotalCrits++; playerFouls = 0; DoOpponentScores(); } DisplayPlayerFouls(playerFouls); if ((!netGameInSession) && (replayFouls)) replayFlag = -90; } /*======================================================== HandleOpponentFoul */ void HandleOpponentFoul (void) { lengthOfApplause = 90; StartApplauseSound(); QueueUpIncidental(kFoulSound, 6, 100); opponentFouls++; opponentTotalFouls++; if (opponentFouls == kCriticalFoul) { opponentTotalCrits++; opponentFouls = 0; DoPlayerScores(); } DisplayOpponentFouls(opponentFouls); if ((!netGameInSession) && (replayFouls)) replayFlag = -90; } /*======================================================== DisplayHoopla */ void DisplayHoopla (void) { #define kDisplayHooplaLoops 5 #define kDisplayHooplaDelay 2 long nextTime; short i, miscShort1; nextTime = Ticks + kDisplayHooplaDelay; DisplayPlayerFouls(1); for (i = 0; i < kDisplayHooplaLoops; i++) /* Blink --> 0:00 X00 000 */ { miscShort1 = RandomInt(10); DisplayScoreDigit(0, miscShort1, 0); while (Ticks < nextTime) { } nextTime = Ticks + kDisplayHooplaDelay; } DisplayScoreDigit(0, 10, 0); DisplayPlayerFouls(2); for (i = 0; i < kDisplayHooplaLoops; i++) /* Blink --> 0:00 0X0 000 */ { miscShort1 = RandomInt(10); DisplayScoreDigit(1, miscShort1, 0); while (Ticks < nextTime) { } nextTime = Ticks + kDisplayHooplaDelay; } DisplayScoreDigit(1, 10, 0); DisplayPlayerFouls(0); for (i = 0; i < kDisplayHooplaLoops; i++) /* Blink --> 0:00 00X 000 */ { miscShort1 = RandomInt(10); DisplayScoreDigit(2, miscShort1, 0); while (Ticks < nextTime) { } nextTime = Ticks + kDisplayHooplaDelay; } DisplayScoreDigit(2, 10, 0); DisplayOpponentFouls(1); for (i = 0; i < kDisplayHooplaLoops; i++) /* Blink --> 0:00 000 X00 */ { miscShort1 = RandomInt(10); DisplayScoreDigit(0, miscShort1, 1); while (Ticks < nextTime) { } nextTime = Ticks + kDisplayHooplaDelay; } DisplayScoreDigit(0, 10, 1); DisplayOpponentFouls(2); for (i = 0; i < kDisplayHooplaLoops; i++) /* Blink --> 0:00 000 0X0 */ { miscShort1 = RandomInt(10); DisplayScoreDigit(1, miscShort1, 1); while (Ticks < nextTime) { } nextTime = Ticks + kDisplayHooplaDelay; } DisplayScoreDigit(1, 10, 1); DisplayOpponentFouls(0); for (i = 0; i < kDisplayHooplaLoops; i++) /* Blink --> 0:00 000 00X */ { miscShort1 = RandomInt(10); DisplayScoreDigit(2, miscShort1, 1); while (Ticks < nextTime) { } nextTime = Ticks + kDisplayHooplaDelay; } DisplayScoreDigit(2, 10, 1); } /*======================================================== DoNetGameSetUp */ Boolean DoNetGameSetUp (void) { OSErr theErr; Boolean itWorked; masterSendSize = (short)sizeof(masterSendType); slaveSendSize = (short)sizeof(slaveSendType); spotPoints = 0; spottedPoints = 0; theErr = RegisterNameOnNet(); if (theErr != noErr) { MinorError(kMinorRegisterFailed); return(FALSE); } itWorked = SelectNetOpponentAsynch(); if (!itWorked) { theErr = DeRegisterName(); return(FALSE); } itWorked = SpotPoints(); itWorked = WaitForSynch(3600); if (!itWorked) { MinorError(kMinorSynchFailed); theErr = DeRegisterName(); return(FALSE); } itWorked = ConfirmEnvironmentMatch(); if (!itWorked) { theErr = DeRegisterName(); return(FALSE); } theErr = DeRegisterName(); netGameInSession = TRUE; madeThePickUp = FALSE; loopDelay = 1; frameCounter = 0; newFrameCount = 0; lastFrameCount = 0; droppedPackets = 0; sentPackets = 0; wasLastSound = 0; lastSoundPriority = 0; return (TRUE); } /*======================================================== CantRepeatTournament */ Boolean CantRepeatTournament (void) { Str255 theText; short sheWants; GetIndString(theText, rMiscStrings, 23); ParamText(theText, "\p", "\p", "\p"); CenterAlert(rCantRepeatAlertID); sheWants = Alert(rCantRepeatAlertID, kNilPointer); if (sheWants == 1) return (TRUE); else return (FALSE); } /*======================================================== MustProLeagueTournament */ Boolean MustProLeagueTournament (void) { Str255 theText; short sheWants; GetIndString(theText, rMiscStrings, 24); ParamText(theText, "\p", "\p", "\p"); CenterAlert(rCantRepeatAlertID); sheWants = Alert(rCantRepeatAlertID, kNilPointer); if (sheWants == 1) return (TRUE); else return (FALSE); } /*======================================================== CanWePlay */ Boolean CanWePlay (void) { short statusFlag; Boolean sheSaid; if ((netOnly) && (theOpponent.persona != kNetHuman)) { MinorError(kMinorNetworkOnlyRestrict); primaryMode = kIdleMode; return (FALSE); } if ((thePlayer.persona == kHumanPlayer) && (theOpponent.persona != kNetHuman) && (whichGame == kTournament)) { switch (theOpponent.persona) { case kSimpleGeorge: statusFlag = theStats[whichHumanNumber - 1].georgeState; break; case kMadMara: statusFlag = theStats[whichHumanNumber - 1].maraState; break; case kHeavyOtto: statusFlag = theStats[whichHumanNumber - 1].ottoState; break; case kCleverClaire: statusFlag = theStats[whichHumanNumber - 1].claireState; break; case kMisterEaze: statusFlag = theStats[whichHumanNumber - 1].eazeState; break; case kMissTeak: statusFlag = theStats[whichHumanNumber - 1].teakState; break; default: break; } if (statusFlag != kUnplayedState) { sheSaid = CantRepeatTournament(); if (sheSaid) { whichGame = kStandardGame; CheckGameMenu(); } else { primaryMode = kIdleMode; return (FALSE); } } } if ((thePlayer.persona == kHumanPlayer) && (theOpponent.persona != kNetHuman) && (whichGame == kTournament) && (isLeague != kProfessional)) { sheSaid = MustProLeagueTournament(); if (sheSaid) { whichGame = kStandardGame; CheckGameMenu(); } else { primaryMode = kIdleMode; return (FALSE); } } if ((theOpponent.persona == kNetHuman) && (whichGame == kTournament)) { MinorError(kMinorNetCantTournament); whichGame = kStandardGame; CheckGameMenu(); } if ((thePlayer.persona != kHumanPlayer) && (theOpponent.persona != kHumanPlayer) && (whichGame != kStandardGame)) { MinorError(kMinorNetCantPractice); whichGame = kStandardGame; CheckGameMenu(); } return (TRUE); } /*======================================================== PrepareNewGame */ void PrepareNewGame (void) { long dummyLong; OSErr theErr; short i; Boolean itWorked; if (splashIsUp) { DissolveWorkToMain(); RefreshMainWindow(); splashIsUp = FALSE; } if ((autoTeamsDialog) && (whichGame > kPracticeScoring)) { itWorked = DoTeamsSetUp(); if (itWorked) { WhosOnFirst(); UpdateGoalPicts(FALSE); } else { primaryMode = kIdleMode; DrawMenuBar(); return; } } if (!CanWePlay()) { DrawMenuBar(); return; } leftScoredLast = RandomCoin(); netGameInSession = FALSE; if ((theOpponent.persona == kNetHuman) && (whichGame > kPracticeScoring)) { itWorked = DoNetGameSetUp(); if (!itWorked) { primaryMode = kIdleMode; DrawMenuBar(); return; } WhosOnFirst(); } ResetBall(); ResetPerson(&thePlayer); ResetPerson(&theOpponent); thePlayer.wasRect = thePlayer.isRect; theOpponent.wasRect = theOpponent.isRect; theBall.wasRect = theBall.isRect; SetMBarToPlaying(); HideMenuBar((GrafPtr)mainWndo); EraseMenuBarRect(); UpdateGoalPicts(FALSE); RefreshMainWindow(); TurnSMSOn(); FlushSoundQueues(); StartCrowdSound(); if ((enableAnnouncer) && (whichGame > kPracticeScoring)) { DoOpeningAnnouncer(); } else { lengthOfApplause = 300; StartApplauseSound(); Delay(kApplauseSwellTicks, &dummyLong); crowdQueue.when = 1; HandleCrowdSound(); } DisplayHoopla(); if (netGameInSession) { playerScore = spottedPoints; opponentScore = spotPoints; } else { playerScore = 0; opponentScore = 0; } playerFouls = 0; opponentFouls = 0; playerTotalGoals = 0; opponentTotalGoals = 0; playerTotalFouls = 0; opponentTotalFouls = 0; playerTotalCrits = 0; opponentTotalCrits = 0; if (thePlayer.persona == kHumanPlayer) theOpponent.teaksThresh = teaksThreshholds[whichHumanNumber - 1]; replayFlag = 0; if (canReplay) { replayData->frame = 0; replayData->lastFrame = 0; } UpdatePlayerScore(); UpdateOpponentScore(); for (i = 0; i < kMaxReplayFrames; i++) AmassReplayData(); newGame = FALSE; gameIsOver = FALSE; wasBrakeOn = FALSE; drawThisFrame = TRUE; baseTime = Ticks / 60; timeElapsed = 0; wasTime = 0; DrawNames(); if (netGameInSession) { InitializeMessages(); itWorked = WaitForSynch(3600); if (!itWorked) { MinorError(kMinorSynchFailed); primaryMode = kIdleMode; ShowMenuBar((GrafPtr)mainWndo); FixVisRegion(); InitCursor(); return; } } HideCursor(); } \ No newline at end of file diff --git a/Sources/PlayerStats.c b/Sources/PlayerStats.c new file mode 100755 index 0000000..8810a5e --- /dev/null +++ b/Sources/PlayerStats.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Player Statistics Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "PlayerStats.h" /*======================================================== Functions */ /*======================================================== EraseStats */ void EraseStats (short whoBitesIt) { theStats[whoBitesIt - 1].tournamentTime = 0L; theStats[whoBitesIt - 1].bestPlatinumTime = 0L; theStats[whoBitesIt - 1].copperTitles = 0; theStats[whoBitesIt - 1].bronzeTitles = 0; theStats[whoBitesIt - 1].silverTitles = 0; theStats[whoBitesIt - 1].goldTitles = 0; theStats[whoBitesIt - 1].platinumTitles = 0; theStats[whoBitesIt - 1].played = 0; theStats[whoBitesIt - 1].won = 0; theStats[whoBitesIt - 1].goals = 0; theStats[whoBitesIt - 1].fouls = 0; theStats[whoBitesIt - 1].criticals = 0; theStats[whoBitesIt - 1].oppGoals = 0; theStats[whoBitesIt - 1].oppFouls = 0; theStats[whoBitesIt - 1].oppCriticals = 0; theStats[whoBitesIt - 1].georgeState = kUnplayedState; theStats[whoBitesIt - 1].maraState = kUnplayedState; theStats[whoBitesIt - 1].ottoState = kUnplayedState; theStats[whoBitesIt - 1].claireState = kUnplayedState; theStats[whoBitesIt - 1].eazeState = kUnplayedState; theStats[whoBitesIt - 1].teakState = kUnplayedState; teaksThreshholds[whoBitesIt - 1] = 50; } /*======================================================== DrawStatsPopUpItem */ void DrawStatsPopUpItem (void) { #define kBottomMargin 5 Str255 menuItem; short itemLeftMargin; InsetRect(&teamsPopUpRect, 1, 1); EraseRect(&teamsPopUpRect); InsetRect(&teamsPopUpRect, -1, -1); GetItem(teamsPopUp, popUpItemSelected, (StringPtr)&menuItem); itemLeftMargin = (teamsPopUpRect.right - teamsPopUpRect.left - StringWidth(menuItem)) / 2; MoveTo(teamsPopUpRect.left + itemLeftMargin, teamsPopUpRect.bottom - kBottomMargin); DrawString(menuItem); } /*======================================================== DrawStatsPopUp */ void DrawStatsPopUp (void) { #define kLeftMargin 5 #define kRightMargin 5 FrameRect(&teamsPopUpRect); MoveTo(teamsPopUpRect.left + 1, teamsPopUpRect.bottom); LineTo(teamsPopUpRect.right, teamsPopUpRect.bottom); LineTo(teamsPopUpRect.right, teamsPopUpRect.top + 1); DrawStatsPopUpItem(); } /*======================================================== RedrawStatValues */ void RedrawStatValues (void) { Str255 tempStr; Rect tempRect; PicHandle checkPict, xPict; short tempShort, i; if (!isColor) TextMode(srcXor); PenMode(patOr); PenPat(gray); SetRect(&tempRect, 0, 0, 60, 35); OffsetRect(&tempRect, 60, 72); if (theStats[popUpItemSelected - 1].copperTitles == 0) PaintRect(&tempRect); else { ForeColor(yellowColor); MoveTo(tempRect.right - 16, tempRect.bottom - 2); NumToString((long)theStats[popUpItemSelected - 1].copperTitles, tempStr); DrawString(tempStr); ForeColor(blackColor); } OffsetRect(&tempRect, 66, 0); if (theStats[popUpItemSelected - 1].bronzeTitles == 0) PaintRect(&tempRect); else { ForeColor(yellowColor); MoveTo(tempRect.right - 16, tempRect.bottom - 2); NumToString((long)theStats[popUpItemSelected - 1].bronzeTitles, tempStr); DrawString(tempStr); ForeColor(blackColor); } OffsetRect(&tempRect, 66, 0); if (theStats[popUpItemSelected - 1].silverTitles == 0) PaintRect(&tempRect); else { ForeColor(yellowColor); MoveTo(tempRect.right - 16, tempRect.bottom - 2); NumToString((long)theStats[popUpItemSelected - 1].silverTitles, tempStr); DrawString(tempStr); ForeColor(blackColor); } OffsetRect(&tempRect, 66, 0); if (theStats[popUpItemSelected - 1].goldTitles == 0) PaintRect(&tempRect); else { ForeColor(yellowColor); MoveTo(tempRect.right - 16, tempRect.bottom - 2); NumToString((long)theStats[popUpItemSelected - 1].goldTitles, tempStr); DrawString(tempStr); ForeColor(blackColor); } OffsetRect(&tempRect, 66, 0); if (theStats[popUpItemSelected - 1].platinumTitles == 0) PaintRect(&tempRect); else { ForeColor(yellowColor); MoveTo(tempRect.right - 16, tempRect.bottom - 2); NumToString((long)theStats[popUpItemSelected - 1].platinumTitles, tempStr); DrawString(tempStr); ForeColor(blackColor); } PenNormal(); SetRect(&tempRect, 0, 0, 76, 17); OffsetRect(&tempRect, 148, 120); FillRect(&tempRect, black); MoveTo(tempRect.left + 6, tempRect.bottom - 4); NumToString((long)theStats[popUpItemSelected - 1].played, tempStr); ForeColor(cyanColor); DrawString(tempStr); ForeColor(blackColor); OffsetRect(&tempRect, 0, 18); FillRect(&tempRect, black); MoveTo(tempRect.left + 6, tempRect.bottom - 4); NumToString((long)theStats[popUpItemSelected - 1].won, tempStr); ForeColor(cyanColor); DrawString(tempStr); ForeColor(blackColor); OffsetRect(&tempRect, 0, 18); FillRect(&tempRect, black); MoveTo(tempRect.left + 6, tempRect.bottom - 4); tempShort = theStats[popUpItemSelected - 1].played - theStats[popUpItemSelected - 1].won; NumToString((long)tempShort, tempStr); ForeColor(cyanColor); DrawString(tempStr); ForeColor(blackColor); OffsetRect(&tempRect, 0, 18); FillRect(&tempRect, black); MoveTo(tempRect.left + 6, tempRect.bottom - 4); if (theStats[popUpItemSelected - 1].played != 0) tempShort = (short)((long)theStats[popUpItemSelected - 1].won * 100L / (long)theStats[popUpItemSelected - 1].played); else tempShort = 0; NumToString((long)tempShort, tempStr); ForeColor(cyanColor); DrawString(tempStr); ForeColor(blackColor); OffsetRect(&tempRect, 0, 22); FillRect(&tempRect, black); MoveTo(tempRect.left + 6, tempRect.bottom - 4); NumToString((long)theStats[popUpItemSelected - 1].goals, tempStr); ForeColor(redColor); DrawString(tempStr); ForeColor(blackColor); OffsetRect(&tempRect, 0, 18); FillRect(&tempRect, black); MoveTo(tempRect.left + 6, tempRect.bottom - 4); NumToString((long)theStats[popUpItemSelected - 1].fouls, tempStr); ForeColor(redColor); DrawString(tempStr); ForeColor(blackColor); OffsetRect(&tempRect, 0, 18); FillRect(&tempRect, black); MoveTo(tempRect.left + 6, tempRect.bottom - 4); NumToString((long)theStats[popUpItemSelected - 1].criticals, tempStr); ForeColor(redColor); DrawString(tempStr); ForeColor(blackColor); OffsetRect(&tempRect, 0, 22); FillRect(&tempRect, black); MoveTo(tempRect.left + 6, tempRect.bottom - 4); NumToString((long)theStats[popUpItemSelected - 1].oppGoals, tempStr); ForeColor(magentaColor); DrawString(tempStr); ForeColor(blackColor); OffsetRect(&tempRect, 0, 18); FillRect(&tempRect, black); MoveTo(tempRect.left + 6, tempRect.bottom - 4); NumToString((long)theStats[popUpItemSelected - 1].oppFouls, tempStr); ForeColor(magentaColor); DrawString(tempStr); ForeColor(blackColor); OffsetRect(&tempRect, 0, 18); FillRect(&tempRect, black); MoveTo(tempRect.left + 6, tempRect.bottom - 4); NumToString((long)theStats[popUpItemSelected - 1].oppCriticals, tempStr); ForeColor(magentaColor); DrawString(tempStr); ForeColor(blackColor); if (isColor) { checkPict = GetPicture(kCheck4PictID); xPict = GetPicture(kX4PictID); } else { checkPict = GetPicture(kCheck1PictID); xPict = GetPicture(kX1PictID); } if ((checkPict != kNilPointer) && (xPict != kNilPointer)) { HLock((Handle)checkPict); tempRect = (**checkPict).picFrame; HUnlock((Handle)checkPict); OffsetRect(&tempRect, -tempRect.left, -tempRect.top); OffsetRect(&tempRect, 370, 158); if (theStats[popUpItemSelected - 1].georgeState == kLostState) DrawPicture(xPict, &tempRect); else if (theStats[popUpItemSelected - 1].georgeState >= kWonState) DrawPicture(checkPict, &tempRect); else FillRect(&tempRect, black); OffsetRect(&tempRect, 0, 18); if (theStats[popUpItemSelected - 1].maraState == kLostState) DrawPicture(xPict, &tempRect); else if (theStats[popUpItemSelected - 1].maraState >= kWonState) DrawPicture(checkPict, &tempRect); else FillRect(&tempRect, black); OffsetRect(&tempRect, 0, 18); if (theStats[popUpItemSelected - 1].ottoState == kLostState) DrawPicture(xPict, &tempRect); else if (theStats[popUpItemSelected - 1].ottoState >= kWonState) DrawPicture(checkPict, &tempRect); else FillRect(&tempRect, black); OffsetRect(&tempRect, 0, 18); if (theStats[popUpItemSelected - 1].claireState == kLostState) DrawPicture(xPict, &tempRect); else if (theStats[popUpItemSelected - 1].claireState >= kWonState) DrawPicture(checkPict, &tempRect); else FillRect(&tempRect, black); OffsetRect(&tempRect, 0, 18); if (theStats[popUpItemSelected - 1].eazeState == kLostState) DrawPicture(xPict, &tempRect); else if (theStats[popUpItemSelected - 1].eazeState >= kWonState) DrawPicture(checkPict, &tempRect); else FillRect(&tempRect, black); OffsetRect(&tempRect, 0, 18); if (theStats[popUpItemSelected - 1].teakState == kLostState) DrawPicture(xPict, &tempRect); else if (theStats[popUpItemSelected - 1].teakState >= kWonState) DrawPicture(checkPict, &tempRect); else FillRect(&tempRect, black); ReleaseResource((Handle)checkPict); ReleaseResource((Handle)xPict); } } /*======================================================== UpdateStatsDialog */ void UpdateStatsDialog (DialogPtr theDialog) { PicHandle thePict; Handle iHandle; Rect iRect; Str255 theTitle; short iType; DrawDialog(theDialog); GetDItem(theDialog, kStatsTitles, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kTitles4PictID); else thePict = GetPicture(kTitles1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetDItem(theDialog, kStatsTallys, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kTallys4PictID); else thePict = GetPicture(kTallys1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetDItem(theDialog, kStatsDefeated, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kDefeated4PictID); else thePict = GetPicture(kDefeated1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetDItem(theDialog, kStatsBalloon, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kBalloon4PictID); else thePict = GetPicture(kBalloon1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetIndString(theTitle, rMiscStrings, 5); if (theTitle[0] == 0) PasStringCopy((StringPtr)"\pPlayer Stats", (StringPtr)theTitle); MoveTo(kStatsTitleLeft, kStatsTitleTop); DrawString(theTitle); RedrawStatValues(); DrawStatsPopUp(); DrawDefaultButton(theDialog, kStatsOkay); } /*======================================================== DoStatsPopUpSelect */ void DoStatsPopUpSelect (DialogPtr theDialog) { Point popUpperLeft; long theChoice; popUpperLeft.v = teamsPopUpRect.top + 1; popUpperLeft.h = teamsPopUpRect.left; LocalToGlobal(&popUpperLeft); theChoice = PopUpMenuSelect(teamsPopUp, popUpperLeft.v, popUpperLeft.h, popUpItemSelected); if (LoWrd(theChoice) > 0) { popUpItemSelected = LoWrd(theChoice); DrawStatsPopUpItem(); UpdateStatsDialog(theDialog); RedrawStatValues(); } } /*======================================================== StatsFilter */ pascal Boolean StatsFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit) { switch (theEvent->what) { case keyDown: switch ((theEvent->message) & charCodeMask) { case kReturnKeyASCII: case kEnterKeyASCII: FlashDialogButton(theDialog, kStatsOkay); *itemHit = kStatsOkay; return(TRUE); break; default: return(FALSE); } break; case updateEvt: BeginUpdate((GrafPtr)theDialog); UpdateStatsDialog(theDialog); EndUpdate((GrafPtr)theDialog); theEvent->what = nullEvent; return(FALSE); break; default: return(FALSE); break; } } /*======================================================== DoPlayerStats */ Boolean DoPlayerStats (void) { DialogPtr statsDialog; Handle iHandle; Rect iRect; short itemHit, iType, i, sheSaid; Boolean leaveDialog, userOkayed, wasState; CenterDialog(rStatsDialogID); if (doZooms) ZoomOutDialogRect(rStatsDialogID); statsDialog = GetNewDialog(rStatsDialogID, kNilPointer, kPutInFront); SetPort((GrafPtr)statsDialog); ShowWindow((GrafPtr)statsDialog); teamsPopUp = GetMenu(kStatsPopMenuID); if (teamsPopUp == kNilPointer) DeathError(kErrNoResource); InsertMenu(teamsPopUp, -1); HLock((Handle)teamsPopUp); teamsPopUpWidth = StringWidth((**teamsPopUp).menuData); HUnlock((Handle)teamsPopUp); for (i = 0; i < 10; i++) { SetItem(teamsPopUp, i + 1, (StringPtr)theNames[i]); } GetDItem(statsDialog, kStatsPopUp, &iType, &iHandle, &teamsPopUpRect); popUpItemSelected = whichHumanNumber; UpdateStatsDialog(statsDialog); leaveDialog = FALSE; while (!leaveDialog) { ModalDialog(StatsFilter, &itemHit); switch (itemHit) { case kStatsOkay: whichHumanNumber = popUpItemSelected; userOkayed = TRUE; leaveDialog = TRUE; break; case kStatsPopUp: DoStatsPopUpSelect(statsDialog); break; case kStatsErase: CenterAlert(rEraseStatsAlertID); sheSaid = Alert(rEraseStatsAlertID, kNilPointer); if (sheSaid != kEraseStatsOkay) EraseStats(popUpItemSelected); UpdateStatsDialog(statsDialog); break; default: break; } } DisposDialog(statsDialog); return (userOkayed); } /*======================================================== ResetWorldRecords */ void ResetWorldRecords (void) { PasStringCopy((StringPtr)"\pNo one", (StringPtr)mostTitlesName); GetDateTime((unsigned long *)&mostTitlesDate); mostTitles = 0; PasStringCopy((StringPtr)"\pNo one", (StringPtr)mostPointsName); GetDateTime((unsigned long *)&mostPointsDate); mostPoints = 0; PasStringCopy((StringPtr)"\pNo one", (StringPtr)mostFoulsName); GetDateTime((unsigned long *)&mostFoulsDate); mostFouls = 0; PasStringCopy((StringPtr)"\pNo one", (StringPtr)mostCritsName); GetDateTime((unsigned long *)&mostCritsDate); mostCrits = 0; } \ No newline at end of file diff --git a/Sources/Prefs.c b/Sources/Prefs.c new file mode 100755 index 0000000..ee88585 --- /dev/null +++ b/Sources/Prefs.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Preferences Handling File ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "Prefs.h" #include #include #include #include "FileError.h" /*======================================================== Globals */ extern macEnvironment thisMac; /*======================================================== CanUseFindFolder */ Boolean CanUseFindFolder (void) { OSErr theErr; long theFeature; if (!thisMac.hasGestalt) return(FALSE); theErr = Gestalt(gestaltFindFolderAttr, &theFeature); if (theErr != noErr) return(FALSE); if (!BitTst(&theFeature, 31 - gestaltFindFolderPresent)) return(FALSE); return(TRUE); } /*======================================================== GetPrefsFPathSyst7 */ Boolean GetPrefsFPathSyst7 (long *prefDirID, short *systemVolRef) { OSErr theErr; theErr = FindFolder(kOnSystemDisk, kPreferencesFolderType, kCreateFolder, systemVolRef, prefDirID); if (theErr != noErr) return(FALSE); return(TRUE); } /*======================================================== CreatePrefsFolder */ Boolean CreatePrefsFolder (short *systemVolRef) { HFileParam fileParamBlock; Str255 folderName; OSErr theErr; GetIndString(folderName, rPrefsStringsID, kPrefsFNameIndex); if (folderName[0] == 0) PasStringCopy((StringPtr)&folderName, (StringPtr)kDefaultPrefFName); fileParamBlock.ioVRefNum = *systemVolRef; fileParamBlock.ioDirID = 0; fileParamBlock.ioNamePtr = folderName; fileParamBlock.ioCompletion = kNilPointer; theErr = PBDirCreate((HParmBlkPtr)&fileParamBlock, FALSE); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } return(TRUE); } /*======================================================== GetPrefsFPathSyst6 */ Boolean GetPrefsFPathSyst6 (short *systemVolRef) { Str255 folderName; SysEnvRec thisWorld; CInfoPBRec catalogInfoPB; DirInfo *directoryInfo = (DirInfo *) &catalogInfoPB; HFileInfo *fileInfo = (HFileInfo *) &catalogInfoPB; WDPBRec workingDirPB; long prefDirID; OSErr theErr; GetIndString(folderName, rPrefsStringsID, kPrefsFNameIndex); if (folderName[0] == 0) PasStringCopy((StringPtr)&folderName, (StringPtr)kDefaultPrefFName); theErr = SysEnvirons(2, &thisWorld); if (theErr != noErr) return(FALSE); *systemVolRef = thisWorld.sysVRefNum; fileInfo->ioVRefNum = *systemVolRef; fileInfo->ioDirID = 0; fileInfo->ioFDirIndex = 0; fileInfo->ioNamePtr = folderName; fileInfo->ioCompletion = kNilPointer; theErr = PBGetCatInfo(&catalogInfoPB, FALSE); if (theErr != noErr) { if (theErr != fnfErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } if (!CreatePrefsFolder(systemVolRef)) return(FALSE); directoryInfo->ioVRefNum = *systemVolRef; directoryInfo->ioFDirIndex = 0; directoryInfo->ioNamePtr = folderName; theErr = PBGetCatInfo(&catalogInfoPB, FALSE); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } } prefDirID = directoryInfo->ioDrDirID; workingDirPB.ioNamePtr = nil; workingDirPB.ioVRefNum = *systemVolRef; workingDirPB.ioWDIndex = 0; workingDirPB.ioWDProcID = 0; workingDirPB.ioWDVRefNum = 0; workingDirPB.ioCompletion = kNilPointer; theErr = PBGetWDInfo(&workingDirPB, FALSE); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } *systemVolRef = workingDirPB.ioWDVRefNum; workingDirPB.ioNamePtr = nil; workingDirPB.ioWDDirID = prefDirID; workingDirPB.ioVRefNum = *systemVolRef; workingDirPB.ioWDProcID = 0; workingDirPB.ioCompletion = kNilPointer; theErr = PBOpenWD(&workingDirPB, FALSE); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } *systemVolRef = workingDirPB.ioVRefNum; return(TRUE); } /*======================================================== WritePrefsFileSyst7 */ Boolean WritePrefsFileSyst7 (long *prefDirID, short *systemVolRef, prefsInfo *thePrefs) { OSErr theErr; short fileRefNum; long byteCount; FSSpec theSpecs; Str255 fileName = kPrefFileName; theErr = FSMakeFSSpec(*systemVolRef, *prefDirID, fileName, &theSpecs); if (theErr != noErr) { if (theErr != fnfErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } theErr = FSpCreate(&theSpecs, kPrefCreatorType, kPrefFileType, smSystemScript); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } } theErr = FSpOpenDF(&theSpecs, fsRdWrPerm, &fileRefNum); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } byteCount = sizeof(*thePrefs); theErr = FSWrite(fileRefNum, &byteCount, thePrefs); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } theErr = FSClose(fileRefNum); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } return(TRUE); } /*======================================================== WritePrefsFileSyst6 */ Boolean WritePrefsFileSyst6 (short *systemVolRef, prefsInfo *thePrefs) { OSErr theErr; short fileRefNum; long byteCount; Str255 fileName = kPrefFileName; theErr = FSOpen(fileName, *systemVolRef, &fileRefNum); if (theErr != noErr) { if (theErr != fnfErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } theErr = Create(fileName, *systemVolRef, kPrefCreatorType, kPrefFileType); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } theErr = FSOpen(fileName, *systemVolRef, &fileRefNum); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } } byteCount = sizeof(*thePrefs); theErr = FSWrite(fileRefNum, &byteCount, thePrefs); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } theErr = FSClose(fileRefNum); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } return(TRUE); } /*======================================================== SavePrefs */ Boolean SavePrefs (prefsInfo *thePrefs) { long prefDirID, systemDirID; short systemVolRef; Boolean canUseFSSpecs, noProblems; canUseFSSpecs = thisMac.hasSystem7; if (canUseFSSpecs) { canUseFSSpecs = CanUseFindFolder(); if (canUseFSSpecs) noProblems = GetPrefsFPathSyst7(&prefDirID, &systemVolRef); else noProblems = GetPrefsFPathSyst6(&systemVolRef); if (!noProblems) return(FALSE); } else { noProblems = GetPrefsFPathSyst6(&systemVolRef); if (!noProblems) return(FALSE); } if (canUseFSSpecs) { if (!WritePrefsFileSyst7(&prefDirID, &systemVolRef, thePrefs)) return(FALSE); } else { if (!WritePrefsFileSyst6(&systemVolRef, thePrefs)) return(FALSE); } return(TRUE); } /*======================================================== ReadPrefsFileSyst7 */ Boolean ReadPrefsFileSyst7 (long *prefDirID, short *systemVolRef, prefsInfo *thePrefs) { OSErr theErr; short fileRefNum; long byteCount; FSSpec theSpecs; Str255 fileName = kPrefFileName; theErr = FSMakeFSSpec(*systemVolRef, *prefDirID, fileName, &theSpecs); if (theErr != noErr) { if (theErr == fnfErr) return(FALSE); else { CheckFileError(theErr, "\pPreferences"); return(FALSE); } } theErr = FSpOpenDF(&theSpecs, fsRdWrPerm, &fileRefNum); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } byteCount = sizeof(*thePrefs); theErr = FSRead(fileRefNum, &byteCount, thePrefs); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); theErr = FSClose(fileRefNum); return(FALSE); } theErr = FSClose(fileRefNum); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } return(TRUE); } /*======================================================== ReadPrefsFileSyst6 */ Boolean ReadPrefsFileSyst6 (short *systemVolRef, prefsInfo *thePrefs) { OSErr theErr; short fileRefNum; long byteCount; Str255 fileName = kPrefFileName; theErr = FSOpen(fileName, *systemVolRef, &fileRefNum); if (theErr != noErr) { if (theErr == fnfErr) return(FALSE); else { CheckFileError(theErr, "\pPreferences"); return(FALSE); } } byteCount = sizeof(*thePrefs); theErr = FSRead(fileRefNum, &byteCount, thePrefs); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); theErr = FSClose(fileRefNum); return(FALSE); } theErr = FSClose(fileRefNum); if (theErr != noErr) { CheckFileError(theErr, "\pPreferences"); return(FALSE); } return(TRUE); } /*======================================================== LoadPrefs */ Boolean LoadPrefs (prefsInfo *thePrefs) { long prefDirID, systemDirID; short systemVolRef; Boolean canUseFSSpecs, noProblems; canUseFSSpecs = thisMac.hasSystem7; if (canUseFSSpecs) { canUseFSSpecs = CanUseFindFolder(); if (canUseFSSpecs) noProblems = GetPrefsFPathSyst7(&prefDirID, &systemVolRef); else noProblems = GetPrefsFPathSyst6(&systemVolRef); if (!noProblems) return(FALSE); } else { noProblems = GetPrefsFPathSyst6(&systemVolRef); if (!noProblems) return(FALSE); } if (canUseFSSpecs) { noProblems = ReadPrefsFileSyst7(&prefDirID, &systemVolRef, thePrefs); if (!noProblems) return(FALSE); } else { noProblems = ReadPrefsFileSyst6(&systemVolRef, thePrefs); if (!noProblems) return(FALSE); } return(TRUE); } \ No newline at end of file diff --git a/Sources/Render.c b/Sources/Render.c new file mode 100755 index 0000000..47f40de --- /dev/null +++ b/Sources/Render.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Rendering Directing Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "Render.h" #include "RenderAsm1.h" #include "RenderAsm4.h" #include "RenderQD.h" /*======================================================== Functions */ /*======================================================== FillInTheSrcAndMaskRect */ void FillInTheSrcAndMaskRect (playerType *who) { if (who->selector == kPlayerSelector) { if (leftGoalIsPlayers) who->srcRect = playerSrcRects[who->dirFlagSrc][who->postFlagSrc]; else who->srcRect = opponentSrcRects[who->dirFlagSrc][who->postFlagSrc]; } else { if (leftGoalIsPlayers) who->srcRect = opponentSrcRects[who->dirFlagSrc][who->postFlagSrc]; else who->srcRect = playerSrcRects[who->dirFlagSrc][who->postFlagSrc]; } if (who->arrayFlagMask == kMask) { who->maskRect = playerSrcRects[who->dirFlagMask][who->postFlagMask]; } else { who->maskRect = fadeMaskRects[who->dirFlagMask][who->postFlagMask]; } } /*======================================================== FillInTheSrcAndMaskAddr */ void FillInTheSrcAndMaskAddr (playerType *who) { if (who->selector == kPlayerSelector) { if (leftGoalIsPlayers) who->srcAddr = playerSrcAddrs[who->dirFlagSrc][who->postFlagSrc]; else who->srcAddr = opponentSrcAddrs[who->dirFlagSrc][who->postFlagSrc]; } else { if (leftGoalIsPlayers) who->srcAddr = opponentSrcAddrs[who->dirFlagSrc][who->postFlagSrc]; else who->srcAddr = playerSrcAddrs[who->dirFlagSrc][who->postFlagSrc]; } if (who->arrayFlagMask == kMask) who->maskAddr = maskAddrs[who->dirFlagMask][who->postFlagMask]; else who->maskAddr = fadeMaskAddrs[who->dirFlagMask][who->postFlagMask]; } /*======================================================== DetermineFrameRate */ void DetermineFrameRate (void) { if (doSkipFrames) { if ((Ticks % kFramesToSkip) == 0) drawThisFrame = TRUE; else drawThisFrame = FALSE; } else drawThisFrame = TRUE; } /*======================================================== HandlePreGraphics */ void HandlePreGraphics (void) { if (netGameInSession) { if (imTheMaster) { playerInBack = (thePlayer.zPos > theOpponent.zPos); } else if (!madeThePickUp) { return; } } else { playerInBack = (thePlayer.zPos > theOpponent.zPos); } if (useQD) { FillInTheSrcAndMaskRect(&thePlayer); FillInTheSrcAndMaskRect(&theOpponent); } else { FillInTheSrcAndMaskAddr(&thePlayer); FillInTheSrcAndMaskAddr(&theOpponent); } } /*======================================================== HandlePostGraphics */ void HandlePostGraphics (void) { if (netGameInSession) { if ((!imTheMaster) && (!madeThePickUp)) return; } if (drawThisFrame) { theBall.eraser = theBall.isRect; thePlayer.wasRect = thePlayer.isRect; theOpponent.wasRect = theOpponent.isRect; theBall.wasRect = theBall.isRect; boardCursor.wasRect = boardCursor.isRect; } } /*======================================================== RenderScene */ void RenderScene (void) { if (netGameInSession) { if ((!imTheMaster) && (!madeThePickUp)) return; } if (useQD) { if (isColor) RenderSceneQDC(); else RenderSceneQD1(); } else { switch (isDepth) { case kDisplay1Bit: RenderSceneAsm1(); break; case kDisplay4Bit: RenderSceneAsm4(); break; case kDisplay8Bit: break; } } } /*======================================================== DisplayScoreDigit */ void DisplayScoreDigit (short place, short digit, short who) { if (isColor) DisplayScoreDigitQDC(place, digit, who); else DisplayScoreDigitQD1(place, digit, who); } /*======================================================== DisplayPlayerFouls */ void DisplayPlayerFouls (short fouls) { if (isColor) DisplayPlayerFoulsQDC(fouls); else DisplayPlayerFoulsQD1(fouls); } /*======================================================== DisplayOpponentFouls */ void DisplayOpponentFouls (short fouls) { if (isColor) DisplayOpponentFoulsQDC(fouls); else DisplayOpponentFoulsQD1(fouls); } /*======================================================== TwinkleAStar */ void TwinkleAStar (void) { short starNumber, colorNumber; starNumber = RandomInt(kNumberOfStars); colorNumber = RandomInt(kNumberOfStarColors); if (splashIsUp) { starNumber = 0; colorNumber = 0; } if (isColor) TwinkleAStarQDC(starNumber, colorNumber); else TwinkleAStarQD1(starNumber); } /*======================================================== DrawAllStars */ void DrawAllStars (void) { short i, colorNumber; for (i = 0; i < kNumberOfStars; i++) { colorNumber = RandomInt(kNumberOfStarColors); if (isColor) DrawOffscreenAStarQDC(i, colorNumber); else DrawOffscreenAStarQD1(i); } } /*======================================================== UpdateArrows */ void UpdateArrows (void) { if (isColor) UpdateArrowsQDC(); else UpdateArrowsQD1(); } /*======================================================== UpdateBallTimers */ void UpdateBallTimers (playerType *who) { Rect tempRect; if (who->selector == kPlayerSelector) { if (leftGoalIsPlayers) tempRect = leftTimingDest; else tempRect = rightTimingDest; } else { if (leftGoalIsPlayers) tempRect = rightTimingDest; else tempRect = leftTimingDest; } tempRect.bottom = tempRect.top + ((kLoopLimitOnHeldBall - who->loopsBallHeld) / kTimingScale); if (isColor) UpdateBallTimersQDC(&tempRect); else UpdateBallTimersQD1(&tempRect); } \ No newline at end of file diff --git a/Sources/RenderAsm1.c b/Sources/RenderAsm1.c new file mode 100755 index 0000000..6c70817 --- /dev/null +++ b/Sources/RenderAsm1.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== 1-Bit Assembler Rendering Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "RenderAsm1.h" /*======================================================== Functions */ /*======================================================== DropDoorToWorkMapAsm1 */ void DropDoorToWorkMapAsm1 (void) { long srcAddress, destAddress; srcAddress = theDoor.srcAddrs[theDoor.doorOpen][theDoor.doorState]; destAddress = theDoor.workDestAddr[theDoor.doorOpen]; asm 68000 { move.l srcAddress, a0 ; src bitmap address move.l destAddress, a1 ; dest screen address ; 0 = source 1 = dest move.w partsRowBytes, d0 ; next row offset move.w workRowBytes, d1 ; next row offset move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 12 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 13 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 14 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 15 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 16 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 17 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 18 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 19 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 20 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 21 } destAddress = theDoor.backDestAddr[theDoor.doorOpen]; asm 68000 { move.l srcAddress, a0 ; src bitmap address move.l destAddress, a1 ; dest screen address ; 0 = source 1 = dest move.w partsRowBytes, d0 ; next row offset move.w workRowBytes, d1 ; next row offset move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 12 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 13 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 14 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 15 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 16 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 17 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 18 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 19 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 20 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 21 } } /*======================================================== MaskCursorAsm1 */ void MaskCursorAsm1 (long dest, short shiftRight) { asm 68000 { move.l a2, -(sp) ; save a2 on stack move.l d3, -(sp) ; save d3 on stack move.l d4, -(sp) ; save d4 on stack move.l d5, -(sp) ; save d5 on stack move.l d6, -(sp) ; save d6 on stack move.l boardCursor.srcAddr, a0 ; src bitmap address move.l dest, a1 ; dest screen address move.l boardCursor.maskAddr, a2 ; mask bitmap address move.w partsRowBytes, d0 ; next row offset (parts) move.w maskRowBytes, d6 ; next row offset (mask) move.w workRowBytes, d1 ; next row offset move.w shiftRight, d2 ; d2 will hold # of bits to shift right move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest move.l (sp)+, d6 ; restore d6 from stack move.l (sp)+, d5 ; restore d5 from stack move.l (sp)+, d4 ; restore d4 from stack move.l (sp)+, d3 ; restore d3 from stack move.l (sp)+, a2 ; restore a2 from stack } } /*======================================================== MaskBallAsm1 */ void MaskBallAsm1 (long dest, short shiftRight) { asm 68000 { move.l a2, -(sp) ; save a2 on stack move.l d3, -(sp) ; save d3 on stack move.l d4, -(sp) ; save d4 on stack move.l d5, -(sp) ; save d5 on stack move.l d6, -(sp) ; save d6 on stack move.l ballSrcAddr, a0 ; src bitmap address move.l dest, a1 ; dest screen address move.l ballMaskAddr, a2 ; mask bitmap address move.w partsRowBytes, d0 ; next row offset (parts) move.w workRowBytes, d1 ; next row offset move.w maskRowBytes, d6 ; next row offset (mask) move.w shiftRight, d2 ; d2 will hold # of bits to shift right move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d6, a2 ; add row offset to mask move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest move.l (sp)+, d6 ; restore d6 from stack move.l (sp)+, d5 ; restore d5 from stack move.l (sp)+, d4 ; restore d4 from stack move.l (sp)+, d3 ; restore d3 from stack move.l (sp)+, a2 ; restore a2 from stack } } /*======================================================== MaskPlayerAsm1 */ void MaskPlayerAsm1 (long src, long dest, long mask, short shiftRight) { asm 68000 { move.l a2, -(sp) ; save a2 on stack move.l d3, -(sp) ; save d3 on stack move.l d4, -(sp) ; save d4 on stack move.l d5, -(sp) ; save d5 on stack move.l d6, -(sp) ; save d6 on stack move.l d7, -(sp) ; save d7 on stack move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address move.l mask, a2 ; mask bitmap address move.w partsRowBytes, d0 ; next row offset (parts) move.w workRowBytes, d1 ; next row offset move.w shiftRight, d2 ; d2 will hold # of bits to shift right move.w #32, d3 ; copy shiftRight to d3 sub.w d2, d3 ; calculate value to shift left in d3 move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #10, a2 ; compensate for mask/parts difference move.l (a2), d4 ; move mask row 1 move.l d4, d5 ; copy the mask to d5 lsr.l d2, d4 ; shift d4 bits to the right lsl.l d3, d5 ; shift d5 bits to the left move.l (a0), d6 ; move src row 1 move.l d6, d7 ; copy the src to d7 lsr.l d2, d6 ; shift d6 bits to the right lsl.l d3, d7 ; shift d7 bits to the left and.l d4, d6 ; clean out unwanted bits and.l d5, d7 ; clean out unwanted bits not.l d4 ; invert mask not.l d5 ; invert mask and.l d4, (a1) ; and mask to dest and.l d5, 4(a1) ; and mask to dest or.l d6, (a1) ; or src to dest or.l d7, 4(a1) ; or src to dest move.l (sp)+, d7 ; restore d7 from stack move.l (sp)+, d6 ; restore d6 from stack move.l (sp)+, d5 ; restore d5 from stack move.l (sp)+, d4 ; restore d4 from stack move.l (sp)+, d3 ; restore d3 from stack move.l (sp)+, a2 ; restore a2 from stack } } /*======================================================== DumpWholePlayerAsm1 */ void DumpWholePlayerAsm1 (long src, long dest) { asm 68000 { move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address ; 0 = source 1 = dest move.w workRowBytes, d0 ; next row offset move.w screenRowBytes, d1 ; next row offset subq.w #4, d0 ; compensate for (a0)+ inc. (4 x +'s) subq.w #4, d1 ; compensate for (a1)+ increment move.l (a0)+,(a1)+ ; move row 1 move.w (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 2 move.w (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 3 move.w (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 4 move.w (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 5 move.w (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 6 move.w (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 7 move.w (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 8 move.w (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 9 move.w (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 10 move.w (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 11 move.w (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 12 move.w (a0),(a1) ; move row 12 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 13 move.w (a0),(a1) ; move row 13 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 14 move.w (a0),(a1) ; move row 14 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 15 move.w (a0),(a1) ; move row 15 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 16 move.w (a0),(a1) ; move row 16 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 17 move.w (a0),(a1) ; move row 17 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 18 move.w (a0),(a1) ; move row 18 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 19 move.w (a0),(a1) ; move row 19 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 20 move.w (a0),(a1) ; move row 20 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 21 move.w (a0),(a1) ; move row 21 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 22 move.w (a0),(a1) ; move row 22 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 23 move.w (a0),(a1) ; move row 23 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 24 move.w (a0),(a1) ; move row 24 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 25 move.w (a0),(a1) ; move row 25 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 26 move.w (a0),(a1) ; move row 26 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 27 move.w (a0),(a1) ; move row 27 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 28 move.w (a0),(a1) ; move row 28 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 29 move.w (a0),(a1) ; move row 29 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 30 move.w (a0),(a1) ; move row 30 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 31 move.w (a0),(a1) ; move row 31 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 32 move.w (a0),(a1) ; move row 32 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 33 move.w (a0),(a1) ; move row 33 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 34 move.w (a0),(a1) ; move row 34 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 35 move.w (a0),(a1) ; move row 35 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 36 move.w (a0),(a1) ; move row 36 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 37 move.w (a0),(a1) ; move row 37 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 38 move.w (a0),(a1) ; move row 38 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 39 move.w (a0),(a1) ; move row 39 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 40 move.w (a0),(a1) ; move row 40 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 41 move.w (a0),(a1) ; move row 41 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 42 move.w (a0),(a1) ; move row 42 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 43 move.w (a0),(a1) ; move row 43 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 44 move.w (a0),(a1) ; move row 44 } } /*======================================================== DumpWholeBallAsm1 */ void DumpWholeBallAsm1 (long src, long dest) { asm 68000 { move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address ; 0 = source 1 = dest move.w workRowBytes, d0 ; next row offset move.w screenRowBytes, d1 ; next row offset move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 1 } } /*======================================================== DumpCursorAsm1 */ void DumpCursorAsm1 (long src, long dest) { asm 68000 { move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address ; 0 = source 1 = dest move.w workRowBytes, d0 ; next row offset move.w screenRowBytes, d1 ; next row offset move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 8 } } /*======================================================== DumpDoorToScreenAsm1 */ void DumpDoorToScreenAsm1 (void) { long srcAddress, destAddress; srcAddress = theDoor.workDestAddr[theDoor.doorOpen]; destAddress = theDoor.screenDestAddr[theDoor.doorOpen]; asm 68000 { move.l srcAddress, a0 ; src bitmap address move.l destAddress, a1 ; dest screen address ; 0 = source 1 = dest move.w workRowBytes, d0 ; next row offset move.w screenRowBytes, d1 ; next row offset move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 12 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 13 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 14 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 15 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 16 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 17 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 18 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 19 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 20 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 21 } } /*======================================================== PatchPlayerAsm1 */ void PatchPlayerAsm1 (long src, long dest) { asm 68000 { move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address ; 0 = source 1 = dest move.w backRowBytes, d0 ; next row offset move.w workRowBytes, d1 ; next row offset subq.w #4, d0 ; compensate for (a0)+ inc. (4 x +'s) subq.w #4, d1 ; compensate for (a1)+ increment move.l (a0)+,(a1)+ ; move row 1 move.w (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 2 move.w (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 3 move.w (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 4 move.w (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 5 move.w (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 6 move.w (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 7 move.w (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 8 move.w (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 9 move.w (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 10 move.w (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 11 move.w (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 12 move.w (a0),(a1) ; move row 12 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 13 move.w (a0),(a1) ; move row 13 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 14 move.w (a0),(a1) ; move row 14 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 15 move.w (a0),(a1) ; move row 15 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 16 move.w (a0),(a1) ; move row 16 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 17 move.w (a0),(a1) ; move row 17 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 18 move.w (a0),(a1) ; move row 18 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 19 move.w (a0),(a1) ; move row 19 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 20 move.w (a0),(a1) ; move row 20 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 21 move.w (a0),(a1) ; move row 21 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 22 move.w (a0),(a1) ; move row 22 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 23 move.w (a0),(a1) ; move row 23 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 24 move.w (a0),(a1) ; move row 24 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 25 move.w (a0),(a1) ; move row 25 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 26 move.w (a0),(a1) ; move row 26 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 27 move.w (a0),(a1) ; move row 27 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 28 move.w (a0),(a1) ; move row 28 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 29 move.w (a0),(a1) ; move row 29 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 30 move.w (a0),(a1) ; move row 30 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 31 move.w (a0),(a1) ; move row 31 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 32 move.w (a0),(a1) ; move row 32 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 33 move.w (a0),(a1) ; move row 33 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 34 move.w (a0),(a1) ; move row 34 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 35 move.w (a0),(a1) ; move row 35 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 36 move.w (a0),(a1) ; move row 36 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 37 move.w (a0),(a1) ; move row 37 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 38 move.w (a0),(a1) ; move row 38 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 39 move.w (a0),(a1) ; move row 39 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 40 move.w (a0),(a1) ; move row 40 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 41 move.w (a0),(a1) ; move row 41 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 42 move.w (a0),(a1) ; move row 42 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 43 move.w (a0),(a1) ; move row 43 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 44 move.w (a0),(a1) ; move row 44 } } /*======================================================== PatchBallAsm1 */ void PatchBallAsm1 (long src, long dest) { asm 68000 { move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address ; 0 = source 1 = dest move.w backRowBytes, d0 ; next row offset move.w workRowBytes, d1 ; next row offset move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 12 } } /*======================================================== PatchCursorAsm1 */ void PatchCursorAsm1 (long src, long dest) { asm 68000 { move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address ; 0 = source 1 = dest move.w backRowBytes, d0 ; next row offset move.w workRowBytes, d1 ; next row offset move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0),(a1) ; move row 8 } } /*======================================================== RenderSceneAsm1 */ void RenderSceneAsm1 (void) { long srcAddress, destAddress; long ballOffIs, playerOffIs, opponentOffIs, cursorOffIs; Point offsetPt; char theMode; ballOffIs = workRowOffsets[theBall.isRect.top] + (long)(((short)theBall.isRect.left & 0xFFF0) >> 3); playerOffIs = workRowOffsets[thePlayer.isRect.top] + (long)(((short)thePlayer.isRect.left & 0xFFF0) >> 3); opponentOffIs = workRowOffsets[theOpponent.isRect.top] + (long)(((short)theOpponent.isRect.left & 0xFFF0) >> 3); offsetPt.h = 0; offsetPt.v = 0; ShieldCursor(&screenRect, offsetPt); if (knowsColor) { theMode = true32b; SwapMMUMode(&theMode); } /* dick with the door */ if (theDoor.stateChanged) DropDoorToWorkMapAsm1(); if ((showBoardCursor) && (!disableBoardCursor) && (drawThisFrame)) { cursorOffIs = workRowOffsets[boardCursor.isRect.top] + (long)(((short)boardCursor.isRect.left & 0xFFF0) >> 3); destAddress = (long)offWorkBits.baseAddr + cursorOffIs; MaskCursorAsm1 (destAddress, boardCursor.isRect.left & 0x000F); } if ((theBall.mode == kBallRolling) && (!theBall.dontDraw) && (drawThisFrame)) { destAddress = (long)offWorkBits.baseAddr + ballOffIs; MaskBallAsm1 (destAddress, theBall.isRect.left & 0x000F); } /* mask the bastards to the work map - back to front! */ if (playerInBack) { if ((thePlayer.mode != kInStasis) && (drawThisFrame)) { destAddress = (long)offWorkBits.baseAddr + playerOffIs; MaskPlayerAsm1(thePlayer.srcAddr, destAddress, thePlayer.maskAddr, thePlayer.isRect.left & 0x000F); } if ((theOpponent.mode != kInStasis) && (drawThisFrame)) { destAddress = (long)offWorkBits.baseAddr + opponentOffIs; MaskPlayerAsm1(theOpponent.srcAddr, destAddress, theOpponent.maskAddr, theOpponent.isRect.left & 0x000F); } } else { if ((theOpponent.mode != kInStasis) && (drawThisFrame)) { destAddress = (long)offWorkBits.baseAddr + opponentOffIs; MaskPlayerAsm1(theOpponent.srcAddr, destAddress, theOpponent.maskAddr, theOpponent.isRect.left & 0x000F); } if ((thePlayer.mode != kInStasis) && (drawThisFrame)) { destAddress = (long)offWorkBits.baseAddr + playerOffIs; MaskPlayerAsm1(thePlayer.srcAddr, destAddress, thePlayer.maskAddr, thePlayer.isRect.left & 0x000F); } } /* blast them to the screen */ if ((thePlayer.mode != kInStasis) && (drawThisFrame)) { srcAddress = (long)offWorkBits.baseAddr + playerOffIs; destAddress = screenRowAddrs[thePlayer.isRect.top] + (long)(((short)thePlayer.isRect.left & 0xFFF0) >> 3); DumpWholePlayerAsm1(srcAddress, destAddress); srcAddress = (long)offWorkBits.baseAddr + workRowOffsets[thePlayer.wasRect.top] + (long)(((short)thePlayer.wasRect.left & 0xFFF0) >> 3); destAddress = screenRowAddrs[thePlayer.wasRect.top] + (long)(((short)thePlayer.wasRect.left & 0xFFF0) >> 3); DumpWholePlayerAsm1(srcAddress, destAddress); } if ((theOpponent.mode != kInStasis) && (drawThisFrame)) { srcAddress = (long)offWorkBits.baseAddr + opponentOffIs; destAddress = screenRowAddrs[theOpponent.isRect.top] + (long)(((short)theOpponent.isRect.left & 0xFFF0) >> 3); DumpWholePlayerAsm1(srcAddress, destAddress); srcAddress = (long)offWorkBits.baseAddr + workRowOffsets[theOpponent.wasRect.top] + (long)(((short)theOpponent.wasRect.left & 0xFFF0) >> 3); destAddress = screenRowAddrs[theOpponent.wasRect.top] + (long)(((short)theOpponent.wasRect.left & 0xFFF0) >> 3); DumpWholePlayerAsm1(srcAddress, destAddress); } if ((theBall.mode == kBallRolling) && (drawThisFrame)) { srcAddress = (long)offWorkBits.baseAddr + ballOffIs; destAddress = screenRowAddrs[theBall.isRect.top] + (long)(((short)theBall.isRect.left & 0xFFF0) >> 3); DumpWholeBallAsm1(srcAddress, destAddress); srcAddress = (long)offWorkBits.baseAddr + workRowOffsets[theBall.wasRect.top] + (long)(((short)theBall.wasRect.left & 0xFFF0) >> 3); destAddress = screenRowAddrs[theBall.wasRect.top] + (long)(((short)theBall.wasRect.left & 0xFFF0) >> 3); DumpWholeBallAsm1(srcAddress, destAddress); } else if (theBall.eraseTheBall) { srcAddress = (long)offWorkBits.baseAddr + workRowOffsets[theBall.eraser.top] + (long)(((short)theBall.eraser.left & 0xFFF0) >> 3); destAddress = screenRowAddrs[theBall.eraser.top] + (long)(((short)theBall.eraser.left & 0xFFF0) >> 3); DumpWholeBallAsm1(srcAddress, destAddress); theBall.eraseTheBall = FALSE; } if ((showBoardCursor) && (!disableBoardCursor) && (drawThisFrame)) { srcAddress = (long)offWorkBits.baseAddr + cursorOffIs; destAddress = screenRowAddrs[boardCursor.isRect.top] + (long)(((short)boardCursor.isRect.left & 0xFFF0) >> 3); DumpCursorAsm1(srcAddress, destAddress); srcAddress = (long)offWorkBits.baseAddr + workRowOffsets[boardCursor.wasRect.top] + (long)(((short)boardCursor.wasRect.left & 0xFFF0) >> 3); destAddress = screenRowAddrs[boardCursor.wasRect.top] + (long)(((short)boardCursor.wasRect.left & 0xFFF0) >> 3); DumpCursorAsm1(srcAddress, destAddress); } if (theDoor.stateChanged) DumpDoorToScreenAsm1(); /* plug up the holes on the work map */ if ((thePlayer.mode != kInStasis) && (drawThisFrame)) { srcAddress = (long)offBackBits.baseAddr + playerOffIs; destAddress = (long)offWorkBits.baseAddr + playerOffIs; PatchPlayerAsm1(srcAddress, destAddress); } if ((theOpponent.mode != kInStasis) && (drawThisFrame)) { srcAddress = (long)offBackBits.baseAddr + opponentOffIs; destAddress = (long)offWorkBits.baseAddr + opponentOffIs; PatchPlayerAsm1(srcAddress, destAddress); } if ((theBall.mode == kBallRolling) && (drawThisFrame)) { srcAddress = (long)offBackBits.baseAddr + ballOffIs; destAddress = (long)offWorkBits.baseAddr + ballOffIs; PatchBallAsm1(srcAddress, destAddress); } if ((showBoardCursor) && (!disableBoardCursor) && (drawThisFrame)) { srcAddress = (long)offBackBits.baseAddr + cursorOffIs; destAddress = (long)offWorkBits.baseAddr + cursorOffIs; PatchCursorAsm1(srcAddress, destAddress); } if (knowsColor) SwapMMUMode(&theMode); ShowCursor(); } /*======================================================== ReplayWorkToMainAsm1 */ void ReplayWorkToMainAsm1 (void) { Point offsetPt; char theMode; offsetPt.h = 0; offsetPt.v = 0; ShieldCursor(&screenRect, offsetPt); if (knowsColor) { theMode = true32b; SwapMMUMode(&theMode); } asm 68000 { move.l replaySrc, a0 ; src bitmap address move.l replayDest, a1 ; dest screen address ; 0 = source 1 = dest move.w workRowBytes, d0 ; next row offset move.w screenRowBytes, d1 ; next row offset subi.w #20, d0 ; compensate for (a0)+ increment subi.w #20, d1 ; compensate for (a1)+ increment move.w #128, d2 ; d2 will count rows @1 move.l (a0)+,(a1)+ ; move long 1 move.l (a0)+,(a1)+ ; move long 2 move.l (a0)+,(a1)+ ; move long 3 move.l (a0)+,(a1)+ ; move long 4 move.l (a0)+,(a1)+ ; move long 5 move.l (a0),(a1) ; move long 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest subq.w #1, d2 ; decrement row counter bne @1 ; do another row until d2 = 0 } if (knowsColor) SwapMMUMode(&theMode); ShowCursor(); } \ No newline at end of file diff --git a/Sources/RenderAsm4.c b/Sources/RenderAsm4.c new file mode 100755 index 0000000..49818a6 --- /dev/null +++ b/Sources/RenderAsm4.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Assembler Rendering Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "RenderAsm4.h" /*======================================================== Functions */ /*======================================================== DropDoorToWorkMapAsm4 */ void DropDoorToWorkMapAsm4 (void) { long srcAddress, destAddress; srcAddress = theDoor.srcAddrs[theDoor.doorOpen][theDoor.doorState]; destAddress = theDoor.workDestAddr[theDoor.doorOpen]; asm 68000 { move.l srcAddress, a0 ; src bitmap address move.l destAddress, a1 ; dest screen address ; 0 = source 1 = dest move.w partsRowBytes, d0 ; next row offset move.w workRowBytes, d1 ; next row offset subi.w #12, d0 ; compensate for (a0)+ increment subi.w #12, d1 ; compensate for (a1)+ increment move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.l (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.l (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.l (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.l (a0),(a1) ; move row 12 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 13 move.l (a0)+,(a1)+ ; move row 13 move.l (a0)+,(a1)+ ; move row 13 move.l (a0),(a1) ; move row 13 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 14 move.l (a0)+,(a1)+ ; move row 14 move.l (a0)+,(a1)+ ; move row 14 move.l (a0),(a1) ; move row 14 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 15 move.l (a0)+,(a1)+ ; move row 15 move.l (a0)+,(a1)+ ; move row 15 move.l (a0),(a1) ; move row 15 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 16 move.l (a0)+,(a1)+ ; move row 16 move.l (a0)+,(a1)+ ; move row 16 move.l (a0),(a1) ; move row 16 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 17 move.l (a0)+,(a1)+ ; move row 17 move.l (a0)+,(a1)+ ; move row 17 move.l (a0),(a1) ; move row 17 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 18 move.l (a0)+,(a1)+ ; move row 18 move.l (a0)+,(a1)+ ; move row 18 move.l (a0),(a1) ; move row 18 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 19 move.l (a0)+,(a1)+ ; move row 19 move.l (a0)+,(a1)+ ; move row 19 move.l (a0),(a1) ; move row 19 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 20 move.l (a0)+,(a1)+ ; move row 20 move.l (a0)+,(a1)+ ; move row 20 move.l (a0),(a1) ; move row 20 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 21 move.l (a0)+,(a1)+ ; move row 21 move.l (a0)+,(a1)+ ; move row 21 move.l (a0),(a1) ; move row 21 } destAddress = theDoor.backDestAddr[theDoor.doorOpen]; asm 68000 { move.l srcAddress, a0 ; src bitmap address move.l destAddress, a1 ; dest screen address ; 0 = source 1 = dest move.w partsRowBytes, d0 ; next row offset move.w backRowBytes, d1 ; next row offset subi.w #12, d0 ; compensate for (a0)+ increment subi.w #12, d1 ; compensate for (a1)+ increment move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.l (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.l (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.l (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.l (a0),(a1) ; move row 12 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 13 move.l (a0)+,(a1)+ ; move row 13 move.l (a0)+,(a1)+ ; move row 13 move.l (a0),(a1) ; move row 13 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 14 move.l (a0)+,(a1)+ ; move row 14 move.l (a0)+,(a1)+ ; move row 14 move.l (a0),(a1) ; move row 14 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 15 move.l (a0)+,(a1)+ ; move row 15 move.l (a0)+,(a1)+ ; move row 15 move.l (a0),(a1) ; move row 15 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 16 move.l (a0)+,(a1)+ ; move row 16 move.l (a0)+,(a1)+ ; move row 16 move.l (a0),(a1) ; move row 16 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 17 move.l (a0)+,(a1)+ ; move row 17 move.l (a0)+,(a1)+ ; move row 17 move.l (a0),(a1) ; move row 17 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 18 move.l (a0)+,(a1)+ ; move row 18 move.l (a0)+,(a1)+ ; move row 18 move.l (a0),(a1) ; move row 18 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 19 move.l (a0)+,(a1)+ ; move row 19 move.l (a0)+,(a1)+ ; move row 19 move.l (a0),(a1) ; move row 19 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 20 move.l (a0)+,(a1)+ ; move row 20 move.l (a0)+,(a1)+ ; move row 20 move.l (a0),(a1) ; move row 20 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 21 move.l (a0)+,(a1)+ ; move row 21 move.l (a0)+,(a1)+ ; move row 21 move.l (a0),(a1) ; move row 21 } } /*======================================================== MaskBoardCursorAsm4 */ void MaskBoardCursorAsm4 (long dest, short shiftRight) { asm 68000 { move.l a2, -(sp) ; save a2 on stack move.l d3, -(sp) ; save d3 on stack move.l d4, -(sp) ; save d4 on stack move.l d5, -(sp) ; save d5 on stack move.l d6, -(sp) ; save d4 on stack move.l d7, -(sp) ; save d5 on stack move.l boardCursor.srcAddr, a0 ; src bitmap address move.l dest, a1 ; dest screen address move.l boardCursor.maskAddr, a2 ; mask bitmap address move.w partsRowBytes, d0 ; next row offset (parts) subq.l #4, d0 ; compensate for little adds move.w workRowBytes, d1 ; next row offset subq.l #4, d1 ; compensate for little adds move.w shiftRight, d2 ; d2 will hold # of bits to shift right move.w #32, d3 ; prepare to subtract from 32 sub.w d2, d3 ; calculate value to shift left in d3 ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask/parts row diff. ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask/parts row diff. ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask/parts row diff. ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask/parts row diff. ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask/parts row diff. ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask/parts row diff. ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask/parts row diff. ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask/parts row diff. ; move.l (sp)+, d7 ; restore d5 from stack move.l (sp)+, d6 ; restore d4 from stack move.l (sp)+, d5 ; restore d5 from stack move.l (sp)+, d4 ; restore d4 from stack move.l (sp)+, d3 ; restore d3 from stack move.l (sp)+, a2 ; restore a2 from stack } } /*======================================================== MaskBallAsm4 */ void MaskBallAsm4 (long dest, short shiftRight) { asm 68000 { move.l a2, -(sp) ; save a2 on stack move.l d3, -(sp) ; save d3 on stack move.l d4, -(sp) ; save d4 on stack move.l d5, -(sp) ; save d5 on stack move.l d6, -(sp) ; save d4 on stack move.l d7, -(sp) ; save d5 on stack move.l ballSrcAddr, a0 ; src bitmap address move.l dest, a1 ; dest screen address move.l ballMaskAddr, a2 ; mask bitmap address move.w partsRowBytes, d0 ; next row offset (parts) subq.l #4, d0 ; compensate for little adds move.w workRowBytes, d1 ; next row offset subq.l #4, d1 ; compensate for little adds move.w shiftRight, d2 ; d2 will hold # of bits to shift right move.w #32, d3 ; prepare to subtract from 32 sub.w d2, d3 ; calculate value to shift left in d3 ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask row 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; === prepare for next word move.l (a2)+, d6 ; move mask row 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src row 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the left and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; move.l (sp)+, d7 ; restore d5 from stack move.l (sp)+, d6 ; restore d4 from stack move.l (sp)+, d5 ; restore d5 from stack move.l (sp)+, d4 ; restore d4 from stack move.l (sp)+, d3 ; restore d3 from stack move.l (sp)+, a2 ; restore a2 from stack } } /*======================================================== MaskPlayerAsm4 */ void MaskPlayerAsm4 (long src, long dest, long mask, short shiftRight) { asm 68000 { move.l a2, -(sp) ; save a2 on stack move.l d3, -(sp) ; save d3 on stack move.l d4, -(sp) ; save d4 on stack move.l d5, -(sp) ; save d5 on stack move.l d6, -(sp) ; save d4 on stack move.l d7, -(sp) ; save d5 on stack move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address move.l mask, a2 ; mask bitmap address move.w partsRowBytes, d0 ; next row offset (parts) sub.w #12, d0 ; compensate for little adds move.w workRowBytes, d1 ; next row offset sub.w #12, d1 ; compensate for little adds move.w shiftRight, d2 ; d2 will hold # of bits to shift right move.w #32, d3 ; prepare to subtract from 32 sub.w d2, d3 ; calculate value to shift left in d3 ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; === increment pointers adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest adda.w d0, a2 ; add row offset to mask suba.w #40, a2 ; compensate for mask row bytes difference ; ; === BEGIN a ROW move.l (a2), d4 ; move mask seg 1 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src seg 1 lsr.l d2, d5 ; shift d5 logically d2 bits to the right and.l d4, d5 ; clear trash bits not.l d4 ; invert mask bits and.l d4, (a1) ; and mask to dest (create hole) or.l d5, (a1)+ ; or src to dest (fill hole) ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 1 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 1 lsl.l d3, d7 ; shift d7 logically d3 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask seg 2 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 2 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 2 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 2 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 3 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 3 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1)+ ; or src to dest ; <<< prepare for next word move.l (a2)+, d6 ; move mask seg 3 lsl.l d3, d6 ; shift d6 logically d3 bits to the left move.l (a0)+, d7 ; move src seg 3 lsl.l d3, d7 ; shift d7 logically d2 bits to the right and.l d6, d7 ; clear trash bits ; === load next word in row move.l (a2), d4 ; move mask row 4 lsr.l d2, d4 ; shift d4 logically d2 bits to the right move.l (a0), d5 ; move src row 4 lsr.l d2, d5 ; shift d5 logically d2 bits to the right ; === add overhang from last word in or.l d6, d4 ; or old mask to new mask or.l d7, d5 ; or old src to new src and.l d4, d5 ; clear trash bits not.l d4 ; invert mask and.l d4, (a1) ; and mask to dest or.l d5, (a1) ; or src to dest ; move.l (sp)+, d7 ; restore d7 from stack move.l (sp)+, d6 ; restore d6 from stack move.l (sp)+, d5 ; restore d5 from stack move.l (sp)+, d4 ; restore d4 from stack move.l (sp)+, d3 ; restore d3 from stack move.l (sp)+, a2 ; restore a2 from stack } } /*======================================================== DumpWholePlayerAsm4 */ void DumpWholePlayerAsm4 (long src, long dest) { asm 68000 { move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address ; 0 = source 1 = dest move.w workRowBytes, d0 ; next row offset move.w screenRowBytes, d1 ; next row offset subi.w #16, d0 ; compensate for (a0)+ inc. (4 x +'s) subi.w #16, d1 ; compensate for (a1)+ increment move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.l (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.l (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.l (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.l (a0),(a1) ; move row 12 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 13 move.l (a0)+,(a1)+ ; move row 13 move.l (a0)+,(a1)+ ; move row 13 move.l (a0)+,(a1)+ ; move row 13 move.l (a0),(a1) ; move row 13 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 14 move.l (a0)+,(a1)+ ; move row 14 move.l (a0)+,(a1)+ ; move row 14 move.l (a0)+,(a1)+ ; move row 14 move.l (a0),(a1) ; move row 14 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 15 move.l (a0)+,(a1)+ ; move row 15 move.l (a0)+,(a1)+ ; move row 15 move.l (a0)+,(a1)+ ; move row 15 move.l (a0),(a1) ; move row 15 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 16 move.l (a0)+,(a1)+ ; move row 16 move.l (a0)+,(a1)+ ; move row 16 move.l (a0)+,(a1)+ ; move row 16 move.l (a0),(a1) ; move row 16 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 17 move.l (a0)+,(a1)+ ; move row 17 move.l (a0)+,(a1)+ ; move row 17 move.l (a0)+,(a1)+ ; move row 17 move.l (a0),(a1) ; move row 17 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 18 move.l (a0)+,(a1)+ ; move row 18 move.l (a0)+,(a1)+ ; move row 18 move.l (a0)+,(a1)+ ; move row 18 move.l (a0),(a1) ; move row 18 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 19 move.l (a0)+,(a1)+ ; move row 19 move.l (a0)+,(a1)+ ; move row 19 move.l (a0)+,(a1)+ ; move row 19 move.l (a0),(a1) ; move row 19 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 20 move.l (a0)+,(a1)+ ; move row 20 move.l (a0)+,(a1)+ ; move row 20 move.l (a0)+,(a1)+ ; move row 20 move.l (a0),(a1) ; move row 20 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 21 move.l (a0)+,(a1)+ ; move row 21 move.l (a0)+,(a1)+ ; move row 21 move.l (a0)+,(a1)+ ; move row 21 move.l (a0),(a1) ; move row 21 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 22 move.l (a0)+,(a1)+ ; move row 22 move.l (a0)+,(a1)+ ; move row 22 move.l (a0)+,(a1)+ ; move row 22 move.l (a0),(a1) ; move row 22 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 23 move.l (a0)+,(a1)+ ; move row 23 move.l (a0)+,(a1)+ ; move row 23 move.l (a0)+,(a1)+ ; move row 23 move.l (a0),(a1) ; move row 23 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 24 move.l (a0)+,(a1)+ ; move row 24 move.l (a0)+,(a1)+ ; move row 24 move.l (a0)+,(a1)+ ; move row 24 move.l (a0),(a1) ; move row 24 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 25 move.l (a0)+,(a1)+ ; move row 25 move.l (a0)+,(a1)+ ; move row 25 move.l (a0)+,(a1)+ ; move row 25 move.l (a0),(a1) ; move row 25 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 26 move.l (a0)+,(a1)+ ; move row 26 move.l (a0)+,(a1)+ ; move row 26 move.l (a0)+,(a1)+ ; move row 26 move.l (a0),(a1) ; move row 26 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 27 move.l (a0)+,(a1)+ ; move row 27 move.l (a0)+,(a1)+ ; move row 27 move.l (a0)+,(a1)+ ; move row 27 move.l (a0),(a1) ; move row 27 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 28 move.l (a0)+,(a1)+ ; move row 28 move.l (a0)+,(a1)+ ; move row 28 move.l (a0)+,(a1)+ ; move row 28 move.l (a0),(a1) ; move row 28 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 29 move.l (a0)+,(a1)+ ; move row 29 move.l (a0)+,(a1)+ ; move row 29 move.l (a0)+,(a1)+ ; move row 29 move.l (a0),(a1) ; move row 29 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 30 move.l (a0)+,(a1)+ ; move row 30 move.l (a0)+,(a1)+ ; move row 30 move.l (a0)+,(a1)+ ; move row 30 move.l (a0),(a1) ; move row 30 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 31 move.l (a0)+,(a1)+ ; move row 31 move.l (a0)+,(a1)+ ; move row 31 move.l (a0)+,(a1)+ ; move row 31 move.l (a0),(a1) ; move row 31 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 32 move.l (a0)+,(a1)+ ; move row 32 move.l (a0)+,(a1)+ ; move row 32 move.l (a0)+,(a1)+ ; move row 32 move.l (a0),(a1) ; move row 32 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 33 move.l (a0)+,(a1)+ ; move row 33 move.l (a0)+,(a1)+ ; move row 33 move.l (a0)+,(a1)+ ; move row 33 move.l (a0),(a1) ; move row 33 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 34 move.l (a0)+,(a1)+ ; move row 34 move.l (a0)+,(a1)+ ; move row 34 move.l (a0)+,(a1)+ ; move row 34 move.l (a0),(a1) ; move row 34 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 35 move.l (a0)+,(a1)+ ; move row 35 move.l (a0)+,(a1)+ ; move row 35 move.l (a0)+,(a1)+ ; move row 35 move.l (a0),(a1) ; move row 35 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 36 move.l (a0)+,(a1)+ ; move row 36 move.l (a0)+,(a1)+ ; move row 36 move.l (a0)+,(a1)+ ; move row 36 move.l (a0),(a1) ; move row 36 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 37 move.l (a0)+,(a1)+ ; move row 37 move.l (a0)+,(a1)+ ; move row 37 move.l (a0)+,(a1)+ ; move row 37 move.l (a0),(a1) ; move row 37 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 38 move.l (a0)+,(a1)+ ; move row 38 move.l (a0)+,(a1)+ ; move row 38 move.l (a0)+,(a1)+ ; move row 38 move.l (a0),(a1) ; move row 38 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 39 move.l (a0)+,(a1)+ ; move row 39 move.l (a0)+,(a1)+ ; move row 39 move.l (a0)+,(a1)+ ; move row 39 move.l (a0),(a1) ; move row 39 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 40 move.l (a0)+,(a1)+ ; move row 40 move.l (a0)+,(a1)+ ; move row 40 move.l (a0)+,(a1)+ ; move row 40 move.l (a0),(a1) ; move row 40 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 41 move.l (a0)+,(a1)+ ; move row 41 move.l (a0)+,(a1)+ ; move row 41 move.l (a0)+,(a1)+ ; move row 41 move.l (a0),(a1) ; move row 41 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 42 move.l (a0)+,(a1)+ ; move row 42 move.l (a0)+,(a1)+ ; move row 42 move.l (a0)+,(a1)+ ; move row 42 move.l (a0),(a1) ; move row 42 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 43 move.l (a0)+,(a1)+ ; move row 43 move.l (a0)+,(a1)+ ; move row 43 move.l (a0)+,(a1)+ ; move row 43 move.l (a0),(a1) ; move row 43 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 44 move.l (a0)+,(a1)+ ; move row 44 move.l (a0)+,(a1)+ ; move row 44 move.l (a0)+,(a1)+ ; move row 44 move.l (a0),(a1) ; move row 44 } } /*======================================================== DumpWholeBallAsm4 */ void DumpWholeBallAsm4 (long src, long dest) { asm 68000 { move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address ; 0 = source 1 = dest move.w workRowBytes, d0 ; next row offset move.w screenRowBytes, d1 ; next row offset subq.w #8, d0 ; compensate for (a0)+ inc. (4 x +'s) subq.w #8, d1 ; compensate for (a1)+ increment move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.l (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.l (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.l (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.l (a0),(a1) ; move row 12 } } /*======================================================== DumpCursorAsm4 */ void DumpCursorAsm4 (long src, long dest) { asm 68000 { move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address ; 0 = source 1 = dest move.w workRowBytes, d0 ; next row offset move.w screenRowBytes, d1 ; next row offset subq.w #8, d0 ; compensate for (a0)+ inc. (4 x +'s) subq.w #8, d1 ; compensate for (a1)+ increment move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0),(a1) ; move row 8 } } /*======================================================== DumpDoorToScreenAsm4 */ void DumpDoorToScreenAsm4 (void) { long srcAddress, destAddress; srcAddress = theDoor.workDestAddr[theDoor.doorOpen]; destAddress = theDoor.screenDestAddr[theDoor.doorOpen]; asm 68000 { move.l srcAddress, a0 ; src bitmap address move.l destAddress, a1 ; dest screen address ; 0 = source 1 = dest move.w workRowBytes, d0 ; next row offset move.w screenRowBytes, d1 ; next row offset subi.w #12, d0 ; compensate for (a0)+ increment subi.w #12, d1 ; compensate for (a1)+ increment move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.l (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.l (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.l (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.l (a0),(a1) ; move row 12 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 13 move.l (a0)+,(a1)+ ; move row 13 move.l (a0)+,(a1)+ ; move row 13 move.l (a0),(a1) ; move row 13 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 14 move.l (a0)+,(a1)+ ; move row 14 move.l (a0)+,(a1)+ ; move row 14 move.l (a0),(a1) ; move row 14 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 15 move.l (a0)+,(a1)+ ; move row 15 move.l (a0)+,(a1)+ ; move row 15 move.l (a0),(a1) ; move row 15 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 16 move.l (a0)+,(a1)+ ; move row 16 move.l (a0)+,(a1)+ ; move row 16 move.l (a0),(a1) ; move row 16 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 17 move.l (a0)+,(a1)+ ; move row 17 move.l (a0)+,(a1)+ ; move row 17 move.l (a0),(a1) ; move row 17 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 18 move.l (a0)+,(a1)+ ; move row 18 move.l (a0)+,(a1)+ ; move row 18 move.l (a0),(a1) ; move row 18 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 19 move.l (a0)+,(a1)+ ; move row 19 move.l (a0)+,(a1)+ ; move row 19 move.l (a0),(a1) ; move row 19 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 20 move.l (a0)+,(a1)+ ; move row 20 move.l (a0)+,(a1)+ ; move row 20 move.l (a0),(a1) ; move row 20 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 21 move.l (a0)+,(a1)+ ; move row 21 move.l (a0)+,(a1)+ ; move row 21 move.l (a0),(a1) ; move row 21 } } /*======================================================== PatchPlayerAsm4 */ void PatchPlayerAsm4 (long src, long dest) { asm 68000 { move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address ; 0 = source 1 = dest move.w backRowBytes, d0 ; next row offset move.w workRowBytes, d1 ; next row offset subi.w #16, d0 ; compensate for (a0)+ inc. (4 x +'s) subi.w #16, d1 ; compensate for (a1)+ increment move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.w (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.w (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.w (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.w (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.w (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.w (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.w (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.w (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.w (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.w (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.w (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.w (a0),(a1) ; move row 12 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 13 move.l (a0)+,(a1)+ ; move row 13 move.l (a0)+,(a1)+ ; move row 13 move.l (a0)+,(a1)+ ; move row 13 move.w (a0),(a1) ; move row 13 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 14 move.l (a0)+,(a1)+ ; move row 14 move.l (a0)+,(a1)+ ; move row 14 move.l (a0)+,(a1)+ ; move row 14 move.w (a0),(a1) ; move row 14 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 15 move.l (a0)+,(a1)+ ; move row 15 move.l (a0)+,(a1)+ ; move row 15 move.l (a0)+,(a1)+ ; move row 15 move.w (a0),(a1) ; move row 15 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 16 move.l (a0)+,(a1)+ ; move row 16 move.l (a0)+,(a1)+ ; move row 16 move.l (a0)+,(a1)+ ; move row 16 move.w (a0),(a1) ; move row 16 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 17 move.l (a0)+,(a1)+ ; move row 17 move.l (a0)+,(a1)+ ; move row 17 move.l (a0)+,(a1)+ ; move row 17 move.w (a0),(a1) ; move row 17 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 18 move.l (a0)+,(a1)+ ; move row 18 move.l (a0)+,(a1)+ ; move row 18 move.l (a0)+,(a1)+ ; move row 18 move.w (a0),(a1) ; move row 18 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 19 move.l (a0)+,(a1)+ ; move row 19 move.l (a0)+,(a1)+ ; move row 19 move.l (a0)+,(a1)+ ; move row 19 move.w (a0),(a1) ; move row 19 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 20 move.l (a0)+,(a1)+ ; move row 20 move.l (a0)+,(a1)+ ; move row 20 move.l (a0)+,(a1)+ ; move row 20 move.w (a0),(a1) ; move row 20 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 21 move.l (a0)+,(a1)+ ; move row 21 move.l (a0)+,(a1)+ ; move row 21 move.l (a0)+,(a1)+ ; move row 21 move.w (a0),(a1) ; move row 21 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 22 move.l (a0)+,(a1)+ ; move row 22 move.l (a0)+,(a1)+ ; move row 22 move.l (a0)+,(a1)+ ; move row 22 move.w (a0),(a1) ; move row 22 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 23 move.l (a0)+,(a1)+ ; move row 23 move.l (a0)+,(a1)+ ; move row 23 move.l (a0)+,(a1)+ ; move row 23 move.w (a0),(a1) ; move row 23 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 24 move.l (a0)+,(a1)+ ; move row 24 move.l (a0)+,(a1)+ ; move row 24 move.l (a0)+,(a1)+ ; move row 24 move.w (a0),(a1) ; move row 24 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 25 move.l (a0)+,(a1)+ ; move row 25 move.l (a0)+,(a1)+ ; move row 25 move.l (a0)+,(a1)+ ; move row 25 move.w (a0),(a1) ; move row 25 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 26 move.l (a0)+,(a1)+ ; move row 26 move.l (a0)+,(a1)+ ; move row 26 move.l (a0)+,(a1)+ ; move row 26 move.w (a0),(a1) ; move row 26 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 27 move.l (a0)+,(a1)+ ; move row 27 move.l (a0)+,(a1)+ ; move row 27 move.l (a0)+,(a1)+ ; move row 27 move.w (a0),(a1) ; move row 27 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 28 move.l (a0)+,(a1)+ ; move row 28 move.l (a0)+,(a1)+ ; move row 28 move.l (a0)+,(a1)+ ; move row 28 move.w (a0),(a1) ; move row 28 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 29 move.l (a0)+,(a1)+ ; move row 29 move.l (a0)+,(a1)+ ; move row 29 move.l (a0)+,(a1)+ ; move row 29 move.w (a0),(a1) ; move row 29 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 30 move.l (a0)+,(a1)+ ; move row 30 move.l (a0)+,(a1)+ ; move row 30 move.l (a0)+,(a1)+ ; move row 30 move.w (a0),(a1) ; move row 30 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 31 move.l (a0)+,(a1)+ ; move row 31 move.l (a0)+,(a1)+ ; move row 31 move.l (a0)+,(a1)+ ; move row 31 move.w (a0),(a1) ; move row 31 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 32 move.l (a0)+,(a1)+ ; move row 32 move.l (a0)+,(a1)+ ; move row 32 move.l (a0)+,(a1)+ ; move row 32 move.w (a0),(a1) ; move row 32 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 33 move.l (a0)+,(a1)+ ; move row 33 move.l (a0)+,(a1)+ ; move row 33 move.l (a0)+,(a1)+ ; move row 33 move.w (a0),(a1) ; move row 33 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 34 move.l (a0)+,(a1)+ ; move row 34 move.l (a0)+,(a1)+ ; move row 34 move.l (a0)+,(a1)+ ; move row 34 move.w (a0),(a1) ; move row 34 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 35 move.l (a0)+,(a1)+ ; move row 35 move.l (a0)+,(a1)+ ; move row 35 move.l (a0)+,(a1)+ ; move row 35 move.w (a0),(a1) ; move row 35 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 36 move.l (a0)+,(a1)+ ; move row 36 move.l (a0)+,(a1)+ ; move row 36 move.l (a0)+,(a1)+ ; move row 36 move.w (a0),(a1) ; move row 36 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 37 move.l (a0)+,(a1)+ ; move row 37 move.l (a0)+,(a1)+ ; move row 37 move.l (a0)+,(a1)+ ; move row 37 move.w (a0),(a1) ; move row 37 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 38 move.l (a0)+,(a1)+ ; move row 38 move.l (a0)+,(a1)+ ; move row 38 move.l (a0)+,(a1)+ ; move row 38 move.w (a0),(a1) ; move row 38 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 39 move.l (a0)+,(a1)+ ; move row 39 move.l (a0)+,(a1)+ ; move row 39 move.l (a0)+,(a1)+ ; move row 39 move.w (a0),(a1) ; move row 39 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 40 move.l (a0)+,(a1)+ ; move row 40 move.l (a0)+,(a1)+ ; move row 40 move.l (a0)+,(a1)+ ; move row 40 move.w (a0),(a1) ; move row 40 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 41 move.l (a0)+,(a1)+ ; move row 41 move.l (a0)+,(a1)+ ; move row 41 move.l (a0)+,(a1)+ ; move row 41 move.w (a0),(a1) ; move row 41 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 42 move.l (a0)+,(a1)+ ; move row 42 move.l (a0)+,(a1)+ ; move row 42 move.l (a0)+,(a1)+ ; move row 42 move.w (a0),(a1) ; move row 42 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 43 move.l (a0)+,(a1)+ ; move row 43 move.l (a0)+,(a1)+ ; move row 43 move.l (a0)+,(a1)+ ; move row 43 move.w (a0),(a1) ; move row 43 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 44 move.l (a0)+,(a1)+ ; move row 44 move.l (a0)+,(a1)+ ; move row 44 move.l (a0)+,(a1)+ ; move row 44 move.w (a0),(a1) ; move row 44 } } /*======================================================== PatchBallAsm4 */ void PatchBallAsm4 (long src, long dest) { asm 68000 { move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address ; 0 = source 1 = dest move.w backRowBytes, d0 ; next row offset move.w workRowBytes, d1 ; next row offset subq.w #8, d0 ; compensate for (a0)+ inc. (4 x +'s) subq.w #8, d1 ; compensate for (a1)+ increment move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.w (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.w (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.w (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.w (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.w (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.w (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.w (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.w (a0),(a1) ; move row 8 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 9 move.l (a0)+,(a1)+ ; move row 9 move.w (a0),(a1) ; move row 9 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 10 move.l (a0)+,(a1)+ ; move row 10 move.w (a0),(a1) ; move row 10 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 11 move.l (a0)+,(a1)+ ; move row 11 move.w (a0),(a1) ; move row 11 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 12 move.l (a0)+,(a1)+ ; move row 12 move.w (a0),(a1) ; move row 12 } } /*======================================================== PatchCursorAsm4 */ void PatchCursorAsm4 (long src, long dest) { asm 68000 { move.l src, a0 ; src bitmap address move.l dest, a1 ; dest screen address ; 0 = source 1 = dest move.w backRowBytes, d0 ; next row offset move.w workRowBytes, d1 ; next row offset subq.w #8, d0 ; compensate for (a0)+ inc. (4 x +'s) subq.w #8, d1 ; compensate for (a1)+ increment move.l (a0)+,(a1)+ ; move row 1 move.l (a0)+,(a1)+ ; move row 1 move.w (a0),(a1) ; move row 1 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 2 move.l (a0)+,(a1)+ ; move row 2 move.w (a0),(a1) ; move row 2 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 3 move.l (a0)+,(a1)+ ; move row 3 move.w (a0),(a1) ; move row 3 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 4 move.l (a0)+,(a1)+ ; move row 4 move.w (a0),(a1) ; move row 4 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 5 move.l (a0)+,(a1)+ ; move row 5 move.w (a0),(a1) ; move row 5 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 6 move.l (a0)+,(a1)+ ; move row 6 move.w (a0),(a1) ; move row 6 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 7 move.l (a0)+,(a1)+ ; move row 7 move.w (a0),(a1) ; move row 7 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest move.l (a0)+,(a1)+ ; move row 8 move.l (a0)+,(a1)+ ; move row 8 move.w (a0),(a1) ; move row 8 } } /*======================================================== RenderSceneAsm4 */ void RenderSceneAsm4 (void) { long srcAddress, destAddress; long ballOffIs, playerOffIs, opponentOffIs, cursorOffIs; Point offsetPt; char theMode; ballOffIs = workRowOffsets[theBall.isRect.top] + (long)(((short)theBall.isRect.left & 0xFFFC) >> 1); playerOffIs = workRowOffsets[thePlayer.isRect.top] + (long)(((short)thePlayer.isRect.left & 0xFFFC) >> 1); opponentOffIs = workRowOffsets[theOpponent.isRect.top] + (long)(((short)theOpponent.isRect.left & 0xFFFC) >> 1);; offsetPt.h = 0; offsetPt.v = 0; ShieldCursor(&screenRect, offsetPt); theMode = true32b; SwapMMUMode(&theMode); if (theDoor.stateChanged) DropDoorToWorkMapAsm4(); if ((showBoardCursor) && (!disableBoardCursor) && (drawThisFrame)) { cursorOffIs = workRowOffsets[boardCursor.isRect.top] + (long)(((short)boardCursor.isRect.left & 0xFFFC) >> 1); destAddress = (long)offWorkPix + cursorOffIs; MaskBoardCursorAsm4 (destAddress, (boardCursor.isRect.left % 4) * 4); } if ((theBall.mode == kBallRolling) && (!theBall.dontDraw) && (drawThisFrame)) { destAddress = (long)offWorkPix + ballOffIs; MaskBallAsm4 (destAddress, (theBall.isRect.left % 4) * 4); } /* mask the bastards to the work map - back to front! */ if (playerInBack) { if ((thePlayer.mode != kInStasis) && (drawThisFrame)) { destAddress = (long)offWorkPix + playerOffIs; MaskPlayerAsm4(thePlayer.srcAddr, destAddress, thePlayer.maskAddr, (thePlayer.isRect.left % 4) * 4); } if ((theOpponent.mode != kInStasis) && (drawThisFrame)) { destAddress = (long)offWorkPix + opponentOffIs; MaskPlayerAsm4(theOpponent.srcAddr, destAddress, theOpponent.maskAddr, (theOpponent.isRect.left % 4) * 4); } } else { if ((theOpponent.mode != kInStasis) && (drawThisFrame)) { destAddress = (long)offWorkPix + opponentOffIs; MaskPlayerAsm4(theOpponent.srcAddr, destAddress, theOpponent.maskAddr, (theOpponent.isRect.left % 4) * 4); } if ((thePlayer.mode != kInStasis) && (drawThisFrame)) { destAddress = (long)offWorkPix + playerOffIs; MaskPlayerAsm4(thePlayer.srcAddr, destAddress, thePlayer.maskAddr, (thePlayer.isRect.left % 4) * 4); } } /* blast them to the screen */ if ((thePlayer.mode != kInStasis) && (drawThisFrame)) { srcAddress = (long)offWorkPix + playerOffIs; destAddress = screenRowAddrs[thePlayer.isRect.top] + (long)(((short)thePlayer.isRect.left & 0xFFFC) >> 1); DumpWholePlayerAsm4(srcAddress, destAddress); srcAddress = (long)offWorkPix + workRowOffsets[thePlayer.wasRect.top] + (long)(((short)thePlayer.wasRect.left & 0xFFFC) >> 1); destAddress = screenRowAddrs[thePlayer.wasRect.top] + (long)(((short)thePlayer.wasRect.left & 0xFFFC) >> 1); DumpWholePlayerAsm4(srcAddress, destAddress); } if ((theOpponent.mode != kInStasis) && (drawThisFrame)) { srcAddress = (long)offWorkPix + opponentOffIs; destAddress = screenRowAddrs[theOpponent.isRect.top] + (long)(((short)theOpponent.isRect.left & 0xFFFC) >> 1); DumpWholePlayerAsm4(srcAddress, destAddress); srcAddress = (long)offWorkPix + workRowOffsets[theOpponent.wasRect.top] + (long)(((short)theOpponent.wasRect.left & 0xFFFC) >> 1); destAddress = screenRowAddrs[theOpponent.wasRect.top] + (long)(((short)theOpponent.wasRect.left & 0xFFFC) >> 1); DumpWholePlayerAsm4(srcAddress, destAddress); } if ((theBall.mode == kBallRolling) && (drawThisFrame)) { srcAddress = (long)offWorkPix + ballOffIs; destAddress = screenRowAddrs[theBall.isRect.top] + (long)(((short)theBall.isRect.left & 0xFFFC) >> 1); DumpWholeBallAsm4(srcAddress, destAddress); srcAddress = (long)offWorkPix + workRowOffsets[theBall.wasRect.top] + (long)(((short)theBall.wasRect.left & 0xFFFC) >> 1); destAddress = screenRowAddrs[theBall.wasRect.top] + (long)(((short)theBall.wasRect.left & 0xFFFC) >> 1); DumpWholeBallAsm4(srcAddress, destAddress); } else if (theBall.eraseTheBall) { srcAddress = (long)offWorkPix + workRowOffsets[theBall.eraser.top] + (long)(((short)theBall.eraser.left & 0xFFFC) >> 1); destAddress = screenRowAddrs[theBall.eraser.top] + (long)(((short)theBall.eraser.left & 0xFFFC) >> 1); DumpWholeBallAsm4(srcAddress, destAddress); theBall.eraseTheBall = FALSE; } if ((showBoardCursor) && (!disableBoardCursor) && (drawThisFrame)) { srcAddress = (long)offWorkPix + cursorOffIs; destAddress = screenRowAddrs[boardCursor.isRect.top] + (long)(((short)boardCursor.isRect.left & 0xFFFC) >> 1); DumpCursorAsm4(srcAddress, destAddress); srcAddress = (long)offWorkPix + workRowOffsets[boardCursor.wasRect.top] + (long)(((short)boardCursor.wasRect.left & 0xFFFC) >> 1); destAddress = screenRowAddrs[boardCursor.wasRect.top] + (long)(((short)boardCursor.wasRect.left & 0xFFFC) >> 1); DumpCursorAsm4(srcAddress, destAddress); } if (theDoor.stateChanged) DumpDoorToScreenAsm4(); /* plug up the holes on the work map */ if ((thePlayer.mode != kInStasis) && (drawThisFrame)) { srcAddress = (long)offBackPix + playerOffIs; destAddress = (long)offWorkPix + playerOffIs; PatchPlayerAsm4(srcAddress, destAddress); } if ((theOpponent.mode != kInStasis) && (drawThisFrame)) { srcAddress = (long)offBackPix + opponentOffIs; destAddress = (long)offWorkPix + opponentOffIs; PatchPlayerAsm4(srcAddress, destAddress); } if ((theBall.mode == kBallRolling) && (drawThisFrame)) { srcAddress = (long)offBackPix + ballOffIs; destAddress = (long)offWorkPix + ballOffIs; PatchBallAsm4(srcAddress, destAddress); } if ((showBoardCursor) && (!disableBoardCursor) && (drawThisFrame)) { srcAddress = (long)offBackPix + cursorOffIs; destAddress = (long)offWorkPix + cursorOffIs; PatchCursorAsm4(srcAddress, destAddress); } SwapMMUMode(&theMode); ShowCursor(); } /*======================================================== ReplayWorkToMainAsm4 */ void ReplayWorkToMainAsm4 (void) { Point offsetPt; char theMode; offsetPt.h = 0; offsetPt.v = 0; ShieldCursor(&screenRect, offsetPt); theMode = true32b; SwapMMUMode(&theMode); asm 68000 { move.l replaySrc, a0 ; src bitmap address move.l replayDest, a1 ; dest screen address ; 0 = source 1 = dest move.w workRowBytes, d0 ; next row offset move.w screenRowBytes, d1 ; next row offset subi.w #92, d0 ; compensate for (a0)+ increment subi.w #92, d1 ; compensate for (a1)+ increment move.w #128, d2 ; d2 will count rows @1 move.l (a0)+,(a1)+ ; move long 1 move.l (a0)+,(a1)+ ; move long 2 move.l (a0)+,(a1)+ ; move long 3 move.l (a0)+,(a1)+ ; move long 4 move.l (a0)+,(a1)+ ; move long 5 move.l (a0)+,(a1)+ ; move long 6 move.l (a0)+,(a1)+ ; move long 7 move.l (a0)+,(a1)+ ; move long 8 move.l (a0)+,(a1)+ ; move long 9 move.l (a0)+,(a1)+ ; move long 10 move.l (a0)+,(a1)+ ; move long 11 move.l (a0)+,(a1)+ ; move long 12 move.l (a0)+,(a1)+ ; move long 13 move.l (a0)+,(a1)+ ; move long 14 move.l (a0)+,(a1)+ ; move long 15 move.l (a0)+,(a1)+ ; move long 16 move.l (a0)+,(a1)+ ; move long 17 move.l (a0)+,(a1)+ ; move long 18 move.l (a0)+,(a1)+ ; move long 19 move.l (a0)+,(a1)+ ; move long 20 move.l (a0)+,(a1)+ ; move long 21 move.l (a0)+,(a1)+ ; move long 22 move.l (a0)+,(a1)+ ; move long 23 move.l (a0),(a1) ; move long 24 adda.w d0, a0 ; add row offset to src adda.w d1, a1 ; add row offset to dest subq.w #1, d2 ; decrement row counter bne @1 ; do another row until d2 = 0 } SwapMMUMode(&theMode); ShowCursor(); } \ No newline at end of file diff --git a/Sources/RenderQD.c b/Sources/RenderQD.c new file mode 100755 index 0000000..4b130d7 --- /dev/null +++ b/Sources/RenderQD.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== QuickDraw Rendering Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "RenderQD.h" #include "Render.h" #include "PlayUtils.h" /*======================================================== Functions */ /*======================================================== RenderSceneQD1 */ void RenderSceneQD1 (void) { Rect wholeBall, wholePlayer, wholeOpponent, wholeCursor; /* find union of old & new position rects */ UnionRect(&thePlayer.isRect, &thePlayer.wasRect, &wholePlayer); UnionRect(&theOpponent.isRect, &theOpponent.wasRect, &wholeOpponent); UnionRect(&theBall.isRect, &theBall.wasRect, &wholeBall); UnionRect(&boardCursor.isRect, &boardCursor.wasRect, &wholeCursor); /* dick with the door */ if (theDoor.stateChanged) { CopyBits(&offPartsBits, &offWorkBits, &theDoor.srcRects[theDoor.doorOpen][theDoor.doorState], &theDoor.destRects[theDoor.doorOpen], srcCopy, kNilPointer); CopyBits(&offWorkBits, &offBackBits, &theDoor.destRects[theDoor.doorOpen], &theDoor.destRects[theDoor.doorOpen], srcCopy, kNilPointer); } if ((showBoardCursor) && (!disableBoardCursor) && (drawThisFrame)) { CopyMask(&offPartsBits, &offMaskMap, &offWorkBits, &boardCursor.srcRect, &boardCursor.srcRect, &boardCursor.isRect); } if ((theBall.mode == kBallRolling) && (!theBall.dontDraw) && (drawThisFrame)) CopyMask(&offPartsBits, &offMaskMap, &offWorkBits, &theBall.srcRect, &theBall.srcRect, &theBall.isRect); /* mask the bastards to the work map - back to front! */ if (playerInBack) { if ((thePlayer.mode != kInStasis) && (drawThisFrame)) CopyMask(&offPartsBits, &offMaskMap, &offWorkBits, &thePlayer.srcRect, &thePlayer.maskRect, &thePlayer.isRect); if ((theOpponent.mode != kInStasis) && (drawThisFrame)) CopyMask(&offPartsBits, &offMaskMap, &offWorkBits, &theOpponent.srcRect, &theOpponent.maskRect, &theOpponent.isRect); } else { if ((theOpponent.mode != kInStasis) && (drawThisFrame)) CopyMask(&offPartsBits, &offMaskMap, &offWorkBits, &theOpponent.srcRect, &theOpponent.maskRect, &theOpponent.isRect); if ((thePlayer.mode != kInStasis) && (drawThisFrame)) CopyMask(&offPartsBits, &offMaskMap, &offWorkBits, &thePlayer.srcRect, &thePlayer.maskRect, &thePlayer.isRect); } /* blast them to the screen */ if ((thePlayer.mode != kInStasis) && (drawThisFrame)) { CopyBits(&offWorkBits, &(mainWndo->portBits), &wholePlayer, &wholePlayer, srcCopy, kNilPointer); } if ((theOpponent.mode != kInStasis) && (drawThisFrame)) { CopyBits(&offWorkBits, &(mainWndo->portBits), &wholeOpponent, &wholeOpponent, srcCopy, kNilPointer); } if ((theBall.mode == kBallRolling) && (drawThisFrame)) { CopyBits(&offWorkBits, &(mainWndo->portBits), &wholeBall, &wholeBall, srcCopy, kNilPointer); } else if (theBall.eraseTheBall) { CopyBits(&offWorkBits, &(mainWndo->portBits), &theBall.eraser, &theBall.eraser, srcCopy, kNilPointer); theBall.eraseTheBall = FALSE; } if ((showBoardCursor) && (!disableBoardCursor) && (drawThisFrame)) { CopyBits(&offWorkBits, &(mainWndo->portBits), &wholeCursor, &wholeCursor, srcCopy, kNilPointer); } /* and re-dick with the door */ if (theDoor.stateChanged) { CopyBits(&offWorkBits, &(mainWndo->portBits), &theDoor.destRects[theDoor.doorOpen], &theDoor.destRects[theDoor.doorOpen], srcCopy, kNilPointer); CopyBits(&offPartsBits, &offBackBits, &theDoor.srcRects[theDoor.doorOpen][theDoor.doorState], &theDoor.destRects[theDoor.doorOpen], srcCopy, kNilPointer); CopyBits(&offWorkBits, &offBackBits, &theDoor.destRects[theDoor.doorOpen], &theDoor.destRects[theDoor.doorOpen], srcCopy, kNilPointer); } /* plug up the holes on the work map */ if ((thePlayer.mode != kInStasis) && (drawThisFrame)) CopyBits(&offBackBits, &offWorkBits, &thePlayer.isRect, &thePlayer.isRect, srcCopy, kNilPointer); if ((theOpponent.mode != kInStasis) && (drawThisFrame)) CopyBits(&offBackBits, &offWorkBits, &theOpponent.isRect, &theOpponent.isRect, srcCopy, kNilPointer); if ((theBall.mode == kBallRolling) && (drawThisFrame)) CopyBits(&offBackBits, &offWorkBits, &theBall.isRect, &theBall.isRect, srcCopy, kNilPointer); if ((showBoardCursor) && (!disableBoardCursor) && (drawThisFrame)) CopyBits(&offBackBits, &offWorkBits, &boardCursor.isRect, &boardCursor.isRect, srcCopy, kNilPointer); } /*======================================================== RenderSceneQDC */ void RenderSceneQDC (void) { Rect wholeBall, wholePlayer, wholeOpponent, wholeCursor; /* find union of old & new position rects */ UnionRect(&thePlayer.isRect, &thePlayer.wasRect, &wholePlayer); UnionRect(&theOpponent.isRect, &theOpponent.wasRect, &wholeOpponent); UnionRect(&theBall.isRect, &theBall.wasRect, &wholeBall); UnionRect(&boardCursor.isRect, &boardCursor.wasRect, &wholeCursor); /* dick with the door */ if (theDoor.stateChanged) { CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &theDoor.srcRects[theDoor.doorOpen][theDoor.doorState], &theDoor.destRects[theDoor.doorOpen], srcCopy, kNilPointer); CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &((GrafPtr)offCBackPtr)->portBits, &theDoor.destRects[theDoor.doorOpen], &theDoor.destRects[theDoor.doorOpen], srcCopy, kNilPointer); } if ((showBoardCursor) && (!disableBoardCursor) && (drawThisFrame)) { CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &((GrafPtr)offCWorkPtr)->portBits, &boardCursor.srcRect, &boardCursor.srcRect, &boardCursor.isRect); } if ((theBall.mode == kBallRolling) && (!theBall.dontDraw) && (drawThisFrame)) CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &((GrafPtr)offCWorkPtr)->portBits, &theBall.srcRect, &theBall.srcRect, &theBall.isRect); /* mask the bastards to the work map - back to front! */ if (playerInBack) { if ((thePlayer.mode != kInStasis) && (drawThisFrame)) CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &((GrafPtr)offCWorkPtr)->portBits, &thePlayer.srcRect, &thePlayer.maskRect, &thePlayer.isRect); if ((theOpponent.mode != kInStasis) && (drawThisFrame)) CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &((GrafPtr)offCWorkPtr)->portBits, &theOpponent.srcRect, &theOpponent.maskRect, &theOpponent.isRect); } else { if ((theOpponent.mode != kInStasis) && (drawThisFrame)) CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &((GrafPtr)offCWorkPtr)->portBits, &theOpponent.srcRect, &theOpponent.maskRect, &theOpponent.isRect); if ((thePlayer.mode != kInStasis) && (drawThisFrame)) CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &((GrafPtr)offCWorkPtr)->portBits, &thePlayer.srcRect, &thePlayer.maskRect, &thePlayer.isRect); } /* blast them to the screen */ if ((thePlayer.mode != kInStasis) && (drawThisFrame)) { CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &wholePlayer, &wholePlayer, srcCopy, kNilPointer); } if ((theOpponent.mode != kInStasis) && (drawThisFrame)) { CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &wholeOpponent, &wholeOpponent, srcCopy, kNilPointer); } if ((theBall.mode == kBallRolling) && (drawThisFrame)) { CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &wholeBall, &wholeBall, srcCopy, kNilPointer); } else if (theBall.eraseTheBall) { CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &theBall.eraser, &theBall.eraser, srcCopy, kNilPointer); theBall.eraseTheBall = FALSE; } if ((showBoardCursor) && (!disableBoardCursor) && (drawThisFrame)) { CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &wholeCursor, &wholeCursor, srcCopy, kNilPointer); } /* and re-dick with the door */ if (theDoor.stateChanged) { CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &theDoor.destRects[theDoor.doorOpen], &theDoor.destRects[theDoor.doorOpen], srcCopy, kNilPointer); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCBackPtr)->portBits, &theDoor.srcRects[theDoor.doorOpen][theDoor.doorState], &theDoor.destRects[theDoor.doorOpen], srcCopy, kNilPointer); CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &((GrafPtr)offCBackPtr)->portBits, &theDoor.destRects[theDoor.doorOpen], &theDoor.destRects[theDoor.doorOpen], srcCopy, kNilPointer); } /* plug up the holes on the work map */ if ((thePlayer.mode != kInStasis) && (drawThisFrame)) CopyBits(&((GrafPtr)offCBackPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &thePlayer.isRect, &thePlayer.isRect, srcCopy, kNilPointer); if ((theOpponent.mode != kInStasis) && (drawThisFrame)) CopyBits(&((GrafPtr)offCBackPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &theOpponent.isRect, &theOpponent.isRect, srcCopy, kNilPointer); if ((theBall.mode == kBallRolling) && (drawThisFrame)) CopyBits(&((GrafPtr)offCBackPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &theBall.isRect, &theBall.isRect, srcCopy, kNilPointer); if ((showBoardCursor) && (!disableBoardCursor) && (drawThisFrame)) CopyBits(&((GrafPtr)offCBackPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &boardCursor.isRect, &boardCursor.isRect, srcCopy, kNilPointer); } /*======================================================== DisplayScoreDigitQD1 */ void DisplayScoreDigitQD1 (short place, short digit, short who) { CopyBits(&offPartsBits, &(mainWndo->portBits), &scoreDisplays[who].srcRects[digit], &scoreDisplays[who].destRects[place], srcCopy, kNilPointer); } /*======================================================== DisplayScoreDigitQDC */ void DisplayScoreDigitQDC (short place, short digit, short who) { CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &scoreDisplays[who].srcRects[digit], &scoreDisplays[who].destRects[place], srcCopy, kNilPointer); } /*======================================================== DisplayPlayerFoulsQD1 */ void DisplayPlayerFoulsQD1 (short fouls) { Rect srcOnRect, srcOffRect; short i, selector; SetRect(&srcOnRect, 0, 56, 16, 62); SetRect(&srcOffRect, 0, 50, 16, 56); if (leftGoalIsPlayers) selector = kLeftScoreSelector; else selector = kRightScoreSelector; for (i = 0; i < 2; i++) { if (i < fouls) CopyBits(&offPartsBits, &(mainWndo->portBits), &srcOnRect, &scoreDisplays[selector].lightDest[i], srcCopy, kNilPointer); else CopyBits(&offPartsBits, &(mainWndo->portBits), &srcOffRect, &scoreDisplays[selector].lightDest[i], srcCopy, kNilPointer); } } /*======================================================== DisplayPlayerFoulsQDC */ void DisplayPlayerFoulsQDC (short fouls) { Rect srcOnRect, srcOffRect; short i, selector; SetRect(&srcOffRect, 0, 50, 16, 56); if (leftGoalIsPlayers) { SetRect(&srcOnRect, 0, 56, 16, 62); selector = kLeftScoreSelector; } else { SetRect(&srcOnRect, 16, 56, 32, 62); selector = kRightScoreSelector; } for (i = 0; i < 2; i++) { if (i < fouls) CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &srcOnRect, &scoreDisplays[selector].lightDest[i], srcCopy, kNilPointer); else CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &srcOffRect, &scoreDisplays[selector].lightDest[i], srcCopy, kNilPointer); } } /*======================================================== DisplayOpponentFoulsQD1 */ void DisplayOpponentFoulsQD1 (short fouls) { Rect srcOnRect, srcOffRect; short i, selector; SetRect(&srcOnRect, 16, 56, 32, 62); SetRect(&srcOffRect, 0, 50, 16, 56); if (leftGoalIsPlayers) selector = kRightScoreSelector; else selector = kLeftScoreSelector; for (i = 0; i < 2; i++) { if (i < fouls) CopyBits(&offPartsBits, &(mainWndo->portBits), &srcOnRect, &scoreDisplays[selector].lightDest[i], srcCopy, kNilPointer); else CopyBits(&offPartsBits, &(mainWndo->portBits), &srcOffRect, &scoreDisplays[selector].lightDest[i], srcCopy, kNilPointer); } } /*======================================================== DisplayOpponentFoulsQDC */ void DisplayOpponentFoulsQDC (short fouls) { Rect srcOnRect, srcOffRect; short i, selector; SetRect(&srcOffRect, 0, 50, 16, 56); if (leftGoalIsPlayers) { selector = kRightScoreSelector; SetRect(&srcOnRect, 16, 56, 32, 62); } else { selector = kLeftScoreSelector; SetRect(&srcOnRect, 0, 56, 16, 62); } for (i = 0; i < 2; i++) { if (i < fouls) CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &srcOnRect, &scoreDisplays[selector].lightDest[i], srcCopy, kNilPointer); else CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &srcOffRect, &scoreDisplays[selector].lightDest[i], srcCopy, kNilPointer); } } /*======================================================== TwinkleAStarQD1 */ void TwinkleAStarQD1 (short whichStar) { GrafPtr wasPort; GetPort(&wasPort); SetPort((GrafPtr)mainWndo); PenMode(patXor); MoveTo(starList[whichStar].h, starList[whichStar].v); Line(0, 0); PenNormal(); SetPort((GrafPtr)wasPort); } /*======================================================== TwinkleAStarQDC */ void TwinkleAStarQDC (short whichStar, short color) { GrafPtr wasPort; GetPort(&wasPort); SetPort((GrafPtr)mainWndo); RGBForeColor(&starColors[color]); MoveTo(starList[whichStar].h, starList[whichStar].v); Line(0, 0); RGBForeColor(&RGBBlackColor); SetPort((GrafPtr)wasPort); } /*======================================================== DrawOffscreenAStarQD1 */ void DrawOffscreenAStarQD1 (short whichStar) { GrafPtr wasPort; GetPort(&wasPort); SetPort(offBackPtr); PenMode(patXor); MoveTo(starList[whichStar].h, starList[whichStar].v); Line(0, 0); PenNormal(); SetPort(offWorkPtr); PenMode(patXor); MoveTo(starList[whichStar].h, starList[whichStar].v); Line(0, 0); PenNormal(); SetPort((GrafPtr)wasPort); } /*======================================================== DrawOffscreenAStarQDC */ void DrawOffscreenAStarQDC (short whichStar, short color) { GrafPtr wasPort; GetPort(&wasPort); SetPort((GrafPtr)offCBackPtr); RGBForeColor(&starColors[color]); MoveTo(starList[whichStar].h, starList[whichStar].v); Line(0, 0); RGBForeColor(&RGBBlackColor); SetPort((GrafPtr)offCWorkPtr); RGBForeColor(&starColors[color]); MoveTo(starList[whichStar].h, starList[whichStar].v); Line(0, 0); RGBForeColor(&RGBBlackColor); SetPort((GrafPtr)wasPort); } /*======================================================== UpdateArrowsQD1 */ void UpdateArrowsQD1 (void) { switch (whosGotBall) { case kBallIsNotHere: case kBallRollsFreely: CopyBits(&offPartsBits, &(mainWndo->portBits), &leftArrowStorage, &leftArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&offPartsBits, &offBackBits, &leftArrowStorage, &leftArrowDest, srcCopy, kNilPointer); CopyBits(&offPartsBits, &offWorkBits, &leftArrowStorage, &leftArrowDest, srcCopy, kNilPointer); CopyBits(&offPartsBits, &(mainWndo->portBits), &rightArrowStorage, &rightArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&offPartsBits, &offBackBits, &rightArrowStorage, &rightArrowDest, srcCopy, kNilPointer); CopyBits(&offPartsBits, &offWorkBits, &rightArrowStorage, &rightArrowDest, srcCopy, kNilPointer); break; case kPlayerHasBall: if (thePlayer.whichGoal == kLeftGoal) { CopyMask(&offPartsBits, &offMaskMap, &offBackBits, &leftArrowSrc, &leftArrowSrc, &leftArrowDest); CopyBits(&offBackBits, &offWorkBits, &leftArrowDest, &leftArrowDest, srcCopy, kNilPointer); CopyBits(&offBackBits, &(mainWndo->portBits), &leftArrowDest, &leftArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&offPartsBits, &(mainWndo->portBits), &rightArrowStorage, &rightArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&offPartsBits, &offBackBits, &rightArrowStorage, &rightArrowDest, srcCopy, kNilPointer); CopyBits(&offPartsBits, &offWorkBits, &rightArrowStorage, &rightArrowDest, srcCopy, kNilPointer); } else { CopyMask(&offPartsBits, &offMaskMap, &offBackBits, &rightArrowSrc, &rightArrowSrc, &rightArrowDest); CopyBits(&offBackBits, &(mainWndo->portBits), &rightArrowDest, &rightArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&offBackBits, &offWorkBits, &rightArrowDest, &rightArrowDest, srcCopy, kNilPointer); CopyBits(&offPartsBits, &(mainWndo->portBits), &leftArrowStorage, &leftArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&offPartsBits, &offBackBits, &leftArrowStorage, &leftArrowDest, srcCopy, kNilPointer); CopyBits(&offPartsBits, &offWorkBits, &leftArrowStorage, &leftArrowDest, srcCopy, kNilPointer); } break; case kOpponentHasBall: if (theOpponent.whichGoal == kLeftGoal) { CopyMask(&offPartsBits, &offMaskMap, &offBackBits, &leftArrowSrc, &leftArrowSrc, &leftArrowDest); CopyBits(&offBackBits, &offWorkBits, &leftArrowDest, &leftArrowDest, srcCopy, kNilPointer); CopyBits(&offBackBits, &(mainWndo->portBits), &leftArrowDest, &leftArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&offPartsBits, &(mainWndo->portBits), &rightArrowStorage, &rightArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&offPartsBits, &offBackBits, &rightArrowStorage, &rightArrowDest, srcCopy, kNilPointer); CopyBits(&offPartsBits, &offWorkBits, &rightArrowStorage, &rightArrowDest, srcCopy, kNilPointer); } else { CopyMask(&offPartsBits, &offMaskMap, &offBackBits, &rightArrowSrc, &rightArrowSrc, &rightArrowDest); CopyBits(&offBackBits, &(mainWndo->portBits), &rightArrowDest, &rightArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&offBackBits, &offWorkBits, &rightArrowDest, &rightArrowDest, srcCopy, kNilPointer); CopyBits(&offPartsBits, &(mainWndo->portBits), &leftArrowStorage, &leftArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&offPartsBits, &offBackBits, &leftArrowStorage, &leftArrowDest, srcCopy, kNilPointer); CopyBits(&offPartsBits, &offWorkBits, &leftArrowStorage, &leftArrowDest, srcCopy, kNilPointer); } break; } } /*======================================================== UpdateArrowsQDC */ void UpdateArrowsQDC (void) { switch (whosGotBall) { case kBallIsNotHere: case kBallRollsFreely: CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &leftArrowStorage, &leftArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCBackPtr)->portBits, &leftArrowStorage, &leftArrowDest, srcCopy, kNilPointer); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &leftArrowStorage, &leftArrowDest, srcCopy, kNilPointer); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &rightArrowStorage, &rightArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCBackPtr)->portBits, &rightArrowStorage, &rightArrowDest, srcCopy, kNilPointer); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &rightArrowStorage, &rightArrowDest, srcCopy, kNilPointer); break; case kPlayerHasBall: if (thePlayer.whichGoal == kLeftGoal) { CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &(((GrafPtr)mainWndo)->portBits), &leftArrowSrc, &leftArrowSrc, &leftArrowDest); CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCBackPtr)->portBits, &leftArrowDest, &leftArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCWorkPtr)->portBits, &leftArrowDest, &leftArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &rightArrowStorage, &rightArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCBackPtr)->portBits, &rightArrowStorage, &rightArrowDest, srcCopy, kNilPointer); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &rightArrowStorage, &rightArrowDest, srcCopy, kNilPointer); } else { CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &(((GrafPtr)mainWndo)->portBits), &rightArrowSrc, &rightArrowSrc, &rightArrowDest); CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCBackPtr)->portBits, &rightArrowDest, &rightArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCWorkPtr)->portBits, &rightArrowDest, &rightArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &leftArrowStorage, &leftArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCBackPtr)->portBits, &leftArrowStorage, &leftArrowDest, srcCopy, kNilPointer); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &leftArrowStorage, &leftArrowDest, srcCopy, kNilPointer); } break; case kOpponentHasBall: if (theOpponent.whichGoal == kLeftGoal) { CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &(((GrafPtr)mainWndo)->portBits), &leftArrowSrc, &leftArrowSrc, &leftArrowDest); CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCBackPtr)->portBits, &leftArrowDest, &leftArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCWorkPtr)->portBits, &leftArrowDest, &leftArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &rightArrowStorage, &rightArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCBackPtr)->portBits, &rightArrowStorage, &rightArrowDest, srcCopy, kNilPointer); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &rightArrowStorage, &rightArrowDest, srcCopy, kNilPointer); } else { CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &(((GrafPtr)mainWndo)->portBits), &rightArrowSrc, &rightArrowSrc, &rightArrowDest); CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCBackPtr)->portBits, &rightArrowDest, &rightArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCWorkPtr)->portBits, &rightArrowDest, &rightArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &leftArrowStorage, &leftArrowDest, srcCopy, mainWndo->visRgn); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCBackPtr)->portBits, &leftArrowStorage, &leftArrowDest, srcCopy, kNilPointer); CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &leftArrowStorage, &leftArrowDest, srcCopy, kNilPointer); } break; } } /*======================================================== RedrawWholeScreen */ void RedrawWholeScreen (void) { Rect tempRect; short i; if (isColor) CopyBits(&((GrafPtr)offCBackPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &offWorkRect, &offWorkRect, srcCopy, kNilPointer); else CopyBits(&offBackBits, &offWorkBits, &offWorkRect, &offWorkRect, srcCopy, kNilPointer); RenderScene(); if (isColor) CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &offWorkRect, &offWorkRect, srcCopy, ((GrafPtr)mainWndo)->visRgn); else CopyBits(&offWorkBits, &(mainWndo->portBits), &offWorkRect, &offWorkRect, srcCopy, mainWndo->visRgn); UpdatePlayerScore(); DisplayPlayerFouls(playerFouls); UpdateOpponentScore(); DisplayOpponentFouls(opponentFouls); UpdateArrows(); tempRect = leftTimingDest; tempRect.bottom = tempRect.top; if (isColor) UpdateBallTimersQDC(&tempRect); else UpdateBallTimersQD1(&tempRect); tempRect = rightTimingDest; tempRect.bottom = tempRect.top; if (isColor) UpdateBallTimersQDC(&tempRect); else UpdateBallTimersQD1(&tempRect); UpdateBallTimers(&thePlayer); UpdateBallTimers(&theOpponent); } /*======================================================== ReplayBackToWorkQD1 */ void ReplayBackToWorkQD1 (void) { CopyBits(&offBackBits, &offWorkBits, &cameraRect, &replayRect, srcCopy, kNilPointer); } /*======================================================== ReplayBackToWorkQDC */ void ReplayBackToWorkQDC (void) { CopyBits(&((GrafPtr)offCBackPtr)->portBits, &((GrafPtr)offCWorkPtr)->portBits, &cameraRect, &replayRect, srcCopy, kNilPointer); } /*======================================================== ReplayWorkToMainQD1 */ void ReplayWorkToMainQD1 (void) { CopyBits(&offWorkBits, &(mainWndo->portBits), &replayRect, &replayRect, srcCopy, kNilPointer); } /*======================================================== ReplayWorkToMainQDC */ void ReplayWorkToMainQDC (void) { CopyBits(&((GrafPtr)offCWorkPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &replayRect, &replayRect, srcCopy, kNilPointer); } //======================================================== DumpPict Boolean DumpPict (short frameNumber) { Str255 nameStr, digitStr; Rect offReplayRect; PicHandle thePict; CTabHandle thisCMHandle; CGrafPtr offCReplayPtr; CGrafPort offCReplayPort; GDHandle thisGDevice; GrafPtr wasPort; Ptr offReplayPix; long longCount, longZero, bytesAvail, sizeOfOff; OSErr err; short i, vrefnum, globalRef, replayRowBytes, digit; globalRef = 0; if (GetVInfo(0, (StringPtr)nameStr, &vrefnum, &bytesAvail) != noErr) return (FALSE); PasStringCopy("\pReplay.000", nameStr); digit = frameNumber % 10; nameStr[10] = digit + 48; frameNumber /= 10; digit = frameNumber % 10; nameStr[9] = digit + 48; frameNumber /= 10; digit = frameNumber % 10; nameStr[8] = digit + 48; do { err = Create(nameStr, vrefnum, 'ttxt', 'PICT'); if (err != noErr) { if (err == dupFNErr) nameStr[10]++; else return (FALSE); } } while (err != noErr); if (FSOpen(nameStr, vrefnum, &globalRef) != 0) return (FALSE); longZero = 0L; longCount = 4L; for (i = 0; i < (512 / 4); i++) { err = FSWrite(globalRef, &longCount, &longZero); if (err != noErr) return (FALSE); } GetPort(&wasPort); SetPort((GrafPtr)mainWndo); thisGDevice = GetMainDevice(); offCReplayPtr = &offCReplayPort; OpenCPort(offCReplayPtr); SetRect(&offReplayRect, 0, 0, replayRect.right - replayRect.left, replayRect.bottom - replayRect.top); replayRowBytes = (((4 * offReplayRect.right) + 15) >> 4) << 1; sizeOfOff = (long)offReplayRect.bottom * (long)replayRowBytes; offReplayPix = NewPtr(sizeOfOff); if (offReplayPix == kNilPointer) DeathError(kErrNoMemory); (**(*offCReplayPtr).portPixMap).baseAddr = offReplayPix; (**(*offCReplayPtr).portPixMap).rowBytes = (short)replayRowBytes + 0x8000; (**(*offCReplayPtr).portPixMap).bounds = offReplayRect; SetPort((GrafPtr)offCReplayPtr); ClipRect(&offReplayRect); thisCMHandle = (**(**thisGDevice).gdPMap).pmTable; err = HandToHand((Handle *)&thisCMHandle); if (err != noErr) return (FALSE); (**(*offCReplayPtr).portPixMap).pmTable = thisCMHandle; PmForeColor(kBlackColor4Bit); PmBackColor(kWhiteColor4Bit); CopyBits(&(((GrafPtr)mainWndo)->portBits), &((GrafPtr)offCReplayPtr)->portBits, &replayRect, &offReplayRect, srcCopy, kNilPointer); SetPort((GrafPtr)offCReplayPtr); thePict = OpenPicture(&offReplayRect); if (thePict == kNilPointer) return (FALSE); CopyBits(&((GrafPtr)offCReplayPtr)->portBits, &((GrafPtr)offCReplayPtr)->portBits, &offReplayRect, &offReplayRect, srcCopy, kNilPointer); ClosePicture(); HLock((Handle)thePict); longCount = GetHandleSize((Handle)thePict); if (FSWrite(globalRef, &longCount, *thePict) != noErr) return (FALSE); HUnlock((Handle)thePict); if (FSClose(globalRef) != noErr) return (FALSE); KillPicture(thePict); if (offCReplayPtr != kNilPointer) CloseCPort(offCReplayPtr); if (offReplayPix != kNilPointer) DisposPtr(offReplayPix); SetPort(wasPort); return (TRUE); } /*======================================================== UpdateBallTimersQD1 */ void UpdateBallTimersQD1 (Rect *dest) { GrafPtr wasPort; if (dest->top == dest->bottom) { dest->bottom = dest->top + 26; CopyBits(&offPartsBits, &(mainWndo->portBits), &timingSource, dest, srcCopy, kNilPointer); } else { GetPort((GrafPtr *)&wasPort); SetPort((GrafPtr)mainWndo); PaintRect(dest); SetPort((GrafPtr)wasPort); } } /*======================================================== UpdateBallTimersQDC */ void UpdateBallTimersQDC (Rect *dest) { GrafPtr wasPort; if (dest->top == dest->bottom) { dest->bottom = dest->top + 26; CopyBits(&((GrafPtr)offCPartsPtr)->portBits, &(((GrafPtr)mainWndo)->portBits), &timingSource, dest, srcCopy, kNilPointer); } else { GetPort((GrafPtr *)&wasPort); SetPort((GrafPtr)mainWndo); PaintRect(dest); SetPort((GrafPtr)wasPort); } } \ No newline at end of file diff --git a/Sources/Replay.c b/Sources/Replay.c new file mode 100755 index 0000000..a2e0179 --- /dev/null +++ b/Sources/Replay.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Instant Replay Handling Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "Replay.h" #include "Render.h" #include "RenderQD.h" #include "NetOpponent.h" #include "RenderAsm1.h" #include "RenderAsm4.h" /*======================================================== Functions */ /*======================================================== AmassReplayData */ void AmassReplayData (void) { short theFrame; if (canReplay) { replayData->frame++; if (replayData->frame >= kMaxReplayFrames) replayData->frame = 0; theFrame = replayData->frame; replayData->data[theFrame].playerIs = thePlayer.isRect; replayData->data[theFrame].opponentIs = theOpponent.isRect; replayData->data[theFrame].ballIs = theBall.isRect; if (leftGoalIsPlayers) replayData->data[theFrame].playerArraySrc = kPlayerSrc; else replayData->data[theFrame].playerArraySrc = kOpponentSrc; replayData->data[theFrame].playerDirSrc = thePlayer.dirFlagSrc; replayData->data[theFrame].playerPostSrc = thePlayer.postFlagSrc; replayData->data[theFrame].playerArrayMask = thePlayer.arrayFlagMask; replayData->data[theFrame].playerDirMask = thePlayer.dirFlagMask; replayData->data[theFrame].playerPostMask = thePlayer.postFlagMask; replayData->data[theFrame].playerMode = thePlayer.mode; if (leftGoalIsPlayers) replayData->data[theFrame].opponentArraySrc = kOpponentSrc; else replayData->data[theFrame].opponentArraySrc = kPlayerSrc; replayData->data[theFrame].opponentDirSrc = theOpponent.dirFlagSrc; replayData->data[theFrame].opponentPostSrc = theOpponent.postFlagSrc; replayData->data[theFrame].opponentArrayMask = theOpponent.arrayFlagMask; replayData->data[theFrame].opponentDirMask = theOpponent.dirFlagMask; replayData->data[theFrame].opponentPostMask = theOpponent.postFlagMask; replayData->data[theFrame].opponentMode = theOpponent.mode; replayData->data[theFrame].ballMode = theBall.mode; replayData->data[theFrame].wheresBall = whosGotBall; replayData->data[theFrame].ballDontDraw = theBall.dontDraw; } } /*======================================================== DoInstantReplay */ void DoInstantReplay (void) { Rect playerIsRect, opponentIsRect, ballIsRect, zoomFrame; RgnHandle wasClip, newClip; GrafPtr wasPort; long nowTime, waitFor, dummyLong; short theFrame, i, replayTickDelay, zoomWide, zoomHigh, wasFrame; char ballsMode; Boolean confirmed, doQuicktime; if (!canReplay) return; doQuicktime = (isColor && OptionKeyIsDown() && CommandKeyIsDown()); nowTime = Ticks; HandlePreGraphics(); RenderScene(); zoomFrame = replayRect; GetPort(&wasPort); SetPort((GrafPtr)mainWndo); wasClip = NewRgn(); if (wasClip != kNilPointer) CopyRgn((RgnHandle)((GrafPtr)mainWndo->visRgn), wasClip); newClip = NewRgn(); if (newClip != kNilPointer) { RectRgn(newClip, &screenBits.bounds); CopyRgn(newClip, (RgnHandle)((GrafPtr)mainWndo->visRgn)); } if (replayZooms) { InsetRect(&zoomFrame, 63, 63); for (i = 1; i < 65; i++) { PenPat(black); FrameRect(&zoomFrame); InsetRect(&zoomFrame, -1, -1); PenPat(white); FrameRect(&zoomFrame); } } else { FillRect(&zoomFrame, black); InsetRect(&zoomFrame, -1, -1); PenPat(white); FrameRect(&zoomFrame); } PenNormal(); SetPort((GrafPtr)wasPort); replayData->hVel = 0; replayData->vVel = 0; wasFrame = replayData->frame; replayData->frame++; if (replayData->frame >= kMaxReplayFrames) replayData->frame = 0; theFrame = replayData->frame; playerIsRect = replayData->data[theFrame].playerIs; opponentIsRect = replayData->data[theFrame].opponentIs; ballIsRect = replayData->data[theFrame].ballIs; ballsMode = replayData->data[theFrame].ballMode; if (ballsMode == kBallRolling) { cameraRect.left = ballIsRect.left - 96; cameraRect.top = ballIsRect.top - 64; cameraRect.right = cameraRect.left + 192; cameraRect.bottom = cameraRect.top + 128; } else if (playerJustScored) { cameraRect.left = playerIsRect.left - 96; cameraRect.top = playerIsRect.top - 64; cameraRect.right = cameraRect.left + 192; cameraRect.bottom = cameraRect.top + 128; } else { cameraRect.left = opponentIsRect.left - 96; cameraRect.top = opponentIsRect.top - 64; cameraRect.right = cameraRect.left + 192; cameraRect.bottom = cameraRect.top + 128; } if (cameraRect.left < 0) { cameraRect.left = 0; cameraRect.right = cameraRect.left + 192; } else if (cameraRect.right > screenWide) { cameraRect.left = screenWide - 192; cameraRect.right = cameraRect.left + 192; } if (cameraRect.top < 0) { cameraRect.top = 0; cameraRect.bottom = cameraRect.top + 128; } else if (cameraRect.bottom > screenHigh) { cameraRect.top = screenHigh - 128; cameraRect.bottom = cameraRect.top + 128; } while (Button()); replayTickDelay = 1; waitFor = Ticks + (long)replayTickDelay; for (i = 0; i < (kMaxReplayFrames); i++) { RenderInstantReplay(); if (doQuicktime && ((i % 2) == 0)) doQuicktime = DumpPict(i / 2); while (Ticks < waitFor); if (i < 200) replayTickDelay = 2; else if (i < 275) replayTickDelay = 4; else replayTickDelay = 8; if (Button()) break; waitFor = Ticks + replayTickDelay; replayData->frame++; if (replayData->frame >= kMaxReplayFrames) replayData->frame = 0; } replayData->frame = wasFrame; while (Button()); RedrawWholeScreen(); if (wasClip != kNilPointer) { CopyRgn(wasClip, (RgnHandle)((GrafPtr)mainWndo->visRgn)); DisposeRgn(wasClip); } if (newClip != kNilPointer) DisposeRgn(newClip); if (netGameInSession) { confirmed = WaitForSynch(1200); } nowTime = Ticks - nowTime; baseTime += (nowTime / 60L); } /*======================================================== RenderInstantReplayQD1 */ void RenderInstantReplayQD1 (void) { Rect playerIsRect, opponentIsRect, ballIsRect; Rect playerSrcRect, opponentSrcRect; Rect playerMaskRect, opponentMaskRect; Point cameraPt; short theFrame; char playersMode, opponentsMode, ballsMode, whereBall; Boolean ballDontDraw; theFrame = replayData->frame; playerIsRect = replayData->data[theFrame].playerIs; opponentIsRect = replayData->data[theFrame].opponentIs; ballIsRect = replayData->data[theFrame].ballIs; playersMode = replayData->data[theFrame].playerMode; opponentsMode = replayData->data[theFrame].opponentMode; ballsMode = replayData->data[theFrame].ballMode; whereBall = replayData->data[theFrame].wheresBall; ballDontDraw = replayData->data[theFrame].ballDontDraw; if (replayData->data[theFrame].playerArraySrc == kPlayerSrc) playerSrcRect = playerSrcRects[replayData->data[theFrame].playerDirSrc] [replayData->data[theFrame].playerPostSrc]; else playerSrcRect = opponentSrcRects[replayData->data[theFrame].playerDirSrc] [replayData->data[theFrame].playerPostSrc]; if (replayData->data[theFrame].playerArrayMask == kMask) playerMaskRect = playerSrcRects[replayData->data[theFrame].playerDirMask] [replayData->data[theFrame].playerPostMask]; else playerMaskRect = fadeMaskRects[replayData->data[theFrame].playerDirMask] [replayData->data[theFrame].playerPostMask]; if (replayData->data[theFrame].opponentArraySrc == kPlayerSrc) opponentSrcRect = playerSrcRects[replayData->data[theFrame].opponentDirSrc] [replayData->data[theFrame].opponentPostSrc]; else opponentSrcRect = opponentSrcRects[replayData->data[theFrame].opponentDirSrc] [replayData->data[theFrame].opponentPostSrc]; if (replayData->data[theFrame].opponentArrayMask == kMask) opponentMaskRect = playerSrcRects[replayData->data[theFrame].opponentDirMask] [replayData->data[theFrame].opponentPostMask]; else opponentMaskRect = fadeMaskRects[replayData->data[theFrame].opponentDirMask] [replayData->data[theFrame].opponentPostMask]; if (whereBall == kBallRollsFreely) { cameraPt.h = ballIsRect.left - 96; cameraPt.v = ballIsRect.top - 64; } else if (whereBall == kPlayerHasBall) { cameraPt.h = playerIsRect.left - 96; cameraPt.v = playerIsRect.top - 64; } else if (whereBall == kOpponentHasBall) { cameraPt.h = opponentIsRect.left - 96; cameraPt.v = opponentIsRect.top - 64; } else { cameraPt.h = cameraRect.left; cameraPt.v = cameraRect.top; } replayData->hVel = (replayData->hVel / 2) + (cameraPt.h - cameraRect.left) / kCameraInertia; replayData->vVel = (replayData->vVel / 2) + (cameraPt.v - cameraRect.top) / kCameraInertia; cameraRect.left += replayData->hVel; cameraRect.top += replayData->vVel; cameraRect.right = cameraRect.left + 192; cameraRect.bottom = cameraRect.top + 128; if (cameraRect.left < 0) { cameraRect.left = 0; cameraRect.right = cameraRect.left + 192; } else if (cameraRect.right > screenWide) { cameraRect.left = screenWide - 192; cameraRect.right = cameraRect.left + 192; } if (cameraRect.top < 0) { cameraRect.top = 0; cameraRect.bottom = cameraRect.top + 128; } else if (cameraRect.bottom > screenHigh) { cameraRect.top = screenHigh - 128; cameraRect.bottom = cameraRect.top + 128; } playerIsRect.left = replayRect.left + playerIsRect.left - cameraRect.left; playerIsRect.right = playerIsRect.left + 32; playerIsRect.top = replayRect.top + playerIsRect.top - cameraRect.top; playerIsRect.bottom = playerIsRect.top + 44; opponentIsRect.left = replayRect.left + opponentIsRect.left - cameraRect.left; opponentIsRect.right = opponentIsRect.left + 32; opponentIsRect.top = replayRect.top + opponentIsRect.top - cameraRect.top; opponentIsRect.bottom = opponentIsRect.top + 44; ballIsRect.left = replayRect.left + ballIsRect.left - cameraRect.left; ballIsRect.right = ballIsRect.left + 16; ballIsRect.top = replayRect.top + ballIsRect.top - cameraRect.top; ballIsRect.bottom = ballIsRect.top + 12; ReplayBackToWorkQD1(); if ((ballsMode == kBallRolling) && (!ballDontDraw)) CopyMask(&offPartsBits, &offMaskMap, &offWorkBits, &theBall.srcRect, &theBall.srcRect, &ballIsRect); if (playerIsRect.bottom < opponentIsRect.bottom) { if (playersMode != kInStasis) CopyMask(&offPartsBits, &offMaskMap, &offWorkBits, &playerSrcRect, &playerMaskRect, &playerIsRect); if (opponentsMode != kInStasis) CopyMask(&offPartsBits, &offMaskMap, &offWorkBits, &opponentSrcRect, &opponentMaskRect, &opponentIsRect); } else { if (opponentsMode != kInStasis) CopyMask(&offPartsBits, &offMaskMap, &offWorkBits, &opponentSrcRect, &opponentMaskRect, &opponentIsRect); if (playersMode != kInStasis) CopyMask(&offPartsBits, &offMaskMap, &offWorkBits, &playerSrcRect, &playerMaskRect, &playerIsRect); } if ((Ticks % 20) <= 15) { SetPort(offWorkPtr); MoveTo(replayRect.left + 4, replayRect.bottom - 4); TextMode(srcBic); TextFont(geneva); TextSize(9); DrawString("\pINSTANT REPLAY"); PenPat(black); } if (useQD) ReplayWorkToMainQD1(); else ReplayWorkToMainAsm1(); } /*======================================================== RenderInstantReplayQDC */ void RenderInstantReplayQDC (void) { Rect playerIsRect, opponentIsRect, ballIsRect; Rect playerSrcRect, opponentSrcRect; Rect playerMaskRect, opponentMaskRect; Point cameraPt; short theFrame; char playersMode, opponentsMode, ballsMode, whereBall; Boolean ballDontDraw; theFrame = replayData->frame; playerIsRect = replayData->data[theFrame].playerIs; opponentIsRect = replayData->data[theFrame].opponentIs; ballIsRect = replayData->data[theFrame].ballIs; playersMode = replayData->data[theFrame].playerMode; opponentsMode = replayData->data[theFrame].opponentMode; ballsMode = replayData->data[theFrame].ballMode; whereBall = replayData->data[theFrame].wheresBall; ballDontDraw = replayData->data[theFrame].ballDontDraw; if (replayData->data[theFrame].playerArraySrc == kPlayerSrc) playerSrcRect = playerSrcRects[replayData->data[theFrame].playerDirSrc] [replayData->data[theFrame].playerPostSrc]; else playerSrcRect = opponentSrcRects[replayData->data[theFrame].playerDirSrc] [replayData->data[theFrame].playerPostSrc]; if (replayData->data[theFrame].playerArrayMask == kMask) playerMaskRect = playerSrcRects[replayData->data[theFrame].playerDirMask] [replayData->data[theFrame].playerPostMask]; else playerMaskRect = fadeMaskRects[replayData->data[theFrame].playerDirMask] [replayData->data[theFrame].playerPostMask]; if (replayData->data[theFrame].opponentArraySrc == kPlayerSrc) opponentSrcRect = playerSrcRects[replayData->data[theFrame].opponentDirSrc] [replayData->data[theFrame].opponentPostSrc]; else opponentSrcRect = opponentSrcRects[replayData->data[theFrame].opponentDirSrc] [replayData->data[theFrame].opponentPostSrc]; if (replayData->data[theFrame].opponentArrayMask == kMask) opponentMaskRect = playerSrcRects[replayData->data[theFrame].opponentDirMask] [replayData->data[theFrame].opponentPostMask]; else opponentMaskRect = fadeMaskRects[replayData->data[theFrame].opponentDirMask] [replayData->data[theFrame].opponentPostMask]; if (whereBall == kBallRollsFreely) { cameraPt.h = ballIsRect.left - 96; cameraPt.v = ballIsRect.top - 64; } else if (whereBall == kPlayerHasBall) { cameraPt.h = playerIsRect.left - 96; cameraPt.v = playerIsRect.top - 64; } else if (whereBall == kOpponentHasBall) { cameraPt.h = opponentIsRect.left - 96; cameraPt.v = opponentIsRect.top - 64; } else { cameraPt.h = cameraRect.left; cameraPt.v = cameraRect.top; } replayData->hVel = (cameraPt.h - cameraRect.left) / kCameraInertia; replayData->vVel = (cameraPt.v - cameraRect.top) / kCameraInertia; cameraRect.left += replayData->hVel; cameraRect.top += replayData->vVel; cameraRect.right = cameraRect.left + 192; cameraRect.bottom = cameraRect.top + 128; if (cameraRect.left < 0) { cameraRect.left = 0; cameraRect.right = cameraRect.left + 192; } else if (cameraRect.right > screenWide) { cameraRect.left = screenWide - 192; cameraRect.right = cameraRect.left + 192; } if (cameraRect.top < 0) { cameraRect.top = 0; cameraRect.bottom = cameraRect.top + 128; } else if (cameraRect.bottom > screenHigh) { cameraRect.top = screenHigh - 128; cameraRect.bottom = cameraRect.top + 128; } playerIsRect.left = replayRect.left + playerIsRect.left - cameraRect.left; playerIsRect.right = playerIsRect.left + 32; playerIsRect.top = replayRect.top + playerIsRect.top - cameraRect.top; playerIsRect.bottom = playerIsRect.top + 44; opponentIsRect.left = replayRect.left + opponentIsRect.left - cameraRect.left; opponentIsRect.right = opponentIsRect.left + 32; opponentIsRect.top = replayRect.top + opponentIsRect.top - cameraRect.top; opponentIsRect.bottom = opponentIsRect.top + 44; ballIsRect.left = replayRect.left + ballIsRect.left - cameraRect.left; ballIsRect.right = ballIsRect.left + 16; ballIsRect.top = replayRect.top + ballIsRect.top - cameraRect.top; ballIsRect.bottom = ballIsRect.top + 12; ReplayBackToWorkQDC(); if ((ballsMode == kBallRolling) && (!ballDontDraw)) CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &((GrafPtr)offCWorkPtr)->portBits, &theBall.srcRect, &theBall.srcRect, &ballIsRect); if (playerIsRect.bottom < opponentIsRect.bottom) { if (playersMode != kInStasis) CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &((GrafPtr)offCWorkPtr)->portBits, &playerSrcRect, &playerMaskRect, &playerIsRect); if (opponentsMode != kInStasis) CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &((GrafPtr)offCWorkPtr)->portBits, &opponentSrcRect, &opponentMaskRect, &opponentIsRect); } else { if (opponentsMode != kInStasis) CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &((GrafPtr)offCWorkPtr)->portBits, &opponentSrcRect, &opponentMaskRect, &opponentIsRect); if (playersMode != kInStasis) CopyMask(&((GrafPtr)offCPartsPtr)->portBits, &offMaskMap, &((GrafPtr)offCWorkPtr)->portBits, &playerSrcRect, &playerMaskRect, &playerIsRect); } if ((Ticks % 20) <= 15) { SetPort((GrafPtr)offCWorkPtr); MoveTo(replayRect.left + 4, replayRect.bottom - 4); TextFont(geneva); TextSize(9); ForeColor(whiteColor); DrawString("\pINSTANT REPLAY"); ForeColor(blackColor); } if (useQD) ReplayWorkToMainQDC(); else ReplayWorkToMainAsm4(); } /*======================================================== RenderInstantReplay */ void RenderInstantReplay (void) { if (isColor) { RenderInstantReplayQDC(); } else RenderInstantReplayQD1(); } \ No newline at end of file diff --git a/Sources/SMSCore.a.π b/Sources/SMSCore.a.π new file mode 100755 index 0000000..e69de29 diff --git a/Sources/Show_help.c b/Sources/Show_help.c new file mode 100755 index 0000000..7de28d2 --- /dev/null +++ b/Sources/Show_help.c @@ -0,0 +1 @@ +#define USE_PICTS 1 /* 1 if PICTs are to be displayed, 0 for text only */ #define ONE_RESOURCE 0 /* 1 for Get1Resource, 0 for GetResource, etc. */ #define COMPRESSION 1 /* compressed TEXT/styl */ #define STANDALONE 0 #define CHECKPOINTS 0 #define ASSERTIONS 0 #if STANDALONE #define Show_help main #else void main( void ); #endif #include "Show_help.h" /* Show_help by James W. Walker, June 1991 version 1.6, updated March 1992 This code is freely usable. If you want to show your gratitude, you could send me a free copy of whatever program you develop with it. e-mail: Internet 76367.2271@compuserve.com CIS 76367,2271 America Online JWWalker This code displays scrolling text in a dialog box. The text comes from TEXT/styl resources, which can be created with ResEdit 2.1 or with an accompanying HyperCard stack. The text cannot be edited, but one can select text and copy it to the clipboard using command-C, or save it as a TeachText file. Pictures can be included in the text using the same scheme as TeachText: Each option-space character indicates where the top edge of a picture should go, and pictures are centered horizontally. Pictures come from consecutively-numbered PICT resources. A popup menu can be used to jump to "bookmarks", which are indicated by tab characters at ends of lines. Prototype: pascal void Show_help( short help_dlog_id, StringPtr help_text_name, short base_pict_id, StringPtr default_filename, StringPtr default_menuname ); help_dlog_id is the resource ID of the DLOG resource. The dialog should have an OK button as item 1 and a userItem, to display the text, in item 2. help_text_name is the suffix of the resource name of the TEXT and styl resources. For instance if help_text_name is "\pblah", and COMPRESSION is 1, then Show_help will look for '4CMP' resources named "TEXTblah" and "stylblah". If COMPRESSION is 0, Show_help looks for a 'TEXT' resource named "blah" and a 'styl' resource named "blah". base_pict_id is the resource ID of the first PICT resource. default_filename is the filename initially presented in the Save dialog when the user saves the help text as TeachText. default_menuname is the menu item used for a line that consists of a tab and nothing else. TO DO: error recovery, support for modeless use. */ #if __option(a4_globals) #define RESTORE_A4 asm { move.L (SP)+, A4 } #if __option(pcrel_strings) // single-segment code resource #define SETUP_A4 asm { move.L A4, -(SP) }\ asm { LEA main, A4 } #else // multi-segment code resource #include #define SETUP_A4 SetUpA4() #endif #else #define SETUP_A4 #define RESTORE_A4 #endif #ifndef NIL #define NIL 0L #endif #if ONE_RESOURCE #define GetResource Get1Resource #define CountResources Count1Resources #define GetNamedResource Get1NamedResource #endif ONE_RESOURCE #if ASSERTIONS #define ASSERT(x,y) if (!(x)) {DebugStr("\p" y);} #else #define ASSERT(x,y) #endif ASSERTIONS #if CHECKPOINTS #define CKPT(x) DebugStr( "\p" x ) #else #define CKPT(x) #endif CHECKPOINTS enum { c_OK = 1, /* OK button */ c_help, /* userItem for our help display */ c_save, /* Button to save as TeachText */ c_menu /* userItem for popup menu */ }; #define SCROLLBAR_WIDTH 16 #define TEXT_INSET 4 typedef struct { Rect bounds; PicHandle pict; } pict_info; typedef struct { short array_size; short high_waiting; Rect high_rect[]; } high_info; #define INITIAL_HIGHLIGHTS 8 typedef struct { // piggyback some other info on the dialog record DialogRecord dialog; ControlHandle scrollbar; #if USE_PICTS high_info **high; short pict_count; /* how many pictures */ pict_info *pict_data; /* pointer to an array */ Boolean high_defer_flag; #endif } help_record, *help_ptr; #if COMPRESSION typedef struct { ResType srcType; Handle srcHandle; ResType dstType; Handle dstHandle; } ParmInfo; /* We don't actually use the first parameter passed to the CNVT code, but it is a pointer to a structure as below. */ typedef struct { ProcPtr entryPoint; short resID; short parmCount; Boolean useDefault; /* 2 bytes? */ } RoutineInfo; typedef pascal OSErr (*CNVT_routine)(RoutineInfo *, ParmInfo *); #endif COMPRESSION /* private global variables */ static RgnHandle save_clip; static CursHandle ibeam_cursor; /* Prototypes of private routines */ static void Push_highlight( high_info **hh, Rect *rect ); static Boolean Pop_highlight( high_info **hh, Rect *rect ); static pascal Boolean Help_filter( DialogPtr dialog, EventRecord *event, short *itemHit); static pascal void Text_userItem_proc( WindowPtr the_window, short item_num ); static pascal void Menu_userItem_proc( WindowPtr the_window, short item_num ); static pascal void Scroll_text( ControlHandle the_bar, int part_code ); static pascal Auto_scroll( void ); static void Handle_scroll( DialogPtr dialog, short the_part, Point local_point ); static void Adjust_text( DialogPtr dialog ); static void Save_text( TEHandle the_text, short base_pict_id, StringPtr default_filename ); static void Topic_menu( DialogPtr dlog, MenuHandle help_popup ); static MenuHandle Build_popup( TEHandle the_text, StringPtr default_menuname ); static short Find_char( Handle data_h, // handle to a block of characters short offset, // initial offset within block char what ); // the character we're looking for #if COMPRESSION static Handle Get_compressed_resource( ResType the_type, StringPtr the_name ); static void Release_compressed_resource( Handle rsrc_h ); #else #define Get_compressed_resource GetNamedResource #define Release_compressed_resource ReleaseResource #endif #if USE_PICTS static void Find_pictures( DialogPtr dlog, short first_pict_id ); static void Draw_picts( WindowPtr the_window, Rect *update_rect ); static pascal void High_hook( Rect *high_rect ); static void High_hook_glue( void ); static void Do_deferred_hilites( help_ptr hptr, Rect *update_rect ); #endif /* ------------------------- Show_help --------------------------------- */ pascal void Show_help( short help_dlog_id, StringPtr help_text_name, short base_pict_id, StringPtr default_filename, StringPtr default_menuname ) { register DialogPtr dptr; register TEHandle the_text; short itype, ihit; Handle item_h; Rect help_item_box, box; Handle help_TEXT; StScrpHandle help_styl; GrafPtr save_port; Rect dest, view; ControlHandle the_bar; short max_scroll, nLines; Point place; MenuHandle help_popup; CursHandle watch_cursor; #if __option(a4_globals) #if __option(pcrel_strings) // single-segment code resource asm { LEA main, A4 } #else // multi-segment code resource RememberA4(); #endif #endif watch_cursor = GetCursor( watchCursor ); SetCursor( *watch_cursor ); ibeam_cursor = GetCursor( iBeamCursor ); dptr = (DialogPtr) NewPtr( sizeof(help_record) ); dptr = GetNewDialog( help_dlog_id, (DialogPeek) dptr, (WindowPtr)-1L ); ASSERT( dptr != NIL, "Failed GetNewDialog" ); GetPort( &save_port ); SetPort( dptr ); ((help_ptr) dptr)->high = (high_info **) NewHandle( sizeof(high_info) + INITIAL_HIGHLIGHTS * sizeof(Rect) ); ASSERT( ((help_ptr) dptr)->high != NIL, "Failed to get highlight record"); (**((help_ptr) dptr)->high).array_size = 2; (**((help_ptr) dptr)->high).high_waiting = 0; help_TEXT = Get_compressed_resource( 'TEXT', help_text_name ); if (help_TEXT == NIL) { ASSERT(false, "Failed to find help TEXT resource" ); SysBeep(1); goto getout; } help_styl = (StScrpHandle) Get_compressed_resource( 'styl', help_text_name ); if (help_styl == NIL) { DisposHandle( help_TEXT ); ASSERT( false, "Failed to find styl resource" ); SysBeep(1); goto getout; } HLock( help_TEXT ); GetDItem( dptr, c_help, &itype, &item_h, &help_item_box ); SetDItem( dptr, c_help, itype, (Handle) Text_userItem_proc, &help_item_box ); view = help_item_box; InsetRect( &view, 1, 1 ); view.right -= SCROLLBAR_WIDTH; dest = view; InsetRect( &dest, TEXT_INSET, 0 ); the_text = TEStylNew( &dest, &view ); ASSERT( the_text != NIL, "Failed TEStylNew." ); TEStylInsert( *help_TEXT, GetHandleSize(help_TEXT), help_styl, the_text ); TEActivate( the_text ); Release_compressed_resource( (Handle) help_styl ); Release_compressed_resource( help_TEXT ); nLines = (**the_text).nLines; SetWRefCon( dptr, (long)the_text ); max_scroll = TEGetHeight( (long) nLines, 1L, the_text ) - (view.bottom - view.top); help_item_box.left = help_item_box.right - SCROLLBAR_WIDTH; the_bar = NewControl( dptr, &help_item_box, "\p", true, 0, 0, max_scroll, scrollBarProc, NIL ); ASSERT( the_bar != NIL, "Failed NewControl for scroll bar." ); ((help_ptr) dptr)->scrollbar = the_bar; #if USE_PICTS Find_pictures( dptr, base_pict_id ); #endif help_popup = Build_popup( the_text, default_menuname ); TEAutoView( TRUE, the_text ); /* Permit auto-scrolling */ CKPT( "Installing ClikLoop" ); (**the_text).clikLoop = (ProcPtr)Auto_scroll; #if USE_PICTS (**the_text).highHook = (ProcPtr) High_hook_glue; ((help_ptr)dptr)->high_defer_flag = false; #endif GetDItem( dptr, c_menu, &itype, &item_h, &box ); SetDItem( dptr, c_menu, itype, (Handle) Menu_userItem_proc, &box ); save_clip = NewRgn(); /* Used in Draw_picts */ ShowWindow( dptr ); InitCursor(); do { ModalDialog( (ProcPtr) Help_filter, &ihit ); if (ihit == c_save) Save_text( the_text, base_pict_id, default_filename ); else if (ihit == c_menu) Topic_menu( dptr, help_popup ); } while (ihit != c_OK); DisposeRgn( save_clip ); #if USE_PICTS DisposPtr( (Ptr) ((help_ptr)dptr)->pict_data ); #endif TEDispose( the_text ); getout: DisposDialog( dptr ); DisposeMenu( help_popup ); SetPort( save_port ); } /* --------------------------- Push_highlight -------------------------- */ static void Push_highlight( high_info **hh, Rect *rect ) { if ( (**hh).high_waiting >= (**hh).array_size ) { SetHandleSize( (Handle)hh, sizeof(high_info) + (INITIAL_HIGHLIGHTS + (**hh).array_size) * sizeof(Rect) ); ASSERT( MemError() == noErr, "Can't expand highlight array" ); (**hh).array_size = ( GetHandleSize( (Handle)hh ) - sizeof(high_info) ) / sizeof(Rect); } if ( (**hh).high_waiting < (**hh).array_size ) { (**hh).high_rect[ (**hh).high_waiting ] = *rect; (**hh).high_waiting++; } } /* --------------------------- Pop_highlight -------------------------- */ static Boolean Pop_highlight( high_info **hh, Rect *rect ) { if ( (**hh).high_waiting > 0 ) { (**hh).high_waiting--; *rect = (**hh).high_rect[ (**hh).high_waiting ]; return true; } else return false; } /* --------------------------- Find_char -------------------------- */ /* Find a character within a handle. In a previous version I did this with Munger(). returns: the offset of the character, or -1 if not found. */ static short Find_char( Handle data_h, // handle to a block of characters short offset, // initial offset within block char what ) // the character we're looking for { Ptr text; short text_size, scan; text_size = (short) GetHandleSize( data_h ); text = *data_h; for (scan = offset; (text[scan] != what) && (scan < text_size); ++scan) ; if (scan == text_size) // not found scan = -1; return scan; } /* --------------------------- Build_popup ------------------------- */ /* Build a popup menu of the sections of the help text. We scan for tab characters. The text between the tab character and the preceding line break will be a menu item, unless it is the null string; then we use the default menu name that was passed to Show_help. */ static MenuHandle Build_popup( TEHandle the_text, StringPtr default_menuname ) { MenuHandle popup; short menu_id; SignedByte text_state; Handle text_h; /* handle to just the text */ Str255 menu_data; char *text; /* pointer to the help text */ register short scan, line_start; short text_size, title_length; /* Find an unused menu ID */ menu_id = 1300; /* no particular reason */ while (GetMHandle(menu_id)) ++menu_id; popup = NewMenu( menu_id, "\p" ); text_h = (**the_text).hText; text_state = HGetState( text_h ); HLock( text_h ); text = *text_h; text_size = (short) GetHandleSize( text_h ); line_start = 0; for (scan = 0; scan < text_size; scan++ ) { if (text[scan] == '\r') { line_start = scan + 1; } else if (text[scan] == '\t') { title_length = scan - line_start; if (title_length == 0) BlockMove( default_menuname, menu_data, 256 ); else { menu_data[0] = title_length; // note: <= 255 BlockMove( &text[line_start], &menu_data[1], menu_data[0] ); } /* AppendMenu recognizes meta-characters like slash, which is probably not what we want in this case. So we use SetItem, which does not use meta-characters. */ AppendMenu( popup, "\p " ); SetItem( popup, CountMItems(popup), menu_data ); } } HSetState( text_h, text_state ); return popup; } /* ------------------------- Topic_menu ------------------------ */ /* This routine is called when the menu title is clicked. It pops up the menu and scrolls to the indicated tab character. */ static void Topic_menu( DialogPtr dptr, MenuHandle menu ) { short menu_id; Handle item_h; short itype; Rect box; Point where; long menu_return; short menu_choice; ControlHandle bar; register short i; register TEHandle the_text; Handle text_h; register short offset; TextStyle what_style; short line_height, font_ascent; if (menu == NIL) return; InsertMenu( menu, -1 ); GetDItem( dptr, c_menu, &itype, &item_h, &box ); where.h = box.left; where.v = box.bottom; LocalToGlobal( &where ); HiliteMode &= ~(1 << hiliteBit); InvertRect( &box ); menu_return = PopUpMenuSelect( menu, where.v, where.h, 0 ); HiliteMode &= ~(1 << hiliteBit); InvertRect( &box ); if (HiWord(menu_return)) /* Something selected */ { menu_choice = LoWord( menu_return ); bar = ((help_ptr)dptr)->scrollbar; the_text = (TEHandle) GetWRefCon( dptr ); text_h = (**the_text).hText; /* Find tab character number menu_choice */ offset = -1L; for (i = 1; i <= menu_choice; ++i) { ++offset; /* so we don't find the same thing twice */ offset = Find_char( text_h, offset, '\t' ); } where = TEGetPoint( (short)offset, the_text ); TEGetStyle( (short)offset, &what_style, &line_height, &font_ascent, the_text ); where.v -= line_height; /* align to TOP of tab */ /* Now where.v is in local coordinates. */ where.v -= (**the_text).destRect.top; SetCtlValue( bar, where.v ); Adjust_text( dptr ); } menu_id = (**menu).menuID; DeleteMenu( menu_id ); } /* ------------------------- Save_text ------------------------ */ /* This is called when the user clicks on the "Save as TeachText" button. */ static void Save_text( TEHandle the_text, short base_pict_id, StringPtr default_filename ) { Point where; SFReply reply; OSErr err; short data_refnum, res_refnum, old_resfile; Handle text_data; SignedByte state; long count; #if USE_PICTS register short num_picts, pict_id; Handle old_pict, new_pict; #endif where.h = where.v = 100; SFPutFile( where, "\pName of TeachText file:", default_filename, NIL, &reply ); if (reply.good) { old_resfile = CurResFile(); #if USE_PICTS num_picts = CountResources( 'PICT' ); #endif (void) FSDelete( reply.fName, reply.vRefNum ); (void) Create( reply.fName, reply.vRefNum, 'ttxt', 'ttro' ); (void) FSOpen( reply.fName, reply.vRefNum, &data_refnum ); text_data = (**the_text).hText; state = HGetState(text_data ); HLock( text_data ); count = GetHandleSize( text_data ); (void) FSWrite( data_refnum, &count, *text_data ); (void) FSClose( data_refnum ); HSetState( text_data, state ); #if USE_PICTS if (num_picts > 0) { (void) SetVol( NIL, reply.vRefNum ); CreateResFile( reply.fName ); ASSERT( ResError() == noErr, "\pCreateResFile error" ); res_refnum = OpenResFile( reply.fName ); ASSERT( ResError() == noErr, "\pOpenResFile error" ); for (pict_id = base_pict_id; pict_id < base_pict_id + num_picts; ++pict_id ) { UseResFile( old_resfile ); old_pict = GetResource( 'PICT', pict_id ); if (old_pict == NIL) break; new_pict = old_pict; (void) HandToHand( &new_pict ); UseResFile( res_refnum ); AddResource( new_pict, 'PICT', pict_id - base_pict_id + 1000, "\p" ); ASSERT( ResError() == noErr, "\pAddResource error" ); } CloseResFile( res_refnum ); (void) FlushVol( NIL, reply.vRefNum ); } #endif } } #if USE_PICTS /* ------------------------- High_hook_glue ------------------------ */ static void High_hook_glue( void ) { asm { move.L (SP)+, A0 ; get address of rectangle movem.L A2-A5/D3-D7, -(SP) ; save registers move.L A0, -(SP) } CKPT( "High_hook_glue" ); asm { JSR High_hook movem.L (SP)+, A2-A5/D3-D7 ; restore registers RTS } } /* ------------------------- High_hook -------------------------- */ /* This deferred highlighting scheme is used to ensure that highlighting will be done after any pictures have been drawn, not before. To do otherwise can cause pictures to be incorrectly highlighted during auto-scrolling. This effect can be seen in TeachText. */ static pascal void High_hook( Rect *the_rect ) { register help_ptr front; CKPT( "High_hook"); front = (help_ptr) FrontWindow(); if ( (front != NIL) && (GetPtrSize((Ptr)front) == sizeof(help_record)) && !EmptyRect( the_rect ) ) { if (!front->high_defer_flag) { HiliteMode &= ~(1 << hiliteBit); InvertRect( the_rect ); } else { Push_highlight( front->high, the_rect ); } } } #endif /* USE_PICTS */ /* ------------------------- Auto_scroll ----------------------------- */ /* This is a ClikLoop routine, called repeatedly by TEClick when the mouse is down. */ static pascal Auto_scroll() { register WindowPtr the_display; register ControlHandle the_bar; Point mouse_point; Rect view_rect; register TEHandle the_text; asm { movem.l a1-a5/d1-d7, -(SP) } CKPT( "Auto_scroll"); the_display = FrontWindow(); if ( (the_display != NIL) && (GetPtrSize((Ptr)the_display) == sizeof(help_record)) ) { the_text = (TEHandle) GetWRefCon( the_display ); the_bar = ((help_ptr) the_display)->scrollbar; GetMouse( &mouse_point ); view_rect = (**the_text).viewRect; if (mouse_point.v < view_rect.top) Scroll_text( the_bar, inUpButton ); else if (mouse_point.v > view_rect.bottom) Scroll_text( the_bar, inDownButton ); } asm { movem.L (SP)+, a1-a5/d1-d7 moveQ #1, D0 } } #if USE_PICTS /* ------------------------- Draw_picts --------------------------------- */ /* Called by Adjust_text and Text_userItem_proc to draw pictures. */ static void Draw_picts( WindowPtr the_window, Rect *update_rect ) { register TEHandle the_text; register short pict_count, pict_index; PicHandle the_pict; short v_offset; Rect pict_loc, dummy; CKPT( "Draw_picts"); the_text = (TEHandle) GetWRefCon( the_window ); v_offset = (**the_text).destRect.top - (**the_text).viewRect.top - TEXT_INSET; pict_count = ((help_ptr) the_window)->pict_count; for (pict_index = 0; pict_index < pict_count; pict_index++) { pict_loc = ((help_ptr) the_window)->pict_data[pict_index].bounds; OffsetRect( &pict_loc, 0, v_offset ); if (!SectRect( &pict_loc, update_rect, &dummy )) continue; the_pict = ((help_ptr) the_window)->pict_data[pict_index].pict; LoadResource( (Handle) the_pict ); GetClip( save_clip ); ClipRect( update_rect ); DrawPicture( the_pict, &pict_loc ); SetClip( save_clip ); } } #define OPTION_SPACE_CHAR 0xCA /* ---------------------- Find_pictures ---------------------------- */ static void Find_pictures( DialogPtr dlog, short first_pict_id ) { register TEHandle the_text; Handle text_h; SignedByte text_state; register short offset; short num_picts; register short which_pict; pict_info *pict; Point place; short line_height, font_ascent; TextStyle what_style; CKPT( "Find_pictures"); the_text = (TEHandle) GetWRefCon( dlog ); text_h = (**the_text).hText; text_state = HGetState( text_h ); HLock( text_h ); /* Count option-space characters in the text. */ offset = 0; num_picts = 0; offset = Find_char( text_h, offset, OPTION_SPACE_CHAR ); while ( offset >= 0 ) { num_picts++; offset++; offset = Find_char( text_h, offset, OPTION_SPACE_CHAR ); } /* Allocate storage for an array of picture bounds. */ pict = (pict_info *) NewPtr( sizeof(pict_info) * num_picts ); ((help_ptr)dlog)->pict_data = pict; /* Initialize the picture info. For each picture we record the picture handle and its rectangle, in unscrolled window coordinates. */ offset = 0; for (which_pict = 0; which_pict < num_picts; which_pict++) { pict[which_pict].pict = (PicHandle) GetResource( 'PICT', first_pict_id + which_pict ); if ( pict[which_pict].pict == NIL ) break; offset = Find_char( text_h, offset, OPTION_SPACE_CHAR ); place = TEGetPoint( offset, the_text ); TEGetStyle( offset, &what_style, &line_height, &font_ascent, the_text ); place.v -= line_height; /* align picture with TOP of option-space */ offset++; pict[which_pict].bounds = (**pict[which_pict].pict).picFrame; OffsetRect( &pict[which_pict].bounds, ( ((**the_text).destRect.right + (**the_text).destRect.left) - (pict[which_pict].bounds.right + pict[which_pict].bounds.left) ) / 2, - pict[which_pict].bounds.top + place.v ); } ((help_ptr)dlog)->pict_count = which_pict; getout: HSetState( text_h, text_state ); } #endif /* USE_PICTS */ /* ---------------------- Scroll_text ---------------------------- */ /* This is used as a TrackControl actionProc for scrolling, and also called by Auto_scroll for automatic scrolling. */ static pascal void Scroll_text( ControlHandle the_bar, int part_code ) { register TEHandle the_text; register short delta; register WindowPtr the_display; short old_value; short offset, line; Point place; Rect view; TextStyle style; short line_height, font_ascent; CKPT( "Scroll_text"); SETUP_A4; // for access to static global save_clip if (part_code != 0) { the_display = (**the_bar).contrlOwner; the_text = (TEHandle) GetWRefCon( the_display ); view = (**the_text).viewRect; place.h = view.left + TEXT_INSET; switch (part_code) { case inUpButton: place.v = view.top - 4; offset = TEGetOffset( place, the_text ); place = TEGetPoint( offset, the_text ); TEGetStyle( offset, &style, &line_height, &font_ascent, the_text ); delta = place.v - line_height - view.top; break; case inDownButton: place.v = view.bottom + 2; offset = TEGetOffset( place, the_text ); place = TEGetPoint( offset, the_text ); /* Now place.v is at the baseline of the border line. */ delta = place.v - view.bottom; break; case inPageUp: /* I want top border line to remain visible, and the top of a line should end up at view.top. */ place.v = view.top + 2; offset = TEGetOffset( place, the_text ); place = TEGetPoint( offset, the_text ); /* place.v is at the baseline of the top border line. */ TEGetStyle( offset, &style, &line_height, &font_ascent, the_text ); place.v += line_height - font_ascent; place.v -= view.bottom - view.top; offset = TEGetOffset( place, the_text ); place = TEGetPoint( offset, the_text ); TEGetStyle( offset, &style, &line_height, &font_ascent, the_text ); delta = place.v - view.top; if (offset == 0) delta -= line_height; break; case inPageDown: /* I want bottom border line to remain visible, and the bottom of a line should end up at view.bottom. */ place.v = view.bottom - 2; offset = TEGetOffset( place, the_text ); place = TEGetPoint( offset, the_text ); /* place.v is at the baseline of the bottom border line. */ TEGetStyle( offset, &style, &line_height, &font_ascent, the_text ); place.v -= font_ascent; /* Top edge of bottom border line */ place.v += view.bottom - view.top; /* We're looking at the bottom border of the next page. */ offset = TEGetOffset( place, the_text ); place = TEGetPoint( offset, the_text ); TEGetStyle( offset, &style, &line_height, &font_ascent, the_text ); delta = place.v - line_height - view.bottom; if (offset == (**the_text).teLength) delta += line_height; break; } old_value = GetCtlValue( the_bar ); if ( ((delta < 0) && (old_value > 0)) || ((delta > 0) && (old_value < GetCtlMax(the_bar))) ) { /* When this routine is called, TextEdit may have set the clipping region to the view rectangle, so we reset it here to make sure the scroll bar gets drawn. */ GetClip( save_clip ); ClipRect( &the_display->portRect ); SetCtlValue( the_bar, old_value + delta ); SetClip( save_clip ); } Adjust_text( the_display ); } RESTORE_A4; } /* ---------------------- Adjust_text ---------------------------- */ /* Called by Handle_scroll and Scroll_text to scroll the text and pictures into sync with the scroll bar's control value. */ static void Adjust_text( DialogPtr dialog ) { register TEHandle the_text; register short scroll_down; short old_scroll; Rect update_rect; ControlHandle the_bar; CKPT( "Adjust_text"); the_text = (TEHandle) GetWRefCon( dialog ); the_bar = ((help_ptr) dialog)->scrollbar; old_scroll = (**the_text).viewRect.top - (**the_text).destRect.top; scroll_down = old_scroll - GetCtlValue( the_bar ); if (scroll_down == 0) return; #if USE_PICTS ((help_ptr) dialog)->high_defer_flag = true; //((help_ptr) dialog)->high_waiting = 0; #endif TEScroll( 0, scroll_down, the_text ); #if USE_PICTS update_rect = (**the_text).viewRect; if (scroll_down > 0) { if (scroll_down < (update_rect.bottom - update_rect.top)) update_rect.bottom = update_rect.top + scroll_down; } else if (- scroll_down < (update_rect.bottom - update_rect.top)) update_rect.top = update_rect.bottom + scroll_down; Draw_picts( dialog, &update_rect ); Do_deferred_hilites( (help_ptr) dialog, &update_rect ); #endif } #if USE_PICTS /* ---------------------- Do_deferred_hilites ---------------------- */ static void Do_deferred_hilites( help_ptr hptr, Rect *update_rect ) { Rect hilite; while (Pop_highlight( hptr->high, &hilite )) { if (SectRect( &hilite, update_rect, &hilite )) { HiliteMode &= ~(1 << hiliteBit); InvertRect( &hilite ); } } hptr->high_defer_flag = false; } #endif /* ---------------------- Handle_scroll ---------------------------- */ /* Called by Help_filter to handle mouseDown events in the scroll bar. */ static void Handle_scroll( DialogPtr dialog, short the_part, Point where ) { register ControlHandle the_bar; CKPT( "Handle_scroll"); SetPort( dialog ); the_bar = ((help_ptr) dialog)->scrollbar; if (the_part == inThumb) { (void) TrackControl( the_bar, where, NIL ); Adjust_text( dialog ); } else (void) TrackControl( the_bar, where, (ProcPtr)Scroll_text ); } /* ---------------------- Help_filter ------------------------- */ /* This is the dialog event filter for our help window. */ #define RETURN_CHAR 0x0D #define TILDE_CHAR 0x7E #define ENTER_CHAR 0x03 #define ESCAPE_CHAR 0x1B static pascal Boolean Help_filter( DialogPtr dialog, EventRecord *event, short *itemHit) { Point local_point; short the_part; ControlHandle the_control; short charcode; register TEHandle the_text; Rect item_box; short cursor; SETUP_A4; // for access to static global ibeam_cursor the_text = (TEHandle) GetWRefCon( dialog ); GetMouse( &local_point ); if (PtInRect( local_point, &(**the_text).viewRect )) SetCursor( *ibeam_cursor ); else InitCursor(); TEIdle( the_text ); switch (event->what) { case nullEvent: break; case mouseDown: CKPT( "Help_filter mousedown"); local_point = event->where; GlobalToLocal( &local_point ); the_part = FindControl( local_point, dialog, &the_control ); if (the_part && ((**the_control).contrlMax > 1) ) { Handle_scroll( dialog, the_part, local_point ); *itemHit = 2; break; } if (PtInRect( local_point, &(**the_text).viewRect )) { if (event->modifiers & shiftKey) TEClick( local_point, true, the_text ); else TEClick( local_point, false, the_text ); } break; case keyDown : case autoKey : charcode = event->message & charCodeMask; /* There's no Cancel button, so we treat the OK button the same as a Cancel button. */ if ( (charcode == RETURN_CHAR) || (charcode == ENTER_CHAR) || (charcode == TILDE_CHAR) || (charcode == ESCAPE_CHAR) || ((charcode == '.') && (event->modifiers & cmdKey)) ) { *itemHit = c_OK; /* OK */ Flash_button( dialog, *itemHit ); RESTORE_A4; return( TRUE ); } if ( (charcode == 'c') && (event->modifiers & cmdKey) ) { (void) ZeroScrap(); TECopy( the_text ); SystemEdit(3); local_point = (**the_text).selPoint; *(long *)&local_point = PinRect( &(**the_text).viewRect, local_point ); cursor = TEGetOffset( local_point, the_text ); TESetSelect( (long)cursor, (long)cursor, the_text ); event->what = nullEvent; } break; } /* end switch */ /* tell the Dialog Manager that the event has NOT been handled and that it should ** take further action on this event. */ RESTORE_A4; return false; } /* ---------------------- Text_userItem_proc ------------------------- */ static pascal void Text_userItem_proc( WindowPtr the_window, short item_num ) { Handle item_h; Rect item_box; short item_type; TEHandle the_text; SETUP_A4; // for access to static global save_clip CKPT( "Text_userItem_proc"); the_text = (TEHandle) GetWRefCon( the_window ); item_box = (**the_text).viewRect; #if USE_PICTS ((help_ptr) the_window)->high_defer_flag = true; #endif TEUpdate( &item_box, the_text ); #if USE_PICTS Draw_picts( the_window, &item_box ); Do_deferred_hilites( (help_ptr) the_window, &item_box ); #endif /* Get the item's rectangle, and frame it. */ GetDItem( the_window, item_num, &item_type, &item_h, &item_box ); FrameRect( &item_box ); RESTORE_A4; } /* ---------------------- Menu_userItem_proc ------------------------- */ static pascal void Menu_userItem_proc( WindowPtr the_window, short item_num ) { Handle item_h; Rect item_box; short item_type; asm { MOVEM.L a1-a5/d0-d7, -(SP) } CKPT( "Menu_UserItem_proc"); /* Get the item's rectangle, and frame it. */ GetDItem( the_window, item_num, &item_type, &item_h, &item_box ); InsetRect(&item_box, -1, -1); FrameRect( &item_box ); /* Draw the drop-shadow */ MoveTo( item_box.left + 3, item_box.bottom ); LineTo( item_box.right, item_box.bottom ); LineTo( item_box.right, item_box.top + 3 ); asm { movem.l (SP)+, a1-a5/d0-d7 ; restore registers } } /* ---------------------- Flash_button ----------------------------- */ pascal void Flash_button( DialogPtr the_dialog, short item_number ) { ControlHandle item_h; long time; short itype; Rect box; GetDItem( the_dialog, item_number, &itype, (Handle *)&item_h, &box ); HiliteControl( item_h, inButton ); Delay( 9L, &time ); HiliteControl( item_h, 0 ); } #if COMPRESSION /* ---------------------- Get_compressed_resource ----------------------- */ static Handle Get_compressed_resource( ResType the_type, StringPtr the_name ) { register Handle CNVT_h; ParmInfo info; Str255 name; CNVT_routine Converter; name[0] = the_name[0] + 4; BlockMove( &the_type, &name[1], 4 ); BlockMove( &the_name[1], &name[5], the_name[0] ); info.srcHandle = GetNamedResource( '4CMP', name ); CNVT_h = GetNamedResource( 'CNVT', "\p4CMPUncompress 4CMP" ); if ( (info.srcHandle == NIL) || /* maybe there's an uncompressed one */ (CNVT_h == NIL) ) { info.dstHandle = GetNamedResource( the_type, the_name ); } else /* found a compressed resource */ { info.srcType = '4CMP'; HLock(CNVT_h); Converter = (CNVT_routine) StripAddress( *CNVT_h ); CKPT("\pAbout to call the CNVT"); (void) Converter( NIL, &info ); CKPT("\pAfter the CNVT"); HUnlock(CNVT_h); ReleaseResource( info.srcHandle ); } return info.dstHandle; } #define mem_resource 0x20 /* ------------------------- Release_compressed_resource ------------- */ /* If it's a resource handle, release it, otherwise dispose of it. */ static void Release_compressed_resource( Handle rsrc_h ) { if ( HGetState( rsrc_h ) & mem_resource ) ReleaseResource( rsrc_h ); else DisposHandle( rsrc_h ); } #endif COMPRESSION \ No newline at end of file diff --git a/Sources/SoundUtils.c b/Sources/SoundUtils.c new file mode 100755 index 0000000..b787b9a --- /dev/null +++ b/Sources/SoundUtils.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Sound Handling Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "SoundUtils.h" #include "SMS.h" /*======================================================== Functions */ /*======================================================== TurnSMSOn */ void TurnSMSOn (void) { if (!smsActivated) { SMSINIT(); SMSSETMODE(kFourChannel); smsActivated = TRUE; } } /*======================================================== TurnSMSOff */ void TurnSMSOff (void) { long dummyLong; if (smsActivated) { SMSSTOP(); SMSEXIT(); Delay(2, &dummyLong); smsActivated = FALSE; } } /*======================================================== PlaySoundSMS */ void PlaySoundSMS (short theSoundID) { if ((netGameInSession) && (imTheMaster) && (theSoundID < kMaxNumberOfSounds) && (soundPriorities[theSoundID] > lastSoundPriority)) { wasLastSound = theSoundID; lastSoundPriority = soundPriorities[theSoundID]; } if (smsActivated && soundLoaded[theSoundID] && soundOn) { switch (theSoundID) { case 0: break; case kClashSound: case kRicochetSound: case kBallPickUpSound: case kBallDropSound: case kBrakeSound: if (collisionSoundOn) { SMSSTART(theSoundID); } break; case kBallFiringSound: case kBeamInSound: case kBeamOutSound: if (beamSoundOn) { SMSSTART(theSoundID); } break; case kCrowdSound: case kCrowdSwellSound: case kApplauseSound: case kCrowdFadeSound: case kMobSwellSound: case kMobSound: case kMobFadeSound: if (crowdSoundOn) { SMSSTART(theSoundID); } break; default: SMSSTART(theSoundID); break; } } } /*======================================================== PlayIncidentSoundSMS */ void PlayIncidentSoundSMS (short theSoundID) { if ((smsActivated) && (soundOn) && (incidentSoundOn) && (incidentSoundLoaded[theSoundID - kMaxNumberOfSounds])) { if ((netGameInSession) && (imTheMaster) && (lastSoundPriority < 10)) { wasLastSound = theSoundID; lastSoundPriority = 10; } switch (theSoundID) { case 0: break; case kBeerManSound: case kHotDogSound: case kProgramSound: if (soundFileRefNum != -1) { SMSSTART(theSoundID); } break; default: break; } } } /*======================================================== FlushSoundQueues */ void FlushSoundQueues (void) { crowdQueue.number = 0; crowdQueue.when = 0; crowdQueue.priority = 0; incidentalQueue.number = 0; incidentalQueue.when = 0; incidentalQueue.priority = 0; } /*======================================================== BeginGamePointSound */ void BeginGamePointSound (void) { incidentalQueue.number = kGameSound; incidentalQueue.when = 180; incidentalQueue.priority = 100; } /*======================================================== BeginAllTiedSound */ void BeginAllTiedSound (void) { incidentalQueue.number = kAllSound; incidentalQueue.when = 180; incidentalQueue.priority = 100; } /*======================================================== StartCrowdSound */ void StartCrowdSound (void) { if ((smsActivated) && (crowdSoundOn) && (soundOn) && (whichGame > kPracticeScoring)) { SMSSTARTCHAN(kCrowdSound, 3); crowdQueue.number = 0; crowdQueue.when = 0; } } /*======================================================== StartApplauseSound */ void StartApplauseSound (void) { if ((smsActivated) && (crowdSoundOn) && (soundOn) && (whichGame > kPracticeScoring)) { SMSSTARTCHAN(kCrowdSwellSound, 3); crowdQueue.number = kApplauseSound; crowdQueue.when = kApplauseSwellTicks; } } /*======================================================== Applaud */ void Applaud (void) { if ((smsActivated) && (crowdSoundOn) && (soundOn) && (whichGame > kPracticeScoring)) { SMSSTARTCHAN(kApplauseSound, 3); crowdQueue.number = kCrowdFadeSound; crowdQueue.when = 40; } } /*======================================================== StartMobSound */ void StartMobSound (void) { if ((smsActivated) && (crowdSoundOn) && (soundOn) && (whichGame > kPracticeScoring)) { SMSSTARTCHAN(kMobSwellSound, 3); crowdQueue.number = kMobSound; crowdQueue.when = kMobSwellTicks; } } /*======================================================== HandleCrowdSound */ void HandleCrowdSound (void) { if (crowdQueue.when == 0) return; crowdQueue.when--; if ((smsActivated) && (crowdQueue.when == 0) && (crowdSoundOn) && (soundOn) && (whichGame > kPracticeScoring)) { switch (crowdQueue.number) { case kApplauseSound: SMSSTARTCHAN(kApplauseSound, 3); crowdQueue.number = kCrowdFadeSound; crowdQueue.when = lengthOfApplause; break; case kMobSound: SMSSTARTCHAN(kMobSound, 3); crowdQueue.number = kMobFadeSound; crowdQueue.when = lengthOfMob; break; case kCrowdFadeSound: SMSSTARTCHAN(kCrowdFadeSound, 3); crowdQueue.number = kCrowdSound; crowdQueue.when = kApplauseFadeTicks; break; case kMobFadeSound: SMSSTARTCHAN(kMobFadeSound, 3); crowdQueue.number = kCrowdSound; crowdQueue.when = kMobFadeTicks; break; case kCrowdSound: SMSSTARTCHAN(kCrowdSound, 3); crowdQueue.number = 0; crowdQueue.when = 0; break; } } } /*======================================================== StopCrowdSound */ void StopCrowdSound (void) { if (smsActivated) SMSSTOPCHAN(3); } /*======================================================== ResumeCrowdSound */ void ResumeCrowdSound (void) { if ((smsActivated) && (crowdSoundOn) && (soundOn) && (whichGame > kPracticeScoring)) SMSSTARTCHAN(kCrowdSound, 3); } /*======================================================== QueueUpIncidental */ void QueueUpIncidental (short soundIDIs, short whenTo, short priorityIs) { if (priorityIs >= incidentalQueue.priority) { incidentalQueue.number = soundIDIs; incidentalQueue.when = whenTo; incidentalQueue.priority = priorityIs; } } /*======================================================== HandleIncidentalQueue */ void HandleIncidentalQueue (void) { if (incidentalQueue.when == 0) { if (netGameInSession && !imTheMaster) { return; } else { incidentalQueue.number = RandomInt(kMaxIncidentalSounds) + kMaxNumberOfSounds; incidentalQueue.when = RandomInt(480) + 480; incidentalQueue.priority = 10; return; } } incidentalQueue.when--; if (incidentalQueue.when == 0) { switch (incidentalQueue.number) { case 0: break; case kGameSound: PlaySoundSMS(kGameSound); if (gameIsOver) incidentalQueue.number = kOverSound; else incidentalQueue.number = kPointSound; incidentalQueue.when = 90; incidentalQueue.priority = 100; break; case kAllSound: PlaySoundSMS(kAllSound); incidentalQueue.number = kTiedSound; incidentalQueue.when = 90; incidentalQueue.priority = 100; break; case kPointSound: case kTiedSound: case kOverSound: PlaySoundSMS(incidentalQueue.number); incidentalQueue.number = 0; incidentalQueue.when = 0; incidentalQueue.priority = 0; break; case kBeerManSound: case kHotDogSound: case kProgramSound: if (soundFileRefNum != -1) { PlayIncidentSoundSMS(incidentalQueue.number); incidentalQueue.number = 0; incidentalQueue.when = 0; incidentalQueue.priority = 0; } break; default: PlaySoundSMS(incidentalQueue.number); incidentalQueue.number = 0; incidentalQueue.when = 0; incidentalQueue.priority = 0; break; } } } \ No newline at end of file diff --git a/Sources/TeamSetUp.c b/Sources/TeamSetUp.c new file mode 100755 index 0000000..226fc5d --- /dev/null +++ b/Sources/TeamSetUp.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Team Set-Up Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "TeamSetUp.h" #include "MainWindow.h" #include "Menu.h" /*======================================================== Local Variables */ Rect leftStandRect, rightStandRect, teamsLabelRect, teamsPopUpRect; Rect iconRects[8]; MenuHandle teamsPopUp; short leftSelected, rightSelected, teamsPopUpWidth, popUpItemSelected; /*======================================================== Functions */ /*======================================================== WhosOnFirst */ void WhosOnFirst (void) { if (leftPlayerNumber == kHumanPlayer) { leftGoalIsPlayers = TRUE; thePlayer.persona = kHumanPlayer; theOpponent.persona = rightPlayerNumber; thePlayer.whichGoal = kLeftGoal; theOpponent.whichGoal = kRightGoal; disableBoardCursor = FALSE; leftGoalLeague = isLeague; if (netGameInSession) rightGoalLeague = theirLeague; else rightGoalLeague = kProfessional; if (arenaSize == kLargeArena) { thePlayer.initXPos = kLgInitLeftXPos; thePlayer.initZPos = kLgInitLeftZPos; theOpponent.initXPos = kLgInitRightXPos; theOpponent.initZPos = kLgInitRightZPos; } else { thePlayer.initXPos = kSmInitLeftXPos; thePlayer.initZPos = kSmInitLeftZPos; theOpponent.initXPos = kSmInitRightXPos; theOpponent.initZPos = kSmInitRightZPos; } } else if (rightPlayerNumber == kHumanPlayer) { leftGoalIsPlayers = FALSE; thePlayer.persona = kHumanPlayer; theOpponent.persona = leftPlayerNumber; thePlayer.whichGoal = kRightGoal; theOpponent.whichGoal = kLeftGoal; disableBoardCursor = FALSE; rightGoalLeague = isLeague; if (netGameInSession) leftGoalLeague = theirLeague; else leftGoalLeague = kProfessional; if (arenaSize == kLargeArena) { thePlayer.initXPos = kLgInitRightXPos; thePlayer.initZPos = kLgInitRightZPos; theOpponent.initXPos = kLgInitLeftXPos; theOpponent.initZPos = kLgInitLeftZPos; } else { thePlayer.initXPos = kSmInitRightXPos; thePlayer.initZPos = kSmInitRightZPos; theOpponent.initXPos = kSmInitLeftXPos; theOpponent.initZPos = kSmInitLeftZPos; } } else { leftGoalIsPlayers = TRUE; thePlayer.persona = leftPlayerNumber; theOpponent.persona = rightPlayerNumber; thePlayer.whichGoal = kLeftGoal; theOpponent.whichGoal = kRightGoal; leftGoalLeague = kProfessional; rightGoalLeague = kProfessional; disableBoardCursor = TRUE; if (arenaSize == kLargeArena) { thePlayer.initXPos = kLgInitLeftXPos; thePlayer.initZPos = kLgInitLeftZPos; theOpponent.initXPos = kLgInitRightXPos; theOpponent.initZPos = kLgInitRightZPos; } else { thePlayer.initXPos = kSmInitLeftXPos; thePlayer.initZPos = kSmInitLeftZPos; theOpponent.initXPos = kSmInitRightXPos; theOpponent.initZPos = kSmInitRightZPos; } } } /*======================================================== UpdateLeftStand */ void UpdateLeftStand (DialogPtr theDialog) { Rect theRect; CIconHandle theCIcon; Handle itemHandle, theIcon; short itemType; GetDItem(theDialog, kLeftStandItem, &itemType, &itemHandle, &theRect); if (isColor) { if ((leftSelected == kNetHuman) && (!canNetwork)) theCIcon = GetCIcon(1009); else theCIcon = GetCIcon(1001 + leftSelected); PlotCIcon(&theRect, theCIcon); DisposCIcon(theCIcon); } else { if ((leftSelected == kNetHuman) && (!canNetwork)) theIcon = GetIcon(1009); else theIcon = GetIcon(1001 + leftSelected); PlotIcon(&theRect, theIcon); } } /*======================================================== UpdateRightStand */ void UpdateRightStand (DialogPtr theDialog) { Rect theRect; CIconHandle theCIcon; Handle itemHandle, theIcon; short itemType; GetDItem(theDialog, kRightStandItem, &itemType, &itemHandle, &theRect); if (isColor) { if ((rightSelected == kNetHuman) && (!canNetwork)) theCIcon = GetCIcon(1009); else theCIcon = GetCIcon(1001 + rightSelected); PlotCIcon(&theRect, theCIcon); DisposCIcon(theCIcon); } else { if ((rightSelected == kNetHuman) && (!canNetwork)) theIcon = GetIcon(1009); else theIcon = GetIcon(1001 + rightSelected); PlotIcon(&theRect, theIcon); } } /*======================================================== DrawTeamsPopUpItem */ void DrawTeamsPopUpItem (void) { #define kBottomMargin 5 Str255 menuItem; short itemLeftMargin; InsetRect(&teamsPopUpRect, 1, 1); EraseRect(&teamsPopUpRect); InsetRect(&teamsPopUpRect, -1, -1); GetItem(teamsPopUp, popUpItemSelected, (StringPtr)&menuItem); itemLeftMargin = (teamsPopUpRect.right - teamsPopUpRect.left - StringWidth(menuItem)) / 2; MoveTo(teamsPopUpRect.left + itemLeftMargin, teamsPopUpRect.bottom - kBottomMargin); DrawString(menuItem); } /*======================================================== DrawTeamsPopUp */ void DrawTeamsPopUp (void) { #define kLeftMargin 5 #define kRightMargin 5 FrameRect(&teamsPopUpRect); MoveTo(teamsPopUpRect.left + 1, teamsPopUpRect.bottom); LineTo(teamsPopUpRect.right, teamsPopUpRect.bottom); LineTo(teamsPopUpRect.right, teamsPopUpRect.top + 1); teamsLabelRect.top = teamsPopUpRect.top + 1; teamsLabelRect.left = teamsPopUpRect.left - teamsPopUpWidth - kLeftMargin - kRightMargin; teamsLabelRect.right = teamsPopUpRect.left; teamsLabelRect.bottom = teamsPopUpRect.bottom; DrawTeamsPopUpItem(); } /*======================================================== RedrawStandNames */ void RedrawStandNames (DialogPtr theDialog) { Str255 theName; Rect theRect, eraseArea; Handle itemHandle; short itemType, i, isWide; TextFont(geneva); TextSize(9); GetDItem(theDialog, kLeftStandItem, &itemType, &itemHandle, &theRect); SetRect(&eraseArea, 0, 0, 64, 12); OffsetRect(&eraseArea, theRect.left - 16, theRect.bottom + 2); EraseRect(&eraseArea); GetIndString(theName, rNamesStringID, leftSelected + 1); isWide = StringWidth(theName); MoveTo(theRect.left + 16 - (isWide / 2), theRect.bottom + 12); DrawString(theName); GetDItem(theDialog, kRightStandItem, &itemType, &itemHandle, &theRect); SetRect(&eraseArea, 0, 0, 64, 12); OffsetRect(&eraseArea, theRect.left - 16, theRect.bottom + 2); EraseRect(&eraseArea); GetIndString(theName, rNamesStringID, rightSelected + 1); isWide = StringWidth(theName); MoveTo(theRect.left + 16 - (isWide / 2), theRect.bottom + 12); DrawString(theName); TextFont(systemFont); TextSize(12); } /*======================================================== RedrawNetIcon */ void RedrawNetIcon (DialogPtr theDialog) { Rect theRect; CIconHandle theCIcon; Handle itemHandle, theIcon; short itemType; GetDItem(theDialog, kNetIconItem, &itemType, &itemHandle, &theRect); if (!canNetwork) { if (isColor) { theCIcon = GetCIcon(1009); PlotCIcon(&theRect, theCIcon); DisposCIcon(theCIcon); } else { theIcon = GetIcon(1009); PlotIcon(&theRect, theIcon); } } else { if (isColor) { theCIcon = GetCIcon(1008); PlotCIcon(&theRect, theCIcon); DisposCIcon(theCIcon); } else { theIcon = GetIcon(1008); PlotIcon(&theRect, theIcon); } } } /*======================================================== GrayOutIcons */ void GrayOutIcons (DialogPtr theDialog) { Rect theRect; Handle itemHandle; short itemType, i; PenNormal(); PenPat(gray); PenMode(srcBic); #if kDemoVersion for (i = 2; i <= 6; i++) { GetDItem(theDialog, kUserIconItem + i, &itemType, &itemHandle, &theRect); PaintRect(&theRect); } #else for (i = 1; i <= 6; i++) { GetDItem(theDialog, kUserIconItem + i, &itemType, &itemHandle, &theRect); PaintRect(&theRect); } #endif PenNormal(); } /*======================================================== UpdateTeamsDialog */ void UpdateTeamsDialog (DialogPtr theDialog) { Str255 theName; Rect theRect; PicHandle thePict; CIconHandle theCIcon; Handle itemHandle, theIcon; short itemType, i, isWide; DrawDialog((GrafPtr)theDialog); RedrawNetIcon(theDialog); GetDItem(theDialog, kPowBalloonItem, &itemType, &itemHandle, &theRect); if (isColor) thePict = GetPicture(kBalloon4PictID); else thePict = GetPicture(kBalloon1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &theRect); ReleaseResource((Handle)thePict); } GetDItem(theDialog, kStandsItem, &itemType, &itemHandle, &theRect); if (isColor) thePict = GetPicture(rTeamsStandPictID4); else thePict = GetPicture(rTeamsStandPictID1); if (thePict != kNilPointer) { DrawPicture(thePict, &theRect); ReleaseResource((Handle)thePict); } GetDItem(theDialog, kSeperatorItem, &itemType, &itemHandle, &theRect); if (isColor) thePict = GetPicture(rTeamsSeperatorPictID4); else thePict = GetPicture(rTeamsSeperatorPictID1); if (thePict != kNilPointer) { DrawPicture(thePict, &theRect); ReleaseResource((Handle)thePict); } UpdateLeftStand(theDialog); UpdateRightStand(theDialog); DrawTeamsPopUp(); GetDItem(theDialog, kArenaFrameItem, &itemType, &itemHandle, &theRect); FrameRect(&theRect); GetIndString(theName, rMiscStrings, 13); if (theName[0] == 0) PasStringCopy((StringPtr)"\pSelect Opponent", (StringPtr)theName); MoveTo(kTeamsTitleLeft, kTeamsTitleTop); DrawString(theName); TextFont(geneva); TextSize(9); for (i = 1; i < 9; i++) { GetDItem(theDialog, i + 3, &itemType, &itemHandle, &theRect); GetIndString(theName, rNamesStringID, i); isWide = StringWidth(theName); MoveTo(theRect.left + 16 - (isWide / 2), theRect.bottom + 12); DrawString(theName); } TextFont(systemFont); TextSize(12); if (netOnly) GrayOutIcons(theDialog); #if kDemoVersion GrayOutIcons(theDialog); #endif RedrawStandNames(theDialog); DrawDefaultButton(theDialog, kButtItemOkay); } /*======================================================== DoDragIcon */ void DoDragIcon (DialogPtr theDialog, Point mousePt, short whichIcon) { Rect srcRect, dragRect; Point dragPt; srcRect = iconRects[whichIcon]; PenMode(patOr); PenPat(gray); PaintRect(&srcRect); dragRect = srcRect; PenMode(patXor); FrameRect(&dragRect); while (Button()) { GetMouse(&dragPt); if ((dragPt.h != mousePt.h) || (dragPt.v != mousePt.v)) { FrameRect(&dragRect); if (PtInRect(mousePt, &leftStandRect) != PtInRect(dragPt, &leftStandRect)) { PenPat(black); PenSize(2, 2); InsetRect(&leftStandRect, -3, -3); FrameRect(&leftStandRect); InsetRect(&leftStandRect, 3, 3); PenSize(1, 1); PenPat(gray); } else if (PtInRect(mousePt, &rightStandRect) != PtInRect(dragPt, &rightStandRect)) { PenPat(black); PenSize(2, 2); InsetRect(&rightStandRect, -3, -3); FrameRect(&rightStandRect); InsetRect(&rightStandRect, 3, 3); PenSize(1, 1); PenPat(gray); } OffsetRect(&dragRect, dragPt.h - mousePt.h, dragPt.v - mousePt.v); FrameRect(&dragRect); mousePt = dragPt; } } FrameRect(&dragRect); DrawDialog(theDialog); if (netOnly) GrayOutIcons(theDialog); #if kDemoVersion GrayOutIcons(theDialog); #endif RedrawNetIcon(theDialog); if (PtInRect(dragPt, &leftStandRect)) { PenPat(black); PenSize(2, 2); InsetRect(&leftStandRect, -3, -3); FrameRect(&leftStandRect); InsetRect(&leftStandRect, 3, 3); PenNormal(); leftSelected = whichIcon; UpdateLeftStand(theDialog); } else if (PtInRect(dragPt, &rightStandRect)) { PenPat(black); PenSize(2, 2); InsetRect(&rightStandRect, -3, -3); FrameRect(&rightStandRect); InsetRect(&rightStandRect, 3, 3); PenNormal(); rightSelected = whichIcon; UpdateRightStand(theDialog); } else { if (rightSelected == kHumanPlayer) { if (whichIcon != kHumanPlayer) { leftSelected = whichIcon; UpdateLeftStand(theDialog); } } else if (leftSelected == kHumanPlayer) { if (whichIcon != kHumanPlayer) { rightSelected = whichIcon; UpdateRightStand(theDialog); } } else { if (whichIcon == kHumanPlayer) { leftSelected = whichIcon; UpdateLeftStand(theDialog); } else { rightSelected = whichIcon; UpdateRightStand(theDialog); } } } PenNormal(); RedrawStandNames(theDialog); } /*======================================================== SwapLeftAndRightSelected */ void SwapLeftAndRightSelected (DialogPtr theDialog) { short tempShort; tempShort = leftSelected; leftSelected = rightSelected; rightSelected = tempShort; UpdateLeftStand(theDialog); UpdateRightStand(theDialog); RedrawStandNames(theDialog); } /*======================================================== DoTeamsPopUpSelect */ void DoTeamsPopUpSelect (void) { Point popUpperLeft; long theChoice; popUpperLeft.v = teamsPopUpRect.top + 1; popUpperLeft.h = teamsPopUpRect.left; LocalToGlobal(&popUpperLeft); theChoice = PopUpMenuSelect(teamsPopUp, popUpperLeft.v, popUpperLeft.h, popUpItemSelected); if (LoWrd(theChoice) > 0) { popUpItemSelected = LoWrd(theChoice); DrawTeamsPopUpItem(); } } /*======================================================== TeamsFilter */ pascal Boolean TeamsFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit) { Point mousePt; Handle itemHandle; short i, iconSelected, itemType; Boolean eventHandled; eventHandled = FALSE; switch (theEvent->what) { case keyDown: switch ((theEvent->message) & charCodeMask) { case kReturnKeyASCII: FlashDialogButton(theDialog, kButtItemOkay); *itemHit = kButtItemOkay; eventHandled = TRUE; break; default: eventHandled = FALSE; } break; case mouseDown: mousePt = theEvent->where; GlobalToLocal(&mousePt); if (PtInRect(mousePt, &teamsPopUpRect)) { DoTeamsPopUpSelect(); eventHandled = TRUE; } else if ((PtInRect(mousePt, &leftStandRect)) || (PtInRect(mousePt, &rightStandRect))) { SwapLeftAndRightSelected(theDialog); } else { iconSelected = -1; for (i = 0; i < 8; i++) { if (PtInRect(mousePt, &iconRects[i])) iconSelected = i; } if ((iconSelected == 7) && (!canNetwork)) iconSelected = -1; if ((netOnly) && (iconSelected >= 1) && (iconSelected <= 6)) iconSelected = -1; #if kDemoVersion if ((iconSelected >= 2) && (iconSelected <= 6)) iconSelected = -1; #endif if (iconSelected != -1) { DoDragIcon(theDialog, mousePt, iconSelected); eventHandled = TRUE; } else eventHandled = FALSE; } break; case mouseUp: mousePt = theEvent->where; GlobalToLocal(&mousePt); break; case updateEvt: BeginUpdate((GrafPtr)theDialog); UpdateTeamsDialog(theDialog); EndUpdate((GrafPtr)theDialog); theEvent->what = nullEvent; eventHandled = FALSE; break; case nullEvent: mousePt = theEvent->where; GlobalToLocal(&mousePt); iconSelected = -1; for (i = 0; i < 8; i++) { if (PtInRect(mousePt, &iconRects[i])) iconSelected = i; } if ((iconSelected == 7) && (!canNetwork)) iconSelected = -1; if ((netOnly) && (iconSelected >= 1) && (iconSelected <= 6)) iconSelected = -1; #if kDemoVersion if ((iconSelected >= 2) && (iconSelected <= 6)) iconSelected = -1; #endif if (iconSelected != -1) SetCursor(&handCursor); else SetCursor(&arrow); eventHandled = FALSE; break; default: eventHandled = FALSE; break; } return (eventHandled); } /*======================================================== DoTeamsSetUp */ Boolean DoTeamsSetUp (void) { #define kSelectString 15 #define kNetOnlyString 16 #define kDemoSelectString 25 Str255 tempString; DialogPtr teamsDialog; Handle iHandle; Rect iRect; short iType, itemHit, i; Boolean leaveDialog, userOkayed, tempBool; #if kDemoVersion GetIndString(tempString, rMiscStrings, kDemoSelectString); #else if (netOnly) GetIndString(tempString, rMiscStrings, kNetOnlyString); else GetIndString(tempString, rMiscStrings, kSelectString); #endif if (tempString[0] != 0) ParamText(tempString, "\p", "\p", "\p"); else ParamText(tempString, "\pSelect two players to play one another", "\p", "\p"); CenterDialog(rTeamsDialogID); if (doZooms) ZoomOutDialogRect(rTeamsDialogID); teamsDialog = GetNewDialog(rTeamsDialogID, kNilPointer, kPutInFront); if (teamsDialog == kNilPointer) DeathError(kErrNoResource); teamsPopUp = GetMenu(kTeamsPopMenuID); if (teamsPopUp == kNilPointer) DeathError(kErrNoResource); InsertMenu(teamsPopUp, -1); HLock((Handle)teamsPopUp); teamsPopUpWidth = StringWidth((**teamsPopUp).menuData); HUnlock((Handle)teamsPopUp); for (i = 0; i < 10; i++) { SetItem(teamsPopUp, i + 1, (StringPtr)theNames[i]); } popUpItemSelected = whichHumanNumber; leftSelected = leftPlayerNumber; rightSelected = rightPlayerNumber; GetDItem(teamsDialog, kCheckTeamsAuto, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)autoTeamsDialog); GetDItem(teamsDialog, kUserPopUpItem, &iType, &iHandle, &teamsPopUpRect); GetDItem(teamsDialog, kLeftStandItem, &iType, &iHandle, &leftStandRect); GetDItem(teamsDialog, kRightStandItem, &iType, &iHandle, &rightStandRect); for (i = 0; i < 8; i++) GetDItem(teamsDialog, kUserIconItem + i, &iType, &iHandle, &iconRects[i]); SetPort((GrafPtr)teamsDialog); /* Bring up the dialog */ ShowWindow((GrafPtr)teamsDialog); UpdateTeamsDialog(teamsDialog); leaveDialog = FALSE; while (leaveDialog == FALSE) { ModalDialog(TeamsFilter, &itemHit); switch (itemHit) { case kButtItemOkay: if ((leftSelected == kHumanPlayer) && (rightSelected == kHumanPlayer)) { MinorError(kMinor2HumanPlayers); } else if (((leftSelected == kNetHuman) && (rightSelected != kHumanPlayer)) || ((leftSelected != kHumanPlayer) && (rightSelected == kNetHuman))) { MinorError(kMinor2NetPlayers); } else { userOkayed = TRUE; leaveDialog = TRUE; whichHumanNumber = popUpItemSelected; leftPlayerNumber = leftSelected; rightPlayerNumber = rightSelected; GetDItem(teamsDialog, kCheckTeamsAuto, &iType, &iHandle, &iRect); autoTeamsDialog = (Boolean)GetCtlValue((ControlHandle)iHandle); } break; case kButtItemCancel: userOkayed = FALSE; leaveDialog = TRUE; break; case kCheckTeamsAuto: GetDItem(teamsDialog, itemHit, &iType, &iHandle, &iRect); tempBool = (Boolean)GetCtlValue((ControlHandle)iHandle); tempBool = !tempBool; SetCtlValue((ControlHandle)iHandle, (short)tempBool); break; default: break; } } InitCursor(); DisposDialog(teamsDialog); return (userOkayed); } \ No newline at end of file diff --git a/Sources/UnivUtilities.c b/Sources/UnivUtilities.c new file mode 100755 index 0000000..fb0e72a --- /dev/null +++ b/Sources/UnivUtilities.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Universal Utility Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "UnivUtilities.h" /*======================================================== Local Variables */ short wasMenuBarHeight; /*======================================================== Functions */ /*======================================================== CenterDialog */ void CenterDialog (short dialogID) { DialogTHndl dlogHandle; Rect scrnRect, dlogBounds; short hPos, vPos; Byte wasState; scrnRect = screenBits.bounds; scrnRect.top += MBarHeight; dlogHandle = (DialogTHndl)GetResource('DLOG', dialogID); if (dlogHandle != kNilPointer) { wasState = HGetState((Handle)dlogHandle); HLock((Handle)dlogHandle); dlogBounds = (**dlogHandle).boundsRect; OffsetRect(&dlogBounds, -dlogBounds.left, -dlogBounds.top); hPos = ((scrnRect.right - scrnRect.left) - dlogBounds.right) / 2; vPos = ((scrnRect.bottom - scrnRect.top) - dlogBounds.bottom) / 3; OffsetRect(&dlogBounds, hPos, vPos + MBarHeight); (**dlogHandle).boundsRect = dlogBounds; HSetState((Handle)dlogHandle, wasState); } } /*======================================================== CenterAlert */ void CenterAlert (short alertID) { AlertTHndl alertHandle; Rect scrnRect, alertRect; short horiOff, vertOff; Byte wasState; scrnRect = screenBits.bounds; scrnRect.top += MBarHeight; alertHandle = (AlertTHndl)GetResource('ALRT', alertID); if (alertHandle != kNilPointer) { wasState = HGetState((Handle)alertHandle); HLock((Handle)alertHandle); alertRect = (**alertHandle).boundsRect; OffsetRect(&alertRect, -alertRect.left, -alertRect.top); horiOff = ((scrnRect.right - scrnRect.left) - alertRect.right) / 2; vertOff = ((scrnRect.bottom - scrnRect.top) - alertRect.bottom) / 3; OffsetRect(&alertRect, horiOff, vertOff + MBarHeight); (**alertHandle).boundsRect = alertRect; HSetState((Handle)alertHandle, wasState); } } /*======================================================== FlashDialogButton */ void FlashDialogButton (DialogPtr theDialog, short itemNumber) { Rect itemRect; Handle itemHandle; long dummyLong; short itemType; GetDItem(theDialog, itemNumber, &itemType, &itemHandle, &itemRect); HiliteControl((ControlHandle)itemHandle, inButton); Delay(8, &dummyLong); HiliteControl((ControlHandle)itemHandle, 0); } /*======================================================== DrawDefaultButton */ void DrawDefaultButton (DialogPtr theDialog, short itemNumber) { Rect itemRect; Handle itemHandle; short itemType; GetDItem(theDialog, itemNumber, &itemType, &itemHandle, &itemRect); InsetRect(&itemRect, -4, -4); PenSize(3, 3); FrameRoundRect(&itemRect, 19, 19); PenNormal(); } /*======================================================== SetDialogString */ void SetDialogString (DialogPtr theDialog, short item, StringPtr theString) { Rect itemRect; Handle itemHandle; short itemType; GetDItem(theDialog, item, &itemType, &itemHandle, &itemRect); SetIText(itemHandle, theString); } /*======================================================== SetDialogNumToStr */ void SetDialogNumToStr (DialogPtr theDialog, short item, long theNumber) { Str255 theString; Rect itemRect; Handle itemHandle; short itemType; NumToString(theNumber, theString); GetDItem(theDialog, item, &itemType, &itemHandle, &itemRect); SetIText(itemHandle, theString); } /*======================================================== SelectFromRadioGroup */ void SelectFromRadioGroup (DialogPtr theDialog, short setItem, short fromItem, short toItem) { Rect iRect; Handle iHandle; short iType, i; for (i = fromItem; i <= toItem; i++) { GetDItem(theDialog, i, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)FALSE); } GetDItem(theDialog, setItem, &iType, &iHandle, &iRect); SetCtlValue((ControlHandle)iHandle, (short)TRUE); } /*======================================================== EnableControl */ void EnableControl(DialogPtr theDialog, short whichItem) { Rect iRect; Handle iHandle; short iType; GetDItem(theDialog, whichItem, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, kActive); } /*======================================================== DisableControl */ void DisableControl(DialogPtr theDialog, short whichItem) { Rect iRect; Handle iHandle; short iType; GetDItem(theDialog, whichItem, &iType, &iHandle, &iRect); HiliteControl((ControlHandle)iHandle, kInactive); } /*======================================================== LocalToGlobalRect */ void LocalToGlobalRect (Rect *theRect) { Point upperLeftPt; upperLeftPt.h = 0; upperLeftPt.v = 0; LocalToGlobal(&upperLeftPt); OffsetRect(theRect, upperLeftPt.h, upperLeftPt.v); } /*======================================================== GlobalToLocalRect */ void GlobalToLocalRect (Rect *theRect) { Point upperLeftPt; upperLeftPt.h = 0; upperLeftPt.v = 0; GlobalToLocal(&upperLeftPt); OffsetRect(theRect, upperLeftPt.h, upperLeftPt.v); } /*======================================================== ZoomOutDialogRect */ void ZoomOutDialogRect (short dialogID) { #define kSteps 20 #define kZoomDelay 1 DialogTHndl dlogHandle; GrafPtr wasPort; WindowPtr windowInFront; Rect dlogBounds, zoomRect; long dummyLong; Byte wasState; short wideStep, highStep, i; GetPort(&wasPort); windowInFront = FrontWindow(); SetPort((GrafPtr)windowInFront); dlogHandle = (DialogTHndl)GetResource('DLOG', dialogID); if (dlogHandle != kNilPointer) { wasState = HGetState((Handle)dlogHandle); HLock((Handle)dlogHandle); dlogBounds = (**dlogHandle).boundsRect; HSetState((Handle)dlogHandle, wasState); } wideStep = ((dlogBounds.right - dlogBounds.left) / 2) / kSteps; highStep = ((dlogBounds.bottom - dlogBounds.top) / 2) / kSteps; SetRect(&zoomRect, dlogBounds.left + (wideStep * kSteps), dlogBounds.top + (highStep * kSteps), dlogBounds.right - (wideStep * kSteps), dlogBounds.bottom - (highStep * kSteps)); GlobalToLocalRect(&zoomRect); PenPat(gray); PenMode(patXor); for (i = 0; i < kSteps; i++) { FrameRect(&zoomRect); Delay(kZoomDelay, &dummyLong); FrameRect(&zoomRect); InsetRect(&zoomRect, -wideStep, -highStep); } PenNormal(); SetPort((GrafPtr)wasPort); } /*======================================================== PasStringCopy */ void PasStringCopy (StringPtr p1, StringPtr p2) { register short stringLength; stringLength = *p2++ = *p1++; while (--stringLength >= 0) *p2++ = *p1++; } /*======================================================== PasStringCopyNum */ void PasStringCopyNum (StringPtr p1, StringPtr p2, short charsToCopy) { short charsCopied; if (charsToCopy > *p1) charsToCopy = *p1; *p2 = charsToCopy; *p2++; *p1++; charsCopied = charsToCopy + 1; while (--charsCopied >= 0) *p2++ = *p1++; } /*======================================================== PasStringConcat */ void PasStringConcat (StringPtr p1, StringPtr p2) { short wasLength, addedLength, i; wasLength = *p1; if (wasLength > 255) wasLength = 255; addedLength = *p2; if ((wasLength + addedLength) > 255) addedLength = 255 - wasLength; *p1 = wasLength + addedLength; *p1++; *p2++; for (i = 0; i < wasLength; i++) *p1++; for (i = 0; i < addedLength; i++) *p1++ = *p2++; } /*======================================================== RandomInt */ short RandomInt (short range) { register long rawResult; rawResult = Random(); if (rawResult < 0) rawResult *= -1; return (rawResult * (long)range / 32768); } /*======================================================== RandomCoin */ Boolean RandomCoin (void) { register long rawResult; rawResult = Random() & 0x00000001; return ((Boolean)rawResult); } /*======================================================== DeathError */ void DeathError (short errorNumber) { short dummyInt; Str255 errTitle, errMessage, errNumberString, errExtra; InitCursor(); if (errorNumber > 1) { GetIndString((StringPtr)&errTitle, rErrTitleID, errorNumber); GetIndString((StringPtr)&errMessage, rErrMssgID, errorNumber); } else { GetIndString((StringPtr)&errTitle, rErrTitleID, 1); GetIndString((StringPtr)&errMessage, rErrMssgID, 1); } NumToString((long)errorNumber, (StringPtr)&errNumberString); ParamText((StringPtr)&errTitle, (StringPtr)&errMessage, (StringPtr)&errNumberString, "\p"); CenterAlert(rDeathAlertID); dummyInt = Alert(rDeathAlertID, kNilPointer); ExitToShell(); } /*======================================================== MinorError */ void MinorError (short errorNumber) { short dummyInt; Str255 errMessage; InitCursor(); GetIndString((StringPtr)&errMessage, rMinorErrMssgID, errorNumber); ParamText((StringPtr)&errMessage, (StringPtr)"\p", (StringPtr)"\p", (StringPtr)"\p"); CenterAlert(rMinorAlertID); dummyInt = Alert(rMinorAlertID, kNilPointer); } /*======================================================== SimpleMessage */ void SimpleMessage (void) { } /*======================================================== KeyIsDown */ Boolean KeyIsDown (short keyCodeOffset) { KeyMap theKeyMap; Boolean isSet; GetKeys(theKeyMap); isSet = (BitTst(&theKeyMap, keyCodeOffset) != 0); return(isSet); } /*======================================================== CommandKeyIsDown */ Boolean CommandKeyIsDown (void) { KeyMap theKeyMap; Boolean isSet; GetKeys(theKeyMap); isSet = (BitTst(&theKeyMap, kCommandKeyMap) != 0); return(isSet); } /*======================================================== OptionKeyIsDown */ Boolean OptionKeyIsDown (void) { KeyMap theKeyMap; Boolean isSet; GetKeys(theKeyMap); isSet = (BitTst(&theKeyMap, kOptionKeyMap) != 0); return(isSet); } /*======================================================== CommandPeriodDown */ Boolean CommandPeriodDown (void) { KeyMap theKeyMap; Boolean isSet; GetKeys(theKeyMap); isSet = (BitTst(&theKeyMap, kCommandKeyMap) != 0) && (BitTst(&theKeyMap, kPeriodKeyMap) != 0); return(isSet); } /*======================================================== RectFromWindow */ void RectFromWindow (Rect *boundsRect, WindowPtr theWindow) { Point tempPt; if (theWindow != kNilPointer) { *boundsRect = (*theWindow).portRect; SetPt(&tempPt, 0, 0); LocalToGlobal(&tempPt); OffsetRect(&(*boundsRect), tempPt.h, tempPt.v); (*boundsRect).top -= 10; } else { SetRect(boundsRect, 0, 0, 0, 0); } } /*======================================================== GetRect */ OSErr GetRect (Rect *theRect, short rectID) { Handle theRectHandle; char wasState; theRectHandle = GetResource('RECT', rectID); /* get a 'RECT' type resource */ if (theRectHandle != kNilPointer) /* be it there? */ { wasState = HGetState(theRectHandle); HLock(theRectHandle); /* lock it! */ BlockMove(*theRectHandle, theRect, 8); /* move data into a rect struct */ HSetState(theRectHandle, wasState); return (MemError()); } else /* return the non-rect */ { SetRect(theRect, 0, 0, 0, 0); /* and this is a non-rect */ return (ResError()); } } /*======================================================== ShowMenuBar */ void ShowMenuBar (WindowPtr theWindow) { if (GetMBarHeight() == 0) { MBarHeight = wasMenuBarHeight; DrawMenuBar(); } } /*======================================================== HideMenuBar */ void HideMenuBar (WindowPtr theWindow) { if (GetMBarHeight() != 0) { wasMenuBarHeight = GetMBarHeight(); MBarHeight = 0; } } /*======================================================== USSecsToDateString */ void USSecsToDateString (long theSecs, StringPtr theDate) { Str255 theDay, theMonth, theYear; DateTimeRec theDateRec; Secs2Date(theSecs, &theDateRec); NumToString((long)(theDateRec.day), theDay); NumToString((long)(theDateRec.month), theMonth); NumToString((long)(theDateRec.year % 100), theYear); PasStringConcat(theMonth, "\p/"); PasStringConcat(theMonth, theDay); PasStringConcat(theMonth, "\p/"); PasStringConcat(theMonth, theYear); PasStringCopy((StringPtr)theMonth, (StringPtr)theDate); } /*======================================================== IntlSecsToDateString */ void IntlSecsToDateString (long theSecs, StringPtr theDate) { Str255 theDay, theMonth, theYear; DateTimeRec theDateRec; Secs2Date(theSecs, &theDateRec); NumToString((long)(theDateRec.day), theDay); NumToString((long)(theDateRec.month), theMonth); NumToString((long)(theDateRec.year % 100), theYear); PasStringConcat(theDay, "\p/"); PasStringConcat(theDay, theMonth); PasStringConcat(theDay, "\p/"); PasStringConcat(theDay, theYear); PasStringCopy((StringPtr)theDay, (StringPtr)theDate); } /*======================================================== HoldIt */ void HoldIt (short ticksToWait) { long dummyLong; Delay(ticksToWait, &dummyLong); } /*======================================================== GetOrigin */ void GetOrigin (Point *theOrigin) { theOrigin->h = 0; theOrigin->v = 0; LocalToGlobal(theOrigin); theOrigin->h *= -1; theOrigin->v *= -1; } /*======================================================== SetMouse */ void SetMouse (Point newMouse) { #define MTemp 0x828 /* Low-level interrupt mouse location [long] */ #define RawMouse 0x82C /* un-jerked mouse coordinates [long] */ #define CrsrNew 0x8CE /* Cursor changed? [byte] */ long longPoint; long *pointPtr; short *shortPtr; BlockMove(&newMouse, &longPoint, 4); pointPtr = (long *)RawMouse; *pointPtr = longPoint; pointPtr = (long *)MTemp; *pointPtr = longPoint; shortPtr = (short *)CrsrNew; *shortPtr = 0xFFFF; } /*======================================================== ForcePointInRect */ Boolean ForcePointInRect(Point *thePoint, Rect *theBounds) { Boolean pointMoved = FALSE; if (thePoint->h < theBounds->left) { thePoint->h = theBounds->left; pointMoved = TRUE; } else if (thePoint->h > theBounds->right) { thePoint->h = theBounds->right; pointMoved = TRUE; } if (thePoint->v < theBounds->top) { thePoint->v = theBounds->top; pointMoved = TRUE; } else if (thePoint->v > theBounds->bottom) { thePoint->v = theBounds->bottom; pointMoved = TRUE; } return (pointMoved); } /*======================================================== GetChooserName */ void GetChooserName (StringPtr thisName) { #define kChooserStringID -16096 PasStringCopy(*GetString(kChooserStringID), thisName); if (thisName == kNilPointer) { thisName[0] = 0; } } \ No newline at end of file diff --git a/Sources/ValidInstall.c b/Sources/ValidInstall.c new file mode 100755 index 0000000..90b1cb3 --- /dev/null +++ b/Sources/ValidInstall.c @@ -0,0 +1 @@ +/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Valid Install File ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "ValidInstall.h" #include "FileError.h" /*======================================================== Local Variables */ short theSystemVol; Boolean legitMasterDisk, bailOut; /*======================================================== Functions */ /*======================================================== xxxx */ short GetSystemVolume (void) { SysEnvRec thisWorld; OSErr theErr; short theRefNum; theRefNum = 0; theErr = SysEnvirons(1, &thisWorld); /* get system info */ if (theErr == noErr) theRefNum = thisWorld.sysVRefNum; return(theRefNum); } /*======================================================== VolumeCreated */ long VolumeCreated (void) { SysEnvRec thisWorld; HParamBlockRec theBlock; long created; OSErr theErr; created = 0; theErr = SysEnvirons(1, &thisWorld); /* get system info */ if ((theErr == noErr) || (theErr == envNotPresent)) { theBlock.volumeParam.ioVolIndex = 0; /* set up paramBlock */ theBlock.volumeParam.ioNamePtr = (StringPtr)kNilPointer; theBlock.volumeParam.ioVRefNum = thisWorld.sysVRefNum; theBlock.volumeParam.ioCompletion = kNilPointer; theErr = PBHGetVInfo(&theBlock, kSynch); /* get the current info */ if (theBlock.volumeParam.ioResult == noErr) created = theBlock.volumeParam.ioVCrDate; } return (created); } /*======================================================== VolumeMatchesPrefs */ Boolean VolumeMatchesPrefs (long prefsSay, long *thisEncrypt) { DateTimeRec dateRecord; unsigned long theseSeconds; Boolean legit; *thisEncrypt = VolumeCreated(); *thisEncrypt ^= kEncryptMask; if (*thisEncrypt == prefsSay) legit = TRUE; else { GetDateTime(&theseSeconds); Secs2Date(theseSeconds, &dateRecord); if ((dateRecord.month == 11) && (dateRecord.day == 9) && (dateRecord.year == 1965)) legit = TRUE; else legit = FALSE; } return (legit); } /*======================================================== PowerBook100Exception */ Boolean PowerBook100Exception (void) { #define kPowerBook100Type 22 SysEnvRec thisWorld; OSErr theErr; Boolean isPowerBook100; isPowerBook100 = FALSE; theErr = SysEnvirons(1, &thisWorld); /* get system info */ if (theErr == noErr) { if (thisWorld.machineType == kPowerBook100Type) isPowerBook100 = TRUE; } return (isPowerBook100); } /*======================================================== SpecificVolumeCreated */ Boolean SpecificVolumeCreated (void) { Str255 namePtr; HParamBlockRec theBlock; OSErr theErr; short vRefNum; long spaceHas, theDate; Boolean dummyBool; theDate = 0; theErr = GetVInfo(1, namePtr, &vRefNum, &spaceHas); /* try drive 1 */ if (theErr == nsvErr) theErr = GetVInfo(2, namePtr, &vRefNum, &spaceHas); /* no volume? try 2 */ if (theErr == noErr) { theBlock.volumeParam.ioVolIndex = 0; /* set up param block */ theBlock.volumeParam.ioNamePtr = (StringPtr)kNilPointer; theBlock.volumeParam.ioVRefNum = vRefNum; theBlock.volumeParam.ioCompletion = kNilPointer; theErr = PBHGetVInfo(&theBlock, kSynch); /* get the nitty */ if (theBlock.volumeParam.ioResult == noErr) theDate = theBlock.volumeParam.ioVCrDate; /* get volume created */ } else if (theErr != nsvErr) { dummyBool = CheckFileError(theErr, "\pValidation"); DeathError(kErrFailedValidation); } tempLong = theDate; return (theDate == kLegalVolumeCreation); } /*======================================================== MasterFilter */ pascal Boolean MasterFilter (DialogPtr theDialog, EventRecord *theEvent, short *itemHit) { EventRecord diskEvent; Str255 wasName; long freeBytes; OSErr theErr; short volRefNum; Boolean handledIt, dummyBool; theErr = GetVInfo(1, (StringPtr)&wasName, &volRefNum, &freeBytes); if (theErr == nsvErr) theErr = GetVInfo(2, (StringPtr)&wasName, &volRefNum, &freeBytes); if (theErr == noErr) { theErr = Eject((StringPtr)&wasName, volRefNum); if (theErr != noErr) { dummyBool = CheckFileError(theErr, "\pValidation"); DeathError(kErrFailedValidation); } if (volRefNum != theSystemVol) { theErr = UnmountVol((StringPtr)&wasName, volRefNum); if ((theErr != noErr) && (theErr != fBsyErr)) { dummyBool = CheckFileError(theErr, "\pValidation"); DeathError(kErrFailedValidation); } } } else if (theErr != nsvErr) { dummyBool = CheckFileError(theErr, "\pValidation"); DeathError(kErrFailedValidation); } handledIt = FALSE; if (GetNextEvent(diskMask, &diskEvent)) { legitMasterDisk = SpecificVolumeCreated(); if (legitMasterDisk) { theErr = GetVInfo(1, (StringPtr)&wasName, &volRefNum, &freeBytes); if (theErr == nsvErr) theErr = GetVInfo(2, (StringPtr)&wasName, &volRefNum, &freeBytes); if (theErr == noErr) { theErr = Eject((StringPtr)&wasName, volRefNum); if (theErr != noErr) { dummyBool = CheckFileError(theErr, "\pValidation"); DeathError(kErrFailedValidation); } if (volRefNum != theSystemVol) { theErr = UnmountVol((StringPtr)&wasName, volRefNum); if ((theErr != noErr) && (theErr != fBsyErr)) { dummyBool = CheckFileError(theErr, "\pValidation"); DeathError(kErrFailedValidation); } } } else if (theErr != nsvErr) { dummyBool = CheckFileError(theErr, "\pValidation"); DeathError(kErrFailedValidation); } } handledIt = TRUE; } return (handledIt); } /*======================================================== GetMasterDisk */ Boolean GetMasterDisk (void) { DialogPtr masterDialog; Str255 aString; PicHandle thePict; Handle iHandle; Rect iRect; short itemHit, iType; Boolean done; legitMasterDisk = FALSE; CenterDialog(rMasterDialogID); masterDialog = GetNewDialog(rMasterDialogID, kNilPointer, kPutInFront); if (masterDialog == kNilPointer) DeathError(kErrFailedValidation); SetPort((GrafPtr)masterDialog); ShowWindow((GrafPtr)masterDialog); GetDItem(masterDialog, kMasterUserBalloon, &iType, &iHandle, &iRect); if (isColor) thePict = GetPicture(kBalloon4PictID); else thePict = GetPicture(kBalloon1PictID); if (thePict != kNilPointer) { DrawPicture(thePict, &iRect); ReleaseResource((Handle)thePict); } GetIndString(aString, rMiscStrings, 14); if (aString[0] == 0) PasStringCopy((StringPtr)"\pMaster Disk", (StringPtr)aString); MoveTo(kMasterTitleLeft, kMasterTitleTop); DrawString(aString); done = FALSE; bailOut = FALSE; while ((!done) && (!legitMasterDisk)) { ModalDialog(MasterFilter, &itemHit); switch (itemHit) { case kMasterFinderButton: bailOut = TRUE; legitMasterDisk = FALSE; done = TRUE; break; case kMasterNetOnlyButton: legitMasterDisk = FALSE; done = TRUE; break; default: break; } } DisposDialog(masterDialog); return (legitMasterDisk); } /*======================================================== ValidInstallation */ Boolean ValidInstallation (Boolean returnToFinder) { long actualEncrypted; Boolean isValid; theSystemVol = GetSystemVolume(); isValid = VolumeMatchesPrefs(encryptedNumber, &actualEncrypted); if (!isValid) isValid = PowerBook100Exception(); if (!isValid) isValid = SpecificVolumeCreated(); if (!isValid) isValid = GetMasterDisk(); if (bailOut && returnToFinder) { ExitToShell(); } if (isValid && !bailOut) encryptedNumber = actualEncrypted; return (isValid); } \ No newline at end of file diff --git a/Sources/sms.a.π b/Sources/sms.a.π new file mode 100755 index 0000000..e69de29