int startupmenu(int i) { while (1) { drawbox(5, STARTUP_Y-2, 22, STARTUP_N+4, NULL); printmenuhelp(19); i = startup_menu(i-1, 8, STARTUP_Y); # ifndef TTY_SOCKET if (!i) break; # else if (i==2 && !select_2p_tty(24, STARTUP_Y+1)) continue; if (!i) { clearbox(0, 6, 0, 16); if ((i = menu_checkinvit(1, 7)) == -1) { i = 1; continue; } if (!i) break; } setcurs_end(); cleartoeol(); textgfx_entermenu(); # endif clearbox(0, 6, 0, 16); break; } return i; }
void sbbs_t::redrwstr(char *strin, int i, int l, long mode) { cursor_left(i); if(mode&K_MSG) bprintf("%-*.*s",l,l,strin); else column+=rprintf("%-*.*s",l,l,strin); cleartoeol(); if(i<l) cursor_left(l-i); }
int gamemenu() { int i = 0; #ifdef TWOPLAYER int y = 7; while (1) { if (!TWOPLAYER_MODE) { if (term_height >= 23) show_hiscorelist5(5, GAMEMENU_LENGTH+9, 0); } else if (term_height < 23) { setcurs(1, 4); cleartoeol(); y = 5; } i = game_menu(0, 1, y); if (i != 4) break; wclrtobot(window); inputsetup_box(0, 1, 7); } if (!i) { setcurs(1, 4); wclrtobot(window); print_vitetris_ver(19, 4); } #else while (1) { printmenuhelp(19); i = game_menu(i, 1, 7); if (!i) break; clearbox(0, 7, 0, GAMEMENU_LENGTH); if (i != 4 && i < GAMEMENU_LENGTH-1) break; wclrtobot(window); switch (i) { case 4: inputsetup_box(0, 1, 7); i = 0; continue; case GAMEMENU_LENGTH-1: optionsmenu(); break; default: hiscorelist(); } i--; } #endif return i; }
static void print_top_scores() { char s[8]; const struct hiscore *hs = hiscores; int pos = 0; int i = 1; if (term_width < 47 || !hs[0].score) return; setwcurs(WIN_TOP_SCORES, 0, 0); setcolorpair(MAGENTA_FG); printstr("Top Scores"); setattr_normal(); while (hs->score && i <= 5) { newln(0); if (!pos && player1.score > hs->score) { hiscoreline(); pos = 1; continue; } putch(i+'0'); putch('.'); if (hs->score < 1000000) putch(' '); sprintf(s, "%06ld", (long) hs->score); printstr(s); hs++; i++; } if (!pos) { newln(0); if (ishiscore()) hiscoreline(); else cleartoeol(); } refreshwin(WIN_TOP_SCORES); }
static void help_alt_enter() { setcurs(2, 19); printstr("ALT-ENTER toggles fullscreen"); cleartoeol(); }
void sbbs_t::ctrl_a(char x) { char tmp1[128],atr=curatr; struct tm tm; if(x && (uchar)x<=CTRL_Z) { /* Ctrl-A through Ctrl-Z for users with MF only */ if(!(useron.flags1&FLAG(x+64))) console^=(CON_ECHO_OFF); return; } if((uchar)x>0x7f) { cursor_right((uchar)x-0x7f); return; } switch(toupper(x)) { case '!': /* level 10 or higher */ if(useron.level<10) console^=CON_ECHO_OFF; break; case '@': /* level 20 or higher */ if(useron.level<20) console^=CON_ECHO_OFF; break; case '#': /* level 30 or higher */ if(useron.level<30) console^=CON_ECHO_OFF; break; case '$': /* level 40 or higher */ if(useron.level<40) console^=CON_ECHO_OFF; break; case '%': /* level 50 or higher */ if(useron.level<50) console^=CON_ECHO_OFF; break; case '^': /* level 60 or higher */ if(useron.level<60) console^=CON_ECHO_OFF; break; case '&': /* level 70 or higher */ if(useron.level<70) console^=CON_ECHO_OFF; break; case '*': /* level 80 or higher */ if(useron.level<80) console^=CON_ECHO_OFF; break; case '(': /* level 90 or higher */ if(useron.level<90) console^=CON_ECHO_OFF; break; case ')': /* turn echo back on */ console&=~CON_ECHO_OFF; break; case '+': /* push current attribte */ if(attr_sp<(int)sizeof(attr_stack)) attr_stack[attr_sp++]=curatr; break; case '-': /* pop current attribute OR optimized "normal" */ if(attr_sp>0) attr(attr_stack[--attr_sp]); else /* turn off all attributes if */ if(atr&(HIGH|BLINK|BG_LIGHTGRAY)) /* high intensity, blink or */ attr(LIGHTGRAY); /* background bits are set */ break; case '_': /* turn off all attributes if */ if(atr&(BLINK|BG_LIGHTGRAY)) /* blink or background is set */ attr(LIGHTGRAY); break; case 'P': /* Pause */ pause(); break; case 'Q': /* Pause reset */ lncntr=0; break; case 'T': /* Time */ now=time(NULL); localtime_r(&now,&tm); if(cfg.sys_misc&SM_MILITARY) bprintf("%02u:%02u:%02u" ,tm.tm_hour, tm.tm_min, tm.tm_sec); else bprintf("%02d:%02d %s" ,tm.tm_hour==0 ? 12 : tm.tm_hour>12 ? tm.tm_hour-12 : tm.tm_hour, tm.tm_min, tm.tm_hour>11 ? "pm":"am"); break; case 'D': /* Date */ now=time(NULL); bputs(unixtodstr(&cfg,(time32_t)now,tmp1)); break; case ',': /* Delay 1/10 sec */ mswait(100); break; case ';': /* Delay 1/2 sec */ mswait(500); break; case '.': /* Delay 2 secs */ mswait(2000); break; case 'S': /* Synchronize */ ASYNC; break; case 'L': /* CLS (form feed) */ CLS; break; case '>': /* CLREOL */ cleartoeol(); break; case '<': /* Non-destructive backspace */ outchar(BS); break; case '[': /* Carriage return */ outchar(CR); break; case ']': /* Line feed */ outchar(LF); break; case 'A': /* Ctrl-A */ outchar(CTRL_A); break; case 'H': /* High intensity */ atr|=HIGH; attr(atr); break; case 'I': /* Blink */ atr|=BLINK; attr(atr); break; case 'N': /* Normal */ attr(LIGHTGRAY); break; case 'R': atr=(atr&0xf8)|RED; attr(atr); break; case 'G': atr=(atr&0xf8)|GREEN; attr(atr); break; case 'B': atr=(atr&0xf8)|BLUE; attr(atr); break; case 'W': /* White */ atr=(atr&0xf8)|LIGHTGRAY; attr(atr); break; case 'C': atr=(atr&0xf8)|CYAN; attr(atr); break; case 'M': atr=(atr&0xf8)|MAGENTA; attr(atr); break; case 'Y': /* Yellow */ atr=(atr&0xf8)|BROWN; attr(atr); break; case 'K': /* Black */ atr=(atr&0xf8)|BLACK; attr(atr); break; case '0': /* Black Background */ atr=(atr&0x8f); attr(atr); break; case '1': /* Red Background */ atr=(atr&0x8f)|(uchar)BG_RED; attr(atr); break; case '2': /* Green Background */ atr=(atr&0x8f)|(uchar)BG_GREEN; attr(atr); break; case '3': /* Yellow Background */ atr=(atr&0x8f)|(uchar)BG_BROWN; attr(atr); break; case '4': /* Blue Background */ atr=(atr&0x8f)|(uchar)BG_BLUE; attr(atr); break; case '5': /* Magenta Background */ atr=(atr&0x8f)|(uchar)BG_MAGENTA; attr(atr); break; case '6': /* Cyan Background */ atr=(atr&0x8f)|(uchar)BG_CYAN; attr(atr); break; case '7': /* White Background */ atr=(atr&0x8f)|(uchar)BG_LIGHTGRAY; attr(atr); break; } }
void sbbs_t::clearline(void) { outcom(CR); column=0; cleartoeol(); }