JNR
Core-Parameters.h
1 /*
2 
3 Jump'n'Run Engine
4 http://www.atanaslaskov.com/jnr/
5 
6 BSD LICENSE
7 Copyright (c) 2007-2013, Atanas Laskov
8 All rights reserved.
9 
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions are met:
12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer.
14 2. Redistributions in binary form must reproduce the above copyright notice,
15 this list of conditions and the following disclaimer in the documentation
16 and/or other materials provided with the distribution.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL ATANAS LASKOV BE LIABLE FOR ANY
21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 */
29 
31 //
33 
35 
36 
37 #ifndef M_PARAMETERS_H
38 #define M_PARAMETERS_H
39 
41 //
42 #define M_ENV_WINDOWS 1
43 
44 #ifdef M_ENV_WINDOWS
45 #define NOMINMAX // eigen doesn't like the default min/max
46 #include <windows.h>
47 #endif
48 
50 
51 #define M_BOOL unsigned char
52 #define M_TRUE 1
53 #define M_FALSE 0
54 
55 
57 
58 #define M_LOGFILE "engine-log.txt"
59 
60 #define M_DIR_MODEL "model\\"
61 #define M_DIR_FX "fx\\"
62 #define M_DIR_TEXTURE "texture\\"
63 #define M_DIR_FONT "font\\"
64 
65 #define M_DLABEL ':'
66 #define M_DTEXT '\''
67 #define M_DSECTION_1 '['
68 #define M_DSECTION_2 ']'
69 
70 #define M_DIR_LEVEL "level\\"
71 #define M_DIR_TILESET "tileset\\"
72 
73 #define M_NEWGAME_FIRST_LEVEL "test-1.lvl"
74 #define M_INTRO_LEVEL "mmenu.lvl"
75 
76 
78 
79 #define M_MIN(a,b) ((a)<(b)?(a):(b))
80 #define M_MAX(a,b) ((a)>(b)?(a):(b))
81 #define M_CLAMP(mini, maxi, val) M_MIN( (maxi), M_MAX( (mini), (val) ))
82 
83 #define M_SIGN(a) ((a)>=0?(1):(-1))
84 #define M_ABS(a) ((a)>0?(a):(-(a)))
85 
86 #define M_R2D(r) ((r)*(180.0/3.14159))
87 #define M_D2R(r) ((r)*(3.14159/180.0))
88 
89 
90 //
93 #define M_UNIT 0.1
94 #define M_SMALL_VECT_DOUBLE (M_UNIT*0.001)
95 
96 #define M_GRAVITATION_ON
97 //#define M_HIDE_GEOMETRY
98 
99 // NOTE: This should be less than M_GRAVITATIONAL_HOVER; Otherwise velocity builds up.
101 //
102 #define M_NORMAL_RESPONSE (0.04*M_UNIT)
103 
105 // NOTE: M_GRAVITATIONAL_HOVER prevents trembling under some circumstances
106 //
107 #define M_GRAVITATIONAL_HOVER (0.15*M_UNIT)
108 
110 // NOTE: This is not g because the model is not phiysically accurate
111 //
112 #define M_GRAVITATION_ACC (600.0)
113 
114 // Not used
115 #define M_CUTOFF 0 //(M_UNIT*0.05)
116 
118 
120 //
122 #define M_COPYRIGHT_STRING (laFont::getSourceStr(0))
123 #define M_VERSION_STRING "Alpha"
124 
125 #define M_JRTITLE_STRING (laFont::getSourceStr(1))
126 #define M_EDITORTITLE_STRING (laFont::getSourceStr(2))
127 
128 
130 //
131 #define M_GRAPHICS_GL
132 
133 
135 #define M_TEXTURE unsigned long
136 
137 #define M_TEX_SIMPLE 1
138 #define M_TEX_TMAP 2
139 #define M_TEX_CKEY 3
140 
141 
142 
144 #define M_CHARCNT 32.0
145 #define M_MAX_FONT_CNT 10
146 
147 #define M_AL 0x1
148 #define M_AR 0x2
149 #define M_AC 0x3
150 
151 #define M_AT 0x10
152 #define M_AB 0x20
153 #define M_AM 0x30
154 
155 
156 //
158 #define M_MAXOBJCNT 1024
159 #define M_MAXVARCNT 5
160 #define M_MAXFORCECNT 10
161 #define M_MAXLITTER_POOLS 32
162 #define M_MAXLITTER_BOX 10
163 
164 #define M_MAX_COLLISION_DOMAIN_SZ 128
165 
166 // External libraries used by Engine
167 //
168 #include <math.h>
169 #include <string.h>
170 #include <stdlib.h>
171 #include <stdio.h>
172 #include <stdarg.h>
173 
174 #include <map>
175 #include <string>
176 #include <vector>
177 #include <list>
178 
179 #include <boost\shared_ptr.hpp>
180 #include <boost\weak_ptr.hpp>
181 
182 using namespace boost;
183 
184 #include <iprof\prof.h>
185 
186 // Wave
187 //
188 #define WAVE_SPEED 2
189 #define WAVE_AMPLITUDE M_UNIT*0.1
190 #define WAVE_FREQUENCY 15
191 #define M_LAVASURFACE_OFFSET M_UNIT*1.45
192 
193 // Object and state ids
194 //
195 #define M_DIR_L 1
196 #define M_DIR_R 2
197 #define M_DIR_T 3
198 #define M_DIR_B 4
199 
200 #define M_OBJ_OBJECT 0
201 #define M_OBJ_PLAYER 1
202 #define M_OBJ_MONSTER 2
203 #define M_OBJ_FINISH 3
204 #define M_OBJ_CHECKPT 4
205 #define M_OBJ_ARROW 5
206 
207 #define M_AI_WALKER 1
208 #define M_AI_JUMPY 2
209 
210 // Game stage IDs
211 //
212 #define M_STAGE_MENU ((unsigned)0)
213 #define M_STAGE_LOAD 1
214 #define M_STAGE_GAME 2
215 #define M_STAGE_GEN 3
216 #define M_STAGE_EDIT 4
217 #define M_STAGE_INTRO 5
218 
219 // GUI Parameters
220 //
221 #define M_UI_SPACING 10
222 #define M_UI_HEIGHT 30
223 #define M_UI_POTIONFX_W 170
224 #define M_UI_POTIONFX_MARGIN 4
225 
226 #define M_BATTLEICON_SZ (M_UNIT/2.0)
227 #define M_HPBAR_W (M_UNIT*0.8)
228 #define M_HPBAR_H (M_UNIT/18.0)
229 #define M_HPBAR_HOVER (M_UNIT/10.0)
230 #define M_POTION_LABEL_RANGE 6*M_UNIT
231 
232 // Level structure
233 //
234 #define M_SEGW 10
235 #define M_SEGH 20
236 
237 // Player and creature movement
238 //
239 #define M_DEFAULT_SPEED 50 // M_UNIT per second
240 #define M_DEFAULT_JUMP 100
241 #define M_DEFAULT_SOMERSAULT 80
242 
243 #define M_PLAYER_SPEED 70 // M_UNIT per second
244 #define M_PLAYER_JUMP 150
245 #define M_PLAYER_SOMERSAULT 100
246 
247 #define M_PUNCH_TIME 2 // sec
248 
249 // Battle
250 //
251 #define M_HP_VISIBILITY_DISTANCE (M_UNIT*4)
252 #define M_TOUCH_HIT_INTERVAL (1.1)
253 
254 #define M_PLAYER_ATTACK_RANGE (M_UNIT*2.2)
255 #define M_PLAYER_ATTACK_INTERVAL (0.4)
256 #define M_MATTACK_RANGE (M_UNIT*1)
257 
258 #define M_DISPLAY_DAMAGE 2.0 //sec
259 
260 // Leveling Up and Upgrading
261 //
262 #define M_XP_LVL2 20 // XP required for 2nd level
263 #define M_XP_INCREMENT 1.5 // Next level costs XP_Current * M_XP_INCREMENT
264 
265 #define M_HP_INCREMENT 2 // HP points added to HP_Max
266 #define M_AP_INCREMENT 1 // AP added to all attacks
267 #define M_DP_INCREMENT 0.1 // DP added to all defenses
268 
269 
271 
272 #define MSG(str, ...) (::laSystemIntegrator::getEnvironment()->message(M_FALSE, str, __VA_ARGS__)) //<! Debug message box
273 #define MLOG(str, ...) (::laSystemIntegrator::getEnvironment()->mlog(__FUNCTION__, str, __VA_ARGS__)) //<! Debug log file message
274 
275 
276 //#define M_DEBUG if(laRenderer::_bDbgEnable) {
277 //#define M_DBEND }
278 
279 //#define M_DEBUG_HIDE_GEOMETRY
280 //#define M_DEBUG_SHOW_PIVOTS
281 //#define M_DEBUG_EXTRAZOOM
282 
284 
285 
286 #define M_MODE_PROFILE //<! Enable global profiler
287 //#define M_MODE_PROFILE_COL //<! Enable collider profiler
288 //#define M_MODE_PROFILE_REN //<! Enable renderer profiler
289 //#define M_MODE_PROFILE_ANIM //<! Enable animation profiler
290 //#define M_MODE_PROFILE_LVL //<! Enable level structure profiler
291 
292 #ifdef M_MODE_PROFILE
293 #define PROFILE(x) Prof(x)
294 #else
295 #define PROFILE(x)
296 #endif
297 
298 #ifdef M_MODE_PROFILE_COL
299 #define PROFILE_COL(x) PROFILE(x)
300 #else
301 #define PROFILE_COL(x)
302 #endif
303 
304 #ifdef M_MODE_PROFILE_REN
305 #define PROFILE_REN(x) PROFILE(x)
306 #else
307 #define PROFILE_REN(x)
308 #endif
309 
310 #ifdef M_MODE_PROFILE_ANIM
311 #define PROFILE_ANIM(x) PROFILE(x)
312 #else
313 #define PROFILE_ANIM(x)
314 #endif
315 
316 #ifdef M_MODE_PROFILE_LVL
317 #define PROFILE_LVL(x) PROFILE(x)
318 #else
319 #define PROFILE_LVL(x)
320 #endif
321 
322 #endif //#ifndef M_PARAMETERS_H
323