Moved several functions from g_local.h to other headers

This commit is contained in:
Walter Julius Hennecke 2013-10-13 21:55:11 +02:00
parent 175a78215a
commit 67306ef4bf
16 changed files with 180 additions and 179 deletions

View file

@ -6,6 +6,8 @@
#include "g_spawn.h" #include "g_spawn.h"
#include "g_cmds.h" #include "g_cmds.h"
#include "g_items.h" #include "g_items.h"
#include "g_combat.h"
#include "g_lua.h"
extern void ammo_station_finish_spawning ( gentity_t *self ); extern void ammo_station_finish_spawning ( gentity_t *self );

View file

@ -8,6 +8,7 @@
#include "g_main.h" #include "g_main.h"
#include "g_spawn.h" #include "g_spawn.h"
#include "g_items.h" #include "g_items.h"
#include "g_lua.h"
reconData_t g_reconData[MAX_RECON_NAMES]; //!< recon data for a limited ammount of clients reconData_t g_reconData[MAX_RECON_NAMES]; //!< recon data for a limited ammount of clients
int32_t g_reconNum; int32_t g_reconNum;

View file

@ -7,6 +7,7 @@
#include "g_main.h" #include "g_main.h"
#include "g_client.h" #include "g_client.h"
#include "g_logger.h" #include "g_logger.h"
#include "g_lua.h"
//#include <windows.h> //#include <windows.h>
@ -7444,7 +7445,6 @@ static void Cmd_Camtest_f(gentity_t *ent) {
void Cmd_CamtestEnd_f(gentity_t *ent) { void Cmd_CamtestEnd_f(gentity_t *ent) {
//Cinematic_DeactivateCameraMode(ent); //Cinematic_DeactivateCameraMode(ent);
G_LuaNumThreads();
} }
// END CCAM // END CCAM

View file

@ -2,12 +2,14 @@
// //
// g_combat.c // g_combat.c
#include "g_combat.h"
#include "g_local.h" #include "g_local.h"
#include "g_breakable.h" //RPG-X | GSIO01 | 09/05/2009: needed by G_Repair #include "g_breakable.h" //RPG-X | GSIO01 | 09/05/2009: needed by G_Repair
#include "g_main.h" #include "g_main.h"
#include "g_cmds.h" #include "g_cmds.h"
#include "g_client.h" #include "g_client.h"
#include "g_items.h" #include "g_items.h"
#include "g_lua.h"
/* /*
============ ============

View file

@ -1,2 +1,8 @@
#ifndef G_COMBAT_H_
#define G_COMBAT_H_
int borgAdaptHits[WP_NUM_WEAPONS]; #include "g_local.h"
qboolean IsBorg( gentity_t* ent ); //GSIO01 | 08/05/2009
#endif /* G_COMBAT_H_ */

View file

@ -2136,162 +2136,6 @@ int BotAIStartFrame( int time );
// g_lua.c // g_lua.c
// //
#ifdef G_LUA #ifdef G_LUA
/**
* Lua hook for InitGame event.
*
* \param leveltime level time the event occured
* \param radomseed a random seed
* \param restart is this a map restart?
*/
void LuaHook_G_InitGame(int leveltime, unsigned int randomseed, int restart);
/**
* Lua hook for Shutdown event.
*
* \param restart is this a map restart?
*/
void LuaHook_G_Shutdown(int restart);
/**
* Lua hook for RunFrame event.
*
* \param leveltime the level time
*/
void LuaHook_G_RunFrame(int leveltime);
/**
* Lua hook for G_Print function.
*
* \param text text to be printed
*/
void LuaHook_G_Print(char* text);
/**
* Lua hook for G_ClientPrint function.
*
* \param text text to be printed
* \param entnum entity index for client the text gets send to
*/
void LuaHook_G_ClientPrint(char* text, int entnum);
/**
* Lua hook for entity think function function.
*
* \param function name of function to call
* \param entnum entity index of entity the think function was called on
* \return success or fail
*/
void LuaHook_G_EntityThink(char* function, int entnum);
/**
* Lua hook for entity touch function function.
*
* \param function name of function to call
* \param entnum entity index of entity the touch function was called on
* \param othernum entiy index of touching entity
* \return success or fail
*/
void LuaHook_G_EntityTouch(char* function, int entnum, int othernum);
/**
* Lua hook for entity use function.
*
* \param function name of function to call
* \param entnum entity index of entity the use function was called on
* \param othernum entity index of other entity
* \param activatornum entity index of activating entity
*/
void LuaHook_G_EntityUse(char* function, int entnum, int othernum, int activatornum);
/**
* Lua hook for entity hurt function.
*
* \param function name of function to call
* \param entnum entity index of entity the hurt function was called on
* \param inflictornum entity index of inflictor
* \param attackernum entity index of attacker
*/
void LuaHook_G_EntityHurt(char* function, int entnum, int inflictornum, int attackernum);
/**
* Lua hook for entity die function.
*
* \param function name of function to call
* \param entnum entity index of entity the die function was called on
* \param inflictornum entity index of inflictor
* \param attackernum entity index of attacker
* \param dmg ammount of damage
* \param mod means of death
*/
void LuaHook_G_EntityDie(char* function, int entnum, int inflictornum, int attackernum, int dmg, int mod);
/**
* Lua hook for entity free function.
*
* \param function name of function to call
* \param entnum entity index of entity the free function was called on
*/
void LuaHook_G_EntityFree(char* function, int entnum);
/**
* Lua hook for entity trigger function.
*
* \param function name of function to call
* \param entnum entity index of entity the trigger function was called on
* \param othernum entity index of triggering entity
*/
void LuaHook_G_EntityTrigger(char* function, int entnum, int othernum);
/**
* Lua hook for entity spawn function.
*
* \param function name of function to call
* \param entnum entity index of entity the spawn function was called on
*/
void LuaHook_G_EntitySpawn(char* function, int entnum);
/**
* Lua hook for entity reached function.
*
* \param function name of function to call
* \param entnum entity index of entity the reached function was called on
*/
void LuaHook_G_EntityReached(char* function, int entnum);
/**
* Lua hook for entity reached angular function.
*
* \param function name of function to call
* \param entnum entity index of entity the reached angular function was called on
*/
void LuaHook_G_EntityReachedAngular(char* function, int entnum);
/**
* Output information about lua threads.
*/
void G_LuaNumThreads(void);
/**
* Collect garbage in lua.
*/
void G_LuaCollectGarbage(void);
/**
* Show lua status information.
*
* \param ent client
*/
void G_LuaStatus(gentity_t* ent);
/**
* Initialize lua.
*/
qboolean G_LuaInit(void);
/**
* Shutdown lua.
*/
void G_LuaShutdown(void);
extern vmCvar_t g_debugLua; extern vmCvar_t g_debugLua;
extern vmCvar_t lua_allowedModules; extern vmCvar_t lua_allowedModules;
extern vmCvar_t lua_modules; extern vmCvar_t lua_modules;
@ -3003,13 +2847,6 @@ void trap_BotResetWeaponState(int weaponstate);
int trap_GeneticParentsAndChildSelection(int numranks, float* ranks, int* parent1, int* parent2, int* child); int trap_GeneticParentsAndChildSelection(int numranks, float* ranks, int* parent1, int* parent2, int* child);
/*=================*\
|| RPG-X Functions ||
\*=================*/
qboolean LineOfSight( gentity_t* ent1, gentity_t* ent2 ); //Phenix
qboolean IsBorg( gentity_t* ent ); //GSIO01 | 08/05/2009
//OUMS //OUMS
/** \typedef holoData_t /** \typedef holoData_t

View file

@ -1079,8 +1079,9 @@ void LuaHook_G_EntitySpawn(char *function, int entnum)
} }
} }
void G_LuaNumThreads(void) { unsigned G_LuaNumThreads(void) {
lvm_t* vm = lVM[0]; lvm_t* vm = lVM[0];
unsigned num = 0;
if(vm) { if(vm) {
lua_State *p; lua_State *p;
@ -1098,8 +1099,11 @@ void G_LuaNumThreads(void) {
} }
} }
} }
G_Printf("Total lua thread count: %d\n", cnt);
num = cnt;
} }
return num;
} }
void G_LuaCollectGarbage(void) { void G_LuaCollectGarbage(void) {

View file

@ -41,18 +41,18 @@ typedef struct {
extern lvm_t *lVM[NUM_VMS]; extern lvm_t *lVM[NUM_VMS];
void QDECL LUA_DEBUG(const char *fmt, ...); void QDECL LUA_DEBUG(const char *fmt, ...);
void QDECL LUA_LOG(const char *fmt, ...); void QDECL LUA_LOG(const char *fmt, ...);
qboolean G_LuaInit(void); qboolean G_LuaInit(void);
qboolean G_LuaCall(lvm_t *vm, char *func, int nargs, int nresults); qboolean G_LuaCall(lvm_t *vm, char *func, int nargs, int nresults);
qboolean G_LuaResume(lvm_t *vm, lua_State *T, char *func, int nargs); qboolean G_LuaResume(lvm_t *vm, lua_State *T, char *func, int nargs);
qboolean G_LuaGetFunction(lvm_t *vm, char *name); qboolean G_LuaGetFunction(lvm_t *vm, char *name);
qboolean G_LuaGetFunctionT(lua_State *T, char *name); qboolean G_LuaGetFunctionT(lua_State *T, char *name);
qboolean G_LuaStartVM(lvm_t *vm); qboolean G_LuaStartVM(lvm_t *vm);
void G_LuaStopVM(lvm_t *vm); void G_LuaStopVM(lvm_t *vm);
void G_LuaShutdown(void); void G_LuaShutdown(void);
void G_LuaStatus(gentity_t *ent); void G_LuaStatus(gentity_t *ent);
lvm_t *G_LuaGetVM(lua_State *L); lvm_t* G_LuaGetVM(lua_State *L);
// lua_entity.c // lua_entity.c
typedef struct { typedef struct {
@ -97,4 +97,137 @@ int Luaopen_Cinematic(lua_State *L);
// lua_sound.c // lua_sound.c
int Luaopen_Sound(lua_State *L); int Luaopen_Sound(lua_State *L);
/**
* Lua hook for InitGame event.
*
* \param leveltime level time the event occured
* \param radomseed a random seed
* \param restart is this a map restart?
*/
void LuaHook_G_InitGame(int leveltime, unsigned int randomseed, int restart);
/**
* Lua hook for Shutdown event.
*
* \param restart is this a map restart?
*/
void LuaHook_G_Shutdown(int restart);
/**
* Lua hook for RunFrame event.
*
* \param leveltime the level time
*/
void LuaHook_G_RunFrame(int leveltime);
/**
* Lua hook for G_Print function.
*
* \param text text to be printed
*/
void LuaHook_G_Print(char* text);
/**
* Lua hook for G_ClientPrint function.
*
* \param text text to be printed
* \param entnum entity index for client the text gets send to
*/
void LuaHook_G_ClientPrint(char* text, int entnum);
/**
* Lua hook for entity think function function.
*
* \param function name of function to call
* \param entnum entity index of entity the think function was called on
* \return success or fail
*/
void LuaHook_G_EntityThink(char* function, int entnum);
/**
* Lua hook for entity touch function function.
*
* \param function name of function to call
* \param entnum entity index of entity the touch function was called on
* \param othernum entiy index of touching entity
* \return success or fail
*/
void LuaHook_G_EntityTouch(char* function, int entnum, int othernum);
/**
* Lua hook for entity use function.
*
* \param function name of function to call
* \param entnum entity index of entity the use function was called on
* \param othernum entity index of other entity
* \param activatornum entity index of activating entity
*/
void LuaHook_G_EntityUse(char* function, int entnum, int othernum, int activatornum);
/**
* Lua hook for entity hurt function.
*
* \param function name of function to call
* \param entnum entity index of entity the hurt function was called on
* \param inflictornum entity index of inflictor
* \param attackernum entity index of attacker
*/
void LuaHook_G_EntityHurt(char* function, int entnum, int inflictornum, int attackernum);
/**
* Lua hook for entity die function.
*
* \param function name of function to call
* \param entnum entity index of entity the die function was called on
* \param inflictornum entity index of inflictor
* \param attackernum entity index of attacker
* \param dmg ammount of damage
* \param mod means of death
*/
void LuaHook_G_EntityDie(char* function, int entnum, int inflictornum, int attackernum, int dmg, int mod);
/**
* Lua hook for entity free function.
*
* \param function name of function to call
* \param entnum entity index of entity the free function was called on
*/
void LuaHook_G_EntityFree(char* function, int entnum);
/**
* Lua hook for entity trigger function.
*
* \param function name of function to call
* \param entnum entity index of entity the trigger function was called on
* \param othernum entity index of triggering entity
*/
void LuaHook_G_EntityTrigger(char* function, int entnum, int othernum);
/**
* Lua hook for entity spawn function.
*
* \param function name of function to call
* \param entnum entity index of entity the spawn function was called on
*/
void LuaHook_G_EntitySpawn(char* function, int entnum);
/**
* Lua hook for entity reached function.
*
* \param function name of function to call
* \param entnum entity index of entity the reached function was called on
*/
void LuaHook_G_EntityReached(char* function, int entnum);
/**
* Lua hook for entity reached angular function.
*
* \param function name of function to call
* \param entnum entity index of entity the reached angular function was called on
*/
void LuaHook_G_EntityReachedAngular(char* function, int entnum);
unsigned G_LuaNumThreads(void);
void G_LuaCollectGarbage(void);
#endif #endif

View file

@ -12,6 +12,7 @@
#include "bg_misc.h" #include "bg_misc.h"
#include "g_logger.h" #include "g_logger.h"
#include "g_usable.h" #include "g_usable.h"
#include "g_lua.h"
extern void BG_LoadItemNames(void); extern void BG_LoadItemNames(void);
extern qboolean BG_ParseRankNames ( char* fileName, rankNames_t rankNames[], size_t size ); extern qboolean BG_ParseRankNames ( char* fileName, rankNames_t rankNames[], size_t size );

View file

@ -4,6 +4,8 @@
#include "g_local.h" #include "g_local.h"
#include "g_client.h" #include "g_client.h"
#include "g_spawn.h" #include "g_spawn.h"
#include "g_combat.h"
#include "g_lua.h"
extern qboolean G_CallSpawn(gentity_t *ent); extern qboolean G_CallSpawn(gentity_t *ent);

View file

@ -4,6 +4,7 @@
#include "g_local.h" #include "g_local.h"
#include "g_spawn.h" #include "g_spawn.h"
#include "g_items.h" #include "g_items.h"
#include "g_lua.h"
field_t fields[] = { field_t fields[] = {
{"classname", FOFS(classname), F_LSTRING}, {"classname", FOFS(classname), F_LSTRING},

View file

@ -5,6 +5,7 @@
#include "g_local.h" #include "g_local.h"
#include "g_cmds.h" #include "g_cmds.h"
#include "g_lua.h"
/* /*
============================================================================== ==============================================================================

View file

@ -5,6 +5,7 @@
#include "bg_misc.h" #include "bg_misc.h"
#include "g_spawn.h" #include "g_spawn.h"
#include "g_client.h" #include "g_client.h"
#include "g_lua.h"
//#include <windows.h> //TiM : WTF? //#include <windows.h> //TiM : WTF?

View file

@ -5,6 +5,7 @@
#include "g_local.h" #include "g_local.h"
#include "g_spawn.h" #include "g_spawn.h"
#include "g_client.h" #include "g_client.h"
#include "g_lua.h"
/*these look weired... I'd rather replace them with streight numbers. /*these look weired... I'd rather replace them with streight numbers.
#define SF_SPECTATOR (1<<0) #define SF_SPECTATOR (1<<0)

View file

@ -7,6 +7,7 @@
#include "g_local.h" #include "g_local.h"
#include "g_lua.h"
/** /**
* \brief Data structure for a singele shader remap. * \brief Data structure for a singele shader remap.

8
code/game/g_utils.h Normal file
View file

@ -0,0 +1,8 @@
#ifndef G_UTILS_H_
#define G_UTILS_H_
#include "g_local.h"
qboolean LineOfSight( gentity_t* ent1, gentity_t* ent2 ); //Phenix
#endif /* G_UTILS_H_ */