/** Main function. */ int main( ) { char ch; int run = 1; clrscr( ); dispmenu( ); /* Loop for keyboard input. */ do { /* Get keyboard input character. */ ch = getch( ); gotoxy( 24, 17 ); switch ( ch ) { case '1': if ( spawnlp( P_WAIT, "RWMAIN.COM", "RWMAIN.COM", NULL ) == -1 ) { puts( "Cannot find file : RWMAIN.COM" ); getch( ); } clrscr( ); dispmenu( ); break; case '2': if ( spawnlp( P_WAIT, "NLQ.EXE", "NLQ.EXE", NULL ) == -1 ) { puts( " Cannot find file : NLQ.EXE " ); getch( ); } clrscr( ); dispmenu( ); break; case '3': puts( " Not implemented. " ); getch( ); clrscr( ); dispmenu( ); break; case '4': case 27: /* escape key */ run = 0; break; default: puts( " Please select number 1-4 " ); } gotoxy( 20, 19 ); } while ( run ); exit( 0 ); }
int display () { int widthbufmin; int heightbufmin; int widthbufmax; int heightbufmax; if((unsigned)time(NULL) == lastframetime) if(stuffdone == 0) return 0; lastframetime = (unsigned)time(NULL); stuffdone = 0; if(dbug) wprintw(special[3], "display has been called\n"); if(showmenu == TRUE) { dispmenu(); } clear(); if(LINES != self.config.screenheight) { delwin(special[2]); delwin(special[3]); special[4] = derwin(stdscr, 1, 0, LINES - 3, 0); special[2] = derwin(stdscr, 1, 0, LINES - 2, 0); special[3] = derwin(stdscr, 1, 0, LINES - 1, 0); scrollok(special[2], FALSE); scrollok(special[3], TRUE); scrollok(special[4], FALSE); self.config.screenheight = LINES; self.config.halfscreenheight = (self.config.screenheight / 2) - 2; self.config.screenwidth = COLS - 4; self.config.halfscreenwidth = self.config.screenwidth / 2; } widthbufmin = self.x - self.config.halfscreenwidth; heightbufmin = self.y - self.config.halfscreenheight; widthbufmax = self.x + self.config.halfscreenwidth; heightbufmax = self.y + self.config.halfscreenheight; wprintw(stdscr, "\n\n"); for(dispmapruny = heightbufmin; dispmapruny < heightbufmax; dispmapruny++) { for(dispmaprunx = widthbufmin; dispmaprunx < widthbufmax; dispmaprunx++) { if((dispmaprunx < 0) || (dispmapruny < 0)) { wprintw(stdscr, " "); goto endloop; } else { if((dispmaprunx == self.x) && (dispmapruny == self.y)) { if(self.face == 'u') wprintw(stdscr, "%c",self.config.letteru); if(self.face == 'd') wprintw(stdscr, "%c",self.config.letterd); if(self.face == 'l') wprintw(stdscr, "%c",self.config.letterl); if(self.face == 'r') wprintw(stdscr, "%c",self.config.letterr); } else { wprintw(stdscr, "%c",currmap.map[dispmaprunx][dispmapruny]); } } endloop:; } wprintw(stdscr, "\n"); } for(dispmaprunx = 0; dispmaprunx < 20; dispmaprunx++){ mvwprintw(special[0], 0, dispmaprunx,"%c", currmap.mapname[dispmaprunx]); } refresh(); return 0; };