X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fmisc.h;h=159b393a27d0fdb9041c273a04aa5c56997f9d0d;hp=593521ea323e114a534ad5b2b6ccecb96b0abcb9;hb=e086ff916e148637704376bff8314a8f23c5f552;hpb=bc101e8e3ab8515fcc5fbed3d8bf8c3efc258846 diff --git a/src/libgame/misc.h b/src/libgame/misc.h index 593521ea..159b393a 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -4,7 +4,7 @@ // (c) 1995-2014 by Artsoft Entertainment // Holger Schemel // info@artsoft.org -// http://www.artsoft.org/ +// https://www.artsoft.org/ // ---------------------------------------------------------------------------- // misc.h // ============================================================================ @@ -19,11 +19,11 @@ #include "system.h" -/* values for InitCounter() and Counter() */ +// values for InitCounter() and Counter() #define INIT_COUNTER 0 #define READ_COUNTER 1 -/* values for InitRND() */ +// values for InitRND() #define NEW_RANDOMIZE 0 #define RANDOM_ENGINE 0 @@ -34,49 +34,32 @@ #define GetEngineRandom(max) get_random_number(RANDOM_ENGINE, max) #define GetSimpleRandom(max) get_random_number(RANDOM_SIMPLE, max) -/* values for Error() */ -#define ERR_UNKNOWN 0 -#define ERR_DEBUG (1 << 0) -#define ERR_INFO (1 << 1) -#define ERR_INFO_LINE (1 << 2) -#define ERR_WARN (1 << 3) -#define ERR_EXIT (1 << 4) -#define ERR_HELP (1 << 5) -#define ERR_SOUND_SERVER (1 << 6) -#define ERR_NETWORK_SERVER (1 << 7) -#define ERR_NETWORK_CLIENT (1 << 8) -#define ERR_FROM_SERVER (ERR_SOUND_SERVER | ERR_NETWORK_SERVER) -#define ERR_EXIT_HELP (ERR_EXIT | ERR_HELP) -#define ERR_EXIT_SOUND_SERVER (ERR_EXIT | ERR_SOUND_SERVER) -#define ERR_EXIT_NETWORK_SERVER (ERR_EXIT | ERR_NETWORK_SERVER) -#define ERR_EXIT_NETWORK_CLIENT (ERR_EXIT | ERR_NETWORK_CLIENT) - -/* values for getFile...() and putFile...() */ +// values for getFile...() and putFile...() #define BYTE_ORDER_BIG_ENDIAN 0 #define BYTE_ORDER_LITTLE_ENDIAN 1 -/* values for cursor bitmap creation */ +// values for cursor bitmap creation #define BIT_ORDER_MSB 0 #define BIT_ORDER_LSB 1 -/* values for createDirectory() */ +// values for createDirectory() #define PERMS_PRIVATE 0 #define PERMS_PUBLIC 1 -/* values for general file handling stuff */ +// values for general file handling stuff #define MAX_FILENAME_LEN 256 #define MAX_LINE_LEN 1024 -/* values for general username handling stuff */ +// values for general username handling stuff #define MAX_USERNAME_LEN 1024 #if defined(PLATFORM_ANDROID) -/* values for Android asset handling */ +// values for Android asset handling #define ASSET_TOC_BASENAME ".toc" #endif -/* structure definitions */ +// structure definitions typedef struct { @@ -111,7 +94,7 @@ typedef struct } Directory; -/* function definitions */ +// function definitions void fprintf_line(FILE *, char *, int); void fprintf_line_with_prefix(FILE *, char *, char *, int); @@ -119,9 +102,18 @@ void printf_line(char *, int); void printf_line_with_prefix(char *, char *, int); void Print(char *, ...); +void PrintNoLog(char *, ...); void PrintLine(char *, int); void PrintLineWithPrefix(char *, char *, int); +void DebugContinued(char *, char *, ...); +void Debug(char *, char *, ...); +void Info(char *, ...); +void Warn(char *, ...); +void Error(char *, ...); +void Fail(char *, ...); +void FailWithHelp(char *, ...); + char *int2str(int, int); char *i_to_a(unsigned int); int log_2(unsigned int); @@ -131,16 +123,27 @@ boolean getTokenValueFromString(char *, char **, char **); void InitCounter(void); unsigned int Counter(void); void Delay(unsigned int); +boolean DelayReachedExt(unsigned int *, unsigned int, unsigned int); boolean FrameReached(unsigned int *, unsigned int); boolean DelayReached(unsigned int *, unsigned int); +void ResetDelayCounterExt(unsigned int *, unsigned int); +void ResetFrameCounter(unsigned int *); +void ResetDelayCounter(unsigned int *); int WaitUntilDelayReached(unsigned int *, unsigned int); void SkipUntilDelayReached(unsigned int *, unsigned int, int *, int); unsigned int init_random_number(int, int); unsigned int get_random_number(int, int); +#if defined(PLATFORM_UNIX) +char *getUnixLoginName(void); +char *getUnixRealName(void); +char *getUnixHomeDir(void); +#endif + char *getLoginName(void); char *getRealName(void); +char *getFixedUserName(char *); time_t getFileTimestampEpochSeconds(char *); @@ -169,14 +172,10 @@ boolean strSuffix(char *, char *); boolean strPrefixLower(char *, char *); boolean strSuffixLower(char *, char *); -void GetOptions(char **, +void GetOptions(int, char **, void (*print_usage_function)(void), void (*print_version_function)(void)); -void SetError(char *, ...); -char *GetError(void); -void Error(int, char *, ...); - void *checked_malloc(unsigned int); void *checked_calloc(unsigned int); void *checked_realloc(void *, unsigned int); @@ -230,6 +229,7 @@ char getValidConfigValueChar(char); int get_integer_from_string(char *); boolean get_boolean_from_string(char *); int get_switch3_from_string(char *); +int get_player_nr_from_string(char *); ListNode *newListNode(void); void addNodeToList(ListNode **, char *, void *); @@ -241,9 +241,11 @@ File *openFile(char *, char *); int closeFile(File *); int checkEndOfFile(File *); size_t readFile(File *, void *, size_t, size_t); +size_t writeFile(File *, void *, size_t, size_t); int seekFile(File *, long, int); int getByteFromFile(File *); char *getStringFromFile(File *, char *, int); +int copyFile(char *, char *); Directory *openDirectory(char *); int closeDirectory(Directory *); @@ -259,11 +261,6 @@ boolean FileIsArtworkType(char *, int); char *get_mapped_token(char *); -int get_parameter_value(char *, char *, int); - -struct ScreenModeInfo *get_screen_mode_from_string(char *); -void get_aspect_ratio_from_screen_mode(struct ScreenModeInfo *, int *x, int *y); - struct FileInfo *getFileListFromConfigList(struct ConfigInfo *, struct ConfigTypeInfo *, char **, int); @@ -272,11 +269,11 @@ void ReloadCustomArtworkList(struct ArtworkListInfo *); void FreeCustomArtworkLists(struct ArtworkListInfo *); char *getLogFilename(char *); -void OpenLogFiles(); -void CloseLogFiles(); +void OpenLogFiles(void); +void CloseLogFiles(void); void DumpLogFile(int); -void NotifyUserAboutErrorFile(); +void NotifyUserAboutErrorFile(void); #if DEBUG void debug_print_timestamp(int, char *); @@ -286,4 +283,4 @@ void print_timestamp_time(char *); void print_timestamp_done(char *); -#endif /* MISC_H */ +#endif // MISC_H