rnd-20070207-1-src
authorHolger Schemel <info@artsoft.org>
Wed, 7 Feb 2007 00:34:31 +0000 (01:34 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:54:20 +0000 (10:54 +0200)
src/conf_gfx.c
src/conftime.h
src/files.c
src/game.c
src/libgame/system.h
src/screens.c

index b30403fd2c11f8a4983821ccf39e21471bcb9cfb..4f126bc033a446cc353581511ada21a7af7c4ca2 100644 (file)
@@ -4948,6 +4948,20 @@ struct ConfigInfo image_config[] =
   /* the following directives are not associated with an image, but
      probably make sense to be defined in "graphicsinfo.conf", too */
 
+#if 0
+  { "titlemessage_1.x",                                "-1"                    },
+  { "titlemessage_1.y",                                "-1"                    },
+  { "titlemessage_1.width",                    "-1"                    },
+  { "titlemessage_1.height",                   "-1"                    },
+  { "titlemessage_1.chars",                    "-1"                    },
+  { "titlemessage_1.lines",                    "-1"                    },
+  { "titlemessage_1.align",                    "-1"                    },
+  { "titlemessage_1.autowrap",                 "-1"                    },
+  { "titlemessage_1.centered",                 "-1"                    },
+  { "titlemessage_1.skip_comments",            "-1"                    },
+  { "titlemessage_1.sort_priority",            "-1"                    },
+#endif
+
   { "global.num_toons",                                "20"                    },
 
   { "border.draw_masked.TITLE",                        "false"                 },
index 775689059199ac38d44f05cddd5c10a93a319dd8..0b9025854d753fa2cf95153c73950172cb27928b 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-02-03 18:40"
+#define COMPILE_DATE_STRING "2007-02-07 01:33"
index e9d254f30186476aec9d4619bf970acfae03c013..7c35c2359b8183c4526bfa0ab669912d426a4d8a 100644 (file)
@@ -7691,14 +7691,15 @@ void SaveScore(int nr)
 #define SETUP_TOKEN_QUICK_SWITCH               20
 #define SETUP_TOKEN_INPUT_ON_FOCUS             21
 #define SETUP_TOKEN_PREFER_AGA_GRAPHICS                22
-#define SETUP_TOKEN_GRAPHICS_SET               23
-#define SETUP_TOKEN_SOUNDS_SET                 24
-#define SETUP_TOKEN_MUSIC_SET                  25
-#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS    26
-#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS      27
-#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC       28
+#define SETUP_TOKEN_GAME_FRAME_DELAY           23
+#define SETUP_TOKEN_GRAPHICS_SET               24
+#define SETUP_TOKEN_SOUNDS_SET                 25
+#define SETUP_TOKEN_MUSIC_SET                  26
+#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS    27
+#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS      28
+#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC       29
 
-#define NUM_GLOBAL_SETUP_TOKENS                        29
+#define NUM_GLOBAL_SETUP_TOKENS                        30
 
 /* editor setup */
 #define SETUP_TOKEN_EDITOR_EL_BOULDERDASH      0
@@ -7817,6 +7818,7 @@ static struct TokenInfo global_setup_tokens[] =
   { TYPE_SWITCH, &si.quick_switch,     "quick_player_switch"           },
   { TYPE_SWITCH, &si.input_on_focus,   "input_on_focus"                },
   { TYPE_SWITCH, &si.prefer_aga_graphics, "prefer_aga_graphics"                },
+  { TYPE_INTEGER,&si.game_frame_delay, "game_frame_delay"              },
   { TYPE_STRING, &si.graphics_set,     "graphics_set"                  },
   { TYPE_STRING, &si.sounds_set,       "sounds_set"                    },
   { TYPE_STRING, &si.music_set,                "music_set"                     },
@@ -7969,6 +7971,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si)
   si->quick_switch = FALSE;
   si->input_on_focus = FALSE;
   si->prefer_aga_graphics = TRUE;
+  si->game_frame_delay = GAME_FRAME_DELAY;
 
   si->graphics_set = getStringCopy(GFX_CLASSIC_SUBDIR);
   si->sounds_set = getStringCopy(SND_CLASSIC_SUBDIR);
index af0b7413103ef3c897535dbcdcc0af31be4e3d0e..0659bd04c273b6c7dab7c7405c6870004c92b20f 100644 (file)
@@ -919,6 +919,8 @@ static void SetPlayerMoveSpeed(struct PlayerInfo *player, int move_stepsize,
 
 void GetPlayerConfig()
 {
+  GameFrameDelay = setup.game_frame_delay;
+
   if (!audio.sound_available)
     setup.sound_simple = FALSE;
 
@@ -10565,12 +10567,39 @@ static boolean AllPlayersInVisibleScreen()
 
 void ScrollLevel(int dx, int dy)
 {
+#if 1
+  static Bitmap *bitmap_db_field2 = NULL;
+  int softscroll_offset = (setup.soft_scrolling ? TILEX : 0);
+  int x, y;
+#else
   int i, x, y;
+#endif
 
   /* only horizontal XOR vertical scroll direction allowed */
   if ((dx == 0 && dy == 0) || (dx != 0 && dy != 0))
     return;
 
+#if 1
+  if (bitmap_db_field2 == NULL)
+    bitmap_db_field2 = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
+
+  BlitBitmap(drawto_field, bitmap_db_field2,
+            FX + TILEX * (dx == -1) - softscroll_offset,
+            FY + TILEY * (dy == -1) - softscroll_offset,
+            SXSIZE - TILEX * (dx != 0) + 2 * softscroll_offset,
+            SYSIZE - TILEY * (dy != 0) + 2 * softscroll_offset,
+            FX + TILEX * (dx == 1) - softscroll_offset,
+            FY + TILEY * (dy == 1) - softscroll_offset);
+  BlitBitmap(bitmap_db_field2, drawto_field,
+            FX + TILEX * (dx == 1) - softscroll_offset,
+            FY + TILEY * (dy == 1) - softscroll_offset,
+            SXSIZE - TILEX * (dx != 0) + 2 * softscroll_offset,
+            SYSIZE - TILEY * (dy != 0) + 2 * softscroll_offset,
+            FX + TILEX * (dx == 1) - softscroll_offset,
+            FY + TILEY * (dy == 1) - softscroll_offset);
+
+#else
+
 #if 1
   int xsize = (BX2 - BX1 + 1);
   int ysize = (BY2 - BY1 + 1);
@@ -10600,6 +10629,7 @@ void ScrollLevel(int dx, int dy)
             SYSIZE - TILEY * (dy != 0) + 2 * softscroll_offset,
             FX + TILEX * (dx == 1) - softscroll_offset,
             FY + TILEY * (dy == 1) - softscroll_offset);
+#endif
 #endif
 
   if (dx != 0)
index b25dc1289a9f02f0ce2835bc9b833791f4a67a32..fcb2034b7a7f015fb62b58f444dca3329c948c82 100644 (file)
@@ -804,6 +804,7 @@ struct SetupInfo
   boolean quick_switch;
   boolean input_on_focus;
   boolean prefer_aga_graphics;
+  int game_frame_delay;
 
   char *graphics_set;
   char *sounds_set;
index 941ad1258394d4f052bd21c18ef5c7b330669f38..b78ccf24a665ac4e0720242db3e400e744889668 100644 (file)
 /* screens in the setup menu */
 #define SETUP_MODE_MAIN                        0
 #define SETUP_MODE_GAME                        1
-#define SETUP_MODE_EDITOR              2
-#define SETUP_MODE_INPUT               3
-#define SETUP_MODE_SHORTCUT_1          4
-#define SETUP_MODE_SHORTCUT_2          5
-#define SETUP_MODE_GRAPHICS            6
-#define SETUP_MODE_CHOOSE_SCREEN_MODE  7
-#define SETUP_MODE_SOUND               8
-#define SETUP_MODE_ARTWORK             9
-#define SETUP_MODE_CHOOSE_GRAPHICS     10
-#define SETUP_MODE_CHOOSE_SOUNDS       11
-#define SETUP_MODE_CHOOSE_MUSIC                12
-
-#define MAX_SETUP_MODES                        13
+#define SETUP_MODE_CHOOSE_GAME_SPEED   2
+#define SETUP_MODE_EDITOR              3
+#define SETUP_MODE_INPUT               4
+#define SETUP_MODE_SHORTCUT_1          5
+#define SETUP_MODE_SHORTCUT_2          6
+#define SETUP_MODE_GRAPHICS            7
+#define SETUP_MODE_CHOOSE_SCREEN_MODE  8
+#define SETUP_MODE_SOUND               9
+#define SETUP_MODE_ARTWORK             10
+#define SETUP_MODE_CHOOSE_GRAPHICS     11
+#define SETUP_MODE_CHOOSE_SOUNDS       12
+#define SETUP_MODE_CHOOSE_MUSIC                13
+
+#define MAX_SETUP_MODES                        14
 
 /* for input setup functions */
 #define SETUPINPUT_SCREEN_POS_START    0
@@ -136,6 +137,7 @@ static void HandleSetupScreen_Generic(int, int, int, int, int);
 static void HandleSetupScreen_Input(int, int, int, int, int);
 static void CustomizeKeyboard(int);
 static void CalibrateJoystick(int);
+static void execSetupGame(void);
 static void execSetupGraphics(void);
 static void execSetupArtwork(void);
 static void HandleChooseTree(int, int, int, int, int, TreeInfo **);
@@ -168,6 +170,40 @@ static int info_mode = INFO_MODE_MAIN;
 static TreeInfo *screen_modes = NULL;
 static TreeInfo *screen_mode_current = NULL;
 
+static TreeInfo *game_speeds = NULL;
+static TreeInfo *game_speed_current = NULL;
+
+static struct
+{
+  int value;
+  char *text;
+} game_speeds_list[] =
+{
+#if 1
+  {    30,     "Very Slow"                     },
+  {    25,     "Slow"                          },
+  {    20,     "Normal"                        },
+  {    15,     "Fast"                          },
+  {    10,     "Very Fast"                     },
+#else
+  {    1000,   "1/1s (Extremely Slow)"         },
+  {    500,    "1/2s"                          },
+  {    200,    "1/5s"                          },
+  {    100,    "1/10s"                         },
+  {    50,     "1/20s"                         },
+  {    29,     "1/35s (Original Supaplex)"     },
+  {    25,     "1/40s"                         },
+  {    20,     "1/50s (Normal Speed)"          },
+  {    14,     "1/70s (Maximum Supaplex)"      },
+  {    10,     "1/100s"                        },
+  {    5,      "1/200s"                        },
+  {    2,      "1/500s"                        },
+  {    1,      "1/1000s (Extremely Fast)"      },
+#endif
+
+  {    -1,     NULL                            },
+};
+
 #define DRAW_MODE(s)           ((s) >= GAME_MODE_MAIN &&               \
                                 (s) <= GAME_MODE_SETUP ? (s) :         \
                                 (s) == GAME_MODE_PSEUDO_TYPENAME ?     \
@@ -785,8 +821,8 @@ void DrawTitleScreenMessage(int nr, boolean initial)
   int font_nr = FONT_TEXT_1;
   int font_width;
   int font_height;
-  int pad_x = 16;
-  int pad_y = 32;
+  int pad_x = 16   + 4;
+  int pad_y = 32   + 14;
   int sx = pad_x;
   int sy = pad_y;
   int max_chars_per_line;
@@ -3103,6 +3139,8 @@ void HandleTypeName(int newxpos, Key key)
 
     DrawText(startx, starty, setup.player_name, font_nr);
   }
+
+  sprintf(main_input_name, "%s", setup.player_name);
 }
 
 
@@ -3308,13 +3346,12 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
     }
     else if (game_status == GAME_MODE_SETUP)
     {
-      if (game_status == GAME_MODE_SETUP)
-      {
-       if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
-         execSetupGraphics();
-       else
-         execSetupArtwork();
-      }
+      if (setup_mode == SETUP_MODE_CHOOSE_GAME_SPEED)
+       execSetupGame();
+      else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+       execSetupGraphics();
+      else
+       execSetupArtwork();
     }
     else
     {
@@ -3478,7 +3515,9 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
 
        if (game_status == GAME_MODE_SETUP)
        {
-         if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+         if (setup_mode == SETUP_MODE_CHOOSE_GAME_SPEED)
+           execSetupGame();
+         else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
            execSetupGraphics();
          else
            execSetupArtwork();
@@ -3654,6 +3693,7 @@ static struct TokenInfo *setup_info;
 static int num_setup_info;
 
 static char *screen_mode_text;
+static char *game_speed_text;
 static char *graphics_set_name;
 static char *sounds_set_name;
 static char *music_set_name;
@@ -3666,10 +3706,63 @@ static void execSetupMain()
 
 static void execSetupGame()
 {
+  if (game_speeds == NULL)
+  {
+    int i;
+
+    for (i = 0; game_speeds_list[i].value != -1; i++)
+    {
+      TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
+      char identifier[32], name[32];
+      int value = game_speeds_list[i].value;
+      char *text = game_speeds_list[i].text;
+
+      ti->node_top = &game_speeds;
+      ti->sort_priority = 10000 - value;
+
+      sprintf(identifier, "%d", value);
+      sprintf(name, "%s", text);
+
+      setString(&ti->identifier, identifier);
+      setString(&ti->name, name);
+      setString(&ti->name_sorting, name);
+      setString(&ti->infotext, "Game Speed");
+
+      pushTreeInfo(&game_speeds, ti);
+    }
+
+    /* sort game speed values to start with slowest game speed */
+    sortTreeInfo(&game_speeds);
+
+    /* set current game speed to configured game speed value */
+    game_speed_current =
+      getTreeInfoFromIdentifier(game_speeds, i_to_a(setup.game_frame_delay));
+
+    /* if that fails, set current game speed to reliable default value */
+    if (game_speed_current == NULL)
+      game_speed_current =
+       getTreeInfoFromIdentifier(game_speeds, i_to_a(GAME_FRAME_DELAY));
+
+    /* if that also fails, set current game speed to first available speed */
+    if (game_speed_current == NULL)
+      game_speed_current = game_speeds;
+  }
+
+  setup.game_frame_delay = atoi(game_speed_current->identifier);
+
+  /* needed for displaying game speed text instead of identifier */
+  game_speed_text = game_speed_current->name;
+
   setup_mode = SETUP_MODE_GAME;
   DrawSetupScreen();
 }
 
+static void execSetupChooseGameSpeed()
+{
+  setup_mode = SETUP_MODE_CHOOSE_GAME_SPEED;
+  DrawSetupScreen();
+}
+
 static void execSetupEditor()
 {
   setup_mode = SETUP_MODE_EDITOR;
@@ -3696,7 +3789,7 @@ static void execSetupGraphics()
       ti->sort_priority = x * 10000 + y;
 
       sprintf(identifier, "%dx%d", x, y);
-      sprintf(name,     "%d x %d [%d:%d]", x, y, xx, yy);
+      sprintf(name, "%d x %d [%d:%d]", x, y, xx, yy);
 
       setString(&ti->identifier, identifier);
       setString(&ti->name, name);
@@ -3844,6 +3937,8 @@ static struct TokenInfo setup_info_game[] =
   { TYPE_SWITCH,       &setup.skip_levels,     "Skip Unsolved Levels:" },
   { TYPE_SWITCH,       &setup.time_limit,      "Time Limit:"           },
   { TYPE_SWITCH,       &setup.autorecord,      "Auto-Record Tapes:"    },
+  { TYPE_ENTER_LIST,   execSetupChooseGameSpeed, "Game Speed:"         },
+  { TYPE_STRING,       &game_speed_text,       ""                      },
   { TYPE_EMPTY,                NULL,                   ""                      },
   { TYPE_LEAVE_MENU,   execSetupMain,          "Back"                  },
 
@@ -5063,6 +5158,8 @@ void DrawSetupScreen()
 
   if (setup_mode == SETUP_MODE_INPUT)
     DrawSetupScreen_Input();
+  else if (setup_mode == SETUP_MODE_CHOOSE_GAME_SPEED)
+    DrawChooseTree(&game_speed_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
     DrawChooseTree(&screen_mode_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS)
@@ -5088,6 +5185,8 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
 {
   if (setup_mode == SETUP_MODE_INPUT)
     HandleSetupScreen_Input(mx, my, dx, dy, button);
+  else if (setup_mode == SETUP_MODE_CHOOSE_GAME_SPEED)
+    HandleChooseTree(mx, my, dx, dy, button, &game_speed_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
     HandleChooseTree(mx, my, dx, dy, button, &screen_mode_current);
   else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS)