UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cl_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 /* vertical cursor offset */
28 #define CURSOR_OFFSET UNIT_HEIGHT * 0.4
29 /* distance from vertical center of grid-point to head when standing */
30 #define EYE_HT_STAND UNIT_HEIGHT * 0.25
31 /* distance from vertical center of grid-point to head when crouched */
32 #define EYE_HT_CROUCH UNIT_HEIGHT * 0.06
33 
35 typedef enum {
40 
42 } walkType_t;
43 
44 extern le_t* selActor;
45 extern pos3_t truePos;
46 extern pos3_t mousePos;
47 
48 #define ACTOR_GET_FIELDSIZE(actor) ((actor != nullptr) ? (actor)->fieldSize : ACTOR_SIZE_NORMAL)
49 
50 void MSG_Write_PA(player_action_t player_action, int num, ...);
51 
52 void ACTOR_InitStartup(void);
53 
54 int CL_ActorCheckAction(const le_t* le);
55 void CL_ActorInvMove(const le_t* le, containerIndex_t fromContainer, int fromX, int fromY, containerIndex_t toContainer, int toX, int toY);
56 
58 character_t* CL_ActorGetChr(const le_t* le);
59 int CL_ActorUsableTUs(const le_t* le);
61 void CL_ActorReserveTUs(const le_t* le, reservation_types_t type, int tus);
62 bool CL_ActorIsReactionFireOutOfRange(const le_t* shooter, const le_t* target);
63 const fireDef_t* CL_ActorGetReactionFireFireDef(const le_t* shooter);
64 
65 int CL_ActorMoveMode(const le_t* le);
66 void CL_ActorSetMode(le_t* actor, actorModes_t actorMode);
69 le_t* CL_ActorGetClosest(const vec3_t origin, int team);
70 bool CL_ActorSelect(le_t* le);
71 bool CL_ActorSelectList(int num);
72 bool CL_ActorSelectNext(void);
73 bool CL_ActorSelectPrev(void);
74 void CL_ActorAddToTeamList(le_t* le);
76 void CL_ActorCleanup(le_t* le);
77 void CL_ActorSelectMouse(void);
78 void CL_ActorReload(le_t* le, containerIndex_t containerID);
79 void CL_ActorTurnMouse(void);
80 void CL_ActorStartMove(le_t* le, const pos3_t to);
81 void CL_ActorShoot(const le_t* le, const pos3_t at);
82 int CL_ActorGetContainerForReload(Item** ic, const Inventory* inv, const objDef_t* weapon);
83 void CL_ActorPlaySound(const le_t* le, actorSound_t soundType);
84 float CL_ActorInjuryModifier(const le_t* le, const modifier_types_t type);
85 int CL_ActorTimeForFireDef(const le_t* le, const fireDef_t* fd, bool reaction = false);
86 
87 void CL_ActorActionMouse(void);
88 void CL_ActorSetFireDef(le_t* actor, const fireDef_t* fd);
89 
90 void CL_NextRound_f(void);
91 
92 void CL_ResetMouseLastPos(void);
94 bool CL_ActorMouseTrace(void);
95 void CL_GetWorldCoordsUnderMouse(vec3_t groundIntersection, vec3_t upperTracePoint, vec3_t lowerTracePoint);
98 
99 bool CL_AddActor(le_t* le, entity_t* ent);
100 bool CL_AddUGV(le_t* le, entity_t* ent);
101 
102 int CL_ActorGetNumber(const le_t* le);
103 
104 void CL_AddTargeting(void);
105 void CL_AddPathing(void);
106 void CL_AddActorPathing(void);
107 void CL_ActorTargetAlign_f(void);
108 
109 void CL_DisplayFloorArrows(void);
110 void CL_DisplayObstructionArrows(void);
int CL_ActorMoveMode(const le_t *le)
Decide how the actor will walk, taking into account autostanding.
Definition: cl_actor.cpp:102
void CL_DisplayObstructionArrows(void)
Useful for debugging pathfinding.
Definition: cl_actor.cpp:2180
void CL_InitBattlescapeMouseDragging(void)
Scroll battlescape touchscreen-style, by clicking and dragging away.
Definition: cl_actor.cpp:1459
QGL_EXTERN GLint GLenum type
Definition: r_gl.h:94
bool CL_ActorFireModeActivated(const actorModes_t mode)
Checks whether we are in fire mode or node.
Definition: cl_actor.cpp:1066
void CL_ActorReload(le_t *le, containerIndex_t containerID)
Reload weapon with actor.
Definition: cl_actor.cpp:948
this is a fire definition for our weapons/ammo
Definition: inv_shared.h:110
void CL_DisplayFloorArrows(void)
Useful for debugging pathfinding.
Definition: cl_actor.cpp:2166
void CL_ActorInvMove(const le_t *le, containerIndex_t fromContainer, int fromX, int fromY, containerIndex_t toContainer, int toX, int toY)
Sends an inventory move event to the server.
Definition: cl_actor.cpp:1004
pos3_t truePos
Definition: cl_actor.cpp:50
void CL_BattlescapeMouseDragging(void)
Scroll battlescape touchscreen-style, by clicking and dragging away.
Definition: cl_actor.cpp:1467
bool CL_ActorIsReactionFireOutOfRange(const le_t *shooter, const le_t *target)
Definition: cl_actor.cpp:199
voidpf uLong int origin
Definition: ioapi.h:45
int CL_ActorGetContainerForReload(Item **ic, const Inventory *inv, const objDef_t *weapon)
Searches the clip with the least TU usage to put it into the weapon.
Definition: cl_actor.cpp:916
bool CL_ActorSelectNext(void)
selects the next actor
Definition: cl_actor.cpp:527
void CL_ActorStartMove(le_t *le, const pos3_t to)
Starts moving actor.
Definition: cl_actor.cpp:847
walkType_t
Definition: cl_actor.h:35
void CL_AddPathing(void)
Adds a pathing marker to the current floor when we render the world.
Definition: cl_actor.cpp:2089
int CL_ActorUsableTUs(const le_t *le)
Returns the amount of usable (overall-reserved) TUs for an actor.
Definition: cl_actor.cpp:259
Defines all attributes of objects used in the inventory.
Definition: inv_shared.h:264
void CL_ActorActionMouse(void)
initiates action with mouse.
Definition: cl_actor.cpp:1266
pos3_t mousePos
Definition: cl_actor.cpp:51
int CL_ActorCheckAction(const le_t *le)
Checks that an action is valid.
Definition: cl_actor.cpp:713
actorModes_t
Actor actions.
const fireDef_t * CL_ActorGetReactionFireFireDef(const le_t *shooter)
Definition: cl_actor.cpp:171
item instance data, with linked list capability
Definition: inv_shared.h:402
inventory definition with all its containers
Definition: inv_shared.h:525
void CL_NextRound_f(void)
character_t * CL_ActorGetChr(const le_t *le)
Returns the character information for an actor in the teamlist.
Definition: cl_actor.cpp:155
player_action_t
Definition: q_shared.h:189
reservation_types_t
Definition: chr_shared.h:197
bool CL_ActorSelectList(int num)
Selects an actor from a list.
Definition: cl_actor.cpp:506
void ACTOR_InitStartup(void)
Definition: cl_actor.cpp:2522
bool CL_ActorSelectPrev(void)
selects the previous actor
Definition: cl_actor.cpp:558
void CL_ActorShoot(const le_t *le, const pos3_t at)
Shoot with actor.
Definition: cl_actor.cpp:888
void CL_AddTargeting(void)
Adds a target cursor when we render the world.
Definition: cl_actor.cpp:1981
float CL_ActorInjuryModifier(const le_t *le, const modifier_types_t type)
Returns the actor injury modifier of the specified type.
Definition: cl_actor.cpp:299
pos_t pos3_t[3]
Definition: ufotypes.h:58
bool CL_AddActor(le_t *le, entity_t *ent)
Adds an actor to the render entities with all it's models and items.
Definition: cl_actor.cpp:1515
void CL_AddActorPathing(void)
Adds an actor pathing marker to the current floor when we render the world.
Definition: cl_actor.cpp:2109
void MSG_Write_PA(player_action_t player_action, int num,...)
Writes player action with its data.
Definition: cl_actor.cpp:73
bool CL_AddUGV(le_t *le, entity_t *ent)
Adds an UGV to the render entities.
Definition: cl_ugv.cpp:35
bool CL_ActorMouseTrace(void)
Battlescape cursor positioning.
Definition: cl_actor.cpp:1373
a local entity
int32_t containerIndex_t
Definition: inv_shared.h:46
void CL_ActorPlaySound(const le_t *le, actorSound_t soundType)
Plays various sounds on actor action.
Definition: cl_actor.cpp:2134
void CL_ActorAddToTeamList(le_t *le)
Adds the actor to the team list.
Definition: cl_actor.cpp:362
void CL_ActorSetMode(le_t *actor, actorModes_t actorMode)
Definition: cl_actor.cpp:835
int CL_ActorTimeForFireDef(const le_t *le, const fireDef_t *fd, bool reaction=false)
Find the TUs needed for the given fireDef taking into account the actor wound penalties.
Definition: cl_actor.cpp:342
void CL_ActorRemoveFromTeamList(le_t *le)
Removes an actor (from your team) from the team list.
Definition: cl_actor.cpp:400
modifier_types_t
Definition: chr_shared.h:244
void CL_ActorSetFireDef(le_t *actor, const fireDef_t *fd)
Definition: cl_actor.cpp:91
void CL_ResetMouseLastPos(void)
const char int mode
Definition: ioapi.h:41
void CL_ActorConditionalMoveCalc(le_t *le)
Recalculate forbidden list, available moves and actor's move length for the current selected actor...
Definition: cl_actor.cpp:682
bool CL_ActorSelect(le_t *le)
Selects an actor.
Definition: cl_actor.cpp:440
le_t * CL_ActorGetFromCharacter(const character_t *chr)
Returns the local entity information for a character in the team list.
Definition: cl_actor.cpp:141
le_t * selActor
Definition: cl_actor.cpp:49
void CL_GetWorldCoordsUnderMouse(vec3_t groundIntersection, vec3_t upperTracePoint, vec3_t lowerTracePoint)
Get battlescape cell position under mouse cursor.
Definition: cl_actor.cpp:1290
vec_t vec3_t[3]
Definition: ufotypes.h:39
void CL_ActorResetMoveLength(le_t *le)
Recalculates the currently selected Actor's move length.
Definition: cl_actor.cpp:764
void CL_ActorTargetAlign_f(void)
Targets to the ground when holding the assigned button.
Definition: cl_actor.cpp:1924
void CL_ActorTurnMouse(void)
Turns the actor around without moving.
Definition: cl_actor.cpp:1074
int CL_ActorGetNumber(const le_t *le)
Returns the number of the actor in the teamlist.
Definition: cl_actor.cpp:125
void CL_ActorCleanup(le_t *le)
Definition: cl_actor.cpp:389
actorSound_t
Types of actor sounds being issued by CL_ActorPlaySound().
Definition: chr_shared.h:207
le_t * CL_ActorGetClosest(const vec3_t origin, int team)
Returns the actor that is closest to the given origin.
Definition: cl_actor.cpp:694
void CL_ActorSelectMouse(void)
Selects an actor using the mouse.
Definition: cl_actor.cpp:1197
int CL_ActorReservedTUs(const le_t *le, reservation_types_t type)
Returns the amount of reserved TUs for a certain type.
Definition: cl_actor.cpp:214
void CL_ActorReserveTUs(const le_t *le, reservation_types_t type, int tus)
Replace the reserved TUs for a certain type.
Definition: cl_actor.cpp:273
Describes a character with all its attributes.
Definition: chr_shared.h:369