OPTIONS.CPP 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #include <fcntl.h>
  2. #include <io.h>
  3. #include <sys\stat.h>
  4. #include "engine.h"
  5. #include "options.h"
  6. #include "debug4g.h"
  7. #include "key.h"
  8. #include "resource.h"
  9. #include "globals.h"
  10. #include "helix.h"
  11. #include "error.h"
  12. #include "gfx.h"
  13. #include "trig.h"
  14. #include <memcheck.h>
  15. BOOL gFallingDamage = TRUE;
  16. BOOL gViewBobbing = TRUE;
  17. BOOL gRunBackwards = FALSE;
  18. BOOL gFriendlyFire = TRUE;
  19. BOOL gRespawnItems = FALSE;
  20. BOOL gRespawnEnemies = FALSE;
  21. BOOL gOverlayMap = FALSE;
  22. BOOL gRotateMap = FALSE;
  23. BOOL gGraphNumbers = FALSE;
  24. BOOL gAutoAim = TRUE;
  25. BOOL gInfiniteAmmo = FALSE;
  26. BOOL gFullMap = FALSE;
  27. BOOL gNoClip = FALSE;
  28. BOOL gAimReticle = FALSE;
  29. int gDetail = kDetailLevelMin;
  30. extern "C" void initgroupfile(char *);
  31. /*******************************************************************************
  32. FUNCTION: InitEngine()
  33. DESCRIPTION: Initialize the Build engine and pick the graphics mode
  34. PARAMETERS: You can override the mode settings in BLOOD.INI by passing
  35. them in here.
  36. NOTES:
  37. ; 0 = Unchained mode
  38. ; 1 = VESA 2.0 linear buffer
  39. ; 2 = Buffered Screen/VESA mode
  40. ; 3 = TSENG mode
  41. ; 4 = Paradise mode
  42. ; 5 = S3
  43. ; 6 = Crystal Eyes mode
  44. ; 7 = Red-Blue mode
  45. *******************************************************************************/
  46. void InitEngine( int nMode, int xRes, int yRes )
  47. {
  48. atexit(uninitengine); // restores key interrupt on crash
  49. if ( nMode == -1 )
  50. {
  51. nMode = BloodINI.GetKeyInt("Video", "Mode", 2);
  52. xRes = BloodINI.GetKeyInt("Video", "XRes", 320);
  53. yRes = BloodINI.GetKeyInt("Video", "YRes", 200);
  54. }
  55. if ( nMode >= 3 && nMode <= 7 )
  56. {
  57. if (xRes != 320 || yRes != 200)
  58. ThrowError("You wanker! This video mode doesn't support that resolution.", ES_ERROR);
  59. }
  60. initengine(nMode, xRes, yRes);
  61. switch (nMode)
  62. {
  63. case 0: // non-chained
  64. if (chainnumpages > 1)
  65. {
  66. if (!gFindMode(320, 240, 256, NONCHAIN256))
  67. ThrowError("Helix driver not found", ES_ERROR);
  68. gPageTable[0].bytesPerRow = xdim / 4;
  69. gPageTable[0].size = chainsiz;
  70. }
  71. else // memory buffered
  72. {
  73. if (!gFindMode(320, 200, 256, CHAIN256))
  74. ThrowError("Helix driver not found", ES_ERROR);
  75. gPageTable[0].begin = (unsigned)frameplace;
  76. gPageTable[0].bytesPerRow = xdim;
  77. gPageTable[0].size = xdim * ydim;
  78. }
  79. break;
  80. default:
  81. // generic linear frame buffer
  82. if (!gFindMode(320, 200, 256, CHAIN256))
  83. ThrowError("Helix driver not found", ES_ERROR);
  84. gPageTable[0].begin = (unsigned)frameplace;
  85. gPageTable[0].bytesPerRow = xdim;
  86. gPageTable[0].size = xdim * ydim;
  87. }
  88. gfxSetClip(0, 0, xRes, yRes);
  89. }
  90. void optLoadINI( void )
  91. {
  92. gSpring = BloodINI.GetKeyInt("Player", "SpringCoefficient", 12);
  93. gSpringPhaseInc = (int)(kAngle360 / (2 * 3.141592654 * (double)gSpring));
  94. gGamma = BloodINI.GetKeyInt("View", "Gamma", 0);
  95. // load the play options
  96. gDetail = BloodINI.GetKeyInt("Options", "Detail", gDetail);
  97. gFallingDamage = BloodINI.GetKeyBool("Options", "FallingDamage", gFallingDamage);
  98. gViewBobbing = BloodINI.GetKeyBool("Options", "ViewBobbing", gViewBobbing);
  99. gRunBackwards = BloodINI.GetKeyBool("Options", "RunBackwards", gRunBackwards);
  100. gFriendlyFire = BloodINI.GetKeyBool("Options", "FriendlyFire", gFriendlyFire);
  101. gRespawnItems = BloodINI.GetKeyBool("Options", "RespawnItems", gRespawnItems);
  102. gRespawnEnemies = BloodINI.GetKeyBool("Options", "RespawnEnemies", gRespawnEnemies);
  103. gOverlayMap = BloodINI.GetKeyBool("Options", "OverlayMap", gOverlayMap);
  104. gRotateMap = BloodINI.GetKeyBool("Options", "RotateMap", gRotateMap);
  105. gGraphNumbers = BloodINI.GetKeyBool("Options", "GraphNumbers", gGraphNumbers);
  106. gAutoAim = BloodINI.GetKeyBool("Options", "AutoAim", gAutoAim);
  107. gInfiniteAmmo = BloodINI.GetKeyBool("Options", "InfiniteAmmo", gInfiniteAmmo);
  108. }