Error("Cannot open file DESCENT.TEX or DESCENT.TXB\nIs descent2.hog in your current directory?");
have_binary=1;
len=cfilelength(ifile);
MALLOC(text,char,len);
atexit(free_text);
cfread(text,1,len,ifile);
cfclose(ifile);
}else{
intc;
char*p;
len=cfilelength(tfile);
MALLOC(text,char,len);
atexit(free_text);
//fread(text,1,len,tfile);
p=text;
do{
c=cfgetc(tfile);
if(c!=13)
*p++=c;
}while(c!=EOF);
cfclose(tfile);
}
for(i=0,tptr=text;i<N_TEXT_STRINGS;i++){
char*p;
Text_string[i]=tptr;
tptr=strchr(tptr,'\n');
#ifdef MACINTOSH // total hack for mac patch since they don't want to patch data.
if(!tptr&&(i==644))
break;
#else
if(!tptr)
{
Warning("Not enough strings in text file - expecting %d, found %d\nThis probably means you have the wrong version of the descent 2 datafiles. You need version 1.2\n",N_TEXT_STRINGS,i);
if(i==644)break;
}
#endif
if(tptr)*tptr++=0;
if(have_binary)
decode_text_line(Text_string[i]);
//scan for special chars (like \n)
for(p=Text_string[i];(p=strchr(p,'\\'));){
charnewchar;
if(p[1]=='n')newchar='\n';
elseif(p[1]=='t')newchar='\t';
elseif(p[1]=='\\')newchar='\\';
else
Error("Unsupported key sequence <\\%c> on line %d of file <%s>",p[1],i+1,filename);