MCPcopy Create free account
hub / github.com/ZDoom/Raze / CreateTexture

Method CreateTexture

source/common/textures/texturemanager.cpp:451–496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

449//==========================================================================
450
451FTextureID FTextureManager::CreateTexture (int lumpnum, ETextureType usetype)
452{
453 if (lumpnum != -1)
454 {
455 FString str;
456 if (!usefullnames)
457 str = fileSystem.GetFileShortName(lumpnum);
458 else
459 {
460 auto fn = fileSystem.GetFileFullName(lumpnum);
461 str = ExtractFileBase(fn);
462 }
463 auto out = MakeGameTexture(CreateTextureFromLump(lumpnum, usetype == ETextureType::Flat), str.GetChars(), usetype);
464
465 if (out != NULL)
466 {
467 if (usetype == ETextureType::Flat)
468 {
469 int w = out->GetTexelWidth();
470 int h = out->GetTexelHeight();
471
472 // Auto-scale flats with dimensions 128x128 and 256x256.
473 // In hindsight, a bad idea, but RandomLag made it sound better than it really is.
474 // Now we're stuck with this stupid behaviour.
475 if (w == 128 && h == 128)
476 {
477 out->SetScale(2, 2);
478 out->SetWorldPanning(true);
479 }
480 else if (w == 256 && h == 256)
481 {
482 out->SetScale(4, 4);
483 out->SetWorldPanning(true);
484 }
485 }
486
487 return AddGameTexture(out);
488 }
489 else
490 {
491 Printf (TEXTCOLOR_ORANGE "Invalid data encountered for texture %s\n", fileSystem.GetFileFullPath(lumpnum).c_str());
492 return FTextureID(-1);
493 }
494 }
495 return FTextureID(-1);
496}
497
498//==========================================================================
499//

Callers 2

GetPaletteMethod · 0.45
GetLookupMethod · 0.45

Calls 14

ExtractFileBaseFunction · 0.85
MakeGameTextureFunction · 0.85
CreateTextureFromLumpFunction · 0.85
PrintfFunction · 0.85
GetFileShortNameMethod · 0.80
GetFileFullNameMethod · 0.80
GetTexelWidthMethod · 0.80
GetTexelHeightMethod · 0.80
SetWorldPanningMethod · 0.80
c_strMethod · 0.80
GetFileFullPathMethod · 0.80
FTextureIDClass · 0.70

Tested by

no test coverage detected