Appear.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. //---------------------------------------------------------------------------
  2. //
  3. // Appear.h -- File contains the Basic Game Appearance Declaration
  4. //
  5. //---------------------------------------------------------------------------//
  6. // Copyright (C) Microsoft Corporation. All rights reserved. //
  7. //===========================================================================//
  8. #ifndef APPEAR_H
  9. #define APPEAR_H
  10. //---------------------------------------------------------------------------
  11. // Include Files
  12. #ifndef DAPPEAR_H
  13. #include "dappear.h"
  14. #endif
  15. #ifndef DAPRTYPE_H
  16. #include "daprtype.h"
  17. #endif
  18. #ifndef FLOATHELP_H
  19. #include "floathelp.h"
  20. #endif
  21. #include <stuff\stuff.hpp>
  22. //---------------------------------------------------------------------------
  23. // Macro definitions
  24. #ifndef MAX_ULONG
  25. #define MAX_ULONG 0x70000000 //Must be able to square this and still get big number!!
  26. #endif
  27. #ifndef NO_ERR
  28. #define NO_ERR 0
  29. #endif
  30. #define HUD_DEPTH 0.0001f //HUD Objects draw over everything else.
  31. #define WIDTH 19 // really half the width...
  32. #define HEIGHT 4
  33. #define BARTEST 0.001f
  34. extern FloatHelpPtr globalFloatHelp;
  35. extern unsigned long currentFloatHelp;
  36. // would have loved to make object flags, but it looks like we're out...
  37. #define DRAW_NORMAL 0x00
  38. #define DRAW_BARS 0x01
  39. #define DRAW_TEXT 0x02
  40. #define DRAW_BRACKETS 0x04
  41. #define DRAW_COLORED 0x08
  42. struct _ScenarioMapCellInfo;
  43. struct _GameObjectFootPrint;
  44. //---------------------------------------------------------------------------
  45. // Class definitions
  46. class Appearance
  47. {
  48. //Data Members
  49. //-------------
  50. protected:
  51. Stuff::Vector4D screenPos; //Where am I on Screen? INCLUDES correct Z now!
  52. bool visible; //Current FOW status to help draw
  53. bool seen; //Current FOW status to help draw
  54. public:
  55. bool inView; //Can I be Seen?
  56. Stuff::Vector4D upperLeft; //used to draw select boxes. Can be 3D Now!
  57. Stuff::Vector4D lowerRight; //used to draw select boxes.
  58. float barStatus; //Status Bar Length.
  59. DWORD barColor; //Status Bar Color.
  60. //Member Functions
  61. //-----------------
  62. public:
  63. void * operator new (size_t mySize);
  64. void operator delete (void * us);
  65. Appearance (void)
  66. {
  67. inView = FALSE;
  68. screenPos.x = screenPos.y = screenPos.z = screenPos.w = -999.0f;
  69. upperLeft.x = upperLeft.y = upperLeft.z = upperLeft.w = -999.0f;
  70. lowerRight.x = lowerRight.y = lowerRight.z = lowerRight.w = -999.0f;
  71. barStatus = 1.0;
  72. barColor = 0x0;
  73. visible = seen = false;
  74. }
  75. virtual void init (AppearanceTypePtr tree = NULL, GameObjectPtr obj = NULL)
  76. {
  77. inView = FALSE;
  78. screenPos.x = screenPos.y = screenPos.z = screenPos.w = -999.0f;
  79. upperLeft.x = upperLeft.y = upperLeft.z = upperLeft.w = -999.0f;
  80. lowerRight.x = lowerRight.y = lowerRight.z = lowerRight.w = -999.0f;
  81. barStatus = 1.0;
  82. barColor = 0x0;
  83. visible = seen = false;
  84. }
  85. virtual void initFX (void)
  86. {
  87. }
  88. virtual void destroy (void)
  89. {
  90. init();
  91. }
  92. virtual ~Appearance (void)
  93. {
  94. destroy();
  95. }
  96. virtual long update (bool animate = true)
  97. {
  98. //Perform any frame by frame tasks. Animations, etc.
  99. return NO_ERR;
  100. }
  101. virtual long render (long depthFixup = 0)
  102. {
  103. //Decide whether or not I can be seen and add me to render list.
  104. return NO_ERR;
  105. }
  106. virtual long renderShadows (void)
  107. {
  108. return NO_ERR;
  109. }
  110. virtual AppearanceTypePtr getAppearanceType (void)
  111. {
  112. return NULL;
  113. }
  114. bool canBeSeen (void)
  115. {
  116. return(inView);
  117. }
  118. void setInView (bool viewStatus)
  119. {
  120. inView = viewStatus;
  121. }
  122. Stuff::Vector4D getScreenPos (void)
  123. {
  124. return screenPos;
  125. }
  126. virtual bool isMouseOver (float px, float py)
  127. {
  128. return FALSE; //Never over a base appearance
  129. }
  130. virtual void drawSelectBox (DWORD color);
  131. virtual void drawSelectBrackets (DWORD color);
  132. virtual void drawBars (void);
  133. void drawTextHelp (char *text);
  134. void drawTextHelp (char *text, unsigned long color);
  135. void drawPilotName(char *text, unsigned long color ); // next line below drawTextHelp
  136. virtual bool recalcBounds (void)
  137. {
  138. //-------------------------------------------------------
  139. // returns TRUE is this appearance is Visible this frame
  140. inView = FALSE;
  141. return inView;
  142. }
  143. virtual void setGesture (unsigned long gestureId)
  144. {
  145. }
  146. virtual long setGestureGoal (long gestureId)
  147. {
  148. return 0;
  149. }
  150. virtual void setVelocityPercentage (float percent)
  151. {
  152. }
  153. virtual long getFrameNumber (void)
  154. {
  155. return 0;
  156. }
  157. virtual unsigned long getAppearanceClass (void)
  158. {
  159. return BASE_APPEARANCE;
  160. }
  161. virtual void setBarStatus (float stat)
  162. {
  163. barStatus = stat;
  164. if (barStatus > 1.0f)
  165. barStatus = 1.0f;
  166. }
  167. virtual void setBarColor (DWORD clr)
  168. {
  169. barColor = clr;
  170. }
  171. virtual bool getInTransition (void)
  172. {
  173. return false;
  174. }
  175. virtual long getNumFramesInGesture (long gestureId)
  176. {
  177. return 0;
  178. }
  179. virtual long getOldGestureGoal (void)
  180. {
  181. return -1;
  182. }
  183. virtual long getCurrentGestureGoal (void)
  184. {
  185. return -1;
  186. }
  187. virtual long getCurrentGestureId (void)
  188. {
  189. return 0;
  190. }
  191. virtual bool isInJump (void)
  192. {
  193. return false;
  194. }
  195. virtual bool isJumpSetup (void)
  196. {
  197. return false;
  198. }
  199. virtual bool isJumpAirborne (void)
  200. {
  201. return false;
  202. }
  203. virtual bool haveFallen (void)
  204. {
  205. return false;
  206. }
  207. virtual void setObjectNameId (long objId)
  208. {
  209. }
  210. virtual bool setJumpParameters (Stuff::Vector3D &jumpGoal)
  211. {
  212. return false;
  213. }
  214. virtual void setWeaponNodeUsed (long nodeId)
  215. {
  216. }
  217. virtual long getLowestWeaponNode (void)
  218. {
  219. return 0;
  220. }
  221. virtual long getWeaponNode (long weapontype)
  222. {
  223. return 0;
  224. }
  225. virtual float getWeaponNodeRecycle (long node)
  226. {
  227. return 0.0f;
  228. }
  229. virtual void resetWeaponNodes (void)
  230. {
  231. }
  232. virtual void setWeaponNodeRecycle(long nodeId, float time)
  233. {
  234. }
  235. virtual Stuff::Vector3D getSmokeNodePosition (long nodeId)
  236. {
  237. Stuff::Vector3D position;
  238. position.x = position.y = position.z = 0.0f;
  239. return position;
  240. }
  241. virtual Stuff::Vector3D getDustNodePosition (long nodeId)
  242. {
  243. Stuff::Vector3D position;
  244. position.x = position.y = position.z = 0.0f;
  245. return position;
  246. }
  247. virtual Stuff::Vector3D getWeaponNodePosition (long node)
  248. {
  249. Stuff::Vector3D position;
  250. position.x = position.y = position.z = 0.0f;
  251. return position;
  252. }
  253. virtual Stuff::Vector3D getNodePosition (long nodeId)
  254. {
  255. Stuff::Vector3D position;
  256. position.x = position.y = position.z = 0.0f;
  257. return position;
  258. }
  259. virtual Stuff::Vector3D getNodeNamePosition (char *nodeName)
  260. {
  261. Stuff::Vector3D position;
  262. position.x = position.y = position.z = 0.0f;
  263. return position;
  264. }
  265. virtual Stuff::Vector3D getNodeIdPosition (long nodeId)
  266. {
  267. Stuff::Vector3D position;
  268. position.x = position.y = position.z = 0.0f;
  269. return position;
  270. }
  271. virtual void setCombatMode (bool combatMode)
  272. {
  273. }
  274. virtual float getVelocityMagnitude (void)
  275. {
  276. return 0.0f;
  277. }
  278. virtual float getVelocityOfGesture (long gestureId)
  279. {
  280. return 0.0f;
  281. }
  282. virtual void setBrake (bool brake)
  283. {
  284. }
  285. virtual void setObjectParameters (Stuff::Vector3D &pos, float rot, long selected, long team, long homeRelations)
  286. {
  287. }
  288. virtual void setMoverParameters (float turretRot, float lArmRot = 0.0f, float rArmRot = 0.0f, bool isAirborne = false)
  289. {
  290. }
  291. virtual void updateFootprints (void)
  292. {
  293. }
  294. virtual void setPaintScheme (void)
  295. {
  296. }
  297. virtual void setPaintScheme (DWORD red, DWORD green, DWORD blue)
  298. {
  299. }
  300. virtual void getPaintScheme (DWORD &red, DWORD &green, DWORD &blue)
  301. {
  302. }
  303. virtual void resetPaintScheme (DWORD red, DWORD green, DWORD blue)
  304. {
  305. }
  306. virtual void setDebugMoveMode (void)
  307. {
  308. }
  309. virtual void setSingleStepMode (void)
  310. {
  311. }
  312. virtual void setPrevFrame (void)
  313. {
  314. }
  315. virtual void setNextFrame (void)
  316. {
  317. }
  318. virtual void setVisibility (bool vis, bool sen)
  319. {
  320. visible = vis;
  321. seen = sen;
  322. }
  323. virtual void setSensorLevel (long lvl)
  324. {
  325. }
  326. virtual void hitFront (void)
  327. {
  328. }
  329. virtual void hitBack (void)
  330. {
  331. }
  332. virtual void hitLeft (void)
  333. {
  334. }
  335. virtual void hitRight (void)
  336. {
  337. }
  338. virtual void setObjStatus (long oStatus)
  339. {
  340. }
  341. virtual long calcCellsCovered (Stuff::Vector3D& pos, short* cellList) {
  342. return(0);
  343. }
  344. virtual void markTerrain (_ScenarioMapCellInfo* pInfo, int type, int counter)
  345. {
  346. }
  347. virtual long markMoveMap (bool passable, long* lineOfSightRect, bool useheight = false, short* cellList = NULL)
  348. {
  349. return(0);
  350. }
  351. virtual void markLOS (bool clearIt = false)
  352. {
  353. }
  354. virtual void scale (float scaleFactor)
  355. {
  356. }
  357. virtual bool playDestruction (void)
  358. {
  359. return false;
  360. }
  361. virtual float getRadius (void)
  362. {
  363. return 0.0f;
  364. }
  365. virtual void flashBuilding (float duration, float flashDuration, DWORD color)
  366. {
  367. }
  368. virtual void setHighlightColor( long argb )
  369. {
  370. }
  371. virtual float getTopZ (void)
  372. {
  373. return 0.0f;
  374. }
  375. virtual void blowLeftArm (void)
  376. {
  377. }
  378. virtual void blowRightArm (void)
  379. {
  380. }
  381. virtual void setFilterState (bool state)
  382. {
  383. }
  384. virtual Stuff::Vector3D getVelocity (void)
  385. {
  386. Stuff::Vector3D result;
  387. result.Zero();
  388. return result;
  389. }
  390. virtual bool isSelectable()
  391. {
  392. return true;
  393. }
  394. virtual void setIsHudElement (void)
  395. {
  396. }
  397. virtual long getObjectNameId ()
  398. {
  399. return -1;
  400. }
  401. virtual bool getIsLit (void)
  402. {
  403. return false;
  404. }
  405. virtual void setLightsOut (bool lightFlag)
  406. {
  407. }
  408. virtual bool PerPolySelect (long mouseX, long mouseY)
  409. {
  410. return true;
  411. }
  412. virtual bool isForestClump (void)
  413. {
  414. return false;
  415. }
  416. virtual Stuff::Point3D getRootNodeCenter (void)
  417. {
  418. Stuff::Point3D result;
  419. result.Zero();
  420. return result;
  421. }
  422. virtual void setAlphaValue (BYTE aVal)
  423. {
  424. }
  425. void drawIcon( unsigned long bmpHandle, unsigned long bmpWidth,
  426. unsigned long bmpHeight, unsigned long color,
  427. unsigned long where = 0 );
  428. virtual void setSkyNumber (long skyNum)
  429. {
  430. }
  431. virtual void setMechName( const char* pName ){}
  432. virtual void startSmoking (long smokeLvl)
  433. {
  434. }
  435. virtual void startWaterWake (void)
  436. {
  437. }
  438. virtual void stopWaterWake (void)
  439. {
  440. }
  441. virtual void playEjection (void)
  442. {
  443. }
  444. virtual void startActivity (long effectId, bool loop)
  445. {
  446. }
  447. virtual void stopActivity (void)
  448. {
  449. }
  450. virtual Stuff::Vector3D getHitNode (void)
  451. {
  452. Stuff::Point3D result;
  453. result.Zero();
  454. return result;
  455. }
  456. virtual Stuff::Vector3D getHitNodeLeft (void)
  457. {
  458. Stuff::Point3D result;
  459. result.Zero();
  460. return result;
  461. }
  462. virtual Stuff::Vector3D getHitNodeRight (void)
  463. {
  464. Stuff::Point3D result;
  465. result.Zero();
  466. return result;
  467. }
  468. virtual bool getRightArmOff (void)
  469. {
  470. return false;
  471. }
  472. virtual bool getLeftArmOff (void)
  473. {
  474. return false;
  475. }
  476. virtual bool hasAnimationData (long gestureId)
  477. {
  478. return false;
  479. }
  480. };
  481. //---------------------------------------------------------------------------
  482. #endif