logmain.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  1. //--------------------------------------------------------------------------
  2. //
  3. // And away we go. MechCommander II GOSScript Test Shell
  4. //
  5. //---------------------------------------------------------------------------//
  6. // Copyright (C) Microsoft Corporation. All rights reserved. //
  7. //===========================================================================//
  8. //-----------------------------------
  9. // Include Files
  10. #ifndef MCLIB_H
  11. #include "mclib.h"
  12. #endif
  13. #ifndef LOGISTICS_H
  14. #include "logistics.h"
  15. #endif
  16. #ifndef GAMESOUND_H
  17. #include "gamesound.h"
  18. #endif
  19. #ifndef VERSION_H
  20. #include "version.h"
  21. #endif
  22. #include <GameOS\GameOS.hpp>
  23. #include <GameOS\ToolOS.hpp>
  24. #include <GOSScript\GOSScriptHeaders.hpp>
  25. #include <Stuff\stuff.hpp>
  26. //------------------------------------------------------------------------------------------------------------
  27. // MechCmdr2 Global Instances of Things
  28. UserHeapPtr systemHeap = NULL;
  29. UserHeapPtr guiHeap = NULL;
  30. FastFile **fastFiles = NULL;
  31. long numFastFiles = 0;
  32. long maxFastFiles = 0;
  33. long GameDifficulty = 0;
  34. long gammaLevel = 0;
  35. long DigitalMasterVolume = 0;
  36. long MusicVolume = 0;
  37. long SFXVolume = 0;
  38. long RadioVolume = 0;
  39. long resolution = 0;
  40. long FilterState = gos_FilterNone;
  41. bool quitGame = FALSE;
  42. bool justStartMission = FALSE;
  43. bool gamePaused = FALSE;
  44. bool hasGuardBand = false;
  45. bool useUnlimitedAmmo = true;
  46. TimerManagerPtr timerManager = NULL;
  47. unsigned long elementHeapSize = 1024000;
  48. unsigned long maxElements = 2048;
  49. unsigned long maxGroups = 1024;
  50. unsigned long systemHeapSize = 3071999;
  51. unsigned long guiHeapSize = 1023999;
  52. unsigned long logisticsHeapSize = 4095999;
  53. unsigned long missionHeapSize = 1023999;
  54. unsigned long spriteDataHeapSize = 2048000;
  55. unsigned long spriteHeapSize = 8192000;
  56. unsigned long polyHeapSize = 1024000;
  57. unsigned long tglHeapSize = 32767000;
  58. DWORD gosResourceHandle = 0;
  59. HGOSFONT3D gosFontHandle = 0;
  60. FloatHelpPtr globalFloatHelp = NULL;
  61. unsigned long currentFloatHelp = 0;
  62. float MaxMinUV = 8.0f;
  63. DWORD BaseVertexColor = 0x00000000; //This color is applied to all vertices in game as Brightness correction.
  64. enum { CPU_UNKNOWN, CPU_PENTIUM, CPU_MMX, CPU_KATMAI } Processor = CPU_PENTIUM; //Needs to be set when GameOS supports ProcessorID -- MECHCMDR2
  65. extern float frameRate;
  66. void EnterWindowMode();
  67. extern bool useSound;
  68. extern bool useMusic;
  69. bool inViewMode = false;
  70. unsigned long viewObject = 0x0;
  71. char missionName[1024];
  72. char* ExceptionGameMsg = NULL;
  73. char buildNumber[80];
  74. extern long TERRAIN_TXM_SIZE;
  75. long ObjectTextureSize = 128;
  76. extern unsigned long MultiPlayCommanderId;
  77. extern bool useRealLOS;
  78. bool reloadBounds = false;
  79. //DEBUG
  80. CameraPtr eye = NULL;
  81. bool useRealLOS = true;
  82. //***************************************************************************
  83. char* GetGameInformation()
  84. {
  85. return(ExceptionGameMsg);
  86. }
  87. //long cLoadString (HINSTANCE hInstance, UINT uID, LPTSTR lpBuffer, int nBufferMax );
  88. //---------------------------------------------------------------------------
  89. void UpdateRenderers()
  90. {
  91. hasGuardBand = gos_GetMachineInformation(gos_Info_HasGuardBandClipping) != 0;
  92. //---------------------------------------------------------------------------------
  93. //Doesn't work. Always returns 0 for TNT in Win2K build 2183 with 3.55 detonator
  94. //Assume worst case is +/- 8.0 for now.
  95. //MaxMinUV = gos_GetMachineInformation(gos_Info_GetMaximumUVSize);
  96. DWORD bColor = 0x0;
  97. if (eye)
  98. bColor = eye->fogColor;
  99. gos_SetupViewport(1,1.0,1,bColor, 0.0, 0.0, 1.0, 1.0 ); //ALWAYS FULL SCREEN for now
  100. gos_SetRenderState( gos_State_Filter, gos_FilterBiLinear );
  101. gos_SetRenderState( gos_State_AlphaMode, gos_Alpha_AlphaInvAlpha );
  102. gos_SetRenderState( gos_State_AlphaTest, TRUE );
  103. gos_SetRenderState( gos_State_Clipping, TRUE);
  104. gos_SetRenderState( gos_State_TextureAddress, gos_TextureClamp );
  105. gos_SetRenderState( gos_State_Dither, 1);
  106. if (logistics)
  107. {
  108. float viewMulX, viewMulY, viewAddX, viewAddY;
  109. gos_GetViewport(&viewMulX, &viewMulY, &viewAddX, &viewAddY);
  110. //userInput->setViewport(viewMulX,viewMulY,viewAddX,viewAddY);
  111. logistics->render();
  112. }
  113. //------------------------------------------------------------
  114. gos_SetRenderState( gos_State_Filter, gos_FilterNone );
  115. //userInput->render();
  116. //------------------------------------------------------------
  117. gos_SetRenderState( gos_State_Filter, gos_FilterNone );
  118. }
  119. //---------------------------------------------------------------------------
  120. void InitializeGameEngine()
  121. {
  122. //---------------------------------------------------------------------
  123. float doubleClickThreshold = 0.2f;
  124. long dragThreshold = 10;
  125. Environment.Key_Exit=-1; // so escape doesn't kill your app
  126. //--------------------------------------------------------------
  127. // Read in System.CFG
  128. FitIniFilePtr systemFile = new FitIniFile;
  129. #ifdef _DEBUG
  130. long systemOpenResult =
  131. #endif
  132. systemFile->open("system.cfg");
  133. #ifdef _DEBUG
  134. if( systemOpenResult != NO_ERR)
  135. {
  136. char Buffer[256];
  137. gos_GetCurrentPath( Buffer, 256 );
  138. STOP(( "Cannot find \"system.cfg\" file in %s",Buffer ));
  139. }
  140. #endif
  141. {
  142. #ifdef _DEBUG
  143. long systemBlockResult =
  144. #endif
  145. systemFile->seekBlock("systemHeap");
  146. gosASSERT(systemBlockResult == NO_ERR);
  147. {
  148. long result = systemFile->readIdULong("systemHeapSize",systemHeapSize);
  149. gosASSERT(result == NO_ERR);
  150. result = systemFile->readIdULong("guiHeapSize",guiHeapSize);
  151. gosASSERT(result == NO_ERR);
  152. result = systemFile->readIdULong("logisticsHeapSize",logisticsHeapSize);
  153. gosASSERT(result == NO_ERR);
  154. }
  155. #ifdef _DEBUG
  156. long systemPathResult =
  157. #endif
  158. systemFile->seekBlock("systemPaths");
  159. gosASSERT(systemPathResult == NO_ERR);
  160. {
  161. long result = systemFile->readIdString("terrainPath",terrainPath,79);
  162. gosASSERT(result == NO_ERR);
  163. result = systemFile->readIdString("artPath",artPath,79);
  164. gosASSERT(result == NO_ERR);
  165. result = systemFile->readIdString("fontPath",fontPath,79);
  166. gosASSERT(result == NO_ERR);
  167. result = systemFile->readIdString("savePath",savePath,79);
  168. gosASSERT(result == NO_ERR);
  169. result = systemFile->readIdString("spritePath",spritePath,79);
  170. gosASSERT(result == NO_ERR);
  171. result = systemFile->readIdString("shapesPath",shapesPath,79);
  172. gosASSERT(result == NO_ERR);
  173. result = systemFile->readIdString("soundPath",soundPath,79);
  174. gosASSERT(result == NO_ERR);
  175. result = systemFile->readIdString("objectPath",objectPath,79);
  176. gosASSERT(result == NO_ERR);
  177. result = systemFile->readIdString("cameraPath",cameraPath,79);
  178. gosASSERT(result == NO_ERR);
  179. result = systemFile->readIdString("tilePath",tilePath,79);
  180. gosASSERT(result == NO_ERR);
  181. result = systemFile->readIdString("missionPath",missionPath,79);
  182. gosASSERT(result == NO_ERR);
  183. result = systemFile->readIdString("warriorPath",warriorPath,79);
  184. gosASSERT(result == NO_ERR);
  185. result = systemFile->readIdString("profilePath",profilePath,79);
  186. gosASSERT(result == NO_ERR);
  187. result = systemFile->readIdString("interfacepath",interfacePath,79);
  188. gosASSERT(result == NO_ERR);
  189. result = systemFile->readIdString("moviepath",moviePath,79);
  190. gosASSERT(result == NO_ERR);
  191. result = systemFile->readIdString("CDsoundPath",CDsoundPath,79);
  192. gosASSERT(result == NO_ERR);
  193. result = systemFile->readIdString("CDmoviepath",CDmoviePath,79);
  194. gosASSERT(result == NO_ERR);
  195. result = systemFile->readIdString("CDspritePath",CDspritePath,79);
  196. gosASSERT(result == NO_ERR);
  197. }
  198. #ifdef _DEBUG
  199. long fastFileResult =
  200. #endif
  201. systemFile->seekBlock("FastFiles");
  202. gosASSERT(fastFileResult == NO_ERR);
  203. {
  204. long result = systemFile->readIdLong("NumFastFiles",maxFastFiles);
  205. if (result != NO_ERR)
  206. maxFastFiles = 0;
  207. if (maxFastFiles)
  208. {
  209. fastFiles = (FastFile **)malloc(maxFastFiles*sizeof(FastFile *));
  210. memset(fastFiles,0,maxFastFiles*sizeof(FastFile *));
  211. long fileNum = 0;
  212. char fastFileId[10];
  213. char fileName[100];
  214. sprintf(fastFileId,"File%d",fileNum);
  215. while (systemFile->readIdString(fastFileId,fileName,99) == NO_ERR)
  216. {
  217. FastFileInit(fileName);
  218. fileNum++;
  219. sprintf(fastFileId,"File%d",fileNum);
  220. numFastFiles++;
  221. }
  222. }
  223. }
  224. long result = systemFile->seekBlock("UseMusic");
  225. if (result == NO_ERR)
  226. useMusic = TRUE;
  227. else
  228. useMusic = FALSE;
  229. result = systemFile->seekBlock("UseSound");
  230. if (result == NO_ERR)
  231. {
  232. useSound = TRUE;
  233. }
  234. else
  235. {
  236. useSound = FALSE;
  237. useMusic = FALSE;
  238. }
  239. }
  240. systemFile->close();
  241. delete systemFile;
  242. systemFile = NULL;
  243. //--------------------------------------------------------------
  244. // Read in Prefs.cfg
  245. FitIniFilePtr prefs = new FitIniFile;
  246. #ifdef _DEBUG
  247. long prefsOpenResult =
  248. #endif
  249. prefs->open("prefs.cfg");
  250. gosASSERT (prefsOpenResult == NO_ERR);
  251. {
  252. #ifdef _DEBUG
  253. long prefsBlockResult =
  254. #endif
  255. prefs->seekBlock("MechCommander2");
  256. gosASSERT(prefsBlockResult == NO_ERR);
  257. {
  258. long filterSetting;
  259. long result = prefs->readIdLong("FilterState",filterSetting);
  260. if (result == NO_ERR)
  261. {
  262. switch (filterSetting)
  263. {
  264. default:
  265. case 0:
  266. FilterState = gos_FilterNone;
  267. break;
  268. case 1:
  269. FilterState = gos_FilterBiLinear;
  270. break;
  271. case 2:
  272. FilterState = gos_FilterTriLinear;
  273. break;
  274. }
  275. }
  276. result = prefs->readIdLong("TerrainTextureRes",TERRAIN_TXM_SIZE);
  277. if (result != NO_ERR)
  278. TERRAIN_TXM_SIZE = 64;
  279. result = prefs->readIdLong("Resolution",resolution);
  280. if (result != NO_ERR)
  281. resolution = 0;
  282. result = prefs->readIdLong("ObjectTextureRes",ObjectTextureSize);
  283. if (result != NO_ERR)
  284. ObjectTextureSize = 128;
  285. result = prefs->readIdLong("Difficulty",GameDifficulty);
  286. if (result != NO_ERR)
  287. GameDifficulty = 1;
  288. result = prefs->readIdLong("Brightness",gammaLevel);
  289. if (result != NO_ERR)
  290. gammaLevel = 0;
  291. // store volume settings in global variable since soundsystem
  292. // does not exist yet. These will be set in SoundSystem::init()
  293. result = prefs->readIdLong("DigitalMasterVolume",DigitalMasterVolume);
  294. if (result != NO_ERR)
  295. DigitalMasterVolume = 255;
  296. result = prefs->readIdLong("MusicVolume",MusicVolume);
  297. if (result != NO_ERR)
  298. MusicVolume = 64;
  299. result = prefs->readIdLong("RadioVolume",RadioVolume);
  300. if (result != NO_ERR)
  301. RadioVolume = 64;
  302. result = prefs->readIdLong("SFXVolume",SFXVolume);
  303. if (result != NO_ERR)
  304. SFXVolume = 64;
  305. result = prefs->readIdFloat("DoubleClickThreshold",doubleClickThreshold);
  306. if (result != NO_ERR)
  307. doubleClickThreshold = 0.2f;
  308. result = prefs->readIdLong("DragThreshold",dragThreshold);
  309. if (result != NO_ERR)
  310. dragThreshold = 10;
  311. result = prefs->readIdULong("BaseVertexColor",BaseVertexColor);
  312. if (result != NO_ERR)
  313. BaseVertexColor = 0x00000000;
  314. result = prefs->readIdBoolean("UnlimitedAmmo",useUnlimitedAmmo);
  315. if (result != NO_ERR)
  316. useUnlimitedAmmo = true;
  317. result = prefs->readIdBoolean("RealLOS",useRealLOS);
  318. if (result != NO_ERR)
  319. useRealLOS = true;
  320. }
  321. }
  322. prefs->close();
  323. delete prefs;
  324. prefs = NULL;
  325. //---------------------------------------------------------------------
  326. switch (resolution)
  327. {
  328. case 0: //640by480
  329. gos_SetScreenMode(640,480);
  330. break;
  331. case 1: //800by600
  332. gos_SetScreenMode(800,600);
  333. break;
  334. case 2: //1024by768
  335. gos_SetScreenMode(1024,768);
  336. break;
  337. case 3: //1280by1024
  338. gos_SetScreenMode(1280,1024);
  339. break;
  340. case 4: //1600by1200
  341. gos_SetScreenMode(1600,1200);
  342. break;
  343. }
  344. //--------------------------------------------------
  345. // Setup Mouse Parameters from Prefs.CFG
  346. //userInput = new UserInput;
  347. //userInput->init();
  348. //userInput->setMouseDoubleClickThreshold(doubleClickThreshold);
  349. //userInput->setMouseDragThreshold(dragThreshold);
  350. //--------------------------------------------------
  351. gosResourceHandle = gos_OpenResourceDLL("mc2res.dll");
  352. gosFontHandle = gos_LoadFont("assets\\graphics\\arial8.tga");
  353. globalFloatHelp = new FloatHelp [MAX_FLOAT_HELPS];
  354. //
  355. //----------------------------------
  356. // Start associated stuff.
  357. //----------------------------------
  358. Stuff::InitializeClasses();
  359. //--------------------------------------------------------------
  360. // Start the GUI Heap.
  361. systemHeap = new UserHeap;
  362. gosASSERT(systemHeap != NULL);
  363. systemHeap->init(systemHeapSize,"SYSTEM");
  364. //--------------------------------------------------------------
  365. // Start the GUI Heap.
  366. guiHeap = new UserHeap;
  367. gosASSERT(guiHeap != NULL);
  368. guiHeap->init(guiHeapSize,"GUI");
  369. //------------------------------------------------
  370. // Fire up the MC Texture Manager.
  371. mcTextureManager = new MC_TextureManager;
  372. mcTextureManager->start();
  373. //--------------------------------------------------------------
  374. // Load up the mouse cursors
  375. //userInput->initMouseCursors("cursors");
  376. //userInput->mouseOff();
  377. //userInput->setMouseCursor(mState_NORMAL);
  378. //------------------------------------------------
  379. // Give the Sound System a Whirl!
  380. //soundSystem = new GameSoundSystem;
  381. //soundSystem->init();
  382. //((SoundSystem *)soundSystem)->init("sound");
  383. //---------------------------------------------------------
  384. // Start the Mission, Scenario and Logistics classes here
  385. logistics = new Logistics;
  386. logistics->start(log_SPLASH); //Always start with logistics in Splash Screen Mode
  387. }
  388. //---------------------------------------------------------------------------
  389. void TerminateGameEngine()
  390. {
  391. gosScript_ShutdownProcessor();
  392. //---------------------------------------------------------
  393. // End the Mission, Operation and Logistics classes here
  394. if (logistics)
  395. {
  396. logistics->destroy();
  397. delete logistics;
  398. logistics = NULL;
  399. }
  400. //-------------------------------------------------------------
  401. // Shut down the soundSytem for a change!
  402. //if (soundSystem)
  403. //{
  404. // soundSystem->destroy();
  405. //
  406. // delete soundSystem;
  407. // soundSystem = NULL;
  408. //}
  409. //------------------------------------------------
  410. // shutdown the MC Texture Manager.
  411. if (mcTextureManager)
  412. {
  413. mcTextureManager->destroy();
  414. delete mcTextureManager;
  415. mcTextureManager = NULL;
  416. }
  417. //--------------------------------------------------------------
  418. // End the SystemHeap and globalHeapList
  419. if (systemHeap)
  420. {
  421. systemHeap->destroy();
  422. delete systemHeap;
  423. systemHeap = NULL;
  424. }
  425. if (globalHeapList)
  426. {
  427. globalHeapList->destroy();
  428. delete globalHeapList;
  429. globalHeapList = NULL;
  430. }
  431. //----------------------------------------------------
  432. // Shutdown the MLR and associated stuff libraries
  433. //----------------------------------------------------
  434. //
  435. //-------------------
  436. // Turn off libraries
  437. //-------------------
  438. //
  439. Stuff::TerminateClasses();
  440. //Redundant. Something else is shutting this down.
  441. //GOS sure does think its bad to delete something multiple times though.
  442. //Even though it simply never is!
  443. //gos_DeleteFont(gosFontHandle);
  444. gos_CloseResourceDLL(gosResourceHandle);
  445. //
  446. //--------------------------
  447. // Turn off the fast Files
  448. //--------------------------
  449. //
  450. FastFileFini();
  451. }
  452. //---------------------------------------------------------------------------
  453. //
  454. // No multi-thread now!
  455. //
  456. void DoGameLogic()
  457. {
  458. //-------------------------------------
  459. // Get me the current frameRate.
  460. // Convert to frameLength and any other timing stuff.
  461. //if (frameRate < 15.0)
  462. // frameRate = 15.0;
  463. frameLength = 1.0 / frameRate;
  464. if (frameLength > 0.25f)
  465. frameLength = 0.25f;
  466. //-------------------------------------
  467. // Poll devices for this frame.
  468. //userInput->update();
  469. //----------------------------------------
  470. // Update the Sound System for this frame
  471. //soundSystem->update();
  472. //-----------------------------------------------------
  473. // Update Mission and Logistics here.
  474. if (logistics)
  475. {
  476. long result = logistics->update();
  477. if (result == log_DONE)
  478. {
  479. logistics->stop();
  480. }
  481. }
  482. //---------------------------------------------------
  483. // Update heap instrumentation.
  484. if (turn > 3)
  485. globalHeapList->update();
  486. //---------------------------------------------------------------
  487. // Somewhere in all of the updates, we have asked to be excused!
  488. if (quitGame)
  489. {
  490. //EnterWindowMode(); //Game crashes if _TerminateApp called from fullScreen
  491. gos_TerminateApplication();
  492. }
  493. }
  494. //---------------------------------------------------------------------------
  495. long textToLong (char *num)
  496. {
  497. long result = 0;
  498. //------------------------------------
  499. // Check if Hex Number
  500. char *hexOffset = strstr(num,"0x");
  501. if (hexOffset == NULL)
  502. {
  503. result = atol(num);
  504. }
  505. else
  506. {
  507. hexOffset += 2;
  508. long numDigits = strlen(hexOffset)-1;
  509. for (int i=0; i<=numDigits; i++)
  510. {
  511. if (!isalnum(hexOffset[i]) || (isalpha(hexOffset[i]) && toupper(hexOffset[i]) > 'F'))
  512. {
  513. hexOffset[i] = 0; // we've reach a "wrong" character. Either start of a comment or something illegal. Either way, stop evaluation here.
  514. break;
  515. }
  516. }
  517. numDigits = strlen(hexOffset)-1;
  518. long power = 0;
  519. for (long count = numDigits;count >= 0;count--,power++)
  520. {
  521. unsigned char currentDigit = toupper(hexOffset[count]);
  522. if (currentDigit >= 'A' && currentDigit <= 'F')
  523. {
  524. result += (currentDigit - 'A' + 10)<<(4*power);
  525. }
  526. else if (currentDigit >= '0' && currentDigit <= '9')
  527. {
  528. result += (currentDigit - '0')<<(4*power);
  529. }
  530. else
  531. {
  532. //---------------------------------------------------------
  533. // There is a digit in here I don't understand. Return 0.
  534. result = 0;
  535. break;
  536. }
  537. }
  538. }
  539. return(result);
  540. }
  541. //----------------------------------------------------------------------------
  542. // Same command line Parser as MechCommander
  543. void ParseCommandLine(char *command_line)
  544. {
  545. int i;
  546. int n_args = 0;
  547. int index = 0;
  548. char *argv[30];
  549. char tempCommandLine[4096];
  550. memset(tempCommandLine,0,4096);
  551. strncpy(tempCommandLine,command_line,4095);
  552. while (tempCommandLine[index] != '\0') // until we null out
  553. {
  554. argv[n_args] = tempCommandLine + index;
  555. n_args++;
  556. while (tempCommandLine[index] != ' ' && tempCommandLine[index] != '\0')
  557. {
  558. index++;
  559. }
  560. while (tempCommandLine[index] == ' ')
  561. {
  562. tempCommandLine[index] = '\0';
  563. index++;
  564. }
  565. }
  566. i=0;
  567. while (i<n_args)
  568. {
  569. i++;
  570. }
  571. }
  572. bool notFirstTime = false;
  573. //---------------------------------------------------------------------------
  574. //
  575. // Setup the GameOS structure -- This tells GameOS what I am using
  576. //
  577. void GetGameOSEnvironment( char* CommandLine )
  578. {
  579. ParseCommandLine(CommandLine);
  580. Environment.applicationName = "MC2GOSScriptShell";
  581. Environment.directoryPath = "Logistics";
  582. Environment.debugLog = ""; //; "DebugLog.txt";
  583. Environment.spew = "GameOS_ScriptsOUtput"; //"GameOS_Texture GameOS_DirectDraw GameOS_Direct3D ";
  584. Environment.TimeStampSpew = 0;
  585. Environment.GetGameInformation = GetGameInformation;
  586. Environment.UpdateRenderers = UpdateRenderers;
  587. Environment.InitializeGameEngine = InitializeGameEngine;
  588. Environment.DoGameLogic = DoGameLogic;
  589. Environment.TerminateGameEngine = TerminateGameEngine;
  590. if (useSound)
  591. {
  592. Environment.soundDisable = FALSE;
  593. Environment.soundHiFi = TRUE;
  594. Environment.soundChannels = 24;
  595. }
  596. else
  597. {
  598. Environment.soundDisable = TRUE;
  599. Environment.soundHiFi = FALSE;
  600. Environment.soundChannels = 0;
  601. }
  602. //--------------------------
  603. // Networking information...
  604. // MechCommander GUID = {09608800-4815-11d2-92D2-0060973CFB2C}
  605. // or {0x9608800, 0x4815, 0x11d2, {0x92, 0xd2, 0x0, 0x60, 0x97, 0x3c, 0xfb, 0x2c}}
  606. Environment.NetworkGame = false;
  607. Environment.NetworkMaxPlayers = 0;
  608. Environment.NetworkGUID[0] = 0x09;
  609. Environment.NetworkGUID[1] = 0x60;
  610. Environment.NetworkGUID[2] = 0x88;
  611. Environment.NetworkGUID[3] = 0x00;
  612. Environment.NetworkGUID[4] = 0x48;
  613. Environment.NetworkGUID[5] = 0x15;
  614. Environment.NetworkGUID[6] = 0x11;
  615. Environment.NetworkGUID[7] = 0xd2;
  616. Environment.NetworkGUID[8] = 0x92;
  617. Environment.NetworkGUID[9] = 0xd2;
  618. Environment.NetworkGUID[10] = 0x00;
  619. Environment.NetworkGUID[11] = 0x60;
  620. Environment.NetworkGUID[12] = 0x97;
  621. Environment.NetworkGUID[13] = 0x3c;
  622. Environment.NetworkGUID[14] = 0xfb;
  623. Environment.NetworkGUID[15] = 0x2c;
  624. Environment.screenWidth = 640;
  625. Environment.screenHeight = 480;
  626. Environment.bitDepth = 16;
  627. Environment.fullScreen = 0;
  628. Environment.version = versionStamp;
  629. Environment.FullScreenDevice = 0;
  630. Environment.Renderer = 0;
  631. Environment.AntiAlias = 0;
  632. //
  633. // Texture infomation
  634. //
  635. Environment.Texture_S_256 = 6;
  636. Environment.Texture_S_128 = 1;
  637. Environment.Texture_S_64 = 0;
  638. Environment.Texture_S_32 = 1;
  639. Environment.Texture_S_16 = 5;
  640. Environment.Texture_K_256 = 2;
  641. Environment.Texture_K_128 = 5;
  642. Environment.Texture_K_64 = 5;
  643. Environment.Texture_K_32 = 5;
  644. Environment.Texture_K_16 = 5;
  645. Environment.Texture_A_256 = 0;
  646. Environment.Texture_A_128 = 1;
  647. Environment.Texture_A_64 = 5;
  648. Environment.Texture_A_32 = 1;
  649. Environment.Texture_A_16 = 0;
  650. notFirstTime = true;
  651. }
  652. //***************************************************************************