rnd-20031129-1-src
[rocksndiamonds.git] / src / screens.c
index 328f6893317dc40b33d415870aa333ac140633d5..ec0a1231b4573c329886272d7e9127e7dbc629ea 100644 (file)
@@ -291,9 +291,9 @@ void DrawMainMenu()
 
   if (leveldir_current->readonly)
   {
-    DrawTextF(mSX + level_width + 9 * 32 - 2,
+    DrawTextS(mSX + level_width + 9 * 32 - 2,
              mSY + 3 * 32 + 1 - 7, FONT_TEXT_3, "READ");
-    DrawTextF(mSX + level_width + 9 * 32 - 2,
+    DrawTextS(mSX + level_width + 9 * 32 - 2,
              mSY + 3 * 32 + 1 + 7, FONT_TEXT_3, "ONLY");
   }
 
@@ -812,7 +812,7 @@ static int num_helpscreen_music = 7;
 static int helpscreen_musicpos;
 
 #if 1
-void DrawHelpScreenElAction(int start)
+void DrawHelpScreenElAction(int start, boolean init)
 {
   int i = 0, j = 0;
   int xstart = mSX + 16;
@@ -823,13 +823,25 @@ void DrawHelpScreenElAction(int start)
   int delay;
   int sync_frame;
 
-  while (info_animation_info[j].element != -999)
+  if (init)
+  {
+    SetMainBackgroundImage(IMG_BACKGROUND_INFO);
+    ClearWindow();
+    DrawHeadline();
+
+    DrawTextSCentered(100, FONT_TEXT_1, "The game elements:");
+
+    DrawTextSCentered(SYSIZE - 20, FONT_TEXT_4,
+                     "Press any key or button for next page");
+  }
+
+  while (demo_anim_info[j].element != -999)
   {
     if (i >= start + MAX_HELPSCREEN_ELS || i >= num_helpscreen_els)
       break;
     else if (i < start)
     {
-      while (info_animation_info[j].element != -1)
+      while (demo_anim_info[j].element != -1)
        j++;
 
       j++;
@@ -840,9 +852,9 @@ void DrawHelpScreenElAction(int start)
 
     j += helpscreen_step[i - start];
 
-    element = info_animation_info[j].element;
-    action = info_animation_info[j].action;
-    direction = info_animation_info[j].direction;
+    element = demo_anim_info[j].element;
+    action = demo_anim_info[j].action;
+    direction = demo_anim_info[j].direction;
 
     if (action != -1 && direction != -1)
       graphic = el_act_dir2img(element, action, direction);
@@ -853,7 +865,7 @@ void DrawHelpScreenElAction(int start)
     else
       graphic = el2img(element);
 
-    delay = info_animation_info[j++].delay;
+    delay = demo_anim_info[j++].delay;
 
     if (delay == -1)
       delay = 1000000;
@@ -869,7 +881,7 @@ void DrawHelpScreenElAction(int start)
       helpscreen_frame[i - start]--;
     }
 
-    if (info_animation_info[j].element == -1)
+    if (demo_anim_info[j].element == -1)
     {
       if (!helpscreen_frame[i - start])
        helpscreen_step[i - start] = 0;
@@ -878,7 +890,7 @@ void DrawHelpScreenElAction(int start)
     {
       if (!helpscreen_frame[i - start])
        helpscreen_step[i - start]++;
-      while(info_animation_info[j].element != -1)
+      while(demo_anim_info[j].element != -1)
        j++;
     }
 
@@ -889,6 +901,9 @@ void DrawHelpScreenElAction(int start)
     DrawGraphicAnimationExt(drawto, xstart, ystart + (i - start) * ystep,
                            graphic, sync_frame, USE_MASKING);
 
+    if (init)
+      DrawHelpScreenElText(element, action, direction, i - start);
+
     i++;
   }
 
@@ -984,6 +999,63 @@ void DrawHelpScreenElAction(int start)
 }
 #endif
 
+#if 1
+void DrawHelpScreenElText(int element, int action, int direction, int ypos)
+{
+  int xstart = mSX + 56;
+  int ystart = mSY + 65 + 2 * 32;
+  int ystep = TILEY + 4;
+  char *text;
+
+  text = getHashEntry(demo_anim_text, element_info[element].token_name);
+
+  if (text == NULL)
+  {
+    char token[MAX_LINE_LEN];
+
+    strcpy(token, element_info[element].token_name);
+
+    if (action != -1)
+      strcat(token, element_action_info[action].suffix);
+
+    if (direction != -1)
+      strcat(token, element_direction_info[MV_DIR_BIT(direction)].suffix);
+
+    text = getHashEntry(demo_anim_text, token);
+
+    if (text == NULL)
+      text = "No description available";
+  }
+
+#if 1
+
+#if 1
+
+  if (strlen(text) <= 34)
+    ystart += getFontHeight(FONT_TEXT_2) / 2;
+
+#if 0
+  DrawTextWrapped(xstart, ystart+1 + ypos * ystep, text, FONT_LEVEL_NUMBER,
+                 34, 2);
+#else
+  DrawTextWrapped(xstart, ystart+1 + ypos * ystep, text, FONT_TEXT_2, 34, 2);
+#endif
+
+#else
+  DrawTextToTextArea(xstart, ystart + ypos * ystep, text, FONT_TEXT_2, 34,
+                    34, 2, BLIT_ON_BACKGROUND);
+#endif
+
+#else
+  if (strlen(text) > 25)
+    text[25] = '\0';
+
+  DrawText(xstart, ystart + ypos * ystep + 8, text, FONT_TEXT_2);
+#endif
+}
+
+#else
+
 void DrawHelpScreenElText(int start)
 {
   int i;
@@ -994,7 +1066,7 @@ void DrawHelpScreenElText(int start)
   ClearWindow();
   DrawHeadline();
 
-  DrawTextFCentered(100, FONT_TEXT_1, "The game elements:");
+  DrawTextSCentered(100, FONT_TEXT_1, "The game elements:");
 
   for(i=start; i < start + MAX_HELPSCREEN_ELS && i < num_helpscreen_els; i++)
   {
@@ -1005,9 +1077,10 @@ void DrawHelpScreenElText(int start)
             helpscreen_eltext[i][1], FONT_TEXT_2);
   }
 
-  DrawTextFCentered(ybottom, FONT_TEXT_4,
+  DrawTextSCentered(ybottom, FONT_TEXT_4,
                    "Press any key or button for next page");
 }
+#endif
 
 void DrawHelpScreenMusicText(int num)
 {
@@ -1023,28 +1096,28 @@ void DrawHelpScreenMusicText(int num)
   ClearWindow();
   DrawHeadline();
 
-  DrawTextFCentered(100, FONT_TEXT_1, "The game background music loops:");
+  DrawTextSCentered(100, FONT_TEXT_1, "The game background music loops:");
 
 #if 1
-  DrawTextFCentered(ystart + 0 * ystep, FONT_TEXT_2, "Excerpt from");
+  DrawTextSCentered(ystart + 0 * ystep, FONT_TEXT_2, "Excerpt from");
   DrawTextFCentered(ystart + 1 * ystep, FONT_TEXT_3, "\"%s\"", list->title);
-  DrawTextFCentered(ystart + 2 * ystep, FONT_TEXT_2, "by");
+  DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_2, "by");
   DrawTextFCentered(ystart + 3 * ystep, FONT_TEXT_3, "%s", list->artist);
-  DrawTextFCentered(ystart + 4 * ystep, FONT_TEXT_2, "from the album");
+  DrawTextSCentered(ystart + 4 * ystep, FONT_TEXT_2, "from the album");
   DrawTextFCentered(ystart + 5 * ystep, FONT_TEXT_3, "\"%s\"", list->album);
 #else
-  DrawTextFCentered(ystart + 0 * ystep, FONT_TEXT_2, "Excerpt from");
+  DrawTextSCentered(ystart + 0 * ystep, FONT_TEXT_2, "Excerpt from");
   DrawTextFCentered(ystart + 1 * ystep, FONT_TEXT_3,
                    "\"%s\"", helpscreen_music[num][0]);
-  DrawTextFCentered(ystart + 2 * ystep, FONT_TEXT_2, "by");
+  DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_2, "by");
   DrawTextFCentered(ystart + 3 * ystep, FONT_TEXT_3,
                    "%s", helpscreen_music[num][1]);
-  DrawTextFCentered(ystart + 4 * ystep, FONT_TEXT_2, "from the album");
+  DrawTextSCentered(ystart + 4 * ystep, FONT_TEXT_2, "from the album");
   DrawTextFCentered(ystart + 5 * ystep, FONT_TEXT_3,
                    "\"%s\"", helpscreen_music[num][2]);
 #endif
 
-  DrawTextFCentered(ybottom, FONT_TEXT_4,
+  DrawTextSCentered(ybottom, FONT_TEXT_4,
                    "Press any key or button for next page");
 
 #if 0
@@ -1061,16 +1134,16 @@ void DrawHelpScreenCreditsText()
   ClearWindow();
   DrawHeadline();
 
-  DrawTextFCentered(100, FONT_TEXT_1, "Credits:");
-  DrawTextFCentered(ystart + 0 * ystep, FONT_TEXT_2, "DOS port of the game:");
-  DrawTextFCentered(ystart + 1 * ystep, FONT_TEXT_3, "Guido Schulz");
-  DrawTextFCentered(ystart + 2 * ystep, FONT_TEXT_2, "Additional toons:");
-  DrawTextFCentered(ystart + 3 * ystep, FONT_TEXT_3, "Karl Hörnell");
-  DrawTextFCentered(ystart + 5 * ystep, FONT_TEXT_2,
+  DrawTextSCentered(100, FONT_TEXT_1, "Credits:");
+  DrawTextSCentered(ystart + 0 * ystep, FONT_TEXT_2, "DOS port of the game:");
+  DrawTextSCentered(ystart + 1 * ystep, FONT_TEXT_3, "Guido Schulz");
+  DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_2, "Additional toons:");
+  DrawTextSCentered(ystart + 3 * ystep, FONT_TEXT_3, "Karl Hörnell");
+  DrawTextSCentered(ystart + 5 * ystep, FONT_TEXT_2,
                    "...and many thanks to all contributors");
-  DrawTextFCentered(ystart + 6 * ystep, FONT_TEXT_2, "of new levels!");
+  DrawTextSCentered(ystart + 6 * ystep, FONT_TEXT_2, "of new levels!");
 
-  DrawTextFCentered(ybottom, FONT_TEXT_4,
+  DrawTextSCentered(ybottom, FONT_TEXT_4,
                    "Press any key or button for next page");
 }
 
@@ -1082,33 +1155,33 @@ void DrawHelpScreenContactText()
   ClearWindow();
   DrawHeadline();
 
-  DrawTextFCentered(100, FONT_TEXT_1, "Program information:");
+  DrawTextSCentered(100, FONT_TEXT_1, "Program information:");
 
-  DrawTextFCentered(ystart + 0 * ystep, FONT_TEXT_2,
+  DrawTextSCentered(ystart + 0 * ystep, FONT_TEXT_2,
                    "This game is Freeware!");
-  DrawTextFCentered(ystart + 1 * ystep, FONT_TEXT_2,
+  DrawTextSCentered(ystart + 1 * ystep, FONT_TEXT_2,
                    "If you like it, send e-mail to:");
-  DrawTextFCentered(ystart + 2 * ystep, FONT_TEXT_3,
+  DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_3,
                    "info@artsoft.org");
-  DrawTextFCentered(ystart + 3 * ystep, FONT_TEXT_2,
+  DrawTextSCentered(ystart + 3 * ystep, FONT_TEXT_2,
                    "or SnailMail to:");
-  DrawTextFCentered(ystart + 4 * ystep + 0, FONT_TEXT_3,
+  DrawTextSCentered(ystart + 4 * ystep + 0, FONT_TEXT_3,
                    "Holger Schemel");
-  DrawTextFCentered(ystart + 4 * ystep + 20, FONT_TEXT_3,
+  DrawTextSCentered(ystart + 4 * ystep + 20, FONT_TEXT_3,
                    "Detmolder Strasse 189");
-  DrawTextFCentered(ystart + 4 * ystep + 40, FONT_TEXT_3,
+  DrawTextSCentered(ystart + 4 * ystep + 40, FONT_TEXT_3,
                    "33604 Bielefeld");
-  DrawTextFCentered(ystart + 4 * ystep + 60, FONT_TEXT_3,
+  DrawTextSCentered(ystart + 4 * ystep + 60, FONT_TEXT_3,
                    "Germany");
 
-  DrawTextFCentered(ystart + 7 * ystep, FONT_TEXT_2,
+  DrawTextSCentered(ystart + 7 * ystep, FONT_TEXT_2,
                    "If you have created new levels,");
-  DrawTextFCentered(ystart + 8 * ystep, FONT_TEXT_2,
+  DrawTextSCentered(ystart + 8 * ystep, FONT_TEXT_2,
                    "send them to me to include them!");
-  DrawTextFCentered(ystart + 9 * ystep, FONT_TEXT_2,
+  DrawTextSCentered(ystart + 9 * ystep, FONT_TEXT_2,
                    ":-)");
 
-  DrawTextFCentered(ybottom, FONT_TEXT_4,
+  DrawTextSCentered(ybottom, FONT_TEXT_4,
                    "Press any key or button for main menu");
 }
 
@@ -1125,20 +1198,23 @@ void DrawHelpScreen()
   helpscreen_musicpos = 0;
   helpscreen_state = 0;
 
-  LoadInfoAnimations();
+  LoadDemoAnimInfo();
+  LoadDemoAnimText();
   LoadMusicInfo();
 
   num_helpscreen_els = 0;
-  for (i=0; info_animation_info[i].element != -999; i++)
-    if (info_animation_info[i].element == -1)
+  for (i=0; demo_anim_info[i].element != -999; i++)
+    if (demo_anim_info[i].element == -1)
       num_helpscreen_els++;
 
   num_helpscreen_music = 0;
   for (list = music_file_info; list != NULL; list = list->next)
     num_helpscreen_music++;
 
+  DrawHelpScreenElAction(0, TRUE);
+#if 0
   DrawHelpScreenElText(0);
-  DrawHelpScreenElAction(0);
+#endif
 
   FadeToFront();
   InitAnimation();
@@ -1164,8 +1240,10 @@ void HandleHelpScreen(int button)
       helpscreen_state++;
 
       FrameCounter = 0;
+      DrawHelpScreenElAction(helpscreen_state * MAX_HELPSCREEN_ELS, TRUE);
+#if 0
       DrawHelpScreenElText(helpscreen_state * MAX_HELPSCREEN_ELS);
-      DrawHelpScreenElAction(helpscreen_state * MAX_HELPSCREEN_ELS);
+#endif
     }
     else if (helpscreen_state <
             num_helpscreen_els_pages + num_helpscreen_music - 1)
@@ -1198,7 +1276,7 @@ void HandleHelpScreen(int button)
     if (DelayReached(&hs_delay, GAME_FRAME_DELAY))
     {
       if (helpscreen_state < num_helpscreen_els_pages)
-       DrawHelpScreenElAction(helpscreen_state * MAX_HELPSCREEN_ELS);
+       DrawHelpScreenElAction(helpscreen_state * MAX_HELPSCREEN_ELS, FALSE);
     }
 
     PlayMenuSoundIfLoop();
@@ -2261,7 +2339,7 @@ void DrawSetupScreen_Input()
 
 #if 0
   DeactivateJoystickForCalibration();
-  DrawTextFCentered(SYSIZE - 20, FONT_TEXT_4,
+  DrawTextSCentered(SYSIZE - 20, FONT_TEXT_4,
                    "Joysticks deactivated on this screen");
 #endif