settings.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. /**
  2. @file settings.h
  3. This file contains settings (or setting hints) for the game. Values here can
  4. fine tune performance vs quality and personalize the final compiled game. Some
  5. of these settings may be overriden by the specific platform used according to
  6. its limitations. You are advised to NOT change value in this file directly,
  7. but rather predefine them somewhere before this file gets included, e.g. in
  8. you personal settings file.
  9. by Miloslav Ciz (drummyfish), 2019
  10. Released under CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/)
  11. plus a waiver of all other intellectual property. The goal of this work is to
  12. be and remain completely in the public domain forever, available for any use
  13. whatsoever.
  14. */
  15. #ifndef _SFG_SETTINGS_H
  16. #define _SFG_SETTINGS_H
  17. /**
  18. Path to the save file. You may want to set this to some absolute path,
  19. depending on your system.
  20. */
  21. #ifndef SFG_SAVE_FILE_PATH
  22. #define SFG_SAVE_FILE_PATH "anarch.sav"
  23. #endif
  24. /**
  25. Time multiplier in SFG_Units (1.0 == 1024). This can be used to slow down or
  26. speed up the game. Note that this also changes the rendering FPS accordingly
  27. (e.g. half FPS at half speed), so if you want to keep the FPS, divide it by
  28. the multiplier value.
  29. */
  30. #ifndef SFG_TIME_MULTIPLIER
  31. #define SFG_TIME_MULTIPLIER 1024
  32. #endif
  33. /**
  34. Target FPS (frames per second). This sets the game logic FPS and will try to
  35. render at the same rate. If such fast rendering can't be achieved, frames will
  36. be droped, but the game logic will still be forced to run at this speed, so
  37. the game may actually become slowed down if FPS is set too high. Too high or
  38. too low FPS can also negatively affect game speeds which are computed as
  39. integers and rounding errors can occur soon, so don't set this to extreme
  40. values (try to keep between 20 to 100). FPS also determines the game
  41. simulation step length, so different FPS values may result in very slight
  42. differences in game behavior (not very noticeable but affecting demos etc.).
  43. */
  44. #ifndef SFG_FPS
  45. #define SFG_FPS 60
  46. #endif
  47. /**
  48. Increases or decreases the brightness of the rendered world (but not menu,
  49. HUD etc.). Effective values are -8 to 8.
  50. */
  51. #ifndef SFG_BRIGHTNESS
  52. #define SFG_BRIGHTNESS 0
  53. #endif
  54. /**
  55. On platforms with mouse this sets its horizontal sensitivity. 128 means 1
  56. RCL_Unit turn angle per mouse pixel travelled.
  57. */
  58. #ifndef SFG_MOUSE_SENSITIVITY_HORIZONTAL
  59. #define SFG_MOUSE_SENSITIVITY_HORIZONTAL 32
  60. #endif
  61. /**
  62. Like SFG_MOUSE_SENSITIVITY_HORIZONTAL but for vertical look. 128 means 1
  63. shear pixel per mouse pixel travelled.
  64. */
  65. #ifndef SFG_MOUSE_SENSITIVITY_VERTICAL
  66. #define SFG_MOUSE_SENSITIVITY_VERTICAL 64
  67. #endif
  68. /**
  69. Width of the screen in pixels. Set this to ACTUAL resolution. If you want the
  70. game to run at smaller resolution (with bigger pixels), do this using
  71. SFG_RESOLUTION_SCALEDOWN.
  72. */
  73. #ifndef SFG_SCREEN_RESOLUTION_X
  74. #define SFG_SCREEN_RESOLUTION_X 800
  75. #endif
  76. /**
  77. Like SFG_SCREEN_RESOLUTION_X, but for y resolution.
  78. */
  79. #ifndef SFG_SCREEN_RESOLUTION_Y
  80. #define SFG_SCREEN_RESOLUTION_Y 600
  81. #endif
  82. /**
  83. How quickly player turns left/right, in degrees per second.
  84. */
  85. #ifndef SFG_PLAYER_TURN_SPEED
  86. #define SFG_PLAYER_TURN_SPEED 180
  87. #endif
  88. /**
  89. Horizontal FOV (field of vision) in RCL_Units (1024 means 360 degrees).
  90. */
  91. #ifndef SFG_FOV_HORIZONTAL
  92. #define SFG_FOV_HORIZONTAL 256
  93. #endif
  94. /**
  95. Like SFG_FOV_HORIZONTAL but for vertical angle.
  96. */
  97. #ifndef SFG_FOV_VERTICAL
  98. #define SFG_FOV_VERTICAL 330
  99. #endif
  100. /**
  101. Distance, in RCL_Units, to which textures will be drawn. Textures behind this
  102. distance will be replaced by an average constant color, which maybe can help
  103. performance and also serves as an antialiasim (2 level MIP map). Value 0 turns
  104. texturing completely off, which is much faster than having just a low value,
  105. values >= 65535 activate texturing completely, which can be a little faster
  106. than setting having a high value lower than this limit.
  107. */
  108. #ifndef SFG_TEXTURE_DISTANCE
  109. #define SFG_TEXTURE_DISTANCE 100000
  110. #endif
  111. /**
  112. How many times the screen resolution will be divided (how many times a game
  113. pixel will be bigger than the screen pixel).
  114. */
  115. #ifndef SFG_RESOLUTION_SCALEDOWN
  116. #define SFG_RESOLUTION_SCALEDOWN 1
  117. #endif
  118. /**
  119. Multiplier, in RCL_Units (1024 == 1.0), of the damager player takes. This can
  120. be used to balance difficulty.
  121. */
  122. #ifndef SFG_PLAYER_DAMAGE_MULTIPLIER
  123. #define SFG_PLAYER_DAMAGE_MULTIPLIER 512
  124. #endif
  125. /**
  126. Hint as to whether to run in fullscreen, if the platform allows it.
  127. */
  128. #ifndef SFG_FULLSCREEN
  129. #define SFG_FULLSCREEN 0
  130. #endif
  131. /**
  132. Whether shadows (fog) should be dithered, i.e. more smooth (needs a bit more
  133. CPU performance and memory).
  134. */
  135. #ifndef SFG_DITHERED_SHADOW
  136. #define SFG_DITHERED_SHADOW 0
  137. #endif
  138. /**
  139. Depth step (in RCL_Units) after which fog diminishes a color by one value
  140. point. For performance reasons this number should be kept a power of two!
  141. */
  142. #ifndef SFG_FOG_DIMINISH_STEP
  143. #define SFG_FOG_DIMINISH_STEP 2048
  144. #endif
  145. /**
  146. If set, floor and ceiling will be colored differently depending on their
  147. height. This can be useful when fog is turned on and different floor levels
  148. are hard to distinguish.
  149. */
  150. #ifndef SFG_DIFFERENT_FLOOR_CEILING_COLORS
  151. #define SFG_DIFFERENT_FLOOR_CEILING_COLORS 0
  152. #endif
  153. /**
  154. Maximum number of squares that will be traversed by any cast ray. Smaller
  155. number is faster but can cause visual artifacts.
  156. */
  157. #ifndef SFG_RAYCASTING_MAX_STEPS
  158. #define SFG_RAYCASTING_MAX_STEPS 30
  159. #endif
  160. /**
  161. Maximum number of hits any cast ray will register. Smaller number is faster
  162. but can cause visual artifacts.
  163. */
  164. #ifndef SFG_RAYCASTING_MAX_HITS
  165. #define SFG_RAYCASTING_MAX_HITS 10
  166. #endif
  167. /**
  168. Same as SFG_RAYCASTING_MAX_STEPS but for visibility rays that are used to
  169. check whether sprites are visible etc.
  170. */
  171. #ifndef SFG_RAYCASTING_VISIBILITY_MAX_STEPS
  172. #if SFG_RAYCASTING_MAX_STEPS < 15
  173. #define SFG_RAYCASTING_VISIBILITY_MAX_STEPS 15
  174. #else
  175. #define SFG_RAYCASTING_VISIBILITY_MAX_STEPS SFG_RAYCASTING_MAX_STEPS
  176. #endif
  177. #endif
  178. /**
  179. Same as SFG_RAYCASTING_MAX_HITS but for visibility rays that are used to check
  180. whether sprites are visible etc.
  181. */
  182. #ifndef SFG_RAYCASTING_VISIBILITY_MAX_HITS
  183. #if SFG_RAYCASTING_MAX_HITS < 6
  184. #define SFG_RAYCASTING_VISIBILITY_MAX_HITS 6
  185. #else
  186. #define SFG_RAYCASTING_VISIBILITY_MAX_HITS SFG_RAYCASTING_MAX_HITS
  187. #endif
  188. #endif
  189. /**
  190. How many times rendering should be subsampled horizontally. Bigger number
  191. can significantly improve performance (by casting fewer rays), but can look
  192. a little worse. This number should be a divisor of SFG_SCREEN_RESOLUTION_X!
  193. */
  194. #ifndef SFG_RAYCASTING_SUBSAMPLE
  195. #define SFG_RAYCASTING_SUBSAMPLE 1
  196. #endif
  197. /**
  198. Enables or disables fog (darkness) due to distance. Recommended to keep on
  199. for good look, but can be turned off for performance.
  200. */
  201. #ifndef SFG_ENABLE_FOG
  202. #define SFG_ENABLE_FOG 1
  203. #endif
  204. /**
  205. Says whether sprites should diminish in fog. This takes more performance but
  206. looks better.
  207. */
  208. #ifndef SFG_DIMINISH_SPRITES
  209. #define SFG_DIMINISH_SPRITES 1
  210. #endif
  211. /**
  212. How quick player head bob is, 1024 meaning once per second. 0 Means turn off
  213. head bob.
  214. */
  215. #ifndef SFG_HEADBOB_SPEED
  216. #define SFG_HEADBOB_SPEED 900
  217. #endif
  218. /**
  219. Sets head bob offset, in RCL_UNITS_PER_SQUARE. 0 Means turn off head bob.
  220. */
  221. #ifndef SFG_HEADBOB_OFFSET
  222. #define SFG_HEADBOB_OFFSET 200
  223. #endif
  224. /**
  225. If head bob is on, this additionally sets additional camera shear bob, in
  226. pixels, which can make bobbing look more "advanced". 0 turns this option off.
  227. */
  228. #ifndef SFG_HEADBOB_SHEAR
  229. #define SFG_HEADBOB_SHEAR 0
  230. #endif
  231. /**
  232. Weapon bobbing offset in weapon image pixels.
  233. */
  234. #ifndef SFG_WEAPONBOB_OFFSET
  235. #define SFG_WEAPONBOB_OFFSET 4
  236. #endif
  237. /**
  238. Camera shearing (looking up/down) speed, in vertical resolutions per second.
  239. */
  240. #ifndef SFG_CAMERA_SHEAR_SPEED
  241. #define SFG_CAMERA_SHEAR_SPEED 3
  242. #endif
  243. /**
  244. Maximum camera shear (vertical angle). 1024 means 1.0 * vertical resolution.
  245. */
  246. #ifndef SFG_CAMERA_MAX_SHEAR
  247. #define SFG_CAMERA_MAX_SHEAR 1024
  248. #endif
  249. /**
  250. Specifies how quick some sprite animations are, in frames per second.
  251. */
  252. #ifndef SFG_SPRITE_ANIMATION_SPEED
  253. #define SFG_SPRITE_ANIMATION_SPEED 4
  254. #endif
  255. /**
  256. How wide the border indicator is, in fractions of screen width.
  257. */
  258. #ifndef SFG_HUD_BORDER_INDICATOR_WIDTH
  259. #define SFG_HUD_BORDER_INDICATOR_WIDTH 32
  260. #endif
  261. /**
  262. For how long border indication (being hurt etc.) stays shown, in ms.
  263. */
  264. #ifndef SFG_HUD_BORDER_INDICATOR_DURATION
  265. #define SFG_HUD_BORDER_INDICATOR_DURATION 500
  266. #endif
  267. /**
  268. Color (palette index) by which being hurt is indicated.
  269. */
  270. #ifndef SFG_HUD_HURT_INDICATION_COLOR
  271. #define SFG_HUD_HURT_INDICATION_COLOR 175
  272. #endif
  273. /**
  274. Color (palette index) by which taking an item is indicated.
  275. */
  276. #ifndef SFG_HUD_ITEM_TAKEN_INDICATION_COLOR
  277. #define SFG_HUD_ITEM_TAKEN_INDICATION_COLOR 207
  278. #endif
  279. /**
  280. How many element (items, monsters, ...) distances will be checked per frame
  281. for distance. Higher value may decrease performance a tiny bit, but things
  282. will react more quickly and appear less "out of thin air".
  283. */
  284. #ifndef SFG_ELEMENT_DISTANCES_CHECKED_PER_FRAME
  285. #define SFG_ELEMENT_DISTANCES_CHECKED_PER_FRAME 8
  286. #endif
  287. /**
  288. Maximum distance at which sound effects (SFX) will be played. The SFX volume
  289. will gradually drop towards this distance.
  290. */
  291. #ifndef SFG_SFX_MAX_DISTANCE
  292. #define SFG_SFX_MAX_DISTANCE (1024 * 60)
  293. #endif
  294. /**
  295. Says the intensity of background image blur. 0 means no blur, which improves
  296. performance and lowers memory usage. Blur doesn't look very good in small
  297. resolutions.
  298. */
  299. #ifndef SFG_BACKGROUND_BLUR
  300. #define SFG_BACKGROUND_BLUR 0
  301. #endif
  302. /**
  303. Defines the period, in ms, of things that blink, such as text.
  304. */
  305. #ifndef SFG_BLINK_PERIOD
  306. #define SFG_BLINK_PERIOD 500
  307. #endif
  308. /**
  309. Probability (0 - 255) of how often a monster makes sound during movement.
  310. */
  311. #ifndef SFG_MONSTER_SOUND_PROBABILITY
  312. #define SFG_MONSTER_SOUND_PROBABILITY 64
  313. #endif
  314. /**
  315. Affects how precise monsters are in aiming, specify random range in
  316. fourths of a game square. Should be power of 2 for performance.
  317. */
  318. #ifndef SFG_MONSTER_AIM_RANDOMNESS
  319. #define SFG_MONSTER_AIM_RANDOMNESS 4
  320. #endif
  321. /// Color 1 index of player on map.
  322. #ifndef SFG_MAP_PLAYER_COLOR1
  323. #define SFG_MAP_PLAYER_COLOR1 93
  324. #endif
  325. /// Color 2 index of player on map.
  326. #ifndef SFG_MAP_PLAYER_COLOR2
  327. #define SFG_MAP_PLAYER_COLOR2 111
  328. #endif
  329. /// Color index of elevators on map.
  330. #ifndef SFG_MAP_ELEVATOR_COLOR
  331. #define SFG_MAP_ELEVATOR_COLOR 214
  332. #endif
  333. /// Color index of squeezers on map.
  334. #ifndef SFG_MAP_SQUEEZER_COLOR
  335. #define SFG_MAP_SQUEEZER_COLOR 246
  336. #endif
  337. /// Color index of door on map.
  338. #ifndef SFG_MAP_DOOR_COLOR
  339. #define SFG_MAP_DOOR_COLOR 188
  340. #endif
  341. /**
  342. Boolean value indicating whether current OS is malware.
  343. */
  344. #ifndef SFG_OS_IS_MALWARE
  345. #define SFG_OS_IS_MALWARE 0
  346. #endif
  347. /**
  348. Angle difference, as a cos value in RCL_Units, between the player and a
  349. monster, at which vertical autoaim will trigger. If the angle is greater, a
  350. shot will go directly forward.
  351. */
  352. #ifndef SFG_VERTICAL_AUTOAIM_ANGLE_THRESHOLD
  353. #define SFG_VERTICAL_AUTOAIM_ANGLE_THRESHOLD 50
  354. #endif
  355. /**
  356. Byte (0 - 255) volume of the menu click sound.
  357. */
  358. #ifndef SFG_MENU_CLICK_VOLUME
  359. #define SFG_MENU_CLICK_VOLUME 220
  360. #endif
  361. /**
  362. Says whether the exit item should be showed in the menu. Platforms that can't
  363. exit (such as some gaming consoles that simply use power off button) can
  364. define this to 0.
  365. */
  366. #ifndef SFG_CAN_EXIT
  367. #define SFG_CAN_EXIT 1
  368. #endif
  369. /**
  370. On Arduino platforms this should be set to 1. That will cause some special
  371. treatment regarding constant variables and PROGMEM.
  372. */
  373. #ifndef SFG_ARDUINO
  374. #define SFG_ARDUINO 0
  375. #endif
  376. /**
  377. Whether levels background (in distance or transparent wall textures) should
  378. be drawn. If turned off, the background will be constant color, which can
  379. noticably increase performance.
  380. */
  381. #ifndef SFG_DRAW_LEVEL_BACKGROUND
  382. #define SFG_DRAW_LEVEL_BACKGROUND 1
  383. #endif
  384. /**
  385. Says the size, in pixels, of a sprite when it is closest to the camera, which
  386. is the maximum size that can be drawn. Sprites on "weird" aspect ratios can
  387. look weirdly scaled, so this option can be used to fix that (typically set
  388. horizontal screen resolution instead of vertical).
  389. */
  390. #ifndef SFG_SPRITE_MAX_SIZE
  391. #define SFG_SPRITE_MAX_SIZE \
  392. (SFG_SCREEN_RESOLUTION_Y / SFG_RESOLUTION_SCALEDOWN)
  393. #endif
  394. /**
  395. If set, single item menu will be forced.
  396. */
  397. #ifndef SFG_FORCE_SINGLE_ITEM_MENU
  398. #define SFG_FORCE_SINGLE_ITEM_MENU 0
  399. #endif
  400. //------ developer/debug settings ------
  401. /**
  402. Developer cheat for having infinite ammo in all weapons.
  403. */
  404. #ifndef SFG_INFINITE_AMMO
  405. #define SFG_INFINITE_AMMO 0
  406. #endif
  407. /**
  408. Developer cheat for immortality.
  409. */
  410. #ifndef SFG_IMMORTAL
  411. #define SFG_IMMORTAL 0
  412. #endif
  413. /**
  414. Developer setting, with 1 every level is won immediately after start.
  415. */
  416. #ifndef SFG_QUICK_WIN
  417. #define SFG_QUICK_WIN 0
  418. #endif
  419. /**
  420. Reveals all levels to be played.
  421. */
  422. #ifndef SFG_ALL_LEVELS
  423. #define SFG_ALL_LEVELS 0
  424. #endif
  425. /**
  426. Turn on for previes mode for map editing (flying, noclip, fast movement etc.).
  427. */
  428. #ifndef SFG_PREVIEW_MODE
  429. #define SFG_PREVIEW_MODE 0
  430. #endif
  431. /**
  432. How much faster movement is in the preview mode.
  433. */
  434. #ifndef SFG_PREVIEW_MODE_SPEED_MULTIPLIER
  435. #define SFG_PREVIEW_MODE_SPEED_MULTIPLIER 2
  436. #endif
  437. /**
  438. Skips menu and starts given level immediatelly, for development. 0 means this
  439. options is ignored, 1 means load level 1 etc.
  440. */
  441. #ifndef SFG_START_LEVEL
  442. #define SFG_START_LEVEL 0
  443. #endif
  444. /**
  445. Reveals whole level map from start.
  446. */
  447. #ifndef SFG_REVEAL_MAP
  448. #define SFG_REVEAL_MAP 0
  449. #endif
  450. /**
  451. Gives player all keys from start.
  452. */
  453. #ifndef SFG_UNLOCK_DOOR
  454. #define SFG_UNLOCK_DOOR 0
  455. #endif
  456. #endif // guard