projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added check if rendering to target texture is supported for SDL2
[rocksndiamonds.git]
/
src
/
screens.c
diff --git
a/src/screens.c
b/src/screens.c
index b86aa1c92c535d7e762efa4b44baeffd187e0ac3..d5e65265346b811866b2c3202a7aa5b92008f305 100644
(file)
--- a/
src/screens.c
+++ b/
src/screens.c
@@
-235,9
+235,6
@@
static TreeInfo *drop_distance_current = NULL;
static TreeInfo *level_number = NULL;
static TreeInfo *level_number_current = NULL;
static TreeInfo *level_number = NULL;
static TreeInfo *level_number_current = NULL;
-static unsigned int sync_frame_delay = 0;
-static unsigned int sync_frame_delay_value = GAME_FRAME_DELAY;
-
static struct
{
int value;
static struct
{
int value;
@@
-725,6
+722,13
@@
static int getTitleMessageGameMode(boolean initial)
return (initial ? GAME_MODE_TITLE_INITIAL : GAME_MODE_TITLE);
}
return (initial ? GAME_MODE_TITLE_INITIAL : GAME_MODE_TITLE);
}
+static int getTitleAnimMode(struct TitleControlInfo *tci)
+{
+ int base = (tci->initial ? GAME_MODE_TITLE_INITIAL_1 : GAME_MODE_TITLE_1);
+
+ return base + tci->local_nr;
+}
+
#if 0
static int getTitleScreenBackground(boolean initial)
{
#if 0
static int getTitleScreenBackground(boolean initial)
{
@@
-1357,8
+1361,6
@@
void DrawTitleScreen()
KeyboardAutoRepeatOff();
HandleTitleScreen(0, 0, 0, 0, MB_MENU_INITIALIZE);
KeyboardAutoRepeatOff();
HandleTitleScreen(0, 0, 0, 0, MB_MENU_INITIALIZE);
-
- StopAnimation();
}
boolean CheckTitleScreen(boolean levelset_has_changed)
}
boolean CheckTitleScreen(boolean levelset_has_changed)
@@
-1393,6
+1395,8
@@
void DrawMainMenu()
UnmapAllGadgets();
FadeSoundsAndMusic();
UnmapAllGadgets();
FadeSoundsAndMusic();
+ ExpireSoundLoops(FALSE);
+
KeyboardAutoRepeatOn();
ActivateJoystick();
KeyboardAutoRepeatOn();
ActivateJoystick();
@@
-1515,8
+1519,6
@@
void DrawMainMenu()
SetMouseCursor(CURSOR_DEFAULT);
SetMouseCursor(CURSOR_DEFAULT);
- InitAnimation();
-
OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
}
OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2);
}
@@
-1565,6
+1567,8
@@
void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
title_screen_nr = 0;
tci = &title_controls[title_screen_nr];
title_screen_nr = 0;
tci = &title_controls[title_screen_nr];
+ SetAnimStatus(getTitleAnimMode(tci));
+
last_sound = SND_UNDEFINED;
last_music = MUS_UNDEFINED;
last_sound = SND_UNDEFINED;
last_music = MUS_UNDEFINED;
@@
-1645,16
+1649,19
@@
void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
}
title_screen_nr++;
}
title_screen_nr++;
- tci = &title_controls[title_screen_nr];
if (title_screen_nr < num_title_screens)
{
if (title_screen_nr < num_title_screens)
{
+ tci = &title_controls[title_screen_nr];
+
+ SetAnimStatus(getTitleAnimMode(tci));
+
sound = getTitleSound(tci);
music = getTitleMusic(tci);
sound = getTitleSound(tci);
music = getTitleMusic(tci);
- if (
sound == SND_UNDEFINED ||
sound != last_sound)
- FadeSound
s(
);
- if (
music == MUS_UNDEFINED ||
music != last_music)
+ if (
last_sound != SND_UNDEFINED &&
sound != last_sound)
+ FadeSound
(last_sound
);
+ if (
last_music != MUS_UNDEFINED &&
music != last_music)
FadeMusic();
fading = getTitleFading(tci);
FadeMusic();
fading = getTitleFading(tci);
@@
-1837,8
+1844,6
@@
void HandleMainMenu(int mx, int my, int dx, int dy, int button)
}
else if (pos == MAIN_CONTROL_LEVEL_NUMBER && !button)
{
}
else if (pos == MAIN_CONTROL_LEVEL_NUMBER && !button)
{
- StopAnimation();
-
CloseDoor(DOOR_CLOSE_2);
SetGameStatus(GAME_MODE_LEVELNR);
CloseDoor(DOOR_CLOSE_2);
SetGameStatus(GAME_MODE_LEVELNR);
@@
-1875,8
+1880,6
@@
void HandleMainMenu(int mx, int my, int dx, int dy, int button)
{
if (leveldir_first)
{
{
if (leveldir_first)
{
- StopAnimation();
-
CloseDoor(DOOR_CLOSE_2);
SetGameStatus(GAME_MODE_LEVELS);
CloseDoor(DOOR_CLOSE_2);
SetGameStatus(GAME_MODE_LEVELS);
@@
-1894,8
+1897,6
@@
void HandleMainMenu(int mx, int my, int dx, int dy, int button)
}
else if (pos == MAIN_CONTROL_SCORES)
{
}
else if (pos == MAIN_CONTROL_SCORES)
{
- StopAnimation();
-
CloseDoor(DOOR_CLOSE_2);
SetGameStatus(GAME_MODE_SCORES);
CloseDoor(DOOR_CLOSE_2);
SetGameStatus(GAME_MODE_SCORES);
@@
-1908,8
+1909,6
@@
void HandleMainMenu(int mx, int my, int dx, int dy, int button)
!strEqual(setup.player_name, "Artsoft"))
Request("This level is read only!", REQ_CONFIRM);
!strEqual(setup.player_name, "Artsoft"))
Request("This level is read only!", REQ_CONFIRM);
- StopAnimation();
-
CloseDoor(DOOR_CLOSE_2);
SetGameStatus(GAME_MODE_EDITOR);
CloseDoor(DOOR_CLOSE_2);
SetGameStatus(GAME_MODE_EDITOR);
@@
-1920,8
+1919,6
@@
void HandleMainMenu(int mx, int my, int dx, int dy, int button)
}
else if (pos == MAIN_CONTROL_INFO)
{
}
else if (pos == MAIN_CONTROL_INFO)
{
- StopAnimation();
-
CloseDoor(DOOR_CLOSE_2);
SetGameStatus(GAME_MODE_INFO);
CloseDoor(DOOR_CLOSE_2);
SetGameStatus(GAME_MODE_INFO);
@@
-1934,14
+1931,10
@@
void HandleMainMenu(int mx, int my, int dx, int dy, int button)
}
else if (pos == MAIN_CONTROL_GAME)
{
}
else if (pos == MAIN_CONTROL_GAME)
{
- StopAnimation();
-
StartGameActions(options.network, setup.autorecord, level.random_seed);
}
else if (pos == MAIN_CONTROL_SETUP)
{
StartGameActions(options.network, setup.autorecord, level.random_seed);
}
else if (pos == MAIN_CONTROL_SETUP)
{
- StopAnimation();
-
CloseDoor(DOOR_CLOSE_2);
SetGameStatus(GAME_MODE_SETUP);
CloseDoor(DOOR_CLOSE_2);
SetGameStatus(GAME_MODE_SETUP);
@@
-2156,6
+2149,7
@@
static void DrawInfoScreen_Main()
fade_mask = REDRAW_ALL;
UnmapAllGadgets();
fade_mask = REDRAW_ALL;
UnmapAllGadgets();
+ FadeSoundsAndMusic();
FreeScreenGadgets();
CreateScreenGadgets();
FreeScreenGadgets();
CreateScreenGadgets();
@@
-2197,8
+2191,6
@@
static void DrawInfoScreen_Main()
DrawMaskedBorder(fade_mask);
FadeIn(fade_mask);
DrawMaskedBorder(fade_mask);
FadeIn(fade_mask);
-
- InitAnimation();
}
static void changeSetupValue(int, int, int);
}
static void changeSetupValue(int, int, int);
@@
-2696,8
+2688,6
@@
void DrawInfoScreen_Elements()
HandleInfoScreen_Elements(MB_MENU_INITIALIZE);
FadeIn(REDRAW_FIELD);
HandleInfoScreen_Elements(MB_MENU_INITIALIZE);
FadeIn(REDRAW_FIELD);
-
- InitAnimation();
}
void HandleInfoScreen_Elements(int button)
}
void HandleInfoScreen_Elements(int button)
@@
-3677,8
+3667,6
@@
static void DrawChooseTree(TreeInfo **ti_ptr)
DrawMaskedBorder(fade_mask);
FadeIn(fade_mask);
DrawMaskedBorder(fade_mask);
FadeIn(fade_mask);
-
- InitAnimation();
}
static void drawChooseTreeList(int first_entry, int num_page_entries,
}
static void drawChooseTreeList(int first_entry, int num_page_entries,
@@
-4061,6
+4049,8
@@
static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
void DrawChooseLevelSet()
{
void DrawChooseLevelSet()
{
+ FadeSoundsAndMusic();
+
SetMainBackgroundImage(IMG_BACKGROUND_LEVELS);
DrawChooseTree(&leveldir_current);
SetMainBackgroundImage(IMG_BACKGROUND_LEVELS);
DrawChooseTree(&leveldir_current);
@@
-4078,6
+4068,8
@@
void DrawChooseLevelNr()
{
int i;
{
int i;
+ FadeSoundsAndMusic();
+
if (level_number != NULL)
{
freeTreeInfo(level_number);
if (level_number != NULL)
{
freeTreeInfo(level_number);
@@
-4163,8
+4155,6
@@
void DrawHallOfFame(int highlight_position)
FadeOut(fade_mask);
FadeOut(fade_mask);
- InitAnimation();
-
PlayMenuSound();
PlayMenuMusic();
PlayMenuSound();
PlayMenuMusic();
@@
-4691,16
+4681,14
@@
static void execSetupGraphics_setRenderingModes()
static void execSetupGraphics()
{
static void execSetupGraphics()
{
+ // update "setup.window_scaling_percent" from list selection
+ // (in this case, window scaling was changed on setup screen)
if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE)
if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE)
- {
- // update "setup.window_scaling_percent" from list selection
execSetupGraphics_setWindowSizes(FALSE);
execSetupGraphics_setWindowSizes(FALSE);
- }
- else
- {
- // update list selection from "setup.window_scaling_percent"
- execSetupGraphics_setWindowSizes(TRUE);
- }
+
+ // update list selection from "setup.window_scaling_percent"
+ // (window scaling may have changed by resizing the window)
+ execSetupGraphics_setWindowSizes(TRUE);
execSetupGraphics_setScalingTypes();
execSetupGraphics_setRenderingModes();
execSetupGraphics_setScalingTypes();
execSetupGraphics_setRenderingModes();
@@
-5574,10
+5562,7
@@
static Key getSetupKey()
}
}
}
}
- DoAnimation();
BackToFront();
BackToFront();
-
- WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value);
}
return key;
}
return key;
@@
-5622,7
+5607,7
@@
static void drawSetupValue(int screen_pos, int setup_info_pos_raw)
int ypos = MENU_SCREEN_START_YPOS + screen_pos;
int startx = mSX + xpos * 32;
int starty = mSY + ypos * 32;
int ypos = MENU_SCREEN_START_YPOS + screen_pos;
int startx = mSX + xpos * 32;
int starty = mSY + ypos * 32;
- int font_nr, font_
width
;
+ int font_nr, font_
nr_default, font_width_default
;
int type = si->type;
void *value = si->value;
char *value_string = getSetupValue(type, value);
int type = si->type;
void *value = si->value;
char *value_string = getSetupValue(type, value);
@@
-5654,8
+5639,10
@@
static void drawSetupValue(int screen_pos, int setup_info_pos_raw)
startx = mSX + xpos * 32;
starty = mSY + ypos * 32;
startx = mSX + xpos * 32;
starty = mSY + ypos * 32;
- font_nr = getSetupValueFont(type, value);
- font_width = getFontWidth(font_nr);
+ font_nr_default = getSetupValueFont(type, value);
+ font_width_default = getFontWidth(font_nr_default);
+
+ font_nr = font_nr_default;
// special check if right-side setup values moved left due to scrollbar
if (scrollbar_needed && xpos > MENU_SCREEN_START_XPOS)
// special check if right-side setup values moved left due to scrollbar
if (scrollbar_needed && xpos > MENU_SCREEN_START_XPOS)
@@
-5673,7
+5660,6
@@
static void drawSetupValue(int screen_pos, int setup_info_pos_raw)
startx = mSX + xpos * 32;
font_nr = getSetupValueFontNarrow(type, font_nr);
startx = mSX + xpos * 32;
font_nr = getSetupValueFontNarrow(type, font_nr);
- font_width = getFontWidth(font_nr);
}
}
}
}
@@
-5716,7
+5702,7
@@
static void drawSetupValue(int screen_pos, int setup_info_pos_raw)
}
for (i = 0; i <= menu_screen_max_xpos - xpos; i++)
}
for (i = 0; i <= menu_screen_max_xpos - xpos; i++)
- DrawText(startx + i * font_width
, starty, " ", font_nr
);
+ DrawText(startx + i * font_width
_default, starty, " ", font_nr_default
);
DrawText(startx, starty, value_string, font_nr);
DrawText(startx, starty, value_string, font_nr);
@@
-5773,6
+5759,7
@@
static void DrawSetupScreen_Generic()
fade_mask = REDRAW_ALL;
UnmapAllGadgets();
fade_mask = REDRAW_ALL;
UnmapAllGadgets();
+ FadeSoundsAndMusic();
FreeScreenGadgets();
CreateScreenGadgets();
FreeScreenGadgets();
CreateScreenGadgets();
@@
-5874,8
+5861,6
@@
static void DrawSetupScreen_Generic()
DrawMaskedBorder(fade_mask);
FadeIn(fade_mask);
DrawMaskedBorder(fade_mask);
FadeIn(fade_mask);
-
- InitAnimation();
}
void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
}
void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button)
@@
-5923,8
+5908,6
@@
void DrawSetupScreen_Input()
HandleSetupScreen_Input(0, 0, 0, 0, MB_MENU_INITIALIZE);
FadeIn(REDRAW_FIELD);
HandleSetupScreen_Input(0, 0, 0, 0, MB_MENU_INITIALIZE);
FadeIn(REDRAW_FIELD);
-
- InitAnimation();
}
static void setJoystickDeviceToNr(char *device_name, int device_nr)
}
static void setJoystickDeviceToNr(char *device_name, int device_nr)
@@
-6205,8
+6188,6
@@
void CustomizeKeyboard(int player_nr)
FadeIn(REDRAW_FIELD);
FadeIn(REDRAW_FIELD);
- InitAnimation();
-
while (!finished)
{
if (PendingEvent()) /* got event */
while (!finished)
{
if (PendingEvent()) /* got event */
@@
-6288,16
+6269,12
@@
void CustomizeKeyboard(int player_nr)
}
}
}
}
- DoAnimation();
BackToFront();
BackToFront();
-
- WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value);
}
/* write new key bindings back to player setup */
setup.input[player_nr].key = custom_key;
}
/* write new key bindings back to player setup */
setup.input[player_nr].key = custom_key;
- StopAnimation();
DrawSetupScreen_Input();
}
DrawSetupScreen_Input();
}
@@
-6361,7
+6338,6
@@
static boolean CalibrateJoystickMain(int player_nr)
FadeIn(REDRAW_FIELD);
while (Joystick(player_nr) & JOY_BUTTON); /* wait for released button */
FadeIn(REDRAW_FIELD);
while (Joystick(player_nr) & JOY_BUTTON); /* wait for released button */
- InitAnimation();
while (result < 0)
{
while (result < 0)
{
@@
-6443,10
+6419,7
@@
static boolean CalibrateJoystickMain(int player_nr)
}
}
}
}
- DoAnimation();
BackToFront();
BackToFront();
-
- WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value);
}
/* calibrated center position (joystick should now be centered) */
}
/* calibrated center position (joystick should now be centered) */
@@
-6456,8
+6429,6
@@
static boolean CalibrateJoystickMain(int player_nr)
new_joystick_xmiddle = joy_x;
new_joystick_ymiddle = joy_y;
new_joystick_xmiddle = joy_x;
new_joystick_ymiddle = joy_y;
- StopAnimation();
-
/* wait until the last pressed button was released */
while (Joystick(player_nr) & JOY_BUTTON)
{
/* wait until the last pressed button was released */
while (Joystick(player_nr) & JOY_BUTTON)
{
@@
-6468,7
+6439,7
@@
static boolean CalibrateJoystickMain(int player_nr)
NextEvent(&event);
HandleOtherEvents(&event);
NextEvent(&event);
HandleOtherEvents(&event);
-
WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value
);
+
BackToFront(
);
}
}
}
}