]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
fix stupid typo in GLSL shader
[xonotic/darkplaces.git] / sv_main.c
index 48c3b912b25af65f50a4de3f6ee8a2fc5d8e74e4..8005c874810e89418eb1fdfd61cd5f77bb18c817 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -41,6 +41,8 @@ cvar_t sv_gameplayfix_stepwhilejumping = {0, "sv_gameplayfix_stepwhilejumping",
 cvar_t sv_gameplayfix_swiminbmodels = {0, "sv_gameplayfix_swiminbmodels", "1"};
 cvar_t sv_gameplayfix_setmodelrealbox = {0, "sv_gameplayfix_setmodelrealbox", "1"};
 
+cvar_t sv_progs = {0, "sv_progs", "progs.dat" };
+
 server_t sv;
 server_static_t svs;
 
@@ -84,6 +86,7 @@ void SV_Init (void)
        Cvar_RegisterVariable (&sv_protocolname);
        Cvar_RegisterVariable (&sv_ratelimitlocalplayer);
        Cvar_RegisterVariable (&sv_maxrate);
+       Cvar_RegisterVariable (&sv_progs);
 
        SV_Phys_Init();
        SV_World_Init();
@@ -449,6 +452,7 @@ void SV_PrepareEntitiesForSending(void)
        int e, i;
        float f;
        edict_t *ent;
+       eval_t *val;
        entity_state_t cs;
        // send all entities that touch the pvs
        numsendentities = 0;
@@ -480,6 +484,16 @@ void SV_PrepareEntitiesForSending(void)
                if (GETEDICTFIELDVALUE(ent, eval_glow_trail)->_float)
                        cs.flags |= RENDER_GLOWTRAIL;
 
+               // don't need to init cs.colormod because the defaultstate did that for us
+               //cs.colormod[0] = cs.colormod[1] = cs.colormod[2] = 32;
+               val = GETEDICTFIELDVALUE(ent, eval_colormod);
+               if (val->vector[0] || val->vector[1] || val->vector[2])
+               {
+                       i = val->vector[0] * 32.0f;cs.colormod[0] = bound(0, i, 255);
+                       i = val->vector[1] * 32.0f;cs.colormod[1] = bound(0, i, 255);
+                       i = val->vector[2] * 32.0f;cs.colormod[2] = bound(0, i, 255);
+               }
+
                cs.modelindex = 0;
                i = (int)ent->v->modelindex;
                if (i >= 1 && i < MAX_MODELS && *PR_GetString(ent->v->model))
@@ -1160,20 +1174,24 @@ void SV_UpdateToReliableMessages (void)
                }
 
                // NEXUIZ_PLAYERMODEL
-               model = PR_GetString(host_client->edict->v->playermodel);
-               if (model == NULL)
-                       model = "";
-               // always point the string back at host_client->name to keep it safe
-               strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel));
-               host_client->edict->v->playermodel = PR_SetString(host_client->playermodel);
+               if( eval_playermodel ) {
+                       model = PR_GetString(GETEDICTFIELDVALUE(host_client->edict, eval_playermodel)->string);
+                       if (model == NULL)
+                               model = "";
+                       // always point the string back at host_client->name to keep it safe
+                       strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel));
+                       GETEDICTFIELDVALUE(host_client->edict, eval_playermodel)->string = PR_SetString(host_client->playermodel);
+               }
 
                // NEXUIZ_PLAYERSKIN
-               skin = PR_GetString(host_client->edict->v->playerskin);
-               if (skin == NULL)
-                       skin = "";
-               // always point the string back at host_client->name to keep it safe
-               strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin));
-               host_client->edict->v->playerskin = PR_SetString(host_client->playerskin);
+               if( eval_playerskin ) {
+                       skin = PR_GetString(GETEDICTFIELDVALUE(host_client->edict, eval_playerskin)->string);
+                       if (skin == NULL)
+                               skin = "";
+                       // always point the string back at host_client->name to keep it safe
+                       strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin));
+                       GETEDICTFIELDVALUE(host_client->edict, eval_playerskin)->string = PR_SetString(host_client->playerskin);
+               }
 
                // frags
                host_client->frags = (int)host_client->edict->v->frags;
@@ -1336,7 +1354,7 @@ int SV_ModelIndex(char *s, int precachemode)
                                        Con_Printf("SV_ModelIndex(\"%s\"): not precached (fix your code), precaching anyway\n", filename);
                                strlcpy(sv.model_precache[i], filename, sizeof(sv.model_precache[i]));
                                sv.models[i] = Mod_ForName (sv.model_precache[i], true, false, false);
-                               if (sv.protocol == PROTOCOL_DARKPLACES6)
+                               if (sv.protocol == PROTOCOL_DARKPLACES6 && sv.state != ss_loading)
                                {
                                        MSG_WriteByte(&sv.reliable_datagram, svc_precache);
                                        MSG_WriteShort(&sv.reliable_datagram, i);
@@ -1384,7 +1402,7 @@ int SV_SoundIndex(char *s, int precachemode)
                                if (precachemode == 1)
                                        Con_Printf("SV_SoundIndex(\"%s\"): not precached (fix your code), precaching anyway\n", filename);
                                strlcpy(sv.sound_precache[i], filename, sizeof(sv.sound_precache[i]));
-                               if (sv.protocol == PROTOCOL_DARKPLACES6)
+                               if (sv.protocol == PROTOCOL_DARKPLACES6 && sv.state != ss_loading)
                                {
                                        MSG_WriteByte(&sv.reliable_datagram, svc_precache);
                                        MSG_WriteShort(&sv.reliable_datagram, i + 32768);
@@ -1589,6 +1607,9 @@ void SV_SpawnServer (const char *server)
 
        Con_DPrintf("SpawnServer: %s\n", server);
 
+       if (cls.state != ca_dedicated)
+               SCR_BeginLoadingPlaque();
+
        snprintf (modelname, sizeof(modelname), "maps/%s.bsp", server);
        worldmodel = Mod_ForName(modelname, false, true, true);
        if (!worldmodel || !worldmodel->TraceBox)
@@ -1661,7 +1682,7 @@ void SV_SpawnServer (const char *server)
        }
 
 // load progs to get entity field count
-       PR_LoadProgs ();
+       PR_LoadProgs ( sv_progs.string );
 
 // allocate server memory
        // start out with just enough room for clients and a reasonable estimate of entities