+void c_printf (char *format, ... )
+{
+ char buffer[BUFSIZ]; /* Well, BUFSIZ is from ncurses... */
+ va_list argp;
+ va_start(argp,format);
+ vsprintf(buffer,format,argp);
+ va_end(argp);
+#ifdef SERGEEV
+ waddstr(conio_scr,buffer);
+#else
+ proutn(buffer);
+#endif /* SERGEEV */
+}
+
+void cgetline(char *line, int max) {
+ if (curses) {
+#ifndef SERGEEV
+ wgetnstr(stdscr, line, max);
+ wrefresh(stdscr);
+#else /* SERGEEV */
+ line[0]=max-1;
+ cgets(line);
+ memmove(line,&line[2],max-3);
+#endif /* SERGEEV */
+ } else {
+ fgets(line, max, stdin);
+ line[strlen(line)-1] = '\0';
+ }
+}
+
+void setwnd(short wndnum){
+/* change windows -- OK for this to be a no-op in tty mode */
+#ifdef SERGEEV
+ int cury;
+ cury=wherey()+wnds[curwnd].wndtop-wnds[wndnum].wndtop;
+ if ((curwnd==FULLSCREEN_WINDOW)&&(wndnum!=FULLSCREEN_WINDOW)) clrscr();
+ window(wnds[wndnum].wndleft, wnds[wndnum].wndtop, wnds[wndnum].wndright, wnds[wndnum].wndbottom);
+ if ((curwnd==wndnum)&&(cury>wnds[wndnum].wndbottom-wnds[wndnum].wndtop+1)){
+ gotoxy(wnds[wndnum].wndright-wnds[wndnum].wndleft+1,wnds[wndnum].wndbottom-wnds[wndnum].wndtop+1);
+ skip(1);
+ }
+ curwnd=wndnum;
+ gotoxy(1,cury);
+#endif /* SERGEEV */
+}
+
+void commandhook(char *cmd, int before) {
+}
+
+/*
+ * Things past this point have policy implications.
+ */
+
+void drawmaps(short l) {
+/* hook to be called after moving to redraw maps */
+#ifdef SERGEEV
+ _setcursortype(_NOCURSOR);
+ if (l==1) sensor();
+ if (l!=2) setwnd(LEFTUPPER_WINDOW);
+ gotoxy(1,1);
+ enqueue("s");
+ srscan(SCAN_FULL);
+ if (l!=2){
+ setwnd(SRSCAN_WINDOW);
+ clrscr();
+ srscan(SCAN_NO_LEFTSIDE);
+ setwnd(LRSCAN_WINDOW);
+ clrscr();
+ enqueue("l");
+ lrscan();
+ _setcursortype(_NORMALCURSOR);
+ }
+#endif /* SERGEEV */
+}
+
+void boom(int ii, int jj)
+/* enemy fall down, go boom */
+{
+#ifdef SERGEEV
+ int crx, cry;
+ crx=wherex();
+ cry=wherey();
+ setwnd(LEFTUPPER_WINDOW);
+ drawmaps(2);
+ gotoxy(jj*2+3,ii+2);
+ highvideo();
+ proutn("%c", game.quad[ii][jj]);
+ gotoxy(wherex()-1,wherey());
+ sound(500);
+ delay(1000);
+ nosound();
+ lowvideo();
+ proutn("%c", game.quad[ii][jj]);
+ setwnd(LOWER_WINDOW);
+ gotoxy(crx,cry);
+ _setcursortype(_NORMALCURSOR);
+ delay(500);
+#endif /* SERGEEV */
+}
+