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

Function FindGFXFile

source/common/models/model.cpp:89–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87//===========================================================================
88
89static int FindGFXFile(FString & fn)
90{
91 int lump = fileSystem.CheckNumForFullName(fn.GetChars()); // if we find something that matches the name plus the extension, return it and do not enter the substitution logic below.
92 if (lump != -1) return lump;
93
94 int best = -1;
95 auto dot = fn.LastIndexOf('.');
96 auto slash = fn.LastIndexOf('/');
97 if (dot > slash) fn.Truncate(dot);
98
99 static const char * extensions[] = { ".png", ".jpg", ".tga", ".pcx", nullptr };
100
101 for (const char ** extp=extensions; *extp; extp++)
102 {
103 lump = fileSystem.CheckNumForFullName((fn + *extp).GetChars());
104 if (lump >= best) best = lump;
105 }
106 return best;
107}
108
109
110//===========================================================================

Callers 1

LoadSkinFunction · 0.85

Calls 4

CheckNumForFullNameMethod · 0.80
LastIndexOfMethod · 0.80
TruncateMethod · 0.80
GetCharsMethod · 0.45

Tested by

no test coverage detected