projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
moved video frame synchronization to single location (screen update)
[rocksndiamonds.git]
/
src
/
screens.c
diff --git
a/src/screens.c
b/src/screens.c
index 3bcb01c4b532ac3ee7ebb89491e15e21ad0501f1..94eb8895e723a87c1731916810607f865d30370e 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)
{
@@
-1247,11
+1251,7
@@
static void drawCursorXY(int xpos, int ypos, int graphic)
static void drawChooseTreeCursor(int ypos, boolean active)
{
static void drawChooseTreeCursor(int ypos, boolean active)
{
- int last_game_status = game_status; /* save current game status */
-
drawCursorExt(0, ypos, active, -1);
drawCursorExt(0, ypos, active, -1);
-
- SetGameStatus(last_game_status); /* restore current game status */
}
void DrawHeadline()
}
void DrawHeadline()
@@
-1309,13
+1309,12
@@
void DrawTitleScreenMessage(int nr, boolean initial)
{
char *filename = getLevelSetTitleMessageFilename(nr, initial);
struct TitleMessageInfo *tmi = getTitleMessageInfo(nr, initial);
{
char *filename = getLevelSetTitleMessageFilename(nr, initial);
struct TitleMessageInfo *tmi = getTitleMessageInfo(nr, initial);
- int last_game_status = game_status; /* save current game status */
if (filename == NULL)
return;
/* force TITLE font on title message screen */
if (filename == NULL)
return;
/* force TITLE font on title message screen */
- Set
Game
Status(getTitleMessageGameMode(initial));
+ Set
Font
Status(getTitleMessageGameMode(initial));
/* if chars *and* width set to "-1", automatically determine width */
if (tmi->chars == -1 && tmi->width == -1)
/* if chars *and* width set to "-1", automatically determine width */
if (tmi->chars == -1 && tmi->width == -1)
@@
-1354,7
+1353,7
@@
void DrawTitleScreenMessage(int nr, boolean initial)
filename, tmi->font, tmi->chars, -1, tmi->lines, 0, -1,
tmi->autowrap, tmi->centered, tmi->parse_comments);
filename, tmi->font, tmi->chars, -1, tmi->lines, 0, -1,
tmi->autowrap, tmi->centered, tmi->parse_comments);
- SetGameStatus(last_game_status); /* restore current game status */
+ ResetFontStatus();
}
void DrawTitleScreen()
}
void DrawTitleScreen()
@@
-1398,6
+1397,8
@@
void DrawMainMenu()
UnmapAllGadgets();
FadeSoundsAndMusic();
UnmapAllGadgets();
FadeSoundsAndMusic();
+ ExpireSoundLoops(FALSE);
+
KeyboardAutoRepeatOn();
ActivateJoystick();
KeyboardAutoRepeatOn();
ActivateJoystick();
@@
-1570,6
+1571,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;
@@
-1590,7
+1593,6
@@
void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
DrawInfoScreen_NotAvailable("Title screen information:",
"No title screen for this level set.");
DrawInfoScreen_NotAvailable("Title screen information:",
"No title screen for this level set.");
-
return;
}
return;
}
@@
-1651,10
+1653,13
@@
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);
@@
-2162,6
+2167,7
@@
static void DrawInfoScreen_Main()
fade_mask = REDRAW_ALL;
UnmapAllGadgets();
fade_mask = REDRAW_ALL;
UnmapAllGadgets();
+ FadeSoundsAndMusic();
FreeScreenGadgets();
CreateScreenGadgets();
FreeScreenGadgets();
CreateScreenGadgets();
@@
-3696,7
+3702,6
@@
static void drawChooseTreeList(int first_entry, int num_page_entries,
int yoffset_setup = 16;
int yoffset = (ti->type == TREE_TYPE_LEVEL_DIR ||
ti->type == TREE_TYPE_LEVEL_NR ? yoffset_sets : yoffset_setup);
int yoffset_setup = 16;
int yoffset = (ti->type == TREE_TYPE_LEVEL_DIR ||
ti->type == TREE_TYPE_LEVEL_NR ? yoffset_sets : yoffset_setup);
- int last_game_status = game_status; /* save current game status */
title_string = ti->infotext;
title_string = ti->infotext;
@@
-3736,8
+3741,6
@@
static void drawChooseTreeList(int first_entry, int num_page_entries,
initCursor(i, IMG_MENU_BUTTON);
}
initCursor(i, IMG_MENU_BUTTON);
}
- SetGameStatus(last_game_status); /* restore current game status */
-
redraw_mask |= REDRAW_FIELD;
}
redraw_mask |= REDRAW_FIELD;
}
@@
-3785,7
+3788,6
@@
static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
int step = (button == 1 ? 1 : button == 2 ? 5 : 10);
int num_entries = numTreeInfoInGroup(ti);
int num_page_entries;
int step = (button == 1 ? 1 : button == 2 ? 5 : 10);
int num_entries = numTreeInfoInGroup(ti);
int num_page_entries;
- int last_game_status = game_status; /* save current game status */
boolean position_set_by_scrollbar = (dx == 999);
if (num_entries <= NUM_MENU_ENTRIES_ON_SCREEN)
boolean position_set_by_scrollbar = (dx == 999);
if (num_entries <= NUM_MENU_ENTRIES_ON_SCREEN)
@@
-3793,8
+3795,6
@@
static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
else
num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN;
else
num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN;
- SetGameStatus(last_game_status); /* restore current game status */
-
if (button == MB_MENU_INITIALIZE)
{
int num_entries = numTreeInfoInGroup(ti);
if (button == MB_MENU_INITIALIZE)
{
int num_entries = numTreeInfoInGroup(ti);
@@
-3878,12
+3878,8
@@
static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
if (mx || my) /* mouse input */
{
if (mx || my) /* mouse input */
{
- int last_game_status = game_status; /* save current game status */
-
x = (mx - mSX) / 32;
y = (my - mSY) / 32 - MENU_SCREEN_START_YPOS;
x = (mx - mSX) / 32;
y = (my - mSY) / 32 - MENU_SCREEN_START_YPOS;
-
- SetGameStatus(last_game_status); /* restore current game status */
}
else if (dx || dy) /* keyboard or scrollbar/scrollbutton input */
{
}
else if (dx || dy) /* keyboard or scrollbar/scrollbutton input */
{
@@
-4077,6
+4073,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);
@@
-4094,6
+4092,8
@@
void DrawChooseLevelNr()
{
int i;
{
int i;
+ FadeSoundsAndMusic();
+
if (level_number != NULL)
{
freeTreeInfo(level_number);
if (level_number != NULL)
{
freeTreeInfo(level_number);
@@
-5592,8
+5592,6
@@
static Key getSetupKey()
DoAnimation();
BackToFront();
DoAnimation();
BackToFront();
-
- WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value);
}
return key;
}
return key;
@@
-5638,7
+5636,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);
@@
-5670,8
+5668,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)
@@
-5689,7
+5689,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);
}
}
}
}
@@
-5732,7
+5731,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);
@@
-5789,6
+5788,7
@@
static void DrawSetupScreen_Generic()
fade_mask = REDRAW_ALL;
UnmapAllGadgets();
fade_mask = REDRAW_ALL;
UnmapAllGadgets();
+ FadeSoundsAndMusic();
FreeScreenGadgets();
CreateScreenGadgets();
FreeScreenGadgets();
CreateScreenGadgets();
@@
-6306,8
+6306,6
@@
void CustomizeKeyboard(int player_nr)
DoAnimation();
BackToFront();
DoAnimation();
BackToFront();
-
- WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value);
}
/* write new key bindings back to player setup */
}
/* write new key bindings back to player setup */
@@
-6461,8
+6459,6
@@
static boolean CalibrateJoystickMain(int player_nr)
DoAnimation();
BackToFront();
DoAnimation();
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) */
@@
-6484,7
+6480,7
@@
static boolean CalibrateJoystickMain(int player_nr)
NextEvent(&event);
HandleOtherEvents(&event);
NextEvent(&event);
HandleOtherEvents(&event);
-
WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value
);
+
BackToFront(
);
}
}
}
}
@@
-6935,14
+6931,10
@@
static void CreateScreenScrollbars()
void CreateScreenGadgets()
{
void CreateScreenGadgets()
{
- int last_game_status = game_status; /* save current game status */
-
CreateScreenMenubuttons();
CreateScreenScrollbuttons();
CreateScreenScrollbars();
CreateScreenMenubuttons();
CreateScreenScrollbuttons();
CreateScreenScrollbars();
-
- SetGameStatus(last_game_status); /* restore current game status */
}
void FreeScreenGadgets()
}
void FreeScreenGadgets()