UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
e_event_startgame.cpp
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 2002-2020 UFO: Alien Invasion.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23 */
24 
25 
26 #include "../../../../client.h"
27 #include "../../../cl_view.h"
28 #include "../../../cl_hud.h"
29 #include "../../../../cgame/cl_game.h"
30 #include "../../../cl_localentity.h"
31 #include "../../../cl_actor.h"
32 #include "e_event_startgame.h"
33 
40 void CL_StartGame (const eventRegister_t* self, dbuffer* msg)
41 {
42  const int isTeamPlay = NET_ReadByte(msg);
43 
44  /* init camera position and angles */
45  OBJZERO(cl.cam);
46  VectorSet(cl.cam.angles, 60.0, 60.0, 0.0);
47  VectorSet(cl.cam.omega, 0.0, 0.0, 0.0);
48  cl.cam.zoom = 1.25;
50 
51  Com_Printf("Starting the game...\n");
52 
53  /* make sure selActor is null (after reconnect or server change this is needed) */
54  CL_ActorSelect(nullptr);
55 
56  /* center on first actor */
57  cl_worldlevel->modified = true;
58  if (cl.numTeamList) {
59  const le_t* le = cl.teamList[0];
61  }
62 
63  /* activate the renderer */
65 
66  GAME_StartBattlescape(isTeamPlay);
67 }
#define VectorSet(v, x, y, z)
Definition: vector.h:59
pos3_t pos
void CL_ViewCenterAtGridPosition(const pos3_t pos)
Centers the camera on a given grid field.
Definition: cl_view.cpp:289
void GAME_StartBattlescape(bool isTeamPlay)
Called when the server sends the EV_START event.
Definition: cl_game.cpp:1487
void Com_Printf(const char *const fmt,...)
Definition: common.cpp:386
cvar_t * cl_worldlevel
Definition: cl_hud.cpp:46
#define OBJZERO(obj)
Definition: shared.h:178
clientBattleScape_t cl
bool CL_ActorSelect(le_t *le)
Selects an actor.
Definition: cl_actor.cpp:440
void CL_ViewCalcFieldOfViewX(void)
Calculates refdef's FOV_X. Should generally be called after any changes are made to the zoom level (v...
Definition: cl_view.cpp:189
Struct that defines one particular event with all its callbacks and data.
Definition: e_main.h:42
a local entity
void CL_SetClientState(connstate_t state)
Sets the client state.
Definition: cl_main.cpp:1016
vec3_t angles
Definition: cl_camera.h:34
float zoom
Definition: cl_camera.h:39
le_t * teamList[MAX_ACTIVETEAM]
bool modified
Definition: cvar.h:79
vec3_t omega
Definition: cl_camera.h:35
int NET_ReadByte(dbuffer *buf)
Reads a byte from the netchannel.
Definition: netpack.cpp:234
void CL_StartGame(const eventRegister_t *self, dbuffer *msg)
Activates the map render screen (ca_active)