UFO: Alien Invasion
Toggle main menu visibility
Loading...
Searching...
No Matches
e_event_addedict.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 "
e_event_addedict.h
"
28
29
33
static
bool
CL_AddEdictFunc
(
le_t
* le,
entity_t
* ent)
34
{
35
ent->
flags
=
RF_BOX
;
36
VectorSet
(ent->
color
, 1, 1, 1);
37
ent->
alpha
= 1.0;
38
ent->
eBox
.
set
(le->
aabb
);
39
R_EntitySetOrigin
(ent, le->
origin
);
40
return
true
;
41
}
42
48
void
CL_AddEdict
(
const
eventRegister_t
* self,
dbuffer
* msg)
49
{
50
int
entnum;
51
entity_type_t
type
;
52
AABB
box;
53
54
NET_ReadFormat
(msg, self->
formatString
, &entnum, &
type
, &box.
mins
, &box.
maxs
);
55
56
/* use an offset to ensure that we don't conflict with any other solid edict that is already spawned */
57
le_t
* le =
LE_Get
(entnum +
MAX_EDICTS
);
58
if
(!le) {
59
le =
LE_Add
(entnum +
MAX_EDICTS
);
60
}
else
{
61
Com_DPrintf
(
DEBUG_CLIENT
,
"CL_AddEdict: Entity appearing already visible... overwriting the old one\n"
);
62
le->
inuse
=
true
;
63
}
64
65
le->
aabb
.
set
(box);
66
le->
addFunc
=
CL_AddEdictFunc
;
67
le->
type
=
type
;
68
69
Com_DPrintf
(
DEBUG_CLIENT
,
"CL_AddEdict: entnum: %i - type: %i\n"
, entnum,
type
);
70
}
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
AABB
Definition
aabb.h:42
AABB::maxs
vec3_t maxs
Definition
aabb.h:258
AABB::mins
vec3_t mins
Definition
aabb.h:257
AABB::set
void set(const AABB &other)
Copies the values from the given aabb.
Definition
aabb.h:60
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
MAX_EDICTS
#define MAX_EDICTS
Definition
defines.h:99
DEBUG_CLIENT
#define DEBUG_CLIENT
Definition
defines.h:59
CL_AddEdict
void CL_AddEdict(const eventRegister_t *self, dbuffer *msg)
Adds server side edicts to the client for displaying them.
Definition
e_event_addedict.cpp:48
CL_AddEdictFunc
static bool CL_AddEdictFunc(le_t *le, entity_t *ent)
Draw the bounding boxes for the server side edicts.
Definition
e_event_addedict.cpp:33
e_event_addedict.h
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
entity_type_t
entity_type_t
Definition
q_shared.h:145
R_EntitySetOrigin
void R_EntitySetOrigin(entity_t *ent, const vec3_t origin)
setter for entity origin
Definition
r_entity.cpp:47
RF_BOX
#define RF_BOX
Definition
r_entity.h:36
type
QGL_EXTERN GLint GLenum type
Definition
r_gl.h:94
entity_t
Definition
r_entity.h:96
entity_t::alpha
float alpha
Definition
r_entity.h:111
entity_t::flags
int flags
Definition
r_entity.h:112
entity_t::color
vec3_t color
Definition
r_entity.h:100
entity_t::eBox
AABB eBox
Definition
r_entity.h:103
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::origin
vec3_t origin
Definition
cl_localentity.h:70
le_t::addFunc
localEntitiyAddFunc_t addFunc
Definition
cl_localentity.h:166
le_t::aabb
AABB aabb
Definition
cl_localentity.h:108
le_t::inuse
bool inuse
Definition
cl_localentity.h:66
le_t::type
entity_type_t type
Definition
cl_localentity.h:67
VectorSet
#define VectorSet(v, x, y, z)
Definition
vector.h:59
src
client
battlescape
events
event
world
e_event_addedict.cpp
Generated on __DATE__ __TIME__ for UFO: Alien Invasion by
1.17.0