27 result.
warnings.push_back(absl::StrFormat(
28 "High object count (%zu > %d). May cause lag or memory issues.",
33 size_t sprite_count = room.
GetSprites().size();
36 absl::StrFormat(
"Too many sprites (%zu > %d). Game limit is strict.",
52 if (obj.id_ >= 0xF9 && obj.id_ <= 0xFD) {
58 result.
errors.push_back(absl::StrFormat(
59 "Too many chests (%d > %d). Item collection flags will conflict.",
69 size_t stateful_room_event_count = 0;
70 bool saw_big_key_lock =
false;
71 int first_chest_after_lock = -1;
72 for (uint8_t list_index = 0; list_index < 3; ++list_index) {
78 if (obj.id_ == kBigKeyLockObjectId) {
79 saw_big_key_lock =
true;
80 ++stateful_room_event_count;
81 }
else if (IsStatefulChest(obj.id_)) {
82 ++stateful_room_event_count;
83 if (saw_big_key_lock && first_chest_after_lock < 0) {
84 first_chest_after_lock = obj.id_;
90 if (first_chest_after_lock >= 0) {
91 result.
warnings.push_back(absl::StrFormat(
92 "Stateful chest 0x%03X appears after big-key lock 0xF98 in "
93 "room-object stream order; move stateful chests before locks to avoid "
94 "room-state slot conflicts.",
95 first_chest_after_lock));
97 if (stateful_room_event_count > kMaxStatefulRoomEventSlots) {
98 result.
warnings.push_back(absl::StrFormat(
99 "Room uses %zu stateful chest/lock slots; the engine supports at most "
101 stateful_room_event_count, kMaxStatefulRoomEventSlots));
106 const int layer =
static_cast<int>(obj.GetLayerValue());
107 if (layer < 0 || layer > 2) {
108 result.
errors.push_back(absl::StrFormat(
109 "Object 0x%02X has invalid layer %d", obj.id_, layer));
113 result.
errors.push_back(absl::StrFormat(
114 "Special-table object 0x%02X has invalid layer selector %d; "
115 "expected upper/BG1 (0) or lower/BG2 (1)",
120 if (obj.x_ < 0 || obj.x_ >= 64 || obj.y_ < 0 || obj.y_ >= 64) {
121 result.
errors.push_back(absl::StrFormat(
122 "Object 0x%02X out of bounds at (%d, %d)", obj.id_, obj.x_, obj.y_));