mover.h 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821
  1. //***************************************************************************
  2. //
  3. // mover.h - This file contains the Mover Class header
  4. //
  5. // MechCommander 2
  6. //
  7. //---------------------------------------------------------------------------//
  8. // Copyright (C) Microsoft Corporation. All rights reserved. //
  9. //===========================================================================//
  10. #ifndef MOVER_H
  11. #define MOVER_H
  12. #ifndef MCLIB_H
  13. #include "mclib.h"
  14. #endif
  15. #ifndef CONTACT_H
  16. #include "contact.h"
  17. #endif
  18. #ifndef DMOVER_H
  19. #include "dmover.h"
  20. #endif
  21. #ifndef GAMEOBJ_H
  22. #include "gameobj.h"
  23. #endif
  24. #ifndef OBJTYPE_H
  25. #include "objtype.h"
  26. #endif
  27. #ifndef MOVE_H
  28. #include "move.h"
  29. #endif
  30. #ifndef DOBJNUM_H
  31. #include "dobjnum.h"
  32. #endif
  33. #ifndef CMPONENT_H
  34. #include "cmponent.h"
  35. #endif
  36. #ifndef WARRIOR_H
  37. #include "warrior.h"
  38. #endif
  39. #ifndef DGROUP_H
  40. #include "dgroup.h"
  41. #endif
  42. #ifndef TRIGGER_H
  43. #include "trigger.h"
  44. #endif
  45. #ifndef DTEAM_H
  46. #include "dteam.h"
  47. #endif
  48. #ifndef DCOMNDR_H
  49. #include "comndr.h"
  50. #endif
  51. extern float metersPerWorldUnit;
  52. //***************************************************************************
  53. #define DEBUG_CHUNKS
  54. #define YIELD_WAITING 0
  55. #define YIELDED 1
  56. #define COLLIDER_YIELDED 2
  57. #define COLLIDER_BEHIND 3
  58. #define NO_ACTION 4
  59. #define ON_THE_MOVE 5
  60. #define MAX_LOCK_RANGE 10
  61. #define MAX_WEAPONFIRE_CHUNKS 128
  62. #define MAX_CRITICALHIT_CHUNKS 128
  63. #define MAX_RADIO_CHUNKS 7
  64. #define CHUNK_SEND 0
  65. #define CHUNK_RECEIVE 1
  66. #define NUM_WEAPONFIRE_MODIFIERS 30
  67. #define MAX_ANTI_MISSILE_SYSTEMS 16 // Way more than we should need!
  68. #define ARMOR_TYPE_STANDARD 0
  69. #define ARMOR_TYPE_FERROFIBROUS 1
  70. #define CHASSIS_TYPE_STANDARD 0
  71. #define CHASSIS_TYPE_ENDOSTEEL 1
  72. #define ENGINE_TYPE_COMBUSTION 0
  73. #define ENGINE_TYPE_FUSION_STANDARD 1
  74. #define ENGINE_TYPE_FUSION_XL 2
  75. #define HEATSINK_TYPE_SINGLE 1
  76. #define HEATSINK_TYPE_DOUBLE 2
  77. #define IS_DAMAGE_NONE 0
  78. #define IS_DAMAGE_PARTIAL 1
  79. #define IS_DAMAGE_DESTROYED 2
  80. #define UNLIMITED_SHOTS 9999
  81. #define NO_APPEARANCE_FOR_MECH 0xFFFA0001
  82. #define NO_RAM_FOR_DYNAMICS_TYPE 0xFFFA0002
  83. #define INVALID_DYNAMICS_TYPE 0xFFFA0003
  84. #define NO_RAM_FOR_CONTROL 0xFFFA0004
  85. #define INVALID_CONTROL_TYPE 0xFFFA0005
  86. #define NO_RAM_FOR_CONTROL_DATA 0xFFFA0006
  87. #define INVALID_CONTROL_DATA_TYPE 0xFFFA0007
  88. #define NO_RAM_FOR_DYNAMICS 0xFFFA0008
  89. #define NO_APPEARANCE_TYPE_FOR_MECH 0xFFFA0009
  90. #define APPEARANCE_NOT_SPRITE_TREE 0xFFFA000A
  91. #define NO_RAM_FOR_FOOT_HS 0xFFFA000B
  92. #define NO_RAM_FOR_WEAPON_HS 0xFFFA000C
  93. #define FOOT_HS_WRONG_SIZE 0xFFFA000D
  94. #define BAD_HS_PACKET 0xFFFA000E
  95. #define NO_RAM_FOR_XLAT_HS 0xFFFA000F
  96. //------------------------------------------------------------------------------
  97. // Enums
  98. typedef enum {
  99. WEAPONSORT_ATTACKCHANCE,
  100. NUM_WEAPONSORT_TYPES
  101. } WeaponSortType;
  102. typedef enum {
  103. SPEED_STATE_STATIONARY,
  104. SPEED_STATE_MOVING,
  105. SPEED_STATE_MOVING_FAST,
  106. NUM_MOVE_STATES
  107. } SpeedState;
  108. enum DeathCause
  109. {
  110. DEBUGGER_DEATH = 0,
  111. ENGINE_DEATH = 1,
  112. PILOT_DEATH = 2,
  113. EJECTION_DEATH = 3,
  114. UNDETERMINED_DEATH = 4,
  115. POWER_USED_UP = 5
  116. };
  117. //---------------------------------------------------------------------------
  118. class MoveChunk;
  119. typedef MoveChunk* MoveChunkPtr;
  120. class MoveChunk {
  121. public:
  122. long stepPos[4][2]; // 0 = curPos, 1 thru 3 = next steps
  123. long stepRelPos[3]; // delta for steps 1 thru 3
  124. long numSteps;
  125. bool run;
  126. bool moving;
  127. unsigned long data;
  128. static long err;
  129. public:
  130. void* operator new (size_t mySize);
  131. void operator delete (void* us);
  132. void init (void) {
  133. stepPos[0][0] = 0xFFFFFFFF;
  134. stepPos[0][1] = 0xFFFFFFFF;
  135. numSteps = 0;
  136. run = false;
  137. moving = false;
  138. data = 0;
  139. }
  140. void destroy (void) {
  141. }
  142. MoveChunk (void) {
  143. init();
  144. }
  145. ~MoveChunk (void) {
  146. destroy();
  147. }
  148. void build (MoverPtr mover, MovePath* path1, MovePath* path2 = NULL);
  149. void build (MoverPtr mover, Stuff::Vector3D jumpGoal);
  150. void pack (MoverPtr mover);
  151. void unpack (MoverPtr mover);
  152. bool equalTo (MoverPtr mover, MoveChunkPtr chunk);
  153. };
  154. //---------------------------------------------------------------------------
  155. #define MAX_YAW 64
  156. typedef enum {
  157. DYNAMICS_BASE,
  158. DYNAMICS_MECH,
  159. DYNAMICS_GROUNDVEHICLE,
  160. DYNAMICS_ELEMENTAL
  161. } DynamicsType;
  162. typedef union {
  163. struct {
  164. long yawRate; //Degrees per sec
  165. } elemental;
  166. struct {
  167. long yawRate; //Degrees per sec
  168. long turretYawRate; //Degrees per sec
  169. long pivotRate; //Degrees per sec
  170. float accel; //Meters per sec per sec
  171. float speed; //Meters per sec
  172. long turretYaw; //Degrees
  173. } groundVehicle;
  174. struct {
  175. long torsoYawRate; //Degrees per sec
  176. long torsoYaw; //Degrees
  177. } mech;
  178. } DynamicsLimits;
  179. class MoverDynamics {
  180. public:
  181. DynamicsType type;
  182. DynamicsLimits max;
  183. public:
  184. void operator = (MoverDynamics copy) {
  185. type = copy.type;
  186. max = copy.max;
  187. //cur = copy.cur;
  188. }
  189. virtual void init (void);
  190. MoverDynamics (void) {
  191. init();
  192. }
  193. virtual void destroy (void) {
  194. }
  195. ~MoverDynamics (void) {
  196. destroy();
  197. }
  198. void init (DynamicsType newType);
  199. virtual void init (CSVFilePtr dynamicsFile);
  200. virtual void init (FitIniFilePtr dynamicsFile);
  201. void setType (DynamicsType newType) {
  202. type = newType;
  203. }
  204. DynamicsType getType (void) {
  205. return(type);
  206. }
  207. long brake (void);
  208. };
  209. //---------------------------------------------------------------------------
  210. typedef enum {
  211. CONTROL_BASE,
  212. CONTROL_PLAYER,
  213. CONTROL_AI,
  214. CONTROL_NET
  215. } ControlType;
  216. typedef enum {
  217. CONTROL_DATA_BASE,
  218. CONTROL_DATA_MECH,
  219. CONTROL_DATA_GROUNDVEHICLE,
  220. CONTROL_DATA_ELEMENTAL
  221. } ControlDataType;
  222. typedef union {
  223. struct {
  224. float rotate;
  225. } elemental;
  226. struct {
  227. char throttle;
  228. float rotate;
  229. float rotateTurret;
  230. char gestureGoal;
  231. bool pivot;
  232. bool isWalking;
  233. } groundVehicle;
  234. struct {
  235. char throttle;
  236. float rotate; //aka mechYaw
  237. float facingRotate; //Direction mech is FACING, NOT MOVING!!!!!
  238. float rotateTorso;
  239. float rotateLeftArm; //aka leftArmYaw
  240. float rotateRightArm; //aka rightArmYaw
  241. char gestureGoal;
  242. bool blowLeftArm;
  243. bool blowRightArm;
  244. bool pivot;
  245. } mech;
  246. } ControlSettings;
  247. class MoverControl {
  248. public:
  249. ControlType type;
  250. ControlDataType dataType;
  251. ControlSettings settings;
  252. public:
  253. void operator = (MoverControl copy) {
  254. type = copy.type;
  255. dataType = copy.dataType;
  256. settings = copy.settings;
  257. }
  258. virtual void init (void) {
  259. type = CONTROL_BASE;
  260. dataType = CONTROL_DATA_BASE;
  261. }
  262. MoverControl (void) {
  263. init();
  264. }
  265. virtual void destroy (void) {
  266. }
  267. ~MoverControl (void) {
  268. destroy();
  269. }
  270. void init (ControlType newType, ControlDataType newDataType) {
  271. setType(newType);
  272. setDataType(newDataType);
  273. }
  274. virtual long init (FitIniFilePtr controlFile);
  275. void setType (ControlType newType) {
  276. type = newType;
  277. }
  278. ControlType getType (void) {
  279. return(type);
  280. }
  281. void setDataType (ControlDataType newDataType) {
  282. dataType = newDataType;
  283. reset();
  284. }
  285. ControlDataType getDataType (void) {
  286. return(dataType);
  287. }
  288. void reset (void);
  289. void brake (void);
  290. void update (MoverPtr mover);
  291. };
  292. //---------------------------------------------------------------------------
  293. #define MAX_RANGE_RATINGS 51
  294. typedef struct _InventoryItem* InventoryItemPtr;
  295. typedef struct _RangeRating {
  296. float accuracy;
  297. float adjAccuracy;
  298. } RangeRating;
  299. typedef struct _RangeRating* RangeRatingPtr;
  300. typedef struct _InventoryItem {
  301. //------------------
  302. // general item info
  303. unsigned char masterID; // master component ID
  304. unsigned char health; // number of points left before destroyed
  305. bool disabled; // TRUE if effectively destroyed
  306. //----------------
  307. // weapon specific
  308. unsigned char facing; // weapon facing in torso: 0 = forward, 1 = rear -- NO WEAPONS fire rear. This is the weapon Node ID now!!!!
  309. short startAmount; // ammo's mission-start level
  310. short amount; // generally for ammo, and weapon's total ammo
  311. short ammoIndex; // used by ammo to reference ammo pools
  312. float readyTime; // next time weapon will be ready
  313. unsigned char bodyLocation; // where is the weapon located
  314. short effectiveness; // weapon max effectiveness
  315. } InventoryItem;
  316. //------------------------------------------------------------------------------------------
  317. #define MAX_AMMO_TYPES 10
  318. typedef struct _AmmoTally {
  319. long masterId; // ammo type's Master Component Id
  320. long curAmount; // current amount of this ammo type in inventory
  321. long maxAmount; // starting amount of this ammo type in inventory
  322. } AmmoTally;
  323. typedef AmmoTally* AmmoTallyPtr;
  324. //------------------------------------------------------------------------------------------
  325. typedef struct _CriticalSpace* CriticalSpacePtr;
  326. typedef struct _CriticalSpace {
  327. unsigned char inventoryID; // indexes into mech's inventory
  328. bool hit; // TRUE, if this space has been hit
  329. void operator = (struct _CriticalSpace copy) {
  330. inventoryID = copy.inventoryID;
  331. hit = copy.hit;
  332. }
  333. } CriticalSpace;
  334. //------------------------------------------------------------------------------------------
  335. #define MAX_CRITSPACES_PER_BODYLOCATION 12
  336. class BodyLocation {
  337. public:
  338. bool CASE;
  339. long totalSpaces;
  340. CriticalSpace criticalSpaces[MAX_CRITSPACES_PER_BODYLOCATION];
  341. float curInternalStructure;
  342. unsigned char hotSpotNumber;
  343. unsigned char maxInternalStructure;
  344. unsigned char damageState;
  345. public:
  346. void operator = (BodyLocation copy) {
  347. CASE = copy.CASE;
  348. totalSpaces = copy.totalSpaces;
  349. for (long i = 0; i < MAX_CRITSPACES_PER_BODYLOCATION; i++)
  350. criticalSpaces[i] = copy.criticalSpaces[i];
  351. curInternalStructure = copy.curInternalStructure;
  352. hotSpotNumber = copy.hotSpotNumber;
  353. maxInternalStructure = copy.maxInternalStructure;
  354. damageState = copy.damageState;
  355. }
  356. };
  357. typedef BodyLocation* BodyLocationPtr;
  358. //---------------------------------------------------------------------------
  359. class ArmorLocation {
  360. public:
  361. float curArmor;
  362. unsigned char maxArmor;
  363. };
  364. typedef ArmorLocation* ArmorLocationPtr;
  365. //---------------------------------------------------------------------------
  366. #define STATUSCHUNK_BODYSTATE_BITS 3
  367. #define STATUSCHUNK_TARGETTYPE_BITS 3
  368. #define STATUSCHUNK_MOVERINDEX_BITS 7
  369. #define STATUSCHUNK_TERRAINPARTID_BITS 20
  370. #define STATUSCHUNK_TERRAINBLOCK_BITS 8
  371. #define STATUSCHUNK_TERRAINVERTEX_BITS 9
  372. #define STATUSCHUNK_TERRAINITEM_BITS 3
  373. #define STATUSCHUNK_TRAIN_BITS 8
  374. #define STATUSCHUNK_TRAINCAR_BITS 8
  375. #define STATUSCHUNK_CELLPOS_BITS 10
  376. #define STATUSCHUNK_EJECTORDER_BITS 1
  377. #define STATUSCHUNK_JUMPORDER_BITS 1
  378. #define STATUSCHUNK_BODYSTATE_MASK 0x00000007
  379. #define STATUSCHUNK_TARGETTYPE_MASK 0x00000007
  380. #define STATUSCHUNK_MOVERINDEX_MASK 0x0000007F
  381. #define STATUSCHUNK_TERRAINPARTID_MASK 0x000FFFFF
  382. #define STATUSCHUNK_TERRAINBLOCK_MASK 0x000000FF
  383. #define STATUSCHUNK_TERRAINVERTEX_MASK 0x000001FF
  384. #define STATUSCHUNK_TERRAINITEM_MASK 0x00000007
  385. #define STATUSCHUNK_TRAIN_MASK 0x000000FF
  386. #define STATUSCHUNK_TRAINCAR_MASK 0x000000FF
  387. #define STATUSCHUNK_CELLPOS_MASK 0x000003FF
  388. #define STATUSCHUNK_EJECTORDER_MASK 0x00000001
  389. #define STATUSCHUNK_JUMPORDER_MASK 0x00000001
  390. typedef enum {
  391. STATUSCHUNK_TARGET_NONE,
  392. STATUSCHUNK_TARGET_MOVER,
  393. STATUSCHUNK_TARGET_TERRAIN,
  394. STATUSCHUNK_TARGET_SPECIAL,
  395. STATUSCHUNK_TARGET_LOCATION
  396. } StatusChunkTarget;
  397. class StatusChunk;
  398. typedef StatusChunk* StatusChunkPtr;
  399. class StatusChunk {
  400. public:
  401. unsigned long bodyState;
  402. char targetType;
  403. long targetId;
  404. long targetBlockOrTrainNumber;
  405. long targetVertexOrCarNumber;
  406. char targetItemNumber;
  407. short targetCellRC[2];
  408. bool ejectOrderGiven;
  409. bool jumpOrder;
  410. unsigned long data;
  411. public:
  412. void* operator new (size_t mySize);
  413. void operator delete (void* us);
  414. void init (void) {
  415. bodyState = 0;
  416. targetType = 0;
  417. targetId = 0;
  418. targetBlockOrTrainNumber = 0;
  419. targetVertexOrCarNumber = 0;
  420. targetItemNumber = 0;
  421. targetCellRC[0] = -1;
  422. targetCellRC[1] = -1;
  423. ejectOrderGiven = false;
  424. jumpOrder = false;
  425. data = 0;
  426. }
  427. void destroy (void) {
  428. }
  429. StatusChunk (void) {
  430. init ();
  431. }
  432. ~StatusChunk (void) {
  433. destroy();
  434. }
  435. virtual void build (MoverPtr mover);
  436. virtual void pack (MoverPtr mover);
  437. virtual void unpack (MoverPtr mover);
  438. bool equalTo (StatusChunkPtr chunk);
  439. };
  440. //---------------------------------------------------------------------------
  441. #define MAXLEN_MOVER_NAME 65
  442. #define MAX_MOVER_BODY_LOCATIONS 8
  443. #define MAX_MOVER_ARMOR_LOCATIONS 11
  444. #define MAX_MOVER_INVENTORY_ITEMS 72
  445. #define MAXLEN_NET_PLAYER_NAME 256
  446. #define MAXLEN_MECH_LONGNAME 35
  447. #define MAX_ATTACK_CELLRANGE 30
  448. #define MAX_ATTACK_INCREMENTS 32
  449. #define RANGED_CELLS_DIM (MAX_ATTACK_CELLRANGE * 2 + 1) * (MAX_ATTACK_CELLRANGE * 2 + 1)
  450. typedef struct _MoverData : public GameObjectData
  451. {
  452. bool killed;
  453. bool lost;
  454. Stuff::Vector3D positionNormal;
  455. Stuff::Vector3D velocity;
  456. char name[MAXLEN_MOVER_NAME];
  457. unsigned char chassis;
  458. bool startDisabled;
  459. float creationTime;
  460. long moveType;
  461. long moveLevel;
  462. bool followRoads;
  463. long lastMapCell[2];
  464. float damageRateTally;
  465. float damageRateCheckTime;
  466. float pilotCheckDamageTally;
  467. BodyLocation body[MAX_MOVER_BODY_LOCATIONS];
  468. char numBodyLocations;
  469. long fieldedCV;
  470. long attackRange;
  471. ArmorLocation armor[MAX_MOVER_ARMOR_LOCATIONS];
  472. char numArmorLocations;
  473. char longName[MAXLEN_MECH_LONGNAME];
  474. InventoryItem inventory[MAX_MOVER_INVENTORY_ITEMS];
  475. unsigned char numOther;
  476. unsigned char numWeapons;
  477. unsigned char numAmmos;
  478. AmmoTally ammoTypeTotal[MAX_AMMO_TYPES];
  479. char numAmmoTypes;
  480. long pilotHandle;
  481. unsigned char cockpit;
  482. unsigned char engine;
  483. unsigned char lifeSupport;
  484. unsigned char sensor;
  485. unsigned char ecm;
  486. unsigned char probe;
  487. unsigned char jumpJets;
  488. unsigned char nullSignature;
  489. float maxWeaponEffectiveness;
  490. float weaponEffectiveness;
  491. float minRange;
  492. float maxRange;
  493. float optimalRange;
  494. long numFunctionalWeapons;
  495. char numAntiMissileSystems;
  496. unsigned char antiMissileSystem[MAX_ANTI_MISSILE_SYSTEMS];
  497. float engineBlowTime;
  498. float maxMoveSpeed;
  499. bool shutDownThisFrame;
  500. bool startUpThisFrame;
  501. bool disableThisFrame;
  502. char teamId;
  503. char groupId;
  504. long squadId;
  505. long selectionIndex;
  506. long teamRosterIndex;
  507. char commanderId;
  508. long unitGroup;
  509. long iconPictureIndex;
  510. bool suppressionFire;
  511. long pilotCheckModifier;
  512. long prevPilotCheckModifier;
  513. long prevPilotCheckDelta;
  514. float prevPilotCheckUpdate;
  515. bool failedPilotingCheck;
  516. float lastWeaponEffectivenessCalc;
  517. float lastOptimalRangeCalc;
  518. GameObjectWatchID challengerWID;
  519. char lastGesture;
  520. MoverControl control;
  521. MoverDynamics dynamics;
  522. long numWeaponHitsHandled;
  523. float timeLeft;
  524. bool exploding;
  525. bool withdrawing;
  526. float yieldTimeLeft;
  527. Stuff::Vector3D lastValidPosition;
  528. char pivotDirection;
  529. float lastHustleTime;
  530. bool salvageVehicle;
  531. float markDistanceMoved;
  532. GameObjectWatchID refitBuddyWID;
  533. GameObjectWatchID recoverBuddyWID;
  534. long crashAvoidSelf;
  535. long crashAvoidPath;
  536. long crashBlockSelf;
  537. long crashBlockPath;
  538. float crashYieldTime;
  539. long pathLockLength;
  540. long pathLockList[MAX_LOCK_RANGE][2];
  541. Stuff::Vector3D moveCenter;
  542. float moveRadius;
  543. long overlayWeightClass;
  544. float timeToClearSelection;
  545. float timeSinceMoving;
  546. float timeSinceFiredLast;
  547. GameObjectWatchID lastMovingTargetWID;
  548. bool mechSalvage;
  549. Stuff::Vector3D teleportPosition;
  550. long debugPage;
  551. bool pathLocks;
  552. bool isOnGui;
  553. long conStat;
  554. float fadeTime;
  555. BYTE alphaValue;
  556. long causeOfDeath;
  557. long lowestWeaponNodeID;
  558. DWORD psRed;
  559. DWORD psBlue;
  560. DWORD psGreen;
  561. } MoverData;
  562. typedef enum {
  563. MOVETYPE_GROUND,
  564. MOVETYPE_AIR,
  565. NUM_MOVETYPES
  566. } MoveType;
  567. class LogisticsPilot;
  568. class Mover : public GameObject {
  569. //------------
  570. //Data Members
  571. public:
  572. Stuff::Vector3D positionNormal; // normal to terrain at current position
  573. Stuff::Vector3D velocity; //How fast am I going?
  574. char name[MAXLEN_MOVER_NAME]; // Name of this particular mover
  575. unsigned char chassis; // type of mover's chassis
  576. bool startDisabled;
  577. float creationTime;
  578. bool killed; // used to record when the kill score has been awarded
  579. bool lost; // used to record when the loss score has been awarded
  580. long moveType;
  581. long moveLevel;
  582. bool followRoads;
  583. long lastMapCell[2];
  584. float damageRateTally; // damage points taken since last check
  585. float damageRateCheckTime; // time (in game time) of next damage check
  586. float pilotCheckDamageTally; // damage points taken since last pilot check
  587. BodyLocation body[MAX_MOVER_BODY_LOCATIONS]; // body parts of this mech
  588. char numBodyLocations; // should be set based upon mover type
  589. long fieldedCV;
  590. long attackRange; // attack range
  591. bool salvaged;
  592. // Armor
  593. ArmorLocation armor[MAX_MOVER_ARMOR_LOCATIONS]; // armor locations of this mover
  594. char numArmorLocations;
  595. char longName[MAXLEN_MECH_LONGNAME]; //Used by logistics (and the interface) to get long name.
  596. // Inventory
  597. InventoryItem inventory[MAX_MOVER_INVENTORY_ITEMS];
  598. unsigned char numOther;
  599. unsigned char numWeapons;
  600. unsigned char numAmmos;
  601. AmmoTally ammoTypeTotal[MAX_AMMO_TYPES]; // tracks total ammo per ammo type
  602. char numAmmoTypes; // number of different ammo types
  603. MechWarriorPtr pilot;
  604. long pilotHandle;
  605. SensorSystemPtr sensorSystem;
  606. ContactInfoPtr contactInfo;
  607. // Critical Component Indices
  608. unsigned char cockpit; // cockpit inventory index
  609. unsigned char engine; // engine inventory index
  610. unsigned char lifeSupport; // life support inventory index
  611. unsigned char sensor; // sensor inventory index
  612. unsigned char ecm; // ecm inventory index
  613. unsigned char probe; // probe inventory index
  614. unsigned char jumpJets; // jump jets inventory index
  615. unsigned char nullSignature; // null signature inventory index
  616. float maxWeaponEffectiveness; // max total damage possible
  617. float weaponEffectiveness; // basically, total damage possible
  618. float minRange; // current min attack range
  619. float maxRange; // current max attack range
  620. float optimalRange; // current optimum attack range
  621. long numFunctionalWeapons; // takes into account damage, etc.
  622. char numAntiMissileSystems; // number of anti-missile systems
  623. unsigned char antiMissileSystem[MAX_ANTI_MISSILE_SYSTEMS]; // anti-missile system list
  624. // Engine
  625. float engineBlowTime;
  626. float maxMoveSpeed;
  627. bool shutDownThisFrame;
  628. bool startUpThisFrame;
  629. bool disableThisFrame;
  630. // Team
  631. //MoverGroupPtr group; // what group am I a member of?
  632. char teamId;
  633. char groupId;
  634. long squadId;
  635. long selectionIndex; // > 0 when in selected group
  636. long teamRosterIndex; // where am I in my team's roster?
  637. char commanderId;
  638. long unitGroup; // the thing the user sets by hitting ctrl and a number
  639. // this is a field since they can belong to more than one
  640. long iconPictureIndex; // the little picture that shows arms and stuff falling off
  641. bool suppressionFire; // is this guy permanently shooting at ground
  642. char prevTeamId;
  643. char prevCommanderId;
  644. // Update Info
  645. long pilotCheckModifier;
  646. long prevPilotCheckModifier;
  647. long prevPilotCheckDelta;
  648. float prevPilotCheckUpdate;
  649. bool failedPilotingCheck; // Passed or failed this frame...
  650. // BaseObjectPtr collisionFreeFrom;
  651. // float collisionFreeTime;
  652. float lastWeaponEffectivenessCalc; // time of last calc
  653. float lastOptimalRangeCalc; // time of last calc
  654. GameObjectWatchID challengerWID;
  655. char lastGesture;
  656. // AppearancePtr appearance; // pointer to the Actor which is the appearance.
  657. MoverControl control; // control settings for this mover
  658. MoverDynamics dynamics; // dynamics settings for this mover
  659. // Network
  660. //DWORD netPlayerId;
  661. char netPlayerName[MAXLEN_NET_PLAYER_NAME]; // netPlayerName is the player who owns this mover
  662. long localMoverId; // if >= 0, is locally controlled
  663. long netRosterIndex; // used for mover id in net packets
  664. StatusChunk statusChunk; // last status chunk built/received
  665. bool newMoveChunk; // set if last movechunk not yet processed
  666. MoveChunk moveChunk; // last move chunk built/received
  667. long numWeaponFireChunks[2];
  668. unsigned long weaponFireChunks[2][MAX_WEAPONFIRE_CHUNKS];
  669. long numCriticalHitChunks[2];
  670. unsigned char criticalHitChunks[2][MAX_CRITICALHIT_CHUNKS];
  671. long numRadioChunks[2];
  672. unsigned char radioChunks[2][MAX_RADIO_CHUNKS];
  673. bool ejectOrderGiven;
  674. // Still awaiting final destruct orders from update.
  675. long numWeaponHitsHandled;
  676. float timeLeft; // How long before we return FALSE to update.
  677. bool exploding;
  678. bool withdrawing;
  679. float yieldTimeLeft; // How much time do I have left to wait
  680. Stuff::Vector3D lastValidPosition; // Last valid move path point I've been to
  681. char pivotDirection; // Used in pivotTo(): -1 = not pivoting
  682. float lastHustleTime; // last time we had to hustle (on bridge, etc.)
  683. static long numMovers;
  684. static SortListPtr sortList;
  685. bool salvageVehicle;
  686. float markDistanceMoved; //Used to track distance object has moved since last mark of terrain visible.
  687. GameObjectWatchID refitBuddyWID;
  688. GameObjectWatchID recoverBuddyWID;
  689. long crashAvoidSelf;
  690. long crashAvoidPath;
  691. long crashBlockSelf;
  692. long crashBlockPath;
  693. float crashYieldTime;
  694. long pathLockLength;
  695. long pathLockList[MAX_LOCK_RANGE][2];
  696. Stuff::Vector3D moveCenter;
  697. float moveRadius;
  698. long overlayWeightClass;
  699. float timeToClearSelection;
  700. float timeSinceMoving;
  701. float timeSinceFiredLast; //used to track when they stop revealing
  702. //GameObjectPtr lastMovingTarget;
  703. GameObjectWatchID lastMovingTargetWID;
  704. bool mechSalvage; //As this guy dies, ONLY check once if he's salvagable!
  705. Stuff::Vector3D teleportPosition; //debug feature :)
  706. long debugPage;
  707. static float newThreatMultiplier;
  708. static float marginOfError[2];
  709. static float refitRange;
  710. static float refitTime;
  711. static float refitCostArray[NUM_COSTS][NUM_FIXERS];
  712. static float refitAmount;
  713. static float recoverRange;
  714. static float recoverTime;
  715. static float recoverCost;
  716. static float recoverAmount;
  717. static bool inRecoverUpdate;
  718. static char optimalCells[MAX_ATTACK_CELLRANGE][MAX_ATTACK_INCREMENTS][2];
  719. static long numOptimalIncrements;
  720. static short rangedCellsIndices[MAX_ATTACK_CELLRANGE][2];
  721. static char rangedCells[RANGED_CELLS_DIM][2];
  722. static long IndirectFireWeapons[20];
  723. static long AreaEffectWeapons[20];
  724. static unsigned long holdFireIconHandle;
  725. static TriggerAreaManager* triggerAreaMgr;
  726. bool pathLocks; //For movers which can be stepped on. They do NOT lock!
  727. bool isOnGui; //For movers which start out on player team but not on gui. Like raven in 0103
  728. long conStat; //Contact status stored for this frame, for this machine
  729. float fadeTime; //Time between fade from LOS to non-LOS
  730. BYTE alphaValue; //Current Fade value;
  731. long causeOfDeath;
  732. long lowestWeaponNodeID;
  733. float lowestWeaponNodeZ;
  734. //----------------
  735. //Member Functions
  736. public:
  737. virtual void set (Mover copy);
  738. virtual void init (bool create);
  739. Mover (void) {
  740. init(true);
  741. }
  742. virtual void destroy (void);
  743. virtual void init (bool create, ObjectTypePtr objType) {
  744. GameObject::init(create, objType);
  745. }
  746. virtual long init (FitIniFile* objProfile) {
  747. return(NO_ERR);
  748. }
  749. virtual long init (DWORD variantNum) {
  750. return(NO_ERR);
  751. }
  752. virtual void release (void);
  753. //virtual long update (void);
  754. //virtual void render (void);
  755. virtual void updateDebugWindow (GameDebugWindow* debugWindow);
  756. virtual char* getName (void) {
  757. return(name);
  758. }
  759. virtual void setName (char* s) {
  760. strncpy(name, s, MAXLEN_MOVER_NAME);
  761. }
  762. virtual void setControl (ControlType ctrlType) {
  763. }
  764. virtual void updateAIControl (void) {
  765. }
  766. virtual void updateNetworkControl (void) {
  767. }
  768. virtual void updatePlayerControl (void) {
  769. }
  770. virtual void updateDynamics (void) {
  771. }
  772. virtual void setPartId (long newPartId);
  773. virtual void setPosition (Stuff::Vector3D& newPosition);
  774. virtual void setTeleportPosition (Stuff::Vector3D& newPos);
  775. ContactInfoPtr getContactInfo (void) {
  776. return(contactInfo);
  777. }
  778. virtual void tradeRefresh (void);
  779. virtual void setMoveType (long type);
  780. virtual long getMoveType (void) {
  781. return(moveType);
  782. }
  783. virtual void setMoveLevel (long level) {
  784. moveLevel = level;
  785. }
  786. virtual long getMoveLevel (void) {
  787. return(moveLevel);
  788. }
  789. virtual bool getFollowRoads (void) {
  790. return(followRoads);
  791. }
  792. virtual void setFollowRoads (bool setting) {
  793. followRoads = setting;
  794. }
  795. virtual Stuff::Vector3D getVelocity (void) {
  796. return(velocity);
  797. }
  798. virtual void setVelocity (Stuff::Vector3D& newVelocity) {
  799. velocity = newVelocity;
  800. }
  801. virtual float getSpeed (void) {
  802. return(velocity.GetLength());
  803. }
  804. virtual bool hasWeaponNode (void);
  805. Stuff::Vector3D getLOSPosition (void);
  806. virtual void rotate (float angle);
  807. virtual void rotate (float angle, float facingAngle);
  808. virtual void setAwake (bool state);
  809. virtual bool isMarine(void)
  810. {
  811. return(pathLocks == false);
  812. }
  813. void drawWaypointPath();
  814. void updateDrawWaypointPath();
  815. // virtual frame_of_ref getFrame (void)
  816. // {
  817. // return(frame);
  818. // }
  819. virtual long getSpeedState (void) {
  820. return(SPEED_STATE_STATIONARY);
  821. }
  822. virtual float getTerrainAngle (void);
  823. virtual float getVelocityTilt (void);
  824. // virtual void setFrame (frame_of_ref &newFrame)
  825. // {
  826. // frame = newFrame;
  827. // }
  828. virtual Stuff::Vector3D relativePosition (float angle, float radius, unsigned long flags);
  829. long calcLineOfSightView (long range);
  830. virtual void setSensorRange (float range);
  831. virtual Stuff::Vector3D getRotationVector (void)
  832. {
  833. Stuff::Vector3D rotationVec;
  834. rotationVec.x = 0.0f;
  835. rotationVec.y = -1.0f;
  836. rotationVec.z = 0.0f;
  837. Rotate(rotationVec, -rotation);
  838. return(rotationVec);
  839. }
  840. virtual bool hasActiveProbe (void);
  841. virtual float getEcmRange (void);
  842. virtual bool hasNullSignature (void);
  843. virtual void setSelected (bool set, long newSelectionIndex = 0) {
  844. GameObject::setSelected(set);
  845. selectionIndex = newSelectionIndex;
  846. }
  847. virtual long handleTacticalOrder (TacticalOrder tacOrder, long priority = 1, bool queuePlayerOrder = false);
  848. virtual AppearancePtr getAppearance (void) {
  849. return(appearance);
  850. }
  851. // virtual float getAppearRadius (void)
  852. // {
  853. // return appearance->getRadius();
  854. // }
  855. virtual void reduceAntiMissileAmmo (long numAntiMissiles);
  856. virtual void pilotingCheck (unsigned long situation = 0, float modifier = 0.0);
  857. virtual void forcePilotingCheck (void) {
  858. if (pilotCheckModifier < 0)
  859. pilotCheckModifier = 0;
  860. }
  861. virtual bool canFireWeapons (void) {
  862. return(true);
  863. }
  864. virtual void updateDamageTakenRate (void);
  865. virtual long checkShortRangeCollision (void) {
  866. return(NO_ACTION);
  867. }
  868. virtual void setOverlayWeightClass (long overlayClass) {
  869. overlayWeightClass = overlayClass;
  870. }
  871. virtual long getOverlayWeightClass (void) {
  872. return(overlayWeightClass);
  873. }
  874. virtual void getStopInfo (float &stopTime, float &stopDistance) {}
  875. virtual bool getAdjacentCellPathLocked (long level, long cellRow, long cellCol, long dir);
  876. virtual void updatePathLock (bool set);
  877. virtual bool getPathRangeLock (long range, bool* reachedEnd = NULL);
  878. virtual long setPathRangeLock (bool set, long range = 0);
  879. virtual bool getPathRangeBlocked (long range, bool* reachedEnd = NULL);
  880. virtual bool crashAvoidanceSystem (void) {
  881. return(false);
  882. }
  883. void setLastHustleTime (float t) {
  884. lastHustleTime = t;
  885. }
  886. float getLastHustleTime (void) {
  887. return(lastHustleTime);
  888. }
  889. virtual void updateHustleTime (void);
  890. virtual void mineCheck (void) {
  891. //----------------------------
  892. // Does nothing, be default...
  893. }
  894. virtual void updateMovement (void) {}
  895. virtual long bounceToAdjCell (void);
  896. #ifdef USE_MOVERCONTROLS
  897. unsigned long getControlClass (void) {
  898. return(control->getControlClass());
  899. }
  900. #endif
  901. virtual void setSquadId (char newSquadId) {
  902. squadId = newSquadId;
  903. }
  904. virtual char getSquadId (void) {
  905. return(squadId);
  906. }
  907. virtual long setTeamId (long _teamId, bool setup);
  908. virtual long getTeamId (void) {
  909. return(teamId);
  910. }
  911. virtual TeamPtr getTeam (void);
  912. virtual bool isFriendly (TeamPtr team);
  913. virtual bool isEnemy (TeamPtr team);
  914. virtual bool isNeutral (TeamPtr team);
  915. virtual long setGroupId (long _groupId, bool setup);
  916. virtual long getGroupId (void) {
  917. return(groupId);
  918. }
  919. virtual MoverGroupPtr getGroup (void);
  920. virtual void setPilotHandle (long _pilotHandle);
  921. virtual void loadPilot (char* pilotFileName, char* brainFileName, LogisticsPilot *lPilot);
  922. virtual void setCommanderId (long _commanderId);
  923. virtual long getCommanderId (void) {
  924. return(commanderId);
  925. }
  926. virtual CommanderPtr getCommander (void);
  927. virtual MechWarriorPtr getPilot (void) {
  928. return(pilot);
  929. }
  930. MoverPtr getPoint (void);
  931. void setTeamRosterIndex (long index) {
  932. teamRosterIndex = index;
  933. }
  934. long getTeamRosterIndex (void) {
  935. return(teamRosterIndex);
  936. }
  937. virtual long getContacts (long* contactList, long contactCriteria, long sortType);
  938. long getContactStatus (long scanningTeamID, bool includingAllies);
  939. // void setNetPlayerId (DWORD playerId) {
  940. // netPlayerId = playerId;
  941. // }
  942. // DWORD getNetPlayerId (void) {
  943. // return(netPlayerId);
  944. // }
  945. void setNetPlayerName(const char *name) {
  946. if (netPlayerName)
  947. strncpy(netPlayerName,name,255);
  948. }
  949. const char* getNetPlayerName(void) {
  950. return(netPlayerName);
  951. }
  952. void setLocalMoverId (long id) {
  953. localMoverId = id;
  954. }
  955. long getLocalMoverId (void) {
  956. return(localMoverId);
  957. }
  958. virtual long getCBills (void) {
  959. return(0);
  960. }
  961. void setNetRosterIndex (long index) {
  962. netRosterIndex = index;
  963. }
  964. long getNetRosterIndex (void) {
  965. return(netRosterIndex);
  966. }
  967. long getNumWeaponFireChunks (long which) {
  968. return(numWeaponFireChunks[which]);
  969. }
  970. long clearWeaponFireChunks (long which);
  971. long addWeaponFireChunk (long which, WeaponFireChunkPtr chunk);
  972. long addWeaponFireChunks (long which, unsigned long* packedChunkBuffer, long numChunks);
  973. long grabWeaponFireChunks (long which, unsigned long* packedChunkBuffer, long maxChunks);
  974. virtual long updateWeaponFireChunks (long which);
  975. long getNumCriticalHitChunks (long which) {
  976. return(numCriticalHitChunks[which]);
  977. }
  978. long clearCriticalHitChunks (long which);
  979. long addCriticalHitChunk (long which, long bodyLocation, long criticalSpace);
  980. long addCriticalHitChunks (long which, unsigned char* packedChunkBuffer, long numChunks);
  981. long grabCriticalHitChunks (long which, unsigned char* packedChunkBuffer);
  982. virtual long updateCriticalHitChunks (long which);
  983. long getNumRadioChunks (long which) {
  984. return(numRadioChunks[which]);
  985. }
  986. long clearRadioChunks (long which);
  987. long addRadioChunk (long which, unsigned char msg);
  988. long addRadioChunks (long which, unsigned char* packedChunkBuffer, long numChunks);
  989. long grabRadioChunks (long which, unsigned char* packedChunkBuffer);
  990. virtual long updateRadioChunks (long which);
  991. virtual StatusChunkPtr getStatusChunk (void) {
  992. return(&statusChunk);
  993. }
  994. virtual long buildStatusChunk (void) {
  995. return(NO_ERR);
  996. }
  997. virtual long handleStatusChunk (long updateAge, unsigned long chunk) {
  998. return(NO_ERR);
  999. }
  1000. virtual MoveChunkPtr getMoveChunk (void) {
  1001. return(&moveChunk);
  1002. }
  1003. virtual long buildMoveChunk (void) {
  1004. return(NO_ERR);
  1005. }
  1006. virtual long handleMoveChunk (unsigned long chunk) {
  1007. return(NO_ERR);
  1008. }
  1009. void setMoveChunk (MovePathPtr path, MoveChunkPtr chunk);
  1010. void playMessage (RadioMessageType messageId, bool propogateIfMultiplayer = false);
  1011. virtual long calcCV (bool calcMax = false) {
  1012. return(0);
  1013. }
  1014. void setFieldedCV (long CV) {
  1015. fieldedCV = CV;
  1016. }
  1017. unsigned long getFieldedCV (void) {
  1018. return(fieldedCV);
  1019. }
  1020. virtual void setThreatRating (short rating);
  1021. virtual long getThreatRating (void);
  1022. // virtual void getDamageClass (long& damageClass, bool& shutDown);
  1023. virtual bool refit (float pointsAvailable, float& pointsUsed, bool ammoOnly = false);
  1024. float calcRecoverPrice (void);
  1025. virtual bool recover (void);
  1026. long getInventoryDamage (long itemIndex);
  1027. long getInventoryMax (long itemIndex) {
  1028. return(MasterComponent::masterList[inventory[itemIndex].masterID].getHealth());
  1029. }
  1030. virtual long getBodyState (void) {
  1031. return(-1);
  1032. }
  1033. long getSensorMax (void) {
  1034. if (sensor > -1)
  1035. return(MasterComponent::masterList[inventory[sensor].masterID].getHealth());
  1036. else
  1037. return(0);
  1038. }
  1039. long getSensorHealth (void) {
  1040. if (sensor > -1)
  1041. return(inventory[sensor].health);
  1042. else
  1043. return(0);
  1044. }
  1045. float getVisualRange (void);
  1046. float getLastWeaponEffectivenessCalc (void) {
  1047. return(lastWeaponEffectivenessCalc);
  1048. }
  1049. float getLastOptimalRangeCalc (void) {
  1050. return(lastOptimalRangeCalc);
  1051. }
  1052. virtual float getTotalEffectiveness(void)
  1053. {
  1054. return (0.0);
  1055. }
  1056. //ContactWatchPtr addContactWatch (GameObjectPtr who, ContactRecPtr contact) {
  1057. // return(contactWatches.add(who, contact));
  1058. //}
  1059. //void removeContactWatch (ContactWatchPtr watch) {
  1060. // contactWatches.remove(watch);
  1061. //}
  1062. void setChallenger (GameObjectPtr challenger);
  1063. GameObjectPtr getChallenger (void);
  1064. /* void addContact (ContactRecPtr contact) {
  1065. sensorSystem.addContact(contact);
  1066. }
  1067. */
  1068. long scanContact (long contactType, unsigned long contactHandle);
  1069. long analyzeContact (long contactType, unsigned long contactHandle);
  1070. long scanBattlefield (long quadrant, long contactType, long potentialContactType);
  1071. virtual Stuff::Vector3D calcOffsetMoveGoal (Stuff::Vector3D target);
  1072. virtual long calcGlobalPath (GlobalPathStep* globalPath, GameObjectPtr obj, Stuff::Vector3D* location, bool useClosedAreas);
  1073. virtual long calcMoveGoal (GameObjectPtr target,
  1074. Stuff::Vector3D moveCenter,
  1075. float moveRadius,
  1076. Stuff::Vector3D moveGoal,
  1077. long selectionIndex,
  1078. Stuff::Vector3D& newGoal,
  1079. long numValidAreas,
  1080. short* validAreas,
  1081. unsigned long moveParams);
  1082. virtual long calcMovePath (MovePathPtr path,
  1083. long pathType,
  1084. Stuff::Vector3D start,
  1085. Stuff::Vector3D goal,
  1086. long* goalCell,
  1087. unsigned long moveParams = MOVEPARAM_NONE);
  1088. virtual long calcEscapePath (MovePathPtr path,
  1089. Stuff::Vector3D start,
  1090. Stuff::Vector3D goal,
  1091. long* goalCell,
  1092. unsigned long moveParams,
  1093. Stuff::Vector3D& escapeGoal);
  1094. virtual long calcMovePath (MovePathPtr path,
  1095. Stuff::Vector3D start,
  1096. long thruArea[2],
  1097. long goalDoor,
  1098. Stuff::Vector3D finalGoal,
  1099. Stuff::Vector3D* goalWorldPos,
  1100. long* goalCell,
  1101. unsigned long moveParams = MOVEPARAM_NONE);
  1102. virtual float weaponLocked (long weaponIndex, Stuff::Vector3D targetPosition);
  1103. virtual bool weaponInRange (long weaponIndex, float metersToTarget, float buffer);
  1104. virtual long getWeaponsReady (long* list, long listSize);
  1105. virtual long getWeaponsLocked (long* list, long listSize);
  1106. virtual long getWeaponsInRange (long* list, long listSize, float orderFireRange);
  1107. virtual long getWeaponShots (long weaponIndex);
  1108. virtual bool getWeaponIndirectFire (long weaponIndex);
  1109. virtual bool getWeaponAreaEffect (long weaponIndex);
  1110. virtual float getWeaponAmmoLevel (long weaponIndex);
  1111. bool getWeaponIsEnergy( long weaponIndx );
  1112. virtual void calcWeaponEffectiveness (bool setMax);
  1113. virtual void calcAmmoTotals (void);
  1114. virtual long calcFireRanges (void);
  1115. virtual float getOrderedFireRange (long* attackRange = NULL);
  1116. virtual float getMinFireRange (void);
  1117. virtual float getMaxFireRange (void);
  1118. virtual float getOptimalFireRange (void);
  1119. virtual bool isWeaponIndex (long itemIndex);
  1120. virtual bool isWeaponReady (long weaponIndex);
  1121. virtual bool isWeaponMissile (long weaponIndex);
  1122. virtual void startWeaponRecycle (long weaponIndex);
  1123. virtual long tallyAmmo (long ammoMasterId);
  1124. virtual long reduceAmmo (long ammoMasterId, long amount);
  1125. virtual long getNumAmmoTypes (void) {
  1126. return(numAmmoTypes);
  1127. }
  1128. bool hasNonAreaWeapon (void);
  1129. virtual long getAmmoType (long ammoTypeIndex) {
  1130. return(ammoTypeTotal[ammoTypeIndex].masterId);
  1131. }
  1132. virtual long getAmmoTypeTotal (long ammoTypeIndex) {
  1133. //--------------------------------------------------
  1134. // This assumes 0 <= ammoTypeIndex < numAmmoTypes...
  1135. return(ammoTypeTotal[ammoTypeIndex].curAmount);
  1136. }
  1137. virtual long getAmmoTypeStart (long ammoTypeIndex) {
  1138. //--------------------------------------------------
  1139. // This assumes 0 <= ammoTypeIndex < numAmmoTypes...
  1140. return(ammoTypeTotal[ammoTypeIndex].maxAmount);
  1141. }
  1142. virtual void deductWeaponShot (long weaponIndex, long ammoAmount = 1);
  1143. virtual bool needsRefit(void);
  1144. virtual long sortWeapons (long* weaponList, long* valueList, long listSize, long sortType, bool skillCheck);
  1145. virtual float calcAttackChance (GameObjectPtr target, long aimLocation, float targetTime, long weaponIndex, float modifiers, long* range, Stuff::Vector3D* targetPoint = NULL);
  1146. virtual float calcAttackModifier (GameObjectPtr target, long weaponIndex, bool skillCheck) {
  1147. return(0.0);
  1148. }
  1149. MasterComponentPtr getMasterComponent (long itemIndex) {
  1150. return(&MasterComponent::masterList[inventory[itemIndex].masterID]);
  1151. }
  1152. virtual bool hitInventoryItem (long itemIndex, bool setupOnly = FALSE) {
  1153. return(false);
  1154. }
  1155. bool isInventoryDisabled (long itemIndex) {
  1156. return(inventory[itemIndex].disabled);
  1157. }
  1158. virtual void disable (unsigned long cause);
  1159. virtual void shutDown (void);
  1160. virtual void startUp (void);
  1161. virtual void destroyBodyLocation (long location) {}
  1162. virtual void calcCriticalHit (long hitLocation) {}
  1163. virtual bool injureBodyLocation (long bodyLocation, float damage) {
  1164. return(false);
  1165. }
  1166. virtual void ammoExplosion (long ammoIndex);
  1167. virtual long fireWeapon (GameObjectPtr target, float targetTime, long weaponIndex, long attackType, long aimLocation, Stuff::Vector3D* targetPoint, float &damageDone) {
  1168. return(NO_ERR);
  1169. }
  1170. virtual long handleWeaponFire (long weaponIndex,
  1171. GameObjectPtr target,
  1172. Stuff::Vector3D* targetPoint,
  1173. bool hit,
  1174. float entryAngle,
  1175. long numMissiles,
  1176. long hitLocation) {
  1177. return(NO_ERR);
  1178. }
  1179. virtual void printFireWeaponDebugInfo (GameObjectPtr target, Stuff::Vector3D* targetPoint, long chance, long aimLocation, long roll, WeaponShotInfo* shotInfo);
  1180. virtual void printHandleWeaponHitDebugInfo (WeaponShotInfo* shotInfo);
  1181. virtual float relFacingDelta (Stuff::Vector3D goalPos, Stuff::Vector3D targetPos);
  1182. virtual float relFacingTo (Stuff::Vector3D goal, long bodyLocation = -1);
  1183. virtual float relViewFacingTo (Stuff::Vector3D goal) {
  1184. return(GameObject::relFacingTo(goal));
  1185. }
  1186. bool canMoveHere (Stuff::Vector3D worldPos);
  1187. void setLastValidPosition (Stuff::Vector3D pt) {
  1188. lastValidPosition = pt;
  1189. }
  1190. Stuff::Vector3D getLastValidPosition (void) {
  1191. return(lastValidPosition);
  1192. }
  1193. virtual bool canPowerUp (void) {
  1194. return(true);
  1195. }
  1196. virtual bool canMove (void) {
  1197. return(true);
  1198. }
  1199. virtual bool canJump (void) {
  1200. return(false);
  1201. }
  1202. virtual float getJumpRange (long* numOffsets = NULL, long* jumpCost = NULL) {
  1203. if (numOffsets)
  1204. *numOffsets = 8;
  1205. if (jumpCost)
  1206. *jumpCost = 0;
  1207. return(0.0);
  1208. }
  1209. virtual bool isJumping (Stuff::Vector3D* jumpGoal = NULL) {
  1210. return(false);
  1211. }
  1212. virtual bool isMineSweeper (void) {
  1213. return(false);
  1214. }
  1215. virtual bool isMineLayer (void) {
  1216. return(false);
  1217. }
  1218. virtual bool isLayingMines (void) {
  1219. return(false);
  1220. }
  1221. virtual float getFireArc (void);
  1222. virtual float calcMaxSpeed (void) {
  1223. return(0.0);
  1224. }
  1225. virtual float calcSlowSpeed (void) {
  1226. return(0.0);
  1227. }
  1228. virtual float calcModerateSpeed (void) {
  1229. return(0.0);
  1230. }
  1231. virtual long calcSpriteSpeed (float speed, unsigned long flags, long& state, long& throttle) {
  1232. state = 0;
  1233. throttle = 100;
  1234. return(-1);
  1235. }
  1236. virtual Stuff::Vector3D getPositionFromHS (long weaponType)
  1237. {
  1238. Stuff::Vector3D pos;
  1239. pos.Zero();
  1240. return(pos);
  1241. }
  1242. virtual float getGestureStopDistance (void) {
  1243. return 0.0;
  1244. }
  1245. virtual bool handleEjection (void);
  1246. virtual bool isWithdrawing (void);
  1247. virtual bool underPlayerControl (void) {
  1248. return (true);
  1249. }
  1250. ~Mover (void) {
  1251. destroy();
  1252. }
  1253. bool enemyRevealed (void);
  1254. virtual char* getIfaceName(void) {
  1255. return ("No Name");
  1256. }
  1257. void drawSensorTextHelp (float screenX, float screenY, long resID, DWORD color, bool drawBOLD);
  1258. virtual SensorSystem* getSensorSystem(){ return sensorSystem; }
  1259. static long loadGameSystem (FitIniFilePtr mechFile, float visualRange);
  1260. bool isCloseToFirstTacOrder( Stuff::Vector3D& pos );
  1261. void removeFromUnitGroup( int id );
  1262. void addToUnitGroup( int id );
  1263. bool isInUnitGroup( int id );
  1264. virtual bool isRefit(){ return 0; }
  1265. virtual bool isRecover() { return 0; }
  1266. int getIconPictureIndex(){ return iconPictureIndex; }
  1267. bool isWeaponWorking(long index );
  1268. virtual void startShutDown (void)
  1269. {
  1270. }
  1271. virtual bool isMech (void)
  1272. {
  1273. return false;
  1274. }
  1275. virtual bool isVehicle (void)
  1276. {
  1277. return false;
  1278. }
  1279. virtual bool isGuardTower (void)
  1280. {
  1281. return false;
  1282. }
  1283. virtual bool isOnGUI (void)
  1284. {
  1285. return isOnGui;
  1286. }
  1287. virtual void setOnGUI (bool onGui)
  1288. {
  1289. isOnGui = onGui;
  1290. }
  1291. virtual void Save (PacketFilePtr file, long packetNum);
  1292. void CopyTo (MoverData *data);
  1293. void Load (MoverData *data);
  1294. static void initOptimalCells (long numIncrements);
  1295. };
  1296. //---------------------------------------------------------------------------
  1297. typedef struct _MoverInitData {
  1298. char pilotFileName[50];
  1299. bool overrideLoadedPilot;
  1300. float gunnerySkill;
  1301. float pilotingSkill;
  1302. bool specialtySkills[NUM_SPECIALTY_SKILLS];
  1303. char brainFileName[50];
  1304. char csvFileName[50];
  1305. long objNumber;
  1306. long rosterIndex;
  1307. unsigned long controlType;
  1308. unsigned long controlDataType;
  1309. unsigned long variant;
  1310. Stuff::Vector3D position;
  1311. long rotation;
  1312. char teamID;
  1313. char commanderID;
  1314. DWORD baseColor;
  1315. DWORD highlightColor1;
  1316. DWORD highlightColor2;
  1317. char gestureID;
  1318. bool active;
  1319. bool exists;
  1320. char icon;
  1321. bool capturable;
  1322. long numComponents;
  1323. long components[50];
  1324. } MoverInitData;
  1325. //---------------------------------------------------------------------------
  1326. extern MoverPtr getMoverFromHandle (long partId);
  1327. //******************************************************************************************
  1328. #endif