00001 /******************************************************************************/ 00017 /******************************************************************************/ 00018 00019 #ifndef ADIKT_GLOBALS_H 00020 #define ADIKT_GLOBALS_H 00021 00022 #include <stdio.h> 00023 #include <stdlib.h> 00024 #include <string.h> 00025 #include <ctype.h> 00026 #include <limits.h> 00027 #include <time.h> 00028 00029 #if defined(unix) && !defined(GO32) 00030 #include <unistd.h> 00031 #include <signal.h> 00032 #include <sys/ioctl.h> 00033 #include <termios.h> 00034 #if !defined(stricmp) 00035 #define stricmp strcasecmp 00036 #endif 00037 #elif defined(MSDOS) 00038 #include <dos.h> 00039 #include <process.h> 00040 #endif 00041 00042 #if defined(BUILD_DLL) 00043 # define DLLIMPORT __declspec (dllexport) 00044 #elif defined(BUILD_SINGLE) 00045 # define DLLIMPORT 00046 #else // Not defined BUILD_DLL 00047 # define DLLIMPORT __declspec (dllimport) 00048 #endif 00049 00050 // Basic Definitions 00051 00052 #if defined(unix) && !defined (GO32) 00053 #define SEPARATOR "/" 00054 #else 00055 #define SEPARATOR "\\" 00056 #endif 00057 00058 #ifndef false 00059 #define false 0 00060 #endif 00061 #ifndef true 00062 #define true 1 00063 #endif 00064 #ifndef max 00065 #define max(a,b) ((a)>(b)?(a):(b)) 00066 #endif 00067 #ifndef min 00068 #define min(a,b) ((a)<(b)?(a):(b)) 00069 #endif 00070 00071 // Buffer sizes 00072 00073 #define DISKPATH_SIZE 256 00074 #define LINEMSG_SIZE 160 00075 #define READ_BUFSIZE 256 00076 00077 #define PROGRAM_NAME "ADiKtEd" 00078 00079 // Return values for verification functions 00080 #define VERIF_ERROR 0 00081 #define VERIF_OK 1 00082 #define VERIF_WARN 2 00083 00084 // Return values for all other functions 00085 #define ERR_NONE 0 00086 // Note: error codes -1..-79 are reserved standard C library errors with sign reverted. 00087 // these are defined in errno.h 00088 #define ERR_BASE_RNC -90 00089 00090 00091 struct IPOINT_2D { 00092 int x; 00093 int y; 00094 }; 00095 00096 struct IPOINT_3D { 00097 int x; 00098 int y; 00099 int z; 00100 }; 00101 00102 struct UPOINT_2D { 00103 unsigned int x; 00104 unsigned int y; 00105 }; 00106 00107 struct UPOINT_3D { 00108 unsigned int x; 00109 unsigned int y; 00110 unsigned int z; 00111 }; 00112 00113 struct USPOINT_2D { 00114 unsigned short x; 00115 unsigned short y; 00116 }; 00117 00118 struct IRECT_2D { 00119 int l; 00120 int r; 00121 int t; 00122 int b; 00123 }; 00124 00125 struct SCRIPT_OPTIONS { 00126 int level_spaces; 00127 }; 00128 00129 struct MAPDRAW_OPTIONS { 00130 short rescale; 00131 short bmfonts; 00132 short tngflags; 00133 char *data_path; 00134 }; 00135 00136 struct VERIFY_OPTIONS { 00137 // Level size, in tiles 00138 struct UPOINT_2D tlsize; 00139 // Level size, in subtiles 00140 struct UPOINT_2D subsize; 00141 // Verification error message buffer 00142 char err_msg[LINEMSG_SIZE]; 00143 }; 00144 00145 struct LEVOPTIONS { 00146 // Level graphic generation options 00147 short unaffected_gems; 00148 short unaffected_rock; 00149 short fill_reinforced_corner; 00150 short frail_columns; 00151 // True means DAT/CLM/WIB are updated automatically 00152 short datclm_auto_update; 00153 // True means TNG/LGT/APTs are updated automatically 00154 short obj_auto_update; 00155 // File handling variables 00156 char *levels_path; 00157 char *data_path; 00158 // True means that APT/TNG will load all objects if file size of TNG/APT 00159 // is larger than it should 00160 short load_redundant_objects; 00161 // Flags used for level verification 00162 unsigned int verify_warn_flags; 00163 // Map picture generation options 00164 struct MAPDRAW_OPTIONS picture; 00165 // Level script options 00166 struct SCRIPT_OPTIONS script; 00167 }; 00168 00169 // Thing categorization helpers 00170 #define THING_CATEGR_COUNT 0x16 00171 typedef short (*is_thing_subtype)(const unsigned char *thing); 00172 typedef short (*is_item_subtype)(const unsigned char stype_idx); 00173 typedef int (*thing_subtype_arrayindex)(const unsigned char stype_idx); 00174 typedef unsigned char (*thing_subtype_switch)(const unsigned char stype_idx); 00175 typedef unsigned char (*thing_subtype_arrayitem)(const int arr_itm); 00176 00177 #endif // ADIKT_GLOBALS_H