From 65b6c1ac91bf9b81c64baefc168b6b19f43481f4 Mon Sep 17 00:00:00 2001 From: Walter Julius Hennecke Date: Sat, 15 Mar 2014 17:31:04 +0100 Subject: [PATCH] - Added check if entity is a client for G_PrintfClient - Updates to g_cmds.c --- code/game/g_cmds.c | 471 ++++++++------- code/game/g_main.c | 1394 +++++++++++++++++++++----------------------- 2 files changed, 928 insertions(+), 937 deletions(-) diff --git a/code/game/g_cmds.c b/code/game/g_cmds.c index 4fa7595..71df5d7 100644 --- a/code/game/g_cmds.c +++ b/code/game/g_cmds.c @@ -2107,7 +2107,7 @@ static void Cmd_ShakeCamera_f(gentity_t* ent) { trap_Argv(1, arg_intensity, sizeof(arg_intensity)); //TiM : More userfriendly - if (arg_intensity[0] = 0) { //if user added no args (ie wanted the parameters) + if (arg_intensity[0] == 0) { //if user added no args (ie wanted the parameters) G_PrintfClient(ent, "\nUsage: User makes every player's screen shake for X seconds\nCommand: Shake [Intensity] [Duration]\n"); return; } @@ -3000,7 +3000,7 @@ static void Cmd_ForceRank_f(gentity_t* ent) { #ifndef SQL if (!IsAdmin(ent)) { - G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); + G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); return; } #else @@ -3263,7 +3263,7 @@ static void Cmd_Revive_f(gentity_t* ent) { } } } else { - if (pla_str[0] = 0) { + if (pla_str[0] == 0) { //Just me if ((ent->health <= 1) && (ent->client->ps.pm_type == PM_DEAD)) { G_Client_Spawn(ent, 1, qtrue); @@ -3396,8 +3396,11 @@ Admin Message RPG-X | Phenix | 08/06/2005 ================= */ -static void Cmd_admin_message(gentity_t *ent) { - char *arg; +static void Cmd_admin_message(gentity_t* ent) { + char* arg = NULL; + + G_Assert(ent, (void)0); + G_Assert(ent->client, (void)0); if (trap_Argc() < 1) { return; @@ -3407,24 +3410,20 @@ static void Cmd_admin_message(gentity_t *ent) { #ifndef SQL if (!IsAdmin(ent)) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); return; } #else if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_MESSAGE) ) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as a user with the appropriate rights.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as a user with the appropriate rights.\n"); return; } #endif - if (!ent || !ent->client) { - return; // not fully in game yet - } - arg = ConcatArgs(1); - if (!arg[0]) { //if user added no args (ie wanted the parameters) - trap_SendServerCommand(ent - g_entities, va("print \"\nUsage: Admin broadcasts a message to all users on the server that stays for several seconds\nCommand: Msg \"\"\n\" ")); + if (arg[0] == 0) { //if user added no args (ie wanted the parameters) + G_PrintfClient(ent, "\nUsage: Admin broadcasts a message to all users on the server that stays for several seconds\nCommand: Msg \"\"\n"); return; } @@ -3433,7 +3432,7 @@ static void Cmd_admin_message(gentity_t *ent) { } //RPG-X: Marcin: changed to -1 - trap_SendServerCommand(-1, va("print \"%s\n\" ", arg)); + G_PrintfClientAll("%s\n", arg); trap_SendServerCommand(-1, va("servermsg \"%s\"", arg)); @@ -3444,25 +3443,27 @@ static void Cmd_admin_message(gentity_t *ent) { Cmd_ForceModel_f ================= */ -static void Cmd_ForceModel_f(gentity_t *ent) { - gclient_t *cl; - gentity_t *other; - gentity_t *sayA; - int j; +static void Cmd_ForceModel_f(gentity_t* ent) { char send[100]; - char str[MAX_TOKEN_CHARS]; - char *str2; + char str[MAX_TOKEN_CHARS]; + char* str2 = NULL; char clientCmd[64]; - clientPersistant_t *pers; + int32_t j = 0; + gclient_t* cl = NULL; + gentity_t* other = NULL; + gentity_t* sayA = NULL; + clientPersistant_t* pers = NULL; + + G_Assert(ent, (void)0); #ifndef SQL if (!IsAdmin(ent)) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); return; } #else if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_FORCEPARM) ) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as a user with the appropriate rights.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as a user with the appropriate rights.\n"); return; } #endif @@ -3470,17 +3471,16 @@ static void Cmd_ForceModel_f(gentity_t *ent) { //get the first arg trap_Argv(1, str, sizeof(str)); - if (!str[0]) { //if user added no args (ie wanted the parameters) - trap_SendServerCommand(ent - g_entities, va("print \"\nUsage: User forces another player into a specific character model\n\nCommand: ForceModel [Player ID] /\n\" ")); + if (str[0] == 0) { //if user added no args (ie wanted the parameters) + G_PrintfClient(ent, "\nUsage: User forces another player into a specific character model\n\nCommand: ForceModel [Player ID] /\n"); return; } // find the player cl = ClientForString(str); - if (!cl) { - return; - } + G_Assert(cl, (void)0); other = g_entities + cl->ps.clientNum; + G_Assert(other, (void)0); //Get the new model str2 = ConcatArgs(2); @@ -3510,40 +3510,39 @@ static void Cmd_ForceModel_f(gentity_t *ent) { Cmd_PlayMusic_f ================= */ -static void Cmd_PlayMusic_f(gentity_t *ent) { +static void Cmd_PlayMusic_f(gentity_t* ent) { char songIntro[MAX_TOKEN_CHARS]; char songLoop[MAX_TOKEN_CHARS]; //standard checks + G_Assert(ent, (void)0); + G_Assert(ent->client, (void)0); + #ifndef SQL if (!IsAdmin(ent)) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); return; } #else if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_MUSIC) ) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as a user with the appropriate rights.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as a user with the appropriate rights.\n"); return; } #endif - if (!ent || !ent->client) - return; - //Load the arguments trap_Argv(1, songIntro, sizeof(songIntro)); trap_Argv(2, songLoop, sizeof(songLoop)); //Output the isntructions if no arguments - if (!songIntro[0]) { - trap_SendServerCommand(ent - g_entities, va("print \"\nUsage: Plays music throughout the level\n\nCommand: playMusic [songIntro] \n\" ")); + if (songIntro[0] == 0) { + G_PrintfClient(ent, "\nUsage: Plays music throughout the level\n\nCommand: playMusic [songIntro] \n"); return; } //Broadcast the command trap_SetConfigstring(CS_MUSIC, va("%s %s", songIntro, songLoop)); - } /* @@ -3551,24 +3550,24 @@ static void Cmd_PlayMusic_f(gentity_t *ent) { Cmd_StopMusic_f ================= */ -static void Cmd_StopMusic_f(gentity_t *ent) { +static void Cmd_StopMusic_f(gentity_t* ent) { //standard checks + G_Assert(ent, (void)0); + G_Assert(ent->client, (void)0); + #ifndef SQL if (!IsAdmin(ent)) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); return; } #else if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_MUSIC) ) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as a user with the appropriate rights.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as a user with the appropriate rights.\n"); return; } #endif - if (!ent || !ent->client) - return; - trap_SetConfigstring(CS_MUSIC, ""); } @@ -3577,30 +3576,30 @@ static void Cmd_StopMusic_f(gentity_t *ent) { Cmd_PlaySound_f ================= */ -static void Cmd_PlaySound_f(gentity_t *ent) { +static void Cmd_PlaySound_f(gentity_t* ent) { char soundAddress[MAX_TOKEN_CHARS]; + G_Assert(ent, (void)0); + G_Assert(ent->client, (void)0); + #ifndef SQL if (!IsAdmin(ent)) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); return; } #else if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_MUSIC) ) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as a user with the appropriate rights.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as a user with the appropriate rights.\n"); return; } #endif - if (!ent || !ent->client) - return; - //Load the arguments trap_Argv(1, soundAddress, sizeof(soundAddress)); //Output the isntructions if no arguments - if (!soundAddress[0]) { - trap_SendServerCommand(ent - g_entities, va("print \"\nUsage: Plays a sound file throughout the level\n\nCommand: playSound [File Address]\n\" ")); + if (soundAddress[0] == 0) { + G_PrintfClient(ent, "\nUsage: Plays a sound file throughout the level\n\nCommand: playSound [File Address]\n"); return; } @@ -3614,14 +3613,17 @@ static void Cmd_PlaySound_f(gentity_t *ent) { Cmd_Bolton_f ================= */ -static void Cmd_Bolton_f(gentity_t *ent) { - gclient_t *client; - char *msg; +static void Cmd_Bolton_f(gentity_t* ent) { + char* msg = NULL; + gclient_t* client = NULL; + + G_Assert(ent, (void)0); + G_Assert(ent->client, (void)0); client = ent->client; ent->flags ^= FL_HOLSTER; - if (!(ent->flags & FL_HOLSTER)) { + if ((ent->flags & FL_HOLSTER) == 0) { msg = "You took your equipment off.\n"; client->ps.powerups[PW_BOLTON] = level.time; } else { @@ -3629,7 +3631,7 @@ static void Cmd_Bolton_f(gentity_t *ent) { client->ps.powerups[PW_BOLTON] = INT_MAX; } - trap_SendServerCommand(ent - g_entities, va("print \"%s\"", msg)); + G_PrintfClient(ent, "%s", msg); } /* @@ -3641,20 +3643,23 @@ Cmd_UseEnt_f //if no argument, it'll 'use' the entity the player's looking at //Addendum: if player enters targetname, (checked to make sure it's no valid int in the ent list) //activate that one. -static void Cmd_UseEnt_f(gentity_t *ent) { - char entArg[MAX_TOKEN_CHARS]; - gentity_t *targetEnt; - int index; - playerState_t *ps; +static void Cmd_UseEnt_f(gentity_t* ent) { + int index = 0; + char entArg[MAX_TOKEN_CHARS]; + gentity_t* targetEnt = NULL; + playerState_t* ps = NULL; + + G_Assert(ent, (void)0); + G_Assert(ent->client, (void)0); #ifndef SQL if (!IsAdmin(ent)) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); return; } #else if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_USEENT) ) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as a user with the appropriate rights.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as a user with the appropriate rights.\n"); return; } #endif @@ -3664,10 +3669,14 @@ static void Cmd_UseEnt_f(gentity_t *ent) { ps = &ent->client->ps; //No arguments - Do a trace - if (!entArg[0]) { - vec3_t start, forward, end; + if (entArg[0] == 0) { + vec3_t start = { 0, 0, 0 }; + vec3_t forward = { 0, 0, 0 }; + vec3_t end = { 0, 0, 0 }; trace_t tr; + memset(&tr, 0, sizeof(trace_t)); + //calc start VectorCopy(ent->r.currentOrigin, start); start[2] += ps->viewheight; @@ -3689,7 +3698,7 @@ static void Cmd_UseEnt_f(gentity_t *ent) { targetEnt = G_Find(NULL, FOFS(targetname), entArg); //STILL no dice?? Gah... just eff it then lol. - if (!targetEnt) { + if (targetEnt == NULL) { return; } } else { @@ -3707,7 +3716,7 @@ static void Cmd_UseEnt_f(gentity_t *ent) { targetEnt->use(targetEnt, ent, ent); //Activate the Ent } else { //otherwise berrate the user for being n00bish - trap_SendServerCommand(ent - g_entities, va(" print \"Entity %i cannot be activated in that way.\n\" ", index)); + G_PrintfClient(ent, "Entity %i cannot be activated in that way.\n", index); } } @@ -3717,20 +3726,22 @@ Cmd_EntList_f ================= TiM: Displays as many ents it can in the console without pwning the network code in the process */ -static void Cmd_EntList_f(gentity_t *ent) { - int i; - gentity_t *mapEnt; - char entBuffer[128]; - char mainBuffer[1024]; //16384 +static void Cmd_EntList_f(gentity_t* ent) { + char entBuffer[128]; + char mainBuffer[1024]; //16384 + int32_t i = 0; + gentity_t* mapEnt = NULL; + + G_Assert(ent, (void)0); #ifndef SQL if (!IsAdmin(ent)) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); return; } #else if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_USEENT) ) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as a user with the appropriate rights.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as a user with the appropriate rights.\n"); return; } #endif @@ -3747,7 +3758,7 @@ static void Cmd_EntList_f(gentity_t *ent) { if (mapEnt->use) { memset(&entBuffer, 0, sizeof(entBuffer)); - if (mapEnt->targetname) { + if (mapEnt->targetname != NULL) { Com_sprintf(entBuffer, sizeof(entBuffer), "ClassName: '%s', TargetName: '%s', ID: %i\n", mapEnt->classname, mapEnt->targetname, i); } else { Com_sprintf(entBuffer, sizeof(entBuffer), "ClassName: '%s', ID: %i\n", mapEnt->classname, i); @@ -3763,9 +3774,9 @@ static void Cmd_EntList_f(gentity_t *ent) { } if (strlen(mainBuffer) > 0) { - trap_SendServerCommand(ent - g_entities, va("print \"%s\" ", mainBuffer)); + G_PrintfClient(ent, "%s", mainBuffer); } else { - trap_SendServerCommand(ent - g_entities, va("print \"No activatable entities detected.\n\" ")); + G_PrintfClient(ent, "No activate able entities detected.\n"); } } @@ -3780,33 +3791,35 @@ beamTo: beamTo: */ // Harry -- Get the command... -static void Cmd_BeamToLoc_f(gentity_t *ent) { - char argStr[MAX_TOKEN_CHARS]; - gentity_t *locEnt; - gentity_t *targEnt; - gentity_t *beamTarget; - int i; - int clientNum = 0, locIndex = 0; - char *strLoc = NULL; - qboolean all = qfalse; +static void Cmd_BeamToLoc_f(gentity_t* ent) { + char argStr[MAX_TOKEN_CHARS]; + char* strLoc = NULL; + int32_t i = 0; + int32_t clientNum = 0; + int32_t locIndex = 0; + qboolean all = qfalse; + gentity_t* locEnt = NULL; + gentity_t* targEnt = NULL; + gentity_t* beamTarget = NULL; + + G_Assert(ent, (void)0); //Has to be an admin.. if anyone had it, the brig would become useless. - #ifndef SQL if (!IsAdmin(ent)) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); return; } #else if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_BEAM) ) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as a user with the appropriate rights.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as a user with the appropriate rights.\n"); return; } #endif trap_Argv(1, argStr, sizeof(argStr)); - if (!argStr[0]) { - trap_SendServerCommand(ent - g_entities, va("print \"Usage: Allows you to beam yourself to any 'target_location' entity that has a compatible beam-in point\nCommand: (For yourself) - beamToLocation \n(For other players) - beamTo \nType '/beamList' into the console for a list of the 'target_location' indexes.\n\" ")); + if (argStr[0] == 0) { + G_PrintfClient(ent, "Usage: Allows you to beam yourself to any 'target_location' entity that has a compatible beam-in point\nCommand: (For yourself) - beamToLocation \n(For other players) - beamTo \nType '/beamList' into the console for a list of the 'target_location' indexes.\n"); return; } @@ -3815,7 +3828,7 @@ static void Cmd_BeamToLoc_f(gentity_t *ent) { //must be an int coz it's the clientNum, anything else is not valid. if (trap_Argc() > 2 && (unsigned char)argStr[0] >= '0' && (unsigned char)argStr[0] <= '9') { //beam all? - if (!Q_stricmp(argStr, "all")) { + if (Q_stricmp(argStr, "all") == 0) { all = qtrue; } else { //Get Client ID @@ -3823,13 +3836,13 @@ static void Cmd_BeamToLoc_f(gentity_t *ent) { } if (clientNum < 0 || clientNum >= MAX_CLIENTS) { - trap_SendServerCommand(ent - g_entities, va("chat \"Invalid Client ID Number.\n\" ")); + G_PrintfClient(ent, "Invalid Client ID Number.\n"); return; } beamTarget = &g_entities[clientNum]; - if (!beamTarget || !beamTarget->client) { - trap_SendServerCommand(ent - g_entities, va("chat \"No valid client found.\n\" ")); + if (beamTarget == NULL || beamTarget->client == NULL) { + G_PrintfClient(ent, "No valid client found.\n"); return; } @@ -3857,7 +3870,7 @@ static void Cmd_BeamToLoc_f(gentity_t *ent) { //if it's an invalid index, then I'm guessing the player specified location by name then if (locIndex < 1 || locIndex >= MAX_LOCATIONS) { if (!strLoc) { - trap_SendServerCommand(ent - g_entities, va("chat \"Invalid Location Index.\n\" ")); + G_PrintfClient(ent, "Invalid Location Index.\n"); return; } } @@ -3881,19 +3894,19 @@ static void Cmd_BeamToLoc_f(gentity_t *ent) { } if ((locEnt == NULL) || (locEnt->type != ENT_TARGET_LOCATION)) { - trap_SendServerCommand(ent - g_entities, va("chat \"Invalid Beam Entity.\n\" ")); + G_PrintfClient(ent, "Invalid Beam Entity.\n"); return; } //locEnt - if (locEnt->target) { + if (locEnt->target != NULL) { targEnt = G_PickTarget(locEnt->target); } else { targEnt = locEnt; } - if (targEnt /*&& TransDat[beamTarget->client->ps.clientNum].beamTime == 0*/) { - vec3_t destPoint; + if (targEnt != NULL) { + vec3_t destPoint = { 0, 0, 0 }; //TiM : Leeched this code off elsewhere. instead of hard-coding a value, align it to the ent's bbox. //In case they don't use notnulls but something else. VectorCopy(targEnt->s.origin, destPoint); @@ -3906,8 +3919,14 @@ static void Cmd_BeamToLoc_f(gentity_t *ent) { if (!all) { G_InitTransport(beamTarget->client->ps.clientNum, destPoint, targEnt->s.angles); } else { + gentity_t* e = NULL; for (i = 0; i < MAX_CLIENTS && i < g_maxclients.integer; i++) { - if (!&g_entities[i] || !&g_entities[i].client) continue; + e = &g_entities[i]; + + if (e == NULL || e->client == NULL) { + continue; + } + G_InitTransport(g_entities[i].client->ps.clientNum, destPoint, g_entities[i].s.angles); targEnt = G_PickTarget(locEnt->target); } @@ -3934,26 +3953,28 @@ that are too simple to require their own specific function. Although, name and model could be changed here too... */ -static void Cmd_ForcePlayer_f(gentity_t *ent) { - gclient_t *cl; - gentity_t *other; - gentity_t *sayA; - int j; +static void Cmd_ForcePlayer_f(gentity_t* ent) { char send[100]; - char str[MAX_TOKEN_CHARS]; - char *str2; + char str[MAX_TOKEN_CHARS]; + char* str2 = NULL; char userinfo[MAX_INFO_STRING]; char clientCmd[MAX_INFO_STRING]; - clientPersistant_t *pers; + int32_t j = 0; + gclient_t* cl = NULL; + gentity_t* other = NULL; + gentity_t* sayA = NULL; + clientPersistant_t* pers = NULL; + + G_Assert(ent, (void)0); #ifndef SQL if (!IsAdmin(ent)) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); return; } #else if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_FORCEPARM) ) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as a user with the appropriate rights.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as a user with the appropriate rights.\n"); return; } #endif @@ -3961,27 +3982,26 @@ static void Cmd_ForcePlayer_f(gentity_t *ent) { // find the player trap_Argv(1, str, sizeof(str)); - if (!str[0]) { //if user added no args (ie wanted the parameters) - trap_SendServerCommand(ent - g_entities, va("print \"\nUsage: User force changes a parameter in another player's configuration settings on the server.\nCommand: ForcePlayer \"[Setting to be changed]\" \"[New Value]\"\n\n\" ")); + if (str[0] == 0) { //if user added no args (ie wanted the parameters) + G_PrintfClient(ent, "\nUsage: User force changes a parameter in another player's configuration settings on the server.\nCommand: ForcePlayer \"[Setting to be changed]\" \"[New Value]\"\n\n"); return; } cl = ClientForString(str); - if (!cl) { - return; - } + G_Assert(cl, (void)0); other = g_entities + cl->ps.clientNum; + G_Assert(other, (void)0); //Get the key trap_Argv(2, str, sizeof(str)); - if (!str[0]) { + if (str[0] == 0) { return; } //get client's data trap_GetUserinfo(cl->ps.clientNum, userinfo, sizeof(userinfo)); - if (!strstr(userinfo, str)) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: Invalid setting specified.\n\" ")); + if (strstr(userinfo, str) == NULL) { + G_PrintfClient(ent, "ERROR: Invalid setting specified.\n"); return; } @@ -4020,50 +4040,44 @@ Marcin : Implemented an 'all' option. (11/12/2008) */ #define PLAYER_BEAM_DIST 50 -static void Cmd_BeamToPlayer_f(gentity_t *ent) { - char argStr[MAX_TOKEN_CHARS]; - gentity_t *target; - gentity_t *beamee; - int clientNum = 0; - int bClientNum = 0; - vec3_t mins = { -12, -12, -24 }; //for the volume trace -//12 - vec3_t maxs = { 12, 12, 56 }; //44 - int i, j = 0; - vec3_t origin, angles, zOrigin; - trace_t tr; - qboolean validTraceFound = qfalse; - int startPoint; - int totalCount; - int offsetRA[8][2] = { { 1, 0 }, //offsets for each beam test location - { 1, -1 }, - { 0, -1 }, - { -1, -1 }, - { -1, 0 }, - { -1, 1 }, - { 0, 1 }, - { 1, 1 } - }; - int viewAngleHeading[8] = { 180, 135, 90, 45, 0, -45, -90, -135 }; - qboolean everyone = qfalse; +static void Cmd_BeamToPlayer_f(gentity_t* ent) { + char argStr[MAX_TOKEN_CHARS]; + int32_t clientNum = 0; + int32_t bClientNum = 0; + int32_t i = 0; + int32_t j = 0; + int32_t startPoint = 0; + int32_t totalCount = 0; + int32_t viewAngleHeading[8] = { 180, 135, 90, 45, 0, -45, -90, -135 }; + int32_t offsetRA[8][2] = { { 1, 0 }, { 1, -1 }, { 0, -1 }, { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, 1 }, { 1, 1 } }; + vec3_t mins = { -12, -12, -24 }; //for the volume trace -//12 + vec3_t maxs = { 12, 12, 56 }; //44 + vec3_t origin = { 0, 0, 0 }; + vec3_t angles = { 0, 0, 0 }; + vec3_t zOrigin = { 0, 0, 0 }; + qboolean validTraceFound = qfalse; + qboolean everyone = qfalse; + gentity_t* target = NULL; + gentity_t* beamee = NULL; + trace_t tr; //Has to be an admin.. if anyone had it, the brig would become useless. - #ifndef SQL if (!IsAdmin(ent)) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); return; } #else if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_BEAM) ) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as a user with the appropriate rights.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as a user with the appropriate rights.\n"); return; } #endif trap_Argv(1, argStr, sizeof(argStr)); - if (!argStr[0]) { - trap_SendServerCommand(ent - g_entities, va("print \"Usage: Allows you to beam yourself or another player to the location of a separate player.\nCommand: (For yourself) - beamToPlayer \n(For other players) - beamToPlayer \n\" ")); + if (argStr[0] == 0) { + G_PrintfClient(ent, "Usage: Allows you to beam yourself or another player to the location of a separate player.\nCommand: (For yourself) - beamToPlayer \n(For other players) - beamToPlayer \n"); return; } @@ -4081,7 +4095,7 @@ static void Cmd_BeamToPlayer_f(gentity_t *ent) { } trap_Argv(2, argStr, sizeof(argStr)); if (Q_stricmp(argStr, "all") == 0) { - trap_SendServerCommand(ent - g_entities, "print \"ERROR. You can not beam a player to everyone.\nPerhaps you meant /beamToPlayer all .\n\" "); + G_PrintfClient(ent, "ERROR. You can not beam a player to everyone.\nPerhaps you meant /beamToPlayer all .\n"); return; } @@ -4089,12 +4103,12 @@ static void Cmd_BeamToPlayer_f(gentity_t *ent) { } if (clientNum == bClientNum) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR. Target location player and target beaming player cannot be the same.\n\" ")); + G_PrintfClient(ent, "ERROR. Target location player and target beaming player cannot be the same.\n"); return; } if ((clientNum < 0 || clientNum >= MAX_CLIENTS) || ((bClientNum < 0 || bClientNum >= MAX_CLIENTS) && !everyone)) { - trap_SendServerCommand(ent - g_entities, va("print \"Invalid client specified.\n\" ")); + G_PrintfClient(ent, "Invalid client specified.\n"); return; } @@ -4164,7 +4178,7 @@ static void Cmd_BeamToPlayer_f(gentity_t *ent) { } if (!validTraceFound) { - trap_SendServerCommand(ent - g_entities, va("print \"No valid beam points next to player found.\n\" ")); + G_PrintfClient(ent, "No valid beam points next to player found.\n"); continue; } @@ -4203,24 +4217,27 @@ time length has been received from client. Any specific flags the emote may have will be checked here. */ -static void Cmd_DoEmote_f(gentity_t *ent) { - char argStr[MAX_QPATH]; - emoteList_t *emote; - int animLength; - int i; - int emoteInt; - int flagHolder = 0; - qboolean doUpper = qfalse; - qboolean doLower = qfalse; - qboolean alreadyEmoting; - playerState_t *ps; +static void Cmd_DoEmote_f(gentity_t* ent) { + char argStr[MAX_QPATH]; + int32_t animLength = 0; + int32_t i = 0; + int32_t emoteInt = 0; + int32_t flagHolder = 0; + qboolean doUpper = qfalse; + qboolean doLower = qfalse; + qboolean alreadyEmoting = qfalse; + emoteList_t* emote = NULL; + playerState_t* ps = NULL; + + G_Assert(ent, (void)0); + G_Assert(ent->client, (void)0); trap_Argv(1, argStr, sizeof(argStr)); //RPG-X | Marcin | 24/12/2008 //n00b check if (g_classData[ent->client->sess.sessionClass].isn00b) { - trap_SendServerCommand(ent - g_entities, "print \"[You're too stupid to use this command]\n\""); + G_PrintfClient(ent, "[You're too stupid to use this command]\n"); return; } @@ -4228,17 +4245,17 @@ static void Cmd_DoEmote_f(gentity_t *ent) { //Small override for the specific eyes animation emotes. //And also the alert mode now - if (!Q_stricmp(argStr, "eyes_shut") || !Q_stricmp(argStr, "eyes_frown") || !Q_stricmpn(argStr, "alert2", 6) || !Q_stricmpn(argStr, "alert", 5)) { - if (!Q_stricmp(argStr, "eyes_shut")) { + if (Q_stricmp(argStr, "eyes_shut") == 0 || Q_stricmp(argStr, "eyes_frown") == 0 || Q_stricmpn(argStr, "alert2", 6) == 0 || Q_stricmpn(argStr, "alert", 5) == 0) { + if (Q_stricmp(argStr, "eyes_shut") == 0) { ps->stats[EMOTES] ^= EMOTE_EYES_SHUT; } - else if (!Q_stricmp(argStr, "eyes_frown")) + else if (Q_stricmp(argStr, "eyes_frown") == 0) ps->stats[EMOTES] ^= EMOTE_EYES_PISSED; - else if (!Q_stricmpn(argStr, "alert2", 6)) { + else if (Q_stricmpn(argStr, "alert2", 6) == 0) { ps->pm_flags &= ~ANIM_ALERT; ps->pm_flags ^= ANIM_ALERT2; - } else if (!Q_stricmpn(argStr, "alert", 5)) { + } else if (Q_stricmpn(argStr, "alert", 5) == 0) { ps->pm_flags &= ~ANIM_ALERT2; ps->pm_flags ^= ANIM_ALERT; } @@ -4247,15 +4264,15 @@ static void Cmd_DoEmote_f(gentity_t *ent) { } if (trap_Argc() != 3) { - trap_SendServerCommand(ent - g_entities, va("print \"Invalid arguments listed. Please use the '/emote' command to perform emotes.\n\" ")); + G_PrintfClient(ent, "Invalid arguments listed. Please use the '/emote' command to perform emotes.\n"); return; } emoteInt = atoi(argStr); emote = &bg_emoteList[emoteInt]; - if (!emote) { - trap_SendServerCommand(ent - g_entities, va("print \"Invalid emote specified.\n\" ")); + if (emote == NULL) { + G_PrintfClient(ent, "Invalid emote specified.\n"); return; } @@ -4263,7 +4280,7 @@ static void Cmd_DoEmote_f(gentity_t *ent) { animLength = atoi(argStr); if (animLength > 65000) { - trap_SendServerCommand(ent - g_entities, va("print \"Invalid emote time length specified.\n\" ")); + G_PrintfClient(ent, "Invalid emote time length specified.\n"); return; } @@ -4272,18 +4289,18 @@ static void Cmd_DoEmote_f(gentity_t *ent) { ps->torsoAnim = 0; ps->legsAnim = 0; - if (emote->bodyFlags & EMOTE_UPPER) { + if ((emote->bodyFlags & EMOTE_UPPER) != 0) { doUpper = qtrue; } - if (emote->bodyFlags & EMOTE_LOWER) { + if ((emote->bodyFlags & EMOTE_LOWER) != 0) { doLower = qtrue; } - if ((ps->stats[EMOTES] & EMOTE_UPPER) && - (ps->stats[EMOTES] & EMOTE_LOOP_UPPER)) { - if (emote->animFlags & EMOTE_REVERTLOOP_UPPER) { - int anim = ps->stats[TORSOANIM]; + if ((ps->stats[EMOTES] & EMOTE_UPPER) != 0 && + (ps->stats[EMOTES] & EMOTE_LOOP_UPPER) != 0) { + if ((emote->animFlags & EMOTE_REVERTLOOP_UPPER) != 0) { + int32_t anim = ps->stats[TORSOANIM]; anim &= ~ANIM_TOGGLEBIT; //remove the toggle msk for (i = 0; i < bg_numEmotes; i++) { @@ -4295,10 +4312,10 @@ static void Cmd_DoEmote_f(gentity_t *ent) { } } - if ((ps->stats[EMOTES] & EMOTE_LOWER) && - (ps->stats[EMOTES] & EMOTE_LOOP_LOWER)) { - if (emote->animFlags & EMOTE_REVERTLOOP_LOWER) { - int anim = ps->stats[LEGSANIM]; + if ((ps->stats[EMOTES] & EMOTE_LOWER) != 0 && + (ps->stats[EMOTES] & EMOTE_LOOP_LOWER) != 0) { + if ((emote->animFlags & EMOTE_REVERTLOOP_LOWER) != 0) { + int32_t anim = ps->stats[LEGSANIM]; anim &= ~ANIM_TOGGLEBIT; for (i = 0; i < bg_numEmotes; i++) { @@ -4316,7 +4333,7 @@ static void Cmd_DoEmote_f(gentity_t *ent) { doUpper = (qboolean)((emote->animFlags & EMOTE_OVERRIDE_UPPER)); doLower = (qboolean)((emote->animFlags & EMOTE_OVERRIDE_LOWER)); } else { - if (doLower && !(emote->animFlags & EMOTE_OVERRIDE_LOWER) && ps->powerups[PW_FLIGHT]) { + if (doLower && (emote->animFlags & EMOTE_OVERRIDE_LOWER) == 0 && ps->powerups[PW_FLIGHT] != 0) { doLower = qfalse; } } @@ -4400,10 +4417,7 @@ static void Cmd_DoEmote_f(gentity_t *ent) { //set emote num into emote timer so we can use it in pmove ps->legsTimer = emoteInt; - //ent->client->ps.legsAnim = - //( ( ent->client->ps.legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim; - ps->stats[LEGSANIM] = - ((ps->stats[LEGSANIM] & ANIM_TOGGLEBIT) ^ ANIM_TOGGLEBIT) | emote->enumName; + ps->stats[LEGSANIM] = ((ps->stats[LEGSANIM] & ANIM_TOGGLEBIT) ^ ANIM_TOGGLEBIT) | emote->enumName; } } @@ -4414,11 +4428,11 @@ I originally had it so holding the walk button did this, but then found out that it's permanently held down in other instances :S ================*/ -static void Cmd_EndEmote_f(gentity_t *ent) { - playerState_t *ps; +static void Cmd_EndEmote_f(gentity_t* ent) { + playerState_t* ps = NULL; - if (!ent->client) - return; + G_Assert(ent, (void)0); + G_Assert(ent->client, (void)0); ps = &ent->client->ps; @@ -4446,12 +4460,17 @@ resulting in sluggish movement for high ping d00ds. ===============*/ static void Cmd_Laser_f(gentity_t *ent) { - char* message; - playerState_t *ps = &ent->client->ps; + char* message = NULL; + playerState_t *ps = NULL; + + G_Assert(ent, (void)0); + G_Assert(ent->client, (void)0); + + ps = &ent->client->ps; //TiM - Say... what was the max length of time a Q3 server was capable of running //nonstop again lol? :) - if (!ps->powerups[PW_LASER]) { + if (ps->powerups[PW_LASER] == 0) { ps->powerups[PW_LASER] = level.time + 10000000; message = "Activated Laser"; } else { @@ -4459,15 +4478,20 @@ static void Cmd_Laser_f(gentity_t *ent) { message = "Deactivated Laser"; } - trap_SendServerCommand(ent - g_entities, va(" print \"%s\n\" ", message)); + G_PrintfClient(ent, "%s\n", message); } /*============== Cmd_FlashLight_f ==============*/ -static void Cmd_FlashLight_f(gentity_t *ent) { - char* message; - playerState_t *ps = &ent->client->ps; +static void Cmd_FlashLight_f(gentity_t* ent) { + char* message = NULL; + playerState_t *ps = NULL; + + G_Assert(ent, (void)0); + G_Assert(ent->client, (void)0); + + ps = &ent->client->ps; //TiM - Say... what was the max length of time a Q3 server was capable of running //nonstop again lol? :) @@ -4479,7 +4503,7 @@ static void Cmd_FlashLight_f(gentity_t *ent) { message = "Deactivated Flashlight"; } - trap_SendServerCommand(ent - g_entities, va(" print \"%s\n\" ", message)); + G_PrintfClient(ent, "%s\n", message); } /*============== @@ -4488,23 +4512,30 @@ TiM: Allows admins to configure their FX guns to emit different FX ==============*/ -static void Cmd_fxGun_f(gentity_t *ent) { - char arg[MAX_TOKEN_CHARS]; - char fxName[36]; - const int FX_DEFAULT_TIME = 900000; - fxGunData_t *fxGunData; +static void Cmd_fxGun_f(gentity_t* ent) { + char arg[MAX_TOKEN_CHARS]; + char fxName[36]; + const int32_t FX_DEFAULT_TIME = 900000; + int32_t argc = 0; + fxGunData_t* fxGunData = NULL; - if (!ent->client) + G_Assert(ent, (void)0); + G_Assert(ent->client, (void)0); + + argc = trap_Argc(); + if (argc < 2) { + G_PrintfClient(ent, "Usage: /fxGun [arguments]\n"); return; + } #ifndef SQL if (!IsAdmin(ent)) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as an admin.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as an admin.\n"); return; } #else if ( !IsAdmin( ent ) || !G_Sql_UserDB_CheckRight(ent->client->uid, SQLF_FX) ) { - trap_SendServerCommand(ent - g_entities, va("print \"ERROR: You are not logged in as a user with the appropriate rights.\n\" ")); + G_PrintfClient(ent, "ERROR: You are not logged in as a user with the appropriate rights.\n"); return; } #endif @@ -4516,17 +4547,23 @@ static void Cmd_fxGun_f(gentity_t *ent) { fxGunData = &ent->client->fxGunData; - if (!Q_stricmp(arg, "default")) { + if (Q_stricmp(arg, "default") == 0) { memset(fxGunData, 0, sizeof(fxGunData)); - } else if (!Q_stricmp(arg, "detpack")) { + } else if (Q_stricmp(arg, "detpack") == 0) { memset(fxGunData, 0, sizeof(fxGunData)); fxGunData->eventNum = EV_DETPACK; - } else if (!Q_stricmp(arg, "chunks")) { + } else if (Q_stricmp(arg, "chunks") == 0) { memset(fxGunData, 0, sizeof(fxGunData)); + + if (argc < 4) { + G_PrintfClient(ent, "Syntax: /fxGun chunks \n"); + return; + } + //radius trap_Argv(2, arg, sizeof(arg)); - if (!arg[0]) { - trap_SendServerCommand(ent - g_entities, "print \"Syntax: /fxGun chunks \n\" "); + if (arg[0] == 0) { + G_PrintfClient(ent, "Syntax: /fxGun chunks \n"); return; } @@ -4535,8 +4572,8 @@ static void Cmd_fxGun_f(gentity_t *ent) { //radius trap_Argv(3, arg, sizeof(arg)); - if (!arg[0]) { - trap_SendServerCommand(ent - g_entities, "print \"Syntax: /fxGun chunks \n\" "); + if (arg[0] == 0) { + G_PrintfClient(ent, "Syntax: /fxGun chunks \n"); memset(fxGunData, 0, sizeof(fxGunData)); return; } diff --git a/code/game/g_main.c b/code/game/g_main.c index 023996f..8f2f4e8 100644 --- a/code/game/g_main.c +++ b/code/game/g_main.c @@ -15,7 +15,7 @@ #include "g_lua.h" 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); //RPG-X: RedTechie int RPGEntityCount; //Global entity count varible @@ -308,183 +308,183 @@ vmCvar_t rpg_spEasterEggs; static cvarTable_t gameCvarTable[] = { // don't override the cheat state set by the system - { &g_cheats, "sv_cheats", "", 0, 0, qfalse }, + { &g_cheats, "sv_cheats", "", 0, 0, qfalse }, // noset vars - { NULL, "gamename", GAMEVERSION , CVAR_SERVERINFO | CVAR_ROM, 0, qfalse }, - { NULL, "gamedate", __DATE__ , CVAR_ROM, 0, qfalse }, - { &g_restarted, "g_restarted", "0", CVAR_ROM, 0, qfalse }, - { NULL, "sv_mapname", "", CVAR_SERVERINFO | CVAR_ROM, 0, qfalse }, + { NULL, "gamename", GAMEVERSION, CVAR_SERVERINFO | CVAR_ROM, 0, qfalse }, + { NULL, "gamedate", __DATE__, CVAR_ROM, 0, qfalse }, + { &g_restarted, "g_restarted", "0", CVAR_ROM, 0, qfalse }, + { NULL, "sv_mapname", "", CVAR_SERVERINFO | CVAR_ROM, 0, qfalse }, // latched vars - { &g_gametype, "g_gametype", "0", CVAR_SERVERINFO | CVAR_LATCH | CVAR_INIT | CVAR_ROM, 0, qfalse }, - { &g_maxclients, "sv_maxclients", "8", CVAR_SERVERINFO | CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, - { &g_maxGameClients, "g_maxGameClients", "0", CVAR_SERVERINFO | CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, + { &g_gametype, "g_gametype", "0", CVAR_SERVERINFO | CVAR_LATCH | CVAR_INIT | CVAR_ROM, 0, qfalse }, + { &g_maxclients, "sv_maxclients", "8", CVAR_SERVERINFO | CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, + { &g_maxGameClients, "g_maxGameClients", "0", CVAR_SERVERINFO | CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, // change anytime vars - { &g_dmflags, "dmflags", "0", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue }, - { &g_synchronousClients, "g_synchronousClients", "0", CVAR_SYSTEMINFO, 0, qfalse }, - { &g_log, "g_log", "", CVAR_ARCHIVE, 0, qfalse }, - { &g_logSync, "g_logSync", "0", CVAR_ARCHIVE, 0, qfalse }, - { &g_password, "g_password", "", CVAR_USERINFO, 0, qfalse }, - { &g_banIPs, "g_banIPs", "", CVAR_ARCHIVE, 0, qfalse }, - { &g_filterBan, "g_filterBan", "1", CVAR_ARCHIVE, 0, qfalse }, - { &g_banIDs, "g_banIDs", "", CVAR_ARCHIVE, 0, qfalse }, - { &g_needpass, "g_needpass", "0", CVAR_SERVERINFO | CVAR_ROM, 0, qfalse }, - { &g_dedicated, "dedicated", "0", 0, 0, qfalse }, - { &g_speed, "g_speed", "250", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue }, // Quake 3 default was 320. - { &g_gravity, "g_gravity", "800", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue }, - { &g_knockback, "g_knockback", "500", 0, 0, qtrue }, - { &g_dmgmult, "g_dmgmult", "1", 0, 0, qtrue }, - { &g_weaponRespawn, "g_weaponrespawn", "5", 0, 0, qtrue }, // Quake 3 default (with 1 ammo weapons) was 5. - { &g_adaptRespawn, "g_adaptrespawn", "1", 0, 0, qtrue }, // Make weapons respawn faster with a lot of players. - { &g_forcerespawn, "g_forcerespawn", "0", 0, 0, qtrue }, // Quake 3 default was 20. This is more "user friendly". - { &g_inactivity, "g_inactivity", "0", 0, 0, qtrue }, - { &g_debugMove, "g_debugMove", "0", 0, 0, qfalse }, - { &g_debugDamage, "g_debugDamage", "0", 0, 0, qfalse }, - { &g_debugAlloc, "g_debugAlloc", "0", 0, 0, qfalse }, - { &g_motd, "g_motd", "", 0, 0, qfalse }, - { &g_allowVote, "g_allowVote", "1", CVAR_SERVERINFO, 0, qfalse }, + { &g_dmflags, "dmflags", "0", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue }, + { &g_synchronousClients, "g_synchronousClients", "0", CVAR_SYSTEMINFO, 0, qfalse }, + { &g_log, "g_log", "", CVAR_ARCHIVE, 0, qfalse }, + { &g_logSync, "g_logSync", "0", CVAR_ARCHIVE, 0, qfalse }, + { &g_password, "g_password", "", CVAR_USERINFO, 0, qfalse }, + { &g_banIPs, "g_banIPs", "", CVAR_ARCHIVE, 0, qfalse }, + { &g_filterBan, "g_filterBan", "1", CVAR_ARCHIVE, 0, qfalse }, + { &g_banIDs, "g_banIDs", "", CVAR_ARCHIVE, 0, qfalse }, + { &g_needpass, "g_needpass", "0", CVAR_SERVERINFO | CVAR_ROM, 0, qfalse }, + { &g_dedicated, "dedicated", "0", 0, 0, qfalse }, + { &g_speed, "g_speed", "250", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue }, // Quake 3 default was 320. + { &g_gravity, "g_gravity", "800", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qtrue }, + { &g_knockback, "g_knockback", "500", 0, 0, qtrue }, + { &g_dmgmult, "g_dmgmult", "1", 0, 0, qtrue }, + { &g_weaponRespawn, "g_weaponrespawn", "5", 0, 0, qtrue }, // Quake 3 default (with 1 ammo weapons) was 5. + { &g_adaptRespawn, "g_adaptrespawn", "1", 0, 0, qtrue }, // Make weapons respawn faster with a lot of players. + { &g_forcerespawn, "g_forcerespawn", "0", 0, 0, qtrue }, // Quake 3 default was 20. This is more "user friendly". + { &g_inactivity, "g_inactivity", "0", 0, 0, qtrue }, + { &g_debugMove, "g_debugMove", "0", 0, 0, qfalse }, + { &g_debugDamage, "g_debugDamage", "0", 0, 0, qfalse }, + { &g_debugAlloc, "g_debugAlloc", "0", 0, 0, qfalse }, + { &g_motd, "g_motd", "", 0, 0, qfalse }, + { &g_allowVote, "g_allowVote", "1", CVAR_SERVERINFO, 0, qfalse }, #if 0 { &g_debugForward, "g_debugForward", "0", 0, 0, qfalse }, { &g_debugRight, "g_debugRight", "0", 0, 0, qfalse }, { &g_debugUp, "g_debugUp", "0", 0, 0, qfalse }, #endif - { &g_language, "g_language", "", CVAR_ARCHIVE, 0, qfalse }, - { &g_holoIntro, "g_holoIntro", "1", CVAR_ARCHIVE, 0, qfalse }, - { &g_team_group_red, "g_team_group_red", "", CVAR_LATCH, 0, qfalse }, // Used to have CVAR_ARCHIVE - { &g_team_group_blue, "g_team_group_blue", "", CVAR_LATCH, 0, qfalse }, // Used to have CVAR_ARCHIVE - { &g_random_skin_limit, "g_random_skin_limit", "4", CVAR_ARCHIVE, 0, qfalse }, - { &g_classChangeDebounceTime, "g_classChangeDebounceTime", "180", CVAR_ARCHIVE, 0, qfalse }, + { &g_language, "g_language", "", CVAR_ARCHIVE, 0, qfalse }, + { &g_holoIntro, "g_holoIntro", "1", CVAR_ARCHIVE, 0, qfalse }, + { &g_team_group_red, "g_team_group_red", "", CVAR_LATCH, 0, qfalse }, // Used to have CVAR_ARCHIVE + { &g_team_group_blue, "g_team_group_blue", "", CVAR_LATCH, 0, qfalse }, // Used to have CVAR_ARCHIVE + { &g_random_skin_limit, "g_random_skin_limit", "4", CVAR_ARCHIVE, 0, qfalse }, + { &g_classChangeDebounceTime, "g_classChangeDebounceTime", "180", CVAR_ARCHIVE, 0, qfalse }, //RPG-X: RedTechie - RPG-X CVARS....duh....just for the slow ones - { &rpg_allowvote, "rpg_allowVote", "1", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_chatsallowed, "rpg_chatsAllowed", "10", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_allowsuicide, "rpg_allowSuicide", "1", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_selfdamage, "rpg_selfDamage", "1", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_rpg, "rpg_rpg", "1", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, - { &rpg_kickspammers, "rpg_kickSpammers", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_kicksuiciders, "rpg_kickSuiciders", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_allowspmaps, "rpg_allowSPMaps", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_rangetricorder, "rpg_rangeTricorder", "128", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_rangehypo, "rpg_rangeHypo", "32", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_norpgclasses, "rpg_noRPGClasses", "0", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, - { &rpg_forceclasscolor, "rpg_forceClassColor", "0", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, - { &rpg_restrictions, "rpg_restrictions", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_dmgFlags, "rpg_dmgFlags", "63", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_noweapons, "rpg_noWeapons", "0", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, - { &rpg_welcomemessage, "rpg_welcomeMessage", "Welcome to the RPG-X Mod", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, - { &rpg_timedmessagetime, "rpg_timedMessageTime", "0", CVAR_ARCHIVE, 0, qfalse }, //TiM : LATCH Not necessary here. - { &rpg_forcekillradius, "rpg_forceKillRadius", "0", CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue }, - { &rpg_forcekillradiuswaittime, "rpg_forceKillRadiusWaitTime", "45000", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, - { &rpg_chatarearange, "rpg_chatAreaRange", "200", CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue }, //Not latched (ie doesnt need server restart) - { &rpg_forcefielddamage, "rpg_forcefieldDamage", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_invisibletripmines, "rpg_invisibleTripmines", "1", CVAR_ARCHIVE | CVAR_SERVERINFO, 0, qfalse }, - { &rpg_medicsrevive, "rpg_medicsRevive", "1", CVAR_ARCHIVE | CVAR_LATCH, 0, qfalse }, - { &rpg_effectsgun, "rpg_effectsGun", "1", CVAR_ARCHIVE | CVAR_SERVERINFO, 0, qfalse }, - { &rpg_phaserdisintegrates, "rpg_phaserDisintegrates", "1", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_kickAfterXkills, "rpg_kickAfterNumkills", "2", CVAR_ARCHIVE, 0, qfalse }, //RPG-X | Phenix | 06/04/2005 - { &rpg_rankSet, "rpg_rankSet", RANKSET_DEFAULT, CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_LATCH, 0, qfalse }, - { &rpg_passMessage, "rpg_passMessage", "", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_renamedPlayers, "rpg_renamedPlayers", "1", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_uniqueNames, "rpg_uniqueNames", "1", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_startingRank, "rpg_startingRank", "", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_maxRank, "rpg_maxRank", "", CVAR_ARCHIVE | CVAR_SERVERINFO, 0, qfalse }, - { &rpg_changeRanks, "rpg_changeRanks", "1", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_classSet, "rpg_classSet", "rpgx_default", CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_LATCH, 0, qfalse }, - { &rpg_maxHeight, "rpg_maxHeight", "1.15", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_minHeight, "rpg_minHeight", "0.90", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_maxWeight, "rpg_maxWeight", "1.10", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_minWeight, "rpg_minWeight", "0.90", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_mapGiveFlags, "rpg_mapGiveFlags", "0", CVAR_ARCHIVE | CVAR_LATCH, 0, qfalse }, + { &rpg_allowvote, "rpg_allowVote", "1", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_chatsallowed, "rpg_chatsAllowed", "10", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_allowsuicide, "rpg_allowSuicide", "1", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_selfdamage, "rpg_selfDamage", "1", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_rpg, "rpg_rpg", "1", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, + { &rpg_kickspammers, "rpg_kickSpammers", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_kicksuiciders, "rpg_kickSuiciders", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_allowspmaps, "rpg_allowSPMaps", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_rangetricorder, "rpg_rangeTricorder", "128", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_rangehypo, "rpg_rangeHypo", "32", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_norpgclasses, "rpg_noRPGClasses", "0", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, + { &rpg_forceclasscolor, "rpg_forceClassColor", "0", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, + { &rpg_restrictions, "rpg_restrictions", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_dmgFlags, "rpg_dmgFlags", "63", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_noweapons, "rpg_noWeapons", "0", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, + { &rpg_welcomemessage, "rpg_welcomeMessage", "Welcome to the RPG-X Mod", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, + { &rpg_timedmessagetime, "rpg_timedMessageTime", "0", CVAR_ARCHIVE, 0, qfalse }, //TiM : LATCH Not necessary here. + { &rpg_forcekillradius, "rpg_forceKillRadius", "0", CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue }, + { &rpg_forcekillradiuswaittime, "rpg_forceKillRadiusWaitTime", "45000", CVAR_LATCH | CVAR_ARCHIVE, 0, qfalse }, + { &rpg_chatarearange, "rpg_chatAreaRange", "200", CVAR_ARCHIVE | CVAR_NORESTART, 0, qtrue }, //Not latched (ie doesnt need server restart) + { &rpg_forcefielddamage, "rpg_forcefieldDamage", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_invisibletripmines, "rpg_invisibleTripmines", "1", CVAR_ARCHIVE | CVAR_SERVERINFO, 0, qfalse }, + { &rpg_medicsrevive, "rpg_medicsRevive", "1", CVAR_ARCHIVE | CVAR_LATCH, 0, qfalse }, + { &rpg_effectsgun, "rpg_effectsGun", "1", CVAR_ARCHIVE | CVAR_SERVERINFO, 0, qfalse }, + { &rpg_phaserdisintegrates, "rpg_phaserDisintegrates", "1", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_kickAfterXkills, "rpg_kickAfterNumkills", "2", CVAR_ARCHIVE, 0, qfalse }, //RPG-X | Phenix | 06/04/2005 + { &rpg_rankSet, "rpg_rankSet", RANKSET_DEFAULT, CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_LATCH, 0, qfalse }, + { &rpg_passMessage, "rpg_passMessage", "", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_renamedPlayers, "rpg_renamedPlayers", "1", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_uniqueNames, "rpg_uniqueNames", "1", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_startingRank, "rpg_startingRank", "", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_maxRank, "rpg_maxRank", "", CVAR_ARCHIVE | CVAR_SERVERINFO, 0, qfalse }, + { &rpg_changeRanks, "rpg_changeRanks", "1", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_classSet, "rpg_classSet", "rpgx_default", CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_LATCH, 0, qfalse }, + { &rpg_maxHeight, "rpg_maxHeight", "1.15", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_minHeight, "rpg_minHeight", "0.90", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_maxWeight, "rpg_maxWeight", "1.10", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_minWeight, "rpg_minWeight", "0.90", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_mapGiveFlags, "rpg_mapGiveFlags", "0", CVAR_ARCHIVE | CVAR_LATCH, 0, qfalse }, //TiM - maybe we can fix it later, but for now, disable it - { &rpg_scannablePanels, "rpg_scannablePanels", "1", CVAR_ARCHIVE | CVAR_LATCH | CVAR_SERVERINFO, 0, qfalse }, - { &rpg_allowWeaponDrop, "rpg_allowWeaponDrop", "1", CVAR_ARCHIVE, 0, qfalse }, // RPG-X | Marcin | 03/12/2008 - { &rpg_weaponsStay, "rpg_weaponsStay", "0", CVAR_ARCHIVE, 0, qfalse }, // RPG-X | Marcin | 04/12/2008 - { &rpg_rifleSpeed, "rpg_rifleSpeed", "2700", 0, 0, qtrue }, // RPG-X | Marcin | 04/12/2008 - { &rpg_disruptorSpeed, "rpg_disruptorSpeed", "3000", 0, 0, qtrue },// RPG-X | Marcin | 04/12/2008 - { &rpg_photonSpeed, "rpg_photonSpeed", "1300", 0, 0, qtrue }, // RPG-X | Marcin | 05/12/2008 - { &rpg_altPhotonSpeed, "rpg_altPhotonSpeed", "650", 0, 0, qtrue }, // RPG-X | Marcin | 06/12/2008 - { &rpg_rifleDelay, "rpg_rifleDelay", "250", 0, 0, qtrue }, // RPG-X | Marcin | 06/12/2008 - { &rpg_disruptorDelay, "rpg_disruptorDelay", "700", 0, 0, qtrue }, // RPG-X | Marcin | 06/12/2008 - { &rpg_photonDelay, "rpg_photonDelay", "1200", 0, 0, qtrue }, // RPG-X | Marcin | 06/12/2008 - { &rpg_altPhotonDelay, "rpg_altPhotonDelay", "1600", 0, 0, qtrue },// RPG-X | Marcin | 06/12/2008 - { &rpg_TR116Delay, "rpg_TR116Delay", "500", 0, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_motdFile, "rpg_motdFile", "RPG-X_Motd.txt", CVAR_ARCHIVE | CVAR_LATCH, 0, qfalse }, // RPG-X | Marcin | 23/12/2008 - { &rpg_respectPrivacy, "rpg_respectPrivacy", "0", CVAR_ARCHIVE | CVAR_SERVERINFO , 0, qfalse }, // RPG-X | Marcin | 24/12/2008 - { &rpg_maxTricorders, "rpg_maxTricorders", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxPADDs, "rpg_maxPADDs", "10", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxCups, "rpg_maxCups", "2", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxPhasers, "rpg_maxPhasers", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxRifles, "rpg_maxRifles", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxTR116s, "rpg_maxTR116s", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxAdminguns, "rpg_maxAdminguns", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxPhotonbursts, "rpg_maxPhotonbursts", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxDisruptors, "rpg_maxDisruptors", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxMedkits, "rpg_maxMedkits", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxHyposprays, "rpg_maxHyposprays", "2", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxRegenerators, "rpg_maxRegenerators", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxToolkits, "rpg_maxToolkits", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_maxHyperSpanners, "rpg_maxHyperSpanners", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minTricorders, "rpg_minTricorders", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minPADDs, "rpg_minPADDs", "5", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minCups, "rpg_minCups", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minPhasers, "rpg_minPhasers", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minRifles, "rpg_minRifles", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minTR116s, "rpg_minTR116s", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minAdminguns, "rpg_minAdminguns", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minPhotonbursts, "rpg_minPhotonbursts", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minDisruptors, "rpg_minDisruptors", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minMedkits, "rpg_minMedkits", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minHyposprays, "rpg_minHyposprays", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minRegenerators, "rpg_minRegenerators", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minToolkits, "rpg_minToolkits", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_minHyperSpanners, "rpg_minHyperSpanners", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 - { &rpg_dropOnDeath, "rpg_dropItemsOnDeath", "1", CVAR_ARCHIVE, 0, qfalse }, // RPG-X | Marcin | 30/12/2008 - { &rpg_fraggerSpawnDelay, "rpg_fraggerSpawnDelay", "100", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_borgAdapt, "rpg_borgAdapt", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_hypoMelee, "rpg_hypoMelee", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_adaptUseSound, "rpg_adaptUseSound", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_adaptCrifleHits, "rpg_adaptCrifleHits", "6", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_adaptDisruptorHits, "rpg_adaptDisruptorHits", "6", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_adaptPhaserHits, "rpg_adaptPhaserHits", "6", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_adaptPhotonHits, "rpg_adaptPhotonHits", "6", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_adaptTR116Hits, "rpg_adaptTR116Hits", "6", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_adaptGrenadeLauncherHits,"rpg_adaptGrenadeLauncherHits", "6", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_repairModifier, "rpg_repairModifier", "1", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_forceFieldColor, "rpg_forceFieldColor", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_allowRemodulation, "rpg_allowRemodulation", "1", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_forceFieldFreq, "rpg_forceFieldFreq", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_calcLiftTravelDuration, "rpg_calcLiftTravelDuration", "1", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_liftDurationModifier, "rpg_liftDurationModifier" , "0.5", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_altTricorderDelay, "rpg_altTricorderDelay", "1000", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_borgMoveThroughFields, "rpg_borgMoveThroughFields", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_RemodulationDelay, "rpg_RemodulationDelay", "5000", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_adminVoteOverride, "rpg_adminVoteOverride", "1", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_serverchange, "rpg_serverchange", "0", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_allowSPLevelChange, "rpg_allowSPLevelChange", "1", CVAR_ARCHIVE | CVAR_LATCH, 0, qfalse }, - { &rpg_spEasterEggs, "rpg_spEasterEggs", "0", CVAR_ARCHIVE, 0, qfalse }, - { &dev_showTriggers, "dev_showTriggers", "0", CVAR_ARCHIVE, 0, qfalse }, - { &sql_use, "sql_use", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_scannablePanels, "rpg_scannablePanels", "1", CVAR_ARCHIVE | CVAR_LATCH | CVAR_SERVERINFO, 0, qfalse }, + { &rpg_allowWeaponDrop, "rpg_allowWeaponDrop", "1", CVAR_ARCHIVE, 0, qfalse }, // RPG-X | Marcin | 03/12/2008 + { &rpg_weaponsStay, "rpg_weaponsStay", "0", CVAR_ARCHIVE, 0, qfalse }, // RPG-X | Marcin | 04/12/2008 + { &rpg_rifleSpeed, "rpg_rifleSpeed", "2700", 0, 0, qtrue }, // RPG-X | Marcin | 04/12/2008 + { &rpg_disruptorSpeed, "rpg_disruptorSpeed", "3000", 0, 0, qtrue },// RPG-X | Marcin | 04/12/2008 + { &rpg_photonSpeed, "rpg_photonSpeed", "1300", 0, 0, qtrue }, // RPG-X | Marcin | 05/12/2008 + { &rpg_altPhotonSpeed, "rpg_altPhotonSpeed", "650", 0, 0, qtrue }, // RPG-X | Marcin | 06/12/2008 + { &rpg_rifleDelay, "rpg_rifleDelay", "250", 0, 0, qtrue }, // RPG-X | Marcin | 06/12/2008 + { &rpg_disruptorDelay, "rpg_disruptorDelay", "700", 0, 0, qtrue }, // RPG-X | Marcin | 06/12/2008 + { &rpg_photonDelay, "rpg_photonDelay", "1200", 0, 0, qtrue }, // RPG-X | Marcin | 06/12/2008 + { &rpg_altPhotonDelay, "rpg_altPhotonDelay", "1600", 0, 0, qtrue },// RPG-X | Marcin | 06/12/2008 + { &rpg_TR116Delay, "rpg_TR116Delay", "500", 0, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_motdFile, "rpg_motdFile", "RPG-X_Motd.txt", CVAR_ARCHIVE | CVAR_LATCH, 0, qfalse }, // RPG-X | Marcin | 23/12/2008 + { &rpg_respectPrivacy, "rpg_respectPrivacy", "0", CVAR_ARCHIVE | CVAR_SERVERINFO, 0, qfalse }, // RPG-X | Marcin | 24/12/2008 + { &rpg_maxTricorders, "rpg_maxTricorders", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxPADDs, "rpg_maxPADDs", "10", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxCups, "rpg_maxCups", "2", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxPhasers, "rpg_maxPhasers", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxRifles, "rpg_maxRifles", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxTR116s, "rpg_maxTR116s", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxAdminguns, "rpg_maxAdminguns", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxPhotonbursts, "rpg_maxPhotonbursts", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxDisruptors, "rpg_maxDisruptors", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxMedkits, "rpg_maxMedkits", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxHyposprays, "rpg_maxHyposprays", "2", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxRegenerators, "rpg_maxRegenerators", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxToolkits, "rpg_maxToolkits", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_maxHyperSpanners, "rpg_maxHyperSpanners", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minTricorders, "rpg_minTricorders", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minPADDs, "rpg_minPADDs", "5", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minCups, "rpg_minCups", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minPhasers, "rpg_minPhasers", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minRifles, "rpg_minRifles", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minTR116s, "rpg_minTR116s", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minAdminguns, "rpg_minAdminguns", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minPhotonbursts, "rpg_minPhotonbursts", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minDisruptors, "rpg_minDisruptors", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minMedkits, "rpg_minMedkits", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minHyposprays, "rpg_minHyposprays", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minRegenerators, "rpg_minRegenerators", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minToolkits, "rpg_minToolkits", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_minHyperSpanners, "rpg_minHyperSpanners", "1", CVAR_ARCHIVE, 0, qtrue }, // RPG-X | Marcin | 30/12/2008 + { &rpg_dropOnDeath, "rpg_dropItemsOnDeath", "1", CVAR_ARCHIVE, 0, qfalse }, // RPG-X | Marcin | 30/12/2008 + { &rpg_fraggerSpawnDelay, "rpg_fraggerSpawnDelay", "100", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_borgAdapt, "rpg_borgAdapt", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_hypoMelee, "rpg_hypoMelee", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_adaptUseSound, "rpg_adaptUseSound", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_adaptCrifleHits, "rpg_adaptCrifleHits", "6", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_adaptDisruptorHits, "rpg_adaptDisruptorHits", "6", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_adaptPhaserHits, "rpg_adaptPhaserHits", "6", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_adaptPhotonHits, "rpg_adaptPhotonHits", "6", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_adaptTR116Hits, "rpg_adaptTR116Hits", "6", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_adaptGrenadeLauncherHits, "rpg_adaptGrenadeLauncherHits", "6", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_repairModifier, "rpg_repairModifier", "1", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_forceFieldColor, "rpg_forceFieldColor", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_allowRemodulation, "rpg_allowRemodulation", "1", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_forceFieldFreq, "rpg_forceFieldFreq", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_calcLiftTravelDuration, "rpg_calcLiftTravelDuration", "1", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_liftDurationModifier, "rpg_liftDurationModifier", "0.5", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_altTricorderDelay, "rpg_altTricorderDelay", "1000", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_borgMoveThroughFields, "rpg_borgMoveThroughFields", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_RemodulationDelay, "rpg_RemodulationDelay", "5000", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_adminVoteOverride, "rpg_adminVoteOverride", "1", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_serverchange, "rpg_serverchange", "0", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_allowSPLevelChange, "rpg_allowSPLevelChange", "1", CVAR_ARCHIVE | CVAR_LATCH, 0, qfalse }, + { &rpg_spEasterEggs, "rpg_spEasterEggs", "0", CVAR_ARCHIVE, 0, qfalse }, + { &dev_showTriggers, "dev_showTriggers", "0", CVAR_ARCHIVE, 0, qfalse }, + { &sql_use, "sql_use", "0", CVAR_ARCHIVE, 0, qfalse }, #ifdef G_LUA - { &g_debugLua, "g_debugLua", "0", 0, 0, qfalse }, - { &lua_allowedModules, "lua_allowedModules", "", 0, 0, qfalse }, - { &lua_modules, "lua_modules", "", 0, 0, qfalse }, + { &g_debugLua, "g_debugLua", "0", 0, 0, qfalse }, + { &lua_allowedModules, "lua_allowedModules", "", 0, 0, qfalse }, + { &lua_modules, "lua_modules", "", 0, 0, qfalse }, #endif - { &rpg_rifleDamage, "rpg_rifleDamage", "75", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_rifleAltDamage, "rpg_rifleAltDamage", "16", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_phaserDamage, "rpg_phaserDamage", "55", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_disruptorDamage, "rpg_disruptorDamage", "80", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_grenadeDamage, "rpg_grenadeDamage", "75", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_grenadeAltDamage, "rpg_grenadeAltDamage", "80", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_tr116Damage, "rpg_tr116Damage", "150", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_photonDamage, "rpg_photonDamage", "140", CVAR_ARCHIVE, 0, qfalse }, - { &rpg_photonAltDamage, "rpg_photonAltDamage", "140", CVAR_ARCHIVE, 0, qfalse }, - { &g_developer, "g_developer", "0", CVAR_ARCHIVE, 0, qfalse }, - { &g_logLevel, "g_loglevel", "2", CVAR_ARCHIVE, 0, qfalse } + { &rpg_rifleDamage, "rpg_rifleDamage", "75", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_rifleAltDamage, "rpg_rifleAltDamage", "16", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_phaserDamage, "rpg_phaserDamage", "55", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_disruptorDamage, "rpg_disruptorDamage", "80", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_grenadeDamage, "rpg_grenadeDamage", "75", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_grenadeAltDamage, "rpg_grenadeAltDamage", "80", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_tr116Damage, "rpg_tr116Damage", "150", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_photonDamage, "rpg_photonDamage", "140", CVAR_ARCHIVE, 0, qfalse }, + { &rpg_photonAltDamage, "rpg_photonAltDamage", "140", CVAR_ARCHIVE, 0, qfalse }, + { &g_developer, "g_developer", "0", CVAR_ARCHIVE, 0, qfalse }, + { &g_logLevel, "g_loglevel", "2", CVAR_ARCHIVE, 0, qfalse } }; -static int gameCvarTableSize = (int)(sizeof( gameCvarTable ) / sizeof( gameCvarTable[0] )); +static int gameCvarTableSize = (int)(sizeof(gameCvarTable) / sizeof(gameCvarTable[0])); -static void G_InitGame( int levelTime, unsigned int randomSeed, int restart ); -static void G_RunFrame( int levelTime ); -void G_ShutdownGame( int restart ); +static void G_InitGame(int levelTime, unsigned int randomSeed, int restart); +static void G_RunFrame(int levelTime); +void G_ShutdownGame(int restart); //============================= // begin code @@ -497,39 +497,39 @@ This is the only way control passes into the module. This MUST be the very first function compiled into the .q3vm file ================ */ -Q_EXPORT intptr_t vmMain( int command, int arg0, int arg1, int arg2, /*@unused@*/ int arg3, /*@unused@*/ int arg4, /*@unused@*/ int arg5, /*@unused@*/ int arg6 ) { - switch ( command ) { - case GAME_INIT: - G_InitGame( arg0, (unsigned)arg1, arg2 ); - return 0; - case GAME_SHUTDOWN: - G_ShutdownGame( arg0 ); - return 0; - case GAME_CLIENT_CONNECT: - return (intptr_t)G_Client_Connect( arg0, (qboolean)arg1, (qboolean)arg2 ); - case GAME_CLIENT_THINK: - ClientThink( arg0 ); - return 0; - case GAME_CLIENT_USERINFO_CHANGED: - G_Client_UserinfoChanged( arg0 ); //TiM - this means a user just tried to change it - return 0; - case GAME_CLIENT_DISCONNECT: - G_Client_Disconnect( arg0 ); - return 0; - case GAME_CLIENT_BEGIN: - G_Client_Begin( arg0, qtrue, qfalse, qtrue ); - return 0; - case GAME_CLIENT_COMMAND: - G_Client_Command( arg0 ); - return 0; - case GAME_RUN_FRAME: - G_RunFrame( arg0 ); - return 0; - case GAME_CONSOLE_COMMAND: - //RPG-X : TiM - plagiarised Red's logic from SFEFMOD here lol - return (intptr_t)ConsoleCommand(); - case BOTAI_START_FRAME: - return (intptr_t)BotAIStartFrame( arg0 ); +Q_EXPORT intptr_t vmMain(int command, int arg0, int arg1, int arg2, /*@unused@*/ int arg3, /*@unused@*/ int arg4, /*@unused@*/ int arg5, /*@unused@*/ int arg6) { + switch (command) { + case GAME_INIT: + G_InitGame(arg0, (unsigned)arg1, arg2); + return 0; + case GAME_SHUTDOWN: + G_ShutdownGame(arg0); + return 0; + case GAME_CLIENT_CONNECT: + return (intptr_t)G_Client_Connect(arg0, (qboolean)arg1, (qboolean)arg2); + case GAME_CLIENT_THINK: + ClientThink(arg0); + return 0; + case GAME_CLIENT_USERINFO_CHANGED: + G_Client_UserinfoChanged(arg0); //TiM - this means a user just tried to change it + return 0; + case GAME_CLIENT_DISCONNECT: + G_Client_Disconnect(arg0); + return 0; + case GAME_CLIENT_BEGIN: + G_Client_Begin(arg0, qtrue, qfalse, qtrue); + return 0; + case GAME_CLIENT_COMMAND: + G_Client_Command(arg0); + return 0; + case GAME_RUN_FRAME: + G_RunFrame(arg0); + return 0; + case GAME_CONSOLE_COMMAND: + //RPG-X : TiM - plagiarised Red's logic from SFEFMOD here lol + return (intptr_t)ConsoleCommand(); + case BOTAI_START_FRAME: + return (intptr_t)BotAIStartFrame(arg0); } return -1; @@ -539,9 +539,9 @@ void QDECL G_PrintfClientAll(const char *fmt, ...) { va_list argptr; char text[1024]; - va_start (argptr, fmt); + va_start(argptr, fmt); vsnprintf(text, sizeof(text), fmt, argptr); - va_end (argptr); + va_end(argptr); trap_SendServerCommand(-1, va("print \"%s\n\"", text)); } @@ -550,50 +550,53 @@ void QDECL G_PrintfClient(gentity_t *ent, const char *fmt, ...) { va_list argptr; char text[1024]; - va_start (argptr, fmt); + /* only makes sense for players */ + G_Assert(ent->client, (void)0); + + va_start(argptr, fmt); vsnprintf(text, sizeof(text), fmt, argptr); - va_end (argptr); + va_end(argptr); - #ifdef G_LUA - LuaHook_G_ClientPrint(text, ent-g_entities); - #endif +#ifdef G_LUA + LuaHook_G_ClientPrint(text, ent - g_entities); +#endif - trap_SendServerCommand(ent-g_entities, va("print \"%s\n\"", text)); + trap_SendServerCommand(ent - g_entities, va("print \"%s\n\"", text)); } -void QDECL G_Printf( const char *fmt, ... ) { +void QDECL G_Printf(const char *fmt, ...) { va_list argptr; char text[1024]; - va_start (argptr, fmt); + va_start(argptr, fmt); vsnprintf(text, sizeof(text), fmt, argptr); - va_end (argptr); + va_end(argptr); - if(trap_Cvar_VariableIntegerValue("developer") != 0) { + if (trap_Cvar_VariableIntegerValue("developer") != 0) { } - #ifdef G_LUA +#ifdef G_LUA // Lua API callbacks LuaHook_G_Print(text); - #endif +#endif - trap_Printf( text ); + trap_Printf(text); } -void QDECL G_Error( const char *fmt, ... ) { +void QDECL G_Error(const char *fmt, ...) { va_list argptr; char text[1024]; - va_start (argptr, fmt); + va_start(argptr, fmt); vsnprintf(text, sizeof(text), fmt, argptr); - va_end (argptr); + va_end(argptr); - #ifdef G_LUA +#ifdef G_LUA G_Lua_Shutdown(); - #endif +#endif - trap_Error( text ); + trap_Error(text); } stringID_table_t WeaponTable[] = { @@ -612,20 +615,20 @@ stringID_table_t WeaponTable[] = { { ENUM2STRING(WP_14) }, { ENUM2STRING(WP_15) }, - { "WP_TRICORDER", WP_2 }, - { "WP_PADD", WP_3 }, - { "WP_COFFEE", WP_4 }, - { "WP_PHASER", WP_5 }, - { "WP_COMPRESSION_RIFLE", WP_6 }, - { "WP_TR116", WP_7 }, - { "WP_GRENADE_LAUNCHER", WP_8 }, - { "WP_QUANTUM_BURST", WP_9 }, - { "WP_DISRUPTOR", WP_10 }, - { "WP_MEDKIT", WP_11 }, - { "WP_VOYAGER_HYPO", WP_12 }, - { "WP_DERMAL_REGEN", WP_13 }, - { "WP_TOOLKIT", WP_14 }, - { "WP_HYPERSPANNER", WP_15 }, + { "WP_TRICORDER", WP_2 }, + { "WP_PADD", WP_3 }, + { "WP_COFFEE", WP_4 }, + { "WP_PHASER", WP_5 }, + { "WP_COMPRESSION_RIFLE", WP_6 }, + { "WP_TR116", WP_7 }, + { "WP_GRENADE_LAUNCHER", WP_8 }, + { "WP_QUANTUM_BURST", WP_9 }, + { "WP_DISRUPTOR", WP_10 }, + { "WP_MEDKIT", WP_11 }, + { "WP_VOYAGER_HYPO", WP_12 }, + { "WP_DERMAL_REGEN", WP_13 }, + { "WP_TOOLKIT", WP_14 }, + { "WP_HYPERSPANNER", WP_15 }, { NULL, -1 } }; @@ -638,148 +641,146 @@ and parses the class data for utilization on the server and transfer to clients **************************/ -static qboolean G_LoadClassData( char* fileName ) -{ +static qboolean G_LoadClassData(char* fileName) { char* buffer = NULL; char* textPtr = NULL; char* token = NULL; int fileLen; fileHandle_t f = 0; - qboolean classValid=qfalse; - int classIndex=0; + qboolean classValid = qfalse; + int classIndex = 0; unsigned weapon; int i; //Init the storage place - memset( &g_classData, 0, sizeof ( g_classData ) ); + memset(&g_classData, 0, sizeof (g_classData)); - fileLen = trap_FS_FOpenFile( fileName, &f, FS_READ ); + fileLen = trap_FS_FOpenFile(fileName, &f, FS_READ); - if ( f == 0 ) { - G_Printf( S_COLOR_RED "ERROR: File %s not found.\n", fileName ); + if (f == 0) { + G_Printf(S_COLOR_RED "ERROR: File %s not found.\n", fileName); return qfalse; } - buffer = (char *)malloc((fileLen+1) * sizeof(char)); - if(buffer == NULL) { - G_Printf( S_COLOR_RED "ERROR: Was unable to allocate %i bytes.\n", (fileLen+1) * sizeof(char) ); - trap_FS_FCloseFile( f ); + buffer = (char *)malloc((fileLen + 1) * sizeof(char)); + if (buffer == NULL) { + G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i bytes.\n", (fileLen + 1) * sizeof(char)); + trap_FS_FCloseFile(f); return qfalse; } memset(buffer, 0, sizeof(buffer)); - trap_FS_Read( buffer, fileLen, f ); + trap_FS_Read(buffer, fileLen, f); buffer[fileLen] = 0; - trap_FS_FCloseFile( f ); + trap_FS_FCloseFile(f); COM_BeginParseSession(); textPtr = buffer; - token = COM_Parse( &textPtr ); + token = COM_Parse(&textPtr); - if ( token == NULL || token[0] == 0 ) { - G_Printf( S_COLOR_RED "ERROR: No data was found when going to parse the file!\n" ); + if (token == NULL || token[0] == 0) { + G_Printf(S_COLOR_RED "ERROR: No data was found when going to parse the file!\n"); free(buffer); return qfalse; } - if ( Q_stricmpn( token, "{", 1 ) != 0 ) { - G_Printf( S_COLOR_RED "ERROR: File did not start with a '{' symbol!\n" ); + if (Q_stricmpn(token, "{", 1) != 0) { + G_Printf(S_COLOR_RED "ERROR: File did not start with a '{' symbol!\n"); free(buffer); return qfalse; } - while ( qtrue ) { - if ( classIndex >= MAX_CLASSES ) { + while (qtrue) { + if (classIndex >= MAX_CLASSES) { break; } - if ( Q_stricmpn( token, "{", 1 ) == 0 ) { - while ( qtrue ) { - token = COM_Parse( &textPtr ); + if (Q_stricmpn(token, "{", 1) == 0) { + while (qtrue) { + token = COM_Parse(&textPtr); if (token == NULL || token[0] == 0) { break; } - if ( Q_stricmpn( token, "consoleName", 11 ) == 0 ) { - if ( COM_ParseString( &textPtr, &token ) ) { - G_Printf( S_COLOR_RED "ERROR: Invalid class console name in class index: %i.\n", classIndex ); - SkipBracedSection( &textPtr ); + if (Q_stricmpn(token, "consoleName", 11) == 0) { + if (COM_ParseString(&textPtr, &token)) { + G_Printf(S_COLOR_RED "ERROR: Invalid class console name in class index: %i.\n", classIndex); + SkipBracedSection(&textPtr); continue; } - Q_strncpyz( g_classData[classIndex].consoleName, token, sizeof( g_classData[classIndex].consoleName ) ); + Q_strncpyz(g_classData[classIndex].consoleName, token, sizeof(g_classData[classIndex].consoleName)); classValid = qtrue; continue; } - if ( Q_stricmpn( token, "formalName", 11 ) == 0 ) { - if ( COM_ParseString( &textPtr, &token ) ) { - G_Printf( S_COLOR_RED "ERROR: Invalid class formal name in class index: %i.\n", classIndex ); - SkipBracedSection( &textPtr ); + if (Q_stricmpn(token, "formalName", 11) == 0) { + if (COM_ParseString(&textPtr, &token)) { + G_Printf(S_COLOR_RED "ERROR: Invalid class formal name in class index: %i.\n", classIndex); + SkipBracedSection(&textPtr); continue; } - Q_strncpyz( g_classData[classIndex].formalName, token, sizeof( g_classData[classIndex].formalName ) ); + Q_strncpyz(g_classData[classIndex].formalName, token, sizeof(g_classData[classIndex].formalName)); classValid = qtrue; continue; } - if ( Q_stricmpn( token, "message", 7 ) == 0 ) { - if ( COM_ParseString( &textPtr, &token ) ) { - G_Printf( S_COLOR_RED "ERROR: Invalid class message in class index: %i.\n", classIndex ); + if (Q_stricmpn(token, "message", 7) == 0) { + if (COM_ParseString(&textPtr, &token)) { + G_Printf(S_COLOR_RED "ERROR: Invalid class message in class index: %i.\n", classIndex); continue; } - Q_strncpyz( g_classData[classIndex].message, token, sizeof( g_classData[classIndex].message ) ); + Q_strncpyz(g_classData[classIndex].message, token, sizeof(g_classData[classIndex].message)); continue; } - if ( Q_stricmpn( token, "modelSkin", 9 ) == 0 ) { - if ( COM_ParseString( &textPtr, &token ) ) { - G_Printf( S_COLOR_RED "ERROR: Invalid class skin color in class index: %i.\n", classIndex ); + if (Q_stricmpn(token, "modelSkin", 9) == 0) { + if (COM_ParseString(&textPtr, &token)) { + G_Printf(S_COLOR_RED "ERROR: Invalid class skin color in class index: %i.\n", classIndex); continue; } - Q_strncpyz( g_classData[classIndex].modelSkin, token, sizeof( g_classData[classIndex].modelSkin ) ); + Q_strncpyz(g_classData[classIndex].modelSkin, token, sizeof(g_classData[classIndex].modelSkin)); continue; } - if ( Q_stricmpn( token, "weapons", 7) == 0 ) { - token = COM_Parse( &textPtr ); + if (Q_stricmpn(token, "weapons", 7) == 0) { + token = COM_Parse(&textPtr); - if ( Q_stricmpn( token, "{", 1 ) != 0 ) { - G_Printf( S_COLOR_RED "No opening bracket found for weapons field in class: %i.\n", classIndex ); - SkipRestOfLine( &textPtr ); + if (Q_stricmpn(token, "{", 1) != 0) { + G_Printf(S_COLOR_RED "No opening bracket found for weapons field in class: %i.\n", classIndex); + SkipRestOfLine(&textPtr); continue; } //sub loop - while ( qtrue ) { - token = COM_Parse( &textPtr ); + while (qtrue) { + token = COM_Parse(&textPtr); - if ( token == NULL || token[0] == 0 ) { + if (token == NULL || token[0] == 0) { break; } - if ( Q_stricmpn( token, "|", 1 ) == 0) { + if (Q_stricmpn(token, "|", 1) == 0) { continue; } - if ( Q_stricmpn( token, "}", 1 ) == 0 ) { + if (Q_stricmpn(token, "}", 1) == 0) { break; } - if( Q_stricmpn( token, "WP_", 3 ) == 0 ) - { - int t = GetIDForString( WeaponTable, token ); + if (Q_stricmpn(token, "WP_", 3) == 0) { + int t = GetIDForString(WeaponTable, token); - if ( t >= 0 ) { + if (t >= 0) { weapon = (unsigned)t; - g_classData[classIndex].weaponsFlags |= ( 1 << weapon ); + g_classData[classIndex].weaponsFlags |= (1 << weapon); continue; } } @@ -788,44 +789,44 @@ static qboolean G_LoadClassData( char* fileName ) continue; } - if ( Q_stricmpn( token, "admin", 5 ) == 0 ) { - if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isAdmin ) ) { - G_Printf( S_COLOR_RED "ERROR: Class admin check for class %i was invalid.\n", classIndex ); + if (Q_stricmpn(token, "admin", 5) == 0) { + if (COM_ParseInt(&textPtr, &g_classData[classIndex].isAdmin)) { + G_Printf(S_COLOR_RED "ERROR: Class admin check for class %i was invalid.\n", classIndex); continue; } continue; } - if ( Q_stricmpn( token, "marine", 6 ) == 0 ) { - if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isMarine ) ) { - G_Printf( S_COLOR_RED "ERROR: Class marine check for class %i was invalid.\n", classIndex ); + if (Q_stricmpn(token, "marine", 6) == 0) { + if (COM_ParseInt(&textPtr, &g_classData[classIndex].isMarine)) { + G_Printf(S_COLOR_RED "ERROR: Class marine check for class %i was invalid.\n", classIndex); continue; } continue; } - if ( Q_stricmpn( token, "medical", 7 ) == 0) { - if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isMedical ) ) { - G_Printf( S_COLOR_RED "ERROR: Class medic check for class %i was invalid.\n", classIndex ); + if (Q_stricmpn(token, "medical", 7) == 0) { + if (COM_ParseInt(&textPtr, &g_classData[classIndex].isMedical)) { + G_Printf(S_COLOR_RED "ERROR: Class medic check for class %i was invalid.\n", classIndex); continue; } continue; } - if( Q_stricmpn( token, "isBorg", 6 ) == 0 ) { - if( COM_ParseInt( &textPtr, &g_classData[classIndex].isBorg ) ) { - G_Printf( S_COLOR_RED "ERROR: Class borg check for class %i was invalid.\n", classIndex ); + if (Q_stricmpn(token, "isBorg", 6) == 0) { + if (COM_ParseInt(&textPtr, &g_classData[classIndex].isBorg)) { + G_Printf(S_COLOR_RED "ERROR: Class borg check for class %i was invalid.\n", classIndex); continue; } continue; } - if ( Q_stricmpn( token, "n00b", 4 ) == 0 ) { - if ( COM_ParseInt( &textPtr, &g_classData[classIndex].isn00b ) ) { - G_Printf( S_COLOR_RED "ERROR: Class n00b check for class %i was invalid.\n", classIndex ); + if (Q_stricmpn(token, "n00b", 4) == 0) { + if (COM_ParseInt(&textPtr, &g_classData[classIndex].isn00b)) { + G_Printf(S_COLOR_RED "ERROR: Class n00b check for class %i was invalid.\n", classIndex); continue; } @@ -833,28 +834,28 @@ static qboolean G_LoadClassData( char* fileName ) } //skip the client-side specific entries since they interfere with the parsing - if ( (Q_stricmpn( token, "radarColor", 10 ) == 0) - || (Q_stricmpn( token, "iconColor", 9 ) == 0) - || (Q_stricmpn( token, "hasRanks", 8 ) == 0) - || (Q_stricmpn( token, "noShow", 6 ) == 0) + if ((Q_stricmpn(token, "radarColor", 10) == 0) + || (Q_stricmpn(token, "iconColor", 9) == 0) + || (Q_stricmpn(token, "hasRanks", 8) == 0) + || (Q_stricmpn(token, "noShow", 6) == 0) ) { - SkipRestOfLine( &textPtr ); + SkipRestOfLine(&textPtr); continue; } - if ( Q_stricmpn( token, "}", 1 ) == 0 ) { + if (Q_stricmpn(token, "}", 1) == 0) { break; } } - if ( classValid ) { + if (classValid) { classIndex++; classValid = qfalse; } } - token = COM_Parse( &textPtr ); + token = COM_Parse(&textPtr); if (token == NULL || token[0] == 0) { break; } @@ -863,20 +864,20 @@ static qboolean G_LoadClassData( char* fileName ) free(buffer); //build ourselves custom CVARs for each class - for ( i=0; (g_classData[i].consoleName[0] != 0) && (i < MAX_CLASSES); i++ ) { - trap_Cvar_Register( NULL, va("rpg_%sPass", g_classData[i].consoleName ), g_classData[i].consoleName, CVAR_ARCHIVE ); - trap_Cvar_Register( NULL, va("rpg_%sFlags", g_classData[i].consoleName ), va("%i", g_classData[i].weaponsFlags), CVAR_ARCHIVE ); + for (i = 0; (g_classData[i].consoleName[0] != 0) && (i < MAX_CLASSES); i++) { + trap_Cvar_Register(NULL, va("rpg_%sPass", g_classData[i].consoleName), g_classData[i].consoleName, CVAR_ARCHIVE); + trap_Cvar_Register(NULL, va("rpg_%sFlags", g_classData[i].consoleName), va("%i", g_classData[i].weaponsFlags), CVAR_ARCHIVE); } - if ( classIndex > 0 ) { + if (classIndex > 0) { return qtrue; } else { - G_Printf( S_COLOR_RED "ERROR: No valid classes were found.\n"); + G_Printf(S_COLOR_RED "ERROR: No valid classes were found.\n"); return qfalse; } } -void SP_target_location (gentity_t *ent); +void SP_target_location(gentity_t *ent); static void G_LoadTimedMessages(void) { fileHandle_t f = 0; @@ -887,14 +888,14 @@ static void G_LoadTimedMessages(void) { G_LogFuncBegin(); len = trap_FS_FOpenFile("timedmessages.cfg", &f, FS_READ); - if(len == 0) { + if (len == 0) { G_LogFuncEnd(); return; } - buffer = (char *)malloc(sizeof(char) * (len+1)); - if(buffer == NULL) { - G_LocLogger(LL_ERROR, "Was unable to allocate %i byte.\n", (len+1) * sizeof(char) ); + buffer = (char *)malloc(sizeof(char)* (len + 1)); + if (buffer == NULL) { + G_LocLogger(LL_ERROR, "Was unable to allocate %i byte.\n", (len + 1) * sizeof(char)); trap_FS_FCloseFile(f); G_LogFuncEnd(); return; @@ -902,7 +903,7 @@ static void G_LoadTimedMessages(void) { memset(buffer, 0, (size_t)((len + 1) * sizeof(char))); level.timedMessages = create_list(); - if(level.timedMessages == NULL) { + if (level.timedMessages == NULL) { G_LocLogger(LL_ERROR, "Could not create list for timed messages.\n"); trap_FS_FCloseFile(f); free(buffer); @@ -912,18 +913,18 @@ static void G_LoadTimedMessages(void) { trap_FS_Read(buffer, len, f); trap_FS_FCloseFile(f); - + lexer = bgLex_create(buffer); - if(lexer == NULL) { + if (lexer == NULL) { G_LocLogger(LL_ERROR, "Could not create new bgLex to lex timed messages.\n"); free(buffer); G_LogFuncEnd(); return; } - while(bgLex_lex(lexer) != 0) { - if(lexer->morphem.type == LMT_STRING) { + while (bgLex_lex(lexer) != 0) { + if (lexer->morphem.type == LMT_STRING) { level.timedMessages->append(level.timedMessages, lexer->morphem.data.str, LT_STRING, strlen(lexer->morphem.data.str)); } else { G_Logger(LL_WARN, "Unexpected token in timedmessages.cfg:%d:%d!\n", lexer->morphem.line, lexer->morphem.column); @@ -953,75 +954,74 @@ static void G_LoadHolodeckFile(void) { memset(mapRoute, 0, sizeof(mapRoute)); info = (char *)malloc(MAX_INFO_STRING * sizeof(char)); - if(!info) { - G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i byte.\n", MAX_INFO_STRING * sizeof(char) ); + if (!info) { + G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i byte.\n", MAX_INFO_STRING * sizeof(char)); return; } memset(info, 0, sizeof(info)); //get the map name out of the server data - trap_GetServerinfo( info, MAX_INFO_STRING * sizeof(char) ); + trap_GetServerinfo(info, MAX_INFO_STRING * sizeof(char)); //setup the file route - Com_sprintf( mapRoute, sizeof( mapRoute ), "maps/%s", Info_ValueForKey( info, "mapname" ) ); + Com_sprintf(mapRoute, sizeof(mapRoute), "maps/%s", Info_ValueForKey(info, "mapname")); - BG_LanguageFilename( mapRoute, "holodeck", fileRoute ); + BG_LanguageFilename(mapRoute, "holodeck", fileRoute); - file_len = trap_FS_FOpenFile( fileRoute, &f, FS_READ ); + file_len = trap_FS_FOpenFile(fileRoute, &f, FS_READ); free(info); - if ( file_len == 0) { + if (file_len == 0) { return; } buffer = (char *)malloc(32000 * sizeof(char)); - if(buffer == NULL) { - G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i bytes.\n", 32000 * sizeof(char) ); + if (buffer == NULL) { + G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i bytes.\n", 32000 * sizeof(char)); trap_FS_FCloseFile(f); return; } memset(buffer, 0, sizeof(buffer)); - trap_FS_Read( buffer, file_len, f ); - if ( buffer[0] == 0 ) - { - G_Printf( S_COLOR_RED "ERROR: Couldn't read in file: %s!\n", fileRoute ); - trap_FS_FCloseFile( f ); + trap_FS_Read(buffer, file_len, f); + if (buffer[0] == 0) { + G_Printf(S_COLOR_RED "ERROR: Couldn't read in file: %s!\n", fileRoute); + trap_FS_FCloseFile(f); free(buffer); return; } buffer[file_len] = '\0'; - trap_FS_FCloseFile( f ); + trap_FS_FCloseFile(f); memset(&holoData, 0, sizeof(holoData)); COM_BeginParseSession(); txtPtr = buffer; - while(qtrue) { + while (qtrue) { token = COM_Parse(&txtPtr); - if(token == NULL || token[0] == 0) { + if (token == NULL || token[0] == 0) { break; } - if(Q_stricmpn(token, "HolodeckData", 12) == 0) { + if (Q_stricmpn(token, "HolodeckData", 12) == 0) { token = COM_Parse(&txtPtr); - if(Q_stricmpn(token, "{", 1) != 0) { - G_Printf( S_COLOR_RED "ERROR: HolodeckData had no opening brace ( { )!\n"); + if (Q_stricmpn(token, "{", 1) != 0) { + G_Printf(S_COLOR_RED "ERROR: HolodeckData had no opening brace ( { )!\n"); continue; } - while(Q_stricmpn(token, "}", 1) != 0) { + while (Q_stricmpn(token, "}", 1) != 0) { token = COM_Parse(&txtPtr); - if(token == NULL || token[0] == 0) { + if (token == NULL || token[0] == 0) { break; } - if(Q_stricmpn(token, "Program", 7) == 0) { + if (Q_stricmpn(token, "Program", 7) == 0) { token = COM_Parse(&txtPtr); - if(Q_stricmpn(token, "[", 1) != 0) { - G_Printf( S_COLOR_RED "ERROR: Program had no opening brace ( [ )!\n"); + if (Q_stricmpn(token, "[", 1) != 0) { + G_Printf(S_COLOR_RED "ERROR: Program had no opening brace ( [ )!\n"); continue; } @@ -1031,12 +1031,12 @@ static void G_LoadHolodeckFile(void) { // - desc1 // - desc2 // - image - while(Q_stricmpn(token, "]", 1) != 0) { - if(token == NULL || token[0] == 0) { + while (Q_stricmpn(token, "]", 1) != 0) { + if (token == NULL || token[0] == 0) { break; } - if(numProgs >= 5) { + if (numProgs >= 5) { free(buffer); return; } @@ -1091,15 +1091,15 @@ static void G_LoadServerChangeFile(void) { file_len = trap_FS_FOpenFile(fileRoute, &f, FS_READ); - if(file_len == 0) { + if (file_len == 0) { G_LogFuncEnd(); return; } // TODO dynamic buffer size buffer = malloc((file_len + 1) * sizeof(char)); - if(buffer == NULL) { - G_LocLogger(LL_ERROR, "Was unable to allocate %i bytes.\n", (file_len + 1) * sizeof(char) ); + if (buffer == NULL) { + G_LocLogger(LL_ERROR, "Was unable to allocate %i bytes.\n", (file_len + 1) * sizeof(char)); trap_FS_FCloseFile(f); G_LogFuncEnd(); return; @@ -1107,10 +1107,9 @@ static void G_LoadServerChangeFile(void) { memset(buffer, 0, sizeof(buffer)); trap_FS_Read(buffer, file_len, f); - if ( buffer[0] == 0 ) - { - G_LocLogger(LL_ERROR, "Couldn't read in file: %s!\n", fileRoute ); - trap_FS_FCloseFile( f ); + if (buffer[0] == 0) { + G_LocLogger(LL_ERROR, "Couldn't read in file: %s!\n", fileRoute); + trap_FS_FCloseFile(f); free(buffer); G_LogFuncEnd(); return; @@ -1124,21 +1123,21 @@ static void G_LoadServerChangeFile(void) { G_Logger(LL_INFO, "Loading ServerChangeConfig '%s'.\n", fileRoute); lex = bgLex_create(buffer); - if(lex == NULL) { + if (lex == NULL) { G_LocLogger(LL_ERROR, "Could not create bgLex to lex ServerChangeConfig.\n"); free(buffer); G_LogFuncEnd(); return; } - if(bgLex_lex(lex) != LMT_SYMBOL || lex->morphem.data.symbol != LSYM_SERVER_CHANGE_CONFIG) { + if (bgLex_lex(lex) != LMT_SYMBOL || lex->morphem.data.symbol != LSYM_SERVER_CHANGE_CONFIG) { G_LocLogger(LL_ERROR, "Expected 'ServerChangeConfig' at beginning of %s.\n", fileRoute); free(buffer); bgLex_destroy(lex); G_LogFuncEnd(); return; } - if(bgLex_lex(lex) != LMT_SYMBOL || lex->morphem.data.symbol != LSYM_OBRACEC) { + if (bgLex_lex(lex) != LMT_SYMBOL || lex->morphem.data.symbol != LSYM_OBRACEC) { G_LocLogger(LL_ERROR, "Missing '{' at %d:%d.\n", lex->morphem.line, lex->morphem.column); free(buffer); bgLex_destroy(lex); @@ -1146,13 +1145,13 @@ static void G_LoadServerChangeFile(void) { return; } - while(bgLex_lex(lex) != 0) { - if(lex->morphem.type == LMT_SYMBOL && lex->morphem.data.symbol == LSYM_CBRACEC) { + while (bgLex_lex(lex) != 0) { + if (lex->morphem.type == LMT_SYMBOL && lex->morphem.data.symbol == LSYM_CBRACEC) { break; } - if(lex->morphem.type == LMT_SYMBOL && lex->morphem.data.symbol == LSYM_SERVER) { - if(bgLex_lex(lex) != LMT_SYMBOL || lex->morphem.data.symbol != LSYM_OBRACESQ) { + if (lex->morphem.type == LMT_SYMBOL && lex->morphem.data.symbol == LSYM_SERVER) { + if (bgLex_lex(lex) != LMT_SYMBOL || lex->morphem.data.symbol != LSYM_OBRACESQ) { G_LocLogger(LL_ERROR, "Missing '[' at %d:%d.\n", lex->morphem.line, lex->morphem.column); free(buffer); bgLex_destroy(lex); @@ -1160,7 +1159,7 @@ static void G_LoadServerChangeFile(void) { return; } - if(bgLex_lex(lex) == LMT_STRING) { + if (bgLex_lex(lex) == LMT_STRING) { strncpy(level.srvChangeData.ip[level.srvChangeData.count], lex->morphem.data.str, sizeof(level.srvChangeData.ip[level.srvChangeData.count])); } else { G_LocLogger(LL_ERROR, "Unexpected token at %d:%d.\n", lex->morphem.line, lex->morphem.column); @@ -1170,7 +1169,7 @@ static void G_LoadServerChangeFile(void) { return; } - if(bgLex_lex(lex) == LMT_STRING) { + if (bgLex_lex(lex) == LMT_STRING) { strncpy(level.srvChangeData.name[level.srvChangeData.count], lex->morphem.data.str, sizeof(level.srvChangeData.name[level.srvChangeData.count])); } else { G_LocLogger(LL_ERROR, "Unexpected token at %d:%d.\n", lex->morphem.line, lex->morphem.column); @@ -1183,7 +1182,7 @@ static void G_LoadServerChangeFile(void) { level.srvChangeData.count++; - if(bgLex_lex(lex) != LMT_SYMBOL || lex->morphem.data.symbol != LSYM_CBRACESQ) { + if (bgLex_lex(lex) != LMT_SYMBOL || lex->morphem.data.symbol != LSYM_CBRACESQ) { G_LocLogger(LL_ERROR, "Missing ']' at %d:%d.\n", lex->morphem.line, lex->morphem.column); free(buffer); bgLex_destroy(lex); @@ -1220,23 +1219,22 @@ static void G_LoadMapChangeFile(void) { file_len = trap_FS_FOpenFile(fileRoute, &f, FS_READ); - if(file_len == 0) { + if (file_len == 0) { return; } buffer = (char *)malloc(32000 * sizeof(char)); - if(buffer == NULL) { - G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i bytes.\n", 32000 * sizeof(char) ); + if (buffer == NULL) { + G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i bytes.\n", 32000 * sizeof(char)); trap_FS_FCloseFile(f); return; } memset(buffer, 0, sizeof(buffer)); trap_FS_Read(buffer, file_len, f); - if ( buffer[0] == 0 ) - { - G_Printf( S_COLOR_RED "ERROR: Couldn't read in file: %s!\n", fileRoute ); - trap_FS_FCloseFile( f ); + if (buffer[0] == 0) { + G_Printf(S_COLOR_RED "ERROR: Couldn't read in file: %s!\n", fileRoute); + trap_FS_FCloseFile(f); free(buffer); return; } @@ -1249,49 +1247,47 @@ static void G_LoadMapChangeFile(void) { COM_BeginParseSession(); txtPtr = buffer; - while(qtrue) { + while (qtrue) { token = COM_Parse(&txtPtr); - if(token == NULL || token[0] == 0) { + if (token == NULL || token[0] == 0) { break; } - if(Q_stricmp(token, "MapChangeConfig") == 0) { - token = COM_Parse( &txtPtr ); - if ( Q_strncmp( token, "{", 1 ) != 0 ) - { - G_Printf( S_COLOR_RED "ERROR: MapChangeConfig had no opening brace ( { )!\n" ); + if (Q_stricmp(token, "MapChangeConfig") == 0) { + token = COM_Parse(&txtPtr); + if (Q_strncmp(token, "{", 1) != 0) { + G_Printf(S_COLOR_RED "ERROR: MapChangeConfig had no opening brace ( { )!\n"); continue; } - while(Q_strncmp(token, "}", 1) != 0) { + while (Q_strncmp(token, "}", 1) != 0) { token = COM_Parse(&txtPtr); - if(token == NULL || token[0] == 0) { + if (token == NULL || token[0] == 0) { break; } - if(Q_stricmp(token, "Map") == 0) { + if (Q_stricmp(token, "Map") == 0) { token = COM_Parse(&txtPtr); - if ( Q_strncmp( token, "[", 1 ) != 0 ) - { - G_Printf( S_COLOR_RED "ERROR: Server had no opening brace ( [ )!\n" ); + if (Q_strncmp(token, "[", 1) != 0) { + G_Printf(S_COLOR_RED "ERROR: Server had no opening brace ( [ )!\n"); continue; } token = COM_Parse(&txtPtr); - while(Q_strncmp(token, "]", 1) != 0) { - if(token == NULL || token[0] == 0) { + while (Q_strncmp(token, "]", 1) != 0) { + if (token == NULL || token[0] == 0) { break; } - if(cnt > 12) break; + if (cnt > 12) break; - if(cnt % 2 == 0) + if (cnt % 2 == 0) Q_strncpyz(mapChangeData.name[i], token, sizeof(mapChangeData.name[i])); else Q_strncpyz(mapChangeData.bspname[i], token, sizeof(mapChangeData.bspname[i])); cnt++; - if(cnt % 2 == 0) + if (cnt % 2 == 0) i++; token = COM_Parse(&txtPtr); @@ -1304,8 +1300,7 @@ static void G_LoadMapChangeFile(void) { free(buffer); } -static void G_LoadLocationsFile( void ) -{ +static void G_LoadLocationsFile(void) { char fileRoute[MAX_QPATH]; char mapRoute[MAX_QPATH]; char *serverInfo; @@ -1322,9 +1317,9 @@ static void G_LoadLocationsFile( void ) memset(fileRoute, 0, sizeof(fileRoute)); memset(mapRoute, 0, sizeof(mapRoute)); - + serverInfo = malloc(MAX_INFO_STRING * sizeof(char)); - if(serverInfo == NULL) { + if (serverInfo == NULL) { G_LocLogger(LL_ERROR, "Was unable to allocate %i bytes.\n", MAX_INFO_STRING * sizeof(char)); G_LogFuncEnd(); return; @@ -1332,14 +1327,14 @@ static void G_LoadLocationsFile( void ) memset(serverInfo, 0, sizeof(serverInfo)); //get the map name out of the server data - trap_GetServerinfo( serverInfo, (size_t)(MAX_INFO_STRING * sizeof(char)) ); + trap_GetServerinfo(serverInfo, (size_t)(MAX_INFO_STRING * sizeof(char))); //setup the file route - Com_sprintf( mapRoute, sizeof( mapRoute ), "maps/%s", Info_ValueForKey( serverInfo, "mapname" ) ); + Com_sprintf(mapRoute, sizeof(mapRoute), "maps/%s", Info_ValueForKey(serverInfo, "mapname")); - BG_LanguageFilename( mapRoute, "locations", fileRoute ); + BG_LanguageFilename(mapRoute, "locations", fileRoute); - file_len = trap_FS_FOpenFile( fileRoute, &f, FS_READ ); + file_len = trap_FS_FOpenFile(fileRoute, &f, FS_READ); free(serverInfo); @@ -1348,38 +1343,37 @@ static void G_LoadLocationsFile( void ) return; } - buffer = (char *)malloc((file_len+1) * sizeof(char)); - if(buffer == NULL) { - G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i bytes.\n", (file_len+1) * sizeof(char)); + buffer = (char *)malloc((file_len + 1) * sizeof(char)); + if (buffer == NULL) { + G_Printf(S_COLOR_RED "ERROR: Was unable to allocate %i bytes.\n", (file_len + 1) * sizeof(char)); trap_FS_FCloseFile(f); return; } memset(buffer, 0, sizeof(buffer)); - trap_FS_Read( buffer, file_len, f ); - if ( buffer[0] == 0 ) - { - G_LocLogger(LL_ERROR, "Couldn't read in file: %s!\n", fileRoute ); - trap_FS_FCloseFile( f ); + trap_FS_Read(buffer, file_len, f); + if (buffer[0] == 0) { + G_LocLogger(LL_ERROR, "Couldn't read in file: %s!\n", fileRoute); + trap_FS_FCloseFile(f); free(buffer); G_LogFuncEnd(); return; } buffer[file_len] = '\0'; - trap_FS_FCloseFile( f ); + trap_FS_FCloseFile(f); G_Logger(LL_INFO, "Locations file %s located. Proceeding to load scan data.\n", fileRoute); //GSIO01: why did this say "Usables file ..."? lol ;) lex = bgLex_create(buffer); - if(lex == NULL) { + if (lex == NULL) { G_LocLogger(LL_ERROR, "Could not create bgLex to lex locations file.\n"); free(buffer); G_LogFuncEnd(); return; } - if(bgLex_lex(lex) != LMT_SYMBOL) { + if (bgLex_lex(lex) != LMT_SYMBOL) { G_LocLogger(LL_ERROR, "Expected locations file to begin with 'LocationsList' or 'LocationsList2'.\n"); free(buffer); bgLex_destroy(lex); @@ -1387,9 +1381,9 @@ static void G_LoadLocationsFile( void ) return; } - if(lex->morphem.data.symbol == LSYM_LOCATIONS_LIST || lex->morphem.data.symbol == LSYM_LOCATIONS_LIST_2) { - if(bgLex_lex(lex) == LMT_SYMBOL && lex->morphem.data.symbol == LSYM_OBRACEC) { - if(bgLex_lex(lex) == 0) { + if (lex->morphem.data.symbol == LSYM_LOCATIONS_LIST || lex->morphem.data.symbol == LSYM_LOCATIONS_LIST_2) { + if (bgLex_lex(lex) == LMT_SYMBOL && lex->morphem.data.symbol == LSYM_OBRACEC) { + if (bgLex_lex(lex) == 0) { G_LocLogger(LL_ERROR, "Unexpected end of file.\n"); free(buffer); bgLex_destroy(lex); @@ -1400,12 +1394,12 @@ static void G_LoadLocationsFile( void ) G_Logger(LL_WARN, "LocationsList2 had no opening brace '{'!\n"); } - while(qtrue) { - if(lex->morphem.type == LMT_SYMBOL && lex->morphem.data.symbol == LSYM_CBRACEC) { + while (qtrue) { + if (lex->morphem.type == LMT_SYMBOL && lex->morphem.data.symbol == LSYM_CBRACEC) { break; } - if(lex->morphem.type == LMT_VECTOR3) { + if (lex->morphem.type == LMT_VECTOR3) { VectorCopy(lex->morphem.data.vector3, origin); } else { G_LocLogger(LL_ERROR, "Expected vector at %d:%d.\n", lex->morphem.line, lex->morphem.column); @@ -1415,7 +1409,7 @@ static void G_LoadLocationsFile( void ) return; } - if(bgLex_lex(lex) == LMT_VECTOR3) { + if (bgLex_lex(lex) == LMT_VECTOR3) { VectorCopy(lex->morphem.data.vector3, angles); } else { G_LocLogger(LL_ERROR, "Expected vector at %d:%d.\n", lex->morphem.line, lex->morphem.column); @@ -1425,22 +1419,22 @@ static void G_LoadLocationsFile( void ) return; } - if(bgLex_lex(lex) == LMT_STRING) { + if (bgLex_lex(lex) == LMT_STRING) { int result; desc = G_NewString(lex->morphem.data.str); - if(desc == NULL) { + if (desc == NULL) { free(buffer); bgLex_destroy(lex); return; } - if((result = bgLex_lex(lex)) == LMT_STRING) { + if ((result = bgLex_lex(lex)) == LMT_STRING) { rest = atoi(desc); desc = G_NewString(lex->morphem.data.str); - if(bgLex_lex(lex) == 0) { + if (bgLex_lex(lex) == 0) { G_LocLogger(LL_ERROR, "Unexpected end of file.\n"); free(buffer); bgLex_destroy(lex); @@ -1448,7 +1442,7 @@ static void G_LoadLocationsFile( void ) return; } } else { - if(result == 0) { + if (result == 0) { G_LocLogger(LL_ERROR, "Unexpected end of file.\n"); free(buffer); bgLex_destroy(lex); @@ -1466,9 +1460,8 @@ static void G_LoadLocationsFile( void ) //create a new entity ent = G_Spawn(); - if ( ent == NULL ) - { - G_LocLogger(LL_ERROR, "Couldn't create entity in %s!\n", fileRoute ); + if (ent == NULL) { + G_LocLogger(LL_ERROR, "Couldn't create entity in %s!\n", fileRoute); free(buffer); bgLex_destroy(lex); G_LogFuncEnd(); @@ -1478,27 +1471,27 @@ static void G_LoadLocationsFile( void ) ent->classname = "target_location"; //copy position data - VectorCopy( origin, ent->s.origin ); - VectorCopy( angles, ent->s.angles ); + VectorCopy(origin, ent->s.origin); + VectorCopy(angles, ent->s.angles); //copy string - ent->message = G_NewString( desc ); + ent->message = G_NewString(desc); //copy desc into target as well - ent->target = ent->targetname = G_NewString( desc ); + ent->target = ent->targetname = G_NewString(desc); // copy restriction value ent->sound1to2 = rest; //initiate it as a location ent - SP_target_location( ent ); + SP_target_location(ent); //reset the ent ent = NULL; rest = 0; - if(lex->morphem.type == LMT_SYMBOL && lex->morphem.data.symbol == LSYM_SEMICOLON) { - if(bgLex_lex(lex) == 0) { + if (lex->morphem.type == LMT_SYMBOL && lex->morphem.data.symbol == LSYM_SEMICOLON) { + if (bgLex_lex(lex) == 0) { G_LocLogger(LL_ERROR, "Unexpected end of file.\n"); free(buffer); bgLex_destroy(lex); @@ -1518,7 +1511,7 @@ static void G_LoadLocationsFile( void ) return; } - if(lex->morphem.type != LMT_SYMBOL || lex->morphem.data.symbol != LSYM_CBRACEC) { + if (lex->morphem.type != LMT_SYMBOL || lex->morphem.data.symbol != LSYM_CBRACEC) { G_Logger(LL_WARN, "Missing closing brace '}'!\n"); } @@ -1529,42 +1522,35 @@ static void G_LoadLocationsFile( void ) } #define MAX_GROUP_FILE_SIZE 5000 -char *G_searchGroupList(const char *name) -{ +char *G_searchGroupList(const char *name) { char *text_p = NULL, *slash = NULL; char text[MAX_GROUP_FILE_SIZE]; int i; char mod_name[200]; - memset (mod_name, 0, sizeof(mod_name)); - memset (races, 0, sizeof(races)); - memset (text, 0, sizeof(text)); + memset(mod_name, 0, sizeof(mod_name)); + memset(races, 0, sizeof(races)); + memset(text, 0, sizeof(text)); // check to see if there is a '/' in the name Q_strncpyz(mod_name, name, sizeof(mod_name)); - slash = strstr( mod_name, "/" ); - if ( slash != NULL ) - {//drop the slash and everything after it for the purpose of finding the model name in th group + slash = strstr(mod_name, "/"); + if (slash != NULL) {//drop the slash and everything after it for the purpose of finding the model name in th group *slash = 0; } // find the name in the group list - for (i=0; iinuse) continue; if (!e->team) continue; if ((e->flags & FL_TEAMSLAVE) != 0) continue; - if ( (e->classname != NULL) && (e->type != ENT_FUNC_DOOR) ) - {//not a door - if ( Q_stricmp( "1", e->team ) == 0 || Q_stricmp( "2", e->team ) == 0 ) - {//is trying to tell us it belongs to the TEAM_RED or TEAM_BLUE + if ((e->classname != NULL) && (e->type != ENT_FUNC_DOOR)) {//not a door + if (Q_stricmp("1", e->team) == 0 || Q_stricmp("2", e->team) == 0) {//is trying to tell us it belongs to the TEAM_RED or TEAM_BLUE continue; } } e->teammaster = e; c++; c2++; - for (j=i+1, e2=e+1 ; j < level.num_entities ; j++,e2++) - { + for (j = i + 1, e2 = e + 1; j < level.num_entities; j++, e2++) { if (!e2->inuse) continue; if (!e2->team) continue; if ((e2->flags & FL_TEAMSLAVE) != 0) continue; - if (strcmp(e->team, e2->team) == 0) - { + if (strcmp(e->team, e2->team) == 0) { c2++; e2->teamchain = e->teamchain; e->teamchain = e2; @@ -1625,7 +1607,7 @@ static void G_FindTeams( void ) { e2->flags |= FL_TEAMSLAVE; // make sure that targets only point at the master - if ( e2->targetname ) { + if (e2->targetname) { e->targetname = e2->targetname; e2->targetname = NULL; } @@ -1633,7 +1615,7 @@ static void G_FindTeams( void ) { } } - G_Printf ("%i teams with %i entities\n", c, c2); + G_Printf("%i teams with %i entities\n", c, c2); } /* @@ -1641,30 +1623,27 @@ static void G_FindTeams( void ) { G_RegisterCvars ================= */ -static void G_RegisterCvars( void ) { +static void G_RegisterCvars(void) { int i; cvarTable_t *cv; - for ( i = 0, cv = gameCvarTable ; i < gameCvarTableSize ; i++, cv++ ) - { + for (i = 0, cv = gameCvarTable; i < gameCvarTableSize; i++, cv++) { - if ( rpg_rpg.integer != 0 ) - { - trap_Cvar_Set( "g_gametype", "0" );//RPG-X: RedTechie - Make sure we keep gametype at 0 + if (rpg_rpg.integer != 0) { + trap_Cvar_Set("g_gametype", "0");//RPG-X: RedTechie - Make sure we keep gametype at 0 } - trap_Cvar_Register( cv->vmCvar, cv->cvarName, cv->defaultString, cv->cvarFlags ); - if ( cv->vmCvar ) - { + trap_Cvar_Register(cv->vmCvar, cv->cvarName, cv->defaultString, cv->cvarFlags); + if (cv->vmCvar) { cv->modificationCount = cv->vmCvar->modificationCount; } } // check some things - if ( g_gametype.integer < 0 || g_gametype.integer >= GT_MAX_GAME_TYPE ) { - G_Printf( "g_gametype %i is out of range, defaulting to 0\n", g_gametype.integer ); - trap_Cvar_Set( "g_gametype", "0" ); + if (g_gametype.integer < 0 || g_gametype.integer >= GT_MAX_GAME_TYPE) { + G_Printf("g_gametype %i is out of range, defaulting to 0\n", g_gametype.integer); + trap_Cvar_Set("g_gametype", "0"); } } @@ -1673,30 +1652,23 @@ static void G_RegisterCvars( void ) { G_UpdateCvars ================= */ -static void G_UpdateCvars( void ) -{ +static void G_UpdateCvars(void) { int i; cvarTable_t *cv; - for ( i = 0, cv = gameCvarTable ; i < gameCvarTableSize ; i++, cv++ ) - { - if ( cv->vmCvar ) - { - trap_Cvar_Update( cv->vmCvar ); + for (i = 0, cv = gameCvarTable; i < gameCvarTableSize; i++, cv++) { + if (cv->vmCvar) { + trap_Cvar_Update(cv->vmCvar); - if ( cv->modificationCount != cv->vmCvar->modificationCount ) - { + if (cv->modificationCount != cv->vmCvar->modificationCount) { cv->modificationCount = cv->vmCvar->modificationCount; - if ( cv->trackChange ) - { - if ( !levelExiting ) - {//no need to do this during level changes + if (cv->trackChange) { + if (!levelExiting) {//no need to do this during level changes //RPG-X: J2J - Don't show gravity changed messages any more (for the gravity target ents) - if(Q_stricmp(cv->cvarName,"g_gravity") != 0) - { - trap_SendServerCommand( -1, va("print \"Server: %s changed to %s\n\"", - cv->cvarName, cv->vmCvar->string ) ); + if (Q_stricmp(cv->cvarName, "g_gravity") != 0) { + trap_SendServerCommand(-1, va("print \"Server: %s changed to %s\n\"", + cv->cvarName, cv->vmCvar->string)); } } } @@ -1706,8 +1678,7 @@ static void G_UpdateCvars( void ) } extern int altAmmoUsage[]; -static void G_InitModRules( void ) -{ +static void G_InitModRules(void) { numKilled = 0; } @@ -1717,19 +1688,19 @@ static void Dev_ShowTriggers(gentity_t *ent) { ent->nextthink = level.time + 9500; - for(i = 0; i < MAX_GENTITIES; i++) { - if((tar = &g_entities[i]) == NULL) continue; - if(tar->type >= ENT_TRIGGER_ALWAYS && tar->type < ENT_TARGET_REMOVE_POWERUPS) { - if(tar->type == ENT_TRIGGER_ALWAYS) { + for (i = 0; i < MAX_GENTITIES; i++) { + if ((tar = &g_entities[i]) == NULL) continue; + if (tar->type >= ENT_TRIGGER_ALWAYS && tar->type < ENT_TARGET_REMOVE_POWERUPS) { + if (tar->type == ENT_TRIGGER_ALWAYS) { continue; } - if((tar->r.svFlags & SVF_NOCLIENT) != 0) { + if ((tar->r.svFlags & SVF_NOCLIENT) != 0) { tar->r.svFlags ^= SVF_NOCLIENT; } trap_LinkEntity(ent); - if(tar->type == ENT_TRIGGER_PUSH) { + if (tar->type == ENT_TRIGGER_PUSH) { G_AddEvent(tar, EV_TRIGGER_SHOW, 1); } else { G_AddEvent(tar, EV_TRIGGER_SHOW, 0); @@ -1748,20 +1719,20 @@ extern int lastKillTime[]; extern int LastFKRadius[]; //(RPG-X J2J) added so array can be initialised to 0 first. extern RPGX_SiteTOSiteData TransDat[]; //(RPG-X J2J) added for tricorder transporter extern RPGX_DragData DragDat[]; -void G_InitGame( int levelTime, unsigned int randomSeed, int restart ) { +void G_InitGame(int levelTime, unsigned int randomSeed, int restart) { int i; char fileName[MAX_QPATH]; float messageTime; - G_Printf ("------- Game Initialization -------\n"); - G_Printf ("gamename: %s\n", GAMEVERSION); - G_Printf ("gamedate: %s\n", __DATE__); - G_Printf ("This is RPG-X version %s compiled by %s on %s.\n", RPGX_VERSION, RPGX_COMPILEDBY, RPGX_COMPILEDATE); + G_Printf("------- Game Initialization -------\n"); + G_Printf("gamename: %s\n", GAMEVERSION); + G_Printf("gamedate: %s\n", __DATE__); + G_Printf("This is RPG-X version %s compiled by %s on %s.\n", RPGX_VERSION, RPGX_COMPILEDBY, RPGX_COMPILEDATE); level.overrideCalcLiftTravelDuration = 0; init_tonextint(qtrue); - srand( randomSeed ); + srand(randomSeed); numKilled = 0; level.numObjectives = 0;//no objectives by default @@ -1778,33 +1749,29 @@ void G_InitGame( int levelTime, unsigned int randomSeed, int restart ) { BG_LoadItemNames(); // set some level globals - memset( &level, 0, sizeof( level ) ); + memset(&level, 0, sizeof(level)); //Class loader - memset( fileName, 0, sizeof( fileName ) ); - Com_sprintf( fileName, sizeof( fileName ), "ext_data/classes/%s.classes", rpg_classSet.string ); - if ( !G_LoadClassData( fileName ) ) - { - G_Printf( S_COLOR_RED "ERROR: Could not load class set %s. Reverting to default.\n", fileName ); - trap_Cvar_Set( "rpg_classSet", CLASS_DEFAULT ); + memset(fileName, 0, sizeof(fileName)); + Com_sprintf(fileName, sizeof(fileName), "ext_data/classes/%s.classes", rpg_classSet.string); + if (!G_LoadClassData(fileName)) { + G_Printf(S_COLOR_RED "ERROR: Could not load class set %s. Reverting to default.\n", fileName); + trap_Cvar_Set("rpg_classSet", CLASS_DEFAULT); - if ( !G_LoadClassData( va( "ext_data/classes/%s.classes", CLASS_DEFAULT ) ) ) - { - G_Error( "Could not load default class set: %s", CLASS_DEFAULT ); + if (!G_LoadClassData(va("ext_data/classes/%s.classes", CLASS_DEFAULT))) { + G_Error("Could not load default class set: %s", CLASS_DEFAULT); } } //Rank Loader - memset( fileName, 0, sizeof( fileName ) ); - Com_sprintf( fileName, sizeof( fileName ), "ext_data/ranksets/%s.ranks", rpg_rankSet.string ); - if ( !BG_ParseRankNames( fileName, g_rankNames, sizeof(rankNames_t) * MAX_RANKS )) - { - G_Printf( S_COLOR_RED "ERROR: Could not load rankset %s. Reverting to default.\n", fileName ); - trap_Cvar_Set( "rpg_rankSet", RANKSET_DEFAULT ); + memset(fileName, 0, sizeof(fileName)); + Com_sprintf(fileName, sizeof(fileName), "ext_data/ranksets/%s.ranks", rpg_rankSet.string); + if (!BG_ParseRankNames(fileName, g_rankNames, sizeof(rankNames_t)* MAX_RANKS)) { + G_Printf(S_COLOR_RED "ERROR: Could not load rankset %s. Reverting to default.\n", fileName); + trap_Cvar_Set("rpg_rankSet", RANKSET_DEFAULT); - if ( !BG_ParseRankNames( va( "ext_data/ranksets/%s.ranks", RANKSET_DEFAULT ), g_rankNames, sizeof(rankNames_t) * MAX_RANKS ) ) - { - G_Error( "Could not load default rankset: %s", RANKSET_DEFAULT ); + if (!BG_ParseRankNames(va("ext_data/ranksets/%s.ranks", RANKSET_DEFAULT), g_rankNames, sizeof(rankNames_t)* MAX_RANKS)) { + G_Error("Could not load default rankset: %s", RANKSET_DEFAULT); } } @@ -1813,7 +1780,7 @@ void G_InitGame( int levelTime, unsigned int randomSeed, int restart ) { level.restarted = (qboolean)restart; //level.message = levelTime - (int)(rpg_timedmessagetime.value * 60000) + 30000; - if ( rpg_timedmessagetime.value < 0.2 ) { + if (rpg_timedmessagetime.value < 0.2) { messageTime = 0.2; } else { messageTime = rpg_timedmessagetime.value; @@ -1823,46 +1790,46 @@ void G_InitGame( int levelTime, unsigned int randomSeed, int restart ) { level.snd_fry = G_SoundIndex("sound/player/fry.wav"); // FIXME standing in lava / slime - if ( g_gametype.integer != GT_SINGLE_PLAYER && g_log.string[0] != 0 ) { - if ( g_logSync.integer != 0 ) { - trap_FS_FOpenFile( g_log.string, &level.logFile, FS_APPEND_SYNC ); + if (g_gametype.integer != GT_SINGLE_PLAYER && g_log.string[0] != 0) { + if (g_logSync.integer != 0) { + trap_FS_FOpenFile(g_log.string, &level.logFile, FS_APPEND_SYNC); } else { - trap_FS_FOpenFile( g_log.string, &level.logFile, FS_APPEND ); + trap_FS_FOpenFile(g_log.string, &level.logFile, FS_APPEND); } - if ( level.logFile == 0 ) { - G_Printf( "WARNING: Couldn't open logfile: %s\n", g_log.string ); + if (level.logFile == 0) { + G_Printf("WARNING: Couldn't open logfile: %s\n", g_log.string); } else { char serverinfo[MAX_INFO_STRING]; memset(serverinfo, 0, sizeof(serverinfo)); - trap_GetServerinfo( serverinfo, sizeof( serverinfo ) ); + trap_GetServerinfo(serverinfo, sizeof(serverinfo)); - G_LogPrintf("------------------------------------------------------------\n" ); - G_LogPrintf("InitGame: %s\n", serverinfo ); + G_LogPrintf("------------------------------------------------------------\n"); + G_LogPrintf("InitGame: %s\n", serverinfo); } } else { - G_Printf( "Not logging to disk.\n" ); + G_Printf("Not logging to disk.\n"); } - #ifdef G_LUA +#ifdef G_LUA G_Lua_Init(); - #endif +#endif G_LogWeaponInit(); G_InitWorldSession(); // initialize all entities for this game - memset( g_entities, 0, MAX_GENTITIES * sizeof(g_entities[0]) ); + memset(g_entities, 0, MAX_GENTITIES * sizeof(g_entities[0])); level.gentities = g_entities; // initialize all clients for this game level.maxclients = g_maxclients.integer; - memset( g_clients, 0, MAX_CLIENTS * sizeof(g_clients[0]) ); + memset(g_clients, 0, MAX_CLIENTS * sizeof(g_clients[0])); level.clients = g_clients; // set client fields on player ents - for ( i=0 ; i= GT_TEAM || trap_Cvar_VariableIntegerValue( "com_buildScript" ) != 0) - { - G_ModelIndex( TEAM_PODIUM_MODEL ); + if (g_gametype.integer >= GT_TEAM || trap_Cvar_VariableIntegerValue("com_buildScript") != 0) { + G_ModelIndex(TEAM_PODIUM_MODEL); } - if ( trap_Cvar_VariableIntegerValue( "bot_enable" ) != 0 ) { - BotAISetup( restart ); - BotAILoadMap( restart ); - G_InitBots( (qboolean)restart ); + if (trap_Cvar_VariableIntegerValue("bot_enable") != 0) { + BotAISetup(restart); + BotAILoadMap(restart); + G_InitBots((qboolean)restart); } G_InitModRules(); @@ -1929,14 +1895,13 @@ void G_InitGame( int levelTime, unsigned int randomSeed, int restart ) { levelExiting = qfalse; /*RPG-X J2J************************************************************************************/ - G_Printf ("Initializing RPG-X Globals..."); + G_Printf("Initializing RPG-X Globals..."); //WARNING - used hard coded number to shut up compiler, 1023 is MAX_ENTITIES (which apperently cant be increased without substansial exe recoding) //TiM : NB Ents 0 -> 128 are clients only. cyclicng thru all ents here is not needed. - for(i = 0; i < MAX_CLIENTS; i++) - { + for (i = 0; i < MAX_CLIENTS; i++) { //RPG-X: Redtechie - Make sure score cant be chnaged unless other wise told to - if(g_entities[i].client){ + if (g_entities[i].client) { g_entities[i].client->UpdateScore = qfalse; g_entities[i].client->AdminFailed = 0; // RPG-X | Phenix | 21/11/2004 | Init Admin Failed Integer g_entities[i].client->LoggedAsAdmin = qfalse; @@ -1944,33 +1909,32 @@ void G_InitGame( int levelTime, unsigned int randomSeed, int restart ) { } } - for ( i = 0; i < MAX_CLIENTS; i++ ) - { - lastKillTime[i] = level.time-30000; + for (i = 0; i < MAX_CLIENTS; i++) { + lastKillTime[i] = level.time - 30000; //FKR LastFKRadius[i] = level.time - rpg_forcekillradiuswaittime.integer; //Transporter - memset( &TransDat[i], 0, sizeof( TransDat[i] ) ); - TransDat[i].LastClick = level.time-5000; //Make last click current time less 5 seconds. + memset(&TransDat[i], 0, sizeof(TransDat[i])); + TransDat[i].LastClick = level.time - 5000; //Make last click current time less 5 seconds. //Drag Data DragDat[i].AdminId = -1; } - G_Printf( "%i entities loaded.\n", level.num_entities ); + G_Printf("%i entities loaded.\n", level.num_entities); - G_Printf ("COMPLETED\n"); + G_Printf("COMPLETED\n"); - #ifdef G_LUA +#ifdef G_LUA LuaHook_G_InitGame(levelTime, randomSeed, restart); - #endif +#endif - if(dev_showTriggers.integer != 0 && restart == 0) { + if (dev_showTriggers.integer != 0 && restart == 0) { gentity_t *t; t = G_Spawn(); - if(t) { + if (t) { t->think = Dev_ShowTriggers; t->nextthink = level.time + 1000; } @@ -1985,10 +1949,10 @@ void G_InitGame( int levelTime, unsigned int randomSeed, int restart ) { } #endif -/*************************************************************************************************/ + /*************************************************************************************************/ G_Printf(" ,. \n"); G_Printf(" ..:, :Xt. ,:. \n"); - G_Printf(" ,=+t: .IRX= :++=. \n"); G_Printf(" .=iVt:. :RYYI. .itt+ \n"); + G_Printf(" ,=+t: .IRX= :++=. \n"); G_Printf(" .=iVt:. :RYYI. .itt+ \n"); G_Printf(" .:tXI=;. tRtiV; ,IYY:. \n"); G_Printf(" .+;ii=;. ,XVi+Vt. :tIi+ \n"); G_Printf(" .;ti;;:. +RI++IY, ,+tt=. \n"); G_Printf(" ,++YY;. ,XXi+++X= ;IYI=. \n"); G_Printf(" ;ttY+;. .,=iVRI++++YX+;. ;VYt; \n"); G_Printf(" .;ii+=, .;IXRRXVi++++iVRXVi:. ,=iii. \n"); @@ -2008,31 +1972,31 @@ void G_InitGame( int levelTime, unsigned int randomSeed, int restart ) { } -void G_ShutdownGame( int restart ) { - G_Printf ("==== ShutdownGame ====\n"); +void G_ShutdownGame(int restart) { + G_Printf("==== ShutdownGame ====\n"); - #ifdef G_LUA +#ifdef G_LUA LuaHook_G_Shutdown(restart); G_Lua_Shutdown(); - #endif +#endif #if 0 // kef -- Pat sez this is causing some trouble these days G_LogWeaponOutput(); #endif - if ( level.logFile != 0) { - G_LogPrintf("ShutdownGame:\n" ); - G_LogPrintf("------------------------------------------------------------\n" ); - trap_FS_FCloseFile( level.logFile ); + if (level.logFile != 0) { + G_LogPrintf("ShutdownGame:\n"); + G_LogPrintf("------------------------------------------------------------\n"); + trap_FS_FCloseFile(level.logFile); } // write all the client session data so we can get it back G_WriteSessionData(); - if ( trap_Cvar_VariableIntegerValue( "bot_enable" ) != 0 ) { - BotAIShutdown( restart ); + if (trap_Cvar_VariableIntegerValue("bot_enable") != 0) { + BotAIShutdown(restart); } - if(level.timedMessages != NULL) { + if (level.timedMessages != NULL) { destroy_list(level.timedMessages); } @@ -2050,26 +2014,26 @@ void G_ShutdownGame( int restart ) { #ifndef GAME_HARD_LINKED // this is only here so the functions in q_shared.c and bg_*.c can link -void QDECL Com_Error ( /*@unused@*/ int32_t errlevel, const char *error, ... ) { +void QDECL Com_Error( /*@unused@*/ int32_t errlevel, const char *error, ...) { va_list argptr; char text[1024]; - va_start (argptr, error); + va_start(argptr, error); vsnprintf(text, sizeof(text), error, argptr); - va_end (argptr); + va_end(argptr); - G_Error( "%s", text); + G_Error("%s", text); } -void QDECL Com_Printf( const char *msg, ... ) { +void QDECL Com_Printf(const char *msg, ...) { va_list argptr; char text[1024]; - va_start (argptr, msg); + va_start(argptr, msg); vsnprintf(text, sizeof(text), msg, argptr); - va_end (argptr); + va_end(argptr); - G_Printf ("%s", text); + G_Printf("%s", text); } #endif @@ -2089,21 +2053,21 @@ RemoveTournamentLoser Make the loser a spectator at the back of the line ======================= */ -static void RemoveTournamentLoser( void ) { +static void RemoveTournamentLoser(void) { int clientNum; - if ( level.numPlayingClients != 2 ) { + if (level.numPlayingClients != 2) { return; } clientNum = level.sortedClients[1]; - if ( level.clients[ clientNum ].pers.connected != CON_CONNECTED ) { + if (level.clients[clientNum].pers.connected != CON_CONNECTED) { return; } // make them a spectator - SetTeam( &g_entities[ clientNum ], "s" ); + SetTeam(&g_entities[clientNum], "s"); } @@ -2113,19 +2077,19 @@ AdjustTournamentScores ======================= */ -static void AdjustTournamentScores( void ) { +static void AdjustTournamentScores(void) { int clientNum; clientNum = level.sortedClients[0]; - if ( level.clients[ clientNum ].pers.connected == CON_CONNECTED ) { - level.clients[ clientNum ].sess.wins++; - G_Client_UserinfoChanged( clientNum ); + if (level.clients[clientNum].pers.connected == CON_CONNECTED) { + level.clients[clientNum].sess.wins++; + G_Client_UserinfoChanged(clientNum); } clientNum = level.sortedClients[1]; - if ( level.clients[ clientNum ].pers.connected == CON_CONNECTED ) { - level.clients[ clientNum ].sess.losses++; - G_Client_UserinfoChanged( clientNum ); + if (level.clients[clientNum].pers.connected == CON_CONNECTED) { + level.clients[clientNum].sess.losses++; + G_Client_UserinfoChanged(clientNum); } } @@ -2147,21 +2111,21 @@ Do this at G_Client_BeginIntermission time and whenever ranks are recalculated due to enters/exits/forced team changes ======================== */ -void SendScoreboardMessageToAllClients( void ) { +void SendScoreboardMessageToAllClients(void) { int i; - for ( i = 0 ; i < level.maxclients ; i++ ) { - if ( level.clients[ i ].pers.connected == CON_CONNECTED ) { - DeathmatchScoreboardMessage( g_entities + i ); + for (i = 0; i < level.maxclients; i++) { + if (level.clients[i].pers.connected == CON_CONNECTED) { + DeathmatchScoreboardMessage(g_entities + i); } } } -void MoveClientToIntermission( gentity_t *ent ) { +void MoveClientToIntermission(gentity_t *ent) { entityState_t* es; playerState_t* ps; - if(ent == NULL || ent->client == NULL) { + if (ent == NULL || ent->client == NULL) { return; } @@ -2169,20 +2133,20 @@ void MoveClientToIntermission( gentity_t *ent ) { es = &ent->s; // take out of follow mode if needed - if ( ent->client->sess.spectatorState == SPECTATOR_FOLLOW ) { - StopFollowing( ent ); + if (ent->client->sess.spectatorState == SPECTATOR_FOLLOW) { + StopFollowing(ent); } // move to the spot - VectorCopy( level.intermission_origin, es->origin ); - VectorCopy( level.intermission_origin, ps->origin ); - VectorCopy (level.intermission_angle, ps->viewangles); + VectorCopy(level.intermission_origin, es->origin); + VectorCopy(level.intermission_origin, ps->origin); + VectorCopy(level.intermission_angle, ps->viewangles); ps->pm_type = PM_INTERMISSION; ps->eFlags ^= EF_TELEPORT_BIT; // clean up powerup info - memset( ps->powerups, 0, sizeof(ps->powerups) ); + memset(ps->powerups, 0, sizeof(ps->powerups)); ps->eFlags = 0; es->eFlags = 0; @@ -2193,23 +2157,23 @@ void MoveClientToIntermission( gentity_t *ent ) { ent->r.contents = 0; } -void FindIntermissionPoint( void ) { +void FindIntermissionPoint(void) { gentity_t *ent, *target; vec3_t dir; // find the intermission spot - ent = G_Find (NULL, FOFS(classname), "info_player_intermission"); - if ( ent == NULL ) { // the map creator forgot to put in an intermission point... - G_Client_SelectSpawnPoint ( vec3_origin, level.intermission_origin, level.intermission_angle ); + ent = G_Find(NULL, FOFS(classname), "info_player_intermission"); + if (ent == NULL) { // the map creator forgot to put in an intermission point... + G_Client_SelectSpawnPoint(vec3_origin, level.intermission_origin, level.intermission_angle); } else { - VectorCopy (ent->s.origin, level.intermission_origin); - VectorCopy (ent->s.angles, level.intermission_angle); + VectorCopy(ent->s.origin, level.intermission_origin); + VectorCopy(ent->s.angles, level.intermission_angle); // if it has a target, look towards it - if ( ent->target ) { - target = G_PickTarget( ent->target ); - if ( target ) { - VectorSubtract( target->s.origin, level.intermission_origin, dir ); - vectoangles( dir, level.intermission_angle ); + if (ent->target) { + target = G_PickTarget(ent->target); + if (target) { + VectorSubtract(target->s.origin, level.intermission_origin, dir); + vectoangles(dir, level.intermission_angle); } } } @@ -2221,19 +2185,16 @@ void FindIntermissionPoint( void ) { ClearFiringFlags ================== */ -static void ClearFiringFlags(void) -{ +static void ClearFiringFlags(void) { int i = 0; gentity_t *ent = NULL; - for (i=0 ; i< level.maxclients ; i++) - { + for (i = 0; i < level.maxclients; i++) { ent = g_entities + i; if (!ent->inuse) continue; // clear the firing flag - if (ent->client) - { + if (ent->client) { ent->client->ps.eFlags &= ~EF_FIRING; } } @@ -2244,7 +2205,7 @@ static void ClearFiringFlags(void) G_Client_BeginIntermission ================== */ -void G_Client_BeginIntermission( void ) { +void G_Client_BeginIntermission(void) { int i; gentity_t *client; qboolean doingLevelshot; @@ -2254,12 +2215,12 @@ void G_Client_BeginIntermission( void ) { else doingLevelshot = qfalse; - if ( level.intermissiontime != 0 && level.intermissiontime != -1 ) { + if (level.intermissiontime != 0 && level.intermissiontime != -1) { return; // already active } // if in tournament mode, change the wins / losses - if ( g_gametype.integer == GT_TOURNAMENT ) { + if (g_gametype.integer == GT_TOURNAMENT) { AdjustTournamentScores(); } @@ -2278,14 +2239,14 @@ void G_Client_BeginIntermission( void ) { // move all clients to the intermission point - for (i=0 ; i< level.maxclients ; i++) { + for (i = 0; i < level.maxclients; i++) { client = g_entities + i; if (!client->inuse) continue; if (client->health <= 0) { G_Client_Respawn(client); } - MoveClientToIntermission( client ); + MoveClientToIntermission(client); } @@ -2294,13 +2255,12 @@ void G_Client_BeginIntermission( void ) { } -static void G_ClearObjectives( void ) -{ +static void G_ClearObjectives(void) { gentity_t *tent; - tent = G_TempEntity( vec3_origin, EV_OBJECTIVE_COMPLETE ); + tent = G_TempEntity(vec3_origin, EV_OBJECTIVE_COMPLETE); - if(tent == NULL) { + if (tent == NULL) { return; } @@ -2318,7 +2278,7 @@ or moved to a new level based on the "nextmap" cvar ============= */ qboolean levelExiting = qfalse; -void ExitLevel (void) { +void ExitLevel(void) { int i; levelExiting = qtrue; @@ -2329,17 +2289,17 @@ void ExitLevel (void) { G_ClearObjectives(); // if we are running a tournement map, kick the loser to spectator status, // which will automatically grab the next spectator and restart - if ( g_gametype.integer == GT_TOURNAMENT ) { - if ( !level.restarted ) { + if (g_gametype.integer == GT_TOURNAMENT) { + if (!level.restarted) { RemoveTournamentLoser(); - trap_SendConsoleCommand( EXEC_APPEND, "map_restart 0\n" ); + trap_SendConsoleCommand(EXEC_APPEND, "map_restart 0\n"); level.restarted = qtrue; level.intermissiontime = 0; } return; } - trap_SendConsoleCommand( EXEC_APPEND, "vstr nextmap\n" ); + trap_SendConsoleCommand(EXEC_APPEND, "vstr nextmap\n"); level.intermissiontime = 0; // we need to do this here before chaning to CON_CONNECTING @@ -2347,8 +2307,8 @@ void ExitLevel (void) { // change all client states to connecting, so the early players into the // next level will know the others aren't done reconnecting - for (i=0 ; i< g_maxclients.integer ; i++) { - if ( level.clients[i].pers.connected == CON_CONNECTED ) { + for (i = 0; i < g_maxclients.integer; i++) { + if (level.clients[i].pers.connected == CON_CONNECTED) { level.clients[i].pers.connected = CON_CONNECTING; } } @@ -2371,17 +2331,17 @@ CheckTournement Once a frame, check for changes in tournement player state ============= */ -static void CheckTournement( void ) { - if ( level.numPlayingClients == 0 ) { +static void CheckTournement(void) { + if (level.numPlayingClients == 0) { return; } - if ( g_gametype.integer == GT_TOURNAMENT ) { - if ( level.warmupTime == 0 || level.warmupTime != 0) {//RPG-X: RedTechie - No warmup Fail safe + if (g_gametype.integer == GT_TOURNAMENT) { + if (level.warmupTime == 0 || level.warmupTime != 0) {//RPG-X: RedTechie - No warmup Fail safe return; } - } else if ( g_gametype.integer != GT_SINGLE_PLAYER ) { - if ( level.warmupTime == 0) { + } else if (g_gametype.integer != GT_SINGLE_PLAYER) { + if (level.warmupTime == 0) { return; } } @@ -2393,29 +2353,29 @@ static void CheckTournement( void ) { CheckVote ================== */ -static void CheckVote( void ) { - if ( level.voteTime == 0 ) { +static void CheckVote(void) { + if (level.voteTime == 0) { return; } - if ( level.time - level.voteTime >= VOTE_TIME ) { - trap_SendServerCommand( -1, "print \"Vote failed.\n\"" ); + if (level.time - level.voteTime >= VOTE_TIME) { + trap_SendServerCommand(-1, "print \"Vote failed.\n\""); } else { - if ( level.voteYes > level.numVotingClients/2 ) { + if (level.voteYes > level.numVotingClients / 2) { // execute the command, then remove the vote char message[1024] = ""; - trap_SendServerCommand( -1, "print \"Vote passed.\n\"" ); + trap_SendServerCommand(-1, "print \"Vote passed.\n\""); Com_sprintf(message, 1024, "%s\n", level.voteString); - trap_SendConsoleCommand( EXEC_APPEND, message ); - } else if ( level.voteNo >= level.numVotingClients/2 ) { + trap_SendConsoleCommand(EXEC_APPEND, message); + } else if (level.voteNo >= level.numVotingClients / 2) { // same behavior as a timeout - trap_SendServerCommand( -1, "print \"Vote failed.\n\"" ); + trap_SendServerCommand(-1, "print \"Vote failed.\n\""); } else { // still waiting for a majority return; } } level.voteTime = 0; - trap_SetConfigstring( CS_VOTE_TIME, "" ); + trap_SetConfigstring(CS_VOTE_TIME, ""); } @@ -2425,15 +2385,15 @@ static void CheckVote( void ) { CheckCvars ================== */ -static void CheckCvars( void ) { +static void CheckCvars(void) { static int lastMod = -1; - if ( g_password.modificationCount != lastMod ) { + if (g_password.modificationCount != lastMod) { lastMod = g_password.modificationCount; - if ( g_password.string[0] != 0 && Q_stricmp( g_password.string, "none" ) != 0 ) { - trap_Cvar_Set( "g_needpass", "1" ); + if (g_password.string[0] != 0 && Q_stricmp(g_password.string, "none") != 0) { + trap_Cvar_Set("g_needpass", "1"); } else { - trap_Cvar_Set( "g_needpass", "0" ); + trap_Cvar_Set("g_needpass", "0"); } } } @@ -2445,10 +2405,10 @@ G_RunThink Runs thinking code for this frame if necessary ============= */ -void G_RunThink (gentity_t *ent) { +void G_RunThink(gentity_t *ent) { int thinktime; - if(ent == NULL) { + if (ent == NULL) { return; } @@ -2462,18 +2422,17 @@ void G_RunThink (gentity_t *ent) { ent->nextthink = 0; if (ent->think == NULL) { - G_Error ( "NULL ent->think"); + G_Error("NULL ent->think"); return; } - #ifdef G_LUA - if(ent->luaThink != NULL && ent->client == NULL) - { +#ifdef G_LUA + if (ent->luaThink != NULL && ent->client == NULL) { LuaHook_G_EntityThink(ent->luaThink, ent->s.number); } - #endif +#endif - ent->think (ent); + ent->think(ent); } /* @@ -2484,8 +2443,8 @@ Advances the non-player objects in the world ================ */ -void CheckHealthInfoMessage( void ); -void G_RunFrame( int32_t levelTime ) { +void CheckHealthInfoMessage(void); +void G_RunFrame(int32_t levelTime) { int32_t i; gentity_t* ent; gclient_t* client; @@ -2493,7 +2452,7 @@ void G_RunFrame( int32_t levelTime ) { entityState_t* es; // if we are waiting for the level to restart, do nothing - if ( level.restarted ) { + if (level.restarted) { return; } @@ -2508,8 +2467,8 @@ void G_RunFrame( int32_t levelTime ) { // go through all allocated objects // ent = &g_entities[0]; - for (i=0 ; iinuse == qfalse ) { + for (i = 0; iinuse == qfalse) { continue; } @@ -2517,10 +2476,10 @@ void G_RunFrame( int32_t levelTime ) { ps = &ent->client->ps; // clear events that are too old - if ( level.time - ent->eventTime > EVENT_VALID_MSEC ) { - if ( es->event != 0 ) { + if (level.time - ent->eventTime > EVENT_VALID_MSEC) { + if (es->event != 0) { es->event = 0; - if ( ent->client ) { + if (ent->client) { ps->externalEvent = 0; ps->events[0] = 0; ps->events[1] = 0; @@ -2528,62 +2487,60 @@ void G_RunFrame( int32_t levelTime ) { ps->events[3] = 0; } } - if ( ent->freeAfterEvent ) { + if (ent->freeAfterEvent) { // tempEntities or dropped items completely go away after their event - G_FreeEntity( ent ); + G_FreeEntity(ent); continue; - } else if ( ent->unlinkAfterEvent ) { + } else if (ent->unlinkAfterEvent) { // items that will respawn will hide themselves after their pickup event ent->unlinkAfterEvent = qfalse; - trap_UnlinkEntity( ent ); + trap_UnlinkEntity(ent); } } // temporary entities don't think - if ( ent->freeAfterEvent ) { + if (ent->freeAfterEvent) { continue; } - if ( !ent->r.linked && ent->neverFree ) { + if (!ent->r.linked && ent->neverFree) { continue; } - if ( !ent->client ) - { - if ( (es->eFlags & EF_ANIM_ONCE) == EF_ANIM_ONCE ) - {//this must be capped render-side + if (!ent->client) { + if ((es->eFlags & EF_ANIM_ONCE) == EF_ANIM_ONCE) {//this must be capped render-side es->frame++; } } - if ( (es->eType == ET_MISSILE) || (es->eType == ET_ALT_MISSILE) ) { - G_Missile_Run( ent ); + if ((es->eType == ET_MISSILE) || (es->eType == ET_ALT_MISSILE)) { + G_Missile_Run(ent); continue; } - if ( es->eType == ET_ITEM || ent->physicsObject ) { - G_RunItem( ent ); + if (es->eType == ET_ITEM || ent->physicsObject) { + G_RunItem(ent); continue; } - if ( es->eType == ET_MOVER || es->eType == ET_MOVER_STR ) { //RPG-X | GSIO01 | 13/05/2009 - G_Mover_Run( ent ); + if (es->eType == ET_MOVER || es->eType == ET_MOVER_STR) { //RPG-X | GSIO01 | 13/05/2009 + G_Mover_Run(ent); continue; } - if ( i < MAX_CLIENTS ) { - G_RunClient( ent ); + if (i < MAX_CLIENTS) { + G_RunClient(ent); continue; } - G_RunThink( ent ); + G_RunThink(ent); } // perform final fixups on the players ent = &g_entities[0]; - for (i=0 ; i < level.maxclients ; i++, ent++ ) { - if ( ent->inuse ) { - ClientEndFrame( ent ); + for (i = 0; i < level.maxclients; i++, ent++) { + if (ent->inuse) { + ClientEndFrame(ent); } } @@ -2602,11 +2559,10 @@ void G_RunFrame( int32_t levelTime ) { //RPG-X: J2J - This will check for drag movements that need to be calculated. DragCheck(); - for ( i = 0; i < MAX_CLIENTS; i++ ) - { + for (i = 0; i < MAX_CLIENTS; i++) { ent = &g_entities[i]; - if(!ent || !ent->client) + if (!ent || !ent->client) continue; client = ent->client; @@ -2615,11 +2571,9 @@ void G_RunFrame( int32_t levelTime ) { client->pressedUse = qfalse; } - if (g_classData[client->sess.sessionClass].isn00b != 0) - { - if ((client->n00bTime != -1) && (client->n00bTime <= level.time) && client->origClass[0] != 0) - { - if(SetClass( ent, client->origClass, NULL, qtrue ) == qfalse) { + if (g_classData[client->sess.sessionClass].isn00b != 0) { + if ((client->n00bTime != -1) && (client->n00bTime <= level.time) && client->origClass[0] != 0) { + if (SetClass(ent, client->origClass, NULL, qtrue) == qfalse) { DEVELOPER(G_Printf(S_COLOR_YELLOW "G_RunFrame - Warning: SetClass failed!\n");); } } @@ -2628,8 +2582,8 @@ void G_RunFrame( int32_t levelTime ) { //RPG-X: Marcin: To clear pressedUse. - 30/12/2008 - #ifdef G_LUA +#ifdef G_LUA LuaHook_G_RunFrame(levelTime); - #endif +#endif }