projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added dynamic default screen position for button to show level set info
[rocksndiamonds.git]
/
src
/
screens.c
diff --git
a/src/screens.c
b/src/screens.c
index 394f52927f2b40a1c66251e8890a6ff367f87b89..d986f8d96a164c12258cb1f6532278d95fa9f490 100644
(file)
--- a/
src/screens.c
+++ b/
src/screens.c
@@
-131,8
+131,11
@@
#define MENU_CHOOSE_TREE_FONT(x) (FONT_TEXT_1 + (x))
#define MENU_CHOOSE_TREE_COLOR(ti, a) TREE_COLOR(ti, a)
#define MENU_CHOOSE_TREE_FONT(x) (FONT_TEXT_1 + (x))
#define MENU_CHOOSE_TREE_COLOR(ti, a) TREE_COLOR(ti, a)
-#define TEXT_
NEXT_PAGE "Press any key or button for next page
"
+#define TEXT_
MAIN_MENU "Press any key or button for main menu
"
#define TEXT_INFO_MENU "Press any key or button for info menu"
#define TEXT_INFO_MENU "Press any key or button for info menu"
+#define TEXT_NEXT_PAGE "Press any key or button for next page"
+#define TEXT_NEXT_MENU (info_screens_from_main ? \
+ TEXT_MAIN_MENU : TEXT_INFO_MENU)
// for input setup functions
#define SETUPINPUT_SCREEN_POS_START 0
// for input setup functions
#define SETUPINPUT_SCREEN_POS_START 0
@@
-200,20
+203,21
@@
#define SCREEN_CTRL_ID_NEXT_PLAYER 11
#define SCREEN_CTRL_ID_INSERT_SOLUTION 12
#define SCREEN_CTRL_ID_PLAY_SOLUTION 13
#define SCREEN_CTRL_ID_NEXT_PLAYER 11
#define SCREEN_CTRL_ID_INSERT_SOLUTION 12
#define SCREEN_CTRL_ID_PLAY_SOLUTION 13
-#define SCREEN_CTRL_ID_SWITCH_ECS_AGA 14
-#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE 15
-#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE 16
-#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE2 17
-#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE2 18
+#define SCREEN_CTRL_ID_LEVELSET_INFO 14
+#define SCREEN_CTRL_ID_SWITCH_ECS_AGA 15
+#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE 16
+#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE 17
+#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE2 18
+#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE2 19
-#define NUM_SCREEN_MENUBUTTONS
19
+#define NUM_SCREEN_MENUBUTTONS
20
-#define SCREEN_CTRL_ID_SCROLL_UP
19
-#define SCREEN_CTRL_ID_SCROLL_DOWN 2
0
-#define SCREEN_CTRL_ID_SCROLL_VERTICAL 2
1
-#define SCREEN_CTRL_ID_NETWORK_SERVER 2
2
+#define SCREEN_CTRL_ID_SCROLL_UP
20
+#define SCREEN_CTRL_ID_SCROLL_DOWN 2
1
+#define SCREEN_CTRL_ID_SCROLL_VERTICAL 2
2
+#define SCREEN_CTRL_ID_NETWORK_SERVER 2
3
-#define NUM_SCREEN_GADGETS 2
3
+#define NUM_SCREEN_GADGETS 2
4
#define NUM_SCREEN_SCROLLBUTTONS 2
#define NUM_SCREEN_SCROLLBARS 1
#define NUM_SCREEN_SCROLLBUTTONS 2
#define NUM_SCREEN_SCROLLBARS 1
@@
-221,11
+225,12
@@
#define SCREEN_MASK_MAIN (1 << 0)
#define SCREEN_MASK_MAIN_HAS_SOLUTION (1 << 1)
#define SCREEN_MASK_MAIN (1 << 0)
#define SCREEN_MASK_MAIN_HAS_SOLUTION (1 << 1)
-#define SCREEN_MASK_INPUT (1 << 2)
-#define SCREEN_MASK_TOUCH (1 << 3)
-#define SCREEN_MASK_TOUCH2 (1 << 4)
-#define SCREEN_MASK_SCORES (1 << 5)
-#define SCREEN_MASK_SCORES_INFO (1 << 6)
+#define SCREEN_MASK_MAIN_HAS_SET_INFO (1 << 2)
+#define SCREEN_MASK_INPUT (1 << 3)
+#define SCREEN_MASK_TOUCH (1 << 4)
+#define SCREEN_MASK_TOUCH2 (1 << 5)
+#define SCREEN_MASK_SCORES (1 << 6)
+#define SCREEN_MASK_SCORES_INFO (1 << 7)
// graphic position and size values for buttons and scrollbars
#define SC_MENUBUTTON_XSIZE TILEX
// graphic position and size values for buttons and scrollbars
#define SC_MENUBUTTON_XSIZE TILEX
@@
-318,6
+323,8
@@
static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS];
static int info_mode = INFO_MODE_MAIN;
static int setup_mode = SETUP_MODE_MAIN;
static int info_mode = INFO_MODE_MAIN;
static int setup_mode = SETUP_MODE_MAIN;
+static boolean info_screens_from_main = FALSE;
+
static TreeInfo *window_sizes = NULL;
static TreeInfo *window_size_current = NULL;
static TreeInfo *window_sizes = NULL;
static TreeInfo *window_size_current = NULL;
@@
-918,6
+925,11
@@
static struct MainControlInfo main_controls[] =
};
};
+static boolean hasLevelSetInfo(void)
+{
+ return (getLevelSetInfoFilename(0) != NULL);
+}
+
static int getTitleScreenGraphic(int nr, boolean initial)
{
return (initial ? IMG_TITLESCREEN_INITIAL_1 : IMG_TITLESCREEN_1) + nr;
static int getTitleScreenGraphic(int nr, boolean initial)
{
return (initial ? IMG_TITLESCREEN_INITIAL_1 : IMG_TITLESCREEN_1) + nr;
@@
-1804,6
+1816,7
@@
void DrawMainMenu(void)
MapTapeButtons();
MapScreenMenuGadgets(SCREEN_MASK_MAIN);
UpdateScreenMenuGadgets(SCREEN_MASK_MAIN_HAS_SOLUTION, hasSolutionTape());
MapTapeButtons();
MapScreenMenuGadgets(SCREEN_MASK_MAIN);
UpdateScreenMenuGadgets(SCREEN_MASK_MAIN_HAS_SOLUTION, hasSolutionTape());
+ UpdateScreenMenuGadgets(SCREEN_MASK_MAIN_HAS_SET_INFO, hasLevelSetInfo());
// copy actual game door content to door double buffer for OpenDoor()
BlitBitmap(drawto, bitmap_db_door_1, DX, DY, DXSIZE, DYSIZE, 0, 0);
// copy actual game door content to door double buffer for OpenDoor()
BlitBitmap(drawto, bitmap_db_door_1, DX, DY, DXSIZE, DYSIZE, 0, 0);
@@
-2537,6
+2550,18
@@
static void DrawInfoScreen_Main(void)
int fade_mask = REDRAW_FIELD;
int i;
int fade_mask = REDRAW_FIELD;
int i;
+ // (needed after displaying info sub-screens directly from main menu)
+ if (info_screens_from_main)
+ {
+ info_screens_from_main = FALSE;
+
+ SetGameStatus(GAME_MODE_MAIN);
+
+ DrawMainMenu();
+
+ return;
+ }
+
if (redraw_mask & REDRAW_ALL)
fade_mask = REDRAW_ALL;
if (redraw_mask & REDRAW_ALL)
fade_mask = REDRAW_ALL;
@@
-2955,7
+2980,7
@@
void DrawInfoScreen_NotAvailable(char *text_title, char *text_error)
DrawTextSCentered(ystart1, font_title, text_title);
DrawTextSCentered(ystart2, font_error, text_error);
DrawTextSCentered(ystart1, font_title, text_title);
DrawTextSCentered(ystart2, font_error, text_error);
- DrawTextSCentered(ybottom, font_foot, TEXT_
INFO
_MENU);
+ DrawTextSCentered(ybottom, font_foot, TEXT_
NEXT
_MENU);
FadeIn(REDRAW_FIELD);
}
FadeIn(REDRAW_FIELD);
}
@@
-3275,7
+3300,7
@@
void HandleInfoScreen_Music(int dx, int dy, int button)
DrawHeadline();
DrawTextSCentered(ystart, font_title, "No music info for this level set.");
DrawHeadline();
DrawTextSCentered(ystart, font_title, "No music info for this level set.");
- DrawTextSCentered(ybottom, font_foot, TEXT_
INFO
_MENU);
+ DrawTextSCentered(ybottom, font_foot, TEXT_
NEXT
_MENU);
return;
}
return;
}
@@
-3574,7
+3599,7
@@
static void DrawInfoScreen_Version(void)
DrawTextF(xstart2, ystart, font_text, "%s", setup.system.sdl_audiodriver);
DrawTextF(xstart3, ystart, font_text, "%s", driver_name);
DrawTextF(xstart2, ystart, font_text, "%s", setup.system.sdl_audiodriver);
DrawTextF(xstart3, ystart, font_text, "%s", driver_name);
- DrawTextSCentered(ybottom, font_foot, TEXT_
INFO
_MENU);
+ DrawTextSCentered(ybottom, font_foot, TEXT_
NEXT
_MENU);
FadeIn(REDRAW_FIELD);
}
FadeIn(REDRAW_FIELD);
}
@@
-3695,7
+3720,7
@@
static void DrawInfoScreen_GenericScreen(int screen_nr, int num_screens,
}
boolean last_screen = (screen_nr == num_screens - 1);
}
boolean last_screen = (screen_nr == num_screens - 1);
- char *text_foot = (last_screen ? TEXT_
INFO
_MENU : TEXT_NEXT_PAGE);
+ char *text_foot = (last_screen ? TEXT_
NEXT
_MENU : TEXT_NEXT_PAGE);
DrawTextSCentered(ybottom, font_foot, text_foot);
}
DrawTextSCentered(ybottom, font_foot, text_foot);
}
@@
-3775,7
+3800,7
@@
void HandleInfoScreen_Generic(int dx, int dy, int button)
DrawHeadline();
DrawTextSCentered(ystart, font_title, text_no_info);
DrawHeadline();
DrawTextSCentered(ystart, font_title, text_no_info);
- DrawTextSCentered(ybottom, font_foot, TEXT_
INFO
_MENU);
+ DrawTextSCentered(ybottom, font_foot, TEXT_
NEXT
_MENU);
return;
}
return;
}
@@
-3848,6
+3873,8
@@
static void DrawInfoScreen(void)
void DrawInfoScreen_FromMainMenu(int nr)
{
void DrawInfoScreen_FromMainMenu(int nr)
{
+ int fade_mask = REDRAW_FIELD;
+
if (nr < INFO_MODE_MAIN || nr >= MAX_INFO_MODES)
return;
if (nr < INFO_MODE_MAIN || nr >= MAX_INFO_MODES)
return;
@@
-3855,10
+3882,29
@@
void DrawInfoScreen_FromMainMenu(int nr)
SetGameStatus(GAME_MODE_INFO);
SetGameStatus(GAME_MODE_INFO);
- info_mode = nr;;
+ info_mode = nr;
+ info_screens_from_main = TRUE;
+
+ if (redraw_mask & REDRAW_ALL)
+ fade_mask = REDRAW_ALL;
+
+ if (CheckFadeAll())
+ fade_mask = REDRAW_ALL;
+
+ UnmapAllGadgets();
+ FadeMenuSoundsAndMusic();
FadeSetEnterScreen();
FadeSetEnterScreen();
+ FadeOut(fade_mask);
+
+ FadeSkipNextFadeOut();
+
+ // needed if different viewport properties defined for info screen
+ ChangeViewportPropertiesIfNeeded();
+
+ SetMainBackgroundImage(IMG_BACKGROUND_INFO);
+
DrawInfoScreen();
}
DrawInfoScreen();
}
@@
-4502,7
+4548,7
@@
static void drawChooseTreeScreen_Scores_NotAvailable(void)
char *text_info = "HighScores of Level %d";
char *text_title = "Score information:";
char *text_error = "No scores for this level.";
char *text_info = "HighScores of Level %d";
char *text_title = "Score information:";
char *text_error = "No scores for this level.";
- char *text_foot =
"Press any key or button for main menu"
;
+ char *text_foot =
TEXT_MAIN_MENU
;
int font_info = FONT_TITLE_2;
int font_title = FONT_INITIAL_3;
int font_error = FONT_INITIAL_4;
int font_info = FONT_TITLE_2;
int font_title = FONT_INITIAL_3;
int font_error = FONT_INITIAL_4;
@@
-9524,6
+9570,14
@@
static struct
GD_EVENT_RELEASED,
FALSE, "play solution tape"
},
GD_EVENT_RELEASED,
FALSE, "play solution tape"
},
+ {
+ IMG_MENU_BUTTON_LEVELSET_INFO, IMG_MENU_BUTTON_LEVELSET_INFO_ACTIVE,
+ &menu.main.button.levelset_info, NULL,
+ SCREEN_CTRL_ID_LEVELSET_INFO,
+ SCREEN_MASK_MAIN_HAS_SET_INFO,
+ GD_EVENT_RELEASED,
+ FALSE, "show level set info"
+ },
{
IMG_MENU_BUTTON_SWITCH_ECS_AGA, IMG_MENU_BUTTON_SWITCH_ECS_AGA_ACTIVE,
&menu.main.button.switch_ecs_aga, &setup.prefer_aga_graphics,
{
IMG_MENU_BUTTON_SWITCH_ECS_AGA, IMG_MENU_BUTTON_SWITCH_ECS_AGA_ACTIVE,
&menu.main.button.switch_ecs_aga, &setup.prefer_aga_graphics,
@@
-9716,6
+9770,16
@@
static void CreateScreenMenubuttons(void)
id == SCREEN_CTRL_ID_NEXT_LEVEL2 ? mSY + MENU_TITLE1_YPOS : 0);
}
id == SCREEN_CTRL_ID_NEXT_LEVEL2 ? mSY + MENU_TITLE1_YPOS : 0);
}
+ if (id == SCREEN_CTRL_ID_LEVELSET_INFO)
+ {
+ if (pos->x == -1 && pos->y == -1)
+ {
+ // use "SX" here to place button (ignore draw offsets)
+ x = SX + SXSIZE - 2 * TILESIZE;
+ y = SY + SYSIZE - 2 * TILESIZE;
+ }
+ }
+
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
GDI_IMAGE_ID, gfx_unpressed,
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_CUSTOM_TYPE_ID, i,
GDI_IMAGE_ID, gfx_unpressed,
@@
-10132,6
+10196,10
@@
static void HandleScreenGadgets(struct GadgetInfo *gi)
PlaySolutionTape();
break;
PlaySolutionTape();
break;
+ case SCREEN_CTRL_ID_LEVELSET_INFO:
+ DrawInfoScreen_FromMainMenu(INFO_MODE_LEVELSET);
+ break;
+
case SCREEN_CTRL_ID_SWITCH_ECS_AGA:
setup.prefer_aga_graphics = !setup.prefer_aga_graphics;
DrawMainMenu();
case SCREEN_CTRL_ID_SWITCH_ECS_AGA:
setup.prefer_aga_graphics = !setup.prefer_aga_graphics;
DrawMainMenu();