mirror of
https://github.com/yquake2/rogue.git
synced 2024-11-26 06:00:50 +00:00
Cleanup g_main.c and add sanity checks
This commit is contained in:
parent
ea9bd331ff
commit
be4d838f45
1 changed files with 261 additions and 237 deletions
498
src/g_main.c
498
src/g_main.c
|
@ -1,105 +1,103 @@
|
||||||
|
/* =======================================================================
|
||||||
|
*
|
||||||
|
* Jump in into the game.so and support functions.
|
||||||
|
*
|
||||||
|
* =======================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
#include "header/local.h"
|
#include "header/local.h"
|
||||||
|
|
||||||
game_locals_t game;
|
game_locals_t game;
|
||||||
level_locals_t level;
|
level_locals_t level;
|
||||||
game_import_t gi;
|
game_import_t gi;
|
||||||
game_export_t globals;
|
game_export_t globals;
|
||||||
spawn_temp_t st;
|
spawn_temp_t st;
|
||||||
|
|
||||||
int sm_meat_index;
|
int sm_meat_index;
|
||||||
int snd_fry;
|
int snd_fry;
|
||||||
int meansOfDeath;
|
int meansOfDeath;
|
||||||
|
|
||||||
edict_t *g_edicts;
|
edict_t *g_edicts;
|
||||||
|
|
||||||
cvar_t *deathmatch;
|
cvar_t *deathmatch;
|
||||||
cvar_t *coop;
|
cvar_t *coop;
|
||||||
cvar_t *dmflags;
|
cvar_t *dmflags;
|
||||||
cvar_t *skill;
|
cvar_t *skill;
|
||||||
cvar_t *fraglimit;
|
cvar_t *fraglimit;
|
||||||
cvar_t *timelimit;
|
cvar_t *timelimit;
|
||||||
cvar_t *password;
|
cvar_t *password;
|
||||||
cvar_t *spectator_password;
|
cvar_t *spectator_password;
|
||||||
cvar_t *needpass;
|
cvar_t *needpass;
|
||||||
cvar_t *maxclients;
|
cvar_t *maxclients;
|
||||||
cvar_t *maxspectators;
|
cvar_t *maxspectators;
|
||||||
cvar_t *maxentities;
|
cvar_t *maxentities;
|
||||||
cvar_t *g_select_empty;
|
cvar_t *g_select_empty;
|
||||||
cvar_t *dedicated;
|
cvar_t *dedicated;
|
||||||
|
|
||||||
cvar_t *filterban;
|
cvar_t *filterban;
|
||||||
|
|
||||||
cvar_t *sv_maxvelocity;
|
cvar_t *sv_maxvelocity;
|
||||||
cvar_t *sv_gravity;
|
cvar_t *sv_gravity;
|
||||||
|
|
||||||
cvar_t *sv_rollspeed;
|
cvar_t *sv_rollspeed;
|
||||||
cvar_t *sv_rollangle;
|
cvar_t *sv_rollangle;
|
||||||
cvar_t *gun_x;
|
cvar_t *gun_x;
|
||||||
cvar_t *gun_y;
|
cvar_t *gun_y;
|
||||||
cvar_t *gun_z;
|
cvar_t *gun_z;
|
||||||
|
|
||||||
cvar_t *run_pitch;
|
cvar_t *run_pitch;
|
||||||
cvar_t *run_roll;
|
cvar_t *run_roll;
|
||||||
cvar_t *bob_up;
|
cvar_t *bob_up;
|
||||||
cvar_t *bob_pitch;
|
cvar_t *bob_pitch;
|
||||||
cvar_t *bob_roll;
|
cvar_t *bob_roll;
|
||||||
|
|
||||||
cvar_t *sv_cheats;
|
cvar_t *sv_cheats;
|
||||||
|
|
||||||
cvar_t *flood_msgs;
|
cvar_t *flood_msgs;
|
||||||
cvar_t *flood_persecond;
|
cvar_t *flood_persecond;
|
||||||
cvar_t *flood_waitdelay;
|
cvar_t *flood_waitdelay;
|
||||||
|
|
||||||
cvar_t *sv_maplist;
|
cvar_t *sv_maplist;
|
||||||
|
cvar_t *sv_stopspeed;
|
||||||
|
|
||||||
cvar_t *sv_stopspeed; //PGM (this was a define in g_phys.c)
|
cvar_t *g_showlogic;
|
||||||
|
cvar_t *gamerules;
|
||||||
|
cvar_t *huntercam;
|
||||||
|
cvar_t *strong_mines;
|
||||||
|
cvar_t *randomrespawn;
|
||||||
|
|
||||||
//ROGUE cvars
|
void SpawnEntities(char *mapname, char *entities, char *spawnpoint);
|
||||||
cvar_t *g_showlogic;
|
void ClientThink(edict_t *ent, usercmd_t *cmd);
|
||||||
cvar_t *gamerules;
|
qboolean ClientConnect(edict_t *ent, char *userinfo);
|
||||||
cvar_t *huntercam;
|
void ClientUserinfoChanged(edict_t *ent, char *userinfo);
|
||||||
cvar_t *strong_mines;
|
void ClientDisconnect(edict_t *ent);
|
||||||
cvar_t *randomrespawn;
|
void ClientBegin(edict_t *ent);
|
||||||
//ROGUE
|
void ClientCommand(edict_t *ent);
|
||||||
|
void RunEntity(edict_t *ent);
|
||||||
|
void WriteGame(char *filename, qboolean autosave);
|
||||||
|
void ReadGame(char *filename);
|
||||||
|
void WriteLevel(char *filename);
|
||||||
|
void ReadLevel(char *filename);
|
||||||
|
void InitGame(void);
|
||||||
|
void G_RunFrame(void);
|
||||||
|
|
||||||
void SpawnEntities (char *mapname, char *entities, char *spawnpoint);
|
/* =================================================================== */
|
||||||
void ClientThink (edict_t *ent, usercmd_t *cmd);
|
|
||||||
qboolean ClientConnect (edict_t *ent, char *userinfo);
|
|
||||||
void ClientUserinfoChanged (edict_t *ent, char *userinfo);
|
|
||||||
void ClientDisconnect (edict_t *ent);
|
|
||||||
void ClientBegin (edict_t *ent);
|
|
||||||
void ClientCommand (edict_t *ent);
|
|
||||||
void RunEntity (edict_t *ent);
|
|
||||||
void WriteGame (char *filename, qboolean autosave);
|
|
||||||
void ReadGame (char *filename);
|
|
||||||
void WriteLevel (char *filename);
|
|
||||||
void ReadLevel (char *filename);
|
|
||||||
void InitGame (void);
|
|
||||||
void G_RunFrame (void);
|
|
||||||
|
|
||||||
|
void
|
||||||
//===================================================================
|
ShutdownGame(void)
|
||||||
|
|
||||||
|
|
||||||
void ShutdownGame (void)
|
|
||||||
{
|
{
|
||||||
gi.dprintf ("==== ShutdownGame ====\n");
|
gi.dprintf("==== ShutdownGame ====\n");
|
||||||
|
|
||||||
gi.FreeTags (TAG_LEVEL);
|
gi.FreeTags(TAG_LEVEL);
|
||||||
gi.FreeTags (TAG_GAME);
|
gi.FreeTags(TAG_GAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
* Returns a pointer to the structure with
|
||||||
GetGameAPI
|
* all entry points and global variables
|
||||||
|
*/
|
||||||
Returns a pointer to the structure with all entry points
|
game_export_t *
|
||||||
and global variables
|
GetGameAPI(game_import_t *import)
|
||||||
=================
|
|
||||||
*/
|
|
||||||
game_export_t *GetGameAPI (game_import_t *import)
|
|
||||||
{
|
{
|
||||||
gi = *import;
|
gi = *import;
|
||||||
|
|
||||||
|
@ -132,71 +130,73 @@ game_export_t *GetGameAPI (game_import_t *import)
|
||||||
return &globals;
|
return &globals;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef GAME_HARD_LINKED
|
/*
|
||||||
// this is only here so the functions in q_shared.c and q_shwin.c can link
|
* this is only here so the functions in
|
||||||
void Sys_Error (char *error, ...)
|
* q_shared.c and q_shwin.c can link
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Sys_Error(char *error, ...)
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char text[1024];
|
char text[1024];
|
||||||
|
|
||||||
va_start (argptr, error);
|
va_start(argptr, error);
|
||||||
vsprintf (text, error, argptr);
|
vsprintf(text, error, argptr);
|
||||||
va_end (argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
gi.error (ERR_FATAL, "%s", text);
|
gi.error(ERR_FATAL, "%s", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Com_Printf (char *msg, ...)
|
void
|
||||||
|
Com_Printf(char *msg, ...)
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char text[1024];
|
char text[1024];
|
||||||
|
|
||||||
va_start (argptr, msg);
|
va_start(argptr, msg);
|
||||||
vsprintf (text, msg, argptr);
|
vsprintf(text, msg, argptr);
|
||||||
va_end (argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
gi.dprintf ("%s", text);
|
gi.dprintf("%s", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
/* ====================================================================== */
|
||||||
|
|
||||||
//======================================================================
|
void
|
||||||
|
ClientEndServerFrames(void)
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
ClientEndServerFrames
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void ClientEndServerFrames (void)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
// calc the player views now that all pushing
|
/* calc the player views now that all
|
||||||
// and damage has been added
|
pushing and damage has been added */
|
||||||
for (i=0 ; i<maxclients->value ; i++)
|
for (i = 0; i < maxclients->value; i++)
|
||||||
{
|
{
|
||||||
ent = g_edicts + 1 + i;
|
ent = g_edicts + 1 + i;
|
||||||
if (!ent->inuse || !ent->client)
|
|
||||||
continue;
|
|
||||||
ClientEndServerFrame (ent);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!ent->inuse || !ent->client)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientEndServerFrame(ent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
* Returns the created target changelevel
|
||||||
CreateTargetChangeLevel
|
*/
|
||||||
|
edict_t *
|
||||||
Returns the created target changelevel
|
CreateTargetChangeLevel(char *map)
|
||||||
=================
|
|
||||||
*/
|
|
||||||
edict_t *CreateTargetChangeLevel(char *map)
|
|
||||||
{
|
{
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
ent = G_Spawn ();
|
if (!map)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ent = G_Spawn();
|
||||||
ent->classname = "target_changelevel";
|
ent->classname = "target_changelevel";
|
||||||
Com_sprintf(level.nextmap, sizeof(level.nextmap), "%s", map);
|
Com_sprintf(level.nextmap, sizeof(level.nextmap), "%s", map);
|
||||||
ent->map = level.nextmap;
|
ent->map = level.nextmap;
|
||||||
|
@ -204,243 +204,267 @@ edict_t *CreateTargetChangeLevel(char *map)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
* The timelimit or fraglimit has been exceeded
|
||||||
EndDMLevel
|
*/
|
||||||
|
void
|
||||||
The timelimit or fraglimit has been exceeded
|
EndDMLevel(void)
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void EndDMLevel (void)
|
|
||||||
{
|
{
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
char *s, *t, *f;
|
char *s, *t, *f;
|
||||||
static const char *seps = " ,\n\r";
|
static const char *seps = " ,\n\r";
|
||||||
|
|
||||||
// stay on same level flag
|
/* stay on same level flag */
|
||||||
if ((int)dmflags->value & DF_SAME_LEVEL)
|
if ((int)dmflags->value & DF_SAME_LEVEL)
|
||||||
{
|
{
|
||||||
BeginIntermission (CreateTargetChangeLevel (level.mapname) );
|
BeginIntermission(CreateTargetChangeLevel(level.mapname));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if it's in the map list
|
/* see if it's in the map list */
|
||||||
if (*sv_maplist->string) {
|
if (*sv_maplist->string)
|
||||||
|
{
|
||||||
s = strdup(sv_maplist->string);
|
s = strdup(sv_maplist->string);
|
||||||
f = NULL;
|
f = NULL;
|
||||||
t = strtok(s, seps);
|
t = strtok(s, seps);
|
||||||
while (t != NULL) {
|
|
||||||
if (Q_stricmp(t, level.mapname) == 0) {
|
while (t != NULL)
|
||||||
// it's in the list, go to the next one
|
{
|
||||||
|
if (Q_stricmp(t, level.mapname) == 0)
|
||||||
|
{
|
||||||
|
/* it's in the list, go to the next one */
|
||||||
t = strtok(NULL, seps);
|
t = strtok(NULL, seps);
|
||||||
if (t == NULL) { // end of list, go to first one
|
|
||||||
if (f == NULL) // there isn't a first one, same level
|
if (t == NULL) /* end of list, go to first one */
|
||||||
BeginIntermission (CreateTargetChangeLevel (level.mapname) );
|
{
|
||||||
|
if (f == NULL) /* there isn't a first one, same level */
|
||||||
|
{
|
||||||
|
BeginIntermission(CreateTargetChangeLevel(level.mapname));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
BeginIntermission (CreateTargetChangeLevel (f) );
|
{
|
||||||
} else
|
BeginIntermission(CreateTargetChangeLevel(f));
|
||||||
BeginIntermission (CreateTargetChangeLevel (t) );
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BeginIntermission(CreateTargetChangeLevel(t));
|
||||||
|
}
|
||||||
|
|
||||||
free(s);
|
free(s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!f)
|
if (!f)
|
||||||
|
{
|
||||||
f = t;
|
f = t;
|
||||||
|
}
|
||||||
|
|
||||||
t = strtok(NULL, seps);
|
t = strtok(NULL, seps);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level.nextmap[0]) // go to a specific map
|
if (level.nextmap[0]) /* go to a specific map */
|
||||||
BeginIntermission (CreateTargetChangeLevel (level.nextmap) );
|
{
|
||||||
else { // search for a changelevel
|
BeginIntermission(CreateTargetChangeLevel(level.nextmap));
|
||||||
ent = G_Find (NULL, FOFS(classname), "target_changelevel");
|
}
|
||||||
|
else /* search for a changelevel */
|
||||||
|
{
|
||||||
|
ent = G_Find(NULL, FOFS(classname), "target_changelevel");
|
||||||
|
|
||||||
if (!ent)
|
if (!ent)
|
||||||
{ // the map designer didn't include a changelevel,
|
{
|
||||||
// so create a fake ent that goes back to the same level
|
/* the map designer didn't include a changelevel,
|
||||||
BeginIntermission (CreateTargetChangeLevel (level.mapname) );
|
so create a fake ent that goes back to the same
|
||||||
|
level */
|
||||||
|
BeginIntermission(CreateTargetChangeLevel(level.mapname));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
BeginIntermission (ent);
|
|
||||||
|
BeginIntermission(ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
/*
|
CheckNeedPass(void)
|
||||||
=================
|
|
||||||
CheckNeedPass
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void CheckNeedPass (void)
|
|
||||||
{
|
{
|
||||||
int need;
|
int need;
|
||||||
|
|
||||||
// if password or spectator_password has changed, update needpass
|
/* if password or spectator_password has
|
||||||
// as needed
|
changed, update needpass as needed */
|
||||||
if (password->modified || spectator_password->modified)
|
if (password->modified || spectator_password->modified)
|
||||||
{
|
{
|
||||||
password->modified = spectator_password->modified = false;
|
password->modified = spectator_password->modified = false;
|
||||||
|
|
||||||
need = 0;
|
need = 0;
|
||||||
|
|
||||||
if (*password->string && Q_stricmp(password->string, "none"))
|
if (*password->string && Q_stricmp(password->string, "none"))
|
||||||
|
{
|
||||||
need |= 1;
|
need |= 1;
|
||||||
if (*spectator_password->string && Q_stricmp(spectator_password->string, "none"))
|
}
|
||||||
|
|
||||||
|
if (*spectator_password->string &&
|
||||||
|
Q_stricmp(spectator_password->string, "none"))
|
||||||
|
{
|
||||||
need |= 2;
|
need |= 2;
|
||||||
|
}
|
||||||
|
|
||||||
gi.cvar_set("needpass", va("%d", need));
|
gi.cvar_set("needpass", va("%d", need));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
void
|
||||||
=================
|
CheckDMRules(void)
|
||||||
CheckDMRules
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void CheckDMRules (void)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
gclient_t *cl;
|
gclient_t *cl;
|
||||||
|
|
||||||
if (level.intermissiontime)
|
if (level.intermissiontime)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!deathmatch->value)
|
if (!deathmatch->value)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//=======
|
|
||||||
//ROGUE
|
|
||||||
if (gamerules && gamerules->value && DMGame.CheckDMRules)
|
if (gamerules && gamerules->value && DMGame.CheckDMRules)
|
||||||
{
|
{
|
||||||
if(DMGame.CheckDMRules())
|
if (DMGame.CheckDMRules())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//ROGUE
|
|
||||||
//=======
|
|
||||||
|
|
||||||
if (timelimit->value)
|
if (timelimit->value)
|
||||||
{
|
{
|
||||||
if (level.time >= timelimit->value*60)
|
if (level.time >= timelimit->value * 60)
|
||||||
{
|
{
|
||||||
gi.bprintf (PRINT_HIGH, "Timelimit hit.\n");
|
gi.bprintf(PRINT_HIGH, "Timelimit hit.\n");
|
||||||
EndDMLevel ();
|
EndDMLevel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fraglimit->value)
|
if (fraglimit->value)
|
||||||
{
|
{
|
||||||
for (i=0 ; i<maxclients->value ; i++)
|
for (i = 0; i < maxclients->value; i++)
|
||||||
{
|
{
|
||||||
cl = game.clients + i;
|
cl = game.clients + i;
|
||||||
if (!g_edicts[i+1].inuse)
|
|
||||||
|
if (!g_edicts[i + 1].inuse)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (cl->resp.score >= fraglimit->value)
|
if (cl->resp.score >= fraglimit->value)
|
||||||
{
|
{
|
||||||
gi.bprintf (PRINT_HIGH, "Fraglimit hit.\n");
|
gi.bprintf(PRINT_HIGH, "Fraglimit hit.\n");
|
||||||
EndDMLevel ();
|
EndDMLevel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
/*
|
ExitLevel(void)
|
||||||
=============
|
|
||||||
ExitLevel
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void ExitLevel (void)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
char command [256];
|
char command[256];
|
||||||
|
|
||||||
Com_sprintf (command, sizeof(command), "gamemap \"%s\"\n", level.changemap);
|
Com_sprintf(command, sizeof(command), "gamemap \"%s\"\n", level.changemap);
|
||||||
gi.AddCommandString (command);
|
gi.AddCommandString(command);
|
||||||
level.changemap = NULL;
|
level.changemap = NULL;
|
||||||
level.exitintermission = 0;
|
level.exitintermission = 0;
|
||||||
level.intermissiontime = 0;
|
level.intermissiontime = 0;
|
||||||
ClientEndServerFrames ();
|
ClientEndServerFrames();
|
||||||
|
|
||||||
// clear some things before going to next level
|
/* clear some things before going to next level */
|
||||||
for (i=0 ; i<maxclients->value ; i++)
|
for (i = 0; i < maxclients->value; i++)
|
||||||
{
|
{
|
||||||
ent = g_edicts + 1 + i;
|
ent = g_edicts + 1 + i;
|
||||||
if (!ent->inuse)
|
|
||||||
continue;
|
|
||||||
if (ent->health > ent->client->pers.max_health)
|
|
||||||
ent->health = ent->client->pers.max_health;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!ent->inuse)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ent->health > ent->client->pers.max_health)
|
||||||
|
{
|
||||||
|
ent->health = ent->client->pers.max_health;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
* Advances the world by 0.1 seconds
|
||||||
G_RunFrame
|
*/
|
||||||
|
void
|
||||||
Advances the world by 0.1 seconds
|
G_RunFrame(void)
|
||||||
================
|
|
||||||
*/
|
|
||||||
void G_RunFrame (void)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
level.framenum++;
|
level.framenum++;
|
||||||
level.time = level.framenum*FRAMETIME;
|
level.time = level.framenum * FRAMETIME;
|
||||||
|
|
||||||
// choose a client for monsters to target this frame
|
/* choose a client for monsters to target this frame */
|
||||||
AI_SetSightClient ();
|
AI_SetSightClient();
|
||||||
|
|
||||||
// exit intermissions
|
|
||||||
|
|
||||||
|
/* exit intermissions */
|
||||||
if (level.exitintermission)
|
if (level.exitintermission)
|
||||||
{
|
{
|
||||||
ExitLevel ();
|
ExitLevel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/* treat each object in turn even the
|
||||||
// treat each object in turn
|
world gets a chance to think */
|
||||||
// even the world gets a chance to think
|
|
||||||
//
|
|
||||||
ent = &g_edicts[0];
|
ent = &g_edicts[0];
|
||||||
for (i=0 ; i<globals.num_edicts ; i++, ent++)
|
|
||||||
|
for (i = 0; i < globals.num_edicts; i++, ent++)
|
||||||
{
|
{
|
||||||
if (!ent->inuse)
|
if (!ent->inuse)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
level.current_entity = ent;
|
level.current_entity = ent;
|
||||||
|
|
||||||
VectorCopy (ent->s.origin, ent->s.old_origin);
|
VectorCopy(ent->s.origin, ent->s.old_origin);
|
||||||
|
|
||||||
// if the ground entity moved, make sure we are still on it
|
/* if the ground entity moved, make sure we are still on it */
|
||||||
if ((ent->groundentity) && (ent->groundentity->linkcount != ent->groundentity_linkcount))
|
if ((ent->groundentity) &&
|
||||||
|
(ent->groundentity->linkcount != ent->groundentity_linkcount))
|
||||||
{
|
{
|
||||||
ent->groundentity = NULL;
|
ent->groundentity = NULL;
|
||||||
if ( !(ent->flags & (FL_SWIM|FL_FLY)) && (ent->svflags & SVF_MONSTER) )
|
|
||||||
|
if (!(ent->flags & (FL_SWIM | FL_FLY)) &&
|
||||||
|
(ent->svflags & SVF_MONSTER))
|
||||||
{
|
{
|
||||||
M_CheckGround (ent);
|
M_CheckGround(ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i > 0 && i <= maxclients->value)
|
if ((i > 0) && (i <= maxclients->value))
|
||||||
{
|
{
|
||||||
ClientBeginServerFrame (ent);
|
ClientBeginServerFrame(ent);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
G_RunEntity (ent);
|
G_RunEntity(ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if it is time to end a deathmatch
|
/* see if it is time to end a deathmatch */
|
||||||
CheckDMRules ();
|
CheckDMRules();
|
||||||
|
|
||||||
// see if needpass needs updated
|
/* see if needpass needs updated */
|
||||||
CheckNeedPass ();
|
CheckNeedPass();
|
||||||
|
|
||||||
// build the playerstate_t structures for all players
|
/* build the playerstate_t structures for all players */
|
||||||
ClientEndServerFrames ();
|
ClientEndServerFrames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue