g_local.h

Go to the documentation of this file.
00001 
00006 /*
00007 All original material Copyright (C) 2002-2010 UFO: Alien Invasion.
00008 
00009 Original file from Quake 2 v3.21: quake2-2.31/game/g_local.h
00010 Copyright (C) 1997-2001 Id Software, Inc.
00011 
00012 This program is free software; you can redistribute it and/or
00013 modify it under the terms of the GNU General Public License
00014 as published by the Free Software Foundation; either version 2
00015 of the License, or (at your option) any later version.
00016 
00017 This program is distributed in the hope that it will be useful,
00018 but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00020 
00021 See the GNU General Public License for more details.
00022 
00023 You should have received a copy of the GNU General Public License
00024 along with this program; if not, write to the Free Software
00025 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00026 
00027 */
00028 
00029 #ifndef GAME_G_LOCAL_H
00030 #define GAME_G_LOCAL_H
00031 
00032 #include "q_shared.h"
00033 #include "inventory.h"
00034 #include "../shared/infostring.h"
00035 #include "lua/lua.h"
00036 
00038 #define _(String) String
00039 #define ngettext(x, y, cnt) x
00040 
00044 #define GAME_INCLUDE
00045 #include "game.h"
00046 
00048 #define GAMEVERSION "baseufo"
00049 
00050 #define MAX_SPOT_DIST   4096 /* 768 */
00051 
00055 #define PM_ALL          0xFFFFFFFF
00056 
00059 #define TEAM_ALL        0xFFFFFFFF
00060 
00061 #define G_PlayerToPM(player) ((player)->num < game.sv_maxplayersperteam ? 1 << ((player)->num) : 0)
00062 
00064 #define SERVER_FRAME_SECONDS        0.1
00065 
00067 #define TAG_GAME    765         /* clear when unloading the game library */
00068 #define TAG_LEVEL   766         /* clear when loading a new level */
00069 
00071 #define CONTAINER(e, containerID) ((e)->chr.i.c[(containerID)])
00072 #define ARMOUR(e) (CONTAINER(e, gi.csi->idArmour))
00073 #define RIGHT(e) (CONTAINER(e, gi.csi->idRight))
00074 #define LEFT(e)  (CONTAINER(e, gi.csi->idLeft))
00075 #define EXTENSION(e)  (CONTAINER(e, gi.csi->idExtension))
00076 #define HEADGEAR(e)  (CONTAINER(e, gi.csi->idHeadgear))
00077 #define FLOOR(e) (CONTAINER(e, gi.csi->idFloor))
00078 
00079 #define INVDEF(containerID) (&gi.csi->ids[(containerID)])
00080 
00082 #define ACTOR_VIS_100   1.0
00083 #define ACTOR_VIS_50    0.5
00084 #define ACTOR_VIS_10    0.1
00085 #define ACTOR_VIS_0     0.0
00086 
00087 #define G_FreeTags(tag) gi.FreeTags((tag), __FILE__, __LINE__)
00088 #define G_TagMalloc(size, tag) gi.TagMalloc((size), (tag), __FILE__, __LINE__)
00089 #define G_MemFree(ptr) gi.TagFree((ptr), __FILE__, __LINE__)
00090 
00091 #define G_PLAYER_FROM_ENT(ent) (game.players + (ent)->pnum)
00092 
00095 typedef struct {
00096     player_t *players;          /* [maxplayers] */
00097 
00098     /* store latched cvars here that we want to get at often */
00099     int sv_maxplayersperteam;
00100     int sv_maxentities;
00101 
00102     inventoryInterface_t i;
00103 } game_locals_t;
00104 
00106 typedef struct {
00107     int framenum;       
00108     float time;         
00111     char mapname[MAX_QPATH];    
00112     char nextmap[MAX_QPATH];    
00113     qboolean routed;
00114     qboolean day;
00115     qboolean hurtAliens;
00116 
00117     /* intermission state */
00118     float intermissionTime;     
00121     int winningTeam;            
00122     float roundstartTime;       
00124     /* round statistics */
00125     int numplayers;
00126     int activeTeam;
00127     int nextEndRound;
00128     int actualRound;    
00130     pathing_t pathingMap;   
00132     int randomSpawn;    
00134     byte num_alive[MAX_TEAMS];      
00135     byte num_spawned[MAX_TEAMS];    
00136     byte num_spawnpoints[MAX_TEAMS];    
00137     byte num_2x2spawnpoints[MAX_TEAMS]; 
00138     byte num_kills[MAX_TEAMS][MAX_TEAMS];   
00139     byte num_stuns[MAX_TEAMS][MAX_TEAMS];   
00140 } level_locals_t;
00141 
00142 
00147 typedef struct {
00148     /* world vars */
00149     char *nextmap;  
00150     int randomSpawn;    
00151 } spawn_temp_t;
00152 
00154 typedef struct {
00155     int enemyCount;         
00156     int friendCount;        
00157     int civilian;           
00158     int self;               
00159     int damage;
00160     qboolean allow_self;
00161 } shot_mock_t;
00162 
00163 extern game_locals_t game;
00164 extern level_locals_t level;
00165 extern game_import_t gi;
00166 extern game_export_t globals;
00167 
00168 #define random()    ((rand() & 0x7fff) / ((float)0x7fff))
00169 #define crandom()   (2.0 * (random() - 0.5))
00170 
00171 #define G_IsState(ent, s)       ((ent)->state & (s))
00172 #define G_IsShaken(ent)         G_IsState(ent, STATE_SHAKEN)
00173 #define G_IsStunned(ent)        (G_IsState(ent, STATE_STUN) & ~STATE_DEAD)
00174 #define G_IsPaniced(ent)        G_IsState(ent, STATE_PANIC)
00175 #define G_IsReaction(ent)       G_IsState(ent, STATE_REACTION)
00176 #define G_IsRaged(ent)          G_IsState(ent, STATE_RAGE)
00177 #define G_IsInsane(ent)         G_IsState(ent, STATE_INSANE)
00178 #define G_IsDazed(ent)          G_IsState(ent, STATE_DAZED)
00179 #define G_IsCrouched(ent)       G_IsState(ent, STATE_CROUCHED)
00180 
00181 #define G_IsDead(ent)           G_IsState(ent, STATE_DEAD)
00182 #define G_IsActor(ent)          ((ent)->type == ET_ACTOR || (ent)->type == ET_ACTOR2x2)
00183 #define G_IsBreakable(ent)      ((ent)->flags & FL_DESTROYABLE)
00184 #define G_IsBrushModel(ent)     ((ent)->type == ET_BREAKABLE || (ent)->type == ET_DOOR)
00185 
00186 #define G_IsVisibleOnBattlefield(ent)   (G_IsActor((ent)) || (ent)->type == ET_ITEM || (ent)->type == ET_PARTICLE)
00187 #define G_IsAI(ent)             (G_PLAYER_FROM_ENT((ent))->pers.ai)
00188 #define G_IsAIPlayer(player)    ((player)->pers.ai)
00189 #define G_TeamToVisMask(team)   (1 << (team))
00190 #define G_IsVisibleForTeam(ent, team) ((ent)->visflags & G_TeamToVisMask(team))
00191 
00192 #define G_IsCivilian(ent)       ((ent)->team == TEAM_CIVILIAN)
00193 #define G_IsAlien(ent)          ((ent)->team == TEAM_ALIEN)
00194 #define G_IsBlockingMovementActor(ent)  (((ent)->type == ET_ACTOR && !G_IsDead(ent)) || ent->type == ET_ACTOR2x2)
00195 
00196 #define G_ToggleState(ent, s)   (ent)->state ^= (s)
00197 #define G_ToggleCrouched(ent)   G_ToggleState(ent, STATE_CROUCHED)
00198 
00199 #define G_SetState(ent, s)      (ent)->state |= (s)
00200 #define G_SetShaken(ent)        G_SetState((ent), STATE_SHAKEN)
00201 #define G_SetDazed(ent)         G_SetState((ent), STATE_DAZED)
00202 #define G_SetStunned(ent)       G_SetState((ent), STATE_STUN)
00203 #define G_SetDead(ent)          G_SetState((ent), STATE_DEAD)
00204 #define G_SetInsane(ent)        G_SetState((ent), STATE_INSANE)
00205 #define G_SetRage(ent)          G_SetState((ent), STATE_RAGE)
00206 #define G_SetPanic(ent)         G_SetState((ent), STATE_PANIC)
00207 #define G_SetCrouched(ent)      G_SetState((ent), STATE_CROUCHED)
00208 
00209 #define G_RemoveState(ent, s)   (ent)->state &= ~(s)
00210 #define G_RemoveShaken(ent)     G_RemoveState((ent), STATE_SHAKEN)
00211 #define G_RemoveDazed(ent)      G_RemoveState((ent), STATE_DAZED)
00212 #define G_RemoveStunned(ent)    G_RemoveState((ent), STATE_STUN)
00213 #define G_RemoveDead(ent)       G_RemoveState((ent), STATE_DEAD)
00214 #define G_RemoveInsane(ent)     G_RemoveState((ent), STATE_INSANE)
00215 #define G_RemoveRage(ent)       G_RemoveState((ent), STATE_RAGE)
00216 #define G_RemovePanic(ent)      G_RemoveState((ent), STATE_PANIC)
00217 #define G_RemoveCrouched(ent)   G_RemoveState((ent), STATE_CROUCHED)
00218 #define G_RemoveReaction(ent)   G_RemoveState((ent), STATE_REACTION)
00219 
00220 extern cvar_t *sv_maxentities;
00221 extern cvar_t *password;
00222 extern cvar_t *sv_needpass;
00223 extern cvar_t *sv_dedicated;
00224 
00225 extern cvar_t *logstats;
00226 extern FILE *logstatsfile;
00227 
00228 extern cvar_t *sv_filterban;
00229 
00230 extern cvar_t *sv_maxvelocity;
00231 
00232 extern cvar_t *sv_maxclients;
00233 extern cvar_t *sv_shot_origin;
00234 extern cvar_t *sv_hurtaliens;
00235 extern cvar_t *sv_maxplayersperteam;
00236 extern cvar_t *sv_maxsoldiersperteam;
00237 extern cvar_t *sv_maxsoldiersperplayer;
00238 extern cvar_t *sv_enablemorale;
00239 extern cvar_t *sv_roundtimelimit;
00240 
00241 extern cvar_t *sv_maxteams;
00242 
00243 extern cvar_t *sv_ai;
00244 extern cvar_t *sv_teamplay;
00245 
00246 extern cvar_t *ai_alien;
00247 extern cvar_t *ai_civilian;
00248 extern cvar_t *ai_equipment;
00249 extern cvar_t *ai_numaliens;
00250 extern cvar_t *ai_numcivilians;
00251 extern cvar_t *ai_numactors;
00252 
00253 extern cvar_t *mob_death;
00254 extern cvar_t *mob_wound;
00255 extern cvar_t *mof_watching;
00256 extern cvar_t *mof_teamkill;
00257 extern cvar_t *mof_civilian;
00258 extern cvar_t *mof_enemy;
00259 extern cvar_t *mor_pain;
00260 
00261 /*everyone gets this times morale damage */
00262 extern cvar_t *mor_default;
00263 
00264 /* at this distance the following two get halfed (exponential scale) */
00265 extern cvar_t *mor_distance;
00266 
00267 /* at this distance the following two get halfed (exponential scale) */
00268 extern cvar_t *mor_victim;
00269 
00270 /* at this distance the following two get halfed (exponential scale) */
00271 extern cvar_t *mor_attacker;
00272 
00273 /* how much the morale depends on the size of the damaged team */
00274 extern cvar_t *mon_teamfactor;
00275 
00276 extern cvar_t *mor_regeneration;
00277 extern cvar_t *mor_shaken;
00278 extern cvar_t *mor_panic;
00279 extern cvar_t *mor_brave;
00280 
00281 extern cvar_t *m_sanity;
00282 extern cvar_t *m_rage;
00283 extern cvar_t *m_rage_stop;
00284 extern cvar_t *m_panic_stop;
00285 
00286 extern cvar_t *g_reaction_fair;
00287 extern cvar_t *g_ailua;
00288 extern cvar_t *g_aidebug;
00289 extern cvar_t *g_drawtraces;
00290 extern cvar_t *g_nodamage;
00291 extern cvar_t *g_notu;
00292 extern cvar_t *g_nospawn;
00293 extern cvar_t *g_actorspeed;
00294 
00295 extern cvar_t *flood_msgs;
00296 extern cvar_t *flood_persecond;
00297 extern cvar_t *flood_waitdelay;
00298 
00299 extern cvar_t *difficulty;
00300 
00301 /* fields are needed for spawning from the entity string */
00302 #define FFL_SPAWNTEMP       1
00303 #define FFL_NOSPAWN         2
00304 
00305 /* g_stats.c */
00306 void G_SendPlayerStats(const player_t *player);
00307 
00308 /* g_inventory.c */
00309 void G_WriteItem(const item_t *item, const invDef_t *container, int x, int y);
00310 void G_ReadItem(item_t *item, invDef_t **container, int *x, int *y);
00311 void G_InventoryToFloor(edict_t *ent);
00312 qboolean G_AddItemToFloor(const pos3_t pos, const char *itemID);
00313 edict_t *G_GetFloorItemsFromPos(const pos3_t pos);
00314 
00315 /* g_morale */
00316 void G_MoraleBehaviour(int team);
00317 
00318 /* g_phys.c */
00319 void G_PhysicsRun(void);
00320 void G_PhysicsStep(edict_t *ent);
00321 
00322 /* g_actor.c */
00323 void G_ActorReserveTUs(edict_t *ent, int resReaction, int resShot, int resCrouch);
00324 int G_ActorGetTUForReactionFire(const edict_t *ent);
00325 int G_ActorUsableTUs(const edict_t *ent);
00326 int G_ActorGetReservedTUs(const edict_t *ent);
00327 void G_ActorCheckRevitalise(edict_t *ent);
00328 
00329 /* g_mission.c */
00330 qboolean G_MissionTouch(edict_t *self, edict_t *activator);
00331 qboolean G_MissionUse(edict_t *self, edict_t *activator);
00332 qboolean G_MissionDestroy(edict_t *self);
00333 void G_MissionThink(edict_t *self);
00334 
00335 /* g_utils.c */
00336 edict_t *G_Find(edict_t *from, int fieldofs, char *match);
00337 edict_t *G_FindRadius(edict_t *from, const vec3_t org, float rad, entity_type_t type);
00338 edict_t *G_FindTargetEntity(const char *target);
00339 const char* G_GetPlayerName(int pnum);
00340 player_t* G_GetPlayerForTeam(int team);
00341 int G_GetActiveTeam(void);
00342 const char* G_GetWeaponNameForFiredef(const fireDef_t *fd);
00343 void G_PrintActorStats(const edict_t *victim, const edict_t *attacker, const fireDef_t *fd);
00344 void G_PrintStats(const char *buffer);
00345 int G_TouchTriggers(edict_t *ent);
00346 void G_TouchSolids(edict_t *ent);
00347 void G_TouchEdicts(edict_t *ent, float extend);
00348 edict_t *G_Spawn(void);
00349 edict_t *G_SpawnParticle(const vec3_t origin, int spawnflags, const char *particle);
00350 void G_FreeEdict(edict_t *e);
00351 qboolean G_UseEdict(edict_t *ent, edict_t* activator);
00352 edict_t *G_GetEdictFromPos(const pos3_t pos, const entity_type_t type);
00353 void G_TakeDamage(edict_t *ent, int damage);
00354 trace_t G_Trace(const vec3_t start, const vec3_t end, const edict_t * passent, int contentmask);
00355 qboolean G_TestLineWithEnts(const vec3_t start, const vec3_t end);
00356 qboolean G_TestLine(const vec3_t start, const vec3_t end);
00357 
00358 /* g_reaction.c */
00359 void G_ReactionFirePreShot(const edict_t *target, const int fdTime);
00360 void G_ReactionFirePostShot(edict_t *target);
00361 void G_ReactionFireReset(int team);
00362 qboolean G_ReactionFireCanBeEnabled(const edict_t *ent);
00363 qboolean G_ReactionFireSetDefault(edict_t *ent);
00364 void G_ReactionFireUpdate(edict_t *ent, fireDefIndex_t fmIdx, actorHands_t hand, const objDef_t *od);
00365 qboolean G_ReactionFireOnMovement(edict_t *target);
00366 void G_ReactionFireEndTurn(void);
00367 
00368 void G_CompleteRecalcRouting(void);
00369 void G_RecalcRouting(const edict_t * ent);
00370 void G_GenerateEntList(const char *entList[MAX_EDICTS]);
00371 
00372 /* g_events.c */
00373 void G_EventSpawnSound(const edict_t* ent, const vec3_t origin, const char *sound);
00374 void G_EventActorTurn(const edict_t* ent);
00375 void G_EventActorFall(const edict_t* ent);
00376 void G_EventActorDie(const edict_t* ent);
00377 void G_EventActorRevitalise(const edict_t* ent);
00378 void G_EventActorSendReservations(const edict_t *ent);
00379 void G_EventInventoryDelete(const edict_t* ent, int playerMask, const invDef_t* invDef, int x, int y);
00380 void G_EventInventoryAdd(const edict_t* ent, int playerMask, int itemAmount);
00381 void G_EventPerish(const edict_t* ent);
00382 void G_EventDestroyEdict(const edict_t* ent);
00383 void G_EventInventoryAmmo(const edict_t* ent, const objDef_t* ammo, int amount, shoot_types_t shootType);
00384 void G_EventStartShoot(const edict_t* ent, int visMask, shoot_types_t shootType, const pos3_t at);
00385 void G_EventShootHidden(int visMask, const fireDef_t* fd, qboolean firstShoot);
00386 void G_EventShoot(const edict_t* ent, int visMask, const fireDef_t* fd, qboolean firstShoot, shoot_types_t shootType, int flags, const trace_t* trace, const vec3_t from, const vec3_t impact);
00387 void G_EventSetClientAction(const edict_t *ent);
00388 void G_EventResetClientAction(const edict_t* ent);
00389 void G_EventActorStats(const edict_t* ent);
00390 void G_EventEndRound(void);
00391 void G_EventInventoryReload(const edict_t* ent, int playerMask, const item_t* item, const invDef_t* invDef, const invList_t* ic);
00392 void G_EventThrow(int visMask, const fireDef_t *fd, float dt, byte flags, const vec3_t position, const vec3_t velocity);
00393 void G_EventReactionFireChange(const edict_t* ent);
00394 void G_EventParticleSpawn(int playerMask, const char *name, int levelFlags, const vec3_t s, const vec3_t v, const vec3_t a);
00395 void G_EventSendEdict(const edict_t *ent);
00396 
00397 /* g_vis.c */
00398 #define VIS_APPEAR  1
00399 #define VIS_PERISH  2
00400 
00402 #define VIS_CHANGE  1
00403 
00404 #define VIS_YES     2
00405 
00406 #define VIS_STOP    4
00407 
00408 /* g_client.c */
00411 #define VT_PERISH       1
00412 
00413 #define VT_NOFRUSTUM    2
00414 
00415 #define MORALE_RANDOM( mod )    ( (mod) * (1.0 + 0.3*crand()) )
00416 
00417 #define MAX_DVTAB 32
00418 
00419 edict_t* G_ClientGetFreeSpawnPointForActorSize(const player_t *player, const actorSizeEnum_t actorSize);
00420 qboolean G_ClientUseEdict(const player_t *player, edict_t *actor, edict_t *door);
00421 qboolean G_ActionCheckForCurrentTeam(const player_t *player, edict_t *ent, int TU);
00422 qboolean G_ActionCheckWithoutTeam(const player_t *player, edict_t *ent, int TU);
00423 void G_SendStats(edict_t *ent) __attribute__((nonnull));
00424 edict_t *G_SpawnFloor(const pos3_t pos);
00425 int G_CheckVisTeam(const int team, edict_t *check, qboolean perish, const edict_t *ent);
00426 int G_CheckVisTeamAll(const int team, qboolean perish, const edict_t *ent);
00427 edict_t *G_GetFloorItems(edict_t *ent) __attribute__((nonnull));
00428 qboolean G_InventoryRemoveItemByID(const char *itemID, edict_t *ent, containerIndex_t index);
00429 void G_SendState(unsigned int playerMask, const edict_t *ent);
00430 void G_SetTeamForPlayer(player_t* player, const int team);
00431 void G_CenterView(const edict_t *ent);
00432 
00433 qboolean G_ActorIsInRescueZone(const edict_t* actor);
00434 void G_ActorSetInRescueZone(edict_t* actor, qboolean inRescueZone);
00435 void G_ActorUseDoor(edict_t *actor, edict_t *door);
00436 qboolean G_IsLivingActor(const edict_t *ent) __attribute__((nonnull));
00437 void G_ActorSetClientAction(edict_t *actor, edict_t *ent);
00438 edict_t *G_ActorGetByUCN(const int ucn, const int team);
00439 void G_CheckForceEndRound(void);
00440 void G_ActorDieOrStun(edict_t *ent, edict_t *attacker);
00441 void G_ActorSetMaxs(edict_t* ent);
00442 void G_ActorGiveTimeUnits(edict_t *ent);
00443 void G_ActorSetTU(edict_t *ent, int tus);
00444 void G_ActorUseTU(edict_t *ent, int tus);
00445 int G_ClientAction(player_t * player);
00446 void G_ClientEndRound(player_t * player);
00447 void G_ClientTeamInfo(const player_t * player);
00448 void G_ClientInitActorStates(const player_t * player);
00449 int G_ClientGetTeamNum(const player_t * player);
00450 int G_ClientGetTeamNumPref(const player_t * player);
00451 qboolean G_ClientIsReady(const player_t * player);
00452 void G_ClientPrintf(const player_t * player, int printlevel, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
00453 void G_ResetClientData(void);
00454 
00455 void G_ClientCommand(player_t * player);
00456 void G_ClientUserinfoChanged(player_t * player, char *userinfo);
00457 qboolean G_ClientBegin(player_t * player);
00458 void G_ClientSpawn(player_t * player);
00459 qboolean G_ClientConnect(player_t * player, char *userinfo, size_t userinfoSize);
00460 void G_ClientDisconnect(player_t * player);
00461 
00462 void G_ActorReload(edict_t* ent, const invDef_t *invDef);
00463 qboolean G_ClientCanReload(edict_t *ent, containerIndex_t containerID);
00464 void G_ClientGetWeaponFromInventory(edict_t *ent);
00465 void G_ClientMove(const player_t * player, int visTeam, edict_t* ent, const pos3_t to);
00466 void G_ActorFall(edict_t *ent);
00467 void G_MoveCalc(int team, const edict_t *movingActor, const pos3_t from, byte crouchingState, int distance);
00468 void G_MoveCalcLocal(pathing_t *pt, int team, const edict_t *movingActor, const pos3_t from, byte crouchingState, int distance);
00469 void G_ActorInvMove(edict_t *ent, const invDef_t * from, invList_t *fItem, const invDef_t * to, int tx, int ty, qboolean checkaction);
00470 void G_ClientStateChange(const player_t* player, edict_t* ent, int reqState, qboolean checkaction);
00471 int G_ActorDoTurn(edict_t * ent, byte dir);
00472 
00473 edict_t *G_GetActorFromPos(const pos3_t pos);
00474 
00475 void G_SendInvisible(player_t *player);
00476 void G_GiveTimeUnits(int team);
00477 
00478 void G_AppearPerishEvent(unsigned int player_mask, qboolean appear, edict_t * check, const edict_t *ent);
00479 unsigned int G_VisToPM(unsigned int vis_mask);
00480 void G_SendInventory(unsigned int player_mask, const edict_t * ent);
00481 unsigned int G_TeamToPM(int team);
00482 
00483 void G_SpawnEntities(const char *mapname, qboolean day, const char *entities);
00484 qboolean G_RunFrame(void);
00485 
00486 #ifdef DEBUG
00487 void G_InvList_f(const player_t *player);
00488 #endif
00489 
00490 /* g_vis.c */
00491 qboolean G_FrustumVis(const edict_t *from, const vec3_t point);
00492 float G_ActorVis(const vec3_t from, const edict_t *check, qboolean full);
00493 void G_ClearVisFlags(int team);
00494 int G_CheckVis(edict_t *check, qboolean perish);
00495 int G_CheckVisPlayer(player_t* player, qboolean perish);
00496 int G_TestVis(const int team, edict_t * check, int flags);
00497 float G_Vis(const int team, const edict_t * from, const edict_t * check, int flags);
00498 
00499 /* g_combat.c */
00500 qboolean G_ClientShoot(const player_t *player, edict_t* ent, const pos3_t at, shoot_types_t shootType, fireDefIndex_t firemode, shot_mock_t *mock, qboolean allowReaction, int z_align);
00501 
00502 /* g_ai.c */
00503 extern edict_t *ai_waypointList;
00504 void G_AddToWayPointList(edict_t *ent);
00505 void AI_Run(void);
00506 void AI_ActorThink(player_t *player, edict_t *ent);
00507 player_t *AI_CreatePlayer(int team);
00508 qboolean AI_CheckUsingDoor(const edict_t *ent, const edict_t *door);
00509 
00510 /* g_svcmds.c */
00511 void G_ServerCommand(void);
00512 qboolean SV_FilterPacket(const char *from);
00513 
00514 /* g_match.c */
00515 qboolean G_MatchIsRunning(void);
00516 void G_MatchEndTrigger(int team, int timeGap);
00517 void G_MatchEndCheck(void);
00518 qboolean G_MatchDoEnd(void);
00519 
00520 /* g_trigger.c */
00521 edict_t* G_TriggerSpawn(edict_t *owner);
00522 void SP_trigger_hurt(edict_t *ent);
00523 void SP_trigger_touch(edict_t *ent);
00524 void SP_trigger_rescue(edict_t *ent);
00525 
00526 /* g_func.c */
00527 void SP_func_rotating(edict_t *ent);
00528 void SP_func_door(edict_t *ent);
00529 void SP_func_breakable(edict_t *ent);
00530 
00532 edict_t* G_EdictsInit(void);
00533 void G_EdictsReset(void);
00534 edict_t* G_EdictsGetNewEdict(void);
00535 int G_EdictsGetNumber(const edict_t* ent);
00536 qboolean G_EdictsIsValidNum(const int idx);
00537 edict_t* G_EdictsGetByNum(const int num);
00538 edict_t* G_EdictsGetFirst(void);
00539 edict_t* G_EdictsGetNext(edict_t* lastEnt);
00540 edict_t* G_EdictsGetNextInUse(edict_t* lastEnt);
00541 edict_t* G_EdictsGetNextActor(edict_t* lastEnt);
00542 edict_t* G_EdictsGetNextLivingActor(edict_t* lastEnt);
00543 edict_t* G_EdictsGetNextLivingActorOfTeam (edict_t* lastEnt, const int team);
00544 
00546 void G_EdictCalcOrigin(edict_t* ent);
00547 void G_EdictSetOrigin(edict_t* ent, const pos3_t newPos);
00548 qboolean G_EdictPosIsSameAs(edict_t* ent, const pos3_t cmpPos);
00549 
00550 /*============================================================================ */
00551 
00553 typedef enum {
00554     MAT_GLASS,      /* default */
00555     MAT_METAL,
00556     MAT_ELECTRICAL,
00557     MAT_WOOD,
00558 
00559     MAT_MAX
00560 } edictMaterial_t;
00561 
00563 typedef struct {
00564     int         contentFlags[MAX_DVTAB];
00565     int         visflags[MAX_DVTAB];
00566     byte        steps;
00567     int         currentStep;
00568 } moveinfo_t;
00569 
00571 typedef struct {
00572     char userinfo[MAX_INFO_STRING];
00573     char netname[16];
00574 
00577     int team;
00578     qboolean ai;                
00581     edict_t *last; 
00583     float       flood_locktill;     
00584     float       flood_when[10];     
00585     int         flood_whenhead;     
00586 } client_persistant_t;
00587 
00591 struct player_s {
00592     /* known to server */
00593     qboolean inuse;
00594     int num;
00595     qboolean isReady;           
00597     /* private to game */
00598     qboolean spawned;           
00599     qboolean began;             
00600     qboolean roundDone;         
00602     int reactionLeftover;       
00603     qboolean autostand;         
00605     client_persistant_t pers;
00606 };
00607 
00612 #define FL_GROUPSLAVE   0x00000008
00613 
00619 #define FL_DESTROYABLE  0x00000004
00620 
00623 #define FL_TRIGGERED    0x00000100
00624 
00626 typedef struct AI_s {
00627     char type[MAX_QPATH];   
00628     char subtype[MAX_VAR];  
00629     lua_State* L;           
00630 } AI_t;
00631 
00636 struct edict_s {
00637     qboolean inuse;
00638     int linkcount;      
00641     int number;         
00643     vec3_t origin;      
00644     vec3_t angles;      
00647     solid_t solid;
00648 
00649     vec3_t mins, maxs; 
00650     vec3_t absmin, absmax; 
00651     vec3_t size;
00652 
00653     edict_t *child; 
00654     edict_t *owner; 
00655     int modelindex;  
00657     /*================================ */
00658     /* don't change anything above here - the server expects the fields in that order */
00659     /*================================ */
00660 
00661     int mapNum;     
00662     const char *model;  
00667     entity_type_t type;
00668     int visflags;               
00670     int contentFlags;           
00672     pos3_t pos;
00673     byte dir;                   
00675     int TU;                     
00676     int HP;                     
00677     int STUN;                   
00682     int morale;                 
00684     int state;                  
00686     int team;                   
00687     int pnum;                   
00689     int body;
00690     int head;
00691     int frame;                  
00693     char *group;                
00699     const edict_t *reactionTarget;  
00700     float reactionTUs;  
00701     qboolean reactionNoDraw;
00702     qboolean inRescueZone;  
00706     edict_t *clientAction;
00707 
00709     character_t chr;
00710 
00711     int spawnflags; 
00712     const char *classname;
00713 
00714     float angle;    
00717     int speed;  
00718     const char *target; 
00719     const char *targetname; 
00720     const char *item;   
00721     const char *particle;
00722     const char *message; 
00723     const char *noise;  
00724     edictMaterial_t material;   
00725     int count;      
00726     int time;       
00727     int sounds;     
00728     int dmg;        
00730     actorSizeEnum_t fieldSize;  /* ACTOR_SIZE_* */
00731     qboolean hiding;        
00735     qboolean (*touch)(edict_t * self, edict_t * activator);
00737     void (*reset)(edict_t * self, edict_t * activator);
00738     float nextthink;
00739     void (*think)(edict_t *self);
00743     qboolean (*use)(edict_t *self, edict_t *activator);
00744     qboolean (*destroy)(edict_t *self);
00745 
00746     int doorState;  
00748     moveinfo_t      moveinfo;
00749 
00755     edict_t *groupChain;
00756     edict_t *groupMaster;   
00757     int flags;      
00759     AI_t AI; 
00761     pos3_t *forbiddenListPos; 
00763     int forbiddenListSize;      
00764 };
00765 
00766 #endif /* GAME_G_LOCAL_H */

Generated by  doxygen 1.6.2