Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.4 KiB

  1. #ifndef SEALIFE_H
  2. #define SEALIFE_H
  3. #include "D3DEnum.h"
  4. #define WATER_COLOR 0x00008899
  5. #define NUM_FISH 44
  6. #define NUM_DOLPHINS 5
  7. #define NUM_CAMFISH 1
  8. #define NUM_FISH1 50
  9. #define XEXTENT (40.0f*(rnd()-rnd()))
  10. #define YEXTENT (10.0f*(rnd()))
  11. #define ZEXTENT (30.0f*(rnd()))
  12. #define DOLPHINSPEED 35 //0.01f
  13. #define FISHSPEED 40 //0.01f
  14. #define TWEAK 0.005f
  15. #define TWEAKFISH 0.05f
  16. #define TURNDELTADOLPHIN .1
  17. #define TURNDELTAFISH .1
  18. #define PITCHCHANGE (3.1415 / 5000)
  19. #define PITCHDELTA 1
  20. #define PITCHCHANGEFISH (3.1415 / 500)
  21. #define PITCHDELTAFISH 2
  22. #define INITPITCH 0
  23. #define DOLPHINUPDOWN(t) (-2*(float)cos(t)/6)
  24. #define FISHWIGGLE (3.1415/8)*sin(fTimeKey*10)
  25. #define FISHTYPE_DOLPHIN 0
  26. #define FISHTYPE_FISH1 1
  27. #define FISHTYPE_CAMERA 2
  28. typedef struct t_FISH
  29. {
  30. D3DVECTOR loc;
  31. D3DVECTOR goal;
  32. D3DVECTOR dir;
  33. D3DMATRIX matrix;
  34. float angle_tweak;
  35. float turndelta;
  36. float yaw;
  37. float pitch;
  38. float pitchchange;
  39. float pitchdelta;
  40. float roll;
  41. float weight;
  42. float speed;
  43. float upDownFactor;
  44. DWORD type;
  45. } FISHSTRUCT;
  46. //-----------------------------------------------------------------------------
  47. // Name: class CMyD3DApplication
  48. // Desc: Main class to run this application. Most functionality is inherited
  49. // from the CD3DApplication base class.
  50. //-----------------------------------------------------------------------------
  51. class CSeaLife
  52. {
  53. // The DirectX file objects
  54. CD3DFile* m_pDolphinGroupObject;
  55. CD3DFile* m_pDolphinObject;
  56. CD3DFile* m_pFloorObject;
  57. CD3DFile* m_pFish1Object;
  58. // Vertex data from the file objects
  59. D3DVERTEX* m_pDolphinVertices;
  60. D3DVERTEX* m_pDolphin1Vertices;
  61. D3DVERTEX* m_pDolphin2Vertices;
  62. D3DVERTEX* m_pDolphin3Vertices;
  63. DWORD m_dwNumDolphinVertices;
  64. D3DVERTEX* m_pFloorVertices;
  65. DWORD m_dwNumFloorVertices;
  66. D3DMATRIX m_matDolphin;
  67. D3DMATRIX m_matFloor;
  68. FISHSTRUCT m_FishState[NUM_FISH];
  69. LPDIRECT3DDEVICE7 m_pd3dDevice;
  70. D3DEnum_DeviceInfo *m_pDeviceInfo;
  71. public:
  72. //SeaLife();
  73. HRESULT OneTimeSceneInit();
  74. HRESULT InitDeviceObjects(LPDIRECT3DDEVICE7,D3DEnum_DeviceInfo*);
  75. HRESULT DeleteDeviceObjects();
  76. HRESULT Render(LPDIRECT3DDEVICE7);
  77. HRESULT FrameMove(FLOAT);
  78. HRESULT FinalCleanup();
  79. };
  80. #endif // SEALIFE_H