Refactor USECODE tooling documentation and enhance map-viewer decompiler
- Updated the USECODE Tool Improvement Plan to focus on the map-viewer decompiler/editor, emphasizing its role as the primary development target for USECODE editing and recompilation. - Revised the tooling comparison document to include the newer map-viewer decompiler, clarifying its purpose and distinguishing it from the Python parser. - Introduced a new ClearAvatarInStasisProcessEntry structure in the entity dispatch entry header, along with related process creation and execution logic in the ProcessKernel. - Implemented the setItemShape method in LiveFixedMapItems to allow dynamic shape updates for items. - Enhanced the teleporter process to handle avatar stasis and integrated it into the game main loop, ensuring proper process management and state handling. - Added tests for the new functionality, including shape setting and teleporter process behavior, to ensure correctness and stability.
This commit is contained in:
parent
0771c86043
commit
6d4972933f
17 changed files with 1868 additions and 114 deletions
|
|
@ -250,14 +250,48 @@ int main()
|
|||
for (int reservedSlot = 0; reservedSlot < 3; ++reservedSlot) {
|
||||
teleporterKernel.createProcess(1, teleporterGroups);
|
||||
}
|
||||
auto* teleporterProcess = teleporterKernel.createTeleporterProcess(1, 1, 0x1e, teleporterGroups);
|
||||
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);
|
||||
assert(!remorse::TeleporterProcess::run(*teleporterProcess, spawnSearchWorld, 2, *typeFlags));
|
||||
assert(spawnSearchWorld.findItem(1)->data.x == 0 && spawnSearchWorld.findItem(1)->data.y == 0);
|
||||
assert(remorse::TeleporterProcess::run(*teleporterProcess, spawnSearchWorld, 1, *typeFlags));
|
||||
teleporterProcess->base.bytes[0x18] |= 4;
|
||||
teleporterKernel.terminateProcess(teleporterProcessId, teleporterGroups);
|
||||
struct TeleporterPassContext {
|
||||
remorse::ProcessKernel& kernel;
|
||||
remorse::LiveFixedMapItems& items;
|
||||
const std::vector<remorse::ShapeTypeInfo>& shapes;
|
||||
remorse::u16 (&groupCounts)[32];
|
||||
bool& avatarInStasis;
|
||||
bool teleported = false;
|
||||
} teleporterPass{teleporterKernel, spawnSearchWorld, *typeFlags, teleporterGroups, avatarInStasis};
|
||||
const auto runTeleporterPass = [](remorse::EntityDispatchEntryBase& entry, void* opaque) {
|
||||
auto& context = *static_cast<TeleporterPassContext*>(opaque);
|
||||
const remorse::u16 processId = static_cast<remorse::u16>(entry.bytes[2] |
|
||||
(static_cast<remorse::u16>(entry.bytes[3]) << 8));
|
||||
if (processId < 3) return;
|
||||
const remorse::u16 vtable = static_cast<remorse::u16>(entry.bytes[0] |
|
||||
(static_cast<remorse::u16>(entry.bytes[1]) << 8));
|
||||
if (vtable == remorse::ClearAvatarInStasisProcess::vtableOffset) {
|
||||
assert(context.kernel.runClearAvatarInStasisProcess(processId,
|
||||
context.avatarInStasis, context.groupCounts));
|
||||
} else if (vtable == remorse::TeleporterProcess::vtableOffset) {
|
||||
const auto& process = *reinterpret_cast<remorse::TeleporterProcessEntry*>(&entry);
|
||||
context.teleported = remorse::TeleporterProcess::run(process, context.items, 1,
|
||||
context.shapes);
|
||||
entry.bytes[0x18] |= 4;
|
||||
context.kernel.terminateProcess(processId, context.groupCounts);
|
||||
}
|
||||
};
|
||||
teleporterKernel.scanRunnableProcesses(1, runTeleporterPass, &teleporterPass);
|
||||
assert(!avatarInStasis && !teleporterPass.teleported &&
|
||||
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);
|
||||
assert(spawnEgg->recordIndex < fixedMap->entries.size());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue