Fix crash with old panel objects present in a level

This commit is contained in:
Lwmte 2025-03-13 20:32:14 +01:00
parent 1daf39471a
commit 28773e2387
3 changed files with 8 additions and 2 deletions

View file

@ -1014,5 +1014,5 @@ enum GAME_OBJECT_ID : short
ID_DIARY_SPRITES,
ID_DIARY_ENTRY_SPRITES,
ID_NUMBER_OBJECTS
ID_NUMBER_OBJECTS = 1408 // Compatibility. Remove this constant when slot count is nearing 1408.
};

View file

@ -1,7 +1,7 @@
#pragma once
// This file is generated automatically, do not edit it.
// Last generated on 11/03/2025.
// Last generated on 13/03/2025.
#include <unordered_map>
#include <string>

View file

@ -440,6 +440,12 @@ void LoadObjects()
int objNum = ReadInt32();
MoveablesIds.push_back(objNum);
if (objNum >= GAME_OBJECT_ID::ID_NUMBER_OBJECTS)
{
TENLog("Unsupported object slot is detected in a level. Make sure you delete unsupported objects from your wads.", LogLevel::Warning);
continue;
}
Objects[objNum].loaded = true;
Objects[objNum].nmeshes = ReadInt32();
Objects[objNum].meshIndex = ReadInt32();