]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
cl_particles_reloadeffects <filename> - reload effects from custom effect file
authorvortex <vortex@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 20 Mar 2012 20:46:03 +0000 (20:46 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Sun, 1 Apr 2012 09:40:46 +0000 (11:40 +0200)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11765 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=cf5fd37724378511010a798b1e761f79ea1bd87c

cl_particles.c

index 1e7a909d70a4fdec9875e3ffcf927a0ddbb6bd8a..331310b7ef01b10baac26dedcc2d0a5ef0ff4891 100644 (file)
@@ -518,7 +518,7 @@ static const char *standardeffectnames[EFFECT_TOTAL] =
        "SVC_PARTICLE"
 };
 
        "SVC_PARTICLE"
 };
 
-static void CL_Particles_LoadEffectInfo(void)
+static void CL_Particles_LoadEffectInfo(const char *customfile)
 {
        int i;
        int filepass;
 {
        int i;
        int filepass;
@@ -533,10 +533,15 @@ static void CL_Particles_LoadEffectInfo(void)
        for (filepass = 0;;filepass++)
        {
                if (filepass == 0)
        for (filepass = 0;;filepass++)
        {
                if (filepass == 0)
-                       dpsnprintf(filename, sizeof(filename), "effectinfo.txt");
+               {
+                       if (customfile)
+                               dpsnprintf(filename, sizeof(filename), customfile);
+                       else
+                               dpsnprintf(filename, sizeof(filename), "effectinfo.txt");
+               }
                else if (filepass == 1)
                {
                else if (filepass == 1)
                {
-                       if (!cl.worldbasename[0])
+                       if (!cl.worldbasename[0] || customfile)
                                continue;
                        dpsnprintf(filename, sizeof(filename), "%s_effectinfo.txt", cl.worldnamenoextension);
                }
                                continue;
                        dpsnprintf(filename, sizeof(filename), "%s_effectinfo.txt", cl.worldnamenoextension);
                }
@@ -550,6 +555,11 @@ static void CL_Particles_LoadEffectInfo(void)
        }
 }
 
        }
 }
 
+void CL_Particles_LoadEffectInfo_f(void)
+{
+       CL_Particles_LoadEffectInfo(Cmd_Argc() > 1 ? Cmd_Argv(1) : NULL);
+}
+
 /*
 ===============
 CL_InitParticles
 /*
 ===============
 CL_InitParticles
@@ -559,7 +569,7 @@ void CL_ReadPointFile_f (void);
 void CL_Particles_Init (void)
 {
        Cmd_AddCommand ("pointfile", CL_ReadPointFile_f, "display point file produced by qbsp when a leak was detected in the map (a line leading through the leak hole, to an entity inside the level)");
 void CL_Particles_Init (void)
 {
        Cmd_AddCommand ("pointfile", CL_ReadPointFile_f, "display point file produced by qbsp when a leak was detected in the map (a line leading through the leak hole, to an entity inside the level)");
-       Cmd_AddCommand ("cl_particles_reloadeffects", CL_Particles_LoadEffectInfo, "reloads effectinfo.txt and maps/levelname_effectinfo.txt (where levelname is the current map)");
+       Cmd_AddCommand ("cl_particles_reloadeffects", CL_Particles_LoadEffectInfo_f, "reloads effectinfo.txt and maps/levelname_effectinfo.txt (where levelname is the current map) if parameter is given, loads from custom file (no levelname_effectinfo are loaded in this case)");
 
        Cvar_RegisterVariable (&cl_particles);
        Cvar_RegisterVariable (&cl_particles_quality);
 
        Cvar_RegisterVariable (&cl_particles);
        Cvar_RegisterVariable (&cl_particles_quality);
@@ -2369,7 +2379,7 @@ static void r_part_start(void)
                particlepalette[i] = palette_rgb[i][0] * 65536 + palette_rgb[i][1] * 256 + palette_rgb[i][2];
        particletexturepool = R_AllocTexturePool();
        R_InitParticleTexture ();
                particlepalette[i] = palette_rgb[i][0] * 65536 + palette_rgb[i][1] * 256 + palette_rgb[i][2];
        particletexturepool = R_AllocTexturePool();
        R_InitParticleTexture ();
-       CL_Particles_LoadEffectInfo();
+       CL_Particles_LoadEffectInfo(NULL);
 }
 
 static void r_part_shutdown(void)
 }
 
 static void r_part_shutdown(void)
@@ -2381,7 +2391,7 @@ static void r_part_newmap(void)
 {
        if (decalskinframe)
                R_SkinFrame_MarkUsed(decalskinframe);
 {
        if (decalskinframe)
                R_SkinFrame_MarkUsed(decalskinframe);
-       CL_Particles_LoadEffectInfo();
+       CL_Particles_LoadEffectInfo(NULL);
 }
 
 unsigned short particle_elements[MESHQUEUE_TRANSPARENT_BATCHSIZE*6];
 }
 
 unsigned short particle_elements[MESHQUEUE_TRANSPARENT_BATCHSIZE*6];