void HU_Init(void) { int i; int j; char buffer[9]; // load the heads-up font j = HU_FONTSTART; for (i=0;i<HU_FONTSIZE;i++) { sprintf(buffer, DEH_String("STCFN%.3d"), j++); hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC); } }
// // D_PageDrawer // void D_PageDrawer (void) { if (page) { page->Blit (0, 0, page->width, page->height, screen, 0, 0, screen->width, screen->height); if ((gameinfo.gametype & GAME_Heretic) && demosequence == 1) screen->DrawPatchIndirect((patch_t *)W_CacheLumpName("ADVISOR",PU_CACHE),4,160); } else { screen->Clear (0, 0, screen->width, screen->height, 0); //screen->PrintStr (0, 0, "Page graphic goes here", 22); } }
void I_Endoom(void) { #ifndef GCONSOLE // I will return to this -- Hyper_Eye unsigned char *endoom_data; unsigned char *screendata; int y; int indent; 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(); #endif // Hyper_Eye }
static void OpenScript(const char *name) { SC_Close(); // Lump script ScriptBuffer = (char *)W_CacheLumpName(name); ScriptSize = W_LumpLength(W_GetNumForName(name)); strcpy(ScriptName, name); ScriptPtr = ScriptBuffer; ScriptEndPtr = ScriptPtr + ScriptSize; sc_Line = 1; sc_End = false; ScriptOpen = true; sc_String = StringBuffer; AlreadyGot = false; }
static void DrawPic(void) { memcpy(screen, W_CacheLumpNum(FinaleLumpNum, PU_CACHE), SCREENWIDTH*SCREENHEIGHT); if(FinaleStage == 4 || FinaleStage == 5) { // Chess pic, draw the correct character graphic if(netgame) { V_DrawPatch(20, 0, W_CacheLumpName("chessall", PU_CACHE)); } else if(PlayerClass[consoleplayer]) { V_DrawPatch(60, 0, W_CacheLumpNum(W_GetNumForName("chessc") +PlayerClass[consoleplayer]-1, PU_CACHE)); } } }
// // M_SaveGame & Cie. // [ML] 7 Sept 08: Bringing game saving/loading in from // zdoom 1.22 source, see MAINTAINERS // void M_DrawSave(void) { int i; screen->DrawPatchClean ((patch_t *)W_CacheLumpName("M_SAVEG",PU_CACHE), 72, 28); for (i = 0; i < load_end; i++) { M_DrawSaveLoadBorder(LoadDef.x,LoadDef.y+LINEHEIGHT*i,24); screen->DrawTextCleanMove (CR_RED, LoadDef.x, LoadDef.y+LINEHEIGHT*i, savegamestrings[i]); } if (genStringEnter) { i = V_StringWidth(savegamestrings[saveSlot]); screen->DrawTextCleanMove (CR_RED, LoadDef.x + i, LoadDef.y+LINEHEIGHT*saveSlot, "_"); } }
// // Draw character quit prompt // void FE_DrawChar(void) { char msg[128]; if(!curCharacter) return; V_DrawPatch(0, 0, W_CacheLumpName(curCharacter->pic, PU_CACHE)); M_WriteText(12, 18, curCharacter->name); M_StringCopy(msg, curCharacter->text, sizeof(msg)); M_DialogDimMsg(20, 28, msg, false); M_WriteText(20, 28, msg); FE_WriteSmallTextCentered(160, "Are you sure you want to quit?"); FE_WriteSmallTextCentered(172, "(Press Y or confirm to quit)"); }
// // Main Console functions // // ticker, responder, drawer, init etc. // void C_InitBackdrop(void) { patch_t *patch; switch(gamemode) { case retail: case registered: lumpname = "PFUB1"; break; case shareware: lumpname = "WIMAP0"; break; case commercial: lumpname = "INTERPIC"; break; default: lumpname = "TITLEPIC"; break; } // allow for custom console background graphic if(W_CheckNumForName("CONSOLE") >= 0) lumpname = "CONSOLE"; backdrop_lumpnum = W_GetNumForName(lumpname); if(backdrop) Z_Free(backdrop); backdrop = Z_Malloc(SCREENWIDTH * SCREENHEIGHT, PU_STATIC, 0); // draw the console background image to the newly allocated video buffer patch = W_CacheLumpName(lumpname, PU_CACHE); // fill the video buffer with the newly allocated screen V_UseBuffer(backdrop); V_DrawPatch(0, 0, patch); // restore the backup up video buffer V_RestoreBuffer(); }
// // M_SaveGame & Cie. // void M_DrawSave(void) { int i; V_DrawPatchDirect (72,28,0,(patch_t*)W_CacheLumpName("M_SAVEG",PU_CACHE_SHARED)); for (i = 0;i < load_end; i++) { M_DrawSaveLoadBorder(::g->LoadDef.x,::g->LoadDef.y+LINEHEIGHT*i); M_WriteText(::g->LoadDef.x,::g->LoadDef.y+LINEHEIGHT*i,::g->savegamestrings[i]); } if (::g->saveStringEnter) { i = M_StringWidth(::g->savegamestrings[::g->saveSlot]); M_WriteText(::g->LoadDef.x + i,::g->LoadDef.y+LINEHEIGHT*::g->saveSlot,"_"); } }
static void LoadDiskImage(void) { patch_t *disk; char *disk_name; int y; int xoffset = SCREENWIDTH - LOADING_DISK_W; int yoffset = SCREENHEIGHT - LOADING_DISK_H; char buf[20]; SDL_VideoDriverName(buf, 15); if (!strcmp(buf, "Quartz")) { // MacOS Quartz gives us pageflipped graphics that screw up the // display when we use the loading disk. Disable it. // This is a gross hack. return; } if (M_CheckParm("-cdrom") > 0) disk_name = DEH_String("STCDROM"); else disk_name = DEH_String("STDISK"); disk = W_CacheLumpName(disk_name, PU_STATIC); // Draw the disk to the screen: V_DrawPatch(SCREENWIDTH - LOADING_DISK_W, SCREENHEIGHT - LOADING_DISK_H, 0, disk); disk_image = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H, PU_STATIC, NULL); saved_background = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H, PU_STATIC, NULL); for (y=0; y<LOADING_DISK_H; ++y) { memcpy(disk_image + LOADING_DISK_W * y, screens[0] + SCREENWIDTH * (y + yoffset) + xoffset, LOADING_DISK_W); } W_ReleaseLumpName(disk_name); }
void R_InitTextures (void) { maptexture_t *mtexture; texture_t *texture; int i,j,c; int offset; int *directory; /* */ /* load the map texture definitions from textures.lmp */ /* */ maptex = W_CacheLumpName ("TEXTURE1", PU_STATIC); numtextures = LITTLELONG(*maptex); directory = maptex+1; for (i=0 ; i<numtextures ; i++, directory++) { offset = LITTLELONG(*directory); mtexture = (maptexture_t *) ( (byte *)maptex + offset); texture = &textures[i]; texture->width = LITTLESHORT(mtexture->width); texture->height = LITTLESHORT(mtexture->height); D_memcpy (texture->name, mtexture->name, 8); for (j=0 ; j<8 ; j++) { c = texture->name[j]; if (c >= 'a' && c<='z') texture->name[j] = c - ('a'-'A'); } texture->data = NULL; /* not cached yet */ texture->lumpnum = W_CheckNumForName (texture->name); if (texture->lumpnum == -1) texture->lumpnum = 0; } Z_Free (maptex); /* */ /* translation table for global animation */ /* */ texturetranslation = Z_Malloc ((numtextures+1)*4, PU_STATIC, 0); for (i=0 ; i<numtextures ; i++) texturetranslation[i] = i; }
void HU_Init(void) { int i; int j; char buffer[9]; shiftxform = english_shiftxform; // load the heads-up font j = HU_FONTSTART; for (i=0;i<HU_FONTSIZE;i++) { sprintf(buffer, "STCFN%.3d", j++); ::g->hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC_SHARED); } }
void IN_Start(void) { int i; I_SetPalette(W_CacheLumpName("PLAYPAL", PU_CACHE)); InitStats(); LoadPics(); intermission = true; interstate = 0; skipintermission = false; intertime = 0; AM_Stop(); for (i = 0; i < MAXPLAYERS; i++) { players[i].messageTics = 0; players[i].message[0] = 0; } SN_StopAllSequences(); }
static void D_Endoom(void) { byte *endoom; // Don't show ENDOOM if we have it disabled, or we're running // in screensaver or control test mode. Only show it once the // game has actually started. if (!show_endoom || !main_loop_started || screensaver_mode || M_CheckParm("-testcontrols") > 0) { return; } endoom = W_CacheLumpName(DEH_String("ENDOOM"), PU_STATIC); I_Endoom(endoom); }
static void DrawFileSlots(Menu_t * menu) { int i; int x; int y; x = menu->x; y = menu->y; for (i = 0; i < 6; i++) { V_DrawPatch(x, y, W_CacheLumpName(DEH_String("M_FSLOT"), PU_CACHE)); if (SlotStatus[i]) { MN_DrTextA(SlotText[i], x + 5, y + 5); } y += ITEM_HEIGHT; } }
void R_ForceDefaultColormap(const char *name) { byte *data = (byte *)W_CacheLumpName (name, PU_CACHE); memcpy (realcolormaps.colormap, data, (NUMCOLORMAPS+1)*256); #if 0 // Setup shademap to mirror colormapped colors: for (int m = 0; m < (NUMCOLORMAPS+1); ++m) for (int c = 0; c < 256; ++c) realcolormaps.shademap[m*256+c] = V_Palette.shade(realcolormaps.colormap[m*256+c]); #else BuildDefaultShademap (GetDefaultPalette(), realcolormaps); #endif strncpy (fakecmaps[0].name, name, 9); // denis - todo - string limit? std::transform(fakecmaps[0].name, fakecmaps[0].name + strlen(fakecmaps[0].name), fakecmaps[0].name, toupper); fakecmaps[0].blend = 0; }
void R_InitColormaps(void) { int lump; boolean COLORMAP = (W_CheckMultipleLumps("COLORMAP") > 1); // Load in the light tables, // 256 byte align tables. lump = W_GetNumForName("COLORMAP"); colormaps = (lighttable_t *)W_CacheLumpNum(lump, PU_STATIC); // [BH] There's a typo in dcolors.c, the source code of the utility Id // Software used to construct the palettes and colormaps for DOOM (see // http://www.doomworld.com/idgames/?id=16644). When constructing colormap // 32, which is used for the invulnerability powerup, the traditional // Y luminence values are used (see http://en.wikipedia.org/wiki/YIQ), but a // value of 0.144 is used when it should be 0.114. So I've grabbed the // offending code from dcolor.c, corrected it, put it here, and now colormap // 32 is manually calculated rather than grabbing it from the colormap lump. // The resulting differences are minor. { int i; float red, green, blue, gray; byte *palsrc, *palette; palsrc = palette = W_CacheLumpName("PLAYPAL", PU_CACHE); for (i = 0; i < 255; i++) { red = *palsrc++ / 256.0f; green = *palsrc++ / 256.0f; blue = *palsrc++ / 256.0f; gray = red * 0.299f + green * 0.587f + blue * 0.114f/*0.144f*/; grays[i] = FindNearestColor(palette, (int)(gray * 255.0f), (int)(gray * 255.0f), (int)(gray * 255.0f)); if (!COLORMAP) { gray = (1.0f - gray) * 255.0f; colormaps[32 * 256 + i] = FindNearestColor(palette, (int)gray, (int)gray, (int)gray); } } } }
static void UnloadPics(void) { int i; if (HubCount || gametype == DEATHMATCH) { W_ReleaseLumpName("INTERPIC"); patchINTERPIC = W_CacheLumpName("INTERPIC", PU_STATIC); FontBLumpBase = W_GetNumForName("FONTB16"); for (i = 0; i < 10; i++) { W_ReleaseLumpNum(FontBLumpBase + i); } W_ReleaseLumpName("FONTB13"); W_ReleaseLumpName("FONTB15"); W_ReleaseLumpName("FONTB05"); } }
static void D_Endoom(void) { byte *endoom; // Don't show ENDOOM if we have it disabled, or we're running // in screensaver or control test mode. Only show it once the // game has actually started. if (!show_endoom || !main_loop_started || screensaver_mode || testcontrols) { return; } // haleyjd 08/27/10: [STRIFE] ENDOOM -> ENDSTRF endoom = W_CacheLumpName(DEH_String("ENDSTRF"), PU_STATIC); I_Endoom(endoom); }
static void D_InitIntroSequence(void) { if(showintro) { // In vanilla Strife, Mode 13h was initialized directly in D_DoomMain. // We have to be a little more courteous of the low-level code here. I_SetWindowTitle(gamedescription); I_SetGrabMouseCallback(D_StartupGrabCallback); I_InitGraphics(); V_RestoreBuffer(); // make the V_ routines work // Load all graphics rawgfx_startup0 = W_CacheLumpName("STARTUP0", PU_STATIC); rawgfx_startp[0] = W_CacheLumpName("STRTPA1", PU_STATIC); rawgfx_startp[1] = W_CacheLumpName("STRTPB1", PU_STATIC); rawgfx_startp[2] = W_CacheLumpName("STRTPC1", PU_STATIC); rawgfx_startp[3] = W_CacheLumpName("STRTPD1", PU_STATIC); rawgfx_startlz[0] = W_CacheLumpName("STRTLZ1", PU_STATIC); rawgfx_startlz[1] = W_CacheLumpName("STRTLZ2", PU_STATIC); rawgfx_startbot = W_CacheLumpName("STRTBOT", PU_STATIC); // Draw the background D_IntroBackground(); } /* // STRIFE-FIXME: This was actually displayed on a special textmode // screen with ANSI color codes... would require use of textlib to // emulate properly... else { puts(DEH_String("Conversation ON")); puts(DEH_String("Rogue Entertainment")); puts(DEH_String("and")); puts(DEH_String("Velocity Games")); puts(DEH_String("present")); puts(DEH_String("S T R I F E")); puts(DEH_String("Loading...")); } */ }
void gld_SetTexturePalette(GLenum target) { const unsigned char *playpal; unsigned char pal[1024]; int i; playpal=W_CacheLumpName("PLAYPAL"); for (i=0; i<256; i++) { pal[i*4+0] = playpal[i*3+0]; pal[i*4+1] = playpal[i*3+1]; pal[i*4+2] = playpal[i*3+2]; pal[i*4+3] = 255; } pal[transparent_pal_index*4+0]=0; pal[transparent_pal_index*4+1]=0; pal[transparent_pal_index*4+2]=0; pal[transparent_pal_index*4+3]=0; gld_ColorTableEXT(target, GL_RGBA, 256, GL_RGBA, GL_UNSIGNED_BYTE, pal); W_UnlockLumpName("PLAYPAL"); }
void HU_Init(void) { int i; int j; char buffer[9]; if (language==french) shiftxform = french_shiftxform; else shiftxform = english_shiftxform; // load the heads-up font j = HU_FONTSTART; for (i=0;i<HU_FONTSIZE;i++) { sprintf(buffer, "STCFN%.3d", j++); hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC); } }
angle_t R_DemoEx_ReadMLook(void) { angle_t pitch; if (!use_demoex_info || !(demoplayback || democontinue)) return 0; // mlook data must be initialised here if ((mlook_lump.lump == -2)) { if (R_DemoEx_GetVersion() < 2) { // unsupported format mlook_lump.lump = -1; } else { mlook_lump.lump = W_CheckNumForName(mlook_lump.name); if (mlook_lump.lump != -1) { const unsigned char *data = W_CacheLumpName(mlook_lump.name); int size = W_LumpLength(mlook_lump.lump); mlook_lump.maxtick = size / sizeof(mlook_lump.data[0]); mlook_lump.data = malloc(size); memcpy(mlook_lump.data, data, size); } } } pitch = 0; if (mlook_lump.data && mlook_lump.tick < mlook_lump.maxtick && consoleplayer == displayplayer && !walkcamera.type) { pitch = mlook_lump.data[mlook_lump.tick]; } mlook_lump.tick++; return (pitch << 16); }
// // initialise the console // void C_Init(void) { int i; int j = CONSOLEFONTSTART; char buffer[9]; // load the heads-up font j = CONSOLEFONTSTART; for (i = 0; i < CONSOLEFONTSIZE; i++) { if(j == 32) j = 33; if(j < 127) { DEH_snprintf(buffer, 9, "DRFON%.3d", j++); c_font[i] = W_CacheLumpName(buffer, PU_STATIC); } } C_UpdateInputPoint(); }
// // Read This Menus // Had a "quick hack to fix romero bug" // void M_DrawReadThis1 (void) { if (gameinfo.flags & GI_PAGESARERAW) { if (readpage && (readpage->width != pwidth || readpage->height != pheight)) { I_FreeScreen(readpage); readpage = NULL; } if (readpage == NULL) readpage = I_AllocateScreen(pwidth,pheight,screen->bits); readpage->Lock (); readpage->DrawBlock (0, 0, pwidth, pheight, (byte *)W_CachePatch (gameinfo.info.infoPage[0])); readpage->Unlock (); readpage->Blit (0, 0, readpage->width, readpage->height, screen, 0, 0, screen->width, screen->height); } else screen->DrawPatchIndirect ((patch_t *)W_CacheLumpName (gameinfo.info.infoPage[0], PU_CACHE), 0, 0); }
static boolean LoadInstrumentTable(void) { byte *lump; lump = W_CacheLumpName("GENMIDI", PU_STATIC); // Check header if (strncmp((char *) lump, GENMIDI_HEADER, strlen(GENMIDI_HEADER)) != 0) { W_ReleaseLumpName("GENMIDI"); return false; } main_instrs = (genmidi_instr_t *) (lump + strlen(GENMIDI_HEADER)); percussion_instrs = main_instrs + GENMIDI_NUM_INSTRS; main_instr_names = (char (*)[32]) (percussion_instrs + GENMIDI_NUM_PERCUSSION); percussion_names = main_instr_names + GENMIDI_NUM_INSTRS; return true; }
static void F_DrawBackground(void) { /* erase the entire screen to a tiled background. */ int x, y; byte *src, *dest; src = (byte *) W_CacheLumpName(finaleflat, PU_CACHE); dest = screen; for (y = 0; y < SCREENHEIGHT; y++) { for (x = 0; x < SCREENWIDTH/64; x++) { memcpy (dest, src + ((y & 63)<<6), 64); dest += 64; } if (SCREENWIDTH & 63) { memcpy (dest, src + ((y & 63)<<6), SCREENWIDTH & 63); dest += (SCREENWIDTH & 63); } } }
// // DoTimeBomb // // haleyjd 08/23/2010: [STRIFE] New function // Code with no xrefs; probably left over from a private alpha or beta. // Translated here because it explains what the SERIAL lump was meant to do. // void DoTimeBomb(void) { dosdate_t date; char *serial; int serialnum; int serial_year; int serial_month; serial = W_CacheLumpName("serial", PU_CACHE); serialnum = atoi(serial); // Rogue, much like Governor Mourel, were lousy liars. These deceptive // error messages are pretty low :P dos_getdate(&date); if(date.year > 1996 || date.day > 15 && date.month > 4) I_Error("Data error! Corrupted WAD File!"); serial_year = serialnum / 10000; serial_month = serialnum / 100 - 100 * serial_year; if(date.year < serial_year || date.day < serialnum - 100 * serial_month - 10000 * serial_year && date.month < serial_month) I_Error("Bad wadfile"); }
static void F_ArtScreenDrawer(void) { const char *lumpname; if (gameepisode == 3) { F_BunnyScroll(); } else { switch (gameepisode) { case 1: if (gameversion >= exe_ultimate) { lumpname = "CREDIT"; } else { lumpname = "HELP2"; } break; case 2: lumpname = "VICTORY2"; break; case 4: lumpname = "ENDPIC"; break; default: return; } lumpname = DEH_String(lumpname); V_DrawPatch (0, 0, W_CacheLumpName(lumpname, PU_CACHE)); } }
//----------------------------------------------------------------------------- // // M_ScreenShot // void M_ScreenShot (void) { int i; byte* linear; char pcxname [6]; char lbmname [80]; // munge planar buffer to linear linear = screens[2]; I_ReadScreen (linear); // I only want the first four characters as I now use a four digit index... memcpy (pcxname, screenshot_messages[SC_FILENAME], 4); pcxname [4] = 0; // find a file name to save it to i=~0; do { i++; sprintf (lbmname, "%s"DIRSEP"%s%04u"EXTSEP"pcx", basedefaultdir, pcxname, i); } while (access(lbmname,0) != -1); // file doesn't exist // save the pcx file WritePCXfile (lbmname, linear, SCREENWIDTH, SCREENHEIGHT, W_CacheLumpName ("PLAYPAL",PU_CACHE)); #ifdef __riscos set_riscos_filetype (lbmname, 0x697); #endif players[consoleplayer].message = HU_printf ("%s - %s", screenshot_messages[SC_MESSAGE], lbmname); #ifdef NORMALUNIX printf ("%s\n", players[consoleplayer].message); #endif }