mirror of https://github.com/UberGames/rpgxEF.git
Moved some functions
This commit is contained in:
parent
3b8451d635
commit
a9805d8eac
|
@ -8,6 +8,7 @@
|
||||||
#include "g_items.h"
|
#include "g_items.h"
|
||||||
#include "g_combat.h"
|
#include "g_combat.h"
|
||||||
#include "g_lua.h"
|
#include "g_lua.h"
|
||||||
|
#include "g_mover.h"
|
||||||
|
|
||||||
extern void ammo_station_finish_spawning ( gentity_t *self );
|
extern void ammo_station_finish_spawning ( gentity_t *self );
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "g_local.h"
|
#include "g_local.h"
|
||||||
#include "g_client.h"
|
#include "g_client.h"
|
||||||
|
#include "g_utils.h"
|
||||||
|
|
||||||
#ifndef min
|
#ifndef min
|
||||||
#define min(a, b) (a) < (b) ? a : b
|
#define min(a, b) (a) < (b) ? a : b
|
||||||
|
@ -17,17 +18,16 @@ gentity_t* podium2;
|
||||||
gentity_t* podium3;
|
gentity_t* podium3;
|
||||||
|
|
||||||
void UpdateTournamentInfo(void) {
|
void UpdateTournamentInfo(void) {
|
||||||
|
char msg[AWARDS_MSG_LENGTH];
|
||||||
|
char msg2[AWARDS_MSG_LENGTH];
|
||||||
|
char* mvpName = "";
|
||||||
int32_t i = 0;
|
int32_t i = 0;
|
||||||
int32_t j = 0;
|
int32_t j = 0;
|
||||||
int32_t k = 0;
|
int32_t k = 0;
|
||||||
gentity_t* player = NULL;
|
|
||||||
int32_t playerClientNum = 0;
|
|
||||||
int32_t n = 0;
|
int32_t n = 0;
|
||||||
char msg[AWARDS_MSG_LENGTH];
|
int32_t playerClientNum = 0;
|
||||||
char msg2[AWARDS_MSG_LENGTH];
|
|
||||||
int32_t playerRank = level.numNonSpectatorClients - 1;
|
int32_t playerRank = level.numNonSpectatorClients - 1;
|
||||||
int32_t highestTiedRank = 0;
|
int32_t highestTiedRank = 0;
|
||||||
gentity_t* MVP = NULL;
|
|
||||||
int32_t mvpNum = -1;
|
int32_t mvpNum = -1;
|
||||||
int32_t mvpPoints = 0;
|
int32_t mvpPoints = 0;
|
||||||
int32_t winningCaptures = 0;
|
int32_t winningCaptures = 0;
|
||||||
|
@ -35,10 +35,11 @@ void UpdateTournamentInfo(void) {
|
||||||
int32_t winningTeam=0;
|
int32_t winningTeam=0;
|
||||||
int32_t loseCaptures = 0;
|
int32_t loseCaptures = 0;
|
||||||
int32_t losePoints = 0;
|
int32_t losePoints = 0;
|
||||||
char* mvpName = "";
|
int32_t secondPlaceTied=0;
|
||||||
|
gentity_t* MVP = NULL;
|
||||||
|
gentity_t* player = NULL;
|
||||||
gclient_t* cl = NULL;
|
gclient_t* cl = NULL;
|
||||||
gclient_t* cl2= NULL;
|
gclient_t* cl2= NULL;
|
||||||
int32_t secondPlaceTied=0;
|
|
||||||
|
|
||||||
memset(msg, 0, AWARDS_MSG_LENGTH);
|
memset(msg, 0, AWARDS_MSG_LENGTH);
|
||||||
memset(msg2, 0, AWARDS_MSG_LENGTH);
|
memset(msg2, 0, AWARDS_MSG_LENGTH);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "g_spawn.h"
|
#include "g_spawn.h"
|
||||||
#include "g_items.h"
|
#include "g_items.h"
|
||||||
#include "g_combat.h"
|
#include "g_combat.h"
|
||||||
|
#include "g_utils.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief A func_breakables health has sunk to or under zero
|
* \brief A func_breakables health has sunk to or under zero
|
||||||
|
|
|
@ -865,17 +865,6 @@ typedef struct {
|
||||||
//
|
//
|
||||||
// g_utils.c
|
// g_utils.c
|
||||||
//
|
//
|
||||||
/**
|
|
||||||
* \brief Get the model index for a model.
|
|
||||||
*
|
|
||||||
* Get the model index for a model.
|
|
||||||
*
|
|
||||||
* \param name the model name
|
|
||||||
*
|
|
||||||
* \return the models index
|
|
||||||
*/
|
|
||||||
int G_ModelIndex( char* name );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get the sound index for a sound.
|
* \brief Get the sound index for a sound.
|
||||||
*
|
*
|
||||||
|
@ -1242,34 +1231,6 @@ int G_GetEntityByBmodel(char* bmodel,list_p entities);
|
||||||
*/
|
*/
|
||||||
void AddRemap(const char* oldShader, const char* newShader, float timeOffset);
|
void AddRemap(const char* oldShader, const char* newShader, float timeOffset);
|
||||||
|
|
||||||
//
|
|
||||||
// g_mover.c
|
|
||||||
//
|
|
||||||
/**
|
|
||||||
* Run a mover.
|
|
||||||
*
|
|
||||||
* \param ent Mover to run.
|
|
||||||
*/
|
|
||||||
void G_Mover_Run( gentity_t* ent );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Touch function for doors.
|
|
||||||
*
|
|
||||||
* \param ent The mover.
|
|
||||||
* \param other The touching entity.
|
|
||||||
* \param trace A trace.
|
|
||||||
*/
|
|
||||||
void G_Mover_TouchDoorTrigger( gentity_t* ent, gentity_t* other, trace_t* trace );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use function for binary movers.
|
|
||||||
*
|
|
||||||
* \param ent The mover.
|
|
||||||
* \param other Other entity.
|
|
||||||
* \param activator Activator.
|
|
||||||
*/
|
|
||||||
void G_Mover_UseBinaryMover( gentity_t* ent, gentity_t* other, gentity_t* activator );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// g_misc.c
|
// g_misc.c
|
||||||
//
|
//
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "g_usable.h"
|
#include "g_usable.h"
|
||||||
#include "g_lua.h"
|
#include "g_lua.h"
|
||||||
#include "g_missile.h"
|
#include "g_missile.h"
|
||||||
|
#include "g_utils.h"
|
||||||
|
#include "g_mover.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);
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
// Copyright (C) 1999-2000 Id Software, Inc.
|
// Copyright (C) 1999-2000 Id Software, Inc.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "g_local.h"
|
#include "g_mover.h"
|
||||||
#include "g_client.h"
|
#include "g_client.h"
|
||||||
#include "g_spawn.h"
|
#include "g_spawn.h"
|
||||||
#include "g_combat.h"
|
#include "g_combat.h"
|
||||||
#include "g_lua.h"
|
#include "g_lua.h"
|
||||||
|
#include "g_utils.h"
|
||||||
|
|
||||||
extern qboolean G_CallSpawn(gentity_t *ent);
|
extern qboolean G_CallSpawn(gentity_t *ent);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
#ifndef G_MOVER_H_
|
||||||
|
#define G_MOVER_H_
|
||||||
|
|
||||||
|
#include "g_local.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Run a mover.
|
||||||
|
*
|
||||||
|
* \param ent Mover to run.
|
||||||
|
*/
|
||||||
|
void G_Mover_Run(gentity_t* ent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Touch function for doors.
|
||||||
|
*
|
||||||
|
* \param ent The mover.
|
||||||
|
* \param other The touching entity.
|
||||||
|
* \param trace A trace.
|
||||||
|
*/
|
||||||
|
void G_Mover_TouchDoorTrigger(gentity_t* ent, gentity_t* other, trace_t* trace);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Use function for binary movers.
|
||||||
|
*
|
||||||
|
* \param ent The mover.
|
||||||
|
* \param other Other entity.
|
||||||
|
* \param activator Activator.
|
||||||
|
*/
|
||||||
|
void G_Mover_UseBinaryMover(gentity_t* ent, gentity_t* other, gentity_t* activator);
|
||||||
|
|
||||||
|
#endif /* G_MOVER_H_ */
|
|
@ -332,26 +332,21 @@ qboolean G_CallSpawn( gentity_t *ent ) {
|
||||||
spawn_t *s;
|
spawn_t *s;
|
||||||
gitem_t *item;
|
gitem_t *item;
|
||||||
|
|
||||||
if ( ent->classname == NULL )
|
if (ent->classname == NULL) {
|
||||||
{
|
|
||||||
G_Printf("G_CallSpawn: NULL classname\n");
|
G_Printf("G_CallSpawn: NULL classname\n");
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check item spawn functions
|
// check item spawn functions
|
||||||
for ( item=bg_itemlist+1 ; item->classname ; item++ )
|
for (item = bg_itemlist + 1; item->classname; item++) {
|
||||||
{
|
if (!strcmp(item->classname, ent->classname)) { // found it
|
||||||
if ( !strcmp(item->classname, ent->classname) )
|
if (item->giType == IT_TEAM && g_gametype.integer != GT_CTF) {
|
||||||
{ // found it
|
|
||||||
if( item->giType == IT_TEAM && g_gametype.integer != GT_CTF )
|
|
||||||
{
|
|
||||||
return qfalse;
|
return qfalse;
|
||||||
}
|
}
|
||||||
G_SpawnItem(ent, item);
|
G_SpawnItem(ent, item);
|
||||||
|
|
||||||
#ifdef G_LUA
|
#ifdef G_LUA
|
||||||
if(ent->luaSpawn)
|
if (ent->luaSpawn) {
|
||||||
{
|
|
||||||
LuaHook_G_EntitySpawn(ent->luaSpawn, ent->s.number);
|
LuaHook_G_EntitySpawn(ent->luaSpawn, ent->s.number);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -361,10 +356,8 @@ qboolean G_CallSpawn( gentity_t *ent ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check normal spawn functions
|
// check normal spawn functions
|
||||||
for ( s=spawns ; s->name ; s++ )
|
for (s = spawns; s->name; s++) {
|
||||||
{
|
if (!strcmp(s->name, ent->classname)) {
|
||||||
if ( !strcmp(s->name, ent->classname) )
|
|
||||||
{
|
|
||||||
// found it
|
// found it
|
||||||
s->spawn(ent);
|
s->spawn(ent);
|
||||||
|
|
||||||
|
@ -372,14 +365,12 @@ qboolean G_CallSpawn( gentity_t *ent ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Q_stricmp( "item_botroam", ent->classname ) != 0 )
|
if (Q_stricmp("item_botroam", ent->classname) != 0) {//suppress error message about botroams as those are actually valid
|
||||||
{//suppress error message about botroams as those are actually valid
|
|
||||||
DEVELOPER(G_Printf(S_COLOR_RED "%s doesn't have a spawn function\n", ent->classname););
|
DEVELOPER(G_Printf(S_COLOR_RED "%s doesn't have a spawn function\n", ent->classname););
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef G_LUA
|
#ifdef G_LUA
|
||||||
if(ent->luaSpawn)
|
if (ent->luaSpawn) {
|
||||||
{
|
|
||||||
LuaHook_G_EntitySpawn(ent->luaSpawn, ent->s.number);
|
LuaHook_G_EntitySpawn(ent->luaSpawn, ent->s.number);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -504,8 +495,7 @@ Spawn an entity and fill in all of the level fields from
|
||||||
level.spawnVars[], then call the class specfic spawn function
|
level.spawnVars[], then call the class specfic spawn function
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
void G_SpawnGEntityFromSpawnVars( void )
|
void G_SpawnGEntityFromSpawnVars(void) {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
gentity_t *ent;
|
gentity_t *ent;
|
||||||
char *s, *value, *gametypeName;
|
char *s, *value, *gametypeName;
|
||||||
|
@ -526,33 +516,25 @@ void G_SpawnGEntityFromSpawnVars( void )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( g_gametype.integer >= GT_TEAM )
|
if (g_gametype.integer >= GT_TEAM) {
|
||||||
{
|
|
||||||
G_SpawnInt("notteam", "0", &i);
|
G_SpawnInt("notteam", "0", &i);
|
||||||
if ( i )
|
if (i) {
|
||||||
{
|
|
||||||
G_FreeEntity(ent);
|
G_FreeEntity(ent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
G_SpawnInt("notfree", "0", &i);
|
G_SpawnInt("notfree", "0", &i);
|
||||||
if ( i )
|
if (i) {
|
||||||
{
|
|
||||||
G_FreeEntity(ent);
|
G_FreeEntity(ent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( G_SpawnString( "gametype", "", &value ) )
|
if (G_SpawnString("gametype", "", &value)) {
|
||||||
{
|
if (g_gametype.integer >= GT_FFA && g_gametype.integer < GT_MAX_GAME_TYPE) {
|
||||||
if ( g_gametype.integer >= GT_FFA && g_gametype.integer < GT_MAX_GAME_TYPE )
|
|
||||||
{
|
|
||||||
gametypeName = gametypeNames[g_gametype.integer];
|
gametypeName = gametypeNames[g_gametype.integer];
|
||||||
s = strstr(value, gametypeName);
|
s = strstr(value, gametypeName);
|
||||||
if ( !s )
|
if (!s) {
|
||||||
{
|
|
||||||
G_FreeEntity(ent);
|
G_FreeEntity(ent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -564,8 +546,7 @@ void G_SpawnGEntityFromSpawnVars( void )
|
||||||
VectorCopy(ent->s.origin, ent->r.currentOrigin);
|
VectorCopy(ent->s.origin, ent->r.currentOrigin);
|
||||||
|
|
||||||
// if we didn't get a classname, don't bother spawning anything
|
// if we didn't get a classname, don't bother spawning anything
|
||||||
if ( !G_CallSpawn( ent ) )
|
if (!G_CallSpawn(ent)) {
|
||||||
{
|
|
||||||
G_FreeEntity(ent);
|
G_FreeEntity(ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -716,23 +697,19 @@ void SP_worldspawn( void ) {
|
||||||
|
|
||||||
//FIXME: in some cases, want to carry over from previous running of this map
|
//FIXME: in some cases, want to carry over from previous running of this map
|
||||||
G_SpawnString("fraglimit", "0", &s);
|
G_SpawnString("fraglimit", "0", &s);
|
||||||
if ( s && atoi(s) != 0 )
|
if (s && atoi(s) != 0) {
|
||||||
{
|
|
||||||
trap_Cvar_Set("fraglimit", s);
|
trap_Cvar_Set("fraglimit", s);
|
||||||
}
|
}
|
||||||
G_SpawnString("capturelimit", "0", &s);
|
G_SpawnString("capturelimit", "0", &s);
|
||||||
if ( s && atoi(s) != 0 )
|
if (s && atoi(s) != 0) {
|
||||||
{
|
|
||||||
trap_Cvar_Set("capturelimit", s);
|
trap_Cvar_Set("capturelimit", s);
|
||||||
}
|
}
|
||||||
G_SpawnString("timelimit", "0", &s);
|
G_SpawnString("timelimit", "0", &s);
|
||||||
if ( s && atoi(s) != 0 )
|
if (s && atoi(s) != 0) {
|
||||||
{
|
|
||||||
trap_Cvar_Set("timelimit", s);
|
trap_Cvar_Set("timelimit", s);
|
||||||
}
|
}
|
||||||
G_SpawnString("timelimitWinningTeam", "", &s);
|
G_SpawnString("timelimitWinningTeam", "", &s);
|
||||||
if ( s )
|
if (s) {
|
||||||
{
|
|
||||||
trap_Cvar_Set("timelimitWinningTeam", s);
|
trap_Cvar_Set("timelimitWinningTeam", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "g_items.h"
|
#include "g_items.h"
|
||||||
#include "g_logger.h"
|
#include "g_logger.h"
|
||||||
#include "g_combat.h"
|
#include "g_combat.h"
|
||||||
|
#include "g_utils.h"
|
||||||
|
|
||||||
#define ARM_ANGLE_RANGE 60
|
#define ARM_ANGLE_RANGE 60
|
||||||
#define HEAD_ANGLE_RANGE 90
|
#define HEAD_ANGLE_RANGE 90
|
||||||
|
|
|
@ -3,6 +3,13 @@
|
||||||
|
|
||||||
#include "g_local.h"
|
#include "g_local.h"
|
||||||
|
|
||||||
qboolean G_Utils_LineOfSight( gentity_t* ent1, gentity_t* ent2 ); //Phenix
|
/**
|
||||||
|
* \brief Get the model index for a model.
|
||||||
|
* Get the model index for a model.
|
||||||
|
*
|
||||||
|
* \param name the model name
|
||||||
|
* \return the models index
|
||||||
|
*/
|
||||||
|
int32_t G_ModelIndex(char* name);
|
||||||
|
|
||||||
#endif /* G_UTILS_H_ */
|
#endif /* G_UTILS_H_ */
|
||||||
|
|
|
@ -516,6 +516,7 @@
|
||||||
<ClInclude Include="g_lua.h" />
|
<ClInclude Include="g_lua.h" />
|
||||||
<ClInclude Include="g_main.h" />
|
<ClInclude Include="g_main.h" />
|
||||||
<ClInclude Include="g_missile.h" />
|
<ClInclude Include="g_missile.h" />
|
||||||
|
<ClInclude Include="g_mover.h" />
|
||||||
<ClInclude Include="g_public.h" />
|
<ClInclude Include="g_public.h" />
|
||||||
<ClInclude Include="g_spawn.h" />
|
<ClInclude Include="g_spawn.h" />
|
||||||
<ClInclude Include="g_sql.h" />
|
<ClInclude Include="g_sql.h" />
|
||||||
|
|
|
@ -530,6 +530,9 @@
|
||||||
<ClInclude Include="..\qcommon\stv_version.h">
|
<ClInclude Include="..\qcommon\stv_version.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="g_mover.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="game.def">
|
<None Include="game.def">
|
||||||
|
|
Loading…
Reference in New Issue