From c2035c3c9504762b7e0e3a1cba0bb16c81c8a206 Mon Sep 17 00:00:00 2001 From: Dethrace Labs <78985374+dethrace-labs@users.noreply.github.com> Date: Wed, 7 Jan 2026 15:08:51 +1300 Subject: [PATCH] LoadNPixelmaps matching --- src/DETHRACE/common/world.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/DETHRACE/common/world.c b/src/DETHRACE/common/world.c index 80573061..cdcc04e9 100644 --- a/src/DETHRACE/common/world.c +++ b/src/DETHRACE/common/world.c @@ -395,7 +395,7 @@ int LoadNPixelmaps(tBrender_storage* pStorage_space, FILE* pF, int pCount) { char* str; br_pixelmap* temp_array[200]; - new_ones = 0; + total = 0; for (i = 0; i < pCount; ++i) { PossibleService(); GetALineAndDontArgue(pF, s); @@ -404,33 +404,34 @@ int LoadNPixelmaps(tBrender_storage* pStorage_space, FILE* pF, int pCount) { PathCat(the_path, the_path, "PIXELMAP"); PathCat(the_path, the_path, str); AllowOpenToFail(); - total = DRPixelmapLoadMany(the_path, temp_array, COUNT_OF(temp_array)); - if (total == 0) { + new_ones = DRPixelmapLoadMany(the_path, temp_array, COUNT_OF(temp_array)); + DoNotAllowOpenToFail(); + if (new_ones == 0) { PathCat(the_path, gApplication_path, "PIXELMAP"); PathCat(the_path, the_path, str); - total = DRPixelmapLoadMany(the_path, temp_array, COUNT_OF(temp_array)); - if (total == 0) { + new_ones = DRPixelmapLoadMany(the_path, temp_array, COUNT_OF(temp_array)); + if (new_ones == 0) { FatalError(kFatalError_LoadPixelmapFile_S, str); } } - for (j = 0; j < total; j++) { + for (j = 0; j < new_ones; j++) { if (temp_array[j] != NULL) { switch (AddPixelmapToStorage(pStorage_space, (br_pixelmap**)temp_array[j])) { - case eStorage_not_enough_room: - FatalError(kFatalError_InsufficientPixelmapSlots); + case eStorage_allocated: + BrMapAdd(temp_array[j]); + total++; break; case eStorage_duplicate: BrPixelmapFree(temp_array[j]); break; - case eStorage_allocated: - BrMapAdd(temp_array[j]); - ++new_ones; + case eStorage_not_enough_room: + FatalError(kFatalError_InsufficientPixelmapSlots); break; } } } } - return new_ones; + return total; } // IDA: br_pixelmap* __usercall LoadSinglePixelmap@(tBrender_storage *pStorage_space@, char *pName@)