From bc8503fee1600305a9e915da07d5f2c29d9890b6 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 2 Aug 2003 23:25:44 +0200 Subject: [PATCH] rnd-20030802-2-src --- CHANGES | 8 +++- src/conftime.h | 2 +- src/init.c | 15 ++++++ src/libgame/setup.c | 112 ++++++++++++++++++++++++++++++++++++++++++++ src/screens.c | 29 ++++++++++++ 5 files changed, 164 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 2e7bb1d1..389da539 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,12 @@ -Pre-Release Version 3.3.0 [?? ??? ????] +Release Version 3.0.0 [02 AUG 2003] ------------------------------------------ + - final version bumped to 3.0.0 due to the massive changes + - custom elements now have lots of configurable properties + - advanced custom element settings for powerful new elements - fixed Supaplex gravity tubes + - added new contributed levels from the following players: + + Juergen Bonhagen (with complete artwork set) + + Andreas Buschbeck (with complete artwork set) Pre-Release Version 2.2.0rc7 [17 JUL 2003] ------------------------------------------ diff --git a/src/conftime.h b/src/conftime.h index 7e8f2f32..f2784dea 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-08-02 02:07]" +#define COMPILE_DATE_STRING "[2003-08-02 20:23]" diff --git a/src/init.c b/src/init.c index 79a67d1e..dde09f6d 100644 --- a/src/init.c +++ b/src/init.c @@ -3195,8 +3195,17 @@ void InitLevelArtworkInfo() static void InitImages() { + + TreeInfo *tst1 = getTreeInfoFromIdentifier(leveldir_first, "jue1"); + TreeInfo *tst2 = getTreeInfoFromIdentifier(leveldir_first, "demojue"); + printf("::: XXX 0 '%s' [%x, %x]\n", tst1->graphics_path, + tst1->graphics_path, tst2->graphics_path); + + setLevelArtworkDir(artwork.gfx_first); + printf("::: XXX 1 '%s'\n", tst1->graphics_path); + #if 0 printf("::: InitImages for '%s' ['%s', '%s'] ['%s', '%s']\n", leveldir_current->identifier, @@ -3208,10 +3217,16 @@ static void InitImages() ReloadCustomImages(); + printf("::: XXX 2 '%s'\n", tst1->graphics_path); + LoadCustomElementDescriptions(); LoadSpecialMenuDesignSettings(); + printf("::: XXX 3 '%s'\n", tst1->graphics_path); + ReinitializeGraphics(); + + printf("::: XXX 4 '%s'\n", tst1->graphics_path); } static void InitSound(char *identifier) diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 51c6f646..20160fc7 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -332,17 +332,39 @@ void setLevelArtworkDir(TreeInfo *ti) char **artwork_path_ptr, **artwork_set_ptr; TreeInfo *level_artwork; + TreeInfo *tst1 = getTreeInfoFromIdentifier(leveldir_first, "jue1"); + printf("::: XXX 0.1 '%s'\n", tst1->graphics_path); + if (ti == NULL || leveldir_current == NULL) return; artwork_path_ptr = &(LEVELDIR_ARTWORK_PATH(leveldir_current, ti->type)); artwork_set_ptr = &(LEVELDIR_ARTWORK_SET( leveldir_current, ti->type)); + printf("::: ['%s', '%s']\n", tst1->identifier, leveldir_current->identifier); + + printf("::: XXX 0.2 '%s' [%x]\n", tst1->graphics_path, tst1->graphics_path); + +#if 1 if (*artwork_path_ptr != NULL) + { + if (ti->type == 0) + printf("::: free'ing '%s' [%x] [%x] [type %d] ...\n", + *artwork_path_ptr, *artwork_path_ptr, + leveldir_current->graphics_path, ti->type); + free(*artwork_path_ptr); + } +#endif + + printf("::: XXX 0.3 '%s' [%x]\n", tst1->graphics_path, tst1->graphics_path); if ((level_artwork = getTreeInfoFromIdentifier(ti, *artwork_set_ptr))) + { *artwork_path_ptr = getStringCopy(getSetupArtworkDir(level_artwork)); + + printf(":1: setting to '%s' [type %d] ...\n", *artwork_path_ptr, ti->type); + } else { /* No (or non-existing) artwork configured in "levelinfo.conf". This would @@ -361,11 +383,19 @@ void setLevelArtworkDir(TreeInfo *ti) { *artwork_path_ptr = getStringCopy(getDefaultArtworkDir(ti->type)); *artwork_set_ptr = getStringCopy(getDefaultArtworkSet(ti->type)); + + if (ti->type == 0) + printf(":2: setting to '%s' [type %d] ...\n", + *artwork_path_ptr, ti->type); } else { *artwork_path_ptr = getStringCopy(UNDEFINED_FILENAME); *artwork_set_ptr = NULL; + + if (ti->type == 0) + printf(":3: setting to '%s' [type %d] ...\n", + *artwork_path_ptr, ti->type); } free(dir); @@ -1497,12 +1527,14 @@ static void setTreeInfoToDefaults(TreeInfo *ldi, int type) if (ldi->type == TREE_TYPE_LEVEL_DIR) { ldi->imported_from = NULL; + ldi->graphics_set = NULL; ldi->sounds_set = NULL; ldi->music_set = NULL; ldi->graphics_path = getStringCopy(UNDEFINED_FILENAME); ldi->sounds_path = getStringCopy(UNDEFINED_FILENAME); ldi->music_path = getStringCopy(UNDEFINED_FILENAME); + ldi->levels = 0; ldi->first_level = 0; ldi->last_level = 0; @@ -1523,6 +1555,55 @@ static void setTreeInfoToDefaultsFromParent(TreeInfo *ldi, TreeInfo *parent) return; } +#if 1 + /* copy all values from the parent structure */ + + ldi->type = parent->type; + + ldi->node_top = parent->node_top; + ldi->node_parent = parent; + ldi->node_group = NULL; + ldi->next = NULL; + + ldi->cl_first = -1; + ldi->cl_cursor = -1; + + ldi->filename = NULL; + ldi->fullpath = NULL; + ldi->basepath = NULL; + ldi->identifier = NULL; + ldi->name = getStringCopy(ANONYMOUS_NAME); + ldi->name_sorting = NULL; + ldi->author = getStringCopy(parent->author); + + ldi->sort_priority = parent->sort_priority; + ldi->parent_link = FALSE; + ldi->user_defined = parent->user_defined; + ldi->color = parent->color; + ldi->class_desc = getStringCopy(parent->class_desc); + + if (ldi->type == TREE_TYPE_LEVEL_DIR) + { + ldi->imported_from = getStringCopy(parent->imported_from); + + ldi->graphics_set = NULL; + ldi->sounds_set = NULL; + ldi->music_set = NULL; + ldi->graphics_path = getStringCopy(UNDEFINED_FILENAME); + ldi->sounds_path = getStringCopy(UNDEFINED_FILENAME); + ldi->music_path = getStringCopy(UNDEFINED_FILENAME); + + ldi->levels = 0; + ldi->first_level = 0; + ldi->last_level = 0; + ldi->level_group = FALSE; + ldi->handicap_level = 0; + ldi->readonly = TRUE; + } + + +#else + /* first copy all values from the parent structure ... */ *ldi = *parent; @@ -1540,7 +1621,16 @@ static void setTreeInfoToDefaultsFromParent(TreeInfo *ldi, TreeInfo *parent) ldi->name = getStringCopy(ANONYMOUS_NAME); ldi->name_sorting = NULL; ldi->author = getStringCopy(parent->author); + ldi->imported_from = getStringCopy(parent->imported_from); + ldi->class_desc = getStringCopy(parent->class_desc); + + ldi->graphics_set = NULL; + ldi->sounds_set = NULL; + ldi->music_set = NULL; + ldi->graphics_path = NULL; + ldi->sounds_path = NULL; + ldi->music_path = NULL; ldi->level_group = FALSE; ldi->parent_link = FALSE; @@ -1549,6 +1639,8 @@ static void setTreeInfoToDefaultsFromParent(TreeInfo *ldi, TreeInfo *parent) ldi->node_parent = parent; ldi->node_group = NULL; ldi->next = NULL; + +#endif } void setSetupInfo(struct TokenInfo *token_info, @@ -1830,6 +1922,13 @@ void LoadLevelInfo() LoadLevelInfoFromLevelDir(&leveldir_first, NULL, options.level_directory); LoadLevelInfoFromLevelDir(&leveldir_first, NULL, getUserLevelDir(NULL)); + { + TreeInfo *tst1 = getTreeInfoFromIdentifier(leveldir_first, "jue1"); + TreeInfo *tst2 = getTreeInfoFromIdentifier(leveldir_first, "demojue"); + printf("::: ??? 1 '%s' [%x, %x]\n", tst1->graphics_path, + tst1->graphics_path, tst2->graphics_path); + } + /* before sorting, the first entries will be from the user directory */ leveldir_current = getFirstValidTreeInfoEntry(leveldir_first); @@ -2264,6 +2363,18 @@ static void SaveUserLevelInfo() /* always start with reliable default values */ setTreeInfoToDefaults(&ldi, TREE_TYPE_LEVEL_DIR); +#if 0 + /* !!! FIX ME !!! */ + setString(&ldi.name, getLoginName()); + setString(&ldi.author, getRealName()); + ldi.levels = 100; + ldi.first_level = 1; + ldi.sort_priority = LEVELCLASS_USER_START; + ldi.readonly = FALSE; + setString(&ldi.graphics_set, GRAPHICS_SUBDIR); + setString(&ldi.sounds_set, SOUNDS_SUBDIR); + setString(&ldi.music_set, MUSIC_SUBDIR); +#else ldi.name = getStringCopy(getLoginName()); ldi.author = getStringCopy(getRealName()); ldi.levels = 100; @@ -2273,6 +2384,7 @@ static void SaveUserLevelInfo() ldi.graphics_set = getStringCopy(GRAPHICS_SUBDIR); ldi.sounds_set = getStringCopy(SOUNDS_SUBDIR); ldi.music_set = getStringCopy(MUSIC_SUBDIR); +#endif fprintf(file, "%s\n\n", getFormattedSetupEntry(TOKEN_STR_FILE_IDENTIFIER, getCookie("LEVELINFO"))); diff --git a/src/screens.c b/src/screens.c index 65708d24..d096d3bb 100644 --- a/src/screens.c +++ b/src/screens.c @@ -197,6 +197,8 @@ void DrawMainMenu() int level_width = font_width * strlen("Level:"); int i; + printf("::: CHECK A: '%s'\n", leveldir_current->graphics_path); + UnmapAllGadgets(); FadeSounds(); @@ -222,9 +224,24 @@ void DrawMainMenu() /* needed if last screen was the setup screen and fullscreen state changed */ ToggleFullscreenIfNeeded(); + printf("::: CHECK B.1: '%s'\n", leveldir_current->graphics_path); + +#if 1 + /* leveldir_current may be invalid (level group, parent link) */ + if (!validLevelSeries(leveldir_current)) + leveldir_current = getFirstValidTreeInfoEntry(leveldir_last_valid); + + /* store valid level series information */ + leveldir_last_valid = leveldir_current; +#endif + + printf("::: CHECK B.2: '%s'\n", leveldir_current->graphics_path); + /* needed if last screen (level choice) changed graphics, sounds or music */ ReloadCustomArtwork(); + printf("::: CHECK C: '%s'\n", leveldir_current->graphics_path); + #ifdef TARGET_SDL SetDrawtoField(DRAW_BACKBUFFER); #endif @@ -232,12 +249,14 @@ void DrawMainMenu() /* map gadgets for main menu screen */ MapTapeButtons(); +#if 0 /* leveldir_current may be invalid (level group, parent link) */ if (!validLevelSeries(leveldir_current)) leveldir_current = getFirstValidTreeInfoEntry(leveldir_last_valid); /* store valid level series information */ leveldir_last_valid = leveldir_current; +#endif /* level_nr may have been set to value over handicap with level editor */ if (setup.handicap && level_nr > leveldir_current->handicap_level) @@ -306,6 +325,8 @@ static void gotoTopLevelDir() /* move upwards to top level directory */ while (leveldir_current->node_parent) { + printf("::: ---> '%s'\n", leveldir_current->graphics_path); + /* write a "path" into level tree for easy navigation to last level */ if (leveldir_current->node_parent->node_group->cl_first == -1) { @@ -327,7 +348,11 @@ static void gotoTopLevelDir() } leveldir_current = leveldir_current->node_parent; + + printf("::: +++> '%s'\n", leveldir_current->graphics_path); } + + printf("::: ===> '%s'\n", leveldir_current->graphics_path); } void HandleMainMenu(int mx, int my, int dx, int dy, int button) @@ -418,8 +443,12 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) SaveLevelSetup_LastSeries(); SaveLevelSetup_SeriesInfo(); + printf("::: CHECK C.1: '%s'\n", leveldir_current->graphics_path); + gotoTopLevelDir(); + printf("::: CHECK C.2: '%s'\n", leveldir_current->graphics_path); + DrawChooseLevel(); } } -- 2.34.1