HoverRace  2.0
Observer.h
Go to the documentation of this file.
1 // Observer.h
2 //
3 // Copyright (c) 1995-1998 - Richard Langlois and Grokksoft Inc.
4 //
5 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
6 // you may not use this file except in compliance with the License.
7 //
8 // A copy of the license should have been attached to the package from which
9 // you have taken this file. If you can not find the license you can not use
10 // this file.
11 //
12 //
13 // The author makes no representations about the suitability of
14 // this software for any purpose. It is provided "as is" "AS IS",
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16 // implied.
17 //
18 // See the License for the specific language governing permissions
19 // and limitations under the License.
20 //
21 
22 #pragma once
23 
24 #include "../../engine/Display/HudCell.h"
25 #include "../../engine/VideoServices/Viewport3D.h"
26 #include "../../engine/MainCharacter/MainCharacter.h"
27 #include "../../engine/ObjFacTools/SpriteHandle.h"
28 
29 namespace HoverRace {
30  namespace Client {
31  class ClientSession;
32  }
33  namespace Model {
34  struct SectionId;
35  }
36 }
37 
38 namespace HoverRace {
39 namespace Client {
40 
41 class Observer
42 {
43 private:
47  bool hudVisible;
48  bool demoMode;
49 
53 
55 
56  int mScroll;
58  int mXMargin_1024; // Fraction of Horizontal screen that is a margin
59  int mYMargin_1024; // Fraction of vertical screen that is a margin
60 
62  int mDispPlayers; // Index of the players list to display
63  // 0 mean do not display
64 
65  std::shared_ptr<ObjFac1::SpriteHandle> mBaseFont;
66  std::shared_ptr<ObjFac1::SpriteHandle> mMissileLevel;
67  std::shared_ptr<ObjFac1::SpriteHandle> mMineDisp;
68  std::shared_ptr<ObjFac1::SpriteHandle> mPowerUpDisp;
69  std::shared_ptr<ObjFac1::SpriteHandle> mHoverIcons;
70 
71 public:
72  Observer();
73  ~Observer() { }
74 
75 private:
76  void Render2DDebugView(VideoServices::VideoBuffer * pDest, const Model::Level * pLevel, const MainCharacter::MainCharacter * pViewingCharacter);
77  void RenderWireFrameView(const Model::Level * pLevel, const MainCharacter::MainCharacter * pViewingCharacter);
78  void Render3DView(const HoverRace::Client::ClientSession * pSession, const MainCharacter::MainCharacter * pViewingCharacter, MR_SimulationTime pTime, const MR_UInt8 * pBackImage);
79 
80  void DrawWFSection(const Model::Level * pLevel, const Model::SectionId & pSectionId, MR_UInt8 pColor);
81  void RenderRoomWalls(const Model::Level * pLevel, int pRoomId, MR_SimulationTime pTime);
82  void RenderFeatureWalls(const Model::Level * pLevel, int pFeatureId, MR_SimulationTime pTime);
83  void RenderFloorOrCeiling(const Model::Level * pLevel, const Model::SectionId & pSectionId, BOOL pFloor, MR_SimulationTime pTime);
84 
85  static void DrawBackground(VideoServices::VideoBuffer * pDest);
86 
87 public:
88  static const std::string &GetCraftName(int id);
89 
90  // Camera control
91  void Scroll(int pOffset);
92  void Zoom(int factor);
93  void Home();
94  void ToggleHudVisible();
95  void SetHudVisible(bool visible);
96  void StartDemoMode();
97 
98  void EnlargeMargin();
99  void ReduceMargin();
100 
101  void MoreMessages();
102  void PlayersListPageDn();
103 
104  void SetCockpitView(BOOL pOn);
105 
106  void SetSplitMode(Display::HudCell pMode);
107 
108  // Rendering function
109  void RenderDebugDisplay(VideoServices::VideoBuffer * pDest, const HoverRace::Client::ClientSession *pSession, const MainCharacter::MainCharacter * pViewingCharacter, MR_SimulationTime pTime, const MR_UInt8 * pBackImage);
110  void RenderNormalDisplay(VideoServices::VideoBuffer * pDest, const HoverRace::Client::ClientSession *pSession, const MainCharacter::MainCharacter * pViewingCharacter, MR_SimulationTime pTime, const MR_UInt8 * pBackImage);
111 
112  void PlaySounds(const Model::Level * pLevel, MainCharacter::MainCharacter * pViewingCharacter);
113 
114 };
115 
116 } // namespace Client
117 } // namespace HoverRace
VideoServices::Viewport3D mWireFrameView
Definition: Observer.h:51
std::shared_ptr< ObjFac1::SpriteHandle > mMineDisp
Definition: Observer.h:67
std::shared_ptr< ObjFac1::SpriteHandle > mMissileLevel
Definition: Observer.h:66
Definition: Level.h:64
int mDispPlayers
Definition: Observer.h:62
bool demoMode
Definition: Observer.h:48
std::shared_ptr< ObjFac1::SpriteHandle > mHoverIcons
Definition: Observer.h:69
Definition: Viewport3D.h:53
Definition: WorldCoordinates.h:75
Definition: Viewport2D.h:42
MR_Int16 MR_Angle
Definition: WorldCoordinates.h:96
MR_Int32 MR_SimulationTime
Definition: WorldCoordinates.h:106
int mYMargin_1024
Definition: Observer.h:59
int mScroll
Definition: Observer.h:56
Definition: Observer.h:41
Video framebuffer for legacy (8-bit, palettized) rendering.
Definition: VideoBuffer.h:54
BOOL mLastCameraPosValid
Definition: Observer.h:45
std::shared_ptr< ObjFac1::SpriteHandle > mPowerUpDisp
Definition: Observer.h:68
MR_Angle mApperture
Definition: Observer.h:57
BOOL mMoreMessages
Definition: Observer.h:61
MR_3DCoordinate mLastCameraPos
Definition: Observer.h:44
Definition: Level.h:74
Definition: ClientSession.h:58
~Observer()
Definition: Observer.h:73
int mXMargin_1024
Definition: Observer.h:58
VideoServices::Viewport2D m2DDebugView
Definition: Observer.h:50
Definition: Announcement.h:24
std::shared_ptr< ObjFac1::SpriteHandle > mBaseFont
Definition: Observer.h:65
bool hudVisible
Definition: Observer.h:47
HudCell
Split-screen HUD grid locations.
Definition: HudCell.h:28
Display::HudCell splitMode
Definition: Observer.h:54
uint8_t MR_UInt8
Definition: MR_Types.h:40
VideoServices::Viewport3D m3DView
Definition: Observer.h:52
Definition: MainCharacter.h:62
BOOL mCockpitView
Definition: Observer.h:46