UFO: Alien Invasion
Loading...
Searching...
No Matches
e_event_cameraappear.cpp
Go to the documentation of this file.
1
4
5/*
6Copyright (C) 2002-2025 UFO: Alien Invasion.
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; either version 2
11of the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
17See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23*/
24
25#include "../../../../client.h"
29
34void CL_CameraAppear (const eventRegister_t* self, dbuffer* msg)
35{
36 int entnum;
37 int team;
38 int levelflags;
39 int dir;
40 int rotate;
42 camera_type_t cameraType;
43
44 NET_ReadFormat(msg, self->formatString, &entnum, &origin, &team, &dir, &cameraType, &levelflags, &rotate);
45
46 le_t* le = LE_Get(entnum);
47 if (!le) {
48 le = LE_Add(entnum);
49 } else {
50 le->inuse = true;
51 }
52
54 le->type = ET_CAMERA;
55 le->team = team;
56 le->angles[YAW] = directionAngles[le->angle];
58 le->levelflags = levelflags;
59 le->model1 = R_FindModel(va("objects/cameras/camera%i", cameraType));
60 if (rotate) {
61 const char* rotateAnim = "rotate";
62 R_AnimChange(&le->as, le->model1, rotateAnim);
63 }
64
65 Com_DPrintf(DEBUG_CLIENT, "CL_CameraAppear: entnum: %i\n", entnum);
66}
le_t * LE_Add(int entnum)
Add a new local entity to the scene.
le_t * LE_Get(int entnum)
Searches all local entities for the one with the searched entnum.
#define LE_CHECK_LEVELFLAGS
Primary header for client.
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
Definition common.cpp:440
#define DEBUG_CLIENT
Definition defines.h:59
void CL_CameraAppear(const eventRegister_t *self, dbuffer *msg)
Adds a camera edicts to the client for displaying them.
voidpf uLong int origin
Definition ioapi.h:45
const float directionAngles[CORE_DIRECTIONS]
Definition mathlib.cpp:105
#define YAW
Definition mathlib.h:55
void NET_ReadFormat(dbuffer *buf, const char *format,...)
The user-friendly version of NET_ReadFormat that reads variable arguments from a buffer according to ...
Definition netpack.cpp:533
camera_type_t
Definition q_shared.h:178
@ ET_CAMERA
Definition q_shared.h:171
void R_AnimChange(animState_t *as, const model_t *mod, const char *name)
Changes the animation for md2 models.
model_t * R_FindModel(const char *name)
Tries to load a model.
Definition r_model.cpp:203
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
Definition shared.cpp:410
Struct that defines one particular event with all its callbacks and data.
Definition e_main.h:42
const char * formatString
The format string that is used to write and parse this event.
Definition e_main.h:54
a local entity
int flags
float angles[3]
vec3_t origin
int angle
animState_t as
model_t * model1
bool inuse
entity_type_t type
int levelflags
vec_t vec3_t[3]
Definition ufotypes.h:39
#define VectorCopy(src, dest)
Definition vector.h:51