UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cl_ugv.cpp
Go to the documentation of this file.
1 
6 /*
7 Copyright (C) 2002-2020 UFO: Alien Invasion.
8 
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 
18 See the GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 
24 */
25 
26 #include "../client.h"
27 #include "cl_actor.h"
28 
35 bool 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 }
bool CL_AddUGV(le_t *le, entity_t *ent)
Adds an UGV to the render entities.
Definition: cl_ugv.cpp:35
int pnum
float alpha
#define RF_MEMBER
Definition: r_entity.h:44
#define TEAM_CIVILIAN
Definition: q_shared.h:61
client_static_t cls
Definition: cl_main.cpp:83
int right
model_t * modelPool[MAX_OBJDEFS]
Definition: client.h:96
#define OBJZERO(obj)
Definition: shared.h:178
entity_t * R_GetFreeEntity(void)
Get the next free entry in the entity list (the last one)
Definition: r_entity.cpp:684
#define RF_SELECTED
Definition: r_entity.h:43
#define LE_IsSelected(le)
clientBattleScape_t cl
#define RF_NEUTRAL
Definition: r_entity.h:49
#define RF_NONE
Definition: r_entity.h:34
model_t * model2
#define RF_ALLIED
Definition: r_entity.h:45
unsigned int bodySkin
a local entity
#define LE_IsDead(le)
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
#define NONE
Definition: defines.h:68
#define RF_SHADOW
Definition: r_entity.h:50
int team
#define RF_ACTOR
Definition: r_entity.h:46
int left