From d965f76d694c19c4188ac3429cfa049200abdf54 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 6 May 2006 17:00:46 +0200 Subject: [PATCH] rnd-20060506-1-src * added some missing element descriptions to the level editor * added the possibility to view the title screen to the info screen menu * fixed some minor bugs with viewing title screens --- ChangeLog | 7 ++++ src/conftime.h | 2 +- src/editor.c | 65 +++++++++++++++++------------ src/init.c | 15 +++++++ src/main.h | 7 +++- src/screens.c | 111 +++++++++++++++++++++++++++++++++++++++++-------- src/tools.c | 10 ++++- 7 files changed, 170 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe3a3bf1..ea35d755 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-05-06 + * added some missing element descriptions to the level editor + +2006-05-05 + * added the possibility to view the title screen to the info screen menu + * fixed some minor bugs with viewing title screens + 2006-05-02 * fixed bug with title (cross)fading in/out when using fullscreen mode diff --git a/src/conftime.h b/src/conftime.h index 2af8db3c..9d39b8fc 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-05-02 02:18]" +#define COMPILE_DATE_STRING "[2006-05-06 16:04]" diff --git a/src/editor.c b/src/editor.c index 631a5756..7ac0d1da 100644 --- a/src/editor.c +++ b/src/editor.c @@ -4536,6 +4536,32 @@ static char *getElementInfoText(int element) return info_text; } +char *getElementDescriptionFilename(int element) +{ + char *docs_dir = options.docs_directory; + char *elements_subdir = "elements"; + static char *filename = NULL; + char basename[MAX_FILENAME_LEN]; + + checked_free(filename); + + /* 1st try: look for element description file for exactly this element */ + sprintf(basename, "%s.txt", element_info[element].token_name); + filename = getPath3(docs_dir, elements_subdir, basename); + if (fileExists(filename)) + return filename; + + free(filename); + + /* 2nd try: look for element description file for this element's class */ + sprintf(basename, "%s.txt", element_info[element].class_name); + filename = getPath3(docs_dir, elements_subdir, basename); + if (fileExists(filename)) + return filename; + + return NULL; +} + static void InitDynamicEditorElementList(int **elements, int *num_elements) { boolean element_found[NUM_FILE_ELEMENTS]; @@ -6891,11 +6917,24 @@ static void CopyElementPropertiesToGame(int element) CopyClassicElementPropertiesToGame(element); } +void CheckElementDescriptions() +{ + int i; + + for (i = 0; i < NUM_FILE_ELEMENTS; i++) + if (getElementDescriptionFilename(i) == NULL && !IS_OBSOLETE(i)) + Error(ERR_WARN, "no element description for element '%s'", EL_NAME(i)); +} + void DrawLevelEd() { CloseDoor(DOOR_CLOSE_ALL); OpenDoor(DOOR_OPEN_2 | DOOR_NO_DELAY); +#if DEBUG + CheckElementDescriptions(); +#endif + if (level_editor_test_game) { CopyPlayfield(level.field, Feld); @@ -7420,32 +7459,6 @@ static void DrawEnvelopeTextArea(int envelope_nr) MapTextAreaGadget(ED_TEXTAREA_ID_ENVELOPE_INFO); } -char *getElementDescriptionFilename(int element) -{ - char *docs_dir = options.docs_directory; - char *elements_subdir = "elements"; - static char *filename = NULL; - char basename[MAX_FILENAME_LEN]; - - checked_free(filename); - - /* 1st try: look for element description file for exactly this element */ - sprintf(basename, "%s.txt", element_info[element].token_name); - filename = getPath3(docs_dir, elements_subdir, basename); - if (fileExists(filename)) - return filename; - - free(filename); - - /* 2nd try: look for element description file for this element's class */ - sprintf(basename, "%s.txt", element_info[element].class_name); - filename = getPath3(docs_dir, elements_subdir, basename); - if (fileExists(filename)) - return filename; - - return NULL; -} - static boolean PrintInfoText(char *text, int font_nr, int start_line) { int font_height = getFontHeight(font_nr); diff --git a/src/init.c b/src/init.c index a25394b6..21a989c6 100644 --- a/src/init.c +++ b/src/init.c @@ -3559,6 +3559,19 @@ void InitElementPropertiesStatic() -1 }; + static int ep_obsolete[] = + { + EL_PLAYER_OBSOLETE, + EL_KEY_OBSOLETE, + EL_EM_KEY_1_FILE_OBSOLETE, + EL_EM_KEY_2_FILE_OBSOLETE, + EL_EM_KEY_3_FILE_OBSOLETE, + EL_EM_KEY_4_FILE_OBSOLETE, + EL_ENVELOPE_OBSOLETE, + + -1 + }; + static struct { int *elements; @@ -3629,6 +3642,8 @@ void InitElementPropertiesStatic() { ep_editor_cascade_active, EP_EDITOR_CASCADE_ACTIVE }, { ep_editor_cascade_inactive, EP_EDITOR_CASCADE_INACTIVE }, + { ep_obsolete, EP_OBSOLETE }, + { NULL, -1 } }; diff --git a/src/main.h b/src/main.h index 774c97c7..96ce9f7f 100644 --- a/src/main.h +++ b/src/main.h @@ -163,7 +163,10 @@ #define EP_HAS_ACTION 87 #define EP_CAN_CHANGE_OR_HAS_ACTION 88 -#define NUM_ELEMENT_PROPERTIES 89 +/* values for internal purpose only (other) */ +#define EP_OBSOLETE 89 + +#define NUM_ELEMENT_PROPERTIES 90 #define NUM_EP_BITFIELDS ((NUM_ELEMENT_PROPERTIES + 31) / 32) #define EP_BITFIELD_BASE 0 @@ -593,6 +596,8 @@ #define CAN_CHANGE_OR_HAS_ACTION(e) \ HAS_PROPERTY(e, EP_CAN_CHANGE_OR_HAS_ACTION) +#define IS_OBSOLETE(e) HAS_PROPERTY(e, EP_OBSOLETE) + /* special macros used in game engine */ #define IS_CUSTOM_ELEMENT(e) ((e) >= EL_CUSTOM_START && \ (e) <= EL_CUSTOM_END) diff --git a/src/screens.c b/src/screens.c index 6dc45883..031d7f6e 100644 --- a/src/screens.c +++ b/src/screens.c @@ -48,13 +48,14 @@ /* screens on the info screen */ #define INFO_MODE_MAIN 0 -#define INFO_MODE_ELEMENTS 1 -#define INFO_MODE_MUSIC 2 -#define INFO_MODE_CREDITS 3 -#define INFO_MODE_PROGRAM 4 -#define INFO_MODE_LEVELSET 5 +#define INFO_MODE_TITLESCREEN 1 +#define INFO_MODE_ELEMENTS 2 +#define INFO_MODE_MUSIC 3 +#define INFO_MODE_CREDITS 4 +#define INFO_MODE_PROGRAM 5 +#define INFO_MODE_LEVELSET 6 -#define MAX_INFO_MODES 6 +#define MAX_INFO_MODES 7 /* for various menu stuff */ #define MENU_SCREEN_START_XPOS 1 @@ -115,9 +116,11 @@ static void DrawChooseLevel(void); static void DrawInfoScreen(void); static void DrawSetupScreen(void); +static void DrawInfoScreenExt(int); static void DrawInfoScreen_HelpAnim(int, int, boolean); static void DrawInfoScreen_HelpText(int, int, int, int); static void HandleInfoScreen_Main(int, int, int, int, int); +static void HandleInfoScreen_TitleScreen(int); static void HandleInfoScreen_Elements(int); static void HandleInfoScreen_Music(int); static void HandleInfoScreen_Credits(int); @@ -491,6 +494,8 @@ static void DrawMainMenuExt(int fade_delay) #if 0 FadeToFront(); +#endif +#if 0 InitAnimation(); #endif @@ -504,6 +509,7 @@ static void DrawMainMenuExt(int fade_delay) PlayMenuSound(); PlayMenuMusic(); +#if 0 #if 1 OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2); #else @@ -512,22 +518,37 @@ static void DrawMainMenuExt(int fade_delay) else OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2); #endif +#endif + +#if 0 + InitAnimation(); +#endif #if 1 /* map gadgets for main menu screen */ MapTapeButtons(); #endif +#if 1 #if 1 FadeIn(fade_delay); +#else + BackToFront(); +#endif +#endif +#if 1 InitAnimation(); #endif + +#if 1 + OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2); +#endif } void DrawMainMenu() { - DrawMainMenuExt(FALSE); + DrawMainMenuExt(0); } #if 0 @@ -574,6 +595,13 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) { title_nr = 0; + if (game_status == GAME_MODE_INFO) + { + FadeSoundsAndMusic(); + + FadeOut(fade_delay, post_delay); + } + DrawTitleScreenImage(title_nr); FadeIn(fade_delay); @@ -621,14 +649,24 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) if (return_to_main_menu) { + int menu_fade_delay = (use_fading_main_menu ? fade_delay : 0); + RedrawBackground(); -#if 1 - OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); -#endif + if (game_status == GAME_MODE_INFO) + { + OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); - game_status = GAME_MODE_MAIN; - DrawMainMenuExt(use_fading_main_menu ? fade_delay : 0); + info_mode = INFO_MODE_MAIN; + DrawInfoScreenExt(menu_fade_delay); + } + else /* default: return to main menu */ + { + OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); + + game_status = GAME_MODE_MAIN; + DrawMainMenuExt(menu_fade_delay); + } } } @@ -800,6 +838,12 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) static struct TokenInfo *info_info; static int num_info_info; +static void execInfoTitleScreen() +{ + info_mode = INFO_MODE_TITLESCREEN; + DrawInfoScreen(); +} + static void execInfoElements() { info_mode = INFO_MODE_ELEMENTS; @@ -838,6 +882,7 @@ static void execExitInfo() static struct TokenInfo info_info_main[] = { + { TYPE_ENTER_SCREEN, execInfoTitleScreen, "Title Screen" }, { TYPE_ENTER_SCREEN, execInfoElements, "Elements Info" }, { TYPE_ENTER_SCREEN, execInfoMusic, "Music Info" }, { TYPE_ENTER_SCREEN, execInfoCredits, "Credits" }, @@ -849,7 +894,7 @@ static struct TokenInfo info_info_main[] = { 0, NULL, NULL } }; -static void DrawInfoScreen_Main() +static void DrawInfoScreen_Main(int fade_delay) { int i; @@ -885,6 +930,18 @@ static void DrawInfoScreen_Main() num_info_info++; } +#if 1 + + HandleInfoScreen_Main(0, 0, 0, 0, MB_MENU_INITIALIZE); + + PlayMenuSound(); + PlayMenuMusic(); + + FadeIn(fade_delay); + InitAnimation(); + +#else + FadeToFront(); InitAnimation(); @@ -892,6 +949,7 @@ static void DrawInfoScreen_Main() PlayMenuMusic(); HandleInfoScreen_Main(0, 0, 0, 0, MB_MENU_INITIALIZE); +#endif } void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button) @@ -1137,6 +1195,16 @@ void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos) max_chars_per_line, max_lines_per_text); } +void DrawInfoScreen_TitleScreen() +{ + DrawTitleScreen(); +} + +void HandleInfoScreen_TitleScreen(int button) +{ + HandleTitleScreen(0, 0, 0, 0, button); +} + void DrawInfoScreen_Elements() { SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_ELEMENTS); @@ -1518,11 +1586,13 @@ void HandleInfoScreen_LevelSet(int button) } } -void DrawInfoScreen() +static void DrawInfoScreenExt(int fade_delay) { SetMainBackgroundImage(IMG_BACKGROUND_INFO); - if (info_mode == INFO_MODE_ELEMENTS) + if (info_mode == INFO_MODE_TITLESCREEN) + DrawInfoScreen_TitleScreen(); + else if (info_mode == INFO_MODE_ELEMENTS) DrawInfoScreen_Elements(); else if (info_mode == INFO_MODE_MUSIC) DrawInfoScreen_Music(); @@ -1533,7 +1603,7 @@ void DrawInfoScreen() else if (info_mode == INFO_MODE_LEVELSET) DrawInfoScreen_LevelSet(); else - DrawInfoScreen_Main(); + DrawInfoScreen_Main(fade_delay); if (info_mode != INFO_MODE_MUSIC) { @@ -1542,9 +1612,16 @@ void DrawInfoScreen() } } +void DrawInfoScreen() +{ + DrawInfoScreenExt(0); +} + void HandleInfoScreen(int mx, int my, int dx, int dy, int button) { - if (info_mode == INFO_MODE_ELEMENTS) + if (info_mode == INFO_MODE_TITLESCREEN) + HandleInfoScreen_TitleScreen(button); + else if (info_mode == INFO_MODE_ELEMENTS) HandleInfoScreen_Elements(button); else if (info_mode == INFO_MODE_MUSIC) HandleInfoScreen_Music(button); diff --git a/src/tools.c b/src/tools.c index 65c62558..bad43ac5 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2615,8 +2615,8 @@ unsigned int MoveDoor(unsigned int door_state) #if 1 int end = door_size; #else - int end = (door_state & DOOR_ACTION_1 && - door_1.anim_mode & ANIM_VERTICAL ? DYSIZE : DXSIZE); + int end = (door_state & DOOR_ACTION_1 && door_1.anim_mode & ANIM_VERTICAL ? + DYSIZE : DXSIZE); #endif #if 1 int start = ((door_state & DOOR_NO_DELAY) ? end : 0); @@ -2734,9 +2734,15 @@ unsigned int MoveDoor(unsigned int door_state) if (door_state & DOOR_ACTION_2) { +#if 1 + int a = MIN(x * door_2.step_offset, door_size); + int p = (door_state & DOOR_OPEN_2 ? door_size - a : a); + int i = p + door_skip; +#else int a = MIN(x * door_2.step_offset, door_size_2); int p = (door_state & DOOR_OPEN_2 ? door_size_2 - a : a); int i = p + door_skip; +#endif if (door_2.anim_mode & ANIM_STATIC_PANEL) { -- 2.34.1