void FTextureManager::AddHiresTextures (int wadnum) { int firsttx = Wads.GetFirstLump(wadnum); int lasttx = Wads.GetLastLump(wadnum); char name[9]; TArray<FTextureID> tlist; if (firsttx == -1 || lasttx == -1) { return; } name[8] = 0; for (;firsttx <= lasttx; ++firsttx) { if (Wads.GetLumpNamespace(firsttx) == ns_hires) { Wads.GetLumpName (name, firsttx); if (Wads.CheckNumForName (name, ns_hires) == firsttx) { tlist.Clear(); int amount = ListTextures(name, tlist); if (amount == 0) { // A texture with this name does not yet exist FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any); if (newtex != NULL) { newtex->UseType=FTexture::TEX_Override; AddTexture(newtex); } } else { for(unsigned int i = 0; i < tlist.Size(); i++) { FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any); if (newtex != NULL) { FTexture * oldtex = Textures[tlist[i].GetIndex()].Texture; // Replace the entire texture and adjust the scaling and offset factors. newtex->bWorldPanning = true; newtex->SetScaledSize(oldtex->GetScaledWidth(), oldtex->GetScaledHeight()); newtex->LeftOffset = FixedMul(oldtex->GetScaledLeftOffset(), newtex->xScale); newtex->TopOffset = FixedMul(oldtex->GetScaledTopOffset(), newtex->yScale); ReplaceTexture(tlist[i], newtex, true); } } } //StartScreen->Progress(); } } } }
FFont::FFont (const char *name, const char *nametemplate, int first, int count, int start) { int i, lump; char buffer[12]; int *charlumps; BYTE usedcolors[256], identity[256]; double *luminosity; int maxyoffs; bool doomtemplate = gameinfo.gametype == GAME_Doom ? strncmp (nametemplate, "STCFN", 5) == 0 : false; Chars = new CharData[count]; charlumps = new int[count]; PatchRemap = new BYTE[256]; Ranges = NULL; FirstChar = first; LastChar = first + count - 1; FontHeight = 0; GlobalKerning = false; memset (usedcolors, 0, 256); Name = copystring (name); Next = FirstFont; FirstFont = this; maxyoffs = 0; for (i = 0; i < count; i++) { sprintf (buffer, nametemplate, i + start); lump = Wads.CheckNumForName (buffer, ns_graphics); if (doomtemplate && lump >= 0 && i + start == 121) { // HACKHACK: Don't load STCFN121 in doom(2), because // it's not really a lower-case 'y' but an upper-case 'I'. // Because a lot of wads with their own font seem to foolishly // copy STCFN121 and make it an 'I' themselves, wads must // provide STCFN120 (x) and STCFN122 (z) for STCFN121 to load. if (Wads.CheckNumForName ("STCFN120", ns_graphics) == -1 || Wads.CheckNumForName ("STCFN122", ns_graphics) == -1) { lump = -1; } } charlumps[i] = lump; if (lump >= 0) { FTexture *pic = TexMan[TexMan.AddPatch (buffer)]; int height = pic->GetScaledHeight(); int yoffs = pic->GetScaledTopOffset(); if (yoffs > maxyoffs) { maxyoffs = yoffs; } height += abs (yoffs); if (height > FontHeight) { FontHeight = height; } RecordTextureColors (pic, usedcolors); } } ActiveColors = SimpleTranslation (usedcolors, PatchRemap, identity, &luminosity); for (i = 0; i < count; i++) { if (charlumps[i] >= 0) { Chars[i].Pic = new FFontChar1 (charlumps[i], PatchRemap); } else { Chars[i].Pic = NULL; } } if ('N'-first>=0 && 'N'-first<count && Chars['N' - first].Pic) { SpaceWidth = (Chars['N' - first].Pic->GetScaledWidth() + 1) / 2; } else { SpaceWidth = 4; } BuildTranslations (luminosity, identity, &TranslationParms[0][0]); delete[] luminosity; delete[] charlumps; }