This software may be copied and distributed for educational, research, and
not for profit purposes provided that this copyright and statement are
included in all such copies. */
/* This I/O module doesn't need PCcurses. You may also need to make some
changes to ms_misc.c. */
void shell_out(void){
char *comspec;
#ifndef __TURBOC__
char key;
int val;
char *str;
#endif /* __TURBOC__ */
save_screen();
clear_screen();
puts("[Entering DOS shell, type exit to return to game.]");
msdos_noraw();
ignore_signals();
if((comspec=getenv("COMSPEC")) ==NULL ||
spawnl(P_WAIT,comspec,comspec,(char *)NULL)<0){
puts("Sorry, there seems to be a problem with shell_out()");
printf("comspec = %s\n",comspec);
flush();
puts("Hit a key to continue");
while(!kbhit())
;
}
restore_signals();
restore_screen();
}
void clear_screen(void){
window(1,1,COLS,LINES);
/*
I think later I might want to define seperate windows, so the above line
is definsive code.
*/
clrscr();
}
int get_com(char *prompt,char *command){
int res;
if(prompt)
prt(prompt,0,0);
*command=inkey();
if(*command==ESCAPE)
res=FALSE;
else
res=TRUE;
erase_line(MSG_LINE,0);
return(res);
}
void bell(void){
if (! sound_beep_flag)
return;
putch('\007');
}
/* the rest is just modified -ev- */
/* definitions used by screen_map() */
/* index into border character array */
#define TL 0 /* top left */
#define TR 1
#define BL 2
#define BR 3
#define HE 4 /* horizontal edge */
#define VE 5
/* character set to use */
# define CH(x) (screen_border[1][x])
/* Display highest priority object in the RATIO by RATIO area */
#define RATIO 3
save_screen();
clear_screen();
prntscrnbuf[0] = CH(TL);
for (i = 0; i < MAX_WIDTH / RATIO; i++)
prntscrnbuf[i+1] = CH(HE);
prntscrnbuf[++i] = CH(TR);
prntscrnbuf[++i] = '\0';
put_buffer(prntscrnbuf, 0, 0);
orow = -1;
map[MAX_WIDTH / RATIO] = '\0';
for (i = 0; i < MAX_HEIGHT; i++) {
row = i / RATIO;
if (row != orow) {
if (orow >= 0) {
sprintf(prntscrnbuf,"%c%s%c",CH(VE), map, CH(VE));
put_buffer(prntscrnbuf,orow+1,0);
}
for (j = 0; j < MAX_WIDTH / RATIO; j++)
map[j] = ' ';
orow = row;
}
for (j = 0; j < MAX_WIDTH; j++) {
col = j / RATIO;
tmp = loc_symbol(i, j);
if (priority[map[col]] < priority[tmp])
map[col] = tmp;
if (map[col] == '@') {
mycol = col + 1; /* account for border */
myrow = row + 1;
}
}
}
if (orow >= 0) {
sprintf(prntscrnbuf,"%c%s%c",CH(VE), map, CH(VE));
put_buffer(prntscrnbuf,orow+1,0);
}
prntscrnbuf[0] = CH(BL);
for (i = 0; i < MAX_WIDTH / RATIO; i++)
prntscrnbuf[i+1] = CH(HE);
prntscrnbuf[++i] = CH(BR);
prntscrnbuf[++i] = '\0';
put_buffer(prntscrnbuf, orow+2, 0);
put_buffer("Hit any key to continue",23,23);
if (mycol > 0)
gotoxy(mycol+1, myrow+1);
inkey();
restore_screen();
}
void pause_exit(int prt_line, int delay)
{
char dummy;
#ifdef __TURBOC__
/* Otherwise, TURBO C complains that delay is never used. */
dummy = (char) delay;
#endif
prt("[Press any key to continue, or Q to exit.]", prt_line, 10);
dummy = inkey();
if (dummy == 'Q')
{
erase_line(prt_line, 0);
exit_game();
}
erase_line(prt_line, 0);
}
void pause_line(int prt_line)
{
prt("[Press any key to continue.]", prt_line, 23);
(void) inkey();
erase_line(prt_line, 0);
}