X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fsetup.h;h=c8c5feccd309922b6bcdc066de190fc7a528e8e6;hp=38a732f475ec74ac68a1524c27f1919ba2d0a634;hb=3bb225da5092d0741870829d9f8f8642070d29c5;hpb=05deb9f50dbf596012b2ab0116b95548d2182410 diff --git a/src/libgame/setup.h b/src/libgame/setup.h index 38a732f4..c8c5fecc 100644 --- a/src/libgame/setup.h +++ b/src/libgame/setup.h @@ -114,6 +114,11 @@ typedef struct hashtable SetupFileHash; } \ +// sort priorities of special tree entries +#define LEVELCLASS_TOP 0 +#define LEVELCLASS_PARENT 1 +#define LEVELCLASS_LAST_PLAYED_LEVEL 2 + // sort priorities of level series (also used as level series classes) #define LEVELCLASS_TUTORIAL_START 10 #define LEVELCLASS_TUTORIAL_END 99 @@ -227,6 +232,30 @@ typedef struct hashtable SetupFileHash; IS_ARTWORKCLASS_LEVEL(n) ? ARTWORKCLASS_LEVEL : \ ARTWORKCLASS_UNDEFINED) +#define TREE_SORTING_DIR(ti) \ + (((ti)->parent_link ? 0 : \ + (ti)->in_user_dir ? 4 * 200 : \ + (ti)->sort_priority >= LEVELCLASS_CLASSICS_START ? 3 * 200 + \ + (ti)->sort_priority % 100 : \ + (ti)->sort_priority >= LEVELCLASS_TUTORIAL_START ? 2 * 200 + \ + (ti)->sort_priority % 100 : \ + 1 * 200) + \ + ((ti)->level_group ? 0 : 100)) + +#define TREE_COLOR_DIR(ti, active) \ + ((active) ? FC_YELLOW : \ + TREE_SORTING(ti) / 200 == 4 ? FC_GREEN : \ + TREE_SORTING(ti) / 200 == 2 ? FC_BLUE : \ + FC_RED) + +#define TREE_SORTING(ti) \ + (TREE_TYPE_IS_DIR((ti)->type) ? TREE_SORTING_DIR(ti) : \ + (ti)->sort_priority) + +#define TREE_COLOR(ti, active) \ + (TREE_TYPE_IS_DIR((ti)->type) ? TREE_COLOR_DIR(ti, active) : \ + (ti)->color) + char *getUserGraphicsDir(void); char *getUserSoundsDir(void); @@ -262,8 +291,10 @@ void InitLevelSetupDirectory(char *); TreeInfo *newTreeInfo(void); TreeInfo *newTreeInfo_setDefaults(int); void pushTreeInfo(TreeInfo **, TreeInfo *); +void removeTreeInfo(TreeInfo **); int numTreeInfo(TreeInfo *); boolean validLevelSeries(TreeInfo *); +TreeInfo *getValidLevelSeries(TreeInfo *, TreeInfo *); TreeInfo *getFirstValidTreeInfoEntry(TreeInfo *); TreeInfo *getTreeInfoFirstGroupEntry(TreeInfo *); int numTreeInfoInGroup(TreeInfo *); @@ -343,6 +374,10 @@ void AddTreeSetToTreeInfo(TreeInfo *, char *, char *, int); boolean UpdateUserLevelSet(char *, char *, char *, int); boolean CreateUserLevelSet(char *, char *, char *, int, boolean); +void UpdateLastPlayedLevels_TreeInfo(void); +void StoreLastPlayedLevels(TreeInfo *); +void RestoreLastPlayedLevels(TreeInfo **); + void LoadLevelSetup_LastSeries(void); void SaveLevelSetup_LastSeries(void); void SaveLevelSetup_LastSeries_Deactivate(void);