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
|
|
@ -6,6 +6,7 @@
|
|||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace remorse {
|
||||
|
|
@ -56,6 +57,11 @@ struct TeleporterProcessEntry {
|
|||
u8 extra[0x04];
|
||||
} CR_PACKED;
|
||||
|
||||
struct ClearAvatarInStasisProcessEntry {
|
||||
EntityDispatchEntryBase base;
|
||||
u8 extra[0x01];
|
||||
} CR_PACKED;
|
||||
|
||||
struct AnimPrimitiveProcessEntry {
|
||||
EntityDispatchEntryBase base;
|
||||
u8 extra[0x29];
|
||||
|
|
@ -82,6 +88,9 @@ struct EntityDispatchEntryRuntimeState {
|
|||
} CR_PACKED;
|
||||
CR_PACK_POP
|
||||
|
||||
static_assert(sizeof(ClearAvatarInStasisProcessEntry) == 0x33,
|
||||
"Clear-avatar-stasis process size must match allocation evidence");
|
||||
|
||||
static_assert(sizeof(EntityDispatchEntryBase) == 0x32, "EntityDispatchEntryBase size must match allocation evidence");
|
||||
static_assert(sizeof(StandProcessEntry) == 0x42, "StandProcessEntry size must match allocation evidence");
|
||||
static_assert(sizeof(GravityProcessEntry) == 0x42, "GravityProcessEntry size must match allocation evidence");
|
||||
|
|
@ -127,6 +136,10 @@ public:
|
|||
ControllerProcessEntry* createControllerProcess(u8 activeGroup, u16 (&groupCounts)[32]);
|
||||
TeleporterProcessEntry* createTeleporterProcess(u8 activeGroup, u16 mapNumber, u16 teleportId,
|
||||
u16 (&groupCounts)[32]);
|
||||
TeleporterProcessEntry* createTeleporterProcess(u8 activeGroup, u16 mapNumber, u16 teleportId,
|
||||
u16 (&groupCounts)[32], bool doStasis, bool avatarTeleporting, bool& avatarInStasis);
|
||||
bool runClearAvatarInStasisProcess(u16 processId, bool& avatarInStasis,
|
||||
u16 (&groupCounts)[32]);
|
||||
AnimPrimitiveProcessEntry* createAnimPrimitiveProcess(u8 activeGroup, u16 itemNumber,
|
||||
u16 animationNumber, u8 direction, const AnimationClip& clip, u16 (&groupCounts)[32]);
|
||||
EntityVmContextProcessEntry* createUsecodeProcess(u8 activeGroup, u16 (&groupCounts)[32]);
|
||||
|
|
@ -172,6 +185,8 @@ public:
|
|||
std::size_t capacity() const;
|
||||
|
||||
private:
|
||||
ClearAvatarInStasisProcessEntry* createClearAvatarInStasisProcess(u8 activeGroup,
|
||||
bool& avatarInStasis, u16 (&groupCounts)[32]);
|
||||
void releaseOwnedProcess(u16 id);
|
||||
void refreshItemPresence(u16 itemNumber);
|
||||
void refreshItemProcessType(u16 itemNumber, u16 eventType);
|
||||
|
|
@ -183,12 +198,14 @@ private:
|
|||
std::vector<std::unique_ptr<GravityProcessEntry>> ownedGravityProcesses_;
|
||||
std::vector<std::unique_ptr<AnimPrimitiveProcessEntry>> ownedAnimPrimitiveProcesses_;
|
||||
std::vector<std::unique_ptr<TeleporterProcessEntry>> ownedTeleporterProcesses_;
|
||||
std::vector<std::unique_ptr<ClearAvatarInStasisProcessEntry>> ownedClearAvatarInStasisProcesses_;
|
||||
std::vector<std::unique_ptr<EntityVmContextProcessEntry>> ownedUsecodeProcesses_;
|
||||
std::unique_ptr<SystemTimerProcessEntry> systemTimerProcess_;
|
||||
std::unique_ptr<KeyboardProcessEntry> keyboardProcess_;
|
||||
std::unique_ptr<KeyDaemonProcessEntry> keyDaemonProcess_;
|
||||
std::unique_ptr<ControllerProcessEntry> controllerProcess_;
|
||||
std::vector<u16> keyboardSubscriberIds_;
|
||||
std::vector<std::pair<u16, u16>> processWaits_;
|
||||
std::array<KeyEvent, 32> pendingKeyEvents_{};
|
||||
u8 nextKeyEventOffset_ = 0;
|
||||
u8 keyEventOffset_ = 0;
|
||||
|
|
@ -255,6 +272,11 @@ public:
|
|||
u16 currentMapNumber, const std::vector<ShapeTypeInfo>& shapes);
|
||||
};
|
||||
|
||||
class ClearAvatarInStasisProcess {
|
||||
public:
|
||||
static constexpr u16 vtableOffset = 0x0f5e;
|
||||
};
|
||||
|
||||
class KeyboardProcess {
|
||||
public:
|
||||
static bool handleKeyEvent(KeyboardProcessEntry& process, u16 selector, u16 filter,
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ public:
|
|||
std::optional<std::vector<u16>> hatchGlobEgg(u16 eggItemNumber, const GlobObject& glob,
|
||||
const std::vector<ShapeTypeInfo>& shapes);
|
||||
bool isGlobHatched(u16 eggItemNumber) const;
|
||||
bool setItemShape(u16 itemNumber, u16 shape);
|
||||
bool setItemFrame(u16 itemNumber, u8 frame);
|
||||
bool moveItem(u16 itemNumber, u16 x, u16 y, u8 z);
|
||||
std::optional<std::vector<u16>> grabItem(u16 itemNumber, const std::vector<ShapeTypeInfo>& shapes,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue