home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Games / Glypha 3v2 / GlyphaIII Code ƒ / Interface.c < prev    next >
Encoding:
Text File  |  1995-06-30  |  18.5 KB  |  595 lines  |  [TEXT/CWIE]

  1.  
  2. //============================================================================
  3. //----------------------------------------------------------------------------
  4. //                                    Interface.c
  5. //----------------------------------------------------------------------------
  6. //============================================================================
  7.  
  8. // I put all interface related code in here.  Interface would include event…
  9. // handling, menus, dialog boxes, etc.  All the user interaction that takes…
  10. // place before and after an actual game is in play.
  11.  
  12. #include "Externs.h"
  13. #include <Sound.h>
  14.  
  15.  
  16. #define kAppleMenuID        128
  17. #define iAbout                1
  18. #define kGameMenuID            129
  19. #define iNewGame            1
  20. #define iPauseGame            2
  21. #define iEndGame            3
  22. #define iQuit                5
  23. #define kOptionsMenuID        130
  24. #define iSettings            1
  25. #define iHelp                2
  26. #define iHighScores            3
  27. #define kAboutPictID        132
  28.  
  29.  
  30. void DoAppleMenu (short);
  31. void DoGameMenu (short);
  32. void DoOptionsMenu (short);
  33. void UpdateMainWindow (void);
  34. void HandleMouseEvent (EventRecord *);
  35. void HandleKeyEvent (EventRecord *);
  36. void HandleUpdateEvent (EventRecord *);
  37. void HandleOSEvent (EventRecord *);
  38. void HandleHighLevelEvent (EventRecord *);
  39. void DoAbout (void);
  40. void DoGameSettings (void);
  41.  
  42.  
  43. Rect        mainWindowRect;
  44. WindowPtr    mainWindow;
  45. MenuHandle    appleMenu, gameMenu, optionsMenu;
  46. Boolean        switchedOut, quitting, canPlay, openTheScores;
  47.  
  48. extern    prefsInfo    thePrefs;
  49. extern    Rect        backSrcRect, workSrcRect;
  50. extern    CGrafPtr    backSrcMap, workSrcMap;
  51. extern    Boolean        pausing, playing, helpOpen, scoresOpen;
  52.  
  53.  
  54. //==============================================================  Functions
  55. //--------------------------------------------------------------  MenusReflectMode
  56.  
  57. // Depending on whether a game is in progress (paused) or not, I want…
  58. // menu items grayed out in one case and not grayed out in the other.
  59. // This function, when called, displays the menus correctly depending…
  60. // on the mode we're in (playing or not playing, pausing or not).
  61.  
  62. void MenusReflectMode (void)
  63. {
  64.     if (playing)                                // If a game is in progress…
  65.     {
  66.         DisableItem(gameMenu, iNewGame);        // Cannot begin another New Game.
  67.         EnableItem(gameMenu, iPauseGame);        // Can Pause Game.
  68.         if (pausing)                            // If we are paused…
  69.             SetItem(gameMenu, iPauseGame, 
  70.                     "\pResume Game");            // Rename item "Resume Game".
  71.         else                                    // If we are not paused…
  72.             SetItem(gameMenu, iPauseGame, 
  73.                     "\pPause Game");            // Rename item "Pause Game".
  74.         EnableItem(gameMenu, iEndGame);            // Can End Game.
  75.         DisableItem(optionsMenu, 0);            // Cannot change game settings.
  76.     }
  77.     else                                        // Else, if Glypha is idle…
  78.     {
  79.         EnableItem(gameMenu, iNewGame);            // Can begin a New Game.
  80.         DisableItem(gameMenu, iPauseGame);        // Cannot Pause Game.
  81.         SetItem(gameMenu, iPauseGame, 
  82.                 "\pPause Game");                // Rename item "Pause Game".
  83.         DisableItem(gameMenu, iEndGame);        // Cannot End Game.
  84.         EnableItem(optionsMenu, 0);                // Can change game settings.
  85.     }
  86. }
  87.  
  88. //--------------------------------------------------------------  DoAppleMenu
  89.  
  90. // This function takes care of handling the Apple menu (Desk Assecories and the…
  91. // About box).
  92.  
  93. void DoAppleMenu (short theItem)
  94. {
  95.     Str255        daName;
  96.     GrafPtr        wasPort;
  97.     short        daNumber;
  98.     
  99.     switch (theItem)                            // Depending on the item selected…
  100.     {
  101.         case iAbout:                            // If the About item was selected…
  102.         if ((scoresOpen) || (helpOpen))            // If high scores or help screens up…
  103.         {
  104.             CloseWall();                        // hide them.
  105.             scoresOpen = FALSE;                    // High scores no longer open.
  106.             helpOpen = FALSE;                    // Help screen is no longer open.
  107.                                                 // Uncheck help & high scores menu items.
  108.             CheckItem(optionsMenu, iHelp, helpOpen);
  109.             CheckItem(optionsMenu, iHighScores, scoresOpen);
  110.         }
  111.         DoAbout();                                // Bring up the About dialog.
  112.         break;
  113.         
  114.         default:                                // If any other item was selected (DA)…
  115.         GetItem(appleMenu, theItem, daName);    // Get the name of the item selected.
  116.         GetPort(&wasPort);                        // Remember our port.
  117.         daNumber = OpenDeskAcc(daName);            // Launch the Desk Accesory.
  118.         SetPort((GrafPtr)wasPort);                // When we return, restore port.
  119.         break;
  120.     }
  121. }
  122.  
  123. //--------------------------------------------------------------  DoGameMenu
  124.  
  125. // This function handles a users interaction with the Game menu.  Quitting…
  126. // Glypha, starting a new game, resuming a paused game are handled here.
  127.  
  128. void DoGameMenu (short theItem)
  129. {
  130.     switch (theItem)                        // Depending on menu item selected…
  131.     {
  132.         case iNewGame:                        // If user selected New Game item…
  133.         if ((scoresOpen) || (helpOpen))        // If high scores or help screen is up,…
  134.         {                                    // close them first.
  135.             CloseWall();
  136.             scoresOpen = FALSE;
  137.             helpOpen = FALSE;
  138.             CheckItem(optionsMenu, iHelp, helpOpen);
  139.             CheckItem(optionsMenu, iHighScores, scoresOpen);
  140.         }
  141.         InitNewGame();                        // Initialize variables for a new game.
  142.         MenusReflectMode();                    // Properly gray out the right menu items.
  143.         break;
  144.         
  145.         case iPauseGame:                    // If user selected Pause Game item…
  146.         if (pausing)                        // If we are paused, resume playing.
  147.         {
  148.             pausing = FALSE;                // Turn off pausing flag.
  149.             DumpBackToWorkMap();            // Restore off screen just in case.
  150.         }                                    // Actually pausing a game (not resuming)…
  151.         break;                                // is not really handled here.  It's handled…
  152.                                             // directly within the main game loop.
  153.                                             
  154.         case iEndGame:                        // Ending a game in progress isn't really…
  155.         break;                                // handled here - this is a dummy item.
  156.                                             // Ending a game is handled within the main…
  157.                                             // game loop by looking for the 'command'…
  158.                                             // and 'E' key explicitly.
  159.         
  160.         case iQuit:                            // If user selected Quit item…
  161.         quitting = TRUE;                    // Set quitting flag to TRUE.
  162.         break;
  163.     }
  164. }
  165.  
  166. //--------------------------------------------------------------  DoOptionsMenu
  167.  
  168. // This function handles the Options menu.  Options include game settings,…
  169. // displaying the high scores, and bringing up the Help screen.
  170.  
  171. void DoOptionsMenu (short theItem)
  172. {
  173.     switch (theItem)                    // Depending on which item the user selected…
  174.     {
  175.         case iSettings:                    // If user selected Game Settings item…
  176.         if ((scoresOpen) || (helpOpen))    // Close high scores or help screen.
  177.         {
  178.             CloseWall();
  179.             scoresOpen = FALSE;
  180.             helpOpen = FALSE;
  181.             CheckItem(optionsMenu, iHelp, helpOpen);
  182.             CheckItem(optionsMenu, iHighScores, scoresOpen);
  183.         }
  184.         DoGameSettings();                // Bring up game settings dialog.
  185.         break;
  186.         
  187.         case iHelp:                        // If user selected Help item…
  188.         if (helpOpen)                    // If Help open, close it.
  189.         {
  190.             CloseWall();
  191.             helpOpen = FALSE;
  192.         }
  193.         else                            // Else, if Help is not open - open it.
  194.         {
  195.             if (scoresOpen)                // If the High Scores are up though,…
  196.             {
  197.                 CloseWall();            // Close them first.
  198.                 scoresOpen = FALSE;
  199.                 CheckItem(optionsMenu, iHighScores, scoresOpen);
  200.             }
  201.             OpenHelp();                    // Now open the Help screen.
  202.         }
  203.         CheckItem(optionsMenu, iHelp, helpOpen);
  204.         break;
  205.         
  206.         case iHighScores:                // If user selected High Scores…
  207.         if (scoresOpen)                    // If the High Scores are up, close them.
  208.         {
  209.             CloseWall();
  210.             scoresOpen = FALSE;
  211.         }
  212.         else                            // If the High Scores are not up…
  213.         {
  214.             if (helpOpen)                // First see if Help is open.
  215.             {
  216.                 CloseWall();            // And close the Help screen.
  217.                 helpOpen = FALSE;
  218.                 CheckItem(optionsMenu, iHelp, helpOpen);
  219.             }
  220.             OpenHighScores();            // Now open the High Scores.
  221.         }
  222.         CheckItem(optionsMenu, iHighScores, scoresOpen);
  223.         break;
  224.     }
  225. }
  226.  
  227. //--------------------------------------------------------------  DoMenuChoice
  228.  
  229. // This is the main menu-handling function.  It examines which menu was selected…
  230. // by the user and passes on to the appropriate function, the item within that…
  231. // menu that was selected.
  232.  
  233. void DoMenuChoice (long menuChoice)
  234. {
  235.     short        theMenu, theItem;
  236.     
  237.     if (menuChoice == 0)            // A little error checking.
  238.         return;
  239.     
  240.     theMenu = HiWord(menuChoice);    // Extract which menu was selected.
  241.     theItem = LoWord(menuChoice);    // Extract which item it was that was selected.
  242.     
  243.     switch (theMenu)                // Now, depending upon which menu was selected…
  244.     {
  245.         case kAppleMenuID:            // If the Apple menu selected…
  246.         DoAppleMenu(theItem);        // Call the function that handles the Apple menu.
  247.         break;
  248.         
  249.         case kGameMenuID:            // If the Game menu selected…
  250.         DoGameMenu(theItem);        // Call the function that handles the Game menu.
  251.         break;
  252.         
  253.         case kOptionsMenuID:        // If the Options menu selected…
  254.         DoOptionsMenu(theItem);        // Call the function that handles the Options menu.
  255.         break;
  256.     }
  257.     
  258.     HiliteMenu(0);                    // "De-invert" menu.
  259. }
  260.  
  261. //--------------------------------------------------------------  UpdateMainWindow
  262.  
  263. // This is a simple function that simply copies the contents from the…
  264. // background offscreen pixmap to the main screen.  It is primarily…
  265. // called in response to an update event, but could be called any time…
  266. // when I want to force the screen to be redrawn.
  267.  
  268. void UpdateMainWindow (void)
  269. {
  270.     CopyBits(&((GrafPtr)backSrcMap)->portBits, 
  271.             &(((GrafPtr)mainWindow)->portBits), 
  272.             &mainWindowRect, &mainWindowRect, 
  273.             srcCopy, 0L);
  274. }
  275.  
  276. //--------------------------------------------------------------  HandleMouseEvent
  277.  
  278. // Mouse clicks come here.  This is standard event-handling drivel.  No different 
  279. // from any other standard Mac program (game or otherwise).
  280.  
  281. void HandleMouseEvent (EventRecord *theEvent)
  282. {
  283.     WindowPtr    whichWindow;
  284.     long        menuChoice;
  285.     short        thePart;
  286.                                                 // Determine window and where in window.
  287.     thePart = FindWindow(theEvent->where, &whichWindow);
  288.     
  289.     switch (thePart)                            // Depending on where mouse was clicked…
  290.     {
  291.         case inSysWindow:                        // In a Desk Accesory.
  292.         SystemClick(theEvent, whichWindow);        // (Is this stuff obsolete yet?)
  293.         break;
  294.         
  295.         case inMenuBar:                            // Selected a menu item.
  296.         menuChoice = MenuSelect(theEvent->where);
  297.         if (canPlay)                            // Call menu handling routine.
  298.             DoMenuChoice(menuChoice);
  299.         break;
  300.         
  301.         case inDrag:                            // Like the lazy bastard I am…
  302.         case inGoAway:                            // I'll just ignore these.
  303.         case inGrow:                            // But, hey, the window isn't…
  304.         case inZoomIn:                            // movable or growable!
  305.         case inZoomOut:
  306.         break;
  307.         
  308.         case inContent:                            // Click in the window itself.
  309.         FlashObelisks(TRUE);                    // Do lightning animation.
  310.         LogNextTick(3);                            // Lightning will hit cursor location.
  311.         GenerateLightning(theEvent->where.h, theEvent->where.v - 20);
  312.         StrikeLightning();
  313.         WaitForNextTick();
  314.         StrikeLightning();
  315.         LogNextTick(2);
  316.         WaitForNextTick();
  317.         PlayExternalSound(kLightningSound, kLightningPriority);
  318.         LogNextTick(3);
  319.         GenerateLightning(theEvent->where.h, theEvent->where.v - 20);
  320.         StrikeLightning();
  321.         WaitForNextTick();
  322.         StrikeLightning();
  323.         LogNextTick(2);
  324.         WaitForNextTick();
  325.         LogNextTick(3);
  326.         GenerateLightning(theEvent->where.h, theEvent->where.v - 20);
  327.         StrikeLightning();
  328.         WaitForNextTick();
  329.         StrikeLightning();
  330.         LogNextTick(2);
  331.         WaitForNextTick();
  332.         PlayExternalSound(kLightningSound, kLightningPriority);
  333.         LogNextTick(3);
  334.         GenerateLightning(theEvent->where.h, theEvent->where.v - 20);
  335.         StrikeLightning();
  336.         WaitForNextTick();
  337.         StrikeLightning();
  338.         LogNextTick(2);
  339.         WaitForNextTick();
  340.         FlashObelisks(FALSE);
  341.         break;
  342.     }
  343. }
  344.  
  345. //--------------------------------------------------------------  HandleKeyEvent
  346.  
  347. // More standard issue.  This function handles any keystrokes when no game is
  348. // in session.  Command-key strokes handled here too.
  349.  
  350. void HandleKeyEvent (EventRecord *theEvent)
  351. {
  352.     char        theChar;
  353.     Boolean        commandDown;
  354.     
  355.     theChar = theEvent->message & charCodeMask;                // Extract key hit.
  356.     commandDown = ((theEvent->modifiers & cmdKey) != 0);    // See if command key down.
  357.     
  358.     if (commandDown)                                // If command key down, call menu…
  359.     {                                                // handling routine.
  360.         if (canPlay)
  361.             DoMenuChoice(MenuKey(theChar));
  362.     }
  363.     else
  364.     {
  365.         if (helpOpen)                                // Handle special keys if the help…
  366.         {                                            // screen is up.
  367.             if (theChar == kUpArrowKeyASCII)        // Up arrow key scrolls help down.
  368.             {
  369.                 if (theEvent->what == autoKey)
  370.                     ScrollHelp(-3);
  371.                 else
  372.                     ScrollHelp(-1);
  373.             }
  374.             else if (theChar == kDownArrowKeyASCII)    // Down arrow key scrolls help up.
  375.             {
  376.                 if (theEvent->what == autoKey)
  377.                     ScrollHelp(3);
  378.                 else
  379.                     ScrollHelp(1);
  380.             }
  381.             else if (theChar == kPageDownKeyASCII)    // Handle page down for help screen.
  382.             {
  383.                 ScrollHelp(199);
  384.             }
  385.             else if (theChar == kPageUpKeyASCII)    // Handle page up for help.
  386.             {
  387.                 ScrollHelp(-199);
  388.             }
  389.             else if ((theChar == kHelpKeyASCII) && (!playing))
  390.             {                                        // Hitting Help key closes help…
  391.                 CloseWall();                        // (if it's already open).
  392.                 helpOpen = FALSE;
  393.                 CheckItem(optionsMenu, iHelp, helpOpen);
  394.             }
  395.         }
  396.         else if ((theChar == kHelpKeyASCII) && (!playing))
  397.         {                                            // Else, if help not open and Help…
  398.             if (scoresOpen)                            // key is hit, open Help.
  399.             {                                        // Close high scores if open.
  400.                 CloseWall();
  401.                 scoresOpen = FALSE;
  402.                 CheckItem(optionsMenu, iHighScores, scoresOpen);
  403.             }
  404.             OpenHelp();                                // Open help.
  405.             CheckItem(optionsMenu, iHelp, helpOpen);
  406.         }
  407.     }
  408. }
  409.  
  410. //--------------------------------------------------------------  HandleUpdateEvent
  411.  
  412. // This function handles update events.  Standard event-handling stuff.
  413.  
  414. void HandleUpdateEvent (EventRecord *theEvent)
  415. {    
  416.     if ((WindowPtr)theEvent->message == mainWindow)
  417.     {
  418.         SetPort((GrafPtr)mainWindow);        // Don't forget this line, BTW.
  419.         BeginUpdate((GrafPtr)mainWindow);    // I did once and it took me…
  420.         UpdateMainWindow();                    // ages to track down that bug.
  421.         EndUpdate((GrafPtr)mainWindow);        // Well, it took me a week I think.
  422.         canPlay = TRUE;
  423.     }
  424. }
  425.  
  426. //--------------------------------------------------------------  HandleOSEvent
  427.  
  428. // Handle switchin in and out events.  Standard event-handling stuff.
  429.  
  430. void HandleOSEvent (EventRecord *theEvent)
  431. {    
  432.     if (theEvent->message & 0x01000000)        // If suspend or resume event…
  433.     {
  434.         if (theEvent->message & 0x00000001)    // Specifically, if resume event…
  435.             switchedOut = FALSE;            // I keep thinking I should do more here.
  436.         else                                // Or if suspend event…
  437.             switchedOut = TRUE;                // What am I forgetting?
  438.     }
  439. }
  440.  
  441. //--------------------------------------------------------------  HandleHighLevelEvent
  442.  
  443. // Again, it's a fact I'm lazy.  AppleEvents are fairly easy to implement but…
  444. // a nightmare to try and explain.  Filling out the below function is left as…
  445. // and exercise to the reader.
  446.  
  447. void HandleHighLevelEvent (EventRecord *theEvent)
  448. {    
  449. //    theErr = AEProcessAppleEvent(theEvent);
  450. }
  451.  
  452. //--------------------------------------------------------------  HandleEvent
  453.  
  454. // Standard event stuff.  This is the culling function that calls all the above…
  455. // functions.  It looks for an event and if it detects one, it calls the appropriate…
  456. // function above to handle it.
  457.  
  458. void HandleEvent (void)
  459. {
  460.     EventRecord    theEvent;
  461.     long        sleep = 1L;
  462.     Boolean        itHappened;
  463.                                             // See if an event is queued up.
  464.     itHappened = WaitNextEvent(everyEvent, &theEvent, sleep, 0L);
  465.     
  466.     if (itHappened)                            // Ah, an event.  I live for events!
  467.     {
  468.         switch (theEvent.what)                // And what kind of event be ya'?
  469.         {
  470.             case mouseDown:                    // Aiy!  Y' be a mouse click do ya'?
  471.             HandleMouseEvent(&theEvent);
  472.             break;
  473.             
  474.             case keyDown:                    // Key down, key held down events.
  475.             case autoKey:
  476.             HandleKeyEvent(&theEvent);
  477.             break;
  478.             
  479.             case updateEvt:                    // Something needs redrawing!
  480.             HandleUpdateEvent(&theEvent);
  481.             break;
  482.             
  483.             case osEvt:                        // Switching in and out events.
  484.             HandleOSEvent(&theEvent);
  485.             break;
  486.             
  487.             case kHighLevelEvent:            // Hmmmm.  A "what" event?
  488.             HandleHighLevelEvent(&theEvent);
  489.             break;
  490.         }
  491.     }
  492.     else if (openTheScores)                    // Check for "auto open" flag.
  493.     {                                        // If TRUE, set the flag back to…
  494.         openTheScores = FALSE;                // FALSE and open the high scores.
  495.         OpenHighScores();
  496.     }
  497. }
  498.  
  499. //--------------------------------------------------------------  DoAbout
  500.  
  501. // This handles the About dialog.  It brings up the About box in a…
  502. // simple centered window with no drag bar, close box or anything.
  503. // Leaving the dialog is handled with a simple mouse click.
  504.  
  505. void DoAbout (void)
  506. {
  507.     Rect        aboutRect;
  508.     WindowPtr    aboutWindow;
  509.     
  510.     SetRect(&aboutRect, 0, 0, 325, 318);        // Bring up centered window.
  511.     CenterRectInRect(&aboutRect, &qd.screenBits.bounds);
  512.     aboutWindow = GetNewCWindow(129, 0L, kPutInFront);
  513.     MoveWindow((GrafPtr)aboutWindow, aboutRect.left, aboutRect.top, TRUE);
  514.     ShowWindow((GrafPtr)aboutWindow);
  515.     SetPort((GrafPtr)aboutWindow);
  516.     LoadGraphic(kAboutPictID);                    // Draw About dialog graphic.
  517.     
  518.     do                                            // Make sure button not down…
  519.     {                                            // before proceeding.
  520.     }
  521.     while (Button());                            // Proceed.
  522.     do                                            // And now wait until the mouse…
  523.     {                                            // is pressed before closing the…
  524.     }                                            // window (ABout dialog).
  525.     while (!Button());
  526.     
  527.     FlushEvents(everyEvent, 0);                    // Flush the queue.
  528.     
  529.     if (aboutWindow != 0L)
  530.         DisposeWindow(aboutWindow);                // Close the About dialog.
  531. }
  532.  
  533. //--------------------------------------------------------------  DoGameSettings
  534.  
  535. // This one however is a good and proper dialog box.  It handles the meager…
  536. // preference settings for Glypha.  Nothing fancy here to report.  Just a…
  537. // straight-forward dialog calling routine.
  538.  
  539. void DoGameSettings (void)
  540. {
  541.     #define        kGameSettingsDialogID    133
  542.     DialogPtr    theDial;
  543.     long        newVolume;
  544.     short        i, item;
  545.     Boolean        leaving;
  546.     
  547.     CenterDialog(kGameSettingsDialogID);    // Center dialog, then call up.
  548.     theDial = GetNewDialog(kGameSettingsDialogID, 0L, kPutInFront);
  549.     SetPort((GrafPtr)theDial);
  550.     ShowWindow((GrafPtr)theDial);            // Make visible (after centering).
  551.     DrawDefaultButton(theDial);                // Draw border around Okay button.
  552.     FlushEvents(everyEvent, 0);
  553.                                             // Put in a default sound volume.
  554.     SetDialogNumToStr(theDial, 3, (long)thePrefs.wasVolume);
  555.     SelIText(theDial, 3, 0, 1024);            // Select it.
  556.     
  557.     leaving = FALSE;
  558.     
  559.     while (!leaving)
  560.     {
  561.         ModalDialog(0L, &item);                // Simple modal dialog filtering.
  562.         
  563.         if (item == 1)                        // Did user hit the Okay button?
  564.         {                                    // Well see if volume entered is legal.
  565.             GetDialogNumFromStr(theDial, 3, &newVolume);
  566.             if ((newVolume >= 0) && (newVolume <= 7))
  567.             {                                // If it is legal, we'll note it and quit.
  568.                 thePrefs.wasVolume = (short)newVolume;
  569.                 SetSoundVol((short)newVolume);
  570.                 leaving = TRUE;                // Bye.
  571.             }
  572.             else                            // Otherwise, the volume entered is wrong.
  573.             {                                // So we'll Beep, enter the last legal…
  574.                 SysBeep(1);                    // value and select the text again.
  575.                 SetDialogNumToStr(theDial, 3, (long)thePrefs.wasVolume);
  576.                 SelIText(theDial, 3, 0, 1024);
  577.             }
  578.         }
  579.         else if (item == 2)                    // Did the user hit the "Clear Scores"…
  580.         {                                    // button?
  581.             for (i = 0; i < 10; i++)        // Walk through and zero scores.
  582.             {
  583.                 PasStringCopy("\pNemo", thePrefs.highNames[i]);
  584.                 thePrefs.highScores[i] = 0L;
  585.                 thePrefs.highLevel[i] = 0;
  586.                 openTheScores = TRUE;        // Bring up scores when dialog quits.
  587.             }
  588.             DisableControl(theDial, 2);        // Gray out Clear Scores button.
  589.         }
  590.     }
  591.     
  592.     DisposDialog(theDial);                    // Clean up before going.
  593. }
  594.  
  595.