Skip to content
Snippets Groups Projects
Commit a032f64a authored by deuce's avatar deuce
Browse files

Fix handling of ESC[H when loading ANSI files.

If the file uses a known extension, do not pass through all the parsers.
parent 168a69e3
Branches
Tags
No related merge requests found
...@@ -345,8 +345,8 @@ display_ansi(char ch) ...@@ -345,8 +345,8 @@ display_ansi(char ch)
for (x = 0; x < l; x++) for (x = 0; x < l; x++)
if (ansicode[x] == ';') if (ansicode[x] == ';')
y = x; y = x;
CursY = strtol(copy(ansicode, 0, y?(y - 1):0), NULL, 0); CursY = strtol(copy(ansicode, 0, y?(y - 1):0), NULL, 0)-1;
CursX = strtol(copy(ansicode, y?(y + 1):(strlen(ansicode)-1), strlen(ansicode) - 1), NULL, 0); CursX = strtol(copy(ansicode, y?(y + 1):(strlen(ansicode)-1), strlen(ansicode) - 1), NULL, 0)-1;
break; break;
case 'C': case 'C':
ans_rep = strtol(ansicode, NULL, 0) + 1; ans_rep = strtol(ansicode, NULL, 0) + 1;
...@@ -581,6 +581,12 @@ LoadFile(char *Name) ...@@ -581,6 +581,12 @@ LoadFile(char *Name)
{ {
FILE *fp; FILE *fp;
int ch; int ch;
int PCB=TRUE;
int ANSI=TRUE;
int SYNC=TRUE;
int AVATAR=TRUE;
char *ext;
erasescreen(); erasescreen();
fp = fopen(Name, "rb"); fp = fopen(Name, "rb");
if(fp==NULL) if(fp==NULL)
...@@ -598,11 +604,44 @@ LoadFile(char *Name) ...@@ -598,11 +604,44 @@ LoadFile(char *Name)
CursY++; CursY++;
} while (!feof(fp)); } while (!feof(fp));
} else } else
/* Check for "known" extensions */
ext=getfext(Name);
if(ext) {
if(stricmp(ext,".asc")) {
PCB=FALSE;
ANSI=FALSE;
AVATAR=FALSE;
}
else if(stricmp(ext,".ans")) {
PCB=FALSE;
AVATAR=FALSE;
SYNC=FALSE;
}
else if(stricmp(ext,".avt")) {
PCB=FALSE;
ANSI=FALSE;
SYNC=FALSE;
}
else if(stricmp(ext,".pcb")) {
ANSI=FALSE;
AVATAR=FALSE;
SYNC=FALSE;
}
}
do { do {
ch=fgetc(fp); ch=fgetc(fp);
if (ch == 26 && !avt_command && !avt_rep) if (ch == 26 && !avt_command && !avt_rep)
break; break;
do { do {
if(AVATAR)
ch=display_avatar(ch);
if(SYNC)
ch=display_sync(ch);
if(ANSI)
ch=display_ansi(ch);
if(PCB)
ch=display_PCBoard(ch);
ch = display_PCBoard(display_ansi(display_sync(display_avatar(ch)))); ch = display_PCBoard(display_ansi(display_sync(display_avatar(ch))));
if (ch > 0) { if (ch > 0) {
if (CursX > 79) { if (CursX > 79) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment