UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
e_event_cameraappear.cpp
Go to the documentation of this file.
1
4
5
/*
6
Copyright (C) 2002-2025 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
#include "
../../../../client.h
"
26
#include "
../../../cl_localentity.h
"
27
#include "
../../../../renderer/r_mesh_anim.h
"
28
#include "
e_event_cameraappear.h
"
29
34
void
CL_CameraAppear
(
const
eventRegister_t
* self,
dbuffer
* msg)
35
{
36
int
entnum;
37
int
team;
38
int
levelflags;
39
int
dir;
40
int
rotate;
41
vec3_t
origin
;
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
53
VectorCopy
(
origin
, le->
origin
);
54
le->
type
=
ET_CAMERA
;
55
le->
team
= team;
56
le->
angles
[
YAW
] =
directionAngles
[le->
angle
];
57
le->
flags
|=
LE_CHECK_LEVELFLAGS
;
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_Add
le_t * LE_Add(int entnum)
Add a new local entity to the scene.
Definition
cl_localentity.cpp:1209
LE_Get
le_t * LE_Get(int entnum)
Searches all local entities for the one with the searched entnum.
Definition
cl_localentity.cpp:1287
cl_localentity.h
LE_CHECK_LEVELFLAGS
#define LE_CHECK_LEVELFLAGS
Definition
cl_localentity.h:48
dbuffer
Definition
dbuffer.h:20
client.h
Primary header for client.
Com_DPrintf
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
DEBUG_CLIENT
#define DEBUG_CLIENT
Definition
defines.h:59
CL_CameraAppear
void CL_CameraAppear(const eventRegister_t *self, dbuffer *msg)
Adds a camera edicts to the client for displaying them.
Definition
e_event_cameraappear.cpp:34
e_event_cameraappear.h
origin
voidpf uLong int origin
Definition
ioapi.h:45
directionAngles
const float directionAngles[CORE_DIRECTIONS]
Definition
mathlib.cpp:105
YAW
#define YAW
Definition
mathlib.h:55
NET_ReadFormat
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
camera_type_t
Definition
q_shared.h:178
ET_CAMERA
@ ET_CAMERA
Definition
q_shared.h:171
R_AnimChange
void R_AnimChange(animState_t *as, const model_t *mod, const char *name)
Changes the animation for md2 models.
Definition
r_mesh_anim.cpp:134
r_mesh_anim.h
R_FindModel
model_t * R_FindModel(const char *name)
Tries to load a model.
Definition
r_model.cpp:203
va
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
eventRegister_t
Struct that defines one particular event with all its callbacks and data.
Definition
e_main.h:42
eventRegister_t::formatString
const char * formatString
The format string that is used to write and parse this event.
Definition
e_main.h:54
le_t
a local entity
Definition
cl_localentity.h:65
le_t::flags
int flags
Definition
cl_localentity.h:91
le_t::angles
float angles[3]
Definition
cl_localentity.h:84
le_t::origin
vec3_t origin
Definition
cl_localentity.h:70
le_t::angle
int angle
Definition
cl_localentity.h:72
le_t::as
animState_t as
Definition
cl_localentity.h:149
le_t::model1
model_t * model1
Definition
cl_localentity.h:116
le_t::team
int team
Definition
cl_localentity.h:87
le_t::inuse
bool inuse
Definition
cl_localentity.h:66
le_t::type
entity_type_t type
Definition
cl_localentity.h:67
le_t::levelflags
int levelflags
Definition
cl_localentity.h:151
vec3_t
vec_t vec3_t[3]
Definition
ufotypes.h:39
VectorCopy
#define VectorCopy(src, dest)
Definition
vector.h:51
src
client
battlescape
events
event
world
e_event_cameraappear.cpp
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0