X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsetup.h;h=baf447946a5a977932dffc66449084e5235808c7;hb=483d088f2bd4dd2ee267aff416503b2c667a69d3;hp=7877ccb23246ce42c5fff8d6ba508239359c0144;hpb=076afecb45e19998ef5f8995774bc35ea0f1b4fc;p=rocksndiamonds.git diff --git a/src/libgame/setup.h b/src/libgame/setup.h index 7877ccb2..baf44794 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); @@ -265,6 +294,7 @@ 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 *);