SETUP.CPP 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. /*******************************************************************************
  2. FILE: SETUP.CPP
  3. DESCRIPTION: Blood setup program
  4. AUTHOR: Peter M. Freese
  5. CREATED: 11-18-95
  6. COPYRIGHT: Copyright (c) 1995 Q Studios Corporation
  7. *******************************************************************************/
  8. #include <conio.h>
  9. #include <stdlib.h>
  10. #include <stdio.h>
  11. #include <string.h>
  12. #include <process.h>
  13. #include "typedefs.h"
  14. #include "debug4g.h"
  15. #include "misc.h"
  16. #include "task_man.h"
  17. #include "fx_man.h"
  18. #include "music.h"
  19. #include "inifile.h"
  20. #include "textio.h"
  21. #include "usrhooks.h"
  22. IniFile config("BLOOD.INI");
  23. struct MENU_LINE
  24. {
  25. int id;
  26. char *name;
  27. char *hint;
  28. };
  29. MENU_LINE MusicCardMenu[] =
  30. {
  31. { -1, "None", "No music card" },
  32. { SoundBlaster, "SoundBlaster", "Sound Blaster, SB Pro, SB 16, or compatible" },
  33. { ProAudioSpectrum, "Pro Audio Spectrum", "Media Vision Pro Audio Sprectrum" },
  34. { SoundMan16, "Sound Man 16", "Logitech Sound Man 16" },
  35. { Adlib, "Adlib", "Adlib card" },
  36. { GenMidi, "General Midi", "General MIDI device through MPU-401" },
  37. { SoundCanvas, "Sound Canvas", "Sound Canvas SCC-1 or daughterboard" },
  38. { Awe32, "Awe 32", "Sound Blaster Awe 32" },
  39. { WaveBlaster, "WaveBlaster", "WaveBlaster daughterboard" },
  40. { SoundScape, "SoundScape", "Ensoniq Sound Scape" },
  41. { UltraSound, "Gravis UltraSound", "Advanced Gravis UltraSound" },
  42. { SoundSource, "Disney Sound Source", "Disney Sound Source" },
  43. { TandySoundSource, "Tandy Sound Source", "Tandy Sound Source" },
  44. { 0, NULL, NULL },
  45. };
  46. MENU_LINE MidiPortMenu[] =
  47. {
  48. { 0x300, "300h", "MIDI Port Address at 300h" },
  49. { 0x310, "310h", "MIDI Port Address at 310h" },
  50. { 0x320, "320h", "MIDI Port Address at 320h" },
  51. { 0x330, "330h (default)", "MIDI Port Address at 330h" },
  52. { 0, NULL, NULL },
  53. };
  54. MENU_LINE SoundCardMenu[] =
  55. {
  56. { -1, "None", "No sound card" },
  57. { SoundBlaster, "SoundBlaster", "Sound Blaster, SB Pro, SB 16, or compatible" },
  58. { ProAudioSpectrum, "Pro Audio Spectrum", "Media Vision Pro Audio Sprectrum" },
  59. { SoundMan16, "Sound Man 16", "Logitech Sound Man 16" },
  60. { Awe32, "Awe 32", "Sound Blaster Awe 32" },
  61. { SoundScape, "SoundScape", "Ensoniq Sound Scape" },
  62. { UltraSound, "Gravis UltraSound", "Advanced Gravis UltraSound" },
  63. { SoundSource, "Disney Sound Source", "Disney Sound Source" },
  64. { TandySoundSource, "Tandy Sound Source", "Tandy Sound Source" },
  65. { 0, NULL, NULL },
  66. };
  67. MENU_LINE BlasterTypeMenu[] =
  68. {
  69. { fx_SB, "Sound Blaster or compatible", "Vanilla Sound Blaster Card" },
  70. { fx_SB20, "Sound Blaster 2.0", "Sound Blaster 2.0 Card" },
  71. { fx_SBPro, "Sound Blaster Pro (old)", "Original Sound Blaster Pro" },
  72. { fx_SBPro2, "Sound Blaster Pro (new)", "Newer Sound Blaster Pro" },
  73. { fx_SB16, "Sound Blaster 16 or AWE32", "Sound Blaster 16 or AWE 32" },
  74. { 0, NULL, NULL },
  75. };
  76. MENU_LINE BlasterAddressMenu[] =
  77. {
  78. { 0x210, "210h", "Sound Blaster Port Address at 210h" },
  79. { 0x220, "220h (default)", "Sound Blaster Port Address at 220h" },
  80. { 0x230, "230h", "Sound Blaster Port Address at 230h" },
  81. { 0x240, "240h", "Sound Blaster Port Address at 240h" },
  82. { 0x250, "250h", "Sound Blaster Port Address at 250h" },
  83. { 0x260, "260h", "Sound Blaster Port Address at 260h" },
  84. { 0x270, "270h", "Sound Blaster Port Address at 270h" },
  85. { 0x280, "280h", "Sound Blaster Port Address at 280h" },
  86. { 0, NULL, NULL },
  87. };
  88. MENU_LINE BlasterIRQMenu[] =
  89. {
  90. { 2, "IRQ 2", "Sound Blaster Set to IRQ 2" },
  91. { 3, "IRQ 3", "Sound Blaster Set to IRQ 3" },
  92. { 5, "IRQ 5 (default", "Sound Blaster Set to IRQ 5" },
  93. { 7, "IRQ 7", "Sound Blaster Set to IRQ 7" },
  94. { 10, "IRQ 10", "Sound Blaster Set to IRQ 10" },
  95. { 11, "IRQ 11", "Sound Blaster Set to IRQ 11" },
  96. { 12, "IRQ 12", "Sound Blaster Set to IRQ 12" },
  97. { 15, "IRQ 15", "Sound Blaster Set to IRQ 15" },
  98. { 0, NULL, NULL },
  99. };
  100. MENU_LINE BlasterDma8Menu[] =
  101. {
  102. { 0, "Channel 0", "8 bit DMA on channel 0" },
  103. { 1, "Channel 1 (default)", "8 bit DMA on channel 1" },
  104. { 3, "Channel 3", "8 bit DMA on channel 3" },
  105. { 0, NULL, NULL },
  106. };
  107. MENU_LINE BlasterDma16Menu[] =
  108. {
  109. { 5, "Channel 5 (default)", "16 bit DMA on channel 5" },
  110. { 6, "Channel 6", "16 bit DMA on channel 6" },
  111. { 7, "Channel 7", "16 bit DMA on channel 7" },
  112. { 0, NULL, NULL },
  113. };
  114. MENU_LINE BitMenu[] =
  115. {
  116. { 8, "8-bit", "8-bit low quality mixing" },
  117. { 16, "16-bit", "16-bit high quality mixing" },
  118. { 0, NULL, NULL },
  119. };
  120. MENU_LINE ChannelMenu[] =
  121. {
  122. { 1, "Mono", "Mono sound, no stereo imaging" },
  123. { 2, "Stereo", "Stereo sound, full stereo imaging" },
  124. { 0, NULL, NULL },
  125. };
  126. MENU_LINE VoiceMenu[] =
  127. {
  128. { 8, "8", "8 voice mixing" },
  129. { 16, "16", "16 voice mixing" },
  130. { 24, "24", "24 voice mixing" },
  131. { 32, "32", "32 voice mixing" },
  132. { 0, NULL, NULL },
  133. };
  134. MENU_LINE MixRateMenu[] =
  135. {
  136. { 11110, "11 KHz", "Mix at 11 KHz" },
  137. { 22220, "22 KHz", "Mix at 22 KHz" },
  138. { 44440, "44 KHz", "Mix at 44 KHz" },
  139. { 0, NULL, NULL },
  140. };
  141. enum
  142. {
  143. kVModeUnchained = 0,
  144. kVModeVesa2 = 1,
  145. kVModeBuffered = 2,
  146. kVModeTseng = 3,
  147. kVModeParadise = 4,
  148. kVModeS3 = 5,
  149. kVModeCrystal = 6,
  150. kVModeRedBlue = 7,
  151. };
  152. MENU_LINE VModeMenu[] =
  153. {
  154. { kVModeUnchained, "Unchained", "Unchained VGA modes (mode X)" },
  155. { kVModeVesa2, "VESA 2.0", "VESA 2.0 Linear Frame Buffer modes" },
  156. { kVModeBuffered, "Memory buffered", "Memory buffer VGA and VESA 1.0 modes" },
  157. { kVModeTseng, "Tseng ET4000", "Specially optimized 320x200 mode for Tseng ET4000 chipsets" },
  158. { kVModeParadise, "Paradise WD90Cxxx", "Specially optimized 320x200 mode for Paradise WD90Cxx chipsets" },
  159. { kVModeS3, "S3", "Specially optimized 320x200 mode for S3 chipsets" },
  160. { kVModeCrystal, "Crystal Eyes Stereo", "320x200 120 Hz Stereo (Crystal Eyes only)" },
  161. { kVModeRedBlue, "Red-Blue Stereogram", "320x200 Red-Blue Stereogram (VGA Compatible)" },
  162. { 0, NULL, NULL },
  163. };
  164. MENU_LINE UnchainedModes[] =
  165. {
  166. { 320 << 16 | 200, "320x200", "320x200" },
  167. { 320 << 16 | 240, "320x240", "320x240" },
  168. { 360 << 16 | 270, "360x270", "360x270" },
  169. { 320 << 16 | 400, "320x400", "320x400" },
  170. { 0, NULL, NULL },
  171. };
  172. MENU_LINE Vesa2Modes[] =
  173. {
  174. { 320 << 16 | 200, "320x200", "320x200" },
  175. { 320 << 16 | 240, "320x240", "320x240" },
  176. { 320 << 16 | 400, "320x400", "320x400" },
  177. { 640 << 16 | 400, "640x400", "640x400" },
  178. { 640 << 16 | 480, "640x480", "640x480" },
  179. { 800 << 16 | 600, "800x600", "800x600" },
  180. { 0, NULL, NULL },
  181. };
  182. enum
  183. {
  184. kMenuSound,
  185. kMenuMusic,
  186. kMenuVideo,
  187. kMenuControl,
  188. kMenuNetwork,
  189. kMenuModem,
  190. kMenuLaunch,
  191. kMenuSave,
  192. };
  193. MENU_LINE MainMenu[] =
  194. {
  195. { kMenuSound, "Sound setup", "Setup sound card" },
  196. { kMenuMusic, "Music setup", "Setup music card" },
  197. { kMenuVideo, "Video setup", "Setup video mode" },
  198. { kMenuControl, "Control setup", "Configure input devices" },
  199. { kMenuNetwork, "Network game", "Play a network game of Blood" },
  200. { kMenuModem, "Modem game", "Launch a modem game of Blood" },
  201. { kMenuLaunch, "Save and play", "Save settings and launch Blood" },
  202. { kMenuSave, "Save and exit", "Save settings and exit" },
  203. { 0, NULL, NULL },
  204. };
  205. int gMusicDevice;
  206. int gMusicVolume;
  207. int gMidiPort;
  208. int gFXDevice;
  209. int gMixBits;
  210. int gChannels;
  211. int gMixVoices;
  212. int gMixRate;
  213. int gFXVolume;
  214. fx_blaster_config gSBConfig;
  215. int gVideoMode;
  216. int gVideoXRes;
  217. int gVideoYRes;
  218. /*---------------------------------------------------------------------
  219. Function: USRHOOKS_GetMem
  220. Allocates the requested amount of memory and returns a pointer to
  221. its location, or NULL if an error occurs. NOTE: pointer is assumed
  222. to be dword aligned.
  223. ---------------------------------------------------------------------*/
  224. int USRHOOKS_GetMem( void **ptr, unsigned long size )
  225. {
  226. void *memory;
  227. memory = malloc( size );
  228. if ( memory == NULL )
  229. {
  230. return( USRHOOKS_Error );
  231. }
  232. *ptr = memory;
  233. return( USRHOOKS_Ok );
  234. }
  235. /*---------------------------------------------------------------------
  236. Function: USRHOOKS_FreeMem
  237. Deallocates the memory associated with the specified pointer.
  238. ---------------------------------------------------------------------*/
  239. int USRHOOKS_FreeMem( void *ptr )
  240. {
  241. if ( ptr == NULL )
  242. {
  243. return( USRHOOKS_Error );
  244. }
  245. free( ptr );
  246. return( USRHOOKS_Ok );
  247. }
  248. /*---------------------------------------------------------------------
  249. Function: SelectMenu
  250. Draws the sound card selection screen and waits for the user to
  251. select a card.
  252. ---------------------------------------------------------------------*/
  253. int SelectMenu( char *title, MENU_LINE list[], int nDefault )
  254. {
  255. int cols = 0, rows = 0;
  256. int pos = 0;
  257. int nListItems;
  258. // cols = strlen(title);
  259. (void)title;
  260. // find widest menu item text
  261. for ( int i = 0; list[i].name != NULL; i++)
  262. {
  263. int n = strlen(list[i].name);
  264. if (n > cols)
  265. cols = n;
  266. }
  267. nListItems = i;
  268. cols += 5;
  269. rows = nListItems + 3;
  270. char *saveUnder = (char *)malloc(rows * cols * 2);
  271. int left = (tioScreenCols - cols) / 2;
  272. int top = (tioScreenRows - rows) / 2;
  273. tioSaveWindow(saveUnder, top, left, rows, cols);
  274. tioFrame(top, left, rows - 1, cols - 1, kFrameSingle, kColorBlue * 16 | kColorCyan);
  275. tioFill(top + 1, left + 1, rows - 3, cols - 3, ' ', kColorBlue * 16 | kColorYellow);
  276. tioFillShadow(top + rows - 1, left + 1, 1, cols - 1);
  277. tioFillShadow(top + 1, left + cols - 1, rows - 2, 1);
  278. for( i = 0; i < nListItems; i++ )
  279. {
  280. tioLeftString(top + i + 1, left + 2, list[i].name, kColorBlue * 16 | kColorYellow);
  281. if ( list[i].id == nDefault )
  282. pos = i;
  283. }
  284. int ch = 0;
  285. while( ch != 0x0D && ch != 0x20 )
  286. {
  287. // highlight current line and display hint
  288. tioFillAttr(top + pos + 1, left + 1, 1, cols - 3, kColorLightGray * 16 | kColorBlack);
  289. tioCenterString(tioScreenRows - 1, 0, tioScreenCols - 1,
  290. list[pos].hint, kColorRed * 16 | kColorYellow);
  291. ch = getch();
  292. if ( ch == 0 )
  293. {
  294. ch = 0x100 | getch();
  295. }
  296. // Up arrow
  297. if ( ch == 0x148 )
  298. {
  299. tioFillAttr(top + pos + 1, left + 1, 1, cols - 3, kColorBlue * 16 | kColorYellow);
  300. pos = DecRotate(pos, nListItems);
  301. }
  302. // Down arrow
  303. if ( ch == 0x150 )
  304. {
  305. tioFillAttr(top + pos + 1, left + 1, 1, cols - 3, kColorBlue * 16 | kColorYellow);
  306. pos = IncRotate(pos, nListItems);
  307. }
  308. // Esc
  309. if ( ch == 0x1B )
  310. {
  311. tioRestoreWindow(saveUnder, top, left, rows, cols);
  312. free(saveUnder);
  313. return -1;
  314. }
  315. }
  316. tioRestoreWindow(saveUnder, top, left, rows, cols);
  317. free(saveUnder);
  318. return list[pos].id;
  319. }
  320. void DoMusicMenu( void )
  321. {
  322. // Get Sound fx card
  323. gMusicDevice = SelectMenu("Select a device for music",
  324. MusicCardMenu, gMusicDevice);
  325. if ( gMusicDevice < 0 )
  326. return;
  327. if ( gMusicDevice == SoundCanvas || gMusicDevice == GenMidi )
  328. {
  329. gMidiPort = SelectMenu("MIDI Port Address",
  330. MidiPortMenu, gMidiPort);
  331. }
  332. config.PutKeyInt("Sound Setup", "MusicDevice", gMusicDevice);
  333. config.PutKeyInt("Sound Setup", "MusicVolume", gMusicVolume);
  334. config.PutKeyHex("Sound Setup", "MidiPort", gMidiPort);
  335. return;
  336. }
  337. void GetSoundSettings( void )
  338. {
  339. FX_GetBlasterSettings(&gSBConfig);
  340. // Read current setup
  341. gMusicDevice = config.GetKeyInt("Sound Setup", "MusicDevice", -1);
  342. gMusicVolume = config.GetKeyInt("Sound Setup", "MusicVolume", 200);
  343. gMidiPort = config.GetKeyHex("Sound Setup", "MidiPort", gSBConfig.Midi);
  344. gFXDevice = config.GetKeyInt("Sound Setup", "FXDevice", -1);
  345. gFXVolume = config.GetKeyInt("Sound Setup", "FXVolume", 200);
  346. gMixBits = config.GetKeyInt("Sound Setup", "Bits", 16);
  347. gChannels = config.GetKeyInt("Sound Setup", "Channels", 2);
  348. gMixVoices = config.GetKeyInt("Sound Setup", "Voices", 32);
  349. gMixRate = config.GetKeyInt("Sound Setup", "MixRate", 22220);
  350. gSBConfig.Address = config.GetKeyInt("Sound Setup", "BlasterAddress", gSBConfig.Address);
  351. gSBConfig.Type = config.GetKeyInt("Sound Setup", "BlasterType", gSBConfig.Type);
  352. gSBConfig.Interrupt = config.GetKeyInt("Sound Setup", "BlasterInterrupt", gSBConfig.Interrupt);
  353. gSBConfig.Dma8 = config.GetKeyInt("Sound Setup", "BlasterDma8", gSBConfig.Dma8);
  354. gSBConfig.Dma16 = config.GetKeyInt("Sound Setup", "BlasterDma16", gSBConfig.Dma16);
  355. gSBConfig.Emu = config.GetKeyInt("Sound Setup", "BlasterEmu", gSBConfig.Emu);
  356. }
  357. void DoSoundMenu( void )
  358. {
  359. // Get Sound fx card
  360. gFXDevice = SelectMenu("Select a device for digital sound",
  361. SoundCardMenu, gFXDevice);
  362. if ( gFXDevice < 0 )
  363. return;
  364. switch ( gFXDevice )
  365. {
  366. case SoundBlaster:
  367. case ProAudioSpectrum:
  368. case SoundMan16:
  369. case Awe32:
  370. case WaveBlaster:
  371. case SoundScape:
  372. gMixBits = SelectMenu("Select the number of bits to use for mixing",
  373. BitMenu, gMixBits);
  374. if ( gMixBits < 0 )
  375. return;
  376. gChannels = SelectMenu("Select the channels mode",
  377. ChannelMenu, gChannels);
  378. if ( gChannels < 0 )
  379. return;
  380. gMixVoices = SelectMenu("Select the number of voices to use for mixing",
  381. VoiceMenu, gMixVoices);
  382. break;
  383. default:
  384. gMixBits = 8;
  385. gChannels = 1;
  386. gMixVoices = 2;
  387. break;
  388. }
  389. gMixRate = SelectMenu("Select the rate to use for mixing",
  390. MixRateMenu, gMixRate);
  391. if ( gMixRate < 0 )
  392. return;
  393. if ( gFXDevice == SoundBlaster || gFXDevice == Awe32 )
  394. {
  395. gSBConfig.Address = SelectMenu("Base I/O address",
  396. BlasterAddressMenu, gSBConfig.Address);
  397. gSBConfig.Type = SelectMenu("Type of Sound Blaster card",
  398. BlasterTypeMenu, gSBConfig.Type);
  399. gSBConfig.Interrupt = SelectMenu("Interrupt",
  400. BlasterIRQMenu, gSBConfig.Interrupt);
  401. gSBConfig.Dma8 = SelectMenu("8 bit DMA channel",
  402. BlasterDma8Menu, gSBConfig.Dma8);
  403. gSBConfig.Dma16 = SelectMenu("16 bit DMA channel",
  404. BlasterDma16Menu, gSBConfig.Dma16);
  405. }
  406. config.PutKeyInt("Sound Setup", "FXDevice", gFXDevice);
  407. config.PutKeyInt("Sound Setup", "FXVolume", gFXVolume);
  408. config.PutKeyInt("Sound Setup", "Bits", gMixBits);
  409. config.PutKeyInt("Sound Setup", "Channels", gChannels);
  410. config.PutKeyInt("Sound Setup", "Voices", gMixVoices);
  411. config.PutKeyInt("Sound Setup", "MixRate", gMixRate);
  412. config.PutKeyHex("Sound Setup", "BlasterAddress", gSBConfig.Address);
  413. config.PutKeyInt("Sound Setup", "BlasterType", gSBConfig.Type);
  414. config.PutKeyInt("Sound Setup", "BlasterInterrupt", gSBConfig.Interrupt);
  415. config.PutKeyInt("Sound Setup", "BlasterDma8", gSBConfig.Dma8);
  416. config.PutKeyInt("Sound Setup", "BlasterDma16", gSBConfig.Dma16);
  417. config.PutKeyInt("Sound Setup", "BlasterEmu", gSBConfig.Emu);
  418. return;
  419. }
  420. void InitSoundCard( void )
  421. {
  422. int status;
  423. // Do special Sound Blaster, AWE32 stuff
  424. if ( gFXDevice == SoundBlaster || gFXDevice == Awe32 )
  425. {
  426. int MaxVoices;
  427. int MaxBits;
  428. int MaxChannels;
  429. status = FX_SetupSoundBlaster(gSBConfig, &MaxVoices, &MaxBits, &MaxChannels);
  430. }
  431. else
  432. {
  433. fx_device device;
  434. status = FX_SetupCard( gFXDevice, &device );
  435. }
  436. if ( status != FX_Ok )
  437. {
  438. printf( "%s\n", FX_ErrorString( status ) );
  439. exit( 1 );
  440. }
  441. status = FX_Init( gFXDevice, gMixVoices, gChannels, gMixBits, gMixRate );
  442. if ( status != FX_Ok )
  443. {
  444. printf( "%s\n", FX_ErrorString( status ) );
  445. exit( 1 );
  446. }
  447. }
  448. void DoVideoMenu( void )
  449. {
  450. int packedRes = gVideoXRes << 16 | gVideoYRes;
  451. gVideoMode = SelectMenu("Select a video mode", VModeMenu, gVideoMode);
  452. switch ( gVideoMode )
  453. {
  454. case -1:
  455. return;
  456. case kVModeUnchained:
  457. packedRes = SelectMenu("Select resolution", UnchainedModes, packedRes);
  458. if ( packedRes < 0 )
  459. return;
  460. gVideoXRes = packedRes >> 16;
  461. gVideoYRes = packedRes & 0xFFFF;
  462. break;
  463. case kVModeVesa2:
  464. packedRes = SelectMenu("Select resolution", Vesa2Modes, packedRes);
  465. if ( packedRes < 0 )
  466. return;
  467. gVideoXRes = packedRes >> 16;
  468. gVideoYRes = packedRes & 0xFFFF;
  469. break;
  470. case kVModeBuffered:
  471. case kVModeTseng:
  472. case kVModeParadise:
  473. case kVModeS3:
  474. case kVModeCrystal:
  475. case kVModeRedBlue:
  476. gVideoXRes = 320;
  477. gVideoYRes = 200;
  478. break;
  479. }
  480. config.PutKeyInt("Video", "Mode", gVideoMode);
  481. config.PutKeyInt("Video", "XRes", gVideoXRes);
  482. config.PutKeyInt("Video", "YRes", gVideoYRes);
  483. return;
  484. }
  485. void DoMainMenu( void )
  486. {
  487. int nMenuItem = 0;
  488. while (1)
  489. {
  490. nMenuItem = SelectMenu("", MainMenu, nMenuItem);
  491. switch ( nMenuItem )
  492. {
  493. case -1:
  494. return;
  495. case kMenuSound:
  496. DoSoundMenu();
  497. break;
  498. case kMenuMusic:
  499. DoMusicMenu();
  500. break;
  501. case kMenuVideo:
  502. DoVideoMenu();
  503. break;
  504. case kMenuControl:
  505. break;
  506. case kMenuNetwork:
  507. break;
  508. case kMenuModem:
  509. break;
  510. case kMenuLaunch:
  511. config.Save();
  512. tioSetAttribute(kColorLightGray);
  513. tioClearWindow();
  514. tioTerm();
  515. exit(spawnl(P_WAIT, "blood.exe", "blood.exe", NULL));
  516. case kMenuSave:
  517. config.Save();
  518. return;
  519. }
  520. }
  521. }
  522. /*---------------------------------------------------------------------
  523. Function: main
  524. Sets up sound cards, calls the demo, and then cleans up.
  525. ---------------------------------------------------------------------*/
  526. void main( void )
  527. {
  528. GetSoundSettings();
  529. gVideoMode = config.GetKeyInt("Video", "Mode", kVModeBuffered);
  530. gVideoXRes = config.GetKeyInt("Video", "XRes", 320);
  531. gVideoYRes = config.GetKeyInt("Video", "YRes", 200);
  532. tioInit(1);
  533. tioFill( 0, 0, tioScreenRows - 2, tioScreenCols, ' ', kColorBlue * 16 | kColorYellow);
  534. tioLeftString(0, 1, "Blood Setup Version 1.0", kColorBlue * 16 | kColorYellow);
  535. tioRightString(0, tioScreenCols - 2, "Copyright (c) 1995 Q Studios", kColorBlue * 16 | kColorYellow);
  536. tioFill( 1, 0, tioScreenRows - 2, tioScreenCols, '°', kColorBlack * 16 | kColorDarkGray);
  537. DoMainMenu();
  538. tioSetAttribute(kColorLightGray);
  539. tioClearWindow();
  540. tioTerm();
  541. }