From 1c1d251ba80d985f8b7f641f3e9baa0584eb2a86 Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 4 Sep 2010 14:47:52 +0000 Subject: [PATCH] Adding GAME_XONOTIC and recognizing xonotic executable names git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10437 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_collision.c | 12 ++++++------ cl_input.c | 4 ++-- cl_main.c | 6 +++--- cl_parse.c | 10 +++++----- cl_screen.c | 2 +- common.c | 3 +++ common.h | 1 + console.c | 2 +- host.c | 2 +- host_cmd.c | 4 ++-- jpeg.c | 2 +- netconn.c | 2 +- sbar.c | 12 ++++++------ sv_main.c | 2 +- 14 files changed, 34 insertions(+), 30 deletions(-) diff --git a/cl_collision.c b/cl_collision.c index 8978f374..513aa13e 100644 --- a/cl_collision.c +++ b/cl_collision.c @@ -321,7 +321,7 @@ trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int vec3_t origin, entmins, entmaxs; matrix4x4_t entmatrix, entinversematrix; - if(gamemode == GAME_NEXUIZ) + if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) { // don't hit network players, if we are a nonsolid player if(cl.scores[cl.playerentity-1].frags == -666 || cl.scores[cl.playerentity-1].frags == -616) @@ -340,7 +340,7 @@ trace_t CL_TracePoint(const vec3_t start, int type, prvm_edict_t *passedict, int if (!cl.scores[i-1].name[0]) continue; - if(gamemode == GAME_NEXUIZ) + if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) { // don't hit spectators or nonsolid players if(cl.scores[i-1].frags == -666 || cl.scores[i-1].frags == -616) @@ -554,7 +554,7 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ vec3_t origin, entmins, entmaxs; matrix4x4_t entmatrix, entinversematrix; - if(gamemode == GAME_NEXUIZ) + if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) { // don't hit network players, if we are a nonsolid player if(cl.scores[cl.playerentity-1].frags == -666 || cl.scores[cl.playerentity-1].frags == -616) @@ -573,7 +573,7 @@ trace_t CL_TraceLine(const vec3_t start, const vec3_t end, int type, prvm_edict_ if (!cl.scores[i-1].name[0]) continue; - if(gamemode == GAME_NEXUIZ) + if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) { // don't hit spectators or nonsolid players if(cl.scores[i-1].frags == -666 || cl.scores[i-1].frags == -616) @@ -828,7 +828,7 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co vec3_t origin, entmins, entmaxs; matrix4x4_t entmatrix, entinversematrix; - if(gamemode == GAME_NEXUIZ) + if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) { // don't hit network players, if we are a nonsolid player if(cl.scores[cl.playerentity-1].frags == -666 || cl.scores[cl.playerentity-1].frags == -616) @@ -847,7 +847,7 @@ trace_t CL_TraceBox(const vec3_t start, const vec3_t mins, const vec3_t maxs, co if (!cl.scores[i-1].name[0]) continue; - if(gamemode == GAME_NEXUIZ) + if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) { // don't hit spectators or nonsolid players if(cl.scores[i-1].frags == -666 || cl.scores[i-1].frags == -616) diff --git a/cl_input.c b/cl_input.c index 6f25cee6..8c38c69d 100644 --- a/cl_input.c +++ b/cl_input.c @@ -1074,7 +1074,7 @@ void CL_ClientMovement_Physics_Swim(cl_clientmovement_state_t *s) s->velocity[2] = 80; else { - if (gamemode == GAME_NEXUIZ) + if (gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) s->velocity[2] = 200; else s->velocity[2] = 100; @@ -1798,7 +1798,7 @@ void CL_SendMove(void) break; case PROTOCOL_DARKPLACES6: case PROTOCOL_DARKPLACES7: - // FIXME: cl.cmd.buttons & 16 is +button5, Nexuiz specific + // FIXME: cl.cmd.buttons & 16 is +button5, Nexuiz/Xonotic specific cl.cmd.crouch = (cl.cmd.buttons & 16) != 0; break; case PROTOCOL_UNKNOWN: diff --git a/cl_main.c b/cl_main.c index f005cafd..be5497fe 100644 --- a/cl_main.c +++ b/cl_main.c @@ -171,7 +171,7 @@ void CL_ClearState(void) cl.entities[i].state_current = defaultstate; } - if (gamemode == GAME_NEXUIZ) + if (gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) { VectorSet(cl.playerstandmins, -16, -16, -24); VectorSet(cl.playerstandmaxs, 16, 16, 45); @@ -1176,7 +1176,7 @@ void CL_UpdateNetworkEntityTrail(entity_t *e) { if (e->render.effects & EF_BRIGHTFIELD) { - if (gamemode == GAME_NEXUIZ) + if (gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) trailtype = EFFECT_TR_NEXUIZPLASMA; else CL_EntityParticles(e); @@ -1395,7 +1395,7 @@ void CL_LinkNetworkEntity(entity_t *e) { if (e->render.effects & EF_BRIGHTFIELD) { - if (gamemode == GAME_NEXUIZ) + if (gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) trailtype = EFFECT_TR_NEXUIZPLASMA; } if (e->render.effects & EF_DIMLIGHT) diff --git a/cl_parse.c b/cl_parse.c index b8bfb65e..72e377da 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -1190,13 +1190,13 @@ void CL_BeginDownloads(qboolean aborteddownload) // finished loading sounds } - if(gamemode == GAME_NEXUIZ) + if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) Cvar_SetValueQuick(&cl_serverextension_download, false); - // in Nexuiz, the built in download protocol is kinda broken (misses lots + // in Nexuiz/Xonotic, the built in download protocol is kinda broken (misses lots // of dependencies) anyway, and can mess around with the game directory; // until this is fixed, only support pk3 downloads via curl, and turn off // individual file downloads other than for CSQC - // on the other end of the download protocol, GAME_NEXUIZ enforces writing + // on the other end of the download protocol, GAME_NEXUIZ/GAME_XONOTIC enforces writing // to dlcache only // idea: support download of pk3 files using this protocol later @@ -1369,8 +1369,8 @@ void CL_StopDownload(int size, int crc) // save to disk only if we don't already have it // (this is mainly for playing back demos) existingcrc = FS_CRCFile(cls.qw_downloadname, &existingsize); - if (existingsize || gamemode == GAME_NEXUIZ || !strcmp(cls.qw_downloadname, csqc_progname.string)) - // let csprogs ALWAYS go to dlcache, to prevent "viral csprogs"; also, never put files outside dlcache for Nexuiz + if (existingsize || gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC || !strcmp(cls.qw_downloadname, csqc_progname.string)) + // let csprogs ALWAYS go to dlcache, to prevent "viral csprogs"; also, never put files outside dlcache for Nexuiz/Xonotic { if ((int)existingsize != size || existingcrc != crc) { diff --git a/cl_screen.c b/cl_screen.c index 9b0a0c14..3236056d 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -2077,7 +2077,7 @@ void CL_UpdateScreen(void) if (!scr_initialized || !con_initialized || !scr_refresh.integer) return; // not initialized yet - if(gamemode == GAME_NEXUIZ) + if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) { // play a bit with the palette (experimental) palette_rgb_pantscolormap[15][0] = (unsigned char) (128 + 127 * sin(cl.time / exp(1.0f) + 0.0f*M_PI/3.0f)); diff --git a/common.c b/common.c index f3dd8e50..9615b5a7 100644 --- a/common.c +++ b/common.c @@ -1448,6 +1448,9 @@ static const gamemode_info_t gamemode_info [GAME_COUNT] = // GAME_NEXUIZ // COMMANDLINEOPTION: Game: -nexuiz runs the multiplayer game Nexuiz { "nexuiz", "-nexuiz", "Nexuiz", "data", NULL, "nexuiz", "nexuiz" }, +// GAME_XONOTIC +// COMMANDLINEOPTION: Game: -xonotic runs the multiplayer game Xonotic +{ "xonotic", "-xonotic", "Xonotic", "data", NULL, "xonotic", "xonotic" }, // GAME_TRANSFUSION // COMMANDLINEOPTION: Game: -transfusion runs Transfusion (the recreation of Blood in Quake) { "transfusion", "-transfusion", "Transfusion", "basetf", NULL, "transfusion", "transfusion" }, diff --git a/common.h b/common.h index 220e5caa..f8cba1a3 100644 --- a/common.h +++ b/common.h @@ -273,6 +273,7 @@ typedef enum gamemode_e GAME_BLOODOMNICIDE, GAME_STEELSTORM, // added by motorsep GAME_STRAPBOMB, // added by motorsep for Urre + GAME_XONOTIC, GAME_COUNT } gamemode_t; diff --git a/console.c b/console.c index 3ce37373..7c0499ad 100644 --- a/console.c +++ b/console.c @@ -1049,7 +1049,7 @@ void Con_MaskPrint(int additionalmask, const char *msg) { if (con_chatsound.value) { - if(gamemode == GAME_NEXUIZ) + if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) { if(msg[1] == '\r' && cl.foundtalk2wav) S_LocalSound ("sound/misc/talk2.wav"); diff --git a/host.c b/host.c index dc551146..1b776d7b 100644 --- a/host.c +++ b/host.c @@ -189,7 +189,7 @@ void Host_ServerOptions (void) else { // default players in some games, singleplayer in most - if (gamemode != GAME_GOODVSBAD2 && gamemode != GAME_NEXUIZ && gamemode != GAME_BATTLEMECH) + if (gamemode != GAME_GOODVSBAD2 && gamemode != GAME_NEXUIZ && gamemode != GAME_XONOTIC && gamemode != GAME_BATTLEMECH) svs.maxclients = 1; } } diff --git a/host_cmd.c b/host_cmd.c index a3b25028..b54559b8 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -1209,7 +1209,7 @@ void Host_Name_f (void) Host_Playermodel_f ====================== */ -cvar_t cl_playermodel = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_playermodel", "", "internal storage cvar for current player model in Nexuiz (changed by playermodel command)"}; +cvar_t cl_playermodel = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_playermodel", "", "internal storage cvar for current player model in Nexuiz/Xonotic (changed by playermodel command)"}; // the old cl_playermodel in cl_main has been renamed to __cl_playermodel void Host_Playermodel_f (void) { @@ -1267,7 +1267,7 @@ void Host_Playermodel_f (void) Host_Playerskin_f ====================== */ -cvar_t cl_playerskin = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_playerskin", "", "internal storage cvar for current player skin in Nexuiz (changed by playerskin command)"}; +cvar_t cl_playerskin = {CVAR_SAVE | CVAR_NQUSERINFOHACK, "_cl_playerskin", "", "internal storage cvar for current player skin in Nexuiz/Xonotic (changed by playerskin command)"}; void Host_Playerskin_f (void) { int i, j; diff --git a/jpeg.c b/jpeg.c index cc995239..8df1b484 100644 --- a/jpeg.c +++ b/jpeg.c @@ -965,7 +965,7 @@ size_t JPEG_SaveImage_to_Buffer (char *jpegbuf, size_t jpegsize, int width, int #endif //quality_guess = (100 * jpegsize - 41000) / (width*height) + 2; // fits random data - quality_guess = (256 * jpegsize - 81920) / (width*height) - 8; // fits Nexuiz's map pictures + quality_guess = (256 * jpegsize - 81920) / (width*height) - 8; // fits Nexuiz's/Xonotic's map pictures quality_guess = bound(0, quality_guess, 100); quality = bound(0, quality_guess + sv_writepicture_quality.integer, 100); // assume it can do 10 failed attempts diff --git a/netconn.c b/netconn.c index eb77b514..c14acccb 100755 --- a/netconn.c +++ b/netconn.c @@ -2279,7 +2279,7 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg } } - if ((gamemode == GAME_NEXUIZ) && (teamplay.integer > 0)) + if ((gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) && (teamplay.integer > 0)) { if(cl->frags == -666) // spectator strlcpy(teambuf, " 0", sizeof(teambuf)); diff --git a/sbar.c b/sbar.c index d062a86a..f575ca01 100644 --- a/sbar.c +++ b/sbar.c @@ -1054,7 +1054,7 @@ static void get_showspeed_unit(int unitnumber, double *conversion_factor, const { default: case 1: - if(gamemode == GAME_NEXUIZ) + if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) *unit = "in/s"; else *unit = "qu/s"; @@ -1063,23 +1063,23 @@ static void get_showspeed_unit(int unitnumber, double *conversion_factor, const case 2: *unit = "m/s"; *conversion_factor = 0.0254; - if(gamemode != GAME_NEXUIZ) *conversion_factor *= 1.5; - // 1qu=1.5in is for non-Nexuiz only - Nexuiz players are overly large, but 1qu=1in fixes that + if(gamemode != GAME_NEXUIZ && gamemode != GAME_XONOTIC) *conversion_factor *= 1.5; + // 1qu=1.5in is for non-Nexuiz/Xonotic only - Nexuiz/Xonotic players are overly large, but 1qu=1in fixes that break; case 3: *unit = "km/h"; *conversion_factor = 0.0254 * 3.6; - if(gamemode != GAME_NEXUIZ) *conversion_factor *= 1.5; + if(gamemode != GAME_NEXUIZ && gamemode != GAME_XONOTIC) *conversion_factor *= 1.5; break; case 4: *unit = "mph"; *conversion_factor = 0.0254 * 3.6 * 0.6213711922; - if(gamemode != GAME_NEXUIZ) *conversion_factor *= 1.5; + if(gamemode != GAME_NEXUIZ && gamemode != GAME_XONOTIC) *conversion_factor *= 1.5; break; case 5: *unit = "knots"; *conversion_factor = 0.0254 * 1.943844492; // 1 m/s = 1.943844492 knots, because 1 knot = 1.852 km/h - if(gamemode != GAME_NEXUIZ) *conversion_factor *= 1.5; + if(gamemode != GAME_NEXUIZ && gamemode != GAME_XONOTIC) *conversion_factor *= 1.5; break; } } diff --git a/sv_main.c b/sv_main.c index 7e5ebb31..bb272231 100644 --- a/sv_main.c +++ b/sv_main.c @@ -2395,7 +2395,7 @@ static void SV_UpdateToReliableMessages (void) // frags host_client->frags = (int)host_client->edict->fields.server->frags; - if(gamemode == GAME_NEXUIZ) + if(gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) if(!host_client->spawned && host_client->netconnection) host_client->frags = -666; if (host_client->old_frags != host_client->frags) -- 2.39.2