minor code improvement
[rocksndiamonds.git] / src / libgame / setup.h
index 3af76ed5fa13b92479da451b6657cc3e0c98738c..8ec6b4d8dc14fd616eea7c3ee8ff06564ded463e 100644 (file)
@@ -4,7 +4,7 @@
 // (c) 1995-2014 by Artsoft Entertainment
 //                         Holger Schemel
 //                 info@artsoft.org
-//                 http://www.artsoft.org/
+//                 https://www.artsoft.org/
 // ----------------------------------------------------------------------------
 // setup.h
 // ============================================================================
@@ -227,6 +227,28 @@ 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 :   \
+         (ti)->sort_priority >= LEVELCLASS_CLASSICS_START      ? 3 :   \
+         (ti)->sort_priority >= LEVELCLASS_TUTORIAL_START      ? 2 :   \
+         1) * 2 +                                                      \
+        ((ti)->level_group ? 0 : 1))
+
+#define TREE_COLOR_DIR(ti, active)                                     \
+       ((active)                       ? FC_YELLOW :                   \
+        TREE_SORTING(ti) / 2 == 4      ? FC_GREEN :                    \
+        TREE_SORTING(ti) / 2 == 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,12 +284,13 @@ void InitLevelSetupDirectory(char *);
 TreeInfo *newTreeInfo(void);
 TreeInfo *newTreeInfo_setDefaults(int);
 void pushTreeInfo(TreeInfo **, TreeInfo *);
+void removeTreeInfo(TreeInfo **);
 int numTreeInfo(TreeInfo *);
 boolean validLevelSeries(TreeInfo *);
 TreeInfo *getFirstValidTreeInfoEntry(TreeInfo *);
 TreeInfo *getTreeInfoFirstGroupEntry(TreeInfo *);
 int numTreeInfoInGroup(TreeInfo *);
-int posTreeInfo(TreeInfo *);
+int getPosFromTreeInfo(TreeInfo *);
 TreeInfo *getTreeInfoFromPos(TreeInfo *, int);
 TreeInfo *getTreeInfoFromIdentifier(TreeInfo *, char *);
 void dumpTreeInfo(TreeInfo *, int);
@@ -280,6 +303,7 @@ void freeTreeInfo(TreeInfo *);
 char *getHomeDir(void);
 char *getCommonDataDir(void);
 char *getPersonalDataDir(void);
+char *getMainUserGameDataDir(void);
 char *getUserGameDataDir(void);
 char *getSetupDir(void);
 char *getLevelDirFromTreeInfo(TreeInfo *);
@@ -289,6 +313,7 @@ char *getCurrentLevelDir(void);
 char *getNewUserLevelSubdir(void);
 
 void createDirectory(char *, char *, int);
+void InitMainUserDataDirectory(void);
 void InitUserDataDirectory(void);
 void SetFilePermissions(char *, int);
 
@@ -324,6 +349,10 @@ int GetZipFileTreeType(char *);
 char *ExtractZipFileIntoDirectory(char *, char *, int);
 
 boolean AdjustGraphicsForEMC(void);
+boolean AdjustSoundsForEMC(void);
+
+void SetCurrentArtwork(int);
+void ChangeCurrentArtworkIfNeeded(int);
 
 void LoadLevelInfo(void);
 void LoadArtworkInfo(void);
@@ -337,6 +366,8 @@ void AddTreeSetToTreeInfo(TreeInfo *, char *, char *, int);
 boolean UpdateUserLevelSet(char *, char *, char *, int);
 boolean CreateUserLevelSet(char *, char *, char *, int, boolean);
 
+void UpdateLastPlayedLevels_TreeInfo(void);
+
 void LoadLevelSetup_LastSeries(void);
 void SaveLevelSetup_LastSeries(void);
 void SaveLevelSetup_LastSeries_Deactivate(void);
@@ -350,4 +381,7 @@ void LevelStats_setSolved(int, int);
 void LevelStats_incPlayed(int);
 void LevelStats_incSolved(int);
 
+void LoadUserSetup(void);
+void SaveUserSetup(void);
+
 #endif // MISC_H