UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
g_actor.h
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 2002-2020 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 #pragma once
26 
27 #include "g_local.h"
28 
29 #define G_IsState(ent, s) ((ent)->state & (s))
30 #define G_IsStunned(ent) (G_IsState(ent, STATE_STUN) & ~STATE_DEAD)
31 #define G_IsPanicked(ent) G_IsState(ent, STATE_PANIC)
32 #define G_IsCrouched(ent) G_IsState(ent, STATE_CROUCHED)
33 
34 #define G_IsDead(ent) G_IsState(ent, STATE_DEAD)
35 
36 #define G_SetState(ent, s) (ent)->state |= (s)
37 #define G_SetStunned(ent) G_SetState((ent), STATE_STUN)
38 #define G_SetDead(ent) G_SetState((ent), STATE_DEAD)
39 #define G_SetCrouched(ent) G_SetState((ent), STATE_CROUCHED)
40 
41 #define G_ToggleState(ent, s) (ent)->state ^= (s)
42 #define G_ToggleCrouched(ent) G_ToggleState(ent, STATE_CROUCHED)
43 
44 bool G_IsLivingActor(const Edict* ent) __attribute__((nonnull));
45 void G_ActorUseDoor(Actor* actor, Edict* door);
46 void G_ActorSetClientAction(Edict* actor, Edict* ent);
47 int G_ActorUsableTUs(const Edict* ent);
48 int G_ActorGetTUForReactionFire(const Edict* ent);
49 void G_ActorReserveTUs(Edict* ent, int resReaction, int resShot, int resCrouch);
50 int G_ActorDoTurn(Edict* ent, byte dir);
51 void G_ActorSetMaxs(Actor* actor);
52 int G_ActorCalculateMaxTU(const Edict* ent);
53 void G_ActorGiveTimeUnits(Actor* actor);
54 void G_ActorSetTU(Edict* ent, int tus);
55 void G_ActorUseTU(Edict* ent, int tus);
56 void G_ActorModifyCounters(const Edict* attacker, const Edict* victim, int deltaAlive, int deltaKills, int deltaStuns);
57 void G_ActorGetEyeVector(const Edict* actor, vec3_t eye);
58 void G_ActorCheckRevitalise(Actor* actor);
59 bool G_ActorDieOrStun(Actor* actor, Edict* attacker);
61 bool G_ActorInvMove(Actor* actor, const invDef_t* from, Item* fItem, const invDef_t* to, int tx, int ty, bool checkaction);
62 bool G_ActorReload(Actor* actor, const invDef_t* invDef);
63 int G_ActorGetModifiedTimeForFiredef(const Edict* ent, const fireDef_t* const fd, bool reaction);
void G_ActorSetTU(Edict *ent, int tus)
Definition: g_actor.cpp:267
bool G_IsLivingActor(const Edict *ent) __attribute__((nonnull))
Checks whether the given edict is a living actor.
Definition: g_actor.cpp:43
void G_ActorCheckRevitalise(Actor *actor)
Definition: g_actor.cpp:386
this is a fire definition for our weapons/ammo
Definition: inv_shared.h:110
void G_ActorUseTU(Edict *ent, int tus)
Definition: g_actor.cpp:278
voidpf uLong int origin
Definition: ioapi.h:45
bool G_ActorReload(Actor *actor, const invDef_t *invDef)
Reload weapon with actor.
Definition: g_actor.cpp:714
int G_ActorGetModifiedTimeForFiredef(const Edict *ent, const fireDef_t *const fd, bool reaction)
Definition: g_actor.cpp:764
#define __attribute__(x)
Definition: cxx.h:37
void G_ActorGiveTimeUnits(Actor *actor)
Set time units for the given edict. Based on speed skills.
Definition: g_actor.cpp:260
void G_ActorReserveTUs(Edict *ent, int resReaction, int resShot, int resCrouch)
Reserves TUs for different actor actions.
Definition: g_actor.cpp:136
int G_ActorGetTUForReactionFire(const Edict *ent)
Calculates the amount of TUs that are needed for the current selected reaction fire mode...
Definition: g_actor.cpp:116
void G_ActorModifyCounters(const Edict *attacker, const Edict *victim, int deltaAlive, int deltaKills, int deltaStuns)
Definition: g_actor.cpp:299
item instance data, with linked list capability
Definition: inv_shared.h:402
void G_ActorUseDoor(Actor *actor, Edict *door)
Make the actor use (as in open/close) a door edict.
Definition: g_actor.cpp:55
int G_ActorUsableTUs(const Edict *ent)
Calculates the amount of usable TUs. This is without the reserved TUs.
Definition: g_actor.cpp:102
An Edict of type Actor.
Definition: g_edict.h:348
int G_ActorCalculateMaxTU(const Edict *ent)
Definition: g_actor.cpp:247
Local definitions for game module.
bool G_ActorInvMove(Actor *actor, const invDef_t *from, Item *fItem, const invDef_t *to, int tx, int ty, bool checkaction)
Moves an item inside an inventory. Floors are handled special.
Definition: g_actor.cpp:506
vec_t vec3_t[3]
Definition: ufotypes.h:39
inventory definition for our menus
Definition: inv_shared.h:371
void G_ActorGetEyeVector(const Edict *actor, vec3_t eye)
Fills a vector with the eye position of a given actor.
Definition: g_actor.cpp:357
void G_ActorSetClientAction(Edict *actor, Edict *ent)
Handles the client actions (interaction with the world)
Definition: g_actor.cpp:82
void G_ActorSetMaxs(Actor *actor)
Sets correct bounding box for actor (state dependent).
Definition: g_actor.cpp:226
bool G_ActorDieOrStun(Actor *actor, Edict *attacker)
Reports and handles death or stun of an actor. If the HP of an actor is zero the actor will die...
Definition: g_actor.cpp:435
Definition: g_edict.h:45
uint8_t byte
Definition: ufotypes.h:34
int G_ActorGetContentFlags(const vec3_t origin)
Get the content flags from where the actor is currently standing.
Definition: g_actor.cpp:484
int G_ActorDoTurn(Edict *ent, byte dir)
Turns an actor around.
Definition: g_actor.cpp:154