1 /*
2 SDLPoP, a port/conversion of the DOS game Prince of Persia.
3 Copyright (C) 2013-2021  Dávid Nagy
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 
18 The authors of this program may be contacted at https://forum.princed.org
19 */
20 
21 #ifndef CONFIG_H
22 #define CONFIG_H
23 
24 // WINDOWS overrides
25 #ifdef _MSC_VER
26 #define strncasecmp _strnicmp
27 #define strcasecmp _stricmp
28 #endif
29 
30 #define POP_MAX_PATH 256
31 #define POP_MAX_OPTIONS_SIZE 256
32 
33 #define SDLPOP_VERSION "1.22"
34 #define WINDOW_TITLE "Prince of Persia (SDLPoP) v" SDLPOP_VERSION
35 
36 // Enable or disable the SDL hardware accelerated renderer backend
37 // Uses a software backend otherwise
38 #define USE_HW_ACCELERATION
39 
40 // Enable or disable fading.
41 // Fading used to be very buggy, but now it works correctly.
42 #define USE_FADE
43 
44 // Enable or disable the potions level. (copy protection)
45 #define USE_COPYPROT
46 
47 // Enable or disable flashing.
48 #define USE_FLASH
49 
50 //#define USE_ALPHA
51 
52 // Enable or disable texts.
53 #define USE_TEXT
54 
55 // Use timers in a way that is more similar to the original game.
56 // Was needed for the correct fading of cutscenes.
57 // Disabled, because it introduces some timing bugs.
58 //#define USE_COMPAT_TIMER
59 
60 // Enable quicksave/load feature.
61 #define USE_QUICKSAVE
62 
63 // Try to let time keep running out when quickloading. (similar to Ctrl+A)
64 // Technically, the 'remaining time' is still restored, but with a penalty for elapsed time (up to 1 minute).
65 // The one minute penalty will also be applied when quickloading from e.g. the title screen.
66 #define USE_QUICKLOAD_PENALTY
67 
68 #ifdef USE_QUICKSAVE // Replay relies on quicksave, because the replay file begins with a quicksave of the initial state.
69 
70 // Enable recording/replay feature.
71 #define USE_REPLAY
72 
73 #endif
74 
75 // Adds a way to crouch immediately after climbing up: press down and forward simultaneously.
76 // In the original game, this could not be done (pressing down always causes the kid to climb down).
77 #define ALLOW_CROUCH_AFTER_CLIMBING
78 
79 // Time runs out while the level ending music plays; however, the music can be skipped by disabling sound.
80 // This option stops time while the ending music is playing (so there is no need to disable sound).
81 #define FREEZE_TIME_DURING_END_MUSIC
82 
83 // Enable fake/invisible tiles feature. Tiles may look like one tiletype but behave like another.
84 // Currently works for empty tiles, walls, floors.
85 // Use tile modifier 4 to display a fake floor, 5 to display a fake wall, 6 to display an empty tile
86 // For now, for fake dungeon walls, the wall neighbors must be specified for now using tile modifiers:
87 //      5 or 50 = no neighbors; 51 = wall to the right; 52 = wall to the left; 53 = walls on both sides
88 // For fake palace walls:
89 //      5 = wall including blue line; 50 = no blue
90 #define USE_FAKE_TILES
91 
92 // Allow guard hitpoints not resetting to their default (maximum) value when re-entering the room
93 #define REMEMBER_GUARD_HP
94 
95 // Enable completely disabling the time limit. To use this feature, set the starting time to -1.
96 // This also disables the in-game messages that report how much time is left every minute.
97 // The elasped time is still kept track of, so that the shortest times will appear in the Hall of Fame.
98 #define ALLOW_INFINITE_TIME
99 
100 
101 // Bugfixes:
102 
103 // The mentioned tricks can be found here: https://www.popot.org/documentation.php?doc=Tricks
104 
105 // A compilation-time option to disable all fixes. Useful for automated solving tools that require vanilla emulation.
106 #ifndef DISABLE_ALL_FIXES
107 
108 // If a room is linked to itself on the left, the closing sounds of the gates in that room can't be heard.
109 #define FIX_GATE_SOUNDS
110 
111 // An open gate or chomper may enable the Kid to go through walls. (Trick 7, 37, 62)
112 #define FIX_TWO_COLL_BUG
113 
114 // If a room is linked to itself at the bottom, and the Kid's column has no floors, the game hangs.
115 #define FIX_INFINITE_DOWN_BUG
116 
117 // When a gate is under another gate, the top of the bottom gate is not visible.
118 // But this fix causes a drawing bug when a gate opens.
119 #define FIX_GATE_DRAWING_BUG
120 
121 // When climbing up to a floor with a big pillar top behind, turned right, Kid sees through floor.
122 #define FIX_BIGPILLAR_CLIMB
123 
124 // When climbing up two floors, turning around and jumping upward, the kid falls down.
125 // This fix makes the workaround of Trick 25 unnecessary.
126 #define FIX_JUMP_DISTANCE_AT_EDGE
127 
128 // When climbing to a higher floor, the game unnecessarily checks how far away the edge below is;
129 // This contributes to sometimes "teleporting" considerable distances when climbing from firm ground
130 #define FIX_EDGE_DISTANCE_CHECK_WHEN_CLIMBING
131 
132 // Falling from a great height directly on top of guards does not hurt.
133 #define FIX_PAINLESS_FALL_ON_GUARD
134 
135 // Bumping against a wall may cause a loose floor below to drop, even though it has not been touched. (Trick 18, 34)
136 #define FIX_WALL_BUMP_TRIGGERS_TILE_BELOW
137 
138 // When pressing a loose tile, you can temporarily stand on thin air by standing up from crouching.
139 #define FIX_STAND_ON_THIN_AIR
140 
141 // Buttons directly to the right of gates can be pressed even though the gate is closed (Trick 1)
142 #define FIX_PRESS_THROUGH_CLOSED_GATES
143 
144 // By jumping and bumping into a wall, you can sometimes grab a ledge two stories down (which should not be possible).
145 #define FIX_GRAB_FALLING_SPEED
146 
147 // When chomped, skeletons cause the chomper to become bloody even though skeletons do not have blood.
148 #define FIX_SKELETON_CHOMPER_BLOOD
149 
150 // Controls do not get released properly when drinking a potion, sometimes causing unintended movements.
151 #define FIX_MOVE_AFTER_DRINK
152 
153 // A drawing bug occurs when a loose tile is placed to the left of a potion (or sword).
154 #define FIX_LOOSE_LEFT_OF_POTION
155 
156 // Guards may "follow" the kid to the room on the left or right, even though there is a closed gate in between.
157 #define FIX_GUARD_FOLLOWING_THROUGH_CLOSED_GATES
158 
159 // When landing on the edge of a spikes tile, it is considered safe. (Trick 65)
160 #define FIX_SAFE_LANDING_ON_SPIKES
161 
162 // The kid may glide through walls after turning around while running (especially when weightless).
163 #define FIX_GLIDE_THROUGH_WALL
164 
165 // The kid can drop down through a closed gate, when there is a tapestry (doortop) above the gate.
166 #define FIX_DROP_THROUGH_TAPESTRY
167 
168 // When dropping down and landing right in front of a wall, the entire landing animation should normally play.
169 // However, when falling against a closed gate or a tapestry(+floor) tile, the animation aborts.
170 // (The game considers these tiles floor tiles; so it mistakenly assumes that no x-position adjustment is needed)
171 #define FIX_LAND_AGAINST_GATE_OR_TAPESTRY
172 
173 // Sometimes, the kid may automatically strike immediately after drawing the sword.
174 // This especially happens when dropping down from a higher floor and then turning towards the opponent.
175 #define FIX_UNINTENDED_SWORD_STRIKE
176 
177 // By repeatedly pressing 'back' in a swordfight, you can retreat out of a room without the room changing. (Trick 35)
178 #define FIX_RETREAT_WITHOUT_LEAVING_ROOM
179 
180 // The kid can jump through a tapestry with a running jump to the left, if there is a floor above it.
181 #define FIX_RUNNING_JUMP_THROUGH_TAPESTRY
182 
183 // Guards can be pushed into walls, because the game does not correctly check for walls located behind a guard.
184 #define FIX_PUSH_GUARD_INTO_WALL
185 
186 // By doing a running jump into a wall, you can fall behind a closed gate two floors down. (e.g. skip in Level 7)
187 #define FIX_JUMP_THROUGH_WALL_ABOVE_GATE
188 
189 // If you grab a ledge that is one or more floors down, the chompers on that row will not start.
190 #define FIX_CHOMPERS_NOT_STARTING
191 
192 // As soon as a level door has completely opened, the feather fall effect is interrupted because the sound stops.
193 #define FIX_FEATHER_INTERRUPTED_BY_LEVELDOOR
194 
195 // Guards will often not reappear in another room if they have been pushed (partly or entirely) offscreen.
196 #define FIX_OFFSCREEN_GUARDS_DISAPPEARING
197 
198 // While putting the sword away, if you press forward and down, and then release down, the kid will still duck.
199 #define FIX_MOVE_AFTER_SHEATHE
200 
201 // After uniting with the shadow in level 12, the hidden floors will not appear until after the flashing stops.
202 #define FIX_HIDDEN_FLOORS_DURING_FLASHING
203 
204 // By jumping towards one of the bottom corners of the room and grabbing a ledge, you can teleport to the room above.
205 #define FIX_HANG_ON_TELEPORT
206 
207 // Fix priorities of sword and spike sounds. (As in PoP 1.3.)
208 #define FIX_SOUND_PRIORITIES
209 
210 // Don't draw the right edge of loose floors on the left side of a potion or sword.
211 #define FIX_LOOSE_NEXT_TO_POTION
212 
213 // A guard standing on a door top (with floor) should not become inactive.
214 #define FIX_DOORTOP_DISABLING_GUARD
215 
216 // Fix graphical glitches with an opening gate:
217 // 1. with a loose floor above and a wall above-right.
218 // 2. with the top half of a big pillar above-right.
219 // Details: https://forum.princed.org/viewtopic.php?p=31884#p31884
220 #define FIX_ABOVE_GATE
221 
222 // Disable this fix to make it possible to go through a certain closed gate on level 11 of Demo by Suave Prince.
223 // Details: https://forum.princed.org/viewtopic.php?p=32326#p32326
224 // Testcase: doc/replays-testcases/Demo by Suave Prince level 11.p1r
225 //#define FIX_COLL_FLAGS
226 
227 // The prince can now grab a ledge at the bottom right corner of a room with no room below.
228 // Details: https://forum.princed.org/viewtopic.php?p=30410#p30410
229 // Testcase: doc/replays-testcases/SNES-PC-set level 11.p1r
230 #define FIX_CORNER_GRAB
231 
232 // When the prince jumps up at the bottom of a big pillar split between two rooms, a part near the top of the screen disappears.
233 // Example: The top row in the first room of the original level 5.
234 // Videos: https://forum.princed.org/viewtopic.php?p=32227#p32227
235 // Explanation: https://forum.princed.org/viewtopic.php?p=32414#p32414
236 #define FIX_BIGPILLAR_JUMP_UP
237 
238 // When the prince dies behind a wall, and he is revived with R, he appears in a glitched room.
239 // (Example: The bottom right part of the bottom right room of level 3.)
240 // The same room can also be reached by falling into a wall. (Falling into the wall, itself, is a different glitch, though.)
241 // Testcase: doc/replays-testcases/Original level 2 falling into wall.p1r
242 // More info: https://forum.princed.org/viewtopic.php?f=68&t=4467
243 #define FIX_ENTERING_GLITCHED_ROOMS
244 
245 // If you are using the caped prince graphics, and crouch with your back towards a closed gate on the left edge on the room, then the prince will slide through the gate.
246 // You can also try this with the original graphics if your use the debug cheat "[" to push the prince into the gate.
247 // This option fixes that.
248 // You can get the caped prince graphics here: https://www.popot.org/custom_levels.php?action=KID.DAT (it's the one by Veke)
249 // Video: https://www.popot.org/documentation.php?doc=TricksPage3#83
250 // Explanation: https://forum.princed.org/viewtopic.php?p=32701#p32701
251 // This also fixes the bug described at FIX_COLL_FLAGS.
252 #define FIX_CAPED_PRINCE_SLIDING_THROUGH_GATE
253 
254 // If the prince dies on level 14, restarting the level will not stop the "Press Button to Continue" timer, and the game will return to the intro after a few seconds.
255 // How to reproduce: https://forum.princed.org/viewtopic.php?p=16926#p16926
256 // Technical explanation: https://forum.princed.org/viewtopic.php?p=16408#p16408 (the second half of the post)
257 #define FIX_LEVEL_14_RESTARTING
258 
259 #endif // ifndef DISABLE_ALL_FIXES
260 
261 // Debug features:
262 
263 // When the program starts, check whether the deobfuscated sequence table (seqtbl.c) is correct.
264 //#define CHECK_SEQTABLE_MATCHES_ORIGINAL
265 
266 // Print out every second how closely the in-game elapsed time corresponds to the actual elapsed time.
267 //#define CHECK_TIMING
268 
269 
270 // Enable debug cheats (with command-line argument "debug")
271 // "[" and "]" : nudge x position by one pixel
272 // "T" : display remaining time in minutes, seconds and ticks
273 #define USE_DEBUG_CHEATS
274 
275 
276 
277 // Darken those parts of the screen which are not near a torch.
278 #define USE_LIGHTING
279 
280 // Enable screenshot features.
281 #define USE_SCREENSHOT
282 
283 // Automatically switch to keyboard or joystick/gamepad mode if there is input from that device.
284 // Useful if SDL detected a gamepad but there is none.
285 #define USE_AUTO_INPUT_MODE
286 
287 #ifdef USE_TEXT // The menu won't work without text.
288 
289 // Display the in-game menu.
290 #define USE_MENU
291 
292 #endif
293 
294 // Enable colored torches. A torch can be colored by changing its modifier in a level editor.
295 #define USE_COLORED_TORCHES
296 
297 // Enable fast forwarding with the backtick key.
298 #define USE_FAST_FORWARD
299 
300 // Set how much should the fast forwarding speed up the game.
301 #define FAST_FORWARD_RATIO 10
302 
303 // Speed up the sound during fast forward using resampling.
304 // If disabled, the sound is sped up by clipping out parts from it.
305 //#define FAST_FORWARD_RESAMPLE_SOUND
306 
307 // Mute the sound during fast forward.
308 //#define FAST_FORWARD_MUTE
309 
310 
311 // Default SDL_Joystick button values
312 #define SDL_JOYSTICK_BUTTON_Y 2
313 #define SDL_JOYSTICK_BUTTON_X 3
314 #define SDL_JOYSTICK_X_AXIS 0
315 #define SDL_JOYSTICK_Y_AXIS 1
316 
317 #endif
318