]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
renamed varray_ arrays to rsurface_array_, and they are no longer used outside the...
[xonotic/darkplaces.git] / sv_main.c
index c9d8e3016fe53cb89422793622e23761a22f59b0..e6ce99427d03c790e71ed34a86d703bc1895b13e 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -32,25 +32,25 @@ void EntityFrameCSQC_WriteFrame (sizebuf_t *msg, int numstates, const entity_sta
 
 
 // select which protocol to host, this is fed to Protocol_EnumForName
-cvar_t sv_protocolname = {0, "sv_protocolname", "DP7"};
-cvar_t sv_ratelimitlocalplayer = {0, "sv_ratelimitlocalplayer", "0"};
-cvar_t sv_maxrate = {CVAR_SAVE | CVAR_NOTIFY, "sv_maxrate", "10000"};
-
-static cvar_t sv_cullentities_pvs = {0, "sv_cullentities_pvs", "1"}; // fast but loose
-static cvar_t sv_cullentities_trace = {0, "sv_cullentities_trace", "0"}; // tends to get false negatives, uses a timeout to keep entities visible a short time after becoming hidden
-static cvar_t sv_cullentities_stats = {0, "sv_cullentities_stats", "0"};
-static cvar_t sv_entpatch = {0, "sv_entpatch", "1"};
-
-cvar_t sv_gameplayfix_grenadebouncedownslopes = {0, "sv_gameplayfix_grenadebouncedownslopes", "1"};
-cvar_t sv_gameplayfix_noairborncorpse = {0, "sv_gameplayfix_noairborncorpse", "1"};
-cvar_t sv_gameplayfix_stepdown = {0, "sv_gameplayfix_stepdown", "1"};
-cvar_t sv_gameplayfix_stepwhilejumping = {0, "sv_gameplayfix_stepwhilejumping", "1"};
-cvar_t sv_gameplayfix_swiminbmodels = {0, "sv_gameplayfix_swiminbmodels", "1"};
-cvar_t sv_gameplayfix_setmodelrealbox = {0, "sv_gameplayfix_setmodelrealbox", "1"};
-cvar_t sv_gameplayfix_blowupfallenzombies = {0, "sv_gameplayfix_blowupfallenzombies", "1"};
-cvar_t sv_gameplayfix_findradiusdistancetobox = {0, "sv_gameplayfix_findradiusdistancetobox", "1"};
-
-cvar_t sv_progs = {0, "sv_progs", "progs.dat" };
+cvar_t sv_protocolname = {0, "sv_protocolname", "DP7", "selects network protocol to host for (values include QUAKE, QUAKEDP, NEHAHRAMOVIE, DP1 and up)"};
+cvar_t sv_ratelimitlocalplayer = {0, "sv_ratelimitlocalplayer", "0", "whether to apply rate limiting to the local player in a listen server (only useful for testing)"};
+cvar_t sv_maxrate = {CVAR_SAVE | CVAR_NOTIFY, "sv_maxrate", "10000", "upper limit on client rate cvar, should reflect your network connection quality"};
+
+static cvar_t sv_cullentities_pvs = {0, "sv_cullentities_pvs", "1", "fast but loose culling of hidden entities"}; // fast but loose
+static cvar_t sv_cullentities_trace = {0, "sv_cullentities_trace", "0", "somewhat slow but very tight culling of hidden entities, minimizes network traffic and makes wallhack cheats useless"}; // tends to get false negatives, uses a timeout to keep entities visible a short time after becoming hidden
+static cvar_t sv_cullentities_stats = {0, "sv_cullentities_stats", "0", "displays stats on network entities culled by various methods for each client"};
+static cvar_t sv_entpatch = {0, "sv_entpatch", "1", "enables loading of .ent files to override entities in the bsp (for example Threewave CTF server pack contains .ent patch files enabling play of CTF on id1 maps)"};
+
+cvar_t sv_gameplayfix_grenadebouncedownslopes = {0, "sv_gameplayfix_grenadebouncedownslopes", "1", "prevents MOVETYPE_BOUNCE (grenades) from getting stuck when fired down a downward sloping surface"};
+cvar_t sv_gameplayfix_noairborncorpse = {0, "sv_gameplayfix_noairborncorpse", "1", "causes entities (corpses) sitting ontop of moving entities (players) to fall when the moving entity (player) is no longer supporting them"};
+cvar_t sv_gameplayfix_stepdown = {0, "sv_gameplayfix_stepdown", "1", "attempts to step down stairs, not just up them (prevents the familiar thud..thud..thud.. when running down stairs and slopes)"};
+cvar_t sv_gameplayfix_stepwhilejumping = {0, "sv_gameplayfix_stepwhilejumping", "1", "applies step-up onto a ledge even while airborn, useful if you would otherwise just-miss the floor when running across small areas with gaps (for instance running across the moving platforms in dm2, or jumping to the megahealth and red armor in dm2 rather than using the bridge)"};
+cvar_t sv_gameplayfix_swiminbmodels = {0, "sv_gameplayfix_swiminbmodels", "1", "causes pointcontents (used to determine if you are in a liquid) to check bmodel entities as well as the world model, so you can swim around in (possibly moving) water bmodel entities"};
+cvar_t sv_gameplayfix_setmodelrealbox = {0, "sv_gameplayfix_setmodelrealbox", "1", "fixes a bug in Quake that made setmodel always set the entity box to ('-16 -16 -16', '16 16 16') rather than properly checking the model box, breaks some poorly coded mods"};
+cvar_t sv_gameplayfix_blowupfallenzombies = {0, "sv_gameplayfix_blowupfallenzombies", "1", "causes findradius to detect SOLID_NOT entities such as zombies and corpses on the floor, allowing splash damage to apply to them"};
+cvar_t sv_gameplayfix_findradiusdistancetobox = {0, "sv_gameplayfix_findradiusdistancetobox", "1", "causes findradius to check the distance to the corner of a box rather than the center of the box, makes findradius detect bmodels such as very large doors that would otherwise be unaffected by splash damage"};
+
+cvar_t sv_progs = {0, "sv_progs", "progs.dat", "selects which quakec progs.dat file to run" };
 
 server_t sv;
 server_static_t svs;
@@ -70,7 +70,7 @@ SV_Init
 */
 void SV_Init (void)
 {
-       Cmd_AddCommand("sv_saveentfile", SV_SaveEntFile_f);
+       Cmd_AddCommand("sv_saveentfile", SV_SaveEntFile_f, "save map entities to .ent file (to allow external editing)");
        Cvar_RegisterVariable (&sv_maxvelocity);
        Cvar_RegisterVariable (&sv_gravity);
        Cvar_RegisterVariable (&sv_friction);
@@ -82,7 +82,6 @@ void SV_Init (void)
        Cvar_RegisterVariable (&sv_idealpitchscale);
        Cvar_RegisterVariable (&sv_aim);
        Cvar_RegisterVariable (&sv_nostep);
-       Cvar_RegisterVariable (&sv_deltacompress);
        Cvar_RegisterVariable (&sv_cullentities_pvs);
        Cvar_RegisterVariable (&sv_cullentities_trace);
        Cvar_RegisterVariable (&sv_cullentities_stats);
@@ -283,6 +282,7 @@ CLIENT SPAWNING
 */
 
 static const char *SV_InitCmd; //[515]: svprogs able to send cmd to client on connect
+extern qboolean csqc_loaded;
 /*
 ================
 SV_SendServerinfo
@@ -296,6 +296,8 @@ void SV_SendServerinfo (client_t *client)
        int i;
        char message[128];
 
+       // we know that this client has a netconnection and thus is not a bot
+
        // edicts get reallocated on level changes, so we need to update it here
        client->edict = PRVM_EDICT_NUM((client - svs.clients) + 1);
 
@@ -323,55 +325,53 @@ void SV_SendServerinfo (client_t *client)
                        client->entitydatabase5 = EntityFrame5_AllocDatabase(sv_mempool);
        }
 
-       SZ_Clear (&client->message);
-       MSG_WriteByte (&client->message, svc_print);
+       SZ_Clear (&client->netconnection->message);
+       MSG_WriteByte (&client->netconnection->message, svc_print);
        dpsnprintf (message, sizeof (message), "\002\nServer: %s build %s (progs %i crc)", gamename, buildstring, prog->filecrc);
-       MSG_WriteString (&client->message,message);
+       MSG_WriteString (&client->netconnection->message,message);
 
-       // LordHavoc: this does not work on dedicated servers, needs fixing.
-extern qboolean csqc_loaded;
+       // FIXME: LordHavoc: this does not work on dedicated servers, needs fixing.
 //[515]: init csprogs according to version of svprogs, check the crc, etc.
        if(csqc_loaded && (cls.state == ca_dedicated || PRVM_NUM_FOR_EDICT(client->edict) != 1))
        {
-               MSG_WriteByte (&client->message, svc_stufftext);
+               MSG_WriteByte (&client->netconnection->message, svc_stufftext);
                if(SV_InitCmd)
-                       MSG_WriteString (&client->message, va("csqc_progcrc %i;%s\n", csqc_progcrc.integer, SV_InitCmd));
+                       MSG_WriteString (&client->netconnection->message, va("csqc_progcrc %i;%s\n", csqc_progcrc.integer, SV_InitCmd));
                else
-                       MSG_WriteString (&client->message, va("csqc_progcrc %i\n", csqc_progcrc.integer));
+                       MSG_WriteString (&client->netconnection->message, va("csqc_progcrc %i\n", csqc_progcrc.integer));
        }
 
-       MSG_WriteByte (&client->message, svc_serverinfo);
-       MSG_WriteLong (&client->message, Protocol_NumberForEnum(sv.protocol));
-       MSG_WriteByte (&client->message, svs.maxclients);
+       MSG_WriteByte (&client->netconnection->message, svc_serverinfo);
+       MSG_WriteLong (&client->netconnection->message, Protocol_NumberForEnum(sv.protocol));
+       MSG_WriteByte (&client->netconnection->message, svs.maxclients);
 
        if (!coop.integer && deathmatch.integer)
-               MSG_WriteByte (&client->message, GAME_DEATHMATCH);
+               MSG_WriteByte (&client->netconnection->message, GAME_DEATHMATCH);
        else
-               MSG_WriteByte (&client->message, GAME_COOP);
+               MSG_WriteByte (&client->netconnection->message, GAME_COOP);
 
-       MSG_WriteString (&client->message,PRVM_GetString(prog->edicts->fields.server->message));
+       MSG_WriteString (&client->netconnection->message,PRVM_GetString(prog->edicts->fields.server->message));
 
        for (i = 1;i < MAX_MODELS && sv.model_precache[i][0];i++)
-               MSG_WriteString (&client->message, sv.model_precache[i]);
-       MSG_WriteByte (&client->message, 0);
+               MSG_WriteString (&client->netconnection->message, sv.model_precache[i]);
+       MSG_WriteByte (&client->netconnection->message, 0);
 
        for (i = 1;i < MAX_SOUNDS && sv.sound_precache[i][0];i++)
-               MSG_WriteString (&client->message, sv.sound_precache[i]);
-       MSG_WriteByte (&client->message, 0);
+               MSG_WriteString (&client->netconnection->message, sv.sound_precache[i]);
+       MSG_WriteByte (&client->netconnection->message, 0);
 
 // send music
-       MSG_WriteByte (&client->message, svc_cdtrack);
-       MSG_WriteByte (&client->message, prog->edicts->fields.server->sounds);
-       MSG_WriteByte (&client->message, prog->edicts->fields.server->sounds);
+       MSG_WriteByte (&client->netconnection->message, svc_cdtrack);
+       MSG_WriteByte (&client->netconnection->message, prog->edicts->fields.server->sounds);
+       MSG_WriteByte (&client->netconnection->message, prog->edicts->fields.server->sounds);
 
 // set view
-       MSG_WriteByte (&client->message, svc_setview);
-       MSG_WriteShort (&client->message, PRVM_NUM_FOR_EDICT(client->edict));
+       MSG_WriteByte (&client->netconnection->message, svc_setview);
+       MSG_WriteShort (&client->netconnection->message, PRVM_NUM_FOR_EDICT(client->edict));
 
-       MSG_WriteByte (&client->message, svc_signonnum);
-       MSG_WriteByte (&client->message, 1);
+       MSG_WriteByte (&client->netconnection->message, svc_signonnum);
+       MSG_WriteByte (&client->netconnection->message, 1);
 
-       client->sendsignon = true;
        client->spawned = false;                // need prespawn, spawn, etc
 }
 
@@ -407,9 +407,8 @@ void SV_ConnectClient (int clientnum, netconn_t *netconnection)
        strcpy(client->old_name, "unconnected");
        client->spawned = false;
        client->edict = PRVM_EDICT_NUM(clientnum+1);
-       client->message.data = client->msgbuf;
-       client->message.maxsize = sizeof(client->msgbuf);
-       client->message.allowoverflow = true;           // we can catch it
+       if (client->netconnection)
+               client->netconnection->message.allowoverflow = true;            // we can catch it
        // updated by receiving "rate" command from client
        client->rate = NET_MINRATE;
        // no limits for local player
@@ -427,10 +426,10 @@ void SV_ConnectClient (int clientnum, netconn_t *netconnection)
                PRVM_ExecuteProgram (prog->globals.server->SetNewParms, "QC function SetNewParms is missing");
                for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
                        client->spawn_parms[i] = (&prog->globals.server->parm1)[i];
-       }
 
-       // set up the entity for this client (including .colormap, .team, etc)
-       PRVM_ED_ClearEdict(client->edict);
+               // set up the entity for this client (including .colormap, .team, etc)
+               PRVM_ED_ClearEdict(client->edict);
+       }
 
        // don't call SendServerinfo for a fresh botclient because its fields have
        // not been set up by the qc yet
@@ -873,12 +872,12 @@ void SV_MarkWriteEntityStateToClient(entity_state_t *s)
 }
 
 entity_state_t sendstates[MAX_EDICTS];
+extern int csqc_clent;
 
 void SV_WriteEntitiesToClient(client_t *client, prvm_edict_t *clent, sizebuf_t *msg, int *stats)
 {
        int i, numsendstates;
        entity_state_t *s;
-       extern int csqc_clent;
 
        // if there isn't enough space to accomplish anything, skip it
        if (msg->cursize + 25 > msg->maxsize)
@@ -1180,7 +1179,7 @@ SV_SendClientDatagram
 =======================
 */
 static unsigned char sv_sendclientdatagram_buf[NET_MAXMESSAGE]; // FIXME?
-qboolean SV_SendClientDatagram (client_t *client)
+void SV_SendClientDatagram (client_t *client)
 {
        int rate, maxrate, maxsize, maxsize2;
        sizebuf_t msg;
@@ -1207,6 +1206,8 @@ qboolean SV_SendClientDatagram (client_t *client)
                if (sv_maxrate.integer != maxrate)
                        Cvar_SetValueQuick(&sv_maxrate, maxrate);
 
+               // this rate limiting does not understand sys_ticrate 0
+               // (but no one should be running that on a server!)
                rate = bound(NET_MINRATE, client->rate, maxrate);
                rate = (int)(client->rate * sys_ticrate.value);
                maxsize = bound(100, rate, 1400);
@@ -1217,31 +1218,35 @@ qboolean SV_SendClientDatagram (client_t *client)
        msg.maxsize = maxsize;
        msg.cursize = 0;
 
-       MSG_WriteByte (&msg, svc_time);
-       MSG_WriteFloat (&msg, sv.time);
-
-       // add the client specific data to the datagram
-       SV_WriteClientdataToMessage (client, client->edict, &msg, stats);
-       VM_SV_WriteAutoSentStats (client, client->edict, &msg, stats);
-       SV_WriteEntitiesToClient (client, client->edict, &msg, stats);
-
-       // expand packet size to allow effects to go over the rate limit
-       // (dropping them is FAR too ugly)
-       msg.maxsize = maxsize2;
-
-       // copy the server datagram if there is space
-       // FIXME: put in delayed queue of effects to send
-       if (sv.datagram.cursize > 0 && msg.cursize + sv.datagram.cursize <= msg.maxsize)
-               SZ_Write (&msg, sv.datagram.data, sv.datagram.cursize);
-
-// send the datagram
-       if (NetConn_SendUnreliableMessage (client->netconnection, &msg) == -1)
+       if (host_client->spawned)
        {
-               SV_DropClient (true);// if the message couldn't send, kick off
-               return false;
+               MSG_WriteByte (&msg, svc_time);
+               MSG_WriteFloat (&msg, sv.time);
+
+               // add the client specific data to the datagram
+               SV_WriteClientdataToMessage (client, client->edict, &msg, stats);
+               VM_SV_WriteAutoSentStats (client, client->edict, &msg, stats);
+               SV_WriteEntitiesToClient (client, client->edict, &msg, stats);
+
+               // expand packet size to allow effects to go over the rate limit
+               // (dropping them is FAR too ugly)
+               msg.maxsize = maxsize2;
+
+               // copy the server datagram if there is space
+               // FIXME: put in delayed queue of effects to send
+               if (sv.datagram.cursize > 0 && msg.cursize + sv.datagram.cursize <= msg.maxsize)
+                       SZ_Write (&msg, sv.datagram.data, sv.datagram.cursize);
+       }
+       else if (realtime > client->keepalivetime)
+       {
+               // the player isn't totally in the game yet
+               // send small keepalive messages if too much time has passed
+               client->keepalivetime = realtime + 5;
+               MSG_WriteChar (&msg, svc_nop);
        }
 
-       return true;
+// send the datagram
+       NetConn_SendUnreliableMessage (client->netconnection, &msg, sv.protocol);
 }
 
 /*
@@ -1329,36 +1334,12 @@ void SV_UpdateToReliableMessages (void)
 
        for (j = 0, client = svs.clients;j < svs.maxclients;j++, client++)
                if (client->netconnection)
-                       SZ_Write (&client->message, sv.reliable_datagram.data, sv.reliable_datagram.cursize);
+                       SZ_Write (&client->netconnection->message, sv.reliable_datagram.data, sv.reliable_datagram.cursize);
 
        SZ_Clear (&sv.reliable_datagram);
 }
 
 
-/*
-=======================
-SV_SendNop
-
-Send a nop message without trashing or sending the accumulated client
-message buffer
-=======================
-*/
-void SV_SendNop (client_t *client)
-{
-       sizebuf_t       msg;
-       unsigned char           buf[4];
-
-       msg.data = buf;
-       msg.maxsize = sizeof(buf);
-       msg.cursize = 0;
-
-       MSG_WriteChar (&msg, svc_nop);
-
-       if (NetConn_SendUnreliableMessage (client->netconnection, &msg) == -1)
-               SV_DropClient (true);   // if the message couldn't send, kick off
-       client->last_message = realtime;
-}
-
 /*
 =======================
 SV_SendClientMessages
@@ -1368,6 +1349,9 @@ void SV_SendClientMessages (void)
 {
        int i, prepared = false;
 
+       if (sv.protocol == PROTOCOL_QUAKEWORLD)
+               Sys_Error("SV_SendClientMessages: no quakeworld support\n");
+
 // update frags, names, etc
        SV_UpdateToReliableMessages();
 
@@ -1377,59 +1361,21 @@ void SV_SendClientMessages (void)
                if (!host_client->active)
                        continue;
                if (!host_client->netconnection)
-               {
-                       SZ_Clear(&host_client->message);
                        continue;
-               }
 
-               if (host_client->message.overflowed)
+               if (host_client->netconnection->message.overflowed)
                {
                        SV_DropClient (true);   // if the message couldn't send, kick off
                        continue;
                }
 
-               if (host_client->spawned)
+               if (!prepared)
                {
-                       if (!prepared)
-                       {
-                               prepared = true;
-                               // only prepare entities once per frame
-                               SV_PrepareEntitiesForSending();
-                       }
-                       if (!SV_SendClientDatagram (host_client))
-                               continue;
-               }
-               else
-               {
-               // the player isn't totally in the game yet
-               // send small keepalive messages if too much time has passed
-               // send a full message when the next signon stage has been requested
-               // some other message data (name changes, etc) may accumulate
-               // between signon stages
-                       if (!host_client->sendsignon)
-                       {
-                               if (realtime - host_client->last_message > 5)
-                                       SV_SendNop (host_client);
-                               continue;       // don't send out non-signon messages
-                       }
-               }
-
-               if (host_client->message.cursize || host_client->dropasap)
-               {
-                       if (!NetConn_CanSendMessage (host_client->netconnection))
-                               continue;
-
-                       if (host_client->dropasap)
-                               SV_DropClient (false);  // went to another level
-                       else
-                       {
-                               if (NetConn_SendReliableMessage (host_client->netconnection, &host_client->message) == -1)
-                                       SV_DropClient (true);   // if the message couldn't send, kick off
-                               SZ_Clear (&host_client->message);
-                               host_client->last_message = realtime;
-                               host_client->sendsignon = false;
-                       }
+                       prepared = true;
+                       // only prepare entities once per frame
+                       SV_PrepareEntitiesForSending();
                }
+               SV_SendClientDatagram (host_client);
        }
 
 // clear muzzle flashes
@@ -1615,36 +1561,6 @@ void SV_CreateBaseline (void)
 }
 
 
-/*
-================
-SV_SendReconnect
-
-Tell all the clients that the server is changing levels
-================
-*/
-void SV_SendReconnect (void)
-{
-#if 1
-       MSG_WriteByte(&sv.reliable_datagram, svc_stufftext);
-       MSG_WriteString(&sv.reliable_datagram, "reconnect\n");
-#else
-       unsigned char data[128];
-       sizebuf_t msg;
-
-       msg.data = data;
-       msg.cursize = 0;
-       msg.maxsize = sizeof(data);
-
-       MSG_WriteChar (&msg, svc_stufftext);
-       MSG_WriteString (&msg, "reconnect\n");
-       NetConn_SendToAll (&msg, 5);
-
-       if (cls.state != ca_dedicated)
-               Cmd_ExecuteString ("reconnect\n", src_command);
-#endif
-}
-
-
 /*
 ================
 SV_SaveSpawnparms
@@ -1757,9 +1673,15 @@ void SV_SpawnServer (const char *server)
 //
        if (sv.active)
        {
-               SV_VM_Begin();
-               SV_SendReconnect();
-               SV_VM_End();
+               client_t *client;
+               for (i = 0, client = svs.clients;i < svs.maxclients;i++, client++)
+               {
+                       if (client->netconnection)
+                       {
+                               MSG_WriteByte(&client->netconnection->message, svc_stufftext);
+                               MSG_WriteString(&client->netconnection->message, "reconnect\n");
+                       }
+               }
        }
        else
        {
@@ -1780,8 +1702,6 @@ void SV_SpawnServer (const char *server)
 //
 // set up the new server
 //
-       Host_ClearMemory ();
-
        memset (&sv, 0, sizeof(sv));
 
        SV_VM_Setup();
@@ -1906,10 +1826,7 @@ void SV_SpawnServer (const char *server)
        }
 
        // load replacement entity file if found
-       entities = NULL;
-       if (sv_entpatch.integer)
-               entities = (char *)FS_LoadFile(va("maps/%s.ent", sv.name), tempmempool, true, NULL);
-       if (entities)
+       if (sv_entpatch.integer && (entities = (char *)FS_LoadFile(va("maps/%s.ent", sv.name), tempmempool, true, NULL)))
        {
                Con_Printf("Loaded maps/%s.ent\n", sv.name);
                PRVM_ED_LoadFromFile (entities);
@@ -2011,6 +1928,8 @@ void SV_VM_CB_InitEdict(prvm_edict_t *e)
        // LordHavoc: for consistency set these here
        int num = PRVM_NUM_FOR_EDICT(e) - 1;
 
+       e->priv.server->move = false; // don't move on first frame
+
        if (num >= 0 && num < svs.maxclients)
        {
                prvm_eval_t *val;
@@ -2097,30 +2016,39 @@ qboolean SV_VM_CB_LoadEdict(prvm_edict_t *ent)
        return true;
 }
 
-cvar_t pr_checkextension = {CVAR_READONLY, "pr_checkextension", "1"};
-cvar_t nomonsters = {0, "nomonsters", "0"};
-cvar_t gamecfg = {0, "gamecfg", "0"};
-cvar_t scratch1 = {0, "scratch1", "0"};
-cvar_t scratch2 = {0,"scratch2", "0"};
-cvar_t scratch3 = {0, "scratch3", "0"};
-cvar_t scratch4 = {0, "scratch4", "0"};
-cvar_t savedgamecfg = {CVAR_SAVE, "savedgamecfg", "0"};
-cvar_t saved1 = {CVAR_SAVE, "saved1", "0"};
-cvar_t saved2 = {CVAR_SAVE, "saved2", "0"};
-cvar_t saved3 = {CVAR_SAVE, "saved3", "0"};
-cvar_t saved4 = {CVAR_SAVE, "saved4", "0"};
-cvar_t decors = {0, "decors", "0"};
-cvar_t nehx00 = {0, "nehx00", "0"};cvar_t      nehx01 = {0, "nehx01", "0"};
-cvar_t nehx02 = {0, "nehx02", "0"};cvar_t      nehx03 = {0, "nehx03", "0"};
-cvar_t nehx04 = {0, "nehx04", "0"};cvar_t      nehx05 = {0, "nehx05", "0"};
-cvar_t nehx06 = {0, "nehx06", "0"};cvar_t      nehx07 = {0, "nehx07", "0"};
-cvar_t nehx08 = {0, "nehx08", "0"};cvar_t      nehx09 = {0, "nehx09", "0"};
-cvar_t nehx10 = {0, "nehx10", "0"};cvar_t      nehx11 = {0, "nehx11", "0"};
-cvar_t nehx12 = {0, "nehx12", "0"};cvar_t      nehx13 = {0, "nehx13", "0"};
-cvar_t nehx14 = {0, "nehx14", "0"};cvar_t      nehx15 = {0, "nehx15", "0"};
-cvar_t nehx16 = {0, "nehx16", "0"};cvar_t      nehx17 = {0, "nehx17", "0"};
-cvar_t nehx18 = {0, "nehx18", "0"};cvar_t      nehx19 = {0, "nehx19", "0"};
-cvar_t cutscene = {0, "cutscene", "1"};
+cvar_t pr_checkextension = {CVAR_READONLY, "pr_checkextension", "1", "indicates to QuakeC that the standard quakec extensions system is available (if 0, quakec should not attempt to use extensions)"};
+cvar_t nomonsters = {0, "nomonsters", "0", "unused cvar in quake, can be used by mods"};
+cvar_t gamecfg = {0, "gamecfg", "0", "unused cvar in quake, can be used by mods"};
+cvar_t scratch1 = {0, "scratch1", "0", "unused cvar in quake, can be used by mods"};
+cvar_t scratch2 = {0,"scratch2", "0", "unused cvar in quake, can be used by mods"};
+cvar_t scratch3 = {0, "scratch3", "0", "unused cvar in quake, can be used by mods"};
+cvar_t scratch4 = {0, "scratch4", "0", "unused cvar in quake, can be used by mods"};
+cvar_t savedgamecfg = {CVAR_SAVE, "savedgamecfg", "0", "unused cvar in quake that is saved to config.cfg on exit, can be used by mods"};
+cvar_t saved1 = {CVAR_SAVE, "saved1", "0", "unused cvar in quake that is saved to config.cfg on exit, can be used by mods"};
+cvar_t saved2 = {CVAR_SAVE, "saved2", "0", "unused cvar in quake that is saved to config.cfg on exit, can be used by mods"};
+cvar_t saved3 = {CVAR_SAVE, "saved3", "0", "unused cvar in quake that is saved to config.cfg on exit, can be used by mods"};
+cvar_t saved4 = {CVAR_SAVE, "saved4", "0", "unused cvar in quake that is saved to config.cfg on exit, can be used by mods"};
+cvar_t nehx00 = {0, "nehx00", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx01 = {0, "nehx01", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx02 = {0, "nehx02", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx03 = {0, "nehx03", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx04 = {0, "nehx04", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx05 = {0, "nehx05", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx06 = {0, "nehx06", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx07 = {0, "nehx07", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx08 = {0, "nehx08", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx09 = {0, "nehx09", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx10 = {0, "nehx10", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx11 = {0, "nehx11", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx12 = {0, "nehx12", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx13 = {0, "nehx13", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx14 = {0, "nehx14", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx15 = {0, "nehx15", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx16 = {0, "nehx16", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx17 = {0, "nehx17", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx18 = {0, "nehx18", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t nehx19 = {0, "nehx19", "0", "nehahra data storage cvar (used in singleplayer)"};
+cvar_t cutscene = {0, "cutscene", "1", "enables cutscenes in nehahra, can be used by other mods"};
 
 void SV_VM_Init(void)
 {
@@ -2136,21 +2064,29 @@ void SV_VM_Init(void)
        Cvar_RegisterVariable (&saved2);
        Cvar_RegisterVariable (&saved3);
        Cvar_RegisterVariable (&saved4);
-       // LordHavoc: for DarkPlaces, this overrides the number of decors (shell casings, gibs, etc)
-       Cvar_RegisterVariable (&decors);
        // LordHavoc: Nehahra uses these to pass data around cutscene demos
        if (gamemode == GAME_NEHAHRA)
        {
-               Cvar_RegisterVariable (&nehx00);Cvar_RegisterVariable (&nehx01);
-               Cvar_RegisterVariable (&nehx02);Cvar_RegisterVariable (&nehx03);
-               Cvar_RegisterVariable (&nehx04);Cvar_RegisterVariable (&nehx05);
-               Cvar_RegisterVariable (&nehx06);Cvar_RegisterVariable (&nehx07);
-               Cvar_RegisterVariable (&nehx08);Cvar_RegisterVariable (&nehx09);
-               Cvar_RegisterVariable (&nehx10);Cvar_RegisterVariable (&nehx11);
-               Cvar_RegisterVariable (&nehx12);Cvar_RegisterVariable (&nehx13);
-               Cvar_RegisterVariable (&nehx14);Cvar_RegisterVariable (&nehx15);
-               Cvar_RegisterVariable (&nehx16);Cvar_RegisterVariable (&nehx17);
-               Cvar_RegisterVariable (&nehx18);Cvar_RegisterVariable (&nehx19);
+               Cvar_RegisterVariable (&nehx00);
+               Cvar_RegisterVariable (&nehx01);
+               Cvar_RegisterVariable (&nehx02);
+               Cvar_RegisterVariable (&nehx03);
+               Cvar_RegisterVariable (&nehx04);
+               Cvar_RegisterVariable (&nehx05);
+               Cvar_RegisterVariable (&nehx06);
+               Cvar_RegisterVariable (&nehx07);
+               Cvar_RegisterVariable (&nehx08);
+               Cvar_RegisterVariable (&nehx09);
+               Cvar_RegisterVariable (&nehx10);
+               Cvar_RegisterVariable (&nehx11);
+               Cvar_RegisterVariable (&nehx12);
+               Cvar_RegisterVariable (&nehx13);
+               Cvar_RegisterVariable (&nehx14);
+               Cvar_RegisterVariable (&nehx15);
+               Cvar_RegisterVariable (&nehx16);
+               Cvar_RegisterVariable (&nehx17);
+               Cvar_RegisterVariable (&nehx18);
+               Cvar_RegisterVariable (&nehx19);
        }
        Cvar_RegisterVariable (&cutscene); // for Nehahra but useful to other mods as well
 }