rnd-20061019-2-src
authorHolger Schemel <info@artsoft.org>
Thu, 19 Oct 2006 17:52:03 +0000 (19:52 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:53:26 +0000 (10:53 +0200)
13 files changed:
src/conf_gfx.c
src/conf_gfx.h
src/conftime.h
src/events.c
src/game.c
src/libgame/misc.c
src/libgame/system.h
src/main.c
src/main.h
src/netserv.c
src/network.c
src/screens.c
src/tools.c

index 3340c89e2e77e0585fc361c2b63369b32518f70e..1427994e8ea9dc10269ae5955f4de0bc0f4b45a6 100644 (file)
@@ -4497,6 +4497,11 @@ struct ConfigInfo image_config[] =
   { "background.envelope_4.anim_mode",         "default"               },
   { "background.envelope_4.draw_masked",       "false"                 },
 
+  { "titlescreen_initial_1",                   UNDEFINED_FILENAME      },
+  { "titlescreen_initial_2",                   UNDEFINED_FILENAME      },
+  { "titlescreen_initial_3",                   UNDEFINED_FILENAME      },
+  { "titlescreen_initial_4",                   UNDEFINED_FILENAME      },
+  { "titlescreen_initial_5",                   UNDEFINED_FILENAME      },
   { "titlescreen_1",                           UNDEFINED_FILENAME      },
   { "titlescreen_2",                           UNDEFINED_FILENAME      },
   { "titlescreen_3",                           UNDEFINED_FILENAME      },
@@ -4567,6 +4572,7 @@ struct ConfigInfo image_config[] =
 
   { "menu.fade_delay",                         "250"                   },
   { "menu.post_delay",                         "125"                   },
+  { "menu.auto_delay",                         "0"                     },
 
   { "main.button.name.x",                      "0"                     },
   { "main.button.name.y",                      "64"                    },
index 1f0d5dc15ae93f53268316a0b326897edef1593d..33083cc2a156435542d6d036e9f57f6f8ecdad92 100644 (file)
 #define IMG_BACKGROUND_ENVELOPE_2                      1542
 #define IMG_BACKGROUND_ENVELOPE_3                      1543
 #define IMG_BACKGROUND_ENVELOPE_4                      1544
-#define IMG_TITLESCREEN_1                              1545
-#define IMG_TITLESCREEN_2                              1546
-#define IMG_TITLESCREEN_3                              1547
-#define IMG_TITLESCREEN_4                              1548
-#define IMG_TITLESCREEN_5                              1549
-#define IMG_BACKGROUND                                 1550
-#define IMG_BACKGROUND_TITLE                           1551
-#define IMG_BACKGROUND_MAIN                            1552
-#define IMG_BACKGROUND_LEVELS                          1553
-#define IMG_BACKGROUND_SCORES                          1554
-#define IMG_BACKGROUND_EDITOR                          1555
-#define IMG_BACKGROUND_INFO                            1556
-#define IMG_BACKGROUND_INFO_ELEMENTS                   1557
-#define IMG_BACKGROUND_INFO_MUSIC                      1558
-#define IMG_BACKGROUND_INFO_CREDITS                    1559
-#define IMG_BACKGROUND_INFO_PROGRAM                    1560
-#define IMG_BACKGROUND_INFO_LEVELSET                   1561
-#define IMG_BACKGROUND_SETUP                           1562
-#define IMG_BACKGROUND_DOOR                            1563
+#define IMG_TITLESCREEN_INITIAL_1                      1545
+#define IMG_TITLESCREEN_INITIAL_2                      1546
+#define IMG_TITLESCREEN_INITIAL_3                      1547
+#define IMG_TITLESCREEN_INITIAL_4                      1548
+#define IMG_TITLESCREEN_INITIAL_5                      1549
+#define IMG_TITLESCREEN_1                              1550
+#define IMG_TITLESCREEN_2                              1551
+#define IMG_TITLESCREEN_3                              1552
+#define IMG_TITLESCREEN_4                              1553
+#define IMG_TITLESCREEN_5                              1554
+#define IMG_BACKGROUND                                 1555
+#define IMG_BACKGROUND_TITLE                           1556
+#define IMG_BACKGROUND_MAIN                            1557
+#define IMG_BACKGROUND_LEVELS                          1558
+#define IMG_BACKGROUND_SCORES                          1559
+#define IMG_BACKGROUND_EDITOR                          1560
+#define IMG_BACKGROUND_INFO                            1561
+#define IMG_BACKGROUND_INFO_ELEMENTS                   1562
+#define IMG_BACKGROUND_INFO_MUSIC                      1563
+#define IMG_BACKGROUND_INFO_CREDITS                    1564
+#define IMG_BACKGROUND_INFO_PROGRAM                    1565
+#define IMG_BACKGROUND_INFO_LEVELSET                   1566
+#define IMG_BACKGROUND_SETUP                           1567
+#define IMG_BACKGROUND_DOOR                            1568
 
-#define NUM_IMAGE_FILES                                        1564
+#define NUM_IMAGE_FILES                                        1569
 
 #endif /* CONF_GFX_H */
index 02614da58cd77d515d2e11c3ccf0a6545e3fc30c..66817545051a4489e136b66008ea3c4d55a3dfe7 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2006-10-19 00:36]"
+#define COMPILE_DATE_STRING "[2006-10-19 19:44]"
index dbaa43735a78fb606b3cf7f4c87fc531b0cd42a0..7ea4356bc8920f6afaa51f0c7bdc397ad4a64b93 100644 (file)
@@ -127,7 +127,7 @@ void EventLoop(void)
 
       while (NextValidEvent(&event))
       {
-       switch(event.type)
+       switch (event.type)
        {
          case EVENT_BUTTONPRESS:
          case EVENT_BUTTONRELEASE:
@@ -194,7 +194,7 @@ void EventLoop(void)
 
 void HandleOtherEvents(Event *event)
 {
-  switch(event->type)
+  switch (event->type)
   {
     case EVENT_EXPOSE:
       HandleExposeEvent((ExposeEvent *) event);
@@ -238,7 +238,7 @@ void ClearEventQueue()
 
     NextEvent(&event);
 
-    switch(event.type)
+    switch (event.type)
     {
       case EVENT_BUTTONRELEASE:
        button_status = MB_RELEASED;
@@ -281,7 +281,7 @@ void SleepWhileUnmapped()
 
     NextEvent(&event);
 
-    switch(event.type)
+    switch (event.type)
     {
       case EVENT_BUTTONRELEASE:
        button_status = MB_RELEASED;
@@ -781,7 +781,7 @@ void HandleKey(Key key, int key_status)
       key = KSYM_UNDEFINED;
   }
 
-  switch(game_status)
+  switch (game_status)
   {
     case GAME_MODE_PSEUDO_TYPENAME:
       HandleTypeName(0, key);
@@ -793,7 +793,7 @@ void HandleKey(Key key, int key_status)
     case GAME_MODE_SETUP:
     case GAME_MODE_INFO:
     case GAME_MODE_SCORES:
-      switch(key)
+      switch (key)
       {
        case KSYM_space:
        case KSYM_Return:
@@ -864,7 +864,7 @@ void HandleKey(Key key, int key_status)
 
     case GAME_MODE_PLAYING:
     {
-      switch(key)
+      switch (key)
       {
         case KSYM_Escape:
          RequestQuitGame(setup.ask_on_escape);
@@ -1029,7 +1029,7 @@ void HandleJoystick()
   int dx       = (left ? -1    : right ? 1     : 0);
   int dy       = (up   ? -1    : down  ? 1     : 0);
 
-  switch(game_status)
+  switch (game_status)
   {
     case GAME_MODE_TITLE:
     case GAME_MODE_MAIN:
index 6148015ddeac6d4cc5a60ea170e91a66cb6e9303..2ed1121bab972f1986a5866eee5087d1c103ab7e 100644 (file)
@@ -2488,7 +2488,7 @@ void InitMovDir(int x, int y)
     { MV_LEFT,  MV_RIGHT, MV_UP, MV_DOWN }
   };
 
-  switch(element)
+  switch (element)
   {
     case EL_BUG_RIGHT:
     case EL_BUG_UP:
@@ -3922,7 +3922,7 @@ void Bang(int x, int y)
     }
   }
 
-  switch(element)
+  switch (element)
   {
     case EL_BUG:
     case EL_SPACESHIP:
@@ -7717,7 +7717,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
 
   /* ---------- execute action  -------------------------------------------- */
 
-  switch(action_type)
+  switch (action_type)
   {
     case CA_NO_ACTION:
     {
@@ -12384,7 +12384,7 @@ void RaiseScore(int value)
 
 void RaiseScoreElement(int element)
 {
-  switch(element)
+  switch (element)
   {
     case EL_EMERALD:
     case EL_BD_DIAMOND:
index ec16eeee4568f1b7c95a23b5d810a64c1edfcad9..3bbf74a75ad58af039a922e253a342f81aa523d4 100644 (file)
@@ -1781,6 +1781,8 @@ int get_parameter_value(char *value_raw, char *suffix, int type)
              string_has_parameter(value, "horizontal") ? ANIM_HORIZONTAL :
              string_has_parameter(value, "vertical")   ? ANIM_VERTICAL :
              string_has_parameter(value, "centered")   ? ANIM_CENTERED :
+             string_has_parameter(value, "fade")       ? ANIM_FADE :
+             string_has_parameter(value, "crossfade")  ? ANIM_CROSSFADE :
              ANIM_DEFAULT);
 
     if (string_has_parameter(value, "reverse"))
index 6fa176b434bcdbbe1f4b76ab5102d555fbc7639d..73d67f0bf165109b57fb8345720d14420f56f5bb 100644 (file)
 #define ANIM_VERTICAL          (1 << 11)
 #define ANIM_CENTERED          (1 << 12)
 #define ANIM_STATIC_PANEL      (1 << 13)
+#define ANIM_FADE              (1 << 14)
+#define ANIM_CROSSFADE         (1 << 15)
 
 #define ANIM_DEFAULT           ANIM_LOOP
 
index ac42d28c8af6428620f0d86699c334513fff72e5..e4d912ab2ecfdf5a82259fc06663e8082405308e 100644 (file)
@@ -4693,6 +4693,7 @@ struct TokenIntPtrInfo image_config_vars[] =
 
   { "menu.fade_delay",         &menu.fade_delay                              },
   { "menu.post_delay",         &menu.post_delay                              },
+  { "menu.auto_delay",         &menu.auto_delay                              },
 
   { "main.button.name.x",      &menu.main.button.name.x                      },
   { "main.button.name.y",      &menu.main.button.name.y                      },
index 4ef25ab1be6c72b0ef0a3c31284458bc52cb2c88..c77317238fbba2d8905978f5fc872105acf524ac 100644 (file)
@@ -1915,6 +1915,7 @@ struct MenuInfo
 
   int fade_delay;
   int post_delay;
+  int auto_delay;
 
   int sound[NUM_SPECIAL_GFX_ARGS];
   int music[NUM_SPECIAL_GFX_ARGS];
index 4e65cf3d293838016f2656625bd780f829d11b1d..a62cae02ccfec722f4e7d2b08e41a95c72e14e20 100644 (file)
@@ -740,7 +740,7 @@ void NetworkServer(int port, int serveronly)
            break;
          }
 
-         switch(buffer[1])
+         switch (buffer[1])
          {
            case OP_PLAYER_NAME:
              Handle_OP_PLAYER_NAME(player, len);
index 412d2bd820a842bf35d107bdebfa0325ae4cccc4..f2f1ea2829427fb807d0d04e945e9d5ba7d1a8af 100644 (file)
@@ -626,7 +626,7 @@ static void HandleNetworkingMessages()
     nread -= 4 + message_length;
     memmove(readbuffer, readbuffer + 4 + message_length, nread);
 
-    switch(buffer[1])
+    switch (buffer[1])
     {
       case OP_BAD_PROTOCOL_VERSION:
        Handle_OP_BAD_PROTOCOL_VERSION();
index ce3bbe47a3895349848f66661b9bced0833964a6..9c2ed1b1c8292d440503181694fdaec10701d9b3 100644 (file)
@@ -158,6 +158,9 @@ static void MapScreenMenuGadgets(int);
 static void MapScreenTreeGadgets(TreeInfo *);
 
 static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS];
+
+static boolean show_titlescreen_initial = TRUE;
+
 static int setup_mode = SETUP_MODE_MAIN;
 static int info_mode = INFO_MODE_MAIN;
 
@@ -512,11 +515,13 @@ static void DrawCursorAndText_Main(int pos, boolean active)
 
 static boolean insideMenuPosRect(struct MenuPosInfo *rect, int x, int y)
 {
+  if (rect == NULL)
+    return FALSE;
+
   int rect_x = ALIGNED_XPOS(rect->x, rect->width, rect->align);
   int rect_y = rect->y;
 
-  return (rect != NULL &&
-         x >= rect_x && x < rect_x + rect->width &&
+  return (x >= rect_x && x < rect_x + rect->width &&
          y >= rect_y && y < rect_y + rect->height);
 }
 
@@ -596,9 +601,15 @@ static int getLevelRangeTextPos()
 }
 #endif
 
+static int getTitleScreenGraphic()
+{
+  return (show_titlescreen_initial ? IMG_TITLESCREEN_INITIAL_1 :
+         IMG_TITLESCREEN_1);
+}
+
 void DrawTitleScreenImage(int nr)
 {
-  int graphic = IMG_TITLESCREEN_1 + nr;
+  int graphic = getTitleScreenGraphic() + nr;
   Bitmap *bitmap = graphic_info[graphic].bitmap;
   int width  = graphic_info[graphic].src_image_width;
   int height = graphic_info[graphic].src_image_height;
@@ -705,8 +716,10 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading)
 #endif
 
   if (setup.show_titlescreen &&
-      levelset_has_changed &&
-      graphic_info[IMG_TITLESCREEN_1].bitmap != NULL)
+      ((levelset_has_changed &&
+       graphic_info[IMG_TITLESCREEN_1].bitmap != NULL) ||
+       (show_titlescreen_initial &&
+       graphic_info[IMG_TITLESCREEN_INITIAL_1].bitmap != NULL)))
   {
     game_status = GAME_MODE_TITLE;
 
@@ -870,14 +883,18 @@ static void gotoTopLevelDir()
 
 void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
 {
+  static unsigned long title_delay = 0;
   static int title_nr = 0;
   boolean return_to_main_menu = FALSE;
   boolean use_fading_main_menu = TRUE;
-  boolean use_cross_fading = TRUE;
+  boolean use_cross_fading = !show_titlescreen_initial;                /* default */
+  int auto_delay = menu.auto_delay;
 
   if (button == MB_MENU_INITIALIZE)
   {
     int last_game_status = game_status;        /* save current game status */
+
+    title_delay = 0;
     title_nr = 0;
 
     if (game_status == GAME_MODE_INFO)
@@ -907,9 +924,19 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
 
     FadeIn(REDRAW_ALL);
 
+    DelayReached(&title_delay, 0);     /* reset delay counter */
+
     return;
   }
-  else if (button == MB_MENU_LEAVE)
+
+  int anim_delay = graphic_info[getTitleScreenGraphic() + title_nr].anim_delay;
+  if (anim_delay > 1)
+    auto_delay = anim_delay;
+
+  if (auto_delay > 0 && DelayReached(&title_delay, auto_delay))
+    button = MB_MENU_CHOICE;
+
+  if (button == MB_MENU_LEAVE)
   {
     return_to_main_menu = TRUE;
     use_fading_main_menu = FALSE;
@@ -927,11 +954,26 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
 
     title_nr++;
 
+    if (show_titlescreen_initial &&
+       (title_nr >= MAX_NUM_TITLE_SCREENS ||
+        graphic_info[IMG_TITLESCREEN_INITIAL_1 + title_nr].bitmap == NULL))
+    {
+      show_titlescreen_initial = FALSE;
+
+      title_nr = 0;    /* restart with title screens for current level set */
+    }
+
+    int anim_mode = graphic_info[getTitleScreenGraphic() + title_nr].anim_mode;
+
+    use_cross_fading = (anim_mode == ANIM_FADE ? FALSE :
+                       anim_mode == ANIM_CROSSFADE ? TRUE :
+                       use_cross_fading);
+
     if (!use_cross_fading)
       FadeOut(REDRAW_ALL);
 
     if (title_nr < MAX_NUM_TITLE_SCREENS &&
-       graphic_info[IMG_TITLESCREEN_1 + title_nr].bitmap != NULL)
+       graphic_info[getTitleScreenGraphic() + title_nr].bitmap != NULL)
     {
       if (use_cross_fading)
        FadeCrossSaveBackbuffer();
@@ -942,6 +984,8 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
        FadeCross(REDRAW_ALL);
       else
        FadeIn(REDRAW_ALL);
+
+      DelayReached(&title_delay, 0);   /* reset delay counter */
     }
     else
     {
@@ -3275,7 +3319,7 @@ static Key getSetupKey()
 
       NextEvent(&event);
 
-      switch(event.type)
+      switch (event.type)
       {
         case EVENT_KEYPRESS:
          {
@@ -4020,7 +4064,7 @@ void CustomizeKeyboard(int player_nr)
 
       NextEvent(&event);
 
-      switch(event.type)
+      switch (event.type)
       {
         case EVENT_KEYPRESS:
          {
@@ -4170,10 +4214,10 @@ static boolean CalibrateJoystickMain(int player_nr)
 
       NextEvent(&event);
 
-      switch(event.type)
+      switch (event.type)
       {
        case EVENT_KEYPRESS:
-         switch(GetEventKey((KeyEvent *)&event, TRUE))
+         switch (GetEventKey((KeyEvent *)&event, TRUE))
          {
            case KSYM_Return:
              if (check_remaining == 0)
index 41ed06d693d078aa0c8d52cdce9efa773474f012..f6441aa09f642e09c758435eaa345639a5d91c15 100644 (file)
@@ -2602,7 +2602,7 @@ boolean Request(char *text, unsigned int req_state)
 
       NextEvent(&event);
 
-      switch(event.type)
+      switch (event.type)
       {
        case EVENT_BUTTONPRESS:
        case EVENT_BUTTONRELEASE:
@@ -2634,7 +2634,7 @@ boolean Request(char *text, unsigned int req_state)
          /* this sets 'request_gadget_id' */
          HandleGadgets(mx, my, button_status);
 
-         switch(request_gadget_id)
+         switch (request_gadget_id)
          {
            case TOOL_CTRL_ID_YES:
              result = TRUE;
@@ -2667,7 +2667,7 @@ boolean Request(char *text, unsigned int req_state)
        }
 
        case EVENT_KEYPRESS:
-         switch(GetEventKey((KeyEvent *)&event, TRUE))
+         switch (GetEventKey((KeyEvent *)&event, TRUE))
          {
            case KSYM_Return:
              result = 1;
@@ -5341,7 +5341,7 @@ int map_direction_EM_to_RND(int direction)
 
 int get_next_element(int element)
 {
-  switch(element)
+  switch (element)
   {
     case EL_QUICKSAND_FILLING:         return EL_QUICKSAND_FULL;
     case EL_QUICKSAND_EMPTYING:                return EL_QUICKSAND_EMPTY;