rnd-20030208-3-src
[rocksndiamonds.git] / src / screens.c
index 6b827227a475f18092487526206245d940529f86..830834d85cb6884341295781b1aed872d6d64344 100644 (file)
@@ -114,12 +114,35 @@ static void drawCursorXY(int xpos, int ypos, int graphic)
   drawCursorExt(xpos, ypos, -1, graphic);
 }
 
+static void PlaySound_Menu_Start(int sound)
+{
+  if (sound_info[sound].loop)
+    PlaySoundLoop(sound);
+  else
+    PlaySound(sound);
+}
+
+static void PlaySound_Menu_Continue(int sound)
+{
+  if (sound_info[sound].loop)
+    PlaySoundLoop(sound);
+}
+
+void DrawTextStatic(int x, int y, char *text, int font_size, int font_type)
+{
+  if (game_status == MAINMENU && gfx.menu_main_hide_static_text)
+    return;
+
+  DrawText(x, y, text, font_size, font_type);
+}
+
 void DrawHeadline()
 {
-  int x = SX + (SXSIZE - strlen(PROGRAM_TITLE_STRING) * FONT1_XSIZE) / 2;
+  int x1 = SX + (SXSIZE - strlen(PROGRAM_TITLE_STRING)   * FONT1_XSIZE) / 2;
+  int x2 = SX + (SXSIZE - strlen(WINDOW_SUBTITLE_STRING) * FONT2_XSIZE) / 2;
 
-  DrawText(x, SY + 8, PROGRAM_TITLE_STRING, FS_BIG, FC_YELLOW);
-  DrawTextFCentered(46, FC_RED, WINDOW_SUBTITLE_STRING);
+  DrawTextStatic(x1, SY + 8,  PROGRAM_TITLE_STRING,   FS_BIG,   FC_YELLOW);
+  DrawTextStatic(x2, SY + 46, WINDOW_SUBTITLE_STRING, FS_SMALL, FC_RED);
 }
 
 static void ToggleFullscreenIfNeeded()
@@ -135,7 +158,7 @@ static void ToggleFullscreenIfNeeded()
     setup.fullscreen = video.fullscreen_enabled;
 
     /* redraw background to newly created backbuffer */
-    BlitBitmap(new_graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer,
+    BlitBitmap(graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer,
               0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
 
     /* restore old door content */
@@ -201,22 +224,22 @@ void DrawMainMenu()
   GetPlayerConfig();
   LoadLevel(level_nr);
 
-  SetMainBackgroundBitmap(new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
+  SetMainBackgroundImage(IMG_BACKGROUND_MAIN);
   ClearWindow();
 
   DrawHeadline();
 
-  DrawText(SX + 32,    SY + 2*32, name_text, FS_BIG, FC_GREEN);
+  DrawTextStatic(SX + 32,    SY + 2*32, name_text, FS_BIG, FC_GREEN);
   DrawText(SX + 6*32,  SY + 2*32, setup.player_name, FS_BIG, FC_RED);
-  DrawText(SX + 32,    SY + 3*32, "Level:", FS_BIG, FC_GREEN);
+  DrawTextStatic(SX + 32,    SY + 3*32, "Level:", FS_BIG, FC_GREEN);
   DrawText(SX + 11*32, SY + 3*32, int2str(level_nr,3), FS_BIG,
           (leveldir_current->readonly ? FC_RED : FC_YELLOW));
-  DrawText(SX + 32,    SY + 4*32, "Hall Of Fame", FS_BIG, FC_GREEN);
-  DrawText(SX + 32,    SY + 5*32, "Level Creator", FS_BIG, FC_GREEN);
-  DrawText(SY + 32,    SY + 6*32, "Info Screen", FS_BIG, FC_GREEN);
-  DrawText(SX + 32,    SY + 7*32, "Start Game", FS_BIG, FC_GREEN);
-  DrawText(SX + 32,    SY + 8*32, "Setup", FS_BIG, FC_GREEN);
-  DrawText(SX + 32,    SY + 9*32, "Quit", FS_BIG, FC_GREEN);
+  DrawTextStatic(SX + 32,    SY + 4*32, "Hall Of Fame", FS_BIG, FC_GREEN);
+  DrawTextStatic(SX + 32,    SY + 5*32, "Level Creator", FS_BIG, FC_GREEN);
+  DrawTextStatic(SY + 32,    SY + 6*32, "Info Screen", FS_BIG, FC_GREEN);
+  DrawTextStatic(SX + 32,    SY + 7*32, "Start Game", FS_BIG, FC_GREEN);
+  DrawTextStatic(SX + 32,    SY + 8*32, "Setup", FS_BIG, FC_GREEN);
+  DrawTextStatic(SX + 32,    SY + 9*32, "Quit", FS_BIG, FC_GREEN);
 
   DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, TRUE);
 
@@ -241,8 +264,8 @@ void DrawMainMenu()
   drawCursorXY(14, 1, IMG_ARROW_BLUE_RIGHT);
 #endif
 
-  DrawText(SX + 56, SY + 326, "A Game by Artsoft Entertainment",
-          FS_SMALL, FC_RED);
+  DrawTextStatic(SX + 56, SY + 326, "A Game by Artsoft Entertainment",
+                FS_SMALL, FC_RED);
 
   if (leveldir_current->name)
   {
@@ -575,12 +598,12 @@ static int OLD_helpscreen_action[] =
 
 static int helpscreen_action[] =
 {
-  IMG_PLAYER1_DOWN_MOVING,             16,
-  IMG_PLAYER1_UP_MOVING,               16,
-  IMG_PLAYER1_LEFT_MOVING,             16,
-  IMG_PLAYER1_RIGHT_MOVING,            16,
-  IMG_PLAYER1_LEFT_PUSHING,            16,
-  IMG_PLAYER1_RIGHT_PUSHING,           16,                     HA_NEXT,
+  IMG_PLAYER1_MOVING_DOWN,             16,
+  IMG_PLAYER1_MOVING_UP,               16,
+  IMG_PLAYER1_MOVING_LEFT,             16,
+  IMG_PLAYER1_MOVING_RIGHT,            16,
+  IMG_PLAYER1_PUSHING_LEFT,            16,
+  IMG_PLAYER1_PUSHING_RIGHT,           16,                     HA_NEXT,
 
   IMG_SAND,                            -1,                     HA_NEXT,
 
@@ -713,25 +736,25 @@ static int helpscreen_action[] =
 
   IMG_ROBOT,                           -1,                     HA_NEXT,
 
-  IMG_MOLE_RIGHT_MOVING,               16,
-  IMG_MOLE_UP_MOVING,                  16,
-  IMG_MOLE_LEFT_MOVING,                        16,
-  IMG_MOLE_DOWN_MOVING,                        16,                     HA_NEXT,
+  IMG_MOLE_MOVING_RIGHT,               16,
+  IMG_MOLE_MOVING_UP,                  16,
+  IMG_MOLE_MOVING_LEFT,                        16,
+  IMG_MOLE_MOVING_DOWN,                        16,                     HA_NEXT,
 
-  IMG_PENGUIN_RIGHT_MOVING,            16,
-  IMG_PENGUIN_UP_MOVING,               16,
-  IMG_PENGUIN_LEFT_MOVING,             16,
-  IMG_PENGUIN_DOWN_MOVING,             16,                     HA_NEXT,
+  IMG_PENGUIN_MOVING_RIGHT,            16,
+  IMG_PENGUIN_MOVING_UP,               16,
+  IMG_PENGUIN_MOVING_LEFT,             16,
+  IMG_PENGUIN_MOVING_DOWN,             16,                     HA_NEXT,
 
-  IMG_PIG_RIGHT_MOVING,                        16,
-  IMG_PIG_UP_MOVING,                   16,
-  IMG_PIG_LEFT_MOVING,                 16,
-  IMG_PIG_DOWN_MOVING,                 16,                     HA_NEXT,
+  IMG_PIG_MOVING_RIGHT,                        16,
+  IMG_PIG_MOVING_UP,                   16,
+  IMG_PIG_MOVING_LEFT,                 16,
+  IMG_PIG_MOVING_DOWN,                 16,                     HA_NEXT,
 
-  IMG_DRAGON_RIGHT_MOVING,             16,
-  IMG_DRAGON_UP_MOVING,                        16,
-  IMG_DRAGON_LEFT_MOVING,              16,
-  IMG_DRAGON_DOWN_MOVING,              16,                     HA_NEXT,
+  IMG_DRAGON_MOVING_RIGHT,             16,
+  IMG_DRAGON_MOVING_UP,                        16,
+  IMG_DRAGON_MOVING_LEFT,              16,
+  IMG_DRAGON_MOVING_DOWN,              16,                     HA_NEXT,
 
   IMG_SATELLITE,                       -1,                     HA_NEXT,
 
@@ -1008,6 +1031,7 @@ void DrawHelpScreenElText(int start)
   int xstart = SX + 56, ystart = SY + 65 + 2 * 32, ystep = TILEY + 4;
   int ybottom = SYSIZE - 20;
 
+  SetMainBackgroundImage(IMG_BACKGROUND_INFO);
   ClearWindow();
   DrawHeadline();
 
@@ -1131,12 +1155,18 @@ void DrawHelpScreen()
     helpscreen_step[i] = helpscreen_frame[i] = 0;
   helpscreen_musicpos = 0;
   helpscreen_state = 0;
+
   DrawHelpScreenElText(0);
   DrawHelpScreenElAction(0);
 
   FadeToFront();
   InitAnimation();
+
+#if 0
   PlaySoundLoop(SND_MENU_INFO_SCREEN);
+#else
+  PlaySound_Menu_Start(SND_MENU_INFO_SCREEN);
+#endif
 }
 
 void HandleHelpScreen(int button)
@@ -1195,7 +1225,11 @@ void HandleHelpScreen(int button)
     /* !!! workaround for playing "music" that is really a sound loop (and
        must therefore periodically be reactivated with the current sound
        engine !!! */
+#if 0
     PlaySoundLoop(SND_MENU_INFO_SCREEN);
+#else
+    PlaySound_Menu_Continue(SND_MENU_INFO_SCREEN);
+#endif
 
     DoAnimation();
   }
@@ -1262,6 +1296,7 @@ static void DrawChooseTree(TreeInfo **ti_ptr)
   CloseDoor(DOOR_CLOSE_2);
 
   ClearWindow();
+
   HandleChooseTree(0,0, 0,0, MB_MENU_INITIALIZE, ti_ptr);
   MapChooseTreeGadgets(*ti_ptr);
 
@@ -1576,6 +1611,8 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
 
 void DrawChooseLevel()
 {
+  SetMainBackgroundImage(IMG_BACKGROUND_LEVEL_SERIES);
+
   DrawChooseTree(&leveldir_current);
 }
 
@@ -1595,15 +1632,23 @@ void DrawHallOfFame(int highlight_position)
 
   FadeToFront();
   InitAnimation();
+
   HandleHallOfFame(highlight_position,0, 0,0, MB_MENU_INITIALIZE);
+
+#if 0
   PlaySound(SND_MENU_HALL_OF_FAME);
+#else
+  PlaySound_Menu_Start(SND_MENU_HALL_OF_FAME);
+#endif
 }
 
 static void drawHallOfFameList(int first_entry, int highlight_position)
 {
   int i;
 
+  SetMainBackgroundImage(IMG_BACKGROUND_HALL_OF_FAME);
   ClearWindow();
+
   DrawText(SX + 80, SY + 8, "Hall Of Fame", FS_BIG, FC_YELLOW);
   DrawTextFCentered(46, FC_RED, "HighScores of Level %d", level_nr);
 
@@ -1682,7 +1727,12 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
   BackToFront();
 
   if (game_status == HALLOFFAME)
+  {
     DoAnimation();
+#if 1
+    PlaySound_Menu_Continue(SND_MENU_HALL_OF_FAME);
+#endif
+  }
 }
 
 
@@ -2008,6 +2058,7 @@ static void DrawSetupScreen_Generic()
 
   UnmapAllGadgets();
   CloseDoor(DOOR_CLOSE_2);
+
   ClearWindow();
 
   if (setup_mode == SETUP_MODE_MAIN)
@@ -2184,6 +2235,7 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
 void DrawSetupScreen_Input()
 {
   ClearWindow();
+
   DrawText(SX+16, SY+16, "Setup Input", FS_BIG, FC_YELLOW);
 
   initCursor(0, IMG_BALL_BLUE);
@@ -2753,6 +2805,8 @@ void DrawSetupScreen()
 {
   DeactivateJoystick();
 
+  SetMainBackgroundImage(IMG_BACKGROUND_SETUP);
+
   if (setup_mode == SETUP_MODE_INPUT)
     DrawSetupScreen_Input();
   else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS)
@@ -2888,12 +2942,12 @@ static void CreateScreenScrollbuttons()
 
     gfx_unpressed = scrollbutton_info[i].gfx_unpressed;
     gfx_pressed   = scrollbutton_info[i].gfx_pressed;
-    gd_bitmap_unpressed = new_graphic_info[gfx_unpressed].bitmap;
-    gd_bitmap_pressed   = new_graphic_info[gfx_pressed].bitmap;
-    gd_x1 = new_graphic_info[gfx_unpressed].src_x;
-    gd_y1 = new_graphic_info[gfx_unpressed].src_y;
-    gd_x2 = new_graphic_info[gfx_pressed].src_x;
-    gd_y2 = new_graphic_info[gfx_pressed].src_y;
+    gd_bitmap_unpressed = graphic_info[gfx_unpressed].bitmap;
+    gd_bitmap_pressed   = graphic_info[gfx_pressed].bitmap;
+    gd_x1 = graphic_info[gfx_unpressed].src_x;
+    gd_y1 = graphic_info[gfx_unpressed].src_y;
+    gd_x2 = graphic_info[gfx_pressed].src_x;
+    gd_y2 = graphic_info[gfx_pressed].src_y;
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
                      GDI_CUSTOM_TYPE_ID, i,
@@ -2950,12 +3004,12 @@ static void CreateScreenScrollbars()
 #else
     gfx_unpressed = scrollbar_info[i].gfx_unpressed;
     gfx_pressed   = scrollbar_info[i].gfx_pressed;
-    gd_bitmap_unpressed = new_graphic_info[gfx_unpressed].bitmap;
-    gd_bitmap_pressed   = new_graphic_info[gfx_pressed].bitmap;
-    gd_x1 = new_graphic_info[gfx_unpressed].src_x;
-    gd_y1 = new_graphic_info[gfx_unpressed].src_y;
-    gd_x2 = new_graphic_info[gfx_pressed].src_x;
-    gd_y2 = new_graphic_info[gfx_pressed].src_y;
+    gd_bitmap_unpressed = graphic_info[gfx_unpressed].bitmap;
+    gd_bitmap_pressed   = graphic_info[gfx_pressed].bitmap;
+    gd_x1 = graphic_info[gfx_unpressed].src_x;
+    gd_y1 = graphic_info[gfx_unpressed].src_y;
+    gd_x2 = graphic_info[gfx_pressed].src_x;
+    gd_y2 = graphic_info[gfx_pressed].src_y;
 #endif
 
     gi = CreateGadget(GDI_CUSTOM_ID, id,
@@ -2995,14 +3049,14 @@ void CreateScreenGadgets()
 
     /* copy pointers to clip mask and GC */
     scrollbar_bitmap[i]->clip_mask =
-      new_graphic_info[IMG_SCROLLBAR_BLUE + i].clip_mask;
+      graphic_info[IMG_SCROLLBAR_BLUE + i].clip_mask;
     scrollbar_bitmap[i]->stored_clip_gc =
-      new_graphic_info[IMG_SCROLLBAR_BLUE + i].clip_gc;
+      graphic_info[IMG_SCROLLBAR_BLUE + i].clip_gc;
 
-    BlitBitmap(new_graphic_info[IMG_SCROLLBAR_BLUE + i].bitmap,
+    BlitBitmap(graphic_info[IMG_SCROLLBAR_BLUE + i].bitmap,
               scrollbar_bitmap[i],
-              new_graphic_info[IMG_SCROLLBAR_BLUE + i].src_x,
-              new_graphic_info[IMG_SCROLLBAR_BLUE + i].src_y,
+              graphic_info[IMG_SCROLLBAR_BLUE + i].src_x,
+              graphic_info[IMG_SCROLLBAR_BLUE + i].src_y,
               TILEX, TILEY, 0, 0);
   }
 #endif