Enhance teleporter and map rendering tests
- Added initialization of startup processes in flex_archive_tests to ensure proper setup before teleporter operations. - Updated assertions to verify the correct allocation and state of processes during teleporter execution. - Introduced new tests in map_renderer_tests to validate shape rendering, including isolated shape rendering and player sprite integration. - Enhanced map_sorter_tests with additional checks for occlusion handling and boundary conditions in render order resolution.
This commit is contained in:
parent
6d4972933f
commit
e00f9f3186
16 changed files with 954 additions and 398 deletions
|
|
@ -250,14 +250,27 @@ int main()
|
|||
for (int reservedSlot = 0; reservedSlot < 3; ++reservedSlot) {
|
||||
teleporterKernel.createProcess(1, teleporterGroups);
|
||||
}
|
||||
auto* startupTimer = teleporterKernel.createSystemTimerProcess(1, teleporterGroups);
|
||||
auto* startupKeyboard = teleporterKernel.createKeyboardProcess(1, teleporterGroups);
|
||||
auto* startupController = teleporterKernel.createControllerProcess(1, teleporterGroups);
|
||||
assert(startupTimer && startupKeyboard && startupController);
|
||||
const auto processIdOf = [](const auto& process) {
|
||||
return static_cast<remorse::u16>(process->base.bytes[2] |
|
||||
(static_cast<remorse::u16>(process->base.bytes[3]) << 8));
|
||||
};
|
||||
const remorse::u16 startupTimerId = processIdOf(startupTimer);
|
||||
const remorse::u16 startupKeyboardId = processIdOf(startupKeyboard);
|
||||
const remorse::u16 startupControllerId = processIdOf(startupController);
|
||||
bool avatarInStasis = false;
|
||||
auto* teleporterProcess = teleporterKernel.createTeleporterProcess(1, 1, 0x1e,
|
||||
teleporterGroups, true, false, avatarInStasis);
|
||||
const remorse::u16 teleporterProcessId = static_cast<remorse::u16>(
|
||||
teleporterProcess->base.bytes[2] | (static_cast<remorse::u16>(teleporterProcess->base.bytes[3]) << 8));
|
||||
assert(avatarInStasis && teleporterKernel.allocationSizeAt(4) == 0x33 &&
|
||||
teleporterKernel.processAt(4)->bytes[0] == 0x5e &&
|
||||
teleporterKernel.processAt(4)->bytes[1] == 0x0f);
|
||||
const remorse::u16 clearStasisProcessId = static_cast<remorse::u16>(teleporterProcessId + 1);
|
||||
assert(avatarInStasis && clearStasisProcessId > startupControllerId &&
|
||||
teleporterKernel.allocationSizeAt(clearStasisProcessId) == 0x33 &&
|
||||
teleporterKernel.processAt(clearStasisProcessId)->bytes[0] == 0x5e &&
|
||||
teleporterKernel.processAt(clearStasisProcessId)->bytes[1] == 0x0f);
|
||||
assert(!remorse::TeleporterProcess::run(*teleporterProcess, spawnSearchWorld, 2, *typeFlags));
|
||||
assert(spawnSearchWorld.findItem(1)->data.x == 0 && spawnSearchWorld.findItem(1)->data.y == 0);
|
||||
struct TeleporterPassContext {
|
||||
|
|
@ -288,12 +301,19 @@ int main()
|
|||
};
|
||||
teleporterKernel.scanRunnableProcesses(1, runTeleporterPass, &teleporterPass);
|
||||
assert(!avatarInStasis && !teleporterPass.teleported &&
|
||||
teleporterKernel.processAt(startupTimerId) == &startupTimer->base &&
|
||||
teleporterKernel.processAt(startupKeyboardId) == &startupKeyboard->base &&
|
||||
teleporterKernel.processAt(startupControllerId) == &startupController->base &&
|
||||
teleporterKernel.processAt(clearStasisProcessId) == nullptr &&
|
||||
teleporterKernel.processAt(teleporterProcessId) == &teleporterProcess->base &&
|
||||
spawnSearchWorld.findItem(1)->data.x == 0 && spawnSearchWorld.findItem(1)->data.y == 0);
|
||||
teleporterKernel.scanRunnableProcesses(1, runTeleporterPass, &teleporterPass);
|
||||
assert(teleporterPass.teleported);
|
||||
assert(teleporterKernel.processAt(teleporterProcessId) == nullptr &&
|
||||
teleporterKernel.allocationSizeAt(teleporterProcessId) == 0 && teleporterGroups[1] == 3);
|
||||
teleporterKernel.allocationSizeAt(teleporterProcessId) == 0 && teleporterGroups[1] == 6 &&
|
||||
teleporterKernel.processAt(startupTimerId) == &startupTimer->base &&
|
||||
teleporterKernel.processAt(startupKeyboardId) == &startupKeyboard->base &&
|
||||
teleporterKernel.processAt(startupControllerId) == &startupController->base);
|
||||
assert(spawnEgg->recordIndex < fixedMap->entries.size());
|
||||
const auto& startingEggRecord = fixedMap->entries[spawnEgg->recordIndex];
|
||||
const auto* spawnedAvatar = spawnSearchWorld.findItem(1);
|
||||
|
|
@ -302,6 +322,44 @@ int main()
|
|||
assert(spawnedAvatar && spawnedAvatar->itemNumber == 1 &&
|
||||
spawnedAvatar->data.x == spawnEgg->data.x && spawnedAvatar->data.y == spawnEgg->data.y &&
|
||||
spawnedAvatar->data.z == spawnEgg->data.z && spawnedAvatar->data.mapNumber == 1);
|
||||
remorse::LiveFixedMapItems integratedStartupWorld(*stagedItems);
|
||||
assert(integratedStartupWorld.initializeAvatar());
|
||||
remorse::ProcessKernel integratedStartupKernel;
|
||||
remorse::u16 integratedStartupGroups[32]{};
|
||||
for (int reservedSlot = 0; reservedSlot < 3; ++reservedSlot) {
|
||||
integratedStartupKernel.createProcess(1, integratedStartupGroups);
|
||||
}
|
||||
auto* integratedTimer = integratedStartupKernel.createSystemTimerProcess(1, integratedStartupGroups);
|
||||
auto* integratedKeyboard = integratedStartupKernel.createKeyboardProcess(1, integratedStartupGroups);
|
||||
auto* integratedController = integratedStartupKernel.createControllerProcess(1, integratedStartupGroups);
|
||||
assert(remorse::runFreshGameTeleporterStartup(integratedStartupKernel, integratedStartupWorld,
|
||||
1, 0x1e, *typeFlags, integratedStartupGroups));
|
||||
const auto* integratedAvatar = integratedStartupWorld.findItem(1);
|
||||
assert(integratedTimer && integratedKeyboard && integratedController && integratedAvatar &&
|
||||
integratedAvatar->data.x == spawnEgg->data.x && integratedAvatar->data.y == spawnEgg->data.y &&
|
||||
integratedAvatar->data.mapNumber == 1 && integratedStartupGroups[1] == 6 &&
|
||||
integratedStartupKernel.processAt(processIdOf(integratedTimer)) == &integratedTimer->base &&
|
||||
integratedStartupKernel.processAt(processIdOf(integratedKeyboard)) == &integratedKeyboard->base &&
|
||||
integratedStartupKernel.processAt(processIdOf(integratedController)) == &integratedController->base);
|
||||
const auto stagingTeleporter = remorse::findNearbyActiveTeleportEgg(*integratedAvatar,
|
||||
integratedStartupWorld.mapItems(), *typeFlags, 1);
|
||||
const auto levelStartEgg = remorse::findTeleportEgg(*stagedItems, *typeFlags, 0x63);
|
||||
assert(stagingTeleporter && stagingTeleporter->itemNumber == 1598 &&
|
||||
stagingTeleporter->data.shape == 0x0194 && stagingTeleporter->data.frame == 0 &&
|
||||
stagingTeleporter->data.quality == 0x0063 && stagingTeleporter->data.mapNumber == 1 &&
|
||||
levelStartEgg && levelStartEgg->itemNumber == 6812 && levelStartEgg->data.x == 30328 &&
|
||||
levelStartEgg->data.y == 29656 && levelStartEgg->data.z == 16);
|
||||
assert(remorse::runFreshGameTeleporterStartup(integratedStartupKernel, integratedStartupWorld,
|
||||
stagingTeleporter->data.mapNumber,
|
||||
static_cast<remorse::u8>(stagingTeleporter->data.quality & 0xff), *typeFlags,
|
||||
integratedStartupGroups));
|
||||
integratedAvatar = integratedStartupWorld.findItem(1);
|
||||
assert(integratedAvatar && integratedAvatar->data.x == levelStartEgg->data.x &&
|
||||
integratedAvatar->data.y == levelStartEgg->data.y && integratedAvatar->data.z == levelStartEgg->data.z &&
|
||||
integratedAvatar->data.mapNumber == 1 && integratedStartupGroups[1] == 6 &&
|
||||
integratedStartupKernel.processAt(processIdOf(integratedTimer)) == &integratedTimer->base &&
|
||||
integratedStartupKernel.processAt(processIdOf(integratedKeyboard)) == &integratedKeyboard->base &&
|
||||
integratedStartupKernel.processAt(processIdOf(integratedController)) == &integratedController->base);
|
||||
const auto spawnUseCandidates = remorse::itemGrabSearchCandidates(
|
||||
*spawnedAvatar, spawnSearchWorld.mapItems(), *typeFlags);
|
||||
assert(spawnUseCandidates);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue