void TXT_DrawASCIITable(void) { unsigned char *screendata; char buf[10]; int x, y; int n; screendata = TXT_GetScreenData(); TXT_FGColor(TXT_COLOR_BRIGHT_WHITE); TXT_BGColor(TXT_COLOR_BLACK, 0); for (y=0; y<16; ++y) { for (x=0; x<16; ++x) { n = y * 16 + x; TXT_GotoXY(x * 5, y); sprintf(buf, "%02x ", n); TXT_Puts(buf); // Write the character directly to the screen memory buffer: screendata[(y * TXT_SCREEN_W + x * 5 + 3) * 2] = n; } } TXT_UpdateScreen(); }
void TXT_PutChar(int c) { unsigned char *screen; screen = TXT_GetScreenData(); PutChar(screen, c); }
void I_Endoom(void) { #ifndef GCONSOLE // I will return to this -- Hyper_Eye unsigned char *endoom_data; unsigned char *screendata; int y; int indent; // Hack to stop crash with disk icon in_endoom = true; endoom_data = (unsigned char *)W_CacheLumpName("ENDOOM", PU_STATIC); // Set up text mode screen TXT_Init(); I_SetWindowCaption(); I_SetWindowIcon(); // Write the data to the screen memory screendata = TXT_GetScreenData(); indent = (ENDOOM_W - TXT_SCREEN_W) / 2; for (y=0; y<TXT_SCREEN_H; ++y) { memcpy(screendata + (y * TXT_SCREEN_W * 2), endoom_data + (y * ENDOOM_W + indent) * 2, TXT_SCREEN_W * 2); } // Wait for a keypress while (true) { TXT_UpdateScreen(); if (TXT_GetChar() > 0) break; TXT_Sleep(0); } // Shut down text mode screen TXT_Shutdown(); in_endoom = false; #endif // Hyper_Eye }
void TXT_Puts(const char *s) { unsigned char *screen; const char *p; screen = TXT_GetScreenData(); for (p=s; *p != '\0'; ++p) { PutChar(screen, *p); } PutChar(screen, '\n'); }
void I_Endoom(void) { unsigned char *endoom_data; unsigned char *screendata; int y; int indent; endoom_data = W_CacheLumpName(DEH_String("ENDOOM"), PU_STATIC); // Set up text mode screen TXT_Init(); // Make sure the new window has the right title and icon I_SetWindowCaption(); I_SetWindowIcon(); // Write the data to the screen memory screendata = TXT_GetScreenData(); indent = (ENDOOM_W - TXT_SCREEN_W) / 2; for (y=0; y<TXT_SCREEN_H; ++y) { memcpy(screendata + (y * TXT_SCREEN_W * 2), endoom_data + (y * ENDOOM_W + indent) * 2, TXT_SCREEN_W * 2); } // Wait for a keypress while (true) { TXT_UpdateScreen(); if (TXT_GetChar() > 0) { break; } TXT_Sleep(0); } // Shut down text mode screen TXT_Shutdown(); }
void TXT_ClearScreen(void) { unsigned char *screen; int i; screen = TXT_GetScreenData(); for (i=0; i<TXT_SCREEN_W * TXT_SCREEN_H; ++i) { screen[i * 2] = ' '; screen[i * 2 + 1] = (bgcolor << 4) | fgcolor; } cur_x = 0; cur_y = 0; }
// // I_EndDoom // // killough 2/22/98: Add support for ENDBOOM, which is PC-specific // killough 8/1/98: change back to ENDOOM // haleyjd 10/09/05: ENDOOM emulation thanks to fraggle and // Chocolate DOOM! // void I_EndDoom() { unsigned char *endoom_data; unsigned char *screendata; int start_ms; int lumpnum; // haleyjd: it's possible to have quit before we even initialized // GameModeInfo, so be sure it's valid before using it here. Also, // allow ENDOOM disable in configuration. if(!GameModeInfo || !showendoom) return; if((lumpnum = wGlobalDir.checkNumForName(GameModeInfo->endTextName)) < 0) return; endoom_data = (unsigned char *)wGlobalDir.cacheLumpNum(lumpnum, PU_STATIC); // Set up text mode screen if(!TXT_Init()) return; // Make sure the new window has the right title and icon SDL_WM_SetCaption("Thanks for using the Eternity Engine!", NULL); // Write the data to the screen memory screendata = TXT_GetScreenData(); memcpy(screendata, endoom_data, 4000); // Wait for 10 seconds, or until a keypress or mouse click // haleyjd: delay period specified in config (default = 350) start_ms = i_haltimer.GetTime(); while(i_haltimer.GetTime() < start_ms + endoomdelay) { TXT_UpdateScreen(); if(TXT_GetChar() > 0) break; TXT_Sleep(0); } // Shut down text mode screen TXT_Shutdown(); }
static void DrawDesktopBackground(const char *title) { int i; unsigned char *screendata; unsigned char *p; screendata = TXT_GetScreenData(); // Fill the screen with gradient characters p = screendata; for (i=0; i<TXT_SCREEN_W * TXT_SCREEN_H; ++i) { *p++ = 0xb1; *p++ = TXT_COLOR_GREY | (TXT_COLOR_BLUE << 4); } // Draw the top and bottom banners p = screendata; for (i=0; i<TXT_SCREEN_W; ++i) { *p++ = ' '; *p++ = TXT_COLOR_BLACK | (TXT_COLOR_GREY << 4); } p = screendata + (TXT_SCREEN_H - 1) * TXT_SCREEN_W * 2; for (i=0; i<TXT_SCREEN_W; ++i) { *p++ = ' '; *p++ = TXT_COLOR_BLACK | (TXT_COLOR_GREY << 4); } // Print the title TXT_GotoXY(0, 0); TXT_FGColor(TXT_COLOR_BLACK); TXT_BGColor(TXT_COLOR_GREY, 0); TXT_PutChar(' '); TXT_Puts(title); }
void I_Endoom(byte *endoom_data) { unsigned char *screendata; int y; int indent; // Set up text mode screen TXT_Init(); I_InitWindowTitle(); I_InitWindowIcon(); // Write the data to the screen memory screendata = TXT_GetScreenData(); indent = (ENDOOM_W - TXT_SCREEN_W) / 2; for (y=0; y<TXT_SCREEN_H; ++y) { memcpy(screendata + (y * TXT_SCREEN_W * 2), endoom_data + (y * ENDOOM_W + indent) * 2, TXT_SCREEN_W * 2); } // Wait for a keypress while (true) { TXT_UpdateScreen(); if (TXT_GetChar() > 0) { break; } TXT_Sleep(0); } // Shut down text mode screen TXT_Shutdown(); }
void TXT_DrawSeparator(int x, int y, int w) { unsigned char *data; int x1; int b; data = TXT_GetScreenData(); TXT_FGColor(TXT_COLOR_BRIGHT_CYAN); TXT_BGColor(TXT_WINDOW_BACKGROUND, 0); if (!VALID_Y(y)) { return; } data += (y * TXT_SCREEN_W + x) * 2; for (x1=x; x1<x+w; ++x1) { TXT_GotoXY(x1, y); b = x1 == x ? 0 : x1 == x + w - 1 ? 3 : 1; if (VALID_X(x1)) { // Read the current value from the screen // Check that it matches what the window should look like if // there is no separator, then apply the separator if (*data == borders[1][b]) { TXT_PutChar(borders[2][b]); } } data += 2; } }
void TXT_DrawShadow(int x, int y, int w, int h) { unsigned char *screendata; unsigned char *p; int x1, y1; screendata = TXT_GetScreenData(); for (y1=y; y1<y+h; ++y1) { p = screendata + (y1 * TXT_SCREEN_W + x) * 2; for (x1=x; x1<x+w; ++x1) { if (VALID_X(x1) && VALID_Y(y1)) { p[1] = TXT_COLOR_DARK_GREY; } p += 2; } } }
void TXT_Puts(char *s) { int previous_color = TXT_COLOR_BLACK; unsigned char *screen; char *p; char colorname_buf[20]; char *ending; int col; screen = TXT_GetScreenData(); for (p=s; *p != '\0'; ++p) { if (*p == '<') { ++p; if (*p == '<') { PutChar(screen, '<'); } else { ending = strchr(p, '>'); if (ending == NULL) { return; } strncpy(colorname_buf, p, 19); colorname_buf[ending-p] = '\0'; if (!strcmp(colorname_buf, "/")) { // End of color block col = previous_color; } else { col = GetColorForName(colorname_buf); if (col < 0) { return; } // Save the color for the ending marker previous_color = fgcolor; } TXT_FGColor(col); p = ending; } } else { PutChar(screen, *p); } } PutChar(screen, '\n'); }