From: Holger Schemel Date: Thu, 19 Oct 2006 17:52:03 +0000 (+0200) Subject: rnd-20061019-2-src X-Git-Tag: 3.2.3^2~27 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=ca40038f7fbffd28bd6a106715a573d2029b5a04;p=rocksndiamonds.git rnd-20061019-2-src --- diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 3340c89e..1427994e 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -4497,6 +4497,11 @@ struct ConfigInfo image_config[] = { "background.envelope_4.anim_mode", "default" }, { "background.envelope_4.draw_masked", "false" }, + { "titlescreen_initial_1", UNDEFINED_FILENAME }, + { "titlescreen_initial_2", UNDEFINED_FILENAME }, + { "titlescreen_initial_3", UNDEFINED_FILENAME }, + { "titlescreen_initial_4", UNDEFINED_FILENAME }, + { "titlescreen_initial_5", UNDEFINED_FILENAME }, { "titlescreen_1", UNDEFINED_FILENAME }, { "titlescreen_2", UNDEFINED_FILENAME }, { "titlescreen_3", UNDEFINED_FILENAME }, @@ -4567,6 +4572,7 @@ struct ConfigInfo image_config[] = { "menu.fade_delay", "250" }, { "menu.post_delay", "125" }, + { "menu.auto_delay", "0" }, { "main.button.name.x", "0" }, { "main.button.name.y", "64" }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index 1f0d5dc1..33083cc2 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -1563,26 +1563,31 @@ #define IMG_BACKGROUND_ENVELOPE_2 1542 #define IMG_BACKGROUND_ENVELOPE_3 1543 #define IMG_BACKGROUND_ENVELOPE_4 1544 -#define IMG_TITLESCREEN_1 1545 -#define IMG_TITLESCREEN_2 1546 -#define IMG_TITLESCREEN_3 1547 -#define IMG_TITLESCREEN_4 1548 -#define IMG_TITLESCREEN_5 1549 -#define IMG_BACKGROUND 1550 -#define IMG_BACKGROUND_TITLE 1551 -#define IMG_BACKGROUND_MAIN 1552 -#define IMG_BACKGROUND_LEVELS 1553 -#define IMG_BACKGROUND_SCORES 1554 -#define IMG_BACKGROUND_EDITOR 1555 -#define IMG_BACKGROUND_INFO 1556 -#define IMG_BACKGROUND_INFO_ELEMENTS 1557 -#define IMG_BACKGROUND_INFO_MUSIC 1558 -#define IMG_BACKGROUND_INFO_CREDITS 1559 -#define IMG_BACKGROUND_INFO_PROGRAM 1560 -#define IMG_BACKGROUND_INFO_LEVELSET 1561 -#define IMG_BACKGROUND_SETUP 1562 -#define IMG_BACKGROUND_DOOR 1563 +#define IMG_TITLESCREEN_INITIAL_1 1545 +#define IMG_TITLESCREEN_INITIAL_2 1546 +#define IMG_TITLESCREEN_INITIAL_3 1547 +#define IMG_TITLESCREEN_INITIAL_4 1548 +#define IMG_TITLESCREEN_INITIAL_5 1549 +#define IMG_TITLESCREEN_1 1550 +#define IMG_TITLESCREEN_2 1551 +#define IMG_TITLESCREEN_3 1552 +#define IMG_TITLESCREEN_4 1553 +#define IMG_TITLESCREEN_5 1554 +#define IMG_BACKGROUND 1555 +#define IMG_BACKGROUND_TITLE 1556 +#define IMG_BACKGROUND_MAIN 1557 +#define IMG_BACKGROUND_LEVELS 1558 +#define IMG_BACKGROUND_SCORES 1559 +#define IMG_BACKGROUND_EDITOR 1560 +#define IMG_BACKGROUND_INFO 1561 +#define IMG_BACKGROUND_INFO_ELEMENTS 1562 +#define IMG_BACKGROUND_INFO_MUSIC 1563 +#define IMG_BACKGROUND_INFO_CREDITS 1564 +#define IMG_BACKGROUND_INFO_PROGRAM 1565 +#define IMG_BACKGROUND_INFO_LEVELSET 1566 +#define IMG_BACKGROUND_SETUP 1567 +#define IMG_BACKGROUND_DOOR 1568 -#define NUM_IMAGE_FILES 1564 +#define NUM_IMAGE_FILES 1569 #endif /* CONF_GFX_H */ diff --git a/src/conftime.h b/src/conftime.h index 02614da5..66817545 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-10-19 00:36]" +#define COMPILE_DATE_STRING "[2006-10-19 19:44]" diff --git a/src/events.c b/src/events.c index dbaa4373..7ea4356b 100644 --- a/src/events.c +++ b/src/events.c @@ -127,7 +127,7 @@ void EventLoop(void) while (NextValidEvent(&event)) { - switch(event.type) + switch (event.type) { case EVENT_BUTTONPRESS: case EVENT_BUTTONRELEASE: @@ -194,7 +194,7 @@ void EventLoop(void) void HandleOtherEvents(Event *event) { - switch(event->type) + switch (event->type) { case EVENT_EXPOSE: HandleExposeEvent((ExposeEvent *) event); @@ -238,7 +238,7 @@ void ClearEventQueue() NextEvent(&event); - switch(event.type) + switch (event.type) { case EVENT_BUTTONRELEASE: button_status = MB_RELEASED; @@ -281,7 +281,7 @@ void SleepWhileUnmapped() NextEvent(&event); - switch(event.type) + switch (event.type) { case EVENT_BUTTONRELEASE: button_status = MB_RELEASED; @@ -781,7 +781,7 @@ void HandleKey(Key key, int key_status) key = KSYM_UNDEFINED; } - switch(game_status) + switch (game_status) { case GAME_MODE_PSEUDO_TYPENAME: HandleTypeName(0, key); @@ -793,7 +793,7 @@ void HandleKey(Key key, int key_status) case GAME_MODE_SETUP: case GAME_MODE_INFO: case GAME_MODE_SCORES: - switch(key) + switch (key) { case KSYM_space: case KSYM_Return: @@ -864,7 +864,7 @@ void HandleKey(Key key, int key_status) case GAME_MODE_PLAYING: { - switch(key) + switch (key) { case KSYM_Escape: RequestQuitGame(setup.ask_on_escape); @@ -1029,7 +1029,7 @@ void HandleJoystick() int dx = (left ? -1 : right ? 1 : 0); int dy = (up ? -1 : down ? 1 : 0); - switch(game_status) + switch (game_status) { case GAME_MODE_TITLE: case GAME_MODE_MAIN: diff --git a/src/game.c b/src/game.c index 6148015d..2ed1121b 100644 --- a/src/game.c +++ b/src/game.c @@ -2488,7 +2488,7 @@ void InitMovDir(int x, int y) { MV_LEFT, MV_RIGHT, MV_UP, MV_DOWN } }; - switch(element) + switch (element) { case EL_BUG_RIGHT: case EL_BUG_UP: @@ -3922,7 +3922,7 @@ void Bang(int x, int y) } } - switch(element) + switch (element) { case EL_BUG: case EL_SPACESHIP: @@ -7717,7 +7717,7 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) /* ---------- execute action -------------------------------------------- */ - switch(action_type) + switch (action_type) { case CA_NO_ACTION: { @@ -12384,7 +12384,7 @@ void RaiseScore(int value) void RaiseScoreElement(int element) { - switch(element) + switch (element) { case EL_EMERALD: case EL_BD_DIAMOND: diff --git a/src/libgame/misc.c b/src/libgame/misc.c index ec16eeee..3bbf74a7 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1781,6 +1781,8 @@ int get_parameter_value(char *value_raw, char *suffix, int type) string_has_parameter(value, "horizontal") ? ANIM_HORIZONTAL : string_has_parameter(value, "vertical") ? ANIM_VERTICAL : string_has_parameter(value, "centered") ? ANIM_CENTERED : + string_has_parameter(value, "fade") ? ANIM_FADE : + string_has_parameter(value, "crossfade") ? ANIM_CROSSFADE : ANIM_DEFAULT); if (string_has_parameter(value, "reverse")) diff --git a/src/libgame/system.h b/src/libgame/system.h index 6fa176b4..73d67f0b 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -196,6 +196,8 @@ #define ANIM_VERTICAL (1 << 11) #define ANIM_CENTERED (1 << 12) #define ANIM_STATIC_PANEL (1 << 13) +#define ANIM_FADE (1 << 14) +#define ANIM_CROSSFADE (1 << 15) #define ANIM_DEFAULT ANIM_LOOP diff --git a/src/main.c b/src/main.c index ac42d28c..e4d912ab 100644 --- a/src/main.c +++ b/src/main.c @@ -4693,6 +4693,7 @@ struct TokenIntPtrInfo image_config_vars[] = { "menu.fade_delay", &menu.fade_delay }, { "menu.post_delay", &menu.post_delay }, + { "menu.auto_delay", &menu.auto_delay }, { "main.button.name.x", &menu.main.button.name.x }, { "main.button.name.y", &menu.main.button.name.y }, diff --git a/src/main.h b/src/main.h index 4ef25ab1..c7731723 100644 --- a/src/main.h +++ b/src/main.h @@ -1915,6 +1915,7 @@ struct MenuInfo int fade_delay; int post_delay; + int auto_delay; int sound[NUM_SPECIAL_GFX_ARGS]; int music[NUM_SPECIAL_GFX_ARGS]; diff --git a/src/netserv.c b/src/netserv.c index 4e65cf3d..a62cae02 100644 --- a/src/netserv.c +++ b/src/netserv.c @@ -740,7 +740,7 @@ void NetworkServer(int port, int serveronly) break; } - switch(buffer[1]) + switch (buffer[1]) { case OP_PLAYER_NAME: Handle_OP_PLAYER_NAME(player, len); diff --git a/src/network.c b/src/network.c index 412d2bd8..f2f1ea28 100644 --- a/src/network.c +++ b/src/network.c @@ -626,7 +626,7 @@ static void HandleNetworkingMessages() nread -= 4 + message_length; memmove(readbuffer, readbuffer + 4 + message_length, nread); - switch(buffer[1]) + switch (buffer[1]) { case OP_BAD_PROTOCOL_VERSION: Handle_OP_BAD_PROTOCOL_VERSION(); diff --git a/src/screens.c b/src/screens.c index ce3bbe47..9c2ed1b1 100644 --- a/src/screens.c +++ b/src/screens.c @@ -158,6 +158,9 @@ static void MapScreenMenuGadgets(int); static void MapScreenTreeGadgets(TreeInfo *); static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS]; + +static boolean show_titlescreen_initial = TRUE; + static int setup_mode = SETUP_MODE_MAIN; static int info_mode = INFO_MODE_MAIN; @@ -512,11 +515,13 @@ static void DrawCursorAndText_Main(int pos, boolean active) static boolean insideMenuPosRect(struct MenuPosInfo *rect, int x, int y) { + if (rect == NULL) + return FALSE; + int rect_x = ALIGNED_XPOS(rect->x, rect->width, rect->align); int rect_y = rect->y; - return (rect != NULL && - x >= rect_x && x < rect_x + rect->width && + return (x >= rect_x && x < rect_x + rect->width && y >= rect_y && y < rect_y + rect->height); } @@ -596,9 +601,15 @@ static int getLevelRangeTextPos() } #endif +static int getTitleScreenGraphic() +{ + return (show_titlescreen_initial ? IMG_TITLESCREEN_INITIAL_1 : + IMG_TITLESCREEN_1); +} + void DrawTitleScreenImage(int nr) { - int graphic = IMG_TITLESCREEN_1 + nr; + int graphic = getTitleScreenGraphic() + nr; Bitmap *bitmap = graphic_info[graphic].bitmap; int width = graphic_info[graphic].src_image_width; int height = graphic_info[graphic].src_image_height; @@ -705,8 +716,10 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) #endif if (setup.show_titlescreen && - levelset_has_changed && - graphic_info[IMG_TITLESCREEN_1].bitmap != NULL) + ((levelset_has_changed && + graphic_info[IMG_TITLESCREEN_1].bitmap != NULL) || + (show_titlescreen_initial && + graphic_info[IMG_TITLESCREEN_INITIAL_1].bitmap != NULL))) { game_status = GAME_MODE_TITLE; @@ -870,14 +883,18 @@ static void gotoTopLevelDir() void HandleTitleScreen(int mx, int my, int dx, int dy, int button) { + static unsigned long title_delay = 0; static int title_nr = 0; boolean return_to_main_menu = FALSE; boolean use_fading_main_menu = TRUE; - boolean use_cross_fading = TRUE; + boolean use_cross_fading = !show_titlescreen_initial; /* default */ + int auto_delay = menu.auto_delay; if (button == MB_MENU_INITIALIZE) { int last_game_status = game_status; /* save current game status */ + + title_delay = 0; title_nr = 0; if (game_status == GAME_MODE_INFO) @@ -907,9 +924,19 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) FadeIn(REDRAW_ALL); + DelayReached(&title_delay, 0); /* reset delay counter */ + return; } - else if (button == MB_MENU_LEAVE) + + int anim_delay = graphic_info[getTitleScreenGraphic() + title_nr].anim_delay; + if (anim_delay > 1) + auto_delay = anim_delay; + + if (auto_delay > 0 && DelayReached(&title_delay, auto_delay)) + button = MB_MENU_CHOICE; + + if (button == MB_MENU_LEAVE) { return_to_main_menu = TRUE; use_fading_main_menu = FALSE; @@ -927,11 +954,26 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) title_nr++; + if (show_titlescreen_initial && + (title_nr >= MAX_NUM_TITLE_SCREENS || + graphic_info[IMG_TITLESCREEN_INITIAL_1 + title_nr].bitmap == NULL)) + { + show_titlescreen_initial = FALSE; + + title_nr = 0; /* restart with title screens for current level set */ + } + + int anim_mode = graphic_info[getTitleScreenGraphic() + title_nr].anim_mode; + + use_cross_fading = (anim_mode == ANIM_FADE ? FALSE : + anim_mode == ANIM_CROSSFADE ? TRUE : + use_cross_fading); + if (!use_cross_fading) FadeOut(REDRAW_ALL); if (title_nr < MAX_NUM_TITLE_SCREENS && - graphic_info[IMG_TITLESCREEN_1 + title_nr].bitmap != NULL) + graphic_info[getTitleScreenGraphic() + title_nr].bitmap != NULL) { if (use_cross_fading) FadeCrossSaveBackbuffer(); @@ -942,6 +984,8 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) FadeCross(REDRAW_ALL); else FadeIn(REDRAW_ALL); + + DelayReached(&title_delay, 0); /* reset delay counter */ } else { @@ -3275,7 +3319,7 @@ static Key getSetupKey() NextEvent(&event); - switch(event.type) + switch (event.type) { case EVENT_KEYPRESS: { @@ -4020,7 +4064,7 @@ void CustomizeKeyboard(int player_nr) NextEvent(&event); - switch(event.type) + switch (event.type) { case EVENT_KEYPRESS: { @@ -4170,10 +4214,10 @@ static boolean CalibrateJoystickMain(int player_nr) NextEvent(&event); - switch(event.type) + switch (event.type) { case EVENT_KEYPRESS: - switch(GetEventKey((KeyEvent *)&event, TRUE)) + switch (GetEventKey((KeyEvent *)&event, TRUE)) { case KSYM_Return: if (check_remaining == 0) diff --git a/src/tools.c b/src/tools.c index 41ed06d6..f6441aa0 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2602,7 +2602,7 @@ boolean Request(char *text, unsigned int req_state) NextEvent(&event); - switch(event.type) + switch (event.type) { case EVENT_BUTTONPRESS: case EVENT_BUTTONRELEASE: @@ -2634,7 +2634,7 @@ boolean Request(char *text, unsigned int req_state) /* this sets 'request_gadget_id' */ HandleGadgets(mx, my, button_status); - switch(request_gadget_id) + switch (request_gadget_id) { case TOOL_CTRL_ID_YES: result = TRUE; @@ -2667,7 +2667,7 @@ boolean Request(char *text, unsigned int req_state) } case EVENT_KEYPRESS: - switch(GetEventKey((KeyEvent *)&event, TRUE)) + switch (GetEventKey((KeyEvent *)&event, TRUE)) { case KSYM_Return: result = 1; @@ -5341,7 +5341,7 @@ int map_direction_EM_to_RND(int direction) int get_next_element(int element) { - switch(element) + switch (element) { case EL_QUICKSAND_FILLING: return EL_QUICKSAND_FULL; case EL_QUICKSAND_EMPTYING: return EL_QUICKSAND_EMPTY;