Add extensive tests for animation, input handling, and map rendering

- Enhanced animation archive tests to validate frame metadata and start frame selection logic.
- Introduced new tests for entity dispatch entry handling, including key event queuing and processing.
- Added tests for fixed map item interactions, including glob egg hatching and item movement.
- Expanded flex archive tests to cover teleport egg spawning and usecode event selection.
- Implemented isometric controls tests to verify directional key handling and animation state changes.
- Improved map renderer tests to ensure correct rendering of map previews and collision detection.
This commit is contained in:
Maddo 2026-09-27 11:48:14 +02:00
commit e757bb33d0
20 changed files with 1247 additions and 142 deletions

View file

@ -100,6 +100,29 @@ int main()
assert(stand.has_value() && stand->frameCount > 0);
assert(walk.has_value() && walk->frameCount == 17);
assert(run.has_value() && run->frameCount == 12);
for (const remorse::AnimationClip* clip : {&*walk, &*run}) {
assert(clip->header[1] == 5);
for (remorse::u8 direction = 0; direction < 16; ++direction) {
for (remorse::u8 frame = 1; frame < clip->frameCount; ++frame) {
const auto metadata = remorse::getAnimationFrame(*clip, direction, frame);
assert(metadata && (metadata->bytes[5] & 2) != 0);
}
}
}
auto startClip = *walk;
startClip.header[1] = 1;
assert(remorse::selectAnimationStartFrame(startClip, false, false, true, true, 0) == 8);
assert(remorse::selectAnimationStartFrame(startClip, true, false, true, true, 0) == 0);
startClip.header[1] = 5;
assert(remorse::selectAnimationStartFrame(startClip, true, false, true, true, 0) == 16);
startClip.header[1] = 4;
assert(remorse::selectAnimationStartFrame(startClip, false, false, true, true, 0) == 0);
assert(remorse::selectAnimationStartFrame(startClip, false, true, true, true, 0) == 1);
assert(remorse::selectAnimationStartFrame(startClip, false, true, true, true, 3) == 2);
assert(remorse::selectAnimationStartFrame(startClip, false, true, false, false, 0) == 2);
assert(remorse::selectAnimationStartFrame(startClip, false, true, false, true, 2) == 2);
startClip.header[1] = 0;
assert(remorse::selectAnimationStartFrame(startClip, false, true, true, true, 0) == 0);
assert(remorse::getAnimationFrame(*walk, 0, 0).has_value());
assert(remorse::getAnimationFrame(*run, 15, 11).has_value());
for (remorse::u8 direction : {remorse::u8{6}, remorse::u8{7}, remorse::u8{10}, remorse::u8{11}}) {

View file

@ -1,6 +1,8 @@
#include "remorse/animation_archive.h"
#include "remorse/collision.h"
#include "remorse/entity_dispatch_entry.h"
#include "remorse/fixed_map.h"
#include "remorse/isometric_controls.h"
#include "remorse/map_renderer.h"
#include "remorse/type_flags.h"
@ -877,8 +879,139 @@ int main()
assert(!remorse::KeyboardProcess::handleKeyEvent(*keyboard, 0x10, 0, keyboardEvent, lastEvent));
keyboardEvent.character = 0x41;
assert(remorse::KeyboardProcess::handleKeyEvent(*keyboard, 0x10, 0, keyboardEvent, lastEvent));
remorse::ProcessKernel inputKernel;
assert(!inputKernel.popPendingKeyEvent());
for (remorse::u8 index = 0; index < 31; ++index) {
remorse::KeyEvent queued{};
queued.scanCode = index;
assert(inputKernel.queuePendingKeyEvent(queued));
}
assert(inputKernel.pendingKeyEventCount() == 31);
assert(!inputKernel.queuePendingKeyEvent({}));
assert(inputKernel.pendingKeyEventOverflowed());
for (remorse::u8 index = 0; index < 31; ++index) {
const auto queued = inputKernel.popPendingKeyEvent();
assert(queued && queued->scanCode == index);
}
assert(inputKernel.pendingKeyEventCount() == 0 && !inputKernel.pendingKeyEventOverflowed());
remorse::KeyEvent wrapped{};
wrapped.scanCode = 0x47;
assert(inputKernel.queuePendingKeyEvent(wrapped));
assert(inputKernel.popPendingKeyEvent()->scanCode == 0x47);
remorse::u16 inputGroups[32]{};
auto* inputKeyboard = inputKernel.createKeyboardProcess(1, inputGroups);
auto* inputController = inputKernel.createControllerProcess(1, inputGroups);
assert(inputController && inputController->base.bytes[0x00] == 0xa6 &&
inputController->base.bytes[0x01] == 0x3a);
assert(inputController->base.bytes[0x17] == 0x03 && inputController->extra[4] == 0x3c);
assert(!inputKeyboard->extra[0]);
assert(inputKernel.queuePendingKeyEvent(wrapped));
wrapped.scanCode = 0x48;
assert(inputKernel.queuePendingKeyEvent(wrapped));
std::vector<remorse::u8> deliveredScans;
inputKernel.dispatchPendingKeyEvents([](remorse::EntityDispatchEntryBase& process,
remorse::u16 selector, remorse::u16 filter, remorse::KeyEvent& event, void* context) {
assert(selector == 0x10 && filter == 0);
assert(process.bytes[0x00] == 0xa6);
static_cast<std::vector<remorse::u8>*>(context)->push_back(event.scanCode);
}, &deliveredScans);
assert((deliveredScans == std::vector<remorse::u8>{0x47, 0x48}));
assert(inputKernel.pendingKeyEventCount() == 0);
remorse::ControllerMovementState deliveredMovement;
wrapped.scanCode = 0x48;
wrapped.field8 = 1;
assert(inputKernel.queuePendingKeyEvent(wrapped));
inputKernel.dispatchPendingKeyEvents([](remorse::EntityDispatchEntryBase& process,
remorse::u16 selector, remorse::u16 filter, remorse::KeyEvent& event, void* context) {
assert(process.bytes[0] == 0xa6 && selector == 0x10 && filter == 0);
static_cast<remorse::ControllerMovementState*>(context)->handleDirectionalKey(
event.scanCode, event.modifiers, event.field8 != 0);
}, &deliveredMovement);
assert(deliveredMovement.request().animation == 1 && deliveredMovement.request().direction == 14);
wrapped.field8 = 0;
assert(inputKernel.queuePendingKeyEvent(wrapped));
inputKernel.dispatchPendingKeyEvents([](remorse::EntityDispatchEntryBase&,
remorse::u16, remorse::u16, remorse::KeyEvent& event, void* context) {
static_cast<remorse::ControllerMovementState*>(context)->handleDirectionalKey(
event.scanCode, event.modifiers, event.field8 != 0);
}, &deliveredMovement);
assert(deliveredMovement.request().animation == 0);
assert(std::memcmp(&keyboardEvent, &lastEvent, sizeof(keyboardEvent)) == 0);
assert(keyboard->extra[0] == 0x21);
remorse::ProcessKernel animationKernel;
remorse::u16 animationGroups[32]{};
for (int reservedSlot = 0; reservedSlot < 3; ++reservedSlot) {
animationKernel.createProcess(1, animationGroups);
}
remorse::AnimationClip walking{};
walking.header = {17, 4, 0, 0};
walking.frameCount = 17;
auto* animation = animationKernel.createAnimPrimitiveProcess(1, 1, 1, 6, walking, animationGroups);
assert(animationKernel.processAt(3) == &animation->base);
assert(animationKernel.allocationSizeAt(3) == 0x5b && animationGroups[1] == 4);
assert(animationKernel.findProcessForItemAndType(1, 0xf0) == &animation->base);
assert(animation->base.bytes[0] == 0x57 && animation->base.bytes[1] == 0x2a);
assert(animation->base.bytes[0x16] == 0 && animation->base.bytes[0x17] == 0x08);
assert(animation->extra[0] == 1 && animation->extra[4] == 1 && animation->extra[6] == 6);
assert(animation->extra[7] == 17 && animation->extra[0x18] == 17 && animation->extra[0x19] == 4);
remorse::LiveFixedMapItems animationItems({});
assert(animationItems.initializeAvatar());
assert(animationKernel.startAnimPrimitiveProcess(3, animationItems, walking));
const auto* npcAnimation = animationItems.findNpcAnimation(1);
assert(npcAnimation && npcAnimation->lastAnimation == 1 && npcAnimation->frame == 0);
assert(!animationKernel.startAnimPrimitiveProcess(3, animationItems, walking));
auto* repeatedWalk = animationKernel.createAnimPrimitiveProcess(1, 1, 1, 6, walking, animationGroups);
assert(animationKernel.startAnimPrimitiveProcess(4, animationItems, walking));
assert(repeatedWalk->base.bytes[0x3a] == 1 && animationItems.findNpcAnimation(1)->frame == 1);
auto* turning = animationKernel.createAnimPrimitiveProcess(1, 1, 0, 6, walking, animationGroups);
assert(animationKernel.startAnimPrimitiveProcess(5, animationItems, walking));
assert(turning->base.bytes[0x3a] == 1 && animationItems.findNpcAnimation(1)->frame == 0);
remorse::StagedFixedMapItem animationSpawn{};
animationSpawn.data.x = 512;
animationSpawn.data.y = 512;
assert(animationItems.teleportAvatar(animationSpawn, 1));
walking.frames.resize(17 * 8);
auto& nextWalkFrame = walking.frames[3 * 17 + 1];
nextWalkFrame.bytes[4] = 1;
nextWalkFrame.bytes[5] = 2;
std::vector<remorse::ShapeTypeInfo> animationShapes(2);
animationShapes[1].x = animationShapes[1].y = animationShapes[1].z = 2;
auto& movingNpc = *animationItems.editNpcAnimation(1);
movingNpc.lastAnimation = 1;
movingNpc.frame = 0;
const auto animationArea = remorse::calculateFastAreaRange({512, 512, 0});
assert(animationKernel.advanceGroundedAnimPrimitive(3, animationItems,
walking, animationShapes, animationArea) == true);
assert(animationItems.findItem(1)->data.x == 514 && animationItems.findItem(1)->data.y == 514);
assert(movingNpc.frame == 1);
nextWalkFrame.bytes[4] = 100;
movingNpc.frame = 0;
remorse::StagedFixedMapItem animationWall{};
animationWall.itemNumber = 0x100;
animationWall.data.shape = 2;
animationWall.data.x = 650;
animationWall.data.y = 650;
animationShapes.push_back(animationShapes[1]);
animationShapes[2].flags = 2;
assert(animationItems.insertItem(animationWall));
assert(animationKernel.advanceGroundedAnimPrimitive(3, animationItems,
walking, animationShapes, animationArea) == false);
assert(animationItems.findItem(1)->data.x == 514 && movingNpc.frame == 0);
assert(animation->extra[0x0a] == 1);
walking.header[1] = 5;
nextWalkFrame.bytes[4] = 1;
auto* twoStepWalk = animationKernel.createAnimPrimitiveProcess(1, 1, 1, 6, walking, animationGroups);
assert(animationKernel.startAnimPrimitiveProcess(6, animationItems, walking));
assert(movingNpc.frame == 8 && twoStepWalk->extra[7] == 17);
movingNpc.frame = 16;
assert(animationKernel.advanceGroundedAnimPrimitive(6, animationItems,
walking, animationShapes, animationArea) == true);
assert(movingNpc.frame == 1 && animationItems.findItem(1)->data.x == 516);
twoStepWalk->base.bytes[0x18] |= 4;
animationKernel.terminateProcess(6, animationGroups);
assert(animationKernel.processAt(6) == nullptr && animationKernel.allocationSizeAt(6) == 0);
assert(animationGroups[1] == 6 && animationKernel.itemHasProcess(1));
return 0;
}

View file

@ -1,6 +1,7 @@
#include "remorse/entity_dispatch_entry.h"
#include "remorse/file_system.h"
#include "remorse/fixed_map.h"
#include "remorse/glob_archive.h"
#include "remorse/map_renderer.h"
#include "remorse/type_flags.h"
@ -235,6 +236,24 @@ int main()
assert(allocatedItems.allocateItem(newItem) == 0x107);
newItem.data.x = 0x8000;
assert(!allocatedItems.allocateItem(newItem) && !allocatedItems.findItem(0x108));
remorse::StagedFixedMapItem globEgg;
globEgg.itemNumber = 0x100;
globEgg.data.x = 0x403;
globEgg.data.y = 0x601;
globEgg.data.z = 12;
globEgg.data.shape = 3;
globEgg.data.quality = 7;
remorse::LiveFixedMapItems hatchedItems({globEgg});
std::vector<remorse::ShapeTypeInfo> globShapes(4);
globShapes[3].family = 3;
remorse::GlobObject glob{7, {{2, 5, 3, 1, 2}}};
const auto childIds = hatchedItems.hatchGlobEgg(0x100, glob, globShapes);
assert(childIds && *childIds == std::vector<remorse::u16>{0x101});
const auto* child = hatchedItems.findItem(0x101);
assert(child && child->recordIndex == static_cast<std::size_t>(-1));
assert(child->data.x == 0x405 && child->data.y == 0x60b && child->data.z == 15);
assert(child->data.flags == 0x82 && child->data.frame == 2);
assert(hatchedItems.isGlobHatched(0x100) && !hatchedItems.hatchGlobEgg(0x100, glob, globShapes));
remorse::LiveFixedMapItems movingItems(blockItems);
remorse::ProcessKernel movingKernel;
remorse::u16 movingGroups[32]{};
@ -266,7 +285,18 @@ int main()
candidate.itemNumber = 0;
assert(remorse::classifyItemFindZMatch(origin, originShape, candidate, footprint, 3) == 0);
assert(cachedItems->front().recordIndex < retailMap->entries.size());
const remorse::LiveFixedMapItems retailLiveItems(*cachedItems);
remorse::LiveFixedMapItems retailLiveItems(*cachedItems);
assert(!retailLiveItems.findItem(1));
assert(retailLiveItems.initializeAvatar());
assert(!retailLiveItems.initializeAvatar());
assert(retailLiveItems.findItem(1)->data.shape == 1);
assert(retailLiveItems.findItem(1)->data.frame == 0);
assert(retailLiveItems.findItem(1)->data.npcNumber == 1);
assert(retailLiveItems.teleportAvatar(cachedItems->front(), 1));
assert(retailLiveItems.findItem(1)->data.x == cachedItems->front().data.x);
assert(retailLiveItems.findItem(1)->data.mapNumber == 1);
assert(retailLiveItems.moveItem(1, 100, 200, 5));
assert(retailLiveItems.findItem(1)->data.x == 100 && retailLiveItems.findItem(1)->data.y == 200);
assert(retailLiveItems.findItem(cachedItems->front().itemNumber)->recordIndex ==
cachedItems->front().recordIndex);
for (const auto& item : *cachedItems) {

View file

@ -1,8 +1,11 @@
#include "remorse/collision.h"
#include "remorse/file_system.h"
#include "remorse/flex_archive.h"
#include "remorse/fixed_map.h"
#include "remorse/glob_archive.h"
#include "remorse/type_flags.h"
#include "remorse/usecode_archive.h"
#include "remorse/usecode_vm.h"
#include <cassert>
#include <filesystem>
@ -69,6 +72,38 @@ int main()
assert(fixedMap && typeFlags);
const auto stagedItems = remorse::stageFixedMapItems(*fixedMap);
assert(stagedItems && !stagedItems->empty());
const auto spawnEgg = remorse::findTeleportEgg(*stagedItems, *typeFlags, 0x1e);
assert(spawnEgg);
const auto globPath = remorse::resolveGameDataPath(*root, std::filesystem::path("STATIC") / "GLOB.FLX");
const auto globs = globPath ? remorse::loadGlobObjects(*globPath) : std::nullopt;
assert(globs);
remorse::LiveFixedMapItems spawnedItems(*stagedItems);
const auto fastArea = remorse::calculateFastAreaRange({
spawnEgg->data.x * 2, spawnEgg->data.y * 2, spawnEgg->data.z});
unsigned hatched = 0;
for (const auto& egg : *stagedItems) {
if (egg.data.shape >= typeFlags->size() || (*typeFlags)[egg.data.shape].family != 3 ||
!remorse::isWorldPointInFastArea(egg.data.x * 2, egg.data.y * 2, fastArea)) continue;
for (const auto& glob : *globs) {
if (glob.index == egg.data.quality) {
const auto children = spawnedItems.hatchGlobEgg(egg.itemNumber, glob, *typeFlags);
if (children) hatched += static_cast<unsigned>(children->size());
break;
}
}
}
unsigned scriptChildren = 0;
for (const auto& item : spawnedItems.mapItems()) {
if (item.recordIndex != static_cast<std::size_t>(-1) || item.data.shape >= typeFlags->size()) continue;
const remorse::UsecodeItemIdentity childIdentity{item.itemNumber, item.data.shape,
item.data.flags, item.data.quality, (*typeFlags)[item.data.shape].family, false};
const auto use = remorse::selectEligibleUsecodeEvent(*usecode, *retailOwnerRows, childIdentity,
remorse::UsecodeClassBases{0, 0x800, 0x900}, 2, 1);
if (use) {
++scriptChildren;
}
}
assert(hatched == 4 && scriptChildren == 0);
const auto& staged = stagedItems->front();
assert(staged.data.shape < typeFlags->size());
const remorse::UsecodeItemIdentity stagedIdentity{staged.itemNumber, staged.data.shape,
@ -100,6 +135,18 @@ int main()
rechargeItem, retailBases, 0x200, 9);
assert(eligibleRelease && eligibleRelease->classId == 0x138 &&
eligibleRelease->className == "RECHFLNS" && eligibleRelease->body.bytes.size() == 102);
auto interpreter = remorse::UsecodeInterpreterState::initialize({0x00, 0x01});
assert(interpreter && interpreter->stackTop == 0xca && interpreter->stackLimit == 199);
assert(interpreter->valueStack[0xca] == 0x00 && interpreter->valueStack[0xcb] == 0x01);
assert(interpreter->pushCodeAddress(eligibleRelease->classId, 9));
assert(interpreter->callFrameCount == 1 && interpreter->callFrames[0].offset == 0x138 &&
interpreter->callFrames[0].segment == 9);
for (unsigned index = 1; index < 0x1f; ++index) {
assert(interpreter->pushCodeAddress(static_cast<remorse::u16>(index), 0));
}
assert(!interpreter->pushCodeAddress(0xffff, 0));
assert(interpreter->callFrameCount == 0x1f && interpreter->callFrames[31].offset == 0);
assert(!remorse::UsecodeInterpreterState::initialize(std::vector<remorse::u8>(0xcd)));
assert(!remorse::selectEligibleUsecodeEvent(*usecode, *retailOwnerRows,
rechargeItem, retailBases, 0, 9));
std::vector<remorse::u8> ownerRows(26);

View file

@ -5,6 +5,22 @@
int main()
{
remorse::ControllerMovementState controller;
assert(controller.request().animation == 0);
controller.handleDirectionalKey(0x48, 0, true);
assert(controller.request().animation == 1 && controller.request().direction == 14);
controller.handleDirectionalKey(0x4d, 1, true);
assert(controller.request().animation == 3 && controller.request().direction == 2);
controller.handleDirectionalKey(0x4d, 1, false);
assert(controller.request().animation == 3 && controller.request().direction == 14);
controller.handleDirectionalKey(0x48, 0, false);
assert(controller.request().animation == 0 && controller.request().direction == 14);
controller.handleDirectionalKey(0x49, 0x20, true);
assert(controller.request().animation == 0);
controller.handleDirectionalKey(0x47, 0x40, true);
assert(controller.request().animation == 3 && controller.request().direction == 12);
controller.clear();
assert(controller.request().animation == 0);
assert(remorse::controllerWalkRequested(0));
assert(!remorse::controllerWalkRequested(0x01));
assert(!remorse::controllerWalkRequested(0x02));

View file

@ -1,10 +1,14 @@
#include "remorse/collision.h"
#include "remorse/file_system.h"
#include "remorse/fixed_map.h"
#include "remorse/glob_archive.h"
#include "remorse/map_renderer.h"
#include "remorse/type_flags.h"
#include <algorithm>
#include <cassert>
#include <filesystem>
#include <utility>
int main()
{
@ -51,5 +55,100 @@ int main()
const remorse::ScreenPoint center = remorse::projectToScreen(*options.viewCenter);
assert(centeredImage->sourceLeft == center.x - static_cast<remorse::s32>(options.maxWidth / 2));
assert(centeredImage->sourceTop == center.y - static_cast<remorse::s32>(options.maxHeight / 2));
const auto typesPath = remorse::resolveGameDataPath(*root, std::filesystem::path("STATIC") / "TYPEFLAG.DAT");
const auto globPath = remorse::resolveGameDataPath(*root, std::filesystem::path("STATIC") / "GLOB.FLX");
assert(typesPath && globPath);
const auto shapeTypes = remorse::loadTypeFlags(*typesPath);
const auto globs = remorse::loadGlobObjects(*globPath);
assert(shapeTypes && shapeTypes->size() > 1 && globs);
const auto stagedItems = remorse::stageFixedMapItems(*fixedMap);
assert(stagedItems);
const auto startingEgg = remorse::findTeleportEgg(*stagedItems, *shapeTypes, 0x1e);
assert(startingEgg && startingEgg->itemNumber >= 0x100);
assert((startingEgg->data.quality & 0xff) == 0x1e && startingEgg->data.frame == 1);
assert(startingEgg->data.x > 0 && startingEgg->data.y > 0);
assert(startingEgg->data.x * 2 == fixedMap->entries[startingEgg->recordIndex].x);
assert(startingEgg->data.y * 2 == fixedMap->entries[startingEgg->recordIndex].y);
const auto obstacles = remorse::collectMapCollisionBodies(*fixedMap, *shapeTypes, *globs);
const remorse::WorldPoint spawn{startingEgg->data.x * 2, startingEgg->data.y * 2, startingEgg->data.z};
options.maxWidth = 320;
options.maxHeight = 200;
options.viewCenter = spawn;
const auto startingScene = remorse::renderMapPreview(*root, options);
assert(startingScene && startingScene->paintedItemCount > 0);
remorse::LiveFixedMapItems liveSceneItems(*stagedItems);
auto cachedRenderer = remorse::loadMapSceneRenderer(*root, 1);
assert(cachedRenderer);
const auto liveBefore = cachedRenderer->render(options, &liveSceneItems);
const auto samePixels = [](const auto& left, const auto& right) {
return left.size() == right.size() && std::equal(left.begin(), left.end(), right.begin(),
[](const auto& lhs, const auto& rhs) {
return lhs.red == rhs.red && lhs.green == rhs.green && lhs.blue == rhs.blue;
});
};
assert(liveBefore && samePixels(liveBefore->pixels, startingScene->pixels));
const remorse::s32 redrawRadius = static_cast<remorse::s32>(
options.maxWidth + options.maxHeight * 2 + 512);
options.worldRect = remorse::WorldRect{spawn.x - redrawRadius, spawn.y - redrawRadius,
spawn.x + redrawRadius, spawn.y + redrawRadius};
const auto boundedScene = cachedRenderer->render(options, &liveSceneItems);
assert(boundedScene && samePixels(boundedScene->pixels, liveBefore->pixels));
options.worldRect.reset();
const auto nearEgg = std::find_if(stagedItems->begin(), stagedItems->end(), [&](const auto& item) {
return item.data.shape < shapeTypes->size() &&
(*shapeTypes)[item.data.shape].family == 3 && item.data.quality != 0 &&
std::any_of(globs->begin(), globs->end(), [&](const auto& object) {
return object.index == item.data.quality;
});
});
assert(nearEgg != stagedItems->end());
{
options.viewCenter = remorse::WorldPoint{
nearEgg->data.x * 2, nearEgg->data.y * 2, nearEgg->data.z};
const auto unhatchedScene = cachedRenderer->render(options, &liveSceneItems);
assert(unhatchedScene);
const auto glob = std::find_if(globs->begin(), globs->end(), [&](const auto& object) {
return object.index == nearEgg->data.quality;
});
assert(glob != globs->end());
const auto childIds = liveSceneItems.hatchGlobEgg(nearEgg->itemNumber, *glob, *shapeTypes);
assert(childIds && childIds->size() == glob->entries.size());
const auto hatchedScene = cachedRenderer->render(options, &liveSceneItems);
assert(hatchedScene && samePixels(hatchedScene->pixels, unhatchedScene->pixels));
for (const remorse::u16 childId : *childIds) {
const auto* child = liveSceneItems.findItem(childId);
assert(child && liveSceneItems.moveItem(childId,
static_cast<remorse::u16>(child->data.x + 512),
static_cast<remorse::u16>(child->data.y + 512), child->data.z));
}
const auto movedScene = cachedRenderer->render(options, &liveSceneItems);
assert(movedScene && !samePixels(movedScene->pixels, hatchedScene->pixels));
}
options.viewCenter = spawn;
auto visibleItem = std::find_if(stagedItems->begin(), stagedItems->end(), [&](const auto& item) {
if (item.data.shape >= shapeTypes->size() || (item.data.flags & 0x10) != 0 ||
((*shapeTypes)[item.data.shape].flags & 0x400) != 0) {
return false;
}
const auto family = (*shapeTypes)[item.data.shape].family;
if (family == 3 || family == 4 || family == 7 || family == 8) {
return false;
}
return true;
});
assert(visibleItem != stagedItems->end());
assert(liveSceneItems.moveItem(visibleItem->itemNumber, startingEgg->data.x,
startingEgg->data.y, 16));
const auto liveAfter = cachedRenderer->render(options, &liveSceneItems);
assert(liveAfter && !samePixels(liveAfter->pixels, liveBefore->pixels));
assert(!cachedRenderer->decodedFrames.empty());
const auto actor = remorse::makeCollisionBody(spawn, (*shapeTypes)[1]);
bool canLeaveSpawn = false;
for (const auto [deltaX, deltaY] : {std::pair{32, 0}, {0, 32}, {-32, 0}, {0, -32}}) {
canLeaveSpawn |= remorse::canMoveCollisionBody(actor,
{spawn.x + deltaX, spawn.y + deltaY, spawn.z}, obstacles);
}
assert(canLeaveSpawn);
return 0;
}