GameSettings.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. #ifdef PRECOMPILEDHEADERS
  2. #include "JA2 All.h"
  3. #include "HelpScreen.h"
  4. #include "Campaign.h"
  5. #include "Cheats.h"
  6. #else
  7. #include "Types.h"
  8. #include "GameSettings.h"
  9. #include "FileMan.h"
  10. #include "String.h"
  11. #include "Sound Control.h"
  12. #include "SaveLoadScreen.h"
  13. #include "Music Control.h"
  14. #include "Options Screen.h"
  15. #include "Overhead.h"
  16. #include "GameVersion.h"
  17. #include "LibraryDataBase.h"
  18. #include "Debug.h"
  19. #include "Language Defines.h"
  20. #include "HelpScreen.h"
  21. #endif
  22. #include "Text.h"
  23. #define GAME_SETTINGS_FILE "..\\Ja2.set"
  24. #define GAME_INI_FILE "..\\Ja2.ini"
  25. #define CD_ROOT_DIR "DATA\\"
  26. GAME_SETTINGS gGameSettings;
  27. GAME_OPTIONS gGameOptions;
  28. extern SGPFILENAME gCheckFilenames[];
  29. extern CHAR8 gzErrorMsg[256];
  30. void InitGameSettings();
  31. BOOLEAN GetCdromLocationFromIniFile( STR pRootOfCdromDrive );
  32. extern BOOLEAN DoJA2FilesExistsOnDrive( CHAR8 *zCdLocation );
  33. BOOLEAN GetCDromDriveLetter( STR8 pString );
  34. BOOLEAN IsDriveLetterACDromDrive( STR pDriveLetter );
  35. void CDromEjectionErrorMessageBoxCallBack( UINT8 bExitValue );
  36. //Change this number when we want any who gets the new build to reset the options
  37. #define GAME_SETTING_CURRENT_VERSION 522
  38. BOOLEAN LoadGameSettings()
  39. {
  40. HWFILE hFile;
  41. UINT32 uiNumBytesRead;
  42. //if the game settings file does NOT exist, or if it is smaller then what it should be
  43. if( !FileExists( GAME_SETTINGS_FILE ) || FileSize( GAME_SETTINGS_FILE ) != sizeof( GAME_SETTINGS ) )
  44. {
  45. //Initialize the settings
  46. InitGameSettings();
  47. //delete the shade tables aswell
  48. DeleteShadeTableDir( );
  49. }
  50. else
  51. {
  52. hFile = FileOpen( GAME_SETTINGS_FILE, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
  53. if( !hFile )
  54. {
  55. FileClose( hFile );
  56. InitGameSettings();
  57. return(FALSE);
  58. }
  59. FileRead( hFile, &gGameSettings, sizeof( GAME_SETTINGS ), &uiNumBytesRead );
  60. if( uiNumBytesRead != sizeof( GAME_SETTINGS ) )
  61. {
  62. FileClose( hFile );
  63. InitGameSettings();
  64. return(FALSE);
  65. }
  66. FileClose( hFile );
  67. }
  68. //if the version in the game setting file is older then the we want, init the game settings
  69. if( gGameSettings.uiSettingsVersionNumber < GAME_SETTING_CURRENT_VERSION )
  70. {
  71. //Initialize the settings
  72. InitGameSettings();
  73. //delete the shade tables aswell
  74. DeleteShadeTableDir( );
  75. return( TRUE );
  76. }
  77. //
  78. //Do checking to make sure the settings are valid
  79. //
  80. if( gGameSettings.bLastSavedGameSlot < 0 || gGameSettings.bLastSavedGameSlot >= NUM_SAVE_GAMES )
  81. gGameSettings.bLastSavedGameSlot = -1;
  82. if( gGameSettings.ubMusicVolumeSetting > HIGHVOLUME )
  83. gGameSettings.ubMusicVolumeSetting = MIDVOLUME;
  84. if( gGameSettings.ubSoundEffectsVolume > HIGHVOLUME )
  85. gGameSettings.ubSoundEffectsVolume = MIDVOLUME;
  86. if( gGameSettings.ubSpeechVolume > HIGHVOLUME )
  87. gGameSettings.ubSpeechVolume = MIDVOLUME;
  88. //make sure that at least subtitles or speech is enabled
  89. if( !gGameSettings.fOptions[ TOPTION_SUBTITLES ] && !gGameSettings.fOptions[ TOPTION_SPEECH ] )
  90. {
  91. gGameSettings.fOptions[ TOPTION_SUBTITLES ] = TRUE;
  92. gGameSettings.fOptions[ TOPTION_SPEECH ] = TRUE;
  93. }
  94. //
  95. // Set the settings
  96. //
  97. SetSoundEffectsVolume( gGameSettings.ubSoundEffectsVolume );
  98. SetSpeechVolume( gGameSettings.ubSpeechVolume );
  99. MusicSetVolume( gGameSettings.ubMusicVolumeSetting );
  100. #ifndef BLOOD_N_GORE_ENABLED
  101. gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] = FALSE;
  102. #endif
  103. //if the user doesnt want the help screens present
  104. if( gGameSettings.fHideHelpInAllScreens )
  105. {
  106. gHelpScreen.usHasPlayerSeenHelpScreenInCurrentScreen = 0;
  107. }
  108. else
  109. {
  110. //Set it so that every screens help will come up the first time ( the 'x' will be set )
  111. gHelpScreen.usHasPlayerSeenHelpScreenInCurrentScreen = 0xffff;
  112. }
  113. return( TRUE );
  114. }
  115. BOOLEAN SaveGameSettings()
  116. {
  117. HWFILE hFile;
  118. UINT32 uiNumBytesWritten;
  119. //create the file
  120. hFile = FileOpen( GAME_SETTINGS_FILE, FILE_ACCESS_WRITE | FILE_CREATE_ALWAYS, FALSE );
  121. if( !hFile )
  122. {
  123. FileClose( hFile );
  124. return(FALSE);
  125. }
  126. //Record the current settings into the game settins structure
  127. gGameSettings.ubSoundEffectsVolume = (UINT8)GetSoundEffectsVolume( );
  128. gGameSettings.ubSpeechVolume = (UINT8)GetSpeechVolume( );
  129. gGameSettings.ubMusicVolumeSetting = (UINT8)MusicGetVolume( );
  130. strcpy( gGameSettings.zVersionNumber, czVersionNumber );
  131. gGameSettings.uiSettingsVersionNumber = GAME_SETTING_CURRENT_VERSION;
  132. //Write the game settings to disk
  133. FileWrite( hFile, &gGameSettings, sizeof( GAME_SETTINGS ), &uiNumBytesWritten );
  134. if( uiNumBytesWritten != sizeof( GAME_SETTINGS ) )
  135. {
  136. FileClose( hFile );
  137. return(FALSE);
  138. }
  139. FileClose( hFile );
  140. return( TRUE );
  141. }
  142. void InitGameSettings()
  143. {
  144. memset( &gGameSettings, 0, sizeof( GAME_SETTINGS ) );
  145. //Init the Game Settings
  146. gGameSettings.bLastSavedGameSlot = -1;
  147. gGameSettings.ubMusicVolumeSetting = 63;
  148. gGameSettings.ubSoundEffectsVolume = 63;
  149. gGameSettings.ubSpeechVolume = 63;
  150. //Set the settings
  151. SetSoundEffectsVolume( gGameSettings.ubSoundEffectsVolume );
  152. SetSpeechVolume( gGameSettings.ubSpeechVolume );
  153. MusicSetVolume( gGameSettings.ubMusicVolumeSetting );
  154. gGameSettings.fOptions[ TOPTION_SUBTITLES ] = TRUE;
  155. gGameSettings.fOptions[ TOPTION_SPEECH ] = TRUE;
  156. gGameSettings.fOptions[ TOPTION_KEY_ADVANCE_SPEECH ] = FALSE;
  157. gGameSettings.fOptions[ TOPTION_RTCONFIRM ] = FALSE;
  158. gGameSettings.fOptions[ TOPTION_HIDE_BULLETS ] = FALSE;
  159. gGameSettings.fOptions[ TOPTION_TRACKING_MODE ] = TRUE;
  160. gGameSettings.fOptions[ TOPTION_MUTE_CONFIRMATIONS ] = FALSE;
  161. gGameSettings.fOptions[ TOPTION_ANIMATE_SMOKE ] = TRUE;
  162. gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] = TRUE;
  163. gGameSettings.fOptions[ TOPTION_DONT_MOVE_MOUSE ] = FALSE;
  164. gGameSettings.fOptions[ TOPTION_OLD_SELECTION_METHOD ] = FALSE;
  165. gGameSettings.fOptions[ TOPTION_ALWAYS_SHOW_MOVEMENT_PATH ] = FALSE;
  166. gGameSettings.fOptions[ TOPTION_SLEEPWAKE_NOTIFICATION ] = TRUE;
  167. gGameSettings.fOptions[ TOPTION_USE_METRIC_SYSTEM ] = FALSE;
  168. #ifndef BLOOD_N_GORE_ENABLED
  169. gGameSettings.fOptions[ TOPTION_BLOOD_N_GORE ] = FALSE;
  170. #endif
  171. gGameSettings.fOptions[ TOPTION_MERC_ALWAYS_LIGHT_UP ] = FALSE;
  172. gGameSettings.fOptions[ TOPTION_SMART_CURSOR ] = FALSE;
  173. gGameSettings.fOptions[ TOPTION_SNAP_CURSOR_TO_DOOR ] = TRUE;
  174. gGameSettings.fOptions[ TOPTION_GLOW_ITEMS ] = TRUE;
  175. gGameSettings.fOptions[ TOPTION_TOGGLE_TREE_TOPS ] = TRUE;
  176. gGameSettings.fOptions[ TOPTION_TOGGLE_WIREFRAME ] = TRUE;
  177. gGameSettings.fOptions[ TOPTION_3D_CURSOR ] = FALSE;
  178. // JA2Gold
  179. gGameSettings.fOptions[ TOPTION_MERC_CASTS_LIGHT ] = TRUE;
  180. gGameSettings.ubSizeOfDisplayCover = 4;
  181. gGameSettings.ubSizeOfLOS = 4;
  182. //Since we just set the settings, save them
  183. SaveGameSettings();
  184. }
  185. void InitGameOptions()
  186. {
  187. memset( &gGameOptions, 0, sizeof( GAME_OPTIONS ) );
  188. //Init the game options
  189. gGameOptions.fGunNut = FALSE;
  190. gGameOptions.fSciFi = TRUE;
  191. gGameOptions.ubDifficultyLevel = DIF_LEVEL_EASY;
  192. //gGameOptions.fTurnTimeLimit = FALSE;
  193. gGameOptions.fIronManMode = FALSE;
  194. }
  195. BOOLEAN GetCDLocation( )
  196. {
  197. UINT32 uiStrngLength = 0;
  198. CHAR8 zCdLocation[ SGPFILENAME_LEN ];
  199. UINT32 uiDriveType=0;
  200. UINT32 uiRetVal=0;
  201. //Do a crude check to make sure the Ja2.ini file is the right on
  202. uiRetVal = GetPrivateProfileString( "Ja2 Settings","CD", "", zCdLocation, SGPFILENAME_LEN, GAME_INI_FILE );
  203. if( uiRetVal == 0 || !IsDriveLetterACDromDrive( zCdLocation ) )
  204. {
  205. // the user most likely doesnt have the file, or the user has messed with the file
  206. // build a new one
  207. //First delete the old file
  208. FileDelete( GAME_INI_FILE );
  209. //Get the location of the cdrom drive
  210. if( GetCDromDriveLetter( zCdLocation ) )
  211. {
  212. CHAR8 *pTemp;
  213. //if it succeeded
  214. pTemp = strrchr( zCdLocation, ':' );
  215. pTemp[0] = '\0';
  216. }
  217. else
  218. {
  219. //put in a default location
  220. sprintf( zCdLocation, "c" );
  221. }
  222. //Now create a new file
  223. WritePrivateProfileString( "Ja2 Settings", "CD", zCdLocation, GAME_INI_FILE );
  224. GetPrivateProfileString( "Ja2 Settings","CD", "", zCdLocation, SGPFILENAME_LEN, GAME_INI_FILE );
  225. }
  226. uiStrngLength = strlen( zCdLocation );
  227. //if the string length is less the 1 character, it is a drive letter
  228. if( uiStrngLength == 1 )
  229. {
  230. sprintf( gzCdDirectory, "%s:\\%s", zCdLocation, CD_ROOT_DIR );
  231. }
  232. //else it is most likely a network location
  233. else if( uiStrngLength > 1 )
  234. {
  235. sprintf( gzCdDirectory, "%s\\%s", zCdLocation, CD_ROOT_DIR );
  236. }
  237. else
  238. {
  239. //no path was entered
  240. gzCdDirectory[ 0 ] = '.';
  241. }
  242. return( TRUE );
  243. }
  244. BOOLEAN GetCDromDriveLetter( STR8 pString )
  245. {
  246. UINT32 uiSize=0;
  247. UINT8 ubCnt=0;
  248. CHAR8 zDriveLetters[512];
  249. CHAR8 zDriveLetter[16];
  250. UINT32 uiDriveType;
  251. uiSize = GetLogicalDriveStrings( 512, zDriveLetters );
  252. for( ubCnt=0;ubCnt<uiSize;ubCnt++ )
  253. {
  254. //if the current char is not null
  255. if( zDriveLetters[ ubCnt ] != '\0' )
  256. {
  257. //get the string
  258. zDriveLetter[ 0 ] = zDriveLetters[ ubCnt ];
  259. ubCnt++;
  260. zDriveLetter[ 1 ] = zDriveLetters[ ubCnt ];
  261. ubCnt++;
  262. zDriveLetter[ 2 ] = zDriveLetters[ ubCnt ];
  263. zDriveLetter[ 3 ] = '\0';
  264. //Get the drive type
  265. uiDriveType = GetDriveType( zDriveLetter );
  266. switch( uiDriveType )
  267. {
  268. // The drive is a CD-ROM drive.
  269. case DRIVE_CDROM:
  270. strcpy( pString, zDriveLetter );
  271. if ( DoJA2FilesExistsOnDrive( pString ) )
  272. {
  273. return( TRUE );
  274. }
  275. break;
  276. default:
  277. break;
  278. }
  279. }
  280. }
  281. return( FALSE );
  282. }
  283. /*
  284. //Determine the type of drive the CDrom is on
  285. uiDriveType = GetDriveType( zCdLocation );
  286. switch( uiDriveType )
  287. {
  288. // The root directory does not exist.
  289. case DRIVE_NO_ROOT_DIR:
  290. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("CDrom Info '%s': %s", zCdLocation, "The root directory does not exist." ) );
  291. break;
  292. // The disk can be removed from the drive.
  293. case DRIVE_REMOVABLE:
  294. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("CDrom Info '%s': %s", zCdLocation, "The disk can be removed from the drive." ) );
  295. break;
  296. // The disk cannot be removed from the drive.
  297. case DRIVE_FIXED:
  298. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("CDrom Info '%s': %s", zCdLocation, "The disk cannot be removed from the drive." ) );
  299. break;
  300. // The drive is a remote (network) drive.
  301. case DRIVE_REMOTE:
  302. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("CDrom Info '%s': %s", zCdLocation, "The drive is a remote (network) drive." ) );
  303. break;
  304. // The drive is a CD-ROM drive.
  305. case DRIVE_CDROM:
  306. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("CDrom Info '%s': %s", zCdLocation, "The drive is a CD-ROM drive." ) );
  307. break;
  308. // The drive is a RAM disk.
  309. case DRIVE_RAMDISK:
  310. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("CDrom Info '%s': %s", zCdLocation, "The drive is a RAM disk." ) );
  311. break;
  312. // The drive type cannot be determined.
  313. case DRIVE_UNKNOWN:
  314. default:
  315. DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("CDrom Info '%s': %s", zCdLocation, "The drive type cannot be determined." ) );
  316. break;
  317. }
  318. */
  319. BOOLEAN CheckIfGameCdromIsInCDromDrive()
  320. {
  321. CHAR8 zVolumeNameBuffer[512];
  322. UINT32 uiVolumeSerialNumber=0;
  323. UINT32 uiMaxComponentLength=0;
  324. UINT32 uiFileSystemFlags=0;
  325. CHAR8 zFileSystemNameBuffer[512];
  326. CHAR8 zCdLocation[ SGPFILENAME_LEN ];
  327. CHAR8 zCdFile[ SGPFILENAME_LEN ];
  328. CHAR8 zCdromRootDrive[512];
  329. BOOLEAN fFailed = FALSE;
  330. UINT32 uiVolumeReturnValue;
  331. UINT32 uiLastError = ERROR_SUCCESS;
  332. if( !GetCdromLocationFromIniFile( zCdromRootDrive ) )
  333. return( FALSE );
  334. uiVolumeReturnValue = GetVolumeInformation( zCdromRootDrive, zVolumeNameBuffer, 512, &uiVolumeSerialNumber, &uiMaxComponentLength, &uiFileSystemFlags, zFileSystemNameBuffer, 512 );
  335. if( !uiVolumeReturnValue )
  336. {
  337. uiLastError = GetLastError();
  338. }
  339. // OK, build filename
  340. sprintf( zCdFile, "%s%s", zCdLocation, gCheckFilenames[ Random( 2 ) ] );
  341. //If the cdrom drive is no longer in the drive
  342. if( uiLastError == ERROR_NOT_READY || ( !FileExists( zCdFile ) ) )
  343. {
  344. CHAR8 sString[512];
  345. //if a game has been started, add the msg about saving the game to a different entry
  346. if( gTacticalStatus.fHasAGameBeenStarted )
  347. {
  348. sprintf( sString, "%S %S", pMessageStrings[ MSG_INTEGRITY_WARNING ], pMessageStrings[ MSG_CDROM_SAVE_GAME ] );
  349. SaveGame( SAVE__ERROR_NUM, pMessageStrings[ MSG_CDROM_SAVE ] );
  350. }
  351. else
  352. {
  353. sprintf( sString, "%S", pMessageStrings[ MSG_INTEGRITY_WARNING ] );
  354. }
  355. // ATE: These are ness. due to reference counting
  356. // in showcursor(). I'm not about to go digging in low level stuff at this
  357. // point in the game development, so keep these here, as this works...
  358. ShowCursor(TRUE);
  359. ShowCursor(TRUE);
  360. ShutdownWithErrorBox( sString );
  361. //DoTester( );
  362. //MessageBox(NULL, sString, "Error", MB_OK | MB_ICONERROR );
  363. return( FALSE );
  364. }
  365. return( TRUE );
  366. }
  367. BOOLEAN GetCdromLocationFromIniFile( STR pRootOfCdromDrive )
  368. {
  369. UINT32 uiRetVal=0;
  370. //Do a crude check to make sure the Ja2.ini file is the right on
  371. uiRetVal = GetPrivateProfileString( "Ja2 Settings","CD", "", pRootOfCdromDrive, SGPFILENAME_LEN, GAME_INI_FILE );
  372. if( uiRetVal == 0 )
  373. {
  374. pRootOfCdromDrive[0] = '\0';
  375. return( FALSE);
  376. }
  377. else
  378. {
  379. //add the :\ to the dir
  380. strcat( pRootOfCdromDrive, ":\\" );
  381. return( TRUE );
  382. }
  383. }
  384. void CDromEjectionErrorMessageBoxCallBack( UINT8 bExitValue )
  385. {
  386. if( bExitValue == MSG_BOX_RETURN_OK )
  387. {
  388. guiPreviousOptionScreen = GAME_SCREEN;
  389. //if we are in a game, save the game
  390. if( gTacticalStatus.fHasAGameBeenStarted )
  391. {
  392. SaveGame( SAVE__ERROR_NUM, pMessageStrings[ MSG_CDROM_SAVE ] );
  393. }
  394. //quit the game
  395. gfProgramIsRunning = FALSE;
  396. }
  397. }
  398. BOOLEAN IsDriveLetterACDromDrive( STR pDriveLetter )
  399. {
  400. UINT32 uiDriveType;
  401. CHAR8 zRootName[512];
  402. sprintf( zRootName, "%s:\\", pDriveLetter );
  403. //Get the drive type
  404. uiDriveType = GetDriveType( zRootName );
  405. switch( uiDriveType )
  406. {
  407. // The drive is a CD-ROM drive.
  408. #ifdef JA2BETAVERSION
  409. case DRIVE_NO_ROOT_DIR:
  410. case DRIVE_REMOTE:
  411. #endif
  412. case DRIVE_CDROM:
  413. return( TRUE );
  414. break;
  415. }
  416. return( FALSE );
  417. }
  418. void DisplayGameSettings( )
  419. {
  420. //Display the version number
  421. ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s (%S)", pMessageStrings[ MSG_VERSION ], zVersionLabel, czVersionNumber );
  422. //Display the difficulty level
  423. ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", gzGIOScreenText[ GIO_DIF_LEVEL_TEXT ], gzGIOScreenText[ gGameOptions.ubDifficultyLevel + GIO_EASY_TEXT - 1 ] );
  424. //Iron man option
  425. ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", gzGIOScreenText[ GIO_GAME_SAVE_STYLE_TEXT ], gzGIOScreenText[ GIO_SAVE_ANYWHERE_TEXT + gGameOptions.fIronManMode ] );
  426. // Gun option
  427. if( gGameOptions.fGunNut )
  428. ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", gzGIOScreenText[ GIO_GUN_OPTIONS_TEXT ], gzGIOScreenText[ GIO_GUN_NUT_TEXT ] );
  429. else
  430. ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", gzGIOScreenText[ GIO_GUN_OPTIONS_TEXT ], gzGIOScreenText[ GIO_REDUCED_GUNS_TEXT ] );
  431. //Sci fi option
  432. ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", gzGIOScreenText[ GIO_GAME_STYLE_TEXT ], gzGIOScreenText[ GIO_REALISTIC_TEXT + gGameOptions.fSciFi ] );
  433. //Timed Turns option
  434. // JA2Gold: no timed turns
  435. //ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"%s: %s", gzGIOScreenText[ GIO_TIMED_TURN_TITLE_TEXT ], gzGIOScreenText[ GIO_NO_TIMED_TURNS_TEXT + gGameOptions.fTurnTimeLimit ] );
  436. if( CHEATER_CHEAT_LEVEL() )
  437. {
  438. ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, gzLateLocalizedString[58], CurrentPlayerProgressPercentage(), HighestPlayerProgressPercentage() );
  439. }
  440. }
  441. BOOLEAN MeanwhileSceneSeen( UINT8 ubMeanwhile )
  442. {
  443. UINT32 uiCheckFlag;
  444. if ( ubMeanwhile > 32 || ubMeanwhile > NUM_MEANWHILES )
  445. {
  446. return( FALSE );
  447. }
  448. uiCheckFlag = 0x1 << ubMeanwhile;
  449. if ( gGameSettings.uiMeanwhileScenesSeenFlags & uiCheckFlag )
  450. {
  451. return( TRUE );
  452. }
  453. else
  454. {
  455. return( FALSE );
  456. }
  457. }
  458. BOOLEAN SetMeanwhileSceneSeen( UINT8 ubMeanwhile )
  459. {
  460. UINT32 uiCheckFlag;
  461. if ( ubMeanwhile > 32 || ubMeanwhile > NUM_MEANWHILES )
  462. {
  463. // can't set such a flag!
  464. return( FALSE );
  465. }
  466. uiCheckFlag = 0x1 << ubMeanwhile;
  467. gGameSettings.uiMeanwhileScenesSeenFlags |= uiCheckFlag;
  468. return( TRUE );
  469. }
  470. BOOLEAN CanGameBeSaved()
  471. {
  472. //if the iron man mode is on
  473. if( gGameOptions.fIronManMode )
  474. {
  475. //if we are in turn based combat
  476. if( (gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) )
  477. {
  478. //no save for you
  479. return( FALSE );
  480. }
  481. //if there are enemies in the current sector
  482. if( gWorldSectorX != -1 && gWorldSectorY != -1 &&
  483. gWorldSectorX != 0 && gWorldSectorY != 0 &&
  484. NumEnemiesInAnySector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ) > 0 )
  485. {
  486. //no save for you
  487. return( FALSE );
  488. }
  489. //All checks failed, so we can save
  490. return( TRUE );
  491. }
  492. else
  493. {
  494. return( TRUE );
  495. }
  496. }