Leaked source code of windows server 2003
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.

175 lines
5.9 KiB

  1. /*****************************************************************************\
  2. FILE: room.h
  3. DESCRIPTION:
  4. BryanSt 12/24/2000
  5. Copyright (C) Microsoft Corp 2000-2001. All rights reserved.
  6. \*****************************************************************************/
  7. #ifndef ROOM_H
  8. #define ROOM_H
  9. #include "util.h"
  10. #include "main.h"
  11. #include "painting.h"
  12. #include "pictures.h"
  13. #define WATER_COLOR 0x00008899
  14. //-----------------------------------------------------------------------------
  15. // Defines, constants, and global variables
  16. //-----------------------------------------------------------------------------
  17. #define WALL_VECTORS 6
  18. #define CEILING_VECTORS 4
  19. #define FLOOR_VECTORS 4
  20. #define DOORFRAME_DEPTH 1.0f
  21. #define DOOR_HEIGHT 30.0f
  22. #define DOOR_WIDTH 30.0f
  23. #define WALL_WIDTHBEFOREDOOR 145.0f
  24. #define TOEGUARD_HEIGHT 1.25f
  25. // Smaller numbers make them appear larger.
  26. #define TEXTURESCALE_WALLPAPER 0.6f // 0.6f for 25x36 Orig, 0.3f for CDWallpaper 256x256.
  27. #define TEXTURESCALE_TOEGUARD 0.6f // 0.6f for 32x32.
  28. #define TEXTURESCALE_CEILING 0.09f
  29. #define TEXTURESCALE_FLOOR 0.05f // 0.03f or 0.05f for Hardwoods (476x214), 0.09f for Tile (256x256)
  30. #define DOOR_DISTANCETOFIRSTDOOR 0.6f
  31. #define NUM_PAINTINGS 8
  32. extern float g_fRoomWidthX;
  33. extern float g_fRoomDepthZ;
  34. extern float g_fRoomHeightY;
  35. extern float g_fFudge; // This will cause one object to be above another.
  36. typedef struct
  37. {
  38. D3DXVECTOR3 vLocation;
  39. D3DXVECTOR3 vNormal;
  40. } PAINTING_LAYOUT;
  41. typedef struct
  42. {
  43. int nEnterDoor;
  44. int nExitDoor;
  45. int nMovementPattern; // What pattern should be used in the user's movements?
  46. BOOL fDoor0; // Does this door exist?
  47. BOOL fDoor1; // Does this door exist?
  48. BOOL fDoor2; // Does this door exist?
  49. int nPaintings; // Number of PAINTING_LAYOUT in pPaintingsLayout.
  50. PAINTING_LAYOUT * pPaintingsLayout;
  51. } ROOM_FLOORPLANS;
  52. class CTheRoom : public IUnknown
  53. {
  54. public:
  55. //////////////////////////////////////////////////////
  56. // Public Interfaces
  57. //////////////////////////////////////////////////////
  58. // *** IUnknown ***
  59. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  60. virtual STDMETHODIMP_(ULONG) AddRef(void);
  61. virtual STDMETHODIMP_(ULONG) Release(void);
  62. public:
  63. HRESULT OneTimeSceneInit(int nFutureRooms, BOOL fLowPriority);
  64. HRESULT Render(IDirect3DDevice8 * lpDev, int nRenderPhase, BOOL fFrontToBack);
  65. HRESULT FinalCleanup(void);
  66. HRESULT DeleteDeviceObjects(void);
  67. HRESULT SetCurrent(BOOL fCurrent);
  68. HRESULT GetNextRoom(CTheRoom ** ppNextRoom);
  69. HRESULT LoadCameraMoves(CCameraMove * ptheCamera);
  70. HRESULT FreePictures(int nMaxBatch = -1);
  71. float GetDoorOffset(void) {return (g_fRoomWidthX / 2.0f);} // This will return the distance between the new room's 0 coord and the middle of it's the enter door.
  72. int GetMaxRenderPhases(void) {return 8;};
  73. int GetEnterDoor(void);
  74. int GetExitDoor(void);
  75. CTheRoom(BOOL fLobby, CMSLogoDXScreenSaver * pMain, CTheRoom * pEnterRoom, int nBatch);
  76. virtual ~CTheRoom();
  77. protected:
  78. int m_nBatch;
  79. private:
  80. long m_cRef;
  81. D3DXMATRIX m_matIdentity;
  82. C3DObject m_objWall1;
  83. C3DObject m_objCeiling;
  84. C3DObject m_objToeGuard1;
  85. C3DObject m_objFloor;
  86. C3DObject m_theRug;
  87. C3DObject m_thePowerSocket;
  88. CPainting * m_pPaintings[NUM_PAINTINGS];
  89. BOOL m_fWalls;
  90. BOOL m_fToeGuard;
  91. BOOL m_fRug;
  92. BOOL m_fPower;
  93. BOOL m_fCeiling;
  94. BOOL m_fFloor;
  95. BOOL m_fPaintings;
  96. BOOL m_fLobby;
  97. BOOL m_fCurrentRoom; // Current Room
  98. BOOL m_fVisible;
  99. BOOL m_fLowPriority;
  100. CMSLogoDXScreenSaver * m_pMain; // Weak reference
  101. ROOM_FLOORPLANS * m_pFloorPlan;
  102. CTheRoom * m_pEnterRoom; // Equal to m_pFirstRoom or m_pLeftRoom or m_pRightRoom
  103. CTheRoom * m_pFirstRoom; // Thru Door 0
  104. CTheRoom * m_pLeftRoom; // Thru Door 1
  105. CTheRoom * m_pRightRoom; // Thru Door 2
  106. D3DXMATRIX m_matFirstRoom;
  107. D3DXMATRIX m_matLeftRoom;
  108. D3DXMATRIX m_matRightRoom;
  109. BOOL m_fRoomCreated;
  110. // Functions:
  111. LPCTSTR _GetItemTexturePath(DWORD dwItem);
  112. HRESULT _InitPaintings(void);
  113. HRESULT _CreateRoom(void);
  114. HRESULT _AddWallWithDoor(C3DObject * pobjWall, C3DObject * pobjToeGuard, C3DObject * pobjFloor, D3DXVECTOR3 vLocation, D3DXVECTOR3 vWidth, D3DXVECTOR3 vHeight, D3DXVECTOR3 vNormal,
  115. float fTotalHeight, float fDoorHeight, float fTotalWidth, float fDoorWidth, float fDoorStart);
  116. HRESULT _RenderThisRoom(IDirect3DDevice8 * pD3DDevice, int nRenderPhase, BOOL fFrontToBack);
  117. HRESULT _SetRotationMatrix(void);
  118. HRESULT _LoadLobbyPath(CCameraMove * ptheCamera);
  119. HRESULT _CreateLobbySign(void);
  120. HRESULT _LongRoomEnterDoorMovements(CCameraMove * ptheCamera);
  121. HRESULT _LongRoomSideEnterLeaveMovements(CCameraMove * ptheCamera);
  122. BOOL _IsRoomVisible(IDirect3DDevice8 * pD3DDevice, int nRoomNumber);
  123. HRESULT _AddWall(BOOL fWithDoor, D3DXVECTOR3 vLocation, D3DXVECTOR3 vWidth, D3DXVECTOR3 vHeight, D3DXVECTOR3 vNormal,
  124. float fTotalHeight, float fDoorHeight, float fTotalWidth, float fDoorWidth, float fDoorStart);
  125. HRESULT _AddPaintingToPaintingMovements(CCameraMove * ptheCamera, D3DXVECTOR3 vSourceLocIn, D3DXVECTOR3 vSourceTangentIn,
  126. D3DXVECTOR3 vPainting, D3DXVECTOR3 * pvDestDir, float fDest, D3DXVECTOR3 * pvDestTangent, int nBatch);
  127. friend CMSLogoDXScreenSaver;
  128. };
  129. #endif // ROOM_H