offline.cpp 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484
  1. #include "pch.h"
  2. #include "offline.h"
  3. #if 0
  4. VOID LoadDefaultMap(ImissionIGC * pCore, bool fSwarm, SideID sideID)
  5. {
  6. Time now = pCore->GetLastUpdate();
  7. /*
  8. {
  9. DataClusterIGC c1;
  10. c1.starSeed = 3682;
  11. c1.lightDirection.z = c1.lightDirection.y = 0.0f;
  12. c1.lightDirection.x = 1.0f;
  13. c1.lightColor = 0x00ffffff;
  14. for (SectorID i = 0; (i < 3); i++)
  15. {
  16. c1.clusterID = 25 + i;
  17. const char* names[3] = {"Goron.IL", "L'Sau.CW", "Nadir"};
  18. strcpy(c1.name, names[i]);
  19. c1.nDebris = 500 + 100 * i;
  20. c1.nStars = 1000 - 200 * i;
  21. c1.screenX = 0.5f * cos((pi / 1.5f) * (float)i);
  22. c1.screenY = 0.5f * sin((pi / 1.5f) * (float)i);
  23. IclusterIGC* s = (IclusterIGC*)pCore->CreateObject(now, OT_cluster,
  24. &c1, sizeof(c1));
  25. s->SetActive(true);
  26. s->Release();
  27. }
  28. }
  29. {
  30. for (SectorID i = 25; (i <= 27); i++)
  31. {
  32. IclusterIGC* cluster = pCore->GetCluster(i);
  33. assert (cluster);
  34. for (int j = 0; (j < 3); j++)
  35. {
  36. float latr = ((float)(j * j)) * 45.0f * pi / 180.0f;
  37. float lonr = ((float)j) * 45.0f * pi / 180.0f;
  38. float cosLatr = cos(latr);
  39. Vector position(cosLatr * cos(lonr), cosLatr * sin(lonr), sin(latr));
  40. const char* names[] = {"f05", "nebplnt02", "neb09",
  41. "f05", "nebplnt01", "neb10",
  42. "f05", "nebplnt35", "neb07"};
  43. cluster->GetClusterSite()->AddPoster(names[(i - 25) * 3 + j], position, (float)(j * j + 2) * 40.0f);
  44. }
  45. }
  46. }
  47. {
  48. DataAsteroidIGC p1;
  49. for (AsteroidID i = 0; (i <= 44); i++)
  50. {
  51. p1.asteroidDef.asteroidID = i;
  52. strcpy(p1.asteroidDef.modelName, i % 2 == 0
  53. ? "bgrnd05"
  54. : "bgrnd03");
  55. p1.asteroidDef.textureName[0] = '\0';
  56. p1.asteroidDef.radius = (short)randomInt(50, 105);
  57. p1.clusterID = 25 + i % 3;
  58. p1.name[0] = '\0';
  59. {
  60. float yaw = random(0, 2 * pi);
  61. float sinPitch = random(-1, 1);
  62. float cosPitch = sqrt(1.0f - sinPitch * sinPitch);
  63. float r = random(200.0f, 3000.0f);
  64. p1.position.x = r * cosPitch * cos(yaw);
  65. p1.position.y = r * cosPitch * sin(yaw);
  66. p1.position.z = r * sinPitch;
  67. }
  68. {
  69. //Parts get a random orientation
  70. float yaw = random(0, 2 * pi);
  71. float sinPitch = random(-1, 1);
  72. float cosPitch = sqrt(1.0f - sinPitch * sinPitch);
  73. Vector v(cosPitch * cos(yaw), cosPitch * sin(yaw), sinPitch);
  74. Orientation o(v);
  75. p1.forward = o.GetForward();
  76. p1.up = o.GetUp();
  77. }
  78. {
  79. //and a random rotation
  80. float yaw = random(0, 2 * pi);
  81. float sinPitch = random(-1, 1);
  82. float cosPitch = sqrt(1.0f - sinPitch * sinPitch);
  83. Vector v(cosPitch * cos(yaw), cosPitch * sin(yaw), sinPitch);
  84. Rotation r;
  85. p1.rotation.axis(v);
  86. p1.rotation.angle(random(-0.25f, 0.25f));
  87. }
  88. p1.mass = 1000.0f;
  89. IObject* u = pCore->CreateObject(now,
  90. OT_asteroid,
  91. &p1, sizeof(p1));
  92. u->Release();
  93. }
  94. }
  95. {
  96. DataWarpIGC w1;
  97. w1.warpDef.warpID = 0;
  98. w1.warpDef.destinationID = 1;
  99. strcpy(w1.warpDef.textureName, "plnt02");
  100. w1.warpDef.radius = 100;
  101. w1.clusterID = 27;
  102. strcpy(w1.name, "L'Sau");
  103. w1.position.x = 1600.0f;
  104. w1.position.y = 500.0f;
  105. w1.position.z = 0.0f;
  106. w1.up.x = w1.up.z = w1.forward.x = w1.forward.y = 0.0f;
  107. w1.up.y = w1.forward.z = 1.0f;
  108. w1.rotation.axis(w1.forward);
  109. w1.rotation.angle(0.1f);
  110. IObject* u = pCore->CreateObject(now,
  111. OT_warp,
  112. &w1, sizeof(w1));
  113. u->Release();
  114. }
  115. {
  116. DataWarpIGC w1;
  117. w1.warpDef.warpID = 1;
  118. w1.warpDef.destinationID = 0;
  119. strcpy(w1.warpDef.textureName, "plnt19");
  120. w1.warpDef.radius = 100;
  121. w1.clusterID = 26;
  122. strcpy(w1.name, "Nadir");
  123. w1.position.x = 0.0f;
  124. w1.position.y = -1500.0f;
  125. w1.position.z = 0.0f;
  126. w1.up.x = w1.up.z = w1.forward.x = w1.forward.y = 0.0f;
  127. w1.up.y = w1.forward.z = 1.0f;
  128. w1.rotation.axis(w1.forward);
  129. w1.rotation.angle(0.1f);
  130. IObject* u = pCore->CreateObject(now,
  131. OT_warp,
  132. &w1, sizeof(w1));
  133. u->Release();
  134. }
  135. {
  136. DataWarpIGC w1;
  137. w1.warpDef.warpID = 2;
  138. w1.warpDef.destinationID = 3;
  139. strcpy(w1.warpDef.textureName, "plnt02");
  140. w1.warpDef.radius = 100;
  141. w1.clusterID = 25;
  142. strcpy(w1.name, "Nadir");
  143. w1.position.x = 2300.0f;
  144. w1.position.y = 2300.0f;
  145. w1.position.z = 800.0f;
  146. w1.up.x = w1.up.z = w1.forward.x = w1.forward.y = 0.0f;
  147. w1.up.y = w1.forward.z = 1.0f;
  148. w1.rotation.axis(w1.forward);
  149. w1.rotation.angle(0.1f);
  150. IObject* u = pCore->CreateObject(now,
  151. OT_warp,
  152. &w1, sizeof(w1));
  153. u->Release();
  154. }
  155. {
  156. DataWarpIGC w1;
  157. w1.warpDef.warpID = 3;
  158. w1.warpDef.destinationID = 2;
  159. strcpy(w1.warpDef.textureName, "plnt19");
  160. w1.warpDef.radius = 100;
  161. w1.clusterID = 27;
  162. strcpy(w1.name, "Goron");
  163. w1.position.x = -500.0f;
  164. w1.position.y = -1600.0f;
  165. w1.position.z = 0.0f;
  166. w1.up.x = w1.up.z = w1.forward.x = w1.forward.y = 0.0f;
  167. w1.up.y = w1.forward.z = 1.0f;
  168. w1.rotation.axis(w1.forward);
  169. w1.rotation.angle(0.1f);
  170. IObject* u = pCore->CreateObject(now,
  171. OT_warp,
  172. &w1, sizeof(w1));
  173. u->Release();
  174. }
  175. */
  176. {
  177. DataStationTypeIGC st;
  178. for (StationTypeID i = 0; i < 3; i++)
  179. {
  180. st.stationTypeID = i;
  181. st.maxArmorHitPoints = 5000.0f;
  182. st.maxShieldHitPoints = 250.0f;
  183. st.armorRegeneration = 10.0f;
  184. st.shieldRegeneration = 5.0f;
  185. const char* models[] = {"ss21a", "ss90", "acs08"}; //{"acs05", "acs05", "acs05"};
  186. strcpy(st.modelName, models[i]);
  187. strcpy(st.iconName, "station");
  188. const char* names[] = {"Ordinance", "Energy", "Electronics"};
  189. strcpy(st.name, names[i]);
  190. const char* descs[] = {"Ordinance", "Energy", "Electronics"};
  191. strcpy(st.description, descs[i]);
  192. Money prices[] = {1000, 1000, 1500};
  193. st.price = prices[i];
  194. st.timeToBuild = 100;
  195. st.textureName[0] = '\0';
  196. st.radius = 200;
  197. st.ttbmRequired.ClearAll();
  198. st.ttbmEffects.ClearAll();
  199. st.ttbmLocal.ClearAll();
  200. st.signature = 2.5f;
  201. st.scannerRange = 2000.0f;
  202. st.aabmBuild = (c_aabmSpecial << 0);
  203. st.exteriorSound = 380;
  204. st.interiorSound = 420;
  205. st.interiorAlertSound = 460;
  206. st.successorStationTypeID = /*(i == 2) ? 0 :*/ NA;
  207. StationClassID classes[] = { c_scOrdinance, c_scResearch, c_scElectronics };
  208. st.classID = classes[i];
  209. /*
  210. st.dsuUpgrade.price = 0;
  211. st.dsuUpgrade.stationUpgradeID = i + 100;
  212. strcpy(st.dsuUpgrade.modelName, "acs05");
  213. strcpy(st.dsuUpgrade.name, "upgrade");
  214. st.dsuUpgrade.description[0] = '\0';
  215. st.dsuUpgrade.timeToBuild = 60;
  216. st.dsuUpgrade.ttbmRequired.ClearAll();
  217. st.dsuUpgrade.ttbmEffects.ClearAll();
  218. */
  219. st.sabmCapabilities = c_sabmUnload | c_sabmStart | c_sabmRestart | c_sabmLand | c_sabmRepair | c_sabmLoadoutMenu | c_sabmRipcord | c_sabmReload;
  220. IObject* u = pCore->CreateObject(now,
  221. OT_stationType,
  222. &st, sizeof(st));
  223. u->Release();
  224. }
  225. }
  226. {
  227. const struct
  228. {
  229. const char* name;
  230. const char* modelName;
  231. float length;
  232. float mass;
  233. float speed;
  234. HitPoints hitPoints;
  235. float scannerRange;
  236. float maxTurnRates;
  237. float turnAccelerations;
  238. float acceleration;
  239. float starts[c_cAnimStates];
  240. float stops[c_cAnimStates];
  241. char* hp1FrameName;
  242. char hp1MountClass;
  243. char* hp2FrameName;
  244. char hp2MountClass;
  245. } hulls[7] = {
  246. //used in offline 1
  247. {"Stinger", "fig02",
  248. 15.0f, 100.0f, 100.0f, 250, 3000.0f, 60.0f, 90.0f, 40.0f,
  249. { 1.0f, 16.0f, 121.0f, 120.0f, 76.0f},
  250. {15.0f, 75.0f, 133.0f, 91.0f, 90.0f},
  251. "lwepemt1X", '\0', "wepattX", 'c'},
  252. //used in offline 2
  253. {"BF Bomber", "bom07b",
  254. 20.0f, 120.0f, 89.25f, 3208, 3000.0f, 90.0f, 45.0f, 25.0,
  255. { 1.0f, 16.0, 44.0f, 76.0f, 60.0f},
  256. {15.0f, 43.0f, 59.0f, 91.0f, 75.0f},
  257. "lwepemt", '\0', "rwepemt", '\0'},
  258. //used in offline 3
  259. {"Scarab", "fig04",
  260. 15.0f, 50.0f, 100.0f, 250, 3000.0f, 90.0f, 270.0f, 10.0f,
  261. { 1.0f, 16.0f, 57.0f, 57.0f, 57.0f},
  262. {15.0f, 56.0f, 71.0f, 71.0f, 71.0f},
  263. "lwepmnt1X", 'd', "rwepmnt1X", 'd'},
  264. {"Fox", "fig12",
  265. 15.0f, 100.0f, 100.0f, 250, 1000.0f, 90.0f, 360.0f, 20.0,
  266. { 1.0f, 16.0, 57.0f, 57.0f, 57.0f},
  267. {15.0f, 94.0f, 62.0f, 62.0f, 62.0f},
  268. "lwepattX", 'c', "rwepattX", 'c'},
  269. {"Turret", "utl25",
  270. 10.0f, 50.0f, 50.0f, 125, 1000.0f, 60.0f, 120.0f, 5.0,
  271. { 1.0f, 0.0, 1.0f, 31.0f, 91.0f},
  272. {30.0f, 0.0f, 30.0f, 90.0f, 120.0f},
  273. "wepemt", '\0', "wepemt", '\0'},
  274. {"Mining", "utl19",
  275. 35.0f, 500.0f, 50.0f, 500, 1000.0f, 15.0f, 30.0f, 5.0,
  276. { 1.0f, 0.0, 1.0f, 0.0f, 0.0f},
  277. {15.0f, 0.0f, 15.0f, 0.0f, 0.0f},
  278. "wepatt", 'c', "wepemt", '\0'},
  279. {"Ambulance", "fig01",
  280. 35.0f, 500.0f, 50.0f, 500, 1000.0f, 15.0f, 30.0f, 5.0,
  281. { 1.0f, 0.0, 1.0f, 0.0f, 0.0f},
  282. {15.0f, 0.0f, 15.0f, 0.0f, 0.0f},
  283. "wepatt", 'c', "wepemt", '\0'},
  284. };
  285. //crude way of allocating space on the stack for a buffer for the extra data
  286. char hbfr[sizeof(DataHullTypeIGC) + 10 * sizeof(HardpointData)];
  287. DataHullTypeIGC* h1 = (DataHullTypeIGC*)hbfr;
  288. for (HullID i = 0; (i < 7); i++)
  289. {
  290. strcpy(h1->modelName, hulls[i].modelName);
  291. strcpy(h1->iconName, "fighter");
  292. strcpy(h1->pilotHUDName, "dialog");
  293. strcpy(h1->observerHUDName, "dialog");
  294. h1->textureName[0] = '\0';
  295. strcpy(h1->name, hulls[i].name);
  296. h1->description[0] = '\0';
  297. h1->price = 1000;
  298. h1->mass = hulls[i].mass;
  299. h1->preferredPartsTypes[0] = NA;
  300. h1->maxEnergy = 2000.0f;
  301. h1->rechargeRate = 100.0f;
  302. h1->hullID = i + 1;
  303. h1->successorHullID = NA;
  304. h1->length = (short)hulls[i].length;
  305. h1->ttbmRequired.ClearAll();
  306. h1->ttbmEffects.ClearAll();
  307. h1->maxFuel = 100.0f;
  308. h1->maxAmmo = 2000;
  309. h1->habmCapabilities = 0;
  310. h1->speed = hulls[i].speed;
  311. {
  312. for (int j = 0; (j < 3); j++)
  313. {
  314. h1->maxTurnRates[j] = hulls[i].maxTurnRates * pi / 180.0f;
  315. h1->turnTorques[j] = hulls[i].mass * hulls[i].turnAccelerations * pi / 180.0f;
  316. }
  317. }
  318. h1->thrust = hulls[i].mass * hulls[i].acceleration;
  319. h1->sideMultiplier = 1.0f;
  320. h1->backMultiplier = 1.0f;
  321. h1->signature = 1.0f;
  322. h1->scannerRange = hulls[i].scannerRange;
  323. h1->hitPoints = hulls[i].hitPoints;
  324. memset(h1->psEquipment, 0, sizeof(h1->psEquipment));
  325. h1->interiorSound = 140;
  326. h1->exteriorSound = 180;
  327. h1->mainThrusterInteriorSound = 220;
  328. h1->mainThrusterExteriorSound = 260;
  329. h1->manuveringThrusterInteriorSound = 300;
  330. h1->manuveringThrusterExteriorSound = 340;
  331. h1->maxWeapons = 4;
  332. h1->maxFixedWeapons = 4;
  333. h1->hardpointOffset = sizeof(DataHullTypeIGC);
  334. {
  335. HardpointData* hd = (HardpointData*)(&hbfr[sizeof(DataHullTypeIGC)]);
  336. strcpy(hd[0].frameName, hulls[i].hp1FrameName);
  337. strcpy(hd[0].hudName, "dialog");
  338. hd[0].bFixed = true;
  339. hd[0].minDot = 0.5f;
  340. hd[0].partMask = 0;
  341. strcpy(hd[1].frameName, hulls[i].hp2FrameName);
  342. strcpy(hd[1].hudName, "dialog");
  343. hd[1].bFixed = true;
  344. hd[1].minDot = 0.5f;
  345. hd[1].partMask = 0;
  346. strcpy(hd[2].frameName, hulls[i].hp1FrameName);
  347. strcpy(hd[2].hudName, "dialog");
  348. hd[2].bFixed = true;
  349. hd[2].minDot = 0.5f;
  350. hd[2].partMask = 0;
  351. strcpy(hd[3].frameName, hulls[i].hp2FrameName);
  352. strcpy(hd[3].hudName, "dialog");
  353. hd[3].bFixed = true;
  354. hd[3].minDot = 0.5f;
  355. hd[3].partMask = 0;
  356. }
  357. //Create some default hull types (-4 ... -1)
  358. IObject* u = pCore->CreateObject(now, OT_hullType,
  359. h1, sizeof(DataHullTypeIGC) + sizeof(HardpointData) * 4);
  360. u->Release();
  361. }
  362. }
  363. //Define a default missile and magazine
  364. {
  365. DataMissileTypeIGC m1;
  366. m1.width = 1;
  367. m1.bDirectional = false;
  368. m1.modelName[0] = '\0';
  369. strcpy(m1.iconName, "missle");
  370. strcpy(m1.textureName, "f02");
  371. m1.radius = 2.0f;
  372. m1.rotation = 160.0f * pi / 180.0f;
  373. m1.color.r = m1.color.g = m1.color.b =
  374. m1.color.a = 0.0f;
  375. m1.expendabletypeID = 1;
  376. m1.maxLock = 1.0f;
  377. m1.chaffResistance = 1.0f;
  378. m1.acceleration = 100.0f;
  379. m1.turnRate = 2.0f;
  380. m1.initialSpeed = 10.0f; //0.0f;
  381. m1.lifespan = 4.0f;
  382. m1.armTime = 0.25f;
  383. m1.lockTime = 0.5f;
  384. m1.loadTime = 0.5f;
  385. m1.readyTime = 0.5f;
  386. m1.dispersion = 0.05f;
  387. m1.lockAngle = pi / 12.0f;
  388. m1.signature = 2.0f;
  389. m1.hitPoints = 0;
  390. m1.power = 25.0f;
  391. m1.blastPower = m1.blastRadius = 0.0f;
  392. m1.damageType = c_dtmEnergy;
  393. m1.launchSound = 500;
  394. m1.ambientSound = 540;
  395. m1.launcherDef.ttbmRequired.ClearAll();
  396. m1.launcherDef.ttbmEffects.ClearAll();
  397. m1.launcherDef.mass = 0.1f;
  398. m1.launcherDef.signature = 0.5f;
  399. m1.launcherDef.price = 5;
  400. strcpy(m1.launcherDef.modelName, "mis05");
  401. strcpy(m1.launcherDef.name, "Plasma torpedo");
  402. strcpy(m1.launcherDef.iconName, "missle");
  403. strcpy(m1.launcherDef.description, "Fast, cheap, weak");
  404. m1.launcherDef.partMask = 0;
  405. m1.launcherDef.expendableSize = 1;
  406. IObject* u = pCore->CreateObject(now, OT_missileType,
  407. &m1, sizeof(m1));
  408. u->Release();
  409. }
  410. {
  411. DataLauncherTypeIGC m1;
  412. //Other fields are not used (data is gotten from the missile type)
  413. m1.partID = 7;
  414. m1.expendabletypeID = 1;
  415. m1.amount = 100;
  416. m1.successorPartID = NA;
  417. strcpy(m1.inventoryLineMDL, "invsmissile");
  418. IObject* u = pCore->CreateObject(now, OT_partType,
  419. &m1, sizeof(m1));
  420. u->Release();
  421. }
  422. {
  423. DataMissileTypeIGC m1;
  424. strcpy(m1.modelName, "mis12");
  425. strcpy(m1.iconName, "aleph");
  426. m1.width = 1;
  427. m1.bDirectional = false;
  428. m1.textureName[0] = '\0';
  429. m1.radius = 4.0f;
  430. m1.rotation = 0.0f;
  431. m1.color.r = m1.color.g = m1.color.b =
  432. m1.color.a = 0.0f;
  433. m1.expendabletypeID = 2;
  434. m1.maxLock = 0.25f;
  435. m1.chaffResistance = 1.0f;
  436. m1.acceleration = 50.0f;
  437. m1.turnRate = 0.125f;
  438. m1.initialSpeed = 25.0f;
  439. m1.lifespan = 6.0f;
  440. m1.armTime = 0.25f;
  441. m1.lockTime = 5.0f;
  442. m1.loadTime = 2.0f;
  443. m1.readyTime = 0.5f;
  444. m1.dispersion = 0.05f;
  445. m1.lockAngle = pi / 24.0f;
  446. m1.signature = 5.0f;
  447. m1.hitPoints = 20;
  448. m1.power = 500.0f;
  449. m1.blastPower = 1000.0f;
  450. m1.blastRadius = 100.0f;
  451. m1.damageType = c_dtmEnergy;
  452. m1.launchSound = 500;
  453. m1.ambientSound = 540;
  454. m1.launcherDef.ttbmRequired.ClearAll();
  455. m1.launcherDef.ttbmEffects.ClearAll();
  456. m1.launcherDef.mass = 2.0f;
  457. m1.launcherDef.signature = 0.5f;
  458. m1.launcherDef.price = 50;
  459. strcpy(m1.launcherDef.modelName, "mis12");
  460. strcpy(m1.launcherDef.iconName, "missle");
  461. strcpy(m1.launcherDef.name, "Titan missile");
  462. strcpy(m1.launcherDef.description, "Big & painful");
  463. m1.launcherDef.partMask = 0;
  464. m1.launcherDef.expendableSize = 1;
  465. IObject* u = pCore->CreateObject(now, OT_missileType,
  466. &m1, sizeof(m1));
  467. u->Release();
  468. }
  469. {
  470. DataLauncherTypeIGC m1;
  471. //Other fields are not used (data is gotten from the missile type)
  472. m1.partID = 8;
  473. m1.expendabletypeID = 2;
  474. m1.amount = 10;
  475. m1.successorPartID = NA;
  476. strcpy(m1.inventoryLineMDL, "invsmissile");
  477. IObject* u = pCore->CreateObject(now, OT_partType,
  478. &m1, sizeof(m1));
  479. u->Release();
  480. }
  481. {
  482. DataMineTypeIGC m1;
  483. strcpy(m1.modelName, "mis12");
  484. strcpy(m1.iconName, "missle");
  485. m1.textureName[0] = '\0';
  486. m1.radius = 2.0f;
  487. m1.rotation = 0.0f;
  488. m1.color.r = m1.color.g = m1.color.b =
  489. m1.color.a = 0.0f;
  490. m1.lifespan = 600.0f;
  491. m1.loadTime = 2.0f;
  492. m1.signature = 5.0f;
  493. m1.placementRadius = 20.0f;
  494. m1.hitPoints = 20;
  495. m1.expendabletypeID = 3;
  496. m1.munitionCount = 50;
  497. m1.munitionDef.power = 20.0f;
  498. m1.munitionDef.hitpoints = 0;
  499. m1.munitionDef.damageType = c_dtmEnergy;
  500. m1.munitionDef.rotation = 160.0f * pi / 180.0f;
  501. m1.munitionDef.modelName[0] = '\0';
  502. strcpy(m1.munitionDef.textureName, "f03");
  503. m1.munitionDef.radius = 2.0f;
  504. m1.munitionDef.rotation = 0.0f;
  505. m1.munitionDef.color.r = m1.munitionDef.color.g =
  506. m1.munitionDef.color.b =
  507. m1.munitionDef.color.a = 0.0f;
  508. m1.launcherDef.ttbmRequired.ClearAll();
  509. m1.launcherDef.ttbmEffects.ClearAll();
  510. m1.launcherDef.mass = 2.0f;
  511. m1.launcherDef.signature = 0.5f;
  512. m1.launcherDef.price = 50;
  513. strcpy(m1.launcherDef.modelName, "mis12");
  514. strcpy(m1.launcherDef.iconName, "missle");
  515. strcpy(m1.launcherDef.name, "Calthrop");
  516. strcpy(m1.launcherDef.description, "Small & annoying");
  517. m1.launcherDef.partMask = 0;
  518. m1.launcherDef.expendableSize = 1;
  519. IObject* u = pCore->CreateObject(now, OT_mineType,
  520. &m1, sizeof(m1));
  521. u->Release();
  522. }
  523. {
  524. DataLauncherTypeIGC m1;
  525. //Other fields are not used (data is gotten from the missile type)
  526. m1.partID = 9;
  527. m1.expendabletypeID = 3;
  528. m1.amount = 10;
  529. strcpy(m1.inventoryLineMDL, "invsmine");
  530. m1.successorPartID = NA;
  531. IObject* u = pCore->CreateObject(now, OT_partType,
  532. &m1, sizeof(m1));
  533. u->Release();
  534. }
  535. {
  536. DataChaffTypeIGC m1;
  537. m1.modelName[0] = '\0';
  538. m1.iconName[0] = '\0';
  539. strcpy(m1.textureName, "chaff");
  540. m1.radius = 2.0f;
  541. m1.rotation = 0.0f;
  542. m1.color.r = m1.color.g = m1.color.b =
  543. m1.color.a = 0.0f;
  544. m1.lifespan = 4.0f;
  545. m1.loadTime = 2.0f;
  546. m1.chaffStrength = 5.0f;
  547. //None of these are used ... but set them anyway
  548. m1.signature = 0.0f;
  549. m1.hitPoints = 0;
  550. m1.expendabletypeID = 4;
  551. m1.launcherDef.ttbmRequired.ClearAll();
  552. m1.launcherDef.ttbmEffects.ClearAll();
  553. m1.launcherDef.mass = 2.0f;
  554. m1.launcherDef.signature = 0.5f;
  555. m1.launcherDef.price = 50;
  556. strcpy(m1.launcherDef.modelName, "mis12");
  557. strcpy(m1.launcherDef.iconName, "missle");
  558. strcpy(m1.launcherDef.name, "Tinfoil");
  559. strcpy(m1.launcherDef.description, "Small & annoying");
  560. m1.launcherDef.partMask = 0;
  561. m1.launcherDef.expendableSize = 1;
  562. IObject* u = pCore->CreateObject(now, OT_chaffType,
  563. &m1, sizeof(m1));
  564. u->Release();
  565. }
  566. {
  567. DataLauncherTypeIGC m1;
  568. //Other fields are not used (data is gotten from the missile type)
  569. m1.partID = 30;
  570. m1.expendabletypeID = 4;
  571. m1.amount = 10;
  572. m1.successorPartID = NA;
  573. strcpy(m1.inventoryLineMDL, "invchaff");
  574. IObject* u = pCore->CreateObject(now, OT_partType,
  575. &m1, sizeof(m1));
  576. u->Release();
  577. }
  578. //create some default projectile types
  579. {
  580. DataProjectileTypeIGC pt1;
  581. pt1.width = 0;
  582. pt1.bDirectional = false;
  583. pt1.projectileTypeID = 1;
  584. pt1.power = 1.0f;
  585. pt1.blastPower = 0.0f; //20.0f;
  586. pt1.blastRadius = 0.0f; //5.0f;
  587. pt1.speed = 500.0f;
  588. pt1.absoluteF = false;
  589. pt1.modelName[0] = '\0';
  590. strcpy(pt1.textureName, "f22");
  591. pt1.lifespan = 1.25f;
  592. pt1.radius = 2.5f;
  593. pt1.rotation = 240.0f * pi / 180.0f;
  594. pt1.color.r = pt1.color.g = pt1.color.b =
  595. pt1.color.a = 0.0f;
  596. pt1.damageType = c_dtmEnergy;
  597. pt1.ambientSound = NA;
  598. IObject* u = pCore->CreateObject(now, OT_projectileType,
  599. &pt1, sizeof(pt1));
  600. u->Release();
  601. }
  602. {
  603. DataProjectileTypeIGC pt1;
  604. pt1.width = 1;
  605. pt1.bDirectional = false;
  606. pt1.projectileTypeID = 2;
  607. pt1.power = 9.0f;
  608. pt1.blastPower = 0.0f;
  609. pt1.blastRadius = 0.0f;
  610. pt1.speed = 625.0f;
  611. pt1.absoluteF = false;
  612. pt1.modelName[0] = '\0';
  613. strcpy(pt1.textureName, "f08");
  614. pt1.lifespan = 0.65f;
  615. pt1.radius = 2.5f;
  616. pt1.rotation = 120.0f * pi / 180.0f;
  617. pt1.color.r = pt1.color.g = pt1.color.b =
  618. pt1.color.a = 0.0f;
  619. pt1.damageType = c_dtmParticle;
  620. pt1.ambientSound = NA;
  621. IObject* u = pCore->CreateObject(now, OT_projectileType,
  622. &pt1, sizeof(pt1));
  623. u->Release();
  624. }
  625. {
  626. DataProjectileTypeIGC pt1;
  627. pt1.width = 0;
  628. pt1.bDirectional = false;
  629. pt1.projectileTypeID = 3;
  630. pt1.power = 12.0f;
  631. pt1.blastPower = 0.0f;
  632. pt1.blastRadius = 0.0f;
  633. pt1.speed = 1000.0f;
  634. pt1.absoluteF = true;
  635. pt1.modelName[0] = '\0';
  636. strcpy(pt1.textureName, "f20");
  637. pt1.lifespan = 0.75f;
  638. pt1.radius = 3.0f;
  639. pt1.rotation = 200.0f * pi / 180.0f;
  640. pt1.color.r = pt1.color.g = pt1.color.b =
  641. pt1.color.a = 0.0f;
  642. pt1.damageType = c_dtmParticle;
  643. pt1.ambientSound = NA;
  644. IObject* u = pCore->CreateObject(now, OT_projectileType,
  645. &pt1, sizeof(pt1));
  646. u->Release();
  647. }
  648. {
  649. DataProjectileTypeIGC pt1;
  650. pt1.width = 1;
  651. pt1.bDirectional = true;
  652. pt1.projectileTypeID = 4;
  653. pt1.power = 12.0f;
  654. pt1.blastPower = 0.0f;
  655. pt1.blastRadius = 0.0f;
  656. pt1.speed = 1000.0f;
  657. pt1.absoluteF = true;
  658. pt1.modelName[0] = '\0';
  659. strcpy(pt1.textureName, "fx95");
  660. pt1.lifespan = 1.5f;
  661. pt1.radius = 3.5f;
  662. pt1.rotation = 200.0f * pi / 180.0f;
  663. pt1.color.r = pt1.color.g = pt1.color.b =
  664. pt1.color.a = 0.0f;
  665. pt1.damageType = c_dtmParticle;
  666. pt1.ambientSound = NA;
  667. IObject* u = pCore->CreateObject(now, OT_projectileType,
  668. &pt1, sizeof(pt1));
  669. u->Release();
  670. }
  671. {
  672. DataProbeTypeIGC m1;
  673. strcpy(m1.modelName, "acs34");
  674. strcpy(m1.iconName, "missle");
  675. m1.textureName[0] = '\0';
  676. m1.radius = 2.0f;
  677. m1.rotation = 0.0f;
  678. m1.color.r = m1.color.g = m1.color.b =
  679. m1.color.a = 0.0f;
  680. m1.lifespan = 300.0f;
  681. m1.loadTime = 2.0f;
  682. m1.signature = 0.1f;
  683. m1.scannerRange = 20000.0f;
  684. m1.hitPoints = 20;
  685. m1.expendabletypeID = 5002;
  686. m1.projectileTypeID = 1;
  687. m1.accuracy = 1.0f;
  688. m1.dtimeBurst = 0.2f;
  689. m1.dispersion = 0.0f;
  690. m1.launcherDef.ttbmRequired.ClearAll();
  691. m1.launcherDef.ttbmEffects.ClearAll();
  692. m1.launcherDef.mass = 2.0f;
  693. m1.launcherDef.signature = 0.5f;
  694. m1.launcherDef.price = 50;
  695. strcpy(m1.launcherDef.modelName, "acs48");
  696. strcpy(m1.launcherDef.iconName, "missle");
  697. strcpy(m1.launcherDef.name, "Eyes");
  698. strcpy(m1.launcherDef.description, "Can see forever");
  699. m1.launcherDef.partMask = 0;
  700. m1.launcherDef.expendableSize = 1;
  701. m1.ambientSound = 720;
  702. IObject* u = pCore->CreateObject(now, OT_probeType,
  703. &m1, sizeof(m1));
  704. u->Release();
  705. }
  706. {
  707. DataLauncherTypeIGC m1;
  708. //Other fields are not used (data is gotten from the missile type)
  709. m1.partID = 10;
  710. m1.expendabletypeID = 5002;
  711. m1.amount = 10;
  712. m1.successorPartID = NA;
  713. strcpy(m1.inventoryLineMDL, "invmine");
  714. IObject* u = pCore->CreateObject(now, OT_partType,
  715. &m1, sizeof(m1));
  716. u->Release();
  717. }
  718. //Create some default weapons
  719. {
  720. DataWeaponTypeIGC w1;
  721. strcpy(w1.modelName, "wep01");
  722. strcpy(w1.iconName, "missle");
  723. strcpy(w1.name, "Particle Cannon");
  724. w1.description[0] = '\0';
  725. w1.price = 100;
  726. w1.mass = 1.0f;
  727. w1.partID = 1;
  728. w1.successorPartID = NA;
  729. w1.equipmentType = ET_Weapon;
  730. w1.partMask = 0;
  731. w1.signature = 0.25f;
  732. w1.dtimeBurst = 0.25f;
  733. w1.dtimeReady = 0.25f;
  734. w1.energyPerShot = 35.0f;
  735. w1.dispersion = 0.02f;
  736. w1.projectileTypeID = 1;
  737. w1.cAmmoPerShot = 0;
  738. w1.activateSound = 80;
  739. w1.singleShotSound = 2;
  740. w1.burstSound = 42;
  741. strcpy(w1.inventoryLineMDL, "invsweapon");
  742. w1.ttbmRequired.ClearAll();
  743. w1.ttbmEffects.ClearAll();
  744. IObject* u = pCore->CreateObject(now, OT_partType,
  745. &w1, sizeof(w1));
  746. u->Release();
  747. }
  748. {
  749. DataWeaponTypeIGC w1;
  750. strcpy(w1.modelName, "wep01");
  751. strcpy(w1.iconName, "missle");
  752. strcpy(w1.name, "Machine gun");
  753. w1.description[0] = '\0';
  754. w1.price = 100;
  755. w1.mass = 1.0f;
  756. w1.partID = 2;
  757. w1.successorPartID = NA;
  758. w1.equipmentType = ET_Weapon;
  759. w1.partMask = 0;
  760. w1.signature = 0.25f;
  761. w1.dtimeBurst = 0.065f;
  762. w1.dtimeReady = 0.25f;
  763. w1.energyPerShot = 0.0f;
  764. w1.dispersion = 0.02f;
  765. w1.projectileTypeID = 2;
  766. w1.cAmmoPerShot = 1;
  767. w1.activateSound = 80;
  768. w1.singleShotSound = 9;
  769. w1.burstSound = 49;
  770. strcpy(w1.inventoryLineMDL, "invsweapon");
  771. w1.ttbmRequired.ClearAll();
  772. w1.ttbmEffects.ClearAll();
  773. IObject* u = pCore->CreateObject(now, OT_partType,
  774. &w1, sizeof(w1));
  775. u->Release();
  776. }
  777. {
  778. DataWeaponTypeIGC w1;
  779. strcpy(w1.modelName, "wep01");
  780. strcpy(w1.iconName, "missle");
  781. strcpy(w1.name, "Plasma Rifle");
  782. w1.description[0] = '\0';
  783. w1.price = 100;
  784. w1.mass = 1.0f;
  785. w1.partID = 21;
  786. w1.successorPartID = NA;
  787. w1.equipmentType = ET_Weapon;
  788. w1.partMask = 0;
  789. w1.signature = 0.25f;
  790. w1.dtimeBurst = 0.1f;
  791. w1.dtimeReady = 0.25f;
  792. w1.energyPerShot = 10.0f;
  793. w1.dispersion = 0.0f;
  794. w1.projectileTypeID = 3;
  795. w1.cAmmoPerShot = 0;
  796. w1.activateSound = 80;
  797. w1.singleShotSound = 1;
  798. w1.burstSound = 41;
  799. strcpy(w1.inventoryLineMDL, "invsweapon");
  800. w1.ttbmRequired.ClearAll();
  801. w1.ttbmEffects.ClearAll();
  802. IObject* u = pCore->CreateObject(now, OT_partType,
  803. &w1, sizeof(w1));
  804. u->Release();
  805. }
  806. {
  807. DataWeaponTypeIGC w1;
  808. strcpy(w1.modelName, "wep05");
  809. strcpy(w1.iconName, "missle");
  810. strcpy(w1.name, "Sniper Rifle");
  811. w1.description[0] = '\0';
  812. w1.price = 100;
  813. w1.mass = 1.0f;
  814. w1.partID = 22;
  815. w1.successorPartID = NA;
  816. w1.equipmentType = ET_Weapon;
  817. w1.partMask = 0;
  818. w1.signature = 0.25f;
  819. w1.dtimeBurst = 0.15f;
  820. w1.dtimeReady = 0.25f;
  821. w1.energyPerShot = 0.0f;
  822. w1.dispersion = 0.0f; //1f;
  823. w1.projectileTypeID = 4;
  824. w1.cAmmoPerShot = 1;
  825. w1.activateSound = 80;
  826. w1.singleShotSound = 3;
  827. w1.burstSound = 43;
  828. w1.ttbmRequired.ClearAll();
  829. w1.ttbmEffects.ClearAll();
  830. strcpy(w1.inventoryLineMDL, "invsweapon");
  831. IObject* u = pCore->CreateObject(now, OT_partType,
  832. &w1, sizeof(w1));
  833. u->Release();
  834. /*
  835. DataWeaponTypeIGC w1;
  836. strcpy(w1.modelName, "wep05");
  837. strcpy(w1.name, "Double Particle Accelerator");
  838. w1.description[0] = '\0';
  839. w1.price = 100;
  840. w1.mass = 1.0f;
  841. w1.partID = 2;
  842. w1.equipmentType = ET_Weapon;
  843. w1.partMask = 0;
  844. w1.signature = 0.25f;
  845. w1.dtimeBurst = 0.320f;
  846. w1.dtimeReady = 0.25f;
  847. w1.energyPerShot = 50.0f;
  848. w1.dispersion = 0.01f;
  849. w1.projectileTypeID = 2;
  850. w1.cAmmoPerShot = 1;
  851. w1.soundID = particleSound;
  852. w1.ttbmRequired.ClearAll();
  853. w1.ttbmRequired.SetBit(c_ttbBuildBlaster);
  854. w1.ttbmEffects.ClearAll();
  855. IObject* u = pCore->CreateObject(now, OT_partType,
  856. &w1, sizeof(w1));
  857. u->Release();
  858. */
  859. }
  860. {
  861. DataShieldTypeIGC w1;
  862. strcpy(w1.modelName, "acs34");
  863. strcpy(w1.iconName, "missle");
  864. strcpy(w1.name, "Particle dissipator");
  865. w1.description[0] = '\0';
  866. w1.price = 100;
  867. w1.mass = 4.0f;
  868. w1.partID = 3;
  869. w1.successorPartID = NA;
  870. w1.equipmentType = ET_Shield;
  871. w1.partMask = 0;
  872. w1.signature = 0.50f;
  873. w1.rateRegen = 10.0f;
  874. w1.maxStrength = 500.0f;
  875. w1.reflect[0] = 0.2f;
  876. w1.reflect[1] = 0.05f;
  877. w1.activateSound = 580;
  878. w1.deactivateSound = 620;
  879. w1.ttbmRequired.ClearAll();
  880. w1.ttbmEffects.ClearAll();
  881. strcpy(w1.inventoryLineMDL, "invshield");
  882. IObject* u = pCore->CreateObject(now, OT_partType,
  883. &w1, sizeof(w1));
  884. u->Release();
  885. }
  886. {
  887. DataCloakTypeIGC w1;
  888. strcpy(w1.modelName, "acs34");
  889. strcpy(w1.iconName, "missle");
  890. strcpy(w1.name, "Hide&Seek");
  891. w1.description[0] = '\0';
  892. w1.price = 100;
  893. w1.mass = 4.0f;
  894. w1.partID = 4;
  895. w1.successorPartID = NA;
  896. w1.equipmentType = ET_Cloak;
  897. w1.partMask = 0;
  898. w1.signature = 0.50f;
  899. w1.maxCloaking = 0.8f;
  900. w1.energyConsumption = 125.0f;
  901. w1.onRate = 0.25f;
  902. w1.offRate = 0.5f;
  903. w1.engageSound = 640;
  904. w1.disengageSound = 660;
  905. w1.ttbmRequired.ClearAll();
  906. w1.ttbmEffects.ClearAll();
  907. strcpy(w1.inventoryLineMDL, "invcloak");
  908. IObject* u = pCore->CreateObject(now, OT_partType,
  909. &w1, sizeof(w1));
  910. u->Release();
  911. }
  912. {
  913. DataAfterburnerTypeIGC w1;
  914. strcpy(w1.modelName, "acs48");
  915. strcpy(w1.iconName, "missle");
  916. strcpy(w1.name, "Booster Mk4");
  917. w1.description[0] = '\0';
  918. w1.price = 100;
  919. w1.mass = 8.0f;
  920. w1.partID = 5;
  921. w1.successorPartID = NA;
  922. w1.equipmentType = ET_Afterburner;
  923. w1.partMask = 0;
  924. w1.signature = 3.0f;
  925. w1.fuelConsumption = 0.001f;
  926. w1.maxThrust = 4000.0f;
  927. w1.onRate = 0.2f;
  928. w1.offRate = 0.5f;
  929. w1.interiorSound = 680;
  930. w1.exteriorSound = 700;
  931. w1.ttbmRequired.ClearAll();
  932. w1.ttbmEffects.ClearAll();
  933. strcpy(w1.inventoryLineMDL, "invafterburn");
  934. IObject* u = pCore->CreateObject(now, OT_partType,
  935. &w1, sizeof(w1));
  936. u->Release();
  937. }
  938. {
  939. DataPackTypeIGC w1;
  940. strcpy(w1.modelName, "wep07");
  941. strcpy(w1.iconName, "missle");
  942. strcpy(w1.name, "Ammo pack");
  943. w1.description[0] = '\0';
  944. w1.price = 100;
  945. w1.mass = 8.0f;
  946. w1.partID = 6;
  947. w1.successorPartID = NA;
  948. w1.equipmentType = ET_Pack;
  949. w1.partMask = 0;
  950. w1.signature = 3.0f;
  951. w1.packType = c_packAmmo;
  952. w1.amount = 250;
  953. w1.ttbmRequired.ClearAll();
  954. w1.ttbmEffects.ClearAll();
  955. IObject* u = pCore->CreateObject(now, OT_partType,
  956. &w1, sizeof(w1));
  957. u->Release();
  958. }
  959. {
  960. DataPackTypeIGC w1;
  961. strcpy(w1.modelName, "wep07");
  962. strcpy(w1.iconName, "missle");
  963. strcpy(w1.name, "Fuel pack");
  964. w1.description[0] = '\0';
  965. w1.price = 100;
  966. w1.mass = 8.0f;
  967. w1.partID = 11;
  968. w1.successorPartID = NA;
  969. w1.equipmentType = ET_Pack;
  970. w1.partMask = 0;
  971. w1.signature = 3.0f;
  972. w1.packType = c_packFuel;
  973. w1.amount = 100;
  974. w1.ttbmRequired.ClearAll();
  975. w1.ttbmEffects.ClearAll();
  976. IObject* u = pCore->CreateObject(now, OT_partType,
  977. &w1, sizeof(w1));
  978. u->Release();
  979. }
  980. {
  981. DataDevelopmentIGC d;
  982. d.timeToBuild = 100;
  983. d.developmentID = 1;
  984. d.price = 500;
  985. strcpy(d.modelName, "wep05");
  986. strcpy(d.iconName, "missle");
  987. strcpy(d.name, "Kick Butt Blasters");
  988. strcpy(d.description, "Kick Butt Blasters");
  989. d.ttbmRequired.ClearAll();
  990. d.ttbmEffects.ClearAll();
  991. d.gas.Initialize();
  992. IObject* u = pCore->CreateObject(now, OT_development,
  993. &d, sizeof(d));
  994. u->Release();
  995. }
  996. {
  997. DataDroneTypeIGC d;
  998. //parameters for drone type 1 -- called by a trekkey
  999. d.timeToBuild = 30;
  1000. d.droneTypeID = 1;
  1001. d.hullTypeID = 6;
  1002. d.pilotType = c_ptBuilder;
  1003. d.moveSkill = d.shootSkill = 1.0f;
  1004. d.bravery = 0.5f;
  1005. d.price = 500;
  1006. strcpy(d.modelName, "utl19");
  1007. d.iconName[0] = '\0';
  1008. strcpy(d.name, "Construction");
  1009. strcpy(d.description, "Construction drone");
  1010. d.ttbmRequired.ClearAll();
  1011. d.ttbmEffects.ClearAll();
  1012. {
  1013. //create the drone type
  1014. IObject* u = pCore->CreateObject(now, OT_droneType,
  1015. &d, sizeof(d));
  1016. u->Release();
  1017. }
  1018. d.droneTypeID = 2;
  1019. d.hullTypeID = 2;
  1020. d.pilotType = c_ptWingman;
  1021. strcpy(d.modelName, "bom01a");
  1022. d.iconName[0] = '\0';
  1023. strcpy(d.name, "Wingman");
  1024. strcpy(d.description, "Unarmed wingman");
  1025. {
  1026. IObject* u = pCore->CreateObject(now, OT_droneType,
  1027. &d, sizeof(d));
  1028. u->Release();
  1029. }
  1030. }
  1031. {
  1032. //Create the 3 civilizations
  1033. DataCivilizationIGC c;
  1034. strcpy(c.name, "Rix");
  1035. c.lifepod = 1;
  1036. c.constructionDroneTypeID = 1;
  1037. strcpy(c.hudName, "dialog");
  1038. c.nPreferredPartTypes = 0;
  1039. c.initialStationTypeID = 0;
  1040. c.civilizationID = 0;
  1041. c.ttbmBaseTechs.ClearAll();
  1042. c.ttbmNoDevTechs.ClearAll();
  1043. c.gasBaseAttributes.Initialize();
  1044. {
  1045. IObject* u = pCore->CreateObject(now, OT_civilization,
  1046. &c, sizeof(c));
  1047. u->Release();
  1048. }
  1049. strcpy(c.name, "Iron league");
  1050. c.initialStationTypeID = 1;
  1051. c.civilizationID = 1;
  1052. {
  1053. IObject* u = pCore->CreateObject(now, OT_civilization,
  1054. &c, sizeof(c));
  1055. u->Release();
  1056. }
  1057. strcpy(c.name, "Belorian");
  1058. c.initialStationTypeID = 2;
  1059. c.civilizationID = 2;
  1060. {
  1061. IObject* u = pCore->CreateObject(now, OT_civilization,
  1062. &c, sizeof(c));
  1063. u->Release();
  1064. }
  1065. }
  1066. /*
  1067. {
  1068. //Create the 3 sides
  1069. DataSideIGC s;
  1070. strcpy(s.name, "Majestic");
  1071. s.civilizationID = 0;
  1072. s.sideID = 0;
  1073. s.ttbmDevelopmentTechs.ClearAll();
  1074. s.gas.Initialize();
  1075. s.color.SetRGBA(1.0f, 0.0f, 0.0f);
  1076. {
  1077. IObject* u = pCore->CreateObject(now, OT_side,
  1078. &s, sizeof(s));
  1079. u->Release();
  1080. }
  1081. strcpy(s.name, "Ponderous");
  1082. s.civilizationID = 1;
  1083. s.sideID = 1;
  1084. s.gas.SetAttribute(c_gaTopSpeed, 1.25f);
  1085. s.color.SetRGBA(0.0f, 1.0f, 0.0f);
  1086. {
  1087. IObject* u = pCore->CreateObject(now, OT_side,
  1088. &s, sizeof(s));
  1089. u->Release();
  1090. }
  1091. strcpy(s.name, "Agile");
  1092. s.civilizationID = 2;
  1093. s.sideID = 2;
  1094. s.color.SetRGBA(0.0f, 1.0f, 1.0f);
  1095. {
  1096. IObject* u = pCore->CreateObject(now, OT_side,
  1097. &s, sizeof(s));
  1098. u->Release();
  1099. }
  1100. }
  1101. {
  1102. DataStationIGC s1;
  1103. for (SectorID i = 25; (i <= 27); i++)
  1104. {
  1105. s1.stationTypeID = i - 25;
  1106. s1.stationID = i;
  1107. s1.clusterID = i;
  1108. s1.sideID = i - 25;
  1109. const char* names[] = {"IL Starbase", "RU Starbase", "CW Starbase"};
  1110. strcpy(s1.name, names[i-25]);
  1111. s1.position.x = 0.0f;
  1112. s1.position.y = 0.0f;
  1113. s1.position.z = 0.0f;
  1114. s1.up.x = s1.up.z = s1.forward.x = s1.forward.y = 0.0f;
  1115. s1.up.y = s1.forward.z = 1.0f;
  1116. s1.rotation.axis(s1.forward);
  1117. s1.rotation.angle(0.1f);
  1118. IObject* u = pCore->CreateObject(now,
  1119. OT_station,
  1120. &s1, sizeof(s1));
  1121. u->Release();
  1122. }
  1123. }
  1124. {
  1125. DataTreasureIGC t1;
  1126. t1.partID = 7;
  1127. t1.amount = 500;
  1128. t1.lifespan = 1000.0f;
  1129. t1.p0.x = 700.0f; t1.p0.y = 400.0f; t1.p0.z = 900.0f;
  1130. t1.v0 = Vector::GetZero();
  1131. t1.time0 = now;
  1132. ItreasureIGC* t = (ItreasureIGC*)pCore->CreateObject(now, OT_treasure,
  1133. &t1, sizeof(t1));
  1134. assert (t);
  1135. t->SetCluster(pCore->GetCluster(27));
  1136. t->Release();
  1137. }
  1138. if (fSwarm)
  1139. {
  1140. srand(48324);
  1141. for (int i = 0; (i < 30); i++)
  1142. {
  1143. {
  1144. Vector p(700.0f, 400.0f, 0.0f);
  1145. p.x += random(-100.0f, 100.0f);
  1146. p.y += random(-100.0f, 100.0f);
  1147. p.z += random(-100.0f, 100.0f);
  1148. //p.z = 0.0f;
  1149. const PartData partData[2] = {{1, 0}, {3, 0}};
  1150. g_drones.Create(trekClient.m_pCoreIGC, c_dtDummy,
  1151. "Target",
  1152. 2,
  1153. pCore->GetSide(2),
  1154. 2, partData,
  1155. pCore->GetCluster(27), p);
  1156. }
  1157. }
  1158. }
  1159. {
  1160. for (SectorID i = 25; (i <= 27); i++)
  1161. {
  1162. for (int j = 0; (j < 3); j++)
  1163. {
  1164. Vector p;
  1165. p.x = cos(((float)j) * 120.0f * pi / 180.0f) * 300;
  1166. p.y = sin(((float)j) * 120.0f * pi / 180.0f) * 300;
  1167. p.z = 0.0f;
  1168. const PartData partData[2] = {{1, 0}, {3, 0}};
  1169. g_drones.Create(trekClient.m_pCoreIGC, c_dtTurret,
  1170. "Turret",
  1171. 5,
  1172. pCore->GetSide(i - 25),
  1173. 2, partData,
  1174. pCore->GetCluster(i), p);
  1175. }
  1176. {
  1177. Vector p;
  1178. p.x =400.0f;
  1179. p.y = p.z = 0.0f;
  1180. const PartData partData[1] = {{3, 0}};
  1181. Drone* d=g_drones.Create(trekClient.m_pCoreIGC, c_dtMining,
  1182. "Miner",
  1183. 6,
  1184. pCore->GetSide(i - 25),
  1185. 1, partData,
  1186. pCore->GetCluster(i), p);
  1187. }
  1188. }
  1189. }
  1190. */
  1191. #ifdef foo
  1192. //NYI hack to read all of the data in
  1193. {
  1194. char artwork[MAX_PATH];
  1195. HRESULT hr = UTL::getFile("gamedata", ".dat", artwork,
  1196. true, true);
  1197. FILE* f = fopen(artwork, "rb");
  1198. int datasize;
  1199. int n = fread(&datasize, sizeof(datasize), 1, f);
  1200. assert (n == 1);
  1201. char* pdata = new char[datasize];
  1202. int c = fread(pdata, sizeof(char), datasize, f);
  1203. assert (c == datasize);
  1204. trekClient.m_pCoreIGC->Import(now, -1, pdata, datasize);
  1205. delete [] pdata;
  1206. fclose(f);
  1207. }
  1208. #endif
  1209. //Put the client on the given side
  1210. {
  1211. MissionParams mp;
  1212. mp.nTeams = 3;
  1213. const CivilizationListIGC * plistCiv = trekClient.m_pCoreIGC->GetCivilizations();
  1214. int cCivs = plistCiv->n();
  1215. mp.bShowHomeSector = false;
  1216. mp.nNeutralSectorAsteroids = 40;
  1217. mp.nPlayerSectorAsteroids = 20;
  1218. mp.nNeutralSectorMineableAsteroids = 4;
  1219. mp.nPlayerSectorMineableAsteroids = 2;
  1220. mp.nNeutralSectorSpecialAsteroids = 2;
  1221. mp.nPlayerSectorSpecialAsteroids = 1;
  1222. mp.nNeutralSectorTreasures = 15;
  1223. mp.nPlayerSectorTreasures = 5;
  1224. mp.nPlayerSectorTreasureRate = 0.01f;
  1225. mp.nNeutralSectorTreasureRate = 0.05f;
  1226. mp.tsiPlayerStart = 0;
  1227. mp.tsiNeutralStart = 1;
  1228. mp.tsiPlayerRegenerate = 2;
  1229. mp.tsiNeutralRegenerate = 3;
  1230. mp.nMinPlayersPerTeam = 1;
  1231. mp.nMaxPlayersPerTeam = 1;
  1232. for (SideID i = 0; (i < mp.nTeams); i++)
  1233. mp.rgCivID[i] = (*plistCiv)[i % cCivs]->data()->GetObjectID();
  1234. trekClient.m_pCoreIGC->GenerateMission(now, &mp);
  1235. }
  1236. //trekClient.SetSide(trekClient.m_pCoreIGC->GetSide(sideID - 1));
  1237. }
  1238. VOID LoadMDLMap(WinTrekClient * pClient, const ZString& strMap,
  1239. bool fSwarm, SideID sideID)
  1240. {
  1241. TRef<IshipIGC> pShip;
  1242. gpMissionManager = MissionManager::Create(pClient->GetMissionContext());
  1243. gpMissionManager->CreateDefaults();
  1244. gpMissionManager->LoadTechTree("techtree");
  1245. gpMissionManager->LoadClusters(strMap);
  1246. pShip = gpMissionManager->CreateShip("loadoutFighter", sideID, "Majik");
  1247. pClient->BuyShip(pShip);
  1248. }
  1249. TRef<MissionManager> gpMissionManager = NULL;
  1250. #endif 0