/* * Alternate saver that got its inspiration from a well known utility * package for an inferior^H^H^H^H^H^Hfamous OS. */ static int star_saver(video_adapter_t *adp, int blank) { sc_softc_t *sc; scr_stat *scp; int cell, i; static u_char pattern[] = {"...........++++*** "}; static char color16[] = {FG_DARKGREY, FG_LIGHTGREY, FG_WHITE, FG_LIGHTCYAN}; static char color8[] = {FG_BLUE, FG_BROWN, FG_LIGHTGREY, FG_CYAN}; static char *colors; static u_short stars[NUM_STARS][2]; sc = sc_find_softc(adp, NULL); if (sc == NULL) return EAGAIN; scp = sc->cur_scp; if (blank) { if (adp->va_info.vi_flags & V_INFO_GRAPHICS) return EAGAIN; if (!blanked) { switch (adp->va_mode) { case M_PC98_80x25: case M_PC98_80x30: colors = color8; break; default: colors = color16; break; } /* clear the screen and set the border color */ sc_vtb_clear(&scp->scr, sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8); vidd_set_hw_cursor(adp, -1, -1); sc_set_border(scp, 0); blanked = TRUE; for(i=0; i<NUM_STARS; i++) { stars[i][0] = random() % (scp->xsize*scp->ysize); stars[i][1] = 0; } } cell = random() % NUM_STARS; sc_vtb_putc(&scp->scr, stars[cell][0], sc->scr_map[pattern[stars[cell][1]]], colors[random()%sizeof(color16)] << 8); if ((stars[cell][1]+=(random()%4)) >= sizeof(pattern)-1) { stars[cell][0] = random() % (scp->xsize*scp->ysize); stars[cell][1] = 0; } } else blanked = FALSE; return 0; }
static void draw_string(sc_softc_t *sc, int xpos, int ypos, int xoff, u_char *s, int len) { int x; for (x = xoff; x < len; x++) sc_vtb_putc(&sc->cur_scp->scr, ypos*sc->cur_scp->xsize + xpos + x, sc->scr_map[s[x]], ATTR(FG_LIGHTGREEN | BG_BLACK)); }
static void draw_daemon(sc_softc_t *sc, int xpos, int ypos, int dxdir, int xoff, int yoff, int xlen, int ylen) { int x, y; int px; int attr; for (y = yoff; y < ylen; y++) { if (dxdir < 0) px = xoff; else px = DAEMON_MAX_WIDTH - xlen; if (px >= strlen(daemon_pic[y])) continue; for (x = xoff; (x < xlen) && (daemon_pic[y][px] != '\0'); x++, px++) { switch (daemon_attr[y][px]) { case 'R': attr = FG_LIGHTRED | BG_BLACK; break; case 'Y': attr = FG_YELLOW | BG_BLACK; break; case 'B': attr = FG_LIGHTBLUE | BG_BLACK; break; case 'W': attr = FG_LIGHTGREY | BG_BLACK; break; case 'C': attr = FG_CYAN | BG_BLACK; break; default: attr = FG_WHITE | BG_BLACK; break; } if (dxdir < 0) { /* Moving left */ sc_vtb_putc(&sc->cur_scp->scr, (ypos + y)*sc->cur_scp->xsize + xpos + x, sc->scr_map[daemon_pic[y][px]], ATTR(attr)); } else { /* Moving right */ sc_vtb_putc(&sc->cur_scp->scr, (ypos + y)*sc->cur_scp->xsize + xpos + DAEMON_MAX_WIDTH - px - 1, sc->scr_map[xflip_symbol(daemon_pic[y][px])], ATTR(attr)); } } } }
static void draw_text_splash(sc_softc_t *sc) { u_int x, y; u_char ch, attr; u_char *pdata = txt_decoder.data; /* Init failed. */ if (txt_decoder.data == NULL) return; for (y = 0; y < BIN_IMAGE_HEIGHT; y++) { for (x = 0; x < BIN_IMAGE_WIDTH; x++) { ch = *pdata++; attr = *pdata++; sc_vtb_putc(&sc->cur_scp->scr, (y * sc->cur_scp->xsize) + x, sc->scr_map[ch], (int)attr << 8); } } }
static int snake_saver(video_adapter_t *adp, int blank) { static int dirx, diry; int f; sc_softc_t *sc; scr_stat *scp; /* XXX hack for minimal changes. */ #define save message #define savs messagep sc = sc_find_softc(adp, NULL); if (sc == NULL) return EAGAIN; scp = sc->cur_scp; if (blank) { if (adp->va_info.vi_flags & V_INFO_GRAPHICS) return EAGAIN; if (blanked <= 0) { #ifdef PC98 if (epson_machine_id == 0x20) { outb(0x43f, 0x42); outb(0x0c17, inb(0xc17) & ~0x08); outb(0x43f, 0x40); } #endif /* PC98 */ sc_vtb_clear(&scp->scr, sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8); (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); sc_set_border(scp, 0); dirx = (scp->xpos ? 1 : -1); diry = (scp->ypos ? scp->xsize : -scp->xsize); for (f=0; f< messagelen; f++) savs[f] = scp->xpos + scp->ypos*scp->xsize; sc_vtb_putc(&scp->scr, savs[0], sc->scr_map[*save], (FG_LIGHTGREY | BG_BLACK) << 8); blanked = 1; } if (blanked++ < 4) return 0; blanked = 1; sc_vtb_putc(&scp->scr, savs[messagelen - 1], sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8); for (f=messagelen-1; f > 0; f--) savs[f] = savs[f-1]; f = savs[0]; if ((f % scp->xsize) == 0 || (f % scp->xsize) == scp->xsize - 1 || (random() % 50) == 0) dirx = -dirx; if ((f / scp->xsize) == 0 || (f / scp->xsize) == scp->ysize - 1 || (random() % 20) == 0) diry = -diry; savs[0] += dirx + diry; for (f=messagelen-1; f>=0; f--) sc_vtb_putc(&scp->scr, savs[f], sc->scr_map[save[f]], (FG_LIGHTGREY | BG_BLACK) << 8); } else { #ifdef PC98 if (epson_machine_id == 0x20) { outb(0x43f, 0x42); outb(0x0c17, inb(0xc17) | 0x08); outb(0x43f, 0x40); } #endif /* PC98 */ blanked = 0; } return 0; }
/* * Alternate saver that got its inspiration from a well known utility * package for an inferior^H^H^H^H^H^Hfamous OS. */ static int star_saver(video_adapter_t *adp, int blank) { sc_softc_t *sc; scr_stat *scp; int cell, i; static u_char pattern[] = {"...........++++*** "}; #ifndef PC98 static char colors[] = {FG_DARKGREY, FG_LIGHTGREY, FG_WHITE, FG_LIGHTCYAN}; #else static char colors[] = {FG_BLUE, FG_LIGHTGREY, FG_LIGHTGREY, FG_CYAN}; #endif /* PC98 */ static u_short stars[NUM_STARS][2]; sc = sc_find_softc(adp, NULL); if (sc == NULL) return EAGAIN; scp = sc->cur_scp; if (blank) { if (adp->va_info.vi_flags & V_INFO_GRAPHICS) return EAGAIN; if (!blanked) { #ifdef PC98 if (epson_machine_id == 0x20) { outb(0x43f, 0x42); outb(0x0c17, inb(0xc17) & ~0x08); outb(0x43f, 0x40); } #endif /* PC98 */ /* clear the screen and set the border color */ sc_vtb_clear(&scp->scr, sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8); (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); sc_set_border(scp, 0); blanked = TRUE; for(i=0; i<NUM_STARS; i++) { stars[i][0] = random() % (scp->xsize*scp->ysize); stars[i][1] = 0; } } cell = random() % NUM_STARS; sc_vtb_putc(&scp->scr, stars[cell][0], sc->scr_map[pattern[stars[cell][1]]], colors[random()%sizeof(colors)] << 8); if ((stars[cell][1]+=(random()%4)) >= sizeof(pattern)-1) { stars[cell][0] = random() % (scp->xsize*scp->ysize); stars[cell][1] = 0; } } else { #ifdef PC98 if (epson_machine_id == 0x20) { outb(0x43f, 0x42); outb(0x0c17, inb(0xc17) | 0x08); outb(0x43f, 0x40); } #endif /* PC98 */ blanked = FALSE; } return 0; }