]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
fix a typo
[xonotic/darkplaces.git] / sv_main.c
index db56fde35da9ef2243d3d2db0ee6948f6770c937..74457fec038aa437bf01733e99bd982a517223c7 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -95,7 +95,7 @@ cvar_t sv_fixedframeratesingleplayer = {0, "sv_fixedframeratesingleplayer", "1",
 cvar_t sv_freezenonclients = {CVAR_NOTIFY, "sv_freezenonclients", "0", "freezes time, except for players, allowing you to walk around and take screenshots of explosions"};
 cvar_t sv_friction = {CVAR_NOTIFY, "sv_friction","4", "how fast you slow down"};
 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_consistentplayerprethink = {0, "sv_gameplayfix_consistentplayerprethink", "0", "improves fairness in multiplayer by running all PlayerPreThink functions (which fire weapons) before performing physics, then runing all PlayerPostThink functions"};
+cvar_t sv_gameplayfix_consistentplayerprethink = {0, "sv_gameplayfix_consistentplayerprethink", "0", "improves fairness in multiplayer by running all PlayerPreThink functions (which fire weapons) before performing physics, then running all PlayerPostThink functions"};
 cvar_t sv_gameplayfix_delayprojectiles = {0, "sv_gameplayfix_delayprojectiles", "1", "causes entities to not move on the same frame they are spawned, meaning that projectiles wait until the next frame to perform their first move, giving proper interpolation and rocket trails, but making weapons harder to use at low framerates"};
 cvar_t sv_gameplayfix_droptofloorstartsolid = {0, "sv_gameplayfix_droptofloorstartsolid", "1", "prevents items and monsters that start in a solid area from falling out of the level (makes droptofloor treat trace_startsolid as an acceptable outcome)"};
 cvar_t sv_gameplayfix_droptofloorstartsolid_nudgetocorrect = {0, "sv_gameplayfix_droptofloorstartsolid_nudgetocorrect", "1", "tries to nudge stuck items and monsters out of walls before droptofloor is performed"};
@@ -115,6 +115,7 @@ cvar_t sv_gameplayfix_slidemoveprojectiles = {0, "sv_gameplayfix_slidemoveprojec
 cvar_t sv_gameplayfix_stepdown = {0, "sv_gameplayfix_stepdown", "0", "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_stepmultipletimes = {0, "sv_gameplayfix_stepmultipletimes", "0", "applies step-up onto a ledge more than once in a single frame, when running quickly up stairs"};
+cvar_t sv_gameplayfix_nostepmoveonsteepslopes = {0, "sv_gameplayfix_nostepmoveonsteepslopes", "0", "grude fix which prevents MOVETYPE_STEP (not swimming or flying) to move on slopes whose angle is bigger than 45 degree"};
 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_upwardvelocityclearsongroundflag = {0, "sv_gameplayfix_upwardvelocityclearsongroundflag", "1", "prevents monsters, items, and most other objects from being stuck to the floor when pushed around by damage, and other situations in mods"};
 cvar_t sv_gameplayfix_downtracesupportsongroundflag = {0, "sv_gameplayfix_downtracesupportsongroundflag", "1", "prevents very short moves from clearing onground (which may make the player stick to the floor at high netfps)"};
@@ -439,6 +440,7 @@ void SV_Init (void)
        Cvar_RegisterVariable (&sv_gameplayfix_stepdown);
        Cvar_RegisterVariable (&sv_gameplayfix_stepwhilejumping);
        Cvar_RegisterVariable (&sv_gameplayfix_stepmultipletimes);
+       Cvar_RegisterVariable (&sv_gameplayfix_nostepmoveonsteepslopes);
        Cvar_RegisterVariable (&sv_gameplayfix_swiminbmodels);
        Cvar_RegisterVariable (&sv_gameplayfix_upwardvelocityclearsongroundflag);
        Cvar_RegisterVariable (&sv_gameplayfix_downtracesupportsongroundflag);
@@ -485,29 +487,26 @@ void SV_Init (void)
        Cvar_RegisterVariable (&temp1);
 
        // 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
 
        Cvar_RegisterVariable (&sv_autodemo_perclient);
@@ -516,34 +515,6 @@ void SV_Init (void)
 
        Cvar_RegisterVariable (&halflifebsp);
 
-       // any special defaults for gamemodes go here
-       if (gamemode == GAME_NEHAHRA)
-       {
-               // Nehahra pushable crates malfunction in some levels if this is on
-               Cvar_SetValueQuick (&sv_gameplayfix_upwardvelocityclearsongroundflag, 0);
-               // Nehahra NPC AI is confused by this feature
-               Cvar_SetValueQuick (&sv_gameplayfix_blowupfallenzombies, 0);
-       }
-       if (gamemode == GAME_HIPNOTIC)
-       {
-               // hipnotic mission pack has issues in their 'friendly monster' ai, which seem to attempt to attack themselves for some reason when findradius() returns non-solid entities.
-               Cvar_SetValueQuick (&sv_gameplayfix_blowupfallenzombies, 0);
-               // hipnotic mission pack has issues with bobbing water entities 'jittering' between different heights on alternate frames at the default 0.0138889 ticrate, 0.02 avoids this issue
-               Cvar_SetValueQuick (&sys_ticrate, 0.02);
-               // hipnotic mission pack has issues in their proximity mine sticking code, which causes them to bounce off.
-               Cvar_SetValueQuick (&sv_gameplayfix_slidemoveprojectiles, 0);
-       }
-       if (gamemode == GAME_ROGUE)
-       {
-               // rogue mission pack has a guardian boss that does not wake up if findradius returns one of the entities around its spawn area
-               Cvar_SetValueQuick (&sv_gameplayfix_findradiusdistancetobox, 0);
-       }
-       if (gamemode == GAME_NEXUIZ)
-       {
-               Cvar_SetValueQuick (&sv_gameplayfix_q2airaccelerate, 1);
-               Cvar_SetValueQuick (&sv_gameplayfix_stepmultipletimes, 1);
-       }
-
        sv_mempool = Mem_AllocPool("server", 0, NULL);
 }
 
@@ -997,6 +968,18 @@ void SV_ConnectClient (int clientnum, netconn_t *netconnection)
 
        Con_DPrintf("Client %s connected\n", client->netconnection ? client->netconnection->address : "botclient");
 
+       if(client->netconnection && client->netconnection->crypto.authenticated)
+       {
+               Con_Printf("%s connection to %s has been established: client is %s@%.*s, I am %.*s@%.*s\n",
+                               client->netconnection->crypto.use_aes ? "Encrypted" : "Authenticated",
+                               client->netconnection->address,
+                               client->netconnection->crypto.client_idfp[0] ? client->netconnection->crypto.client_idfp : "-",
+                               crypto_keyfp_recommended_length, client->netconnection->crypto.client_keyfp[0] ? client->netconnection->crypto.client_keyfp : "-",
+                               crypto_keyfp_recommended_length, client->netconnection->crypto.server_idfp[0] ? client->netconnection->crypto.server_idfp : "-",
+                               crypto_keyfp_recommended_length, client->netconnection->crypto.server_keyfp[0] ? client->netconnection->crypto.server_keyfp : "-"
+                               );
+       }
+
        strlcpy(client->name, "unconnected", sizeof(client->name));
        strlcpy(client->old_name, "unconnected", sizeof(client->old_name));
        client->spawned = false;
@@ -3125,6 +3108,8 @@ void SV_SpawnServer (const char *server)
                return;
        }
 
+       Collision_Cache_Reset(true);
+
        // let's not have any servers with no name
        if (hostname.string[0] == 0)
                Cvar_Set ("hostname", "UNNAMED");
@@ -3426,6 +3411,41 @@ static void SV_VM_CB_InitEdict(prvm_edict_t *e)
                                // Invalid / Bot
                                PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.netaddress)->string = PRVM_SetEngineString("null/botclient");
                }
+               if(prog->fieldoffsets.crypto_idfp >= 0)
+               { // Valid Field; Process
+                       if(svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated && svs.clients[num].netconnection->crypto.client_idfp[0])
+                               PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_idfp)->string = PRVM_SetEngineString(svs.clients[num].netconnection->crypto.client_idfp);
+                       else
+                               PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_idfp)->string = 0;
+               }
+               if(prog->fieldoffsets.crypto_keyfp >= 0)
+               { // Valid Field; Process
+                       if(svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated && svs.clients[num].netconnection->crypto.client_keyfp[0])
+                               PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_keyfp)->string = PRVM_SetEngineString(svs.clients[num].netconnection->crypto.client_keyfp);
+                       else
+                               PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_keyfp)->string = 0;
+               }
+               if(prog->fieldoffsets.crypto_mykeyfp >= 0)
+               { // Valid Field; Process
+                       if(svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated && svs.clients[num].netconnection->crypto.server_keyfp[0])
+                               PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_mykeyfp)->string = PRVM_SetEngineString(svs.clients[num].netconnection->crypto.server_keyfp);
+                       else
+                               PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_mykeyfp)->string = 0;
+               }
+               if(prog->fieldoffsets.crypto_encryptmethod >= 0)
+               { // Valid Field; Process
+                       if(svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated && svs.clients[num].netconnection->crypto.use_aes)
+                               PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_encryptmethod)->string = PRVM_SetEngineString("AES128");
+                       else
+                               PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_encryptmethod)->string = 0;
+               }
+               if(prog->fieldoffsets.crypto_signmethod >= 0)
+               { // Valid Field; Process
+                       if(svs.clients[num].netconnection != NULL && svs.clients[num].netconnection->crypto.authenticated)
+                               PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_signmethod)->string = PRVM_SetEngineString("HMAC-SHA256");
+                       else
+                               PRVM_EDICTFIELDVALUE(e, prog->fieldoffsets.crypto_signmethod)->string = 0;
+               }
        }
 }