UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
g_utils.h
Go to the documentation of this file.
1 
6 /*
7 All original material Copyright (C) 2002-2020 UFO: Alien Invasion.
8 
9 Original file from Quake 2 v3.21: quake2-2.31/game/g_utils.c
10 Copyright (C) 1997-2001 Id Software, Inc.
11 
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License
14 as published by the Free Software Foundation; either version 2
15 of the License, or (at your option) any later version.
16 
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 
21 See the GNU General Public License for more details.
22 
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 
27 */
28 
29 #pragma once
30 
31 #include "g_local.h"
32 
33 void G_FreeEdict(Edict* e);
35 Edict* G_GetEdictFromPosExcluding(const pos3_t pos, const int n, ...);
36 bool G_UseEdict(Edict* ent, Edict* activator);
37 const char* G_GetWeaponNameForFiredef(const fireDef_t* fd);
38 Player* G_GetPlayerForTeam(int team);
39 void G_TakeDamage(Edict* ent, int damage);
40 bool G_TestLineWithEnts(const vec3_t start, const vec3_t end);
41 bool G_TestLine(const vec3_t start, const vec3_t end);
42 trace_t G_Trace(const Line& trLine, const Edict* passent, int contentmask);
43 const char* G_GetPlayerName(int pnum);
44 void G_PrintStats(const char* format, ...) __attribute__((format(__printf__, 1, 2)));
45 void G_PrintActorStats(const Edict* victim, const Edict* attacker, const fireDef_t* fd);
46 Edict* G_FindRadius(Edict* from, const vec3_t org, float rad, entity_type_t type = ET_NULL);
47 playermask_t G_GetClosePlayerMask(const vec3_t origin, float radius);
48 void G_GenerateEntList(const char* entList[MAX_EDICTS]);
49 void G_RecalcRouting(const char* model, const GridBox& box);
50 void G_CompleteRecalcRouting(void);
51 int G_TouchTriggers(Edict* ent, const entity_type_t type = ET_NULL);
52 int G_TouchSolids(Edict* ent, float extend);
53 void G_TouchEdicts(Edict* ent, float extend);
54 uint32_t G_GetLevelFlagsFromPos(const pos3_t pos);
void G_PrintStats(const char *format,...) __attribute__((format(__printf__
bool G_UseEdict(Edict *ent, Edict *activator)
Call the 'use' function for the given edict and all its group members.
Definition: g_utils.cpp:117
QGL_EXTERN GLint GLenum type
Definition: r_gl.h:94
this is a fire definition for our weapons/ammo
Definition: inv_shared.h:110
const char * G_GetWeaponNameForFiredef(const fireDef_t *fd)
Returns the corresponding weapon name for a given fire definition.
Definition: g_utils.cpp:173
voidpf uLong int origin
Definition: ioapi.h:45
void G_GenerateEntList(const char *entList[MAX_EDICTS])
creates an entity list
Definition: g_utils.cpp:436
unsigned int playermask_t
Definition: g_events.h:34
const char * G_GetPlayerName(int pnum)
Returns the player name for a give player number.
Definition: g_utils.cpp:275
Player * G_GetPlayerForTeam(int team)
Gets player for given team.
Definition: g_utils.cpp:188
int G_TouchTriggers(Edict *ent, const entity_type_t type=ET_NULL)
Check the world against triggers for the current entity.
Definition: g_utils.cpp:547
void void G_PrintActorStats(const Edict *victim, const Edict *attacker, const fireDef_t *fd)
Prints stats about who killed who with what and how.
Definition: g_utils.cpp:336
#define __attribute__(x)
Definition: cxx.h:37
Edict * G_FindRadius(Edict *from, const vec3_t org, float rad, entity_type_t type=ET_NULL)
Returns entities that have origins within a spherical area.
Definition: g_utils.cpp:408
int G_TouchSolids(Edict *ent, float extend)
Call after making a step to a new grid tile to immediately touch edicts whose bbox intersects with th...
Definition: g_utils.cpp:590
void G_FreeEdict(Edict *e)
Marks the edict as free.
Definition: g_utils.cpp:41
bool G_TestLine(const vec3_t start, const vec3_t end)
fast version of a line trace but without including entities
Definition: g_utils.cpp:253
Definition: line.h:31
pos_t pos3_t[3]
Definition: ufotypes.h:58
void G_TouchEdicts(Edict *ent, float extend)
Call after linking a new trigger in or destroying a bmodel during gameplay to force all entities it c...
Definition: g_utils.cpp:625
trace_t G_Trace(const Line &trLine, const Edict *passent, int contentmask)
collision detection - this version is more accurate and includes entity tests
Definition: g_utils.cpp:265
Local definitions for game module.
uint32_t G_GetLevelFlagsFromPos(const pos3_t pos)
Calculates the level flags for a given grid position.
Definition: g_utils.cpp:650
playermask_t G_GetClosePlayerMask(const vec3_t origin, float radius)
Assembles a player mask for those players that have a living team member close to the given location...
Definition: g_utils.cpp:288
void G_RecalcRouting(const char *model, const GridBox &box)
Definition: g_utils.cpp:452
Edict * G_GetEdictFromPosExcluding(const pos3_t pos, const int n,...)
Searches an edict that is not of the given types at the given grid location.
Definition: g_utils.cpp:81
vec_t vec3_t[3]
Definition: ufotypes.h:39
entity_type_t
Definition: q_shared.h:145
Edict * G_GetEdictFromPos(const pos3_t pos, const entity_type_t type)
Searches an edict of the given type at the given grid location.
Definition: g_utils.cpp:59
void G_CompleteRecalcRouting(void)
Definition: g_utils.cpp:464
Definition: g_edict.h:45
void G_TakeDamage(Edict *ent, int damage)
Applies the given damage value to an edict that is either an actor or has the FL_DESTROYABLE flag set...
Definition: g_utils.cpp:215
bool G_TestLineWithEnts(const vec3_t start, const vec3_t end)
fast version of a line trace including entities
Definition: g_utils.cpp:237
void format(__printf__, 1, 2)))
#define MAX_EDICTS
Definition: defines.h:99