support r_particlesdesc chain loading; use r_particledesc "x;y;etc" to load multiple configs, removed shaft effect from spikeset, created new tsshaft set and added it into sets, change r_particlesdesc default to "spikeset;tsshaft"

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2246 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-05-07 01:49:06 +00:00
parent 9e8aa5ee66
commit 6f64002cc3
5 changed files with 336 additions and 350 deletions

View file

@ -124,7 +124,7 @@ extern cvar_t gl_part_flame;
// callbacks // callbacks
void R_ParticlesDesc_Callback(struct cvar_s *var, char *oldvalue); void R_ParticlesDesc_Callback(struct cvar_s *var, char *oldvalue);
cvar_t r_particlesdesc = SCVARFC("r_particlesdesc", "spikeset", CVAR_SEMICHEAT, R_ParticlesDesc_Callback); cvar_t r_particlesdesc = SCVARFC("r_particlesdesc", "spikeset;tsshaft", CVAR_SEMICHEAT, R_ParticlesDesc_Callback);
cvar_t r_part_rain_quantity = SCVAR("r_part_rain_quantity", "1"); cvar_t r_part_rain_quantity = SCVAR("r_part_rain_quantity", "1");
@ -1486,11 +1486,48 @@ void P_ExportBuiltinSet_f(void)
Con_Printf("Written particles/%s.cfg\n", efname); Con_Printf("Written particles/%s.cfg\n", efname);
} }
void P_LoadParticleSet(char *name, qboolean first)
{
int restrictlevel = Cmd_FromGamecode() ? RESTRICT_SERVER : RESTRICT_LOCAL;
//particle descriptions submitted by the server are deemed to not be cheats but game configs.
if (!stricmp(name, "none"))
return;
else if (!stricmp(name, "faithful") || (first && !*name))
Cbuf_AddText(particle_set_faithful, RESTRICT_SERVER);
else if (!stricmp(name, "spikeset"))
Cbuf_AddText(particle_set_spikeset, RESTRICT_SERVER);
else if (!stricmp(name, "highfps"))
Cbuf_AddText(particle_set_highfps, RESTRICT_SERVER);
else if (!stricmp(name, "minimal"))
Cbuf_AddText(particle_set_minimal, RESTRICT_SERVER);
else if (!stricmp(name, "tsshaft"))
Cbuf_AddText(particle_set_tsshaft, RESTRICT_SERVER);
else
{
char *file = COM_LoadMallocFile(va("particles/%s.cfg", name));
if (!file)
file = COM_LoadMallocFile(va("%s.cfg", name));
if (file)
{
Cbuf_AddText(file, restrictlevel);
Cbuf_AddText("\n", restrictlevel);
BZ_Free(file);
}
else if (first)
{
Con_Printf(S_WARNING "Couldn't find particle description %s, using spikeset\n", name);
Cbuf_AddText(particle_set_spikeset, RESTRICT_SERVER);
}
else
Con_Printf(S_WARNING "Couldn't find particle description %s\n", name);
}
}
void R_ParticlesDesc_Callback(struct cvar_s *var, char *oldvalue) void R_ParticlesDesc_Callback(struct cvar_s *var, char *oldvalue)
{ {
extern model_t mod_known[]; extern model_t mod_known[];
extern int mod_numknown; extern int mod_numknown;
int restrictlevel = Cmd_FromGamecode() ? RESTRICT_SERVER : RESTRICT_LOCAL;
model_t *mod; model_t *mod;
int i; int i;
@ -1520,79 +1557,27 @@ void R_ParticlesDesc_Callback(struct cvar_s *var, char *oldvalue)
f_modified_particles = false; f_modified_particles = false;
{ {
char *semi; char name[32];
semi = strchr(r_particlesdesc.string, ';');
if (semi) //make sure nothing uses this for other means.
*semi = '\0';
}
//particle descriptions submitted by the server are deemed to not be cheats but game configs.
if (!stricmp(r_particlesdesc.string, "none"))
return;
else if (!stricmp(r_particlesdesc.string, "faithful") || !*r_particlesdesc.string)
Cbuf_AddText(particle_set_faithful, RESTRICT_SERVER);
else if (!stricmp(r_particlesdesc.string, "spikeset"))
Cbuf_AddText(particle_set_spikeset, RESTRICT_SERVER);
else if (!stricmp(r_particlesdesc.string, "highfps"))
Cbuf_AddText(particle_set_highfps, RESTRICT_SERVER);
else if (!stricmp(r_particlesdesc.string, "minimal"))
Cbuf_AddText(particle_set_minimal, RESTRICT_SERVER);
else
{
char *file = COM_LoadMallocFile(va("particles/%s.cfg", r_particlesdesc.string));
if (!file)
file = COM_LoadMallocFile(va("%s.cfg", r_particlesdesc.string));
if (file)
{
Cbuf_AddText(file, restrictlevel);
Cbuf_AddText("\n", restrictlevel);
BZ_Free(file);
}
else
{
Con_Printf("Couldn't find particle description, using spikeset\n");
Cbuf_AddText(particle_set_spikeset, RESTRICT_SERVER);
}
/*
#if defined(_DEBUG) && defined(_WIN32) //expand the particles cfg into a C style quoted string, and copy to clipboard so I can paste it in.
{
char *TL_ExpandToCString(char *in);
extern HWND mainwindow;
char *file = COM_LoadTempFile(va("%s.cfg", r_particlesdesc.string));
char *lptstrCopy, *buf, temp;
int len; int len;
HANDLE hglbCopy = GlobalAlloc(GMEM_MOVEABLE, qboolean first = true;
com_filesize*2);
lptstrCopy = GlobalLock(hglbCopy); char *oldsemi;
while(file && *file) char *semi;
oldsemi = r_particlesdesc.string;
semi = strchr(oldsemi, ';');
while (semi)
{ {
len = strlen(file)+1; len = (int)(semi - oldsemi) + 1;
if (len > 1024) if (len > sizeof(name))
len = 1024; len = sizeof(name);
temp = file[len-1]; Q_strncpyz(name, oldsemi, len);
file[len-1] = '\0'; P_LoadParticleSet(name, first);
buf = TL_ExpandToCString(file); first = false;
file[len-1] = temp; oldsemi = semi + 1;
len-=1; semi = strchr(oldsemi, ';');
com_filesize -= len;
file+=len;
len = strlen(buf);
memcpy(lptstrCopy, buf, len);
lptstrCopy+=len;
} }
*lptstrCopy = '\0'; Q_strncpyz(name, oldsemi, sizeof(name));
GlobalUnlock(hglbCopy); P_LoadParticleSet(name, first);
if (!OpenClipboard(mainwindow))
return;
EmptyClipboard();
SetClipboardData(CF_TEXT, hglbCopy);
CloseClipboard();
}
#endif
*/
} }
} }

View file

@ -634,144 +634,6 @@ char *particle_set_spikeset =
"assoc empflash\n" "assoc empflash\n"
"}\n" "}\n"
// TE_LIGHTNING2 replacement, (c) 2005 TimeServ
// If you steal this GPLed code you will be violating several international laws
// as well as several laws of physics.
"r_part tlightningflash\n"
"{\n"
"spawntime 0.1\n"
"spawnchance 0.1\n"
"die 0.25\n"
"type beam\n"
"alpha 1\n"
"step 80\n"
"scale 14\n"
"scaledelta -52\n"
"rgb 255 255 255\n"
"spawnmode distball\n"
"spawnorg 16\n"
"spawnparam1 0.5\n"
"averageout\n"
"nospreadfirst\n"
"blend add\n"
"}\n"
"r_part tlightningglow\n"
"{\n"
"step 50\n"
"scale 35\n"
"scalefactor 1\n"
"alpha 1\n"
"die 0\n"
"rgb 1 1 8\n"
"blend add\n"
"assoc tlightningflash\n"
"}\n"
"r_part tlightningfade\n"
"{\n"
"spawntime 0.05\n"
"die 0.2\n"
"type beam\n"
"alpha 2\n"
"step 96\n"
"scale 1.5\n"
"rgb 16 16 64\n"
"spawnmode distball\n"
"spawnorg 9\n"
"spawnparam1 0.9\n"
"blend add\n"
"averageout\n"
"nospreadfirst\n"
"assoc tlightningglow\n"
"}\n"
"r_part te_lightning2\n"
"{\n"
"die 0\n"
"type beam\n"
"alpha 2\n"
"step 96\n"
"scale 4\n"
"rgb 196 196 255\n"
"spawnmode distball\n"
"spawnorg 9\n"
"spawnparam1 0.9\n"
"blend add\n"
"averageout\n"
"nospreadfirst\n"
"assoc tlightningfade\n"
"}\n"
"r_part lbolttrail\n"
"{\n"
"die 0.5\n"
"type beam\n"
"alpha 2\n"
"step 32\n"
"scale 1\n"
"rgb 196 196 255\n"
"rgbdelta -512 -512 -128\n"
"spawnmode distball\n"
"spawnorg 5\n"
"spawnvel 4\n"
"spawnparam1 0.5\n"
"blend add\n"
"}\n"
"r_part lbolt\n"
"{\n"
"die 0.5\n"
"count 1\n"
"spawnmode circle\n"
"spawnvel 2000\n"
"spawnorg 1\n"
"emit lbolttrail\n"
"emitinterval -1\n"
"}\n"
"r_part lemit\n"
"{\n"
"die 0.1\n"
"count 1\n"
"spawnchance 1\n"
"emit lbolt\n"
"emitinterval 100\n"
"spawnchance 0.1\n"
"cliptype lemit\n"
"clipcount 1\n"
"clipbounce 0\n"
"}\n"
"r_part lflash\n"
"{\n"
"die 0.1\n"
"texture \"particles/lflash\"\n"
"count 1\n"
"alpha 1\n"
"scale 100\n"
"scalefactor 1\n"
"scaledelta -500\n"
"rgb 255 255 255\n"
"blend add\n"
"assoc lemit\n"
"}\n"
"r_part te_lightning2_end\n"
"{\n"
"die 0.3\n"
"alpha 1\n"
"count 8\n"
"scale 2\n"
"rgb 128 128 255\n"
"rgbrand 63 63 0\n"
"rgbrandsync 1\n"
"spawnvel 100\n"
"spawnorg 5\n"
"blend add\n"
"assoc lflash\n"
"}\n"
"r_part pe_default\n" "r_part pe_default\n"
"{\n" "{\n"
"texture \"particles/quake\"\n" "texture \"particles/quake\"\n"
@ -1422,3 +1284,144 @@ char *particle_set_minimal =
"spawnvel 2\n" "spawnvel 2\n"
"scalefactor 0.8\n" "scalefactor 0.8\n"
"}\n"; "}\n";
// --- addon scripts will start here
char *particle_set_tsshaft =
// TE_LIGHTNING2 replacement, (c) 2005 TimeServ
// If you steal this GPLed code you will be violating several international laws
// as well as several laws of physics.
"r_part tlightningflash\n"
"{\n"
"spawntime 0.1\n"
"spawnchance 0.1\n"
"die 0.25\n"
"type beam\n"
"alpha 1\n"
"step 80\n"
"scale 14\n"
"scaledelta -52\n"
"rgb 255 255 255\n"
"spawnmode distball\n"
"spawnorg 16\n"
"spawnparam1 0.5\n"
"averageout\n"
"nospreadfirst\n"
"blend add\n"
"}\n"
"r_part tlightningglow\n"
"{\n"
"step 50\n"
"scale 35\n"
"scalefactor 1\n"
"alpha 1\n"
"die 0\n"
"rgb 1 1 8\n"
"blend add\n"
"assoc tlightningflash\n"
"}\n"
"r_part tlightningfade\n"
"{\n"
"spawntime 0.05\n"
"die 0.2\n"
"type beam\n"
"alpha 2\n"
"step 96\n"
"scale 1.5\n"
"rgb 16 16 64\n"
"spawnmode distball\n"
"spawnorg 9\n"
"spawnparam1 0.9\n"
"blend add\n"
"averageout\n"
"nospreadfirst\n"
"assoc tlightningglow\n"
"}\n"
"r_part te_lightning2\n"
"{\n"
"die 0\n"
"type beam\n"
"alpha 2\n"
"step 96\n"
"scale 4\n"
"rgb 196 196 255\n"
"spawnmode distball\n"
"spawnorg 9\n"
"spawnparam1 0.9\n"
"blend add\n"
"averageout\n"
"nospreadfirst\n"
"assoc tlightningfade\n"
"}\n"
"r_part lbolttrail\n"
"{\n"
"die 0.5\n"
"type beam\n"
"alpha 2\n"
"step 32\n"
"scale 1\n"
"rgb 196 196 255\n"
"rgbdelta -512 -512 -128\n"
"spawnmode distball\n"
"spawnorg 5\n"
"spawnvel 4\n"
"spawnparam1 0.5\n"
"blend add\n"
"}\n"
"r_part lbolt\n"
"{\n"
"die 0.5\n"
"count 1\n"
"spawnmode circle\n"
"spawnvel 2000\n"
"spawnorg 1\n"
"emit lbolttrail\n"
"emitinterval -1\n"
"}\n"
"r_part lemit\n"
"{\n"
"die 0.1\n"
"count 1\n"
"spawnchance 1\n"
"emit lbolt\n"
"emitinterval 100\n"
"spawnchance 0.1\n"
"cliptype lemit\n"
"clipcount 1\n"
"clipbounce 0\n"
"}\n"
"r_part lflash\n"
"{\n"
"die 0.1\n"
"texture \"particles/lflash\"\n"
"count 1\n"
"alpha 1\n"
"scale 100\n"
"scalefactor 1\n"
"scaledelta -500\n"
"rgb 255 255 255\n"
"blend add\n"
"assoc lemit\n"
"}\n"
"r_part te_lightning2_end\n"
"{\n"
"die 0.3\n"
"alpha 1\n"
"count 8\n"
"scale 2\n"
"rgb 128 128 255\n"
"rgbrand 63 63 0\n"
"rgbrandsync 1\n"
"spawnvel 100\n"
"spawnorg 5\n"
"blend add\n"
"assoc lflash\n"
"}\n";

View file

@ -2,6 +2,5 @@ extern char *particle_set_spikeset;
extern char *particle_set_highfps; extern char *particle_set_highfps;
extern char *particle_set_faithful; extern char *particle_set_faithful;
extern char *particle_set_minimal; extern char *particle_set_minimal;
extern char *particle_set_tsshaft;
// #define particle_set_faithful particle_set_highfps

View file

@ -631,144 +631,6 @@ r_part te_blob
assoc empflash assoc empflash
} }
// TE_LIGHTNING2 replacement, (c) 2005 TimeServ
// If you steal this GPLed code you will be violating several international laws
// as well as several laws of physics.
r_part tlightningflash
{
spawntime 0.1
spawnchance 0.1
die 0.25
type beam
alpha 1
step 80
scale 14
scaledelta -52
rgb 255 255 255
spawnmode distball
spawnorg 16
spawnparam1 0.5
averageout
nospreadfirst
blend add
}
r_part tlightningglow
{
step 50
scale 35
scalefactor 1
alpha 1
die 0
rgb 1 1 8
blend add
assoc tlightningflash
}
r_part tlightningfade
{
spawntime 0.05
die 0.2
type beam
alpha 2
step 96
scale 1.5
rgb 16 16 64
spawnmode distball
spawnorg 9
spawnparam1 0.9
blend add
averageout
nospreadfirst
assoc tlightningglow
}
r_part te_lightning2
{
die 0
type beam
alpha 2
step 96
scale 4
rgb 196 196 255
spawnmode distball
spawnorg 9
spawnparam1 0.9
blend add
averageout
nospreadfirst
assoc tlightningfade
}
r_part lbolttrail
{
die 0.5
type beam
alpha 2
step 32
scale 1
rgb 196 196 255
rgbdelta -512 -512 -128
spawnmode distball
spawnorg 5
spawnvel 4
spawnparam1 0.5
blend add
}
r_part lbolt
{
die 0.5
count 1
spawnmode circle
spawnvel 2000
spawnorg 1
emit lbolttrail
emitinterval -1
}
r_part lemit
{
die 0.1
count 1
spawnchance 1
emit lbolt
emitinterval 100
spawnchance 0.1
cliptype lemit
clipcount 1
clipbounce 0
}
r_part lflash
{
die 0.1
texture "particles/lflash"
count 1
alpha 1
scale 100
scalefactor 1
scaledelta -500
rgb 255 255 255
blend add
assoc lemit
}
r_part te_lightning2_end
{
die 0.3
alpha 1
count 8
scale 2
rgb 128 128 255
rgbrand 63 63 0
rgbrandsync 1
spawnvel 100
spawnorg 5
blend add
assoc lflash
}
r_part pe_default r_part pe_default
{ {
texture "particles/quake" texture "particles/quake"

137
engine/partcfgs/tsshaft.cfg Normal file
View file

@ -0,0 +1,137 @@
// TE_LIGHTNING2 replacement, (c) 2005 TimeServ
// If you steal this GPLed code you will be violating several international laws
// as well as several laws of physics.
r_part tlightningflash
{
spawntime 0.1
spawnchance 0.1
die 0.25
type beam
alpha 1
step 80
scale 14
scaledelta -52
rgb 255 255 255
spawnmode distball
spawnorg 16
spawnparam1 0.5
averageout
nospreadfirst
blend add
}
r_part tlightningglow
{
step 50
scale 35
scalefactor 1
alpha 1
die 0
rgb 1 1 8
blend add
assoc tlightningflash
}
r_part tlightningfade
{
spawntime 0.05
die 0.2
type beam
alpha 2
step 96
scale 1.5
rgb 16 16 64
spawnmode distball
spawnorg 9
spawnparam1 0.9
blend add
averageout
nospreadfirst
assoc tlightningglow
}
r_part te_lightning2
{
die 0
type beam
alpha 2
step 96
scale 4
rgb 196 196 255
spawnmode distball
spawnorg 9
spawnparam1 0.9
blend add
averageout
nospreadfirst
assoc tlightningfade
}
r_part lbolttrail
{
die 0.5
type beam
alpha 2
step 32
scale 1
rgb 196 196 255
rgbdelta -512 -512 -128
spawnmode distball
spawnorg 5
spawnvel 4
spawnparam1 0.5
blend add
}
r_part lbolt
{
die 0.5
count 1
spawnmode circle
spawnvel 2000
spawnorg 1
emit lbolttrail
emitinterval -1
}
r_part lemit
{
die 0.1
count 1
spawnchance 1
emit lbolt
emitinterval 100
spawnchance 0.1
cliptype lemit
clipcount 1
clipbounce 0
}
r_part lflash
{
die 0.1
texture "particles/lflash"
count 1
alpha 1
scale 100
scalefactor 1
scaledelta -500
rgb 255 255 255
blend add
assoc lemit
}
r_part te_lightning2_end
{
die 0.3
alpha 1
count 8
scale 2
rgb 128 128 255
rgbrand 63 63 0
rgbrandsync 1
spawnvel 100
spawnorg 5
blend add
assoc lflash
}