mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2024-11-29 23:42:00 +00:00
Some cleanups
This commit is contained in:
parent
c7a4d2025a
commit
dd658094c5
5 changed files with 25 additions and 18 deletions
|
@ -217,7 +217,7 @@ typedef struct bot_state_s {
|
||||||
float lastair_time; //last time the bot had air
|
float lastair_time; //last time the bot had air
|
||||||
float teleport_time; //last time the bot teleported
|
float teleport_time; //last time the bot teleported
|
||||||
float camp_time; //last time camped
|
float camp_time; //last time camped
|
||||||
float camp_range; //camp range
|
// float camp_range; //camp range
|
||||||
float weaponchange_time; //time the bot started changing weapons
|
float weaponchange_time; //time the bot started changing weapons
|
||||||
float firethrottlewait_time; //amount of time to wait
|
float firethrottlewait_time; //amount of time to wait
|
||||||
float firethrottleshoot_time; //amount of time to shoot
|
float firethrottleshoot_time; //amount of time to shoot
|
||||||
|
@ -297,11 +297,11 @@ typedef struct bot_state_s {
|
||||||
int ctfstrategy; //ctf strategy
|
int ctfstrategy; //ctf strategy
|
||||||
char subteam[32]; //sub team name
|
char subteam[32]; //sub team name
|
||||||
float formation_dist; //formation team mate intervening space
|
float formation_dist; //formation team mate intervening space
|
||||||
char formation_teammate[16]; //netname of the team mate the bot uses for relative positioning
|
// char formation_teammate[16]; //netname of the team mate the bot uses for relative positioning
|
||||||
float formation_angle; //angle relative to the formation team mate
|
// float formation_angle; //angle relative to the formation team mate
|
||||||
vec3_t formation_dir; //the direction the formation is moving in
|
// vec3_t formation_dir; //the direction the formation is moving in
|
||||||
vec3_t formation_origin; //origin the bot uses for relative positioning
|
// vec3_t formation_origin; //origin the bot uses for relative positioning
|
||||||
bot_goal_t formation_goal; //formation goal
|
// bot_goal_t formation_goal; //formation goal
|
||||||
|
|
||||||
bot_activategoal_t *activatestack; //first activate goal on the stack
|
bot_activategoal_t *activatestack; //first activate goal on the stack
|
||||||
bot_activategoal_t activategoalheap[MAX_ACTIVATESTACK]; //activate goal heap
|
bot_activategoal_t activategoalheap[MAX_ACTIVATESTACK]; //activate goal heap
|
||||||
|
|
|
@ -493,7 +493,8 @@ voiceCommand_t voiceCommands[] = {
|
||||||
|
|
||||||
int BotVoiceChatCommand(bot_state_t * bs, int mode, char *voiceChat)
|
int BotVoiceChatCommand(bot_state_t * bs, int mode, char *voiceChat)
|
||||||
{
|
{
|
||||||
int i, voiceOnly, clientNum, color;
|
int i, clientNum;
|
||||||
|
// int i, voiceOnly, clientNum, color;
|
||||||
char *ptr, buf[MAX_MESSAGE_SIZE], *cmd;
|
char *ptr, buf[MAX_MESSAGE_SIZE], *cmd;
|
||||||
|
|
||||||
if (!TeamPlayIsOn()) {
|
if (!TeamPlayIsOn()) {
|
||||||
|
@ -509,7 +510,7 @@ int BotVoiceChatCommand(bot_state_t * bs, int mode, char *voiceChat)
|
||||||
for (ptr = cmd; *cmd && *cmd > ' '; cmd++);
|
for (ptr = cmd; *cmd && *cmd > ' '; cmd++);
|
||||||
while (*cmd && *cmd <= ' ')
|
while (*cmd && *cmd <= ' ')
|
||||||
*cmd++ = '\0';
|
*cmd++ = '\0';
|
||||||
voiceOnly = atoi(ptr);
|
//voiceOnly = atoi(ptr);
|
||||||
for (ptr = cmd; *cmd && *cmd > ' '; cmd++);
|
for (ptr = cmd; *cmd && *cmd > ' '; cmd++);
|
||||||
while (*cmd && *cmd <= ' ')
|
while (*cmd && *cmd <= ' ')
|
||||||
*cmd++ = '\0';
|
*cmd++ = '\0';
|
||||||
|
@ -517,7 +518,7 @@ int BotVoiceChatCommand(bot_state_t * bs, int mode, char *voiceChat)
|
||||||
for (ptr = cmd; *cmd && *cmd > ' '; cmd++);
|
for (ptr = cmd; *cmd && *cmd > ' '; cmd++);
|
||||||
while (*cmd && *cmd <= ' ')
|
while (*cmd && *cmd <= ' ')
|
||||||
*cmd++ = '\0';
|
*cmd++ = '\0';
|
||||||
color = atoi(ptr);
|
//color = atoi(ptr);
|
||||||
|
|
||||||
if (!BotSameTeam(bs, clientNum)) {
|
if (!BotSameTeam(bs, clientNum)) {
|
||||||
return qfalse;
|
return qfalse;
|
||||||
|
|
|
@ -103,7 +103,7 @@ int _atoi( const char **stringPtr );
|
||||||
long strtol( const char *nptr, char **endptr, int base );
|
long strtol( const char *nptr, char **endptr, int base );
|
||||||
|
|
||||||
int Q_vsnprintf( char *buffer, size_t length, const char *fmt, va_list argptr );
|
int Q_vsnprintf( char *buffer, size_t length, const char *fmt, va_list argptr );
|
||||||
int Q_snprintf( char *buffer, size_t length, const char *fmt, ... ) __attribute__ ((format (printf, 3, 4)));
|
//int Q_snprintf( char *buffer, size_t length, const char *fmt, ... ) __attribute__ ((format (printf, 3, 4)));
|
||||||
|
|
||||||
int sscanf( const char *buffer, const char *fmt, ... ) __attribute__ ((format (scanf, 2, 3)));
|
int sscanf( const char *buffer, const char *fmt, ... ) __attribute__ ((format (scanf, 2, 3)));
|
||||||
|
|
||||||
|
|
|
@ -633,7 +633,7 @@ static cvarTable_t gameCvarTable[] = {
|
||||||
{&g_teamAutoJoin, "g_teamAutoJoin", "0", CVAR_ARCHIVE},
|
{&g_teamAutoJoin, "g_teamAutoJoin", "0", CVAR_ARCHIVE},
|
||||||
{&g_teamForceBalance, "g_teamForceBalance", "0", CVAR_ARCHIVE},
|
{&g_teamForceBalance, "g_teamForceBalance", "0", CVAR_ARCHIVE},
|
||||||
{&g_warmup, "g_warmup", "20", CVAR_ARCHIVE, 0, qtrue},
|
{&g_warmup, "g_warmup", "20", CVAR_ARCHIVE, 0, qtrue},
|
||||||
{&g_doWarmup, "g_doWarmup", "0", 0, 0, qtrue},
|
{&g_doWarmup, "g_doWarmup", "0", CVAR_ARCHIVE, 0, qtrue},
|
||||||
{&g_logfile, "g_log", "reaction.log", CVAR_ARCHIVE, 0, qfalse},
|
{&g_logfile, "g_log", "reaction.log", CVAR_ARCHIVE, 0, qfalse},
|
||||||
{&g_logfileSync, "g_logsync", "0", CVAR_ARCHIVE, 0, qfalse},
|
{&g_logfileSync, "g_logsync", "0", CVAR_ARCHIVE, 0, qfalse},
|
||||||
{&g_password, "g_password", "", CVAR_USERINFO, 0, qfalse},
|
{&g_password, "g_password", "", CVAR_USERINFO, 0, qfalse},
|
||||||
|
@ -1322,6 +1322,10 @@ void G_InitGame(int levelTime, int randomSeed, int restart)
|
||||||
// range are NEVER anything but clients
|
// range are NEVER anything but clients
|
||||||
level.num_entities = MAX_CLIENTS;
|
level.num_entities = MAX_CLIENTS;
|
||||||
|
|
||||||
|
for ( i=0 ; i<MAX_CLIENTS ; i++ ) {
|
||||||
|
g_entities[i].classname = "clientslot";
|
||||||
|
}
|
||||||
|
|
||||||
// let the server system know where the entites are
|
// let the server system know where the entites are
|
||||||
trap_LocateGameData(level.gentities, level.num_entities, sizeof(gentity_t),
|
trap_LocateGameData(level.gentities, level.num_entities, sizeof(gentity_t),
|
||||||
&level.clients[0].ps, sizeof(level.clients[0]));
|
&level.clients[0].ps, sizeof(level.clients[0]));
|
||||||
|
@ -1446,6 +1450,7 @@ void G_ShutdownGame(int restart)
|
||||||
G_LogPrintf("ShutdownGame:\n");
|
G_LogPrintf("ShutdownGame:\n");
|
||||||
G_LogPrintf("------------------------------------------------------------\n");
|
G_LogPrintf("------------------------------------------------------------\n");
|
||||||
trap_FS_FCloseFile(level.logFile);
|
trap_FS_FCloseFile(level.logFile);
|
||||||
|
level.logFile = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
camera_shutdown();
|
camera_shutdown();
|
||||||
|
@ -2048,7 +2053,7 @@ void QDECL G_LogPrintf(const char *fmt, ...)
|
||||||
Com_sprintf(string, sizeof(string), "[%02i:%02i:%02i] ", now.tm_hour, now.tm_min, now.tm_sec);
|
Com_sprintf(string, sizeof(string), "[%02i:%02i:%02i] ", now.tm_hour, now.tm_min, now.tm_sec);
|
||||||
|
|
||||||
va_start(argptr, fmt);
|
va_start(argptr, fmt);
|
||||||
Q_vsnprintf(string + 11, sizeof(string), fmt, argptr);
|
Q_vsnprintf(string + 11, sizeof(string) - 11, fmt, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
if (g_dedicated.integer) {
|
if (g_dedicated.integer) {
|
||||||
|
@ -2764,7 +2769,7 @@ Advances the non-player objects in the world
|
||||||
void G_RunFrame(int levelTime)
|
void G_RunFrame(int levelTime)
|
||||||
{
|
{
|
||||||
gentity_t *ent;
|
gentity_t *ent;
|
||||||
int i, msec, start, end;
|
int i; // msec, start, end;
|
||||||
|
|
||||||
// if we are waiting for the level to restart, do nothing
|
// if we are waiting for the level to restart, do nothing
|
||||||
if (level.restarted) {
|
if (level.restarted) {
|
||||||
|
@ -2779,7 +2784,7 @@ void G_RunFrame(int levelTime)
|
||||||
level.framenum++;
|
level.framenum++;
|
||||||
level.previousTime = level.time;
|
level.previousTime = level.time;
|
||||||
level.time = levelTime;
|
level.time = levelTime;
|
||||||
msec = level.time - level.previousTime;
|
// msec = level.time - level.previousTime;
|
||||||
|
|
||||||
//Makro - in progress
|
//Makro - in progress
|
||||||
//G_UpdateParentDeltas();
|
//G_UpdateParentDeltas();
|
||||||
|
@ -2791,7 +2796,7 @@ void G_RunFrame(int levelTime)
|
||||||
//
|
//
|
||||||
// go through all allocated objects
|
// go through all allocated objects
|
||||||
//
|
//
|
||||||
start = trap_Milliseconds();
|
// start = trap_Milliseconds();
|
||||||
//Makro - use g_parentOder
|
//Makro - use g_parentOder
|
||||||
for (i = 0; i < level.num_entities; i++) {
|
for (i = 0; i < level.num_entities; i++) {
|
||||||
ent = g_parentOrder[i];
|
ent = g_parentOrder[i];
|
||||||
|
@ -2860,9 +2865,9 @@ void G_RunFrame(int levelTime)
|
||||||
//Makro - in progress
|
//Makro - in progress
|
||||||
//G_AdjustCoordinates();
|
//G_AdjustCoordinates();
|
||||||
|
|
||||||
end = trap_Milliseconds();
|
// end = trap_Milliseconds();
|
||||||
|
|
||||||
start = trap_Milliseconds();
|
// start = trap_Milliseconds();
|
||||||
// perform final fixups on the players
|
// perform final fixups on the players
|
||||||
ent = &g_entities[0];
|
ent = &g_entities[0];
|
||||||
for (i = 0; i < level.maxclients; i++, ent++) {
|
for (i = 0; i < level.maxclients; i++, ent++) {
|
||||||
|
@ -2870,7 +2875,7 @@ void G_RunFrame(int levelTime)
|
||||||
ClientEndFrame(ent);
|
ClientEndFrame(ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end = trap_Milliseconds();
|
// end = trap_Milliseconds();
|
||||||
|
|
||||||
// see if it is time to do a tournement restart
|
// see if it is time to do a tournement restart
|
||||||
// JBravo: no need if teamplay
|
// JBravo: no need if teamplay
|
||||||
|
|
|
@ -89,6 +89,7 @@ void G_BounceMissile(gentity_t * ent, trace_t * trace)
|
||||||
// check for stop
|
// check for stop
|
||||||
if (trace->plane.normal[2] > 0.2 && VectorLength(ent->s.pos.trDelta) < 40) {
|
if (trace->plane.normal[2] > 0.2 && VectorLength(ent->s.pos.trDelta) < 40) {
|
||||||
G_SetOrigin(ent, trace->endpos);
|
G_SetOrigin(ent, trace->endpos);
|
||||||
|
ent->s.time = level.time / 4;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue