rnd-19981130-1
[rocksndiamonds.git] / src / screens.c
index 82c3e76478046933d034abfb348fa67a32615fad..48f42a35ca745a65b1b39c7f1202a17c366d2c56 100644 (file)
 #include "network.h"
 #include "init.h"
 
+/* for DrawSetupScreen(), HandleSetupScreen() */
+#define SETUP_SCREEN_POS_START         2
+#define SETUP_SCREEN_POS_END           16
+#define SETUP_SCREEN_POS_EMPTY1                (SETUP_SCREEN_POS_END - 2)
+#define SETUP_SCREEN_POS_EMPTY2                (SETUP_SCREEN_POS_END - 2)
+
+/* for HandleSetupInputScreen() */
+#define SETUPINPUT_SCREEN_POS_START    2
+#define SETUPINPUT_SCREEN_POS_END      15
+#define SETUPINPUT_SCREEN_POS_EMPTY1   (SETUPINPUT_SCREEN_POS_START + 3)
+#define SETUPINPUT_SCREEN_POS_EMPTY2   (SETUPINPUT_SCREEN_POS_END - 1)
+
+/* for HandleChooseLevel() */
+#define MAX_LEVEL_SERIES_ON_SCREEN     15
+
 #ifdef MSDOS
 extern unsigned char get_ascii(KeySym);
 #endif
@@ -225,9 +240,11 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
        if (setup.autorecord)
          TapeStartRecording();
 
+#ifndef MSDOS
        if (options.network)
          SendToServer_StartPlaying();
        else
+#endif
        {
          game_status = PLAYING;
          InitGame();
@@ -782,7 +799,7 @@ static void drawChooseLevelList(int first_entry, int num_page_entries)
     DrawGraphic(0, 1, GFX_PFEIL_O);
 
   if (first_entry + num_page_entries < num_leveldirs)
-    DrawGraphic(0, MAX_VISIBLE_ENTRIES + 1, GFX_PFEIL_U);
+    DrawGraphic(0, MAX_LEVEL_SERIES_ON_SCREEN + 1, GFX_PFEIL_U);
 }
 
 static void drawChooseLevelInfo(int leveldir_nr)
@@ -802,10 +819,10 @@ void HandleChooseLevel(int mx, int my, int dx, int dy, int button)
   int x = (mx + 32 - SX) / 32, y = (my + 32 - SY) / 32;
   int num_page_entries;
 
-  if (num_leveldirs <= MAX_VISIBLE_ENTRIES)
+  if (num_leveldirs <= MAX_LEVEL_SERIES_ON_SCREEN)
     num_page_entries = num_leveldirs;
   else
-    num_page_entries = MAX_VISIBLE_ENTRIES - 1;
+    num_page_entries = MAX_LEVEL_SERIES_ON_SCREEN - 1;
 
   if (button == MB_MENU_INITIALIZE)
   {
@@ -892,9 +909,7 @@ void HandleChooseLevel(int mx, int my, int dx, int dy, int button)
        getLastPlayedLevelOfLevelSeries(leveldir[leveldir_nr].filename);
 
       SaveLevelSetup();
-
       TapeErase();
-      LoadTape(level_nr);
 
       game_status = MAINMENU;
       DrawMainMenu();
@@ -922,7 +937,7 @@ void DrawHallOfFame(int highlight_position)
   DrawText(SX + 80, SY + 8, "Hall Of Fame", FS_BIG, FC_YELLOW);
   DrawTextFCentered(46, FC_RED, "HighScores of Level %d", level_nr);
 
-  for(i=0; i<MAX_VISIBLE_ENTRIES; i++)
+  for(i=0; i<MAX_LEVEL_SERIES_ON_SCREEN; i++)
   {
     DrawText(SX, SY + 64 + i * 32, ".................", FS_BIG,
             (i == highlight_position ? FC_RED : FC_GREEN));
@@ -1189,6 +1204,11 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
          SaveJoystickData();
          */
 
+#ifdef MSDOS
+         save_joystick_data(JOYSTICK_FILENAME);
+#endif
+
+
        }
 
        game_status = MAINMENU;
@@ -1640,7 +1660,9 @@ void CalibrateJoystick(int player_nr)
 #endif
 
 #ifdef MSDOS
+  /*
   char joy_nr[4];
+  */
 #endif
 
   int joystick_fd = stored_player[player_nr].joystick_fd;
@@ -1730,11 +1752,13 @@ void CalibrateJoystick(int player_nr)
       }
     }
 
+#ifndef MSDOS
     if (read(joystick_fd, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
     {
       joystick_status = JOYSTICK_OFF;
       goto error_out;
     }
+#endif
 
     new_joystick_xleft  = MIN(new_joystick_xleft,  joy_ctrl.x);
     new_joystick_xright = MAX(new_joystick_xright, joy_ctrl.x);
@@ -1802,7 +1826,9 @@ void CalibrateJoystick(int player_nr)
   while(Joystick(player_nr) & JOY_BUTTON);
   return;
 
+#ifndef MSDOS
   error_out:
+#endif
 
   ClearWindow();
   DrawText(SX+16, SY+16, "NO JOYSTICK",FS_BIG,FC_YELLOW);
@@ -2045,9 +2071,11 @@ void HandleVideoButtons(int mx, int my, int button)
       {
        TapeStartRecording();
 
+#ifndef MSDOS
        if (options.network)
          SendToServer_StartPlaying();
        else
+#endif
        {
          game_status = PLAYING;
          InitGame();
@@ -2190,9 +2218,11 @@ void HandleGameButtons(int mx, int my, int button)
       if (Request("Do you really want to quit the game ?",
                  REQ_ASK | REQ_STAY_CLOSED))
       { 
+#ifndef MSDOS
        if (options.network)
          SendToServer_StopPlaying();
        else
+#endif
        {
          game_status = MAINMENU;
          DrawMainMenu();
@@ -2205,10 +2235,12 @@ void HandleGameButtons(int mx, int my, int button)
     case BUTTON_GAME_PAUSE:
       if (options.network)
       {
+#ifndef MSDOS
        if (tape.pausing)
          SendToServer_ContinuePlaying();
        else
          SendToServer_PausePlaying();
+#endif
       }
       else
        TapeTogglePause();
@@ -2217,9 +2249,11 @@ void HandleGameButtons(int mx, int my, int button)
     case BUTTON_GAME_PLAY:
       if (tape.pausing)
       {
+#ifndef MSDOS
        if (options.network)
          SendToServer_ContinuePlaying();
        else
+#endif
        {
          tape.pausing = FALSE;
          DrawVideoDisplay(VIDEO_STATE_PAUSE_OFF,0);