UFO: Alien Invasion
Loading...
Searching...
No Matches
cl_ugv.cpp
Go to the documentation of this file.
1
5
6/*
7Copyright (C) 2002-2025 UFO: Alien Invasion.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24*/
25
26#include "../client.h"
27#include "cl_actor.h"
28
35bool CL_AddUGV (le_t* le, entity_t* ent)
36{
37 entity_t add(RF_NONE);
38
39 if (!LE_IsDead(le)) {
40 /* add weapon */
41 if (le->left != NONE) {
42 OBJZERO(add);
43
44 add.model = cls.modelPool[le->left];
45
46 add.tagent = R_GetFreeEntity() + 2 + (le->right != NONE);
47 add.tagname = "tag_lweapon";
48
49 R_AddEntity(&add);
50 }
51
52 /* add weapon */
53 if (le->right != NONE) {
54 OBJZERO(add);
55
56 add.alpha = le->alpha;
57 add.model = cls.modelPool[le->right];
58
59 add.tagent = R_GetFreeEntity() + 2;
60 add.tagname = "tag_rweapon";
61
62 R_AddEntity(&add);
63 }
64 }
65
66 /* add head */
67 OBJZERO(add);
68
69 add.alpha = le->alpha;
70 add.model = le->model2;
71 add.skinnum = le->bodySkin;
72
74 add.tagent = R_GetFreeEntity() + 1;
75 add.tagname = "tag_head";
76
77 R_AddEntity(&add);
78
79 /* add actor special effects */
80 ent->flags |= RF_SHADOW;
81 ent->flags |= RF_ACTOR;
82
83 if (!LE_IsDead(le)) {
84 if (LE_IsSelected(le))
85 ent->flags |= RF_SELECTED;
86 if (le->team == cls.team) {
87 if (le->pnum == cl.pnum)
88 ent->flags |= RF_MEMBER;
89 if (le->pnum != cl.pnum)
90 ent->flags |= RF_ALLIED;
91 }
92 if (le->team == TEAM_CIVILIAN)
93 ent->flags |= RF_NEUTRAL;
94 }
95
96 return true;
97}
clientBattleScape_t cl
#define LE_IsDead(le)
#define LE_IsSelected(le)
client_static_t cls
Definition cl_main.cpp:83
bool CL_AddUGV(le_t *le, entity_t *ent)
Adds an UGV to the render entities.
Definition cl_ugv.cpp:35
Primary header for client.
#define NONE
Definition defines.h:68
#define TEAM_CIVILIAN
Definition q_shared.h:61
int R_AddEntity(const entity_t *ent)
Adds a copy of the specified entity to the list of all known render entities.
Definition r_entity.cpp:706
entity_t * R_GetFreeEntity(void)
Get the next free entry in the entity list (the last one).
Definition r_entity.cpp:684
#define RF_SHADOW
Definition r_entity.h:50
#define RF_ACTOR
Definition r_entity.h:46
#define RF_MEMBER
Definition r_entity.h:44
#define RF_SELECTED
Definition r_entity.h:43
#define RF_ALLIED
Definition r_entity.h:45
#define RF_NONE
Definition r_entity.h:34
#define RF_NEUTRAL
Definition r_entity.h:49
#define OBJZERO(obj)
Definition shared.h:178
float alpha
Definition r_entity.h:111
int flags
Definition r_entity.h:112
struct model_s * model
Definition r_entity.h:97
const char * tagname
Definition r_entity.h:107
int skinnum
Definition r_entity.h:110
struct entity_s * tagent
Definition r_entity.h:106
a local entity
float alpha
model_t * model2
unsigned int bodySkin