char randomfg = 0; char randombg = 0; char sgets(unsigned int max, char *output,char ww) { signed int pos = 0; char rv = 0; int ch; output[0] = 0; output[1] = 0; for(;;) { topp: if((ww && pos > max - 12 && ch == ' ') || (ww && pos == max)) goto end; ch =getch(); if(!ch) { getch(); goto topp; } if (ch == 27) { output[pos] = 0; rv = 1; goto end; } if (ch == '\r' ) goto end; if (ch == '\b') { output[pos] = 0; pos -= 1; if (pos >= 0) cprintf("\b \b"); if (pos<1) pos = 0; } else if (pos < max) { if(ch == ' ') { output[pos] = output[pos+1] = output[pos+2] = ' '; output[pos + 3] = output[pos+4] = output[pos+5] = ' '; cprintf(" "); pos += 6; } else { output[pos] = ch; cprintf("%c",ch); pos++; } } } end: output[pos] = 0; return(rv); } void bg(char fg,char bg,char ch) { if (!directvideo){ int hr; textcolor(fg); textbackground(bg); clrscr(); for (hr=0;hr<200;hr++) cprintf("%c%c%c%c%c%c%c%c%c%c", ch,ch,ch,ch,ch,ch,ch,ch,ch,ch); } else { int x; typedef unsigned int (far *booga); booga vmem[80]; vmem[0] = (booga)MK_FP(0xb800,0); for (x=0;x<80 * 25;x++) vmem[0][x] = ch + (fg * 0x0100) + (bg * 0x1000); } } void disp(char *in) { char fg,bg; int point = 0; fg = -1; bg = -1; do { hi: if(in[point] == '@') if (in[point + 2] == '@' && (in[point+1] == 'r' || in[point+1] == 'R')) { point+=3; srand(point * 123421 + 46); randombg=randomfg=1; goto hi; } else if (in[point + 4] == '@') { if (in[point+1] == 'C' && in[point+2] == 'L' && in[point+3] == 'S') { clrscr(); point+=5;goto hi;} } else if(in[point + 6] == '@' && in[point+3] == ':') { unsigned int xp,yp; char x1,x2,y1,y2; x1 = in[point + 1] - '0'; x2 = in[point + 2] - '0'; y1 = in[point + 4] - '0'; y2 = in[point + 5] - '0'; xp = (x1 * 10) + x2; yp = (y1 * 10) + y2; gotoxy(xp,yp); point += 7; goto hi; } else if(in[point + 6] == '@' && in[point+3] == '|') { unsigned int xp,yp; char x1,x2,y1,y2; x1 = in[point + 1] - '0'; x2 = in[point + 2] - '0'; y1 = in[point + 4] - '0'; y2 = in[point + 5] - '0'; xp = (x1 * 10) + x2; yp = (y1 * 10) + y2; gotoxy(xp + wherex(),yp + wherey()); point += 7; goto hi; } else if(in[point+3] == '@') { fg = bg = -1; if(in[point+1] == 'r' || in[point+1] == 'R') randombg=1; else if(in[point+1] <'9' + 1 && in[point+1] > '0'-1) bg = in[point+1] - '0'; else if(in[point+1] > 'A' - 1 && in[point+1] <'F' +1) bg = in[point+1] - 'A' + 10; else if(in[point+1] > 'a' - 1 && in[point+1] <'f' +1) bg = in[point+1] - 'a' + 10; if(in[point+2] == 'r' || in[point+2] == 'R') randomfg=1; else if(in[point+2] <'9'+1 && in[point+2] > '0' -1) fg = in[point+2] - '0'; else if(in[point+2] > 'A' -1 && in[point+2] < 'F' + 1) fg = in[point+2] - 'A' + 10; else if(in[point+2] > 'a' -1 && in[point+2] < 'f' + 1) fg = in[point+2] - 'a' + 10; point += 4; if(bg != -1) { if(bg>7) { bg -= 8; if(fg != -1) fg += BLINK; } textbackground(bg); randombg=0; } if(fg != -1) { textcolor(fg); randomfg=0; } else if(fg == -1 && bg == -1) { srand(in[point-4]*in[point]*235 + 421410297); } goto hi; } if(randomfg) textcolor(random(15) + 1); if(randombg) textbackground(random(7) +1); cprintf("%c",in[point]); point += 1; }while(in[point]); } void stripstr(char *in, char *out) { int inpoint = 0; int outpoint = 0; do { second: if(in[inpoint] == '@'){ if(in[inpoint+3] == '@') inpoint += 4; // @XX@ else if(in[inpoint+2] == '@') inpoint += 3; // @X@ else if(in[inpoint+4] == '@') inpoint += 5; //@XXX@ else if(in[inpoint+6] == '@' && (in[inpoint+3] == '|' || in[inpoint+3] == ':')) inpoint += 7; else goto nosecond; goto second; } nosecond: out[outpoint++] = in[inpoint++]; out[outpoint] = 0; } while(in[inpoint]); }