1 //**************************************************************************
2 //**
3 //**	##   ##    ##    ##   ##   ####     ####   ###     ###
4 //**	##   ##  ##  ##  ##   ##  ##  ##   ##  ##  ####   ####
5 //**	 ## ##  ##    ##  ## ##  ##    ## ##    ## ## ## ## ##
6 //**	 ## ##  ########  ## ##  ##    ## ##    ## ##  ###  ##
7 //**	  ###   ##    ##   ###    ##  ##   ##  ##  ##       ##
8 //**	   #    ##    ##    #      ####     ####   ##       ##
9 //**
10 //**	$Id: cl_local.h 4339 2010-12-14 12:07:27Z dj_jl $
11 //**
12 //**	Copyright (C) 1999-2006 Jānis Legzdiņš
13 //**
14 //**	This program is free software; you can redistribute it and/or
15 //**  modify it under the terms of the GNU General Public License
16 //**  as published by the Free Software Foundation; either version 2
17 //**  of the License, or (at your option) any later version.
18 //**
19 //**	This program is distributed in the hope that it will be useful,
20 //**  but WITHOUT ANY WARRANTY; without even the implied warranty of
21 //**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 //**  GNU General Public License for more details.
23 //**
24 //**************************************************************************
25 
26 #ifndef __CL_LOCAL_H__
27 #define __CL_LOCAL_H__
28 
29 // HEADER FILES ------------------------------------------------------------
30 
31 #include "iline.h"		//	Input line widget
32 
33 class VRootWidget;
34 struct VModel;
35 
36 // MACROS ------------------------------------------------------------------
37 
38 // TYPES -------------------------------------------------------------------
39 
40 struct dlight_t
41 {
42 	TVec		origin;		// origin of the light
43 	float		radius;		// radius - how far light goes
44 	float		die;		// stop lighting after this time
45 	float		decay;		// drop this each second
46 	float		minlight;	// don't add when contributing less
47 	VThinker*	Owner;		// used to identify owner to reuse the same light
48 	vuint32		colour;		// for coloured lights
49 };
50 
51 struct im_t
52 {
53 	VName		LeaveMap;
54 	vint32		LeaveCluster;
55 	VStr		LeaveName;
56 	VName		LeaveTitlePatch;
57 	VName		ExitPic;
58 
59 	VName		EnterMap;
60 	vint32		EnterCluster;
61 	VStr		EnterName;
62 	VName		EnterTitlePatch;
63 	VName		EnterPic;
64 
65 	VName		InterMusic;
66 
67 	VStr		Text;
68 	VName		TextFlat;
69 	VName		TextPic;
70 	VName		TextMusic;
71 	vint32		TextCDTrack;
72 	vint32		TextCDId;
73 
74 	enum
75 	{
76 		IMF_TextIsLump		= 0x01,
77 	};
78 	vint32		IMFlags;
79 };
80 
81 class VClientGameBase : public VObject
82 {
83 	DECLARE_CLASS(VClientGameBase, VObject, 0)
84 
85 	enum
86 	{
87 		CF_LocalServer		= 0x01,
88 		// used to accelerate or skip a stage
89 		CF_SkipIntermission	= 0x02,
90 	};
91 	vuint32				ClientFlags;
92 
93 	VGameInfo*			Game;
94 	VBasePlayer*		cl;
95 	VLevel*				GLevel;
96 
97 	im_t				im;
98 
99 	VRootWidget*		GRoot;
100 
101 	int					sb_height;
102 
103 	int					maxclients;
104 	int					deathmatch;
105 
106 	VStr				serverinfo;
107 
108 	int					intermission;
109 
VClientGameBase()110 	VClientGameBase()
111 	: serverinfo(E_NoInit)
112 	{}
113 
eventRootWindowCreated()114 	void eventRootWindowCreated()
115 	{
116 		P_PASS_SELF;
117 		EV_RET_VOID(NAME_RootWindowCreated);
118 	}
eventConnected()119 	void eventConnected()
120 	{
121 		P_PASS_SELF;
122 		EV_RET_VOID(NAME_Connected);
123 	}
eventDisconnected()124 	void eventDisconnected()
125 	{
126 		P_PASS_SELF;
127 		EV_RET_VOID(NAME_Disconnected);
128 	}
eventDemoPlaybackStarted()129 	void eventDemoPlaybackStarted()
130 	{
131 		P_PASS_SELF;
132 		EV_RET_VOID(NAME_DemoPlaybackStarted);
133 	}
eventDemoPlaybackStopped()134 	void eventDemoPlaybackStopped()
135 	{
136 		P_PASS_SELF;
137 		EV_RET_VOID(NAME_DemoPlaybackStopped);
138 	}
eventOnHostEndGame()139 	void eventOnHostEndGame()
140 	{
141 		P_PASS_SELF;
142 		EV_RET_VOID(NAME_OnHostEndGame);
143 	}
eventOnHostError()144 	void eventOnHostError()
145 	{
146 		P_PASS_SELF;
147 		EV_RET_VOID(NAME_OnHostError);
148 	}
eventStatusBarStartMap()149 	void eventStatusBarStartMap()
150 	{
151 		P_PASS_SELF;
152 		EV_RET_VOID(NAME_StatusBarStartMap);
153 	}
eventStatusBarDrawer(int sb_type)154 	void eventStatusBarDrawer(int sb_type)
155 	{
156 		P_PASS_SELF;
157 		P_PASS_INT(sb_type);
158 		EV_RET_VOID(NAME_StatusBarDrawer);
159 	}
eventStatusBarUpdateWidgets(float DeltaTime)160 	void eventStatusBarUpdateWidgets(float DeltaTime)
161 	{
162 		P_PASS_SELF;
163 		P_PASS_FLOAT(DeltaTime);
164 		EV_RET_VOID(NAME_StatusBarUpdateWidgets);
165 	}
eventIintermissionStart()166 	void eventIintermissionStart()
167 	{
168 		P_PASS_SELF;
169 		EV_RET_VOID(NAME_IintermissionStart);
170 	}
eventStartFinale(VName FinaleType)171 	void eventStartFinale(VName FinaleType)
172 	{
173 		P_PASS_SELF;
174 		P_PASS_NAME(FinaleType);
175 		EV_RET_VOID(NAME_StartFinale);
176 	}
eventFinaleResponder(event_t * event)177 	bool eventFinaleResponder(event_t* event)
178 	{
179 		P_PASS_SELF;
180 		P_PASS_PTR(event);
181 		EV_RET_BOOL(NAME_FinaleResponder);
182 	}
eventDeactivateMenu()183 	void eventDeactivateMenu()
184 	{
185 		P_PASS_SELF;
186 		EV_RET_VOID(NAME_DeactivateMenu);
187 	}
eventMenuResponder(event_t * event)188 	bool eventMenuResponder(event_t* event)
189 	{
190 		P_PASS_SELF;
191 		P_PASS_PTR(event);
192 		EV_RET_BOOL(NAME_MenuResponder);
193 	}
eventMenuActive()194 	bool eventMenuActive()
195 	{
196 		P_PASS_SELF;
197 		EV_RET_BOOL(NAME_MenuActive);
198 	}
eventSetMenu(const VStr & Name)199 	void eventSetMenu(const VStr& Name)
200 	{
201 		P_PASS_SELF;
202 		P_PASS_STR(Name);
203 		EV_RET_VOID(NAME_SetMenu);
204 	}
eventMessageBoxDrawer()205 	void eventMessageBoxDrawer()
206 	{
207 		P_PASS_SELF;
208 		EV_RET_VOID(NAME_MessageBoxDrawer);
209 	}
eventMessageBoxResponder(event_t * event)210 	bool eventMessageBoxResponder(event_t* event)
211 	{
212 		P_PASS_SELF;
213 		P_PASS_PTR(event);
214 		EV_RET_BOOL(NAME_MessageBoxResponder);
215 	}
eventMessageBoxActive()216 	bool eventMessageBoxActive()
217 	{
218 		P_PASS_SELF;
219 		EV_RET_BOOL(NAME_MessageBoxActive);
220 	}
eventDrawViewBorder(int x,int y,int w,int h)221 	void eventDrawViewBorder(int x, int y, int w, int h)
222 	{
223 		P_PASS_SELF;
224 		P_PASS_INT(x);
225 		P_PASS_INT(y);
226 		P_PASS_INT(w);
227 		P_PASS_INT(h);
228 		EV_RET_VOID(NAME_DrawViewBorder);
229 	}
eventAddNotifyMessage(const VStr & Str)230 	void eventAddNotifyMessage(const VStr& Str)
231 	{
232 		P_PASS_SELF;
233 		P_PASS_STR(Str);
234 		EV_RET_VOID(NAME_AddNotifyMessage);
235 	}
eventAddCentreMessage(const VStr & Msg)236 	void eventAddCentreMessage(const VStr& Msg)
237 	{
238 		P_PASS_SELF;
239 		P_PASS_STR(Msg);
240 		EV_RET_VOID(NAME_AddCentreMessage);
241 	}
eventAddHudMessage(const VStr & Message,VName Font,int Type,int Id,int Colour,const VStr & ColourName,float x,float y,int HudWidth,int HudHeight,float HoldTime,float Time1,float Time2)242 	void eventAddHudMessage(const VStr& Message, VName Font, int Type, int Id,
243 		int Colour, const VStr& ColourName, float x, float y, int HudWidth,
244 		int HudHeight, float HoldTime, float Time1, float Time2)
245 	{
246 		P_PASS_SELF;
247 		P_PASS_STR(Message);
248 		P_PASS_NAME(Font);
249 		P_PASS_INT(Type);
250 		P_PASS_INT(Id);
251 		P_PASS_INT(Colour);
252 		P_PASS_STR(ColourName);
253 		P_PASS_FLOAT(x);
254 		P_PASS_FLOAT(y);
255 		P_PASS_INT(HudWidth);
256 		P_PASS_INT(HudHeight);
257 		P_PASS_FLOAT(HoldTime);
258 		P_PASS_FLOAT(Time1);
259 		P_PASS_FLOAT(Time2);
260 		EV_RET_VOID(NAME_AddHudMessage);
261 	}
262 };
263 
264 // PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
265 
266 void CL_DecayLights();
267 
268 void CL_KeepaliveMessage();
269 void CL_ParseServerInfo(class VMessageIn& msg);
270 void CL_ReadFromServerInfo();
271 void CL_StopRecording();
272 
273 void R_DrawModelFrame(const TVec&, float, VModel*, int, int, const char*, int,
274 	int, int, float);
275 
276 VModel* Mod_FindName(const VStr&);
277 
278 void SCR_SetVirtualScreen(int, int);
279 
280 // PUBLIC DATA DECLARATIONS ------------------------------------------------
281 
282 extern VClientGameBase*		GClGame;
283 
284 extern int					VirtualWidth;
285 extern int					VirtualHeight;
286 
287 extern float				fScaleX;
288 extern float				fScaleY;
289 extern float				fScaleXI;
290 extern float				fScaleYI;
291 
292 extern bool					UserInfoSent;
293 
294 #endif
295