'autoext' program. Reads a list of extensions, works out what the engine supports, and generates a modder friendly qc file listing all the extensions that engine supports. Yay.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1136 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
372d64347f
commit
cc753531a5
4 changed files with 346 additions and 0 deletions
106
quakec/autoext/src/autoext.qc
Normal file
106
quakec/autoext/src/autoext.qc
Normal file
|
@ -0,0 +1,106 @@
|
|||
float resultfile;
|
||||
void(string s) putresultstring =
|
||||
{
|
||||
fputs(resultfile, s);
|
||||
};
|
||||
|
||||
void(string s) FoundExtension =
|
||||
{
|
||||
float descfile;
|
||||
string descfilename;
|
||||
|
||||
putresultstring("//");putresultstring(s);putresultstring("\r\n");
|
||||
|
||||
descfilename = strcat("ext/", s, ".qc");
|
||||
descfile = fopen(descfilename, 0);
|
||||
|
||||
if (descfile>=0)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
s = fgets(descfile);
|
||||
if (s) {} else break;
|
||||
|
||||
putresultstring(s);
|
||||
putresultstring("\r\n");
|
||||
}
|
||||
fclose(descfile);
|
||||
putresultstring("\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
putresultstring("//FIXME: AutoExt: No information\r\n");
|
||||
putresultstring("\r\n"); //and a blank line
|
||||
}
|
||||
};
|
||||
|
||||
void(string inname) decompose =
|
||||
{
|
||||
float in;
|
||||
float out;
|
||||
float len;
|
||||
string s;
|
||||
string outname;
|
||||
|
||||
in = fopen(inname, 0);
|
||||
if (in < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for(;;)
|
||||
{
|
||||
s = fgets(in);
|
||||
if (s) {} else break;
|
||||
|
||||
if (s == "") //skip extra whitespace
|
||||
continue;
|
||||
|
||||
len = strlen(s);
|
||||
s = substring(s, 2, len-2);
|
||||
outname = strcat("ext/", s, ".qc");
|
||||
out = fopen(outname, 2);
|
||||
while((s = fgets(in)) != "")
|
||||
{
|
||||
fputs(out, s);
|
||||
fputs(out, "\r\n");
|
||||
}
|
||||
fclose(out);
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
};
|
||||
|
||||
void() worldspawn =
|
||||
{
|
||||
float extlist;
|
||||
string s;
|
||||
|
||||
if (!cvar("pr_checkextension"))
|
||||
error("Engine doesn't support any extensions\n");
|
||||
|
||||
if (!checkextension("FRIK_FILE"))
|
||||
error("Unable to continue without FRIK_FILE\n");
|
||||
|
||||
|
||||
// decompose("lists/betwix.qc");
|
||||
// decompose("lists/dpextensions.qc");
|
||||
|
||||
extlist = fopen("lists/extlist.txt", 0);
|
||||
resultfile = fopen("results.qc", 2);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
s = fgets(extlist);
|
||||
if (s) {} else break;
|
||||
|
||||
if (checkextension(s))
|
||||
FoundExtension(s);
|
||||
}
|
||||
|
||||
fclose(resultfile);
|
||||
fclose(extlist);
|
||||
|
||||
// dprint("\n\n\n\n\n\n\n\n");
|
||||
error("autoext compleate\n");
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue