static int print_doc_msg_func(int pnum, int num_pages) { char temp[10]; int key; if ( pnum == -1 ) /* successful completion */ { static FCODE msg[] = {"Done -- Press any key"}; buzzer(0); putstringcenter(7, 0, 80, C_HELP_LINK, msg); getakey(); return (0); } if ( pnum == -2 ) /* aborted */ { static FCODE msg[] = {"Aborted -- Press any key"}; buzzer(1); putstringcenter(7, 0, 80, C_HELP_LINK, msg); getakey(); return (0); } if (pnum == 0) /* initialization */ { static FCODE msg[] = {"Generating FRACTINT.DOC"}; helptitle(); printinstr(); setattr(2, 0, C_HELP_BODY, 80*22); putstringcenter(1, 0, 80, C_HELP_HDG, msg); putstring(7, 30, C_HELP_BODY, "Completed:"); movecursor(25,80); /* hide cursor */ } sprintf(temp, "%d%%", (int)( (100.0 / num_pages) * pnum ) ); putstring(7, 41, C_HELP_LINK, temp); while ( keypressed() ) { key = getakey(); if ( key == ESC ) return (0); /* user abort */ } return (1); /* AOK -- continue */ }
static void display_page(char far *title, char far *text, unsigned text_len, int page, int num_pages, int start_margin, int *num_link, LINK far *link) { char temp[9]; helptitle(); helpinstr(); setattr(2, 0, C_HELP_BODY, 80*22); putstringcenter(1, 0, 80, C_HELP_HDG, title); sprintf(temp, "%2d of %d", page+1, num_pages); #ifndef XFRACT putstring(1, 79-(6 + ((num_pages>=10)?2:1)), C_HELP_INSTR, temp); #else /* Some systems (Ultrix) mess up if you write to column 80 */ putstring(1, 78-(6 + ((num_pages>=10)?2:1)), C_HELP_INSTR, temp); #endif if (text != NULL) display_parse_text(text, text_len, start_margin, num_link, link); movecursor(25, 80); /* hide cursor */ }
void intro() { // following overlayed data safe if "putstrings" are resident static char PRESS_ENTER[] = {"Press ENTER for main menu, F1 for help."}; int toprow, botrow, delaymax; char oldchar; std::vector<int> authors; char credits[32768] = { 0 }; char screen_text[32768]; int old_look_at_mouse; g_timer_start -= std::clock(); // "time out" during help old_look_at_mouse = g_look_at_mouse; help_labels const old_help_mode = g_help_mode; g_look_at_mouse = 0; // de-activate full mouse checking int i = 32767 + read_help_topic(help_labels::INTRO_AUTHORS, 0, 32767, screen_text); screen_text[i] = '\0'; i = 32767 + read_help_topic(help_labels::INTRO_CREDITS, 0, 32767, credits); credits[i] = '\0'; int j = 0; authors.push_back(0); // find the start of each credit-line for (i = 0; credits[i] != 0; i++) { if (credits[i] == '\n') { authors.push_back(i+1); } } authors.push_back(i); helptitle(); #define END_MAIN_AUTHOR 5 toprow = END_MAIN_AUTHOR+1; botrow = 21; putstringcenter(1, 0, 80, C_TITLE, PRESS_ENTER); driver_put_string(2, 0, C_CONTRIB, screen_text); driver_set_attr(2, 0, C_AUTHDIV1, 80); driver_set_attr(END_MAIN_AUTHOR, 0, C_AUTHDIV1, 80); driver_set_attr(22, 0, C_AUTHDIV2, 80); driver_set_attr(3, 0, C_PRIMARY, 80*(END_MAIN_AUTHOR-3)); driver_set_attr(23, 0, C_TITLE_LOW, 160); for (int i = 3; i < END_MAIN_AUTHOR; ++i) { driver_set_attr(i, 21, C_CONTRIB, 58); } driver_set_attr(toprow, 0, C_CONTRIB, (21-END_MAIN_AUTHOR)*80); srand((unsigned int)std::clock()); j = rand()%(j-(botrow-toprow)); // first to use i = j+botrow-toprow; // last to use oldchar = credits[authors.at(i+1)]; credits[authors.at(i+1)] = 0; driver_put_string(toprow, 0, C_CONTRIB, credits+authors.at(j)); credits[authors.at(i+1)] = oldchar; delaymax = 10; driver_hide_text_cursor(); g_help_mode = help_labels::HELPMENU; while (! driver_key_pressed()) { if (slowdisplay) { delaymax *= 15; } for (j = 0; j < delaymax && !(driver_key_pressed()); j++) { driver_delay(100); } if (driver_key_pressed() == FIK_SPACE) { // spacebar pauses driver_get_key(); driver_wait_key_pressed(0); if (driver_key_pressed() == FIK_SPACE) { driver_get_key(); } } delaymax = 15; driver_scroll_up(toprow, botrow); i++; if (credits[authors.at(i)] == 0) { i = 0; } oldchar = credits[authors.at(i+1)]; credits[authors.at(i+1)] = 0; driver_put_string(botrow, 0, C_CONTRIB, &credits[authors.at(i)]); driver_set_attr(botrow, 0, C_CONTRIB, 80); credits[authors.at(i+1)] = oldchar; driver_hide_text_cursor(); // turn it off } g_look_at_mouse = old_look_at_mouse; // restore the mouse-checking g_help_mode = old_help_mode; }
void intro() { // following overlayed data safe if "putstrings" are resident #ifdef XFRACT static char PRESS_ENTER[] = {"Press ENTER for main menu, Shift-1 for help."}; #else static char PRESS_ENTER[] = {"Press ENTER for main menu, F1 for help."}; #endif int toprow, botrow, delaymax; char oldchar; std::vector<int> authors; char credits[32768] = { 0 }; char screen_text[32768]; int oldlookatmouse; int oldhelpmode; timer_start -= clock_ticks(); // "time out" during help oldlookatmouse = lookatmouse; oldhelpmode = helpmode; lookatmouse = 0; // de-activate full mouse checking int i = 32767 + read_help_topic(INTRO_AUTHORS, 0, 32767, screen_text); screen_text[i++] = '\0'; i = 32767 + read_help_topic(INTRO_CREDITS, 0, 32767, credits); credits[i++] = '\0'; int j = 0; authors.push_back(0); // find the start of each credit-line for (i = 0; credits[i] != 0; i++) if (credits[i] == 10) authors.push_back(i+1); authors.push_back(i); helptitle(); #define END_MAIN_AUTHOR 5 toprow = END_MAIN_AUTHOR+1; #ifndef XFRACT botrow = 21; #else botrow = 20; putstringcenter(21, 0, 80, C_TITLE, "Unix/X port of fractint by Ken Shirriff"); #endif putstringcenter(1, 0, 80, C_TITLE, PRESS_ENTER); driver_put_string(2, 0, C_CONTRIB, screen_text); driver_set_attr(2, 0, C_AUTHDIV1, 80); driver_set_attr(END_MAIN_AUTHOR, 0, C_AUTHDIV1, 80); driver_set_attr(22, 0, C_AUTHDIV2, 80); driver_set_attr(3, 0, C_PRIMARY, 80*(END_MAIN_AUTHOR-3)); driver_set_attr(23, 0, C_TITLE_LOW, 160); for (int i = 3; i < END_MAIN_AUTHOR; ++i) driver_set_attr(i, 21, C_CONTRIB, 58); driver_set_attr(toprow, 0, C_CONTRIB, (21-END_MAIN_AUTHOR)*80); srand((unsigned int)clock_ticks()); j = rand()%(j-(botrow-toprow)); // first to use i = j+botrow-toprow; // last to use oldchar = credits[authors.at(i+1)]; credits[authors.at(i+1)] = 0; driver_put_string(toprow, 0, C_CONTRIB, credits+authors.at(j)); credits[authors.at(i+1)] = oldchar; delaymax = 10; driver_hide_text_cursor(); helpmode = HELPMENU; while (! driver_key_pressed()) { #ifdef XFRACT if (slowdisplay) delaymax *= 15; #endif for (j = 0; j < delaymax && !(driver_key_pressed()); j++) driver_delay(100); if (driver_key_pressed() == FIK_SPACE) { // spacebar pauses driver_get_key(); driver_wait_key_pressed(0); if (driver_key_pressed() == FIK_SPACE) driver_get_key(); } delaymax = 15; driver_scroll_up(toprow, botrow); i++; if (credits[authors.at(i)] == 0) i = 0; oldchar = credits[authors.at(i+1)]; credits[authors.at(i+1)] = 0; driver_put_string(botrow, 0, C_CONTRIB, &credits[authors.at(i)]); driver_set_attr(botrow, 0, C_CONTRIB, 80); credits[authors.at(i+1)] = oldchar; driver_hide_text_cursor(); // turn it off } lookatmouse = oldlookatmouse; // restore the mouse-checking helpmode = oldhelpmode; return; }