forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 202
Expand file tree
/
Copy pathW3DGameClient.h
More file actions
138 lines (111 loc) · 5.62 KB
/
W3DGameClient.h
File metadata and controls
138 lines (111 loc) · 5.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
** Command & Conquer Generals Zero Hour(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: W3DGameClient.h ///////////////////////////////////////////////////
//
// W3D implementation of the game interface. The GameClient is
// responsible for maintaining our drawables, handling our GUI, and creating
// the display ... basically the Client if this were a Client/Server game.
//
// Author: Colin Day, April 2001
//
///////////////////////////////////////////////////////////////////////////////
#pragma once
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////
#include "Common/GlobalData.h"
#include "GameClient/GameClient.h"
#include "W3DDevice/GameClient/W3DParticleSys.h"
#include "W3DDevice/GameClient/W3DDisplay.h"
#include "W3DDevice/GameClient/W3DInGameUI.h"
#include "W3DDevice/GameClient/W3DTerrainVisual.h"
#include "W3DDevice/GameClient/W3DGameWindowManager.h"
#include "W3DDevice/GameClient/W3DGameFont.h"
#include "W3DDevice/GameClient/W3DDisplayStringManager.h"
#include "VideoDevice/Bink/BinkVideoPlayer.h"
#ifdef RTS_HAS_FFMPEG
#include "VideoDevice/FFmpeg/FFmpegVideoPlayer.h"
#endif
#include "Win32Device/GameClient/Win32DIKeyboard.h"
#include "Win32Device/GameClient/Win32DIMouse.h"
#include "Win32Device/GameClient/Win32Mouse.h"
#include "W3DDevice/GameClient/W3DMouse.h"
#include "W3DDevice/GameClient/W3DSnow.h"
class ThingTemplate;
extern Win32Mouse *TheWin32Mouse;
///////////////////////////////////////////////////////////////////////////////
// PROTOTYPES /////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// W3DGameClient -----------------------------------------------------------
/** The W3DGameClient singleton */
//-----------------------------------------------------------------------------
class W3DGameClient : public GameClient
{
public:
W3DGameClient();
virtual ~W3DGameClient();
/// given a type, create a drawable
virtual Drawable *friend_createDrawable( const ThingTemplate *thing, DrawableStatusBits statusBits = DRAWABLE_STATUS_DEFAULT );
virtual void init(); ///< initialize resources
virtual void update(); ///< per frame update
virtual void reset(); ///< reset system
virtual void addScorch(const Coord3D *pos, Real radius, Scorches type);
virtual void createRayEffectByTemplate( const Coord3D *start, const Coord3D *end, const ThingTemplate* tmpl ); ///< create effect needing start and end location
//virtual Bool getBonePos(Drawable *draw, AsciiString boneName, Coord3D* pos, Matrix3D* transform) const;
virtual void setTimeOfDay( TimeOfDay tod ); ///< Tell all the drawables what time of day it is now
//---------------------------------------------------------------------------
virtual void setTeamColor( Int red, Int green, Int blue ); ///< @todo superhack for demo, remove!!!
virtual void setTextureLOD( Int level );
virtual void notifyTerrainObjectMoved(Object *obj);
protected:
virtual Keyboard *createKeyboard(); ///< factory for the keyboard
virtual Mouse *createMouse(); ///< factory for the mouse
/// factory for creating TheDisplay
virtual Display *createGameDisplay() { return NEW W3DDisplay; }
/// factory for creating TheInGameUI
virtual InGameUI *createInGameUI() { return NEW W3DInGameUI; }
/// factory for creating the window manager
virtual GameWindowManager *createWindowManager() { return NEW W3DGameWindowManager; }
/// factory for creating the font library
virtual FontLibrary *createFontLibrary() { return NEW W3DFontLibrary; }
/// Manager for display strings
virtual DisplayStringManager *createDisplayStringManager() { return NEW W3DDisplayStringManager; }
#ifdef RTS_HAS_FFMPEG
virtual VideoPlayerInterface *createVideoPlayer() { return NEW FFmpegVideoPlayer; }
#else
virtual VideoPlayerInterface *createVideoPlayer() { return NEW BinkVideoPlayer; }
#endif
/// factory for creating the TerrainVisual
// TheSuperHackers @fix bobtista 31/01/2026 Return dummy in headless mode
virtual TerrainVisual *createTerrainVisual() { return TheGlobalData->m_headless ? static_cast<TerrainVisual*>(NEW TerrainVisualDummy) : NEW W3DTerrainVisual; }
/// factory for creating the snow manager
virtual SnowManager *createSnowManager() { return NEW W3DSnowManager; }
virtual void setFrameRate(Real msecsPerFrame) { TheW3DFrameLengthInMsec = msecsPerFrame; }
};
inline Keyboard *W3DGameClient::createKeyboard() { return NEW DirectInputKeyboard; }
inline Mouse *W3DGameClient::createMouse()
{
//return new DirectInputMouse;
Win32Mouse * mouse = NEW W3DMouse;
TheWin32Mouse = mouse; ///< global cheat for the WndProc()
return mouse;
}