ScummVM API documentation
nuvie_defs.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef NUVIE_CORE_NUVIE_DEFS_H
23 #define NUVIE_CORE_NUVIE_DEFS_H
24 
25 #include "common/scummsys.h"
26 #include "ultima/nuvie/misc/sdl_compat.h"
27 
28 namespace Ultima {
29 namespace Nuvie {
30 
31 typedef int8 sint8;
32 typedef int16 sint16;
33 typedef int32 sint32;
34 
35 #define USE_BUTTON Shared::BUTTON_LEFT
36 #define WALK_BUTTON Shared::BUTTON_RIGHT
37 #define ACTION_BUTTON Shared::BUTTON_RIGHT
38 #define DRAG_BUTTON Shared::BUTTON_LEFT
39 
40 typedef uint8 nuvie_game_t; // Game type (1=u6,2=md,4=se)
41 
42 #define NUVIE_GAME_NONE 0
43 #define NUVIE_GAME_U6 1
44 #define NUVIE_GAME_MD 2
45 #define NUVIE_GAME_SE 4
46 
47 #define NUVIE_CONFIG_NAME_U6 "ultima6"
48 #define NUVIE_CONFIG_NAME_MD "martian"
49 #define NUVIE_CONFIG_NAME_SE "savage"
50 
51 #define NUVIE_STYLE_ORIG 0
52 #define NUVIE_STYLE_NEW 1
53 #define NUVIE_STYLE_ORIG_PLUS_CUTOFF_MAP 2
54 #define NUVIE_STYLE_ORIG_PLUS_FULL_MAP 3
55 
56 #define clamp_min(v, c) (((v) < (c)) ? (c) : (v))
57 #define clamp_max(v, c) (((v) > (c)) ? (c) : (v))
58 #define clamp(v, c1, c2) ( ((v) < (c1)) ? (c1) : (((v) > (c2)) ? (c2) : (v)) )
59 
60 #ifndef INT_MAX
61 #define INT_MAX 0x7fffffff
62 #endif
63 #ifndef UCHAR_MAX
64 #define UCHAR_MAX 0xff
65 #endif
66 #ifndef SHRT_MAX
67 #define SHRT_MAX 0x7fff
68 #endif
69 
70 //FIXME fix for future maps which will probably be 1024 wide starting at level 6..
71 #define WRAPPED_COORD(c,level) ((c)&((level)?255:1023))
72 #define WRAP_COORD(c,level) ((c)&=((level)?255:1023))
73 
74 #define MAP_SIDE_LENGTH(map_level) ((map_level > 0 && map_level < 6) ? 256 : 1024)
75 
76 /*
77  * on all levels, except level 0 (conveniently 'false') the map pitch is 256.
78  * to properly wrap, mask the coordinate with the relevant bit-mask.
79  * Another way to write this would be:
80 
81 const uint16 map_pitch[2] = { 1024, 256 }; // width of 0:surface plane, and 1:all other planes
82 #define WRAPPED_COORD(c,level) ((c)&(map_pitch[(level==0)?0:1]-1)) // mask high bit, wrap C to map_pitch
83 #define WRAP_COORD(c,level) ((c)&=(map_pitch[(level==0)?0:1]-1)) // modifies C
84 */
85 
86 enum NuvieDir {
87  NUVIE_DIR_N = 0,
88  NUVIE_DIR_E = 1,
89  NUVIE_DIR_S = 2,
90  NUVIE_DIR_W = 3,
91 
92  NUVIE_DIR_NE = 4,
93  NUVIE_DIR_SE = 5,
94  NUVIE_DIR_SW = 6,
95  NUVIE_DIR_NW = 7,
96 
97  NUVIE_DIR_NONE = 8,
98 };
99 
100 #define TRAMMEL_PHASE 1.75
101 #define FELUCCA_PHASE 1.1666666666666667
102 
103 enum DebugLevelType {
104  LEVEL_EMERGENCY = 0,
105  LEVEL_ALERT,
106  LEVEL_CRITICAL,
107  LEVEL_ERROR,
108  LEVEL_WARNING,
109  LEVEL_NOTIFICATION,
110  LEVEL_INFORMATIONAL,
111  LEVEL_DEBUGGING
112 };
113 
114 enum ConverseGumpType {
115  CONVERSE_GUMP_DEFAULT = 0,
116  CONVERSE_GUMP_U7_STYLE = 1,
117  CONVERSE_GUMP_WOU_STYLE = 2,
118 };
119 
120 #ifdef WITHOUT_DEBUG
121 inline void u6debug(bool no_header, const DebugLevelType level, const char *format, ...) {}
122 #else
123 extern void u6debug(bool no_header, const DebugLevelType level, const char *format, ...);
124 #endif
125 
126 #ifdef DEBUG
127 #undef DEBUG
128 #endif
129 #define DEBUG u6debug
130 
131 #define U6PATH_DELIMITER '/'
132 
133 #define NUVIE_RAND_MAX 0x7fffffff // POSIX: 2^(31)-1
134 #define NUVIE_RAND() getRandom(NUVIE_RAND_MAX)
135 
136 } // End of namespace Nuvie
137 } // End of namespace Ultima
138 
139 #endif
Definition: detection.h:27