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

Function validateSprite

source/core/maploader.cpp:272–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270}
271
272void validateSprite(spritetype& spri, int sectnum, int index)
273{
274 sectortype* sectp = &sector[sectnum];
275
276 auto pos = spri.pos;
277 bool bugged = false;
278 if ((unsigned)spri.statnum >= MAXSTATUS)
279 {
280 Printf("Sprite #%d (%.0f,%.0f) has invalid statnum %d.\n", index, pos.X, pos.Y, spri.statnum);
281 bugged = true;
282 }
283 else if ((unsigned)spri.picnum >= MAXTILES)
284 {
285 Printf("Sprite #%d (%.0f,%.0f) has invalid picnum %d.\n", index, pos.X, pos.Y, spri.picnum);
286 bugged = true;
287 }
288 else if (!validSectorIndex(sectnum))
289 {
290 sectp = nullptr;
291 updatesector(pos.XY(), &sectp);
292 bugged = sectp == nullptr;
293
294 if (!DPrintf(DMSG_WARNING, "Sprite #%d (%.0f,%.0f) with invalid sector %d was corrected to sector %d\n", index, pos.X, pos.Y, sectnum, ::sectindex(sectp)))
295 {
296 if (bugged) Printf("Sprite #%d (%.0f,%.0f) with invalid sector %d\n", index, pos.X, pos.Y, sectnum);
297 }
298 }
299 if (bugged)
300 {
301 spri = {};
302 spri.statnum = MAXSTATUS;
303 sectp = nullptr;
304 }
305 spri.sectp = sectp;
306}
307
308static void ReadSpriteV7(FileReader& fr, spritetype& spr, int& secno)
309{

Callers 3

dbLoadMapFunction · 0.85
loadMapFunction · 0.85
LoadMapHackFunction · 0.85

Calls 5

PrintfFunction · 0.85
validSectorIndexFunction · 0.85
updatesectorFunction · 0.85
DPrintfFunction · 0.85
sectindexFunction · 0.85

Tested by

no test coverage detected