#define SETUP_MODE_CHOOSE_GAME_SPEED 16
#define SETUP_MODE_CHOOSE_SCROLL_DELAY 17
#define SETUP_MODE_CHOOSE_SNAPSHOT_MODE 18
-#define SETUP_MODE_CHOOSE_SCREEN_MODE 19
-#define SETUP_MODE_CHOOSE_WINDOW_SIZE 20
-#define SETUP_MODE_CHOOSE_SCALING_TYPE 21
-#define SETUP_MODE_CHOOSE_GRAPHICS 22
-#define SETUP_MODE_CHOOSE_SOUNDS 23
-#define SETUP_MODE_CHOOSE_MUSIC 24
-#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE 25
-#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 26
-#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 27
-#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 28
-#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 29
-#define SETUP_MODE_CHOOSE_DROP_DISTANCE 30
-
-#define MAX_SETUP_MODES 31
+#define SETUP_MODE_CHOOSE_WINDOW_SIZE 19
+#define SETUP_MODE_CHOOSE_SCALING_TYPE 20
+#define SETUP_MODE_CHOOSE_GRAPHICS 21
+#define SETUP_MODE_CHOOSE_SOUNDS 22
+#define SETUP_MODE_CHOOSE_MUSIC 23
+#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE 24
+#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 25
+#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 26
+#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 27
+#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 28
+#define SETUP_MODE_CHOOSE_DROP_DISTANCE 29
+
+#define MAX_SETUP_MODES 30
#define MAX_MENU_MODES MAX(MAX_INFO_MODES, MAX_SETUP_MODES)
static int info_mode = INFO_MODE_MAIN;
static int setup_mode = SETUP_MODE_MAIN;
-static TreeInfo *screen_modes = NULL;
-static TreeInfo *screen_mode_current = NULL;
-
static TreeInfo *window_sizes = NULL;
static TreeInfo *window_size_current = NULL;
char *text;
} snapshot_modes_list[] =
{
- { STR_SNAPSHOT_MODE_OFF, "Off" },
- { STR_SNAPSHOT_MODE_EVERY_STEP, "Every Step" },
- { STR_SNAPSHOT_MODE_EVERY_MOVE, "Every Move" },
+ { STR_SNAPSHOT_MODE_OFF, "Off" },
+ { STR_SNAPSHOT_MODE_EVERY_STEP, "Every Step" },
+ { STR_SNAPSHOT_MODE_EVERY_MOVE, "Every Move" },
+ { STR_SNAPSHOT_MODE_EVERY_COLLECT, "Every Collect" },
- { NULL, NULL },
+ { NULL, NULL },
};
static struct
drawCursorExt(0, ypos, active, -1);
- game_status = last_game_status; /* restore current game status */
+ SetGameStatus(last_game_status); /* restore current game status */
}
void DrawHeadline()
return;
/* force TITLE font on title message screen */
- game_status = getTitleMessageGameMode(initial);
+ SetGameStatus(getTitleMessageGameMode(initial));
/* if chars *and* width set to "-1", automatically determine width */
if (tmi->chars == -1 && tmi->width == -1)
filename, tmi->font, tmi->chars, -1, tmi->lines, 0, -1,
tmi->autowrap, tmi->centered, tmi->parse_comments);
- game_status = last_game_status; /* restore current game status */
+ SetGameStatus(last_game_status); /* restore current game status */
}
void DrawTitleScreen()
/* needed if last screen was the playing screen, invoked from level editor */
if (level_editor_test_game)
{
- game_status = GAME_MODE_EDITOR;
+ CloseDoor(DOOR_CLOSE_ALL);
+
+ SetGameStatus(GAME_MODE_EDITOR);
+
DrawLevelEd();
return;
/* needed if last screen (level choice) changed graphics, sounds or music */
ReloadCustomArtwork(0);
+ if (CheckTitleScreen(levelset_has_changed))
+ {
+ game_status_last_screen = GAME_MODE_MAIN;
+
+ SetGameStatus(GAME_MODE_TITLE);
+
+ DrawTitleScreen();
+
+ return;
+ }
+
/* needed if different viewport properties defined for menues */
ChangeViewportPropertiesIfNeeded();
FadeOut(fade_mask);
- /* needed if last screen was the editor screen */
- UndrawSpecialEditorDoor();
-
SetDrawtoField(DRAW_BACKBUFFER);
- if (CheckTitleScreen(levelset_has_changed))
- {
- game_status_last_screen = GAME_MODE_MAIN;
- game_status = GAME_MODE_TITLE;
-
- DrawTitleScreen();
-
- return;
- }
-
/* level_nr may have been set to value over handicap with level editor */
if (setup.handicap && level_nr > leveldir_current->handicap_level)
level_nr = leveldir_current->handicap_level;
if (num_title_screens == 0)
{
/* switch game mode from title screen mode back to info screen mode */
- game_status = GAME_MODE_INFO;
+ SetGameStatus(GAME_MODE_INFO);
DrawInfoScreen_NotAvailable("Title screen information:",
"No title screen for this level set.");
}
FadeSoundsAndMusic();
-
- FadeOut(REDRAW_ALL);
}
+ FadeOut(REDRAW_ALL);
+
/* only required to update logic for redrawing global border */
ClearField();
{
if (game_status_last_screen == GAME_MODE_INFO && num_title_screens == 0)
{
- game_status = GAME_MODE_INFO;
+ SetGameStatus(GAME_MODE_INFO);
+
info_mode = INFO_MODE_MAIN;
DrawInfoScreen();
if (game_status_last_screen == GAME_MODE_INFO)
{
- game_status = GAME_MODE_INFO;
+ SetGameStatus(GAME_MODE_INFO);
+
info_mode = INFO_MODE_MAIN;
DrawInfoScreen();
}
else /* default: return to main menu */
{
- game_status = GAME_MODE_MAIN;
+ SetGameStatus(GAME_MODE_MAIN);
DrawMainMenu();
}
CloseDoor(DOOR_CLOSE_2);
- game_status = GAME_MODE_LEVELNR;
+ SetGameStatus(GAME_MODE_LEVELNR);
ChangeViewportPropertiesIfNeeded();
if (pos == MAIN_CONTROL_NAME)
{
- game_status = GAME_MODE_PSEUDO_TYPENAME;
+ SetGameStatus(GAME_MODE_PSEUDO_TYPENAME);
HandleTypeName(strlen(setup.player_name), 0);
}
CloseDoor(DOOR_CLOSE_2);
- game_status = GAME_MODE_LEVELS;
+ SetGameStatus(GAME_MODE_LEVELS);
SaveLevelSetup_LastSeries();
SaveLevelSetup_SeriesInfo();
CloseDoor(DOOR_CLOSE_2);
- game_status = GAME_MODE_SCORES;
+ SetGameStatus(GAME_MODE_SCORES);
DrawHallOfFame(-1);
}
CloseDoor(DOOR_CLOSE_2);
- game_status = GAME_MODE_EDITOR;
+ SetGameStatus(GAME_MODE_EDITOR);
FadeSetEnterScreen();
CloseDoor(DOOR_CLOSE_2);
- game_status = GAME_MODE_INFO;
+ SetGameStatus(GAME_MODE_INFO);
+
info_mode = INFO_MODE_MAIN;
ChangeViewportPropertiesIfNeeded();
CloseDoor(DOOR_CLOSE_2);
- game_status = GAME_MODE_SETUP;
+ SetGameStatus(GAME_MODE_SETUP);
+
setup_mode = SETUP_MODE_MAIN;
ChangeViewportPropertiesIfNeeded();
SaveLevelSetup_SeriesInfo();
if (Request("Do you really want to quit?", REQ_ASK | REQ_STAY_CLOSED))
- game_status = GAME_MODE_QUIT;
+ SetGameStatus(GAME_MODE_QUIT);
}
}
}
static void execExitInfo()
{
- game_status = GAME_MODE_MAIN;
+ SetGameStatus(GAME_MODE_MAIN);
DrawMainMenu();
}
DrawCursorAndText_Menu_Ext(setup_info, screen_pos, menu_info_pos_raw, active);
}
-static char *screen_mode_text;
static char *window_size_text;
static char *scaling_type_text;
(value_ptr == &setup.sound_loops && !audio.loops_available) ||
(value_ptr == &setup.sound_music && !audio.music_available) ||
(value_ptr == &setup.fullscreen && !video.fullscreen_available) ||
- (value_ptr == &screen_mode_text && !video.fullscreen_available) ||
(value_ptr == &window_size_text && !video.window_scaling_available) ||
(value_ptr == &scaling_type_text && !video.window_scaling_available))
si->type |= TYPE_GHOSTED;
FreeScreenGadgets();
CreateScreenGadgets();
- CloseDoor(DOOR_CLOSE_2);
-
/* (needed after displaying title screens which disable auto repeat) */
KeyboardAutoRepeatOn();
ChangeViewportPropertiesIfNeeded();
- OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
-
ClearField();
+ OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+
DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, "Info Screen");
info_info = info_info_main;
PlayMenuSound();
PlayMenuMusic();
-#if 1
- // needed after returning from title screens with different window size
- OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
-#endif
-
DrawMaskedBorder(fade_mask);
FadeIn(fade_mask);
void DrawInfoScreen_TitleScreen()
{
game_status_last_screen = GAME_MODE_INFO;
- game_status = GAME_MODE_TITLE;
+
+ SetGameStatus(GAME_MODE_TITLE);
DrawTitleScreen();
}
is_active = FALSE;
- game_status = GAME_MODE_MAIN;
+ SetGameStatus(GAME_MODE_MAIN);
}
else if (key == KSYM_Escape)
{
is_active = FALSE;
- game_status = GAME_MODE_MAIN;
+ SetGameStatus(GAME_MODE_MAIN);
}
if (is_active)
if (strEqual((*ti_ptr)->subdir, STRING_TOP_DIRECTORY))
{
- game_status = GAME_MODE_MAIN;
+ SetGameStatus(GAME_MODE_MAIN);
DrawMainMenu();
FreeScreenGadgets();
CreateScreenGadgets();
- CloseDoor(DOOR_CLOSE_2);
-
FadeOut(fade_mask);
- OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
-
ClearField();
+ OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+
HandleChooseTree(0, 0, 0, 0, MB_MENU_INITIALIZE, ti_ptr);
MapScreenTreeGadgets(*ti_ptr);
initCursor(i, IMG_MENU_BUTTON);
}
- game_status = last_game_status; /* restore current game status */
+ SetGameStatus(last_game_status); /* restore current game status */
redraw_mask |= REDRAW_FIELD;
}
else
num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN;
- game_status = last_game_status; /* restore current game status */
+ SetGameStatus(last_game_status); /* restore current game status */
if (button == MB_MENU_INITIALIZE)
{
setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY ||
setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE)
execSetupGame();
- else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE ||
- setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE ||
+ else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE ||
setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE)
execSetupGraphics();
else if (setup_mode == SETUP_MODE_CHOOSE_VOLUME_SIMPLE ||
HandleMainMenu_SelectLevel(0, 0, new_level_nr);
}
- game_status = GAME_MODE_MAIN;
+ SetGameStatus(GAME_MODE_MAIN);
DrawMainMenu();
}
x = (mx - mSX) / 32;
y = (my - mSY) / 32 - MENU_SCREEN_START_YPOS;
- game_status = last_game_status; /* restore current game status */
+ SetGameStatus(last_game_status); /* restore current game status */
}
else if (dx || dy) /* keyboard or scrollbar/scrollbutton input */
{
setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY ||
setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE)
execSetupGame();
- else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE ||
- setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE ||
+ else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE ||
setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE)
execSetupGraphics();
else if (setup_mode == SETUP_MODE_CHOOSE_VOLUME_SIMPLE ||
HandleMainMenu_SelectLevel(0, 0, new_level_nr);
}
- game_status = GAME_MODE_MAIN;
+ SetGameStatus(GAME_MODE_MAIN);
DrawMainMenu();
}
{
int fade_mask = REDRAW_FIELD;
- /* required before door position may be changed in next step */
- CloseDoor(DOOR_CLOSE_ALL);
-
/* needed if different viewport properties defined for scores */
ChangeViewportPropertiesIfNeeded();
FadeSound(SND_BACKGROUND_SCORES);
- game_status = GAME_MODE_MAIN;
+ SetGameStatus(GAME_MODE_MAIN);
DrawMainMenu();
}
FadeSound(SND_BACKGROUND_SCORES);
- game_status = GAME_MODE_MAIN;
+ SetGameStatus(GAME_MODE_MAIN);
DrawMainMenu();
}
static int num_setup_info; /* number of setup entries shown on screen */
static int max_setup_info; /* total number of setup entries in list */
-static char *screen_mode_text;
static char *window_size_text;
static char *scaling_type_text;
static char *scroll_delay_text;
setString(&ti->identifier, identifier);
setString(&ti->name, name);
setString(&ti->name_sorting, name);
- setString(&ti->infotext, "Scaling Type");
+ setString(&ti->infotext, "Scroll Delay");
pushTreeInfo(&scroll_delays, ti);
}
- /* sort scaling type values to start with lowest scaling type value */
+ /* sort scroll delay values to start with lowest scroll delay value */
sortTreeInfo(&scroll_delays);
- /* set current scaling type value to configured scaling type value */
+ /* set current scroll delay value to configured scroll delay value */
scroll_delay_current =
getTreeInfoFromIdentifier(scroll_delays,i_to_a(setup.scroll_delay_value));
- /* if that fails, set current scaling type to reliable default value */
+ /* if that fails, set current scroll delay to reliable default value */
if (scroll_delay_current == NULL)
scroll_delay_current =
getTreeInfoFromIdentifier(scroll_delays, i_to_a(STD_SCROLL_DELAY));
- /* if that also fails, set current scaling type to first available value */
+ /* if that also fails, set current scroll delay to first available value */
if (scroll_delay_current == NULL)
scroll_delay_current = scroll_delays;
}
setup.scroll_delay_value = atoi(scroll_delay_current->identifier);
- /* needed for displaying scaling type text instead of identifier */
+ /* needed for displaying scroll delay text instead of identifier */
scroll_delay_text = scroll_delay_current->name;
}
scaling_type_text = scaling_type_current->name;
}
-static void execSetupGraphics_setScreenModes()
-{
- // if (screen_modes == NULL && video.fullscreen_available)
- if (screen_modes == NULL && video.fullscreen_modes != NULL)
- {
- int i;
-
- for (i = 0; video.fullscreen_modes[i].width != -1; i++)
- {
- TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
- char identifier[32], name[32];
- int x = video.fullscreen_modes[i].width;
- int y = video.fullscreen_modes[i].height;
- int xx, yy;
-
- get_aspect_ratio_from_screen_mode(&video.fullscreen_modes[i], &xx, &yy);
-
- ti->node_top = &screen_modes;
- ti->sort_priority = x * 10000 + y;
-
- sprintf(identifier, "%dx%d", x, y);
- sprintf(name, "%d x %d [%d:%d]", x, y, xx, yy);
-
- setString(&ti->identifier, identifier);
- setString(&ti->name, name);
- setString(&ti->name_sorting, name);
- setString(&ti->infotext, "Fullscreen Mode");
-
- pushTreeInfo(&screen_modes, ti);
- }
-
- /* sort fullscreen modes to start with lowest available screen resolution */
- sortTreeInfo(&screen_modes);
-
- /* set current screen mode for fullscreen mode to configured setup value */
- screen_mode_current = getTreeInfoFromIdentifier(screen_modes,
- setup.fullscreen_mode);
-
- /* if that fails, set current screen mode to reliable default value */
- if (screen_mode_current == NULL)
- screen_mode_current = getTreeInfoFromIdentifier(screen_modes,
- DEFAULT_FULLSCREEN_MODE);
-
- /* if that also fails, set current screen mode to first available mode */
- if (screen_mode_current == NULL)
- screen_mode_current = screen_modes;
-
- if (screen_mode_current == NULL)
- video.fullscreen_available = FALSE;
- }
-
- // if (video.fullscreen_available)
- if (screen_mode_current != NULL)
- {
- setup.fullscreen_mode = screen_mode_current->identifier;
-
- /* needed for displaying screen mode name instead of identifier */
- screen_mode_text = screen_mode_current->name;
- }
-}
-
static void execSetupGraphics()
{
if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE)
}
execSetupGraphics_setScalingTypes();
- execSetupGraphics_setScreenModes();
setup_mode = SETUP_MODE_GRAPHICS;
#endif
}
-#if !defined(PLATFORM_ANDROID)
-#if defined(TARGET_SDL2)
+#if defined(TARGET_SDL2) && !defined(PLATFORM_ANDROID)
static void execSetupChooseWindowSize()
{
setup_mode = SETUP_MODE_CHOOSE_WINDOW_SIZE;
DrawSetupScreen();
}
-#else
-static void execSetupChooseScreenMode()
-{
- if (!video.fullscreen_available)
- return;
-
- setup_mode = SETUP_MODE_CHOOSE_SCREEN_MODE;
-
- DrawSetupScreen();
-}
-#endif
#endif
static void execSetupChooseVolumeSimple()
static void execExitSetup()
{
- game_status = GAME_MODE_MAIN;
+ SetGameStatus(GAME_MODE_MAIN);
DrawMainMenu();
}
static struct TokenInfo setup_info_graphics[] =
{
-#if !defined(PLATFORM_ANDROID)
+#if defined(TARGET_SDL2) && !defined(PLATFORM_ANDROID)
{ TYPE_SWITCH, &setup.fullscreen, "Fullscreen:" },
-#if defined(TARGET_SDL2)
{ TYPE_ENTER_LIST, execSetupChooseWindowSize, "Window Scaling:" },
{ TYPE_STRING, &window_size_text, "" },
{ TYPE_ENTER_LIST, execSetupChooseScalingType, "Anti-Aliasing:" },
{ TYPE_STRING, &scaling_type_text, "" },
-#else
- { TYPE_ENTER_LIST, execSetupChooseScreenMode, "Fullscreen Mode:" },
- { TYPE_STRING, &screen_mode_text, "" },
-#endif
#endif
#if 0
{ TYPE_ENTER_LIST, execSetupChooseScrollDelay, "Scroll Delay:" },
FreeScreenGadgets();
CreateScreenGadgets();
- CloseDoor(DOOR_CLOSE_2);
-
if (redraw_mask & REDRAW_ALL)
redraw_all = TRUE;
FadeOut(fade_mask);
- OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
-
ClearField();
+ OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
+
if (setup_mode == SETUP_MODE_MAIN)
{
setup_info = setup_info_main;
DrawChooseTree(&scroll_delay_current);
else if (setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE)
DrawChooseTree(&snapshot_mode_current);
- else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
- DrawChooseTree(&screen_mode_current);
else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE)
DrawChooseTree(&window_size_current);
else if (setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE)
HandleChooseTree(mx, my, dx, dy, button, &scroll_delay_current);
else if (setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE)
HandleChooseTree(mx, my, dx, dy, button, &snapshot_mode_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_WINDOW_SIZE)
HandleChooseTree(mx, my, dx, dy, button, &window_size_current);
else if (setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE)
CreateScreenScrollbuttons();
CreateScreenScrollbars();
- game_status = last_game_status; /* restore current game status */
+ SetGameStatus(last_game_status); /* restore current game status */
}
void FreeScreenGadgets()